|  |  |  | 
|---|
|  |  |  | GameWorld.DebugLog('    PyGameData.g_sortBOSSRefreshList=%s'%PyGameData.g_sortBOSSRefreshList) | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | ## 世界boss重生 | 
|---|
|  |  |  | #  @param msgList 信息列表 | 
|---|
|  |  |  | #  @param tick 时间戳 | 
|---|
|  |  |  | #  @return None | 
|---|
|  |  |  | def DoGameWorldBossOnReborn(msgList, tick): | 
|---|
|  |  |  | def OnGameWorldBossStateChange(msgList, tick): | 
|---|
|  |  |  | ## 世界boss状态变更 | 
|---|
|  |  |  | if len(msgList) <= 0: | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | isAlive = msgList[1] | 
|---|
|  |  |  | mapID = msgList[2] if len(msgList) > 2 else None | 
|---|
|  |  |  | lineID = msgList[3] if len(msgList) > 3 else None | 
|---|
|  |  |  | GameWorld.DebugLog("世界boss DoGameWorldBossOnReborn...mapID=%s,lineID=%s,bossID=%s,state=%s,tick=%s" % (mapID, lineID, bossID, isAlive, tick)) | 
|---|
|  |  |  | GameWorld.Log("世界boss状态变更: mapID=%s,lineID=%s,bossID=%s,state=%s,tick=%s" % (mapID, lineID, bossID, isAlive, tick)) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if bossID <= 0: | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | bossShuntMapIDList = IpyGameDataPY.GetFuncEvalCfg("BossShunt") | 
|---|
|  |  |  | isBossShuntMap = mapID in bossShuntMapIDList | 
|---|
|  |  |  | isMapNeedShunt = IsMapNeedBossShunt(mapID) | 
|---|
|  |  |  | if not isAlive: | 
|---|
|  |  |  | DoRemoveBossShuntPlayerByNPCID(mapID, lineID, bossID) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if isMapNeedShunt: | 
|---|
|  |  |  | __UpdBossLineState(bossID, lineID, isAlive) | 
|---|
|  |  |  | if isBossShuntMap: | 
|---|
|  |  |  | __UpdBossLineState(bossID, lineID, isAlive, isMapNeedShunt) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #__GetBossRecDataByID(bossID) # 检查是否有该boss记录,没有的话创建新纪录 | 
|---|
|  |  |  | if isAlive != __GetIsAlive(bossID): | 
|---|
|  |  |  | 
|---|
|  |  |  | PyGameData.g_familyOwnerBossInfo.pop(bossID) | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | def __UpdBossLineState(bossID, lineID, isAlive): | 
|---|
|  |  |  | def __UpdBossLineState(bossID, lineID, isAlive, isMapNeedShunt): | 
|---|
|  |  |  | if lineID == None: | 
|---|
|  |  |  | return | 
|---|
|  |  |  | bossDeadLineList = PyGameData.g_bossShuntDeadLine.get(bossID, []) | 
|---|
|  |  |  | if isAlive and lineID in bossDeadLineList: | 
|---|
|  |  |  | bossDeadLineList.remove(lineID) | 
|---|
|  |  |  | elif not isAlive and lineID not in bossDeadLineList: | 
|---|
|  |  |  | bossDeadLineList.append(lineID) | 
|---|
|  |  |  | else: | 
|---|
|  |  |  | bossLineStateDict = PyGameData.g_bossShuntLineState.get(bossID, {}) | 
|---|
|  |  |  | if bossLineStateDict.get(lineID) == isAlive: | 
|---|
|  |  |  | return | 
|---|
|  |  |  | bossLineStateDict[lineID] = isAlive | 
|---|
|  |  |  | PyGameData.g_bossShuntLineState[bossID] = bossLineStateDict | 
|---|
|  |  |  | # 为方便内网清除开服天测试,状态都更新 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if not isMapNeedShunt: | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | PyGameData.g_bossShuntDeadLine[bossID] = bossDeadLineList | 
|---|
|  |  |  | if not bossDeadLineList: | 
|---|
|  |  |  | PyGameData.g_bossShuntDeadLine.pop(bossID) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if bossID not in PyGameData.g_bossShuntDeadLineChangeBoss: | 
|---|
|  |  |  | PyGameData.g_bossShuntDeadLineChangeBoss.append(bossID) | 
|---|
|  |  |  | #GameWorld.SendCommMapServerMsg(ShareDefine.Def_Notify_WorldKey_BossShuntDeadLine, PyGameData.g_bossShuntDeadLine) | 
|---|
|  |  |  | GameWorld.DebugLog("    boss已死亡线路变更: %s" % PyGameData.g_bossShuntDeadLine) | 
|---|
|  |  |  | if bossID not in PyGameData.g_bossShuntStateChangeBoss: | 
|---|
|  |  |  | PyGameData.g_bossShuntStateChangeBoss.append(bossID) | 
|---|
|  |  |  | GameWorld.Log("    分流Boss线路状态变更: %s" % PyGameData.g_bossShuntLineState) | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | killedTime = universalRecData.GetValue2() | 
|---|
|  |  |  | refreshTime = __GetBossRefreshTime(bossInfoObj.BossID) | 
|---|
|  |  |  | bossInfoObj.RefreshSecond = max(0, refreshTime - (curTime - killedTime)) | 
|---|
|  |  |  | bossInfoObj.RefreshCD = refreshTime | 
|---|
|  |  |  | #bossInfoObj.KilledCnt = __GetKilledCnt(universalRecData) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | bossInfo.BossInfoList.append(bossInfoObj) | 
|---|
|  |  |  | 
|---|
|  |  |  | state = gameWorld.GetDictByKey(ChConfig.Def_WorldKey_OperationActionState % ShareDefine.OperationActionName_BossReborn) | 
|---|
|  |  |  | if state: | 
|---|
|  |  |  | Sync_BossRebornPoint(curPlayer) | 
|---|
|  |  |  | Sync_DogzNPCRefreshTime(curPlayer) | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | ## 地图启动ok通知 | 
|---|
|  |  |  | 
|---|
|  |  |  | __SendMapServerAliveBoss() | 
|---|
|  |  |  | if IsMapNeedBossShunt(0): | 
|---|
|  |  |  | GameWorld.SendCommMapServerMsg(ShareDefine.Def_Notify_WorldKey_BossShuntPlayer, PyGameData.g_bossShuntPlayerInfo) | 
|---|
|  |  |  | GameWorld.SendCommMapServerMsg(ShareDefine.Def_Notify_WorldKey_BossShuntDeadLine, PyGameData.g_bossShuntDeadLine) | 
|---|
|  |  |  | GameWorld.SendCommMapServerMsg(ShareDefine.Def_Notify_WorldKey_BossShuntLineState, PyGameData.g_bossShuntLineState) | 
|---|
|  |  |  | #通知一个参数 | 
|---|
|  |  |  | bossID = IpyGameDataPY.GetFuncCfg('DogzFBRefreshCfg', 2) | 
|---|
|  |  |  | onlineCnt = __GetBossOnlineHeroCnt(bossID)[0] | 
|---|
|  |  |  | 
|---|
|  |  |  | if not ipyData: | 
|---|
|  |  |  | return | 
|---|
|  |  |  | onlineCnt = __GetBossOnlineHeroCnt(bossid)[0] | 
|---|
|  |  |  | LVLimit = ipyData.GetLVLimit() | 
|---|
|  |  |  | openServerDay = PlayerDBGSEvent.GetDBGSTrig_ByKey(PlayerDBGSEvent.Def_ServerDay) | 
|---|
|  |  |  | if openServerDay != 0 and LVLimit and len(LVLimit) == 2: | 
|---|
|  |  |  | yesterdayCnt = len([1 for lv in PyGameData.g_yesterdayPlayerLVDict.values() if LVLimit[0]<=lv <= LVLimit[1]]) #参数昨日活跃人数 | 
|---|
|  |  |  | else: | 
|---|
|  |  |  | yesterdayCnt = IpyGameDataPY.GetFuncCfg('FirstDayActivePlayerCnt') | 
|---|
|  |  |  | refreshTime = eval(ipyData.GetRefreshTime()) | 
|---|
|  |  |  | PlayerDBGSEvent.SetDBGSTrig_ByKey(PlayerDBGSEvent.Def_BossRefreshTime % bossid, refreshTime) | 
|---|
|  |  |  | __UpdateBossRefreshList(bossid, killedTime, refreshTime) | 
|---|
|  |  |  | GameWorld.DebugLog('    设置boss刷新时间 BossID=%s,onlineCnt=%s,refreshTime=%s' % (bossid, onlineCnt, refreshTime)) | 
|---|
|  |  |  | GameWorld.DebugLog('    设置boss刷新时间 BossID=%s,onlineCnt=%s,yesterdayCnt=%s,refreshTime=%s' % (bossid, onlineCnt, yesterdayCnt, refreshTime)) | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | def DoCheckWorldBossShuntInfo(curTime, tick): | 
|---|
|  |  |  | ## 定时检查boss分流信息数据 | 
|---|
|  |  |  | if PyGameData.g_bossShuntDeadLineChangeBoss and curTime % 2 == 0: | 
|---|
|  |  |  | GameWorld.SendCommMapServerMsg(ShareDefine.Def_Notify_WorldKey_BossShuntDeadLine, PyGameData.g_bossShuntDeadLine) | 
|---|
|  |  |  | Sync_BossShuntLineInfo(None, PyGameData.g_bossShuntDeadLineChangeBoss) | 
|---|
|  |  |  | PyGameData.g_bossShuntDeadLineChangeBoss = [] | 
|---|
|  |  |  | if PyGameData.g_bossShuntStateChangeBoss and curTime % 5 == 0: | 
|---|
|  |  |  | GameWorld.SendCommMapServerMsg(ShareDefine.Def_Notify_WorldKey_BossShuntLineState, PyGameData.g_bossShuntLineState) | 
|---|
|  |  |  | Sync_BossShuntLineInfo(None, PyGameData.g_bossShuntStateChangeBoss) | 
|---|
|  |  |  | PyGameData.g_bossShuntStateChangeBoss = [] | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if curTime % 10 != 0: | 
|---|
|  |  |  | return | 
|---|
|  |  |  | 
|---|
|  |  |  | def Sync_BossShuntLineInfo(curPlayer=None, syncBOSSIDList=[]): | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if not syncBOSSIDList: | 
|---|
|  |  |  | syncBOSSIDList = PyGameData.g_bossShuntDeadLine.keys() | 
|---|
|  |  |  | syncBOSSIDList = PyGameData.g_bossShuntLineState.keys() | 
|---|
|  |  |  |  | 
|---|
|  |  |  | bossShuntLineInfo = ChPyNetSendPack.tagGCBossShuntLineStateInfo() | 
|---|
|  |  |  | bossShuntLineInfo.Clear() | 
|---|
|  |  |  | bossShuntLineInfo.BossLineStateInfo = [] | 
|---|
|  |  |  | for bossID in syncBOSSIDList: | 
|---|
|  |  |  | bossLineStateDict = PyGameData.g_bossShuntLineState.get(bossID, {}) | 
|---|
|  |  |  | lineIDList = [] | 
|---|
|  |  |  | stateList = [] | 
|---|
|  |  |  | for lineID, state in bossLineStateDict.items(): | 
|---|
|  |  |  | lineIDList.append(lineID) | 
|---|
|  |  |  | stateList.append(state) | 
|---|
|  |  |  | bossLineState = ChPyNetSendPack.tagGCBossShuntLineState() | 
|---|
|  |  |  | bossLineState.BossID = bossID | 
|---|
|  |  |  | bossLineState.DeadLineList = PyGameData.g_bossShuntDeadLine.get(bossID, []) | 
|---|
|  |  |  | bossLineState.DeadLineCount = len(bossLineState.DeadLineList) | 
|---|
|  |  |  | bossLineState.LineIDList = lineIDList | 
|---|
|  |  |  | bossLineState.StateList = stateList | 
|---|
|  |  |  | bossLineState.LineCount = len(bossLineState.LineIDList) | 
|---|
|  |  |  | bossShuntLineInfo.BossLineStateInfo.append(bossLineState) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | bossShuntLineInfo.Count = len(bossShuntLineInfo.BossLineStateInfo) | 
|---|
|  |  |  | 
|---|
|  |  |  | refreshTime = 0 | 
|---|
|  |  |  | PyGameData.g_sortBOSSRefreshList[i] = [bossID, killedTime, refreshTime] | 
|---|
|  |  |  | bossIDList.append(bossID) | 
|---|
|  |  |  | curTime = int(time.time()) | 
|---|
|  |  |  | PyGameData.g_sortBOSSRefreshList.sort(key=lambda asd:max(0, asd[2] - (curTime - asd[1]))) | 
|---|
|  |  |  | GameWorld.Log(' boss复活活动 重生boss bossIDList=%s'%bossIDList) | 
|---|
|  |  |  | g_lastBossRebornTime = int(time.time()) | 
|---|
|  |  |  | g_lastBossRebornTime = curTime | 
|---|
|  |  |  | else: | 
|---|
|  |  |  | #广播 | 
|---|
|  |  |  | needNotifyPointPerList = IpyGameDataPY.GetFuncEvalCfg('BossRebornNotify') | 
|---|
|  |  |  | 
|---|
|  |  |  | NetPackCommon.SendFakePack(curPlayer, packData) | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | def Sync_DogzNPCRefreshTime(msgList): | 
|---|
|  |  |  | def Sync_DogzNPCRefreshTime(curPlayer=None): | 
|---|
|  |  |  | #同步神兽副本NPC刷新时间 | 
|---|
|  |  |  | playerID, refreshTimeDict = msgList | 
|---|
|  |  |  | curPlayer = GameWorld.GetPlayerManager().FindPlayerByID(playerID) if playerID else None | 
|---|
|  |  |  | if playerID and not curPlayer: | 
|---|
|  |  |  | return | 
|---|
|  |  |  | refreshTimeDict = PyGameData.g_dogzNPCRefreshTimeDict | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if not refreshTimeDict: | 
|---|
|  |  |  | return | 
|---|
|  |  |  | curTime = int(time.time()) | 
|---|
|  |  |  | packData = ChPyNetSendPack.tagGCDogzNPCRefreshTime() | 
|---|
|  |  |  | packData.InfoList=[] | 
|---|
|  |  |  | for npcid, rTime in refreshTimeDict.items(): | 
|---|
|  |  |  | for npcid, timeinfo in refreshTimeDict.items(): | 
|---|
|  |  |  | lastRefreshTime, nextNeedTime = timeinfo | 
|---|
|  |  |  | remainTime = max(0, nextNeedTime - curTime + lastRefreshTime) | 
|---|
|  |  |  | timeInfo = ChPyNetSendPack.tagDogzTimeInfoObj() | 
|---|
|  |  |  | timeInfo.NPCID = npcid | 
|---|
|  |  |  | timeInfo.RefreshSecond = rTime | 
|---|
|  |  |  | timeInfo.RefreshSecond = remainTime | 
|---|
|  |  |  | packData.InfoList.append(timeInfo) | 
|---|
|  |  |  | packData.Cnt = len(packData.InfoList) | 
|---|
|  |  |  | if not playerID: | 
|---|
|  |  |  | if not curPlayer: | 
|---|
|  |  |  | playerManager = GameWorld.GetPlayerManager() | 
|---|
|  |  |  | for i in xrange(playerManager.GetActivePlayerCount()): | 
|---|
|  |  |  | curPlayer = playerManager.GetActivePlayerAt(i) | 
|---|
|  |  |  | 
|---|
|  |  |  | GameWorld.Log("骑宠争夺仙盟击杀Boss数统计: %s" % PyGameData.g_familyKillHorsePetRobBossCntDict) | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | def SyncMapServer_HorsePetRobBossPlayerCount(): | 
|---|
|  |  |  | ## 活动开始前,同步有效活动人数到地图,作为Boss属性成长系数用 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | diffWorldLV = int(IpyGameDataPY.GetFuncCfg("FairyGrabBossID", 3)) | 
|---|
|  |  |  | funcLimitLV = PlayerControl.GetFuncLimitLV(ShareDefine.GameFuncID_HorsePetRobBoss) | 
|---|
|  |  |  | curWorldLV = PlayerDBGSEvent.GetDBGSTrig_ByKey(ShareDefine.Def_Notify_WorldKey_WorldAverageLv) | 
|---|
|  |  |  | minLV = max(funcLimitLV, curWorldLV + diffWorldLV) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | playerCount = 0 | 
|---|
|  |  |  | playerManager = GameWorld.GetPlayerManager() | 
|---|
|  |  |  | for i in xrange(playerManager.GetActivePlayerCount()): | 
|---|
|  |  |  | findPlayer = playerManager.GetActivePlayerAt(i) | 
|---|
|  |  |  | if findPlayer == None or not findPlayer.GetInitOK(): | 
|---|
|  |  |  | continue | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if PlayerControl.GetIsTJG(findPlayer): | 
|---|
|  |  |  | continue | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if not findPlayer.GetFamilyID(): | 
|---|
|  |  |  | continue | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if findPlayer.GetLV() < minLV: | 
|---|
|  |  |  | continue | 
|---|
|  |  |  |  | 
|---|
|  |  |  | playerCount += 1 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | GameWorld.SendMapServerMsgEx(ShareDefine.Def_Notify_WorldKey_HorsePetRobBossPlayerCount, playerCount) | 
|---|
|  |  |  | GameWorld.Log("同步骑宠争夺有效参与人数: playerCount=%s,minLV=%s,funcLimitLV=%s,curWorldLV=%s,diffWorldLV=%s" | 
|---|
|  |  |  | % (playerCount, minLV, funcLimitLV, curWorldLV, diffWorldLV)) | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | def OnHorsePetRobBossActionChange(isOpen): | 
|---|
|  |  |  | ## 骑宠争夺活动状态变更 | 
|---|
|  |  |  |  | 
|---|