From 8532cf79b7fec586561bea3cc05d58fd7d5c9b52 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期四, 28 十二月 2023 16:24:08 +0800
Subject: [PATCH] 10077 游戏代币方案
---
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerDailyGiftbag.py | 3
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ShareDefine.py | 3
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetPack.py | 78 +++++++++++++
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/SetMoney.py | 2
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/PyNetPack.ini | 6
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/DataRecordPack.py | 12 +
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCoin.py | 90 ++++++++++++++
ServerPython/CoreServerGroup/GameServer/Script/ShareDefine.py | 3
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerControl.py | 34 +++++
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py | 5
13 files changed, 309 insertions(+), 16 deletions(-)
diff --git a/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetPack.py b/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetPack.py
index 0521142..49d2b66 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/CoreServerGroup/GameServer/Script/ShareDefine.py b/ServerPython/CoreServerGroup/GameServer/Script/ShareDefine.py
index 86b41af..fdd69a5 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/ShareDefine.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/ShareDefine.py
@@ -1101,13 +1101,14 @@
TYPE_Price_BTGMYuE = 38 # GM余额
TYPE_Price_SuccessSocre = 39 # 成就积分
TYPE_Price_Xiantao = 40 # 仙桃
+TYPE_Price_PayCoin = 99 # 代币
#key可用于遍历所有货币,value仅GM相关会用到
MoneyNameDict = {
1:"仙玉", 2:"绑玉", 3:"铜钱", 6:"战盟贡献度", 10:"战盟仓库积分", 13:"境界修行点", 14:"符印融合石", 15:"仙盟活跃令",
16:"助战积分", 18:"荣誉", 19:"Boss积分", 23:"符印精华", 24:"符印碎片", 25:"寻宝积分", 26:"集市额度", 27:"丹精", 28:"魂尘",
29:"聚魂碎片", 30:"核心环", 31:"功能特权令", 32:"环保值", 33:"GM令", 34:"古神币", 35:"功德点",
- 39:"成就积分", 40:"仙桃"
+ 39:"成就积分", 40:"仙桃", 99:"代币"
}
#以下是旧的金钱类型
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/PyNetPack.ini b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/PyNetPack.ini
index 6e43ddb..2fe0abe 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/PyNetPack.ini
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/PyNetPack.ini
@@ -1483,12 +1483,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 ea6b866..db86ffd 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
@@ -6101,4 +6101,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 0521142..49d2b66 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 6bdfd40..5905aa3 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
@@ -309,7 +377,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()
@@ -338,6 +406,15 @@
if orderCoin != CommFunc.RMBToCoin(payRMBNum):
DataRecordPack.DR_CTGError(curPlayer, "The orderCoin is not equal to the ipyData's RMB(%s)!" % payRMBNum, addDRDict)
return
+
+ 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
@@ -398,7 +475,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()
@@ -406,7 +483,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()
@@ -414,7 +491,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()
@@ -422,7 +499,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)
@@ -490,6 +567,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 c5dd550..97a946d 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerControl.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerControl.py
@@ -2826,6 +2826,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)
@@ -2866,6 +2870,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:
@@ -3002,6 +3010,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:
@@ -3161,6 +3173,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)
@@ -3246,7 +3267,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
@@ -3425,7 +3446,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)
@@ -3549,6 +3573,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:
@@ -6241,6 +6267,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)
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ShareDefine.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ShareDefine.py
index 86b41af..fdd69a5 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ShareDefine.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ShareDefine.py
@@ -1101,13 +1101,14 @@
TYPE_Price_BTGMYuE = 38 # GM余额
TYPE_Price_SuccessSocre = 39 # 成就积分
TYPE_Price_Xiantao = 40 # 仙桃
+TYPE_Price_PayCoin = 99 # 代币
#key可用于遍历所有货币,value仅GM相关会用到
MoneyNameDict = {
1:"仙玉", 2:"绑玉", 3:"铜钱", 6:"战盟贡献度", 10:"战盟仓库积分", 13:"境界修行点", 14:"符印融合石", 15:"仙盟活跃令",
16:"助战积分", 18:"荣誉", 19:"Boss积分", 23:"符印精华", 24:"符印碎片", 25:"寻宝积分", 26:"集市额度", 27:"丹精", 28:"魂尘",
29:"聚魂碎片", 30:"核心环", 31:"功能特权令", 32:"环保值", 33:"GM令", 34:"古神币", 35:"功德点",
- 39:"成就积分", 40:"仙桃"
+ 39:"成就积分", 40:"仙桃", 99:"代币"
}
#以下是旧的金钱类型
--
Gitblit v1.8.0