From 386b21211f046d4abecad344bdc7371dc62bc5bb Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期二, 09 三月 2021 18:41:30 +0800
Subject: [PATCH] 8650 【主干】【BT2】活动规则优化(限时抢购支持多活动编号同时开启);

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFlashSale.py           |  191 ++++++++++++++++++++++++++-----------
 ServerPython/CoreServerGroup/GameServer/Script/IpyGameDataPY.py                                         |    6 
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/FunctionNPCCommon.py |   13 --
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ShareDefine.py                      |    2 
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetPack.py                      |    4 
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py                  |   14 ++
 ServerPython/CoreServerGroup/GameServer/Script/ChPyNetPack.py                                           |    4 
 ServerPython/CoreServerGroup/GameServer/Script/ShareDefine.py                                           |    2 
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerEventCounter.py        |    2 
 ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py                                       |   14 ++
 PySysDB/PySysDBG.h                                                                                      |    2 
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py                         |    8 
 12 files changed, 181 insertions(+), 81 deletions(-)

diff --git a/PySysDB/PySysDBG.h b/PySysDB/PySysDBG.h
index 74fb112..21b5409 100644
--- a/PySysDB/PySysDBG.h
+++ b/PySysDB/PySysDBG.h
@@ -530,9 +530,9 @@
 struct tagActFlashSale
 {
 	DWORD		_CfgID;	//配置ID
-	char		ActMark;	//活动组标记
 	list		PlatformList;	//活动平台列表["平台A", "平台A", ...],配[]代表所有
 	list		ServerGroupIDList;	//服务器ID列表
+	BYTE		ActNum;	//活动分组编号, 活动类型 * 10 + 不同界面编号
 	char		StartDate;	//开启日期
 	char		EndDate;	//结束日期
 	list		StartTimeList;	//开启时间列表, 支持多个时段
diff --git a/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetPack.py b/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetPack.py
index 9fdde86..34e45fe 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetPack.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetPack.py
@@ -13545,6 +13545,7 @@
     _fields_ = [
                   ("Cmd", c_ubyte),
                   ("SubCmd", c_ubyte),
+                  ("ActNum", c_ubyte),    #活动编号
                   ("GoodsID", c_int),    # 抢购商品标识
                   ("State", c_ubyte),    # 1-预约 0-取消
                   ]
@@ -13563,6 +13564,7 @@
     def Clear(self):
         self.Cmd = 0xAA
         self.SubCmd = 0x05
+        self.ActNum = 0
         self.GoodsID = 0
         self.State = 0
         return
@@ -13577,12 +13579,14 @@
         DumpString = '''// AA 05 限时抢购预约 //tagCMFlashSaleAppointment:
                                 Cmd:%s,
                                 SubCmd:%s,
+                                ActNum:%d,
                                 GoodsID:%d,
                                 State:%d
                                 '''\
                                 %(
                                 self.Cmd,
                                 self.SubCmd,
+                                self.ActNum,
                                 self.GoodsID,
                                 self.State
                                 )
diff --git a/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py b/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py
index 3ad10e4..ed0706d 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py
@@ -29585,6 +29585,7 @@
 
 class  tagMCFlashSaleAppointmentInfo(Structure):
     Head = tagHead()
+    ActNum = 0    #(BYTE ActNum)//活动编号
     IsAll = 0    #(BYTE IsAll)// 是否全部
     GoodsCount = 0    #(WORD GoodsCount)// 商品数
     GoodsList = list()    #(vector<tagMCFlashSaleAppointmentState> GoodsList)// 预约的商品
@@ -29599,6 +29600,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.IsAll,_pos = CommFunc.ReadBYTE(_lpData, _pos)
         self.GoodsCount,_pos = CommFunc.ReadWORD(_lpData, _pos)
         for i in range(self.GoodsCount):
@@ -29612,6 +29614,7 @@
         self.Head.Clear()
         self.Head.Cmd = 0xAA
         self.Head.SubCmd = 0x18
+        self.ActNum = 0
         self.IsAll = 0
         self.GoodsCount = 0
         self.GoodsList = list()
@@ -29620,6 +29623,7 @@
     def GetLength(self):
         length = 0
         length += self.Head.GetLength()
+        length += 1
         length += 1
         length += 2
         for i in range(self.GoodsCount):
@@ -29630,6 +29634,7 @@
     def GetBuffer(self):
         data = ''
         data = CommFunc.WriteString(data, self.Head.GetLength(), self.Head.GetBuffer())
+        data = CommFunc.WriteBYTE(data, self.ActNum)
         data = CommFunc.WriteBYTE(data, self.IsAll)
         data = CommFunc.WriteWORD(data, self.GoodsCount)
         for i in range(self.GoodsCount):
@@ -29639,12 +29644,14 @@
     def OutputString(self):
         DumpString = '''
                                 Head:%s,
+                                ActNum:%d,
                                 IsAll:%d,
                                 GoodsCount:%d,
                                 GoodsList:%s
                                 '''\
                                 %(
                                 self.Head.OutputString(),
+                                self.ActNum,
                                 self.IsAll,
                                 self.GoodsCount,
                                 "..."
@@ -29837,6 +29844,7 @@
 
 class  tagMCFlashSaleInfo(Structure):
     Head = tagHead()
+    ActNum = 0    #(BYTE ActNum)//活动编号
     StartDate = ""    #(char StartDate[10])// 开始日期 y-m-d
     EndtDate = ""    #(char EndtDate[10])// 结束日期 y-m-d
     AdvanceMinutes = 0    #(WORD AdvanceMinutes)// 提前显示分钟
@@ -29857,6 +29865,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.AdvanceMinutes,_pos = CommFunc.ReadWORD(_lpData, _pos)
@@ -29879,6 +29888,7 @@
         self.Head.Clear()
         self.Head.Cmd = 0xAA
         self.Head.SubCmd = 0x17
+        self.ActNum = 0
         self.StartDate = ""
         self.EndtDate = ""
         self.AdvanceMinutes = 0
@@ -29893,6 +29903,7 @@
     def GetLength(self):
         length = 0
         length += self.Head.GetLength()
+        length += 1
         length += 10
         length += 10
         length += 2
@@ -29910,6 +29921,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.WriteWORD(data, self.AdvanceMinutes)
@@ -29926,6 +29938,7 @@
     def OutputString(self):
         DumpString = '''
                                 Head:%s,
+                                ActNum:%d,
                                 StartDate:%s,
                                 EndtDate:%s,
                                 AdvanceMinutes:%d,
@@ -29938,6 +29951,7 @@
                                 '''\
                                 %(
                                 self.Head.OutputString(),
+                                self.ActNum,
                                 self.StartDate,
                                 self.EndtDate,
                                 self.AdvanceMinutes,
diff --git a/ServerPython/CoreServerGroup/GameServer/Script/IpyGameDataPY.py b/ServerPython/CoreServerGroup/GameServer/Script/IpyGameDataPY.py
index c24a5db..70b7582 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/IpyGameDataPY.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/IpyGameDataPY.py
@@ -443,9 +443,9 @@
 
                 "ActFlashSale":(
                         ("DWORD", "CfgID", 1),
-                        ("char", "ActMark", 0),
                         ("list", "PlatformList", 0),
                         ("list", "ServerGroupIDList", 0),
+                        ("BYTE", "ActNum", 0),
                         ("char", "StartDate", 0),
                         ("char", "EndDate", 0),
                         ("list", "StartTimeList", 0),
@@ -1546,9 +1546,9 @@
     
     def __init__(self):
         self.CfgID = 0
-        self.ActMark = ""
         self.PlatformList = []
         self.ServerGroupIDList = []
+        self.ActNum = 0
         self.StartDate = ""
         self.EndDate = ""
         self.StartTimeList = []
@@ -1563,9 +1563,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 GetStartTimeList(self): return self.StartTimeList # 开启时间列表, 支持多个时段
diff --git a/ServerPython/CoreServerGroup/GameServer/Script/ShareDefine.py b/ServerPython/CoreServerGroup/GameServer/Script/ShareDefine.py
index 2e66b8f..53dde27 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/ShareDefine.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/ShareDefine.py
@@ -265,7 +265,7 @@
 #支持多活动分组编号的活动名
 MultiActNumOperationActNameList = [OperationActionName_TotalRecharge, OperationActionName_CollectWords,
                                    OperationActionName_FlashGiftbag, OperationActionName_CostRebate,
-                                   OperationActionName_SpringSale,
+                                   OperationActionName_SpringSale, OperationActionName_FlashSale,
                                    ]
 
 #跨服运营活动表名定义
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
index fde11a6..cff9187 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
@@ -3768,10 +3768,10 @@
 Def_PDict_BindJadeWheelHistoryCnt = "BindJadeWheelHistoryCnt"  # 历史已转次数
 
 #限时抢购活动
-Def_PDict_FlashSaleID = "FlashSaleID"  # 玩家身上的限时抢购活动ID,唯一标识,取活动开始日期time
-Def_PDict_FlashSaleState = "FlashSaleState"  # 玩家身上的限时抢购活动state
-Def_PDict_FlashSaleMailState = "FlashSaleMailState"  # 玩家身上的活动更新提醒邮件状态
-Def_PDict_FlashSaleYY = "FlashSaleYY_%s"  # 玩家预约限时抢购商品
+Def_PDict_FlashSaleID = "FlashSaleID_%s"  # 玩家身上的限时抢购活动ID,唯一标识,取活动开始日期time,参数(活动编号)
+Def_PDict_FlashSaleState = "FlashSaleState_%s"  # 玩家身上的限时抢购活动state,参数(活动编号)
+Def_PDict_FlashSaleMailState = "FlashSaleMailState_%s"  # 玩家身上的活动更新提醒邮件状态,参数(活动编号)
+Def_PDict_FlashSaleYY = "FlashSaleYY_%s_%s"  # 玩家预约限时抢购商品,参数(活动编号, 商品标识)
 
 #许愿池活动
 Def_PDict_WishingWellID = "WishingWellID"  # 玩家身上的许愿池活动ID,唯一标识,取活动开始日期time值
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetPack.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetPack.py
index 9fdde86..34e45fe 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetPack.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetPack.py
@@ -13545,6 +13545,7 @@
     _fields_ = [
                   ("Cmd", c_ubyte),
                   ("SubCmd", c_ubyte),
+                  ("ActNum", c_ubyte),    #活动编号
                   ("GoodsID", c_int),    # 抢购商品标识
                   ("State", c_ubyte),    # 1-预约 0-取消
                   ]
@@ -13563,6 +13564,7 @@
     def Clear(self):
         self.Cmd = 0xAA
         self.SubCmd = 0x05
+        self.ActNum = 0
         self.GoodsID = 0
         self.State = 0
         return
@@ -13577,12 +13579,14 @@
         DumpString = '''// AA 05 限时抢购预约 //tagCMFlashSaleAppointment:
                                 Cmd:%s,
                                 SubCmd:%s,
+                                ActNum:%d,
                                 GoodsID:%d,
                                 State:%d
                                 '''\
                                 %(
                                 self.Cmd,
                                 self.SubCmd,
+                                self.ActNum,
                                 self.GoodsID,
                                 self.State
                                 )
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py
index 3ad10e4..ed0706d 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py
@@ -29585,6 +29585,7 @@
 
 class  tagMCFlashSaleAppointmentInfo(Structure):
     Head = tagHead()
+    ActNum = 0    #(BYTE ActNum)//活动编号
     IsAll = 0    #(BYTE IsAll)// 是否全部
     GoodsCount = 0    #(WORD GoodsCount)// 商品数
     GoodsList = list()    #(vector<tagMCFlashSaleAppointmentState> GoodsList)// 预约的商品
@@ -29599,6 +29600,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.IsAll,_pos = CommFunc.ReadBYTE(_lpData, _pos)
         self.GoodsCount,_pos = CommFunc.ReadWORD(_lpData, _pos)
         for i in range(self.GoodsCount):
@@ -29612,6 +29614,7 @@
         self.Head.Clear()
         self.Head.Cmd = 0xAA
         self.Head.SubCmd = 0x18
+        self.ActNum = 0
         self.IsAll = 0
         self.GoodsCount = 0
         self.GoodsList = list()
@@ -29620,6 +29623,7 @@
     def GetLength(self):
         length = 0
         length += self.Head.GetLength()
+        length += 1
         length += 1
         length += 2
         for i in range(self.GoodsCount):
@@ -29630,6 +29634,7 @@
     def GetBuffer(self):
         data = ''
         data = CommFunc.WriteString(data, self.Head.GetLength(), self.Head.GetBuffer())
+        data = CommFunc.WriteBYTE(data, self.ActNum)
         data = CommFunc.WriteBYTE(data, self.IsAll)
         data = CommFunc.WriteWORD(data, self.GoodsCount)
         for i in range(self.GoodsCount):
@@ -29639,12 +29644,14 @@
     def OutputString(self):
         DumpString = '''
                                 Head:%s,
+                                ActNum:%d,
                                 IsAll:%d,
                                 GoodsCount:%d,
                                 GoodsList:%s
                                 '''\
                                 %(
                                 self.Head.OutputString(),
+                                self.ActNum,
                                 self.IsAll,
                                 self.GoodsCount,
                                 "..."
@@ -29837,6 +29844,7 @@
 
 class  tagMCFlashSaleInfo(Structure):
     Head = tagHead()
+    ActNum = 0    #(BYTE ActNum)//活动编号
     StartDate = ""    #(char StartDate[10])// 开始日期 y-m-d
     EndtDate = ""    #(char EndtDate[10])// 结束日期 y-m-d
     AdvanceMinutes = 0    #(WORD AdvanceMinutes)// 提前显示分钟
@@ -29857,6 +29865,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.AdvanceMinutes,_pos = CommFunc.ReadWORD(_lpData, _pos)
@@ -29879,6 +29888,7 @@
         self.Head.Clear()
         self.Head.Cmd = 0xAA
         self.Head.SubCmd = 0x17
+        self.ActNum = 0
         self.StartDate = ""
         self.EndtDate = ""
         self.AdvanceMinutes = 0
@@ -29893,6 +29903,7 @@
     def GetLength(self):
         length = 0
         length += self.Head.GetLength()
+        length += 1
         length += 10
         length += 10
         length += 2
@@ -29910,6 +29921,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.WriteWORD(data, self.AdvanceMinutes)
@@ -29926,6 +29938,7 @@
     def OutputString(self):
         DumpString = '''
                                 Head:%s,
+                                ActNum:%d,
                                 StartDate:%s,
                                 EndtDate:%s,
                                 AdvanceMinutes:%d,
@@ -29938,6 +29951,7 @@
                                 '''\
                                 %(
                                 self.Head.OutputString(),
+                                self.ActNum,
                                 self.StartDate,
                                 self.EndtDate,
                                 self.AdvanceMinutes,
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/FunctionNPCCommon.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/FunctionNPCCommon.py
index 2b0d2ef..9e32e8f 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/FunctionNPCCommon.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/FunctionNPCCommon.py
@@ -558,18 +558,7 @@
         if not PlayerSpringSale.IsSpringSaleShopType(shopType):
             return
     elif operationActionShopType == 2:
-        actInfo = PyGameData.g_operationActionDict.get(ShareDefine.OperationActionName_FlashSale, {})
-        state = actInfo.get(ShareDefine.ActKey_State, 0)
-        if not state:
-            GameWorld.DebugLog("限时抢购非活动中!state=%s" % (state), curPlayer.GetPlayerID())
-            return
-        shopTypeList = PlayerFlashSale.GetShopTypeList(actInfo.get(ShareDefine.ActKey_CfgID, 0), actInfo.get(ShareDefine.ActKey_DayIndex, 0), state, actInfo.get(ShareDefine.ActKey_WorldLV, 0))
-        if not shopTypeList:
-            return
-        actShopType = shopTypeList[0]
-        if shopType != actShopType:
-            GameWorld.DebugLog("限时抢购非活动中的商店类型!state=%s,shopType=%s,actShopType=%s,shopTypeList=%s" 
-                               % (state, shopType, actShopType, shopTypeList), curPlayer.GetPlayerID())
+        if not PlayerFlashSale.IsFlashSaleShopType(shopType):
             return
         
     # 物品信息
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 09743fb..fca3e36 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerEventCounter.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerEventCounter.py
@@ -1376,7 +1376,7 @@
                 PlayerNewFairyCeremony.RefreshOperationAction_NewFairyCeremony()
                 
             elif actionName == ShareDefine.OperationActionName_FlashSale:
-                PlayerFlashSale.RefreshflashSaleActionInfo()
+                PlayerFlashSale.RefreshflashSaleActionInfo(actNum)
                 
             elif actionName == ShareDefine.OperationActionName_WishingWell:
                 PlayerWishingWell.RefreshWishingWellAction()
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFlashSale.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFlashSale.py
index 646fc9c..5bb9ca0 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFlashSale.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFlashSale.py
@@ -42,35 +42,86 @@
 
 
 def OnPlayerLogin(curPlayer):
-    __CheckPlayerflashSaleAction(curPlayer)
+    
+    TransferPlayerActDBKeyValue(curPlayer)
+    
+    for actInfo in PyGameData.g_operationActionDict.get(ShareDefine.OperationActionName_FlashSale, {}).values():
+        actNum = actInfo.get(ShareDefine.ActKey_ActNum, 0)
+        __CheckPlayerflashSaleAction(curPlayer, actNum)
+        
     return
 
+def TransferPlayerActDBKeyValue(curPlayer):
+    ## 玩家登录时调用,旧版本玩家活动数据转移到新版本字典,线上版本维护之后的版本可删除此代码,线上版本分支 gt_1.100.4
+    
+    #限时抢购活动
+    Def_PDict_FlashSaleID = "FlashSaleID"  # 玩家身上的限时抢购活动ID,唯一标识,取活动开始日期time
+    Def_PDict_FlashSaleState = "FlashSaleState"  # 玩家身上的限时抢购活动state
+    Def_PDict_FlashSaleMailState = "FlashSaleMailState"  # 玩家身上的活动更新提醒邮件状态
+    Def_PDict_FlashSaleYY = "FlashSaleYY_%s"  # 玩家预约限时抢购商品
+    
+    playerActID = curPlayer.NomalDictGetProperty(Def_PDict_FlashSaleID, 0, ChConfig.Def_PDictType_FlashSale)
+    if not playerActID:
+        return
+    
+    tagActNum = 10
+    
+    playerState = curPlayer.NomalDictGetProperty(Def_PDict_FlashSaleState, 0, ChConfig.Def_PDictType_FlashSale)
+    playerMailState = curPlayer.NomalDictGetProperty(Def_PDict_FlashSaleMailState, 0, ChConfig.Def_PDictType_FlashSale)
+    
+    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FlashSaleID % tagActNum, playerActID, ChConfig.Def_PDictType_FlashSale)
+    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FlashSaleState % tagActNum, playerState, ChConfig.Def_PDictType_FlashSale)
+    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FlashSaleMailState % tagActNum, playerMailState, ChConfig.Def_PDictType_FlashSale)
+    
+    PlayerControl.NomalDictSetProperty(curPlayer, Def_PDict_FlashSaleID, 0, ChConfig.Def_PDictType_FlashSale)
+    PlayerControl.NomalDictSetProperty(curPlayer, Def_PDict_FlashSaleState, 0, ChConfig.Def_PDictType_FlashSale)
+    PlayerControl.NomalDictSetProperty(curPlayer, Def_PDict_FlashSaleMailState, 0, ChConfig.Def_PDictType_FlashSale)
+    
+    GameWorld.Log("限时抢购转移玩家活动字典记录: tagActNum=%s,playerActID=%s,playerState=%s,playerMailState=%s" 
+                  % (tagActNum, playerActID, playerState, playerMailState), curPlayer.GetPlayerID())
+    
+    for dayIndex in xrange(7): # 支持7天
+        for timeIndex in xrange(2): # 支持2个时段
+            for i in xrange(10): # 支持10个物品
+                goodsMark = dayIndex * 10000 + timeIndex * 100 + i  #商品标识
+                isAppointment = curPlayer.NomalDictGetProperty(Def_PDict_FlashSaleYY % goodsMark, 0, ChConfig.Def_PDictType_FlashSale)
+                if not isAppointment:
+                    continue
+                
+                PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FlashSaleYY % (tagActNum, goodsMark), isAppointment, ChConfig.Def_PDictType_FlashSale)
+                
+                PlayerControl.NomalDictSetProperty(curPlayer, Def_PDict_FlashSaleYY % goodsMark, 0, ChConfig.Def_PDictType_FlashSale)
+                
+                GameWorld.Log("    转移预约状态: dayIndex=%s,timeIndex=%s,i=%s,goodsMark=%s, %s" 
+                              % (dayIndex, timeIndex, i, goodsMark, isAppointment), curPlayer.GetPlayerID())
+                
+    return
 
-def RefreshflashSaleActionInfo():
+def RefreshflashSaleActionInfo(actNum):
     ## 收到GameServer同步的活动信息,刷新活动信息
     playerManager = GameWorld.GetPlayerManager()
     for index in xrange(playerManager.GetPlayerCount()):
         curPlayer = playerManager.GetPlayerByIndex(index)
         if curPlayer.GetID() == 0:
             continue
-        __CheckPlayerflashSaleAction(curPlayer)
+        __CheckPlayerflashSaleAction(curPlayer, actNum)
     return
 
 
-def __CheckPlayerflashSaleAction(curPlayer):
+def __CheckPlayerflashSaleAction(curPlayer, actNum):
     ## 检查玩家限时抢购活动数据信息
     
     playerID = curPlayer.GetPlayerID()
     
-    actInfo = PyGameData.g_operationActionDict.get(ShareDefine.OperationActionName_FlashSale, {})
+    actInfo = GameWorld.GetActInfo(ShareDefine.OperationActionName_FlashSale, actNum)
     actID = actInfo.get(ShareDefine.ActKey_ID, 0)
     state = actInfo.get(ShareDefine.ActKey_State, 0)
     cfgID = actInfo.get(ShareDefine.ActKey_CfgID, 0)
     dayIndex = actInfo.get(ShareDefine.ActKey_DayIndex, 0)
     woldLV = actInfo.get(ShareDefine.ActKey_WorldLV, 0)
-    playerActID = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FlashSaleID, 0, ChConfig.Def_PDictType_FlashSale)  # 玩家身上的活动ID
-    playerActState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FlashSaleState, 0, ChConfig.Def_PDictType_FlashSale)  # 玩家身上的活动State
-    playerMailState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FlashSaleMailState, 0, ChConfig.Def_PDictType_FlashSale)  # 玩家身上的活动提醒邮件状态
+    playerActID = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FlashSaleID % actNum, 0, ChConfig.Def_PDictType_FlashSale)  # 玩家身上的活动ID
+    playerActState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FlashSaleState % actNum, 0, ChConfig.Def_PDictType_FlashSale)  # 玩家身上的活动State
+    playerMailState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FlashSaleMailState % actNum, 0, ChConfig.Def_PDictType_FlashSale)  # 玩家身上的活动提醒邮件状态
     isReset = False
     if actID != playerActID or (state != playerActState):
         isReset = True
@@ -88,63 +139,83 @@
         shopTypeList = GetShopTypeList(cfgID, dayIndex, state, woldLV)
         if shopTypeList:
             FunctionNPCCommon.ResetShopItemBuyCountByShopType(curPlayer, shopTypeList)
-        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FlashSaleID, actID, ChConfig.Def_PDictType_FlashSale)
-        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FlashSaleState, state, ChConfig.Def_PDictType_FlashSale)
+        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FlashSaleID % actNum, actID, ChConfig.Def_PDictType_FlashSale)
+        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FlashSaleState % actNum, state, ChConfig.Def_PDictType_FlashSale)
         #Sync_flashSaleActionInfo(curPlayer)
-        GameWorld.DebugLog("限时抢购单场重置! actID=%s,playerActID=%s,dayIndex=%s,state=%s,playerActState=%s,shopTypeList=%s,playerMailState=%s" % (actID, playerActID, dayIndex, state, playerActState, shopTypeList,playerMailState), playerID)
+        GameWorld.DebugLog("限时抢购单场重置! actNum=%s,actID=%s,playerActID=%s,dayIndex=%s,state=%s,playerActState=%s,shopTypeList=%s,playerMailState=%s" % (actNum, actID, playerActID, dayIndex, state, playerActState, shopTypeList,playerMailState), playerID)
     else:
