| | |
| | | import ShareDefine
|
| | | import PlayerTeam
|
| | | import NPCCommon
|
| | | import FBCommon
|
| | | import ChConfig
|
| | |
|
| | | import time
|
| | |
| | | self.__hurtType = ChConfig.Def_NPCHurtTypePlayer # 均默认是玩家
|
| | | self.__hurtName = ""
|
| | | self.__hurtValue = 0
|
| | | self.__isFriend = 0
|
| | | return
|
| | |
|
| | | def GetValueID(self): return self.__hurtID
|
| | |
| | | def SetHurtName(self, hurtName): self.__hurtName = hurtName
|
| | | def GetHurtValue(self): return self.__hurtValue
|
| | | def SetHurtValue(self, hurtValue): self.__hurtValue = hurtValue
|
| | | def GetIsFriend(self): return self.__isFriend
|
| | | def SetIsFriend(self, isFriend): self.__isFriend = isFriend
|
| | |
|
| | | class PlayerHurtList():
|
| | | ''' 伤血列表, 类似 IPY_GameObj.IPY_PlayerHurtList
|
| | |
| | |
|
| | | self.__hurtSortList = []
|
| | | self.__hurtDict = {} # 伤血列表实例字典,实际的NPC伤血列表实例,可能不是玩家{(hurtID, hurtType):HurtValueObj, ...}
|
| | | |
| | | self.__assistAwardItemID = 0 # 协助奖励礼盒ID
|
| | | self.__assistAwardResult = {} # {playerID:{assistPlayerID:{协助玩家信息数据字典}, ...}}
|
| | | return
|
| | |
|
| | | def Clear(self):
|
| | |
| | | def OnDelete(self):
|
| | | # 删除伤血列表,NPC死亡调用
|
| | |
|
| | | cancelPlayerIDList = self.__noAssitPlayerIDDict.keys()
|
| | | if cancelPlayerIDList:
|
| | | noAssistPlayerIDList = self.__noAssitPlayerIDDict.keys()
|
| | | if noAssistPlayerIDList:
|
| | | mapID = GameWorld.GetMap().GetMapID()
|
| | | queryData = [mapID, self.lineID, self.npcID, self.objID, "OnBossDead", cancelPlayerIDList]
|
| | | PlayerAssist.QueryGameServer_PlayerAssist(0, "OnCancelBossRequestAssist", queryData)
|
| | | queryData = [mapID, self.lineID, self.npcID, self.objID, noAssistPlayerIDList, self.__assistAwardItemID, self.__assistAwardResult]
|
| | | PlayerAssist.QueryGameServer_PlayerAssist(0, "OnBossAssistOver", queryData)
|
| | |
|
| | | return
|
| | |
|
| | |
| | | hurtPlayer.SetHurtName(playerName)
|
| | | return hurtPlayer
|
| | |
|
| | | def AddAssistPlayer(self, assistPlayerID, assistPlayerName, tagPlayerID, tagPlayerName, tagTeamID):
|
| | | def AddAssistPlayer(self, assistPlayerID, assistPlayerName, isFriend, tagPlayerID, tagPlayerName, tagTeamID):
|
| | | ## 添加助战玩家
|
| | | # @param assistPlayerID: 协助玩家ID
|
| | | # @param tagPlayerID: 目标玩家ID,即发布协助的玩家ID
|
| | |
| | | % (assistPlayerID, tagPlayerID), self.npcID, self.lineID)
|
| | | return
|
| | |
|
| | | GameWorld.DebugLog("新增协助玩家: assistPlayerID=%s,tagPlayerID=%s,tagTeamID=%s" |
| | | % (assistPlayerID, tagPlayerID, tagTeamID), self.npcID, self.lineID)
|
| | | GameWorld.DebugLog("新增协助玩家: assistPlayerID=%s,tagPlayerID=%s,tagTeamID=%s,isFriend=%s" |
| | | % (assistPlayerID, tagPlayerID, tagTeamID, isFriend), self.npcID, self.lineID)
|
| | |
|
| | | if assistPlayerID in self.__noAssitPlayerIDDict:
|
| | | GameWorld.DebugLog("原来为常规玩家,需要先删除!", self.npcID, self.lineID)
|
| | |
| | | assistPlayerIDList.append(assistPlayerID)
|
| | | self.__assistPlayerIDDict[assistPlayerID] = tagPlayerID
|
| | |
|
| | | assistHurtPlayer = self.__GetHurtPlayer(assistPlayerID, assistPlayerName)
|
| | | assistHurtPlayer.SetIsFriend(isFriend)
|
| | | GameWorld.DebugLog(" self.__noAssitPlayerIDDict=%s" % (self.__noAssitPlayerIDDict), self.npcID, self.lineID)
|
| | | GameWorld.DebugLog(" self.__assistPlayerIDDict=%s" % (self.__assistPlayerIDDict), self.npcID, self.lineID)
|
| | | return
|
| | |
| | | # 地图删除的同步GameServer
|
| | | if isMapServerDel:
|
| | | mapID = GameWorld.GetMap().GetMapID()
|
| | | cancelPlayerIDList = [playerID]
|
| | | queryData = [mapID, self.lineID, self.npcID, self.objID, reason, cancelPlayerIDList]
|
| | | PlayerAssist.QueryGameServer_PlayerAssist(0, "OnCancelBossRequestAssist", queryData)
|
| | | queryData = [mapID, self.lineID, self.npcID, self.objID, reason]
|
| | | PlayerAssist.QueryGameServer_PlayerAssist(playerID, "OnCancelBossRequestAssist", queryData)
|
| | |
|
| | | # 协助玩家
|
| | | elif playerID in self.__assistPlayerIDDict:
|
| | |
| | | ''' 执行协助奖励逻辑
|
| | | '''
|
| | |
|
| | | liheItemID = 2244 # 感谢礼盒物品ID,暂山寨,感谢系统再修改
|
| | | self.__assistAwardResult = {}
|
| | |
|
| | | liheItemID, assistMoney = 0, 0
|
| | | mapAssistGiftDict = IpyGameDataPY.GetFuncEvalCfg("AssistAward", 2, {})
|
| | | mapID = FBCommon.GetRecordMapID(GameWorld.GetMap().GetMapID())
|
| | | if mapID in mapAssistGiftDict:
|
| | | liheItemID, assistMoney = mapAssistGiftDict[mapID]
|
| | | else:
|
| | | killBossCntLimitDict = IpyGameDataPY.GetFuncEvalCfg('KillBossCntLimit') |
| | | index = GameWorld.GetDictValueByKey(killBossCntLimitDict, self.npcID)
|
| | | if index == None:
|
| | | return
|
| | | bossAssistGiftDict = IpyGameDataPY.GetFuncEvalCfg("AssistAward", 1, {})
|
| | | if index not in bossAssistGiftDict:
|
| | | GameWorld.DebugLog("该boss没有协助额外奖励!index=%s" % index, self.npcID)
|
| | | return
|
| | | liheItemID, assistMoney = bossAssistGiftDict[index]
|
| | | |
| | | if not liheItemID or not assistMoney:
|
| | | GameWorld.DebugLog("该副本或boss没有协助额外奖励!mapID=%s" % (mapID), self.npcID)
|
| | | return
|
| | | self.__assistAwardItemID = liheItemID
|
| | | |
| | | friendAddAssistMoneyPer = IpyGameDataPY.GetFuncCfg("AssistAward", 3)
|
| | | GameWorld.DebugLog("执行协助奖励逻辑", self.npcID, self.lineID)
|
| | | copyPlayerManager = GameWorld.GetMapCopyPlayerManager()
|
| | | for playerID, assistPlayerIDList in self.__noAssitPlayerIDDict.items():
|
| | | if not assistPlayerIDList:
|
| | | GameWorld.DebugLog("发布方没有发布协助,不给奖励: playerID=%s" % playerID, self.npcID, self.lineID)
|
| | | GameWorld.DebugLog("发布方没有发布协助,不处理: playerID=%s" % playerID, self.npcID, self.lineID)
|
| | | continue
|
| | |
|
| | | player = copyPlayerManager.FindPlayerByID(playerID)
|
| | | if player:
|
| | | GameWorld.DebugLog("发布方给感谢礼盒奖励: playerID=%s" % playerID, self.npcID, self.lineID)
|
| | | ItemControler.GivePlayerItemOrMail(player, [[liheItemID, 1, 0]])
|
| | | else:
|
| | | GameWorld.DebugLog("发布方离线或不在本地图,不给感谢礼盒奖励: playerID=%s" % playerID, self.npcID, self.lineID)
|
| | | |
| | | noAssistPlayer = copyPlayerManager.FindPlayerByID(playerID)
|
| | | |
| | | assistAwardPlayerDict = {}
|
| | | # 即使发布方不在线,协助方完成后也可获得活跃令奖励,只是不一定获得礼盒感谢奖励(礼盒感谢奖励需双方都在线)
|
| | | for assistPlayerID in assistPlayerIDList:
|
| | | assistHurtPlayer = self.__GetHurtPlayer(assistPlayerID)
|
| | | if not assistHurtPlayer.GetHurtValue():
|
| | | GameWorld.DebugLog("协助方没有输出,不给奖励: assistPlayerID=%s" % assistPlayerID, self.npcID, self.lineID)
|
| | | continue
|
| | | assPlayer = copyPlayerManager.FindPlayerByID(assistPlayerID)
|
| | | if not assPlayer:
|
| | | assistPlayer = copyPlayerManager.FindPlayerByID(assistPlayerID)
|
| | | if not assistPlayer:
|
| | | GameWorld.DebugLog("协助方离线或不在本地图,不给活跃令奖励: assistPlayerID=%s" % assistPlayerID, self.npcID, self.lineID)
|
| | | continue
|
| | | GameWorld.DebugLog("协助方给活跃令奖励: assistPlayerID=%s" % assistPlayerID, self.npcID, self.lineID)
|
| | | PlayerControl.GiveMoney(assPlayer, ShareDefine.TYPE_Price_FamilyActivity, 35)
|
| | | isFriend = assistHurtPlayer.GetIsFriend()
|
| | | addAssistMoney = assistMoney
|
| | | if isFriend and friendAddAssistMoneyPer:
|
| | | addAssistMoney += int(assistMoney * friendAddAssistMoneyPer / 100.0)
|
| | | GameWorld.DebugLog("协助方给活跃令奖励: assistPlayerID=%s,assistMoney=%s,isFriend=%s,addAssistMoney=%s" |
| | | % (assistPlayerID, assistMoney, isFriend, addAssistMoney), self.npcID, self.lineID)
|
| | | PlayerControl.GiveMoney(assistPlayer, ShareDefine.TYPE_Price_XianyuanCoin, addAssistMoney) # 给活跃令无视发布方是否在线
|
| | |
|
| | | if noAssistPlayer:
|
| | | todayGiftCount = assistPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GetThanksGiftCount % liheItemID)
|
| | | assistAwardPlayerDict[assistPlayerID] = {"PlayerName":assistPlayer.GetPlayerName(), "Job":assistPlayer.GetJob(), |
| | | "LV":assistPlayer.GetLV(), "RealmLV":assistPlayer.GetOfficialRank(),
|
| | | "TodayGiftCount":todayGiftCount}
|
| | | |
| | | if not noAssistPlayer or not assistAwardPlayerDict:
|
| | | GameWorld.DebugLog("发布方离线或无有效协助玩家在线,不给感谢礼盒奖励: playerID=%s" % playerID, self.npcID, self.lineID)
|
| | | continue
|
| | | |
| | | GameWorld.DebugLog("发布方给感谢礼盒奖励: playerID=%s" % playerID, self.npcID, self.lineID)
|
| | | ItemControler.GivePlayerItemOrMail(noAssistPlayer, [[liheItemID, 1, 0]])
|
| | | self.__assistAwardResult[playerID] = assistAwardPlayerDict
|
| | | |
| | | return
|
| | |
|
| | | def __CmpHurtValue(self, hurtObjA, hurtObjB):
|