From 94bb5ab94e98fb616137f9c143e702aae10df8a6 Mon Sep 17 00:00:00 2001
From: xdh <xiefantasy@qq.com>
Date: 星期三, 17 七月 2019 14:32:17 +0800
Subject: [PATCH] 8125 子 【主干】新功能:累计充值 / 【后端】【主干】累计充值

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py       |   52 +++++++++++++
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/IpyGameDataPY.py         |   25 ++++++
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/ChPlayer.py       |    4 
 PySysDB/PySysDBPY.h                                                                          |   11 ++
 ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py                            |   52 +++++++++++++
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerGoldGift.py |   64 ++++++++++++++++
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py              |    4 
 7 files changed, 208 insertions(+), 4 deletions(-)

diff --git a/PySysDB/PySysDBPY.h b/PySysDB/PySysDBPY.h
index 595a519..2d9820d 100644
--- a/PySysDB/PySysDBPY.h
+++ b/PySysDB/PySysDBPY.h
@@ -1918,7 +1918,7 @@
 	BYTE		SkinIndex;	//外观
 };
 
-//骑宠幻化表
+//装备升星概率表
 
 struct tagEquipStarUpRate
 {
@@ -1927,4 +1927,13 @@
 	DWORD		_EquipPlace;	//部位
 	DWORD		_IsSuite;	//是否套装
 	DWORD		Rate;	//概率
+};
+
+//累计充值奖励表
+
+struct tagHistoryRechargeAward
+{
+	BYTE		_ID;	//id
+	DWORD		Recharge;	//所需充值元
+	dict		Reward;	//职业对应的奖励内容,每个职业4组数据,物品ID和物品数量(1.枪豪2.道师3.剑修)
 };
\ No newline at end of file
diff --git a/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py b/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py
index cc089ea..e2d1905 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py
@@ -15449,6 +15449,58 @@
 
 
 #------------------------------------------------------
+# A3 28 历史累积充值奖励领取记录 #tagMCHistoryReChargeAwardRecord
+
+class  tagMCHistoryReChargeAwardRecord(Structure):
+    _pack_ = 1
+    _fields_ = [
+                  ("Cmd", c_ubyte),
+                  ("SubCmd", c_ubyte),
+                  ("AwardGetRecord", c_int),    # 按二进制位标示领取记录 配置奖励ID代表第几位
+                  ]
+
+    def __init__(self):
+        self.Clear()
+        self.Cmd = 0xA3
+        self.SubCmd = 0x28
+        return
+
+    def ReadData(self, stringData, _pos=0, _len=0):
+        self.Clear()
+        memmove(addressof(self), stringData[_pos:], self.GetLength())
+        return _pos + self.GetLength()
+
+    def Clear(self):
+        self.Cmd = 0xA3
+        self.SubCmd = 0x28
+        self.AwardGetRecord = 0
+        return
+
+    def GetLength(self):
+        return sizeof(tagMCHistoryReChargeAwardRecord)
+
+    def GetBuffer(self):
+        return string_at(addressof(self), self.GetLength())
+
+    def OutputString(self):
+        DumpString = '''// A3 28 历史累积充值奖励领取记录 //tagMCHistoryReChargeAwardRecord:
+                                Cmd:%s,
+                                SubCmd:%s,
+                                AwardGetRecord:%d
+                                '''\
+                                %(
+                                self.Cmd,
+                                self.SubCmd,
+                                self.AwardGetRecord
+                                )
+        return DumpString
+
+
+m_NAtagMCHistoryReChargeAwardRecord=tagMCHistoryReChargeAwardRecord()
+ChNetPackDict[eval("0x%02x%02x"%(m_NAtagMCHistoryReChargeAwardRecord.Cmd,m_NAtagMCHistoryReChargeAwardRecord.SubCmd))] = m_NAtagMCHistoryReChargeAwardRecord
+
+
+#------------------------------------------------------
 # A3 12 通知骑宠觉醒信息 #tagMCHorsePetSkinData
 
 class  tagMCHorsePetSkinInfo(Structure):
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
index d2d7f15..5f4fc93 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
@@ -3455,6 +3455,7 @@
 Def_PDict_OnlineStartTick = "OnlineStartTime"        # 在线计算时间
 Def_PDict_LVAwardGetRecord = "LVAwardGetRecord"  # 等级奖励领取信息记录,按二进制位标示
 Def_PDict_LVAwardVIPGetRecord = "LVAwardVIPGetRecord"  # 等级奖励vip领取信息记录,按二进制位标示
+Def_PDict_HistoryChargeAwardGetRecord = "HTotalGoldAwardRecord"  # 历史累计充值奖励领取信息记录,按二进制位标示
 Def_PDict_CTGCountResetTime = "CTGCountResetTime"  # CTG次数重置时间time值
 Def_PDict_TodayCTGCount = "TodayCTGCount_%s"  # 当日充值次数,参数(CTG对应的商品记录ID)
 Def_PDict_CTGGoodsBuyCount = "CTGGoodsBuyCount_%s"  # 对应充值商品已购买次数,参数(CTG对应的商品记录ID)
