From 02a4f8f2fe8c82b82e8801d6b47f62fdc728c332 Mon Sep 17 00:00:00 2001 From: hxp <ale99527@vip.qq.com> Date: 星期一, 21 六月 2021 16:50:30 +0800 Subject: [PATCH] 5089 【主干】【BT2】超级助力重读充值表和充值编号表异常(修复充值表新增数据热更重读后登录无法同步新数据的bug) --- ServerPython/CoreServerGroup/GameServer/Script/PyGameDataStruct.py | 578 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 578 insertions(+), 0 deletions(-) diff --git a/ServerPython/CoreServerGroup/GameServer/Script/PyGameDataStruct.py b/ServerPython/CoreServerGroup/GameServer/Script/PyGameDataStruct.py index 383f78c..bcb5cc3 100644 --- a/ServerPython/CoreServerGroup/GameServer/Script/PyGameDataStruct.py +++ b/ServerPython/CoreServerGroup/GameServer/Script/PyGameDataStruct.py @@ -15,6 +15,584 @@ 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 + _fields_ = [ + ('GUID', ctypes.c_char * 40), + ('ItemID', ctypes.c_ulong), + ('FamilyID', ctypes.c_ulong), + ('PlayerID', ctypes.c_ulong), + ('PlayerName', ctypes.c_char * 33), + ('Job', ctypes.c_ubyte), + ('LV', ctypes.c_ushort), + ('RealmLV', ctypes.c_ubyte), + ('MapID', ctypes.c_ulong), + ('LineID', ctypes.c_ulong), + ('NPCID', ctypes.c_ulong), + ('ExDataLen', ctypes.c_ushort), + ('ExData', ctypes.c_char_p), + ('DailyDateStr', ctypes.c_char * 10), + ('TimeStr', ctypes.c_char * 19), + ('ThanksState', ctypes.c_ubyte), + ('AssistPlayerLen', ctypes.c_ushort), + ('AssistPlayer', 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.FamilyID = 0 + self.PlayerID = 0 + self.PlayerName = '' + self.Job = 0 + self.LV = 0 + self.RealmLV = 0 + self.MapID = 0 + self.LineID = 0 + self.NPCID = 0 + self.ExDataLen = 0 + self.ExData = '' + self.DailyDateStr = '' + self.TimeStr = '' + self.ThanksState = 0 + self.AssistPlayerLen = 0 + self.AssistPlayer = '' + + 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, 40) + self.ItemID, pos = CommFunc.ReadDWORD(buf, pos) + self.FamilyID, pos = CommFunc.ReadDWORD(buf, pos) + self.PlayerID, pos = CommFunc.ReadDWORD(buf, pos) + self.PlayerName, pos = CommFunc.ReadString(buf, pos, 33) + self.Job, pos = CommFunc.ReadBYTE(buf, pos) + self.LV, pos = CommFunc.ReadWORD(buf, pos) + self.RealmLV, pos = CommFunc.ReadBYTE(buf, pos) + self.MapID, pos = CommFunc.ReadDWORD(buf, pos) + self.LineID, pos = CommFunc.ReadDWORD(buf, pos) + self.NPCID, pos = CommFunc.ReadDWORD(buf, pos) + self.ExDataLen, pos = CommFunc.ReadWORD(buf, pos) + tmp, pos = CommFunc.ReadString(buf, pos, self.ExDataLen) + self.ExData = ctypes.c_char_p(tmp) + self.DailyDateStr, pos = CommFunc.ReadString(buf, pos, 10) + self.TimeStr, pos = CommFunc.ReadString(buf, pos, 19) + self.ThanksState, pos = CommFunc.ReadBYTE(buf, pos) + self.AssistPlayerLen, pos = CommFunc.ReadWORD(buf, pos) + tmp, pos = CommFunc.ReadString(buf, pos, self.AssistPlayerLen) + self.AssistPlayer = ctypes.c_char_p(tmp) + return self.getLength() + + def getBuffer(self): + buf = '' + buf = CommFunc.WriteString(buf, sizeof(ctypes.c_char) * 40, self.GUID) + buf = CommFunc.WriteDWORD(buf, self.ItemID) + buf = CommFunc.WriteDWORD(buf, self.FamilyID) + buf = CommFunc.WriteDWORD(buf, self.PlayerID) + buf = CommFunc.WriteString(buf, sizeof(ctypes.c_char) * 33, self.PlayerName) + buf = CommFunc.WriteBYTE(buf, self.Job) + buf = CommFunc.WriteWORD(buf, self.LV) + buf = CommFunc.WriteBYTE(buf, self.RealmLV) + buf = CommFunc.WriteDWORD(buf, self.MapID) + buf = CommFunc.WriteDWORD(buf, self.LineID) + buf = CommFunc.WriteDWORD(buf, self.NPCID) + buf = CommFunc.WriteWORD(buf, self.ExDataLen) + buf = CommFunc.WriteString(buf, self.ExDataLen, self.ExData) + buf = CommFunc.WriteString(buf, sizeof(ctypes.c_char) * 10, self.DailyDateStr) + buf = CommFunc.WriteString(buf, sizeof(ctypes.c_char) * 19, self.TimeStr) + buf = CommFunc.WriteBYTE(buf, self.ThanksState) + buf = CommFunc.WriteWORD(buf, self.AssistPlayerLen) + buf = CommFunc.WriteString(buf, self.AssistPlayerLen, self.AssistPlayer) + return buf + + def getLength(self): + length = 0 + length += sizeof(ctypes.c_char) * 40 + length += sizeof(ctypes.c_ulong) + length += sizeof(ctypes.c_ulong) + length += sizeof(ctypes.c_ulong) + length += sizeof(ctypes.c_char) * 33 + length += sizeof(ctypes.c_ubyte) + length += sizeof(ctypes.c_ushort) + length += sizeof(ctypes.c_ubyte) + length += sizeof(ctypes.c_ulong) + length += sizeof(ctypes.c_ulong) + length += sizeof(ctypes.c_ulong) + length += sizeof(ctypes.c_ushort) + length += self.ExDataLen + length += sizeof(ctypes.c_char) * 10 + length += sizeof(ctypes.c_char) * 19 + length += sizeof(ctypes.c_ubyte) + length += sizeof(ctypes.c_ushort) + length += self.AssistPlayerLen + return length + + def outputString(self): + output = '''// 协助感谢表 #tagDBAssistThanks: + GUID = %s, + ItemID = %s, + FamilyID = %s, + PlayerID = %s, + PlayerName = %s, + Job = %s, + LV = %s, + RealmLV = %s, + MapID = %s, + LineID = %s, + NPCID = %s, + ExDataLen = %s, + ExData = %s, + DailyDateStr = %s, + TimeStr = %s, + ThanksState = %s, + AssistPlayerLen = %s, + AssistPlayer = %s, + ADOResult = %s, + '''%( + self.GUID, + self.ItemID, + self.FamilyID, + self.PlayerID, + self.PlayerName, + self.Job, + self.LV, + self.RealmLV, + self.MapID, + self.LineID, + self.NPCID, + self.ExDataLen, + self.ExData, + self.DailyDateStr, + self.TimeStr, + self.ThanksState, + self.AssistPlayerLen, + self.AssistPlayer, + self.ADOResult, + ) + return output + + #Char数组类型Set接口,使用该接口对此类型数据赋值,防止赋值的数据过长报错 + def SetGUID(self,Str): + if len(Str)<=40: + self.GUID = Str + else: + self.GUID = Str[:40] + + def SetPlayerName(self,Str): + if len(Str)<=33: + self.PlayerName = Str + else: + self.PlayerName = Str[:33] + + def SetDailyDateStr(self,Str): + if len(Str)<=10: + self.DailyDateStr = Str + else: + self.DailyDateStr = Str[:10] + + def SetTimeStr(self,Str): + if len(Str)<=19: + self.TimeStr = Str + else: + self.TimeStr = Str[:19] + + +# 协助表 #tagDBAssist +class tagDBAssist(Structure): + _pack_ = 1 + _fields_ = [ + ('GUID', ctypes.c_char * 40), + ('FamilyID', ctypes.c_ulong), + ('PlayerID', ctypes.c_ulong), + ('PlayerName', ctypes.c_char * 33), + ('Job', ctypes.c_ubyte), + ('LV', ctypes.c_ushort), + ('RealmLV', ctypes.c_ubyte), + ('MapID', ctypes.c_ulong), + ('LineID', ctypes.c_ulong), + ('NPCID', ctypes.c_ulong), + ('ExDataLen', ctypes.c_ushort), + ('ExData', ctypes.c_char_p), + ('ADOResult', ctypes.c_ulong), + ] + + def __init__(self): + Structure.__init__(self) + self.clear() + + def clear(self): + self.GUID = '' + self.FamilyID = 0 + self.PlayerID = 0 + self.PlayerName = '' + self.Job = 0 + self.LV = 0 + self.RealmLV = 0 + self.MapID = 0 + self.LineID = 0 + self.NPCID = 0 + self.ExDataLen = 0 + self.ExData = '' + + 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, 40) + self.FamilyID, pos = CommFunc.ReadDWORD(buf, pos) + self.PlayerID, pos = CommFunc.ReadDWORD(buf, pos) + self.PlayerName, pos = CommFunc.ReadString(buf, pos, 33) + self.Job, pos = CommFunc.ReadBYTE(buf, pos) + self.LV, pos = CommFunc.ReadWORD(buf, pos) + self.RealmLV, pos = CommFunc.ReadBYTE(buf, pos) + self.MapID, pos = CommFunc.ReadDWORD(buf, pos) + self.LineID, pos = CommFunc.ReadDWORD(buf, pos) + self.NPCID, pos = CommFunc.ReadDWORD(buf, pos) + self.ExDataLen, pos = CommFunc.ReadWORD(buf, pos) + tmp, pos = CommFunc.ReadString(buf, pos, self.ExDataLen) + self.ExData = ctypes.c_char_p(tmp) + return self.getLength() + + def getBuffer(self): + buf = '' + buf = CommFunc.WriteString(buf, sizeof(ctypes.c_char) * 40, self.GUID) + buf = CommFunc.WriteDWORD(buf, self.FamilyID) + buf = CommFunc.WriteDWORD(buf, self.PlayerID) + buf = CommFunc.WriteString(buf, sizeof(ctypes.c_char) * 33, self.PlayerName) + buf = CommFunc.WriteBYTE(buf, self.Job) + buf = CommFunc.WriteWORD(buf, self.LV) + buf = CommFunc.WriteBYTE(buf, self.RealmLV) + buf = CommFunc.WriteDWORD(buf, self.MapID) + buf = CommFunc.WriteDWORD(buf, self.LineID) + buf = CommFunc.WriteDWORD(buf, self.NPCID) + buf = CommFunc.WriteWORD(buf, self.ExDataLen) + buf = CommFunc.WriteString(buf, self.ExDataLen, self.ExData) + return buf + + def getLength(self): + length = 0 + length += sizeof(ctypes.c_char) * 40 + length += sizeof(ctypes.c_ulong) + length += sizeof(ctypes.c_ulong) + length += sizeof(ctypes.c_char) * 33 + length += sizeof(ctypes.c_ubyte) + length += sizeof(ctypes.c_ushort) + length += sizeof(ctypes.c_ubyte) + length += sizeof(ctypes.c_ulong) + length += sizeof(ctypes.c_ulong) + length += sizeof(ctypes.c_ulong) + length += sizeof(ctypes.c_ushort) + length += self.ExDataLen + return length + + def outputString(self): + output = '''// 协助表 #tagDBAssist: + GUID = %s, + FamilyID = %s, + PlayerID = %s, + PlayerName = %s, + Job = %s, + LV = %s, + RealmLV = %s, + MapID = %s, + LineID = %s, + NPCID = %s, + ExDataLen = %s, + ExData = %s, + ADOResult = %s, + '''%( + self.GUID, + self.FamilyID, + self.PlayerID, + self.PlayerName, + self.Job, + self.LV, + self.RealmLV, + self.MapID, + self.LineID, + self.NPCID, + self.ExDataLen, + self.ExData, + self.ADOResult, + ) + return output + + #Char数组类型Set接口,使用该接口对此类型数据赋值,防止赋值的数据过长报错 + def SetGUID(self,Str): + if len(Str)<=40: + self.GUID = Str + else: + self.GUID = Str[:40] + + def SetPlayerName(self,Str): + if len(Str)<=33: + self.PlayerName = Str + else: + self.PlayerName = Str[:33] + + # 玩家数据查看缓存表Py #tagPlayerViewCachePy class tagPlayerViewCachePy(Structure): _pack_ = 1 -- Gitblit v1.8.0