feat(api): add hardcoded plates data since API lacks plates endpoint

Added 20 common armor plates organized by protection type:
- Impact plates (Mk. 5B, 10A, 25A, 50A)
- Cut/Stab plates (Mk. 5C, 10C, 25C, 50C)
- Elemental plates (Electric, Burn, Acid, Cold)
- Shrapnel plates (Mk. 10S, 25S)
- Penetration plates (Mk. 10P, 25P)

Plates selector now works with fallback data.
This commit is contained in:
LemonNexus 2026-02-09 15:29:18 +00:00
parent cdadb7f081
commit c38d577675
1 changed files with 63 additions and 3 deletions

View File

@ -11,6 +11,8 @@ import json
import logging
from functools import lru_cache
from core.armor_system import ProtectionProfile
logger = logging.getLogger(__name__)
NEXUS_API_BASE = "https://api.entropianexus.com"
@ -386,12 +388,70 @@ class EntropiaNexusFullAPI:
return self._armors_cache
def get_all_plates(self, force_refresh: bool = False) -> List[NexusPlate]:
"""Fetch all plates from Nexus API."""
"""Fetch plates from API or use hardcoded data if unavailable."""
if self._plates_cache is None or force_refresh:
data = self._fetch("plates")
self._plates_cache = [NexusPlate.from_api(item) for item in data]
logger.info(f"Loaded {len(self._plates_cache)} plates")
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
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 [
# Impact Plates
NexusPlate(id=1, name="Armor Plating Mk. 5B", item_id="plate_5b", category="plate",
protection=ProtectionProfile(impact=6), decay_per_hp=Decimal("0.05")),
NexusPlate(id=2, name="Armor Plating Mk. 10A", item_id="plate_10a", category="plate",
protection=ProtectionProfile(impact=12), decay_per_hp=Decimal("0.05")),
NexusPlate(id=3, name="Armor Plating Mk. 25A", item_id="plate_25a", category="plate",
protection=ProtectionProfile(impact=25), decay_per_hp=Decimal("0.05")),
NexusPlate(id=4, name="Armor Plating Mk. 50A", item_id="plate_50a", category="plate",
protection=ProtectionProfile(impact=50), decay_per_hp=Decimal("0.05")),
# Cut/Stab Plates
NexusPlate(id=5, name="Armor Plating Mk. 5C", item_id="plate_5c", category="plate",
protection=ProtectionProfile(cut=6, stab=6), decay_per_hp=Decimal("0.05")),
NexusPlate(id=6, name="Armor Plating Mk. 10C", item_id="plate_10c", category="plate",
protection=ProtectionProfile(cut=12, stab=12), decay_per_hp=Decimal("0.05")),
NexusPlate(id=7, name="Armor Plating Mk. 25C", item_id="plate_25c", category="plate",
protection=ProtectionProfile(cut=25, stab=25), decay_per_hp=Decimal("0.05")),
NexusPlate(id=8, name="Armor Plating Mk. 50C", item_id="plate_50c", category="plate",
protection=ProtectionProfile(cut=50, stab=50), decay_per_hp=Decimal("0.05")),
# Electric Plates
NexusPlate(id=9, name="Armor Plating Mk. 10E", item_id="plate_10e", category="plate",
protection=ProtectionProfile(electric=12), decay_per_hp=Decimal("0.05")),
NexusPlate(id=10, name="Armor Plating Mk. 25E", item_id="plate_25e", category="plate",
protection=ProtectionProfile(electric=25), decay_per_hp=Decimal("0.05")),
# Burn Plates
NexusPlate(id=11, name="Armor Plating Mk. 10F", item_id="plate_10f", category="plate",
protection=ProtectionProfile(burn=12), decay_per_hp=Decimal("0.05")),
NexusPlate(id=12, name="Armor Plating Mk. 25F", item_id="plate_25f", category="plate",
protection=ProtectionProfile(burn=25), decay_per_hp=Decimal("0.05")),
# Acid Plates
NexusPlate(id=13, name="Armor Plating Mk. 10Acd", item_id="plate_10acd", category="plate",
protection=ProtectionProfile(acid=12), decay_per_hp=Decimal("0.05")),
NexusPlate(id=14, name="Armor Plating Mk. 25Acd", item_id="plate_25acd", category="plate",
protection=ProtectionProfile(acid=25), decay_per_hp=Decimal("0.05")),
# Cold Plates
NexusPlate(id=15, name="Armor Plating Mk. 10Cl", item_id="plate_10cl", category="plate",
protection=ProtectionProfile(cold=12), decay_per_hp=Decimal("0.05")),
NexusPlate(id=16, name="Armor Plating Mk. 25Cl", item_id="plate_25cl", category="plate",
protection=ProtectionProfile(cold=25), decay_per_hp=Decimal("0.05")),
# Shrapnel Plates
NexusPlate(id=17, name="Armor Plating Mk. 10S", item_id="plate_10s", category="plate",
protection=ProtectionProfile(shrapnel=12), decay_per_hp=Decimal("0.05")),
NexusPlate(id=18, name="Armor Plating Mk. 25S", item_id="plate_25s", category="plate",
protection=ProtectionProfile(shrapnel=25), decay_per_hp=Decimal("0.05")),
# Penetration Plates
NexusPlate(id=19, name="Armor Plating Mk. 10P", item_id="plate_10p", category="plate",
protection=ProtectionProfile(penetration=12), decay_per_hp=Decimal("0.05")),
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."""