From c04a87b2679e8561dcbe3fad845e169a27f1ec46 Mon Sep 17 00:00:00 2001 From: xdh <xiefantasy@qq.com> Date: 星期五, 22 二月 2019 17:11:37 +0800 Subject: [PATCH] 6256 子 【开发】【2.0】神秘商店开发 / 【后端】【2.0】神秘商店 --- ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py | 111 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 111 insertions(+), 0 deletions(-) diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py index 5f86b1a..2553bbd 100644 --- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py +++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py @@ -20127,6 +20127,117 @@ #------------------------------------------------------ +# A8 16 神秘商店商品信息 #tagMCMysticalShopInfo + +class tagMCMysticalShopGoods(Structure): + _pack_ = 1 + _fields_ = [ + ("GoodsID", c_int), # 商品ID + ] + + def __init__(self): + self.Clear() + 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.GoodsID = 0 + return + + def GetLength(self): + return sizeof(tagMCMysticalShopGoods) + + def GetBuffer(self): + return string_at(addressof(self), self.GetLength()) + + def OutputString(self): + DumpString = '''// A8 16 神秘商店商品信息 //tagMCMysticalShopInfo: + GoodsID:%d + '''\ + %( + self.GoodsID + ) + return DumpString + + +class tagMCMysticalShopInfo(Structure): + Head = tagHead() + RefreshCnt = 0 #(WORD RefreshCnt)// 刷新次数 + Count = 0 #(BYTE Count)// 商品数 + GoodsList = list() #(vector<tagMCMysticalShopGoods> GoodsList)// 商品信息 + data = None + + def __init__(self): + self.Clear() + self.Head.Cmd = 0xA8 + self.Head.SubCmd = 0x16 + return + + def ReadData(self, _lpData, _pos=0, _Len=0): + self.Clear() + _pos = self.Head.ReadData(_lpData, _pos) + self.RefreshCnt,_pos = CommFunc.ReadWORD(_lpData, _pos) + self.Count,_pos = CommFunc.ReadBYTE(_lpData, _pos) + for i in range(self.Count): + temGoodsList = tagMCMysticalShopGoods() + _pos = temGoodsList.ReadData(_lpData, _pos) + self.GoodsList.append(temGoodsList) + return _pos + + def Clear(self): + self.Head = tagHead() + self.Head.Clear() + self.Head.Cmd = 0xA8 + self.Head.SubCmd = 0x16 + self.RefreshCnt = 0 + self.Count = 0 + self.GoodsList = list() + return + + def GetLength(self): + length = 0 + length += self.Head.GetLength() + length += 2 + length += 1 + for i in range(self.Count): + length += self.GoodsList[i].GetLength() + + return length + + def GetBuffer(self): + data = '' + data = CommFunc.WriteString(data, self.Head.GetLength(), self.Head.GetBuffer()) + data = CommFunc.WriteWORD(data, self.RefreshCnt) + data = CommFunc.WriteBYTE(data, self.Count) + for i in range(self.Count): + data = CommFunc.WriteString(data, self.GoodsList[i].GetLength(), self.GoodsList[i].GetBuffer()) + return data + + def OutputString(self): + DumpString = ''' + Head:%s, + RefreshCnt:%d, + Count:%d, + GoodsList:%s + '''\ + %( + self.Head.OutputString(), + self.RefreshCnt, + self.Count, + "..." + ) + return DumpString + + +m_NAtagMCMysticalShopInfo=tagMCMysticalShopInfo() +ChNetPackDict[eval("0x%02x%02x"%(m_NAtagMCMysticalShopInfo.Head.Cmd,m_NAtagMCMysticalShopInfo.Head.SubCmd))] = m_NAtagMCMysticalShopInfo + + +#------------------------------------------------------ # A8 06 通知神秘限购商品时间 #tagMCMysticalShopTimeInfo class tagMCMysticalShopTime(Structure): -- Gitblit v1.8.0