From d14ab97849f1afd9b784b97694923070281a9e3b Mon Sep 17 00:00:00 2001 From: zig-for Date: Wed, 29 Mar 2023 05:41:11 -0700 Subject: [PATCH] LADX: Fix gen failures with non-ascii player names, fix missing custom (#1619) --- worlds/ladx/LADXR/locations/shop.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/worlds/ladx/LADXR/locations/shop.py b/worlds/ladx/LADXR/locations/shop.py index e3e05d94..b6872666 100644 --- a/worlds/ladx/LADXR/locations/shop.py +++ b/worlds/ladx/LADXR/locations/shop.py @@ -17,18 +17,24 @@ class ShopItem(ItemInfo): def patch(self, rom, option, *, multiworld=None): mw_text = "" if multiworld: - mw_text = f" for player {rom.player_names[multiworld - 1]}" + mw_text = f" for player {rom.player_names[multiworld - 1].encode('ascii', 'replace').decode()}" + + + if self.custom_item_name: + name = self.custom_item_name + else: + name = "{"+option+"}" if self.__index == 0: # Old index, maybe not needed any more rom.patch(0x04, 0x37C5, "08", "%02X" % (CHEST_ITEMS[option])) - rom.texts[0x030] = formatText(f"Deluxe {{%s}} 200 {{RUPEES}}{mw_text}!" % (option), ask="Buy No Way") + rom.texts[0x030] = formatText(f"Deluxe {name} 200 {{RUPEES}}{mw_text}!", ask="Buy No Way") rom.banks[0x3E][0x3800 + 0x2A1] = CHEST_ITEMS[option] if multiworld: rom.banks[0x3E][0x3300 + 0x2A1] = multiworld elif self.__index == 1: rom.patch(0x04, 0x37C6, "02", "%02X" % (CHEST_ITEMS[option])) - rom.texts[0x02C] = formatText(f"{{%s}} Only 980 {{RUPEES}}{mw_text}!" % (option), ask="Buy No Way") + rom.texts[0x02C] = formatText(f"{name} only 980 {{RUPEES}}{mw_text}!", ask="Buy No Way") rom.banks[0x3E][0x3800 + 0x2A7] = CHEST_ITEMS[option] if multiworld: