Skip to content

Pokemon Emerald: Fix client crash if 0.4.6 client connects to 0.4.5 seed #3146

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion worlds/pokemon_emerald/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class PokemonEmeraldWorld(World):
location_name_groups = LOCATION_GROUPS

data_version = 2
required_client_version = (0, 4, 5)
required_client_version = (0, 4, 6)

badge_shuffle_info: Optional[List[Tuple[PokemonEmeraldLocation, PokemonEmeraldItem]]]
hm_shuffle_info: Optional[List[Tuple[PokemonEmeraldLocation, PokemonEmeraldItem]]]
Expand Down
7 changes: 4 additions & 3 deletions worlds/pokemon_emerald/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@
]
KEY_LOCATION_FLAG_MAP = {data.locations[location_name].flag: location_name for location_name in KEY_LOCATION_FLAGS}

LEGENDARY_NAMES = {
# .lower() keys for backward compatibility between 0.4.5 and 0.4.6
LEGENDARY_NAMES = {k.lower(): v for k, v in {
"Groudon": "GROUDON",
"Kyogre": "KYOGRE",
"Rayquaza": "RAYQUAZA",
Expand All @@ -100,7 +101,7 @@
"Deoxys": "DEOXYS",
"Ho-Oh": "HO_OH",
"Lugia": "LUGIA",
}
}.items()}

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

num_caught = 0
for legendary, is_caught in caught_legendaries.items():
if is_caught and legendary in [LEGENDARY_NAMES[name] for name in ctx.slot_data["allowed_legendary_hunt_encounters"]]:
if is_caught and legendary in [LEGENDARY_NAMES[name.lower()] for name in ctx.slot_data["allowed_legendary_hunt_encounters"]]:
num_caught += 1

if num_caught >= ctx.slot_data["legendary_hunt_count"]:
Expand Down
Loading