mirror of
https://github.com/EDCD/EDMarketConnector.git
synced 2025-04-16 09:10:35 +03:00
Merge pull request #701 from EDCD/fix/671-no-modules
Fix the detection of no modules being available at a station, so is_horizons() doesn't blindly modules.values().
This commit is contained in:
commit
faf4906eea
@ -270,14 +270,22 @@ Msg:\n{msg}''')
|
||||
:param data: dict containing the outfitting data
|
||||
:param is_beta: whether or not we're currently in beta mode
|
||||
"""
|
||||
modules: Dict[str, Any] = data['lastStarport'].get('modules') or {}
|
||||
modules: Dict[str, Any] = data['lastStarport'].get('modules')
|
||||
if modules is None:
|
||||
logger.debug('modules was None')
|
||||
modules = {}
|
||||
|
||||
ships: Dict[str, Any] = data['lastStarport'].get('ships')
|
||||
if ships is None:
|
||||
logger.debug('ships was None')
|
||||
ships = {'shipyard_list': {}, 'unavailable_list': []}
|
||||
|
||||
# Horizons flag - will hit at least Int_PlanetApproachSuite other than at engineer bases ("Colony"),
|
||||
# prison or rescue Megaships, or under Pirate Attack etc
|
||||
horizons: bool = is_horizons(
|
||||
data['lastStarport'].get('economies', {}),
|
||||
modules,
|
||||
data['lastStarport'].get('ships', {'shipyard_list': {}, 'unavailable_list': []})
|
||||
ships
|
||||
)
|
||||
|
||||
to_search: Iterator[Mapping[str, Any]] = filter(
|
||||
@ -313,10 +321,19 @@ Msg:\n{msg}''')
|
||||
:param data: dict containing the shipyard data
|
||||
:param is_beta: whether or not we are in beta mode
|
||||
"""
|
||||
ships: Dict[str, Any] = data['lastStarport'].get('ships', {'shipyard_list': {}, 'unavailable_list': []})
|
||||
modules: Dict[str, Any] = data['lastStarport'].get('modules')
|
||||
if modules is None:
|
||||
logger.debug('modules was None')
|
||||
modules = {}
|
||||
|
||||
ships: Dict[str, Any] = data['lastStarport'].get('ships')
|
||||
if ships is None:
|
||||
logger.debug('ships was None')
|
||||
ships = {'shipyard_list': {}, 'unavailable_list': []}
|
||||
|
||||
horizons: bool = is_horizons(
|
||||
data['lastStarport'].get('economies', {}),
|
||||
data['lastStarport'].get('modules', {}),
|
||||
modules,
|
||||
ships
|
||||
)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user