From 12db44928bd0bdab4baaeef731eb572efd0ea869 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期二, 09 三月 2021 14:44:01 +0800
Subject: [PATCH] 8650 【主干】【BT2】活动规则优化(消费返利支持多活动编号同时开启);

---
 ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldActionControl.py          |    5 -
 ServerPython/CoreServerGroup/GameServer/Script/IpyGameDataPY.py                                  |    6 
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCostRebate.py   |  169 ++++++++++++++++++++++--------------------
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ShareDefine.py               |    2 
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py           |   11 ++
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/ChPlayer.py           |    2 
 ServerPython/CoreServerGroup/GameServer/Script/ShareDefine.py                                    |    2 
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerEventCounter.py |    2 
 ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py                                |   11 ++
 PySysDB/PySysDBG.h                                                                               |    2 
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py                  |   10 +-
 11 files changed, 125 insertions(+), 97 deletions(-)

diff --git a/PySysDB/PySysDBG.h b/PySysDB/PySysDBG.h
index 9e41625..a80965c 100644
--- a/PySysDB/PySysDBG.h
+++ b/PySysDB/PySysDBG.h
@@ -440,9 +440,9 @@
 struct tagActCostRebate
 {
 	DWORD		_CfgID;	//配置ID
-	char		ActMark;	//活动组标记
 	list		PlatformList;	//活动平台列表["平台A", "平台A", ...],配[]代表所有
 	list		ServerGroupIDList;	//服务器ID列表
+	BYTE		ActNum;	//活动分组编号, 活动类型 * 10 + 不同界面编号
 	char		StartDate;	//开启日期
 	char		EndDate;	//结束日期
 	dict		NotifyInfoStart;	//全服提示信息 - 相对开始时间
diff --git a/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py b/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py
index d9a3161..5b9c60c 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py
@@ -26832,6 +26832,7 @@
 
 class  tagMCCostRebateInfo(Structure):
     Head = tagHead()
+    ActNum = 0    #(BYTE ActNum)//活动编号
     StartDate = ""    #(char StartDate[10])// 开始日期 y-m-d
     EndtDate = ""    #(char EndtDate[10])// 结束日期 y-m-d
     IsDayReset = 0    #(BYTE IsDayReset)//是否每天重置
@@ -26849,6 +26850,7 @@
     def ReadData(self, _lpData, _pos=0, _Len=0):
         self.Clear()
         _pos = self.Head.ReadData(_lpData, _pos)
+        self.ActNum,_pos = CommFunc.ReadBYTE(_lpData, _pos)
         self.StartDate,_pos = CommFunc.ReadString(_lpData, _pos,10)
         self.EndtDate,_pos = CommFunc.ReadString(_lpData, _pos,10)
         self.IsDayReset,_pos = CommFunc.ReadBYTE(_lpData, _pos)
@@ -26865,6 +26867,7 @@
         self.Head.Clear()
         self.Head.Cmd = 0xAA
         self.Head.SubCmd = 0x09
+        self.ActNum = 0
         self.StartDate = ""
         self.EndtDate = ""
         self.IsDayReset = 0
@@ -26876,6 +26879,7 @@
     def GetLength(self):
         length = 0
         length += self.Head.GetLength()
+        length += 1
         length += 10
         length += 10
         length += 1
@@ -26889,6 +26893,7 @@
     def GetBuffer(self):
         data = ''
         data = CommFunc.WriteString(data, self.Head.GetLength(), self.Head.GetBuffer())
+        data = CommFunc.WriteBYTE(data, self.ActNum)
         data = CommFunc.WriteString(data, 10, self.StartDate)
         data = CommFunc.WriteString(data, 10, self.EndtDate)
         data = CommFunc.WriteBYTE(data, self.IsDayReset)
@@ -26901,6 +26906,7 @@
     def OutputString(self):
         DumpString = '''
                                 Head:%s,
+                                ActNum:%d,
                                 StartDate:%s,
                                 EndtDate:%s,
                                 IsDayReset:%d,
@@ -26910,6 +26916,7 @@
                                 '''\
                                 %(
                                 self.Head.OutputString(),
+                                self.ActNum,
                                 self.StartDate,
                                 self.EndtDate,
                                 self.IsDayReset,
@@ -26932,6 +26939,7 @@
     _fields_ = [
                   ("Cmd", c_ubyte),
                   ("SubCmd", c_ubyte),
+                  ("ActNum", c_ubyte),    #活动编号
                   ("CostGoldTotal", c_int),    #本次活动已累计消费仙玉数
                   ("AwardRecord", c_int),    #返利奖励领奖记录,按奖励索引二进制位存储是否已领取
                   ]
@@ -26950,6 +26958,7 @@
     def Clear(self):
         self.Cmd = 0xAA
         self.SubCmd = 0x10
+        self.ActNum = 0
         self.CostGoldTotal = 0
         self.AwardRecord = 0
         return
@@ -26964,12 +26973,14 @@
         DumpString = '''// AA 10 消费返利玩家活动信息 //tagMCCostRebatePlayerInfo:
                                 Cmd:%s,
                                 SubCmd:%s,
+                                ActNum:%d,
                                 CostGoldTotal:%d,
                                 AwardRecord:%d
                                 '''\
                                 %(
                                 self.Cmd,
                                 self.SubCmd,
+                                self.ActNum,
                                 self.CostGoldTotal,
                                 self.AwardRecord
                                 )
diff --git a/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldActionControl.py b/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldActionControl.py
index efd3f40..3b62025 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldActionControl.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldActionControl.py
@@ -726,7 +726,7 @@
                         PlayerControl.WorldNotify(0, notifyKey, paramList)
                         
             dictName = ChConfig.Def_WorldKey_OperationActionState % actName
-            if actName in ShareDefine.MultiActNumOperationActNameList:         
+            if actName in ShareDefine.MultiActNumOperationActNameList:
                 dictName += "_%s" % actNum
             preState = gameWorld.GetDictByKey(dictName)
             if not isReload and preState == state:
@@ -786,9 +786,6 @@
                 if isReload and ipyData:
                     Sync_OperationAction_ExpRate(ipyData)
                     
-            elif actName == ShareDefine.OperationActionName_CostRebate:
-                if isReload and ipyData:
-                    pass
             elif actName == ShareDefine.OperationActionName_BossReborn:
                 if isReload and ipyData:
                     GameWorldBoss.SetBossRebornNeedPoint(True)
diff --git a/ServerPython/CoreServerGroup/GameServer/Script/IpyGameDataPY.py b/ServerPython/CoreServerGroup/GameServer/Script/IpyGameDataPY.py
index 0c20f43..fde388d 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/IpyGameDataPY.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/IpyGameDataPY.py
@@ -371,9 +371,9 @@
 
                 "ActCostRebate":(
                         ("DWORD", "CfgID", 1),
-                        ("char", "ActMark", 0),
                         ("list", "PlatformList", 0),
                         ("list", "ServerGroupIDList", 0),
+                        ("BYTE", "ActNum", 0),
                         ("char", "StartDate", 0),
                         ("char", "EndDate", 0),
                         ("dict", "NotifyInfoStart", 0),
@@ -1396,9 +1396,9 @@
     
     def __init__(self):
         self.CfgID = 0
-        self.ActMark = ""
         self.PlatformList = []
         self.ServerGroupIDList = []
+        self.ActNum = 0
         self.StartDate = ""
         self.EndDate = ""
         self.NotifyInfoStart = {}
@@ -1408,9 +1408,9 @@
         return
         
     def GetCfgID(self): return self.CfgID # 配置ID
-    def GetActMark(self): return self.ActMark # 活动组标记
     def GetPlatformList(self): return self.PlatformList # 活动平台列表["平台A", "平台A", ...],配[]代表所有
     def GetServerGroupIDList(self): return self.ServerGroupIDList # 服务器ID列表
+    def GetActNum(self): return self.ActNum # 活动分组编号, 活动类型 * 10 + 不同界面编号
     def GetStartDate(self): return self.StartDate # 开启日期
     def GetEndDate(self): return self.EndDate # 结束日期
     def GetNotifyInfoStart(self): return self.NotifyInfoStart # 全服提示信息 - 相对开始时间
diff --git a/ServerPython/CoreServerGroup/GameServer/Script/ShareDefine.py b/ServerPython/CoreServerGroup/GameServer/Script/ShareDefine.py
index 3e4f103..6c3f725 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/ShareDefine.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/ShareDefine.py
@@ -264,7 +264,7 @@
 
 #支持多活动分组编号的活动名
 MultiActNumOperationActNameList = [OperationActionName_TotalRecharge, OperationActionName_CollectWords,
-                                   OperationActionName_FlashGiftbag,
+                                   OperationActionName_FlashGiftbag, OperationActionName_CostRebate,
                                    ]
 
 #跨服运营活动表名定义
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
index c1d6765..767f918 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
@@ -3695,11 +3695,11 @@
 Def_PDict_CA_CTGBillboardAward = "CA_CTGBillboardAward"  # 活动充值目标领奖状态,按二进制位存储
 
 #消费返利活动
-Def_PDict_CostRebateID = "CostRebateID"  # 玩家身上的消费返利活动ID,唯一标识,取活动开始日期time值
-Def_PDict_CostRebateTemplateID = "CostRebateTemplateID"  # 玩家身上的消费返利模板ID
-Def_PDict_CostRebateGold = "CostRebateGold"  # 消费返利总累计消费仙玉
-Def_PDict_CostRebateAwardRecord = "CostRebateAwardRecord"  # 消费返利领奖记录
-Def_PDict_CostRebateWorldLV = "CostRebateWorldLV" #消费返利活动开启时世界等级
+Def_PDict_CostRebateID = "CostRebateID_%s"  # 玩家身上的消费返利活动ID,唯一标识,取活动开始日期time值,参数(活动编号)
+Def_PDict_CostRebateTemplateID = "CostRebateTemplateID_%s"  # 玩家身上的消费返利模板ID,参数(活动编号)
+Def_PDict_CostRebateGold = "CostRebateGold_%s"  # 消费返利总累计消费仙玉,参数(活动编号)
+Def_PDict_CostRebateAwardRecord = "CostRebateAwardRecord_%s"  # 消费返利领奖记录,参数(活动编号)
+Def_PDict_CostRebateWorldLV = "CostRebateWorldLV_%s" #消费返利活动开启时世界等级,参数(活动编号)
 
 #累计充值活动
 Def_PDict_TotalRechargeID = "TotalRechargeID_%s"  # 玩家身上的累计充值活动ID,唯一标识,取活动开始日期time值,参数:(活动编号)
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py
index d9a3161..5b9c60c 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py
@@ -26832,6 +26832,7 @@
 
 class  tagMCCostRebateInfo(Structure):
     Head = tagHead()
+    ActNum = 0    #(BYTE ActNum)//活动编号
     StartDate = ""    #(char StartDate[10])// 开始日期 y-m-d
     EndtDate = ""    #(char EndtDate[10])// 结束日期 y-m-d
     IsDayReset = 0    #(BYTE IsDayReset)//是否每天重置
@@ -26849,6 +26850,7 @@
     def ReadData(self, _lpData, _pos=0, _Len=0):
         self.Clear()
         _pos = self.Head.ReadData(_lpData, _pos)
+        self.ActNum,_pos = CommFunc.ReadBYTE(_lpData, _pos)
         self.StartDate,_pos = CommFunc.ReadString(_lpData, _pos,10)
         self.EndtDate,_pos = CommFunc.ReadString(_lpData, _pos,10)
         self.IsDayReset,_pos = CommFunc.ReadBYTE(_lpData, _pos)
@@ -26865,6 +26867,7 @@
         self.Head.Clear()
         self.Head.Cmd = 0xAA
         self.Head.SubCmd = 0x09
+        self.ActNum = 0
         self.StartDate = ""
         self.EndtDate = ""
         self.IsDayReset = 0
@@ -26876,6 +26879,7 @@
     def GetLength(self):
         length = 0
         length += self.Head.GetLength()
+        length += 1
         length += 10
         length += 10
         length += 1
@@ -26889,6 +26893,7 @@
     def GetBuffer(self):
         data = ''
         data = CommFunc.WriteString(data, self.Head.GetLength(), self.Head.GetBuffer())
+        data = CommFunc.WriteBYTE(data, self.ActNum)
         data = CommFunc.WriteString(data, 10, self.StartDate)
         data = CommFunc.WriteString(data, 10, self.EndtDate)
         data = CommFunc.WriteBYTE(data, self.IsDayReset)
@@ -26901,6 +26906,7 @@
     def OutputString(self):
         DumpString = '''
                                 Head:%s,
+                                ActNum:%d,
                                 StartDate:%s,
                                 EndtDate:%s,
                                 IsDayReset:%d,
@@ -26910,6 +26916,7 @@
                                 '''\
                                 %(
                                 self.Head.OutputString(),
+                                self.ActNum,
                                 self.StartDate,
                                 self.EndtDate,
                                 self.IsDayReset,
@@ -26932,6 +26939,7 @@
     _fields_ = [
                   ("Cmd", c_ubyte),
                   ("SubCmd", c_ubyte),
+                  ("ActNum", c_ubyte),    #活动编号
                   ("CostGoldTotal", c_int),    #本次活动已累计消费仙玉数
                   ("AwardRecord", c_int),    #返利奖励领奖记录,按奖励索引二进制位存储是否已领取
                   ]
@@ -26950,6 +26958,7 @@
     def Clear(self):
         self.Cmd = 0xAA
         self.SubCmd = 0x10
+        self.ActNum = 0
         self.CostGoldTotal = 0
         self.AwardRecord = 0
         return
@@ -26964,12 +26973,14 @@
         DumpString = '''// AA 10 消费返利玩家活动信息 //tagMCCostRebatePlayerInfo:
                                 Cmd:%s,
                                 SubCmd:%s,
+                                ActNum:%d,
                                 CostGoldTotal:%d,
                                 AwardRecord:%d
                                 '''\
                                 %(
                                 self.Cmd,
                                 self.SubCmd,
+                                self.ActNum,
                                 self.CostGoldTotal,
                                 self.AwardRecord
                                 )
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 311e42a..6a6ccbc 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/ChPlayer.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/ChPlayer.py
@@ -5360,7 +5360,7 @@
         PlayerFreeGoods.OnGetFreeGoods(curPlayer, dataEx)
     # 领取消费返利奖励
     elif rewardType == ChConfig.Def_RewardType_CostRebate:
-        PlayerCostRebate.OnGetCostRebateAward(curPlayer, dataEx)
+        PlayerCostRebate.OnGetCostRebateAward(curPlayer, dataEx, dataExStr)
     # 领取累计充值奖励
     elif rewardType == ChConfig.Def_RewardType_TotalRecharge:
         PlayerActTotalRecharge.OnGetTotalRechargeAward(curPlayer, dataEx, dataExStr)
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCostRebate.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCostRebate.py
index 5044233..ceb1cbe 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCostRebate.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCostRebate.py
@@ -24,7 +24,6 @@
 import DataRecordPack
 import IPY_GameWorld
 import NetPackCommon
-import ItemCommon
 import GameWorld
 import ChConfig
 
@@ -39,68 +38,70 @@
     return templateID
 
 def OnPlayerLogin(curPlayer):
-    isReset = __CheckPlayerCostRebateAction(curPlayer)
-    if not isReset:
-        actCostRebateInfo = PyGameData.g_operationActionDict.get(ShareDefine.OperationActionName_CostRebate, {})
-        # 活动中同步活动信息
-        if actCostRebateInfo.get(ShareDefine.ActKey_State):
-            Sync_CostRebateActionInfo(curPlayer)
-            Sync_CostRebateInfo(curPlayer)
+    
+    for actInfo in PyGameData.g_operationActionDict.get(ShareDefine.OperationActionName_CostRebate, {}).values():
+        actNum = actInfo.get(ShareDefine.ActKey_ActNum, 0)
+        isReset = __CheckPlayerCostRebateAction(curPlayer, actNum)
+        if not isReset:
+            # 活动中同步活动信息
+            if actInfo.get(ShareDefine.ActKey_State):
+                Sync_CostRebateActionInfo(curPlayer, actNum)
+                Sync_CostRebateInfo(curPlayer, actNum)
     return
 
-def RefreshCostRebateActionInfo():
+def RefreshCostRebateActionInfo(actNum):
     ## 收到GameServer同步的活动信息,刷新活动信息
     playerManager = GameWorld.GetPlayerManager()
     for index in xrange(playerManager.GetPlayerCount()):
         curPlayer = playerManager.GetPlayerByIndex(index)
         if curPlayer.GetID() == 0:
             continue
-        __CheckPlayerCostRebateAction(curPlayer)
+        __CheckPlayerCostRebateAction(curPlayer, actNum)
     return
 
-def __CheckPlayerCostRebateAction(curPlayer):
+def __CheckPlayerCostRebateAction(curPlayer, actNum):
     ## 检查玩家消费返利活动数据信息
     
     playerID = curPlayer.GetPlayerID()
     
-    actCostRebateInfo = PyGameData.g_operationActionDict.get(ShareDefine.OperationActionName_CostRebate, {})
-    costRebateID = actCostRebateInfo.get(ShareDefine.ActKey_ID, 0)
-    state = actCostRebateInfo.get(ShareDefine.ActKey_State, 0)
+    actInfo = GameWorld.GetActInfo(ShareDefine.OperationActionName_CostRebate, actNum)
+    actID = actInfo.get(ShareDefine.ActKey_ID, 0)
+    state = actInfo.get(ShareDefine.ActKey_State, 0)
     
-    playerCostRebateID = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CostRebateID) # 玩家身上的活动ID
+    playerActID = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CostRebateID % actNum) # 玩家身上的活动ID
     
     # 活动ID 相同的话不处理
-    if costRebateID == playerCostRebateID:
-        #GameWorld.DebugLog("消费返利活动ID不变,不处理!", curPlayer.GetPlayerID())
+    if actID == playerActID:
+        GameWorld.DebugLog("消费返利活动ID不变,不处理!actNum=%s,actID=%s" % (actNum, actID), curPlayer.GetPlayerID())
         return
-    actWorldLV = actCostRebateInfo.get(ShareDefine.ActKey_WorldLV, 0)
-    playerWorldLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CostRebateWorldLV)
-    templateID = GetTemplateID(actCostRebateInfo.get(ShareDefine.ActKey_CfgID, 0), actCostRebateInfo.get(ShareDefine.ActKey_DayIndex, 0))
-    playerTemplateID = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CostRebateTemplateID)
+    actWorldLV = actInfo.get(ShareDefine.ActKey_WorldLV, 0)
+    playerWorldLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CostRebateWorldLV % actNum)
+    templateID = GetTemplateID(actInfo.get(ShareDefine.ActKey_CfgID, 0), actInfo.get(ShareDefine.ActKey_DayIndex, 0))
+    playerTemplateID = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CostRebateTemplateID % actNum)
     
-    GameWorld.DebugLog("消费返利重置! costRebateID=%s,playerCostRebateID=%s,state=%s,templateID=%s,playerTemplateID=%s" 
-                       % (costRebateID, playerCostRebateID, state, templateID, playerTemplateID), playerID)
+    GameWorld.DebugLog("消费返利重置! actNum=%s,actID=%s,playerActID=%s,state=%s,templateID=%s,playerTemplateID=%s" 
+                       % (actNum, actID, playerActID, state, templateID, playerTemplateID), playerID)
     
     # 未领取的奖励邮件发放
-    __SendCostRebateMail(curPlayer, playerTemplateID, playerWorldLV)
+    __SendCostRebateMail(curPlayer, playerTemplateID, playerWorldLV, actNum)
     
-    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CostRebateID, costRebateID)
-    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CostRebateTemplateID, templateID)
-    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CostRebateWorldLV, actWorldLV)
-    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CostRebateGold, 0)
-    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CostRebateAwardRecord, 0)
+    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CostRebateID % actNum, actID)
+    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CostRebateTemplateID % actNum, templateID)
+    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CostRebateWorldLV % actNum, actWorldLV)
+    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CostRebateGold % actNum, 0)
+    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CostRebateAwardRecord % actNum, 0)
     
-    Sync_CostRebateActionInfo(curPlayer)
-    Sync_CostRebateInfo(curPlayer)
+    Sync_CostRebateActionInfo(curPlayer, actNum)
+    Sync_CostRebateInfo(curPlayer, actNum)
     return True
 
-def __SendCostRebateMail(curPlayer, playerTemplateID, playerWorldLV):
+def __SendCostRebateMail(curPlayer, playerTemplateID, playerWorldLV, actNum):
     # 未领取的奖励邮件发放
     
     if not playerTemplateID:
         return
     
-    costGold = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CostRebateGold)
+    costGold = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CostRebateGold % actNum)
     if not costGold:
         return
     
@@ -110,7 +111,7 @@
     job = curPlayer.GetJob()
     playerID = curPlayer.GetPlayerID()
     batchPlayerIDList, batchAddItemList, batchParamList = [], [], []
-    awardRecord = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CostRebateAwardRecord)
+    awardRecord = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CostRebateAwardRecord % actNum)
     
     for ipyData in ipyDataList:
         awardIndex = ipyData.GetAwardIndex()
@@ -128,7 +129,7 @@
         batchParamList.append([needCostGold])
         
     if batchPlayerIDList:
-        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CostRebateAwardRecord, awardRecord)
+        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CostRebateAwardRecord % actNum, awardRecord)
         PlayerControl.SendMailBatch("ConsumptionRebateMail", batchPlayerIDList, batchAddItemList, batchParamList)
         
     return
@@ -157,47 +158,54 @@
         GameWorld.DebugLog("不计入消费返利的消费类型!costType=%s" % costType, curPlayer.GetPlayerID())
         return
     
-    actCostRebateInfo = PyGameData.g_operationActionDict.get(ShareDefine.OperationActionName_CostRebate, {})
-    if not actCostRebateInfo.get(ShareDefine.ActKey_State):
-        GameWorld.DebugLog("消费返利活动当前未开启!")
-        return
-    
-    actID = actCostRebateInfo.get(ShareDefine.ActKey_ID)
-    templateID = GetTemplateID(actCostRebateInfo.get(ShareDefine.ActKey_CfgID, 0), actCostRebateInfo.get(ShareDefine.ActKey_DayIndex, 0))
-    if not actID or not templateID:
-        GameWorld.ErrLog("消费返利活动数据异常!actID=%s,templateID=%s" % (actID, templateID), curPlayer.GetPlayerID())
-        return
-    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CostRebateID, actID)
-    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CostRebateTemplateID, templateID)
-    
-    curCostGold = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CostRebateGold)
-    updCostGold = curCostGold + costGold
-    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CostRebateGold, updCostGold)
-    Sync_CostRebateInfo(curPlayer)
-    GameWorld.DebugLog("玩家消费返利活动: actID=%s,templateID=%s,curCostGold=%s,costGold=%s,updCostGold=%s" 
-                       % (actID, templateID, curCostGold, costGold, updCostGold), curPlayer.GetPlayerID())
+    for actInfo in PyGameData.g_operationActionDict.get(ShareDefine.OperationActionName_CostRebate, {}).values():
+        actNum = actInfo.get(ShareDefine.ActKey_ActNum, 0)
+        
+        if not actInfo.get(ShareDefine.ActKey_State):
+            GameWorld.DebugLog("消费返利活动当前未开启!actNum=%s" % actNum)
+            continue
+        
+        actID = actInfo.get(ShareDefine.ActKey_ID)
+        templateID = GetTemplateID(actInfo.get(ShareDefine.ActKey_CfgID, 0), actInfo.get(ShareDefine.ActKey_DayIndex, 0))
+        if not actID or not templateID:
+            GameWorld.ErrLog("消费返利活动数据异常!actNum=%s,actID=%s,templateID=%s" % (actNum, actID, templateID), curPlayer.GetPlayerID())
+            continue
+        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CostRebateID % actNum, actID)
+        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CostRebateTemplateID % actNum, templateID)
+        
+        curCostGold = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CostRebateGold % actNum)
+        updCostGold = curCostGold + costGold
+        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CostRebateGold % actNum, updCostGold)
+        Sync_CostRebateInfo(curPlayer, actNum)
+        GameWorld.DebugLog("玩家消费返利活动: actNum=%s,actID=%s,templateID=%s,curCostGold=%s,costGold=%s,updCostGold=%s" 
+                           % (actNum, actID, templateID, curCostGold, costGold, updCostGold), curPlayer.GetPlayerID())
     return
 
-def OnGetCostRebateAward(curPlayer, awardIndex):
+def OnGetCostRebateAward(curPlayer, awardIndex, actNum):
     ## 领取消费返利奖励
-
-    playerID = curPlayer.GetPlayerID()
     
-    actCostRebateInfo = PyGameData.g_operationActionDict.get(ShareDefine.OperationActionName_CostRebate, {})
-    costRebateID = actCostRebateInfo.get(ShareDefine.ActKey_ID, 0)
-    state = actCostRebateInfo.get(ShareDefine.ActKey_State, 0)
-    templateID = GetTemplateID(actCostRebateInfo.get(ShareDefine.ActKey_CfgID, 0), actCostRebateInfo.get(ShareDefine.ActKey_DayIndex, 0))
-    if not state or not templateID:
-        GameWorld.DebugLog("没有消费返利活动,无法领奖!state=%s,templateID=%s" % (state, templateID), playerID)
+    actNum = GameWorld.ToIntDef(actNum, 0)
+    if actNum <= 0:
+        GameWorld.DebugLog("没有该活动编号! actNum=%s" % actNum)
         return
     
-    playerCostRebateID = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CostRebateID) # 玩家身上的活动ID
+    playerID = curPlayer.GetPlayerID()
+    
+    actInfo = GameWorld.GetActInfo(ShareDefine.OperationActionName_CostRebate, actNum)
+    costRebateID = actInfo.get(ShareDefine.ActKey_ID, 0)
+    state = actInfo.get(ShareDefine.ActKey_State, 0)
+    templateID = GetTemplateID(actInfo.get(ShareDefine.ActKey_CfgID, 0), actInfo.get(ShareDefine.ActKey_DayIndex, 0))
+    if not state or not templateID:
+        GameWorld.DebugLog("没有消费返利活动,无法领奖!actNum=%s,state=%s,templateID=%s" % (actNum, state, templateID), playerID)
+        return
+    
+    playerCostRebateID = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CostRebateID % actNum) # 玩家身上的活动ID
     if costRebateID != playerCostRebateID:
         return
     
-    awardRecord = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CostRebateAwardRecord)
+    awardRecord = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CostRebateAwardRecord % actNum)
     if awardRecord & pow(2, awardIndex):
-        GameWorld.DebugLog("已经领取过该消费返利活动奖励!awardIndex=%s" % awardIndex, playerID)
+        GameWorld.DebugLog("已经领取过该消费返利活动奖励!actNum=%s,awardIndex=%s,awardRecord=%s" % (actNum, awardIndex, awardRecord), playerID)
         return
     
     ipyDataList = IpyGameDataPY.GetIpyGameDataList("CostRebateTemplate", templateID)
@@ -215,47 +223,47 @@
         return
     
     needCostGold = awardIpyData.GetNeedCostGold()
-    actWorldLV = actCostRebateInfo.get(ShareDefine.ActKey_WorldLV, 0)
+    actWorldLV = actInfo.get(ShareDefine.ActKey_WorldLV, 0)
     awardItemList = __GetItemList(awardIpyData.GetAwardItemList(), curPlayer.GetJob(), actWorldLV)
     
-    curCostGold = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CostRebateGold)
+    curCostGold = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CostRebateGold % actNum)
     if curCostGold < needCostGold:
         GameWorld.DebugLog("所需消费仙玉数不足,无法领取!templateID=%s,awardIndex=%s,needCostGold=%s,curCostGold=%s" 
                            % (templateID, awardIndex, needCostGold, curCostGold), playerID)
         return
     
