Shop work:
- Potion shop - Cap Fairy blacklist - Item counter increased over 255 - Inverted work - Static sram for shops - Price adjustments (and discounts)
This commit is contained in:
@@ -52,6 +52,7 @@ class Context:
|
||||
self.awaiting_rom = False
|
||||
self.rom = None
|
||||
self.auth = None
|
||||
self.total_locations = None
|
||||
|
||||
def color_code(*args):
|
||||
codes = {'reset': 0, 'bold': 1, 'underline': 4, 'black': 30, 'red': 31, 'green': 32, 'yellow': 33, 'blue': 34,
|
||||
@@ -86,6 +87,12 @@ SCOUT_LOCATION_ADDR = SAVEDATA_START + 0x4D7 # 1 byte
|
||||
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
|
||||
|
||||
SHOP_SRAM_LEN = 0x29 # 41 tracked items
|
||||
location_shop_order = [Regions.shop_to_location_table.keys()] + [Regions.retro_shops.keys()]
|
||||
location_shop_ids = {0x0112, 0x0110, 0x010F, 0x00FF, 0x011F, 0x0109, 0x0115}
|
||||
|
||||
location_table_uw = {"Blind's Hideout - Top": (0x11d, 0x10),
|
||||
"Blind's Hideout - Left": (0x11d, 0x20),
|
||||
@@ -800,11 +807,28 @@ def get_location_name_from_address(address):
|
||||
async def track_locations(ctx : Context, roomid, roomdata):
|
||||
new_locations = []
|
||||
|
||||
if ctx.total_locations is None:
|
||||
total_data = await snes_read(ctx, DYNAMIC_TOTAL_ADDR, 2)
|
||||
ttl = total_data[0] | (total_data[1] << 8)
|
||||
if ttl > 0:
|
||||
ctx.total_locations = ttl
|
||||
|
||||
def new_check(location):
|
||||
ctx.locations_checked.add(location)
|
||||
logging.info("New check: %s (%d/216)" % (location, len(ctx.locations_checked)))
|
||||
logging.info(f"New check: {location} ({len(ctx.locations_checked)}/{ctx.total_locations})")
|
||||
new_locations.append(Regions.lookup_name_to_id[location])
|
||||
|
||||
try:
|
||||
if roomid in location_shop_ids:
|
||||
misc_data = await snes_read(ctx, SHOP_ADDR, SHOP_SRAM_LEN)
|
||||
for cnt, b in enumerate(misc_data):
|
||||
my_check = Regions.shop_table_by_location_id[0x400000 + cnt]
|
||||
if int(b) > 0 and my_check not in ctx.locations_checked:
|
||||
new_check(my_check)
|
||||
except Exception as e:
|
||||
print(e)
|
||||
logging.warning(e)
|
||||
|
||||
for location, (loc_roomid, loc_mask) in location_table_uw.items():
|
||||
if location not in ctx.locations_checked and loc_roomid == roomid and (roomdata << 4) & loc_mask != 0:
|
||||
new_check(location)
|
||||
|
||||
Reference in New Issue
Block a user