1
0
mirror of https://github.com/EDCD/EDMarketConnector.git synced 2025-04-15 08:40:34 +03:00

Support for 'TradeMicroResources' event

This has an array 'Offered' listing what was traded away.
'Category' & 'Received' is what you got in return, 'Count' many.

Again, we assume this only interacts with ShipLocker, not BackPack.
This commit is contained in:
Athanasius 2021-04-05 11:22:39 +01:00
parent c94ebad54c
commit c5d2300ba5

View File

@ -767,9 +767,21 @@ class EDLogs(FileSystemEventHandler): # type: ignore # See below
for mr in entry['MicroResources']:
category = self.category(mr['Category'])
name = self.canonicalise(mr['Name'])
self.state[category][name] -= mr['Count']
elif event_type == 'TradeMicroResources':
# Trading some MicroResources for another at a Bar Tender
# 'Offered' is what we traded away
for offer in entry['Offered']:
category = self.category(offer['Category'])
name = self.canonicalise(offer['Name'])
self.state[category][name] -= offer['Count']
# For a single item name received
category = self.category(entry['Category'])
name = self.canonicalise(entry['Received'])
self.state[category][name] += entry['Count']
elif event_type == 'NavRoute':
# Added in ED 3.7 - multi-hop route details in NavRoute.json
with open(join(self.currentdir, 'NavRoute.json'), 'rb') as rf: # type: ignore