LADX: Filter braces out of player names for hint text (#3831)

* Filter braces out of player names for hint text

* Filter out another spot
This commit is contained in:
Scipio Wright 2024-08-29 02:15:49 -04:00 committed by GitHub
parent ab5b986716
commit 0e55ddc7cf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 2 deletions

View File

@ -280,6 +280,8 @@ def generateRom(args, world: "LinksAwakeningWorld"):
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
@ -288,7 +290,9 @@ def generateRom(args, world: "LinksAwakeningWorld"):
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

View File

@ -18,7 +18,8 @@ class ShopItem(ItemInfo):
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