From 8eec7c10e8d56fad0159556eb1ef7f3d6d68a479 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期二, 26 一月 2021 11:40:17 +0800
Subject: [PATCH] 8710 【开发】【主干】【BT2】根据世界等级配置奖励(集字活动支持按世界等级配置不同奖励);

---
 ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldActionControl.py             |   61 ++++++++++++++++--------------
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ShareDefine.py                  |    1 
 ServerPython/CoreServerGroup/GameServer/Script/ShareDefine.py                                       |    1 
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerActCollectWords.py |   52 ++++++++++++++-----------
 4 files changed, 63 insertions(+), 52 deletions(-)

diff --git a/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldActionControl.py b/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldActionControl.py
index 58e0646..087a71b 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldActionControl.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldActionControl.py
@@ -588,42 +588,45 @@
         sendMapServerMsgDict = mapServerInfoDict.get(actName, {})
         
         dbOperationActIDKey = PlayerDBGSEvent.Def_OperationActID % actName
-        curActID = sendMapServerMsgDict.get(ShareDefine.ActKey_ID)
+        dbActID = PlayerDBGSEvent.GetDBGSTrig_ByKey(dbOperationActIDKey)
+        curActID = sendMapServerMsgDict.get(ShareDefine.ActKey_ID, 0)
         dayIndex = sendMapServerMsgDict.get(ShareDefine.ActKey_DayIndex, 0)
-        if curActID and PlayerDBGSEvent.GetDBGSTrig_ByKey(dbOperationActIDKey) != curActID:
-            GameWorld.Log("    dbActID变更,dbActID=%s,curActID=%s" % (PlayerDBGSEvent.GetDBGSTrig_ByKey(dbOperationActIDKey), curActID))
+        if dbActID != curActID:
+            GameWorld.Log("    dbActID变更: dbActID=%s,curActID=%s" % (dbActID, curActID))
             PlayerDBGSEvent.SetDBGSTrig_ByKey(dbOperationActIDKey, curActID)
-            if actName in ShareDefine.NeedWorldLVOperationActNameList:
-                #记录开启时世界等级
-                worldLV = PlayerDBGSEvent.GetDBGSTrig_ByKey(ShareDefine.Def_Notify_WorldKey_WorldAverageLv)
-                PlayerDBGSEvent.SetDBGSTrig_ByKey(PlayerDBGSEvent.Def_OActWorldLV % actName, worldLV)
-                GameWorld.Log("    记录活动开启时世界等级: worldLV=%s" % (worldLV))
-                
-            #此处为活动开启时
-            if actName == ShareDefine.OperationActionName_BossReborn:
-                #重置BOSS复活点
-                GameWorldBoss.ResetBossRebornPoint()
-            elif actName == ShareDefine.OperationActionName_FairyCeremony:
-                #重置仙界盛典
-                PlayerFairyCeremony.ResetFairyCeremony()
-            elif actName == ShareDefine.OperationActionName_NewFairyCeremony:
-                #重置仙界盛典
-                PlayerNewFairyCeremony.ResetNewFairyCeremony()
-            elif actName == ShareDefine.OperationActionName_FeastRedPacket:
-                #重置节日红包
-                if ipyData:
-                    PlayerFamilyRedPacket.OnResetFeastRedPacket(ipyData, dayIndex)
-            elif actName == ShareDefine.OperationActionName_FlashSale:
-                #限时抢购重置购买次数 本次活动每场不能重复
-                #dayIndex = sendMapServerMsgDict.get(ShareDefine.ActKey_DayIndex, 0)
-                PlayerStore.ResetFlashSaleBuyCnt(ipyData)
+            
+            if curActID:
+                if actName in ShareDefine.NeedWorldLVOperationActNameList:
+                    #记录开启时世界等级
+                    worldLV = PlayerDBGSEvent.GetDBGSTrig_ByKey(ShareDefine.Def_Notify_WorldKey_WorldAverageLv)
+                    PlayerDBGSEvent.SetDBGSTrig_ByKey(PlayerDBGSEvent.Def_OActWorldLV % actName, worldLV)
+                    GameWorld.Log("    记录活动开启时世界等级: worldLV=%s" % (worldLV))
+                    
+                #此处为活动开启时
+                if actName == ShareDefine.OperationActionName_BossReborn:
+                    #重置BOSS复活点
+                    GameWorldBoss.ResetBossRebornPoint()
+                elif actName == ShareDefine.OperationActionName_FairyCeremony:
+                    #重置仙界盛典
+                    PlayerFairyCeremony.ResetFairyCeremony()
+                elif actName == ShareDefine.OperationActionName_NewFairyCeremony:
+                    #重置仙界盛典
+                    PlayerNewFairyCeremony.ResetNewFairyCeremony()
+                elif actName == ShareDefine.OperationActionName_FeastRedPacket:
+                    #重置节日红包
+                    if ipyData:
+                        PlayerFamilyRedPacket.OnResetFeastRedPacket(ipyData, dayIndex)
+                elif actName == ShareDefine.OperationActionName_FlashSale:
+                    #限时抢购重置购买次数 本次活动每场不能重复
+                    #dayIndex = sendMapServerMsgDict.get(ShareDefine.ActKey_DayIndex, 0)
+                    PlayerStore.ResetFlashSaleBuyCnt(ipyData)
         else:
