1
0
mirror of https://github.com/EDCD/EDMarketConnector.git synced 2025-04-17 17:42:20 +03:00

EDDN: Rename is_horizons() and document that it's for CAPI data only

OK, it has `data` passed in, so this should be obvious, but let's make
it explicit both by name and in the docstring.

The docstring now also emphasies that *this* check **MUST** be used for
CAPI data, as it's dependent only on the availability of Horizons on the
account, and not on the `LoadGame` flags.
This commit is contained in:
Athanasius 2021-10-18 12:20:06 +01:00
parent d8689e5b9b
commit 694321064d
No known key found for this signature in database
GPG Key ID: AE3E527847057C7D

View File

@ -452,7 +452,7 @@ Msg:\n{msg}'''
# 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(
horizons: bool = capi_is_horizons(
data['lastStarport'].get('economies', {}),
modules,
ships
@ -500,7 +500,7 @@ Msg:\n{msg}'''
"""
modules, ships = self.safe_modules_and_ships(data)
horizons: bool = is_horizons(
horizons: bool = capi_is_horizons(
data['lastStarport'].get('economies', {}),
modules,
ships
@ -1432,10 +1432,19 @@ def cmdr_data(data: CAPIData, is_beta: bool) -> Optional[str]: # noqa: CCR001
MAP_STR_ANY = Mapping[str, Any]
def is_horizons(economies: MAP_STR_ANY, modules: MAP_STR_ANY, ships: MAP_STR_ANY) -> bool:
def capi_is_horizons(economies: MAP_STR_ANY, modules: MAP_STR_ANY, ships: MAP_STR_ANY) -> bool:
"""
Indicate if the supplied data indicates a player has Horizons access.
This is to be used **only** for CAPI-sourced data and **MUST** be used
for CAPI data!!!
If the account has Horizons access then CAPI `/shipyard` will always see
the Horizons-only modules/ships. You can**NOT** use the Journal horizons
flag for this! If logged in to the base game on an account with Horizons,
which is all of them now, CAPI `/shipyard` will *still* return all of the
Horizons-only modules and ships.
:param economies: Economies of where the Cmdr is docked.
:param modules: Modules available at the docked station.
:param ships: Ships available at the docked station.