mirror of
https://github.com/EDCD/EDMarketConnector.git
synced 2025-04-19 02:17:38 +03:00
Suits: Fully implement mapping to sane (English only for now) names
This commit is contained in:
parent
f85213b318
commit
dba3fba8e3
@ -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']
|
||||
|
15
edmc_data.py
15
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',
|
||||
}
|
||||
|
12
monitor.py
12
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 `$<type>_Class<X>_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 `<type>_class<x>` 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 '<type> Suit' form
|
||||
name = edmc_suit_symbol_to_en.get(name.lower(), name)
|
||||
|
||||
# Stage 3: Is it in verbose `<type> Suit` form ?
|
||||
name = edmc_suit_shortnames.get(name, name)
|
||||
|
||||
return name
|
||||
|
||||
def suitloadout_store_from_event(self, entry) -> Tuple[int, int]:
|
||||
|
Loading…
x
Reference in New Issue
Block a user