1
0
mirror of https://github.com/EDCD/EDMarketConnector.git synced 2025-04-17 17:42:20 +03:00

SuitLoadout: Attempt to get all state set correctly.

I think this is now correct, but not yet triggering the unhide of the
'Suit' UI line, will check that next.
This commit is contained in:
Athanasius 2021-05-20 10:51:49 +01:00
parent eeed2cf7af
commit 652fecc3e8

View File

@ -1044,20 +1044,34 @@ class EDLogs(FileSystemEventHandler): # type: ignore # See below
# this version of the docs: "SuitLoadout": # when starting on foot, or # this version of the docs: "SuitLoadout": # when starting on foot, or
# when disembarking from a ship, with the same info as found in "CreateSuitLoadout" # when disembarking from a ship, with the same info as found in "CreateSuitLoadout"
elif event_type == 'SuitLoadout': elif event_type == 'SuitLoadout':
suit_slotid = self.suit_loadout_id_from_loadoutid(entry['LoadoutID'])
# Initial suit containing just the data that is then embedded in
# the loadout
new_suit = {
'name': entry['SuitName'],
'locName': entry.get('SuitName_Localised', entry['SuitName']),
'suitId': entry['SuitID'],
}
# Make the new loadout, in the CAPI format
new_loadout = { new_loadout = {
'loadoutSlotId': self.suit_loadout_id_from_loadoutid(entry['LoadoutID']), 'loadoutSlotId': suit_slotid,
'suit': { 'suit': new_suit,
'name': entry['SuitName'],
'locName': entry.get('SuitName_Localised', entry['SuitName']),
'suitId': entry['SuitID'],
},
'name': entry['LoadoutName'], 'name': entry['LoadoutName'],
'slots': self.suit_loadout_slots_array_to_dict(entry['Modules']), 'slots': self.suit_loadout_slots_array_to_dict(entry['Modules']),
} }
# Assign this loadout into our state
self.state['SuitLoadouts'][new_loadout['loadoutSlotId']] = new_loadout self.state['SuitLoadouts'][new_loadout['loadoutSlotId']] = new_loadout
self.state['SuitLoadoutCurrent'] = new_loadout self.state['SuitLoadoutCurrent'] = new_loadout
# TODO: Well we know about the **SUIT**, as opposed to the Loadout ?
# self.state['SuitCurrent'] = self.state['Suits'][f'{new_suitid}'] # Now add in the extra fields for new_suit to be a 'full' Suit structure
new_suit['id'] = None # Not available in 4.0.0.100 journal event
new_suit['slots'] = new_loadout['slots'] # 'slots', not 'Modules', to match CAPI
# Ensure new_suit is in self.state['Suits']
self.state['Suits'][suit_slotid] = new_suit
self.state['SuitCurrent'] = new_suit
elif event_type == 'SwitchSuitLoadout': elif event_type == 'SwitchSuitLoadout':
loadoutid = entry['LoadoutID'] loadoutid = entry['LoadoutID']