fix: correct cost calculations in loadout selection dialog
- weapon_decay_pec is in PEC (divide by 100 to get PED) - weapon_ammo_pec is ammo count (multiply by 0.0001 to get PED) - armor_decay_pec is in PEC (divide by 100 to get PED) - heal_cost_pec is in PEC (divide by 100 to get PED)
This commit is contained in:
parent
f5a0cf1514
commit
43657eaf1e
|
|
@ -244,25 +244,27 @@ class LoadoutSelectionDialog(QDialog):
|
|||
self.preview_healing.setText(data.get('heal_name', "None"))
|
||||
|
||||
# Try to calculate costs from JSON data
|
||||
# weapon_decay_pec is in PEC (1 PED = 100 PEC)
|
||||
# weapon_decay_pec is in PEC (divide by 100 to get PED)
|
||||
# weapon_ammo_pec is ammo count (multiply by 0.0001 to get PED)
|
||||
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")
|
||||
weapon_decay = Decimal(str(weapon_decay_raw)) / Decimal("100") # PEC to PED
|
||||
weapon_ammo = Decimal(str(weapon_ammo_raw)) * Decimal("0.0001") # Ammo to PED
|
||||
cost_shot = weapon_decay + weapon_ammo
|
||||
|
||||
print(f"DEBUG: calculated cost_shot = {cost_shot} PED")
|
||||
print(f"DEBUG: weapon_decay_pec={weapon_decay_raw} -> {weapon_decay} PED")
|
||||
print(f"DEBUG: weapon_ammo_pec={weapon_ammo_raw} -> {weapon_ammo} PED")
|
||||
|
||||
# Armor decay per hit
|
||||
armor_decay = Decimal(str(data.get('armor_decay_pec', 0)))
|
||||
cost_hit = armor_decay / Decimal("100")
|
||||
# Armor decay per hit (in PEC, convert to PED)
|
||||
armor_decay_raw = data.get('armor_decay_pec', 0)
|
||||
armor_decay = Decimal(str(armor_decay_raw)) / Decimal("100") # PEC to PED
|
||||
cost_hit = armor_decay
|
||||
|
||||
# Healing cost per use
|
||||
heal_cost = Decimal(str(data.get('heal_cost_pec', 0)))
|
||||
cost_heal = heal_cost / Decimal("100")
|
||||
# Healing cost per use (in PEC, convert to PED)
|
||||
heal_cost_raw = data.get('heal_cost_pec', 0)
|
||||
heal_cost = Decimal(str(heal_cost_raw)) / Decimal("100") # PEC to PED
|
||||
cost_heal = heal_cost
|
||||
|
||||
self.preview_cost_shot.setText(f"{cost_shot:.4f} PED")
|
||||
self.preview_cost_hit.setText(f"{cost_hit:.4f} PED")
|
||||
|
|
|
|||
Loading…
Reference in New Issue