From 8e25bc7b9ca60ea789374fa70e0ddae4a5adc79a Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期四, 28 十二月 2023 16:41:57 +0800
Subject: [PATCH] 10077 游戏代币方案

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerDailyGiftbag.py |    3 
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/PyNetPack.ini                       |    6 
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetPack.py               |   78 +++++++++++++
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/DataRecordPack.py            |   12 +
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/SetMoney.py      |    2 
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCoin.py         |   90 ++++++++++++++
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/CommFunc.py                  |    8 +
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFlashGiftbag.py |    3 
 ServerPython/CoreServerGroup/GameServer/Script/ChPyNetPack.py                                    |   78 +++++++++++++
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerControl.py      |   34 +++++
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py                  |    5 
 11 files changed, 305 insertions(+), 14 deletions(-)

diff --git a/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetPack.py b/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetPack.py
index 3014e24..122e1d4 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetPack.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetPack.py
@@ -4723,6 +4723,84 @@
 
 
 #------------------------------------------------------
+# A1 25 代币购买充值商品编号商品 #tagCMCoinBuyOrderInfo
+
+class  tagCMCoinBuyOrderInfo(Structure):
+    Head = tagHead()
+    AppIDLen = 0    #(BYTE AppIDLen)
+    AppID = ""    #(String AppID)
+    OrderInfoLen = 0    #(BYTE OrderInfoLen)
+    OrderInfo = ""    #(String OrderInfo)//商品编号
+    data = None
+
+    def __init__(self):
+        self.Clear()
+        self.Head.Cmd = 0xA1
+        self.Head.SubCmd = 0x25
+        return
+
+    def ReadData(self, _lpData, _pos=0, _Len=0):
+        self.Clear()
+        _pos = self.Head.ReadData(_lpData, _pos)
+        self.AppIDLen,_pos = CommFunc.ReadBYTE(_lpData, _pos)
+        self.AppID,_pos = CommFunc.ReadString(_lpData, _pos,self.AppIDLen)
+        self.OrderInfoLen,_pos = CommFunc.ReadBYTE(_lpData, _pos)
+        self.OrderInfo,_pos = CommFunc.ReadString(_lpData, _pos,self.OrderInfoLen)
+        return _pos
+
+    def Clear(self):
+        self.Head = tagHead()
+        self.Head.Clear()
+        self.Head.Cmd = 0xA1
+        self.Head.SubCmd = 0x25
+        self.AppIDLen = 0
+        self.AppID = ""
+        self.OrderInfoLen = 0
+        self.OrderInfo = ""
+        return
+
+    def GetLength(self):
+        length = 0
+        length += self.Head.GetLength()
+        length += 1
+        length += len(self.AppID)
+        length += 1
+        length += len(self.OrderInfo)
+
+        return length
+
+    def GetBuffer(self):
+        data = ''
+        data = CommFunc.WriteString(data, self.Head.GetLength(), self.Head.GetBuffer())
+        data = CommFunc.WriteBYTE(data, self.AppIDLen)
+        data = CommFunc.WriteString(data, self.AppIDLen, self.AppID)
+        data = CommFunc.WriteBYTE(data, self.OrderInfoLen)
+        data = CommFunc.WriteString(data, self.OrderInfoLen, self.OrderInfo)
+        return data
+
+    def OutputString(self):
+        DumpString = '''
+                                Head:%s,
+                                AppIDLen:%d,
+                                AppID:%s,
+                                OrderInfoLen:%d,
+                                OrderInfo:%s
+                                '''\
+                                %(
+                                self.Head.OutputString(),
+                                self.AppIDLen,
+                                self.AppID,
+                                self.OrderInfoLen,
+                                self.OrderInfo
+                                )
+        return DumpString
+
+
+m_NAtagCMCoinBuyOrderInfo=tagCMCoinBuyOrderInfo()
+ChNetPackDict[eval("0x%02x%02x"%(m_NAtagCMCoinBuyOrderInfo.Head.Cmd,m_NAtagCMCoinBuyOrderInfo.Head.SubCmd))] = m_NAtagCMCoinBuyOrderInfo
+
+
+#------------------------------------------------------
 # A1 20 货币兑换 #tagCMMoneyExchange
 
 class  tagCMMoneyExchange(Structure):
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/PyNetPack.ini b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/PyNetPack.ini
index 07ad34e..5f5eea1 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/PyNetPack.ini
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/PyNetPack.ini
@@ -1495,12 +1495,16 @@
 Writer = hxp
 Releaser = hxp
 RegType = 0
