feat(loadout): wire ALL selectors into LoadoutManager

- Attachment buttons now open AttachmentSelectorDialog (API-based)
- NEW: Enhancer selection button with warning about breakage
- NEW: Accessories section (Rings, Clothing, Pets)
- Methods for all selectors:
  - _on_select_attachment() - Amps, Scopes, Absorbers
  - _on_select_enhancer() - Weapon/Armor enhancers
  - _on_select_accessories() - Rings, Clothing, Pets
  - _on_ring_selected(), _on_clothing_selected(), _on_pet_selected()

Complete gear selection now available!
This commit is contained in:
LemonNexus 2026-02-09 11:57:27 +00:00
parent c490a84982
commit 88a3c8b551
1 changed files with 118 additions and 6 deletions

View File

@ -1187,19 +1187,31 @@ class LoadoutManagerDialog(QDialog):
attachments_layout = QGridLayout(attachments_frame)
attachments_layout.addWidget(QLabel("Amplifier:"), 0, 0)
attachments_layout.addWidget(self.amp_label, 0, 1)
self.attach_amp_btn.setText("🔍 Search Amps")
self.attach_amp_btn.clicked.connect(lambda: self._on_select_attachment("amplifier"))
attachments_layout.addWidget(self.attach_amp_btn, 0, 2)
attachments_layout.addWidget(self.remove_amp_btn, 0, 3)
attachments_layout.addWidget(QLabel("Scope:"), 1, 0)
attachments_layout.addWidget(self.scope_label, 1, 1)
self.attach_scope_btn.setText("🔍 Search Scopes")
self.attach_scope_btn.clicked.connect(lambda: self._on_select_attachment("scope"))
attachments_layout.addWidget(self.attach_scope_btn, 1, 2)
attachments_layout.addWidget(self.remove_scope_btn, 1, 3)
attachments_layout.addWidget(QLabel("Absorber:"), 2, 0)
attachments_layout.addWidget(self.absorber_label, 2, 1)
self.attach_absorber_btn.setText("🔍 Search Absorbers")
self.attach_absorber_btn.clicked.connect(lambda: self._on_select_attachment("absorber"))
attachments_layout.addWidget(self.attach_absorber_btn, 2, 2)
attachments_layout.addWidget(self.remove_absorber_btn, 2, 3)
# Add enhancer selection button
self.select_enhancer_btn = QPushButton("✨ Select Enhancers")
self.select_enhancer_btn.setObjectName("selectButton")
self.select_enhancer_btn.clicked.connect(self._on_select_enhancer)
attachments_layout.addWidget(self.select_enhancer_btn, 3, 0, 1, 4)
weapon_layout.addRow("Attachments:", attachments_frame)
right_layout.addWidget(self.weapon_group)
@ -1254,6 +1266,22 @@ class LoadoutManagerDialog(QDialog):
heal_layout.addRow("Heal amount:", self.heal_amount_edit)
right_layout.addWidget(self.heal_group)
# Accessories section (NEW)
self.accessories_group = DarkGroupBox("💍 Accessories (Rings, Clothing, Pets)")
accessories_layout = QVBoxLayout(self.accessories_group)
self.select_accessories_btn = QPushButton("🔍 Search Accessories from Nexus")
self.select_accessories_btn.setObjectName("selectButton")
self.select_accessories_btn.clicked.connect(self._on_select_accessories)
accessories_layout.addWidget(self.select_accessories_btn)
# Display selected accessories
self.accessories_summary = QLabel("No accessories selected")
self.accessories_summary.setStyleSheet("color: #888888; padding: 5px;")
accessories_layout.addWidget(self.accessories_summary)
right_layout.addWidget(self.accessories_group)
# Cost summary
summary_layout = QFormLayout(self.summary_group)
summary_layout.addRow("Weapon Cost:", self.weapon_cost_label)
@ -1430,13 +1458,97 @@ class LoadoutManagerDialog(QDialog):
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
def _on_select_attachment(self, attachment_type: str):
"""Open attachment selector dialog from Nexus API."""
from ui.attachment_selector import AttachmentSelectorDialog
dialog = AttachmentSelectorDialog(self, attachment_type=attachment_type)
dialog.attachment_selected.connect(
lambda att: self._on_api_attachment_selected(att, attachment_type)
)
dialog.exec()
def _on_api_attachment_selected(self, attachment: NexusAttachment, att_type: str):
"""Handle attachment selection from API."""
# Update UI based on attachment type
if att_type == "amplifier":
self.amp_label.setText(f"{attachment.name} (+{attachment.damage_bonus} dmg)")
elif att_type == "scope":
self.scope_label.setText(f"{attachment.name} (+{attachment.range_bonus} rng)")
elif att_type == "absorber":
self.absorber_label.setText(f"{attachment.name}")
attachments = get_mock_attachments(attachment_type)
if not attachments:
QMessageBox.information(self, "No Attachments", f"No {attachment_type} attachments available.")
QMessageBox.information(
self,
"Attachment Selected",
f"Selected: {attachment.name}\n"
f"Type: {attachment.attachment_type.title()}\n"
f"Damage: +{attachment.damage_bonus}\n"
f"Range: +{attachment.range_bonus}\n"
f"Decay: {attachment.decay:.2f} PEC"
)
def _on_select_enhancer(self):
"""Open enhancer selector dialog."""
from ui.enhancer_selector import EnhancerSelectorDialog
dialog = EnhancerSelectorDialog(self)
dialog.enhancer_selected.connect(self._on_api_enhancer_selected)
dialog.exec()
def _on_api_enhancer_selected(self, enhancer: NexusEnhancer):
"""Handle enhancer selection from API."""
QMessageBox.information(
self,
"Enhancer Selected",
f"Selected: {enhancer.name}\n"
f"Type: {enhancer.enhancer_type.title()}\n"
f"Tier: {enhancer.tier}\n"
f"Effect: +{enhancer.effect_value}%\n"
f"Break Chance: {enhancer.break_chance * 100:.1f}%"
)
def _on_select_accessories(self):
"""Open accessories selector dialog (rings, clothing, pets)."""
from ui.accessories_selector import AccessoriesSelectorDialog
dialog = AccessoriesSelectorDialog(self)
dialog.ring_selected.connect(self._on_ring_selected)
dialog.clothing_selected.connect(self._on_clothing_selected)
dialog.pet_selected.connect(self._on_pet_selected)
dialog.exec()
def _on_ring_selected(self, ring: NexusRing):
"""Handle ring selection."""
QMessageBox.information(
self,
"Ring Selected",
f"Selected: {ring.name}\n"
f"Effect: {ring.effect_type} {ring.effect_value}\n"
f"Slot: Left/Right Ring"
)
def _on_clothing_selected(self, clothing: NexusClothing):
"""Handle clothing selection."""
buffs = ", ".join([f"{k}:{v}" for k, v in clothing.buffs.items()])
QMessageBox.information(
self,
"Clothing Selected",
f"Selected: {clothing.name}\n"
f"Slot: {clothing.slot}\n"
f"Buffs: {buffs if buffs else 'None'}"
)
def _on_pet_selected(self, pet: NexusPet):
"""Handle pet selection."""
QMessageBox.information(
self,
"Pet Selected",
f"Selected: {pet.name}\n"
f"Effect: {pet.effect_type} {pet.effect_value}\n"
f"Level Required: {pet.level_required if pet.level_required > 0 else 'None'}"
)
def _on_attach(self, attachment_type: str):
"""Handle attachment selection (legacy - now uses API)."""
self._on_select_attachment(attachment_type)
return
# Create simple selection dialog