1
0
mirror of https://github.com/EDCD/EDMarketConnector.git synced 2025-06-06 10:23:06 +03:00

Support BuyDrones and SellDrones events

This commit is contained in:
Jonathan Harris 2017-09-10 23:56:44 +01:00
parent 976e044178
commit 0762b3d11b

View File

@ -386,10 +386,10 @@ class EDLogs(FileSystemEventHandler):
self.live = True # First event in 2.3 self.live = True # First event in 2.3
self.state['Cargo'] = defaultdict(int) self.state['Cargo'] = defaultdict(int)
self.state['Cargo'].update({ self.canonicalise(x['Name']): x['Count'] for x in entry['Inventory'] }) self.state['Cargo'].update({ self.canonicalise(x['Name']): x['Count'] for x in entry['Inventory'] })
elif entry['event'] in ['CollectCargo', 'MarketBuy', 'MiningRefined']: elif entry['event'] in ['CollectCargo', 'MarketBuy', 'BuyDrones', 'MiningRefined']:
commodity = self.canonicalise(entry['Type']) commodity = self.canonicalise(entry['Type'])
self.state['Cargo'][commodity] += entry.get('Count', 1) self.state['Cargo'][commodity] += entry.get('Count', 1)
elif entry['event'] in ['EjectCargo', 'MarketSell']: elif entry['event'] in ['EjectCargo', 'MarketSell', 'SellDrones']:
commodity = self.canonicalise(entry['Type']) commodity = self.canonicalise(entry['Type'])
self.state['Cargo'][commodity] -= entry.get('Count', 1) self.state['Cargo'][commodity] -= entry.get('Count', 1)
if self.state['Cargo'][commodity] <= 0: if self.state['Cargo'][commodity] <= 0: