| | |
| | | from ctypes import (Structure, memset, memmove, sizeof, addressof, create_string_buffer, string_at)
|
| | | import CommFunc
|
| | |
|
| | | # 跨服竞技场未通知玩家的比赛结果表 #tagDBCrossPKUnNotifyOverInfo
|
| | | class tagDBCrossPKUnNotifyOverInfo(Structure):
|
| | | _pack_ = 1
|
| | | _fields_ = [
|
| | | ('ZoneID', ctypes.c_ubyte),
|
| | | ('SeasonID', ctypes.c_ubyte),
|
| | | ('RoomID', ctypes.c_ushort),
|
| | | ('TimeStr', ctypes.c_char * 19),
|
| | | ('OverType', ctypes.c_ubyte),
|
| | | ('PlayerID', ctypes.c_ulong),
|
| | | ('WinnerID', ctypes.c_ulong),
|
| | | ('RoundWinnerLen', ctypes.c_ubyte),
|
| | | ('RoundWinnerInfo', ctypes.c_char_p),
|
| | | ('PKScore', ctypes.c_ulong),
|
| | | ('DanLV', ctypes.c_ubyte),
|
| | | ('CWinCount', ctypes.c_ushort),
|
| | | ('AddScore', ctypes.c_ushort),
|
| | | ('TagPlayerID', ctypes.c_ulong),
|
| | | ('TagPlayerName', ctypes.c_char * 33),
|
| | | ('ADOResult', ctypes.c_ulong),
|
| | | ]
|
| | |
|
| | | def __init__(self):
|
| | | Structure.__init__(self)
|
| | | self.clear()
|
| | |
|
| | | def clear(self):
|
| | | self.ZoneID = 0
|
| | | self.SeasonID = 0
|
| | | self.RoomID = 0
|
| | | self.TimeStr = ''
|
| | | self.OverType = 0
|
| | | self.PlayerID = 0
|
| | | self.WinnerID = 0
|
| | | self.RoundWinnerLen = 0
|
| | | self.RoundWinnerInfo = ''
|
| | | self.PKScore = 0
|
| | | self.DanLV = 0
|
| | | self.CWinCount = 0
|
| | | self.AddScore = 0
|
| | | self.TagPlayerID = 0
|
| | | self.TagPlayerName = ''
|
| | |
|
| | | 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.ZoneID, pos = CommFunc.ReadBYTE(buf, pos)
|
| | | self.SeasonID, pos = CommFunc.ReadBYTE(buf, pos)
|
| | | self.RoomID, pos = CommFunc.ReadWORD(buf, pos)
|
| | | self.TimeStr, pos = CommFunc.ReadString(buf, pos, 19)
|
| | | self.OverType, pos = CommFunc.ReadBYTE(buf, pos)
|
| | | self.PlayerID, pos = CommFunc.ReadDWORD(buf, pos)
|
| | | self.WinnerID, pos = CommFunc.ReadDWORD(buf, pos)
|
| | | self.RoundWinnerLen, pos = CommFunc.ReadBYTE(buf, pos)
|
| | | tmp, pos = CommFunc.ReadString(buf, pos, self.RoundWinnerLen)
|
| | | self.RoundWinnerInfo = ctypes.c_char_p(tmp)
|
| | | self.PKScore, pos = CommFunc.ReadDWORD(buf, pos)
|
| | | self.DanLV, pos = CommFunc.ReadBYTE(buf, pos)
|
| | | self.CWinCount, pos = CommFunc.ReadWORD(buf, pos)
|
| | | self.AddScore, pos = CommFunc.ReadWORD(buf, pos)
|
| | | self.TagPlayerID, pos = CommFunc.ReadDWORD(buf, pos)
|
| | | self.TagPlayerName, pos = CommFunc.ReadString(buf, pos, 33)
|
| | | return self.getLength()
|
| | |
|
| | | def getBuffer(self):
|
| | | buf = ''
|
| | | buf = CommFunc.WriteBYTE(buf, self.ZoneID)
|
| | | buf = CommFunc.WriteBYTE(buf, self.SeasonID)
|
| | | buf = CommFunc.WriteWORD(buf, self.RoomID)
|
| | | buf = CommFunc.WriteString(buf, sizeof(ctypes.c_char) * 19, self.TimeStr)
|
| | | buf = CommFunc.WriteBYTE(buf, self.OverType)
|
| | | buf = CommFunc.WriteDWORD(buf, self.PlayerID)
|
| | | buf = CommFunc.WriteDWORD(buf, self.WinnerID)
|
| | | buf = CommFunc.WriteBYTE(buf, self.RoundWinnerLen)
|
| | | buf = CommFunc.WriteString(buf, self.RoundWinnerLen, self.RoundWinnerInfo)
|
| | | buf = CommFunc.WriteDWORD(buf, self.PKScore)
|
| | | buf = CommFunc.WriteBYTE(buf, self.DanLV)
|
| | | buf = CommFunc.WriteWORD(buf, self.CWinCount)
|
| | | buf = CommFunc.WriteWORD(buf, self.AddScore)
|
| | | buf = CommFunc.WriteDWORD(buf, self.TagPlayerID)
|
| | | buf = CommFunc.WriteString(buf, sizeof(ctypes.c_char) * 33, self.TagPlayerName)
|
| | | return buf
|
| | |
|
| | | def getLength(self):
|
| | | length = 0
|
| | | length += sizeof(ctypes.c_ubyte)
|
| | | length += sizeof(ctypes.c_ubyte)
|
| | | length += sizeof(ctypes.c_ushort)
|
| | | length += sizeof(ctypes.c_char) * 19
|
| | | length += sizeof(ctypes.c_ubyte)
|
| | | length += sizeof(ctypes.c_ulong)
|
| | | length += sizeof(ctypes.c_ulong)
|
| | | length += sizeof(ctypes.c_ubyte)
|
| | | length += self.RoundWinnerLen
|
| | | length += sizeof(ctypes.c_ulong)
|
| | | length += sizeof(ctypes.c_ubyte)
|
| | | length += sizeof(ctypes.c_ushort)
|
| | | length += sizeof(ctypes.c_ushort)
|
| | | length += sizeof(ctypes.c_ulong)
|
| | | length += sizeof(ctypes.c_char) * 33
|
| | | return length
|
| | |
|
| | | def outputString(self):
|
| | | output = '''// 跨服竞技场未通知玩家的比赛结果表 #tagDBCrossPKUnNotifyOverInfo:
|
| | | ZoneID = %s,
|
| | | SeasonID = %s,
|
| | | RoomID = %s,
|
| | | TimeStr = %s,
|
| | | OverType = %s,
|
| | | PlayerID = %s,
|
| | | WinnerID = %s,
|
| | | RoundWinnerLen = %s,
|
| | | RoundWinnerInfo = %s,
|
| | | PKScore = %s,
|
| | | DanLV = %s,
|
| | | CWinCount = %s,
|
| | | AddScore = %s,
|
| | | TagPlayerID = %s,
|
| | | TagPlayerName = %s,
|
| | | ADOResult = %s,
|
| | | '''%(
|
| | | self.ZoneID,
|
| | | self.SeasonID,
|
| | | self.RoomID,
|
| | | self.TimeStr,
|
| | | self.OverType,
|
| | | self.PlayerID,
|
| | | self.WinnerID,
|
| | | self.RoundWinnerLen,
|
| | | self.RoundWinnerInfo,
|
| | | self.PKScore,
|
| | | self.DanLV,
|
| | | self.CWinCount,
|
| | | self.AddScore,
|
| | | self.TagPlayerID,
|
| | | self.TagPlayerName,
|
| | | self.ADOResult,
|
| | | )
|
| | | return output
|
| | |
|
| | | #Char数组类型Set接口,使用该接口对此类型数据赋值,防止赋值的数据过长报错
|
| | | def SetTimeStr(self,Str):
|
| | | if len(Str)<=19:
|
| | | self.TimeStr = Str
|
| | | else:
|
| | | self.TimeStr = Str[:19]
|
| | | |
| | | def SetTagPlayerName(self,Str):
|
| | | if len(Str)<=33:
|
| | | self.TagPlayerName = Str
|
| | | else:
|
| | | self.TagPlayerName = Str[:33]
|
| | | |
| | |
|
| | | # 跨服竞技场PK排行榜 #tagDBCrossPKBillboard
|
| | | class tagDBCrossPKBillboard(Structure):
|
| | | _pack_ = 1
|