From 19e0109ec1e936204cb85362d2e3f705b8b9554c Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期四, 03 十二月 2020 11:19:38 +0800
Subject: [PATCH] 8585 【主干】【BT】【长尾】【后端】竞技场(封包)
---
ServerPython/CoreServerGroup/GameServer/Script/PyGameDataStruct.py | 327 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 327 insertions(+), 0 deletions(-)
diff --git a/ServerPython/CoreServerGroup/GameServer/Script/PyGameDataStruct.py b/ServerPython/CoreServerGroup/GameServer/Script/PyGameDataStruct.py
index 383f78c..e5a824c 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/PyGameDataStruct.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/PyGameDataStruct.py
@@ -15,6 +15,333 @@
from ctypes import (Structure, memset, memmove, sizeof, addressof, create_string_buffer, string_at)
import CommFunc
+# 协助感谢表 #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