Shop location sram offsets now fully static.

This commit is contained in:
CaitSith2
2021-01-22 07:08:50 -08:00
parent 50888eaa6b
commit a2eb666ae9
4 changed files with 27 additions and 29 deletions

9
Rom.py
View File

@@ -1552,22 +1552,17 @@ def patch_race_rom(rom, world, player):
def write_custom_shops(rom, world, player):
shops = sorted([shop for shop in world.shops if shop.custom and shop.region.player == player],
key=lambda shop: shop.region.name)
key=lambda shop: shop.sram_offset)
shop_data = bytearray()
items_data = bytearray()
sram_offset = 0
for shop_id, shop in enumerate(shops):
if shop_id == len(shops) - 1:
shop_id = 0xFF
bytes = shop.get_bytes()
bytes[0] = shop_id
bytes[-1] = sram_offset
if shop.type == ShopType.TakeAny:
sram_offset += 1
else:
sram_offset += 3
bytes[-1] = shop.sram_offset
shop_data.extend(bytes)
# [id][item][price-low][price-high][max][repl_id][repl_price-low][repl_price-high][player]
for item in shop.inventory: