From f41b418a63b56f9d3be21a0910bbe9e068a57676 Mon Sep 17 00:00:00 2001 From: Jonathan Harris Date: Thu, 10 Jan 2019 01:42:03 +0000 Subject: [PATCH] Look for "ELITE_HORIZONS_V_PLANETARY_LANDINGS" sku in cAPI data to set Horizons flag. Should always hit at least Int_PlanetApproachSuite if Horizons. --- plugins/eddn.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/plugins/eddn.py b/plugins/eddn.py index 9e0d4149..551bf539 100644 --- a/plugins/eddn.py +++ b/plugins/eddn.py @@ -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), ]), })