def write(self, stream: OutputStream): stream.put_u16(self.exp_reward) stream.put_u16(self.gil_reward) stream.put_u16(self.max_hp) stream.put_u8(self.morale) stream.put_u8(self.unused_ai) stream.put_u8(self.evasion) stream.put_u8(self.pdef) stream.put_u8(self.hit_count) stream.put_u8(self.acc) stream.put_u8(self.atk) stream.put_u8(self.agi) stream.put_u8(self.intel) stream.put_u8(self.crit_rate) stream.put_u16(self.status_atk_elem) stream.put_u8(self.status_atk_ailment) stream.put_u8(self.family) stream.put_u8(self.mdef) stream.put_u8(self.unused) stream.put_u16(self.elem_weakness) stream.put_u16(self.elem_resists) stream.put_u8(self.drop_type) stream.put_u8(self.drop_id) stream.put_u8(self.drop_chance) for data in self.padding: stream.put_u8(data)
def add_credits(rom: Rom) -> Rom: credits_lut = rom.get_lut(0x1D871C, 128) base_addr = credits_lut[0] new_lut = OutputStream() data_stream = OutputStream() for index, line in enumerate(CREDITS_TEXT.splitlines()[1:]): line = line.strip() if len(line) > 0: encoded = TextBlock.encode_text(line) new_lut.put_u32(base_addr + data_stream.size()) data_stream.put_bytes(encoded) else: new_lut.put_u32(0x0) # And EOF marker new_lut.put_u32(0xffffffff) # Change the duration so it doesn't take so long to scroll duration = OutputStream() duration.put_u16(60 * 60) return rom.apply_patches({ 0x016848: duration.get_buffer(), 0x1D871C: new_lut.get_buffer(), Rom.pointer_to_offset(base_addr): data_stream.get_buffer() })
def write(self, rom: Rom) -> Rom: permissions_stream = OutputStream() for permission in self._permissions: permissions_stream.put_u16(permission) rom = rom.apply_patch(0x1A20C0, permissions_stream.get_buffer()) rom = self._spells.write(rom) return self._shops.write(rom)
def write(self, stream: OutputStream): stream.put_u16(self.base_hp) stream.put_u16(self.base_mp) stream.put_u8(self.starting_spell_level) stream.put_u8(self.base_strength) stream.put_u8(self.base_agility) stream.put_u8(self.base_intellect) stream.put_u8(self.base_stamina) stream.put_u8(self.base_luck) stream.put_u8(self.base_accuracy) stream.put_u8(self.base_evade) stream.put_u8(self.base_mdef) stream.put_u8(self.weapon_id) stream.put_u8(self.armor_id) stream.put_u8(self.unused)
def write(self, stream: OutputStream): self.header.write(stream) for tile in self.tiles: tile.write(stream) for npc in self.npcs: npc.write(stream) for chest in self.chests: chest.write(stream) for sprite in self.sprites: sprite.write(stream) for shop in self.shops: shop.write(stream) # Close the map at the end. :) stream.put_u16(0xffff)
def write(self, stream: OutputStream): stream.put_u8(self.config) stream.put_u8(self.unrunnable) stream.put_u16(self.surprise_chance) for data in self.groups: data.write(stream)
def write(self, stream: OutputStream): stream.put_u16(self.identifier) stream.put_u16(self.event) stream.put_u16(self.x_pos) stream.put_u16(self.y_pos)
def write(self, stream: OutputStream): stream.put_u16(self.identifier) stream.put_u16(self.event) stream.put_u16(self.x_pos) stream.put_u16(self.y_pos) stream.put_u16(self.sprite_id) stream.put_u16(self.move_speed) stream.put_u16(self.facing) stream.put_u16(self.in_room)
def write(self, stream: OutputStream): stream.put_u16(self.identifier) stream.put_u16(self.low_x) stream.put_u16(self.low_y) stream.put_u16(self.high_x) stream.put_u16(self.high_y)