From 1ea73e1885835466265ce788d93556b7030ee0e8 Mon Sep 17 00:00:00 2001 From: hxp <ale99527@vip.qq.com> Date: 星期日, 30 十二月 2018 18:42:00 +0800 Subject: [PATCH] 5424 【后端】【1.4】跨服竞技场开发(GM工具增加子服服务器维护,文字翻译版) --- ServerPython/CoreServerGroup/GameServer/Script/PyGameDataStruct.py | 237 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 237 insertions(+), 0 deletions(-) diff --git a/ServerPython/CoreServerGroup/GameServer/Script/PyGameDataStruct.py b/ServerPython/CoreServerGroup/GameServer/Script/PyGameDataStruct.py index 8be9ddc..a5a2017 100644 --- a/ServerPython/CoreServerGroup/GameServer/Script/PyGameDataStruct.py +++ b/ServerPython/CoreServerGroup/GameServer/Script/PyGameDataStruct.py @@ -15,6 +15,243 @@ from ctypes import (Structure, memset, memmove, sizeof, addressof, create_string_buffer, string_at) import CommFunc +# 跨服竞技场未通知玩家的比赛结果表 #tagDBCrossPKUnNotifyOverInfo +class tagDBCrossPKUnNotifyOverInfo(Structure): + _pack_ = 1 + _fields_ = [ + ('ZoneID', ctypes.c_ubyte), + ('SeasonID', ctypes.c_ubyte), + ('RoomID', ctypes.c_ushort), + ('TimeStr', ctypes.c_char * 19), + ('OverType', ctypes.c_ubyte), + ('PlayerID', ctypes.c_ulong), + ('WinnerID', ctypes.c_ulong), + ('RoundWinnerLen', ctypes.c_ubyte), + ('RoundWinnerInfo', ctypes.c_char_p), + ('PKScore', ctypes.c_ulong), + ('DanLV', ctypes.c_ubyte), + ('CWinCount', ctypes.c_ushort), + ('AddScore', ctypes.c_ushort), + ('TagPlayerID', ctypes.c_ulong), + ('TagPlayerName', ctypes.c_char * 33), + ('ADOResult', ctypes.c_ulong), + ] + + def __init__(self): + Structure.__init__(self) + self.clear() + + def clear(self): + self.ZoneID = 0 + self.SeasonID = 0 + self.RoomID = 0 + self.TimeStr = '' + self.OverType = 0 + self.PlayerID = 0 + self.WinnerID = 0 + self.RoundWinnerLen = 0 + self.RoundWinnerInfo = '' + self.PKScore = 0 + self.DanLV = 0 + self.CWinCount = 0 + self.AddScore = 0 + self.TagPlayerID = 0 + self.TagPlayerName = '' + + 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.ZoneID, pos = CommFunc.ReadBYTE(buf, pos) + self.SeasonID, pos = CommFunc.ReadBYTE(buf, pos) + self.RoomID, pos = CommFunc.ReadWORD(buf, pos) + self.TimeStr, pos = CommFunc.ReadString(buf, pos, 19) + self.OverType, pos = CommFunc.ReadBYTE(buf, pos) + self.PlayerID, pos = CommFunc.ReadDWORD(buf, pos) + self.WinnerID, pos = CommFunc.ReadDWORD(buf, pos) + self.RoundWinnerLen, pos = CommFunc.ReadBYTE(buf, pos) + tmp, pos = CommFunc.ReadString(buf, pos, self.RoundWinnerLen) + self.RoundWinnerInfo = ctypes.c_char_p(tmp) + self.PKScore, pos = CommFunc.ReadDWORD(buf, pos) + self.DanLV, pos = CommFunc.ReadBYTE(buf, pos) + self.CWinCount, pos = CommFunc.ReadWORD(buf, pos) + self.AddScore, pos = CommFunc.ReadWORD(buf, pos) + self.TagPlayerID, pos = CommFunc.ReadDWORD(buf, pos) + self.TagPlayerName, pos = CommFunc.ReadString(buf, pos, 33) + return self.getLength() + + def getBuffer(self): + buf = '' + buf = CommFunc.WriteBYTE(buf, self.ZoneID) + buf = CommFunc.WriteBYTE(buf, self.SeasonID) + buf = CommFunc.WriteWORD(buf, self.RoomID) + buf = CommFunc.WriteString(buf, sizeof(ctypes.c_char) * 19, self.TimeStr) + buf = CommFunc.WriteBYTE(buf, self.OverType) + buf = CommFunc.WriteDWORD(buf, self.PlayerID) + buf = CommFunc.WriteDWORD(buf, self.WinnerID) + buf = CommFunc.WriteBYTE(buf, self.RoundWinnerLen) + buf = CommFunc.WriteString(buf, self.RoundWinnerLen, self.RoundWinnerInfo) + buf = CommFunc.WriteDWORD(buf, self.PKScore) + buf = CommFunc.WriteBYTE(buf, self.DanLV) + buf = CommFunc.WriteWORD(buf, self.CWinCount) + buf = CommFunc.WriteWORD(buf, self.AddScore) + buf = CommFunc.WriteDWORD(buf, self.TagPlayerID) + buf = CommFunc.WriteString(buf, sizeof(ctypes.c_char) * 33, self.TagPlayerName) + return buf + + def getLength(self): + length = 0 + length += sizeof(ctypes.c_ubyte) + length += sizeof(ctypes.c_ubyte) + length += sizeof(ctypes.c_ushort) + length += sizeof(ctypes.c_char) * 19 + length += sizeof(ctypes.c_ubyte) + length += sizeof(ctypes.c_ulong) + length += sizeof(ctypes.c_ulong) + length += sizeof(ctypes.c_ubyte) + length += self.RoundWinnerLen + length += sizeof(ctypes.c_ulong) + length += sizeof(ctypes.c_ubyte) + length += sizeof(ctypes.c_ushort) + length += sizeof(ctypes.c_ushort) + length += sizeof(ctypes.c_ulong) + length += sizeof(ctypes.c_char) * 33 + return length + + def outputString(self): + output = '''// 跨服竞技场未通知玩家的比赛结果表 #tagDBCrossPKUnNotifyOverInfo: + ZoneID = %s, + SeasonID = %s, + RoomID = %s, + TimeStr = %s, + OverType = %s, + PlayerID = %s, + WinnerID = %s, + RoundWinnerLen = %s, + RoundWinnerInfo = %s, + PKScore = %s, + DanLV = %s, + CWinCount = %s, + AddScore = %s, + TagPlayerID = %s, + TagPlayerName = %s, + ADOResult = %s, + '''%( + self.ZoneID, + self.SeasonID, + self.RoomID, + self.TimeStr, + self.OverType, + self.PlayerID, + self.WinnerID, + self.RoundWinnerLen, + self.RoundWinnerInfo, + self.PKScore, + self.DanLV, + self.CWinCount, + self.AddScore, + self.TagPlayerID, + self.TagPlayerName, + self.ADOResult, + ) + return output + + #Char数组类型Set接口,使用该接口对此类型数据赋值,防止赋值的数据过长报错 + def SetTimeStr(self,Str): + if len(Str)<=19: + self.TimeStr = Str + else: + self.TimeStr = Str[:19] + + def SetTagPlayerName(self,Str): + if len(Str)<=33: + self.TagPlayerName = Str + else: + self.TagPlayerName = Str[:33] + + +# 跨服竞技场PK排行榜 #tagDBCrossPKBillboard +class tagDBCrossPKBillboard(Structure): + _pack_ = 1 + _fields_ = [ + ('ZoneID', ctypes.c_ubyte), + ('SeasonID', ctypes.c_ubyte), + ('PlayerID', ctypes.c_ulong), + ('PlayerName', ctypes.c_char * 33), + ('Job', ctypes.c_ubyte), + ('FightPower', ctypes.c_ulong), + ('RealmLV', ctypes.c_ushort), + ('PKScore', ctypes.c_ulong), + ('DanLV', ctypes.c_ubyte), + ('Time', 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() + memmove(addressof(self), buf[pos:], self.getLength()) + 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(tagDBCrossPKBillboard) + + def outputString(self): + output = '''// 跨服竞技场PK排行榜 #tagDBCrossPKBillboard: + ZoneID = %s, + SeasonID = %s, + PlayerID = %s, + PlayerName = %s, + Job = %s, + FightPower = %s, + RealmLV = %s, + PKScore = %s, + DanLV = %s, + Time = %s, + ADOResult = %s, + '''%( + self.ZoneID, + self.SeasonID, + self.PlayerID, + self.PlayerName, + self.Job, + self.FightPower, + self.RealmLV, + self.PKScore, + self.DanLV, + self.Time, + self.ADOResult, + ) + return output + + #Char数组类型Set接口,使用该接口对此类型数据赋值,防止赋值的数据过长报错 + def SetPlayerName(self,Str): + if len(Str)<=33: + self.PlayerName = Str + else: + self.PlayerName = Str[:33] + + #仙魔之争记录表#tagDBPyXMZZ class tagDBPyXMZZ(Structure): _pack_ = 1 -- Gitblit v1.8.0