hxp
2019-02-21 93cdb5aeb0e9741388dd15dbe0ef280e046160aa
ServerPython/CoreServerGroup/GameServer/Script/PyGameDataStruct.py
@@ -15,6 +15,66 @@
from ctypes import (Structure, memset, memmove, sizeof, addressof, create_string_buffer, string_at)
import CommFunc
# 拍卖关注表 #tagDBAuctionAttention
class tagDBAuctionAttention(Structure):
    _pack_ = 1
    _fields_ = [
        ('PlayerID', ctypes.c_ulong),
        ('AttentionLen', ctypes.c_ubyte),
        ('AttentionInfo', ctypes.c_char_p),
        ('ADOResult', ctypes.c_ulong),
    ]
    def __init__(self):
        Structure.__init__(self)
        self.clear()
    def clear(self):
        self.PlayerID = 0
        self.AttentionLen = 0
        self.AttentionInfo = ''
    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.AttentionLen, pos = CommFunc.ReadBYTE(buf, pos)
        tmp, pos = CommFunc.ReadString(buf, pos, self.AttentionLen)
        self.AttentionInfo = ctypes.c_char_p(tmp)
        return self.getLength()
    def getBuffer(self):
        buf = ''
        buf = CommFunc.WriteDWORD(buf, self.PlayerID)
        buf = CommFunc.WriteBYTE(buf, self.AttentionLen)
        buf = CommFunc.WriteString(buf, self.AttentionLen, self.AttentionInfo)
        return buf
    def getLength(self):
        length = 0
        length += sizeof(ctypes.c_ulong)
        length += sizeof(ctypes.c_ubyte)
        length += self.AttentionLen
        return length
    def outputString(self):
        output = '''// 拍卖关注表 #tagDBAuctionAttention:
            PlayerID = %s,
            AttentionLen = %s,
            AttentionInfo = %s,
            ADOResult = %s,
            '''%(
                self.PlayerID,
                self.AttentionLen,
                self.AttentionInfo,
                self.ADOResult,
            )
        return output
# 拍卖记录表 #tagDBAuctionRecord
class tagDBAuctionRecord(Structure):
    _pack_ = 1
@@ -145,6 +205,8 @@
        ('UserData', ctypes.c_char_p),
        ('FamilyPlayerIDLen', ctypes.c_ushort),
        ('FamilyPlayerIDInfo', ctypes.c_char_p),
        ('BidderIDLen', ctypes.c_ubyte),
        ('BidderIDInfo', ctypes.c_char_p),
        ('ADOResult', ctypes.c_ulong),
    ]
@@ -170,6 +232,8 @@
        self.UserData = ''
        self.FamilyPlayerIDLen = 0
        self.FamilyPlayerIDInfo = ''
        self.BidderIDLen = 0
        self.BidderIDInfo = ''
    def readData(self, buf, pos = 0, length = 0):
        if not pos <= length:
@@ -196,6 +260,9 @@
        self.FamilyPlayerIDLen, pos = CommFunc.ReadWORD(buf, pos)
        tmp, pos = CommFunc.ReadString(buf, pos, self.FamilyPlayerIDLen)
        self.FamilyPlayerIDInfo = ctypes.c_char_p(tmp)
        self.BidderIDLen, pos = CommFunc.ReadBYTE(buf, pos)
        tmp, pos = CommFunc.ReadString(buf, pos, self.BidderIDLen)
        self.BidderIDInfo = ctypes.c_char_p(tmp)
        return self.getLength()
    def getBuffer(self):
@@ -217,6 +284,8 @@
        buf = CommFunc.WriteString(buf, self.UserDataLen, self.UserData)
        buf = CommFunc.WriteWORD(buf, self.FamilyPlayerIDLen)
        buf = CommFunc.WriteString(buf, self.FamilyPlayerIDLen, self.FamilyPlayerIDInfo)
        buf = CommFunc.WriteBYTE(buf, self.BidderIDLen)
        buf = CommFunc.WriteString(buf, self.BidderIDLen, self.BidderIDInfo)
        return buf
    def getLength(self):
@@ -238,6 +307,8 @@
        length += self.UserDataLen
        length += sizeof(ctypes.c_ushort)
        length += self.FamilyPlayerIDLen
        length += sizeof(ctypes.c_ubyte)
        length += self.BidderIDLen
        return length
    def outputString(self):
@@ -259,6 +330,8 @@
            UserData = %s,
            FamilyPlayerIDLen = %s,
            FamilyPlayerIDInfo = %s,
            BidderIDLen = %s,
            BidderIDInfo = %s,
            ADOResult = %s,
            '''%(
                self.ItemGUID,
@@ -278,6 +351,8 @@
                self.UserData,
                self.FamilyPlayerIDLen,
                self.FamilyPlayerIDInfo,
                self.BidderIDLen,
                self.BidderIDInfo,
                self.ADOResult,
            )
        return output