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

Store Fileheader language, gameversion and build in monitor.state

This commit is contained in:
Athanasius 2021-05-25 17:56:11 +01:00
parent e9e5352e37
commit bac718aeff
2 changed files with 10 additions and 2 deletions

View File

@ -566,6 +566,9 @@ Content of `state` (updated to the current journal entry):
| Field | Type | Description |
| :------------- | :-------------------------: | :-------------------------------------------------------------------------------------------------------------- |
| `GameLanguage` | `Optional[str]` | `language` value from `Fileheader` event. |
| `GameVersion` | `Optional[str]` | `version` value from `Fileheader` event. |
| `GameBuild` | `Optional[str]` | `build` value from `Fileheader` event. |
| `Captain` | `Optional[str]` | Name of the commander who's crew you're on, if any |
| `Cargo` | `dict` | Current cargo. Note that this will be totals, and any mission specific duplicates will be counted together |
| `CargoJSON` | `dict` | content of cargo.json as of last read. |

View File

@ -115,6 +115,9 @@ class EDLogs(FileSystemEventHandler): # type: ignore # See below
# Cmdr state shared with EDSM and plugins
# If you change anything here update PLUGINS.md documentation!
self.state: Dict = {
'GameLanguage': None, # From `Fileheader
'GameVersion': None, # From `Fileheader
'GameBuild': None, # From `Fileheader
'Captain': None, # On a crew
'Cargo': defaultdict(int),
'Credits': None,
@ -497,13 +500,15 @@ class EDLogs(FileSystemEventHandler): # type: ignore # See below
self.systemaddress = None
self.started = None
self.__init_state()
# In self.state as well, as that's what plugins get
self.stat['GameLanguage'] = entry['language']
self.stat['GameVersion'] = entry['gameversion']
self.stat['GameBuild'] = entry['build']
elif event_type == 'Commander':
self.live = True # First event in 3.0
elif event_type == 'LoadGame':
# alpha4
# Odyssey: bool
self.cmdr = entry['Commander']
# 'Open', 'Solo', 'Group', or None for CQC (and Training - but no LoadGame event)
self.mode = entry.get('GameMode')