Esempio n. 1
0
    def read(self, reader):
        size = reader.read_uint32()
        decompressed_data = zlib.decompress(reader.read(size))
        reader = ByteReader(decompressed_data)

        self.items_1 = read_list(reader, Packet4Struct1)
        self.player_hits = read_list(reader, HitPacket)

        self.items_3 = []
        for _ in xrange(reader.read_uint32()):
            self.items_3.append(reader.read(72))

        self.sound_actions = read_list(reader, SoundAction)
        self.shoot_actions = read_list(reader, ShootPacket)

        self.items_6 = []
        for _ in xrange(reader.read_uint32()):
            self.items_6.append(reader.read(88))

        self.chunk_items = read_list(reader, ChunkItems)

        self.items_8 = []
        for _ in xrange(reader.read_uint32()):
            something = reader.read_uint64()
            sub_items = []
            for _ in xrange(reader.read_uint32()):
                sub_items.append(reader.read(16))
            self.items_8.append((something, sub_items))

        self.pickups = read_list(reader, PickupAction)
        self.kill_actions = read_list(reader, KillAction)
        self.damage_actions = read_list(reader, DamageAction)

        self.items_12 = []
        for _ in xrange(reader.read_uint32()):
            self.items_12.append(reader.read(40))

        # objective/quests? not sure
        self.items_13 = read_list(reader, Item13)

        debug = True
        if debug:
            v = vars(self).copy()
            del v['pickups']
            # del v['kill_actions']
            del v['damage_actions']
            del v['sound_actions']
            del v['shoot_actions']
            # del v['player_hits']
            del v['chunk_items']
            for k, v in v.iteritems():
                if not v:
                    continue
                print k, v

        if len(decompressed_data) != reader.tell():
            raise NotImplementedError()
Esempio n. 2
0
    def read(self, reader):
        size = reader.read_uint32()
        decompressed_data = zlib.decompress(reader.read(size))
        reader = ByteReader(decompressed_data)

        self.items_1 = read_list(reader, Packet4Struct1)
        self.player_hits = read_list(reader, HitPacket)

        self.items_3 = []
        for _ in xrange(reader.read_uint32()):
            self.items_3.append(reader.read(72))

        self.sound_actions = read_list(reader, SoundAction)
        self.shoot_actions = read_list(reader, ShootPacket)

        self.items_6 = []
        for _ in xrange(reader.read_uint32()):
            self.items_6.append(reader.read(88))

        self.chunk_items = read_list(reader, ChunkItems)

        self.items_8 = []
        for _ in xrange(reader.read_uint32()):
            something = reader.read_uint64()
            sub_items = []
            for _ in xrange(reader.read_uint32()):
                sub_items.append(reader.read(16))
            self.items_8.append((something, sub_items))

        self.pickups = read_list(reader, PickupAction)
        self.kill_actions = read_list(reader, KillAction)
        self.damage_actions = read_list(reader, DamageAction)

        self.items_12 = []
        for _ in xrange(reader.read_uint32()):
            self.items_12.append(reader.read(40))

        # objective/quests? not sure
        self.missions = read_list(reader, MissionData)

        debug = True
        if debug:
            v = vars(self).copy()
            del v['pickups']
            # del v['kill_actions']
            del v['damage_actions']
            del v['sound_actions']
            del v['shoot_actions']
            # del v['player_hits']
            del v['chunk_items']
            for k, v in v.iteritems():
                if not v:
                    continue
                print k, v

        if len(decompressed_data) != reader.tell():
            raise NotImplementedError()
Esempio n. 3
0
 def feed(self, data):
     self.data += data
     reader = ByteReader(self.data)
     while True:
         pos = reader.tell()
         if pos >= len(self.data):
             break
         try:
             packet = read_packet(reader, self.table)
         except OutOfData:
             break
         self.callback(packet)
     self.data = self.data[pos:]
Esempio n. 4
0
File: packet.py Progetto: Kyso/cuwo
 def feed(self, data):
     self.data += data
     reader = ByteReader(self.data)
     try:
         while True:
             pos = reader.tell()
             if pos >= len(self.data):
                 break
             packet = read_packet(reader, self.table)
             self.callback(packet)
     except OutOfData, e:
         if e.reader is not reader:
             raise e
Esempio n. 5
0
 def feed(self, data):
     self.data += data
     reader = ByteReader(self.data)
     try:
         while True:
             pos = reader.tell()
             if pos >= len(self.data):
                 break
             packet = read_packet(reader, self.table)
             self.callback(packet)
     except OutOfData, e:
         if e.reader is not reader:
             raise e
