From 0cbb3c283917094ec5dad42628fe7d93a75025c0 Mon Sep 17 00:00:00 2001 From: lordlou <87331798+lordlou@users.noreply.github.com> Date: Sat, 3 Sep 2022 17:52:09 -0400 Subject: [PATCH] SMZ3: data package fix (#996) --- SNIClient.py | 3 ++- worlds/smz3/__init__.py | 9 +++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/SNIClient.py b/SNIClient.py index 3d90fafc..ccac3998 100644 --- a/SNIClient.py +++ b/SNIClient.py @@ -1271,7 +1271,8 @@ async def game_watcher(ctx: Context): snes_buffered_write(ctx, SMZ3_RECV_PROGRESS_ADDR + 0x680, bytes([recv_index & 0xFF, (recv_index >> 8) & 0xFF])) from worlds.smz3.TotalSMZ3.Location import locations_start_id - location_id = locations_start_id + itemIndex + from worlds.smz3 import convertLocSMZ3IDToAPID + location_id = locations_start_id + convertLocSMZ3IDToAPID(itemIndex) ctx.locations_checked.add(location_id) location = ctx.location_names[location_id] diff --git a/worlds/smz3/__init__.py b/worlds/smz3/__init__.py index b9aab50e..b796c2a4 100644 --- a/worlds/smz3/__init__.py +++ b/worlds/smz3/__init__.py @@ -25,6 +25,10 @@ from Options import Accessibility world_folder = os.path.dirname(__file__) logger = logging.getLogger("SMZ3") +# Location IDs in the range 256+196 to 256+202 shifted +34 between 11.2 and 11.3 +# this is required to keep backward compatibility +def convertLocSMZ3IDToAPID(value): + return (value - 34) if value >= 256+230 and value <= 256+236 else value class SMZ3CollectionState(metaclass=AutoLogicRegister): def init_mixin(self, parent: MultiWorld): @@ -61,12 +65,13 @@ class SMZ3World(World): """ game: str = "SMZ3" topology_present = False - data_version = 2 + data_version = 3 option_definitions = smz3_options item_names: Set[str] = frozenset(TotalSMZ3Item.lookup_name_to_id) location_names: Set[str] item_name_to_id = TotalSMZ3Item.lookup_name_to_id - location_name_to_id: Dict[str, int] = {key : locations_start_id + value.Id for key, value in TotalSMZ3World(Config(), "", 0, "").locationLookup.items()} + location_name_to_id: Dict[str, int] = {key : locations_start_id + convertLocSMZ3IDToAPID(value.Id) + for key, value in TotalSMZ3World(Config(), "", 0, "").locationLookup.items()} web = SMZ3Web() remote_items: bool = False