8835 【BT2】【主干】【后端】Part3-2 5)新增多日连充(领奖记录支持多个值)
| | |
| | | ActNum = 0 #(BYTE ActNum)//活动编号
|
| | | Days = 0 #(BYTE Days)
|
| | | DayRechargeValues = list() #(vector<DWORD> DayRechargeValues)//活动每天充值列表
|
| | | AwardRecord = 0 #(DWORD AwardRecord)//奖励领奖记录,按奖励索引二进制位存储是否已领取
|
| | | RecordCount = 0 #(BYTE RecordCount)
|
| | | AwardRecord = list() #(vector<DWORD> AwardRecord)//奖励领奖记录,按奖励索引二进制位存储是否已领取
|
| | | data = None
|
| | |
|
| | | def __init__(self):
|
| | |
| | | for i in range(self.Days):
|
| | | value,_pos=CommFunc.ReadDWORD(_lpData,_pos)
|
| | | self.DayRechargeValues.append(value)
|
| | | self.AwardRecord,_pos = CommFunc.ReadDWORD(_lpData, _pos)
|
| | | self.RecordCount,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | for i in range(self.RecordCount):
|
| | | value,_pos=CommFunc.ReadDWORD(_lpData,_pos)
|
| | | self.AwardRecord.append(value)
|
| | | return _pos
|
| | |
|
| | | def Clear(self):
|
| | |
| | | self.ActNum = 0
|
| | | self.Days = 0
|
| | | self.DayRechargeValues = list()
|
| | | self.AwardRecord = 0
|
| | | self.RecordCount = 0
|
| | | self.AwardRecord = list()
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | |
| | | length += 1
|
| | | length += 1
|
| | | length += 4 * self.Days
|
| | | length += 4
|
| | | length += 1
|
| | | length += 4 * self.RecordCount
|
| | |
|
| | | return length
|
| | |
|
| | |
| | | data = CommFunc.WriteBYTE(data, self.Days)
|
| | | for i in range(self.Days):
|
| | | data = CommFunc.WriteDWORD(data, self.DayRechargeValues[i])
|
| | | data = CommFunc.WriteDWORD(data, self.AwardRecord)
|
| | | data = CommFunc.WriteBYTE(data, self.RecordCount)
|
| | | for i in range(self.RecordCount):
|
| | | data = CommFunc.WriteDWORD(data, self.AwardRecord[i])
|
| | | return data
|
| | |
|
| | | def OutputString(self):
|
| | |
| | | ActNum:%d,
|
| | | Days:%d,
|
| | | DayRechargeValues:%s,
|
| | | AwardRecord:%d
|
| | | RecordCount:%d,
|
| | | AwardRecord:%s
|
| | | '''\
|
| | | %(
|
| | | self.Head.OutputString(),
|
| | | self.ActNum,
|
| | | self.Days,
|
| | | "...",
|
| | | self.AwardRecord
|
| | | self.RecordCount,
|
| | | "..."
|
| | | )
|
| | | return DumpString
|
| | |
|
| | |
| | | Def_PDict_ManyDayRechargeTempID = "ManyDayRechargeTempID_%s" # 玩家身上的模板ID,参数:(活动编号)
|
| | | Def_PDict_ManyDayRechargeWorldLV = "ManyDayRechargeWorldLV_%s" #玩家身上的活动世界等级,参数:(活动编号)
|
| | | Def_PDict_ManyDayRechargeValue = "ManyDayRechargeValue_%s_%s" # 每日累充总额,参数:(活动编号, 天索引)
|
| | | Def_PDict_ManyDayRechargeAward = "ManyDayRechargeAward_%s" # 领奖记录,参数:(活动编号)
|
| | | Def_PDict_ManyDayRechargeAward = "ManyDayRechargeAward_%s_%s" # 领奖记录,参数:(活动编号, key编号)
|
| | | #-------------------------------------------------------------------------------
|
| | |
|
| | | #开服活动,Def_PDictType_OpenServerCampaign
|
| | |
| | | ActNum = 0 #(BYTE ActNum)//活动编号
|
| | | Days = 0 #(BYTE Days)
|
| | | DayRechargeValues = list() #(vector<DWORD> DayRechargeValues)//活动每天充值列表
|
| | | AwardRecord = 0 #(DWORD AwardRecord)//奖励领奖记录,按奖励索引二进制位存储是否已领取
|
| | | RecordCount = 0 #(BYTE RecordCount)
|
| | | AwardRecord = list() #(vector<DWORD> AwardRecord)//奖励领奖记录,按奖励索引二进制位存储是否已领取
|
| | | data = None
|
| | |
|
| | | def __init__(self):
|
| | |
| | | for i in range(self.Days):
|
| | | value,_pos=CommFunc.ReadDWORD(_lpData,_pos)
|
| | | self.DayRechargeValues.append(value)
|
| | | self.AwardRecord,_pos = CommFunc.ReadDWORD(_lpData, _pos)
|
| | | self.RecordCount,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | for i in range(self.RecordCount):
|
| | | value,_pos=CommFunc.ReadDWORD(_lpData,_pos)
|
| | | self.AwardRecord.append(value)
|
| | | return _pos
|
| | |
|
| | | def Clear(self):
|
| | |
| | | self.ActNum = 0
|
| | | self.Days = 0
|
| | | self.DayRechargeValues = list()
|
| | | self.AwardRecord = 0
|
| | | self.RecordCount = 0
|
| | | self.AwardRecord = list()
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | |
| | | length += 1
|
| | | length += 1
|
| | | length += 4 * self.Days
|
| | | length += 4
|
| | | length += 1
|
| | | length += 4 * self.RecordCount
|
| | |
|
| | | return length
|
| | |
|
| | |
| | | data = CommFunc.WriteBYTE(data, self.Days)
|
| | | for i in range(self.Days):
|
| | | data = CommFunc.WriteDWORD(data, self.DayRechargeValues[i])
|
| | | data = CommFunc.WriteDWORD(data, self.AwardRecord)
|
| | | data = CommFunc.WriteBYTE(data, self.RecordCount)
|
| | | for i in range(self.RecordCount):
|
| | | data = CommFunc.WriteDWORD(data, self.AwardRecord[i])
|
| | | return data
|
| | |
|
| | | def OutputString(self):
|
| | |
| | | ActNum:%d,
|
| | | Days:%d,
|
| | | DayRechargeValues:%s,
|
| | | AwardRecord:%d
|
| | | RecordCount:%d,
|
| | | AwardRecord:%s
|
| | | '''\
|
| | | %(
|
| | | self.Head.OutputString(),
|
| | | self.ActNum,
|
| | | self.Days,
|
| | | "...",
|
| | | self.AwardRecord
|
| | | self.RecordCount,
|
| | | "..."
|
| | | )
|
| | | return DumpString
|
| | |
|
| | |
| | | import CommFunc
|
| | |
|
| | | Max_ActDays = 7 # 支持最大活动持续天
|
| | | Max_AwardKeyNum = 3 # 支持最大领奖记录key数
|
| | |
|
| | | def GetTemplateID(cfgID):
|
| | | if not cfgID:
|
| | |
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ManyDayRechargeID % actNum, actID)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ManyDayRechargeTempID % actNum, templateID)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ManyDayRechargeWorldLV % actNum, actWorldLV)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ManyDayRechargeAward % actNum, 0)
|
| | | for i in xrange(Max_AwardKeyNum):
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ManyDayRechargeAward % (actNum, i), 0)
|
| | | for dayIndex in xrange(Max_ActDays):
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ManyDayRechargeValue % (actNum, dayIndex), 0)
|
| | |
|
| | |
| | |
|
| | | playerID = curPlayer.GetPlayerID()
|
| | | batchPlayerIDList, batchAddItemList, batchParamList = [], [], []
|
| | | awardRecord = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ManyDayRechargeAward % actNum)
|
| | |
|
| | | for ipyData in ipyDataList:
|
| | | awardIndex = ipyData.GetAwardIndex()
|
| | | if awardRecord & pow(2, awardIndex):
|
| | | if GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_PDict_ManyDayRechargeAward, awardIndex, True, [actNum]):
|
| | | continue
|
| | |
|
| | | needRechargeValue = CommFunc.RMBToCoin(ipyData.GetNeedRMB())
|
| | |
| | | if finishDays < needDays:
|
| | | continue
|
| | |
|
| | | awardRecord |= pow(2, awardIndex) |
| | | GameWorld.SetDictValueByBit(curPlayer, ChConfig.Def_PDict_ManyDayRechargeAward, awardIndex, 1, True, [actNum])
|
| | | awardItemList = GameWorld.GetDictValueByRangeKey(ipyData.GetAwardItemInfo(), playerWorldLV, [])
|
| | |
|
| | | batchPlayerIDList.append([playerID])
|
| | |
| | | GameWorld.Log("多日连充活动补发奖励! actNum=%s,playerTemplateID=%s,awardIndex=%s" % (actNum, playerTemplateID, awardIndex))
|
| | |
|
| | | if batchPlayerIDList:
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ManyDayRechargeAward % actNum, awardRecord)
|
| | | actType = actNum / 10
|
| | | PlayerControl.SendMailBatch("ManyDayRechargeMail%s" % actType, batchPlayerIDList, batchAddItemList, batchParamList)
|
| | |
|
| | |
| | | GameWorld.DebugLog("该多日连充活动非活动中,无法领奖!actNum=%s,state=%s,templateID=%s" % (actNum, state, templateID), playerID)
|
| | | return
|
| | |
|
| | | awardRecord = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ManyDayRechargeAward % actNum)
|
| | | if awardRecord & pow(2, awardIndex):
|
| | | if GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_PDict_ManyDayRechargeAward, awardIndex, True, [actNum]):
|
| | | GameWorld.DebugLog("已经领取过该多日连充活动奖励! actNum=%s,awardIndex=%s" % (actNum, awardIndex), playerID)
|
| | | return
|
| | |
|
| | |
| | | if not ItemControler.CheckPackSpaceEnough(curPlayer, awardItemList):
|
| | | return
|
| | |
|
| | | awardRecord |= pow(2, awardIndex)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ManyDayRechargeAward % actNum, awardRecord)
|
| | | GameWorld.SetDictValueByBit(curPlayer, ChConfig.Def_PDict_ManyDayRechargeAward, awardIndex, 1, True, [actNum])
|
| | | Sync_ManyDayRechargePlayerInfo(curPlayer, actNum)
|
| | |
|
| | | notifyKey = awardIpyData.GetNotifyKey()
|
| | |
| | | rechargeValue = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ManyDayRechargeValue % (actNum, dayIndex))
|
| | | playerActInfo.DayRechargeValues.append(rechargeValue)
|
| | | playerActInfo.Days = len(playerActInfo.DayRechargeValues)
|
| | | playerActInfo.AwardRecord = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ManyDayRechargeAward % actNum)
|
| | | for i in xrange(Max_AwardKeyNum):
|
| | | playerActInfo.AwardRecord.append(curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ManyDayRechargeAward % (actNum, i)))
|
| | | playerActInfo.RecordCount = len(playerActInfo.AwardRecord)
|
| | | NetPackCommon.SendFakePack(curPlayer, playerActInfo)
|
| | | return
|
| | |
|