From a7e72a169ff9fbd6d9d061f7352a130b8d53f9a6 Mon Sep 17 00:00:00 2001 From: hxp <ale99527@vip.qq.com> Date: 星期五, 16 五月 2025 15:46:43 +0800 Subject: [PATCH] 16 卡牌服务端(排行榜) --- ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/DB/DBStruct.py | 199 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 199 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 2ca0b00..5f67798 100644 --- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/DB/DBStruct.py +++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/DB/DBStruct.py @@ -1698,3 +1698,202 @@ 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] + -- Gitblit v1.8.0