mirror of
https://github.com/EDCD/EDMarketConnector.git
synced 2025-04-13 15:57:14 +03:00
monitor/tracking: Switch .systempopulation to state['SystemPopulation']
1. EDDB plugin tracked this for keeping the Station link text up to date. * So moved it to monitor.state['SystemPopulation']. * PLUGINS.md updated to cite this. * PLUGINS.md also updated to note state entries that are set to None if remote multi-crew is detected.
This commit is contained in:
parent
dbad45cf3b
commit
df5eb5b270
26
PLUGINS.md
26
PLUGINS.md
@ -607,11 +607,11 @@ This gets called when EDMarketConnector sees a new entry in the game's journal.
|
||||
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 |
|
||||
| `Captain`[3] | `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. |
|
||||
| `Credits` | `int` | Current credits balance |
|
||||
@ -639,7 +639,7 @@ Content of `state` (updated to the current journal entry):
|
||||
| `NavRoute` | `dict` | Last plotted multi-hop route[1] |
|
||||
| `ModuleInfo` | `dict` | Last loaded ModulesInfo.json data |
|
||||
| `IsDocked` | `bool` | Whether the Cmdr is currently docked *in their own ship*. |
|
||||
| `OnFoot` | `bool` | Whether the Cmdr is on foot |
|
||||
| `OnFoot`[3] | `bool` | Whether the Cmdr is on foot |
|
||||
| `Component` | `dict` | 'Component' MicroResources in Odyssey, `int` count each. |
|
||||
| `Item` | `dict` | 'Item' MicroResources in Odyssey, `int` count each. |
|
||||
| `Consumable` | `dict` | 'Consumable' MicroResources in Odyssey, `int` count each. |
|
||||
@ -653,9 +653,13 @@ Content of `state` (updated to the current journal entry):
|
||||
| `SuitLoadouts` | `dict`[2] | CAPI-returned data of all Suit Loadouts. NB: May be `None` if no data. |
|
||||
| `Taxi` | `Optional[bool]` | Whether or not we're currently in a taxi. NB: This is best effort with what the journals provide. |
|
||||
| `Dropship` | `Optional[bool]` | Whether or not the above taxi is a Dropship |
|
||||
| `Body`[3] | `Optional[str]` | Name of the body we're currently on / in the SOI of |
|
||||
| `BodyID`[3] | `Optional[int]` | ID of the body we're currently on / in the SOI of |
|
||||
| `BodyType`[3] | `Optional[str]` | The type of body that `Body` refers to |
|
||||
| `SystemAddress`[3] | `Optional[int]` | Unique [ID64](http://disc.thargoid.space/ID64) of the star system we're currently in |
|
||||
| `SystemName`[3] | `Optional[str]` | Name of the star system we're currently in |
|
||||
| `SystemPopulation`[3]| `Optional[int]` | Population of the star system we're currently in |
|
||||
| `StarPos`[3] | `Optional[tuple[float]]` | Galaxy co-ordinates of the system we're currently in |
|
||||
| `Body`[3][4] | `Optional[str]` | Name of the body we're currently on / in the SOI of |
|
||||
| `BodyID`[3][4] | `Optional[int]` | ID of the body we're currently on / in the SOI of |
|
||||
| `BodyType`[3][4] | `Optional[str]` | The type of body that `Body` refers to |
|
||||
|
||||
[1] - Contents of `NavRoute` not changed if a `NavRouteClear` event is seen,
|
||||
but plugins will see the `NavRouteClear` event.
|
||||
@ -677,7 +681,10 @@ least one member is missing, so the indices are not contiguous). We choose to
|
||||
always convert to the integer-keyed `dict` form so that code utilising the data
|
||||
is simpler.
|
||||
|
||||
[3] - There are some caveats with the Body data. Firstly the name and ID
|
||||
[3] - Forced to `None` if the player joins another player's ship in remote
|
||||
multi-crew.
|
||||
|
||||
[4] - There are some caveats with the Body data. Firstly the name and ID
|
||||
can be for the orbital station or fleet carrier the player is docked at.
|
||||
Check 'BodyType' before using the values.
|
||||
|
||||
@ -789,6 +796,11 @@ with the synthetic `StartUp` event. NB: Might just be a `NavRouteClear` event
|
||||
if that's what was in the file.
|
||||
|
||||
New in version 5.8.0:
|
||||
|
||||
`StarPos`, `SystemAddress`, `SystemName` and `SystemPopulation` have been
|
||||
added to the `state` dictionary. Best efforts data pertaining to the star
|
||||
system the player is in.
|
||||
|
||||
`BodyID` and `BodyType` have been added to the `state` dictionary. These
|
||||
now track in the same manner as prior core EDDN plugin code. Check the
|
||||
documentation above for some caveats. Do not just blindly use this data, or
|
||||
|
16
monitor.py
16
monitor.py
@ -116,7 +116,6 @@ class EDLogs(FileSystemEventHandler): # type: ignore # See below
|
||||
self.mode: str | None = None
|
||||
self.group: str | None = None
|
||||
self.cmdr: str | None = None
|
||||
self.systempopulation: int | None = None
|
||||
self.station: str | None = None
|
||||
self.station_marketid: int | None = None
|
||||
self.stationtype: str | None = None
|
||||
@ -191,6 +190,7 @@ class EDLogs(FileSystemEventHandler): # type: ignore # See below
|
||||
'StarPos': None, # Best effort current system's galaxy position.
|
||||
'SystemAddress': None,
|
||||
'SystemName': None,
|
||||
'SystemPopulation': None,
|
||||
'Body': None,
|
||||
'BodyID': None,
|
||||
'BodyType': None,
|
||||
@ -304,6 +304,8 @@ class EDLogs(FileSystemEventHandler): # type: ignore # See below
|
||||
self.group = None
|
||||
self.cmdr = None
|
||||
self.state['SystemAddress'] = None
|
||||
self.state['SystemName'] = None
|
||||
self.state['SystemPopulation'] = None
|
||||
self.state['StarPos'] = None
|
||||
self.state['Body'] = None
|
||||
self.state['BodyID'] = None
|
||||
@ -529,7 +531,7 @@ class EDLogs(FileSystemEventHandler): # type: ignore # See below
|
||||
'StarSystem': self.state['SystemName'],
|
||||
'StarPos': self.state['StarPos'],
|
||||
'SystemAddress': self.state['SystemAddress'],
|
||||
'Population': self.systempopulation,
|
||||
'Population': self.state['SystemPopulation'],
|
||||
}
|
||||
|
||||
if self.state['Body']:
|
||||
@ -577,8 +579,9 @@ class EDLogs(FileSystemEventHandler): # type: ignore # See below
|
||||
self.cmdr = None
|
||||
self.mode = None
|
||||
self.group = None
|
||||
self.state['SystemName'] = None
|
||||
self.state['SystemAddress'] = None
|
||||
self.state['SystemName'] = None
|
||||
self.state['SystemPopulation'] = None
|
||||
self.state['StarPos'] = None
|
||||
self.state['Body'] = None
|
||||
self.state['BodyID'] = None
|
||||
@ -614,8 +617,9 @@ class EDLogs(FileSystemEventHandler): # type: ignore # See below
|
||||
self.mode = entry.get('GameMode')
|
||||
|
||||
self.group = entry.get('Group')
|
||||
self.state['SystemName'] = None
|
||||
self.state['SystemAddress'] = None
|
||||
self.state['SystemName'] = None
|
||||
self.state['SystemPopulation'] = None
|
||||
self.state['StarPos'] = None
|
||||
self.state['Body'] = None
|
||||
self.state['BodyID'] = None
|
||||
@ -939,7 +943,7 @@ class EDLogs(FileSystemEventHandler): # type: ignore # See below
|
||||
# Yes, explicitly state `None` here, so it's crystal clear.
|
||||
self.state['SystemAddress'] = entry.get('SystemAddress', None)
|
||||
|
||||
self.systempopulation = entry.get('Population')
|
||||
self.state['SystemPopulation'] = entry.get('Population')
|
||||
|
||||
if entry['StarSystem'] == 'ProvingGround':
|
||||
self.state['SystemName'] = 'CQC'
|
||||
@ -1688,6 +1692,7 @@ class EDLogs(FileSystemEventHandler): # type: ignore # See below
|
||||
self.state['StarPos'] = None
|
||||
self.state['SystemName'] = None
|
||||
self.state['SystemAddress'] = None
|
||||
self.state['SystemPopulation'] = None
|
||||
self.state['StarPos'] = None
|
||||
self.state['Body'] = None
|
||||
self.state['BodyID'] = None
|
||||
@ -1706,6 +1711,7 @@ class EDLogs(FileSystemEventHandler): # type: ignore # See below
|
||||
self.state['Role'] = None
|
||||
self.state['SystemName'] = None
|
||||
self.state['SystemAddress'] = None
|
||||
self.state['SystemPopulation'] = None
|
||||
self.state['StarPos'] = None
|
||||
self.state['Body'] = None
|
||||
self.state['BodyID'] = None
|
||||
|
@ -186,12 +186,7 @@ def journal_entry( # noqa: CCR001
|
||||
this.on_foot = state['OnFoot']
|
||||
this.system_address = state['SystemAddress']
|
||||
this.system_name = state['SystemName']
|
||||
|
||||
# We need pop == 0 to set the value so as to clear 'x' in systems with
|
||||
# no stations.
|
||||
pop = entry.get('Population')
|
||||
if pop is not None:
|
||||
this.system_population = pop
|
||||
this.system_population = state['SystemPopulation']
|
||||
|
||||
this.station = entry.get('StationName') or this.station
|
||||
# on_foot station detection
|
||||
|
Loading…
x
Reference in New Issue
Block a user