From 11a8b1213819e3067ef079bffecf7542318b49f8 Mon Sep 17 00:00:00 2001 From: hxp <ale99527@vip.qq.com> Date: 星期一, 30 十二月 2019 16:09:31 +0800 Subject: [PATCH] 8346 【恺英】【后端】协助系统(添加第一名无归属时原因日志) --- ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCHurtManager.py | 36 +++++++++++++++++++++++------------- 1 files changed, 23 insertions(+), 13 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 4028134..9482636 100644 --- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCHurtManager.py +++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/NPC/NPCHurtManager.py @@ -431,12 +431,10 @@ # @return: atkPlayer, hurtID, hurtType curNPC = self.curNPC - if not self.__hurtDict: - return 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) @@ -472,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): ## 非协助玩家伤血有效性检查逻辑 @@ -588,7 +586,7 @@ return - def __GetAtkObjByHurtList(self): + def __GetAtkObjByHurtList(self, isDead): '''第一个可攻击的最大伤血对象,也是实际的归属者或队伍 因为玩家伤血掉线、死亡有一定时间的保留机制,故最大伤血不一定是可攻击目标(归属者) 注意: 该规则必须与最终算归属的规则一致,不然可能导致归属错乱 @@ -598,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() @@ -621,6 +619,7 @@ else: continue + playerDisableReason = {} maxHurtValue = 0 for playerID in playerIDList: @@ -629,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() @@ -648,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): @@ -742,7 +748,6 @@ self.__assistAwardItemID = liheItemID fbType = GameWorld.GetMap().GetMapFBTypeByMapID(mapID) - friendAddAssistMoneyPer = IpyGameDataPY.GetFuncCfg("AssistAward", 3) GameWorld.DebugLog("执行协助奖励逻辑", self.npcID, self.lineID) copyPlayerManager = GameWorld.GetMapCopyPlayerManager() for playerID, assistPlayerIDList in self.__noAssitPlayerIDDict.items(): @@ -764,16 +769,14 @@ GameWorld.DebugLog("协助方离线或不在本地图,不给活跃令奖励: assistPlayerID=%s" % assistPlayerID, self.npcID, self.lineID) continue isFriend = assistHurtPlayer.GetIsFriend() - addAssistMoney = assistMoney - if isFriend and friendAddAssistMoneyPer: - addAssistMoney += int(assistMoney * friendAddAssistMoneyPer / 100.0) + assistMoneyType = ShareDefine.TYPE_Price_FamilyActivity + addAssistMoney = PlayerAssist.AddTodayAssistMoney(assistPlayer, assistMoneyType, assistMoney, isFriend) GameWorld.DebugLog("协助方给活跃令奖励: assistPlayerID=%s,assistMoney=%s,isFriend=%s,addAssistMoney=%s" % (assistPlayerID, assistMoney, isFriend, addAssistMoney), self.npcID, self.lineID) - PlayerControl.GiveMoney(assistPlayer, ShareDefine.TYPE_Price_FamilyActivity, addAssistMoney) # 给活跃令无视发布方是否在线 if fbType == IPY_GameWorld.fbtNull: PlayerControl.NotifyCode(assistPlayer, "AssistSuccess") else: - overDict = {FBCommon.Over_isAssist:1, FBCommon.Over_money:FBCommon.GetJsonMoneyList({ShareDefine.TYPE_Price_FamilyActivity:addAssistMoney}), + overDict = {FBCommon.Over_isAssist:1, FBCommon.Over_money:FBCommon.GetJsonMoneyList({assistMoneyType:addAssistMoney}), FBCommon.Over_itemInfo:[]} FBCommon.NotifyFBOver(assistPlayer, mapID, PlayerControl.GetFBFuncLineID(assistPlayer), 1, overDict) @@ -782,6 +785,9 @@ assistAwardPlayerDict[assistPlayerID] = {"PlayerName":assistPlayer.GetPlayerName(), "Job":assistPlayer.GetJob(), "LV":assistPlayer.GetLV(), "RealmLV":assistPlayer.GetOfficialRank(), "TodayGiftCount":todayGiftCount} + + notifyParam = [assistPlayer.GetPlayerName(), noAssistPlayer.GetPlayerName(), mapID, self.curNPC.GetLV(), self.npcID] + PlayerControl.FamilyNotify(assistPlayer.GetFamilyID(), "AssistBossFinish", notifyParam) if not noAssistPlayer or not assistAwardPlayerDict: GameWorld.DebugLog("发布方离线或无有效协助玩家在线,不给感谢礼盒奖励: playerID=%s" % playerID, self.npcID, self.lineID) @@ -831,13 +837,15 @@ bossHurtInfoPack.HurtValueList = hurtValueList bossHurtInfoPack.HurtCount = len(hurtValueList) + curNPC = self.curNPC assistHurtValueListDict = {} copyPlayerManager = GameWorld.GetMapCopyPlayerManager() for playerID in syncPlayerIDList: player = copyPlayerManager.FindPlayerByID(playerID) if not player: continue - + if not player.CanSeeOther(curNPC): + continue if playerID in self.__noAssitPlayerIDDict: assTagPlayerID = playerID elif playerID in self.__assistPlayerIDDict: @@ -994,6 +1002,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