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

Add basic support for ModuleInfo event.

This still needs documentation adding in PLUGINS.md, which is easiest
done after #897 is merged and re-based upon.
This commit is contained in:
Athanasius 2021-03-10 12:07:39 +00:00
parent 361cd168af
commit fd0ce63341

View File

@ -680,6 +680,11 @@ class EDLogs(FileSystemEventHandler): # type: ignore # See below
else:
self.state['NavRoute'] = entry
elif event_type == 'ModuleInfo':
with open(join(self.currentdir, 'ModulesInfo.json'), 'rb') as mf: # type: ignore
entry = json.load(mf)
self.state['ModuleInfo'] = entry
elif event_type in ('CollectCargo', 'MarketBuy', 'BuyDrones', 'MiningRefined'):
commodity = self.canonicalise(entry['Type'])
self.state['Cargo'][commodity] += entry.get('Count', 1)