-RegisterPackCount = 1
+RegisterPackCount = 2
 
 PacketCMD_1=0xA1
 PacketSubCMD_1=0x23
 PacketCallFunc_1=OnQueryCoinToGoldCount
 
+PacketCMD_2=0xA1
+PacketSubCMD_2=0x25
+PacketCallFunc_2=OnCoinBuyOrderInfo
+
 ;首充
 [PlayerGoldGift]
 ScriptName = Player\PlayerGoldGift.py
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
index c5cea58..bc1be34 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
@@ -6049,4 +6049,7 @@
 CoinType_Buy, # 直购,非直接充仙玉的,如RMB直接购买某个物品或激活某个功能 1
 CoinType_ItemSuper, # 使用超级现金卡物品,类充值仙玉效果,但是有某些功能上的限制,一般是bt版本赠送 2
 CoinType_ItemCash, # 使用现金卡物品,类充值仙玉效果,但是有某些功能上的限制,一般是bt版本赠送 3
-) = range(4)
+CoinType_4,
+CoinType_5,
+CoinType_ExchangePayCoin, # 代表转换 6
+) = range(7)
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetPack.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetPack.py
index 3014e24..122e1d4 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetPack.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetPack.py
@@ -4723,6 +4723,84 @@
 
 
 #------------------------------------------------------
+# A1 25 代币购买充值商品编号商品 #tagCMCoinBuyOrderInfo
+
+class  tagCMCoinBuyOrderInfo(Structure):
+    Head = tagHead()
+    AppIDLen = 0    #(BYTE AppIDLen)
+    AppID = ""    #(String AppID)
+    OrderInfoLen = 0    #(BYTE OrderInfoLen)
+    OrderInfo = ""    #(String OrderInfo)//商品编号
+    data = None
+
+    def __init__(self):
+        self.Clear()
+        self.Head.Cmd = 0xA1
+        self.Head.SubCmd = 0x25
+        return
+
+    def ReadData(self, _lpData, _pos=0, _Len=0):
+        self.Clear()
+        _pos = self.Head.ReadData(_lpData, _pos)
+        self.AppIDLen,_pos = CommFunc.ReadBYTE(_lpData, _pos)
+        self.AppID,_pos = CommFunc.ReadString(_lpData, _pos,self.AppIDLen)
+        self.OrderInfoLen,_pos = CommFunc.ReadBYTE(_lpData, _pos)
+        self.OrderInfo,_pos = CommFunc.ReadString(_lpData, _pos,self.OrderInfoLen)
+        return _pos
+
+    def Clear(self):
+        self.Head = tagHead()
+        self.Head.Clear()
+        self.Head.Cmd = 0xA1
+        self.Head.SubCmd = 0x25
+        self.AppIDLen = 0
+        self.AppID = ""
+        self.OrderInfoLen = 0
+        self.OrderInfo = ""
+        return
+
+    def GetLength(self):
+        length = 0
+        length += self.Head.GetLength()
+        length += 1
+        length += len(self.AppID)
+        length += 1
+        length += len(self.OrderInfo)
+
+        return length
+
+    def GetBuffer(self):
+        data = ''
+        data = CommFunc.WriteString(data, self.Head.GetLength(), self.Head.GetBuffer())
+        data = CommFunc.WriteBYTE(data, self.AppIDLen)
+        data = CommFunc.WriteString(data, self.AppIDLen, self.AppID)
+        data = CommFunc.WriteBYTE(data, self.OrderInfoLen)
+        data = CommFunc.WriteString(data, self.OrderInfoLen, self.OrderInfo)
+        return data
+
+    def OutputString(self):
+        DumpString = '''
+                                Head:%s,
+                                AppIDLen:%d,
+                                AppID:%s,
+                                OrderInfoLen:%d,
+                                OrderInfo:%s
+                                '''\
+                                %(
+                                self.Head.OutputString(),
+                                self.AppIDLen,
+                                self.AppID,
+                                self.OrderInfoLen,
+                                self.OrderInfo
+                                )
+        return DumpString
+
+
+m_NAtagCMCoinBuyOrderInfo=tagCMCoinBuyOrderInfo()
+ChNetPackDict[eval("0x%02x%02x"%(m_NAtagCMCoinBuyOrderInfo.Head.Cmd,m_NAtagCMCoinBuyOrderInfo.Head.SubCmd))] = m_NAtagCMCoinBuyOrderInfo
+
+
+#------------------------------------------------------
 # A1 20 货币兑换 #tagCMMoneyExchange
 
 class  tagCMMoneyExchange(Structure):
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/CommFunc.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/CommFunc.py
index 2ef5864..ce9f7be 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/CommFunc.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/CommFunc.py
@@ -592,6 +592,14 @@
         
     return ""
 