@@ -5202,7 +5203,8 @@
 Def_RewardType_FeastWeekPartyAct, # 领取节日巡礼活动奖励25
 Def_RewardType_FeastWeekPartyPoint, # 领取节日巡礼积分奖励26
 Def_RewardType_FairyAdventuresAward, #缥缈奇遇领取27
-)= range(28)
+Def_RewardType_HistoryChargeAward, #历史累计充值领取28
+)= range(29)
 
 
 #boss复活相关活动定义
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py
index cc089ea..e2d1905 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py
@@ -15449,6 +15449,58 @@
 
 
 #------------------------------------------------------
+# A3 28 历史累积充值奖励领取记录 #tagMCHistoryReChargeAwardRecord
+
+class  tagMCHistoryReChargeAwardRecord(Structure):
+    _pack_ = 1
+    _fields_ = [
+                  ("Cmd", c_ubyte),
+                  ("SubCmd", c_ubyte),
+                  ("AwardGetRecord", c_int),    # 按二进制位标示领取记录 配置奖励ID代表第几位
+                  ]
+
+    def __init__(self):
+        self.Clear()
+        self.Cmd = 0xA3
+        self.SubCmd = 0x28
+        return
+
+    def ReadData(self, stringData, _pos=0, _len=0):
+        self.Clear()
+        memmove(addressof(self), stringData[_pos:], self.GetLength())
+        return _pos + self.GetLength()
+
+    def Clear(self):
+        self.Cmd = 0xA3
+        self.SubCmd = 0x28
+        self.AwardGetRecord = 0
+        return
+
+    def GetLength(self):
+        return sizeof(tagMCHistoryReChargeAwardRecord)
+
+    def GetBuffer(self):
+        return string_at(addressof(self), self.GetLength())
+
+    def OutputString(self):
+        DumpString = '''// A3 28 历史累积充值奖励领取记录 //tagMCHistoryReChargeAwardRecord:
+                                Cmd:%s,
+                                SubCmd:%s,
+                                AwardGetRecord:%d
+                                '''\
+                                %(
+                                self.Cmd,
+                                self.SubCmd,
+                                self.AwardGetRecord
+                                )
+        return DumpString
+
+
+m_NAtagMCHistoryReChargeAwardRecord=tagMCHistoryReChargeAwardRecord()
+ChNetPackDict[eval("0x%02x%02x"%(m_NAtagMCHistoryReChargeAwardRecord.Cmd,m_NAtagMCHistoryReChargeAwardRecord.SubCmd))] = m_NAtagMCHistoryReChargeAwardRecord
+
+
+#------------------------------------------------------
 # A3 12 通知骑宠觉醒信息 #tagMCHorsePetSkinData
 
 class  tagMCHorsePetSkinInfo(Structure):
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/IpyGameDataPY.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/IpyGameDataPY.py
index 02e6f9b..2b6a61a 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/IpyGameDataPY.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/IpyGameDataPY.py
@@ -1491,6 +1491,12 @@
                         ("DWORD", "IsSuite", 1),
                         ("DWORD", "Rate", 0),
                         ),
+
+                "HistoryRechargeAward":(
+                        ("BYTE", "ID", 1),
+                        ("DWORD", "Recharge", 0),
+                        ("dict", "Reward", 0),
+                        ),
                 }
 
 
@@ -4547,7 +4553,7 @@
     def GetAttrInfo(self): return self.AttrInfo # 属性
     def GetSkinIndex(self): return self.SkinIndex # 外观
 
-# 骑宠幻化表
+# 装备升星概率表
 class IPY_EquipStarUpRate():
     
     def __init__(self):
@@ -4563,6 +4569,19 @@
     def GetEquipPlace(self): return self.EquipPlace # 部位
     def GetIsSuite(self): return self.IsSuite # 是否套装
     def GetRate(self): return self.Rate # 概率
+
+# 累计充值奖励表
+class IPY_HistoryRechargeAward():
+    
+    def __init__(self):
+        self.ID = 0
+        self.Recharge = 0
+        self.Reward = {}
+        return
+        
+    def GetID(self): return self.ID # id
+    def GetRecharge(self): return self.Recharge # 所需充值元
+    def GetReward(self): return self.Reward # 职业对应的奖励内容,每个职业4组数据,物品ID和物品数量(1.枪豪2.道师3.剑修)
 
 
 def Log(msg, playerID=0, par=0):
@@ -4888,6 +4907,8 @@
         self.ipyHorsePetSkinLen = len(self.ipyHorsePetSkinCache)
         self.ipyEquipStarUpRateCache = self.__LoadFileData("EquipStarUpRate", IPY_EquipStarUpRate)
         self.ipyEquipStarUpRateLen = len(self.ipyEquipStarUpRateCache)
