| | |
| | | # @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 ReadChConfig
|
| | | import ChConfig
|
| | | import GameWorld
|
| | | import EventShell
|
| | | import FBLogic
|
| | | import IPY_GameWorld
|
| | | import ChPlayer
|
| | | import GameLogInfo
|
| | | import GameServerRefresh
|
| | | import ShareDefine
|
| | | import PlayerGameWallow
|
| | |
| | | import FunctionNPCCommon
|
| | | import PlayerGoldGift
|
| | | import PlayerActivity
|
| | | import PlayerBindJadeWheel
|
| | | import FBCommon
|
| | | import PlayerSuccess
|
| | | import PlayerFreeGoods
|
| | |
| | | import PlayerFlashGiftbag
|
| | | import PlayerDailyGiftbag
|
| | | import PlayerFairyCeremony
|
| | | import PlayerOfflineSupport
|
| | | import PlayerNewFairyCeremony
|
| | | import PlayerActHorsePetFeast
|
| | | import PlayerFeastRedPacket
|
| | | import PlayerCrossYaomoBoss
|
| | | import PlayerLuckyCloudBuy
|
| | | import PlayerLuckyTreasure
|
| | | import PlayerAuctionHouse
|
| | | import PlayerTongTianLing
|
| | | import PlayerRefineStove
|
| | | import PlayerFlashSale
|
| | |
| | | import PlayerZhanling
|
| | | import PlayerVip
|
| | | import PlayerLove
|
| | | import PlayerDiceEx
|
| | | import IpyGameDataPY
|
| | | import FamilyRobBoss
|
| | | import FBHelpBattle
|
| | | import QuestManager
|
| | | import PlayerAssist
|
| | | import PlayerArena
|
| | | import PyGameData
|
| | | import PlayerTJG
|
| | | import PlayerGuaji
|
| | | import PlayerXiangong
|
| | | import PlayerFuncTeam
|
| | | import PlayerMineArea
|
| | | import PlayerBillboard
|
| | | import PlayerViewCache
|
| | | import PlayerMail
|
| | | import DBDataMgr
|
| | |
|
| | | 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()
|
| | | #清空每日日记记录信息
|
| | | GameLogInfo.ClearGameLogInfo()
|
| | | |
| | | #副本OnDay事件响应
|
| | | FBLogic.OnDay(tick)
|
| | |
|
| | | #删除所有的任务发布
|
| | | missionPubManager = GameWorld.GetGameWorld().GetDBMissionPubManager()
|
| | | missionPubManager.Clear()
|
| | | #仙盟
|
| | | PlayerFamily.FamilyOnDay()
|
| | |
|
| | | PlayerOfflineSupport.OnDay()
|
| | | playerManager = GameWorld.GetPlayerManager()
|
| | | for i in xrange(playerManager.GetPlayerCount()):
|
| | | curPlayer = playerManager.GetPlayerByIndex(i)
|
| | |
|
| | |
| | | continue
|
| | |
|
| | | PlayerOnDay(curPlayer)
|
| | | # 服务器Onday处理数据,即不能在玩家上线时的Onday触发
|
| | | #PlayerServerDay(curPlayer)
|
| | | |
| | | return
|
| | |
|
| | | def __Func_GameServer_OnDayEx(tick):
|
| | | GameWorld.Log("MapServer -> OnDayEx!")
|
| | | |
| | | DBDataMgr.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)
|
| | | PlayerBillboard.OnDay()
|
| | | PlayerViewCache.OnDay()
|
| | | 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()):
|
| | |
| | | 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
|
| | |
|
| | | #--------------------------------------------------------
|
| | |
| | | GameWorld.Log("PlayerOnDay! ondayValue=%s" % (ondayValue), playerID)
|
| | |
|
| | | __DoPlayerOnDay(curPlayer, ShareDefine.Def_OnEventType)
|
| | | |
| | | GameWorld.Log("PlayerOnDay OK!", playerID)
|
| | | return
|
| | | |
| | | def PlayerOnDayEx(curPlayer):
|
| | | #记录玩家字典值,待初始化后执行
|
| | | if not curPlayer.GetGameServerInitOK():
|
| | | GameServerRefresh.Set_PlayerGameServerInitOK_OnDayEx(curPlayer , 1)
|
| | | return
|
| | | |
| | | ondayValue = __Get_Can_OnDayEx(curPlayer)
|
| | | if not ondayValue:
|
| | | return
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_OnDayEx, ondayValue)
|
| | | playerID = curPlayer.GetPlayerID()
|
| | | GameWorld.Log("PlayerOnDayEx! ondayValue=%s" % (ondayValue), playerID)
|
| | | |
| | | __DoPlayerOnDay(curPlayer, ShareDefine.Def_OnEventTypeEx)
|
| | |
|
| | | GameWorld.Log("PlayerOnDayEx OK!", playerID)
|
| | | GameWorld.Log("PlayerOnDay OK!", playerID)
|
| | | return
|
| | |
|
| | | def __DoPlayerOnDay(curPlayer, onEventType):
|
| | |
| | | PlayerGoldGift.OnDay(curPlayer)
|
| | | #炼丹
|
| | | PlayerRefineStove.OnDay(curPlayer)
|
| | | #绑玉转盘
|
| | | PlayerBindJadeWheel.OnDay(curPlayer)
|
| | | #转盘
|
| | | PlayerActTurntable.PlayerOnDay(curPlayer)
|
| | | #情缘
|
| | |
| | | elif onEventType == ShareDefine.Def_OnEventTypeEx:
|
| | | # 资源找回
|
| | | PlayerRecover.RecoverOnDay(curPlayer)
|
| | | #触发每日任务重置脚本
|
| | | EventShell.EventResponse_OnDay(curPlayer)
|
| | | #购买次数清空
|
| | | Operate_PlayerBuyZhenQi.PlayerOnDay(curPlayer)
|
| | | |
| | | #我要太极过天
|
| | | PlayerDiceEx.OnDay(curPlayer)
|
| | | # 世界boss
|
| | | BossHurtMng.OnDay(curPlayer)
|
| | | # 仙盟过天
|
| | |
| | | #特殊时间点过天的,一般是游戏功能,此时立即同步一次跨服玩家数据
|
| | | CrossPlayerData.SendMergePlayerDataNow(curPlayer)
|
| | |
|
| | | #PlayerTJG.TJGOnDay(curPlayer, onEventType)
|
| | | # 以下为支持两种重置模式切换配置的
|
| | | FBCommon.FBOnDay(curPlayer, onEventType)
|
| | |
|
| | |
| | | GameWorld.Log("PlayerOnWeek! onWeekValue=%s" % (onWeekValue), playerID)
|
| | |
|
| | | __DoPlayerOnWeek(curPlayer, ShareDefine.Def_OnEventType)
|
| | | |
| | | GameWorld.Log("PlayerOnWeek OK!", playerID)
|
| | | return
|
| | |
|
| | | def PlayerOnWeekEx(curPlayer):
|
| | | #记录玩家字典值,待初始化后执行
|
| | | if not curPlayer.GetGameServerInitOK():
|
| | | GameServerRefresh.Set_PlayerGameServerInitOK_OnWeekEx(curPlayer , 1)
|
| | | return
|
| | | |
| | | onWeekValue = __Get_Can_OnWeekEx(curPlayer)
|
| | | if not onWeekValue:
|
| | | return
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_OnWeekEx, onWeekValue)
|
| | | playerID = curPlayer.GetPlayerID()
|
| | | GameWorld.Log("PlayerOnWeekEx! onWeekValue=%s" % (onWeekValue), playerID)
|
| | | |
| | | __DoPlayerOnWeek(curPlayer, ShareDefine.Def_OnEventTypeEx)
|
| | |
|
| | | GameWorld.Log("PlayerOnWeekEx OK!", playerID)
|
| | | GameWorld.Log("PlayerOnWeek OK!", playerID)
|
| | | return
|
| | |
|
| | | def __DoPlayerOnWeek(curPlayer, onEventType):
|
| | |
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_HasVIPClubNote, 0)
|
| | |
|
| | | elif onEventType == ShareDefine.Def_OnEventTypeEx:
|
| | | #触发每周任务重置脚本
|
| | | EventShell.EventResponse_OnWeek(curPlayer)
|
| | | #竞技场
|
| | | PlayerArena.OnWeekEx(curPlayer)
|
| | | PlayerFamily.OnWeekEx(curPlayer)
|
| | |
| | | GameWorld.Log("PlayerOnMonth! onMonthValue=%s" % (onMonthValue), playerID)
|
| | |
|
| | | __DoPlayerOnMonth(curPlayer, ShareDefine.Def_OnEventType)
|
| | | |
| | | GameWorld.Log("PlayerOnMonth OK!", playerID)
|
| | | return
|
| | |
|
| | | def PlayerOnMonthEx(curPlayer):
|
| | | #记录玩家字典值,待初始化后执行
|
| | | if not curPlayer.GetGameServerInitOK():
|
| | | GameServerRefresh.Set_PlayerGameServerInitOK_OnMonthEx(curPlayer , 1)
|
| | | return
|
| | | |
| | | onMonthValue = __Get_Can_OnMonthEx(curPlayer)
|
| | | if not onMonthValue:
|
| | | return
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_OnMonthEx, onMonthValue)
|
| | | playerID = curPlayer.GetPlayerID()
|
| | | GameWorld.Log("PlayerOnMonthEx! onMonthValue=%s" % (onMonthValue), playerID)
|
| | | |
| | | __DoPlayerOnMonth(curPlayer, ShareDefine.Def_OnEventTypeEx)
|
| | |
|
| | | GameWorld.Log("PlayerOnMonthEx OK!", playerID)
|
| | | GameWorld.Log("PlayerOnMonth OK!", playerID)
|
| | | return
|
| | |
|
| | | def __DoPlayerOnMonth(curPlayer, onEventType):
|
| | |
| | | #从数据库中查询当前排行榜等级
|
| | | curPlayer.DataServer_GetBillboardLV()
|
| | |
|
| | | |
| | | #触发每小时任务重置脚本
|
| | | EventShell.EventResponse_OnHour(curPlayer)
|
| | | #缥缈仙域
|
| | | PlayerFairyDomain.OnHour(curPlayer)
|
| | | 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
|
| | |
| | | PlayerOnDay(curPlayer)
|
| | |
|
| | | #OnDayEx事件
|
| | | if __Get_Can_OnDayEx(curPlayer):
|
| | | PlayerOnDayEx(curPlayer)
|
| | | #if __Get_Can_OnDayEx(curPlayer):
|
| | | # PlayerOnDayEx(curPlayer)
|
| | |
|
| | | #OnWeek事件
|
| | | if __Get_Can_OnWeek(curPlayer):
|
| | | PlayerOnWeek(curPlayer)
|
| | |
|
| | | #OnWeekEx事件
|
| | | if __Get_Can_OnWeekEx(curPlayer):
|
| | | PlayerOnWeekEx(curPlayer)
|
| | | #if __Get_Can_OnWeekEx(curPlayer):
|
| | | # PlayerOnWeekEx(curPlayer)
|
| | |
|
| | | #OnMonth事件
|
| | | if __Get_Can_OnMonth(curPlayer):
|
| | | PlayerOnMonth(curPlayer)
|
| | |
|
| | | #OnMonthEx事件
|
| | | if __Get_Can_OnMonthEx(curPlayer):
|
| | | PlayerOnMonthEx(curPlayer)
|
| | | #if __Get_Can_OnMonthEx(curPlayer):
|
| | | # PlayerOnMonthEx(curPlayer)
|
| | |
|
| | | #OnYear事件
|
| | | if __Get_Can_OnYear(curPlayer):
|
| | |
| | | return dateTime_Day
|
| | | return 0
|
| | |
|
| | | def __Get_Can_OnDayEx(curPlayer):
|
| | | '''判断可否凌晨X点过天
|
| | | @return: 0-不可; >0-可以, 且代表的是过天需记录的值
|
| | | '''
|
| | | curDateTime = GameWorld.GetCurrentTime()
|
| | | |
| | | # 上次过天记录格式: 年月日, 如20171027
|
| | | lastOndayEx = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_OnDayEx)
|
| | | #GameWorld.DebugLog("__Get_Can_OnDayEx lastOndayEx=%s" % (lastOndayEx))
|
| | | if lastOndayEx:
|
| | | lastOndayEx_Year = lastOndayEx / 10000
|
| | | lastOndayEx_Month = lastOndayEx % 10000 / 100
|
| | | lastOndayEx_Day = lastOndayEx % 100
|
| | | #GameWorld.DebugLog("lastOndayEx_Year=%s,lastOndayEx_Month=%s,lastOndayEx_Day=%s" % (lastOndayEx_Year, lastOndayEx_Month, lastOndayEx_Day))
|
| | | |
| | | # 上次过天的日期0点
|
| | | lastDatetime = datetime.datetime(lastOndayEx_Year, lastOndayEx_Month, lastOndayEx_Day, 0, 0, 0)
|
| | | passTime = curDateTime - lastDatetime
|
| | | passDays = passTime.days
|
| | | passSeconds = passTime.seconds
|
| | | |
| | | # 如果时间差没有超过1天,代表还未过天
|
| | | if passDays == 0:
|
| | | #GameWorld.DebugLog("如果时间差没有超过1天,代表还未过天, passDays=%s" % passDays)
|
| | | return 0
|
| | | # 等于1天的, 时间差需 >= X时才可过天, 即 X * 3600 秒
|
| | | if passDays == 1 and passSeconds < ShareDefine.Def_OnEventHour * 3600:
|
| | | #GameWorld.DebugLog("等于1天的, 时间差需 >= X时才可过天, 即 X * 3600 秒, passSeconds=%s" % passSeconds)
|
| | | return 0
|
| | | #if passDays < 0:
|
| | | # GameWorld.DebugLog("时间天差小于0,一般为异常情况,只有时间往回调才回出现!默认允许过天,passDays=%s" % passDays)
|
| | | # 大于1天的无论什么时间点都可以过天
|
| | | |
| | | if curDateTime.hour < ShareDefine.Def_OnEventHour:
|
| | | curDateTime = curDateTime - datetime.timedelta(days=1)
|
| | | #GameWorld.Log("OnDayEx 特殊X点之前过天的,代表天差大于1天的时间过天,这时候的过天值需设置为昨天 %s" % curDateTime)
|
| | | |
| | | dateTime_Day = curDateTime.day
|
| | | dateTime_Month = curDateTime.month
|
| | | dateTime_Year = curDateTime.year
|
| | | #GameWorld.DebugLog("可以过天")
|
| | | return dateTime_Year * 10000 + dateTime_Month * 100 + dateTime_Day
|
| | |
|
| | | ## 检查玩家是否可以OnWeek
|
| | | # @param curPlayer 当前玩家
|
| | | # @param curMission 当前任务
|
| | |
| | | if (dateTime_Week != player_Week):
|
| | | return dateTime_Week
|
| | | return 0
|
| | |
|
| | | def __Get_Can_OnWeekEx(curPlayer):
|
| | | '''判断可否凌晨X点过周
|
| | | @return: 0-不可; >0-可以, 且代表的是过周需记录的值
|
| | | '''
|
| | | curDateTime = GameWorld.GetCurrentTime()
|
| | | isocalendar = datetime.datetime.isocalendar(curDateTime)
|
| | | dateTime_year, dateTime_week, dateTime_day = isocalendar
|
| | | |
| | | # 上次过周记录格式: 年周, 如201752
|
| | | lastOnWeekEx = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_OnWeekEx)
|
| | | #GameWorld.DebugLog("__Get_Can_OnWeekEx lastOnWeekEx=%s,dateTime_year=%s,week=%s,day=%s" |
| | | # % (lastOnWeekEx, dateTime_year, dateTime_week, dateTime_day))
|
| | | if lastOnWeekEx:
|
| | | lastOnWeekEx_Year = lastOnWeekEx / 100
|
| | | lastOnWeekEx_Week = lastOnWeekEx % 100
|
| | | # 本周已经过周过
|
| | | if dateTime_year == lastOnWeekEx_Year and dateTime_week == lastOnWeekEx_Week:
|
| | | #GameWorld.DebugLog("本周已经过周过")
|
| | | return 0
|
| | | |
| | | # 当前天为每周第一天的时候,需判断周差为1时当前时间点是否超过5点
|
| | | if dateTime_day == 1:
|
| | | preWeekDateTime = curDateTime - datetime.timedelta(days=7) # 上一周的datetime(即周差为1)
|
| | | preWeek_year, preWeek_week, preWeek_day = datetime.datetime.isocalendar(preWeekDateTime)
|
| | | |
| | | # 上次过周的刚好是周差1, 则需判断当前时间点是否超过X时
|
| | | if preWeek_year == lastOnWeekEx_Year and preWeek_week == lastOnWeekEx_Week:
|
| | | if curDateTime.hour < ShareDefine.Def_OnEventHour:
|
| | | #GameWorld.DebugLog("本周第一天,未到达过周时间点, hour=%s" % curDateTime.hour)
|
| | | return 0
|
| | | |
| | | # 周差不为1的时候,则无论什么时间点均可过周
|
| | | else:
|
| | | #GameWorld.DebugLog("周差不为1的时候,则无论什么时间点均可过周, 可以过周")
|
| | | pass
|
| | | |
| | | # 不是每周第一天的时候,则无论什么时间点均可过周
|
| | | else:
|
| | | #GameWorld.DebugLog("不是每周第一天的时候,则无论什么时间点均可过周, 可以过周")
|
| | | pass
|
| | | |
| | | if dateTime_day == 1 and curDateTime.hour < ShareDefine.Def_OnEventHour:
|
| | | onWeekDateTime = curDateTime - datetime.timedelta(days=7) # 上一周的datetime(即周差为1)
|
| | | dateTime_year, dateTime_week, dateTime_day = datetime.datetime.isocalendar(onWeekDateTime)
|
| | | #GameWorld.Log("OnWeekEx 周一特殊X点之前过天的,代表周差大于1天的周一过周,这时候的过周值需设置为上周 %s" % onWeekDateTime)
|
| | | |
| | | #GameWorld.DebugLog("可以过周")
|
| | | return dateTime_year * 100 + dateTime_week
|
| | |
|
| | | ## 检查玩家是否可以OnMonth
|
| | | # @param curPlayer 当前玩家
|
| | |
| | | if (dateTime_Month != player_Month or dateTime_Year != player_Year):
|
| | | return dateTime_Month
|
| | | return 0
|
| | |
|
| | | def __Get_Can_OnMonthEx(curPlayer):
|
| | | '''判断可否凌晨X点过月
|
| | | @return: 0-不可; >0-可以, 且代表的是过月需记录的值
|
| | | '''
|
| | | curDateTime = GameWorld.GetCurrentTime()
|
| | | dateTime_day = curDateTime.day
|
| | | dateTime_month = curDateTime.month
|
| | | dateTime_year = curDateTime.year
|
| | | |
| | | # 上次过月记录格式: 年月, 如201712
|
| | | lastOnMonthEx = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_OnMonthEx)
|
| | | #GameWorld.DebugLog("__Get_Can_OnMonthEx lastOnMonthEx=%s,dateTime_year=%s,dateTime_month=%s" |
| | | # % (lastOnMonthEx, dateTime_year, dateTime_month))
|
| | | if lastOnMonthEx:
|
| | | lastOnMonthEx_Year = lastOnMonthEx / 100
|
| | | lastOnMonthEx_Month = lastOnMonthEx % 100
|
| | | # 本月已经过月过
|
| | | if dateTime_year == lastOnMonthEx_Year and dateTime_month == lastOnMonthEx_Month:
|
| | | #GameWorld.DebugLog("本月已经过月过")
|
| | | return 0
|
| | | |
| | | # 当前天为每月第一天的时候,需判断月差为1时当前时间点是否超过5点
|
| | | if dateTime_day == 1:
|
| | | preMonth_month = 12 if dateTime_month == 1 else dateTime_month - 1 # 上一月
|
| | | preMonth_year = dateTime_year if preMonth_month != 12 else dateTime_year - 1 # 上一月所属年
|
| | | |
| | | # 上次过月的刚好是月差1, 则需判断当前时间点是否超过X时
|
| | | if preMonth_year == lastOnMonthEx_Year and preMonth_month == lastOnMonthEx_Month:
|
| | | if curDateTime.hour < ShareDefine.Def_OnEventHour:
|
| | | #GameWorld.DebugLog("本月第一天,未到达过月时间点, hour=%s" % curDateTime.hour)
|
| | | return 0
|
| | | |
| | | # 月差不为1的时候,则无论什么时间点均可过月
|
| | | else:
|
| | | #GameWorld.DebugLog("月差不为1的时候,则无论什么时间点均可过月, 可以过月")
|
| | | pass
|
| | | |
| | | # 不是每月第一天的时候,则无论什么时间点均可过月
|
| | | else:
|
| | | #GameWorld.DebugLog("不是每月第一天的时候,则无论什么时间点均可过月, 可以过月")
|
| | | pass
|
| | | |
| | | if dateTime_day == 1 and curDateTime.hour < ShareDefine.Def_OnEventHour:
|
| | | dateTime_month = 12 if dateTime_month == 1 else dateTime_month - 1 # 上一月
|
| | | dateTime_year = dateTime_year if dateTime_month != 12 else dateTime_year - 1 # 上一月所属年
|
| | | #GameWorld.Log("OnMonthEx 月1号特殊X点之前过天的,代表月差大于1的月1号过月,这时候的过月值需设置为上月。%d%02d" % (dateTime_year, dateTime_month))
|
| | | |
| | | #GameWorld.DebugLog("可以过月")
|
| | | return dateTime_year * 100 + dateTime_month
|
| | |
|
| | | ## 检查玩家是否可以OnYear
|
| | | # @param curPlayer 当前玩家
|
| | |
| | | assistData = eval(msgValue)
|
| | | if GameWorld.GetMap().GetMapID() == assistData[0]:
|
| | | PlayerAssist.GameServer_AssistBossMsg(assistData[1:])
|
| | | return
|
| | | |
| | | if key == ShareDefine.Def_Notify_WorldKey_AddFamilyAuctionItem:
|
| | | mapID, familyAuctionItemDict = eval(msgValue)
|
| | | if GameWorld.GetMap().GetMapID() == mapID:
|
| | | PlayerAuctionHouse.DoAddFamilyAuctionItem(familyAuctionItemDict)
|
| | | return
|
| | | |
| | | if key == ShareDefine.Def_Notify_WorldKey_AddSystemAuctionItem:
|
| | | mapID, sysAuctionItemList = eval(msgValue)
|
| | | if GameWorld.GetMap().GetMapID() == mapID:
|
| | | PlayerAuctionHouse.DoAddSystemAuctionItem(sysAuctionItemList)
|
| | | return
|
| | |
|
| | | if key == ShareDefine.Def_Notify_WorldKey_FairyDomainLimit:
|
| | |
| | | PlayerLuckyCloudBuy.OnLuckyCloudBuyChange()
|
| | | return
|
| | |
|
| | | # 功能队伍
|
| | | if key == ShareDefine.Def_Notify_WorldKey_FuncTeamMemIDInfo:
|
| | | PlayerFuncTeam.OnFuncTeamMemIDRefresh(eval(msgValue))
|
| | | return
|
| | | |
| | | if key == ShareDefine.Def_Notify_WorldKey_CrossBattlefieldCallTeamInfo:
|
| | | PyGameData.g_crossBattlefieldCallTeamInfo = eval(msgValue)
|
| | | return
|
| | |
| | | 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:
|
| | |
| | | gameWorldMgr.SetGameWorldDict(ShareDefine.Def_Notify_WorldKey_ReloadJpegCaptcha, value)
|
| | |
|
| | | IpyGameDataPY.IPYData.IpyDataClear()
|
| | | |
| | | #任务重读,需放在配置重读后面,暂时默认关闭,仅有需要重读任务时开启配置
|
| | | if IpyGameDataPY.GetFuncCfg("ReloadQuests", 1):
|
| | | tick = GameWorld.GetGameWorld().GetTick()
|
| | | QuestManager.ReloadQuests(tick)
|
| | | EventShell.DoReloadRefresh()
|
| | | return
|
| | |
|
| | | #===============================================================================
|