|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #------------------------------------------------------ | 
|---|
|  |  |  | # A7 16 小助手设置 #tagMCLittleHelperSet | 
|---|
|  |  |  |  | 
|---|
|  |  |  | class  tagMCLittleHelperFuncSet(Structure): | 
|---|
|  |  |  | _pack_ = 1 | 
|---|
|  |  |  | _fields_ = [ | 
|---|
|  |  |  | ("SetNum", c_ubyte),    # 托管功能设置编号1~20,每个编号对应的托管功能前端自定义 | 
|---|
|  |  |  | ("Value1", c_int),    # 自定义值1,如果存储的是勾选信息, 按二进制位存储代表是否勾选,支持31位,每位代表的含义前端自定义 | 
|---|
|  |  |  | ("Value2", c_int),    # 自定义值2 | 
|---|
|  |  |  | ("Value3", c_int),    # 自定义值3 | 
|---|
|  |  |  | ("Value4", c_int),    # 自定义值4 | 
|---|
|  |  |  | ("Value5", c_int),    # 自定义值5 | 
|---|
|  |  |  | ("Value6", c_int),    # 自定义值6 | 
|---|
|  |  |  | ] | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 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.SetNum = 0 | 
|---|
|  |  |  | self.Value1 = 0 | 
|---|
|  |  |  | self.Value2 = 0 | 
|---|
|  |  |  | self.Value3 = 0 | 
|---|
|  |  |  | self.Value4 = 0 | 
|---|
|  |  |  | self.Value5 = 0 | 
|---|
|  |  |  | self.Value6 = 0 | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | def GetLength(self): | 
|---|
|  |  |  | return sizeof(tagMCLittleHelperFuncSet) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | def GetBuffer(self): | 
|---|
|  |  |  | return string_at(addressof(self), self.GetLength()) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | def OutputString(self): | 
|---|
|  |  |  | DumpString = '''// A7 16 小助手设置 //tagMCLittleHelperSet: | 
|---|
|  |  |  | SetNum:%d, | 
|---|
|  |  |  | Value1:%d, | 
|---|
|  |  |  | Value2:%d, | 
|---|
|  |  |  | Value3:%d, | 
|---|
|  |  |  | Value4:%d, | 
|---|
|  |  |  | Value5:%d, | 
|---|
|  |  |  | Value6:%d | 
|---|
|  |  |  | '''\ | 
|---|
|  |  |  | %( | 
|---|
|  |  |  | self.SetNum, | 
|---|
|  |  |  | self.Value1, | 
|---|
|  |  |  | self.Value2, | 
|---|
|  |  |  | self.Value3, | 
|---|
|  |  |  | self.Value4, | 
|---|
|  |  |  | self.Value5, | 
|---|
|  |  |  | self.Value6 | 
|---|
|  |  |  | ) | 
|---|
|  |  |  | return DumpString | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | class  tagMCLittleHelperSet(Structure): | 
|---|
|  |  |  | Head = tagHead() | 
|---|
|  |  |  | FuncSetCount = 0    #(BYTE FuncSetCount)// 托管功能设置数,暂支持20个 | 
|---|
|  |  |  | FuncSetList = list()    #(vector<tagMCLittleHelperFuncSet> FuncSetList)// 托管功能设置列表 | 
|---|
|  |  |  | data = None | 
|---|
|  |  |  |  | 
|---|
|  |  |  | def __init__(self): | 
|---|
|  |  |  | self.Clear() | 
|---|
|  |  |  | self.Head.Cmd = 0xA7 | 
|---|
|  |  |  | self.Head.SubCmd = 0x16 | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | def ReadData(self, _lpData, _pos=0, _Len=0): | 
|---|
|  |  |  | self.Clear() | 
|---|
|  |  |  | _pos = self.Head.ReadData(_lpData, _pos) | 
|---|
|  |  |  | self.FuncSetCount,_pos = CommFunc.ReadBYTE(_lpData, _pos) | 
|---|
|  |  |  | for i in range(self.FuncSetCount): | 
|---|
|  |  |  | temFuncSetList = tagMCLittleHelperFuncSet() | 
|---|
|  |  |  | _pos = temFuncSetList.ReadData(_lpData, _pos) | 
|---|
|  |  |  | self.FuncSetList.append(temFuncSetList) | 
|---|
|  |  |  | return _pos | 
|---|
|  |  |  |  | 
|---|
|  |  |  | def Clear(self): | 
|---|
|  |  |  | self.Head = tagHead() | 
|---|
|  |  |  | self.Head.Clear() | 
|---|
|  |  |  | self.Head.Cmd = 0xA7 | 
|---|
|  |  |  | self.Head.SubCmd = 0x16 | 
|---|
|  |  |  | self.FuncSetCount = 0 | 
|---|
|  |  |  | self.FuncSetList = list() | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | def GetLength(self): | 
|---|
|  |  |  | length = 0 | 
|---|
|  |  |  | length += self.Head.GetLength() | 
|---|
|  |  |  | length += 1 | 
|---|
|  |  |  | for i in range(self.FuncSetCount): | 
|---|
|  |  |  | length += self.FuncSetList[i].GetLength() | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return length | 
|---|
|  |  |  |  | 
|---|
|  |  |  | def GetBuffer(self): | 
|---|
|  |  |  | data = '' | 
|---|
|  |  |  | data = CommFunc.WriteString(data, self.Head.GetLength(), self.Head.GetBuffer()) | 
|---|
|  |  |  | data = CommFunc.WriteBYTE(data, self.FuncSetCount) | 
|---|
|  |  |  | for i in range(self.FuncSetCount): | 
|---|
|  |  |  | data = CommFunc.WriteString(data, self.FuncSetList[i].GetLength(), self.FuncSetList[i].GetBuffer()) | 
|---|
|  |  |  | return data | 
|---|
|  |  |  |  | 
|---|
|  |  |  | def OutputString(self): | 
|---|
|  |  |  | DumpString = ''' | 
|---|
|  |  |  | Head:%s, | 
|---|
|  |  |  | FuncSetCount:%d, | 
|---|
|  |  |  | FuncSetList:%s | 
|---|
|  |  |  | '''\ | 
|---|
|  |  |  | %( | 
|---|
|  |  |  | self.Head.OutputString(), | 
|---|
|  |  |  | self.FuncSetCount, | 
|---|
|  |  |  | "..." | 
|---|
|  |  |  | ) | 
|---|
|  |  |  | return DumpString | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | m_NAtagMCLittleHelperSet=tagMCLittleHelperSet() | 
|---|
|  |  |  | ChNetPackDict[eval("0x%02x%02x"%(m_NAtagMCLittleHelperSet.Head.Cmd,m_NAtagMCLittleHelperSet.Head.SubCmd))] = m_NAtagMCLittleHelperSet | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #------------------------------------------------------ | 
|---|
|  |  |  | # A7 14 通知查询的NPC数量 #tagMCNPCCntList | 
|---|
|  |  |  |  | 
|---|
|  |  |  | class  tagMCNPCCntInfo(Structure): | 
|---|
|  |  |  | 
|---|
|  |  |  | # AA 16 通知超值礼包信息 #tagMCSuperGiftInfo | 
|---|
|  |  |  |  | 
|---|
|  |  |  | class  tagMCSuperGiftInfo(Structure): | 
|---|
|  |  |  | Head = tagHead() | 
|---|
|  |  |  | GiftID = 0    #(DWORD GiftID)//商品ID | 
|---|
|  |  |  | EndtDate = ""    #(char EndtDate[10])// 结束日期 y-m-d | 
|---|
|  |  |  | data = None | 
|---|
|  |  |  | _pack_ = 1 | 
|---|
|  |  |  | _fields_ = [ | 
|---|
|  |  |  | ("Cmd", c_ubyte), | 
|---|
|  |  |  | ("SubCmd", c_ubyte), | 
|---|
|  |  |  | ("StartTime", c_int), | 
|---|
|  |  |  | ] | 
|---|
|  |  |  |  | 
|---|
|  |  |  | def __init__(self): | 
|---|
|  |  |  | self.Clear() | 
|---|
|  |  |  | self.Head.Cmd = 0xAA | 
|---|
|  |  |  | self.Head.SubCmd = 0x16 | 
|---|
|  |  |  | self.Cmd = 0xAA | 
|---|
|  |  |  | self.SubCmd = 0x16 | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | def ReadData(self, _lpData, _pos=0, _Len=0): | 
|---|
|  |  |  | def ReadData(self, stringData, _pos=0, _len=0): | 
|---|
|  |  |  | self.Clear() | 
|---|
|  |  |  | _pos = self.Head.ReadData(_lpData, _pos) | 
|---|
|  |  |  | self.GiftID,_pos = CommFunc.ReadDWORD(_lpData, _pos) | 
|---|
|  |  |  | self.EndtDate,_pos = CommFunc.ReadString(_lpData, _pos,10) | 
|---|
|  |  |  | return _pos | 
|---|
|  |  |  | memmove(addressof(self), stringData[_pos:], self.GetLength()) | 
|---|
|  |  |  | return _pos + self.GetLength() | 
|---|
|  |  |  |  | 
|---|
|  |  |  | def Clear(self): | 
|---|
|  |  |  | self.Head = tagHead() | 
|---|
|  |  |  | self.Head.Clear() | 
|---|
|  |  |  | self.Head.Cmd = 0xAA | 
|---|
|  |  |  | self.Head.SubCmd = 0x16 | 
|---|
|  |  |  | self.GiftID = 0 | 
|---|
|  |  |  | self.EndtDate = "" | 
|---|
|  |  |  | self.Cmd = 0xAA | 
|---|
|  |  |  | self.SubCmd = 0x16 | 
|---|
|  |  |  | self.StartTime = 0 | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | def GetLength(self): | 
|---|
|  |  |  | length = 0 | 
|---|
|  |  |  | length += self.Head.GetLength() | 
|---|
|  |  |  | length += 4 | 
|---|
|  |  |  | length += 10 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return length | 
|---|
|  |  |  | return sizeof(tagMCSuperGiftInfo) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | def GetBuffer(self): | 
|---|
|  |  |  | data = '' | 
|---|
|  |  |  | data = CommFunc.WriteString(data, self.Head.GetLength(), self.Head.GetBuffer()) | 
|---|
|  |  |  | data = CommFunc.WriteDWORD(data, self.GiftID) | 
|---|
|  |  |  | data = CommFunc.WriteString(data, 10, self.EndtDate) | 
|---|
|  |  |  | return data | 
|---|
|  |  |  | return string_at(addressof(self), self.GetLength()) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | def OutputString(self): | 
|---|
|  |  |  | DumpString = ''' | 
|---|
|  |  |  | Head:%s, | 
|---|
|  |  |  | GiftID:%d, | 
|---|
|  |  |  | EndtDate:%s | 
|---|
|  |  |  | DumpString = '''// AA 16 通知超值礼包信息 //tagMCSuperGiftInfo: | 
|---|
|  |  |  | Cmd:%s, | 
|---|
|  |  |  | SubCmd:%s, | 
|---|
|  |  |  | StartTime:%d | 
|---|
|  |  |  | '''\ | 
|---|
|  |  |  | %( | 
|---|
|  |  |  | self.Head.OutputString(), | 
|---|
|  |  |  | self.GiftID, | 
|---|
|  |  |  | self.EndtDate | 
|---|
|  |  |  | self.Cmd, | 
|---|
|  |  |  | self.SubCmd, | 
|---|
|  |  |  | self.StartTime | 
|---|
|  |  |  | ) | 
|---|
|  |  |  | return DumpString | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | m_NAtagMCSuperGiftInfo=tagMCSuperGiftInfo() | 
|---|
|  |  |  | ChNetPackDict[eval("0x%02x%02x"%(m_NAtagMCSuperGiftInfo.Head.Cmd,m_NAtagMCSuperGiftInfo.Head.SubCmd))] = m_NAtagMCSuperGiftInfo | 
|---|
|  |  |  | ChNetPackDict[eval("0x%02x%02x"%(m_NAtagMCSuperGiftInfo.Cmd,m_NAtagMCSuperGiftInfo.SubCmd))] = m_NAtagMCSuperGiftInfo | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #------------------------------------------------------ | 
|---|