From 4250004f11196ee4e2fff351bdc820ce1e10d010 Mon Sep 17 00:00:00 2001 From: pepperpow Date: Sun, 10 Jan 2021 05:11:45 -0600 Subject: [PATCH] Added Shop ID constant and forfeit values --- Main.py | 4 ++-- MultiClient.py | 2 +- MultiServer.py | 1 + Regions.py | 3 ++- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Main.py b/Main.py index a4604151..e067fb5a 100644 --- a/Main.py +++ b/Main.py @@ -11,7 +11,7 @@ import concurrent.futures from BaseClasses import World, CollectionState, Item, Region, Location, PlandoItem from Items import ItemFactory, item_table, item_name_groups -from Regions import create_regions, create_shops, mark_light_world_regions, lookup_vanilla_location_to_entrance +from Regions import create_regions, create_shops, mark_light_world_regions, lookup_vanilla_location_to_entrance, SHOP_ID_START from InvertedRegions import create_inverted_regions, mark_dark_world_regions from EntranceShuffle import link_entrances, link_inverted_entrances, plando_connect from Rom import patch_rom, patch_race_rom, patch_enemizer, apply_rom_settings, LocalRom, get_hash_string @@ -409,7 +409,7 @@ def main(args, seed=None): main_entrance = get_entrance_to_region(region) for location in region.locations: if type(location.address) == int: # skips events and crystals - if location.address >= 0x400000: continue + if location.address >= SHOP_ID_START: continue if lookup_vanilla_location_to_entrance[location.address] != main_entrance.name: er_hint_data[region.player][location.address] = main_entrance.name diff --git a/MultiClient.py b/MultiClient.py index 90ba6893..0eee6eef 100644 --- a/MultiClient.py +++ b/MultiClient.py @@ -1154,7 +1154,7 @@ async def track_locations(ctx : Context, roomid, roomdata): if roomid in location_shop_ids: misc_data = await snes_read(ctx, SHOP_ADDR, len(location_shop_order)*3) for cnt, b in enumerate(misc_data): - my_check = Regions.shop_table_by_location_id[0x400000 + cnt] + my_check = Regions.shop_table_by_location_id[Regions.SHOP_ID_START + cnt] if int(b) > 0 and my_check not in ctx.locations_checked: new_check(my_check) except Exception as e: diff --git a/MultiServer.py b/MultiServer.py index ccdd6c24..dd844414 100644 --- a/MultiServer.py +++ b/MultiServer.py @@ -475,6 +475,7 @@ def send_new_items(ctx: Context): def forfeit_player(ctx: Context, team: int, slot: int): all_locations = {values[0] for values in Regions.location_table.values() if type(values[0]) is int} all_locations.update({values[1] for values in Regions.key_drop_data.values()}) + all_locations.update({values for values in range(Regions.SHOP_ID_START, Regions.SHOP_ID_START + 256)}) ctx.notify_all("%s (Team #%d) has forfeited" % (ctx.player_names[(team, slot)], team + 1)) register_location_checks(ctx, team, slot, all_locations) diff --git a/Regions.py b/Regions.py index 247bd841..90111abb 100644 --- a/Regions.py +++ b/Regions.py @@ -442,7 +442,8 @@ shop_table = { 'Capacity Upgrade': (0x0115, ShopType.UpgradeShop, 0x04, True, True, [('Bomb Upgrade (+5)', 100, 7), ('Arrow Upgrade (+5)', 100, 7)]) } -shop_table_by_location_id = {0x400000 + cnt: s for cnt, s in enumerate( +SHOP_ID_START = 0x400000 +shop_table_by_location_id = {SHOP_ID_START + cnt: s for cnt, s in enumerate( [item for sublist in [["{} Slot {}".format(name, num + 1) for num in range(3)] for name in shop_table] for item in sublist])} shop_table_by_location = {y: x for x, y in shop_table_by_location_id.items()}