From 3bc2e9aae7e595d5be896a9db4c909b76fa6f5be Mon Sep 17 00:00:00 2001 From: hch <305670599@qq.com> Date: 星期五, 11 七月 2025 14:16:29 +0800 Subject: [PATCH] 0312 物品叠加数量支持配置DWORD --- ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/DB/DBStruct.py | 1051 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 1,050 insertions(+), 1 deletions(-) diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/DB/DBStruct.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/DB/DBStruct.py index 8fce029..9cecba1 100644 --- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/DB/DBStruct.py +++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/DB/DBStruct.py @@ -10,6 +10,7 @@ # @version 1.0 # # 详细描述: CodeMaker PyGameServerSaveData.py生成 +# 注: 修改表结构、增删表时需同步修改 GAMEWORLD_DATA_VERSION_NO # #------------------------------------------------------------------------------- #"""Version = 2025-05-09 12:20""" @@ -666,7 +667,67 @@ else: self.Operate = Str[:15] - + +# 事件触发表 #tagDBEventTrig +class tagDBEventTrig(Structure): + _pack_ = 1 + _fields_ = [ + ('EventLen', ctypes.c_ulong), + ('EventID', ctypes.c_char_p), + ('EventValue', ctypes.c_ulong), + ('ADOResult', ctypes.c_ulong), + ] + + def __init__(self): + Structure.__init__(self) + self.clear() + + def clear(self): + self.EventLen = 0 + self.EventID = '' + self.EventValue = 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.EventLen, pos = CommFunc.ReadDWORD(buf, pos) + tmp, pos = CommFunc.ReadString(buf, pos, self.EventLen) + self.EventID = ctypes.c_char_p(tmp) + self.EventValue, pos = CommFunc.ReadDWORD(buf, pos) + return self.getLength() + + def getBuffer(self): + buf = '' + buf = CommFunc.WriteDWORD(buf, self.EventLen) + buf = CommFunc.WriteString(buf, self.EventLen, self.EventID) + buf = CommFunc.WriteDWORD(buf, self.EventValue) + return buf + + def getLength(self): + length = 0 + length += sizeof(ctypes.c_ulong) + length += self.EventLen + length += sizeof(ctypes.c_ulong) + return length + + def outputString(self): + output = '''// 事件触发表 #tagDBEventTrig: + EventLen = %s, + EventID = %s, + EventValue = %s, + ADOResult = %s, + '''%( + self.EventLen, + self.EventID, + self.EventValue, + self.ADOResult, + ) + return output + + # 家族表 #tagDBFamily class tagDBFamily(Structure): _pack_ = 1 @@ -1236,3 +1297,991 @@ else: self.FamilyName = Str[:33] + +# 邮件个人邮件表 #tagDBMailPersonal +class tagDBMailPersonal(Structure): + _pack_ = 1 + _fields_ = [ + ('PlayerID', ctypes.c_ulong), + ('GUID', ctypes.c_char * 36), + ('Type', ctypes.c_ubyte), + ('CreateTime', ctypes.c_char * 30), + ('LimitDays', ctypes.c_ubyte), + ('TitleLen', ctypes.c_ubyte), + ('Title', ctypes.c_char_p), + ('TextLen', ctypes.c_ushort), + ('Text', ctypes.c_char_p), + ('MailState', ctypes.c_ubyte), + ('ADOResult', ctypes.c_ulong), + ] + + def __init__(self): + Structure.__init__(self) + self.clear() + + def clear(self): + self.PlayerID = 0 + self.GUID = '' + self.Type = 0 + self.CreateTime = '' + self.LimitDays = 0 + self.TitleLen = 0 + self.Title = '' + self.TextLen = 0 + self.Text = '' + self.MailState = 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, 36) + self.Type, pos = CommFunc.ReadBYTE(buf, pos) + self.CreateTime, pos = CommFunc.ReadString(buf, pos, 30) + self.LimitDays, pos = CommFunc.ReadBYTE(buf, pos) + self.TitleLen, pos = CommFunc.ReadBYTE(buf, pos) + tmp, pos = CommFunc.ReadString(buf, pos, self.TitleLen) + self.Title = ctypes.c_char_p(tmp) + self.TextLen, pos = CommFunc.ReadWORD(buf, pos) + tmp, pos = CommFunc.ReadString(buf, pos, self.TextLen) + self.Text = ctypes.c_char_p(tmp) + self.MailState, pos = CommFunc.ReadBYTE(buf, pos) + return self.getLength() + + def getBuffer(self): + buf = '' + buf = CommFunc.WriteDWORD(buf, self.PlayerID) + buf = CommFunc.WriteString(buf, sizeof(ctypes.c_char) * 36, self.GUID) + buf = CommFunc.WriteBYTE(buf, self.Type) + buf = CommFunc.WriteString(buf, sizeof(ctypes.c_char) * 30, self.CreateTime) + buf = CommFunc.WriteBYTE(buf, self.LimitDays) + buf = CommFunc.WriteBYTE(buf, self.TitleLen) + buf = CommFunc.WriteString(buf, self.TitleLen, self.Title) + buf = CommFunc.WriteWORD(buf, self.TextLen) + buf = CommFunc.WriteString(buf, self.TextLen, self.Text) + buf = CommFunc.WriteBYTE(buf, self.MailState) + return buf + + def getLength(self): + length = 0 + length += sizeof(ctypes.c_ulong) + length += sizeof(ctypes.c_char) * 36 + length += sizeof(ctypes.c_ubyte) + length += sizeof(ctypes.c_char) * 30 + length += sizeof(ctypes.c_ubyte) + length += sizeof(ctypes.c_ubyte) + length += self.TitleLen + length += sizeof(ctypes.c_ushort) + length += self.TextLen + length += sizeof(ctypes.c_ubyte) + return length + + def outputString(self): + output = '''// 邮件个人邮件表 #tagDBMailPersonal: + PlayerID = %s, + GUID = %s, + Type = %s, + CreateTime = %s, + LimitDays = %s, + TitleLen = %s, + Title = %s, + TextLen = %s, + Text = %s, + MailState = %s, + ADOResult = %s, + '''%( + self.PlayerID, + self.GUID, + self.Type, + self.CreateTime, + self.LimitDays, + self.TitleLen, + self.Title, + self.TextLen, + self.Text, + self.MailState, + self.ADOResult, + ) + return output + + #Char数组类型Set接口,使用该接口对此类型数据赋值,防止赋值的数据过长报错 + def SetGUID(self,Str): + if len(Str)<=36: + self.GUID = Str + else: + self.GUID = Str[:36] + + def SetCreateTime(self,Str): + if len(Str)<=30: + self.CreateTime = Str + else: + self.CreateTime = Str[:30] + + +# 邮件全服邮件表 #tagDBMailServer +class tagDBMailServer(Structure): + _pack_ = 1 + _fields_ = [ + ('GUID', ctypes.c_char * 36), + ('Type', ctypes.c_ubyte), + ('CreateTime', ctypes.c_char * 30), + ('LimitDays', ctypes.c_ubyte), + ('TitleLen', ctypes.c_ubyte), + ('Title', ctypes.c_char_p), + ('TextLen', ctypes.c_ushort), + ('Text', ctypes.c_char_p), + ('LimitLV', ctypes.c_ushort), + ('LimitLVType', ctypes.c_ubyte), + ('CheckState', ctypes.c_ubyte), + ('ADOResult', ctypes.c_ulong), + ] + + def __init__(self): + Structure.__init__(self) + self.clear() + + def clear(self): + self.GUID = '' + self.Type = 0 + self.CreateTime = '' + self.LimitDays = 0 + self.TitleLen = 0 + self.Title = '' + self.TextLen = 0 + self.Text = '' + self.LimitLV = 0 + self.LimitLVType = 0 + self.CheckState = 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.GUID, pos = CommFunc.ReadString(buf, pos, 36) + self.Type, pos = CommFunc.ReadBYTE(buf, pos) + self.CreateTime, pos = CommFunc.ReadString(buf, pos, 30) + self.LimitDays, pos = CommFunc.ReadBYTE(buf, pos) + self.TitleLen, pos = CommFunc.ReadBYTE(buf, pos) + tmp, pos = CommFunc.ReadString(buf, pos, self.TitleLen) + self.Title = ctypes.c_char_p(tmp) + self.TextLen, pos = CommFunc.ReadWORD(buf, pos) + tmp, pos = CommFunc.ReadString(buf, pos, self.TextLen) + self.Text = ctypes.c_char_p(tmp) + self.LimitLV, pos = CommFunc.ReadWORD(buf, pos) + self.LimitLVType, pos = CommFunc.ReadBYTE(buf, pos) + self.CheckState, pos = CommFunc.ReadBYTE(buf, pos) + return self.getLength() + + def getBuffer(self): + buf = '' + buf = CommFunc.WriteString(buf, sizeof(ctypes.c_char) * 36, self.GUID) + buf = CommFunc.WriteBYTE(buf, self.Type) + buf = CommFunc.WriteString(buf, sizeof(ctypes.c_char) * 30, self.CreateTime) + buf = CommFunc.WriteBYTE(buf, self.LimitDays) + buf = CommFunc.WriteBYTE(buf, self.TitleLen) + buf = CommFunc.WriteString(buf, self.TitleLen, self.Title) + buf = CommFunc.WriteWORD(buf, self.TextLen) + buf = CommFunc.WriteString(buf, self.TextLen, self.Text) + buf = CommFunc.WriteWORD(buf, self.LimitLV) + buf = CommFunc.WriteBYTE(buf, self.LimitLVType) + buf = CommFunc.WriteBYTE(buf, self.CheckState) + return buf + + def getLength(self): + length = 0 + length += sizeof(ctypes.c_char) * 36 + length += sizeof(ctypes.c_ubyte) + length += sizeof(ctypes.c_char) * 30 + length += sizeof(ctypes.c_ubyte) + length += sizeof(ctypes.c_ubyte) + length += self.TitleLen + length += sizeof(ctypes.c_ushort) + length += self.TextLen + length += sizeof(ctypes.c_ushort) + length += sizeof(ctypes.c_ubyte) + length += sizeof(ctypes.c_ubyte) + return length + + def outputString(self): + output = '''// 邮件全服邮件表 #tagDBMailServer: + GUID = %s, + Type = %s, + CreateTime = %s, + LimitDays = %s, + TitleLen = %s, + Title = %s, + TextLen = %s, + Text = %s, + LimitLV = %s, + LimitLVType = %s, + CheckState = %s, + ADOResult = %s, + '''%( + self.GUID, + self.Type, + self.CreateTime, + self.LimitDays, + self.TitleLen, + self.Title, + self.TextLen, + self.Text, + self.LimitLV, + self.LimitLVType, + self.CheckState, + self.ADOResult, + ) + return output + + #Char数组类型Set接口,使用该接口对此类型数据赋值,防止赋值的数据过长报错 + def SetGUID(self,Str): + if len(Str)<=36: + self.GUID = Str + else: + self.GUID = Str[:36] + + def SetCreateTime(self,Str): + if len(Str)<=30: + self.CreateTime = Str + else: + self.CreateTime = Str[:30] + + + +# 邮件物品表 #tagDBMailItem +class tagDBMailItem(Structure): + _pack_ = 1 + _fields_ = [ + ('GUID', ctypes.c_char * 36), + ('ItemID', ctypes.c_ulong), + ('Count', ctypes.c_ulong), + ('IsBind', ctypes.c_ubyte), + ('UserDataLen', ctypes.c_ushort), + ('UserData', ctypes.c_char_p), + ('ADOResult', ctypes.c_ulong), + ] + + def __init__(self): + Structure.__init__(self) + self.clear() + + def clear(self): + self.GUID = '' + self.ItemID = 0 + self.Count = 0 + self.IsBind = 0 + self.UserDataLen = 0 + self.UserData = '' + + 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.GUID, pos = CommFunc.ReadString(buf, pos, 36) + self.ItemID, pos = CommFunc.ReadDWORD(buf, pos) + self.Count, pos = CommFunc.ReadDWORD(buf, pos) + self.IsBind, pos = CommFunc.ReadBYTE(buf, pos) + self.UserDataLen, pos = CommFunc.ReadWORD(buf, pos) + tmp, pos = CommFunc.ReadString(buf, pos, self.UserDataLen) + self.UserData = ctypes.c_char_p(tmp) + return self.getLength() + + def getBuffer(self): + buf = '' + buf = CommFunc.WriteString(buf, sizeof(ctypes.c_char) * 36, self.GUID) + buf = CommFunc.WriteDWORD(buf, self.ItemID) + buf = CommFunc.WriteDWORD(buf, self.Count) + buf = CommFunc.WriteBYTE(buf, self.IsBind) + buf = CommFunc.WriteWORD(buf, self.UserDataLen) + buf = CommFunc.WriteString(buf, self.UserDataLen, self.UserData) + return buf + + def getLength(self): + length = 0 + length += sizeof(ctypes.c_char) * 36 + length += sizeof(ctypes.c_ulong) + length += sizeof(ctypes.c_ulong) + length += sizeof(ctypes.c_ubyte) + length += sizeof(ctypes.c_ushort) + length += self.UserDataLen + return length + + def outputString(self): + output = '''// 邮件物品表 #tagDBMailItem: + GUID = %s, + ItemID = %s, + Count = %s, + IsBind = %s, + UserDataLen = %s, + UserData = %s, + ADOResult = %s, + '''%( + self.GUID, + self.ItemID, + self.Count, + self.IsBind, + self.UserDataLen, + self.UserData, + self.ADOResult, + ) + return output + + #Char数组类型Set接口,使用该接口对此类型数据赋值,防止赋值的数据过长报错 + def SetGUID(self,Str): + if len(Str)<=36: + self.GUID = Str + else: + self.GUID = Str[:36] + + +# 邮件全服记录表 #tagDBMailPlayerRec +class tagDBMailPlayerRec(Structure): + _pack_ = 1 + _fields_ = [ + ('PlayerID', ctypes.c_ulong), + ('GUID', ctypes.c_char * 36), + ('MailState', ctypes.c_ubyte), + ('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.PlayerID, pos = CommFunc.ReadDWORD(buf, pos) + self.GUID, pos = CommFunc.ReadString(buf, pos, 36) + self.MailState, pos = CommFunc.ReadBYTE(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(tagDBMailPlayerRec) + + def outputString(self): + output = '''// 邮件全服记录表 #tagDBMailPlayerRec: + PlayerID = %s, + GUID = %s, + MailState = %s, + ADOResult = %s, + '''%( + self.PlayerID, + self.GUID, + self.MailState, + self.ADOResult, + ) + return output + + #Char数组类型Set接口,使用该接口对此类型数据赋值,防止赋值的数据过长报错 + def SetGUID(self,Str): + if len(Str)<=36: + self.GUID = Str + else: + self.GUID = Str[:36] + + +# 排行榜表 #tagDBBillboard +class tagDBBillboard(Structure): + _pack_ = 1 + _fields_ = [ + ('GroupValue1', ctypes.c_ulong), + ('GroupValue2', ctypes.c_ulong), + ('BillboardType', ctypes.c_ubyte), + ('ID', ctypes.c_ulong), + ('ID2', ctypes.c_ulong), + ('Name1', ctypes.c_char * 33), + ('Name2', ctypes.c_char * 65), + ('Type2', ctypes.c_ubyte), + ('Value1', ctypes.c_ulong), + ('Value2', ctypes.c_ulong), + ('Value3', ctypes.c_ulong), + ('Value4', ctypes.c_ulong), + ('Value5', ctypes.c_ulong), + ('Value6', ctypes.c_ulong), + ('Value7', ctypes.c_ulong), + ('Value8', ctypes.c_ulong), + ('CmpValue', ctypes.c_ulong), + ('CmpValue2', ctypes.c_ulong), + ('CmpValue3', ctypes.c_ulong), + ('DataLen', ctypes.c_ushort), + ('UserData', ctypes.c_char_p), + ('ADOResult', ctypes.c_ulong), + ] + + def __init__(self): + Structure.__init__(self) + self.clear() + + def clear(self): + self.GroupValue1 = 0 + self.GroupValue2 = 0 + self.BillboardType = 0 + self.ID = 0 + self.ID2 = 0 + self.Name1 = '' + self.Name2 = '' + self.Type2 = 0 + self.Value1 = 0 + self.Value2 = 0 + self.Value3 = 0 + self.Value4 = 0 + self.Value5 = 0 + self.Value6 = 0 + self.Value7 = 0 + self.Value8 = 0 + self.CmpValue = 0 + self.CmpValue2 = 0 + self.CmpValue3 = 0 + self.DataLen = 0 + self.UserData = '' + + 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.ReadDWORD(buf, pos) + self.GroupValue2, pos = CommFunc.ReadDWORD(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, 65) + self.Type2, pos = CommFunc.ReadBYTE(buf, pos) + self.Value1, pos = CommFunc.ReadDWORD(buf, pos) + self.Value2, pos = CommFunc.ReadDWORD(buf, pos) + self.Value3, pos = CommFunc.ReadDWORD(buf, pos) + self.Value4, pos = CommFunc.ReadDWORD(buf, pos) + self.Value5, pos = CommFunc.ReadDWORD(buf, pos) + self.Value6, pos = CommFunc.ReadDWORD(buf, pos) + self.Value7, pos = CommFunc.ReadDWORD(buf, pos) + self.Value8, 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) + self.DataLen, pos = CommFunc.ReadWORD(buf, pos) + tmp, pos = CommFunc.ReadString(buf, pos, self.DataLen) + self.UserData = ctypes.c_char_p(tmp) + return self.getLength() + + def getBuffer(self): + buf = '' + buf = CommFunc.WriteDWORD(buf, self.GroupValue1) + buf = CommFunc.WriteDWORD(buf, self.GroupValue2) + buf = CommFunc.WriteBYTE(buf, self.BillboardType) + buf = CommFunc.WriteDWORD(buf, self.ID) + buf = CommFunc.WriteDWORD(buf, self.ID2) + buf = CommFunc.WriteString(buf, sizeof(ctypes.c_char) * 33, self.Name1) + buf = CommFunc.WriteString(buf, sizeof(ctypes.c_char) * 65, self.Name2) + buf = CommFunc.WriteBYTE(buf, self.Type2) + buf = CommFunc.WriteDWORD(buf, self.Value1) + buf = CommFunc.WriteDWORD(buf, self.Value2) + buf = CommFunc.WriteDWORD(buf, self.Value3) + buf = CommFunc.WriteDWORD(buf, self.Value4) + buf = CommFunc.WriteDWORD(buf, self.Value5) + buf = CommFunc.WriteDWORD(buf, self.Value6) + buf = CommFunc.WriteDWORD(buf, self.Value7) + buf = CommFunc.WriteDWORD(buf, self.Value8) + buf = CommFunc.WriteDWORD(buf, self.CmpValue) + buf = CommFunc.WriteDWORD(buf, self.CmpValue2) + buf = CommFunc.WriteDWORD(buf, self.CmpValue3) + buf = CommFunc.WriteWORD(buf, self.DataLen) + buf = CommFunc.WriteString(buf, self.DataLen, self.UserData) + return buf + + def getLength(self): + length = 0 + length += sizeof(ctypes.c_ulong) + length += sizeof(ctypes.c_ulong) + length += sizeof(ctypes.c_ubyte) + length += sizeof(ctypes.c_ulong) + length += sizeof(ctypes.c_ulong) + length += sizeof(ctypes.c_char) * 33 + length += sizeof(ctypes.c_char) * 65 + length += sizeof(ctypes.c_ubyte) + length += sizeof(ctypes.c_ulong) + length += sizeof(ctypes.c_ulong) + length += sizeof(ctypes.c_ulong) + length += sizeof(ctypes.c_ulong) + length += sizeof(ctypes.c_ulong) + length += sizeof(ctypes.c_ulong) + length += sizeof(ctypes.c_ulong) + length += sizeof(ctypes.c_ulong) + length += sizeof(ctypes.c_ulong) + length += sizeof(ctypes.c_ulong) + length += sizeof(ctypes.c_ulong) + length += sizeof(ctypes.c_ushort) + length += self.DataLen + return length + + def outputString(self): + output = '''// 排行榜表 #tagDBBillboard: + GroupValue1 = %s, + GroupValue2 = %s, + BillboardType = %s, + ID = %s, + ID2 = %s, + Name1 = %s, + Name2 = %s, + Type2 = %s, + Value1 = %s, + Value2 = %s, + Value3 = %s, + Value4 = %s, + Value5 = %s, + Value6 = %s, + Value7 = %s, + Value8 = %s, + CmpValue = %s, + CmpValue2 = %s, + CmpValue3 = %s, + DataLen = %s, + UserData = %s, + ADOResult = %s, + '''%( + self.GroupValue1, + self.GroupValue2, + self.BillboardType, + self.ID, + self.ID2, + self.Name1, + self.Name2, + self.Type2, + self.Value1, + self.Value2, + self.Value3, + self.Value4, + self.Value5, + self.Value6, + self.Value7, + self.Value8, + self.CmpValue, + self.CmpValue2, + self.CmpValue3, + self.DataLen, + self.UserData, + 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)<=65: + self.Name2 = Str + else: + self.Name2 = Str[:65] + + +# 通用记录表新 #tagDBGameRec +class tagDBGameRec(Structure): + _pack_ = 1 + _fields_ = [ + ('RecType', ctypes.c_ushort), + ('RecID', ctypes.c_ulong), + ('Time', ctypes.c_double), + ('Value1', ctypes.c_ulong), + ('Value2', ctypes.c_ulong), + ('Value3', ctypes.c_ulong), + ('Value4', ctypes.c_ulong), + ('Value5', ctypes.c_ulong), + ('Value6', ctypes.c_ulong), + ('Value7', ctypes.c_ulong), + ('Value8', ctypes.c_ulong), + ('UserDataLen', ctypes.c_ushort), + ('UserData', ctypes.c_char_p), + ('ADOResult', ctypes.c_ulong), + ] + + def __init__(self): + Structure.__init__(self) + self.clear() + + def clear(self): + self.RecType = 0 + self.RecID = 0 + self.Time = 0.0 + self.Value1 = 0 + self.Value2 = 0 + self.Value3 = 0 + self.Value4 = 0 + self.Value5 = 0 + self.Value6 = 0 + self.Value7 = 0 + self.Value8 = 0 + self.UserDataLen = 0 + self.UserData = '' + + 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.RecType, pos = CommFunc.ReadWORD(buf, pos) + self.RecID, pos = CommFunc.ReadDWORD(buf, pos) + self.Time, pos = CommFunc.ReadDouble(buf, pos) + self.Value1, pos = CommFunc.ReadDWORD(buf, pos) + self.Value2, pos = CommFunc.ReadDWORD(buf, pos) + self.Value3, pos = CommFunc.ReadDWORD(buf, pos) + self.Value4, pos = CommFunc.ReadDWORD(buf, pos) + self.Value5, pos = CommFunc.ReadDWORD(buf, pos) + self.Value6, pos = CommFunc.ReadDWORD(buf, pos) + self.Value7, pos = CommFunc.ReadDWORD(buf, pos) + self.Value8, pos = CommFunc.ReadDWORD(buf, pos) + self.UserDataLen, pos = CommFunc.ReadWORD(buf, pos) + tmp, pos = CommFunc.ReadString(buf, pos, self.UserDataLen) + self.UserData = ctypes.c_char_p(tmp) + return self.getLength() + + def getBuffer(self): + buf = '' + buf = CommFunc.WriteWORD(buf, self.RecType) + buf = CommFunc.WriteDWORD(buf, self.RecID) + buf = CommFunc.WriteDouble(buf, self.Time) + buf = CommFunc.WriteDWORD(buf, self.Value1) + buf = CommFunc.WriteDWORD(buf, self.Value2) + buf = CommFunc.WriteDWORD(buf, self.Value3) + buf = CommFunc.WriteDWORD(buf, self.Value4) + buf = CommFunc.WriteDWORD(buf, self.Value5) + buf = CommFunc.WriteDWORD(buf, self.Value6) + buf = CommFunc.WriteDWORD(buf, self.Value7) + buf = CommFunc.WriteDWORD(buf, self.Value8) + buf = CommFunc.WriteWORD(buf, self.UserDataLen) + buf = CommFunc.WriteString(buf, self.UserDataLen, self.UserData) + return buf + + def getLength(self): + length = 0 + length += sizeof(ctypes.c_ushort) + length += sizeof(ctypes.c_ulong) + length += sizeof(ctypes.c_double) + length += sizeof(ctypes.c_ulong) + length += sizeof(ctypes.c_ulong) + length += sizeof(ctypes.c_ulong) + length += sizeof(ctypes.c_ulong) + length += sizeof(ctypes.c_ulong) + length += sizeof(ctypes.c_ulong) + length += sizeof(ctypes.c_ulong) + length += sizeof(ctypes.c_ulong) + length += sizeof(ctypes.c_ushort) + length += self.UserDataLen + return length + + def outputString(self): + output = '''// 通用记录表新 #tagDBGameRec: + RecType = %s, + RecID = %s, + Time = %s, + Value1 = %s, + Value2 = %s, + Value3 = %s, + Value4 = %s, + Value5 = %s, + Value6 = %s, + Value7 = %s, + Value8 = %s, + UserDataLen = %s, + UserData = %s, + ADOResult = %s, + '''%( + self.RecType, + self.RecID, + self.Time, + self.Value1, + self.Value2, + self.Value3, + self.Value4, + self.Value5, + self.Value6, + self.Value7, + self.Value8, + self.UserDataLen, + self.UserData, + self.ADOResult, + ) + return output + + +# 功能队伍表 #tagDBFuncTeam +class tagDBFuncTeam(Structure): + _pack_ = 1 + _fields_ = [ + ('TeamID', ctypes.c_ulong), + ('TeamName', ctypes.c_char * 33), + ('ZoneID', ctypes.c_ubyte), + ('FuncMapID', ctypes.c_ulong), + ('FuncMapEx', ctypes.c_ulong), + ('CreateTime', ctypes.c_ulong), + ('CaptainID', ctypes.c_ulong), + ('MinLV', ctypes.c_ushort), + ('MinFightPower', ctypes.c_ulong), + ('MinFightPowerEx', ctypes.c_ulong), + ('ServerOnly', ctypes.c_ubyte), + ('NeedCheck', ctypes.c_ubyte), + ('ApplyIDLen', ctypes.c_ushort), + ('ApplyIDList', ctypes.c_char_p), + ('Value1', ctypes.c_ulong), + ('Value2', ctypes.c_ulong), + ('Value3', ctypes.c_ulong), + ('Value4', ctypes.c_ulong), + ('Value5', ctypes.c_ulong), + ('ADOResult', ctypes.c_ulong), + ] + + def __init__(self): + Structure.__init__(self) + self.clear() + + def clear(self): + self.TeamID = 0 + self.TeamName = '' + self.ZoneID = 0 + self.FuncMapID = 0 + self.FuncMapEx = 0 + self.CreateTime = 0 + self.CaptainID = 0 + self.MinLV = 0 + self.MinFightPower = 0 + self.MinFightPowerEx = 0 + self.ServerOnly = 0 + self.NeedCheck = 0 + self.ApplyIDLen = 0 + self.ApplyIDList = '' + self.Value1 = 0 + self.Value2 = 0 + self.Value3 = 0 + self.Value4 = 0 + self.Value5 = 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.TeamID, pos = CommFunc.ReadDWORD(buf, pos) + self.TeamName, pos = CommFunc.ReadString(buf, pos, 33) + self.ZoneID, pos = CommFunc.ReadBYTE(buf, pos) + self.FuncMapID, pos = CommFunc.ReadDWORD(buf, pos) + self.FuncMapEx, pos = CommFunc.ReadDWORD(buf, pos) + self.CreateTime, pos = CommFunc.ReadDWORD(buf, pos) + self.CaptainID, pos = CommFunc.ReadDWORD(buf, pos) + self.MinLV, pos = CommFunc.ReadWORD(buf, pos) + self.MinFightPower, pos = CommFunc.ReadDWORD(buf, pos) + self.MinFightPowerEx, pos = CommFunc.ReadDWORD(buf, pos) + self.ServerOnly, pos = CommFunc.ReadBYTE(buf, pos) + self.NeedCheck, pos = CommFunc.ReadBYTE(buf, pos) + self.ApplyIDLen, pos = CommFunc.ReadWORD(buf, pos) + tmp, pos = CommFunc.ReadString(buf, pos, self.ApplyIDLen) + self.ApplyIDList = ctypes.c_char_p(tmp) + self.Value1, pos = CommFunc.ReadDWORD(buf, pos) + self.Value2, pos = CommFunc.ReadDWORD(buf, pos) + self.Value3, pos = CommFunc.ReadDWORD(buf, pos) + self.Value4, pos = CommFunc.ReadDWORD(buf, pos) + self.Value5, pos = CommFunc.ReadDWORD(buf, pos) + return self.getLength() + + def getBuffer(self): + buf = '' + buf = CommFunc.WriteDWORD(buf, self.TeamID) + buf = CommFunc.WriteString(buf, sizeof(ctypes.c_char) * 33, self.TeamName) + buf = CommFunc.WriteBYTE(buf, self.ZoneID) + buf = CommFunc.WriteDWORD(buf, self.FuncMapID) + buf = CommFunc.WriteDWORD(buf, self.FuncMapEx) + buf = CommFunc.WriteDWORD(buf, self.CreateTime) + buf = CommFunc.WriteDWORD(buf, self.CaptainID) + buf = CommFunc.WriteWORD(buf, self.MinLV) + buf = CommFunc.WriteDWORD(buf, self.MinFightPower) + buf = CommFunc.WriteDWORD(buf, self.MinFightPowerEx) + buf = CommFunc.WriteBYTE(buf, self.ServerOnly) + buf = CommFunc.WriteBYTE(buf, self.NeedCheck) + buf = CommFunc.WriteWORD(buf, self.ApplyIDLen) + buf = CommFunc.WriteString(buf, self.ApplyIDLen, self.ApplyIDList) + buf = CommFunc.WriteDWORD(buf, self.Value1) + buf = CommFunc.WriteDWORD(buf, self.Value2) + buf = CommFunc.WriteDWORD(buf, self.Value3) + buf = CommFunc.WriteDWORD(buf, self.Value4) + buf = CommFunc.WriteDWORD(buf, self.Value5) + return buf + + def getLength(self): + length = 0 + length += sizeof(ctypes.c_ulong) + length += sizeof(ctypes.c_char) * 33 + length += sizeof(ctypes.c_ubyte) + length += sizeof(ctypes.c_ulong) + length += sizeof(ctypes.c_ulong) + length += sizeof(ctypes.c_ulong) + length += sizeof(ctypes.c_ulong) + length += sizeof(ctypes.c_ushort) + length += sizeof(ctypes.c_ulong) + length += sizeof(ctypes.c_ulong) + length += sizeof(ctypes.c_ubyte) + length += sizeof(ctypes.c_ubyte) + length += sizeof(ctypes.c_ushort) + length += self.ApplyIDLen + length += sizeof(ctypes.c_ulong) + length += sizeof(ctypes.c_ulong) + length += sizeof(ctypes.c_ulong) + length += sizeof(ctypes.c_ulong) + length += sizeof(ctypes.c_ulong) + return length + + def outputString(self): + output = '''// 功能队伍表 #tagDBFuncTeam: + TeamID = %s, + TeamName = %s, + ZoneID = %s, + FuncMapID = %s, + FuncMapEx = %s, + CreateTime = %s, + CaptainID = %s, + MinLV = %s, + MinFightPower = %s, + MinFightPowerEx = %s, + ServerOnly = %s, + NeedCheck = %s, + ApplyIDLen = %s, + ApplyIDList = %s, + Value1 = %s, + Value2 = %s, + Value3 = %s, + Value4 = %s, + Value5 = %s, + ADOResult = %s, + '''%( + self.TeamID, + self.TeamName, + self.ZoneID, + self.FuncMapID, + self.FuncMapEx, + self.CreateTime, + self.CaptainID, + self.MinLV, + self.MinFightPower, + self.MinFightPowerEx, + self.ServerOnly, + self.NeedCheck, + self.ApplyIDLen, + self.ApplyIDList, + self.Value1, + self.Value2, + self.Value3, + self.Value4, + self.Value5, + self.ADOResult, + ) + return output + + #Char数组类型Set接口,使用该接口对此类型数据赋值,防止赋值的数据过长报错 + def SetTeamName(self,Str): + if len(Str)<=33: + self.TeamName = Str + else: + self.TeamName = Str[:33] + + +# 功能队伍成员表 #tagDBFuncTeamMem +class tagDBFuncTeamMem(Structure): + _pack_ = 1 + _fields_ = [ + ('TeamID', ctypes.c_ulong), + ('PlayerID', ctypes.c_ulong), + ('Value1', ctypes.c_ulong), + ('Value2', ctypes.c_ulong), + ('Value3', ctypes.c_ulong), + ('Value4', ctypes.c_ulong), + ('Value5', 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.TeamID, pos = CommFunc.ReadDWORD(buf, pos) + self.PlayerID, pos = CommFunc.ReadDWORD(buf, pos) + self.Value1, pos = CommFunc.ReadDWORD(buf, pos) + self.Value2, pos = CommFunc.ReadDWORD(buf, pos) + self.Value3, pos = CommFunc.ReadDWORD(buf, pos) + self.Value4, pos = CommFunc.ReadDWORD(buf, pos) + self.Value5, 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(tagDBFuncTeamMem) + + def outputString(self): + output = '''// 功能队伍成员表 #tagDBFuncTeamMem: + TeamID = %s, + PlayerID = %s, + Value1 = %s, + Value2 = %s, + Value3 = %s, + Value4 = %s, + Value5 = %s, + ADOResult = %s, + '''%( + self.TeamID, + self.PlayerID, + self.Value1, + self.Value2, + self.Value3, + self.Value4, + self.Value5, + self.ADOResult, + ) + return output + + + +#服务器世界数据表版本号 +GAMEWORLD_DATA_VERSION_NO = ctypes.c_ulong (\ + sizeof(tagDBEventTrig) + sizeof(tagDBFamily) + sizeof(tagDBFamilyMem) + sizeof(tagDBFamilyAction) + + sizeof(tagDBPlayerViewCache) + sizeof(tagDBMailPersonal) + sizeof(tagDBMailServer) + sizeof(tagDBMailItem) + + sizeof(tagDBMailPlayerRec) + sizeof(tagDBBillboard) + sizeof(tagDBGameRec) + sizeof(tagDBFuncTeam) + sizeof(tagDBFuncTeamMem) + ).value + \ No newline at end of file -- Gitblit v1.8.0