| | |
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | | # B1 20 战令信息 #tagMCZhanlingInfo
|
| | |
|
| | | class tagMCZhanling(Structure):
|
| | | _pack_ = 1
|
| | | _fields_ = [
|
| | | ("NeedValue", c_int), # 奖励所需值
|
| | | ("FreeRewardState", c_ubyte), # 免费奖励是否已领取
|
| | | ("ZLRewardState", c_ubyte), # 战令奖励是否已领取
|
| | | ]
|
| | |
|
| | | def __init__(self):
|
| | | self.Clear()
|
| | | 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.NeedValue = 0
|
| | | self.FreeRewardState = 0
|
| | | self.ZLRewardState = 0
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | | return sizeof(tagMCZhanling)
|
| | |
|
| | | def GetBuffer(self):
|
| | | return string_at(addressof(self), self.GetLength())
|
| | |
|
| | | def OutputString(self):
|
| | | DumpString = '''// B1 20 战令信息 //tagMCZhanlingInfo:
|
| | | NeedValue:%d,
|
| | | FreeRewardState:%d,
|
| | | ZLRewardState:%d
|
| | | '''\
|
| | | %(
|
| | | self.NeedValue,
|
| | | self.FreeRewardState,
|
| | | self.ZLRewardState
|
| | | )
|
| | | return DumpString
|
| | |
|
| | |
|
| | | class tagMCZhanlingInfo(Structure):
|
| | | Head = tagHead()
|
| | | ZhanlingType = 0 #(BYTE ZhanlingType)// 战令类型
|
| | | IsActivite = 0 #(BYTE IsActivite)// 是否已激活
|
| | | RewardCount = 0 #(WORD RewardCount)
|
| | | RewardList = list() #(vector<tagMCZhanling> RewardList)
|
| | | data = None
|
| | |
|
| | | def __init__(self):
|
| | | self.Clear()
|
| | | self.Head.Cmd = 0xB1
|
| | | self.Head.SubCmd = 0x20
|
| | | return
|
| | |
|
| | | def ReadData(self, _lpData, _pos=0, _Len=0):
|
| | | self.Clear()
|
| | | _pos = self.Head.ReadData(_lpData, _pos)
|
| | | self.ZhanlingType,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | self.IsActivite,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | self.RewardCount,_pos = CommFunc.ReadWORD(_lpData, _pos)
|
| | | for i in range(self.RewardCount):
|
| | | temRewardList = tagMCZhanling()
|
| | | _pos = temRewardList.ReadData(_lpData, _pos)
|
| | | self.RewardList.append(temRewardList)
|
| | | return _pos
|
| | |
|
| | | def Clear(self):
|
| | | self.Head = tagHead()
|
| | | self.Head.Clear()
|
| | | self.Head.Cmd = 0xB1
|
| | | self.Head.SubCmd = 0x20
|
| | | self.ZhanlingType = 0
|
| | | self.IsActivite = 0
|
| | | self.RewardCount = 0
|
| | | self.RewardList = list()
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | | length = 0
|
| | | length += self.Head.GetLength()
|
| | | length += 1
|
| | | length += 1
|
| | | length += 2
|
| | | for i in range(self.RewardCount):
|
| | | length += self.RewardList[i].GetLength()
|
| | |
|
| | | return length
|
| | |
|
| | | def GetBuffer(self):
|
| | | data = ''
|
| | | data = CommFunc.WriteString(data, self.Head.GetLength(), self.Head.GetBuffer())
|
| | | data = CommFunc.WriteBYTE(data, self.ZhanlingType)
|
| | | data = CommFunc.WriteBYTE(data, self.IsActivite)
|
| | | data = CommFunc.WriteWORD(data, self.RewardCount)
|
| | | for i in range(self.RewardCount):
|
| | | data = CommFunc.WriteString(data, self.RewardList[i].GetLength(), self.RewardList[i].GetBuffer())
|
| | | return data
|
| | |
|
| | | def OutputString(self):
|
| | | DumpString = '''
|
| | | Head:%s,
|
| | | ZhanlingType:%d,
|
| | | IsActivite:%d,
|
| | | RewardCount:%d,
|
| | | RewardList:%s
|
| | | '''\
|
| | | %(
|
| | | self.Head.OutputString(),
|
| | | self.ZhanlingType,
|
| | | self.IsActivite,
|
| | | self.RewardCount,
|
| | | "..."
|
| | | )
|
| | | return DumpString
|
| | |
|
| | |
|
| | | m_NAtagMCZhanlingInfo=tagMCZhanlingInfo()
|
| | | ChNetPackDict[eval("0x%02x%02x"%(m_NAtagMCZhanlingInfo.Head.Cmd,m_NAtagMCZhanlingInfo.Head.SubCmd))] = m_NAtagMCZhanlingInfo
|
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | | # B2 08 获得仙缘币信息 #tagMCAddXianyuanCoinMsg
|
| | |
|
| | | class tagMCAddXianyuanCoinMsg(Structure):
|