-    needSpace = len(awardItemList)
-    packSpace = ItemCommon.GetItemPackSpace(curPlayer, IPY_GameWorld.rptItem, needSpace)
-    if packSpace < needSpace:
+    if not ItemControler.CheckPackSpaceEnough(curPlayer, awardItemList):
         return
     
     awardRecord |= pow(2, awardIndex)
-    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CostRebateAwardRecord, awardRecord)
-    Sync_CostRebateInfo(curPlayer)
+    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CostRebateAwardRecord % actNum, awardRecord)
+    Sync_CostRebateInfo(curPlayer, actNum)
     
     notifyKey = awardIpyData.GetNotifyKey()
     if notifyKey:
         PlayerControl.WorldNotify(0, notifyKey, [curPlayer.GetPlayerName(), needCostGold])
         
-    for itemID, itemCount, isBind in awardItemList:
+    for itemID, itemCount, _ in awardItemList:
         ItemControler.GivePlayerItem(curPlayer, itemID, itemCount, 0, [IPY_GameWorld.rptItem])
         
     addDataDict = {"TemplateID":templateID, "NeedCostGold":needCostGold, "AwardIndex":awardIndex,
-                   "ItemList":str(awardItemList)}
+                   "ItemList":str(awardItemList), "ActNum":actNum}
     DataRecordPack.DR_FuncGiveItem(curPlayer, "CostRebateAward", addDataDict)
     return
 
