hxp
4 天以前 a7ab0247c7b8eff06ad104bee39bc035384ca43e
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py
@@ -3252,6 +3252,114 @@
#------------------------------------------------------
# A2 07 背包购买格子信息 #tagSCPackBuyInfo
class  tagSCPackBuy(Structure):
    _pack_ = 1
    _fields_ = [
                  ("PackType", c_ubyte),    # 背包类型
                  ("BuyCnt", c_ushort),    # 已购买次数
                  ]
    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.PackType = 0
        self.BuyCnt = 0
        return
    def GetLength(self):
        return sizeof(tagSCPackBuy)
    def GetBuffer(self):
        return string_at(addressof(self), self.GetLength())
    def OutputString(self):
        DumpString = '''// A2 07 背包购买格子信息 //tagSCPackBuyInfo:
                                PackType:%d,
                                BuyCnt:%d
                                '''\
                                %(
                                self.PackType,
                                self.BuyCnt
                                )
        return DumpString
class  tagSCPackBuyInfo(Structure):
    Head = tagHead()
    Count = 0    #(BYTE Count)
    BuyInfoList = list()    #(vector<tagSCPackBuy> BuyInfoList)
    data = None
    def __init__(self):
        self.Clear()
        self.Head.Cmd = 0xA2
        self.Head.SubCmd = 0x07
        return
    def ReadData(self, _lpData, _pos=0, _Len=0):
        self.Clear()
        _pos = self.Head.ReadData(_lpData, _pos)
        self.Count,_pos = CommFunc.ReadBYTE(_lpData, _pos)
        for i in range(self.Count):
            temBuyInfoList = tagSCPackBuy()
            _pos = temBuyInfoList.ReadData(_lpData, _pos)
            self.BuyInfoList.append(temBuyInfoList)
        return _pos
    def Clear(self):
        self.Head = tagHead()
        self.Head.Clear()
        self.Head.Cmd = 0xA2
        self.Head.SubCmd = 0x07
        self.Count = 0
        self.BuyInfoList = list()
        return
    def GetLength(self):
        length = 0
        length += self.Head.GetLength()
        length += 1
        for i in range(self.Count):
            length += self.BuyInfoList[i].GetLength()
        return length
    def GetBuffer(self):
        data = ''
        data = CommFunc.WriteString(data, self.Head.GetLength(), self.Head.GetBuffer())
        data = CommFunc.WriteBYTE(data, self.Count)
        for i in range(self.Count):
            data = CommFunc.WriteString(data, self.BuyInfoList[i].GetLength(), self.BuyInfoList[i].GetBuffer())
        return data
    def OutputString(self):
        DumpString = '''
                                Head:%s,
                                Count:%d,
                                BuyInfoList:%s
                                '''\
                                %(
                                self.Head.OutputString(),
                                self.Count,
                                "..."
                                )
        return DumpString
m_NAtagSCPackBuyInfo=tagSCPackBuyInfo()
ChNetPackDict[eval("0x%02x%02x"%(m_NAtagSCPackBuyInfo.Head.Cmd,m_NAtagSCPackBuyInfo.Head.SubCmd))] = m_NAtagSCPackBuyInfo
#------------------------------------------------------
# A2 05 虚拟背包物品清空 #tagMCVPackClear
class  tagMCVPackClear(Structure):