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

Suits: Remove weapon from all loadouts if sold.

Also update credits total for the sale.
This commit is contained in:
Athanasius 2021-04-29 12:07:48 +01:00
parent 2253e45c18
commit 218073ed73

View File

@ -1103,8 +1103,22 @@ class EDLogs(FileSystemEventHandler): # type: ignore # See below
# • Name
# • Price
# • SuitModuleID
# alpha4:
# { "timestamp":"2021-04-29T10:50:34Z", "event":"SellWeapon", "Name":"wpn_m_assaultrifle_laser_fauto",
# "Name_Localised":"TK Aphelion", "Price":75000, "SuitModuleID":1698364962722310 }
# We need to look over all Suit Loadouts for ones that used this specific weapon
# and update them to entirely empty that slot.
for sl in self.state['SuitLoadouts']:
for w in self.state['SuitLoadouts'][sl]['slots']:
if self.state['SuitLoadouts'][sl]['slots'][w]['weaponrackId'] == entry['SuitModuleID']:
self.state['SuitLoadouts'][sl]['slots'].pop(w)
# We've changed the dict, so iteration breaks, but also the weapon
# could only possibly have been here once.
break
# Update credits total
pass
self.state['Credits'] += entry.get('Price', 0)
# `UpgradeWeapon` has no instance-specific ID as of 4.0.0.13
elif event_type == 'UpgradeWeapon':