From cf95732fff4b33a0ef6b32084f3505d5d6a63e1a Mon Sep 17 00:00:00 2001 From: LemonNexus Date: Mon, 9 Feb 2026 15:35:54 +0000 Subject: [PATCH] fix(api): update endpoints to match Entropia Nexus API structure MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Plates: /plates → /armorplatings - Absorbers: Now using /absorbers (was /attachments) - Amplifiers: Now using /weaponamplifiers (was /attachments) - Scopes: Now using /weaponvisionattachments (was /attachments) - Healing: Now fetches both /medicaltools AND /medicalchips Added separate cache variables and methods for: - _absorbers_cache, get_all_absorbers() - _amplifiers_cache, get_all_amplifiers() - _scopes_cache, get_all_scopes() - _healing_chips_cache, get_all_healing_chips() --- core/nexus_full_api.py | 81 +++++++++++++++++++++++++++++++++--------- 1 file changed, 65 insertions(+), 16 deletions(-) diff --git a/core/nexus_full_api.py b/core/nexus_full_api.py index 03d944a..32a5986 100644 --- a/core/nexus_full_api.py +++ b/core/nexus_full_api.py @@ -352,9 +352,13 @@ class EntropiaNexusFullAPI: self._weapons_cache: Optional[List[NexusWeapon]] = None self._armors_cache: Optional[List[NexusArmor]] = None self._plates_cache: Optional[List[NexusPlate]] = None + self._absorbers_cache: Optional[List[NexusAttachment]] = None + self._amplifiers_cache: Optional[List[NexusAttachment]] = None + self._scopes_cache: Optional[List[NexusAttachment]] = None self._attachments_cache: Optional[List[NexusAttachment]] = None self._enhancers_cache: Optional[List[NexusEnhancer]] = None self._healing_cache: Optional[List[NexusHealingTool]] = None + self._healing_chips_cache: Optional[List[NexusHealingTool]] = None self._rings_cache: Optional[List[NexusRing]] = None self._clothing_cache: Optional[List[NexusClothing]] = None self._pets_cache: Optional[List[NexusPet]] = None @@ -388,20 +392,20 @@ class EntropiaNexusFullAPI: return self._armors_cache def get_all_plates(self, force_refresh: bool = False) -> List[NexusPlate]: - """Fetch plates from API or use hardcoded data if unavailable.""" + """Fetch plates from /armorplatings endpoint.""" if self._plates_cache is None or force_refresh: - data = self._fetch("plates") + data = self._fetch("armorplatings") if data: self._plates_cache = [NexusPlate.from_api(item) for item in data] logger.info(f"Loaded {len(self._plates_cache)} plates from API") else: - # API doesn't have plates endpoint - use hardcoded data + # Fallback to hardcoded data self._plates_cache = self._get_hardcoded_plates() logger.info(f"Loaded {len(self._plates_cache)} plates from hardcoded data") return self._plates_cache def _get_hardcoded_plates(self) -> List[NexusPlate]: - """Return hardcoded plate data since API doesn't have plates endpoint.""" + """Return hardcoded plate data since API may not have plates endpoint.""" return [ # Impact Plates NexusPlate(id=1, name="Armor Plating Mk. 5B", item_id="plate_5b", category="plate", @@ -452,14 +456,50 @@ class EntropiaNexusFullAPI: NexusPlate(id=20, name="Armor Plating Mk. 25P", item_id="plate_25p", category="plate", protection=ProtectionProfile(penetration=25), decay_per_hp=Decimal("0.05")), ] - - def get_all_attachments(self, force_refresh: bool = False) -> List[NexusAttachment]: - """Fetch all attachments from Nexus API.""" - if self._attachments_cache is None or force_refresh: - data = self._fetch("attachments") - self._attachments_cache = [NexusAttachment.from_api(item) for item in data] - logger.info(f"Loaded {len(self._attachments_cache)} attachments") - return self._attachments_cache + + def get_all_absorbers(self, force_refresh: bool = False) -> List[NexusAttachment]: + """Fetch absorbers from /absorbers endpoint.""" + if self._absorbers_cache is None or force_refresh: + data = self._fetch("absorbers") + if data: + self._absorbers_cache = [NexusAttachment.from_api(item) for item in data] + logger.info(f"Loaded {len(self._absorbers_cache)} absorbers from API") + else: + self._absorbers_cache = [] + return self._absorbers_cache + + def get_all_amplifiers(self, force_refresh: bool = False) -> List[NexusAttachment]: + """Fetch amplifiers from /weaponamplifiers endpoint.""" + if self._amplifiers_cache is None or force_refresh: + data = self._fetch("weaponamplifiers") + if data: + self._amplifiers_cache = [NexusAttachment.from_api(item) for item in data] + logger.info(f"Loaded {len(self._amplifiers_cache)} amplifiers from API") + else: + self._amplifiers_cache = [] + return self._amplifiers_cache + + def get_all_scopes(self, force_refresh: bool = False) -> List[NexusAttachment]: + """Fetch scopes/sights from /weaponvisionattachments endpoint.""" + if self._scopes_cache is None or force_refresh: + data = self._fetch("weaponvisionattachments") + if data: + self._scopes_cache = [NexusAttachment.from_api(item) for item in data] + logger.info(f"Loaded {len(self._scopes_cache)} scopes from API") + else: + self._scopes_cache = [] + return self._scopes_cache + + def get_all_healing_chips(self, force_refresh: bool = False) -> List[NexusHealingTool]: + """Fetch healing chips from /medicalchips endpoint.""" + if self._healing_chips_cache is None or force_refresh: + data = self._fetch("medicalchips") + if data: + self._healing_chips_cache = [NexusHealingTool.from_api(item) for item in data] + logger.info(f"Loaded {len(self._healing_chips_cache)} healing chips from API") + else: + self._healing_chips_cache = [] + return self._healing_chips_cache def get_all_enhancers(self, force_refresh: bool = False) -> List[NexusEnhancer]: """Fetch all enhancers from Nexus API.""" @@ -470,11 +510,20 @@ class EntropiaNexusFullAPI: return self._enhancers_cache def get_all_healing_tools(self, force_refresh: bool = False) -> List[NexusHealingTool]: - """Fetch all healing tools from Nexus API.""" + """Fetch all healing tools from Nexus API (includes medical tools AND chips).""" if self._healing_cache is None or force_refresh: - data = self._fetch("medicaltools") - self._healing_cache = [NexusHealingTool.from_api(item) for item in data] - logger.info(f"Loaded {len(self._healing_cache)} healing tools") + # Fetch both medical tools and medical chips + tools_data = self._fetch("medicaltools") + chips_data = self._fetch("medicalchips") + + all_healing = [] + if tools_data: + all_healing.extend([NexusHealingTool.from_api(item) for item in tools_data]) + if chips_data: + all_healing.extend([NexusHealingTool.from_api(item) for item in chips_data]) + + self._healing_cache = all_healing + logger.info(f"Loaded {len(self._healing_cache)} healing tools ({len(tools_data) if tools_data else 0} tools + {len(chips_data) if chips_data else 0} chips)") return self._healing_cache def get_all_rings(self, force_refresh: bool = False) -> List[NexusRing]: