From 7aad7ca5ed189fba7b701cb99faa1edb1e1f7953 Mon Sep 17 00:00:00 2001
From: xdh <xiefantasy@qq.com>
Date: 星期二, 30 十月 2018 11:07:41 +0800
Subject: [PATCH] 2253 【1.2】【1.1】老服更新后法宝之魂潜力等级显示与实际不符

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCustomRefresh.py |  109 ++++++++++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 92 insertions(+), 17 deletions(-)

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 92db14a..1c58de8 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCustomRefresh.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCustomRefresh.py
@@ -17,6 +17,7 @@
 import ShareDefine
 import ReadChConfig
 import GameLogic_SealDemon
+import PlayerControl
 import IPY_GameWorld
 import IpyGameDataPY
 import GameWorld
@@ -337,6 +338,28 @@
 def NPCRefresh_100(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)
+    
+    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 当前时间
@@ -348,7 +371,8 @@
     mapID = GameWorld.GetMap().GetMapID()
     refreshMark = npcRefresh.GetRefreshMark()
     lineID = GameWorld.GetGameWorld().GetLineID()
-    
+    relatedType, relatedID = 0, 0
+    isNeedShunt = 0
     if mapID == ChConfig.Def_FBMapID_SealDemon:
         bossID = GameLogic_SealDemon.CurFBLineBOSSID()
         stoneNPCID = 0
@@ -358,14 +382,48 @@
             return
         stoneNPCID = ipyData.GetStoneNPCID()
         bossID = ipyData.GetNPCID()
+        relatedType = ipyData.GetRelatedType()
+        relatedID = ipyData.GetRelatedID()
+        isNeedShunt = ipyData.GetIsNeedShunt()
     if not bossID and not stoneNPCID:
         return
     
     gameFB = GameWorld.GetGameFB()
     gameWorldMgr = GameWorld.GetGameWorld()
-    bosskey = ShareDefine.Def_Notify_WorldKey_GameWorldBossReborn % bossID
-    rebornBossState = gameWorldMgr.GetGameWorldDictByKey(bosskey)
-    isNeedShunt = NPCCommon.IsMapNeedBossShunt(mapID)
+    isActivityBoss = False # 是否活动boss
+    # 关联日常活动
+    if relatedType == 1:
+        actionKey = ShareDefine.Def_Notify_WorldKey_DailyActionState % relatedID
+        rebornBossState = 1 if gameWorldMgr.GetGameWorldDictByKey(actionKey) else 0
+        isActivityBoss = True
+    # 关联运营活动,待扩展
+    elif relatedType == 2:
+        pass
+    else:
+        bosskey = ShareDefine.Def_Notify_WorldKey_GameWorldBossReborn % bossID
+        rebornBossState = gameWorldMgr.GetGameWorldDictByKey(bosskey)
+        
+    rebornLineID = 0
+    activityLineID = 0 # 活动线, 默认1线
+    activityMapLineDict = IpyGameDataPY.GetFuncEvalCfg("MapLine", 2, {})
+    if mapID in activityMapLineDict:
+        activityLineID = max(0, activityMapLineDict[mapID] - 1)
+        
+    # 活动boss只在活动线路刷
+    if isActivityBoss:
+        activityBossRebornCount = gameFB.GetGameFBDictByKey(ChConfig.Map_NPC_ActivityBossRebornCount % refreshMark)
+        rebornLineID = activityLineID # 活动boss只刷在活动线
+        # 不是活动线 
+        if rebornBossState and lineID != rebornLineID:
+            rebornBossState = 0
+            
+    # 非活动boss活动线不刷, 1线除外
+    else:
+        if activityLineID and lineID == activityLineID:
+            rebornBossState = 0
+            stoneNPCID = 0 # 活动线暂不刷墓碑
+            
+    isNeedShunt = NPCCommon.IsMapNeedBossShunt(mapID) and isNeedShunt
     
     curNPC = None
     if npcRefresh.GetCount() > 0:
@@ -379,8 +437,13 @@
             #去掉非bossNPC
             NPCCommon.SetDeadEx(curNPC)
             
