From 466edcd49de033afca96312a4291116fa282f8c3 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期一, 15 五月 2023 20:11:45 +0800
Subject: [PATCH] 4075 【BT8】【BT9】【主干】限时抢购修复多活动同时开时导致相互重置活动记录bug;(比如常规和合服活动都开放的时候)

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFlashSale.py |   43 ++++++++++++++++++++++++++++++-------------
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py               |    4 +++-
 2 files changed, 33 insertions(+), 14 deletions(-)

diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
index 2b8320f..8154581 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
@@ -3407,7 +3407,9 @@
 Def_PDictType_Success,   #成就
 Def_PDictType_GFPassive, # 被动功法
 Def_PDictType_GreatMaster, # 大师
-) = range(15)
+Def_PDictType_FlashSaleMix, #限时抢购 合服
+Def_PDictType_FlashSaleFeast, #限时抢购 节日
+) = range(17)
 
 # 玩家字典key定义规则, key的长度不能超过29个字节, 注意尽量避免命名重复
 # 新增参数TYPE 用于字典分类,默认0
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 ceb9839..e3f8dba 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFlashSale.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFlashSale.py
@@ -27,6 +27,18 @@
 
 import datetime
 
+def GetActNumDictType(actNum):
+    '''获取活动分组编号对应的字典类型
+    因为本功能用了 ClearNomalDict 不同的活动分组必须不一样的字典类型,不能可能导致不同活动分组数据异常
+    '''
+    actType = actNum / 10
+    if actType == ShareDefine.ActType_OpenComm:
+        return ChConfig.Def_PDictType_FlashSale
+    if actType == ShareDefine.ActType_MixServer:
+        return ChConfig.Def_PDictType_FlashSaleMix
+    if actType == ShareDefine.ActType_Feast:
+        return ChConfig.Def_PDictType_FlashSaleFeast
+    return 0
 
 def GetShopTypeList(cfgID, dayIndex, state, woldLV):
     if cfgID == 0 or state == 0:
@@ -71,9 +83,11 @@
     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 % 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)  # 玩家身上的活动提醒邮件状态
+    dType = GetActNumDictType(actNum)
+    
+    playerActID = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FlashSaleID % actNum, 0, dType)  # 玩家身上的活动ID
+    playerActState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FlashSaleState % actNum, 0, dType)  # 玩家身上的活动State
+    playerMailState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FlashSaleMailState % actNum, 0, dType)  # 玩家身上的活动提醒邮件状态
     isReset = False
     if actID != playerActID or (state != playerActState):
         isReset = True
@@ -86,14 +100,14 @@
         else:
             startTimeNum = 0
         if playerMailState != startTimeNum:
-            GameWorld.DebugLog('    限时抢购活动重置!')
-            curPlayer.ClearNomalDict(ChConfig.Def_PDictType_FlashSale)
-        
+            GameWorld.DebugLog('    限时抢购活动重置! actNum=%s,dType=%s' % (actNum, dType), playerID)
+            curPlayer.ClearNomalDict(dType)
+            
         shopTypeList = GetShopTypeList(cfgID, dayIndex, state, woldLV)
         if shopTypeList:
             FunctionNPCCommon.ResetShopItemBuyCountByShopType(curPlayer, shopTypeList)
-        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)
+        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FlashSaleID % actNum, actID, dType)
+        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FlashSaleState % actNum, state, dType)
         #Sync_flashSaleActionInfo(curPlayer)
         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:
@@ -134,7 +148,8 @@
         cfgID = actInfo.get(ShareDefine.ActKey_CfgID, 0)
         if not cfgID:
             continue
-        playerMailState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FlashSaleMailState % actNum, 0, ChConfig.Def_PDictType_FlashSale)  # 玩家身上的活动提醒邮件状态
+        dType = GetActNumDictType(actNum)
+        playerMailState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FlashSaleMailState % actNum, 0, dType)  # 玩家身上的活动提醒邮件状态
         if playerMailState:
             continue
         flashSaleIpyData = IpyGameDataPY.GetIpyGameData("ActFlashSale", cfgID)
@@ -157,7 +172,7 @@
             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)
+            PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FlashSaleMailState % actNum, startTimeNum, dType)
             GameWorld.DebugLog("    发送新限时抢购邮件提醒!", curPlayer.GetID())
     #    else:
     #        GameWorld.DebugLog("    发送新限时抢购邮件提醒  时间没到!startTime=%s,endTime=%s,curDateTime=%s"%(startTime,endTime,curDateTime), curPlayer.GetID())
@@ -260,7 +275,8 @@
     cfgID = actInfo.get(ShareDefine.ActKey_CfgID, 0)
     if not cfgID:
         return
-    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FlashSaleYY % (actNum, goodsID), packData.State, ChConfig.Def_PDictType_FlashSale)
+    dType = GetActNumDictType(actNum)
+    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FlashSaleYY % (actNum, goodsID), packData.State, dType)
     Sync_FlashSaleAppointmentInfo(curPlayer, actNum, goodsID)
     return
 
@@ -277,6 +293,7 @@
     if not flashSaleIpyData:
         return
     woldLV = actInfo.get(ShareDefine.ActKey_WorldLV, 0)
+    dType = GetActNumDictType(actNum)
     
     packInfo = ChPyNetSendPack.tagMCFlashSaleAppointmentInfo()
     packInfo.ActNum = actNum
@@ -291,7 +308,7 @@
                     continue
                 for i in xrange(len(shopItemIpyDataList)):
                     goodsMark = dayIndex * 10000 + timeIndex * 100 + i  #商品标识
-                    isAppointment = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FlashSaleYY % (actNum, goodsMark), 0, ChConfig.Def_PDictType_FlashSale)
+                    isAppointment = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FlashSaleYY % (actNum, goodsMark), 0, dType)
                     if isAppointment:
                         appoinetmentPack = ChPyNetSendPack.tagMCFlashSaleAppointmentState()
                         appoinetmentPack.GoodsMark = goodsMark
@@ -299,7 +316,7 @@
                         packInfo.GoodsList.append(appoinetmentPack)
     else:
         packInfo.IsAll = 0
-        isAppointment = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FlashSaleYY % (actNum, goodsID), 0, ChConfig.Def_PDictType_FlashSale)
+        isAppointment = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FlashSaleYY % (actNum, goodsID), 0, dType)
         appoinetmentPack = ChPyNetSendPack.tagMCFlashSaleAppointmentState()
         appoinetmentPack.GoodsMark = goodsID
         appoinetmentPack.State = isAppointment

--
Gitblit v1.8.0