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/PlayerControl.py | 48 ++++++++++++++++++++++++++++++++++++++++++++---- 1 files changed, 44 insertions(+), 4 deletions(-) diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerControl.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerControl.py index fa809f8..3f8a707 100644 --- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerControl.py +++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerControl.py @@ -3016,14 +3016,41 @@ GameWorld.Log("付费金钱异常 TYPE_Price = %s" % (TYPE_Price), curPlayer.GetPlayerID()) return False + if needMoneyCount < Price: + lackPrice = Price - needMoneyCount # 还缺多少钱 + tagMoneyInfo = GetEqualMoneyInfo(TYPE_Price, lackPrice) + if tagMoneyInfo: + tagMoneyType, tagMoneyValue = tagMoneyInfo + if HaveMoney(curPlayer, tagMoneyType, tagMoneyValue, False): + GameWorld.DebugLog("HaveMoney可使用等价货币补足扣除: TYPE_Price=%s, Price=%s, lackPrice=%s, tagMoneyType=%s, tagMoneyValue=%s" + % (TYPE_Price, Price, lackPrice, tagMoneyType, tagMoneyValue), curPlayer.GetPlayerID()) + return True + #---钱不够 返回假如果需要提示的话 提示信息--- if needMoneyCount < Price: if needNotify and notifyCode: NotifyCode(curPlayer, notifyCode) + GameWorld.DebugLog("货币不足: TYPE_Price=%s, Price=%s, curMoneyCount=%s" % (TYPE_Price, Price, needMoneyCount)) return False return True +def GetEqualMoneyInfo(moneyType, needValue): + equalMoneyInfo = IpyGameDataPY.GetFuncEvalCfg("EqualValueMoney", 2, {}) + if str(moneyType) not in equalMoneyInfo: + return + tagMoneyType = equalMoneyInfo[str(moneyType)] + exchangeMoneyInfo = IpyGameDataPY.GetFuncEvalCfg("EqualValueMoney", 1, {}) + if str(tagMoneyType) not in exchangeMoneyInfo: + return + exchangeInfo = exchangeMoneyInfo[str(tagMoneyType)] + if moneyType != exchangeInfo[0]: + return + multiple = exchangeInfo[1] + tagMoneyValue = int(math.ceil(needValue / float(multiple))) + #GameWorld.DebugLog("等价货币信息: moneyType=%s,needValue=%s,multiple=%s,tagMoneyType=%s,tagMoneyValue=%s" + # % (moneyType, needValue, multiple, tagMoneyType, tagMoneyValue)) + return tagMoneyType, tagMoneyValue #--------------------------------------------------------------------- ##玩家是否有钱款 @@ -3086,6 +3113,7 @@ if price < 0: GameWorld.Log('###---扣钱异常 = %s' % (price), curPlayer.GetPlayerID()) return False + lostMoney = price #20190917 恢复绑玉 # if type_Price == IPY_GameWorld.TYPE_Price_Gold_Paper: @@ -3143,19 +3171,31 @@ elif type_Price in ShareDefine.TYPE_Price_CurrencyDict: curCurrency = GetPlayerCurrency(curPlayer, type_Price) if curCurrency < price: - return False + lostMoney = curCurrency + lackPrice = price - curCurrency # 还缺多少钱 + tagMoneyInfo = GetEqualMoneyInfo(type_Price, lackPrice) + if tagMoneyInfo: + tagMoneyType, tagMoneyValue = tagMoneyInfo + if not PayMoney(curPlayer, tagMoneyType, tagMoneyValue, costType, infoDict, quantity, costVIPGold, isNotify, isMinus): + #GameWorld.Log("等价货币也不足") + return False + GameWorld.Log("等价货币补足扣除: type_Price%s, price=%s, curCurrency=%s, lackPrice=%s, tagMoneyType=%s, tagMoneyValue=%s" + % (type_Price, price, curCurrency, lackPrice, tagMoneyType, tagMoneyValue), curPlayer.GetPlayerID()) + else: + #GameWorld.Log("没有等价货币,无法扣除") + return False #有足够的钱支付 - SetPlayerCurrency(curPlayer, type_Price, curCurrency - price) + SetPlayerCurrency(curPlayer, type_Price, curCurrency - lostMoney) else: GameWorld.Log("付费金钱异常 type_Price = %s" % (type_Price), curPlayer.GetPlayerID()) return False #付款以后后续操作 - __PayMoneyAfter(curPlayer, type_Price, price, costType, infoDict, quantity, costVIPGold) + __PayMoneyAfter(curPlayer, type_Price, lostMoney, costType, infoDict, quantity, costVIPGold) #通知客户端失去金钱 if isNotify: - NotifyCode(curPlayer, "LostMoney", [type_Price, price]) + NotifyCode(curPlayer, "LostMoney", [type_Price, lostMoney]) return True ## 付款以后后续操作 -- Gitblit v1.8.0