LADX: Swap out invalid characters in item names (#4495)

This commit is contained in:
threeandthreee 2025-01-16 21:59:19 -05:00 committed by GitHub
parent 3a5a4b89ee
commit 4b8f990960
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 1 deletions

View File

@ -2,6 +2,10 @@ import typing
from ..checkMetadata import checkMetadataTable from ..checkMetadata import checkMetadataTable
from .constants import * from .constants import *
custom_name_replacements = {
'"':"'",
'_':' ',
}
class ItemInfo: class ItemInfo:
MULTIWORLD = True MULTIWORLD = True
@ -23,6 +27,11 @@ class ItemInfo:
def setLocation(self, location): def setLocation(self, location):
self._location = location self._location = location
def setCustomItemName(self, name):
for key, val in custom_name_replacements.items():
name = name.replace(key, val)
self.custom_item_name = name
def getOptions(self): def getOptions(self):
return self.OPTIONS return self.OPTIONS

View File

@ -439,7 +439,7 @@ class LinksAwakeningWorld(World):
# Otherwise, use a cute letter as the icon # Otherwise, use a cute letter as the icon
elif self.options.foreign_item_icons == 'guess_by_name': elif self.options.foreign_item_icons == 'guess_by_name':
loc.ladxr_item.item = self.guess_icon_for_other_world(loc.item) loc.ladxr_item.item = self.guess_icon_for_other_world(loc.item)
loc.ladxr_item.custom_item_name = loc.item.name loc.ladxr_item.setCustomItemName(loc.item.name)
else: else:
if loc.item.advancement: if loc.item.advancement: