fix: correct API attribute names in selectors

- weapon_selector: use ammo_burn (not ammo), range_val (not range)
- armor_selector: use id (not set_id)
- healing_selector: use get_all_healing_tools/get_all_healing_chips
- Add safe null handling for all API values
This commit is contained in:
LemonNexus 2026-02-09 21:59:46 +00:00
parent 5a9ffe5fb8
commit d8b6ef998d
3 changed files with 8 additions and 8 deletions

View File

@ -131,7 +131,7 @@ class ArmorSelectorDialog(QDialog):
item.setData(Qt.ItemDataRole.UserRole, armor)
# Tooltip with protection info
tooltip_parts = [f"Set ID: {armor.set_id}"]
tooltip_parts = [f"Set ID: {armor.id}"]
if hasattr(armor, 'defense') and armor.defense:
tooltip_parts.append(f"Defense: {armor.defense}")
tooltip_parts.append(f"Est. Decay: {decay_pec} PEC")
@ -197,7 +197,7 @@ class ArmorSelectorDialog(QDialog):
return {
'name': self.selected_armor.name,
'api_id': getattr(self.selected_armor, 'set_id', None),
'api_id': getattr(self.selected_armor, 'id', None),
'decay_pec': decay_pec,
'protection_summary': str(getattr(self.selected_armor, 'defense', 'Unknown')),
}

View File

@ -107,8 +107,8 @@ class HealingSelectorDialog(QDialog):
nexus = get_nexus_api()
# Get both medical tools and chips
tools = nexus.get_all_medical_tools()
chips = nexus.get_all_medical_chips()
tools = nexus.get_all_healing_tools()
chips = nexus.get_all_healing_chips()
self._healing_tools = tools + chips

View File

@ -113,7 +113,7 @@ class WeaponSelectorDialog(QDialog):
try:
# Validate that decay and ammo are valid numbers
decay_val = w.decay if w.decay is not None else 0
ammo_val = w.ammo if w.ammo is not None else 0
ammo_val = w.ammo_burn if w.ammo_burn is not None else 0
# Try to convert to Decimal to validate
Decimal(str(decay_val))
Decimal(str(ammo_val))
@ -138,7 +138,7 @@ class WeaponSelectorDialog(QDialog):
try:
# Get values with safe defaults
decay_raw = weapon.decay if weapon.decay is not None else 0
ammo_raw = weapon.ammo if weapon.ammo is not None else 0
ammo_raw = weapon.ammo_burn if weapon.ammo_burn is not None else 0
# Calculate cost per shot
decay_pec = Decimal(str(decay_raw))
@ -153,7 +153,7 @@ class WeaponSelectorDialog(QDialog):
f"Damage: {weapon.damage}\n"
f"Decay: {decay_raw} PEC\n"
f"Ammo: {ammo_raw}\n"
f"Range: {weapon.range}\n"
f"Range: {weapon.range_val}\n"
f"DPP: {weapon.dpp:.2f}" if weapon.dpp else "DPP: -"
)
item.setToolTip(tooltip)
@ -184,7 +184,7 @@ class WeaponSelectorDialog(QDialog):
# Get values with safe defaults
decay_raw = weapon.decay if weapon.decay is not None else 0
ammo_raw = weapon.ammo if weapon.ammo is not None else 0
ammo_raw = weapon.ammo_burn if weapon.ammo_burn is not None else 0
# Calculate cost per shot
decay_pec = Decimal(str(decay_raw))