mirror of
https://github.com/EDCD/EDMarketConnector.git
synced 2025-04-15 00:30:33 +03:00
Look for "ELITE_HORIZONS_V_PLANETARY_LANDINGS" sku in cAPI data
to set Horizons flag. Should always hit at least Int_PlanetApproachSuite if Horizons.
This commit is contained in:
parent
6a9376813c
commit
f41b418a63
@ -197,6 +197,7 @@ class EDDN:
|
||||
|
||||
def export_outfitting(self, data, is_beta):
|
||||
modules = data['lastStarport'].get('modules') or {}
|
||||
horizons = any(module.get('sku') == 'ELITE_HORIZONS_V_PLANETARY_LANDINGS' for module in modules.itervalues()) # Should always hit Int_PlanetApproachSuite
|
||||
outfitting = sorted([self.MODULE_RE.sub(lambda m: m.group(0).capitalize(), module['name'].lower()) for module in modules.itervalues() if self.MODULE_RE.search(module['name']) and module.get('sku') in [None, 'ELITE_HORIZONS_V_PLANETARY_LANDINGS'] and module['name'] != 'Int_PlanetApproachSuite'])
|
||||
if outfitting and this.outfitting != outfitting: # Don't send empty modules list - schema won't allow it
|
||||
self.send(data['commander']['name'], {
|
||||
@ -206,13 +207,16 @@ class EDDN:
|
||||
('systemName', data['lastSystem']['name']),
|
||||
('stationName', data['lastStarport']['name']),
|
||||
('marketId', data['lastStarport']['id']),
|
||||
('horizons', horizons),
|
||||
('modules', outfitting),
|
||||
]),
|
||||
})
|
||||
this.outfitting = outfitting
|
||||
|
||||
def export_shipyard(self, data, is_beta):
|
||||
modules = data['lastStarport'].get('modules') or {}
|
||||
ships = data['lastStarport'].get('ships') or { 'shipyard_list': {}, 'unavailable_list': [] }
|
||||
horizons = any(module.get('sku') == 'ELITE_HORIZONS_V_PLANETARY_LANDINGS' for module in modules.itervalues()) or any(ship.get('sku') == 'ELITE_HORIZONS_V_PLANETARY_LANDINGS' for ship in (ships['shipyard_list'] or {}).values())
|
||||
shipyard = sorted([ship['name'].lower() for ship in (ships['shipyard_list'] or {}).values() + ships['unavailable_list']])
|
||||
if shipyard and this.shipyard != shipyard: # Don't send empty ships list - shipyard data is only guaranteed present if user has visited the shipyard.
|
||||
self.send(data['commander']['name'], {
|
||||
@ -222,6 +226,7 @@ class EDDN:
|
||||
('systemName', data['lastSystem']['name']),
|
||||
('stationName', data['lastStarport']['name']),
|
||||
('marketId', data['lastStarport']['id']),
|
||||
('horizons', horizons),
|
||||
('ships', shipyard),
|
||||
]),
|
||||
})
|
||||
|
Loading…
x
Reference in New Issue
Block a user