From f5a0cf15141b46c26fcbb0024aa1b36c7252199e Mon Sep 17 00:00:00 2001 From: LemonNexus Date: Mon, 9 Feb 2026 20:34:04 +0000 Subject: [PATCH] debug: add debug output to trace cost calculation issue in loadout selection --- ui/loadout_selection_dialog.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/ui/loadout_selection_dialog.py b/ui/loadout_selection_dialog.py index dd88f2c..2c95ce2 100644 --- a/ui/loadout_selection_dialog.py +++ b/ui/loadout_selection_dialog.py @@ -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")