Skip to content

Commit

Permalink
LADX: Filter braces out of player names for hint text (#3831)
Browse files Browse the repository at this point in the history
* Filter braces out of player names for hint text

* Filter out another spot
  • Loading branch information
ScipioWright authored Aug 29, 2024
1 parent ab5b986 commit 0e55ddc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
6 changes: 5 additions & 1 deletion worlds/ladx/LADXR/generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,8 @@ def gen_hint():
name = "Your"
else:
name = f"{world.multiworld.player_name[location.item.player]}'s"
# filter out { and } since they cause issues with string.format later on
name = name.replace("{", "").replace("}", "")

if isinstance(location, LinksAwakeningLocation):
location_name = location.ladxr_item.metadata.name
Expand All @@ -288,7 +290,9 @@ def gen_hint():

hint = f"{name} {location.item} is at {location_name}"
if location.player != world.player:
hint += f" in {world.multiworld.player_name[location.player]}'s world"
# filter out { and } since they cause issues with string.format later on
player_name = world.multiworld.player_name[location.player].replace("{", "").replace("}", "")
hint += f" in {player_name}'s world"

# Cap hint size at 85
# Realistically we could go bigger but let's be safe instead
Expand Down
3 changes: 2 additions & 1 deletion worlds/ladx/LADXR/locations/shop.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ def patch(self, rom, option, *, multiworld=None):
mw_text = ""
if multiworld:
mw_text = f" for player {rom.player_names[multiworld - 1].encode('ascii', 'replace').decode()}"

# filter out { and } since they cause issues with string.format later on
mw_text = mw_text.replace("{", "").replace("}", "")

if self.custom_item_name:
name = self.custom_item_name
Expand Down

0 comments on commit 0e55ddc

Please sign in to comment.