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

@@ -26,7 +26,7 @@ from Fill import sell_potions, sell_keys, balance_multiworld_progression, balanc
from ItemList import generate_itempool, difficulties, fill_prizes, customize_shops from ItemList import generate_itempool, difficulties, fill_prizes, customize_shops
from Utils import output_path, parse_player_names from Utils import output_path, parse_player_names
__version__ = '0.3.1.1-u' __version__ = '0.3.1.0-u'
class EnemizerError(RuntimeError): class EnemizerError(RuntimeError):

View File

@@ -53,6 +53,11 @@ class Context:
self.rom = None self.rom = None
self.auth = None self.auth = None
self.total_locations = 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): def color_code(*args):
codes = {'reset': 0, 'bold': 1, 'underline': 4, 'black': 30, 'red': 31, 'green': 32, 'yellow': 33, 'blue': 34, 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_ITEM_ADDR = SAVEDATA_START + 0x4D9 # 1 byte
SCOUTREPLY_PLAYER_ADDR = SAVEDATA_START + 0x4DA # 1 byte SCOUTREPLY_PLAYER_ADDR = SAVEDATA_START + 0x4DA # 1 byte
SHOP_ADDR = SAVEDATA_START + 0x302 # 2 bytes? 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 SHOP_SRAM_LEN = 0x29 # 41 tracked items
location_shop_order = [Regions.shop_to_location_table.keys()] + [Regions.retro_shops.keys()] 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))) get_location_name_from_address(item.location), index, len(ctx.items_received)))
if command[0] == '/missing': 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: if location not in ctx.locations_checked:
logging.info('Missing: ' + location) logging.info('Missing: ' + location)
if command[0] == '/getitem' and len(command) > 1: 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})') 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): async def track_locations(ctx : Context, roomid, roomdata):
new_locations = [] new_locations = []
@@ -813,10 +830,20 @@ async def track_locations(ctx : Context, roomid, roomdata):
if ttl > 0: if ttl > 0:
ctx.total_locations = ttl 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): def new_check(location):
ctx.locations_checked.add(location) ctx.locations_checked.add(location)
logging.info(f"New check: {location} ({len(ctx.locations_checked)}/{ctx.total_locations})") ignored = filter_location(ctx, location)
new_locations.append(Regions.lookup_name_to_id[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: try:
if roomid in location_shop_ids: if roomid in location_shop_ids:

5
Rom.py
View File

@@ -27,7 +27,7 @@ from EntranceShuffle import door_addresses, exit_ids
JAP10HASH = '03a63945398191337e896e5771f77173' JAP10HASH = '03a63945398191337e896e5771f77173'
RANDOMIZERBASEHASH = '0a34dc667a29125f09b10aeb1e06b83c' RANDOMIZERBASEHASH = '0de33d06fdb9c8cac765047037b39363'
class JsonRom(object): class JsonRom(object):
@@ -774,6 +774,9 @@ def patch_rom(world, rom, player, team, enemized, is_mystery=False):
if world.keydropshuffle[player]: if world.keydropshuffle[player]:
rom.write_byte(0x140000, 1) rom.write_byte(0x140000, 1)
multiClientFlags = ((0x1 if world.keydropshuffle[player] else 0) | (0x2 if world.shopsanity[player] else 0)
| (0x4 if world.retro[player] else 0))
rom.write_byte(0x140001, multiClientFlags)
write_int16(rom, 0x187010, credits_total) # dynamic credits write_int16(rom, 0x187010, credits_total) # dynamic credits
if credits_total != 216: if credits_total != 216:

View File

@@ -26,7 +26,7 @@ Sprite_LoadProperties:
org $288000 ;140000 org $288000 ;140000
ShuffleKeyDrops: ShuffleKeyDrops:
db 0 db 0
ShuffleKeyDropsReserved: MultiClientFlags: ; 140001 -> stored in SRAM at 7ef33d
db 0 db 0
LootTable: ;PC: 140002 LootTable: ;PC: 140002

Binary file not shown.