From c2d45420190e02447a79a680199ab4636ce986e2 Mon Sep 17 00:00:00 2001 From: hxp <ale99527@vip.qq.com> Date: 星期二, 20 五月 2025 15:49:29 +0800 Subject: [PATCH] 16 卡牌服务端(优化备档存取逻辑,GetServerID改为取接口;调整单服StartDB渠口、启动加载数据流程,支持服层级每秒、每分Process) --- ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/GameWorldProcess.py | 104 +--------------------------------------------------- 1 files changed, 2 insertions(+), 102 deletions(-) diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/GameWorldProcess.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/GameWorldProcess.py index d03a9e3..a74fb90 100644 --- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/GameWorldProcess.py +++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/GameWorldProcess.py @@ -47,10 +47,8 @@ import EventReport import ItemCommon import PyGameData -import PlayerTeam import GameMap import NPCRealmRefresh -import IpyGameDataPY import GameWorldEvent #--------------------------------------------------------------------- ## 副本开启 @@ -527,6 +525,8 @@ if not gameWorld.GetInitOK() : return + GameWorldEvent.OnHighProcess(tick) + __ProcessOpen(gameWorld, tick) __ProcessTimeKickPlayer(gameWorld, tick) # 处理副本生存周期强关副本 @@ -548,12 +548,6 @@ #通知RouteServer 消息 __ProcessRouteServer(gameWorld, tick) - #每分钟触发 - curTime = GameWorld.GetCurrentTime() - __OnMapMinute(curTime, tick) - __RefreshOnMinute(curTime, tick) - #五分钟触发 - __RefreshOnFiveMinute(tick) #定时检测关闭超时文件 EventReport.OnTimeCloseScribeTxt() @@ -592,7 +586,6 @@ # @return None # @remarks 函数详细说明 每条分线都会触发该函数 def InitGameWorld(tick): - GameWorldEvent.InitGameWorld(tick) gameWorld = GameWorld.GetGameWorld() ItemCommon.InitPyItem() EventShell.DoReloadRefresh() @@ -741,96 +734,3 @@ return #--------------------------------------------------------------------- - -## 五分钟刷新 -# @param tick -# @return None -def __RefreshOnFiveMinute(tick): - gameWorld = GameWorld.GetGameWorld() - lastTick = gameWorld.GetTickByType(ChConfig.TYPE_Map_Tick_ProcessFiveMinute) - tickInterval = ChConfig.TYPE_Map_Tick_Time[ChConfig.TYPE_Map_Tick_ProcessFiveMinute] - if tick - lastTick < tickInterval: - return - gameWorld.SetTickByType(ChConfig.TYPE_Map_Tick_ProcessFiveMinute, tick) - -# playerManager = GameWorld.GetMapCopyPlayerManager() -# for index in xrange(playerManager.GetPlayerCount()): -# curPlayer = playerManager.GetPlayerByIndex(index) -# if not curPlayer: -# continue - - return - -## 按分钟刷新 -# @param tick -# @return None -def __RefreshOnMinute(curTime, tick): - gameWorld = GameWorld.GetGameWorld() - lastTick = gameWorld.GetTickByType(ChConfig.TYPE_Map_Tick_ProcessMinute) - tickInterval = ChConfig.TYPE_Map_Tick_Time[ChConfig.TYPE_Map_Tick_ProcessMinute] - if tick - lastTick < tickInterval: - return - gameWorld.SetTickByType(ChConfig.TYPE_Map_Tick_ProcessMinute, tick) - - playerManager = GameWorld.GetMapCopyPlayerManager() - for index in xrange(playerManager.GetPlayerCount()): - curPlayer = playerManager.GetPlayerByIndex(index) - if not curPlayer: - continue - - __ProcessHalfHour(curPlayer, curTime, tick) - return - -def __OnMapMinute(curTime, tick): - ## 地图层级每分钟处理, 每分钟最多只会处理一次, 无视虚拟分线 - if not PyGameData.g_initGameTime: - return - - curMinute = curTime.minute - if curMinute == PyGameData.g_mapLastProcess_Minute: - return - PyGameData.g_mapLastProcess_Minute = curMinute - GameWorldEvent.OnMinute(tick) - - PlayerTeam.OnCheckTeamPlayerDisconnectTimeout(tick) - - __CheckIpyDataRecycle(curTime) - return - -def __CheckIpyDataRecycle(timeNow): - ## 检查IpyData数据回收 - playerCount = GameWorld.GetPlayerManager().OnlineCount() - if playerCount: - PyGameData.g_ipyDataRecycleCheckTime = 0 - #GameWorld.DebugLog("地图还有玩家在线! playerCount=%s" % playerCount) - return - - curTime = GameWorld.ChangeDatetimeToNum(timeNow) - if not PyGameData.g_ipyDataRecycleCheckTime: - PyGameData.g_ipyDataRecycleCheckTime = curTime - #GameWorld.DebugLog("地图没有玩家在线") - return - - if PyGameData.g_ipyDataRecycleCheckTime == 1: - # 已经回收了 - #GameWorld.DebugLog("本次已经回收过了") - return - - if curTime - PyGameData.g_ipyDataRecycleCheckTime < 24 * 3600: - #GameWorld.DebugLog("还未到达回收时间, passSeconds=%s" % (curTime - PyGameData.g_ipyDataRecycleCheckTime)) - return - PyGameData.g_ipyDataRecycleCheckTime = 1 - IpyGameDataPY.IPYData.Recycle() - return - -## 整半小时触发 <00和30分钟时触发> -# @param curPlayer -# @param curTime 当前时间对象 -# @param tick -# @return None -def __ProcessHalfHour(curPlayer, curTime, tick): - if curTime.minute not in [0, 30]: - return - - EventShell.EventResponse_OnHalfHour(curPlayer) - return -- Gitblit v1.8.0