debug: add debug output to trace cost calculation issue in loadout selection

This commit is contained in:
LemonNexus 2026-02-09 20:34:04 +00:00
parent 2c2249f45e
commit f5a0cf1514
1 changed files with 13 additions and 3 deletions

View File

@ -238,19 +238,29 @@ class LoadoutSelectionDialog(QDialog):
cost_hit = Decimal(str(data.get('cost_per_hit_ped', 0)))
cost_heal = Decimal(str(data.get('cost_per_heal_ped', 0)))
else:
# JSON format
# JSON format - values stored in PEC, need to convert to PED
self.preview_weapon.setText(data.get('weapon_name', "None"))
self.preview_armor.setText(data.get('armor_set_name', "None"))
self.preview_healing.setText(data.get('heal_name', "None"))
# Try to calculate costs from JSON data
weapon_decay = Decimal(str(data.get('weapon_decay_pec', 0)))
weapon_ammo = Decimal(str(data.get('weapon_ammo_pec', 0)))
# weapon_decay_pec is in PEC (1 PED = 100 PEC)
weapon_decay_raw = data.get('weapon_decay_pec', 0)
weapon_ammo_raw = data.get('weapon_ammo_pec', 0)
print(f"DEBUG: weapon_decay_pec raw = {weapon_decay_raw} (type: {type(weapon_decay_raw)})")
print(f"DEBUG: weapon_ammo_pec raw = {weapon_ammo_raw} (type: {type(weapon_ammo_raw)})")
weapon_decay = Decimal(str(weapon_decay_raw))
weapon_ammo = Decimal(str(weapon_ammo_raw))
cost_shot = (weapon_decay + weapon_ammo) / Decimal("100")
print(f"DEBUG: calculated cost_shot = {cost_shot} PED")
# Armor decay per hit
armor_decay = Decimal(str(data.get('armor_decay_pec', 0)))
cost_hit = armor_decay / Decimal("100")
# Healing cost per use
heal_cost = Decimal(str(data.get('heal_cost_pec', 0)))
cost_heal = heal_cost / Decimal("100")