def export(self): serialize('_build/map.json', self.grid) serialize('_build/blocks.json', [x.data() for x in self.block_table]) serialize('_build/object_pos.json', [(o.x, o.y, o.z, o.type, o.remap >= 128, o.rotation / 1024.0 * 360) for o in self.object_pos]) self.style.export()
# out = vars(obj).copy() # for key, val in vars(obj).items(): # if key.startswith('_'): # del out[key] # continue # if not type(val).__module__ == 'builtins': # print(key, val) # out[key] = recurse_vars(val) # return out db = DB() # Basic Info d = Packet.from_bytes(b"\xdd\x03\x00\x1b\x118\x00b\x00\xa4\x04\xb0\x00\x00'n\x02\x82\x00\x00" + b'\x00\x00!\x0e\x03\x0b\x02\x0b"\x0b\x10\xfcBw') d = Packet.from_bytes(bytes.fromhex('dd 03 00 1b 10 3c fe 0e 02 d7 04 b0 00 00 27 6e 00 00 00 00 00 00 21 3d 03 0b 02 0b 37 0b 47 fb 69 77')) pp(serialize(d)) db.insert(d) # Cells d2 = Packet.from_bytes(b'\xdd\x04\x00\x16\x0f\xa7\x0f\xa5\x0f\xa1\x0f\x98\x0f\x9e\x0f\xa0\x0f\xb1\x0f\xbb' + b'\x0f\xb1\x0f\xa6\x0f\xa7\xf8\x18w',) pp(serialize(d2)) db.insert(d2) cells = [c.volt for c in d2.body.data.cells] print(sum(cells)) # HW d2 = Packet.from_bytes(b'\xdd\x05\x00\x11SP15S001-P13S-30' + b'A\xfb\xfdw') pp(serialize(d2)) # Settings d2 = Packet.from_bytes(b'\xdd\x10\x00\x02\x07\xd0\xff\x27\x77')
def export(self): serialize('_build/sprites.json', self._create_sprite_texture_coordinates()) serialize('_build/car_info.json', [(c.sprite_num, ) for c in self.car_infos]) serialize('_build/object_info.json', self.object_infos)