8299 【恺英】【开发】新增每日直购(增加每日免费直购礼包领取支持)
| | |
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | | # AA 24 每日免费直购礼包信息 #tagMCDayFreeGoldGiftState
|
| | |
|
| | | class tagMCDayFreeGoldGiftState(Structure):
|
| | | _pack_ = 1
|
| | | _fields_ = [
|
| | | ("Cmd", c_ubyte),
|
| | | ("SubCmd", c_ubyte),
|
| | | ("DayFreeGoldGiftState", c_ubyte), #每日免费直购礼包是否已领奖 0-未领 1-已领
|
| | | ]
|
| | |
|
| | | def __init__(self):
|
| | | self.Clear()
|
| | | self.Cmd = 0xAA
|
| | | self.SubCmd = 0x24
|
| | | 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 = 0x24
|
| | | self.DayFreeGoldGiftState = 0
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | | return sizeof(tagMCDayFreeGoldGiftState)
|
| | |
|
| | | def GetBuffer(self):
|
| | | return string_at(addressof(self), self.GetLength())
|
| | |
|
| | | def OutputString(self):
|
| | | DumpString = '''// AA 24 每日免费直购礼包信息 //tagMCDayFreeGoldGiftState:
|
| | | Cmd:%s,
|
| | | SubCmd:%s,
|
| | | DayFreeGoldGiftState:%d
|
| | | '''\
|
| | | %(
|
| | | self.Cmd,
|
| | | self.SubCmd,
|
| | | self.DayFreeGoldGiftState
|
| | | )
|
| | | return DumpString
|
| | |
|
| | |
|
| | | m_NAtagMCDayFreeGoldGiftState=tagMCDayFreeGoldGiftState()
|
| | | ChNetPackDict[eval("0x%02x%02x"%(m_NAtagMCDayFreeGoldGiftState.Cmd,m_NAtagMCDayFreeGoldGiftState.SubCmd))] = m_NAtagMCDayFreeGoldGiftState
|
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | | # AA 20 节日巡礼活动信息 #tagMCFeastWeekPartyInfo
|
| | |
|
| | | class tagMCFeastWeekPartyItem(Structure):
|
| | |
| | | Def_PDict_TodayCTGCoinTotal = "TodayCTGCoinTotal" # 当日充值Coin数
|
| | | Def_PDict_TodayCTGCount = "TodayCTGCount_%s" # 当日充值次数,参数(CTG对应的商品记录ID)
|
| | | Def_PDict_CTGGoodsBuyCount = "CTGGoodsBuyCount_%s" # 对应充值商品已购买次数,参数(CTG对应的商品记录ID)
|
| | | Def_PDict_DayFreeGoldGiftState = "DayFreeGoldGiftState" # 每日免费直购礼包领取记录
|
| | | Def_PDict_GoldGiftFirstRecord = "GoldGiftFirstRecord" # 首充领取记录,0-未领取;1-已领取
|
| | | Def_PDict_FirstGoldRemainTime = "FirstGoldRemainTime" # 首充提示剩余时间
|
| | | Def_PDict_FirstGoldTipStartTime = "FirstGoldTipStartTime" # 首充提示开始时间
|
| | |
| | | Def_RewardType_FeastWeekPartyPoint, # 领取节日巡礼积分奖励26
|
| | | Def_RewardType_FairyAdventuresAward, #缥缈奇遇领取27
|
| | | Def_RewardType_HistoryChargeAward, #历史累计充值领取28
|
| | | )= range(29)
|
| | | Def_RewardType_DayFreeGoldGift, #每日免费直购礼包29
|
| | | )= range(30)
|
| | |
|
| | |
|
| | | #boss复活相关活动定义
|
| | |
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | | # AA 24 每日免费直购礼包信息 #tagMCDayFreeGoldGiftState
|
| | |
|
| | | class tagMCDayFreeGoldGiftState(Structure):
|
| | | _pack_ = 1
|
| | | _fields_ = [
|
| | | ("Cmd", c_ubyte),
|
| | | ("SubCmd", c_ubyte),
|
| | | ("DayFreeGoldGiftState", c_ubyte), #每日免费直购礼包是否已领奖 0-未领 1-已领
|
| | | ]
|
| | |
|
| | | def __init__(self):
|
| | | self.Clear()
|
| | | self.Cmd = 0xAA
|
| | | self.SubCmd = 0x24
|
| | | 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 = 0x24
|
| | | self.DayFreeGoldGiftState = 0
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | | return sizeof(tagMCDayFreeGoldGiftState)
|
| | |
|
| | | def GetBuffer(self):
|
| | | return string_at(addressof(self), self.GetLength())
|
| | |
|
| | | def OutputString(self):
|
| | | DumpString = '''// AA 24 每日免费直购礼包信息 //tagMCDayFreeGoldGiftState:
|
| | | Cmd:%s,
|
| | | SubCmd:%s,
|
| | | DayFreeGoldGiftState:%d
|
| | | '''\
|
| | | %(
|
| | | self.Cmd,
|
| | | self.SubCmd,
|
| | | self.DayFreeGoldGiftState
|
| | | )
|
| | | return DumpString
|
| | |
|
| | |
|
| | | m_NAtagMCDayFreeGoldGiftState=tagMCDayFreeGoldGiftState()
|
| | | ChNetPackDict[eval("0x%02x%02x"%(m_NAtagMCDayFreeGoldGiftState.Cmd,m_NAtagMCDayFreeGoldGiftState.SubCmd))] = m_NAtagMCDayFreeGoldGiftState
|
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | | # AA 20 节日巡礼活动信息 #tagMCFeastWeekPartyInfo
|
| | |
|
| | | class tagMCFeastWeekPartyItem(Structure):
|
| | |
| | | resultName, len(resultName))
|
| | | return
|
| | |
|
| | | ## //A5 04 玩家领取奖励 # tagCMPlayerGetReward
|
| | | ## 领取奖励
|
| | | # @param None None
|
| | | # @return None
|
| | | #//A5 04 玩家领取奖励 #tagCMPlayerGetReward
|
| | | #
|
| | | #struct tagCMPlayerGetReward
|
| | | #
|
| | | #{
|
| | | # tagHead Head;
|
| | | # BYTE RewardType; //奖励类型
|
| | | # DWORD DataEx; //附带信息
|
| | | # BYTE DataExStrLen; //附加字符信息长度
|
| | | # char DataExStr[DataExStrLen]; //附加字符信息
|
| | | #};
|
| | | def PlayerGetReward(index, clientData, tick):
|
| | | playerManager = GameWorld.GetPlayerManager()
|
| | | curPlayer = playerManager.GetPlayerByIndex(index)
|
| | |
| | | # 活跃度奖励
|
| | | if rewardType == ChConfig.Def_RewardType_Activity:
|
| | | PlayerActivity.GetActivityAward(curPlayer, dataEx)
|
| | | # 每日免费直购礼包
|
| | | elif rewardType == ChConfig.Def_RewardType_DayFreeGoldGift:
|
| | | PlayerCoin.OnGetDayFreeGoldGift(curPlayer)
|
| | | # 仙盟活跃度奖励
|
| | | elif rewardType == ChConfig.Def_RewardType_FamilyActivity:
|
| | | PlayerFamily.GetFamilyActivityAward(curPlayer, dataEx)
|
| | |
| | | def OnLogin(curPlayer):
|
| | | if not DoResetCTGCountByTime(curPlayer):
|
| | | Sync_CoinToGoldCountInfo(curPlayer)
|
| | | if curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_DayFreeGoldGiftState):
|
| | | Sync_DayFreeGoldGiftState(curPlayer)
|
| | | return
|
| | |
|
| | | def DoResetCTGCountByTime(curPlayer):
|
| | |
| | | syncRecordIDList.append(recordID)
|
| | | if syncRecordIDList:
|
| | | Sync_CoinToGoldCountInfo(curPlayer, syncRecordIDList)
|
| | | |
| | | if curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_DayFreeGoldGiftState):
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_DayFreeGoldGiftState, 0)
|
| | | Sync_DayFreeGoldGiftState(curPlayer)
|
| | | return
|
| | |
|
| | | ## 创角赠送
|
| | |
| | | NetPackCommon.SendFakePack(curPlayer, countInfoPack)
|
| | | return
|
| | |
|
| | | ## ---------- 每日免费直购礼包 ----------------
|
| | |
|
| | | def OnGetDayFreeGoldGift(curPlayer):
|
| | | ''' 领取每日免费直购礼包
|
| | | '''
|
| | | |
| | | isGet = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_DayFreeGoldGiftState)
|
| | | if isGet:
|
| | | #GameWorld.DebugLog("已经领取过每日免费直购礼包!")
|
| | | return
|
| | | |
| | | rewardItemList = IpyGameDataPY.GetFuncEvalCfg("DayFreeGoldGift", 1)
|
| | | if not rewardItemList:
|
| | | return
|
| | | |
| | | needSpace = len(rewardItemList)
|
| | | packSpace = ItemCommon.GetItemPackSpace(curPlayer, IPY_GameWorld.rptItem, needSpace)
|
| | | if needSpace > packSpace:
|
| | | PlayerControl.NotifyCode(curPlayer, "GeRen_chenxin_998371")
|
| | | return
|
| | | |
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_DayFreeGoldGiftState, 1)
|
| | | |
| | | # 给物品
|
| | | isAuctionItem = False
|
| | | for itemID, itemCount in rewardItemList: |
| | | ItemControler.GivePlayerItem(curPlayer, itemID, itemCount, isAuctionItem, [IPY_GameWorld.rptItem])
|
| | | |
| | | # 通知客户端
|
| | | Sync_DayFreeGoldGiftState(curPlayer)
|
| | | return
|
| | |
|
| | | def Sync_DayFreeGoldGiftState(curPlayer):
|
| | | clientPack = ChPyNetSendPack.tagMCDayFreeGoldGiftState()
|
| | | clientPack.DayFreeGoldGiftState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_DayFreeGoldGiftState)
|
| | | NetPackCommon.SendFakePack(curPlayer, clientPack)
|
| | | return
|
| | |
|
| | | ## ------------------------------------------
|