LttP: allow hinting and tracking "Take Any" type shops (#1392)

* LttP: allow hinting and tracking "Take Any" type shops
fix broken behaviour since bow/cave split


Co-authored-by: CaitSith2 <d_good@caitsith2.com>
This commit is contained in:
Fabian Dill 2023-01-19 16:17:43 +01:00 committed by GitHub
parent 29e1c3dcf4
commit c839a76fe7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 327 additions and 186 deletions

21
Main.py
View File

@ -292,27 +292,6 @@ def main(args, seed=None, baked_server_options: Optional[Dict[str, object]] = No
checks_in_area[location.player]["Dark World"].append(location.address)
checks_in_area[location.player]["Total"] += 1
oldmancaves = []
takeanyregions = ["Old Man Sword Cave", "Take-Any #1", "Take-Any #2", "Take-Any #3", "Take-Any #4"]
for index, take_any in enumerate(takeanyregions):
for region in [world.get_region(take_any, player) for player in
world.get_game_players("A Link to the Past") if world.retro_caves[player]]:
item = world.create_item(
region.shop.inventory[(0 if take_any == "Old Man Sword Cave" else 1)]['item'],
region.player)
player = region.player
location_id = SHOP_ID_START + total_shop_slots + index
main_entrance = region.get_connecting_entrance(is_main_entrance)
if main_entrance.parent_region.type == RegionType.LightWorld:
checks_in_area[player]["Light World"].append(location_id)
else:
checks_in_area[player]["Dark World"].append(location_id)
checks_in_area[player]["Total"] += 1
er_hint_data[player][location_id] = main_entrance.name
oldmancaves.append(((location_id, player), (item.code, player)))
FillDisabledShopSlots(world)
def write_multidata():

View File

@ -3,7 +3,7 @@ import logging
from BaseClasses import Region, RegionType, ItemClassification
from worlds.alttp.SubClasses import ALttPLocation
from worlds.alttp.Shops import TakeAny, total_shop_slots, set_up_shops, shuffle_shops
from worlds.alttp.Shops import TakeAny, total_shop_slots, set_up_shops, shuffle_shops, create_dynamic_shop_locations
from worlds.alttp.Bosses import place_bosses
from worlds.alttp.Dungeons import get_dungeon_item_pool_player
from worlds.alttp.EntranceShuffle import connect_entrance
@ -436,12 +436,13 @@ def generate_itempool(world):
if world.shop_shuffle[player]:
shuffle_shops(world, nonprogressionitems, player)
create_dynamic_shop_locations(world, player)
world.itempool += progressionitems + nonprogressionitems
if world.retro_caves[player]:
set_up_take_anys(world, player) # depends on world.itempool to be set
# set_up_take_anys needs to run first
create_dynamic_shop_locations(world, player)
take_any_locations = {
@ -487,7 +488,7 @@ def set_up_take_anys(world, player):
world.itempool.append(ItemFactory('Rupees (20)', player))
old_man_take_any.shop.add_inventory(0, sword.name, 0, 0, create_location=True)
else:
old_man_take_any.shop.add_inventory(0, 'Rupees (300)', 0, 0)
old_man_take_any.shop.add_inventory(0, 'Rupees (300)', 0, 0, create_location=True)
for num in range(4):
take_any = Region("Take-Any #{}".format(num+1), RegionType.Cave, 'a cave of choice', player)
@ -501,29 +502,11 @@ def set_up_take_anys(world, player):
take_any.shop = TakeAny(take_any, room_id, 0xE3, True, True, total_shop_slots + num + 1)
world.shops.append(take_any.shop)
take_any.shop.add_inventory(0, 'Blue Potion', 0, 0)
take_any.shop.add_inventory(1, 'Boss Heart Container', 0, 0)
take_any.shop.add_inventory(1, 'Boss Heart Container', 0, 0, create_location=True)
world.initialize_regions()
def create_dynamic_shop_locations(world, player):
for shop in world.shops:
if shop.region.player == player:
for i, item in enumerate(shop.inventory):
if item is None:
continue
if item['create_location']:
loc = ALttPLocation(player, f"{shop.region.name} {shop.slot_names[i]}", parent=shop.region)
shop.region.locations.append(loc)
world.clear_location_cache()
world.push_item(loc, ItemFactory(item['item'], player), False)
loc.shop_slot = i
loc.event = True
loc.locked = True
def get_pool_core(world, player: int):
shuffle = world.shuffle[player]
difficulty = world.difficulty[player]

View File

@ -686,142 +686,296 @@ lookup_name_to_id = {name: data[0] for name, data in location_table.items() if t
lookup_name_to_id = {**lookup_name_to_id, **{name: data[1] for name, data in key_drop_data.items()}}
lookup_name_to_id.update(shop_table_by_location)
lookup_vanilla_location_to_entrance = {1572883: 'Kings Grave Inner Rocks', 191256: 'Kings Grave Inner Rocks',
1573194: 'Kings Grave Inner Rocks', 1573189: 'Kings Grave Inner Rocks',
212328: 'Kings Grave Inner Rocks', 60175: 'Blinds Hideout',
60178: 'Blinds Hideout', 60181: 'Blinds Hideout', 60184: 'Blinds Hideout',
60187: 'Blinds Hideout', 188229: 'Hyrule Castle Secret Entrance Drop',
59761: 'Hyrule Castle Secret Entrance Drop', 975299: 'Zoras River',
1573193: 'Zoras River', 59824: 'Waterfall of Wishing',
59857: 'Waterfall of Wishing', 59770: 'Kings Grave', 59788: 'Dam',
59836: 'Links House', 59854: 'Tavern North', 59881: 'Chicken House',
59890: 'Aginahs Cave', 60034: 'Sahasrahlas Hut', 60037: 'Sahasrahlas Hut',
60040: 'Sahasrahlas Hut', 193020: 'Sahasrahlas Hut',
60046: 'Kakariko Well Drop', 60049: 'Kakariko Well Drop',
60052: 'Kakariko Well Drop', 60055: 'Kakariko Well Drop',
60058: 'Kakariko Well Drop', 1572906: 'Blacksmiths Hut',
1572885: 'Bat Cave Drop', 211407: 'Sick Kids House',
212605: 'Hobo Bridge', 1572864: 'Lost Woods Hideout Drop',
1572865: 'Lumberjack Tree Tree', 1572867: 'Cave 45',
1572868: 'Graveyard Cave', 1572869: 'Checkerboard Cave',
60226: 'Mini Moldorm Cave', 60229: 'Mini Moldorm Cave',
60232: 'Mini Moldorm Cave', 60235: 'Mini Moldorm Cave',
1572880: 'Mini Moldorm Cave', 60238: 'Ice Rod Cave',
60223: 'Bonk Rock Cave', 1572882: 'Library', 1572884: 'Potion Shop',
1573188: 'Lake Hylia Island Mirror Spot',
1573186: 'Maze Race Mirror Spot', 1573187: 'Desert Ledge Return Rocks',
59791: 'Desert Palace Entrance (West)',
1573216: 'Desert Palace Entrance (West)',
59830: 'Desert Palace Entrance (West)',
59851: 'Desert Palace Entrance (West)',
59842: 'Desert Palace Entrance (West)',
1573201: 'Desert Palace Entrance (North)', 59767: 'Eastern Palace',
59773: 'Eastern Palace', 59827: 'Eastern Palace', 59833: 'Eastern Palace',
59893: 'Eastern Palace', 1573200: 'Eastern Palace',
166320: 'Master Sword Meadow', 59764: 'Hyrule Castle Entrance (South)',
60172: 'Hyrule Castle Entrance (South)',
60169: 'Hyrule Castle Entrance (South)',
lookup_vanilla_location_to_entrance = {
59758: 'Hyrule Castle Entrance (South)',
59761: 'Hyrule Castle Secret Entrance Drop',
59764: 'Hyrule Castle Entrance (South)',
59767: 'Eastern Palace',
59770: 'Kings Grave',
59773: 'Eastern Palace',
59776: 'Pyramid Fairy',
59779: 'Pyramid Fairy',
59782: 'Swamp Palace',
59785: 'Swamp Palace',
59788: 'Dam',
59791: 'Desert Palace Entrance (West)',
59794: 'Skull Woods First Section Hole (West)',
59797: 'Ice Palace',
59800: 'Skull Woods First Section Hole (North)',
59803: 'Skull Woods First Section Door',
59806: 'Skull Woods Second Section Door (East)',
59809: 'Skull Woods First Section Hole (West)',
59812: 'Ice Palace',
59818: 'Ice Palace',
59821: 'Tower of Hera',
59824: 'Waterfall of Wishing',
59827: 'Eastern Palace',
59830: 'Desert Palace Entrance (West)',
59833: 'Eastern Palace',
59836: 'Links House',
59839: 'Spiral Cave',
59842: 'Desert Palace Entrance (West)',
59845: 'Mimic Cave',
59848: 'Skull Woods First Section Hole (East)',
59851: 'Desert Palace Entrance (West)',
59854: 'Tavern North',
59857: 'Waterfall of Wishing',
59860: 'Ice Palace',
59866: 'Misery Mire',
59869: 'Ice Palace',
59872: 'Ice Palace',
59875: 'Ice Palace',
59878: 'Tower of Hera',
59881: 'Chicken House',
59884: 'Brewery',
59887: 'C-Shaped House',
59890: 'Aginahs Cave',
59893: 'Eastern Palace',
59896: 'Tower of Hera',
59899: 'Tower of Hera',
59902: 'Skull Woods Final Section',
59905: 'Thieves Town',
59908: 'Thieves Town',
59911: 'Thieves Town',
59914: 'Thieves Town',
59917: 'Thieves Town',
59920: 'Thieves Town',
59923: 'Thieves Town',
59926: 'Turtle Rock',
59929: 'Dark Death Mountain Ledge (East)',
59932: 'Turtle Rock',
59935: 'Turtle Rock',
59938: 'Turtle Rock',
59941: 'Dark Death Mountain Ledge (West)',
59944: 'Turtle Rock Isolated Ledge Entrance',
59947: 'Turtle Rock Isolated Ledge Entrance',
59950: 'Turtle Rock Isolated Ledge Entrance',
59953: 'Turtle Rock Isolated Ledge Entrance',
59956: 'Dark Death Mountain Ledge (West)',
59959: 'Palace of Darkness',
59962: 'Palace of Darkness',
59965: 'Palace of Darkness',
59968: 'Palace of Darkness',
59971: 'Palace of Darkness',
59974: 'Palace of Darkness',
59977: 'Palace of Darkness',
59980: 'Palace of Darkness',
59983: 'Palace of Darkness',
59986: 'Palace of Darkness',
59989: 'Palace of Darkness',
59992: 'Palace of Darkness',
59995: 'Palace of Darkness',
59998: 'Misery Mire',
60001: 'Misery Mire',
60004: 'Misery Mire',
60007: 'Misery Mire',
60010: 'Misery Mire',
60013: 'Misery Mire',
60019: 'Mire Shed',
60022: 'Mire Shed',
60025: 'Sanctuary S&Q',
60028: 'Superbunny Cave (Top)',
60031: 'Superbunny Cave (Top)',
60034: 'Sahasrahlas Hut',
60037: 'Sahasrahlas Hut',
60040: 'Sahasrahlas Hut',
60043: 'Spike Cave',
60046: 'Kakariko Well Drop',
60049: 'Kakariko Well Drop',
60052: 'Kakariko Well Drop',
60055: 'Kakariko Well Drop',
60058: 'Kakariko Well Drop',
60061: 'Swamp Palace',
60064: 'Swamp Palace',
60067: 'Swamp Palace',
60070: 'Swamp Palace',
60073: 'Swamp Palace',
60076: 'Swamp Palace',
60079: 'Swamp Palace',
60082: 'Agahnims Tower',
60085: 'Agahnims Tower',
60088: 'Ganons Tower',
60091: 'Ganons Tower',
60094: 'Ganons Tower',
60097: 'Ganons Tower',
60100: 'Ganons Tower',
60103: 'Ganons Tower',
60106: 'Ganons Tower',
60109: 'Ganons Tower',
60112: 'Ganons Tower',
60115: 'Ganons Tower',
60118: 'Ganons Tower',
60121: 'Ganons Tower',
60124: 'Ganons Tower',
60127: 'Ganons Tower',
60130: 'Ganons Tower',
60133: 'Ganons Tower',
60136: 'Ganons Tower',
60139: 'Ganons Tower',
60142: 'Ganons Tower',
60145: 'Ganons Tower',
60148: 'Ganons Tower',
60151: 'Ganons Tower',
60157: 'Ganons Tower',
60160: 'Ganons Tower',
60163: 'Ganons Tower',
60166: 'Ganons Tower',
60169: 'Hyrule Castle Entrance (South)',
60172: 'Hyrule Castle Entrance (South)',
60175: 'Blinds Hideout',
60178: 'Blinds Hideout',
60181: 'Blinds Hideout',
60184: 'Blinds Hideout',
60187: 'Blinds Hideout',
60190: 'Hype Cave',
60193: 'Hype Cave',
60196: 'Hype Cave',
60199: 'Hype Cave',
60202: 'Paradox Cave (Bottom)',
60205: 'Paradox Cave (Bottom)',
60208: 'Paradox Cave (Bottom)',
60211: 'Paradox Cave (Bottom)',
60214: 'Paradox Cave (Bottom)',
60217: 'Paradox Cave (Bottom)',
60220: 'Paradox Cave (Bottom)',
60223: 'Bonk Rock Cave',
60226: 'Mini Moldorm Cave',
60229: 'Mini Moldorm Cave',
60232: 'Mini Moldorm Cave',
60235: 'Mini Moldorm Cave',
60238: 'Ice Rod Cave',
60241: 'Hookshot Cave',
60244: 'Hookshot Cave',
60247: 'Hookshot Cave',
60250: 'Hookshot Cave',
60253: 'Hyrule Castle Entrance (South)',
60256: 'Hyrule Castle Entrance (South)',
60259: 'Hyrule Castle Entrance (South)', 60025: 'Sanctuary S&Q',
60085: 'Agahnims Tower', 60082: 'Agahnims Tower',
1010170: 'Old Man Cave (West)', 1572866: 'Spectacle Rock Cave',
60202: 'Paradox Cave (Bottom)', 60205: 'Paradox Cave (Bottom)',
60208: 'Paradox Cave (Bottom)', 60211: 'Paradox Cave (Bottom)',
60214: 'Paradox Cave (Bottom)', 60217: 'Paradox Cave (Bottom)',
60220: 'Paradox Cave (Bottom)', 59839: 'Spiral Cave',
1572886: 'Death Mountain (Top)', 1573184: 'Spectacle Rock Mirror Spot',
1573218: 'Tower of Hera', 59821: 'Tower of Hera', 59878: 'Tower of Hera',
59899: 'Tower of Hera', 59896: 'Tower of Hera', 1573202: 'Tower of Hera',
1573191: 'Top of Pyramid', 975237: 'Catfish Entrance Rock',
209095: 'South Dark World Bridge', 1573192: 'South Dark World Bridge',
1572887: 'Bombos Tablet Mirror Spot', 60190: 'Hype Cave',
60193: 'Hype Cave', 60196: 'Hype Cave', 60199: 'Hype Cave',
1572881: 'Hype Cave', 1572870: 'Dark World Hammer Peg Cave',
59776: 'Pyramid Fairy', 59779: 'Pyramid Fairy', 59884: 'Brewery',
59887: 'C-Shaped House', 60840: 'Chest Game',
1573190: 'Bumper Cave (Bottom)', 60019: 'Mire Shed', 60022: 'Mire Shed',
60028: 'Superbunny Cave (Top)', 60031: 'Superbunny Cave (Top)',
60043: 'Spike Cave', 60241: 'Hookshot Cave', 60244: 'Hookshot Cave',
60250: 'Hookshot Cave', 60247: 'Hookshot Cave',
1573185: 'Floating Island Mirror Spot', 59845: 'Mimic Cave',
60061: 'Swamp Palace', 59782: 'Swamp Palace', 59785: 'Swamp Palace',
60064: 'Swamp Palace', 60070: 'Swamp Palace', 60067: 'Swamp Palace',
60073: 'Swamp Palace', 60076: 'Swamp Palace', 60079: 'Swamp Palace',
1573204: 'Swamp Palace', 59908: 'Thieves Town', 59905: 'Thieves Town',
59911: 'Thieves Town', 59914: 'Thieves Town', 59917: 'Thieves Town',
59920: 'Thieves Town', 59923: 'Thieves Town', 1573206: 'Thieves Town',
59803: 'Skull Woods First Section Door',
59848: 'Skull Woods First Section Hole (East)',
59794: 'Skull Woods First Section Hole (West)',
59809: 'Skull Woods First Section Hole (West)',
59800: 'Skull Woods First Section Hole (North)',
59806: 'Skull Woods Second Section Door (East)',
59902: 'Skull Woods Final Section', 1573205: 'Skull Woods Final Section',
59860: 'Ice Palace', 59797: 'Ice Palace', 59818: 'Ice Palace',
59875: 'Ice Palace', 59872: 'Ice Palace', 59812: 'Ice Palace',
59869: 'Ice Palace', 1573207: 'Ice Palace', 60007: 'Misery Mire',
60010: 'Misery Mire', 59998: 'Misery Mire', 60001: 'Misery Mire',
59866: 'Misery Mire', 60004: 'Misery Mire', 60013: 'Misery Mire',
1573208: 'Misery Mire', 59938: 'Turtle Rock', 59932: 'Turtle Rock',
59935: 'Turtle Rock', 59926: 'Turtle Rock',
59941: 'Dark Death Mountain Ledge (West)',
59929: 'Dark Death Mountain Ledge (East)',
59956: 'Dark Death Mountain Ledge (West)',
59953: 'Turtle Rock Isolated Ledge Entrance',
59950: 'Turtle Rock Isolated Ledge Entrance',
59947: 'Turtle Rock Isolated Ledge Entrance',
59944: 'Turtle Rock Isolated Ledge Entrance',
60259: 'Hyrule Castle Entrance (South)',
60840: 'Chest Game',
166320: 'Master Sword Meadow',
188229: 'Hyrule Castle Secret Entrance Drop',
191256: 'Kings Grave Inner Rocks',
193020: 'Sahasrahlas Hut',
209095: 'South Dark World Bridge',
211407: 'Sick Kids House',
212328: 'Kings Grave Inner Rocks',
212605: 'Hobo Bridge',
975237: 'Catfish Entrance Rock',
975299: 'Zoras River',
1010170: 'Old Man Cave (West)',
1310724: 'Ice Palace',
1310727: 'Dark Death Mountain Ledge (West)',
1310730: 'Swamp Palace',
1310733: 'Hyrule Castle Entrance (South)',
1310736: 'Swamp Palace',
1310739: 'Swamp Palace',
1310742: 'Swamp Palace',
1310745: 'Swamp Palace',
1310748: 'Skull Woods Final Section',
1310751: 'Ganons Tower',
1310754: 'Ice Palace',
1310757: 'Ice Palace',
1310760: 'Desert Palace Entrance (North)',
1310763: 'Desert Palace Entrance (North)',
1310766: 'Skull Woods Second Section Door (East)',
1310769: 'Desert Palace Entrance (North)',
1310772: 'Hyrule Castle Entrance (South)',
1310775: 'Hyrule Castle Entrance (South)',
1310778: 'Ganons Tower',
1310781: 'Hyrule Castle Entrance (South)',
1310784: 'Ganons Tower',
1310787: 'Ganons Tower',
1310790: 'Ice Palace',
1310793: 'Eastern Palace',
1310796: 'Misery Mire',
1310799: 'Thieves Town',
1310802: 'Agahnims Tower',
1310805: 'Misery Mire',
1310808: 'Turtle Rock',
1310811: 'Eastern Palace',
1310814: 'Thieves Town',
1310817: 'Agahnims Tower',
1310820: 'Misery Mire',
1572864: 'Lost Woods Hideout Drop',
1572865: 'Lumberjack Tree Tree',
1572866: 'Spectacle Rock Cave',
1572867: 'Cave 45',
1572868: 'Graveyard Cave',
1572869: 'Checkerboard Cave',
1572870: 'Dark World Hammer Peg Cave',
1572880: 'Mini Moldorm Cave',
1572881: 'Hype Cave',
1572882: 'Library',
1572883: 'Kings Grave Inner Rocks',
1572884: 'Potion Shop',
1572885: 'Bat Cave Drop',
1572886: 'Death Mountain (Top)',
1572887: 'Bombos Tablet Mirror Spot',
1572906: 'Blacksmiths Hut',
1573184: 'Spectacle Rock Mirror Spot',
1573185: 'Floating Island Mirror Spot',
1573186: 'Maze Race Mirror Spot',
1573187: 'Desert Ledge Return Rocks',
1573188: 'Lake Hylia Island Mirror Spot',
1573189: 'Kings Grave Inner Rocks',
1573190: 'Bumper Cave (Bottom)',
1573191: 'Top of Pyramid',
1573192: 'South Dark World Bridge',
1573193: 'Zoras River',
1573194: 'Kings Grave Inner Rocks',
1573200: 'Eastern Palace',
1573201: 'Desert Palace Entrance (North)',
1573202: 'Tower of Hera',
1573203: 'Palace of Darkness',
1573204: 'Swamp Palace',
1573205: 'Skull Woods Final Section',
1573206: 'Thieves Town',
1573207: 'Ice Palace',
1573208: 'Misery Mire',
1573209: 'Turtle Rock Isolated Ledge Entrance',
59995: 'Palace of Darkness', 59965: 'Palace of Darkness',
59977: 'Palace of Darkness', 59959: 'Palace of Darkness',
59962: 'Palace of Darkness', 59986: 'Palace of Darkness',
59971: 'Palace of Darkness', 59980: 'Palace of Darkness',
59983: 'Palace of Darkness', 59989: 'Palace of Darkness',
59992: 'Palace of Darkness', 59968: 'Palace of Darkness',
59974: 'Palace of Darkness', 1573203: 'Palace of Darkness',
1573217: 'Ganons Tower', 60121: 'Ganons Tower', 60124: 'Ganons Tower',
60130: 'Ganons Tower', 60133: 'Ganons Tower', 60136: 'Ganons Tower',
60139: 'Ganons Tower', 60142: 'Ganons Tower', 60088: 'Ganons Tower',
60091: 'Ganons Tower', 60094: 'Ganons Tower', 60097: 'Ganons Tower',
60115: 'Ganons Tower', 60112: 'Ganons Tower', 60100: 'Ganons Tower',
60103: 'Ganons Tower', 60106: 'Ganons Tower', 60109: 'Ganons Tower',
60127: 'Ganons Tower', 60118: 'Ganons Tower', 60148: 'Ganons Tower',
60151: 'Ganons Tower', 60145: 'Ganons Tower', 60157: 'Ganons Tower',
60160: 'Ganons Tower', 60163: 'Ganons Tower', 60166: 'Ganons Tower',
0x140037: 'Hyrule Castle Entrance (South)',
0x140034: 'Hyrule Castle Entrance (South)',
0x14000d: 'Hyrule Castle Entrance (South)',
0x14003d: 'Hyrule Castle Entrance (South)',
0x14005b: 'Eastern Palace', 0x140049: 'Eastern Palace',
0x140031: 'Desert Palace Entrance (North)',
0x14002b: 'Desert Palace Entrance (North)',
0x140028: 'Desert Palace Entrance (North)',
0x140061: 'Agahnims Tower', 0x140052: 'Agahnims Tower',
0x140019: 'Swamp Palace', 0x140016: 'Swamp Palace', 0x140013: 'Swamp Palace',
0x140010: 'Swamp Palace', 0x14000a: 'Swamp Palace',
0x14002e: 'Skull Woods Second Section Door (East)',
0x14001c: 'Skull Woods Final Section',
0x14005e: 'Thieves Town', 0x14004f: 'Thieves Town',
0x140004: 'Ice Palace', 0x140022: 'Ice Palace',
0x140025: 'Ice Palace', 0x140046: 'Ice Palace',
0x140055: 'Misery Mire', 0x14004c: 'Misery Mire',
0x140064: 'Misery Mire',
0x140058: 'Turtle Rock', 0x140007: 'Dark Death Mountain Ledge (West)',
0x140040: 'Ganons Tower', 0x140043: 'Ganons Tower',
0x14003a: 'Ganons Tower', 0x14001f: 'Ganons Tower',
0x400000: 'Cave Shop (Dark Death Mountain)', 0x400001: 'Cave Shop (Dark Death Mountain)', 0x400002: 'Cave Shop (Dark Death Mountain)',
0x400003: 'Red Shield Shop', 0x400004: 'Red Shield Shop', 0x400005: 'Red Shield Shop',
0x400006: 'Dark Lake Hylia Shop', 0x400007: 'Dark Lake Hylia Shop', 0x400008: 'Dark Lake Hylia Shop',
0x400009: 'Dark World Lumberjack Shop', 0x40000a: 'Dark World Lumberjack Shop', 0x40000b: 'Dark World Lumberjack Shop',
0x40000c: 'Village of Outcasts Shop', 0x40000d: 'Village of Outcasts Shop', 0x40000e: 'Village of Outcasts Shop',
0x40000f: 'Dark World Potion Shop', 0x400010: 'Dark World Potion Shop', 0x400011: 'Dark World Potion Shop',
0x400012: 'Light World Death Mountain Shop', 0x400013: 'Light World Death Mountain Shop', 0x400014: 'Light World Death Mountain Shop',
0x400015: 'Kakariko Shop', 0x400016: 'Kakariko Shop', 0x400017: 'Kakariko Shop',
0x400018: 'Cave Shop (Lake Hylia)', 0x400019: 'Cave Shop (Lake Hylia)', 0x40001a: 'Cave Shop (Lake Hylia)',
0x40001b: 'Potion Shop', 0x40001c: 'Potion Shop', 0x40001d: 'Potion Shop',
0x40001e: 'Capacity Upgrade', 0x40001f: 'Capacity Upgrade', 0x400020: 'Capacity Upgrade'}
1573216: 'Desert Palace Entrance (West)',
1573217: 'Ganons Tower',
1573218: 'Tower of Hera',
4194304: 'Cave Shop (Dark Death Mountain)',
4194305: 'Cave Shop (Dark Death Mountain)',
4194306: 'Cave Shop (Dark Death Mountain)',
4194307: 'Red Shield Shop',
4194308: 'Red Shield Shop',
4194309: 'Red Shield Shop',
4194310: 'Dark Lake Hylia Shop',
4194311: 'Dark Lake Hylia Shop',
4194312: 'Dark Lake Hylia Shop',
4194313: 'Dark World Lumberjack Shop',
4194314: 'Dark World Lumberjack Shop',
4194315: 'Dark World Lumberjack Shop',
4194316: 'Village of Outcasts Shop',
4194317: 'Village of Outcasts Shop',
4194318: 'Village of Outcasts Shop',
4194319: 'Dark World Potion Shop',
4194320: 'Dark World Potion Shop',
4194321: 'Dark World Potion Shop',
4194322: 'Light World Death Mountain Shop',
4194323: 'Light World Death Mountain Shop',
4194324: 'Light World Death Mountain Shop',
4194325: 'Kakariko Shop',
4194326: 'Kakariko Shop',
4194327: 'Kakariko Shop',
4194328: 'Cave Shop (Lake Hylia)',
4194329: 'Cave Shop (Lake Hylia)',
4194330: 'Cave Shop (Lake Hylia)',
4194331: 'Potion Shop',
4194332: 'Potion Shop',
4194333: 'Potion Shop',
4194334: 'Capacity Upgrade',
4194335: 'Capacity Upgrade',
4194336: 'Capacity Upgrade',
# have no vanilla entrance
4194337: "Old Man Sword Cave",
4194338: "Take-Any #1",
4194339: "Take-Any #2",
4194340: "Take-Any #3",
4194341: "Take-Any #4",
}
lookup_prizes = {location for location in location_table if location.endswith(" - Prize")}
lookup_boss_drops = {location for location in location_table if location.endswith(" - Boss")}

View File

@ -39,9 +39,9 @@ class Shop():
blacklist: Set[str] = set() # items that don't work, todo: actually check against this
type = ShopType.Shop
slot_names: Dict[int, str] = {
0: "Left",
1: "Center",
2: "Right"
0: " Left",
1: " Center",
2: " Right"
}
def __init__(self, region, room_id: int, shopkeeper_config: int, custom: bool, locked: bool, sram_offset: int):
@ -142,7 +142,11 @@ class Shop():
class TakeAny(Shop):
type = ShopType.TakeAny
slot_names: Dict[int, str] = {
0: "",
1: "",
2: ""
}
class UpgradeShop(Shop):
type = ShopType.UpgradeShop
@ -168,8 +172,10 @@ def FillDisabledShopSlots(world):
def ShopSlotFill(world):
shop_slots: Set[ALttPLocation] = {location for shop_locations in (shop.region.locations for shop in world.shops)
shop_slots: Set[ALttPLocation] = {location for shop_locations in
(shop.region.locations for shop in world.shops if shop.type != ShopType.TakeAny)
for location in shop_locations if location.shop_slot is not None}
removed = set()
for location in shop_slots:
shop: Shop = location.parent_region.shop
@ -318,7 +324,7 @@ def create_shops(world, player: int):
for index, item in enumerate(inventory):
shop.add_inventory(index, *item)
if not locked and num_slots:
slot_name = f"{region.name} {shop.slot_names[index]}"
slot_name = f"{region.name}{shop.slot_names[index]}"
loc = ALttPLocation(player, slot_name, address=shop_table_by_location[slot_name],
parent=region, hint_text="for sale")
loc.shop_slot = index
@ -376,7 +382,7 @@ total_dynamic_shop_slots = sum(3 for shopname, data in shop_table.items() if not
SHOP_ID_START = 0x400000
shop_table_by_location_id = dict(enumerate(
(f"{name} {Shop.slot_names[num]}" for name, shop_data in
(f"{name}{Shop.slot_names[num]}" for name, shop_data in
sorted(shop_table.items(), key=lambda item: item[1].sram_offset)
for num in range(3)), start=SHOP_ID_START))
@ -591,3 +597,22 @@ def price_to_funny_price(world, item: dict, player: int):
item['price'] = min(price_chart[p_type](item['price']), 255)
item['price_type'] = p_type
break
def create_dynamic_shop_locations(world, player):
for shop in world.shops:
if shop.region.player == player:
for i, item in enumerate(shop.inventory):
if item is None:
continue
if item['create_location']:
slot_name = f"{shop.region.name}{shop.slot_names[i]}"
loc = ALttPLocation(player, slot_name,
address=shop_table_by_location[slot_name], parent=shop.region)
loc.place_locked_item(ItemFactory(item['item'], player))
if shop.type == ShopType.TakeAny:
loc.shop_slot_disabled = True
shop.region.locations.append(loc)
world.clear_location_cache()
loc.shop_slot = i