diff --git a/Rom.py b/Rom.py index 6c434813..f37b47a9 100644 --- a/Rom.py +++ b/Rom.py @@ -1,7 +1,7 @@ from __future__ import annotations JAP10HASH = '03a63945398191337e896e5771f77173' -RANDOMIZERBASEHASH = '93538d51eb018955a90181600e3384ba' +RANDOMIZERBASEHASH = '5d109c62f73966de1fe65751fc876778' import io import json @@ -1560,6 +1560,7 @@ def write_custom_shops(rom, world, player): shop_data = bytearray() items_data = bytearray() + retro_shop_slots = bytearray() for shop_id, shop in enumerate(shops): if shop_id == len(shops) - 1: @@ -1568,10 +1569,27 @@ def write_custom_shops(rom, world, player): bytes[0] = shop_id 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: + + arrow_mask = 0x00 + for index, item in enumerate(shop.inventory): + slot = 0 if shop.type == ShopType.TakeAny else index if item is None: break + if world.shop_shuffle_slots[player]: + count_shop = (shop.region.name != 'Potion Shop' or 'w' in world.shop_shuffle[player]) and \ + shop.region.name != 'Capacity Upgrade' + rom.write_byte(0x186560 + shop.sram_offset + slot, 1 if count_shop else 0) + if item['item'] == 'Single Arrow' and item['player'] == 0: + arrow_mask |= 1 << index + retro_shop_slots.append(shop.sram_offset + slot) + + # [id][item][price-low][price-high][max][repl_id][repl_price-low][repl_price-high][player] + for index, item in enumerate(shop.inventory): + slot = 0 if shop.type == ShopType.TakeAny else index + if item is None: + break + if item['item'] == 'Single Arrow' and item['player'] == 0 and world.retro[player]: + rom.write_byte(0x186500 + shop.sram_offset + slot, arrow_mask) item_data = [shop_id, ItemFactory(item['item'], player).code] + int16_as_bytes(item['price']) + \ [item['max'], ItemFactory(item['replacement'], player).code if item['replacement'] else 0xFF] + \ int16_as_bytes(item['replacement_price']) + [0 if item['player'] == player else item['player']] @@ -1582,6 +1600,10 @@ def write_custom_shops(rom, world, player): items_data.extend([0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF]) rom.write_bytes(0x184900, items_data) + if world.retro[player]: + retro_shop_slots.append(0xFF) + rom.write_bytes(0x186540, retro_shop_slots) + def hud_format_text(text): output = bytes() diff --git a/data/basepatch.bmbp b/data/basepatch.bmbp index 3b1c9e10..00de394b 100644 Binary files a/data/basepatch.bmbp and b/data/basepatch.bmbp differ