hxp
2019-02-21 93cdb5aeb0e9741388dd15dbe0ef280e046160aa
6250 【后端】【2.0】拍卖行开发单(拍卖关注表)
3个文件已修改
107 ■■■■■ 已修改文件
ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/AuctionHouse.py 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/CoreServerGroup/GameServer/Script/PyDataManager.py 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/CoreServerGroup/GameServer/Script/PyGameDataStruct.py 75 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/CoreServerGroup/GameServer/Script/GameWorldLogic/AuctionHouse.py
@@ -18,6 +18,31 @@
import GameWorld
#拍卖关注管理,注意该类只处理数据逻辑,功能相关逻辑不要写在该类,不然重读脚本不会生效
class AuctionAttentionManager(object):
    def __init__(self):
        return
    ## ===========================================================================================
    # 保存数据 存数据库和realtimebackup
    def GetSaveData(self):
        savaData = ""
        cntData = ""
        cnt = 0
        GameWorld.Log("Save AuctionAttention count :%s" % cnt)
        return CommFunc.WriteDWORD(cntData, cnt) + savaData
    # 从数据库载入数据
    def LoadPyGameData(self, datas, pos, dataslen):
        cnt, pos = CommFunc.ReadDWORD(datas, pos)
        GameWorld.Log("Load AuctionAttention count :%s" % cnt)
        return pos
#拍卖记录管理,注意该类只处理数据逻辑,功能相关逻辑不要写在该类,不然重读脚本不会生效
class AuctionRecordManager(object):
    
ServerPython/CoreServerGroup/GameServer/Script/PyDataManager.py
@@ -45,6 +45,7 @@
class PyGameDataManager(object):
    def __init__(self):
        self.AuctionAttention = AuctionHouse.AuctionAttentionManager()
        self.AuctionRecord = AuctionHouse.AuctionRecordManager()
        self.AuctionItem = AuctionHouse.AuctionItemManager()
        self.crossPKUnNotifyOverInfo = CrossRealmPK.CrossPKUnNotifyOverInfoManager()
@@ -64,6 +65,7 @@
    def GetSaveData(self):
        buff = ""
        buff += self.AuctionAttention.GetSaveData()
        buff += self.AuctionRecord.GetSaveData()
        buff += self.AuctionItem.GetSaveData()
        buff += self.crossPKUnNotifyOverInfo.GetSaveData()
@@ -82,6 +84,7 @@
        return buff
    
    def LoadGameData(self, gameBuffer, pos):
        pos = self.AuctionAttention.LoadPyGameData(gameBuffer, pos, len(gameBuffer))
        pos = self.AuctionRecord.LoadPyGameData(gameBuffer, pos, len(gameBuffer))
        pos = self.AuctionItem.LoadPyGameData(gameBuffer, pos, len(gameBuffer))
        pos = self.crossPKUnNotifyOverInfo.LoadPyGameData(gameBuffer, pos, len(gameBuffer))
@@ -100,6 +103,10 @@
        return pos
# 拍卖记录表
def GetAuctionAttentionManager():
    return PyGameData.g_pyGameDataManager.AuctionAttention
# 拍卖记录表
def GetAuctionRecordManager():
    return PyGameData.g_pyGameDataManager.AuctionRecord
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