CommonClient: Use lookup_in_game instead of lookup_in_slot in case of own-game name lookup when disconnected from server. (#3514)

This commit is contained in:
Zach Parks
2024-06-16 05:37:05 -05:00
committed by GitHub
parent c622240730
commit 1f685b4272
17 changed files with 36 additions and 33 deletions

View File

@@ -448,7 +448,7 @@ class SMWSNIClient(SNIClient):
for new_check_id in new_checks:
ctx.locations_checked.add(new_check_id)
location = ctx.location_names.lookup_in_slot(new_check_id)
location = ctx.location_names.lookup_in_game(new_check_id)
snes_logger.info(
f'New Check: {location} ({len(ctx.locations_checked)}/{len(ctx.missing_locations) + len(ctx.checked_locations)})')
await ctx.send_msgs([{"cmd": 'LocationChecks', "locations": [new_check_id]}])
@@ -501,14 +501,14 @@ class SMWSNIClient(SNIClient):
recv_index += 1
sending_game = ctx.slot_info[item.player].game
logging.info('Received %s from %s (%s) (%d/%d in list)' % (
color(ctx.item_names.lookup_in_slot(item.item), 'red', 'bold'),
color(ctx.item_names.lookup_in_game(item.item), 'red', 'bold'),
color(ctx.player_names[item.player], 'yellow'),
ctx.location_names.lookup_in_slot(item.location, item.player), recv_index, len(ctx.items_received)))
if self.should_show_message(ctx, item):
if item.item != 0xBC0012 and item.item not in trap_rom_data:
# Don't send messages for Boss Tokens
item_name = ctx.item_names.lookup_in_slot(item.item)
item_name = ctx.item_names.lookup_in_game(item.item)
player_name = ctx.player_names[item.player]
receive_message = generate_received_text(item_name, player_name)
@@ -516,7 +516,7 @@ class SMWSNIClient(SNIClient):
snes_buffered_write(ctx, SMW_RECV_PROGRESS_ADDR, bytes([recv_index&0xFF, (recv_index>>8)&0xFF]))
if item.item in trap_rom_data:
item_name = ctx.item_names.lookup_in_slot(item.item)
item_name = ctx.item_names.lookup_in_game(item.item)
player_name = ctx.player_names[item.player]
receive_message = generate_received_text(item_name, player_name)
@@ -597,7 +597,7 @@ class SMWSNIClient(SNIClient):
for loc_id in ctx.checked_locations:
if loc_id not in ctx.locations_checked:
ctx.locations_checked.add(loc_id)
loc_name = ctx.location_names.lookup_in_slot(loc_id)
loc_name = ctx.location_names.lookup_in_game(loc_id)
if loc_name not in location_id_to_level_id:
continue