|  |  |  | 
|---|
|  |  |  | import PlayerCompensation | 
|---|
|  |  |  | import IpyGameDataPY | 
|---|
|  |  |  | import PyGameDataStruct | 
|---|
|  |  |  | import CrossRealmPlayer | 
|---|
|  |  |  | import PyDataManager | 
|---|
|  |  |  | import PlayerControl | 
|---|
|  |  |  | import CrossRealmMsg | 
|---|
|  |  |  | 
|---|
|  |  |  | import PlayerGeTui | 
|---|
|  |  |  | import IPY_GameServer | 
|---|
|  |  |  | import CrossBoss | 
|---|
|  |  |  | import PlayerFB | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import time | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | ''' | 
|---|
|  |  |  | ShareDefine.Def_UniversalGameRecType_BossInfo | 
|---|
|  |  |  | 
|---|
|  |  |  | if bossID <= 0: | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | bossID, killPlayerName, hurtValue, isNotify, realMapID, dataMapID, copyMapID, killerIDList = msgList | 
|---|
|  |  |  | bossID, killPlayerName, hurtValue, isNotify, mapID, realMapID, copyMapID, killerIDList = msgList | 
|---|
|  |  |  | mapID = PlayerFB.GetRecordMapID(mapID) | 
|---|
|  |  |  | if GameWorld.IsCrossServer(): | 
|---|
|  |  |  | CrossBoss.DoCrossBossOnKilled(bossID, killPlayerName, realMapID, dataMapID, copyMapID, killerIDList) | 
|---|
|  |  |  | CrossBoss.DoCrossBossOnKilled(bossID, killPlayerName, mapID, realMapID, copyMapID, killerIDList) | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | mapID = dataMapID | 
|---|
|  |  |  | isAddKillCnt = False | 
|---|
|  |  |  |  | 
|---|
|  |  |  | isMapNeedShunt = IsMapNeedBossShunt(mapID) | 
|---|
|  |  |  | 
|---|
|  |  |  | ## 世界boss状态变更 | 
|---|
|  |  |  | if len(msgList) <= 0: | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | bossID, isAlive, dataMapID, realMapID, copyMapID = msgList | 
|---|
|  |  |  |  | 
|---|
|  |  |  | bossID, isAlive, mapID, realMapID, copyMapID = msgList | 
|---|
|  |  |  | mapID = PlayerFB.GetRecordMapID(mapID) | 
|---|
|  |  |  | if GameWorld.IsCrossServer(): | 
|---|
|  |  |  | CrossBoss.DoCrossBossStateChange(bossID, isAlive, dataMapID, realMapID, copyMapID) | 
|---|
|  |  |  | CrossBoss.DoCrossBossStateChange(bossID, isAlive, mapID, realMapID, copyMapID) | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | mapID, lineID = dataMapID, copyMapID | 
|---|
|  |  |  | lineID = copyMapID | 
|---|
|  |  |  | GameWorld.Log("世界boss状态变更: mapID=%s,lineID=%s,bossID=%s,state=%s,tick=%s" % (mapID, lineID, bossID, isAlive, tick)) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if bossID <= 0: | 
|---|
|  |  |  | 
|---|
|  |  |  | def OnQueryBossInfo(index, clientData, tick): | 
|---|
|  |  |  | curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index) | 
|---|
|  |  |  | bossIDList = clientData.BossIDList | 
|---|
|  |  |  | Sync_BossInfo(curPlayer, bossIDList) | 
|---|
|  |  |  | if not bossIDList: | 
|---|
|  |  |  | Sync_BossInfo(curPlayer) | 
|---|
|  |  |  | CrossBoss.Sync_CrossBossInfo(curPlayer) | 
|---|
|  |  |  | return | 
|---|
|  |  |  | bossID = bossIDList[0] | 
|---|
|  |  |  | ipyData = IpyGameDataPY.GetIpyGameData('BOSSInfo', bossID) | 
|---|
|  |  |  | if not ipyData: | 
|---|
|  |  |  | return | 
|---|
|  |  |  | mapID = ipyData.GetMapID() | 
|---|
|  |  |  | if mapID in ChConfig.Def_CrossMapIDList: | 
|---|
|  |  |  | CrossBoss.Sync_CrossBossInfo(curPlayer, bossIDList) | 
|---|
|  |  |  | else: | 
|---|
|  |  |  | Sync_BossInfo(curPlayer, bossIDList) | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | isAlive = __GetIsAlive(bossID) | 
|---|
|  |  |  | if not isAlive: | 
|---|
|  |  |  | continue | 
|---|
|  |  |  | mapID = ipyData.GetMapID() | 
|---|
|  |  |  | if mapID != ChConfig.Def_FBMapID_SealDemon: | 
|---|
|  |  |  | GameWorld.SendMapServerMsgEx(ShareDefine.Def_Notify_WorldKey_GameWorldBossReborn % bossID, 1) | 
|---|
|  |  |  | #if mapID not in ChConfig.WorldBossFBMapIDList: | 
|---|
|  |  |  | GameWorld.SendMapServerMsgEx(ShareDefine.Def_Notify_WorldKey_GameWorldBossReborn % bossID, 1) | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | ## 玩家登录通知 | 
|---|
|  |  |  | 
|---|
|  |  |  | state = gameWorld.GetDictByKey(ChConfig.Def_WorldKey_OperationActionState % ShareDefine.OperationActionName_BossReborn) | 
|---|
|  |  |  | if state: | 
|---|
|  |  |  | Sync_BossRebornPoint(curPlayer) | 
|---|
|  |  |  | Sync_DogzNPCRefreshTime(curPlayer) | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | ## 地图启动ok通知 | 
|---|
|  |  |  | 
|---|
|  |  |  | if IsMapNeedBossShunt(0): | 
|---|
|  |  |  | GameWorld.SendCommMapServerMsg(ShareDefine.Def_Notify_WorldKey_BossShuntPlayer, PyGameData.g_bossShuntPlayerInfo) | 
|---|
|  |  |  | GameWorld.SendCommMapServerMsg(ShareDefine.Def_Notify_WorldKey_BossShuntLineState, PyGameData.g_bossShuntLineState) | 
|---|
|  |  |  | #通知一个参数 | 
|---|
|  |  |  | bossID = IpyGameDataPY.GetFuncCfg('DogzFBRefreshCfg', 2) | 
|---|
|  |  |  | onlineCnt = __GetBossOnlineHeroCnt(bossID)[0] | 
|---|
|  |  |  | GameWorld.SendMapServerMsgEx(ShareDefine.Def_Notify_WorldKey_BossOnlineHeroCnt % bossID, onlineCnt) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #仙盟击杀骑宠boss数 | 
|---|
|  |  |  | if PyGameData.g_familyKillHorsePetRobBossCntDict: | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | def OnKillBossDropGoodItem(msgList, tick): | 
|---|
|  |  |  | # playerName, mapID, npcID, itemID, userData | 
|---|
|  |  |  | if len(msgList) != 8: | 
|---|
|  |  |  | if len(msgList) != 10: | 
|---|
|  |  |  | return | 
|---|
|  |  |  | playerID, killerName, mapID, npcID, itemID, userData, weightValue, serverGroupID = msgList | 
|---|
|  |  |  | playerID, killerName, mapID, lineID, npcID, itemID, userData, weightValue, serverGroupID, playerLV = msgList | 
|---|
|  |  |  | GameWorld.DebugLog("击杀Boss掉落好物品: mapID=%s,npcID=%s,killerName=%s,itemID=%s, userData=%s, weightValue=%s, serverGroupID=%s" | 
|---|
|  |  |  | % (mapID, npcID, killerName, itemID, userData, weightValue, serverGroupID)) | 
|---|
|  |  |  | maxRecordCnt = IpyGameDataPY.GetFuncCfg('DropRecordNum') | 
|---|
|  |  |  | 
|---|
|  |  |  | # 同步到玩家对应子服 | 
|---|
|  |  |  | if not serverGroupID: | 
|---|
|  |  |  | return | 
|---|
|  |  |  | CrossRealmMsg.SendMsgToClientServer(ShareDefine.CrossServerMsg_DropGoodItem, msgList, [serverGroupID]) | 
|---|
|  |  |  | zoneIpyData = CrossRealmPlayer.GetCrossZoneIpyDataByServerGroupID(mapID, serverGroupID) | 
|---|
|  |  |  | if not zoneIpyData: | 
|---|
|  |  |  | return | 
|---|
|  |  |  | serverGroupIDList = zoneIpyData.GetServerGroupIDList() | 
|---|
|  |  |  | CrossRealmMsg.SendMsgToClientServer(ShareDefine.CrossServerMsg_DropGoodItem, msgList, serverGroupIDList) | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | recType = ShareDefine.Def_UniversalGameRecType_BossDropGoodItemInfo | 
|---|
|  |  |  | 
|---|
|  |  |  | if commonList and commonList[0][0] != -1: | 
|---|
|  |  |  | recordList.Delete(commonList[0][0]) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | PlayerUniversalGameRec.MapServer_UniversalGameRec(None, recType, [mapID, npcID, itemID, playerID, weightValue], | 
|---|
|  |  |  | [killerName, "", userData]) | 
|---|
|  |  |  | PlayerUniversalGameRec.MapServer_UniversalGameRec(None, recType, [mapID*100+lineID, npcID, itemID, playerID, weightValue], | 
|---|
|  |  |  | [killerName, '%s|%s'%(serverGroupID, playerLV), userData]) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | msgList = [killerName, playerID, mapID, npcID, itemID, userData] | 
|---|
|  |  |  | msgList = [killerName, playerID, mapID, npcID, itemID, userData, serverGroupID, playerLV, lineID] | 
|---|
|  |  |  | PlayerControl.WorldNotify(0, 'DropRecord' , msgList) | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | newNum = newOnlieCnt * 100 + unUpdataCnt | 
|---|
|  |  |  | PlayerDBGSEvent.SetDBGSTrig_ByKey(ShareDefine.Def_Notify_WorldKey_GameWorldBossOnlineCnt % bossid, newNum) | 
|---|
|  |  |  | if bossid == IpyGameDataPY.GetFuncCfg('DogzFBRefreshCfg', 2): | 
|---|
|  |  |  | GameWorld.SendMapServerMsgEx(ShareDefine.Def_Notify_WorldKey_BossOnlineHeroCnt % bossid, newOnlieCnt) | 
|---|
|  |  |  | GameWorld.DebugLog("设置计算boss刷新时间用的在线人数 Change:bossid=%s, beforeOnlineCnt = %s, newOnlieCnt = %s, unUpdataCnt=%s" % (bossid, beforeOnlineCnt, newOnlieCnt, unUpdataCnt)) | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | def GetBossAttentionDict(self): | 
|---|
|  |  |  | return self.bossAttentionDict | 
|---|
|  |  |  |  | 
|---|
|  |  |  | # RecordData改json记录 bossid存为字符串 | 
|---|
|  |  |  | def UpdateBossAttention(self, playerid, bossid, isAdd): | 
|---|
|  |  |  | if playerid in self.bossAttentionDict: | 
|---|
|  |  |  | bossAttentionData = self.bossAttentionDict[playerid] | 
|---|
|  |  |  | 
|---|
|  |  |  | packData.BossList = [] | 
|---|
|  |  |  | for bossid, addState in bttentionDict.items(): | 
|---|
|  |  |  | bossInfo = ChPyNetSendPack.tagGCBossAttention() | 
|---|
|  |  |  | bossInfo.BossID=bossid | 
|---|
|  |  |  | bossInfo.BossID=int(bossid) | 
|---|
|  |  |  | bossInfo.AddState=addState | 
|---|
|  |  |  | packData.BossList.append(bossInfo) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | data.clear() | 
|---|
|  |  |  | pos += data.readData(datas, pos, dataslen) | 
|---|
|  |  |  | playerID = data.PlayerID | 
|---|
|  |  |  | if type(eval(data.RecordData)) != list: | 
|---|
|  |  |  | self.bossAttentionDict[playerID] = data | 
|---|
|  |  |  | else: | 
|---|
|  |  |  | data.clear() | 
|---|
|  |  |  | self.bossAttentionDict[playerID] = data | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return pos | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | packData.RebornCnt = PlayerDBGSEvent.GetDBGSTrig_ByKey(PlayerDBGSEvent.Def_BossRebornCnt) | 
|---|
|  |  |  | playerManager = GameWorld.GetPlayerManager() | 
|---|
|  |  |  | if not curPlayer: | 
|---|
|  |  |  | for i in xrange(playerManager.GetActivePlayerCount()): | 
|---|
|  |  |  | curPlayer = playerManager.GetActivePlayerAt(i) | 
|---|
|  |  |  | if curPlayer == None or not curPlayer.GetInitOK(): | 
|---|
|  |  |  | continue | 
|---|
|  |  |  | if PlayerControl.GetIsTJG(curPlayer): | 
|---|
|  |  |  | continue | 
|---|
|  |  |  | NetPackCommon.SendFakePack(curPlayer, packData) | 
|---|
|  |  |  | else: | 
|---|
|  |  |  | if PlayerControl.GetIsTJG(curPlayer): | 
|---|
|  |  |  | return | 
|---|
|  |  |  | NetPackCommon.SendFakePack(curPlayer, packData) | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | def Sync_DogzNPCRefreshTime(curPlayer=None): | 
|---|
|  |  |  | #同步神兽副本NPC刷新时间 | 
|---|
|  |  |  | refreshTimeDict = PyGameData.g_dogzNPCRefreshTimeDict | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if not refreshTimeDict: | 
|---|
|  |  |  | return | 
|---|
|  |  |  | curTime = int(time.time()) | 
|---|
|  |  |  | packData = ChPyNetSendPack.tagGCDogzNPCRefreshTime() | 
|---|
|  |  |  | packData.InfoList=[] | 
|---|
|  |  |  | for npcid, timeinfo in refreshTimeDict.items(): | 
|---|
|  |  |  | lastRefreshTime, nextNeedTime = timeinfo | 
|---|
|  |  |  | remainTime = max(0, nextNeedTime - curTime + lastRefreshTime) | 
|---|
|  |  |  | timeInfo = ChPyNetSendPack.tagDogzTimeInfoObj() | 
|---|
|  |  |  | timeInfo.NPCID = npcid | 
|---|
|  |  |  | timeInfo.RefreshSecond = remainTime | 
|---|
|  |  |  | packData.InfoList.append(timeInfo) | 
|---|
|  |  |  | packData.Cnt = len(packData.InfoList) | 
|---|
|  |  |  | if not curPlayer: | 
|---|
|  |  |  | playerManager = GameWorld.GetPlayerManager() | 
|---|
|  |  |  | for i in xrange(playerManager.GetActivePlayerCount()): | 
|---|
|  |  |  | curPlayer = playerManager.GetActivePlayerAt(i) | 
|---|
|  |  |  | if curPlayer == None or not curPlayer.GetInitOK(): | 
|---|