-        # 非一线 且 不需要分流的地图 且 不是封魔坛  不允许复活
-        if lineID != 0 and not isNeedShunt and mapID != ChConfig.Def_FBMapID_SealDemon:
+        # 非复活线 且 不需要分流的地图 且 不是封魔坛  不允许复活
+        if lineID != rebornLineID and not isNeedShunt and mapID != ChConfig.Def_FBMapID_SealDemon:
+            return
+        
+        if isActivityBoss and activityBossRebornCount > 0:
+            #GameWorld.DebugLog("活动线已经刷过不再刷活动boss: lineID=%s,rebornLineID=%s,refreshMark=%s,bossID=%s,activityBossRebornCount=%s" 
+            #                   % (lineID, rebornLineID, refreshMark, bossID, activityBossRebornCount))
             return
         
     # 死亡状态
@@ -391,6 +454,11 @@
                 return
             if curNPC.GetNPCID() == stoneNPCID:
                 return 
+            # 活动的boss
+            if curNPC.GetNPCID() == bossID and isActivityBoss:
+                GameWorld.Log("活动boss,活动结束,系统设置boss死亡!bossID=%s" % bossID)
+                PlayerControl.FBNotify("FairyGrabBossNoDead", [bossID])
+                
             #去掉非墓碑NPC
             NPCCommon.SetDeadEx(curNPC)
         
@@ -415,23 +483,30 @@
     #初始化NPC
     __InitNewBornNPC(npcRefresh, tick)
     gameFB.SetGameFBDict(key, tick)
-    GameWorld.DebugLog("BossRefresh mapID=%s,refreshMark=%s,rebornNPCID=%s,isNeedShunt=%s,OK!" % (mapID, refreshMark, rebornNPCID, isNeedShunt), lineID)
+    
+    if isActivityBoss and rebornBossState:
+        gameFB.SetGameFBDict(ChConfig.Map_NPC_ActivityBossRebornCount % refreshMark, activityBossRebornCount + 1)
+        
+    GameWorld.DebugLog("BossRefresh mapID=%s,rebornLineID=%s,refreshMark=%s,rebornNPCID=%s,isNeedShunt=%s,OK!" 
+                       % (mapID, rebornLineID, refreshMark, rebornNPCID, isNeedShunt), lineID)
     return
 
 def IsShuntBossNeedProcess(curNPC):
     '''分流boss是否需要处理
         无伤血、仇恨、没人看到他、他没看到别人
     '''
-    if curNPC.GetPlayerHurtList().GetHurtCount():
-        #GameWorld.DebugLog("分流boss有伤血,不可以清除!npcID=%s" % curNPC.GetNPCID(), GameWorld.GetGameWorld().GetLineID())
-        return True
-    
-    if curNPC.GetAttentionPlayersCount() or curNPC.GetInSightObjCount():
-        #GameWorld.DebugLog("分流boss有人看到,不可以清除!npcID=%s" % curNPC.GetNPCID(), GameWorld.GetGameWorld().GetLineID())
-        return True
-    
-    GameWorld.DebugLog("分流boss不需要处理了,可以清除!npcID=%s" % curNPC.GetNPCID(), GameWorld.GetGameWorld().GetLineID())
-    return False
+    # 策划暂时修改分流boss不同步死亡
+    return True
+#    if curNPC.GetPlayerHurtList().GetHurtCount():
+#        #GameWorld.DebugLog("分流boss有伤血,不可以清除!npcID=%s" % curNPC.GetNPCID(), GameWorld.GetGameWorld().GetLineID())
+#        return True
+#    
+#    if curNPC.GetAttentionPlayersCount() or curNPC.GetInSightObjCount():
+#        #GameWorld.DebugLog("分流boss有人看到,不可以清除!npcID=%s" % curNPC.GetNPCID(), GameWorld.GetGameWorld().GetLineID())
+#        return True
+#    
+#    GameWorld.DebugLog("分流boss不需要处理了,可以清除!npcID=%s" % curNPC.GetNPCID(), GameWorld.GetGameWorld().GetLineID())
+#    return False
 
 #===================================================================================================
 

--
Gitblit v1.8.0