From a48e71a51cc890a6679ee5d304b13d36804b10fd Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期五, 19 十月 2018 15:31:03 +0800
Subject: [PATCH] sefs

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCommon.py |   92 ++++++++++++++++++++++++++++++++--------------
 1 files changed, 64 insertions(+), 28 deletions(-)

diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCommon.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCommon.py
index 0d7b24c..6b35dda 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCommon.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCCommon.py
@@ -4014,10 +4014,16 @@
         npcID = curNPC.GetNPCID()
         mapID = GameWorld.GetMap().GetMapID()
         mapID = FBCommon.GetRecordMapID(mapID)
+        isGameBoss = ChConfig.IsGameBoss(curNPC)
+        if isGameBoss:
+            GameWorld.Log("NPC开始掉落: npcID=%s,dropPlayerID=%s" % (npcID, dropPlayer.GetPlayerID()))
         if mapID == ChConfig.Def_FBMapID_MunekadoTrial:
             return
         ipyDrop = GetNPCDropIpyData(npcID)
         if not ipyDrop:
+            if isGameBoss:
+                curWorldLV = GameWorld.GetGameWorld().GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_WorldAverageLv)
+                GameWorld.ErrLog("取不到NPC掉落信息!npcID=%s,curWorldLV=%s" % (npcID, curWorldLV))
             return
         
         #if mapID == ChConfig.Def_FBMapID_MunekadoTrial:
@@ -4266,9 +4272,11 @@
         self.__LastHurtPlayer = self.__FindLastTimeHurtObjEx()
         self.__MaxHurtPlayer = self.__FindBossMaxHurtObj() # py自定义伤血所得到的Boss最大伤血玩家
         
-        self.__AllKillerDict, curTeam, hurtType, hurtID = self.__FindNPCKillerInfo()
-        self.__OwnerHurtType, self.__OwnerHurtID = hurtType, hurtID
         isGameBoss = ChConfig.IsGameBoss(curNPC)
+        self.__AllKillerDict, curTeam, hurtType, hurtID = self.__FindNPCKillerInfo(isGameBoss)
+        self.__OwnerHurtType, self.__OwnerHurtID = hurtType, hurtID
+        if isGameBoss:
+            GameWorld.Log("npcID=%s,hurtType=%s,hurtID=%s" % (npcID, hurtType, hurtID))
         
         #最后一击处理
         self.__DoLastTimeHurtLogic()
@@ -4377,7 +4385,7 @@
     ## NPC死亡, 分享经验逻辑
     #  @param self 类实例
     #  @return 返回击杀玩家信息元组, (玩家列表实例,队伍实例,归属类型,归属ID)
-    def __FindNPCKillerInfo(self):
+    def __FindNPCKillerInfo(self, isGameBoss):
         curNPC = self.__Instance
         npcID = curNPC.GetNPCID()
         objID = curNPC.GetID()
@@ -4396,36 +4404,39 @@
         
         #isLog = self.__GetIsLog()
         dropOwnerType = GetDropOwnerType(curNPC)
-        #GameWorld.DebugLog("NPC击杀者信息...npcID=%s,dropOwnerType=%s" % (npcID, dropOwnerType))
-        
+        if isGameBoss:
+            GameWorld.Log("NPC被击杀, key=%s,dropOwnerType=%s" % (key, dropOwnerType))
+            
         # 最大伤血 - 伤血可能被重置
         if dropOwnerType == ChConfig.DropOwnerType_MaxHurt:
             npcHurtList = curNPC.GetPlayerHurtList()
             npcHurtList.Sort()
-            #if isLog:
-            #    GameWorld.DebugLog("NPC被击杀,npcID=%s,dropOwnerType=%s,hurtCount=%s" % (npcID, dropOwnerType, npcHurtList.GetHurtCount()))
+            if isGameBoss:
+                GameWorld.Log("hurtCount=%s" % (npcHurtList.GetHurtCount()))
             for i in xrange(npcHurtList.GetHurtCount()):
                 #获得最大伤血对象
                 maxHurtObj = npcHurtList.GetHurtAt(i)
-                #if isLog:
-                #    GameWorld.DebugLog("    i=%s,hurtValueType=%s,valueID=%s" % (i, maxHurtObj.GetValueType(), maxHurtObj.GetValueID()))
-                curPlayer, curTeam = self.__GetTagByHurtObj(maxHurtObj)
+                if isGameBoss:
+                    GameWorld.Log("hurtIndex=%s,hurtValueType=%s,valueID=%s" % (i, maxHurtObj.GetValueType(), maxHurtObj.GetValueID()))
+                curPlayer, curTeam = self.__GetTagByHurtObj(maxHurtObj, isLog=isGameBoss)
                 #当前伤血对象超出指定范围或已经死亡
                 if curPlayer == None and curTeam == None:
-                    #if isLog:
-                    #    GameWorld.DebugLog("        当前伤血对象超出指定范围或已经死亡")
+                    if isGameBoss:
+                        GameWorld.Log("    当前伤血对象超出指定范围或已经死亡")
                     continue
                 
                 if curPlayer:
                     playerID = curPlayer.GetPlayerID()
                     if playerID not in killerDict:
                         killerDict[playerID] = curPlayer
-                    GameWorld.Log("    归属最大伤血玩家: npcID=%s,dropOwnerType=%s,playerID=%s" % (npcID, dropOwnerType, playerID))
+                    if isGameBoss:
+                        GameWorld.Log("    归属最大伤血玩家: npcID=%s,dropOwnerType=%s,playerID=%s" % (npcID, dropOwnerType, playerID))
                     return killerDict, None, ChConfig.Def_NPCHurtTypePlayer, playerID
                 
                 if curTeam:
                     killTeam = curTeam
-                    GameWorld.Log("    归属最大伤血队伍: npcID=%s,dropOwnerType=%s,teamID=%s" % (npcID, dropOwnerType, curTeam.GetTeamID()))
+                    if isGameBoss:
+                        GameWorld.Log("    归属最大伤血队伍: npcID=%s,dropOwnerType=%s,teamID=%s" % (npcID, dropOwnerType, curTeam.GetTeamID()))
                     return killerDict, curTeam, ChConfig.Def_NPCHurtTypeTeam, curTeam.GetTeamID()
         # 最大伤血玩家 - 伤血不会被重置
         elif dropOwnerType == ChConfig.DropOwnerType_MaxHurtPlayer:
@@ -4455,8 +4466,8 @@
         if self.__LastHurtPlayer:
             lastHurtPlayerID = self.__LastHurtPlayer.GetPlayerID()
             teamID = self.__LastHurtPlayer.GetTeamID()
-            #if isLog:
-            #    GameWorld.DebugLog("    归属最后一击,npcID=%s,lastHurtPlayerID=%s,teamID=%s" % (npcID, lastHurtPlayerID, teamID))
+            if isGameBoss:
+                GameWorld.Log("    归属最后一击,npcID=%s,lastHurtPlayerID=%s,teamID=%s" % (npcID, lastHurtPlayerID, teamID))
             if teamID:
                 killTeam = GameWorld.GetTeamManager().FindTeam(teamID)
             if not killTeam and lastHurtPlayerID not in killerDict:
@@ -4464,9 +4475,8 @@
                 
         if dropOwnerType == ChConfig.DropOwnerType_All:
             hurtType = ChConfig.Def_NPCHurtTypeAll
-            #if isLog:
-            #    GameWorld.DebugLog("    无归属...npcID=%s" % npcID)
-            #GameWorld.DebugLog("    无归属...")
+            if isGameBoss:
+                GameWorld.Log("    无归属...npcID=%s" % npcID)
             
         elif dropOwnerType == ChConfig.DropOwnerType_Faction:
             #阵营归属
@@ -4474,23 +4484,22 @@
             if protectFaction > 0:
                 hurtType = ChConfig.Def_NPCHurtTypeFaction
                 hurtID = protectFaction
-                #GameWorld.DebugLog("    阵营归属...factionID=%s" % protectFaction)
+                if isGameBoss:
+                    GameWorld.Log("    阵营归属...factionID=%s" % protectFaction)
                 
         if hurtType == 0:
             #归属队伍
             if killTeam:
                 hurtType = ChConfig.Def_NPCHurtTypeTeam
                 hurtID = killTeam.GetTeamID()
-                #if isLog:
-                #    GameWorld.DebugLog("    归属默认队伍, npcID=%s,teamID=%s" % (npcID, hurtID))
-                #GameWorld.DebugLog("    归属默认队伍, teamID=%s" % hurtID)
+                if isGameBoss:
+                    GameWorld.Log("    归属默认队伍, npcID=%s,teamID=%s" % (npcID, hurtID))
             #伤血归属玩家
             elif killerDict:
                 hurtType = ChConfig.Def_NPCHurtTypePlayer
                 hurtID = killerDict.keys()[0]
-                #if isLog:
-                #    GameWorld.DebugLog("    归属默认玩家, npcID=%s,playerID=%s" % (npcID, hurtID))
-                #GameWorld.DebugLog("    归属默认玩家, playerID=%s" % hurtID)
+                if isGameBoss:
+                    GameWorld.Log("    归属默认玩家, npcID=%s,playerID=%s" % (npcID, hurtID))
                 
         return killerDict, killTeam, hurtType, hurtID
     
@@ -4561,9 +4570,10 @@
     #  @param maxHurtObj 最大伤血对象
     #  @return 返回值, 伤血对象
     #  @remarks 获得伤血对象,支持抢怪
-    def __GetTagByHurtObj(self, maxHurtObj, isCheckRefreshArea=False):
+    def __GetTagByHurtObj(self, maxHurtObj, isCheckRefreshArea=False, isLog=False):
         #获得死亡的NPC
         curNPC = self.__Instance
+        npcID = curNPC.GetNPCID()
         # 伤害的obj类型元组(玩家, 队伍)
         hurtObjTuple = (None, None)
         if maxHurtObj == None:
