From 26a116683bd08fe6705f12d6386068a801b702b9 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期五, 03 四月 2020 18:11:33 +0800
Subject: [PATCH] 4475 【主干】免费送的3个仙盟,概率随机重名导致无法创建(手动创建与系统随机仙盟名相同的默认当做创建该系统仙盟,防止重复)

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCHurtManager.py |   39 +++++++++++++++++++++++++++++++++------
 1 files changed, 33 insertions(+), 6 deletions(-)

diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCHurtManager.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCHurtManager.py
index 808bd7b..73a3458 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCHurtManager.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCHurtManager.py
@@ -434,7 +434,7 @@
         
         if not isDead:
             if refreshInterval and tick - curNPC.GetDictByKey(ChConfig.Def_NPC_Dict_LastRefreshHurtTick) < refreshInterval:
-                return self.__GetAtkObjByHurtList()
+                return self.__GetAtkObjByHurtList(isDead)
             
         curNPC.SetDict(ChConfig.Def_NPC_Dict_LastRefreshHurtTick, tick)
         
@@ -470,7 +470,7 @@
             
         isInHurt = self.__hurtSortList != []
         curNPC.SetDict(ChConfig.Def_NPC_Dict_InHurtProtect, isInHurt)
-        return self.__GetAtkObjByHurtList()
+        return self.__GetAtkObjByHurtList(isDead)
     
     def __UnAssistPlayerHurtValidLogic(self, playerID, refreshPoint, tick):
         ## 非协助玩家伤血有效性检查逻辑
@@ -586,7 +586,7 @@
                 
         return
     
-    def __GetAtkObjByHurtList(self):
+    def __GetAtkObjByHurtList(self, isDead):
         '''第一个可攻击的最大伤血对象,也是实际的归属者或队伍
         因为玩家伤血掉线、死亡有一定时间的保留机制,故最大伤血不一定是可攻击目标(归属者)
         注意: 该规则必须与最终算归属的规则一致,不然可能导致归属错乱
@@ -596,7 +596,7 @@
         atkPlayer, atkHurtType, atkHurtID = None, 0, 0
         curNPC = self.curNPC
         refreshPoint = curNPC.GetRefreshPosAt(curNPC.GetCurRefreshPointIndex())
-        for hurtObj in self.__hurtSortList:
+        for rank, hurtObj in enumerate(self.__hurtSortList, 1):
             
             hurtID = hurtObj.GetValueID()
             hurtType = hurtObj.GetValueType()
@@ -619,6 +619,7 @@
             else:
                 continue
             
+            playerDisableReason = {}
             maxHurtValue = 0
             for playerID in playerIDList:
                 
@@ -627,15 +628,19 @@
                     continue
                 
                 if player.GetHP() <= 0 or player.GetPlayerAction() == IPY_GameWorld.paDie:
+                    playerDisableReason[playerID] = "dead"
                     continue
                 
                 if not player.GetVisible() or player.GetSightLevel() != curNPC.GetSightLevel():
+                    playerDisableReason[playerID] = "no visible or sightLevel different"
                     continue
                 
                 if not self.__GetIsInRefreshPoint(player.GetPosX(), player.GetPosY(), refreshPoint):
+                    playerDisableReason[playerID] = "not in boss area"
                     continue
                 
                 if playerID not in self.__hurtPlayerDict:
+                    playerDisableReason[playerID] = "no hurt"
                     continue
                 hurtPlayer = self.__hurtPlayerDict[playerID]
                 hurtValue = hurtPlayer.GetHurtValue()                
@@ -646,6 +651,9 @@
             if maxHurtValue:
                 return atkPlayer, atkHurtType, atkHurtID
             
+            if rank == 1 and isDead:
+                GameWorld.Log("boss死亡时,第一名团队没有归属权! playerDisableReason=%s" % playerDisableReason)
+                
         return atkPlayer, atkHurtType, atkHurtID
     
     def __GetIsInRefreshPoint(self, curPosX, curPosY, refreshPoint):
@@ -771,6 +779,7 @@
                     overDict = {FBCommon.Over_isAssist:1, FBCommon.Over_money:FBCommon.GetJsonMoneyList({assistMoneyType:addAssistMoney}),
                                 FBCommon.Over_itemInfo:[]}
                     FBCommon.NotifyFBOver(assistPlayer, mapID, PlayerControl.GetFBFuncLineID(assistPlayer), 1, overDict)
+                    assistPlayer.Sync_TimeTick(IPY_GameWorld.tttLeaveMap, 0, 10000, True)
                     
                 if noAssistPlayer:
                     todayGiftCount = assistPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GetThanksGiftCount % liheItemID)
@@ -878,9 +887,17 @@
 def OnPlayerLeaveMap(curPlayer):
     ## 玩家离开地图处理
     
+    mapID = curPlayer.GetMapID()
+    mapType = GameWorld.GetMap().GetMapFBType()
+    changeMapID = curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_ChangeMapID)
+    changeLineID = curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_ChangeLineID)
+    
     playerID = curPlayer.GetPlayerID()
     for hurtList in PyGameData.g_npcHurtDict.values():
         if hurtList.IsNoAssistPlayer(playerID) or hurtList.IsAssistPlayer(playerID):
+            if mapType == IPY_GameWorld.fbtNull and mapID == changeMapID and changeLineID == hurtList.lineID:
+                #GameWorld.DebugLog("玩家同地图切线,当前伤血lineID为目标线路,不清伤血!changeLineID=%s" % changeLineID, playerID)
+                continue
             GameWorld.DebugLog("玩家离开地图, 删除boss伤血玩家!npcID=%s" % (hurtList.npcID), playerID)
             hurtList.DelHurtPlayer(playerID, "LeaveMap")
             break
@@ -916,11 +933,19 @@
     defendHurtList.Clear()
     return
 
+def GetBossLineID(npcID):
+    sealDemonIpyData = IpyGameDataPY.GetIpyGameDataNotLog("SealDemon", npcID)
+    if sealDemonIpyData:
+        lineID = sealDemonIpyData.GetLineID()
+    else:
+        lineID = GameWorld.GetGameWorld().GetLineID()
+    return lineID
+
 def DeletePlayerHurtList(curNPC):
     ## 删除伤血列表
-    lineID = GameWorld.GetGameWorld().GetLineID()
     objID = curNPC.GetID()
     npcID = curNPC.GetNPCID()
+    lineID = GetBossLineID(npcID)
     key = (lineID, objID, npcID)
     if key in PyGameData.g_npcHurtDict:
         hurtList =PyGameData.g_npcHurtDict.pop(key)
@@ -930,9 +955,9 @@
 
 def GetPlayerHurtList(curNPC):
     ## 获取伤血列表,可能为None
-    lineID = GameWorld.GetGameWorld().GetLineID()
     objID = curNPC.GetID()
     npcID = curNPC.GetNPCID()
+    lineID = GetBossLineID(npcID)
     return GetPlayerHurtListEx(lineID, objID, npcID)
 def GetPlayerHurtListEx(lineID, objID, npcID):
     ## 获取伤血列表,可能为None
@@ -994,6 +1019,8 @@
     return True
 
 def RefreshHurtList(curNPC, tick, refreshInterval=3000, isDead=False):
+    ## 刷新伤血列表
+    # @return: atkPlayer, ownerType, ownerID
     defendHurtList = GetPlayerHurtList(curNPC)
     if not defendHurtList:
         return

--
Gitblit v1.8.0