-        GameWorld.DebugLog("限时抢购活动ID不变,不处理!", playerID)
+        GameWorld.DebugLog("限时抢购活动ID不变,不处理!actNum=%s,actID=%s,state=%s" % (actNum, actID, state), playerID)
         
     if cfgID:
-        Sync_flashSaleActionInfo(curPlayer)
-        Sync_FlashSaleAppointmentInfo(curPlayer)
+        Sync_flashSaleActionInfo(curPlayer, actNum)
+        Sync_FlashSaleAppointmentInfo(curPlayer, actNum)
     return isReset
 
+def IsFlashSaleShopType(shopType):
+    ## 判断是否活动中的商店
+    for actInfo in PyGameData.g_operationActionDict.get(ShareDefine.OperationActionName_FlashSale, {}).values():
+        actNum = actInfo.get(ShareDefine.ActKey_ActNum, 0)
+        
+        state = actInfo.get(ShareDefine.ActKey_State, 0)
+        if not state:
+            continue
+        shopTypeList = GetShopTypeList(actInfo.get(ShareDefine.ActKey_CfgID, 0), actInfo.get(ShareDefine.ActKey_DayIndex, 0), state, actInfo.get(ShareDefine.ActKey_WorldLV, 0))
+        if not shopTypeList:
+            continue
+        actShopType = shopTypeList[0]
+        if shopType == actShopType:
+            GameWorld.DebugLog("限时抢购活动中的商店类型: actNum=%s,shopType=%s" % (actNum, shopType))
+            return True
+        
+    GameWorld.DebugLog("限时抢购非活动中或非活动中的商店类型!shopType=%s" % (shopType))
+    return False
 
 def ProcessFlashSaleMail(curPlayer, tick):
     if not GameWorld.SetPlayerTickTime(curPlayer, ChConfig.TYPE_Player_Tick_FlashSale, tick):
         return
