6250 【后端】【2.0】拍卖行开发单(拍卖关注表)
| | |
| | | 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):
|
| | |
|
| | |
| | |
|
| | | class PyGameDataManager(object):
|
| | | def __init__(self):
|
| | | self.AuctionAttention = AuctionHouse.AuctionAttentionManager()
|
| | | self.AuctionRecord = AuctionHouse.AuctionRecordManager()
|
| | | self.AuctionItem = AuctionHouse.AuctionItemManager()
|
| | | self.crossPKUnNotifyOverInfo = CrossRealmPK.CrossPKUnNotifyOverInfoManager()
|
| | |
| | |
|
| | | def GetSaveData(self):
|
| | | buff = ""
|
| | | buff += self.AuctionAttention.GetSaveData()
|
| | | buff += self.AuctionRecord.GetSaveData()
|
| | | buff += self.AuctionItem.GetSaveData()
|
| | | buff += self.crossPKUnNotifyOverInfo.GetSaveData()
|
| | |
| | | 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))
|
| | |
| | | return pos
|
| | |
|
| | | # 拍卖记录表
|
| | | def GetAuctionAttentionManager():
|
| | | return PyGameData.g_pyGameDataManager.AuctionAttention
|
| | |
|
| | | # 拍卖记录表
|
| | | def GetAuctionRecordManager():
|
| | | return PyGameData.g_pyGameDataManager.AuctionRecord
|
| | |
|
| | |
| | | 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
|
| | |
| | | ('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),
|
| | | ]
|
| | |
|
| | |
| | | self.UserData = ''
|
| | | self.FamilyPlayerIDLen = 0
|
| | | self.FamilyPlayerIDInfo = ''
|
| | | self.BidderIDLen = 0
|
| | | self.BidderIDInfo = ''
|
| | |
|
| | | def readData(self, buf, pos = 0, length = 0):
|
| | | if not pos <= length:
|
| | |
| | | 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):
|
| | |
| | | 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):
|
| | |
| | | length += self.UserDataLen
|
| | | length += sizeof(ctypes.c_ushort)
|
| | | length += self.FamilyPlayerIDLen
|
| | | length += sizeof(ctypes.c_ubyte)
|
| | | length += self.BidderIDLen
|
| | | return length
|
| | |
|
| | | def outputString(self):
|
| | |
| | | UserData = %s,
|
| | | FamilyPlayerIDLen = %s,
|
| | | FamilyPlayerIDInfo = %s,
|
| | | BidderIDLen = %s,
|
| | | BidderIDInfo = %s,
|
| | | ADOResult = %s,
|
| | | '''%(
|
| | | self.ItemGUID,
|
| | |
| | | self.UserData,
|
| | | self.FamilyPlayerIDLen,
|
| | | self.FamilyPlayerIDInfo,
|
| | | self.BidderIDLen,
|
| | | self.BidderIDInfo,
|
| | | self.ADOResult,
|
| | | )
|
| | | return output
|