| | |
| | | # B2 22 砍树装备操作 #tagCMCutTreeEquipOP
|
| | |
|
| | | class tagCMCutTreeEquipOP(Structure):
|
| | | _pack_ = 1
|
| | | _fields_ = [
|
| | | ("Cmd", c_ubyte),
|
| | | ("SubCmd", c_ubyte),
|
| | | ("ItemIndex", c_ubyte), # 物品在砍树背包的索引
|
| | | ("OPType", c_ubyte), # 操作类型:1-替换;2-分解
|
| | | ("AutoDecompose", c_ubyte), # 替换后是否自动分解原装备:0否1是,仅替换操作下有用
|
| | | ]
|
| | | Head = tagHead()
|
| | | IndexCount = 0 #(BYTE IndexCount)
|
| | | ItemIndexList = list() #(vector<BYTE> ItemIndexList)// 物品在砍树背包的索引列表
|
| | | OPType = 0 #(BYTE OPType)// 操作类型:1-替换;2-分解
|
| | | AutoDecompose = 0 #(BYTE AutoDecompose)// 替换后是否自动分解原装备:0否1是,仅替换操作下有用
|
| | | data = None
|
| | |
|
| | | def __init__(self):
|
| | | self.Clear()
|
| | | self.Cmd = 0xB2
|
| | | self.SubCmd = 0x22
|
| | | self.Head.Cmd = 0xB2
|
| | | self.Head.SubCmd = 0x22
|
| | | return
|
| | |
|
| | | def ReadData(self, stringData, _pos=0, _len=0):
|
| | | def ReadData(self, _lpData, _pos=0, _Len=0):
|
| | | self.Clear()
|
| | | memmove(addressof(self), stringData[_pos:], self.GetLength())
|
| | | return _pos + self.GetLength()
|
| | | _pos = self.Head.ReadData(_lpData, _pos)
|
| | | self.IndexCount,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | for i in range(self.IndexCount):
|
| | | value,_pos=CommFunc.ReadBYTE(_lpData,_pos)
|
| | | self.ItemIndexList.append(value)
|
| | | self.OPType,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | self.AutoDecompose,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | return _pos
|
| | |
|
| | | def Clear(self):
|
| | | self.Cmd = 0xB2
|
| | | self.SubCmd = 0x22
|
| | | self.ItemIndex = 0
|
| | | self.Head = tagHead()
|
| | | self.Head.Clear()
|
| | | self.Head.Cmd = 0xB2
|
| | | self.Head.SubCmd = 0x22
|
| | | self.IndexCount = 0
|
| | | self.ItemIndexList = list()
|
| | | self.OPType = 0
|
| | | self.AutoDecompose = 0
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | | return sizeof(tagCMCutTreeEquipOP)
|
| | | length = 0
|
| | | length += self.Head.GetLength()
|
| | | length += 1
|
| | | length += 1 * self.IndexCount
|
| | | length += 1
|
| | | length += 1
|
| | |
|
| | | return length
|
| | |
|
| | | def GetBuffer(self):
|
| | | return string_at(addressof(self), self.GetLength())
|
| | | data = ''
|
| | | data = CommFunc.WriteString(data, self.Head.GetLength(), self.Head.GetBuffer())
|
| | | data = CommFunc.WriteBYTE(data, self.IndexCount)
|
| | | for i in range(self.IndexCount):
|
| | | data = CommFunc.WriteBYTE(data, self.ItemIndexList[i])
|
| | | data = CommFunc.WriteBYTE(data, self.OPType)
|
| | | data = CommFunc.WriteBYTE(data, self.AutoDecompose)
|
| | | return data
|
| | |
|
| | | def OutputString(self):
|
| | | DumpString = '''// B2 22 砍树装备操作 //tagCMCutTreeEquipOP:
|
| | | Cmd:%s,
|
| | | SubCmd:%s,
|
| | | ItemIndex:%d,
|
| | | DumpString = '''
|
| | | Head:%s,
|
| | | IndexCount:%d,
|
| | | ItemIndexList:%s,
|
| | | OPType:%d,
|
| | | AutoDecompose:%d
|
| | | '''\
|
| | | %(
|
| | | self.Cmd,
|
| | | self.SubCmd,
|
| | | self.ItemIndex,
|
| | | self.Head.OutputString(),
|
| | | self.IndexCount,
|
| | | "...",
|
| | | self.OPType,
|
| | | self.AutoDecompose
|
| | | )
|
| | |
| | |
|
| | |
|
| | | m_NAtagCMCutTreeEquipOP=tagCMCutTreeEquipOP()
|
| | | ChNetPackDict[eval("0x%02x%02x"%(m_NAtagCMCutTreeEquipOP.Cmd,m_NAtagCMCutTreeEquipOP.SubCmd))] = m_NAtagCMCutTreeEquipOP
|
| | | ChNetPackDict[eval("0x%02x%02x"%(m_NAtagCMCutTreeEquipOP.Head.Cmd,m_NAtagCMCutTreeEquipOP.Head.SubCmd))] = m_NAtagCMCutTreeEquipOP
|
| | |
|
| | |
|
| | | #------------------------------------------------------
|