From c32b4159c5f33b4badd3d5f2a2c06923dda55ec4 Mon Sep 17 00:00:00 2001 From: hxp <ale99527@vip.qq.com> Date: 星期二, 09 二月 2021 10:59:09 +0800 Subject: [PATCH] 8716 【主干】【后端】【BT2】H.活动-节日祈愿(节日登录优化已登录天不限制领取天); --- ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFeastLogin.py | 37 ++++++++++++++++++++++++++++--------- 1 files changed, 28 insertions(+), 9 deletions(-) diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFeastLogin.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFeastLogin.py index ea11272..fbcc757 100644 --- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFeastLogin.py +++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFeastLogin.py @@ -25,7 +25,6 @@ import NetPackCommon import GameWorld import ChConfig -import ChPlayer def OnPlayerLogin(curPlayer): isReset = __CheckPlayerFeastLoginAction(curPlayer) @@ -33,6 +32,7 @@ actInfo = PyGameData.g_operationActionDict.get(ShareDefine.OperationActionName_FeastLogin, {}) # 活动中同步活动信息 if actInfo.get(ShareDefine.ActKey_State): + __SetLoginByDayIndex(curPlayer, actInfo) Sync_FeastLoginActionInfo(curPlayer) Sync_FeastLoginPlayerInfo(curPlayer) return @@ -60,14 +60,31 @@ # 活动ID 相同的话不处理 if actID == playerActID: GameWorld.DebugLog("节日登录活动ID不变,不处理!", curPlayer.GetPlayerID()) + if state: + if __SetLoginByDayIndex(curPlayer, actInfo): + Sync_FeastLoginPlayerInfo(curPlayer) return GameWorld.DebugLog("节日登录活动重置! actID=%s,playerActID=%s,state=%s" % (actID, playerActID, state), playerID) PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FeastLoginID, actID) + PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FeastLoginState, 0) PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FeastLoginAwardState, 0) - Sync_FeastLoginActionInfo(curPlayer) - Sync_FeastLoginPlayerInfo(curPlayer) + if state: + __SetLoginByDayIndex(curPlayer, actInfo) + Sync_FeastLoginActionInfo(curPlayer) + Sync_FeastLoginPlayerInfo(curPlayer) + return True + +def __SetLoginByDayIndex(curPlayer, actInfo): + ## 设置某一天已登录,可领奖 + dayIndex = actInfo.get(ShareDefine.ActKey_DayIndex, 0) + loginState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FeastLoginState) + if loginState & pow(2, dayIndex): + return + updLoginState = loginState | pow(2, dayIndex) + PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FeastLoginState, updLoginState) + GameWorld.DebugLog(" 节日登录设置天登录: dayIndex=%s,loginState=%s,updLoginState=%s" % (dayIndex, loginState, updLoginState)) return True def GetFeastLoginAward(curPlayer, dayNum): @@ -107,14 +124,14 @@ return awardIndex = dayNum - 1 - dayIndex = actInfo.get(ShareDefine.ActKey_DayIndex) - if awardIndex != dayIndex: - GameWorld.DebugLog("非当天奖励,不可领奖! dayNum=%s, awardIndex=%s != dayIndex=%s" % (dayNum, awardIndex, dayIndex)) + loginState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FeastLoginState) + if not loginState & pow(2, awardIndex): + GameWorld.DebugLog("节日登录活动该天未登录,无法领奖!dayNum=%s,awardIndex=%s,loginState=%s" % (dayNum, awardIndex, loginState)) return awardRecord = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FeastLoginAwardState) if awardRecord & pow(2, awardIndex): - GameWorld.DebugLog("节日登录活动该天已领奖!dayNum=%s" % dayNum) + GameWorld.DebugLog("节日登录活动该天已领奖!dayNum=%s,awardIndex=%s,awardRecord=%s" % (dayNum, awardIndex, awardRecord)) return awardItemList = findIpyData.GetLoginAwardItemList() @@ -135,8 +152,10 @@ def Sync_FeastLoginPlayerInfo(curPlayer): ## 通知活动玩家信息 - awardState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FeastLoginAwardState) - ChPlayer.Sync_RewardGetRecordInfo(curPlayer, ChConfig.Def_RewardType_FeastLogin, awardState) + clientPack = ChPyNetSendPack.tagMCFeastLoginPlayerInfo() + clientPack.LoginState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FeastLoginState) + clientPack.LoginAward = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FeastLoginAwardState) + NetPackCommon.SendFakePack(curPlayer, clientPack) return def Sync_FeastLoginActionInfo(curPlayer): -- Gitblit v1.8.0