-    playerMailState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FlashSaleMailState, 0, ChConfig.Def_PDictType_FlashSale)  # 玩家身上的活动提醒邮件状态
-    if playerMailState:
-        return
-    actInfo = PyGameData.g_operationActionDict.get(ShareDefine.OperationActionName_FlashSale, {})
-    if not actInfo:
-        return
-    cfgID = actInfo.get(ShareDefine.ActKey_CfgID, 0)
-    if not cfgID:
-        return
-    flashSaleIpyData = IpyGameDataPY.GetIpyGameData("ActFlashSale", cfgID)
-    if not flashSaleIpyData:
-        return
-    mailKey = flashSaleIpyData.GetMailKey()
-    LVLimit = flashSaleIpyData.GetLVLimit()
-    if not mailKey or curPlayer.GetLV() < LVLimit:
-        return
-    openServerDay = GameWorld.GetGameWorld().GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_ServerDay) + 1
-    startDate = GameWorld.GetOperationActionDateStr(flashSaleIpyData.GetStartDate(), openServerDay)
-    endDate = GameWorld.GetOperationActionDateStr(flashSaleIpyData.GetEndDate(), openServerDay)
-    startTimeList = flashSaleIpyData.GetStartTimeList()
-    endTimeList = flashSaleIpyData.GetEndTimeList()
-    if not startTimeList or not endTimeList:
-        return
-    advanceMinutes = flashSaleIpyData.GetAdvanceMinutes()
-    startTime = datetime.datetime.strptime("%s %s:00" % (startDate, startTimeList[0]), ChConfig.TYPE_Time_Format) + datetime.timedelta(minutes=-advanceMinutes)
-    endTime = datetime.datetime.strptime("%s %s:00" % (endDate, endTimeList[-1]), ChConfig.TYPE_Time_Format)
-    curDateTime = GameWorld.GetCurrentTime()
-    if startTime <= curDateTime <= endTime:
-        paramList = [startDate.replace('-','/'), endDate.replace('-','/'), GameWorld.GbkToCode('、').join(startTimeList)]
-        PlayerControl.SendMailByKey(mailKey, [curPlayer.GetID()], flashSaleIpyData.GetMailItemPrize(), paramList)
-        startTimeNum = GameWorld.ChangeTimeStrToNum(startDate, timeFormat=ChConfig.TYPE_Time_Format_Day)
-        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FlashSaleMailState, startTimeNum, ChConfig.Def_PDictType_FlashSale)
-        GameWorld.DebugLog("    发送新限时抢购邮件提醒!", curPlayer.GetID())
-#    else:
-#        GameWorld.DebugLog("    发送新限时抢购邮件提醒  时间没到!startTime=%s,endTime=%s,curDateTime=%s"%(startTime,endTime,curDateTime), curPlayer.GetID())
+    
+    for actInfo in PyGameData.g_operationActionDict.get(ShareDefine.OperationActionName_FlashSale, {}).values():
+        actNum = actInfo.get(ShareDefine.ActKey_ActNum, 0)
+        if not actInfo:
+            continue
+        cfgID = actInfo.get(ShareDefine.ActKey_CfgID, 0)
+        if not cfgID:
+            continue
+        playerMailState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FlashSaleMailState % actNum, 0, ChConfig.Def_PDictType_FlashSale)  # 玩家身上的活动提醒邮件状态
+        if playerMailState:
+            continue
+        flashSaleIpyData = IpyGameDataPY.GetIpyGameData("ActFlashSale", cfgID)
+        if not flashSaleIpyData:
+            continue
+        mailKey = flashSaleIpyData.GetMailKey()
+        LVLimit = flashSaleIpyData.GetLVLimit()
+        if not mailKey or curPlayer.GetLV() < LVLimit:
+            continue
+        openServerDay = GameWorld.GetGameWorld().GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_ServerDay) + 1
+        startDate = GameWorld.GetOperationActionDateStr(flashSaleIpyData.GetStartDate(), openServerDay)
+        endDate = GameWorld.GetOperationActionDateStr(flashSaleIpyData.GetEndDate(), openServerDay)
+        startTimeList = flashSaleIpyData.GetStartTimeList()
+        endTimeList = flashSaleIpyData.GetEndTimeList()
+        if not startTimeList or not endTimeList:
+            continue
+        advanceMinutes = flashSaleIpyData.GetAdvanceMinutes()
+        startTime = datetime.datetime.strptime("%s %s:00" % (startDate, startTimeList[0]), ChConfig.TYPE_Time_Format) + datetime.timedelta(minutes=-advanceMinutes)
+        endTime = datetime.datetime.strptime("%s %s:00" % (endDate, endTimeList[-1]), ChConfig.TYPE_Time_Format)
+        curDateTime = GameWorld.GetCurrentTime()
+        if startTime <= curDateTime <= endTime:
+            paramList = [startDate.replace('-','/'), endDate.replace('-','/'), GameWorld.GbkToCode('、').join(startTimeList)]
+            PlayerControl.SendMailByKey(mailKey, [curPlayer.GetID()], flashSaleIpyData.GetMailItemPrize(), paramList)
+            startTimeNum = GameWorld.ChangeTimeStrToNum(startDate, timeFormat=ChConfig.TYPE_Time_Format_Day)
+            PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FlashSaleMailState % actNum, startTimeNum, ChConfig.Def_PDictType_FlashSale)
+            GameWorld.DebugLog("    发送新限时抢购邮件提醒!", curPlayer.GetID())
+    #    else:
+    #        GameWorld.DebugLog("    发送新限时抢购邮件提醒  时间没到!startTime=%s,endTime=%s,curDateTime=%s"%(startTime,endTime,curDateTime), curPlayer.GetID())
     return
 
 