@@ -4578,18 +4588,28 @@
             curPlayer = GameWorld.GetObj(maxHurtObj.GetValueID(), IPY_GameWorld.gotPlayer)
             
             if curPlayer == None:
+                if isLog:
+                    GameWorld.Log("找不到该目标伤血玩家: npcID=%s,playerID=%s" % (npcID, maxHurtObj.GetValueID()))
                 return hurtObjTuple
             
             #支持抢怪,个人杀死,但自己死亡,不算
             if curPlayer.GetHP() <= 0 or curPlayer.GetPlayerAction() == IPY_GameWorld.paDie:
+                if isLog:
+                    GameWorld.Log("该目标伤血玩家已死亡: npcID=%s,playerID=%s" % (npcID, maxHurtObj.GetValueID()))
                 return hurtObjTuple
             
             if isCheckRefreshArea:
                 if not self.GetIsInRefreshPoint(curPlayer.GetPosX(), curPlayer.GetPosY(), refreshPoint):
+                    if isLog:
+                        GameWorld.Log("该目标伤血玩家不在NPC区域内: npcID=%s,playerID=%s,pos(%s,%s)" 
+                                      % (npcID, maxHurtObj.GetValueID(), curPlayer.GetPosX(), curPlayer.GetPosY()))
                     return hurtObjTuple
             #如果玩家已经超出指定距离,不加经验
             elif GameWorld.GetDist(curNPC.GetPosX(), curNPC.GetPosY(),
                                      curPlayer.GetPosX(), curPlayer.GetPosY()) > ChConfig.Def_Team_GetExpScreenDist:
+                if isLog:
+                    GameWorld.Log("该目标伤血玩家超出指定距离: npcID=%s,playerID=%s,npcPos(%s,%s),playerPos(%s,%s)" 
+                                  % (npcID, maxHurtObj.GetValueID(), curNPC.GetPosX(), curNPC.GetPosY(), curPlayer.GetPosX(), curPlayer.GetPosY()))
                 return hurtObjTuple
             
             #正常返回
@@ -4600,23 +4620,39 @@
             #获得当前队伍
             teamID = maxHurtObj.GetValueID()
             curTeam = GameWorld.GetTeamManager().FindTeam(teamID)
+            if isLog:
+                GameWorld.Log("目标伤血队伍: npcID=%s,teamID=%s" % (npcID, teamID))
             if curTeam == None:
+                if isLog:
+                    GameWorld.Log("找不到目标队伍, teamID=%s" % (teamID))
                 return hurtObjTuple
             
+            if isLog:
+                GameWorld.Log("队伍成员数: GetMemberCount=%s" % (curTeam.GetMemberCount()))                
             #遍历队伍,半径为一屏半的距离内的所有队伍/团队成员,可以获得经验
             for i in xrange(curTeam.GetMemberCount()):
                 curTeamPlayer = curTeam.GetMember(i)
                 if curTeamPlayer == None or curTeamPlayer.GetPlayerID() == 0:
+                    if isLog:
+                        GameWorld.Log("    i=%s, 无该队员!" % (i))
                     continue
                 
                 if curTeamPlayer.GetHP() <= 0 or curTeamPlayer.GetPlayerAction() == IPY_GameWorld.paDie:
+                    if isLog:
+                        GameWorld.Log("    i=%s, 队员已死亡!memPlayerID=%s" % (i, curTeamPlayer.GetPlayerID()))
                     continue
                 
                 if isCheckRefreshArea:
                     if not self.GetIsInRefreshPoint(curTeamPlayer.GetPosX(), curTeamPlayer.GetPosY(), refreshPoint):
+                        if isLog:
+                            GameWorld.Log("    i=%s, 队员不在NPC区域内!memPlayerID=%s,pos(%s,%s)" 
+                                          % (i, curTeamPlayer.GetPlayerID(), curTeamPlayer.GetPosX(), curTeamPlayer.GetPosY()))
                         continue
                 elif GameWorld.GetDist(curNPC.GetPosX(), curNPC.GetPosY(), curTeamPlayer.GetPosX(),
                                        curTeamPlayer.GetPosY()) > ChConfig.Def_Team_GetExpScreenDist:
+                    if isLog:
+                        GameWorld.Log("    i=%s, 队员超出指定距离!memPlayerID=%s,npcPos(%s,%s),playerPos(%s,%s)" 
+                                      % (i, curTeamPlayer.GetPlayerID(), curNPC.GetPosX(), curNPC.GetPosY(), curPlayer.GetPosX(), curPlayer.GetPosY()))
                     continue
                 
                 hurtObjTuple = (None, curTeam)
@@ -4849,7 +4885,7 @@
     def __GetIsLog(self):
         ## 测试查错日志,临时用
         ## 相关bug: 仙界秘境无经验、boss无掉落
-        return False
+        return ChConfig.IsGameBoss(self.__Instance)
         #return GameWorld.GetMap().GetMapID() == ChConfig.Def_FBMapID_BZZD or ChConfig.IsGameBoss(self.__Instance)
 
     #---------------------------------------------------------------------

--
Gitblit v1.8.0