| | |
| | | import IpyGameDataPY
|
| | | import ChPyNetSendPack
|
| | | import CrossRealmPlayer
|
| | | import DataRecordPack
|
| | | #import DataRecordPack
|
| | | import PlayerControl
|
| | | import NetPackCommon
|
| | | import CrossRealmMsg
|
| | |
| | | if not zoneID:
|
| | | return
|
| | |
|
| | | __SetCrossBossIsAlive(zoneID, bossID, isAlive)
|
| | | |
| | | if isAlive:
|
| | | # 广播子服跨服boss复活
|
| | | zoneIpyData = CrossRealmPlayer.GetCrossZoneIpyDataByZoneID(mapID, zoneID)
|
| | | if zoneIpyData != None:
|
| | | serverGroupIDList = zoneIpyData.GetServerGroupIDList()
|
| | | stateInfo = [zoneID, bossID, isAlive]
|
| | | CrossRealmMsg.SendMsgToClientServer(ShareDefine.CrossServerMsg_CrossBossState, stateInfo, serverGroupIDList)
|
| | | |
| | | if __GetCrossBossIsAlive(zoneID, bossID) != isAlive:
|
| | | __SetCrossBossIsAlive(zoneID, bossID, isAlive)
|
| | | if isAlive:
|
| | | # 广播子服跨服boss复活
|
| | | SendClientServerCrossBossState(mapID, zoneID, {bossID:isAlive})
|
| | | return
|
| | |
|
| | | def SendClientServerCrossBossState(mapID, zoneID, bossStateDict={}):
|
| | | # 广播子服跨服boss复活
|
| | | zoneIpyData = CrossRealmPlayer.GetCrossZoneIpyDataByZoneID(mapID, zoneID)
|
| | | if zoneIpyData != None:
|
| | | serverGroupIDList = zoneIpyData.GetServerGroupIDList()
|
| | | stateInfo = [zoneID, bossStateDict]
|
| | | CrossRealmMsg.SendMsgToClientServer(ShareDefine.CrossServerMsg_CrossBossState, stateInfo, serverGroupIDList)
|
| | | return
|
| | |
|
| | | def __SetKilledRecord(bossRecData, killedTime, playerName):
|
| | |
| | | mapID = ipyData.GetMapID()
|
| | | if mapID not in ChConfig.Def_CrossZoneTypeName:
|
| | | continue
|
| | | refreshTimeStr = ipyData.GetRefreshTime()
|
| | | if not refreshTimeStr or refreshTimeStr == "0":
|
| | | continue
|
| | | zoneTypeName = ChConfig.Def_CrossZoneTypeName[mapID]
|
| | | if not hasattr(ipyDataMgr, "Get%sCount" % zoneTypeName):
|
| | | continue
|
| | |
| | | bossRecData = __GetCrossBossRecData(zoneID, bossID)
|
| | | killedTime = GetRecKilledTime(bossRecData)
|
| | | refreshTime = GetRecRefreshTime(bossRecData)
|
| | | PyGameData.g_sortBOSSRefreshList.append([bossID, killedTime, refreshTime, zoneID])
|
| | | PyGameData.g_sortBOSSRefreshList.append([bossID, killedTime, refreshTime, zoneID, mapID])
|
| | | PyGameData.g_sortBOSSRefreshList.sort(key=lambda asd:max(0, asd[2] - (curTime - asd[1])))
|
| | |
|
| | | #GameWorld.DebugLog("检查boss复活: PyGameData.g_sortBOSSRefreshList=%s" % PyGameData.g_sortBOSSRefreshList)
|
| | | syncBOSSIDList = []
|
| | | zoneMapBossStateDict = {}
|
| | | for bossInfo in PyGameData.g_sortBOSSRefreshList:
|
| | | bossID, killedTime, refreshTime, zoneID = bossInfo
|
| | | bossID, killedTime, refreshTime, zoneID, mapID = bossInfo
|
| | | isAlive = __GetCrossBossIsAlive(zoneID, bossID)
|
| | | if isAlive:
|
| | | #GameWorld.DebugLog(" zoneID=%s,bossID=%s,未被击杀!" % (zoneID, bossID))
|
| | |
| | | #GameWorld.DebugLog(" zoneID=%s,bossID=%s,refreshTime=%s,curTime=%s,killedTime=%s,重生倒计时秒(%s)!" % (zoneID, bossID, refreshTime, curTime, killedTime, rebornSecond))
|
| | | break
|
| | |
|
| | | __SetCrossBossIsAlive(zoneID, bossID, 1)
|
| | | syncBOSSIDList.append(bossID)
|
| | | isAlive = 1
|
| | | __SetCrossBossIsAlive(zoneID, bossID, isAlive)
|
| | | |
| | | key = (mapID, zoneID)
|
| | | if key not in zoneMapBossStateDict:
|
| | | zoneMapBossStateDict[key] = {}
|
| | | bossStateDict = zoneMapBossStateDict[key]
|
| | | bossStateDict[bossID] = isAlive
|
| | |
|
| | | GameWorld.SendMapServerMsgEx(ShareDefine.Def_Notify_WorldKey_GameWorldBossRebornCross % (zoneID, bossID), 1)
|
| | | GameWorld.DebugLog(" 通知MapServer重生: zoneID=%s,bossID=%s,killedTime=%s,rebornSecond=%s" % (zoneID, bossID, killedTime, rebornSecond))
|
| | |
|
| | | for key, bossStateDict in zoneMapBossStateDict.items():
|
| | | mapID, zoneID = key
|
| | | SendClientServerCrossBossState(mapID, zoneID, bossStateDict)
|
| | | return
|
| | |
|
| | | def GetCrossBossIsAliveOrCanReborn(zoneID, bossID):
|
| | |
| | |
|
| | | def OnPlayerLogin(curPlayer):
|
| | | Sync_CrossBossInfo(curPlayer)
|
| | | __LoginNotifyKillCrossBoss(curPlayer)
|
| | | return
|
| | |
|
| | | def CrossServerMsg_CrossBossInfo(bossInfoDict):
|
| | |
| | | for playerID in killerIDList:
|
| | | killer = GameWorld.GetPlayerManager().FindPlayerByID(playerID)
|
| | | if not killer:
|
| | | GameWorld.ErrLog("击杀跨服boss时主服玩家不在线, playerID=%s,mapID=%s,bossID=%s" % (playerID, mapID, bossID))
|
| | | DataRecordPack.SendEventPack("CrossBoss_Error", {"PlayerID":playerID, "Error":"MainServerOffline"})
|
| | | #GameWorld.ErrLog("击杀跨服boss时主服玩家不在线, playerID=%s,mapID=%s,bossID=%s" % (playerID, mapID, bossID))
|
| | | #DataRecordPack.SendEventPack("CrossBoss_Error", {"PlayerID":playerID, "Error":"MainServerOffline"})
|
| | | killTime = int(time.time())
|
| | | PyGameData.g_unNotifyKillCrossBossDict[playerID] = [killTime, mapID, bossID]
|
| | | continue
|
| | | msgInfo = str([mapID, bossID])
|
| | | killer.MapServer_QueryPlayerResult(0, 0, "CrossKillBoss", msgInfo, len(msgInfo))
|
| | |
| | | Sync_CrossBossInfo(None, syncBOSSIDList)
|
| | | return
|
| | |
|
| | | def __LoginNotifyKillCrossBoss(curPlayer):
|
| | | ## 登录时通知未通知到的击杀跨服boss
|
| | | playerID = curPlayer.GetPlayerID()
|
| | | if playerID not in PyGameData.g_unNotifyKillCrossBossDict:
|
| | | return
|
| | | killTime, mapID, bossID = PyGameData.g_unNotifyKillCrossBossDict.pop(playerID)
|
| | | curTime = int(time.time())
|
| | | passSeconds = curTime - killTime
|
| | | if passSeconds >= 120:
|
| | | GameWorld.DebugLog("超过120秒上线不处理,主要为了防刷上线捡物品!", playerID)
|
| | | return
|
| | | msgInfo = str([mapID, bossID])
|
| | | curPlayer.MapServer_QueryPlayerResult(0, 0, "CrossKillBoss", msgInfo, len(msgInfo))
|
| | | GameWorld.Log("上线补通知击杀跨服boss: passSeconds=%s, mapID=%s, bossID=%s" % (passSeconds, mapID, bossID), playerID)
|
| | | return
|
| | |
|
| | | def CrossServerMsg_CrossBossState(msgInfo):
|
| | | ## 收到跨服服务器同步的跨服boss状态
|
| | |
|
| | | zoneID, bossID, isAlive = msgInfo
|
| | | GameWorld.DebugLog("收到跨服服务器同步的跨服boss状态: zoneID=%s, bossID=%s, isAlive=%s" % (zoneID, bossID, isAlive))
|
| | | zoneID, bossStateDict = msgInfo
|
| | | GameWorld.DebugLog("收到跨服服务器同步的跨服boss状态: zoneID=%s, bossStateDict=%s" % (zoneID, bossStateDict))
|
| | |
|
| | | __SetCrossBossIsAlive(zoneID, bossID, isAlive)
|
| | | aliveBossIDList = []
|
| | | for bossID, isAlive in bossStateDict.items():
|
| | | __SetCrossBossIsAlive(zoneID, bossID, isAlive)
|
| | | if isAlive:
|
| | | aliveBossIDList.append(bossID)
|
| | |
|
| | | if isAlive:
|
| | | Sync_CrossBossInfo(None, [bossID])
|
| | | if aliveBossIDList:
|
| | | Sync_CrossBossInfo(None, aliveBossIDList)
|
| | |
|
| | | return
|
| | |
|
| | |
| | | bossInfoObj.RefreshCD = refreshTime
|
| | | bossInfo.BossInfoList.append(bossInfoObj)
|
| | |
|
| | | if not bossInfo.BossInfoList:
|
| | | return
|
| | | |
| | | bossInfo.BossCnt = len(bossInfo.BossInfoList)
|
| | | if not curPlayer:
|
| | | # 全服广播在线玩家
|