-def Sync_flashSaleActionInfo(curPlayer):
+def Sync_flashSaleActionInfo(curPlayer, actNum):
     ## 通知限时抢购活动信息
-    actInfo = PyGameData.g_operationActionDict.get(ShareDefine.OperationActionName_FlashSale, {})
+    actInfo = GameWorld.GetActInfo(ShareDefine.OperationActionName_FlashSale, actNum)
     if not actInfo:
         return
     
@@ -169,6 +240,7 @@
     job = curPlayer.GetJob()
     openServerDay = GameWorld.GetGameWorld().GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_ServerDay) + 1
     packInfo = ChPyNetSendPack.tagMCFlashSaleInfo()
+    packInfo.ActNum = actNum
     packInfo.StartDate = GameWorld.GetOperationActionDateStr(flashSaleIpyData.GetStartDate(), openServerDay)
     packInfo.EndtDate = GameWorld.GetOperationActionDateStr(flashSaleIpyData.GetEndDate(), openServerDay)
     packInfo.AdvanceMinutes = flashSaleIpyData.GetAdvanceMinutes()
@@ -222,27 +294,29 @@
 #struct     tagCMFlashSaleAppointment
 #{
 #    tagHead        Head;
+#    BYTE        ActNum;        //活动编号
 #    DWORD        GoodsID;         // 抢购商品标识
 #    BYTE        State;         // 1-预约 0-取消
 #};
 def OnFlashSaleAppointment(index, packData, tick):
     curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
+    actNum = packData.ActNum
     goodsID = packData.GoodsID
     
-    actInfo = PyGameData.g_operationActionDict.get(ShareDefine.OperationActionName_FlashSale, {})
+    actInfo = GameWorld.GetActInfo(ShareDefine.OperationActionName_FlashSale, actNum)
     if not actInfo:
         return
     cfgID = actInfo.get(ShareDefine.ActKey_CfgID, 0)
     if not cfgID:
         return
-    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FlashSaleYY % goodsID, packData.State, ChConfig.Def_PDictType_FlashSale)
-    Sync_FlashSaleAppointmentInfo(curPlayer, goodsID)
+    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FlashSaleYY % (actNum, goodsID), packData.State, ChConfig.Def_PDictType_FlashSale)
+    Sync_FlashSaleAppointmentInfo(curPlayer, actNum, goodsID)
     return
 
 
-def Sync_FlashSaleAppointmentInfo(curPlayer, goodsID=0):
+def Sync_FlashSaleAppointmentInfo(curPlayer, actNum, goodsID=0):
     ##通知限时抢购预约情况
-    actInfo = PyGameData.g_operationActionDict.get(ShareDefine.OperationActionName_FlashSale, {})
+    actInfo = GameWorld.GetActInfo(ShareDefine.OperationActionName_FlashSale, actNum)
     if not actInfo:
         return
     cfgID = actInfo.get(ShareDefine.ActKey_CfgID, 0)
