feat(loadout): wire armor and healing API selectors into LoadoutManager

- Added 'Search Entropia Nexus Armors' button
- Added 'Search Healing Tools from Nexus' button
- New methods: _on_select_armor_from_api(), _on_select_healing_from_api()
- Armor selection shows durability and protection summary
- Healing selection auto-updates cost and heal amount fields
This commit is contained in:
LemonNexus 2026-02-09 11:47:51 +00:00
parent dceafbc69f
commit 649aa77bc9
1 changed files with 66 additions and 0 deletions

View File

@ -25,6 +25,7 @@ from PyQt6.QtCore import Qt, pyqtSignal, QThread
from PyQt6.QtGui import QFont
from core.nexus_api import EntropiaNexusAPI, WeaponStats, ArmorStats, FinderStats
from core.nexus_full_api import get_nexus_api, NexusArmor, NexusHealingTool
from core.attachments import (
Attachment, WeaponAmplifier, WeaponScope, WeaponAbsorber,
ArmorPlating, Enhancer, can_attach, get_mock_attachments
@ -1213,6 +1214,12 @@ class LoadoutManagerDialog(QDialog):
set_layout.addWidget(self.clear_armor_btn)
armor_layout.addLayout(set_layout)
# Add API armor selector button
self.select_armor_api_btn = QPushButton("🔍 Search Entropia Nexus Armors")
self.select_armor_api_btn.setObjectName("selectButton")
self.select_armor_api_btn.clicked.connect(self._on_select_armor_from_api)
armor_layout.addWidget(self.select_armor_api_btn)
# Armor summary
armor_layout.addWidget(self.armor_summary_label)
@ -1235,6 +1242,13 @@ class LoadoutManagerDialog(QDialog):
# Healing configuration
heal_layout = QFormLayout(self.heal_group)
# Add healing tool search button
self.select_healing_api_btn = QPushButton("🔍 Search Healing Tools from Nexus")
self.select_healing_api_btn.setObjectName("selectButton")
self.select_healing_api_btn.clicked.connect(self._on_select_healing_from_api)
heal_layout.addRow(self.select_healing_api_btn)
heal_layout.addRow("Healing Tool:", self.heal_combo)
heal_layout.addRow("Cost/heal (PEC):", self.heal_cost_edit)
heal_layout.addRow("Heal amount:", self.heal_amount_edit)
@ -1364,6 +1378,58 @@ class LoadoutManagerDialog(QDialog):
self.weapon_ammo_edit.set_decimal(Decimal(weapon.ammo_burn or 0))
self._update_calculations()
def _on_select_armor_from_api(self):
"""Open armor selector dialog from Nexus API."""
from ui.armor_selector import ArmorSelectorDialog
dialog = ArmorSelectorDialog(self)
dialog.armor_selected.connect(self._on_api_armor_selected)
dialog.exec()
def _on_api_armor_selected(self, armor: NexusArmor):
"""Handle armor selection from API."""
# Store selected armor info
self._selected_api_armor = armor
QMessageBox.information(
self,
"Armor Selected",
f"Selected: {armor.name}\n"
f"Durability: {armor.durability}\n"
f"Protection: Impact {armor.protection_impact}, Cut {armor.protection_cut}, Stab {armor.protection_stab}"
)
def _on_select_healing_from_api(self):
"""Open healing tool selector dialog from Nexus API."""
from ui.healing_selector import HealingSelectorDialog
dialog = HealingSelectorDialog(self)
dialog.tool_selected.connect(self._on_api_healing_selected)
dialog.exec()
def _on_api_healing_selected(self, tool: NexusHealingTool):
"""Handle healing tool selection from API."""
self._selected_api_healing = tool
# Update the healing combo to show selected tool
# Find or add the tool to combo
index = self.heal_combo.findText(tool.name)
if index < 0:
self.heal_combo.addItem(tool.name)
index = self.heal_combo.count() - 1
self.heal_combo.setCurrentIndex(index)
# Update cost and amount fields
self.heal_cost_edit.setText(str(tool.decay))
self.heal_amount_edit.setText(str(tool.heal_amount))
self._update_calculations()
QMessageBox.information(
self,
"Healing Tool Selected",
f"Selected: {tool.name}\n"
f"Heal: {tool.heal_amount} HP\n"
f"Decay: {tool.decay:.2f} PEC ({tool.heal_per_pec:.2f} hp/pec)"
)
def _on_attach(self, attachment_type: str):
"""Handle attachment selection."""
from core.attachments import get_mock_attachments