mirror of
https://github.com/EDCD/EDMarketConnector.git
synced 2025-04-15 08:40:34 +03:00
Suits: Update DeleteSuitLoadout
code with alpha4 example
Also slightly simplified this. Leaving the try/except for now, although it should no longer be necessary.
This commit is contained in:
parent
bd1b86d3a3
commit
e24e0b3547
13
monitor.py
13
monitor.py
@ -977,16 +977,17 @@ class EDLogs(FileSystemEventHandler): # type: ignore # See below
|
||||
self.state['SuitLoadouts'][new_loadout['loadoutSlotId']] = new_loadout
|
||||
|
||||
elif event_type == 'DeleteSuitLoadout':
|
||||
# We should remove this from the monitor.state record of loadouts. The slotid
|
||||
# could end up valid due to CreateSuitLoadout events, but we won't have the
|
||||
# correct new loadout data until next CAPI pull.
|
||||
loadoutid = entry['LoadoutID']
|
||||
slotid = self.suit_loadout_id_from_loadoutid(loadoutid)
|
||||
# This might be a Loadout that was created after our last CAPI pull.
|
||||
# alpha4:
|
||||
# { "timestamp":"2021-04-29T10:32:27Z", "event":"DeleteSuitLoadout", "SuitID":1698365752966423,
|
||||
# "SuitName":"explorationsuit_class1", "SuitName_Localised":"Artemis Suit", "LoadoutID":4293000003,
|
||||
# "LoadoutName":"Loadout 1" }
|
||||
|
||||
slotid = self.suit_loadout_id_from_loadoutid(entry['LoadoutID'])
|
||||
try:
|
||||
self.state['SuitLoadouts'].pop(f'{slotid}')
|
||||
|
||||
except KeyError:
|
||||
# This should no longer happen, as we're now handling CreateSuitLoadout properly
|
||||
logger.exception(f"slot id {slotid} doesn't exist, not in last CAPI pull ?")
|
||||
|
||||
elif event_type == 'RenameSuitLoadout':
|
||||
|
Loading…
x
Reference in New Issue
Block a user