From c24be2a64b5db696a92b6afea349c1766f2e699b Mon Sep 17 00:00:00 2001 From: hxp <ale99527@vip.qq.com> Date: 星期三, 20 三月 2019 14:49:51 +0800 Subject: [PATCH] 3085 【BUG】【2.0】拍卖,拍下物品没有广播 --- ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldProcess.py | 87 +++++++++++++++++++++++++++++++++---------- 1 files changed, 66 insertions(+), 21 deletions(-) diff --git a/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldProcess.py b/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldProcess.py index 4a71a97..eef5bf5 100644 --- a/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldProcess.py +++ b/ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/GameWorldProcess.py @@ -83,7 +83,6 @@ import GameWorldAverageLv import PlayerDBOper import PlayerGeTui -#import GameWorldMixServerCampaign #import PlayerManorWar import GameWorldBoss #import GameWorldActionTeHui @@ -101,6 +100,7 @@ import IpyGameDataPY import PlayerFamilyParty import GameWorldFamilyWar +import AuctionHouse import PlayerXMZZ import PlayerTeam import PyGameData @@ -288,6 +288,8 @@ def __Func_HighPrecisionProcess(tick): if not GameWorld.GetGameWorld().GetDictByKey(ChConfig.Def_WorldKey_IsGameWorldInit): return + curTime = int(time.time()) + #仙盟宴会答题定时器 PlayerFamilyParty.FamilyParty_Process(tick) # 帮主弹劾时钟调用 @@ -305,6 +307,9 @@ #操作Python表 PlayerDBOper.PyDBProccess(tick) + + #拍卖行 + AuctionHouse.OnAuctionItemTimeProcess(curTime) #每整分钟处理一次 curDateTime = datetime.datetime.today() @@ -1211,12 +1216,10 @@ #记录首次开发时间(现实时间戳) PlayerDBGSEvent.SetInitOpenServerTime(initOpenServerTime if initOpenServerTime else int(time.time())) - CrossRealmMsg.OnGameServerInitOK() #初始化家族数量 GameWorld.GetFamilyManager().SetFamilyUpperLimitCount(ChConfig.Def_Family_MaxCnt) #排序元宝交易平台 GameWorld.GetGameWorld().GetDBGoldOrderFormMgr().Sort() - PlayerBillboard.ClearBillboardOnServerInit() #排序排行榜 PlayerBillboard.SortServerBillboard() #排序仙盟 @@ -1243,15 +1246,23 @@ #世界boss被杀次数重置 #GameWorldBoss.CheckResetBossKilledCntOnServerInit() #GameWorldActionTeHui.OnGameServerInitOK() # 特惠活动初始化 + + __Func_HighPrecisionProcess(tick) # 主动触发一次高精度的调用,确保服务器启动后一些功能活动等的数据会被加载 + + GameWorld.Log("=============================== 服务器启动成功 ===================================") isCrossServer = GameWorld.IsCrossServer() if isCrossServer: isServerClose = PlayerDBGSEvent.GetDBGSTrig_ByKey(PlayerDBGSEvent.Def_CrossServerClose) isServerOpen = 0 if isServerClose else 1 GameWorld.GetGameWorld().SetDict(ShareDefine.Def_Notify_WorldKey_CrossServerOpen, isServerOpen) - GameWorld.Log("跨服服务器启动成功: isServerOpen=%s" % isServerOpen) + GameWorld.Log("跨服服务器启动成功: isServerOpen=%s,crossZoneName=%s" % (isServerOpen, GameWorld.GetCrossZoneName())) else: serverGroupID = GameWorld.GetServerGroupID() GameWorld.Log("服务器启动成功: ServerGroupID=%s" % serverGroupID) + GameWorld.GetGameWorld().SetDict(ChConfig.Def_WorldKey_GameWorldInitOK, 1) + + # 注意:跨服相关信息的调用需放在最后,不然可能导致服务器未启动功能或者功能未加载成功导致跨服服务器与子服之间的数据同步可能出现异常的情况 + CrossRealmMsg.OnGameServerInitOK() return def DoCheckNewServerOpen(tick): @@ -1358,8 +1369,6 @@ #触发节假日活动 #GameWorldActionHoliday.ActionHoliday_OpenAndClose(tick, True) - #合服活动 - #GameWorldMixServerCampaign.UpdateMixServerCampaignState(True) #通知世界等级 worldLv = PlayerDBGSEvent.GetDBGSTrig_ByKey(ShareDefine.Def_Notify_WorldKey_WorldAverageLv) @@ -1379,12 +1388,11 @@ # 合服天 mixServerDay = PlayerDBGSEvent.GetDBGSTrig_ByKey(PlayerDBGSEvent.Def_MixServerDay) GameWorld.SendMapServerMsgEx(ShareDefine.Def_Notify_WorldKey_MixServerDay, mixServerDay) - # 上次合服时的开服天数 + # 上次合服时的开服天数、世界等级 lastMixServerDay = PlayerDBGSEvent.GetDBGSTrig_ByKey(PlayerDBGSEvent.Def_LastMixServerDay) GameWorld.SendMapServerMsgEx(ShareDefine.Def_Notify_WorldKey_LastMixServerDay, lastMixServerDay) - # 上次清除排行榜的标记 - lastSign = PlayerDBGSEvent.GetDBGSTrig_ByKey(ShareDefine.Def_Notify_WorldKey_ClearBillboardSign) - GameWorld.SendMapServerMsgEx(ShareDefine.Def_Notify_WorldKey_ClearBillboardSign, lastSign) + lastMixServerWorldLV = PlayerDBGSEvent.GetDBGSTrig_ByKey(PlayerDBGSEvent.Def_LastMixServerWorldLV) + GameWorld.SendMapServerMsgEx(ShareDefine.Def_Notify_WorldKey_LastMixServerWorldLV, lastMixServerWorldLV) # 通知战盟相关活动开启状态 fadState = PlayerDBGSEvent.GetDBGSTrig_ByKey(ShareDefine.Def_Notify_WorldKey_FamilyActivityDayState) @@ -1414,6 +1422,7 @@ # 跨服服务器状态 isCrossServerOpen = GameWorld.GetGameWorld().GetDictByKey(ShareDefine.Def_Notify_WorldKey_CrossServerOpen) GameWorld.SendMapServerMsgEx(ShareDefine.Def_Notify_WorldKey_CrossServerOpen, isCrossServerOpen) + GameWorld.SendMapServerMsgEx(ShareDefine.Def_Notify_WorldKey_CrossZoneName, PyGameData.g_crossZoneName) # 跨服PK CrossRealmPK.OnMapServerInitOK() @@ -1423,6 +1432,10 @@ SendMapCommMapLinePlayerCount(True) # 同步一次普通地图线路人数信息 #随机假仙盟 PlayerFamily.RandomFakeFamily() + + # 记录服务器是否正常开启完毕 + getUrl = ReadChConfig.GetPyMongoConfig("EventReport", "OpenStateUrl") + "?Type=MapInit&MapCount=%s"%GameWorld.GetGameWorld().GetGameMapManager().GetCount() + GameWorld.GetGameWorld().EventReport_EventReport("", "", "", "", 0, getUrl) return ## 服务器合服首次启动数据加载处理 @@ -1439,37 +1452,44 @@ GameWorld.DebugLog("合服首次启动加载已经处理过!") return - GameWorld.DebugLog("合服首次启动加载处理...") + GameWorld.Log("合服首次启动加载处理...") - # 清除指定通用数据 + # 清除指定通用数据,一般是合服工具删,这里可以再做个补充 universalRecMgr = GameWorld.GetUniversalRecMgr() - delRecTypeList = [ShareDefine.Def_UniversalGameRecType_ManorWarInfo, - ] - GameWorld.DebugLog(" 清除指定通用数据 delRecTypeList=%s" % str(delRecTypeList)) + delRecTypeList = [] + GameWorld.Log("清除指定通用数据 delRecTypeList=%s" % str(delRecTypeList)) for delRecType in delRecTypeList: universalRecMgr.Delete(delRecType) - + # 删除过期的通用数据 __DelOutofdayRecData(universalRecMgr) # 仙盟联赛重置 GameWorldFamilyWar.DoFamilyWarReset() + # 重置所有仙盟联赛评级 + familyManager = GameWorld.GetFamilyManager() + for i in xrange(familyManager.GetCount()): + family = familyManager.GetAt(i) + PlayerFamily.SetFamilyWarRank(family, 0) + PlayerFamily.DoFamilySort() # 设置合服首次启动加载成功 PlayerDBGSEvent.SetDBGSTrig_ByKey(PlayerDBGSEvent.Def_IsMixServerInitOK, 1) - # 设置本次合服时的开服天数 + # 设置本次合服时的开服天数、世界等级 serverDay = PlayerDBGSEvent.GetDBGSTrig_ByKey(PlayerDBGSEvent.Def_ServerDay) PlayerDBGSEvent.SetDBGSTrig_ByKey(PlayerDBGSEvent.Def_LastMixServerDay, serverDay) - GameWorld.DebugLog(" 合服首次启动加载成功...") + worldLV = PlayerDBGSEvent.GetDBGSTrig_ByKey(ShareDefine.Def_Notify_WorldKey_WorldAverageLv) + PlayerDBGSEvent.SetDBGSTrig_ByKey(PlayerDBGSEvent.Def_LastMixServerWorldLV, worldLV) + GameWorld.Log(" 合服首次启动加载成功! serverDay=%s,worldLV=%s" % (serverDay, worldLV)) return def __DelOutofdayRecData(universalRecMgr): # 删除过期的通用数据 curTime = int(time.time()) - GameWorld.Log("执行删除过期的通用数据, curTime=%s" % curTime) delOutofdayRecDataDict = { } + GameWorld.Log("执行删除过期的通用数据, curTime=%s,delOutofdayRecDataDict=%s" % (curTime, delOutofdayRecDataDict)) for otDayRecType, otTime in delOutofdayRecDataDict.items(): otRecDataList = universalRecMgr.GetTypeList(otDayRecType) if not otRecDataList: @@ -1822,14 +1842,27 @@ gameMapManager = GameWorld.GetGameWorld().GetGameMapManager() curMap = gameMapManager.Find(mapServerPack.GetRouteServerIndex(), mapServerPack.GetMapID()) - if curMap == None: return + if mapServerPack.GetState() not in [0,1,2,3] and curMap.GetState() != mapServerPack.GetState(): + # 记录服务器是否正常开启完毕, 避免重复发送 + GameWorld.DebugLog("MapServer_RunningStateRefresh--_%s"%([mapServerPack.GetState(), curMap.GetState(), mapServerPack.GetMapID(), curMap.GetID()])) + SendGameError("MapError") + curMap.SetState(mapServerPack.GetState()) curMap.SetRefreshTick(tick) + return + +def SendGameError(state): + getUrl = ReadChConfig.GetPyMongoConfig("EventReport", "OpenStateUrl") + groupID = ReadChConfig.GetPyMongoConfig("platform", "GroupID") + userDBName = ReadChConfig.GetPyMongoConfig("connect", "USER_DB_NAME") + getUrl = getUrl + "?Type=%s&groupID=%s&userDBName=%s"%(state, groupID, userDBName) + GameWorld.GetGameWorld().EventReport_EventReport("", "", "", "", 0, getUrl) + ## 刷新地图服务器状态, 如果1分钟没有状态回报, 刷新为消失状态 # @param tick 当前时间 # @return None @@ -1841,6 +1874,7 @@ gameMapManager = GameWorld.GetGameWorld().GetGameMapManager() + isSendMapClose = False for i in range(0, gameMapManager.GetCount()): curMap = gameMapManager.GetAt(i) @@ -1851,8 +1885,12 @@ if tick - curMap.GetRefreshTick() < ChConfig.Def_Tick_MapServer_MssNone: #间隔未到 continue - + curMap.SetState(IPY_GameServer.mssNone) + if not isSendMapClose: + # 避免多地图发送过多邮件, 如关服的时候 + SendGameError("MapDisconnect") # 状态报告 + isSendMapClose = True return #--------------------------------------------------------------------- @@ -1904,3 +1942,10 @@ GameWorld.Log("通知C++关服!") GameWorld.GetGameWorld().OnServerClose() + +def ChangeGameServerState(state): + # 只接收大于等于mssPyError + GameWorld.DebugLog("ChangeGameServerState:%s"%state) + SendGameError("GameServerError") + + \ No newline at end of file -- Gitblit v1.8.0