From 3a995ca6bc096918388d9474897eeb0e604351ed Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期五, 22 十一月 2019 10:55:24 +0800
Subject: [PATCH] 8346 【恺英】【后端】协助系统(增加DB协助表)

---
 ServerPython/CoreServerGroup/GameServer/Script/PyGameDataStruct.py |  192 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 192 insertions(+), 0 deletions(-)

diff --git a/ServerPython/CoreServerGroup/GameServer/Script/PyGameDataStruct.py b/ServerPython/CoreServerGroup/GameServer/Script/PyGameDataStruct.py
index 383f78c..70c0a92 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/PyGameDataStruct.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/PyGameDataStruct.py
@@ -15,6 +15,198 @@
 from ctypes import (Structure, memset, memmove, sizeof, addressof, create_string_buffer, string_at)
 import CommFunc
 
+# 协助表 #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),
+        ('AssistType', ctypes.c_ubyte),
+        ('AssistValue1', ctypes.c_ulong),
+        ('AssistValue2', ctypes.c_ulong),
+        ('AssistValue3', ctypes.c_ulong),
+        ('AssistValue4', ctypes.c_ulong),
+        ('AssistValue5', ctypes.c_ulong),
+        ('AssistDataLen', ctypes.c_ushort),
+        ('AssistData', ctypes.c_char_p),
+        ('FinishTime', ctypes.c_char * 19),
+        ('AssistState', 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.FamilyID = 0
+        self.PlayerID = 0
+        self.PlayerName = ''
+        self.Job = 0
+        self.LV = 0
+        self.RealmLV = 0
+        self.AssistType = 0
+        self.AssistValue1 = 0
+        self.AssistValue2 = 0
+        self.AssistValue3 = 0
+        self.AssistValue4 = 0
+        self.AssistValue5 = 0
+        self.AssistDataLen = 0
+        self.AssistData = ''
+        self.FinishTime = ''
+        self.AssistState = 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.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.AssistType, pos = CommFunc.ReadBYTE(buf, pos)
+        self.AssistValue1, pos = CommFunc.ReadDWORD(buf, pos)
+        self.AssistValue2, pos = CommFunc.ReadDWORD(buf, pos)
+        self.AssistValue3, pos = CommFunc.ReadDWORD(buf, pos)
+        self.AssistValue4, pos = CommFunc.ReadDWORD(buf, pos)
+        self.AssistValue5, pos = CommFunc.ReadDWORD(buf, pos)
+        self.AssistDataLen, pos = CommFunc.ReadWORD(buf, pos)
+        tmp, pos = CommFunc.ReadString(buf, pos, self.AssistDataLen)
+        self.AssistData = ctypes.c_char_p(tmp)
+        self.FinishTime, pos = CommFunc.ReadString(buf, pos, 19)
+        self.AssistState, 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.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.WriteBYTE(buf, self.AssistType)
+        buf = CommFunc.WriteDWORD(buf, self.AssistValue1)
+        buf = CommFunc.WriteDWORD(buf, self.AssistValue2)
+        buf = CommFunc.WriteDWORD(buf, self.AssistValue3)
+        buf = CommFunc.WriteDWORD(buf, self.AssistValue4)
+        buf = CommFunc.WriteDWORD(buf, self.AssistValue5)
+        buf = CommFunc.WriteWORD(buf, self.AssistDataLen)
+        buf = CommFunc.WriteString(buf, self.AssistDataLen, self.AssistData)
+        buf = CommFunc.WriteString(buf, sizeof(ctypes.c_char) * 19, self.FinishTime)
+        buf = CommFunc.WriteBYTE(buf, self.AssistState)
+        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_char) * 33
+        length += sizeof(ctypes.c_ubyte)
+        length += sizeof(ctypes.c_ushort)
+        length += sizeof(ctypes.c_ubyte)
+        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_ushort)
+        length += self.AssistDataLen
+        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 = '''// 协助表 #tagDBAssist:
+            GUID = %s,
+            FamilyID = %s,
+            PlayerID = %s,
+            PlayerName = %s,
+            Job = %s,
+            LV = %s,
+            RealmLV = %s,
+            AssistType = %s,
+            AssistValue1 = %s,
+            AssistValue2 = %s,
+            AssistValue3 = %s,
+            AssistValue4 = %s,
+            AssistValue5 = %s,
+            AssistDataLen = %s,
+            AssistData = %s,
+            FinishTime = %s,
+            AssistState = %s,
+            AssistPlayerLen = %s,
+            AssistPlayer = %s,
+            ADOResult = %s,
+            '''%(
+                self.GUID,
+                self.FamilyID,
+                self.PlayerID,
+                self.PlayerName,
+                self.Job,
+                self.LV,
+                self.RealmLV,
+                self.AssistType,
+                self.AssistValue1,
+                self.AssistValue2,
+                self.AssistValue3,
+                self.AssistValue4,
+                self.AssistValue5,
+                self.AssistDataLen,
+                self.AssistData,
+                self.FinishTime,
+                self.AssistState,
+                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 SetFinishTime(self,Str):
+        if len(Str)<=19:
+            self.FinishTime = Str
+        else:
+            self.FinishTime = Str[:19]
+            
+            
 # 玩家数据查看缓存表Py #tagPlayerViewCachePy
 class tagPlayerViewCachePy(Structure):
     _pack_ = 1

--
Gitblit v1.8.0