-def Sync_CostRebateInfo(curPlayer):
+def Sync_CostRebateInfo(curPlayer, actNum):
     ## 通知消费返利玩家数据信息
     playerActInfo = ChPyNetSendPack.tagMCCostRebatePlayerInfo()
-    playerActInfo.CostGoldTotal = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CostRebateGold)
-    playerActInfo.AwardRecord = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CostRebateAwardRecord)
+    playerActInfo.ActNum = actNum
+    playerActInfo.CostGoldTotal = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CostRebateGold % actNum)
+    playerActInfo.AwardRecord = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CostRebateAwardRecord % actNum)
     NetPackCommon.SendFakePack(curPlayer, playerActInfo)
     return
 
-def Sync_CostRebateActionInfo(curPlayer):
+def Sync_CostRebateActionInfo(curPlayer, actNum):
     ## 通知消费返利活动信息
-    actCostRebateInfo = PyGameData.g_operationActionDict.get(ShareDefine.OperationActionName_CostRebate, {})
+    
+    actCostRebateInfo = GameWorld.GetActInfo(ShareDefine.OperationActionName_CostRebate, actNum)
     if not actCostRebateInfo:
         return
     
@@ -274,6 +282,7 @@
     actWorldLV = actCostRebateInfo.get(ShareDefine.ActKey_WorldLV, 0)
     openServerDay = GameWorld.GetGameWorld().GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_ServerDay) + 1
     actInfo = ChPyNetSendPack.tagMCCostRebateInfo()
+    actInfo.ActNum = actNum
     actInfo.StartDate = GameWorld.GetOperationActionDateStr(ipyData.GetStartDate(), openServerDay)
     actInfo.EndtDate = GameWorld.GetOperationActionDateStr(ipyData.GetEndDate(), openServerDay)
     actInfo.LimitLV = ipyData.GetLVLimit()
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerEventCounter.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerEventCounter.py
index 123b871..9b0d29d 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerEventCounter.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerEventCounter.py
@@ -1352,7 +1352,7 @@
                 PlayerControl.RefreshOperationAction_ExpRate()
                 
             elif actionName == ShareDefine.OperationActionName_CostRebate:
-                PlayerCostRebate.RefreshCostRebateActionInfo()
+                PlayerCostRebate.RefreshCostRebateActionInfo(actNum)
                 
             elif actionName == ShareDefine.OperationActionName_TotalRecharge:
                 PlayerActTotalRecharge.RefreshTotalRechargeActionInfo(actNum)
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ShareDefine.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ShareDefine.py
index 3e4f103..6c3f725 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ShareDefine.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ShareDefine.py
@@ -264,7 +264,7 @@
 
 #支持多活动分组编号的活动名
 MultiActNumOperationActNameList = [OperationActionName_TotalRecharge, OperationActionName_CollectWords,
-                                   OperationActionName_FlashGiftbag,
+                                   OperationActionName_FlashGiftbag, OperationActionName_CostRebate,
                                    ]
 
 #跨服运营活动表名定义

--
Gitblit v1.8.0