1
0
mirror of https://github.com/EDCD/EDMarketConnector.git synced 2025-04-12 15:27:14 +03:00

Merge pull request #2347 from colsw/stateupdate

Include 'missing?' Loadout event properties in 'state'
This commit is contained in:
David Sangrey 2025-02-08 17:19:44 +00:00 committed by GitHub
commit 9a9246cec3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 14 additions and 0 deletions

View File

@ -655,6 +655,10 @@ Content of `state` (updated to the current journal entry):
| `ShipType` | `str` | Internal name for the current ship type |
| `HullValue` | `int` | Current ship value, excluding modules |
| `ModulesValue` | `int` | Value of the current ship's modules |
| `UnladenMass` | `float` | Unladen mass of current ship |
| `CargoCapacity` | `int` | Max cargo capacity of current ship |
| `MaxJumpRange` | `float` | Unladen jump range of current ship |
| `FuelCapacity` | `dict[str,float]` | Current max capacity of Main & Reserve tanks |
| `Rebuy` | `int` | Current ship's rebuy cost |
| `Modules` | `dict` | Currently fitted modules |
| `NavRoute` | `dict` | Last plotted multi-hop route[1] |

View File

@ -141,6 +141,10 @@ class EDLogs(FileSystemEventHandler):
'ShipType': None,
'HullValue': None,
'ModulesValue': None,
'UnladenMass': None,
'CargoCapacity': None,
'MaxJumpRange': None,
'FuelCapacity': None,
'Rebuy': None,
'Modules': None,
'CargoJSON': None, # The raw data from the last time cargo.json was read
@ -680,6 +684,12 @@ class EDLogs(FileSystemEventHandler):
self.state['ShipType'] = self.canonicalise(entry['Ship'])
self.state['HullValue'] = entry.get('HullValue') # not present on exiting Outfitting
self.state['ModulesValue'] = entry.get('ModulesValue') # not present on exiting Outfitting
self.state['UnladenMass'] = entry.get('UnladenMass')
self.state['CargoCapacity'] = entry.get('CargoCapacity')
self.state['MaxJumpRange'] = entry.get('MaxJumpRange')
self.state['FuelCapacity'] = {}
self.state['FuelCapacity']['Main'] = entry.get('FuelCapacity')['Main']
self.state['FuelCapacity']['Reserve'] = entry.get('FuelCapacity')['Reserve']
self.state['Rebuy'] = entry.get('Rebuy')
# Remove spurious differences between initial Loadout event and subsequent
self.state['Modules'] = {}