| | |
| | |
|
| | | #代币支付
|
| | | elif TYPE_Price == ShareDefine.TYPE_Price_PayCoin:
|
| | | needMoneyCount = GetPayCoin(curPlayer)
|
| | | needMoneyCount = GetPayCoinTotal(curPlayer)
|
| | |
|
| | | #自定义货币
|
| | | elif TYPE_Price in ShareDefine.TYPE_Price_CurrencyDict:
|
| | |
| | | #代币支付
|
| | | elif type_Price == ShareDefine.TYPE_Price_PayCoin:
|
| | | curPlayerPayCoin = GetPayCoin(curPlayer)
|
| | | if curPlayerPayCoin < price:
|
| | | curPayCoinDay = GetPlayerCurrency(curPlayer, ShareDefine.TYPE_Price_PayCoinDay)
|
| | | payCoinTotal = curPlayerPayCoin + curPayCoinDay
|
| | | if payCoinTotal < price:
|
| | | return False
|
| | | #有足够的钱支付
|
| | | SetPayCoin(curPlayer, curPlayerPayCoin - price)
|
| | | costPayCoinDay = price if (curPayCoinDay >= price) else curPayCoinDay
|
| | | costPayCoin = price
|
| | | if costPayCoinDay:
|
| | | GameWorld.DebugLog("先扣代币时效: curPayCoinDay=%s,price=%s,costPayCoinDay=%s" % (curPayCoinDay, price, costPayCoinDay))
|
| | | SetPlayerCurrency(curPlayer, ShareDefine.TYPE_Price_PayCoinDay, curPayCoinDay - costPayCoinDay)
|
| | | costPayCoin -= costPayCoinDay
|
| | | GameWorld.DebugLog("再扣代币: costPayCoin=%s" % (costPayCoin))
|
| | | #时效不够扣除,再扣非时效
|
| | | if costPayCoin > 0:
|
| | | SetPayCoin(curPlayer, curPlayerPayCoin - costPayCoin)
|
| | |
|
| | | #自定义货币
|
| | | elif type_Price in ShareDefine.TYPE_Price_CurrencyDict:
|
| | |
| | | and costType == ChConfig.Def_Cost_Unknown:
|
| | | #GameWorld.DebugLog("该货币没有指定消费类型不记录!type_Price=%s,costType=%s" % (type_Price, costType))
|
| | | return
|
| | | if type_Price == ShareDefine.TYPE_Price_PayCoin:
|
| | | playerID = curPlayer.GetPlayerID()
|
| | | nowMoney = GetMoneyReal(curPlayer, type_Price)
|
| | | payCoinDay = GetMoney(curPlayer, ShareDefine.TYPE_Price_PayCoinDay)
|
| | | infoDict["PlayerMoneyCount2"] = payCoinDay
|
| | | orderInfo = infoDict.get("orderInfo", "")
|
| | | GameWorld.Log("记录消耗代币: eventName=%s,price=%s,nowMoney=%s,payCoinDay=%s,orderInfo=%s" % (eventName, price, nowMoney, payCoinDay, orderInfo), playerID)
|
| | | GameWorld.AddPlayerRec(playerID, ShareDefine.Def_PlayerRecType_PayCoin, [2, price, nowMoney, payCoinDay], orderInfo, 1)
|
| | | # 流向用 eventName
|
| | | #if eventName:
|
| | | DataRecordPack.DR_UseMoney(curPlayer, eventName, type_Price, price, infoDict) # 流向
|
| | | EventReport.WriteEvent_virtual_resource(curPlayer, type_Price, reason_name, quantity,
|
| | | unitPrice, ShareDefine.Def_UserAction_Money_Use, infoDict)
|
| | | if type_Price == ShareDefine.TYPE_Price_PayCoin:
|
| | | playerID = curPlayer.GetPlayerID()
|
| | | nowMoney = GetMoneyReal(curPlayer, type_Price)
|
| | | orderInfo = infoDict.get("orderInfo", "")
|
| | | GameWorld.Log("记录消耗代币: eventName=%s,price=%s,nowMoney=%s,orderInfo=%s" % (eventName, price, nowMoney, orderInfo), playerID)
|
| | | GameWorld.AddPlayerRec(playerID, ShareDefine.Def_PlayerRecType_PayCoin, [2, price, nowMoney], orderInfo, 1)
|
| | | #===========================================================================
|
| | | # if type_Price == IPY_GameWorld.TYPE_Price_Gold_Money:
|
| | | # EventReport.WriteEvent_virtual_cost(curPlayer, quantity, unitPrice, reason_name)
|
| | |
| | | DataRecordPack.DR_GiveMoneyError(curPlayer, priceType, value, giveType, addDataDict)
|
| | | return
|
| | |
|
| | | # 时效代币后续处理均视为代币,包含系统提示、记录、流向等
|
| | | if priceType == ShareDefine.TYPE_Price_PayCoinDay:
|
| | | priceType = ShareDefine.TYPE_Price_PayCoin
|
| | | |
| | | if isSysHint and priceType != ShareDefine.TYPE_Price_BourseMoney:
|
| | | #通知客户端得到金钱
|
| | | if priceType == ShareDefine.TYPE_Price_PayCoin:
|
| | |
| | | eventName = ChConfig.Def_GetType_Dict[giveType]
|
| | | addDataDict["eventName"] = eventName
|
| | |
|
| | | DataRecordPack.DR_GiveMoney(curPlayer, eventName, priceType, value, addDataDict)
|
| | | EventReport.WriteEvent_virtual_resource(curPlayer, priceType, giveType, 1, value,
|
| | | ShareDefine.Def_UserAction_Money_Get, addDataDict)
|
| | | |
| | | if priceType == ShareDefine.TYPE_Price_PayCoin:
|
| | | playerID = curPlayer.GetPlayerID()
|
| | | nowMoney = GetMoneyReal(curPlayer, priceType)
|
| | | payCoinDay = GetMoney(curPlayer, ShareDefine.TYPE_Price_PayCoinDay)
|
| | | addDataDict["PlayerMoneyCount2"] = payCoinDay
|
| | | orderInfo = addDataDict.get("orderInfo", "")
|
| | | GameWorld.Log("记录获得代币: eventName=%s,value=%s,nowMoney=%s,orderInfo=%s" % (eventName, value, nowMoney, orderInfo), playerID)
|
| | | GameWorld.AddPlayerRec(playerID, ShareDefine.Def_PlayerRecType_PayCoin, [1, value, nowMoney], orderInfo, 1)
|
| | | GameWorld.Log("记录获得代币: eventName=%s,value=%s,nowMoney=%s,payCoinDay=%s,orderInfo=%s" % (eventName, value, nowMoney, payCoinDay, orderInfo), playerID)
|
| | | GameWorld.AddPlayerRec(playerID, ShareDefine.Def_PlayerRecType_PayCoin, [1, value, nowMoney, payCoinDay], orderInfo, 1)
|
| | | |
| | | DataRecordPack.DR_GiveMoney(curPlayer, eventName, priceType, value, addDataDict)
|
| | | EventReport.WriteEvent_virtual_resource(curPlayer, priceType, giveType, 1, value,
|
| | | ShareDefine.Def_UserAction_Money_Get, addDataDict)
|
| | | #===============================================================================
|
| | | # reason_name = "Unknown" if not giveType else giveType
|
| | | # eventName = reason_name
|
| | |
| | | def SetChatBubbleBox(curPlayer, value): return curPlayer.SetExAttr10(value, False, True)
|
| | |
|
| | | ##游戏充值支付代币
|
| | | def GetPayCoinTotal(curPlayer): return GetPayCoin(curPlayer) + GetPlayerCurrency(curPlayer, ShareDefine.TYPE_Price_PayCoinDay)
|
| | | def GetPayCoin(curPlayer): return curPlayer.GetExAttr11()
|
| | | def SetPayCoin(curPlayer, value): return curPlayer.SetExAttr11(min(value, ChConfig.Def_UpperLimit_DWord), False, False)
|
| | | def PayCoinOnDay(curPlayer):
|
| | | # 每日过天清除时效代币
|
| | | payCoinDay = GetPlayerCurrency(curPlayer, ShareDefine.TYPE_Price_PayCoinDay)
|
| | | if payCoinDay > 0:
|
| | | PayMoney(curPlayer, ShareDefine.TYPE_Price_PayCoin, payCoinDay, "PayCoinOnDay")
|
| | | return
|
| | |
|
| | | ## 获取佩戴的称号ID
|
| | | def GetTitleID(curPlayer):
|