fix(api): handle absorber-specific fields (absorption instead of decay)
- Absorbers don't have Decay in Economy, only Absorption - Updated parser to set decay=0 and absorption from Economy.Absorption for absorbers - Updated UI to show absorption % in Decay column for absorbers - Updated preview panel to display absorption for absorbers
This commit is contained in:
parent
7f1e111a83
commit
3bdf86ab4c
|
|
@ -163,8 +163,6 @@ class NexusAttachment(NexusItem):
|
||||||
|
|
||||||
# Get Economy data
|
# Get Economy data
|
||||||
economy = props.get('Economy', {}) or {}
|
economy = props.get('Economy', {}) or {}
|
||||||
decay = safe_decimal(economy.get('Decay'))
|
|
||||||
efficiency = safe_decimal(economy.get('Efficiency'))
|
|
||||||
|
|
||||||
# Determine attachment type from API type or name
|
# Determine attachment type from API type or name
|
||||||
api_type = props.get('Type', '').lower()
|
api_type = props.get('Type', '').lower()
|
||||||
|
|
@ -181,6 +179,16 @@ class NexusAttachment(NexusItem):
|
||||||
else:
|
else:
|
||||||
attachment_type = api_type or 'unknown'
|
attachment_type = api_type or 'unknown'
|
||||||
|
|
||||||
|
# Get decay - absorbers don't have decay, they have absorption
|
||||||
|
if attachment_type == 'absorber':
|
||||||
|
decay = Decimal("0")
|
||||||
|
absorption = safe_decimal(economy.get('Absorption'))
|
||||||
|
else:
|
||||||
|
decay = safe_decimal(economy.get('Decay'))
|
||||||
|
absorption = Decimal("0")
|
||||||
|
|
||||||
|
efficiency = safe_decimal(economy.get('Efficiency'))
|
||||||
|
|
||||||
# Parse based on attachment type
|
# Parse based on attachment type
|
||||||
damage_bonus = Decimal("0")
|
damage_bonus = Decimal("0")
|
||||||
range_bonus = Decimal("0")
|
range_bonus = Decimal("0")
|
||||||
|
|
|
||||||
|
|
@ -251,8 +251,12 @@ class AttachmentSelectorDialog(QDialog):
|
||||||
zoom_text = "-"
|
zoom_text = "-"
|
||||||
item.setText(4, zoom_text)
|
item.setText(4, zoom_text)
|
||||||
|
|
||||||
# Column 5: Decay (in PEC)
|
# Column 5: Decay (in PEC) or Absorption
|
||||||
item.setText(5, f"{att.decay:.3f}")
|
if att.attachment_type == 'absorber' and att.absorption > 0:
|
||||||
|
decay_text = f"{att.absorption * 100:.0f}%"
|
||||||
|
else:
|
||||||
|
decay_text = f"{att.decay:.3f}"
|
||||||
|
item.setText(5, decay_text)
|
||||||
|
|
||||||
# Column 6: Efficiency %
|
# Column 6: Efficiency %
|
||||||
if att.efficiency_bonus > 0:
|
if att.efficiency_bonus > 0:
|
||||||
|
|
@ -358,8 +362,13 @@ class AttachmentSelectorDialog(QDialog):
|
||||||
self.preview_absorption.setText("-")
|
self.preview_absorption.setText("-")
|
||||||
self.preview_absorption.setStyleSheet("")
|
self.preview_absorption.setStyleSheet("")
|
||||||
|
|
||||||
# Decay
|
# Decay or Absorption
|
||||||
self.preview_decay.setText(f"{attachment.decay:.4f} PEC")
|
if attachment.attachment_type == 'absorber' and attachment.absorption > 0:
|
||||||
|
self.preview_decay.setText(f"{attachment.absorption * 100:.1f}% absorption")
|
||||||
|
self.preview_decay.setStyleSheet("color: #9c27b0;")
|
||||||
|
else:
|
||||||
|
self.preview_decay.setText(f"{attachment.decay:.4f} PEC")
|
||||||
|
self.preview_decay.setStyleSheet("")
|
||||||
|
|
||||||
# Efficiency
|
# Efficiency
|
||||||
if attachment.efficiency_bonus > 0:
|
if attachment.efficiency_bonus > 0:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue