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

Will now send data to EDDN when on-foot in-station.

NB: No shipyard in tests because data['ships']['shipyard_list'] is an
empty list.  This might be the bug not having been fixed, or the station
might genuinely have no ships for sale.  We have no way to check in
Odyssey Alpha Phase 1.
This commit is contained in:
Athanasius 2021-03-30 16:26:06 +01:00
parent a09512f3b3
commit 567cfdb9ca
3 changed files with 9 additions and 2 deletions

View File

@ -28,6 +28,7 @@ import requests
from config import appname, appversion, config
from EDMCLogging import get_main_logger
from monitor import monitor
from protocol import protocolhandler
logger = get_main_logger()
@ -563,7 +564,7 @@ class Session(object):
logger.error('No commander in returned data')
return data
if not data['commander'].get('docked'):
if not data['commander'].get('docked') and not monitor.on_foot:
return data
services = data['lastStarport'].get('services', {})

View File

@ -626,9 +626,13 @@ class EDLogs(FileSystemEventHandler): # type: ignore # See below
self.stationservices = None
elif event_type == 'Embark':
# If we've embarked then we're no longer on the station.
self.station = None
self.on_foot = False
elif event_type == 'Disembark':
# We don't yet have a way, other than LoadGame+Location, to detect if we *are* on a station on-foot.
self.station = None
self.on_foot = True
elif event_type in ('Location', 'FSDJump', 'Docked', 'CarrierJump'):

View File

@ -22,6 +22,7 @@ import plug
from companion import CAPIData, category_map
from config import applongname, appversion_nobuild, config
from EDMCLogging import get_main_logger
from monitor import monitor
from myNotebook import Frame
from prefs import prefsVersion
from ttkHyperlinkLabel import HyperlinkLabel
@ -907,7 +908,8 @@ def cmdr_data(data: CAPIData, is_beta: bool) -> Optional[str]: # noqa: CCR001
:param is_beta: bool - True if this is a beta version of the Game.
:return: str - Error message, or `None` if no errors.
"""
if data['commander'].get('docked') and config.get_int('output') & config.OUT_MKT_EDDN:
if (data['commander'].get('docked') or (monitor.on_foot and monitor.station)
and config.get_int('output') & config.OUT_MKT_EDDN):
try:
if this.marketId != data['lastStarport']['id']:
this.commodities = this.outfitting = this.shipyard = None