From 46fbb9a99444693cdbcd0df7f6de0d0511235d56 Mon Sep 17 00:00:00 2001 From: hxp <ale99527@vip.qq.com> Date: 星期一, 13 十二月 2021 14:46:53 +0800 Subject: [PATCH] 9265 【BT5】【后端】53、新增幸运云购 --- ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py | 486 ++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 457 insertions(+), 29 deletions(-) diff --git a/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py b/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py index 3a9ad76..f04a366 100644 --- a/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py +++ b/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py @@ -561,33 +561,41 @@ #A0 04 同步客户端时间 #tagServerDateTime class tagServerDateTime(Structure): - _pack_ = 1 - _fields_ = [ - ("Cmd", c_ubyte), - ("SubCmd", c_ubyte), - ("Year", c_ushort), - ("Month", c_ubyte), - ("Day", c_ubyte), - ("Hour", c_ubyte), - ("Minute", c_ubyte), - ("Second", c_ubyte), - ("MicSecond", c_int), - ] + Head = tagHead() + Year = 0 #(WORD Year) + Month = 0 #(BYTE Month) + Day = 0 #(BYTE Day) + Hour = 0 #(BYTE Hour) + Minute = 0 #(BYTE Minute) + Second = 0 #(BYTE Second) + MicSecond = 0 #(DWORD MicSecond) + CrossServerTime = "" #(char CrossServerTime[19]) + data = None def __init__(self): self.Clear() - self.Cmd = 0xA0 - self.SubCmd = 0x04 + self.Head.Cmd = 0xA0 + self.Head.SubCmd = 0x04 return - def ReadData(self, stringData, _pos=0, _len=0): + def ReadData(self, _lpData, _pos=0, _Len=0): self.Clear() - memmove(addressof(self), stringData[_pos:], self.GetLength()) - return _pos + self.GetLength() + _pos = self.Head.ReadData(_lpData, _pos) + self.Year,_pos = CommFunc.ReadWORD(_lpData, _pos) + self.Month,_pos = CommFunc.ReadBYTE(_lpData, _pos) + self.Day,_pos = CommFunc.ReadBYTE(_lpData, _pos) + self.Hour,_pos = CommFunc.ReadBYTE(_lpData, _pos) + self.Minute,_pos = CommFunc.ReadBYTE(_lpData, _pos) + self.Second,_pos = CommFunc.ReadBYTE(_lpData, _pos) + self.MicSecond,_pos = CommFunc.ReadDWORD(_lpData, _pos) + self.CrossServerTime,_pos = CommFunc.ReadString(_lpData, _pos,19) + return _pos def Clear(self): - self.Cmd = 0xA0 - self.SubCmd = 0x04 + self.Head = tagHead() + self.Head.Clear() + self.Head.Cmd = 0xA0 + self.Head.SubCmd = 0x04 self.Year = 0 self.Month = 0 self.Day = 0 @@ -595,42 +603,64 @@ self.Minute = 0 self.Second = 0 self.MicSecond = 0 + self.CrossServerTime = "" return def GetLength(self): - return sizeof(tagServerDateTime) + length = 0 + length += self.Head.GetLength() + length += 2 + length += 1 + length += 1 + length += 1 + length += 1 + length += 1 + length += 4 + length += 19 + + return length def GetBuffer(self): - return string_at(addressof(self), self.GetLength()) + data = '' + data = CommFunc.WriteString(data, self.Head.GetLength(), self.Head.GetBuffer()) + data = CommFunc.WriteWORD(data, self.Year) + data = CommFunc.WriteBYTE(data, self.Month) + data = CommFunc.WriteBYTE(data, self.Day) + data = CommFunc.WriteBYTE(data, self.Hour) + data = CommFunc.WriteBYTE(data, self.Minute) + data = CommFunc.WriteBYTE(data, self.Second) + data = CommFunc.WriteDWORD(data, self.MicSecond) + data = CommFunc.WriteString(data, 19, self.CrossServerTime) + return data def OutputString(self): - DumpString = '''//A0 04 同步客户端时间 //tagServerDateTime: - Cmd:%s, - SubCmd:%s, + DumpString = ''' + Head:%s, Year:%d, Month:%d, Day:%d, Hour:%d, Minute:%d, Second:%d, - MicSecond:%d + MicSecond:%d, + CrossServerTime:%s '''\ %( - self.Cmd, - self.SubCmd, + self.Head.OutputString(), self.Year, self.Month, self.Day, self.Hour, self.Minute, self.Second, - self.MicSecond + self.MicSecond, + self.CrossServerTime ) return DumpString m_NAtagServerDateTime=tagServerDateTime() -ChNetPackDict[eval("0x%02x%02x"%(m_NAtagServerDateTime.Cmd,m_NAtagServerDateTime.SubCmd))] = m_NAtagServerDateTime +ChNetPackDict[eval("0x%02x%02x"%(m_NAtagServerDateTime.Head.Cmd,m_NAtagServerDateTime.Head.SubCmd))] = m_NAtagServerDateTime #------------------------------------------------------ @@ -13266,6 +13296,352 @@ m_NAtagGCCrossRealmPKStartMatch=tagGCCrossRealmPKStartMatch() ChNetPackDict[eval("0x%02x%02x"%(m_NAtagGCCrossRealmPKStartMatch.Cmd,m_NAtagGCCrossRealmPKStartMatch.SubCmd))] = m_NAtagGCCrossRealmPKStartMatch + + +#------------------------------------------------------ +# C0 14 幸运云购开奖记录 #tagGCLuckyCloudBuyLotteryRecInfo + +class tagGCLuckyCloudBuyLotteryRec(Structure): + SuperItemID = 0 #(DWORD SuperItemID)// 大奖物品ID + SuperItemCount = 0 #(BYTE SuperItemCount)// 大奖物品个数 + NameLen = 0 #(BYTE NameLen) + PlayerName = "" #(String PlayerName)// 中奖玩家名 + LotteryNum = 0 #(WORD LotteryNum)// 开奖号码 + LotteryTime = 0 #(DWORD LotteryTime)// 开奖时间戳,秒 + data = None + + def __init__(self): + self.Clear() + return + + def ReadData(self, _lpData, _pos=0, _Len=0): + self.Clear() + self.SuperItemID,_pos = CommFunc.ReadDWORD(_lpData, _pos) + self.SuperItemCount,_pos = CommFunc.ReadBYTE(_lpData, _pos) + self.NameLen,_pos = CommFunc.ReadBYTE(_lpData, _pos) + self.PlayerName,_pos = CommFunc.ReadString(_lpData, _pos,self.NameLen) + self.LotteryNum,_pos = CommFunc.ReadWORD(_lpData, _pos) + self.LotteryTime,_pos = CommFunc.ReadDWORD(_lpData, _pos) + return _pos + + def Clear(self): + self.SuperItemID = 0 + self.SuperItemCount = 0 + self.NameLen = 0 + self.PlayerName = "" + self.LotteryNum = 0 + self.LotteryTime = 0 + return + + def GetLength(self): + length = 0 + length += 4 + length += 1 + length += 1 + length += len(self.PlayerName) + length += 2 + length += 4 + + return length + + def GetBuffer(self): + data = '' + data = CommFunc.WriteDWORD(data, self.SuperItemID) + data = CommFunc.WriteBYTE(data, self.SuperItemCount) + data = CommFunc.WriteBYTE(data, self.NameLen) + data = CommFunc.WriteString(data, self.NameLen, self.PlayerName) + data = CommFunc.WriteWORD(data, self.LotteryNum) + data = CommFunc.WriteDWORD(data, self.LotteryTime) + return data + + def OutputString(self): + DumpString = ''' + SuperItemID:%d, + SuperItemCount:%d, + NameLen:%d, + PlayerName:%s, + LotteryNum:%d, + LotteryTime:%d + '''\ + %( + self.SuperItemID, + self.SuperItemCount, + self.NameLen, + self.PlayerName, + self.LotteryNum, + self.LotteryTime + ) + return DumpString + + +class tagGCLuckyCloudBuyLotteryRecInfo(Structure): + Head = tagHead() + ZoneID = 0 #(BYTE ZoneID)// 分区 + Count = 0 #(WORD Count) + LotteryRecList = list() #(vector<tagGCLuckyCloudBuyLotteryRec> LotteryRecList) + data = None + + def __init__(self): + self.Clear() + self.Head.Cmd = 0xC0 + self.Head.SubCmd = 0x14 + return + + def ReadData(self, _lpData, _pos=0, _Len=0): + self.Clear() + _pos = self.Head.ReadData(_lpData, _pos) + self.ZoneID,_pos = CommFunc.ReadBYTE(_lpData, _pos) + self.Count,_pos = CommFunc.ReadWORD(_lpData, _pos) + for i in range(self.Count): + temLotteryRecList = tagGCLuckyCloudBuyLotteryRec() + _pos = temLotteryRecList.ReadData(_lpData, _pos) + self.LotteryRecList.append(temLotteryRecList) + return _pos + + def Clear(self): + self.Head = tagHead() + self.Head.Clear() + self.Head.Cmd = 0xC0 + self.Head.SubCmd = 0x14 + self.ZoneID = 0 + self.Count = 0 + self.LotteryRecList = list() + return + + def GetLength(self): + length = 0 + length += self.Head.GetLength() + length += 1 + length += 2 + for i in range(self.Count): + length += self.LotteryRecList[i].GetLength() + + return length + + def GetBuffer(self): + data = '' + data = CommFunc.WriteString(data, self.Head.GetLength(), self.Head.GetBuffer()) + data = CommFunc.WriteBYTE(data, self.ZoneID) + data = CommFunc.WriteWORD(data, self.Count) + for i in range(self.Count): + data = CommFunc.WriteString(data, self.LotteryRecList[i].GetLength(), self.LotteryRecList[i].GetBuffer()) + return data + + def OutputString(self): + DumpString = ''' + Head:%s, + ZoneID:%d, + Count:%d, + LotteryRecList:%s + '''\ + %( + self.Head.OutputString(), + self.ZoneID, + self.Count, + "..." + ) + return DumpString + + +m_NAtagGCLuckyCloudBuyLotteryRecInfo=tagGCLuckyCloudBuyLotteryRecInfo() +ChNetPackDict[eval("0x%02x%02x"%(m_NAtagGCLuckyCloudBuyLotteryRecInfo.Head.Cmd,m_NAtagGCLuckyCloudBuyLotteryRecInfo.Head.SubCmd))] = m_NAtagGCLuckyCloudBuyLotteryRecInfo + + +#------------------------------------------------------ +# C0 13 幸运云购购买号码记录 #tagGCLuckyCloudBuyNumRecInfo + +class tagGCLuckyCloudBuyNumRec(Structure): + NameLen = 0 #(BYTE NameLen) + PlayerName = "" #(String PlayerName) + BuyNum = 0 #(WORD BuyNum) + data = None + + def __init__(self): + self.Clear() + return + + def ReadData(self, _lpData, _pos=0, _Len=0): + self.Clear() + self.NameLen,_pos = CommFunc.ReadBYTE(_lpData, _pos) + self.PlayerName,_pos = CommFunc.ReadString(_lpData, _pos,self.NameLen) + self.BuyNum,_pos = CommFunc.ReadWORD(_lpData, _pos) + return _pos + + def Clear(self): + self.NameLen = 0 + self.PlayerName = "" + self.BuyNum = 0 + return + + def GetLength(self): + length = 0 + length += 1 + length += len(self.PlayerName) + length += 2 + + return length + + def GetBuffer(self): + data = '' + data = CommFunc.WriteBYTE(data, self.NameLen) + data = CommFunc.WriteString(data, self.NameLen, self.PlayerName) + data = CommFunc.WriteWORD(data, self.BuyNum) + return data + + def OutputString(self): + DumpString = ''' + NameLen:%d, + PlayerName:%s, + BuyNum:%d + '''\ + %( + self.NameLen, + self.PlayerName, + self.BuyNum + ) + return DumpString + + +class tagGCLuckyCloudBuyNumRecInfo(Structure): + Head = tagHead() + Count = 0 #(WORD Count) + BuyNumRecList = list() #(vector<tagGCLuckyCloudBuyNumRec> BuyNumRecList) + data = None + + def __init__(self): + self.Clear() + self.Head.Cmd = 0xC0 + self.Head.SubCmd = 0x13 + return + + def ReadData(self, _lpData, _pos=0, _Len=0): + self.Clear() + _pos = self.Head.ReadData(_lpData, _pos) + self.Count,_pos = CommFunc.ReadWORD(_lpData, _pos) + for i in range(self.Count): + temBuyNumRecList = tagGCLuckyCloudBuyNumRec() + _pos = temBuyNumRecList.ReadData(_lpData, _pos) + self.BuyNumRecList.append(temBuyNumRecList) + return _pos + + def Clear(self): + self.Head = tagHead() + self.Head.Clear() + self.Head.Cmd = 0xC0 + self.Head.SubCmd = 0x13 + self.Count = 0 + self.BuyNumRecList = list() + return + + def GetLength(self): + length = 0 + length += self.Head.GetLength() + length += 2 + for i in range(self.Count): + length += self.BuyNumRecList[i].GetLength() + + return length + + def GetBuffer(self): + data = '' + data = CommFunc.WriteString(data, self.Head.GetLength(), self.Head.GetBuffer()) + data = CommFunc.WriteWORD(data, self.Count) + for i in range(self.Count): + data = CommFunc.WriteString(data, self.BuyNumRecList[i].GetLength(), self.BuyNumRecList[i].GetBuffer()) + return data + + def OutputString(self): + DumpString = ''' + Head:%s, + Count:%d, + BuyNumRecList:%s + '''\ + %( + self.Head.OutputString(), + self.Count, + "..." + ) + return DumpString + + +m_NAtagGCLuckyCloudBuyNumRecInfo=tagGCLuckyCloudBuyNumRecInfo() +ChNetPackDict[eval("0x%02x%02x"%(m_NAtagGCLuckyCloudBuyNumRecInfo.Head.Cmd,m_NAtagGCLuckyCloudBuyNumRecInfo.Head.SubCmd))] = m_NAtagGCLuckyCloudBuyNumRecInfo + + +#------------------------------------------------------ +# C0 12 幸运云购轮次信息 #tagGCLuckyCloudBuyRoundInfo + +class tagGCLuckyCloudBuyRoundInfo(Structure): + _pack_ = 1 + _fields_ = [ + ("Cmd", c_ubyte), + ("SubCmd", c_ubyte), + ("RoundID", c_int), # 轮次唯一ID标识,当收到的轮次ID变更时,前端需清空购买号码记录缓存 + ("RoundNum", c_ubyte), # 今日第几轮 + ("SuperItemID", c_int), # 大奖物品ID + ("SuperItemCount", c_ubyte), # 大奖物品个数 + ("SuperItemMoneyType", c_ubyte), # 大奖价值货币类型 + ("SuperItemMoneyValue", c_int), # 大奖价值 + ("RemainCount", c_ushort), # 开奖剩余份数 + ] + + def __init__(self): + self.Clear() + self.Cmd = 0xC0 + self.SubCmd = 0x12 + return + + def ReadData(self, stringData, _pos=0, _len=0): + self.Clear() + memmove(addressof(self), stringData[_pos:], self.GetLength()) + return _pos + self.GetLength() + + def Clear(self): + self.Cmd = 0xC0 + self.SubCmd = 0x12 + self.RoundID = 0 + self.RoundNum = 0 + self.SuperItemID = 0 + self.SuperItemCount = 0 + self.SuperItemMoneyType = 0 + self.SuperItemMoneyValue = 0 + self.RemainCount = 0 + return + + def GetLength(self): + return sizeof(tagGCLuckyCloudBuyRoundInfo) + + def GetBuffer(self): + return string_at(addressof(self), self.GetLength()) + + def OutputString(self): + DumpString = '''// C0 12 幸运云购轮次信息 //tagGCLuckyCloudBuyRoundInfo: + Cmd:%s, + SubCmd:%s, + RoundID:%d, + RoundNum:%d, + SuperItemID:%d, + SuperItemCount:%d, + SuperItemMoneyType:%d, + SuperItemMoneyValue:%d, + RemainCount:%d + '''\ + %( + self.Cmd, + self.SubCmd, + self.RoundID, + self.RoundNum, + self.SuperItemID, + self.SuperItemCount, + self.SuperItemMoneyType, + self.SuperItemMoneyValue, + self.RemainCount + ) + return DumpString + + +m_NAtagGCLuckyCloudBuyRoundInfo=tagGCLuckyCloudBuyRoundInfo() +ChNetPackDict[eval("0x%02x%02x"%(m_NAtagGCLuckyCloudBuyRoundInfo.Cmd,m_NAtagGCLuckyCloudBuyRoundInfo.SubCmd))] = m_NAtagGCLuckyCloudBuyRoundInfo #------------------------------------------------------ @@ -40762,6 +41138,58 @@ #------------------------------------------------------ +# C1 08 幸运云购玩家信息 #tagMCLuckyCloudBuyPlayerInfo + +class tagMCLuckyCloudBuyPlayerInfo(Structure): + _pack_ = 1 + _fields_ = [ + ("Cmd", c_ubyte), + ("SubCmd", c_ubyte), + ("BuyCount", c_ushort), # 本轮已购买份数 + ] + + def __init__(self): + self.Clear() + self.Cmd = 0xC1 + self.SubCmd = 0x08 + return + + def ReadData(self, stringData, _pos=0, _len=0): + self.Clear() + memmove(addressof(self), stringData[_pos:], self.GetLength()) + return _pos + self.GetLength() + + def Clear(self): + self.Cmd = 0xC1 + self.SubCmd = 0x08 + self.BuyCount = 0 + return + + def GetLength(self): + return sizeof(tagMCLuckyCloudBuyPlayerInfo) + + def GetBuffer(self): + return string_at(addressof(self), self.GetLength()) + + def OutputString(self): + DumpString = '''// C1 08 幸运云购玩家信息 //tagMCLuckyCloudBuyPlayerInfo: + Cmd:%s, + SubCmd:%s, + BuyCount:%d + '''\ + %( + self.Cmd, + self.SubCmd, + self.BuyCount + ) + return DumpString + + +m_NAtagMCLuckyCloudBuyPlayerInfo=tagMCLuckyCloudBuyPlayerInfo() +ChNetPackDict[eval("0x%02x%02x"%(m_NAtagMCLuckyCloudBuyPlayerInfo.Cmd,m_NAtagMCLuckyCloudBuyPlayerInfo.SubCmd))] = m_NAtagMCLuckyCloudBuyPlayerInfo + + +#------------------------------------------------------ # C1 04 准备进入跨服服务器 #tagMCPrepareEnterCrossServer class tagMCPrepareEnterCrossServer(Structure): -- Gitblit v1.8.0