Esempio n. 6
0
    def read(self, reader):
        size = reader.read_uint32()
        decompressed_data = zlib.decompress(reader.read(size))
        reader = ByteReader(decompressed_data)

        self.items_1 = read_list(reader, Packet4Struct1)
        self.player_hits = read_list(reader, HitPacket)
        self.particles = read_list(reader, ParticleData)
        self.sound_actions = read_list(reader, SoundAction)
        self.shoot_actions = read_list(reader, ShootPacket)
        self.static_entities = read_list(reader, StaticEntityData)
        self.chunk_items = read_list(reader, ChunkItems)

        self.items_8 = []
        for _ in xrange(reader.read_uint32()):
            something = reader.read_uint64()
            sub_items = []
            for _ in xrange(reader.read_uint32()):
                sub_items.append(reader.read(16))
            self.items_8.append((something, sub_items))

        self.pickups = read_list(reader, PickupAction)
        self.kill_actions = read_list(reader, KillAction)
        self.damage_actions = read_list(reader, DamageAction)

        self.items_12 = []
        for _ in xrange(reader.read_uint32()):
            self.items_12.append(reader.read(40))

        # objective/quests? not sure
        self.missions = read_list(reader, MissionData)

        debug = False
        if debug:
            v = vars(self).copy()
            # del v['kill_actions']
            # del v['player_hits']
            del v["pickups"]
            del v["damage_actions"]
            del v["sound_actions"]
            del v["shoot_actions"]
            del v["chunk_items"]
            for k, v in v.iteritems():
                if not v:
                    continue
                print k, v

        if len(decompressed_data) != reader.tell():
            raise NotImplementedError()
Esempio n. 7
0
    def read(self, reader):
        size = reader.read_uint32()
        decompressed_data = zlib.decompress(reader.read(size))
        reader = ByteReader(decompressed_data)

        self.block_actions = read_list(reader, BlockAction)
        self.player_hits = read_list(reader, HitPacket)
        self.particles = read_list(reader, ParticleData)
        self.sound_actions = read_list(reader, SoundAction)
        self.shoot_actions = read_list(reader, ShootPacket)
        self.static_entities = read_list(reader, StaticEntityPacket)
        self.chunk_items = read_list(reader, ChunkItems)

        self.items_8 = []
        for _ in range(reader.read_uint32()):
            something = reader.read_uint64()
            sub_items = []
            for _ in range(reader.read_uint32()):
                sub_items.append(reader.read(16))
            self.items_8.append((something, sub_items))

        self.pickups = read_list(reader, PickupAction)
        self.kill_actions = read_list(reader, KillAction)
        self.damage_actions = read_list(reader, DamageAction)

        # EXT: used when NPC wizards/creatures use a right-click targeted
        # action such as a spell cast. (NPC rclick action?)
        self.passive_actions = read_list(reader, PassivePacket)

        self.missions = read_list(reader, MissionData)

        debug = False
        if debug:
            v = vars(self).copy()
            # del v['kill_actions']
            # del v['player_hits']
            del v['pickups']
            del v['damage_actions']
            del v['sound_actions']
            del v['shoot_actions']
            del v['chunk_items']
            for k, v in v.items():
                if not v:
                    continue
                print(k, v)

        if len(decompressed_data) != reader.tell():
            raise NotImplementedError()
Esempio n. 8
0
    def read(self, reader):
        size = reader.read_uint32()
        decompressed_data = zlib.decompress(reader.read(size))
        reader = ByteReader(decompressed_data)

        self.block_actions = read_list(reader, BlockAction)
        self.player_hits = read_list(reader, HitPacket)
        self.particles = read_list(reader, ParticleData)
        self.sound_actions = read_list(reader, SoundAction)
        self.shoot_actions = read_list(reader, ShootPacket)
        self.static_entities = read_list(reader, StaticEntityPacket)
        self.chunk_items = read_list(reader, ChunkItems)

        self.items_8 = []
        for _ in range(reader.read_uint32()):
            something = reader.read_uint64()
            sub_items = []
            for _ in range(reader.read_uint32()):
                sub_items.append(reader.read(16))
            self.items_8.append((something, sub_items))

        self.pickups = read_list(reader, PickupAction)
        self.kill_actions = read_list(reader, KillAction)
        self.damage_actions = read_list(reader, DamageAction)

        # EXT: used when NPC wizards/creatures use a right-click targeted
        # action such as a spell cast. (NPC rclick action?)
        self.passive_actions = read_list(reader, PassivePacket)

        self.missions = read_list(reader, MissionPacket)

        debug = False
        if debug:
            v = vars(self).copy()
            # del v['kill_actions']
            # del v['player_hits']
            del v['pickups']
            del v['damage_actions']
            del v['sound_actions']
            del v['shoot_actions']
            del v['chunk_items']
            for k, v in v.items():
                if not v:
                    continue
                print(k, v)

        if len(decompressed_data) != reader.tell():
            raise NotImplementedError()
Esempio n. 9
0
 def feed(self, data):
     self.data += data
     reader = ByteReader(self.data)
     try:
         while True:
             pos = reader.tell()
             if pos >= len(self.data):
                 break
             packet = read_packet(reader, self.table)
             self.callback(packet)
             if self.stopping:
                 return
     except OutOfData as e:
         if e.reader is not reader:
             raise e
     self.data = self.data[pos:]
Esempio n. 10
0
 def feed(self, data):
     self.data += data
     reader = ByteReader(self.data)
     while True:
         pos = reader.tell()
         if pos >= len(self.data):
             break
         try:
             packet = read_packet(reader, self.table)
         except OutOfData:
             break
         except KeyError, e:
             print 'Last packet ID:', self.last_packet_id
             raise e
         self.last_packet_id = packet.packet_id
         self.callback(packet)
Esempio n. 11
0
 def feed(self, data):
     self.data += data
     reader = ByteReader(self.data)
     try:
         while True:
             pos = reader.tell()
             if pos >= len(self.data):
                 break
             packet = read_packet(reader, self.table)
             self.callback(packet)
             if self.stopping:
                 return
     except OutOfData as e:
         if e.reader is not reader:
             raise e
     self.data = self.data[pos:]