From 0e55ddc7cf8b36bde3690a86c35d2134cf62a884 Mon Sep 17 00:00:00 2001 From: Scipio Wright Date: Thu, 29 Aug 2024 02:15:49 -0400 Subject: [PATCH] LADX: Filter braces out of player names for hint text (#3831) * Filter braces out of player names for hint text * Filter out another spot --- worlds/ladx/LADXR/generator.py | 6 +++++- worlds/ladx/LADXR/locations/shop.py | 3 ++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/worlds/ladx/LADXR/generator.py b/worlds/ladx/LADXR/generator.py index e6f608a9..69e856f3 100644 --- a/worlds/ladx/LADXR/generator.py +++ b/worlds/ladx/LADXR/generator.py @@ -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 diff --git a/worlds/ladx/LADXR/locations/shop.py b/worlds/ladx/LADXR/locations/shop.py index b6872666..bee05371 100644 --- a/worlds/ladx/LADXR/locations/shop.py +++ b/worlds/ladx/LADXR/locations/shop.py @@ -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