| | |
| | | ipyDataList = IpyGameDataPY.GetIpyGameDataByCondition(zoneTypeName, {"CrossZoneName":crossZoneName}, True)
|
| | | return ipyDataList
|
| | |
|
| | | def GetServerCommCrossZoneID(serverGroupID):
|
| | | ## 获取跨服常规分区
|
| | | zoneTypeName = "CrossZoneComm"
|
| | | crossZoneName = GameWorld.GetCrossZoneName()
|
| | | ipyDataList = IpyGameDataPY.GetIpyGameDataByCondition(zoneTypeName, {"CrossZoneName":crossZoneName}, True)
|
| | | if not ipyDataList:
|
| | | return 0
|
| | | for ipyData in ipyDataList:
|
| | | serverGroupIDList = ipyData.GetServerGroupIDList()
|
| | | for serverGroupIDInfo in serverGroupIDList:
|
| | | if (isinstance(serverGroupIDInfo, tuple) and serverGroupIDInfo[0] <= serverGroupID <= serverGroupIDInfo[1]) \
|
| | | or (isinstance(serverGroupIDInfo, int) and serverGroupIDInfo == serverGroupID):
|
| | | return ipyData.GetZoneID()
|
| | | return 0
|
| | |
|
| | | def GetServerCrossZoneMapIpyData(zoneID, mapID):
|
| | | ## 获取本服对应跨服玩法分区地图信息 - 仅适用于固定地图及虚拟分线的跨服玩法
|
| | | if mapID not in ChConfig.Def_CrossZoneMapTableName:
|
| | |
| | |
|
| | | def SendCrossRealmReg(curPlayer, registerMap, mapID=0, dataMapID=0, copyMapID=0, posX=0, posY=0, lineID=0):
|
| | | # 发送跨服账号注册上传数据
|
| | | # @param mapID: 真实场景地图ID
|
| | | # @param dataMapID: 真实场景地图ID对应场景数据地图ID
|
| | |
|
| | | # 设置上传数据的活动类型
|
| | | curPlayer.SetDict(ChConfig.Def_PlayerKey_CrossRegisterMap, registerMap)
|
| | |
| | | PyGameData.g_crossSetPlayerAttr = {}
|
| | | return
|
| | |
|
| | | def OnPlayerLogin(curPlayer):
|
| | | if not IsCrossServerOpen():
|
| | | return
|
| | | |
| | | Sync_CrossZoneInfo(curPlayer)
|
| | | LoginDoUnNotifyCrossMsg(curPlayer)
|
| | | return
|
| | | |
| | | def MapServer_QueryCrossPlayerResult(playerID, callName, msgInfo, offlineExitCross=False):
|
| | | ## 同步地图跨服玩家处理信息,玩家可能不在线,缓存后等玩家上线处理,暂不考虑存档问题,服务器维护后未处理的命令将失效
|
| | | |
| | | curPlayer = GameWorld.GetPlayerManager().FindPlayerByID(playerID)
|
| | | if curPlayer and curPlayer.GetInitOK():
|
| | | msgInfo = str(msgInfo)
|
| | | curPlayer.MapServer_QueryPlayerResult(0, 0, callName, msgInfo, len(msgInfo))
|
| | | return curPlayer
|
| | | else:
|
| | | # 缓存起来,等上线后处理
|
| | | if playerID not in PyGameData.g_unNotifyPlayerCrossMsgDict:
|
| | | PyGameData.g_unNotifyPlayerCrossMsgDict[playerID] = []
|
| | | msgList = PyGameData.g_unNotifyPlayerCrossMsgDict[playerID]
|
| | | msgList.append([callName, msgInfo])
|
| | | GameWorld.Log("玩家不在线,添加未通知的跨服命令: %s, msgInfo=%s" % (callName, msgInfo), playerID)
|
| | | if offlineExitCross:
|
| | | DoOfflinePlayerExitCrossServer(playerID)
|
| | | return
|
| | |
|
| | | def LoginDoUnNotifyCrossMsg(curPlayer):
|
| | | playerID = curPlayer.GetPlayerID()
|
| | | msgList = PyGameData.g_unNotifyPlayerCrossMsgDict.pop(playerID, [])
|
| | | if not msgList:
|
| | | return
|
| | | for callName, msgInfo in msgList:
|
| | | GameWorld.Log("上线处理未通知的跨服命令: %s, msgInfo=%s" % (callName, msgInfo), playerID)
|
| | | msgInfo = str(msgInfo)
|
| | | curPlayer.MapServer_QueryPlayerResult(0, 0, callName, msgInfo, len(msgInfo))
|
| | | return
|
| | |
|
| | | |
| | | def Sync_CrossZoneInfo(curPlayer):
|
| | | clientPack = ChPyNetSendPack.tagGCCrossZoneInfo()
|
| | | clientPack.CommZoneID = GetServerCommCrossZoneID(GameWorld.GetServerGroupID())
|
| | | NetPackCommon.SendFakePack(curPlayer, clientPack)
|
| | | return
|