+        self.ipyHistoryRechargeAwardCache = self.__LoadFileData("HistoryRechargeAward", IPY_HistoryRechargeAward)
+        self.ipyHistoryRechargeAwardLen = len(self.ipyHistoryRechargeAwardCache)
         Log("IPY_FuncConfig count=%s" % len(self.ipyFuncConfigDict))
         Log("IPY_DataMgr InitOK!")
         return
@@ -5354,6 +5375,8 @@
     def GetHorsePetSkinByIndex(self, index): return self.ipyHorsePetSkinCache[index]
     def GetEquipStarUpRateCount(self): return self.ipyEquipStarUpRateLen
     def GetEquipStarUpRateByIndex(self, index): return self.ipyEquipStarUpRateCache[index]
+    def GetHistoryRechargeAwardCount(self): return self.ipyHistoryRechargeAwardLen
+    def GetHistoryRechargeAwardByIndex(self, index): return self.ipyHistoryRechargeAwardCache[index]
 
 IPYData = IPY_DataMgr()
 def IPY_Data(): return IPYData
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 6cb5ca9..05cdfd2 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/ChPlayer.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/ChPlayer.py
@@ -5362,7 +5362,9 @@
     #缥缈奇遇领取
     elif rewardType == ChConfig.Def_RewardType_FairyAdventuresAward:
         PlayerFairyDomain.GetFairyAdventuresAward(curPlayer, dataEx, dataExStr)
-        
+    #历史累计充值领取
+    elif rewardType == ChConfig.Def_RewardType_HistoryChargeAward:
+        PlayerGoldGift.OnGetHistoryRechargeAward(curPlayer, dataEx)
     return
     
     
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerGoldGift.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerGoldGift.py
index ae637da..9adad02 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerGoldGift.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerGoldGift.py
@@ -158,6 +158,7 @@
     Sync_FirstGoldInfo(curPlayer)
     
     Sync_FirstGoldTime(curPlayer)
+    Sync_HistoryChargeAwardGetRecordInfo(curPlayer)
     #更新首充提示开始计时时间
     if curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FirstGoldRemainTime):
         PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FirstGoldTipStartTime, int(time.time()))
@@ -263,4 +264,67 @@
         return
     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_DailyChargeState, 1)
     PlayerFamilyRedPacket.CreatRedPacketByID(curPlayer, 2)
+    return
+
+
+def OnGetHistoryRechargeAward(curPlayer, awardID):
+    # 领取历史充值奖励
+    
+    ipyData = IpyGameDataPY.GetIpyGameData('HistoryRechargeAward', awardID)
+    if not ipyData:
+        return
+    
+    getRecharge = ipyData.GetRecharge()
+    # 检查可否领取
+    
+    # 玩家充值小于领取充值
+    if curPlayer.GetChangeCoinPointTotal()/100 < getRecharge:
+        GameWorld.ErrLog("OnGetHistoryRechargeAward error:getRecharge=%s greater than ChangeCoinPointTotal=%s" % (getRecharge, curPlayer.GetChangeCoinPointTotal()))
+        return
+    awardInfo = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_HistoryChargeAwardGetRecord, 0)
+    awardMark = pow(2, awardID)
+    if awardInfo & awardMark:
+        #已领取
+        GameWorld.DebugLog("已领取历史充值奖励!awardID=%s,getRecharge=%s" % (awardID, getRecharge))
+        return
+
+    job = curPlayer.GetJob()
+    awardDict = ipyData.GetReward()
+    if str(job) not in awardDict:
+        return
+    itemList = awardDict[str(job)]
+    
+    if not itemList:
+        return
+    # 检查背包
+    needSpace = len(itemList)
+    packSpace = ItemCommon.GetItemPackSpace(curPlayer, IPY_GameWorld.rptItem, needSpace)
+    if needSpace > packSpace:
+        PlayerControl.NotifyCode(curPlayer, "GeRen_chenxin_998371")
+        return
+    
+    # 给物品
+    for itemID, itemCount in itemList:
+        ItemControler.GivePlayerItem(curPlayer, itemID, itemCount, 0, [IPY_GameWorld.rptItem])
+    
+    # 更新已领取成功标记
+    awardMark = pow(2, awardID)
+
+    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_HistoryChargeAwardGetRecord, awardInfo | awardMark)
+    # 通知客户端
+    Sync_HistoryChargeAwardGetRecordInfo(curPlayer)
+    
+    # 记录领取事件
+    DataRecordPack.SendEventPack("HistoryRechargeAward", {'awardID':awardID, 'getRecharge':getRecharge}, curPlayer)
+    return
+
+
+## 通知等级奖励领取记录信息
+#  @param None
+#  @return None
+def Sync_HistoryChargeAwardGetRecordInfo(curPlayer):
+    sendPack = ChPyNetSendPack.tagMCHistoryReChargeAwardRecord()
+    sendPack.Clear()
+    sendPack.AwardGetRecord = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_HistoryChargeAwardGetRecord, 0)
+    NetPackCommon.SendFakePack(curPlayer, sendPack)
     return
\ No newline at end of file

--
Gitblit v1.8.0