hxp
2019-03-07 fa10596d9f3abf523f8e900d7b920e4af8ea6bc5
ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldBoss.py
@@ -39,6 +39,7 @@
import PlayerCompensation
import IpyGameDataPY
import PyGameDataStruct
import CrossRealmPlayer
import PyDataManager
import PlayerControl
import CrossRealmMsg
@@ -49,7 +50,7 @@
import CrossBoss
import time
import json
'''
@@ -484,7 +485,7 @@
        if not isAlive:
            continue
        mapID = ipyData.GetMapID()
        if mapID != ChConfig.Def_FBMapID_SealDemon:
        if mapID not in ChConfig.WorldBossFBMapIDList:
            GameWorld.SendMapServerMsgEx(ShareDefine.Def_Notify_WorldKey_GameWorldBossReborn % bossID, 1)
    return
@@ -502,7 +503,6 @@
    state = gameWorld.GetDictByKey(ChConfig.Def_WorldKey_OperationActionState % ShareDefine.OperationActionName_BossReborn)
    if state:
        Sync_BossRebornPoint(curPlayer)
    Sync_DogzNPCRefreshTime(curPlayer)
    return
## 地图启动ok通知
@@ -517,10 +517,6 @@
    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:
@@ -554,7 +550,11 @@
        # 同步到玩家对应子服
        if not serverGroupID:
            return
        CrossRealmMsg.SendMsgToClientServer(ShareDefine.CrossServerMsg_DropGoodItem, msgList, [serverGroupID])
        zoneIpyData = CrossRealmPlayer.GetCrossCommZoneIpyDataByServerGroupID(serverGroupID)
        if not zoneIpyData:
            return
        serverGroupIDList = zoneIpyData.GetServerGroupIDList()
        CrossRealmMsg.SendMsgToClientServer(ShareDefine.CrossServerMsg_DropGoodItem, msgList, serverGroupIDList)
        return
    
    recType = ShareDefine.Def_UniversalGameRecType_BossDropGoodItemInfo
@@ -655,8 +655,6 @@
    
    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
@@ -719,10 +717,12 @@
    def GetBossAttentionDict(self):
        return self.bossAttentionDict
    # RecordData改json记录 bossid存为字符串
    def UpdateBossAttention(self, playerid, bossid, isAdd):
        bossid = str(bossid)
        if playerid in self.bossAttentionDict:
            bossAttentionData = self.bossAttentionDict[playerid]
            recordDict = eval(bossAttentionData.RecordData)
            recordDict = json.loads(bossAttentionData.RecordData)
            if isAdd:
                recordDict[bossid] = isAdd
            else:
@@ -733,7 +733,7 @@
                self.bossAttentionDict.pop(playerid)
                
            else:
                bossAttentionData.RecordData = str(recordDict)
                bossAttentionData.RecordData = json.dumps(recordDict, ensure_ascii=False)
                bossAttentionData.DataLen = len(bossAttentionData.RecordData)
        else:
            if not isAdd:
@@ -741,7 +741,7 @@
            bossAttention = PyGameDataStruct.tagDBPyBossAttention()
            bossAttention.clear()
            bossAttention.PlayerID = playerid
            bossAttention.RecordData = str({bossid:isAdd})
            bossAttention.RecordData = json.dumps({bossid:isAdd}, ensure_ascii=False)
            bossAttention.DataLen = len(bossAttention.RecordData)
            self.bossAttentionDict[playerid] = bossAttention
        
@@ -755,12 +755,12 @@
        attentionData = self.bossAttentionDict.get(curPlayer.GetPlayerID())
        if not attentionData:
            return
        bttentionDict = eval(attentionData.RecordData)
        bttentionDict = json.loads(attentionData.RecordData)
        packData = ChPyNetSendPack.tagGCBossAttentionInfo()
        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)
        
@@ -792,10 +792,7 @@
            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
@@ -1080,38 +1077,6 @@
    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():