| | |
| | | from ctypes import (Structure, memset, memmove, sizeof, addressof, create_string_buffer, string_at)
|
| | | import CommFunc
|
| | |
|
| | | # 跨服补偿个人领取表 #tagDBCrossPersonalCompensation
|
| | | class tagDBCrossPersonalCompensation(Structure):
|
| | | _pack_ = 1
|
| | | _fields_ = [
|
| | | ('PlayerID', ctypes.c_ulong),
|
| | | ('GUID', ctypes.c_char * 40),
|
| | | ('LimitTime', ctypes.c_char * 30),
|
| | | ('TextLen', ctypes.c_ulong),
|
| | | ('Text', ctypes.c_char_p),
|
| | | ('Gold', ctypes.c_ulong),
|
| | | ('GoldPaper', ctypes.c_ulong),
|
| | | ('Silver', ctypes.c_ulong),
|
| | | ('ItemLen', ctypes.c_ushort),
|
| | | ('ItemInfo', ctypes.c_char_p),
|
| | | ('DetailLen', ctypes.c_ushort),
|
| | | ('Detail', ctypes.c_char_p),
|
| | | ('MoneySource', ctypes.c_ushort),
|
| | | ('ADOResult', ctypes.c_ulong),
|
| | | ]
|
| | |
|
| | | def __init__(self):
|
| | | Structure.__init__(self)
|
| | | self.clear()
|
| | |
|
| | | def clear(self):
|
| | | self.PlayerID = 0
|
| | | self.GUID = ''
|
| | | self.LimitTime = ''
|
| | | self.TextLen = 0
|
| | | self.Text = ''
|
| | | self.Gold = 0
|
| | | self.GoldPaper = 0
|
| | | self.Silver = 0
|
| | | self.ItemLen = 0
|
| | | self.ItemInfo = ''
|
| | | self.DetailLen = 0
|
| | | self.Detail = ''
|
| | | self.MoneySource = 0
|
| | |
|
| | | def readData(self, buf, pos = 0, length = 0):
|
| | | if not pos <= length:
|
| | | return -1
|
| | | if len(buf) < pos + self.getLength():
|
| | | return -1
|
| | | self.clear()
|
| | | self.PlayerID, pos = CommFunc.ReadDWORD(buf, pos)
|
| | | self.GUID, pos = CommFunc.ReadString(buf, pos, 40)
|
| | | self.LimitTime, pos = CommFunc.ReadString(buf, pos, 30)
|
| | | self.TextLen, pos = CommFunc.ReadDWORD(buf, pos)
|
| | | tmp, pos = CommFunc.ReadString(buf, pos, self.TextLen)
|
| | | self.Text = ctypes.c_char_p(tmp)
|
| | | self.Gold, pos = CommFunc.ReadDWORD(buf, pos)
|
| | | self.GoldPaper, pos = CommFunc.ReadDWORD(buf, pos)
|
| | | self.Silver, pos = CommFunc.ReadDWORD(buf, pos)
|
| | | self.ItemLen, pos = CommFunc.ReadWORD(buf, pos)
|
| | | tmp, pos = CommFunc.ReadString(buf, pos, self.ItemLen)
|
| | | self.ItemInfo = ctypes.c_char_p(tmp)
|
| | | self.DetailLen, pos = CommFunc.ReadWORD(buf, pos)
|
| | | tmp, pos = CommFunc.ReadString(buf, pos, self.DetailLen)
|
| | | self.Detail = ctypes.c_char_p(tmp)
|
| | | self.MoneySource, pos = CommFunc.ReadWORD(buf, pos)
|
| | | return self.getLength()
|
| | |
|
| | | def getBuffer(self):
|
| | | buf = ''
|
| | | buf = CommFunc.WriteDWORD(buf, self.PlayerID)
|
| | | buf = CommFunc.WriteString(buf, sizeof(ctypes.c_char) * 40, self.GUID)
|
| | | buf = CommFunc.WriteString(buf, sizeof(ctypes.c_char) * 30, self.LimitTime)
|
| | | buf = CommFunc.WriteDWORD(buf, self.TextLen)
|
| | | buf = CommFunc.WriteString(buf, self.TextLen, self.Text)
|
| | | buf = CommFunc.WriteDWORD(buf, self.Gold)
|
| | | buf = CommFunc.WriteDWORD(buf, self.GoldPaper)
|
| | | buf = CommFunc.WriteDWORD(buf, self.Silver)
|
| | | buf = CommFunc.WriteWORD(buf, self.ItemLen)
|
| | | buf = CommFunc.WriteString(buf, self.ItemLen, self.ItemInfo)
|
| | | buf = CommFunc.WriteWORD(buf, self.DetailLen)
|
| | | buf = CommFunc.WriteString(buf, self.DetailLen, self.Detail)
|
| | | buf = CommFunc.WriteWORD(buf, self.MoneySource)
|
| | | return buf
|
| | |
|
| | | def getLength(self):
|
| | | length = 0
|
| | | length += sizeof(ctypes.c_ulong)
|
| | | length += sizeof(ctypes.c_char) * 40
|
| | | length += sizeof(ctypes.c_char) * 30
|
| | | length += sizeof(ctypes.c_ulong)
|
| | | length += self.TextLen
|
| | | length += sizeof(ctypes.c_ulong)
|
| | | length += sizeof(ctypes.c_ulong)
|
| | | length += sizeof(ctypes.c_ulong)
|
| | | length += sizeof(ctypes.c_ushort)
|
| | | length += self.ItemLen
|
| | | length += sizeof(ctypes.c_ushort)
|
| | | length += self.DetailLen
|
| | | length += sizeof(ctypes.c_ushort)
|
| | | return length
|
| | |
|
| | | def outputString(self):
|
| | | output = '''// 跨服补偿个人领取表 #tagDBCrossPersonalCompensation:
|
| | | PlayerID = %s,
|
| | | GUID = %s,
|
| | | LimitTime = %s,
|
| | | TextLen = %s,
|
| | | Text = %s,
|
| | | Gold = %s,
|
| | | GoldPaper = %s,
|
| | | Silver = %s,
|
| | | ItemLen = %s,
|
| | | ItemInfo = %s,
|
| | | DetailLen = %s,
|
| | | Detail = %s,
|
| | | MoneySource = %s,
|
| | | ADOResult = %s,
|
| | | '''%(
|
| | | self.PlayerID,
|
| | | self.GUID,
|
| | | self.LimitTime,
|
| | | self.TextLen,
|
| | | self.Text,
|
| | | self.Gold,
|
| | | self.GoldPaper,
|
| | | self.Silver,
|
| | | self.ItemLen,
|
| | | self.ItemInfo,
|
| | | self.DetailLen,
|
| | | self.Detail,
|
| | | self.MoneySource,
|
| | | self.ADOResult,
|
| | | )
|
| | | return output
|
| | |
|
| | | #Char数组类型Set接口,使用该接口对此类型数据赋值,防止赋值的数据过长报错
|
| | | def SetGUID(self,Str):
|
| | | if len(Str)<=40:
|
| | | self.GUID = Str
|
| | | else:
|
| | | self.GUID = Str[:40]
|
| | | |
| | | def SetLimitTime(self,Str):
|
| | | if len(Str)<=30:
|
| | | self.LimitTime = Str
|
| | | else:
|
| | | self.LimitTime = Str[:30]
|
| | | |
| | |
|
| | | # 跨服排行榜 #tagDBCrossBillboard
|
| | | class tagDBCrossBillboard(Structure):
|
| | | _pack_ = 1
|
| | | _fields_ = [
|
| | | ('GroupValue1', ctypes.c_ubyte),
|
| | | ('GroupValue2', ctypes.c_ubyte),
|
| | | ('BillboardType', ctypes.c_ubyte),
|
| | | ('ID', ctypes.c_ulong),
|
| | | ('ID2', ctypes.c_ulong),
|
| | | ('Name1', ctypes.c_char * 33),
|
| | | ('Name2', ctypes.c_char * 33),
|
| | | ('Type2', ctypes.c_ubyte),
|
| | | ('Value1', ctypes.c_ulong),
|
| | | ('Value2', ctypes.c_ulong),
|
| | | ('CmpValue', ctypes.c_ulong),
|
| | | ('CmpValue2', ctypes.c_ulong),
|
| | | ('CmpValue3', ctypes.c_ulong),
|
| | | ('ADOResult', ctypes.c_ulong),
|
| | | ]
|
| | |
|
| | | def __init__(self):
|
| | | Structure.__init__(self)
|
| | | self.clear()
|
| | |
|
| | |
|
| | | def clear(self):
|
| | | memset(addressof(self), 0, self.getLength())
|
| | |
|
| | | def readData(self, buf, pos = 0, length = 0):
|
| | | if not pos <= length:
|
| | | return -1
|
| | | if len(buf) < pos + self.getLength():
|
| | | return -1
|
| | | self.clear()
|
| | | self.GroupValue1, pos = CommFunc.ReadBYTE(buf, pos)
|
| | | self.GroupValue2, pos = CommFunc.ReadBYTE(buf, pos)
|
| | | self.BillboardType, pos = CommFunc.ReadBYTE(buf, pos)
|
| | | self.ID, pos = CommFunc.ReadDWORD(buf, pos)
|
| | | self.ID2, pos = CommFunc.ReadDWORD(buf, pos)
|
| | | self.Name1, pos = CommFunc.ReadString(buf, pos, 33)
|
| | | self.Name2, pos = CommFunc.ReadString(buf, pos, 33)
|
| | | self.Type2, pos = CommFunc.ReadBYTE(buf, pos)
|
| | | self.Value1, pos = CommFunc.ReadDWORD(buf, pos)
|
| | | self.Value2, pos = CommFunc.ReadDWORD(buf, pos)
|
| | | self.CmpValue, pos = CommFunc.ReadDWORD(buf, pos)
|
| | | self.CmpValue2, pos = CommFunc.ReadDWORD(buf, pos)
|
| | | self.CmpValue3, pos = CommFunc.ReadDWORD(buf, pos)
|
| | | return self.getLength()
|
| | |
|
| | |
|
| | | def getBuffer(self):
|
| | | buf = create_string_buffer(self.getLength())
|
| | | memmove(addressof(buf), addressof(self), self.getLength())
|
| | | return string_at(addressof(buf), self.getLength())
|
| | |
|
| | | def getLength(self):
|
| | | return sizeof(tagDBCrossBillboard)
|
| | |
|
| | | def outputString(self):
|
| | | output = '''// 跨服排行榜 #tagDBCrossBillboard:
|
| | | GroupValue1 = %s,
|
| | | GroupValue2 = %s,
|
| | | BillboardType = %s,
|
| | | ID = %s,
|
| | | ID2 = %s,
|
| | | Name1 = %s,
|
| | | Name2 = %s,
|
| | | Type2 = %s,
|
| | | Value1 = %s,
|
| | | Value2 = %s,
|
| | | CmpValue = %s,
|
| | | CmpValue2 = %s,
|
| | | CmpValue3 = %s,
|
| | | ADOResult = %s,
|
| | | '''%(
|
| | | self.GroupValue1,
|
| | | self.GroupValue2,
|
| | | self.BillboardType,
|
| | | self.ID,
|
| | | self.ID2,
|
| | | self.Name1,
|
| | | self.Name2,
|
| | | self.Type2,
|
| | | self.Value1,
|
| | | self.Value2,
|
| | | self.CmpValue,
|
| | | self.CmpValue2,
|
| | | self.CmpValue3,
|
| | | self.ADOResult,
|
| | | )
|
| | | return output
|
| | |
|
| | | #Char数组类型Set接口,使用该接口对此类型数据赋值,防止赋值的数据过长报错
|
| | | def SetName1(self,Str):
|
| | | if len(Str)<=33:
|
| | | self.Name1 = Str
|
| | | else:
|
| | | self.Name1 = Str[:33]
|
| | | |
| | | def SetName2(self,Str):
|
| | | if len(Str)<=33:
|
| | | self.Name2 = Str
|
| | | else:
|
| | | self.Name2 = Str[:33]
|
| | | |
| | |
|
| | | # 协助感谢表 #tagDBAssistThanks
|
| | | class tagDBAssistThanks(Structure):
|
| | | _pack_ = 1
|