|  |  |  | 
|---|
|  |  |  | import GameWorldAverageLv | 
|---|
|  |  |  | import PlayerDBOper | 
|---|
|  |  |  | import PlayerGeTui | 
|---|
|  |  |  | #import PlayerManorWar | 
|---|
|  |  |  | import GameWorldBoss | 
|---|
|  |  |  | #import GameWorldActionTeHui | 
|---|
|  |  |  | #import HighLadder | 
|---|
|  |  |  | import PlayerCompensation | 
|---|
|  |  |  | #import GameWorldShopItem | 
|---|
|  |  |  | import ReadChConfig | 
|---|
|  |  |  | import EventReport | 
|---|
|  |  |  | #import ReloadModule | 
|---|
|  |  |  | 
|---|
|  |  |  | import IpyGameDataPY | 
|---|
|  |  |  | import PlayerFamilyParty | 
|---|
|  |  |  | import GameWorldFamilyWar | 
|---|
|  |  |  | import AuctionHouse | 
|---|
|  |  |  | import PlayerXMZZ | 
|---|
|  |  |  | import PlayerTeam | 
|---|
|  |  |  | import PyGameData | 
|---|
|  |  |  | 
|---|
|  |  |  | GameWorld.Log("GameServer -> OnHour!") | 
|---|
|  |  |  | PlayerEventCounter.DoLogic_GameServer_OnHour(tick) | 
|---|
|  |  |  | GameWorld.GetGameWorld().OnHour(curTimeStr) | 
|---|
|  |  |  | #每小时更新天梯 | 
|---|
|  |  |  | #HighLadder.OnHour() | 
|---|
|  |  |  | #设置存取数据库Key | 
|---|
|  |  |  | __SetWorldKey_SavePlayer(curTimeStr) | 
|---|
|  |  |  | #每小时清空宝物掉落 | 
|---|
|  |  |  | 
|---|
|  |  |  | #  @remarks 函数详细说明. | 
|---|
|  |  |  | def OnDay(curTimeStr, tick): | 
|---|
|  |  |  | GameWorld.Log("GameServer -> OnDay!") | 
|---|
|  |  |  | #天梯竞技场,放在排行榜更新之前处理 | 
|---|
|  |  |  | #HighLadder.OnDay() | 
|---|
|  |  |  | #排行榜拷贝昨日榜单 | 
|---|
|  |  |  | PlayerBillboard.CopyBillboardOnDay() | 
|---|
|  |  |  | #开服活动,放在排行榜拷贝昨日榜更新后处理 | 
|---|
|  |  |  | 
|---|
|  |  |  | def __Func_HighPrecisionProcess(tick): | 
|---|
|  |  |  | if not GameWorld.GetGameWorld().GetDictByKey(ChConfig.Def_WorldKey_IsGameWorldInit): | 
|---|
|  |  |  | return | 
|---|
|  |  |  | curTime = int(time.time()) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #仙盟宴会答题定时器 | 
|---|
|  |  |  | PlayerFamilyParty.FamilyParty_Process(tick) | 
|---|
|  |  |  | # 帮主弹劾时钟调用 | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #操作Python表 | 
|---|
|  |  |  | PlayerDBOper.PyDBProccess(tick) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #拍卖行 | 
|---|
|  |  |  | AuctionHouse.OnAuctionItemTimeProcess(curTime, tick) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #每整分钟处理一次 | 
|---|
|  |  |  | curDateTime = datetime.datetime.today() | 
|---|
|  |  |  | 
|---|
|  |  |  | Dispose_DataBase_GMShell(tick) | 
|---|
|  |  |  | ##处理重开服务器后, 活动继续开启逻辑根据天数 | 
|---|
|  |  |  | #GameWorldActionControl.Dispose_Action_GoOn_ByDay(tick) | 
|---|
|  |  |  | #定时神秘商店刷新 | 
|---|
|  |  |  | #GameWorldShopItem.Dispose_ShopItemRefresh(tick) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #定时向RouteServer发送消息 | 
|---|
|  |  |  | Dispose_SendMsg_RouteServer(tick) | 
|---|
|  |  |  | 
|---|
|  |  |  | CrossRealmPK.OnGameServerInitOK() | 
|---|
|  |  |  | #世界boss被杀次数重置 | 
|---|
|  |  |  | #GameWorldBoss.CheckResetBossKilledCntOnServerInit() | 
|---|
|  |  |  | #GameWorldActionTeHui.OnGameServerInitOK() # 特惠活动初始化 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | __Func_HighPrecisionProcess(tick) # 主动触发一次高精度的调用,确保服务器启动后一些功能活动等的数据会被加载 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | # 合服天 | 
|---|
|  |  |  | 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) | 
|---|
|  |  |  | lastMixServerWorldLV = PlayerDBGSEvent.GetDBGSTrig_ByKey(PlayerDBGSEvent.Def_LastMixServerWorldLV) | 
|---|
|  |  |  | GameWorld.SendMapServerMsgEx(ShareDefine.Def_Notify_WorldKey_LastMixServerWorldLV, lastMixServerWorldLV) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | # 通知战盟相关活动开启状态 | 
|---|
|  |  |  | fadState = PlayerDBGSEvent.GetDBGSTrig_ByKey(ShareDefine.Def_Notify_WorldKey_FamilyActivityDayState) | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | # 仙盟联赛 | 
|---|
|  |  |  | GameWorldFamilyWar.OnMapServerInitOK() | 
|---|
|  |  |  | # 领地争夺战 | 
|---|
|  |  |  | #PlayerManorWar.OnMapServerInitOK() | 
|---|
|  |  |  |  | 
|---|
|  |  |  | # 特惠活动 | 
|---|
|  |  |  | #GameWorldActionTeHui.OnMapServerInitOK() | 
|---|
|  |  |  |  | 
|---|
|  |  |  | # 商店信息 | 
|---|
|  |  |  | #GameWorldShopItem.OnMapServerInitOK() | 
|---|
|  |  |  |  | 
|---|
|  |  |  | # 跨服服务器状态 | 
|---|
|  |  |  | isCrossServerOpen = GameWorld.GetGameWorld().GetDictByKey(ShareDefine.Def_Notify_WorldKey_CrossServerOpen) | 
|---|
|  |  |  | 
|---|
|  |  |  | SendMapCommMapLinePlayerCount(True) # 同步一次普通地图线路人数信息 | 
|---|
|  |  |  | #随机假仙盟 | 
|---|
|  |  |  | PlayerFamily.RandomFakeFamily() | 
|---|
|  |  |  |  | 
|---|
|  |  |  | # 记录服务器是否正常开启完毕 | 
|---|
|  |  |  | getUrl = ReadChConfig.GetPyMongoConfig("EventReport", "OpenStateUrl") + "?Type=MapInit&MapCount=%s"%GameWorld.GetGameWorld().GetGameMapManager().GetCount() | 
|---|
|  |  |  | GameWorld.GetGameWorld().EventReport_EventReport("", "", "", "", 0, getUrl) | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | ## 服务器合服首次启动数据加载处理 | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | # 仙盟联赛重置 | 
|---|
|  |  |  | 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.Log("    合服首次启动加载成功!") | 
|---|
|  |  |  | 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): | 
|---|
|  |  |  | 
|---|
|  |  |  | 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 | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | gameMapManager = GameWorld.GetGameWorld().GetGameMapManager() | 
|---|
|  |  |  |  | 
|---|
|  |  |  | isSendMapClose = False | 
|---|
|  |  |  | for i in range(0, gameMapManager.GetCount()): | 
|---|
|  |  |  | curMap = gameMapManager.GetAt(i) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | if tick - curMap.GetRefreshTick() < ChConfig.Def_Tick_MapServer_MssNone: | 
|---|
|  |  |  | #间隔未到 | 
|---|
|  |  |  | continue | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | curMap.SetState(IPY_GameServer.mssNone) | 
|---|
|  |  |  | if not isSendMapClose: | 
|---|
|  |  |  | # 避免多地图发送过多邮件, 如关服的时候 | 
|---|
|  |  |  | SendGameError("MapDisconnect")   # 状态报告 | 
|---|
|  |  |  | isSendMapClose = True | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return | 
|---|
|  |  |  | #--------------------------------------------------------------------- | 
|---|
|  |  |  | 
|---|
|  |  |  | GameWorld.Log("通知C++关服!") | 
|---|
|  |  |  | GameWorld.GetGameWorld().OnServerClose() | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | def ChangeGameServerState(state): | 
|---|
|  |  |  | # 只接收大于等于mssPyError | 
|---|
|  |  |  | GameWorld.DebugLog("ChangeGameServerState:%s"%state) | 
|---|
|  |  |  | SendGameError("GameServerError") | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|