From 61dce3faa761c9d9a514c038607066df787f88c5 Mon Sep 17 00:00:00 2001 From: hxp <ale99527@vip.qq.com> Date: 星期六, 01 三月 2025 01:30:32 +0800 Subject: [PATCH] 5562 【英文】【越南】【BT】【GM】【砍树】修复删除打包数据后可能导致的数据错乱bug; --- ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldProcess.py | 102 ++++++++++++++++++++++++++++++++++++++++++++------ 1 files changed, 89 insertions(+), 13 deletions(-) diff --git a/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldProcess.py b/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldProcess.py index 4e3f6e9..54f790c 100644 --- a/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldProcess.py +++ b/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldProcess.py @@ -97,6 +97,7 @@ import IpyGameDataPY import PlayerFamilyParty import PlayerFamilyZhenfa +import PlayerFamilyEmblem import GameWorldFamilyWar import GameWorldArena import CrossLuckyCloudBuy @@ -111,6 +112,11 @@ import GameWorldOpenServerCampaign import CrossBillboard import CrossChampionship +import GameWorldMineArea +import PlayerFuncTeam +import GameWorship +import GameWorldAlineInvade +import os #--------------------------------------------------------------------- #--------------------------------------------------------------------- @@ -183,6 +189,10 @@ PlayerLove.DoOnDay() # 云购 CrossLuckyCloudBuy.DoOnDay() + # 膜拜 + GameWorship.DoOnDay() + # 异兽入侵 + GameWorldAlineInvade.DoOnDay() return def OnDayEx(tick): @@ -306,8 +316,6 @@ PlayerFamily.OnLeaderImpeachTick(tick) #跨服玩家 CrossRealmPlayer.OnCrossProcess(tick) - #跨服PK匹配 - CrossRealmPK.OnPKMatchProcess(tick) GameWorldBoss.DoCheckWorldBossReborn(tick) @@ -322,6 +330,9 @@ #情缘 PlayerLove.OnTimeProcess(curTime, tick) + + #福地 + GameWorldMineArea.OnMineItemTimeProcess(curTime, tick) #每整分钟处理一次 curDateTime = datetime.datetime.today() @@ -363,6 +374,8 @@ DisposeGameActivePlayer(tick) #处理游戏世界中的时间事件 DisposeGameWorldEvenByTime(tick) + #榜单 + CrossBillboard.OnMinuteProcess() GameWorldActionControl.Dispose_OperationActionState() GameWorldActionControl.Dispose_DailyActionState() GameWorldActionControl.Dispose_FBStateTime() @@ -381,10 +394,13 @@ PlayerFamilyRedPacket.OnRedPacketMinuteProcess() #拍卖行 AuctionHouse.OnAuctionItemMinuteProcess(tick) + #福地 + GameWorldMineArea.OnProcessOnMinute() #每5分钟触发一次仙盟总战力更新 if curMinute % 5 == 0: PlayerFamily.UpdFamilyTotalFightPower() PlayerFamilyRedPacket.CheckDelRedpacketData() + PlayerFamilyEmblem.CheckExpireEmblem() return @@ -407,6 +423,13 @@ return def OnReloadConfig(): + + if GameWorld.IsCrossServer(): + # 跨服重读时重推跨服相关数据 + tick = GameWorld.GetGameWorld().GetTick() + CrossRealmMsg.Sync_CrossServerInitDataToClientServer(tick, serverGroupID=0) # 这里设置为0,广播所有子服务器组 + return + return #--------------------------------------------------------------------- @@ -1248,7 +1271,7 @@ def InitGameWorld(tick): #标记GameWorld初始化完成 GameWorld.GetGameWorld().SetDict(ChConfig.Def_WorldKey_IsGameWorldInit, int(time.time())) - PlayerControl.LoadDBPlayer() + LoadDBPlayer() #初始化游戏时钟 GameWorld.GetGameWorld().SetTickTypeCount(ChConfig.TYPE_Tick_Count) #初始话开服时间、星期几 @@ -1262,10 +1285,13 @@ GameWorld.GetFamilyManager().SetFamilyUpperLimitCount(ChConfig.Def_Family_MaxCnt) #排序元宝交易平台 GameWorld.GetGameWorld().GetDBGoldOrderFormMgr().Sort() + PlayerBillboard.FixBillboardBigCmpValue() #排序排行榜 PlayerBillboard.SortServerBillboard() - #排序仙盟 - PlayerFamily.DoFamilySort() + #功能队伍 + PlayerFuncTeam.OnGameServerInitOK() + #仙盟 + PlayerFamily.OnGameServerInitOK() GameWorldActionControl.Dispose_FBStateTime() #仙盟联赛 GameWorldFamilyWar.OnGameServerInitOK() @@ -1291,6 +1317,7 @@ CrossChampionship.OnServerStart() #跨服战场 CrossBattlefield.OnServerStart() + GameWorship.OnServerStart() #红包 PlayerFamilyRedPacket.OnServerStart() #云购 @@ -1320,6 +1347,20 @@ GameWorld.SendGameError("GameWarning", "InitGameWorld later than AllMapServerInitOK") AllMapServerInitOK(tick) + return + +def LoadDBPlayer(): + if GameWorld.IsCrossServer(): + return + PlayerDBOper.FindDBOper(PlayerDBOper.Table_DBPlayer, {}, {"PlayerID":1, "AccID":1, "_id":0}, LoadDBPlayerRet) + return + +def LoadDBPlayerRet(resultSetList, extendValueList): + for resultDict in resultSetList: + PyGameData.g_dbPlayerIDMap[resultDict["PlayerID"]] = resultDict["AccID"] + GameWorld.Log("启动服务器加载DBPlayer玩家账号ID对应关系! %s, %s" % (len(PyGameData.g_dbPlayerIDMap), PyGameData.g_dbPlayerIDMap)) + + PlayerFamily.OnLoadDBPlayerOK() return def DoCheckNewServerOpen(tick): @@ -1418,6 +1459,7 @@ if not GameWorld.GetGameWorld().GetDictByKey(ChConfig.Def_WorldKey_IsGameWorldInit): GameWorld.Log("AllMapServerInitOK时GameServer还未启动好!") return + __CheckAllMapInitOK() #通知所有地图服务器初始化成功, 同步时间 GameWorld.GetGameWorld().Notify_AllMapServerInitOK(GameWorld.GetCurrentDataTimeStr()) @@ -1463,6 +1505,9 @@ lastMixServerWorldLV = PlayerDBGSEvent.GetDBGSTrig_ByKey(PlayerDBGSEvent.Def_LastMixServerWorldLV) GameWorld.SendMapServerMsgEx(ShareDefine.Def_Notify_WorldKey_LastMixServerWorldLV, lastMixServerWorldLV) + # 功能队伍 + PlayerFuncTeam.OnMapServerInitOK() + # 通知战盟相关活动开启状态 fadState = PlayerDBGSEvent.GetDBGSTrig_ByKey(ShareDefine.Def_Notify_WorldKey_FamilyActivityDayState) GameWorld.SendMapServerMsgEx(ShareDefine.Def_Notify_WorldKey_FamilyActivityDayState, fadState) @@ -1488,6 +1533,8 @@ # 跨服PK CrossRealmPK.OnMapServerInitOK() + # 跨服排位赛 + CrossChampionship.OnMapServerInitOK() #跨服战场 CrossBattlefield.OnMapServerInitOK() # 本服竞技场 @@ -1509,6 +1556,41 @@ # 记录服务器是否正常开启完毕 getUrl = ReadChConfig.GetPyMongoConfig("EventReport", "OpenStateUrl") + "?Type=MapInit&MapCount=%s"%GameWorld.GetGameWorld().GetGameMapManager().GetCount() GameWorld.GetGameWorld().EventReport_EventReport("", "", "", "", 0, getUrl) + return + +def __CheckAllMapInitOK(): + ## 检查所有地图是否启动成功 + rootPath = ChConfig.GetServerRootPath() + mapIDTxtPath = os.path.join(rootPath, "ZoneServerGroup\map1_8G\MapServer\MapServerData\Map\MapID.txt") + if not os.path.isfile(mapIDTxtPath): + GameWorld.ErrLog("MapID.txt不存在: %s" % mapIDTxtPath) + return + fileObj = open(mapIDTxtPath, 'rb') + content = fileObj.read() + fileObj.close() + + mapInfoDict = {} + mapInfoList = content.split('\r\n') + for info in mapInfoList: + mapInfo = info.split('\t') + if len(mapInfo) < 3: + continue + mapInfoDict[GameWorld.ToIntDef(mapInfo[1])] = mapInfo[2] + + gameMapManager = GameWorld.GetGameWorld().GetGameMapManager() + for i in range(0, gameMapManager.GetCount()): + curMap = gameMapManager.GetAt(i) + mapID = curMap.GetID() + state = curMap.GetState() + if mapID in mapInfoDict and state == IPY_GameServer.mssRunning: + mapInfoDict.pop(mapID) + + if not mapInfoDict: + #GameWorld.Log("都启动成功了") + return + # 汇报没有启动启动成功的地图ID信息 + errorMapIDList = mapInfoDict.keys() + GameWorld.SendGameError("AllMapInitError", "未启动成功地图:%s" % (str(errorMapIDList))) return ## 服务器合服首次启动数据加载处理 @@ -1537,14 +1619,8 @@ # 删除过期的通用数据 __DelOutofdayRecData(universalRecMgr) - # 仙盟联赛重置 - GameWorldFamilyWar.DoFamilyWarReset() - # 重置所有仙盟联赛评级 - familyManager = GameWorld.GetFamilyManager() - for i in xrange(familyManager.GetCount()): - family = familyManager.GetAt(i) - PlayerFamily.SetFamilyWarRank(family, 0) - PlayerFamily.DoFamilySort() + # 仙盟 + PlayerFamily.OnMixServerInit() # 设置合服首次启动加载成功 PlayerDBGSEvent.SetDBGSTrig_ByKey(PlayerDBGSEvent.Def_IsMixServerInitOK, 1) -- Gitblit v1.8.0