ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/CrossRealmMsg.py
@@ -23,12 +23,14 @@
import PlayerFuncTeam
import CrossLuckyCloudBuy
import IPY_GameServer
import PlayerViewCache
import CrossRealmPlayer
import PlayerCompensation
import PlayerActBossTrial
import PlayerActXianXiaMJ
import PlayerActGubao
import PlayerActHorsePetTrain
import PlayerActLianqi
import CrossActionControl
import CrossActAllRecharge
import CrossChampionship
@@ -52,6 +54,10 @@
import cPickle
import time
# 仅输出简短日志的信息类型
ClientServerMsg_ShortLogTypeList = [ShareDefine.ClientServerMsg_PushPlayerCache, ShareDefine.ClientServerMsg_PlayerPackData]
CrossServerMsg_ShortLogTypeList = [ShareDefine.CrossServerMsg_PushPlayerPackData, ShareDefine.CrossServerMsg_ViewPlayerCacheRet]
def SendMsgToCrossServer(msgType, dataMsg):
    ## 发送信息到跨服服务器上
    if GameWorld.IsCrossServer():
@@ -65,7 +71,16 @@
    if not GameWorld.GetGameWorld().GetDictByKey(ChConfig.Def_WorldKey_GameWorldInitOK):
        GameWorld.ErrLog("服务器未启动好,不允许向跨服服务器发送数据! %s" % (srcMsg))
        return
    GameWorld.Log("SendMsgToCrossServer => %s" % (srcMsg))
    if msgType in ClientServerMsg_ShortLogTypeList:
        playerID = 0
        if isinstance(dataMsg, dict):
            playerID = dataMsg.get("playerID", 0)
            if not playerID:
                playerID = dataMsg.get("PlayerID", 0)
        msgLen = len(str(srcMsg))
        GameWorld.Log("SendMsgToCrossServer => %s, playerID=%s,msgLen=%s" % (msgType, playerID, msgLen))
    else:
        GameWorld.Log("SendMsgToCrossServer => %s, %s" % (msgType, srcMsg))
    GameWorld.GetGameWorld().SendMergerChildToCenterStringData(sendMsg, len(sendMsg))
    return
@@ -77,23 +92,26 @@
            return
        msgDict = cPickle.loads(recvMsg)
        
        GameWorld.Log("OnCrossServerReceiveMsg: %s" % msgDict)
        msgType = msgDict.get("MsgType", -1)    
        msgData = msgDict.get("Data", "")
        serverGroupID = msgDict.get("ServerGroupID", 0)
        
        if msgType in ClientServerMsg_ShortLogTypeList:
            playerID = 0
            if isinstance(msgData, dict):
                playerID = msgData.get("playerID", 0)
                if not playerID:
                    playerID = msgData.get("PlayerID", 0)
            msgLen = len(str(msgDict))
            GameWorld.Log("OnCrossServerReceiveMsg: %s, serverGroupID=%s,playerID=%s,msgLen=%s" % (msgType, serverGroupID, playerID, msgLen))
        else:
            GameWorld.Log("OnCrossServerReceiveMsg: %s, serverGroupID=%s, %s" % (msgType, serverGroupID, msgDict))
        if msgType == ShareDefine.ClientServerMsg_PKMatch:
            CrossRealmPK.ClientServerMsg_PKMatch(serverGroupID, msgData, tick)
            
        elif msgType == ShareDefine.ClientServerMsg_PKRobotOver:
            CrossRealmPK.ClientServerMsg_PKRobotOver(serverGroupID, msgData, tick)
        elif msgType == ShareDefine.ClientServerMsg_PKCancel:
            CrossRealmPK.ClientServerMsg_PKCancel(msgData, tick)
        elif msgType == ShareDefine.ClientServerMsg_PKPrepareOK:
            CrossRealmPK.ClientServerMsg_PKPrepareOK(msgData, tick)
        elif msgType == ShareDefine.ClientServerMsg_PKOver:
            CrossRealmPK.ClientServerMsg_PKOver(serverGroupID, msgData, tick)
            
        elif msgType == ShareDefine.ClientServerMsg_PKBillboard:
            CrossRealmPK.ClientServerMsg_PKBillboard(serverGroupID, msgData)
@@ -123,7 +141,10 @@
            ClientServerMsg_ServerInitOK(serverGroupID, tick)
            
        elif msgType == ShareDefine.ClientServerMsg_ViewPlayerCache:
            CrossRealmPlayer.ClientServerMsg_ViewPlayerCache(serverGroupID, msgData)
            PlayerViewCache.ClientServerMsg_ViewPlayerCache(serverGroupID, msgData)
        elif msgType == ShareDefine.ClientServerMsg_PushPlayerCache:
            PlayerViewCache.ClientServerMsg_PushPlayerCache(serverGroupID, msgData)
            
        elif msgType == ShareDefine.ClientServerMsg_PullOtherPlayerPackData:
            PlayerPackData.ClientServerMsg_PullOtherPlayerPackData(serverGroupID, msgData)
@@ -157,6 +178,9 @@
                        
        elif msgType == ShareDefine.ClientServerMsg_BattlefieldCallChange:
            CrossBattlefield.ClientServerMsg_BattlefieldCallChange(serverGroupID, msgData)
        elif msgType == ShareDefine.ClientServerMsg_ChampionshipPKOver:
            CrossChampionship.ClientServerMsg_ChampionshipPKOver(serverGroupID, msgData)
            
        elif msgType == ShareDefine.ClientServerMsg_ChampionshipOfficialApply:
            CrossChampionship.ClientServerMsg_ChampionshipOfficialApply(serverGroupID, msgData)
