Example #1
0
    def readTag(self, f):
        chunkTypeName = readString(f)

        t = self.tagParser[chunkTypeName].readTag(f)

        t.chunkTypeName = chunkTypeName

        # TODO there's a magic byte after every tag... value seems to be 
        # very often 0x07!?!
        # maybe it's a CRC value?
        f.read(1)

        return t
Example #2
0
    def readTag(self, f):
        chunkTypeName = readString(f)

        t = self.tagParser[chunkTypeName].readTag(f)

        t.chunkTypeName = chunkTypeName

        # TODO there's a magic byte after every tag... value seems to be
        # very often 0x07!?!
        # maybe it's a CRC value?
        f.read(1)

        return t
    def readEntity(self, f):
        assert readString(f) == 'Items'
        # TODO validate checksum
        readByte(f)

        itemCount = readInt(f)

        # TODO validate checksum
        readByte(f)

        for i in range(itemCount):
            # TODO store parsed items in chest
            readList(f, ChestParser.CHEST_ITEM_DEF)

            readByte(f)

        # TODO store parsed chest attributes in chest
        readList(f, ChestParser.CHEST_ATTR_DEF)
        
        return Chest()