diff --git a/EDMarketConnector.py b/EDMarketConnector.py index 2f94f660..5e0a0f4c 100755 --- a/EDMarketConnector.py +++ b/EDMarketConnector.py @@ -629,7 +629,7 @@ class AppWindow(object): self.suit['text'] = f'<{_("Unknown")}>' return - suitname = suit['locName'] + suitname = suit['edmcName'] if (suitloadout := monitor.state.get('SuitLoadoutCurrent')) is None: self.suit['text'] = '' @@ -927,7 +927,7 @@ class AppWindow(object): if monitor.state.get('SuitCurrent') is not None: if (loadout := data.get('loadout')) is not None: if (suit := loadout.get('suit')) is not None: - if (suitname := suit.get('locName')) is not None: + if (suitname := suit.get('edmcName')) is not None: # We've been paranoid about loadout->suit->suitname, now just assume loadouts is there loadout_name = index_possibly_sparse_list( data['loadouts'], loadout['loadoutSlotId'] diff --git a/edmc_data.py b/edmc_data.py index 7aea749b..11a7db4d 100644 --- a/edmc_data.py +++ b/edmc_data.py @@ -495,3 +495,18 @@ ship_name_map = { 'viper_mkiv': 'Viper MkIV', 'vulture': 'Vulture', } + +# Odyssey Suit Names +edmc_suit_shortnames = { + 'Artemis Suit': 'Artemis', + 'Dominator Suit': 'Dominator', + 'Flight Suit': 'Flight', + 'Maverick Suit': 'Maverick', +} + +edmc_suit_symbol_to_en = { + 'explorationsuit': 'Artemis Suit', + 'flightsuit': 'Flight Suit', + 'tacticalsuit': 'Dominator Suit', + 'utilitysuit': 'Maverick Suit', +} diff --git a/monitor.py b/monitor.py index eca0d5b0..8f6736fd 100644 --- a/monitor.py +++ b/monitor.py @@ -19,6 +19,7 @@ if TYPE_CHECKING: import util_ships from config import config +from edmc_data import edmc_suit_shortnames, edmc_suit_symbol_to_en from EDMCLogging import get_main_logger logger = get_main_logger() @@ -1604,12 +1605,21 @@ class EDLogs(FileSystemEventHandler): # type: ignore # See below """ # TODO: Localisation ? # Stage 1: Is it in `$_Class_Name;` form ? - if (m := re.fullmatch(r'^\$([^_]+)_Class([0-9]+)_Name$', name)): + if m := re.fullmatch(r'^\$([^_]+)_Class([0-9]+)_Name;$', name): n, c = m.group(1, 2) name = n # Stage 2: Is it in `_class` form ? + elif m := re.fullmatch(r'^([^_]+)_class([0-9]+)$', name): + n, c = m.group(1, 2) + name = n + + # Now turn either of those into an English ' Suit' form + name = edmc_suit_symbol_to_en.get(name.lower(), name) + # Stage 3: Is it in verbose ` Suit` form ? + name = edmc_suit_shortnames.get(name, name) + return name def suitloadout_store_from_event(self, entry) -> Tuple[int, int]: