From 60b2045ea4293e2408e7189792621952b78cab81 Mon Sep 17 00:00:00 2001
From: Athanasius <github@miggy.org>
Date: Fri, 30 Apr 2021 15:21:47 +0100
Subject: [PATCH] Items: Fix `DropItems` and `CollectItems`

Tested as actually working.
---
 monitor.py | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/monitor.py b/monitor.py
index 6a0b42dd..584ece48 100644
--- a/monitor.py
+++ b/monitor.py
@@ -895,9 +895,9 @@ class EDLogs(FileSystemEventHandler):  # type: ignore # See below
                 #     • Name
                 #     • Type
                 #     • OwnerID
-                for i in self.state['BackPackMaterials'][entry['Type']]:
-                    if i['Name'] == entry['Name']:
-                        i['Count'] += entry['Count']
+                for i in self.state['BackPack'][entry['Type']]:
+                    if i == entry['Name']:
+                        self.state['BackPack'][entry['Type']][i] += entry['Count']
 
             elif event_type == 'DropItems':
                 # alpha4
@@ -907,12 +907,12 @@ class EDLogs(FileSystemEventHandler):  # type: ignore # See below
                 #     • OwnerID
                 #     • MissionID
                 #     • Count
-                for i in self.state['BackPackMaterials'][entry['Type']]:
-                    if i['Name'] == entry['Name']:
-                        i['Count'] -= entry['Count']
+                for i in self.state['BackPack'][entry['Type']]:
+                    if i == entry['Name']:
+                        self.state['BackPack'][entry['Type']][i] -= entry['Count']
                         # Paranoia in case we lost track
-                        if i['Count'] < 0:
-                            i['Count'] = 0
+                        if self.state['BackPack'][entry['Type']][i] < 0:
+                            self.state['BackPack'][entry['Type']][i] = 0
 
             elif event_type == 'UseConsumable':
                 # alpha4