+def CoinToYuan(orderCoin):
+    '''分转化为元
+    '''
+    yuan = orderCoin / 100.0
+    if str(yuan).endswith(".0"):
+        return int(yuan)
+    return yuan
+
 def RMBToCoin(floatRMB):
     ''' 元转为分,统一函数,方便修改及搜索
     @param floatRMB: 单位元,float 类型,支持 RMB 或 美元
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/DataRecordPack.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/DataRecordPack.py
index 39190d3..b828710 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/DataRecordPack.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/DataRecordPack.py
@@ -797,7 +797,11 @@
     #银票
     elif moneyType == IPY_GameWorld.TYPE_Price_Silver_Paper:
         SendEventPack("UseSilverPaper", dataDict, curPlayer)
-
+        
+    #代币
+    elif moneyType == ShareDefine.TYPE_Price_PayCoin:
+        SendEventPack("UsePayCoin", dataDict, curPlayer)
+        
     #自定义货币
     elif moneyType in ShareDefine.TYPE_Price_CurrencyDict:
         SendEventPack("UseCurrency_%s" % moneyType, dataDict, curPlayer)
@@ -847,7 +851,11 @@
     #银票
     elif moneyType == IPY_GameWorld.TYPE_Price_Silver_Paper:
         SendEventPack("GiveSilverPaper", dataDict, curPlayer)
-    
+        
+    #代币
+    elif moneyType == ShareDefine.TYPE_Price_PayCoin:
+        SendEventPack("GivePayCoin", dataDict, curPlayer)
+        
     #自定义货币
     elif moneyType in ShareDefine.TYPE_Price_CurrencyDict:
         SendEventPack("GiveCurrency_%s" % moneyType, dataDict)
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/SetMoney.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/SetMoney.py
index 3b28e97..09df85b 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/SetMoney.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/SetMoney.py
@@ -65,7 +65,7 @@
         GameWorld.DebugAnswer(curPlayer, Lang.GBText("参数不正确"))
         return
     #钱币类型范围
-    if moneyType not in [1, 2, 3, 4] and moneyType not in ShareDefine.TYPE_Price_CurrencyDict:
+    if moneyType not in [1, 2, 3, 4] and moneyType not in ShareDefine.MoneyNameDict:
         GameWorld.DebugAnswer(curPlayer, Lang.GBText("钱币类型不正确"))
         return
     #0文不处理
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCoin.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCoin.py
index fef61fd..0d336b6 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCoin.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCoin.py
@@ -70,6 +70,16 @@
 import time
 import copy
 
+# 充值订单类型
+PayOrderTypeList = (
+PayOrderType_RMB, # 人民币 1
+PayOrderType_USD, # 美元 2
+PayOrderType_VND, # 越南盾 3
+PayOrderType_Soha, # soha平台币 4
+PayOrderType_BuyOrder, # 使用订单价值对应货币支付 5
+PayOrderType_PayCoin, # 代币 6
+) = range(1, 1 + 6)
+
 # 充值类型定义
 PayType_Gold = 2  # 常规仙玉充值
 PayType_GoldPlus = 3  # 至尊仙玉充值
@@ -238,6 +248,64 @@
     Sync_CoinToGoldCountInfo(curPlayer, [recordID] if recordID else [])
     return
 
+#// A1 25 代币购买充值商品编号商品 #tagCMCoinBuyOrderInfo
+#
+#struct    tagCMCoinBuyOrderInfo
+#{
+#    tagHead        Head;
+#    BYTE        AppIDLen;
+#    char        AppID[AppIDLen];
+#    BYTE        OrderInfoLen;
+#    char        OrderInfo[OrderInfoLen];    //商品编号
+#};
+def OnCoinBuyOrderInfo(index, clientData, tick):
+    curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
+    appID = clientData.AppID
+    orderInfo = clientData.OrderInfo
+    
+    ipyData = IpyGameDataPY.GetIpyGameData("OrderInfo", orderInfo, appID)
+    if not ipyData:
+        return
+    orderCoin = CommFunc.RMBToCoin(ipyData.GetPayRMBNum())    
+    cPlayerCoin = CPY_PlayerCoinToGold()
+    cPlayerCoin.useCoin = orderCoin
+    cPlayerCoin.orderInfo = orderInfo
+    cPlayerCoin.appID = appID
+    cPlayerCoin.orderID = ""
+    PlayerCoinToGold(curPlayer, cPlayerCoin, "CoinBuyOrderInfo", PayOrderType_PayCoin)
+    return
+
+def ExchangePayCoin(curPlayer, errorInfo, addDRDict):
+    ''' 充值兑换成代币
+                一般可用于一些充值订单兑换游戏功能时,游戏功能有限制如限购,
+                该充值视为成功,并转化为对应代币,可以理解为类似充值点券,代币可用于下次充值时支付;
+    '''
+    orderInfo = addDRDict.get("orderInfo", "")
+    orderCoin = addDRDict.get("orderCoin", 0)
+    payOrderType = addDRDict.get("payOrderType", PayOrderType_RMB)
+    if not orderCoin or not orderInfo:
+        DataRecordPack.DR_CTGError(curPlayer, errorInfo, addDRDict)
+        return
+    eventName = addDRDict.get("eventName", "ExchangePayCoin")
+    playerID = curPlayer.GetPlayerID()
+    befPayCoin = PlayerControl.GetPayCoin(curPlayer)
+    drDict = {ChConfig.Def_Give_Reason_SonKey:orderInfo, "payOrderType":payOrderType}
+    PlayerControl.GiveMoney(curPlayer, ShareDefine.TYPE_Price_PayCoin, orderCoin, eventName, drDict)
+    aftPayCoin = PlayerControl.GetPayCoin(curPlayer)
+    GameWorld.Log("充值转化为代币: orderInfo=%s,orderCoin=%s,payOrderType=%s,eventName=%s,befPayCoin=%s,aftPayCoin=%s,errorInfo=%s" 
+                  % (orderInfo, orderCoin, payOrderType, eventName, befPayCoin, aftPayCoin, errorInfo), playerID)
+    
+    addItemList = []
+    paramList = [orderInfo, CommFunc.CoinToYuan(orderCoin)]
+    PlayerControl.SendMailByKey("ExchangeToPayCoin", [playerID], addItemList, paramList)
+    
+    if payOrderType != PayOrderType_PayCoin:
+        serverDay = GameWorld.GetGameWorld().GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_ServerDay) + 1
+        addDRDict.update({"coinType":ChConfig.CoinType_ExchangePayCoin, "PayCoin":[befPayCoin, aftPayCoin], 
+                          "VIPLv":curPlayer.GetVIPLv(), "ServerDay":serverDay, "eventName":eventName})
+        DataRecordPack.DR_CTGOK(curPlayer, addDRDict)
+    return
+
 ## 创角赠送
 #  @param curPlayer 玩家实例
 #  @return None
@@ -312,7 +380,7 @@
 # @param useCoin 使用的点卷
 # @param eventName 兑换事件名
 # @return None
-def PlayerCoinToGold(curPlayer, chargeInfo, eventName):
+def PlayerCoinToGold(curPlayer, chargeInfo, eventName, payOrderType=PayOrderType_RMB):
     ## 按商品编号充值
     orderCoin = chargeInfo.GetCoin() # 金额 已乘以100  人民币单位为分
     #notePrizeCoin = chargeInfo.GetPrizeCoin()
@@ -358,6 +426,15 @@
     # 港台0.1折特殊处理:游戏内部逻辑按原版原价处理,所以验证完金额后需要乘100
     orderCoin *= 100
     addDRDict["orderCoin"] = orderCoin
+    
+    if payOrderType == PayOrderType_PayCoin:
+        #直接扣,类似充值扣钱,这里是发放物品,可能会有发放失败的当做 CTGError 处理
+        if not PlayerControl.PayMoney(curPlayer, ShareDefine.TYPE_Price_PayCoin, orderCoin, eventName, {ChConfig.Def_Cost_Reason_SonKey:orderInfo}):
+            GameWorld.ErrLog("代币不足! appID=%s,orderInfo=%s,orderCoin=%s,curPayCoin=%s" 
+                             % (appID, orderInfo, orderCoin, PlayerControl.GetPayCoin(curPlayer)), curPlayer.GetPlayerID())
+            return
+        
+    addDRDict["payOrderType"] = payOrderType
     
     addGold, prizeGold, giveItemList, ctgIpyData = 0, 0, [], None
     
@@ -418,7 +495,7 @@
     if totalBuyCountLimit:
         addDRDict.update({"totalBuyCountLimit":totalBuyCountLimit, "totalBuyCount":totalBuyCount})
         if totalBuyCount >= totalBuyCountLimit:
-            DataRecordPack.DR_CTGError(curPlayer, "Pay count limit total!totalBuyCount=%s" % totalBuyCount, addDRDict)
+            ExchangePayCoin(curPlayer, "Pay count limit total!totalBuyCount=%s" % totalBuyCount, addDRDict)
             return        
     
     dailyBuyCountLimit = ipyData.GetDailyBuyCount()
@@ -426,7 +503,7 @@
     if dailyBuyCountLimit:
         addDRDict.update({"dailyBuyCountLimit":dailyBuyCountLimit, "todayBuyCount":todayBuyCount})
         if todayBuyCount >= dailyBuyCountLimit:
-            DataRecordPack.DR_CTGError(curPlayer, "Pay count limit today!todayBuyCount=%s" % todayBuyCount, addDRDict)
+            ExchangePayCoin(curPlayer, "Pay count limit today!todayBuyCount=%s" % todayBuyCount, addDRDict)
             return
         
     weekBuyCountLimit = ipyData.GetWeekBuyCount()
@@ -434,7 +511,7 @@
     if weekBuyCountLimit:
         addDRDict.update({"weekBuyCountLimit":weekBuyCountLimit, "weekBuyCount":weekBuyCount})
         if weekBuyCount >= weekBuyCountLimit:
-            DataRecordPack.DR_CTGError(curPlayer, "Pay count limit week!weekBuyCount=%s" % weekBuyCount, addDRDict)
+            ExchangePayCoin(curPlayer, "Pay count limit week!weekBuyCount=%s" % weekBuyCount, addDRDict)
             return
         
     monthBuyCountLimit = ipyData.GetMonthBuyCount()
@@ -442,7 +519,7 @@
     if monthBuyCountLimit:
         addDRDict.update({"monthBuyCountLimit":monthBuyCountLimit, "monthBuyCount":monthBuyCount})
         if monthBuyCount >= monthBuyCountLimit:
-            DataRecordPack.DR_CTGError(curPlayer, "Pay count limit month!monthBuyCount=%s" % monthBuyCount, addDRDict)
+            ExchangePayCoin(curPlayer, "Pay count limit month!monthBuyCount=%s" % monthBuyCount, addDRDict)
             return
         
     totalBuyCountUpd = min(totalBuyCount + 1, ChConfig.Def_UpperLimit_DWord)
@@ -510,6 +587,9 @@
         return
     
     isRealMoney = True if addDRDict.get("orderID") else False # 是否真实货币充值,仅真实货币充值订单有orderID,后台充值的不算真实货币充值
+    payOrderType = addDRDict.get("payOrderType", PayOrderType_RMB)
+    if payOrderType == PayOrderType_PayCoin:
+        isRealMoney = True # 代币充值在游戏内容上算真实充值
     ctgRealToday = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CTGRealToday) # 当日真实货币充值Coin数 ,不含后台充值- 今日
     ctgRealTotal = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CTGRealTotal) # 累计真实货币充值Coin数 ,不包后台充值 - 总计
     ctgRealFirstTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CTGRealFirstTime) # 首次真实货币充值时间戳
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 eb86a44..f45de84 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerControl.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerControl.py
@@ -2833,6 +2833,10 @@
     elif TYPE_Price == IPY_GameWorld.TYPE_Price_Silver_Paper:
         return curPlayer.GetSilverPaper()
     
+    #代币
+    elif TYPE_Price == ShareDefine.TYPE_Price_PayCoin:
+        return GetPayCoin(curPlayer)
+    
     #自定义货币
     elif TYPE_Price in ShareDefine.TYPE_Price_CurrencyDict:
         return GetPlayerCurrency(curPlayer, TYPE_Price)
@@ -2873,6 +2877,10 @@
     #银票
     elif moneyType == IPY_GameWorld.TYPE_Price_Silver_Paper:
         curPlayer.SetSilverPaper(value)
+        
+    #代币
+    elif moneyType == ShareDefine.TYPE_Price_PayCoin:
+        SetPayCoin(curPlayer, value)
         
     #自定义货币
     elif moneyType in ShareDefine.TYPE_Price_CurrencyDict:
@@ -3009,6 +3017,10 @@
     elif TYPE_Price == IPY_GameWorld.TYPE_Price_Silver_Paper:
         needMoneyCount = curPlayer.GetSilverPaper()
         notifyCode = "SilverPaperErr"
+        
+    #代币支付
+    elif TYPE_Price == ShareDefine.TYPE_Price_PayCoin:
+        needMoneyCount = GetPayCoin(curPlayer)
         
     #自定义货币
     elif TYPE_Price in ShareDefine.TYPE_Price_CurrencyDict:
@@ -3168,6 +3180,15 @@
             return False
         #有足够的钱支付
         curPlayer.SetSilverPaper(curPlayerSilverPaper - price)
+        
+    #代币支付
+    elif type_Price == ShareDefine.TYPE_Price_PayCoin:
+        curPlayerPayCoin = GetPayCoin(curPlayer)
+        if curPlayerPayCoin < price:
+            return False
+        #有足够的钱支付
+        SetPayCoin(curPlayer, curPlayerPayCoin - price)
+        
     #自定义货币
     elif type_Price in ShareDefine.TYPE_Price_CurrencyDict:
         curCurrency = GetPlayerCurrency(curPlayer, type_Price)
@@ -3253,7 +3274,7 @@
     #===========================================================================
     
     # 除钻石及绑钻外,未指定操作类型的不记录
-    if type_Price not in [IPY_GameWorld.TYPE_Price_Gold_Money, IPY_GameWorld.TYPE_Price_Gold_Paper] \
+    if type_Price not in [IPY_GameWorld.TYPE_Price_Gold_Money, IPY_GameWorld.TYPE_Price_Gold_Paper, ShareDefine.TYPE_Price_PayCoin] \
         and costType == ChConfig.Def_Cost_Unknown:
         #GameWorld.DebugLog("该货币没有指定消费类型不记录!type_Price=%s,costType=%s" % (type_Price, costType))
         return
@@ -3432,7 +3453,10 @@
             return
         
         curPlayer.SetSilverPaper(curPlayer.GetSilverPaper() + value)
-
+        
+    elif priceType == ShareDefine.TYPE_Price_PayCoin:
+        SetPayCoin(curPlayer, GetPayCoin(curPlayer) + value)
+        
     #自定义货币
     elif priceType in ShareDefine.TYPE_Price_CurrencyDict:
         curCurrency = GetPlayerCurrency(curPlayer, priceType)
@@ -3556,6 +3580,8 @@
             #超过金钱上限
             NotifyCode(curPlayer, "MoneyIsFull", [priceType])
             return False
+    elif priceType == ShareDefine.TYPE_Price_PayCoin:
+        pass
     elif priceType in ShareDefine.TYPE_Price_CurrencyDict:
         curCurrency = GetPlayerCurrency(curPlayer, priceType)
         if curCurrency + value > ChConfig.Def_UpperLimit_DWord:
@@ -6280,6 +6306,10 @@
 def GetChatBubbleBox(curPlayer): return curPlayer.GetExAttr10()
 def SetChatBubbleBox(curPlayer, value): return curPlayer.SetExAttr10(value, False, True)
 
+##游戏充值支付代币
+def GetPayCoin(curPlayer): return curPlayer.GetExAttr11()
+def SetPayCoin(curPlayer, value): return curPlayer.SetExAttr11(min(value, ChConfig.Def_UpperLimit_DWord), False, False)
+
 ##伴侣
 def GetCoupleID(curPlayer):
     coupleInfo = GetCoupleInfo(curPlayer.GetPlayerID())
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerDailyGiftbag.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerDailyGiftbag.py
index 16c97b7..1ae2cea 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerDailyGiftbag.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerDailyGiftbag.py
@@ -28,6 +28,7 @@
 import GameWorld
 import ChConfig
 import CommFunc
+import PlayerCoin
 
 def OnPlayerLogin(curPlayer):
     __CheckPlayerDailyGiftbagAction(curPlayer)
@@ -122,7 +123,7 @@
         addDRDict.update({"buyCountLimit":buyCountLimit, "buyCount":buyCount})
         if buyCount >= buyCountLimit:
             if isCTG:
-                DataRecordPack.DR_CTGError(curPlayer, "DailyGiftbag Pay count limit !buyCount=%s,buyCountLimit=%s" 
+                PlayerCoin.ExchangePayCoin(curPlayer, "DailyGiftbag Pay count limit !buyCount=%s,buyCountLimit=%s" 
                                            % (buyCount, buyCountLimit), addDRDict)
             return
     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_DailyGiftbagBuyCount % giftbagID, buyCount + 1)
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFlashGiftbag.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFlashGiftbag.py
index 2e22b00..b6ef8ab 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFlashGiftbag.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFlashGiftbag.py
@@ -27,6 +27,7 @@
 import GameWorld
 import ChConfig
 import CommFunc
+import PlayerCoin
 
 
 def GetGiftbagTypeList(cfgID, dayIndex, woldLV):
@@ -165,7 +166,7 @@
         if buyCountLimit:
             addDRDict.update({"buyCountLimit":buyCountLimit, "buyCount":buyCount})
             if buyCount >= buyCountLimit:
-                DataRecordPack.DR_CTGError(curPlayer, "FlashGiftbag Pay count limit !buyCount=%s,buyCountLimit=%s" 
+                PlayerCoin.ExchangePayCoin(curPlayer, "FlashGiftbag Pay count limit !buyCount=%s,buyCountLimit=%s" 
                                            % (buyCount, buyCountLimit), addDRDict)
                 return
         PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FlashGiftbagBuyCount % (actNum, giftbagID), buyCount + 1)

--
Gitblit v1.8.0