From 32f4634e85aa6a476ee6e911cc5a81a64c912bd6 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期三, 20 九月 2023 17:52:44 +0800
Subject: [PATCH] 9943 【主干】【BT0.1】货币A补

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/ChPlayer.py |   34 ++++++++++++++++++++++++++++++++++
 1 files changed, 34 insertions(+), 0 deletions(-)

diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/ChPlayer.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/ChPlayer.py
index 6f2ab3a..5f7dd80 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/ChPlayer.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/ChPlayer.py
@@ -262,6 +262,40 @@
     
     return
 
+#// A1 20 货币兑换 #tagCMMoneyExchange
+#
+#struct    tagCMMoneyExchange
+#{
+#    tagHead         Head;
+#    BYTE        SrcMoneyType;    // 源货币类型
+#    BYTE        TagMoneyType;    // 目标货币类型
+#    DWORD        ExchangeValue;    // 兑换数量(消耗源货币的数量)
+#};
+def OnMoneyExchange(index, clientData, tick):
+    curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
+    srcMoneyType = clientData.SrcMoneyType
+    tagMoneyType = clientData.TagMoneyType
+    exchangeValue = clientData.ExchangeValue
+    
+    exchangeMoneyInfo = IpyGameDataPY.GetFuncEvalCfg("EqualValueMoney", 1, {})
+    if str(srcMoneyType) not in exchangeMoneyInfo:
+        return
+    exchangeInfo = exchangeMoneyInfo[str(srcMoneyType)]
+    if tagMoneyType != exchangeInfo[0]:
+        return
+    multiple = exchangeInfo[1]
+    if exchangeValue <= 0:
+        return
+    
+    if not PlayerControl.PayMoney(curPlayer, srcMoneyType, exchangeValue, "MoneyExchange"):
+        return
+    
+    tagMoneyAdd = exchangeValue * multiple
+    PlayerControl.GiveMoney(curPlayer, tagMoneyType, tagMoneyAdd, "MoneyExchange")
+    GameWorld.Log("货币兑换: srcMoneyType=%s,exchangeValue=%s,tagMoneyType=%s,tagMoneyAdd=%s" 
+                  % (srcMoneyType, exchangeValue, tagMoneyType, tagMoneyAdd), curPlayer.GetPlayerID())
+    return
+
 #// A1 21 转职业 #tagCMChangeJob
 #
 #struct    tagCMChangeJob

--
Gitblit v1.8.0