|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #------------------------------------------------------ | 
|---|
|  |  |  | # AA 20 天帝礼包选择物品 #tagCMActGodGiftChooseItem | 
|---|
|  |  |  |  | 
|---|
|  |  |  | class  tagCMActGodGiftChooseItemInfo(Structure): | 
|---|
|  |  |  | ItemLibType = 0    #(BYTE ItemLibType)//物品库类型 | 
|---|
|  |  |  | Count = 0    #(BYTE Count)//选择个数 | 
|---|
|  |  |  | ItemNumList = list()    #(vector<BYTE> ItemNumList)//选择物品编号列表 | 
|---|
|  |  |  | data = None | 
|---|
|  |  |  |  | 
|---|
|  |  |  | def __init__(self): | 
|---|
|  |  |  | self.Clear() | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | def ReadData(self, _lpData, _pos=0, _Len=0): | 
|---|
|  |  |  | self.Clear() | 
|---|
|  |  |  | self.ItemLibType,_pos = CommFunc.ReadBYTE(_lpData, _pos) | 
|---|
|  |  |  | self.Count,_pos = CommFunc.ReadBYTE(_lpData, _pos) | 
|---|
|  |  |  | for i in range(self.Count): | 
|---|
|  |  |  | value,_pos=CommFunc.ReadBYTE(_lpData,_pos) | 
|---|
|  |  |  | self.ItemNumList.append(value) | 
|---|
|  |  |  | return _pos | 
|---|
|  |  |  |  | 
|---|
|  |  |  | def Clear(self): | 
|---|
|  |  |  | self.ItemLibType = 0 | 
|---|
|  |  |  | self.Count = 0 | 
|---|
|  |  |  | self.ItemNumList = list() | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | def GetLength(self): | 
|---|
|  |  |  | length = 0 | 
|---|
|  |  |  | length += 1 | 
|---|
|  |  |  | length += 1 | 
|---|
|  |  |  | length += 1 * self.Count | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return length | 
|---|
|  |  |  |  | 
|---|
|  |  |  | def GetBuffer(self): | 
|---|
|  |  |  | data = '' | 
|---|
|  |  |  | data = CommFunc.WriteBYTE(data, self.ItemLibType) | 
|---|
|  |  |  | data = CommFunc.WriteBYTE(data, self.Count) | 
|---|
|  |  |  | for i in range(self.Count): | 
|---|
|  |  |  | data = CommFunc.WriteBYTE(data, self.ItemNumList[i]) | 
|---|
|  |  |  | return data | 
|---|
|  |  |  |  | 
|---|
|  |  |  | def OutputString(self): | 
|---|
|  |  |  | DumpString = ''' | 
|---|
|  |  |  | ItemLibType:%d, | 
|---|
|  |  |  | Count:%d, | 
|---|
|  |  |  | ItemNumList:%s | 
|---|
|  |  |  | '''\ | 
|---|
|  |  |  | %( | 
|---|
|  |  |  | self.ItemLibType, | 
|---|
|  |  |  | self.Count, | 
|---|
|  |  |  | "..." | 
|---|
|  |  |  | ) | 
|---|
|  |  |  | return DumpString | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | class  tagCMActGodGiftChooseItem(Structure): | 
|---|
|  |  |  | Head = tagHead() | 
|---|
|  |  |  | ActNum = 0    #(BYTE ActNum)//活动编号 | 
|---|
|  |  |  | ChooseLibCount = 0    #(BYTE ChooseLibCount)//选择库个数 | 
|---|
|  |  |  | ChooseItemList = list()    #(vector<tagCMActGodGiftChooseItemInfo> ChooseItemList)//选择库物品信息列表 | 
|---|
|  |  |  | data = None | 
|---|
|  |  |  |  | 
|---|
|  |  |  | def __init__(self): | 
|---|
|  |  |  | self.Clear() | 
|---|
|  |  |  | self.Head.Cmd = 0xAA | 
|---|
|  |  |  | self.Head.SubCmd = 0x20 | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | def ReadData(self, _lpData, _pos=0, _Len=0): | 
|---|
|  |  |  | self.Clear() | 
|---|
|  |  |  | _pos = self.Head.ReadData(_lpData, _pos) | 
|---|
|  |  |  | self.ActNum,_pos = CommFunc.ReadBYTE(_lpData, _pos) | 
|---|
|  |  |  | self.ChooseLibCount,_pos = CommFunc.ReadBYTE(_lpData, _pos) | 
|---|
|  |  |  | for i in range(self.ChooseLibCount): | 
|---|
|  |  |  | temChooseItemList = tagCMActGodGiftChooseItemInfo() | 
|---|
|  |  |  | _pos = temChooseItemList.ReadData(_lpData, _pos) | 
|---|
|  |  |  | self.ChooseItemList.append(temChooseItemList) | 
|---|
|  |  |  | return _pos | 
|---|
|  |  |  |  | 
|---|
|  |  |  | def Clear(self): | 
|---|
|  |  |  | self.Head = tagHead() | 
|---|
|  |  |  | self.Head.Clear() | 
|---|
|  |  |  | self.Head.Cmd = 0xAA | 
|---|
|  |  |  | self.Head.SubCmd = 0x20 | 
|---|
|  |  |  | self.ActNum = 0 | 
|---|
|  |  |  | self.ChooseLibCount = 0 | 
|---|
|  |  |  | self.ChooseItemList = list() | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | def GetLength(self): | 
|---|
|  |  |  | length = 0 | 
|---|
|  |  |  | length += self.Head.GetLength() | 
|---|
|  |  |  | length += 1 | 
|---|
|  |  |  | length += 1 | 
|---|
|  |  |  | for i in range(self.ChooseLibCount): | 
|---|
|  |  |  | length += self.ChooseItemList[i].GetLength() | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return length | 
|---|
|  |  |  |  | 
|---|
|  |  |  | def GetBuffer(self): | 
|---|
|  |  |  | data = '' | 
|---|
|  |  |  | data = CommFunc.WriteString(data, self.Head.GetLength(), self.Head.GetBuffer()) | 
|---|
|  |  |  | data = CommFunc.WriteBYTE(data, self.ActNum) | 
|---|
|  |  |  | data = CommFunc.WriteBYTE(data, self.ChooseLibCount) | 
|---|
|  |  |  | for i in range(self.ChooseLibCount): | 
|---|
|  |  |  | data = CommFunc.WriteString(data, self.ChooseItemList[i].GetLength(), self.ChooseItemList[i].GetBuffer()) | 
|---|
|  |  |  | return data | 
|---|
|  |  |  |  | 
|---|
|  |  |  | def OutputString(self): | 
|---|
|  |  |  | DumpString = ''' | 
|---|
|  |  |  | Head:%s, | 
|---|
|  |  |  | ActNum:%d, | 
|---|
|  |  |  | ChooseLibCount:%d, | 
|---|
|  |  |  | ChooseItemList:%s | 
|---|
|  |  |  | '''\ | 
|---|
|  |  |  | %( | 
|---|
|  |  |  | self.Head.OutputString(), | 
|---|
|  |  |  | self.ActNum, | 
|---|
|  |  |  | self.ChooseLibCount, | 
|---|
|  |  |  | "..." | 
|---|
|  |  |  | ) | 
|---|
|  |  |  | return DumpString | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | m_NAtagCMActGodGiftChooseItem=tagCMActGodGiftChooseItem() | 
|---|
|  |  |  | ChNetPackDict[eval("0x%02x%02x"%(m_NAtagCMActGodGiftChooseItem.Head.Cmd,m_NAtagCMActGodGiftChooseItem.Head.SubCmd))] = m_NAtagCMActGodGiftChooseItem | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #------------------------------------------------------ | 
|---|
|  |  |  | # AA 21 天帝礼包抽奖 #tagCMActGodGiftlottery | 
|---|
|  |  |  |  | 
|---|
|  |  |  | class  tagCMActGodGiftlottery(Structure): | 
|---|
|  |  |  | _pack_ = 1 | 
|---|
|  |  |  | _fields_ = [ | 
|---|
|  |  |  | ("Cmd", c_ubyte), | 
|---|
|  |  |  | ("SubCmd", c_ubyte), | 
|---|
|  |  |  | ("ActNum", c_ubyte),    #活动编号 | 
|---|
|  |  |  | ] | 
|---|
|  |  |  |  | 
|---|
|  |  |  | def __init__(self): | 
|---|
|  |  |  | self.Clear() | 
|---|
|  |  |  | self.Cmd = 0xAA | 
|---|
|  |  |  | self.SubCmd = 0x21 | 
|---|
|  |  |  | 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 = 0x21 | 
|---|
|  |  |  | self.ActNum = 0 | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | def GetLength(self): | 
|---|
|  |  |  | return sizeof(tagCMActGodGiftlottery) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | def GetBuffer(self): | 
|---|
|  |  |  | return string_at(addressof(self), self.GetLength()) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | def OutputString(self): | 
|---|
|  |  |  | DumpString = '''// AA 21 天帝礼包抽奖 //tagCMActGodGiftlottery: | 
|---|
|  |  |  | Cmd:%s, | 
|---|
|  |  |  | SubCmd:%s, | 
|---|
|  |  |  | ActNum:%d | 
|---|
|  |  |  | '''\ | 
|---|
|  |  |  | %( | 
|---|
|  |  |  | self.Cmd, | 
|---|
|  |  |  | self.SubCmd, | 
|---|
|  |  |  | self.ActNum | 
|---|
|  |  |  | ) | 
|---|
|  |  |  | return DumpString | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | m_NAtagCMActGodGiftlottery=tagCMActGodGiftlottery() | 
|---|
|  |  |  | ChNetPackDict[eval("0x%02x%02x"%(m_NAtagCMActGodGiftlottery.Cmd,m_NAtagCMActGodGiftlottery.SubCmd))] = m_NAtagCMActGodGiftlottery | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #------------------------------------------------------ | 
|---|
|  |  |  | # AA 22 天帝礼包重置 #tagCMActGodGiftReset | 
|---|
|  |  |  |  | 
|---|
|  |  |  | class  tagCMActGodGiftReset(Structure): | 
|---|
|  |  |  | _pack_ = 1 | 
|---|
|  |  |  | _fields_ = [ | 
|---|
|  |  |  | ("Cmd", c_ubyte), | 
|---|
|  |  |  | ("SubCmd", c_ubyte), | 
|---|
|  |  |  | ("ActNum", c_ubyte),    #活动编号 | 
|---|
|  |  |  | ] | 
|---|
|  |  |  |  | 
|---|
|  |  |  | def __init__(self): | 
|---|
|  |  |  | self.Clear() | 
|---|
|  |  |  | self.Cmd = 0xAA | 
|---|
|  |  |  | self.SubCmd = 0x22 | 
|---|
|  |  |  | 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 = 0x22 | 
|---|
|  |  |  | self.ActNum = 0 | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | def GetLength(self): | 
|---|
|  |  |  | return sizeof(tagCMActGodGiftReset) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | def GetBuffer(self): | 
|---|
|  |  |  | return string_at(addressof(self), self.GetLength()) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | def OutputString(self): | 
|---|
|  |  |  | DumpString = '''// AA 22 天帝礼包重置 //tagCMActGodGiftReset: | 
|---|
|  |  |  | Cmd:%s, | 
|---|
|  |  |  | SubCmd:%s, | 
|---|
|  |  |  | ActNum:%d | 
|---|
|  |  |  | '''\ | 
|---|
|  |  |  | %( | 
|---|
|  |  |  | self.Cmd, | 
|---|
|  |  |  | self.SubCmd, | 
|---|
|  |  |  | self.ActNum | 
|---|
|  |  |  | ) | 
|---|
|  |  |  | return DumpString | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | m_NAtagCMActGodGiftReset=tagCMActGodGiftReset() | 
|---|
|  |  |  | ChNetPackDict[eval("0x%02x%02x"%(m_NAtagCMActGodGiftReset.Cmd,m_NAtagCMActGodGiftReset.SubCmd))] = m_NAtagCMActGodGiftReset | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #------------------------------------------------------ | 
|---|
|  |  |  | # AA 12 选择转盘活动物品 #tagCMActTurntableChooseItem | 
|---|
|  |  |  |  | 
|---|
|  |  |  | class  tagCMActTurntableChooseItem(Structure): | 
|---|