| | |
| | | # @version 2.6
|
| | | #
|
| | | # @note: 处理每周, 每日, 每月事件处理
|
| | | # @change: "2015-07-10 16:00" xdh QQ每日礼包
|
| | | # @change: "2015-08-13 14:00" ljd 新手卡OnDay
|
| | | # @change: "2015-09-18 19:30" hxp 跨服boss状态变更
|
| | | # @change: "2015-10-25 17:00" hxp 跨服PK状态变更
|
| | | # @change: "2015-11-18 18:30" hxp 跨服王者争霸
|
| | | # @change: "2016-02-30 17:00" hxp 领主霸业、恶魔试炼
|
| | | # @change: "2016-04-29 18:00" hxp 宠物OnDay
|
| | | # @change: "2016-07-13 18:00" hxp 在线赠送寻宝免费次数统计OnHour触发
|
| | | # @change: "2016-07-26 17:30" hxp 增加获胜战盟盟主ID变更处理
|
| | | # @change: "2016-08-05 19:00" hxp 脚本热更支持
|
| | | # @change: "2016-08-29 23:30" hxp 洪荒之力
|
| | | # @change: "2016-09-19 10:30" hxp key状态变更时全服玩家人数获取方式修改
|
| | | # @change: "2016-10-26 11:00" hxp 签到逻辑修改
|
| | | # @change: "2017-03-22 21:00" hxp 二维码红包
|
| | | #
|
| | | #---------------------------------------------------------------------
|
| | | #"""Version = 2017-05-12 18:00"""
|
| | | #---------------------------------------------------------------------
|
| | |
| | | import PlayerAssist
|
| | | import PlayerArena
|
| | | import PyGameData
|
| | | import PlayerTJG
|
| | | import PlayerGuaji
|
| | | import PlayerXiangong
|
| | | import PlayerFuncTeam
|
| | | import PlayerMineArea
|
| | | import PlayerBillboard
|
| | | import PlayerViewCache
|
| | | import PlayerMail
|
| | |
|
| | | import datetime
|
| | | import time
|
| | | #---------------------------------------------------------------------
|
| | |
|
| | | #===============================================================================
|
| | | # //01 01 新一天的响应#tagMOnDay
|
| | | # tagMOnDay * GettagMOnDay();
|
| | | # |
| | | # class IPY_MOnDay
|
| | | # {
|
| | | # public:
|
| | | # |
| | | # char * GetTime();
|
| | | # };
|
| | | #===============================================================================
|
| | | ## 世界服务器->每日响应(封包参数)01 01
|
| | | # @param index 玩家索引
|
| | | # @param tick 当前时间
|
| | | # @return None
|
| | | # @remarks 函数详细说明.
|
| | | def GameServer_OnDay(index, tick):
|
| | | GameWorld.GetPsycoFunc(__Func_GameServer_OnDay)(index, tick)
|
| | | CheckMachineTick(tick)
|
| | | return
|
| | | ## 原GameServer通知的
|
| | | def GameServer_OnDay(index, tick): return
|
| | | def GameServer_OnHour(index, tick): return
|
| | | def GameServer_OnWeek(index, tick): return
|
| | | def GameServer_OnMonth(index, tick): return
|
| | | def GameServer_OnYear(index, tick): return
|
| | |
|
| | | ## 用于防范运维开机时间超过24天导致报错
|
| | | # @param tick 当前时间
|
| | | # @return None
|
| | | def CheckMachineTick(tick):
|
| | | #取一张地图测试,在mapserver做逻辑,方便运维观察
|
| | | if GameWorld.GetMap().GetMapID() != 101:
|
| | | return
|
| | | |
| | | #超过24.8天就会发生游戏逻辑出错,因为tick变成负数
|
| | | if tick/1000.0/60/60/24 >= 22:
|
| | | raise Exception('Start PC > 22 days!!!')
|
| | | |
| | | return
|
| | |
|
| | | ## 世界服务器->每日响应(封包参数)01 01
|
| | | # @param index 玩家索引
|
| | | # @param tick 当前时间
|
| | | # @return None
|
| | | # @remarks 函数详细说明.
|
| | | def __Func_GameServer_OnDay(index, tick):
|
| | | def DoLogic_OnDay(tick):
|
| | | GameWorld.Log("MapServer -> OnDay!")
|
| | | playerManager = GameWorld.GetPlayerManager()
|
| | | #获取每日响应封包
|
| | | pack = IPY_GameWorld.IPY_MOnDay()
|
| | | #同步世界服务器时间
|
| | | SetMapServerTimeFromGameServer(pack.GetTime())
|
| | | |
| | | #处理所有玩家信件的onday事件, 把存在时间+1
|
| | | playerManager.ProcessAllPlayerMailOnDay()
|
| | | #清空每日日记记录信息
|
| | |
| | | continue
|
| | |
|
| | | PlayerOnDay(curPlayer)
|
| | | # 服务器Onday处理数据,即不能在玩家上线时的Onday触发
|
| | | #PlayerServerDay(curPlayer)
|
| | | PlayerOnDayEx(curPlayer)
|
| | |
|
| | | DoLogic_OnDayEx(tick)
|
| | | |
| | | PlayerBillboard.OnDay()
|
| | | PlayerViewCache.OnDay()
|
| | | return
|
| | |
|
| | | def __Func_GameServer_OnDayEx(tick):
|
| | | def DoLogic_OnDayEx(tick):
|
| | | GameWorld.Log("MapServer -> OnDayEx!")
|
| | |
|
| | | PlayerMail.OnDayEx()
|
| | | PlayerControl.RemoveTimeoutLeaveServerPlayerInfo(tick)
|
| | | |
| | | playerManager = GameWorld.GetPlayerManager()
|
| | | for i in xrange(playerManager.GetPlayerCount()):
|
| | | curPlayer = playerManager.GetPlayerByIndex(i)
|
| | | |
| | | if not GameWorld.IsNormalPlayer(curPlayer):
|
| | | continue
|
| | | |
| | | PlayerOnDayEx(curPlayer)
|
| | | return
|
| | |
|
| | | #---------------------------------------------------------------------
|
| | | #===============================================================================
|
| | | # #//////////////////////////////////////////////////////////////
|
| | | # #//01 06 新一个小时的响应#tagMOnHour
|
| | | # #tagMOnHour * GettagMOnHour();
|
| | | # #
|
| | | # #class IPY_MOnHour
|
| | | # #{
|
| | | # #public:
|
| | | # #
|
| | | # # char * GetTime();
|
| | | # #};
|
| | | #===============================================================================
|
| | | ## 01 06 新一个小时的响应
|
| | | # @param index 玩家索引
|
| | | # @param tick 当前时间
|
| | | # @return None
|
| | | # @remarks 函数详细说明.
|
| | | def GameServer_OnHour(index, tick):
|
| | | GameWorld.GetPsycoFunc(__Func_GameServer_OnHour)(index, tick)
|
| | | return
|
| | |
|
| | | ## 01 06 新一个小时的响应
|
| | | # @param index 玩家索引
|
| | | # @param tick 当前时间
|
| | | # @return None
|
| | | # @remarks 函数详细说明.
|
| | | def __Func_GameServer_OnHour(index, tick):
|
| | | def DoLogic_OnHour(tick):
|
| | | GameWorld.Log("MapServer -> OnHour!")
|
| | | #获取每小时响应封包
|
| | | pack = IPY_GameWorld.IPY_MOnHour()
|
| | | time = pack.GetTime()
|
| | | #同步世界服务器时间
|
| | | SetMapServerTimeFromGameServer(time)
|
| | |
|
| | | #副本OnHour事件
|
| | | FBLogic.OnHour(time, tick)
|
| | |
| | | PlayerOnHour(curPlayer)
|
| | |
|
| | | return
|
| | | #---------------------------------------------------------------------
|
| | | #===============================================================================
|
| | | # //01 02 新一个星期的响应#tagMOnWeek
|
| | | # tagMOnWeek * GettagMOnWeek();
|
| | | # |
| | | # class IPY_MOnWeek
|
| | | # {
|
| | | # public:
|
| | | # |
| | | # char * GetTime();
|
| | | # };
|
| | | #===============================================================================
|
| | |
|
| | | ## 世界服务器->每周响应(封包参数) 01 02 新一个星期的响应
|
| | | # @param index 玩家索引
|
| | | # @param tick 当前时间
|
| | | # @return None
|
| | | # @remarks 函数详细说明.
|
| | | def GameServer_OnWeek(index, tick):
|
| | | GameWorld.GetPsycoFunc(__Func_GameServer_OnWeek)(index, tick)
|
| | | return
|
| | |
|
| | | ## 世界服务器->每周响应(封包参数) 01 02 新一个星期的响应
|
| | | # @param index 玩家索引
|
| | | # @param tick 当前时间
|
| | | # @return None
|
| | | # @remarks 函数详细说明.
|
| | | def __Func_GameServer_OnWeek(index, tick):
|
| | | def DoLogic_OnWeek(tick):
|
| | | GameWorld.Log("MapServer -> OnWeek!")
|
| | | #获得每周响应封包
|
| | | pack = IPY_GameWorld.IPY_MOnWeek()
|
| | | #同步世界服务器时间
|
| | | SetMapServerTimeFromGameServer(pack.GetTime())
|
| | |
|
| | | playerManager = GameWorld.GetPlayerManager()
|
| | | for i in xrange(playerManager.GetPlayerCount()):
|
| | |
| | | continue
|
| | |
|
| | | PlayerOnWeek(curPlayer)
|
| | | PlayerOnWeekEx(curPlayer)
|
| | |
|
| | | #副本OnWeek事件响应
|
| | | FBLogic.OnWeek(tick)
|
| | | return
|
| | |
|
| | | def __Func_GameServer_OnWeekEx(tick):
|
| | | GameWorld.Log("MapServer -> OnWeekEx!")
|
| | | |
| | | playerManager = GameWorld.GetPlayerManager()
|
| | | for i in xrange(playerManager.GetPlayerCount()):
|
| | | curPlayer = playerManager.GetPlayerByIndex(i)
|
| | | |
| | | if not GameWorld.IsNormalPlayer(curPlayer):
|
| | | continue
|
| | | |
| | | PlayerOnWeekEx(curPlayer)
|
| | | |
| | | return
|
| | |
|
| | | #---------------------------------------------------------------------
|
| | | #===============================================================================
|
| | | # //01 03 新一个月的响应#tagMOnMonth
|
| | | # tagMOnMonth * GettagMOnMonth();
|
| | | # |
| | | # class IPY_MOnMonth
|
| | | # {
|
| | | # public:
|
| | | # |
| | | # char * GetTime();
|
| | | # };
|
| | | #===============================================================================
|
| | |
|
| | | ## 世界服务器->每月响应(封包参数)01 03 新一个月的响应
|
| | | # @param index 玩家索引
|
| | | # @param tick 当前时间
|
| | | # @return None
|
| | | # @remarks 函数详细说明.
|
| | | def GameServer_OnMonth(index, tick):
|
| | | GameWorld.GetPsycoFunc(__Func_GameServer_OnMonth)(index, tick)
|
| | | return
|
| | |
|
| | | ## 世界服务器->每月响应(封包参数)01 03 新一个月的响应
|
| | | # @param index 玩家索引
|
| | | # @param tick 当前时间
|
| | | # @return None
|
| | | # @remarks 函数详细说明.
|
| | | def __Func_GameServer_OnMonth(index, tick):
|
| | | def DoLogic_OnMonth(tick):
|
| | | GameWorld.Log("MapServer -> OnMonth!")
|
| | | #获得每月响应封包
|
| | | pack = IPY_GameWorld.IPY_MOnMonth()
|
| | | #同步世界服务器时间
|
| | | SetMapServerTimeFromGameServer(pack.GetTime())
|
| | |
|
| | | playerManager = GameWorld.GetPlayerManager()
|
| | | for i in xrange(playerManager.GetPlayerCount()):
|
| | |
| | | continue
|
| | |
|
| | | PlayerOnMonth(curPlayer)
|
| | | |
| | | return
|
| | |
|
| | | def __Func_GameServer_OnMonthEx(tick):
|
| | | GameWorld.Log("MapServer -> OnMonthEx!")
|
| | | |
| | | playerManager = GameWorld.GetPlayerManager()
|
| | | for i in xrange(playerManager.GetPlayerCount()):
|
| | | curPlayer = playerManager.GetPlayerByIndex(i)
|
| | | |
| | | if not GameWorld.IsNormalPlayer(curPlayer):
|
| | | continue
|
| | | |
| | | PlayerOnMonthEx(curPlayer)
|
| | |
|
| | | return
|
| | |
|
| | | #---------------------------------------------------------------------
|
| | | #===============================================================================
|
| | | # //01 04 新一年的响应#tagMOnYear
|
| | | # tagMOnYear * GettagMOnYear();
|
| | | # |
| | | # class IPY_MOnYear
|
| | | # {
|
| | | # public:
|
| | | # |
| | | # char * GetTime();
|
| | | # };
|
| | | #===============================================================================
|
| | |
|
| | | ## 世界服务器->每年响应(封包参数)01 04 新一年的响应
|
| | | # @param index 玩家索引
|
| | | # @param tick 当前时间 |
| | | # @return None
|
| | | # @remarks 函数详细说明.
|
| | | def GameServer_OnYear(index, tick):
|
| | | GameWorld.GetPsycoFunc(__Func_GameServer_OnYear)(index, tick)
|
| | | return
|
| | |
|
| | | ## 世界服务器->每年响应(封包参数)01 04 新一年的响应
|
| | | # @param index 玩家索引
|
| | | # @param tick 当前时间 |
| | | # @return None
|
| | | # @remarks 函数详细说明.
|
| | | def __Func_GameServer_OnYear(index, tick):
|
| | | def DoLogic_OnYear(tick):
|
| | | GameWorld.Log("MapServer -> OnYear")
|
| | | #获得新年响应封包
|
| | | pack = IPY_GameWorld.IPY_MOnYear()
|
| | | #同步世界服务器时间
|
| | | SetMapServerTimeFromGameServer(pack.GetTime())
|
| | |
|
| | | playerManager = GameWorld.GetPlayerManager()
|
| | | for i in range(0, playerManager.GetPlayerCount()):
|
| | |
| | | # @return None
|
| | | # @remarks 函数详细说明.
|
| | | def GameServer_InitOK(index, tick):
|
| | | curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
|
| | | try:
|
| | | #通知BServer自己OK了
|
| | | curPlayer.SendToBServerServerInitOK()
|
| | | ChPlayer.OnAllServerInitOK(curPlayer, tick)
|
| | | except:
|
| | | curPlayer.Kick(IPY_GameWorld.disWaitForPlayerLoinError)
|
| | | import traceback
|
| | | GameWorld.RaiseException("玩家上线逻辑错误\r\n%s" % traceback.format_exc())
|
| | | # curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
|
| | | # try:
|
| | | # #通知BServer自己OK了
|
| | | # curPlayer.SendToBServerServerInitOK()
|
| | | # ChPlayer.OnAllServerInitOK(curPlayer, tick)
|
| | | # except:
|
| | | # curPlayer.Kick(IPY_GameWorld.disWaitForPlayerLoinError)
|
| | | # import traceback
|
| | | # GameWorld.RaiseException("玩家上线逻辑错误\r\n%s" % traceback.format_exc())
|
| | | return
|
| | |
|
| | | #--------------------------------------------------------
|
| | |
| | | # 世界boss
|
| | | BossHurtMng.OnDay(curPlayer)
|
| | | # 仙盟过天
|
| | | PlayerFamily.FamilyPlayerOnDay(curPlayer)
|
| | | PlayerFamily.PlayerOnDay(curPlayer)
|
| | | # 重置物品每日使用次数
|
| | | ChItem.ResetItemUseCntToday(curPlayer)
|
| | | # 极品白拿
|
| | |
| | | #特殊时间点过天的,一般是游戏功能,此时立即同步一次跨服玩家数据
|
| | | CrossPlayerData.SendMergePlayerDataNow(curPlayer)
|
| | |
|
| | | #PlayerTJG.TJGOnDay(curPlayer, onEventType)
|
| | | # 以下为支持两种重置模式切换配置的
|
| | | FBCommon.FBOnDay(curPlayer, onEventType)
|
| | |
|
| | |
| | | #购买次数礼包
|
| | | PlayerActBuyCountGift.OnDay(curPlayer, onEventType)
|
| | | return
|
| | |
|
| | |
|
| | | ### 服务器Onday处理数据,即不能在玩家上线时的Onday触发
|
| | | ## @param curPlayer: 当前玩家实例
|
| | | ## @return: 无
|
| | | #def PlayerServerDay(curPlayer):
|
| | | # |
| | | # # 设置玩家是否可以参加家族活动
|
| | | # #PlayerFamily.SetForbidFamilyAction(curPlayer, 0)
|
| | | # return
|
| | |
|
| | | #---------------------------------------------------------------------
|
| | | ## 把当前这一周的在线时间算到上一周去
|
| | |
| | | GameWorld.Log('验证重生点完毕, mapID = %s, cnt = %s'%(mapID, br_Count))
|
| | | return
|
| | | #---------------------------------------------------------------------
|
| | |
|
| | | def GMDateTime(curPlayer, eventName):
|
| | | if eventName == 'GMOnHour':
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_OnHour, 0)
|
| | | return
|
| | | |
| | | if eventName == 'GMOnDay':
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_OnHour, 0)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_OnDay, 0)
|
| | | #PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_OnDayEx, 0)
|
| | | return
|
| | | |
| | | if eventName == 'GMOnWeek':
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_OnHour, 0)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_OnDay, 0)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_OnWeek, 0)
|
| | | #PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_OnDayEx, 0)
|
| | | #PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_OnWeekEx, 0)
|
| | | return
|
| | | |
| | | if eventName == 'GMOnMonth':
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_OnHour, 0)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_OnDay, 0)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_OnWeek, 0)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_OnMonth, 0)
|
| | | #PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_OnDayEx, 0)
|
| | | #PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_OnWeekEx, 0)
|
| | | #PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_OnMonthEx, 0)
|
| | | return
|
| | | |
| | | if eventName == 'GMOnYear':
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_OnHour, 0)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_OnDay, 0)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_OnWeek, 0)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_OnMonth, 0)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_OnYear, 0)
|
| | | #PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_OnDayEx, 0)
|
| | | #PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_OnWeekEx, 0)
|
| | | #PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_OnMonthEx, 0)
|
| | | return
|
| | | |
| | | return
|
| | |
|
| | | ## 更新玩家在线时间(参数 -> 当前玩家)
|
| | | # @param curPlayer 当前玩家
|
| | | # @return None
|
| | |
| | | elif key == ShareDefine.Def_Notify_WorldKey_CrossDailyActionState % ShareDefine.CrossDailyActionID_YaomoBoss:
|
| | | if gameWorldMgr.GetGameWorldDictByKey(key) != value:
|
| | | PlayerCrossYaomoBoss.OnYaomoBossStateChange(value, tick)
|
| | | |
| | | # OnDayEx
|
| | | elif key == ShareDefine.Def_Notify_WorldKey_OnDayEx:
|
| | | if value and gameWorldMgr.GetGameWorldDictByKey(key) != value:
|
| | | __Func_GameServer_OnDayEx(tick)
|
| | | |
| | | # OnWeekEx
|
| | | elif key == ShareDefine.Def_Notify_WorldKey_OnWeekEx:
|
| | | if value and gameWorldMgr.GetGameWorldDictByKey(key) != value:
|
| | | __Func_GameServer_OnWeekEx(tick)
|
| | | |
| | | # OnMonthEx
|
| | | elif key == ShareDefine.Def_Notify_WorldKey_OnMonthEx:
|
| | | if value and gameWorldMgr.GetGameWorldDictByKey(key) != value:
|
| | | __Func_GameServer_OnMonthEx(tick)
|
| | |
|
| | | # 世界等级
|
| | | elif key == ShareDefine.Def_Notify_WorldKey_WorldAverageLv:
|