Progressive limits ignored for shop items (multiworld)

Multi Client improvements to reporting
This commit is contained in:
aerinon
2021-02-18 13:39:03 -07:00
parent 8d22dd1a3d
commit 9d32a85b89
5 changed files with 37 additions and 7 deletions

View File

@@ -53,6 +53,11 @@ class Context:
self.rom = None
self.auth = None
self.total_locations = None
self.mode_flags = None
self.key_drop_mode = False
self.shop_mode = False
self.retro_mode = False
self.ignore_count = 0
def color_code(*args):
codes = {'reset': 0, 'bold': 1, 'underline': 4, 'black': 30, 'red': 31, 'green': 32, 'yellow': 33, 'blue': 34,
@@ -88,7 +93,8 @@ SCOUTREPLY_LOCATION_ADDR = SAVEDATA_START + 0x4D8 # 1 byte
SCOUTREPLY_ITEM_ADDR = SAVEDATA_START + 0x4D9 # 1 byte
SCOUTREPLY_PLAYER_ADDR = SAVEDATA_START + 0x4DA # 1 byte
SHOP_ADDR = SAVEDATA_START + 0x302 # 2 bytes?
DYNAMIC_TOTAL_ADDR = SAVEDATA_START + 0x33E
DYNAMIC_TOTAL_ADDR = SAVEDATA_START + 0x33E # 2 bytes
MODE_FLAGS = SAVEDATA_START + 0x33D # 1 byte
SHOP_SRAM_LEN = 0x29 # 41 tracked items
location_shop_order = [Regions.shop_to_location_table.keys()] + [Regions.retro_shops.keys()]
@@ -776,7 +782,8 @@ async def console_loop(ctx : Context):
get_location_name_from_address(item.location), index, len(ctx.items_received)))
if command[0] == '/missing':
for location in [k for k, v in Regions.lookup_name_to_id.items() if type(v) is int]:
for location in [k for k, v in Regions.lookup_name_to_id.items()
if type(v) is int and not filter_location(ctx, k)]:
if location not in ctx.locations_checked:
logging.info('Missing: ' + location)
if command[0] == '/getitem' and len(command) > 1:
@@ -804,6 +811,16 @@ def get_location_name_from_address(address):
return Regions.lookup_id_to_name.get(address, f'Unknown location (ID:{address})')
def filter_location(ctx, location):
if not ctx.key_drop_mode and ('Key Drop' in location or 'Pot Key' in location):
return True
if not ctx.shop_mode and location in Regions.flat_normal_shops:
return True
if not ctx.retro_mode and location in Regions.flat_retro_shops:
return True
return False
async def track_locations(ctx : Context, roomid, roomdata):
new_locations = []
@@ -813,10 +830,20 @@ async def track_locations(ctx : Context, roomid, roomdata):
if ttl > 0:
ctx.total_locations = ttl
if ctx.mode_flags is None:
flags = await snes_read(ctx, MODE_FLAGS, 1)
ctx.key_drop_mode = flags[0] & 0x1
ctx.shop_mode = flags[0] & 0x2
ctx.retro_mode = flags[0] & 0x4
def new_check(location):
ctx.locations_checked.add(location)
logging.info(f"New check: {location} ({len(ctx.locations_checked)}/{ctx.total_locations})")
new_locations.append(Regions.lookup_name_to_id[location])
ignored = filter_location(ctx, location)
if ignored:
ctx.ignore_count += 1
else:
logging.info(f"New check: {location} ({len(ctx.locations_checked)-ctx.ignore_count}/{ctx.total_locations})")
new_locations.append(Regions.lookup_name_to_id[location])
try:
if roomid in location_shop_ids: