ServerPython/CoreServerGroup/GameServer/Script/Player/CrossRealmPlayer.py
@@ -46,7 +46,7 @@
# 获取玩家跨服服务器上的名字
def GetCrossPlayerName(curPlayer):
    # 通过游戏账号中的平台标志获取名称,目前为spid
    playerName = curPlayer.GetPlayerName()
    playerName = curPlayer.GetName()
    
    opName = ReadChConfig.GetPyMongoConfig("Merge", "OpName_%s_%s" % (GameWorld.GetPlayerPlatform(curPlayer), 
                                           GameWorld.GetPlayerServerSID(curPlayer)))
@@ -101,7 +101,7 @@
            curPlayer = playerManager.GetActivePlayerAt(i)
            if curPlayer == None:
                continue
            PlayerControl.SetCrossRealmState(curPlayer, 0)
            PlayerControl.SetCrossMapID(curPlayer, 0)
            curPlayer.Kick(0)
            
    # 广播所有子服,本服务器进入维护
@@ -121,7 +121,7 @@
            curPlayer = playerManager.GetActivePlayerAt(i)
            if curPlayer == None:
                continue
            PlayerControl.SetCrossRealmState(curPlayer, 0)
            PlayerControl.SetCrossMapID(curPlayer, 0)
            
    # 通知地图
    GameWorld.SendMapServerMsgEx(ShareDefine.Def_Notify_WorldKey_CrossServerOpen, isOpen)
@@ -139,7 +139,7 @@
    CrossRealmMsg.SendMsgToClientServer(ShareDefine.CrossServerMsg_ExitCrossServer, playerID, [serverGroupID])
    
    # 设置非跨服状态,踢下线
    PlayerControl.SetCrossRealmState(curPlayer, 0)
    PlayerControl.SetCrossMapID(curPlayer, 0)
    curPlayer.Kick(0)
    GameWorld.Log("PlayerExitCrossServer...serverGroupID=%s" % serverGroupID, playerID)
    return
@@ -152,7 +152,7 @@
    if not curPlayer:
        GameWorld.Log("    退出跨服时本服玩家不在线!", playerID)
        return
    PlayerControl.SetCrossRealmState(curPlayer, 0)
    PlayerControl.SetCrossMapID(curPlayer, 0)
    return
def SendCrossRealmReg(curPlayer, registerMap, mapID=0, dataMapID=0, copyMapID=0, posX=0, posY=0):
@@ -226,7 +226,7 @@
    '''
    curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
    GameWorld.ErrLog("某些异常情况下,前端强制发包退出跨服状态! ", curPlayer.GetPlayerID())
    PlayerControl.SetCrossRealmState(curPlayer, 0)
    PlayerControl.SetCrossMapID(curPlayer, 0)
    return
#// C0 02 查看跨服玩家信息 #tagCGViewCrossPlayerInfo
@@ -316,7 +316,6 @@
    sendPack.ItemDataSize = len(sendPack.ItemData)
    sendPack.PlusData = PlusData
    sendPack.PlusDataSize = len(sendPack.PlusData)
    sendPack.CrossPlayer = 1
    NetPackCommon.SendFakePack(curPlayer, sendPack)
    return
@@ -352,5 +351,36 @@
    curPlayer.MapServer_QueryPlayerResult(0, 0, "CrossGiveMoney", msgInfo, len(msgInfo))
    return
def SetCrossPlayerAttrValue(msgInfo, tick):
    ## 设置跨服玩家属性值
    playerID, setType, setDict, isDelay = msgInfo
    if not PyGameData.g_crossSetPlayerAttr:
        GameWorld.GetGameWorld().SetDict(ChConfig.Def_WorldKey_CrossSetPlayerAttrTick, tick)
    playerSetInfoList = PyGameData.g_crossSetPlayerAttr.get(playerID, [])
    playerSetInfoList.append([setType, setDict])
    PyGameData.g_crossSetPlayerAttr[playerID] = playerSetInfoList
    if not isDelay:
        __SendCrossServerSetPlayerAttr(0)
    return
def OnCrossProcess(tick):
    __SendCrossServerSetPlayerAttr(tick)
    return
def __SendCrossServerSetPlayerAttr(tick):
    if not PyGameData.g_crossSetPlayerAttr:
        return
    if tick:
        # 延迟10秒一次性同步,主要是比如OnDay的时候当多个玩家同时跨服时,减少同步次数,延迟统一发送
        if tick - GameWorld.GetGameWorld().GetDictByKey(ChConfig.Def_WorldKey_CrossSetPlayerAttrTick) < 10 * 1000:
            return
        GameWorld.GetGameWorld().SetDict(ChConfig.Def_WorldKey_CrossSetPlayerAttrTick, tick)
    CrossRealmMsg.SendMsgToCrossServer(ShareDefine.ClientServerMsg_SetPlayerAttrValue, PyGameData.g_crossSetPlayerAttr)
    PyGameData.g_crossSetPlayerAttr = {}
    return