8716 【主干】【后端】【BT2】H.活动-节日祈愿(节日登录优化已登录天不限制领取天);
| | |
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | | # AA 39 节日登录奖励活动玩家信息 #tagMCFeastLoginPlayerInfo
|
| | |
|
| | | class tagMCFeastLoginPlayerInfo(Structure):
|
| | | _pack_ = 1
|
| | | _fields_ = [
|
| | | ("Cmd", c_ubyte),
|
| | | ("SubCmd", c_ubyte),
|
| | | ("LoginState", c_int), # 是否已登录,按天索引0代表第1天记录当天是否已登录
|
| | | ("LoginAward", c_int), # 是否已领取,按天索引0代表第1天记录当天是否已领取
|
| | | ]
|
| | |
|
| | | def __init__(self):
|
| | | self.Clear()
|
| | | self.Cmd = 0xAA
|
| | | self.SubCmd = 0x39
|
| | | return
|
| | |
|
| | | def ReadData(self, stringData, _pos=0, _len=0):
|
| | | self.Clear()
|
| | | memmove(addressof(self), stringData[_pos:], self.GetLength())
|
| | | return _pos + self.GetLength()
|
| | |
|
| | | def Clear(self):
|
| | | self.Cmd = 0xAA
|
| | | self.SubCmd = 0x39
|
| | | self.LoginState = 0
|
| | | self.LoginAward = 0
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | | return sizeof(tagMCFeastLoginPlayerInfo)
|
| | |
|
| | | def GetBuffer(self):
|
| | | return string_at(addressof(self), self.GetLength())
|
| | |
|
| | | def OutputString(self):
|
| | | DumpString = '''// AA 39 节日登录奖励活动玩家信息 //tagMCFeastLoginPlayerInfo:
|
| | | Cmd:%s,
|
| | | SubCmd:%s,
|
| | | LoginState:%d,
|
| | | LoginAward:%d
|
| | | '''\
|
| | | %(
|
| | | self.Cmd,
|
| | | self.SubCmd,
|
| | | self.LoginState,
|
| | | self.LoginAward
|
| | | )
|
| | | return DumpString
|
| | |
|
| | |
|
| | | m_NAtagMCFeastLoginPlayerInfo=tagMCFeastLoginPlayerInfo()
|
| | | ChNetPackDict[eval("0x%02x%02x"%(m_NAtagMCFeastLoginPlayerInfo.Cmd,m_NAtagMCFeastLoginPlayerInfo.SubCmd))] = m_NAtagMCFeastLoginPlayerInfo
|
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | | # AA 46 节日游历活动信息 #tagMCFeastTravelInfo
|
| | |
|
| | | class tagMCFeastTravelAwardItem(Structure):
|
| | |
| | |
|
| | | #节日登录活动
|
| | | Def_PDict_FeastLoginID = "FeastLoginID" # 玩家身上的活动ID,唯一标识,取活动开始日期time值
|
| | | Def_PDict_FeastLoginState = "FeastLoginState" # 活动登录记录,按天编号-1为索引进行二进制位运算记录当天是否已登录
|
| | | Def_PDict_FeastLoginAwardState = "FeastLoginAwardState" # 活动登录领奖记录,按天编号-1为索引进行二进制位运算记录当天是否已领奖
|
| | |
|
| | | #节日祝福活动
|
| | |
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | | # AA 39 节日登录奖励活动玩家信息 #tagMCFeastLoginPlayerInfo
|
| | |
|
| | | class tagMCFeastLoginPlayerInfo(Structure):
|
| | | _pack_ = 1
|
| | | _fields_ = [
|
| | | ("Cmd", c_ubyte),
|
| | | ("SubCmd", c_ubyte),
|
| | | ("LoginState", c_int), # 是否已登录,按天索引0代表第1天记录当天是否已登录
|
| | | ("LoginAward", c_int), # 是否已领取,按天索引0代表第1天记录当天是否已领取
|
| | | ]
|
| | |
|
| | | def __init__(self):
|
| | | self.Clear()
|
| | | self.Cmd = 0xAA
|
| | | self.SubCmd = 0x39
|
| | | return
|
| | |
|
| | | def ReadData(self, stringData, _pos=0, _len=0):
|
| | | self.Clear()
|
| | | memmove(addressof(self), stringData[_pos:], self.GetLength())
|
| | | return _pos + self.GetLength()
|
| | |
|
| | | def Clear(self):
|
| | | self.Cmd = 0xAA
|
| | | self.SubCmd = 0x39
|
| | | self.LoginState = 0
|
| | | self.LoginAward = 0
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | | return sizeof(tagMCFeastLoginPlayerInfo)
|
| | |
|
| | | def GetBuffer(self):
|
| | | return string_at(addressof(self), self.GetLength())
|
| | |
|
| | | def OutputString(self):
|
| | | DumpString = '''// AA 39 节日登录奖励活动玩家信息 //tagMCFeastLoginPlayerInfo:
|
| | | Cmd:%s,
|
| | | SubCmd:%s,
|
| | | LoginState:%d,
|
| | | LoginAward:%d
|
| | | '''\
|
| | | %(
|
| | | self.Cmd,
|
| | | self.SubCmd,
|
| | | self.LoginState,
|
| | | self.LoginAward
|
| | | )
|
| | | return DumpString
|
| | |
|
| | |
|
| | | m_NAtagMCFeastLoginPlayerInfo=tagMCFeastLoginPlayerInfo()
|
| | | ChNetPackDict[eval("0x%02x%02x"%(m_NAtagMCFeastLoginPlayerInfo.Cmd,m_NAtagMCFeastLoginPlayerInfo.SubCmd))] = m_NAtagMCFeastLoginPlayerInfo
|
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | | # AA 46 节日游历活动信息 #tagMCFeastTravelInfo
|
| | |
|
| | | class tagMCFeastTravelAwardItem(Structure):
|
| | |
| | | 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)
|
| | |
|
| | | 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):
|