From dc0b92c1e2fe9f3d24c183b325dad54d088735c1 Mon Sep 17 00:00:00 2001 From: hxp <ale99527@vip.qq.com> Date: 星期四, 10 七月 2025 17:01:24 +0800 Subject: [PATCH] Merge branch 'master' of http://192.168.1.20:10010/r/Project_SG_ServerCode --- ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerEventCounter.py | 283 +++----------------------------------------------------- 1 files changed, 18 insertions(+), 265 deletions(-) diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerEventCounter.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerEventCounter.py index 766ae61..4068544 100644 --- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerEventCounter.py +++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerEventCounter.py @@ -18,11 +18,9 @@ import ReadChConfig import ChConfig import GameWorld -import EventShell import FBLogic import IPY_GameWorld import ChPlayer -import GameLogInfo import GameServerRefresh import ShareDefine import PlayerGameWallow @@ -40,7 +38,6 @@ import FunctionNPCCommon import PlayerGoldGift import PlayerActivity -import PlayerBindJadeWheel import FBCommon import PlayerSuccess import PlayerFreeGoods @@ -99,13 +96,13 @@ 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 @@ -116,19 +113,17 @@ import PlayerZhanling import PlayerVip import PlayerLove -import PlayerDiceEx import IpyGameDataPY import FamilyRobBoss import FBHelpBattle -import QuestManager import PlayerAssist import PlayerArena import PyGameData import PlayerGuaji import PlayerXiangong -import PlayerFuncTeam import PlayerMineArea import PlayerBillboard +import PlayerViewCache import PlayerMail import datetime @@ -143,19 +138,14 @@ def DoLogic_OnDay(tick): GameWorld.Log("MapServer -> OnDay!") - playerManager = GameWorld.GetPlayerManager() - #处理所有玩家信件的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) @@ -163,18 +153,11 @@ continue PlayerOnDay(curPlayer) - PlayerOnDayEx(curPlayer) - - DoLogic_OnDayEx(tick) - - PlayerBillboard.OnDay() - return - -def DoLogic_OnDayEx(tick): - GameWorld.Log("MapServer -> OnDayEx!") - + PlayerMail.OnDayEx() PlayerControl.RemoveTimeoutLeaveServerPlayerInfo(tick) + PlayerBillboard.OnDay() + PlayerViewCache.OnDay() return def DoLogic_OnHour(tick): @@ -207,7 +190,6 @@ continue PlayerOnWeek(curPlayer) - PlayerOnWeekEx(curPlayer) #副本OnWeek事件响应 FBLogic.OnWeek(tick) @@ -224,7 +206,6 @@ continue PlayerOnMonth(curPlayer) - PlayerOnMonthEx(curPlayer) return @@ -283,26 +264,9 @@ 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): @@ -355,8 +319,6 @@ PlayerGoldGift.OnDay(curPlayer) #炼丹 PlayerRefineStove.OnDay(curPlayer) - #绑玉转盘 - PlayerBindJadeWheel.OnDay(curPlayer) #转盘 PlayerActTurntable.PlayerOnDay(curPlayer) #情缘 @@ -388,13 +350,8 @@ elif onEventType == ShareDefine.Def_OnEventTypeEx: # 资源找回 PlayerRecover.RecoverOnDay(curPlayer) - #触发每日任务重置脚本 - EventShell.EventResponse_OnDay(curPlayer) #购买次数清空 Operate_PlayerBuyZhenQi.PlayerOnDay(curPlayer) - - #我要太极过天 - PlayerDiceEx.OnDay(curPlayer) # 世界boss BossHurtMng.OnDay(curPlayer) # 仙盟过天 @@ -504,26 +461,9 @@ 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): @@ -553,8 +493,6 @@ PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_HasVIPClubNote, 0) elif onEventType == ShareDefine.Def_OnEventTypeEx: - #触发每周任务重置脚本 - EventShell.EventResponse_OnWeek(curPlayer) #竞技场 PlayerArena.OnWeekEx(curPlayer) PlayerFamily.OnWeekEx(curPlayer) @@ -589,26 +527,9 @@ 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): @@ -685,9 +606,6 @@ #从数据库中查询当前排行榜等级 curPlayer.DataServer_GetBillboardLV() - - #触发每小时任务重置脚本 - EventShell.EventResponse_OnHour(curPlayer) #缥缈仙域 PlayerFairyDomain.OnHour(curPlayer) return @@ -860,24 +778,24 @@ 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): @@ -926,49 +844,6 @@ 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 当前任务 @@ -984,55 +859,6 @@ 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 当前玩家 @@ -1050,56 +876,6 @@ 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 当前玩家 @@ -1215,18 +991,6 @@ 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: @@ -1438,11 +1202,6 @@ 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 @@ -1565,12 +1324,6 @@ 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 #=============================================================================== -- Gitblit v1.8.0