From a4e451de69657fba79075bb68dba5ea2ea084747 Mon Sep 17 00:00:00 2001 From: hch <305670599@qq.com> Date: 星期四, 27 十二月 2018 11:24:16 +0800 Subject: [PATCH] 860312 任务输出 --- ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorld.py | 59 ++++++++++++++++++++++++++++++++++++----------------------- 1 files changed, 36 insertions(+), 23 deletions(-) diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorld.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorld.py index 3498980..7680c92 100644 --- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorld.py +++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorld.py @@ -1016,18 +1016,8 @@ return GetGameWorld().GetServerVersion() def GetServerGroupID(): - # 服务器组ID: 代表一台服务器中包含的合服、混服的各平台区服组成的一个独立游戏区服服务器环境, 用某个ID来代表此服务器 - # 在跨服环境中,此ID就是代表来自同一台服务器子服的玩家 - # 服务器组ID生成规则: DB平台标识对应编号 * 1000000 + DB配置的ServerID - # ServerID支持范围: 1~999999 - # 平台编号支持范围:1~2000 - platform = GetPlatform() - serverNum = GetPlatformServerNum(platform) - if not serverNum: - return 0 - serverNum = max(1, min(2000, serverNum)) - serverID = max(1, min(999999, GetServerID())) - return serverNum * 1000000 + serverID + ## 服务器组ID,必须唯一,代表这台物理服务器 + return ToIntDef(ReadChConfig.GetPyMongoConfig("platform", "GroupID"), 0) def GetPlatformServerNum(platform): # 获取服务器的平台编号 @@ -1086,10 +1076,26 @@ return mainServerID return GetServerID() + +#=============================================================================== +# 平台ID = appid +# 运营ID = spid +# 服务器账号更改 +# 原先账号组合为 +# 运营提供的玩家账号ID + 平台ID + 区服组成 +# +# 因为IOS和安卓在支持混服的情况下,还要能支持同一个角色号,故引入一个新的运营ID(客户端打包配置),以保证玩家账号为同一个 +# 账号组合变更 +# 运营提供的玩家账号ID + 运营ID + 区服组成 +# +# 原游戏中获取平台ID接口变更 +# 1. db 从数据库中的账号表获取AppID +# 2. GameServer和MapServer 接口改为GetOperator 参考 GetPlayerPlatform +#=============================================================================== + ##获取玩家所属平台 -def GetPlayerPlatform(gameAccID): - infoList = gameAccID.split(Def_AccID_Split_Sign) - return "" if len(infoList) < 3 else infoList[-2] +def GetPlayerPlatform(curPlayer): + return curPlayer.GetAccountData().GetOperator() ##获取平台账号 def GetPlatformAccID(gameAccID): @@ -1566,14 +1572,9 @@ return inputText -## 是否跨服服务器 -# @param None None -# @return -def IsMergeServer(): - config = MapConfig.GetConfig() - - return config.get('IsMergeWarServe', 0) - +def IsCrossServer(): + ## 是否跨服服务器 + return ToIntDef(ReadChConfig.GetPyMongoConfig("Merge", "IsMergeServer"), 0) ## 时间格式转换成数值时间,可参考datetime.datetime.fromtimestamp(102645645) # @param timeNum @@ -1827,6 +1828,18 @@ 'SendMergerChildMsg', msgList, len(msgList)) return +def SendMsgToCrossServer(msgType, dataMsg, srcPlayerID=0, queryType=0, queryID=0): + ## 发送信息到跨服服务器 + msgList = str([msgType, dataMsg]) + GetPlayerManager().GameServer_QueryPlayerResult(srcPlayerID, queryType, queryID, "SendMsgToCrossServer", msgList, len(msgList)) + return + +def SendMsgToClientServer(msgType, dataMsg, serverGroupIDList, srcPlayerID=0, queryType=0, queryID=0): + ## 发送信息到子服 + msgList = str([msgType, dataMsg, serverGroupIDList]) + GetPlayerManager().GameServer_QueryPlayerResult(srcPlayerID, queryType, queryID, "SendMsgToClientServer", msgList, len(msgList)) + return + ## 根据排行获取名次对应值 # @param orderDict {名次:obj, ...} 名次支持段跳跃 # @param order 名次,从1开始 -- Gitblit v1.8.0