From eb2b495812782c219d963559e840d1be46c5c846 Mon Sep 17 00:00:00 2001 From: hxp <ale99527@vip.qq.com> Date: 星期三, 14 五月 2025 11:46:47 +0800 Subject: [PATCH] 16 卡牌服务端(邮件功能;) --- ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/DB/DBStruct.py | 402 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 402 insertions(+), 0 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..c258a1a 100644 --- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/DB/DBStruct.py +++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/DB/DBStruct.py @@ -1236,3 +1236,405 @@ 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] + -- Gitblit v1.8.0