| | |
| | | import CrossRealmPK
|
| | | import CrossRealmMsg
|
| | | import CrossRealmPlayer
|
| | | import CrossBattlefield
|
| | | import CrossActionControl
|
| | | import PlayerFBHelpBattle
|
| | | import PlayerFamilyRedPacket
|
| | | import PlayerFairyDomain
|
| | | import IpyGameDataPY
|
| | | import PlayerFamilyParty
|
| | | import PlayerFamilyZhenfa
|
| | | import GameWorldFamilyWar
|
| | | import GameWorldArena
|
| | | import CrossLuckyCloudBuy
|
| | | import AuctionHouse
|
| | | import PlayerXMZZ
|
| | | import PlayerLove
|
| | | import PlayerTeam
|
| | | import PyGameData
|
| | | import CrossBoss
|
| | | import ChPlayer
|
| | | import PyDataManager
|
| | | import GameWorldOpenServerCampaign
|
| | | import CrossBillboard
|
| | | import CrossChampionship
|
| | | import GameWorldMineArea
|
| | | import GameWorship
|
| | | #---------------------------------------------------------------------
|
| | |
|
| | | #---------------------------------------------------------------------
|
| | |
| | | GameWorld.Log("GameServer -> OnDay!")
|
| | | #排行榜拷贝昨日榜单
|
| | | PlayerBillboard.CopyBillboardOnDay()
|
| | | CrossBillboard.CopyBillboardOnDay()
|
| | | #开服活动,放在排行榜拷贝昨日榜更新后处理
|
| | | PlayerEventCounter.DoLogic_GameServer_OnDay(tick)
|
| | | # 通知开服天数, 放在地图OnDay之前处理, 不然地图在OnDay时需要用到开服天时会取到昨天的值
|
| | |
| | | # 通知开服天数
|
| | | #openServerDay = PlayerDBGSEvent.GetDBGSTrig_ByKey(PlayerDBGSEvent.Def_ServerDay)
|
| | | #GameWorld.SendMapServerMsgEx(ShareDefine.Def_Notify_WorldKey_ServerDay, openServerDay)
|
| | | GameWorldOpenServerCampaign.DoOnDay()
|
| | | #清理过期补偿
|
| | | PlayerCompensation.ClearUpTimeOutCompensation()
|
| | | #PlayerGeTui.ClearFMTGeTuiLimit()
|
| | |
| | | PlayerBourse.OverTimeItemsDeal()
|
| | | # 仙盟联赛
|
| | | GameWorldFamilyWar.DoOnDay()
|
| | | # 情缘
|
| | | PlayerLove.DoOnDay()
|
| | | # 云购
|
| | | CrossLuckyCloudBuy.DoOnDay()
|
| | | # 膜拜
|
| | | GameWorship.DoOnDay()
|
| | | return
|
| | |
|
| | | def OnDayEx(tick):
|
| | |
| | | #拍卖行
|
| | | AuctionHouse.OnAuctionItemTimeProcess(curTime, tick)
|
| | |
|
| | | #情缘
|
| | | PlayerLove.OnTimeProcess(curTime, tick)
|
| | | |
| | | #福地
|
| | | GameWorldMineArea.OnMineItemTimeProcess(curTime, tick)
|
| | | |
| | | #每整分钟处理一次
|
| | | curDateTime = datetime.datetime.today()
|
| | | curMinute = curDateTime.minute
|
| | |
| | |
|
| | | def GameWorldProcessOnMinute(curMinute, tick):
|
| | | # 每整分钟触发一次
|
| | | CheckServerHasPlayerLoginAfterInitOK()
|
| | | #检查服务器正式开服
|
| | | DoCheckNewServerOpen(tick)
|
| | | |
| | | #回报数据库当前在线玩家数
|
| | | DisposeGameActivePlayer(tick)
|
| | | #处理游戏世界中的时间事件
|
| | | DisposeGameWorldEvenByTime(tick)
|
| | | GameWorldActionControl.Dispose_OperationActionState()
|
| | |
| | | GameWorldActionControl.Dispose_FBStateTime()
|
| | | #跨服PK
|
| | | CrossRealmPK.OnMinuteProcess()
|
| | | #跨服排位
|
| | | CrossChampionship.OnMinuteProcess(curMinute)
|
| | | CrossBattlefield.OnMinuteProcess()
|
| | | #处理重开服务器后, 活动继续开启逻辑根据天数
|
| | | #GameWorldActionControl.Dispose_Action_GoOn_ByDay(tick)
|
| | | #触发世界等级
|
| | |
| | | PlayerFamilyRedPacket.OnRedPacketMinuteProcess()
|
| | | #拍卖行
|
| | | AuctionHouse.OnAuctionItemMinuteProcess(tick)
|
| | | #福地
|
| | | GameWorldMineArea.OnProcessOnMinute()
|
| | | #每5分钟触发一次仙盟总战力更新
|
| | | if curMinute % 5 == 0:
|
| | | PlayerFamily.UpdFamilyTotalFightPower()
|
| | | PlayerFamilyRedPacket.CheckDelRedpacketData()
|
| | |
|
| | | return
|
| | |
|
| | | def CheckServerHasPlayerLoginAfterInitOK():
|
| | | ## 检查服务器启动成功后是否有玩家正常登录
|
| | | initGameWorldTime = GameWorld.GetGameWorld().GetDictByKey(ChConfig.Def_WorldKey_IsGameWorldInit)
|
| | | if not initGameWorldTime:
|
| | | return
|
| | | |
| | | if PyGameData.g_noPlayerLoginWarningMailState:
|
| | | return
|
| | | |
| | | curTime = int(time.time())
|
| | | noPlayerLoginWarningTimes = IpyGameDataPY.GetFuncCfg("ServerEvent", 1) * 60 # x分钟没有玩家登录则预警
|
| | | if curTime - initGameWorldTime < noPlayerLoginWarningTimes:
|
| | | return
|
| | | |
| | | GameWorld.SendGameError("NoPlayerLogin")
|
| | | PyGameData.g_noPlayerLoginWarningMailState = 1
|
| | | return
|
| | |
|
| | | def OnReloadConfig():
|
| | | return
|
| | |
|
| | | #---------------------------------------------------------------------
|
| | |
| | | #处理世界活动
|
| | | DisposeGameWorldGame(tick)
|
| | | #回报数据库当前在线玩家数
|
| | | DisposeGameActivePlayer(tick)
|
| | | #DisposeGameActivePlayer(tick)
|
| | | #同步地图服务器时间
|
| | | Dispose_MapServer_Time(tick)
|
| | | #保存玩家数据
|
| | |
| | | #activePlayerCount = GameWorld.GetPlayerManager().GetActivePlayerCount()
|
| | | #DataRecordPack.DR_OnLinePlayerCount(activePlayerCount, platformOLDict, tjgOnlineCnt)
|
| | | #===========================================================================
|
| | | for platform, playerCnt in platformOLDict.items():
|
| | | DataRecordPack.DR_OnLinePlayerCount(playerCnt, platform, tjgOnlineCnt) # 单平台
|
| | | EventReport.WriteEvent_concurrency(playerCnt, 0, platform) # 单平台 此处不能传脱机挂玩家总数
|
| | | |
| | |
|
| | | isMixture = False #是否混服
|
| | | if isMixture:
|
| | | for platform, playerCnt in platformOLDict.items():
|
| | | DataRecordPack.DR_OnLinePlayerCount(playerCnt, platform, tjgOnlineCnt) # 单平台
|
| | | EventReport.WriteEvent_concurrency(playerCnt, 0, platform) # 单平台 此处不能传脱机挂玩家总数
|
| | | DataRecordPack.DR_OnLinePlayerCount(activePlayerCount, {}, tjgOnlineCnt) # 总在线
|
| | | #EventReport.WriteEvent_concurrency(activePlayerCount, tjgOnlineCnt)
|
| | | else:
|
| | | serverPlatform = GameWorld.GetPlatform()
|
| | | DataRecordPack.DR_OnLinePlayerCount(activePlayerCount, {}, tjgOnlineCnt) # 总在线
|
| | | EventReport.WriteEvent_concurrency(activePlayerCount, tjgOnlineCnt, serverPlatform)
|
| | | #===========================================================================
|
| | |
|
| | | DataRecordPack.DR_OnLinePlayerCount(activePlayerCount, {}, tjgOnlineCnt) # 总在线
|
| | | #EventReport.WriteEvent_concurrency(activePlayerCount, tjgOnlineCnt)
|
| | | #刷新当前地图服务器
|
| | | #===========================================================================
|
| | | # custom_concurrencyMapList = ReadChConfig.GetEvalChConfig("EventReportMapID")
|
| | |
| | | def InitGameWorld(tick):
|
| | | #标记GameWorld初始化完成
|
| | | GameWorld.GetGameWorld().SetDict(ChConfig.Def_WorldKey_IsGameWorldInit, int(time.time()))
|
| | | LoadDBPlayer()
|
| | | #初始化游戏时钟
|
| | | GameWorld.GetGameWorld().SetTickTypeCount(ChConfig.TYPE_Tick_Count)
|
| | | #初始话开服时间、星期几
|
| | |
| | | GameWorld.GetGameWorld().GetDBGoldOrderFormMgr().Sort()
|
| | | #排序排行榜
|
| | | PlayerBillboard.SortServerBillboard()
|
| | | #排序仙盟
|
| | | PlayerFamily.DoFamilySort()
|
| | | #仙盟
|
| | | PlayerFamily.OnGameServerInitOK()
|
| | | GameWorldActionControl.Dispose_FBStateTime()
|
| | | #仙盟联赛
|
| | | GameWorldFamilyWar.OnGameServerInitOK()
|
| | |
| | | GameWorldArena.OnServerStart()
|
| | | #跨服PK
|
| | | CrossRealmPK.OnGameServerInitOK()
|
| | | #跨服排位
|
| | | CrossChampionship.OnServerStart()
|
| | | #跨服战场
|
| | | CrossBattlefield.OnServerStart()
|
| | | #红包
|
| | | PlayerFamilyRedPacket.OnServerStart()
|
| | | #云购
|
| | | CrossLuckyCloudBuy.OnServerStart()
|
| | | #世界boss被杀次数重置
|
| | | #GameWorldBoss.CheckResetBossKilledCntOnServerInit()
|
| | |
|
| | |
| | | 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):
|
| | |
| | |
|
| | | GameWorldArena.OnServerStart()
|
| | |
|
| | | CrossBattlefield.OnServerStart()
|
| | | |
| | | PlayerDBGSEvent.SetInitOpenServerTime(setOpenServerTime)
|
| | |
|
| | | ReadChConfig.ReloadConfig()
|
| | |
|
| | | AllMapServerInitOK(tick)
|
| | | |
| | | GameWorld.GetGameWorld().SaveGameServerData()
|
| | | GameWorld.SendGameError("ClearOpenServerOK")
|
| | | return
|
| | |
|
| | | ## 服务器开服时是星期几
|
| | |
| | | GameWorldFamilyWar.OnMapServerInitOK()
|
| | |
|
| | | # 跨服服务器状态
|
| | | GameWorld.SendMapServerMsgEx(ShareDefine.Def_Notify_WorldKey_CrossServerTime, PyGameData.g_crossServerTimeInfo)
|
| | | 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()
|
| | | #跨服战场
|
| | | CrossBattlefield.OnMapServerInitOK()
|
| | | # 本服竞技场
|
| | | GameWorldArena.SendMapServerArenaInfo()
|
| | | # 幸运云购
|
| | | CrossLuckyCloudBuy.OnMapServerInitOK()
|
| | |
|
| | | SendAllMapGlobalDropInfo() # 全局掉落控制
|
| | |
|
| | | SendMapCommMapLinePlayerCount(True) # 同步一次普通地图线路人数信息
|
| | | #随机假仙盟
|
| | | PlayerFamily.RandomFakeFamily()
|
| | | #仙盟阵法
|
| | | PlayerFamilyZhenfa.OnMapServerInitOK()
|
| | | #缥缈仙域
|
| | | PlayerFairyDomain.OnMapServerInitOK()
|
| | | #情侣信息
|
| | | PyDataManager.GetDBPyCoupleManager().SendMapServerCoupleInfo()
|
| | | # 记录服务器是否正常开启完毕
|
| | | getUrl = ReadChConfig.GetPyMongoConfig("EventReport", "OpenStateUrl") + "?Type=MapInit&MapCount=%s"%GameWorld.GetGameWorld().GetGameMapManager().GetCount()
|
| | | GameWorld.GetGameWorld().EventReport_EventReport("", "", "", "", 0, getUrl)
|
| | |
| | | # 删除过期的通用数据
|
| | | __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)
|
| | |
| | | ChPlayer.SavePlayerLVData()
|
| | | PlayerFBHelpBattle.OnServerClose()
|
| | | CrossActionControl.OnServerClose()
|
| | | CrossChampionship.OnServerClose()
|
| | | CrossBattlefield.OnServerClose()
|
| | | PlayerFamilyRedPacket.OnServerClose()
|
| | | CrossLuckyCloudBuy.OnServerClose()
|
| | | GameWorldArena.OnServerClose()
|
| | | PlayerLove.OnServerClose()
|
| | | GameWorld.Log("通知C++关服!")
|
| | | GameWorld.GetGameWorld().OnServerClose()
|
| | |
|