From eda1e177e9227ce1a60423a77fa03e3a1f60e73d Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期三, 17 三月 2021 17:34:29 +0800
Subject: [PATCH] 8835 【BT2】【主干】【后端】Part3-2 5)新增多日连充(领奖记录支持多个值)

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py                 |   24 ++++++++---
 ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py                                      |   24 ++++++++---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerActManyDayRecharge.py |   20 +++++-----
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py                        |    2 
 4 files changed, 45 insertions(+), 25 deletions(-)

diff --git a/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py b/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py
index cdf8d7d..10b23a4 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py
@@ -25462,7 +25462,8 @@
     ActNum = 0    #(BYTE ActNum)//活动编号
     Days = 0    #(BYTE Days)
     DayRechargeValues = list()    #(vector<DWORD> DayRechargeValues)//活动每天充值列表
-    AwardRecord = 0    #(DWORD AwardRecord)//奖励领奖记录,按奖励索引二进制位存储是否已领取
+    RecordCount = 0    #(BYTE RecordCount)
+    AwardRecord = list()    #(vector<DWORD> AwardRecord)//奖励领奖记录,按奖励索引二进制位存储是否已领取
     data = None
 
     def __init__(self):
@@ -25479,7 +25480,10 @@
         for i in range(self.Days):
             value,_pos=CommFunc.ReadDWORD(_lpData,_pos)
             self.DayRechargeValues.append(value)
-        self.AwardRecord,_pos = CommFunc.ReadDWORD(_lpData, _pos)
+        self.RecordCount,_pos = CommFunc.ReadBYTE(_lpData, _pos)
+        for i in range(self.RecordCount):
+            value,_pos=CommFunc.ReadDWORD(_lpData,_pos)
+            self.AwardRecord.append(value)
         return _pos
 
     def Clear(self):
@@ -25490,7 +25494,8 @@
         self.ActNum = 0
         self.Days = 0
         self.DayRechargeValues = list()
-        self.AwardRecord = 0
+        self.RecordCount = 0
+        self.AwardRecord = list()
         return
 
     def GetLength(self):
@@ -25499,7 +25504,8 @@
         length += 1
         length += 1
         length += 4 * self.Days
-        length += 4
+        length += 1
+        length += 4 * self.RecordCount
 
         return length
 
@@ -25510,7 +25516,9 @@
         data = CommFunc.WriteBYTE(data, self.Days)
         for i in range(self.Days):
             data = CommFunc.WriteDWORD(data, self.DayRechargeValues[i])
-        data = CommFunc.WriteDWORD(data, self.AwardRecord)
+        data = CommFunc.WriteBYTE(data, self.RecordCount)
+        for i in range(self.RecordCount):
+            data = CommFunc.WriteDWORD(data, self.AwardRecord[i])
         return data
 
     def OutputString(self):
@@ -25519,14 +25527,16 @@
                                 ActNum:%d,
                                 Days:%d,
                                 DayRechargeValues:%s,
-                                AwardRecord:%d
+                                RecordCount:%d,
+                                AwardRecord:%s
                                 '''\
                                 %(
                                 self.Head.OutputString(),
                                 self.ActNum,
                                 self.Days,
                                 "...",
-                                self.AwardRecord
+                                self.RecordCount,
+                                "..."
                                 )
         return DumpString
 
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
index ee6cd49..7ed611e 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
@@ -3855,7 +3855,7 @@
 Def_PDict_ManyDayRechargeTempID = "ManyDayRechargeTempID_%s"  # 玩家身上的模板ID,参数:(活动编号)
 Def_PDict_ManyDayRechargeWorldLV = "ManyDayRechargeWorldLV_%s" #玩家身上的活动世界等级,参数:(活动编号)
 Def_PDict_ManyDayRechargeValue = "ManyDayRechargeValue_%s_%s"  # 每日累充总额,参数:(活动编号, 天索引)
-Def_PDict_ManyDayRechargeAward = "ManyDayRechargeAward_%s"  # 领奖记录,参数:(活动编号)
+Def_PDict_ManyDayRechargeAward = "ManyDayRechargeAward_%s_%s"  # 领奖记录,参数:(活动编号, key编号)
 #-------------------------------------------------------------------------------
 
 #开服活动,Def_PDictType_OpenServerCampaign
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py
index cdf8d7d..10b23a4 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py
@@ -25462,7 +25462,8 @@
     ActNum = 0    #(BYTE ActNum)//活动编号
     Days = 0    #(BYTE Days)
     DayRechargeValues = list()    #(vector<DWORD> DayRechargeValues)//活动每天充值列表
-    AwardRecord = 0    #(DWORD AwardRecord)//奖励领奖记录,按奖励索引二进制位存储是否已领取
+    RecordCount = 0    #(BYTE RecordCount)
+    AwardRecord = list()    #(vector<DWORD> AwardRecord)//奖励领奖记录,按奖励索引二进制位存储是否已领取
     data = None
 
     def __init__(self):
@@ -25479,7 +25480,10 @@
         for i in range(self.Days):
             value,_pos=CommFunc.ReadDWORD(_lpData,_pos)
             self.DayRechargeValues.append(value)
-        self.AwardRecord,_pos = CommFunc.ReadDWORD(_lpData, _pos)
+        self.RecordCount,_pos = CommFunc.ReadBYTE(_lpData, _pos)
+        for i in range(self.RecordCount):
+            value,_pos=CommFunc.ReadDWORD(_lpData,_pos)
+            self.AwardRecord.append(value)
         return _pos
 
     def Clear(self):
@@ -25490,7 +25494,8 @@
         self.ActNum = 0
         self.Days = 0
         self.DayRechargeValues = list()
-        self.AwardRecord = 0
+        self.RecordCount = 0
+        self.AwardRecord = list()
         return
 
     def GetLength(self):
@@ -25499,7 +25504,8 @@
         length += 1
         length += 1
         length += 4 * self.Days
-        length += 4
+        length += 1
+        length += 4 * self.RecordCount
 
         return length
 
@@ -25510,7 +25516,9 @@
         data = CommFunc.WriteBYTE(data, self.Days)
         for i in range(self.Days):
             data = CommFunc.WriteDWORD(data, self.DayRechargeValues[i])
-        data = CommFunc.WriteDWORD(data, self.AwardRecord)
+        data = CommFunc.WriteBYTE(data, self.RecordCount)
+        for i in range(self.RecordCount):
+            data = CommFunc.WriteDWORD(data, self.AwardRecord[i])
         return data
 
     def OutputString(self):
@@ -25519,14 +25527,16 @@
                                 ActNum:%d,
                                 Days:%d,
                                 DayRechargeValues:%s,
-                                AwardRecord:%d
+                                RecordCount:%d,
+                                AwardRecord:%s
                                 '''\
                                 %(
                                 self.Head.OutputString(),
                                 self.ActNum,
                                 self.Days,
                                 "...",
-                                self.AwardRecord
+                                self.RecordCount,
+                                "..."
                                 )
         return DumpString
 
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerActManyDayRecharge.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerActManyDayRecharge.py
index 549bd8f..83727bb 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerActManyDayRecharge.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerActManyDayRecharge.py
@@ -29,6 +29,7 @@
 import CommFunc
 
 Max_ActDays = 7 # 支持最大活动持续天
