| | |
| | | GameWorld.GetGameWorld().EventShell_SendEventEx(eventTypeStr, len(eventTypeStr), dataStr, len(dataStr))
|
| | | return
|
| | |
|
| | | def DR_Reload(reloadType):
|
| | | ## 重读流向
|
| | | GroupName = GameWorld.GetServerGroupName()
|
| | | ServerID = GameWorld.GetGameWorld().GetServerID()
|
| | | dataDict = {"GroupName":GroupName, "ServerID":ServerID, "ReloadType":reloadType}
|
| | | SendEventPack("Reload", dataDict, checkBatServer=False)
|
| | | return
|
| | |
|
| | | ## 登陆
|
| | | # @param curPlayer 玩家实例
|
| | | # @return: None
|
| | |
| | | reload(reloadPath)
|
| | | except Exception:
|
| | | continue
|
| | |
|
| | | |
| | | import DataRecordPack
|
| | | DataRecordPack.DR_Reload("script")
|
| | | Log("Reload Begin : time = %s"%GetCurrentDataTimeStr())
|
| | | return
|
| | |
|
| | |
| | | ## 是否战斗服务器
|
| | | return ToIntDef(ReadChConfig.GetPyMongoConfig("platform", "BattleServer"), 0) == 1
|
| | |
|
| | | def GetServerGroupName():
|
| | | ## 服务器组名,取 ServersRoute 中的配置
|
| | | return ReadChConfig.GetServersRouteConfig("platform", "GroupName")
|
| | |
|
| | | def GetServerGroupID():
|
| | | ## 服务器组ID,必须唯一,代表这台物理服务器
|
| | | return ToIntDef(ReadChConfig.GetPyMongoConfig("platform", "GroupID"), 0)
|
| | |
| | | GameWorld.Log("服务器启动成功: ServerGroupID=%s,serverID=%s,serverDay=%s,isMixServer=%s,mixServerDay=%s"
|
| | | % (serverGroupID, serverID, serverDay, isMixServer, mixServerDay))
|
| | | PyGameData.g_serverInitOK = True
|
| | | DataRecordPack.DR_Reload("restart")
|
| | | return
|
| | |
|
| | | def AllMapServerInitOK(tick):
|
| | |
| | | g_minuteProcess = -1 # 每分钟触发一次,上次处理的分钟
|
| | | g_serverClosing = 0 # 是否关服中 0-非关服中;1-关服中;2-关服结束
|
| | | g_closeSaveDataOK = False # 关服数据入库是否成功
|
| | | g_batServerGMTTimeDict = {} # 战斗服务器处理GMT命令时间戳记录 {"GMT_xxx":上一次处理时间戳, ...}
|
| | |
|
| | | g_objPoolMgr = None # 对象池管理器
|
| | | g_batObjMgr = None # 战斗对象管理
|
| | |
| | | # @return None
|
| | | def OnExec(gmCmdDict):
|
| | | reloadType = gmCmdDict.get("reloadType")
|
| | | GameWorld.Log("服务器执行重读! reloadType=%s" % reloadType)
|
| | | if reloadType == "script":
|
| | | GameWorld.__ReloadScript()
|
| | | else:
|
| | |
| | | import PyGameData
|
| | | import GameWorld
|
| | | import DBDataMgr
|
| | | import time
|
| | |
|
| | | ##################################################################
|
| | | ####### python逻辑入口 #######
|
| | |
| | | execType = GMCommon.Def_Unknow
|
| | | execInfo = ''
|
| | | if callFunc != None:
|
| | | if GameWorld.IsBattleServer():
|
| | | lastTime = PyGameData.g_batServerGMTTimeDict.get(self.funcName, 0)
|
| | | curTime = int(time.time())
|
| | | if lastTime and curTime - lastTime <= 60:
|
| | | GameWorld.Log("战斗服务器1分钟内不重复处理GMT命令! %s, lastTime=%s" % (self.funcName, GameWorld.ChangeTimeNumToStr(lastTime)))
|
| | | return
|
| | | PyGameData.g_batServerGMTTimeDict[self.funcName] = curTime
|
| | | ret = callFunc(self.gmCmdDict)
|
| | | if isinstance(ret, int):
|
| | | execType = ret
|
| | |
| | | resultMsg = json.dumps(resultDcit, ensure_ascii=False)
|
| | |
|
| | | mylog.info("gm result:%s"%resultMsg)
|
| | | SendToGMToolCommandResult(orderId, resultMsg)
|
| | | if GameWorld.IsBattleServer():
|
| | | mylog.info("战斗服务器暂时不回复GM命令处理结果")
|
| | | else:
|
| | | SendToGMToolCommandResult(orderId, resultMsg)
|
| | | return
|
| | |
|
| | |
|
| | |
| | |
|
| | | AllChConfig = {}
|
| | | GeneralProgramme = {}
|
| | | ServersRouteConfig = None
|
| | | PyMongoDataServerConfig = None
|
| | | DBAllChConfig = {}
|
| | |
|
| | |
| | | GameWorld.Log("=== 设置重读配置 ===")
|
| | | GameWorld.GetGameWorld().SetGameWorldDict(ShareDefine.Def_Notify_WorldKey_ReloadConfig, 1)
|
| | | IpyGameDataPY.IPYData.IpyDataClear()
|
| | | import DataRecordPack
|
| | | DataRecordPack.DR_Reload("config")
|
| | | return
|
| | |
|
| | | ## 重读,清除配置
|
| | |
| | | global AllChConfig
|
| | | global GeneralProgramme
|
| | | global PyMongoDataServerConfig
|
| | | global ServersRouteConfig
|
| | | global DBAllChConfig
|
| | |
|
| | | #重读所有的配置表
|
| | |
| | | GeneralProgramme = {}
|
| | | FormulaControl.ClearCompileFormulaDist()
|
| | | PyMongoDataServerConfig = None
|
| | | ServersRouteConfig = None
|
| | | DBAllChConfig = {}
|
| | |
|
| | | GameWorld.Log('MapServer_Reload_ChConfig')
|
| | |
| | |
|
| | | ## -----------------------------------------------------------
|
| | |
|
| | | def GetServersRouteConfig(section, option, raw=False, defaultValue=None, isLog=True):
|
| | | global ServersRouteConfig
|
| | | |
| | | if not ServersRouteConfig:
|
| | | filePath = ChConfig.GetServersRoutePath() + "\\PyMongoDataServer.ini"
|
| | | |
| | | if not os.path.isfile(filePath):
|
| | | GameWorld.Log('无法找到文件 = %s'%(filePath))
|
| | | raise Exception('无法找到文件 = %s'%(filePath))
|
| | | |
| | | ServersRouteConfig = ConfigParser.ConfigParser()
|
| | | ServersRouteConfig.read(filePath)
|
| | | GameWorld.DebugLog("Reload %s" % str(filePath))
|
| | | |
| | | if not ServersRouteConfig.has_option(section, option):
|
| | | if defaultValue != None:
|
| | | return defaultValue
|
| | | if isLog:
|
| | | GameWorld.ErrLog("ServersRoute->PyMongoDataServer.ini找不到配置: section=%s,option=%s" % (section, option))
|
| | | return ""
|
| | | |
| | | strParam = ServersRouteConfig.get(section, option, raw)
|
| | | return strParam
|
| | |
|
| | | ## PyMongoDataServer.ini配置读取
|
| | | # @param section: 分段区块名
|
| | | # @param option: 配置项名
|