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

Merge pull request #1682 from EDCD/fix/1431/eddn-replay-enhancements

Change EDDN 'replay' to using an sqlite3 DB & otherwise improve
This commit is contained in:
Athanasius 2022-11-27 15:24:28 +00:00 committed by GitHub
commit d902093f0b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 518 additions and 276 deletions

View File

@ -922,7 +922,7 @@ class AppWindow(object):
return False
# Ignore possibly missing shipyard info
elif (config.get_int('output') & config.OUT_MKT_EDDN) \
elif (config.get_int('output') & config.OUT_EDDN_SEND_STATION_DATA) \
and not (data['lastStarport'].get('commodities') or data['lastStarport'].get('modules')):
if not self.status['text']:
# LANG: Status - Either no market or no modules data for station from Frontier CAPI

View File

@ -617,6 +617,7 @@ Content of `state` (updated to the current journal entry):
| `Modules` | `dict` | Currently fitted modules |
| `NavRoute` | `dict` | Last plotted multi-hop route |
| `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 |
| `Component` | `dict` | 'Component' MicroResources in Odyssey, `int` count each. |
| `Item` | `dict` | 'Item' MicroResources in Odyssey, `int` count each. |
@ -710,6 +711,17 @@ NB: It *is* possible, if a player is quick enough, to plot and clear a route
before we load it, in which case we'd be retaining the *previous* plotted
route.
New in version 5.6.0:
`IsDocked` boolean added to `state`. This is set True for a `Location` event
having `"Docked":true"`, or the `Docked` event. It is set back to False (its
default value) for an `Undocked` event. Being on-foot in a station at login
time does *not* count as docked for this.
In general on-foot, including being in a taxi, might not set this 100%
correctly. Its main use in core code is to detect being docked so as to send
any stored EDDN messages due to "Delay sending until docked" option.
___
##### Synthetic Events

View File

@ -52,7 +52,7 @@ appcmdname = 'EDMC'
# <https://semver.org/#semantic-versioning-specification-semver>
# Major.Minor.Patch(-prerelease)(+buildmetadata)
# NB: Do *not* import this, use the functions appversion() and appversion_nobuild()
_static_appversion = '5.5.1-alpha0'
_static_appversion = '5.6.0-alpha0'
_cached_version: Optional[semantic_version.Version] = None
copyright = '© 2015-2019 Jonathan Harris, 2020-2022 EDCD'
@ -162,7 +162,7 @@ def appversion_nobuild() -> semantic_version.Version:
class AbstractConfig(abc.ABC):
"""Abstract root class of all platform specific Config implementations."""
OUT_MKT_EDDN = 1
OUT_EDDN_SEND_STATION_DATA = 1
# OUT_MKT_BPC = 2 # No longer supported
OUT_MKT_TD = 4
OUT_MKT_CSV = 8
@ -171,12 +171,12 @@ class AbstractConfig(abc.ABC):
# OUT_SYS_FILE = 32 # No longer supported
# OUT_STAT = 64 # No longer available
# OUT_SHIP_CORIOLIS = 128 # Replaced by OUT_SHIP
OUT_STATION_ANY = OUT_MKT_EDDN | OUT_MKT_TD | OUT_MKT_CSV
# OUT_SYS_EDSM = 256 # Now a plugin
# OUT_SYS_AUTO = 512 # Now always automatic
OUT_MKT_MANUAL = 1024
OUT_SYS_EDDN = 2048
OUT_SYS_DELAY = 4096
OUT_EDDN_SEND_NON_STATION = 2048
OUT_EDDN_DELAY = 4096
OUT_STATION_ANY = OUT_EDDN_SEND_STATION_DATA | OUT_MKT_TD | OUT_MKT_CSV
app_dir_path: pathlib.Path
plugin_dir_path: pathlib.Path

View File

@ -174,6 +174,7 @@ class EDLogs(FileSystemEventHandler): # type: ignore # See below
'Modules': None,
'CargoJSON': None, # The raw data from the last time cargo.json was read
'Route': None, # Last plotted route from Route.json file
'IsDocked': False, # Whether we think cmdr is docked
'OnFoot': False, # Whether we think you're on-foot
'Component': defaultdict(int), # Odyssey Components in Ship Locker
'Item': defaultdict(int), # Odyssey Items in Ship Locker
@ -315,6 +316,7 @@ class EDLogs(FileSystemEventHandler): # type: ignore # See below
self.systemaddress = None
self.is_beta = False
self.state['OnFoot'] = False
self.state['IsDocked'] = False
self.state['Body'] = None
self.state['BodyType'] = None
@ -734,6 +736,7 @@ class EDLogs(FileSystemEventHandler): # type: ignore # See below
self.station_marketid = None
self.stationtype = None
self.stationservices = None
self.state['IsDocked'] = False
elif event_type == 'embark':
# This event is logged when a player (on foot) gets into a ship or SRV
@ -800,6 +803,7 @@ class EDLogs(FileSystemEventHandler): # type: ignore # See below
self.state['Dropship'] = False
elif event_type == 'docked':
self.state['IsDocked'] = True
self.station = entry.get('StationName') # May be None
self.station_marketid = entry.get('MarketID') # May be None
self.stationtype = entry.get('StationType') # May be None
@ -822,6 +826,8 @@ class EDLogs(FileSystemEventHandler): # type: ignore # See below
if event_type == 'location':
logger.trace_if('journal.locations', '"Location" event')
if entry.get('Docked'):
self.state['IsDocked'] = True
elif event_type == 'fsdjump':
self.planet = None

File diff suppressed because it is too large Load Diff

View File

@ -1221,7 +1221,9 @@ class PreferencesDialog(tk.Toplevel):
(self.out_csv.get() and config.OUT_MKT_CSV) +
(config.OUT_MKT_MANUAL if not self.out_auto.get() else 0) +
(self.out_ship.get() and config.OUT_SHIP) +
(config.get_int('output') & (config.OUT_MKT_EDDN | config.OUT_SYS_EDDN | config.OUT_SYS_DELAY))
(config.get_int('output') & (
config.OUT_EDDN_SEND_STATION_DATA | config.OUT_EDDN_SEND_NON_STATION | config.OUT_EDDN_DELAY
))
)
config.set(