From ad66d3a18003f0451e5620c4cc39bd6dfa63d66b Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期六, 14 三月 2020 16:57:51 +0800
Subject: [PATCH] 8401 【后端】BOSS复活修改(活动boss刷新支持)

---
 ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldActionControl.py          |    1 
 PyNetPack                                                                                        |    2 
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/Boss.py          |    2 
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ShareDefine.py               |    1 
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCustomRefresh.py      |   71 +++++++++++++++--------------------
 ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldBoss.py                   |    9 ++++
 ServerPython/CoreServerGroup/GameServer/Script/ShareDefine.py                                    |    1 
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerEventCounter.py |    5 --
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py                  |    2 
 9 files changed, 45 insertions(+), 49 deletions(-)

diff --git a/PyNetPack b/PyNetPack
index 8f2ab74..2aa3c20 160000
--- a/PyNetPack
+++ b/PyNetPack
@@ -1 +1 @@
-Subproject commit 8f2ab740c1e7139456629265d52d237a273b8177
+Subproject commit 2aa3c20dde03d0e46b9bb422cf48784c5e171c76
diff --git a/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldActionControl.py b/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldActionControl.py
index 3f3a36e..7420dec 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldActionControl.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldActionControl.py
@@ -865,6 +865,7 @@
             # 骑宠争夺活动开始前同步有效人数到地图
             if dailyActionID == ShareDefine.DailyActionID_FamilyRobBoss:
                 GameWorldBoss.SyncMapServer_HorsePetRobBossPlayerCount()
+                GameWorld.SendMapServerMsgEx(ShareDefine.Def_Notify_WorldKey_ActionBossRebornSign % dailyActionID, int(time.time()))
                 
         #通知Mapserver,设置字典
         GameWorld.SendMapServerMsgEx(dictName, state)
diff --git a/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldBoss.py b/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldBoss.py
index ba4025e..0243896 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldBoss.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldBoss.py
@@ -995,13 +995,18 @@
     if not totalPoint:
         GameWorld.Log(' 增加boss复活点 没有总点数!!!!')
         return
+    rebornCnt = PlayerDBGSEvent.GetDBGSTrig_ByKey(PlayerDBGSEvent.Def_BossRebornCnt)
+    maxRebornCnt = IpyGameDataPY.GetFuncCfg('BossRebornTotalPoint', 3)
+    if rebornCnt >= maxRebornCnt:
+        GameWorld.DebugLog(' boss复活已达到最大次数! maxRebornCnt=%s' % maxRebornCnt)
+        return
+    
     curPoint = PlayerDBGSEvent.GetDBGSTrig_ByKey(PlayerDBGSEvent.Def_BossRebornPoint)
     
     updPoint = (curPoint+addPoint)%totalPoint
     PlayerDBGSEvent.SetDBGSTrig_ByKey(PlayerDBGSEvent.Def_BossRebornPoint, updPoint)
     if curPoint+addPoint >= totalPoint:
         #重生boss
-        rebornCnt = PlayerDBGSEvent.GetDBGSTrig_ByKey(PlayerDBGSEvent.Def_BossRebornCnt)
         PlayerDBGSEvent.SetDBGSTrig_ByKey(PlayerDBGSEvent.Def_BossRebornCnt, rebornCnt+1)
         
         killBossCntLimitDict = IpyGameDataPY.GetFuncEvalCfg('KillBossCntLimit', 1, {})
@@ -1027,6 +1032,8 @@
         PyGameData.g_sortBOSSRefreshList.sort(key=lambda asd:max(0, asd[2] - (curTime - asd[1])))
         GameWorld.Log(' boss复活活动 重生boss bossIDList=%s'%bossIDList)
         g_lastBossRebornTime = curTime
+        
+        GameWorld.SendMapServerMsgEx(ShareDefine.Def_Notify_WorldKey_ActionBossRebornSign % ShareDefine.OperationActionName_BossReborn, int(time.time()))
     else:
         #广播
         needNotifyPointPerList = IpyGameDataPY.GetFuncEvalCfg('BossRebornNotify')
diff --git a/ServerPython/CoreServerGroup/GameServer/Script/ShareDefine.py b/ServerPython/CoreServerGroup/GameServer/Script/ShareDefine.py
index debc9a8..633607c 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/ShareDefine.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/ShareDefine.py
@@ -146,6 +146,7 @@
 Def_Notify_WorldKey_MapServerScriptReloadVersion = 'MapServerScriptReloadVersion'  # MapServer 脚本重读版本标记
 Def_Notify_WorldKey_InitGameWorldTime = "InitGameWorldTime"  #启动服务器时间
 Def_Notify_WorldKey_OperationActionInfo = "OperationActionInfo_%s" # 运营活动信息,参数为运营活动名
+Def_Notify_WorldKey_ActionBossRebornSign = "ActBossSign_%s" # 活动boss重生标记,参数为日常活动ID 或 运营活动名
 Def_Notify_WorldKey_DailyActionState = "DailyActionState_%s" # 日常活动状态,参数为日常活动ID
 Def_Notify_WorldKey_CrossDailyActionState = "CrossDailyActionState_%s" # 跨服日常活动状态,参数为日常活动ID
 Def_Notify_WorldKey_FBEnterTimeLimiitMapID = "FBEnterTimeLimiitMapID" # 进入副本有时间限制的地图ID列表
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
index 2da3418..30266ae 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
@@ -1998,7 +1998,7 @@
 Map_Player_AreaReward_GetCnt = "AreaAward_GetCnt%s" # 玩家战场区域福利-累计获得次数
 
 #---地图NPC---
-Map_NPC_ActivityBossRebornCount = 'ActivityBossRebornCount_%s' # 活动boss已刷新只数,参数(标识点)
+Map_NPC_ActBossLastRebornSign = 'ActBossRebornSign_%s'   # 活动boss上次复活标记,参数为刷新标识点
 Map_NPC_WorldBossLastReBornTick = 'WorldBossLastReBornTick_%s' # 世界boss上次重生时间
 Map_NPC_WorldBossDeadTick = 'WorldBossDeadTick_%s' # 世界boss死亡时间
 Map_NPC_RandomMapNPCID = 'RandMapNPCID_%s' # 当前地图随机NPCID, 参数为标识点mark
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/Boss.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/Boss.py
index 950f6b9..42a7959 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/Boss.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/Boss.py
@@ -66,7 +66,7 @@
             bossKey = ChConfig.Map_NPC_WorldBossLastReBornTick % ipyData.GetStoneNPCID()
             GameWorld.GetGameFB().SetGameFBDict(bossKey, 0)
             
-            GameWorld.GetGameFB().SetGameFBDict(ChConfig.Map_NPC_ActivityBossRebornCount % ipyData.GetRefreshMark(), 0)
+            GameWorld.GetGameFB().SetGameFBDict(ChConfig.Map_NPC_ActBossLastRebornSign % ipyData.GetRefreshMark(), 0)
         
     gameNPCManager = GameWorld.GetNPCManager()
     tick = GameWorld.GetGameWorld().GetTick()
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCustomRefresh.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCustomRefresh.py
index 2a17501..31f12b4 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCustomRefresh.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCustomRefresh.py
@@ -22,6 +22,7 @@
 import PlayerControl
 import IPY_GameWorld
 import IpyGameDataPY
+import PyGameData
 import GameWorld
 import FBCommon
 import FBLogic
@@ -315,31 +316,6 @@
 def NPCRefresh_219(npcRefresh, tick):__DoRefreshWorldBoss(npcRefresh, tick)
 def NPCRefresh_220(npcRefresh, tick):__DoRefreshWorldBoss(npcRefresh, tick)
 
-
-def ResetActivityBossRefreshCount():
-    ## 重置活动boss刷怪个数
-    
-    # gameFb 要取活动线
-    activityLineIndex = 0 # 活动线, 默认1线
-    mapID = GameWorld.GetMap().GetMapID()
-    activityMapLineDict = IpyGameDataPY.GetFuncEvalCfg("MapLine", 2, {})
-    if mapID in activityMapLineDict:
-        activityLineIndex = max(0, activityMapLineDict[mapID] - 1)
-        
-    gameWorld = IPY_GameWorld.IPY_GameWorld(activityLineIndex)
-    gameFB = gameWorld.GetGameFBByFbIndex(activityLineIndex)
-    if not gameFB:
-        return
-    
-    gameNPC = GameWorld.GetNPCManager() # NPC标识点的无所谓,哪条线都可以,因为都一样
-    for i in xrange(gameNPC.GetCustomNPCRefreshCount()):
-        npcRefresh = gameNPC.GetCustomNPCRefreshAt(i)
-        refreshMark = npcRefresh.GetRefreshMark()
-        if gameFB.GetGameFBDictByKey(ChConfig.Map_NPC_ActivityBossRebornCount % refreshMark):
-            gameFB.SetGameFBDict(ChConfig.Map_NPC_ActivityBossRebornCount % refreshMark, 0)
-            GameWorld.DebugLog("重置活动boss刷怪点刷怪个数: activityLineIndex=%s,refreshMark=%s" % (activityLineIndex, refreshMark))
-    return
-
 ## 世界boss刷怪
 #  @param npcRefresh 刷新实例
 #  @param tick 当前时间
@@ -355,7 +331,7 @@
     mapID = GameWorld.GetMap().GetMapID()
     refreshMark = npcRefresh.GetRefreshMark()
     lineID = GameWorld.GetGameWorld().GetLineID()
-    relatedType, relatedID = 0, 0
+    relatedType, relatedID = 0, ""
     isNeedShunt = 0
     if mapID == ChConfig.Def_FBMapID_SealDemon:
         bossID = GameLogic_SealDemon.CurFBLineBOSSID()
@@ -392,15 +368,21 @@
         return
     gameFB = GameWorld.GetGameFB()
     gameWorldMgr = GameWorld.GetGameWorld()
-    isActivityBoss = False # 是否活动boss
+    forceReborn = False # 强制重生
+    actBossRebornSign = 0
+    mapActBossRebornSign = 0
     # 关联日常活动
     if relatedType == 1:
+        relatedID = int(relatedID)
         actionKey = ShareDefine.Def_Notify_WorldKey_DailyActionState % relatedID
         rebornBossState = 1 if gameWorldMgr.GetGameWorldDictByKey(actionKey) else 0
-        isActivityBoss = True
+        
     # 关联运营活动,待扩展
     elif relatedType == 2:
-        pass
+        operationActionInfo = PyGameData.g_operationActionDict.get(relatedID, {})
+        operationActionState = operationActionInfo.get(ShareDefine.ActKey_State, 0)
+        rebornBossState = 1 if operationActionState else 0
+        
     else:
         bosskey = ShareDefine.Def_Notify_WorldKey_GameWorldBossReborn % bossID
         rebornBossState = gameWorldMgr.GetGameWorldDictByKey(bosskey)
@@ -410,13 +392,19 @@
     if mapID in activityMapLineDict:
         activityLineID = max(0, activityMapLineDict[mapID] - 1)
         
-    # 活动boss只在活动线路刷
-    if isActivityBoss:
-        activityBossRebornCount = gameFB.GetGameFBDictByKey(ChConfig.Map_NPC_ActivityBossRebornCount % refreshMark)
+    # 关联活动boss
+    if relatedType:
         rebornLineID = activityLineID # 活动boss只刷在活动线
         # 不是活动线 
         if rebornBossState and lineID != rebornLineID:
             rebornBossState = 0
+            
+        # 关联活动boss只要复活标记与上次不同,则强制重生
+        actBossRebornSign = gameWorldMgr.GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_ActionBossRebornSign % relatedID)
+        mapActBossRebornSign = gameFB.GetGameFBDictByKey(ChConfig.Map_NPC_ActBossLastRebornSign % refreshMark)
+        rebornBossState = rebornBossState and actBossRebornSign
+        if rebornBossState and actBossRebornSign != mapActBossRebornSign:
+            forceReborn = True
             
     # 非活动boss活动线不刷, 1线除外
     else:
@@ -433,7 +421,7 @@
     # 复活状态
     if rebornBossState:
         if curNPC:
-            if curNPC.GetNPCID() == bossID:
+            if not forceReborn and curNPC.GetNPCID() == bossID:
                 return
             #去掉非bossNPC
             NPCCommon.SetDeadEx(curNPC)
@@ -442,9 +430,9 @@
         if lineID != rebornLineID and not isNeedShunt and mapID not in [ChConfig.Def_FBMapID_SealDemon, ChConfig.Def_FBMapID_ZhuXianBoss]:
             return
         
-        if isActivityBoss and activityBossRebornCount > 0:
-            #GameWorld.DebugLog("活动线已经刷过不再刷活动boss: lineID=%s,rebornLineID=%s,refreshMark=%s,bossID=%s,activityBossRebornCount=%s" 
-            #                   % (lineID, rebornLineID, refreshMark, bossID, activityBossRebornCount))
+        if mapActBossRebornSign and actBossRebornSign == mapActBossRebornSign:
+            #GameWorld.DebugLog("活动线已经刷过不再刷活动boss: lineID=%s,rebornLineID=%s,refreshMark=%s,bossID=%s,actBossRebornSign=%s" 
+            #                   % (lineID, rebornLineID, refreshMark, bossID, actBossRebornSign))
             return
         
     # 死亡状态
@@ -456,9 +444,12 @@
             if curNPC.GetNPCID() == stoneNPCID:
                 return 
             # 活动的boss
-            if curNPC.GetNPCID() == bossID and isActivityBoss:
+            if curNPC.GetNPCID() == bossID and relatedType:
                 GameWorld.Log("活动boss,活动结束,系统设置boss死亡!bossID=%s" % bossID)
-                PlayerControl.FBNotify("FairyGrabBossNoDead", [bossID])
+                if relatedID == ShareDefine.DailyActionID_FamilyRobBoss:
+                    PlayerControl.FBNotify("FairyGrabBossNoDead", [bossID])
+                elif relatedID == ShareDefine.OperationActionName_BossReborn:
+                    pass
                 
             #去掉非墓碑NPC
             NPCCommon.SetDeadEx(curNPC)
@@ -485,8 +476,8 @@
     __InitNewBornNPC(npcRefresh, tick)
     gameFB.SetGameFBDict(key, tick)
     
-    if isActivityBoss and rebornBossState:
-        gameFB.SetGameFBDict(ChConfig.Map_NPC_ActivityBossRebornCount % refreshMark, activityBossRebornCount + 1)
+    if actBossRebornSign and rebornBossState:
+        gameFB.SetGameFBDict(ChConfig.Map_NPC_ActBossLastRebornSign % refreshMark, actBossRebornSign)
         
     GameWorld.DebugLog("BossRefresh mapID=%s,rebornLineID=%s,refreshMark=%s,rebornNPCID=%s,isNeedShunt=%s,OK!" 
                        % (mapID, rebornLineID, refreshMark, rebornNPCID, isNeedShunt), lineID)
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 8ef3d65..e4ded96 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerEventCounter.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerEventCounter.py
@@ -1447,11 +1447,6 @@
                     continue
                 PlayerWorldAverageLv.UpdatePlayerWorldAverageLv(curPlayer)
             
-    # 日常活动
-    elif key.startswith(ShareDefine.Def_Notify_WorldKey_DailyActionState[:-2]):
-        if value and gameWorldMgr.GetGameWorldDictByKey(key) != value:
-            NPCCustomRefresh.ResetActivityBossRefreshCount()
-            
     #通用设置
     befValue = gameWorldMgr.GetGameWorldDictByKey(key)
     gameWorldMgr.SetGameWorldDict(key, value)
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ShareDefine.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ShareDefine.py
index debc9a8..633607c 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ShareDefine.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ShareDefine.py
@@ -146,6 +146,7 @@
 Def_Notify_WorldKey_MapServerScriptReloadVersion = 'MapServerScriptReloadVersion'  # MapServer 脚本重读版本标记
 Def_Notify_WorldKey_InitGameWorldTime = "InitGameWorldTime"  #启动服务器时间
 Def_Notify_WorldKey_OperationActionInfo = "OperationActionInfo_%s" # 运营活动信息,参数为运营活动名
+Def_Notify_WorldKey_ActionBossRebornSign = "ActBossSign_%s" # 活动boss重生标记,参数为日常活动ID 或 运营活动名
 Def_Notify_WorldKey_DailyActionState = "DailyActionState_%s" # 日常活动状态,参数为日常活动ID
 Def_Notify_WorldKey_CrossDailyActionState = "CrossDailyActionState_%s" # 跨服日常活动状态,参数为日常活动ID
 Def_Notify_WorldKey_FBEnterTimeLimiitMapID = "FBEnterTimeLimiitMapID" # 进入副本有时间限制的地图ID列表

--
Gitblit v1.8.0