@@ -196,6 +220,9 @@
            
        elif msgType == ShareDefine.ClientServerMsg_HorsePetTrainScore:
            PlayerActHorsePetTrain.ClientServerMsg_HorsePetTrainScore(serverGroupID, msgData)
        elif msgType == ShareDefine.ClientServerMsg_LianqiScore:
            PlayerActLianqi.ClientServerMsg_LianqiScore(serverGroupID, msgData)
            
        elif msgType == ShareDefine.ClientServerMsg_CreateFuncTeam:
            PlayerFuncTeam.ClientServerMsg_CreateFuncTeam(serverGroupID, msgData)
@@ -309,7 +336,16 @@
    if not GameWorld.GetGameWorld().GetDictByKey(ChConfig.Def_WorldKey_GameWorldInitOK):
        GameWorld.ErrLog("跨服服务器未启动好,不允许向子服发送数据! serverGroupIDList=%s, srcMsg=%s" % (serverGroupIDList, srcMsg))
        return
    GameWorld.Log("SendMsgToClientServer => serverGroupIDList=%s, srcMsg=%s" % (serverGroupIDList, srcMsg))
    if msgType in CrossServerMsg_ShortLogTypeList:
        playerID = 0
        if isinstance(dataMsg, dict):
            playerID = dataMsg.get("playerID", 0)
            if not playerID:
                playerID = dataMsg.get("PlayerID", 0)
        msgLen = len(str(srcMsg))
        GameWorld.Log("SendMsgToClientServer => %s, %s, playerID=%s,msgLen=%s" % (msgType, serverGroupIDList, playerID, msgLen))
    else:
        GameWorld.Log("SendMsgToClientServer => %s, %s, %s" % (msgType, serverGroupIDList, srcMsg))
    if not serverGroupIDList:
        GameWorld.GetGameWorld().SendBroadcastMergeClient(sendMsg, len(sendMsg))
    else:
@@ -334,7 +370,18 @@
        msgType = msgDict.get("MsgType", -1)    
        msgData = msgDict.get("Data", "")
        crossServerTimeStr = msgDict.get("CrossServerTime", "")
        GameWorld.Log("OnClientServerReceiveMsg: %s" % msgDict)
        if msgType in CrossServerMsg_ShortLogTypeList:
            playerID = 0
            if isinstance(msgData, dict):
                playerID = msgData.get("playerID", 0)
                if not playerID:
                    playerID = msgData.get("PlayerID", 0)
            msgLen = len(str(msgDict))
            GameWorld.Log("OnClientServerReceiveMsg: %s, playerID=%s,msgLen=%s" % (msgType, playerID, msgLen))
        else:
            GameWorld.Log("OnClientServerReceiveMsg: %s, %s" % (msgType, msgDict))
        if crossServerTimeStr:
            curServerTime = int(time.time())
            crossServerTime = GameWorld.ChangeTimeStrToNum(crossServerTimeStr)
@@ -362,7 +409,10 @@
            PlayerTalk.CrossServerMsg_ChatCrossWorld(msgData)
            
        elif msgType == ShareDefine.CrossServerMsg_ViewPlayerCacheRet:
            CrossRealmPlayer.CrossServerMsg_ViewPlayerCacheRet(msgData, tick)
            PlayerViewCache.CrossServerMsg_ViewPlayerCacheRet(msgData, tick)
        elif msgType == ShareDefine.CrossServerMsg_PullPlayerViewCache:
            PlayerViewCache.CrossServerMsg_PullPlayerViewCache(msgData)
            
        elif msgType == ShareDefine.CrossServerMsg_PlayerPackDataState:
            PlayerPackData.CrossServerMsg_PlayerPackDataState(msgData)
@@ -376,23 +426,11 @@
        elif msgType == ShareDefine.CrossServerMsg_PKMatchReqRet:
            CrossRealmPK.CrossServerMsg_PKMatchReqRet(msgData)
            
        elif msgType == ShareDefine.CrossServerMsg_PKMatchResult:
            CrossRealmPK.CrossServerMsg_PKMatchResult(msgData)
        elif msgType == ShareDefine.CrossServerMsg_PKReadyOKRoomList:
            CrossRealmPK.CrossServerMsg_PKReadyOKRoomList(msgData)
        elif msgType == ShareDefine.CrossServerMsg_PKTimeoutRoomList:
            CrossRealmPK.CrossServerMsg_PKTimeoutRoomList(msgData)
        elif msgType == ShareDefine.CrossServerMsg_PKOverInfo:
            CrossRealmPK.CrossServerMsg_PKOverInfo(msgData)
            
        elif msgType == ShareDefine.CrossServerMsg_PKSeasonInfo:
            CrossRealmPK.CrossServerMsg_PKSeasonInfo(msgData)
        elif msgType == ShareDefine.CrossServerMsg_PKSyncBillboard:
            CrossRealmPK.CrossServerMsg_PKSyncBillboard(msgData)
            
        elif msgType == ShareDefine.CrossServerMsg_LuckyCloudBuyLottery:
            CrossLuckyCloudBuy.CrossServerMsg_LuckyCloudBuyLottery(msgData)