From 9fa02b51c326b3f393195d23c77701fb839762ab Mon Sep 17 00:00:00 2001 From: Athanasius Date: Thu, 10 Jun 2021 12:52:15 +0100 Subject: [PATCH] Inara: Update to use `ShipLocker`, possibly from file. --- plugins/inara.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/plugins/inara.py b/plugins/inara.py index f4db0098..ee43a592 100644 --- a/plugins/inara.py +++ b/plugins/inara.py @@ -1098,7 +1098,14 @@ def journal_entry( # noqa: C901, CCR001 new_add_event('addCommanderTravelLand', entry['timestamp'], to_send_data) - elif event_name == 'ShipLockerMaterials': + elif event_name == 'ShipLocker': + # In ED 4.0.0.400 the event is only full sometimes, other times indicating + # ShipLocker.json was written. + if not all([entry.get(t, False) for t in ('Components', 'Consumables', 'Data', 'Items')]): + # So it's an empty event, core EDMC should have stuffed the data + # into state['ShipLockerJSON']. + entry = state['ShipLockerJSON'] + odyssey_plural_microresource_types = ('Items', 'Components', 'Data', 'Consumables') # we're getting new data here. so reset it on inara's side just to be sure that we set everything right reset_data = [{'itemType': t} for t in odyssey_plural_microresource_types]