|  |  |  | 
|---|
|  |  |  | import PlayerXMZZ | 
|---|
|  |  |  | import PlayerTeam | 
|---|
|  |  |  | import PyGameData | 
|---|
|  |  |  | import ChPlayer | 
|---|
|  |  |  | #--------------------------------------------------------------------- | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #--------------------------------------------------------------------- | 
|---|
|  |  |  | 
|---|
|  |  |  | # GameDataRecord.OnDayResetRecord() | 
|---|
|  |  |  | # 仙盟红包 | 
|---|
|  |  |  | PlayerFamilyRedPacket.DoOnDay() | 
|---|
|  |  |  |  | 
|---|
|  |  |  | # 玩家等级记录更新 | 
|---|
|  |  |  | ChPlayer.UpdataPlayerLVInfo() | 
|---|
|  |  |  | # 通知开服天数 | 
|---|
|  |  |  | #openServerDay = PlayerDBGSEvent.GetDBGSTrig_ByKey(PlayerDBGSEvent.Def_ServerDay) | 
|---|
|  |  |  | #GameWorld.SendMapServerMsgEx(ShareDefine.Def_Notify_WorldKey_ServerDay, openServerDay) | 
|---|
|  |  |  | #清理过期补偿 | 
|---|
|  |  |  | PlayerCompensation.ClearUpTimeOutCompensation() | 
|---|
|  |  |  | PlayerGeTui.ClearFMTGeTuiLimit() | 
|---|
|  |  |  | import PlayerBourse | 
|---|
|  |  |  | PlayerBourse.OverTimeItemsDeal() | 
|---|
|  |  |  | return | 
|---|
|  |  |  | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | # 全服在线人数平台明细 | 
|---|
|  |  |  | #platformOLDict = {} # 平台在线人数 {平台:人数, ...} | 
|---|
|  |  |  | platformOLDict = {} # 平台在线人数 {平台:人数, ...} | 
|---|
|  |  |  | #mapPlatformOLDict = {} # 地图平台在线人数 {mapID:{平台:人数, ...}, ...} | 
|---|
|  |  |  | tjgOnlineCnt = 0 # 脱机挂在线玩家 | 
|---|
|  |  |  | playerManager = GameWorld.GetPlayerManager() | 
|---|
|  |  |  | 
|---|
|  |  |  | tjgOnlineCnt += 1 | 
|---|
|  |  |  | continue | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #platform = GameWorld.GetPlayerPlatform(player.GetAccID()) | 
|---|
|  |  |  | #platformOLDict[platform] = platformOLDict.get(platform, 0) + 1 # 累计平台在线人数 | 
|---|
|  |  |  | platform = GameWorld.GetPlayerPlatform(player) | 
|---|
|  |  |  | platformOLDict[platform] = platformOLDict.get(platform, 0) + 1 # 累计平台在线人数 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #        mapID = player.GetMapID() | 
|---|
|  |  |  | #        mapOLDict = mapPlatformOLDict.get(mapID, {}) | 
|---|
|  |  |  | 
|---|
|  |  |  | #activePlayerCount = GameWorld.GetPlayerManager().GetActivePlayerCount() | 
|---|
|  |  |  | #DataRecordPack.DR_OnLinePlayerCount(activePlayerCount, platformOLDict, tjgOnlineCnt) | 
|---|
|  |  |  | #=========================================================================== | 
|---|
|  |  |  | # for platform, playerCnt in platformOLDict.items(): | 
|---|
|  |  |  | #    concurrency = EventReport.concurrency() | 
|---|
|  |  |  | #    concurrency.SetEventAgentInfo(platform) | 
|---|
|  |  |  | #    concurrency.concurrency = playerCnt | 
|---|
|  |  |  | #    EventReport.WriteEvent(concurrency) | 
|---|
|  |  |  | 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) | 
|---|
|  |  |  | DataRecordPack.DR_OnLinePlayerCount(activePlayerCount, {}, tjgOnlineCnt)    # 总在线 | 
|---|
|  |  |  | #EventReport.WriteEvent_concurrency(activePlayerCount, tjgOnlineCnt) | 
|---|
|  |  |  | #刷新当前地图服务器 | 
|---|
|  |  |  | #=========================================================================== | 
|---|
|  |  |  | # custom_concurrencyMapList = ReadChConfig.GetEvalChConfig("EventReportMapID") | 
|---|
|  |  |  | 
|---|
|  |  |  | GameWorld.GetGameWorld().SetDict(ChConfig.Def_WorldKey_IsGameWorldInit, 1) | 
|---|
|  |  |  | #初始化游戏时钟 | 
|---|
|  |  |  | GameWorld.GetGameWorld().SetTickTypeCount(ChConfig.TYPE_Tick_Count) | 
|---|
|  |  |  | #初始话开服时间、星期几 | 
|---|
|  |  |  | initOpenServerTime = PlayerDBGSEvent.GetDBGSTrig_ByKey(PlayerDBGSEvent.Def_InitOpenServerTime) | 
|---|
|  |  |  | openServerWeekday = PlayerDBGSEvent.GetDBGSTrig_ByKey(PlayerDBGSEvent.Def_OpenServerWeekday) | 
|---|
|  |  |  | if initOpenServerTime <= 0 or openServerWeekday <= 0: | 
|---|
|  |  |  | #记录首次开发时间(现实时间戳) | 
|---|
|  |  |  | PlayerDBGSEvent.SetInitOpenServerTime(initOpenServerTime if initOpenServerTime else int(time.time())) | 
|---|
|  |  |  | #初始化家族数量 | 
|---|
|  |  |  | GameWorld.GetFamilyManager().SetFamilyUpperLimitCount(ChConfig.Def_Family_MaxCnt) | 
|---|
|  |  |  | #排序元宝交易平台 | 
|---|
|  |  |  | 
|---|
|  |  |  | #事件汇报初始化 | 
|---|
|  |  |  | EventReport.InitDllAppID() | 
|---|
|  |  |  |  | 
|---|
|  |  |  | initOpenServerTime = PlayerDBGSEvent.GetDBGSTrig_ByKey( PlayerDBGSEvent.Def_InitOpenServerTime) | 
|---|
|  |  |  | if initOpenServerTime <= 0: | 
|---|
|  |  |  | #记录首次开发时间(现实时间戳) | 
|---|
|  |  |  | PlayerDBGSEvent.SetDBGSTrig_ByKey(PlayerDBGSEvent.Def_InitOpenServerTime , int(time.time())) | 
|---|
|  |  |  | #ReloadModule.RefreshModuleFileCMTime(True) | 
|---|
|  |  |  | #合服首次启动加载处理 | 
|---|
|  |  |  | __DoMixServerInit() | 
|---|
|  |  |  | #仙魔之争 | 
|---|
|  |  |  | PlayerXMZZ.OnGameServerInitOK() | 
|---|
|  |  |  | #加载活跃玩家等级信息 | 
|---|
|  |  |  | ChPlayer.LoadPlayerLVData() | 
|---|
|  |  |  | #世界boss被杀次数重置 | 
|---|
|  |  |  | #GameWorldBoss.CheckResetBossKilledCntOnServerInit() | 
|---|
|  |  |  | #GameWorldActionTeHui.OnGameServerInitOK() # 特惠活动初始化 | 
|---|
|  |  |  | #子服启动成功告知跨服主服 | 
|---|
|  |  |  | serverGroupID = GameWorld.GetServerGroupID() | 
|---|
|  |  |  | if GameWorld.IsMergeOpen() and not GameWorld.IsMergeServer(): | 
|---|
|  |  |  | GameWorld.Log("通知跨服主服务器启动成功, 可接收最新跨服活动状态及数据...") | 
|---|
|  |  |  | dataMsg = {"Platform":GameWorld.GetPlatform(), "ServerID":GameWorld.GetServerSID(), "ServerGroupID":serverGroupID} | 
|---|
|  |  |  | MergeChildMsg.SendMergerChildToCenterStringData(ChConfig.Def_ClientServerInitOK, dataMsg) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | GameWorld.Log("服务器启动成功: ServerGroupID=%s" % serverGroupID) | 
|---|
|  |  |  | #=========================================================================== | 
|---|
|  |  |  | # serverGroupID = GameWorld.GetServerGroupID() | 
|---|
|  |  |  | # if GameWorld.IsMergeOpen() and not GameWorld.IsMergeServer(): | 
|---|
|  |  |  | #    GameWorld.Log("通知跨服主服务器启动成功, 可接收最新跨服活动状态及数据...") | 
|---|
|  |  |  | #    dataMsg = {"Platform":GameWorld.GetPlatform(), "ServerID":GameWorld.GetServerSID(), "ServerGroupID":serverGroupID} | 
|---|
|  |  |  | #    MergeChildMsg.SendMergerChildToCenterStringData(ChConfig.Def_ClientServerInitOK, dataMsg) | 
|---|
|  |  |  | # | 
|---|
|  |  |  | # GameWorld.Log("服务器启动成功: ServerGroupID=%s" % serverGroupID) | 
|---|
|  |  |  | #=========================================================================== | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | def DoCheckNewServerOpen(tick): | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | AllMapServerInitOK(tick) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | PlayerDBGSEvent.SetDBGSTrig_ByKey(PlayerDBGSEvent.Def_InitOpenServerTime, setOpenServerTime) | 
|---|
|  |  |  | PlayerDBGSEvent.SetInitOpenServerTime(setOpenServerTime) | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | ## 服务器开服时是星期几 | 
|---|
|  |  |  | def GetOpenServerWeekday(): return PlayerDBGSEvent.GetDBGSTrig_ByKey(PlayerDBGSEvent.Def_OpenServerWeekday) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | ## 所有地图服务器初始化成功后(封包注册) | 
|---|
|  |  |  | #  @param tick 当前时间 | 
|---|
|  |  |  | 
|---|
|  |  |  | # 通知开服天数 | 
|---|
|  |  |  | openServerDay = PlayerDBGSEvent.GetDBGSTrig_ByKey(PlayerDBGSEvent.Def_ServerDay) | 
|---|
|  |  |  | GameWorld.SendMapServerMsgEx(ShareDefine.Def_Notify_WorldKey_ServerDay, openServerDay) | 
|---|
|  |  |  | openServerWeekday = PlayerDBGSEvent.GetDBGSTrig_ByKey(PlayerDBGSEvent.Def_OpenServerWeekday) | 
|---|
|  |  |  | GameWorld.SendMapServerMsgEx(ShareDefine.Def_Notify_WorldKey_OpenServerWeekday, openServerWeekday) | 
|---|
|  |  |  | # 合服状态 | 
|---|
|  |  |  | isMixServer = PlayerDBGSEvent.GetDBGSTrig_ByKey(PlayerDBGSEvent.Def_IsMixServer) | 
|---|
|  |  |  | GameWorld.SendMapServerMsgEx(ShareDefine.Def_Notify_WorldKey_IsMixServer, isMixServer) | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | def SendAllMapGlobalDropInfo(): | 
|---|
|  |  |  | # 同步所有地图所有全服掉落控制信息 | 
|---|
|  |  |  | globalDropCDDict = IpyGameDataPY.GetFuncEvalCfg("GlobalDropCD") # {物品ID:分钟, ...} | 
|---|
|  |  |  | globalDropCDDict = IpyGameDataPY.GetFuncEvalCfg("GlobalDropCD", 1) # {物品ID:分钟, ...} | 
|---|
|  |  |  | globalKilledCountDropDict = IpyGameDataPY.GetFuncEvalCfg("GlobalDropCD", 2) # 全服击杀次数必掉 | 
|---|
|  |  |  | globalDropRateDict = IpyGameDataPY.GetFuncEvalCfg("NPCGlobalDropRate") # {物品ID:[[npcID列表], "概率公式"], ...} | 
|---|
|  |  |  |  | 
|---|
|  |  |  | for itemID in globalDropCDDict.keys(): | 
|---|
|  |  |  | 
|---|
|  |  |  | killedCnt = PlayerDBGSEvent.GetDBGSTrig_ByKey(key) | 
|---|
|  |  |  | GameWorld.SendMapServerMsgEx(key, killedCnt) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | for npcID in globalKilledCountDropDict.keys(): | 
|---|
|  |  |  | key = ShareDefine.Def_Notify_WorldKey_NPCKilledCount % npcID | 
|---|
|  |  |  | killedCnt = PlayerDBGSEvent.GetDBGSTrig_ByKey(key) | 
|---|
|  |  |  | GameWorld.SendMapServerMsgEx(key, killedCnt) | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | def UpdGlobalDropCD(msgList): | 
|---|
|  |  |  | 
|---|
|  |  |  | ## 更新全局击杀次数换算掉落概率的物品所累计的击杀次数 | 
|---|
|  |  |  | itemID, updKilledCnt = msgList | 
|---|
|  |  |  | key = ShareDefine.Def_Notify_WorldKey_DropNPCKilledCnt % itemID | 
|---|
|  |  |  | PlayerDBGSEvent.SetDBGSTrig_ByKey(key, updKilledCnt) | 
|---|
|  |  |  | GameWorld.SendMapServerMsgEx(key, updKilledCnt) | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | def UpdGlobalKillCount(msgList): | 
|---|
|  |  |  | ## 更新全局击杀次数 | 
|---|
|  |  |  | npcID, updKilledCnt = msgList | 
|---|
|  |  |  | key = ShareDefine.Def_Notify_WorldKey_NPCKilledCount % npcID | 
|---|
|  |  |  | PlayerDBGSEvent.SetDBGSTrig_ByKey(key, updKilledCnt) | 
|---|
|  |  |  | GameWorld.SendMapServerMsgEx(key, updKilledCnt) | 
|---|
|  |  |  | return | 
|---|
|  |  |  | 
|---|
|  |  |  | #  @return None | 
|---|
|  |  |  | def BeforeClose(tick): | 
|---|
|  |  |  | PlayerTeam.OnServerClose(tick) | 
|---|
|  |  |  | ChPlayer.SavePlayerLVData() | 
|---|
|  |  |  | GameWorld.Log("通知C++关服!") | 
|---|
|  |  |  | GameWorld.GetGameWorld().OnServerClose() | 
|---|
|  |  |  |  | 
|---|