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

Items: Implement CollectItems, DropItems and UseConsumable

The paranoia when subtracting from counts is because of the lack of
fresh `BackPackMaterials` if relogging whilst on foot.
This commit is contained in:
Athanasius 2021-04-30 14:44:20 +01:00
parent 422b766586
commit f89ed7999e

View File

@ -895,7 +895,9 @@ class EDLogs(FileSystemEventHandler): # type: ignore # See below
# • Name # • Name
# • Type # • Type
# • OwnerID # • OwnerID
pass for i in self.state['BackPackMaterials'][entry['Type']]:
if i['Name'] == entry['Name']:
i['Count'] += entry['Count']
elif event_type == 'DropItems': elif event_type == 'DropItems':
# alpha4 # alpha4
@ -905,7 +907,12 @@ class EDLogs(FileSystemEventHandler): # type: ignore # See below
# • OwnerID # • OwnerID
# • MissionID # • MissionID
# • Count # • Count
pass for i in self.state['BackPackMaterials'][entry['Type']]:
if i['Name'] == entry['Name']:
i['Count'] -= entry['Count']
# Paranoia in case we lost track
if i['Count'] < 0:
i['Count'] = 0
elif event_type == 'UseConsumable': elif event_type == 'UseConsumable':
# alpha4 # alpha4
@ -914,9 +921,12 @@ class EDLogs(FileSystemEventHandler): # type: ignore # See below
# Parameters: # Parameters:
# • Name # • Name
# • Type # • Type
for c in self.state['BackPackMaterials']['Consumables']: for c in self.state['BackPackMaterials']['Consumable']:
if c['Name'] == entry['Name']: if c['Name'] == entry['Name']:
c['Count'] -= 1 c['Count'] -= 1
# Paranoia in case we lost track
if i['Count'] < 0:
i['Count'] = 0
elif event_type == 'SwitchSuitLoadout': elif event_type == 'SwitchSuitLoadout':
# alpha4 # alpha4