-            GameWorld.Log("    dbActID不变或无活动: dbActID=%s,curActID=%s" % (PlayerDBGSEvent.GetDBGSTrig_ByKey(dbOperationActIDKey), curActID))
+            GameWorld.Log("    dbActID不变: dbActID=%s,curActID=%s" % (dbActID, curActID))
             
         if actName in ShareDefine.NeedWorldLVOperationActNameList:
             actWorldLV = PlayerDBGSEvent.GetDBGSTrig_ByKey(PlayerDBGSEvent.Def_OActWorldLV % actName)
             sendMapServerMsgDict[ShareDefine.ActKey_WorldLV] = actWorldLV
-            GameWorld.Log("    活动开始时世界等级: actWorldLV=%s" % (actWorldLV))
+            GameWorld.Log("    活动世界等级: actWorldLV=%s" % (actWorldLV))
             
         if actName == ShareDefine.OperationActionName_ExpRate:
             if isReload and ipyData:
diff --git a/ServerPython/CoreServerGroup/GameServer/Script/ShareDefine.py b/ServerPython/CoreServerGroup/GameServer/Script/ShareDefine.py
index 2e4ece3..7b0f96d 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/ShareDefine.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/ShareDefine.py
@@ -245,6 +245,7 @@
                                    OperationActionName_SpringSale, OperationActionName_LuckyTreasure,
                                    OperationActionName_DailyGiftbag, OperationActionName_GrowupBuy,
                                    OperationActionName_WeekParty,
+                                   OperationActionName_CollectWords, OperationActionName_CollectWords2,
                                    ]
 
 #跨服运营活动表名定义
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerActCollectWords.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerActCollectWords.py
index 6e59afb..45f9831 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerActCollectWords.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerActCollectWords.py
@@ -76,19 +76,20 @@
         GameWorld.DebugLog("集字活动ID不变,不处理!actNum=%s,actID=%s" % (actNum, actID), curPlayer.GetPlayerID())
         return
     
+    templateID = 0
     cfgID = actInfo.get(ShareDefine.ActKey_CfgID, 0)
-    actIpyData = IpyGameDataPY.GetIpyGameData(actName, cfgID)
-    templateID = 0 if not actIpyData else actIpyData.GetTemplateID()
-    exchangeList = IpyGameDataPY.GetIpyGameDataList("CollectWordsExchange", templateID)
-    if not exchangeList:
-        GameWorld.ErrLog("集字兑换找不到兑换模板配置!actNum=%s,cfgID=%s,templateID=%s" % (actNum, cfgID, templateID), playerID)
-        return
-    
+    if cfgID:
+        actIpyData = IpyGameDataPY.GetIpyGameData(actName, cfgID)
+        templateID = 0 if not actIpyData else actIpyData.GetTemplateID()
+        exchangeList = IpyGameDataPY.GetIpyGameDataList("CollectWordsExchange", templateID)
+        if not exchangeList:
+            GameWorld.ErrLog("集字兑换找不到兑换模板配置!actNum=%s,cfgID=%s,templateID=%s" % (actNum, cfgID, templateID), playerID)
+        else:
+            for exchangeIpyData in exchangeList:
+                exchangeNum = exchangeIpyData.GetExchangeNum()
+                PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CollectWordsExchangeCount % (actNum, exchangeNum), 0)
+                
     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CollectWordsID % actNum, actID)
-    for exchangeIpyData in exchangeList:
-        exchangeNum = exchangeIpyData.GetExchangeNum()
-        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CollectWordsExchangeCount % (actNum, exchangeNum), 0)
-        
     GameWorld.DebugLog("集字活动重置! actNum=%s,cfgID=%s,templateID=%s,actID=%s" % (actNum, cfgID, templateID, actID), playerID)
     
     if state:
@@ -250,7 +251,7 @@
                            % (templateID, exchangeNum, curExchangeCount, exchangeCountMax))
         return
     
-    exchangeItemInfo = findIpyData.GetExchangeItemInfo()
+    exchangeItemInfo = __GetExchangeItemInfo(findIpyData.GetExchangeItemInfo(), actInfo.get(ShareDefine.ActKey_WorldLV, 0))
     if len(exchangeItemInfo) != 3:
         return
     exchangeItemID = exchangeItemInfo[0]
@@ -285,6 +286,11 @@
         
     return
 
+def __GetExchangeItemInfo(cfgExchangeItemInfo, worldLV):
+    if isinstance(cfgExchangeItemInfo, dict):
+        return GameWorld.GetDictValueByRangeKey(cfgExchangeItemInfo, worldLV, [])
+    return cfgExchangeItemInfo
+
 def SyncCollectWordsActionInfo(curPlayer, actNum):
     ## 同步活动信息
     
@@ -309,18 +315,18 @@
         return
     
     openServerDay = GameWorld.GetGameWorld().GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_ServerDay) + 1
-    actInfo = ChPyNetSendPack.tagMCActCollectWordsInfo()
-    actInfo.ActNum = actNum
-    actInfo.StartDate = GameWorld.GetOperationActionDateStr(ipyData.GetStartDate(), openServerDay)
-    actInfo.EndtDate = GameWorld.GetOperationActionDateStr(ipyData.GetEndDate(), openServerDay)
-    actInfo.LimitLV = ipyData.GetLVLimit()
-    actInfo.LastDayOnlyExchange = ipyData.GetLastDayOnlyExchange()
-    actInfo.ExchangeItemList = []
+    clientPack = ChPyNetSendPack.tagMCActCollectWordsInfo()
+    clientPack.ActNum = actNum
+    clientPack.StartDate = GameWorld.GetOperationActionDateStr(ipyData.GetStartDate(), openServerDay)
+    clientPack.EndtDate = GameWorld.GetOperationActionDateStr(ipyData.GetEndDate(), openServerDay)
+    clientPack.LimitLV = ipyData.GetLVLimit()
+    clientPack.LastDayOnlyExchange = ipyData.GetLastDayOnlyExchange()
+    clientPack.ExchangeItemList = []
     
     exchangeList = IpyGameDataPY.GetIpyGameDataList("CollectWordsExchange", templateID)
     if exchangeList:
         for exchangeIpyData in exchangeList:
-            itemID, itemCount, isBind = exchangeIpyData.GetExchangeItemInfo()
+            itemID, itemCount, isBind = __GetExchangeItemInfo(exchangeIpyData.GetExchangeItemInfo(), actInfo.get(ShareDefine.ActKey_WorldLV, 0))
             needItemList = exchangeIpyData.GetNeedItemList()
             
             exchangeItem = ChPyNetSendPack.tagMCActCollectWordsExchangeItem()
@@ -338,10 +344,10 @@
                 exchangeItem.NeedItemList.append(needItem)
             exchangeItem.NeedItemCount = len(exchangeItem.NeedItemList)
             
-            actInfo.ExchangeItemList.append(exchangeItem)
+            clientPack.ExchangeItemList.append(exchangeItem)
             
-    actInfo.ExchangeCount = len(actInfo.ExchangeItemList)
-    NetPackCommon.SendFakePack(curPlayer, actInfo)
+    clientPack.ExchangeCount = len(clientPack.ExchangeItemList)
+    NetPackCommon.SendFakePack(curPlayer, clientPack)
     return
 
 def SyncCollectWordsPlayerInfo(curPlayer, actNum, exchangeNum=0):
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ShareDefine.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ShareDefine.py
index 2e4ece3..7b0f96d 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ShareDefine.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ShareDefine.py
@@ -245,6 +245,7 @@
                                    OperationActionName_SpringSale, OperationActionName_LuckyTreasure,
                                    OperationActionName_DailyGiftbag, OperationActionName_GrowupBuy,
                                    OperationActionName_WeekParty,
+                                   OperationActionName_CollectWords, OperationActionName_CollectWords2,
                                    ]
 
 #跨服运营活动表名定义

--
Gitblit v1.8.0