From a531569e7cab4dfee86324bd225db34106afe740 Mon Sep 17 00:00:00 2001
From: hch <305670599@qq.com>
Date: 星期四, 23 八月 2018 19:37:49 +0800
Subject: [PATCH] fix:修复字符串转整数

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCAI/AIType_186.py |   29 +++++++++++++++++++++++------
 1 files changed, 23 insertions(+), 6 deletions(-)

diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCAI/AIType_186.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCAI/AIType_186.py
index 1978c26..a460007 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCAI/AIType_186.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCAI/AIType_186.py
@@ -25,7 +25,7 @@
 # @change: "2014-12-31 14:40" Alee 降低NPCAI消耗
 # @change: "2016-11-22 21:00" hxp 支持添加最大仇恨buff
 #------------------------------------------------------------------------------ 
-"""Version = 2016-11-22 21:00"""
+#"""Version = 2016-11-22 21:00"""
 #-------------------------------------------------------------------------------
 import ChConfig
 import NPCCommon
@@ -36,6 +36,7 @@
 import BaseAttack
 import PlayerState
 import SkillCommon
+import PyGameData
 import BuffSkill
 import GameObj
 
@@ -92,7 +93,7 @@
     npcControl.DoHPPerLogic(ChConfig.Def_NPCHurtTypeAll, 0)
     return
 
-def __RefreshDropOwner(curNPC, tick, refreshInterval=3000):
+def __RefreshDropOwner(curNPC, tick, refreshInterval=3000, isDead=False):
     ## 刷新boss掉落归属
     # @return: 可攻击的掉落归属目标玩家
     
@@ -121,13 +122,13 @@
             maxAngryObj = GameWorld.GetObj(angryID, angryObjType)
             
         tagObj = maxAngryObj
-        if dropOwnerType == ChConfig.DropOwnerType_MaxAngry and angryObjType == IPY_GameWorld.gotPlayer and maxAngryObj:
+        if angryObjType == IPY_GameWorld.gotPlayer and maxAngryObj:
             teamID = maxAngryObj.GetTeamID()
             if teamID:
                 ownerType, ownerID = ChConfig.Def_NPCHurtTypeTeam, teamID
             else:
                 ownerType, ownerID = ChConfig.Def_NPCHurtTypePlayer, maxAngryObj.GetPlayerID()
-    __RefreshBossDropOwnerObjBuff(curNPC, npcControl, tick, ownerType, ownerID)
+    __RefreshBossDropOwnerObjBuff(curNPC, npcControl, tick, ownerType, ownerID, isDead)
     return tagObj
 
 def __GetMaxHurtTeamPlayer(curNPC, npcControl, teamID):
@@ -145,7 +146,7 @@
                 return curTeamPlayer
     return
 
-def __RefreshBossDropOwnerObjBuff(curNPC, npcControl, tick, ownerType=0, ownerID=0):
+def __RefreshBossDropOwnerObjBuff(curNPC, npcControl, tick, ownerType=0, ownerID=0, isDead=False):
     npcID = curNPC.GetNPCID()
     dropOwnerType = NPCCommon.GetDropOwnerType(curNPC)
     if dropOwnerType not in [ChConfig.DropOwnerType_MaxHurt, ChConfig.DropOwnerType_MaxAngry]:
@@ -160,6 +161,8 @@
                            % (ownerType, ownerID, lastDropOwnerType, lastDropOwnerID))
         __DelBossDropOwnerBuff(curNPC, lastDropOwnerType, lastDropOwnerID, tick)
     
+    killerDict, curTeam, hurtType, hurtID = {}, None, 0, 0
+    
     # 更新归属
     curNPC.SetDict(ChConfig.Def_NPC_Dict_LastDropOwnerID, ownerID)
     curNPC.SetDict(ChConfig.Def_NPC_Dict_LastDropOwnerType, ownerType)
@@ -168,12 +171,18 @@
     if ownerType == ChConfig.Def_NPCHurtTypePlayer:
         curPlayer = GameWorld.GetObj(ownerID, IPY_GameWorld.gotPlayer)
         if curPlayer:
+            playerID = curPlayer.GetPlayerID()
+            hurtType, hurtID = ChConfig.Def_NPCHurtTypePlayer, playerID
+            killerDict[playerID] = curPlayer
             __AddBossDropOwnerPlayerBuff(curPlayer, tick, curNPC)
             
     elif ownerType == ChConfig.Def_NPCHurtTypeTeam:
         curTeam = GameWorld.GetTeamManager().FindTeam(ownerID)
         if not curTeam:
             return
+        
+        # 因为有击杀次数限制,所以不是所有的队员都可以获得归属,所以这里设置为特殊指定玩家掉落
+        hurtType, hurtID = ChConfig.Def_NPCHurtTypeSpecial, 0
         
         refreshPoint = curNPC.GetRefreshPosAt(curNPC.GetCurRefreshPointIndex())
         for i in xrange(curTeam.GetMemberCount()):
@@ -185,12 +194,20 @@
                 and npcControl.GetIsInRefreshPoint(curTeamPlayer.GetPosX(), curTeamPlayer.GetPosY(), refreshPoint) \
                 and AttackCommon.CheckKillNPCByCnt(curTeamPlayer, curNPC, False):
                 __AddBossDropOwnerPlayerBuff(curTeamPlayer, tick, curNPC)
+                killerDict[curTeamPlayer.GetPlayerID()] = curTeamPlayer
                 
             # 不同线、或者距离超出boss范围的队员不加归属buff
             else:
                 isOk = BuffSkill.DelBuffBySkillID(curTeamPlayer, ChConfig.Def_SkillID_DropOwnerBuff, tick, buffOwner=curNPC)
                 if isOk:
                     GameWorld.DebugLog("删除归属队员buff: teamID=%s,playerID=%s" % (ownerID, curTeamPlayer.GetPlayerID()))
+                    
+    if isDead:
+        key = (GameWorld.GetGameWorld().GetLineID(), curNPC.GetID(), npcID)
+        teamID = curTeam.GetTeamID() if curTeam else 0
+        if killerDict:
+            PyGameData.g_npcKillerInfo[key] = killerDict, curTeam, hurtType, hurtID
+        GameWorld.Log("Boss被击杀: npcID=%s,key=%s,playerIDList=%s,teamID=%s" % (npcID, key, killerDict.keys(), teamID))
     return
 
 def __AddBossDropOwnerPlayerBuff(curPlayer, tick, curNPC):
@@ -296,7 +313,7 @@
     PlayerState.SetBossStateTick(curPlayer, tick)
     
     #被击杀时强制刷新归属
-    __RefreshDropOwner(curNPC, tick, 0)
+    __RefreshDropOwner(curNPC, tick, 0, True)
     return
 
 ## NPC死亡处理

--
Gitblit v1.8.0