+Max_AwardKeyNum = 3 # 支持最大领奖记录key数
 
 def GetTemplateID(cfgID):
     if not cfgID:
@@ -95,7 +96,8 @@
     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ManyDayRechargeID % actNum, actID)
     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ManyDayRechargeTempID % actNum, templateID)
     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ManyDayRechargeWorldLV % actNum, actWorldLV)
-    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ManyDayRechargeAward % actNum, 0)
+    for i in xrange(Max_AwardKeyNum):
+        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ManyDayRechargeAward % (actNum, i), 0)
     for dayIndex in xrange(Max_ActDays):
         PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ManyDayRechargeValue % (actNum, dayIndex), 0)
         
@@ -115,11 +117,10 @@
     
     playerID = curPlayer.GetPlayerID()
     batchPlayerIDList, batchAddItemList, batchParamList = [], [], []
-    awardRecord = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ManyDayRechargeAward % actNum)
     
     for ipyData in ipyDataList:
         awardIndex = ipyData.GetAwardIndex()
-        if awardRecord & pow(2, awardIndex):
+        if GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_PDict_ManyDayRechargeAward, awardIndex, True, [actNum]):
             continue
         
         needRechargeValue = CommFunc.RMBToCoin(ipyData.GetNeedRMB())
@@ -133,7 +134,7 @@
         if finishDays < needDays:
             continue
         
-        awardRecord |= pow(2, awardIndex) 
+        GameWorld.SetDictValueByBit(curPlayer, ChConfig.Def_PDict_ManyDayRechargeAward, awardIndex, 1, True, [actNum])
         awardItemList = GameWorld.GetDictValueByRangeKey(ipyData.GetAwardItemInfo(), playerWorldLV, [])
         
         batchPlayerIDList.append([playerID])
@@ -142,7 +143,6 @@
         GameWorld.Log("多日连充活动补发奖励! actNum=%s,playerTemplateID=%s,awardIndex=%s" % (actNum, playerTemplateID, awardIndex))
         
     if batchPlayerIDList:
-        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ManyDayRechargeAward % actNum, awardRecord)
         actType = actNum / 10
         PlayerControl.SendMailBatch("ManyDayRechargeMail%s" % actType, batchPlayerIDList, batchAddItemList, batchParamList)
         
@@ -187,8 +187,7 @@
         GameWorld.DebugLog("该多日连充活动非活动中,无法领奖!actNum=%s,state=%s,templateID=%s" % (actNum, state, templateID), playerID)
         return
     
-    awardRecord = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ManyDayRechargeAward % actNum)
-    if awardRecord & pow(2, awardIndex):
+    if GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_PDict_ManyDayRechargeAward, awardIndex, True, [actNum]):
         GameWorld.DebugLog("已经领取过该多日连充活动奖励! actNum=%s,awardIndex=%s" % (actNum, awardIndex), playerID)
         return
     
@@ -230,8 +229,7 @@
     if not ItemControler.CheckPackSpaceEnough(curPlayer, awardItemList):
         return
     
-    awardRecord |= pow(2, awardIndex)
-    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ManyDayRechargeAward % actNum, awardRecord)
+    GameWorld.SetDictValueByBit(curPlayer, ChConfig.Def_PDict_ManyDayRechargeAward, awardIndex, 1, True, [actNum])
     Sync_ManyDayRechargePlayerInfo(curPlayer, actNum)
     
     notifyKey = awardIpyData.GetNotifyKey()
@@ -256,7 +254,9 @@
         rechargeValue = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ManyDayRechargeValue % (actNum, dayIndex))
         playerActInfo.DayRechargeValues.append(rechargeValue)
     playerActInfo.Days = len(playerActInfo.DayRechargeValues)
-    playerActInfo.AwardRecord = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ManyDayRechargeAward % actNum)
+    for i in xrange(Max_AwardKeyNum):
+        playerActInfo.AwardRecord.append(curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ManyDayRechargeAward % (actNum, i)))
+    playerActInfo.RecordCount = len(playerActInfo.AwardRecord)
     NetPackCommon.SendFakePack(curPlayer, playerActInfo)
     return
 

--
Gitblit v1.8.0