Skip to content

Commit 056267f

Browse files
Zunaweqwint
authored andcommitted
Pokemon Emerald: Fix client crash if 0.4.6 client connects to 0.4.5 seed (ArchipelagoMW#3146)
1 parent 92a7efe commit 056267f

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

worlds/pokemon_emerald/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ class PokemonEmeraldWorld(World):
8787
location_name_groups = LOCATION_GROUPS
8888

8989
data_version = 2
90-
required_client_version = (0, 4, 5)
90+
required_client_version = (0, 4, 6)
9191

9292
badge_shuffle_info: Optional[List[Tuple[PokemonEmeraldLocation, PokemonEmeraldItem]]]
9393
hm_shuffle_info: Optional[List[Tuple[PokemonEmeraldLocation, PokemonEmeraldItem]]]

worlds/pokemon_emerald/client.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,8 @@
8787
]
8888
KEY_LOCATION_FLAG_MAP = {data.locations[location_name].flag: location_name for location_name in KEY_LOCATION_FLAGS}
8989

90-
LEGENDARY_NAMES = {
90+
# .lower() keys for backward compatibility between 0.4.5 and 0.4.6
91+
LEGENDARY_NAMES = {k.lower(): v for k, v in {
9192
"Groudon": "GROUDON",
9293
"Kyogre": "KYOGRE",
9394
"Rayquaza": "RAYQUAZA",
@@ -100,7 +101,7 @@
100101
"Deoxys": "DEOXYS",
101102
"Ho-Oh": "HO_OH",
102103
"Lugia": "LUGIA",
103-
}
104+
}.items()}
104105

105106
DEFEATED_LEGENDARY_FLAG_MAP = {data.constants[f"FLAG_DEFEATED_{name}"]: name for name in LEGENDARY_NAMES.values()}
106107
CAUGHT_LEGENDARY_FLAG_MAP = {data.constants[f"FLAG_CAUGHT_{name}"]: name for name in LEGENDARY_NAMES.values()}
@@ -311,7 +312,7 @@ async def game_watcher(self, ctx: "BizHawkClientContext") -> None:
311312

312313
num_caught = 0
313314
for legendary, is_caught in caught_legendaries.items():
314-
if is_caught and legendary in [LEGENDARY_NAMES[name] for name in ctx.slot_data["allowed_legendary_hunt_encounters"]]:
315+
if is_caught and legendary in [LEGENDARY_NAMES[name.lower()] for name in ctx.slot_data["allowed_legendary_hunt_encounters"]]:
315316
num_caught += 1
316317

317318
if num_caught >= ctx.slot_data["legendary_hunt_count"]:

0 commit comments

Comments
 (0)