| | |
| | | import NetPackCommon
|
| | | import GameWorld
|
| | | import ChConfig
|
| | | import ChPlayer
|
| | |
|
| | | def OnPlayerLogin(curPlayer):
|
| | | isReset = __CheckPlayerFeastLoginAction(curPlayer)
|
| | |
| | | actInfo = PyGameData.g_operationActionDict.get(ShareDefine.OperationActionName_FeastLogin, {})
|
| | | # 活动中同步活动信息
|
| | | if actInfo.get(ShareDefine.ActKey_State):
|
| | | __SetLoginByDayIndex(curPlayer, actInfo)
|
| | | Sync_FeastLoginActionInfo(curPlayer)
|
| | | Sync_FeastLoginPlayerInfo(curPlayer)
|
| | | return
|
| | |
| | | # 活动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):
|
| | |
| | | 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()
|
| | |
| | |
|
| | | 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):
|