mirror of
https://github.com/EDCD/EDMarketConnector.git
synced 2025-04-17 17:42:20 +03:00
Suits: Add some paranoia around Loadouts
* Initialise to empty dict. * try/except in case CAPI pull hasn't happened yet when parsing Journal events.
This commit is contained in:
parent
e796684fc6
commit
2253e45c18
14
monitor.py
14
monitor.py
@ -153,7 +153,7 @@ class EDLogs(FileSystemEventHandler): # type: ignore # See below
|
|||||||
'SuitCurrent': None,
|
'SuitCurrent': None,
|
||||||
'Suits': None,
|
'Suits': None,
|
||||||
'SuitLoadoutCurrent': None,
|
'SuitLoadoutCurrent': None,
|
||||||
'SuitLoadouts': None,
|
'SuitLoadouts': {},
|
||||||
}
|
}
|
||||||
|
|
||||||
def start(self, root: 'tkinter.Tk') -> bool: # noqa: CCR001
|
def start(self, root: 'tkinter.Tk') -> bool: # noqa: CCR001
|
||||||
@ -982,13 +982,13 @@ class EDLogs(FileSystemEventHandler): # type: ignore # See below
|
|||||||
# "SuitName":"explorationsuit_class1", "SuitName_Localised":"Artemis Suit", "LoadoutID":4293000003,
|
# "SuitName":"explorationsuit_class1", "SuitName_Localised":"Artemis Suit", "LoadoutID":4293000003,
|
||||||
# "LoadoutName":"Loadout 1" }
|
# "LoadoutName":"Loadout 1" }
|
||||||
|
|
||||||
slotid = self.suit_loadout_id_from_loadoutid(entry['LoadoutID'])
|
loadout_id = self.suit_loadout_id_from_loadoutid(entry['LoadoutID'])
|
||||||
try:
|
try:
|
||||||
self.state['SuitLoadouts'].pop(f'{slotid}')
|
self.state['SuitLoadouts'].pop(f'{loadout_id}')
|
||||||
|
|
||||||
except KeyError:
|
except KeyError:
|
||||||
# This should no longer happen, as we're now handling CreateSuitLoadout properly
|
# 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 ?")
|
logger.exception(f"loadout slot id {loadout_id} doesn't exist, not in last CAPI pull ?")
|
||||||
|
|
||||||
elif event_type == 'RenameSuitLoadout':
|
elif event_type == 'RenameSuitLoadout':
|
||||||
# alpha4
|
# alpha4
|
||||||
@ -1002,7 +1002,11 @@ class EDLogs(FileSystemEventHandler): # type: ignore # See below
|
|||||||
# "SuitName":"explorationsuit_class1", "SuitName_Localised":"Artemis Suit", "LoadoutID":4293000003,
|
# "SuitName":"explorationsuit_class1", "SuitName_Localised":"Artemis Suit", "LoadoutID":4293000003,
|
||||||
# "LoadoutName":"Art L/K" }
|
# "LoadoutName":"Art L/K" }
|
||||||
loadout_id = self.suit_loadout_id_from_loadoutid(entry['LoadoutID'])
|
loadout_id = self.suit_loadout_id_from_loadoutid(entry['LoadoutID'])
|
||||||
self.state['SuitLoadouts'][loadout_id]['name'] = entry['LoadoutName']
|
try:
|
||||||
|
self.state['SuitLoadouts'][loadout_id]['name'] = entry['LoadoutName']
|
||||||
|
|
||||||
|
except KeyError:
|
||||||
|
logger.exception(f"loadout slot id {loadout_id} doesn't exist, not in last CAPI pull ?")
|
||||||
|
|
||||||
elif event_type == 'BuySuit':
|
elif event_type == 'BuySuit':
|
||||||
# alpha4 :
|
# alpha4 :
|
||||||
|
Loading…
x
Reference in New Issue
Block a user