@@ -254,6 +328,7 @@
     woldLV = actInfo.get(ShareDefine.ActKey_WorldLV, 0)
     
     packInfo = ChPyNetSendPack.tagMCFlashSaleAppointmentInfo()
+    packInfo.ActNum = actNum
     packInfo.GoodsList = []
     if goodsID == 0:
         packInfo.IsAll = 1
@@ -265,7 +340,7 @@
                     continue
                 for i in xrange(len(shopItemIpyDataList)):
                     goodsMark = dayIndex * 10000 + timeIndex * 100 + i  #商品标识
-                    isAppointment = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FlashSaleYY % goodsMark, 0, ChConfig.Def_PDictType_FlashSale)
+                    isAppointment = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FlashSaleYY % (actNum, goodsMark), 0, ChConfig.Def_PDictType_FlashSale)
                     if isAppointment:
                         appoinetmentPack = ChPyNetSendPack.tagMCFlashSaleAppointmentState()
                         appoinetmentPack.GoodsMark = goodsMark
@@ -273,7 +348,7 @@
                         packInfo.GoodsList.append(appoinetmentPack)
     else:
         packInfo.IsAll = 0
-        isAppointment = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FlashSaleYY % goodsID, 0, ChConfig.Def_PDictType_FlashSale)
+        isAppointment = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FlashSaleYY % (actNum, goodsID), 0, ChConfig.Def_PDictType_FlashSale)
         appoinetmentPack = ChPyNetSendPack.tagMCFlashSaleAppointmentState()
         appoinetmentPack.GoodsMark = goodsID
         appoinetmentPack.State = isAppointment
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ShareDefine.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ShareDefine.py
index 2e66b8f..53dde27 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ShareDefine.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ShareDefine.py
@@ -265,7 +265,7 @@
 #支持多活动分组编号的活动名
 MultiActNumOperationActNameList = [OperationActionName_TotalRecharge, OperationActionName_CollectWords,
                                    OperationActionName_FlashGiftbag, OperationActionName_CostRebate,
-                                   OperationActionName_SpringSale,
+                                   OperationActionName_SpringSale, OperationActionName_FlashSale,
                                    ]
 
 #跨服运营活动表名定义

--
Gitblit v1.8.0