diff --git a/ui/hud_overlay_clean.py b/ui/hud_overlay_clean.py index 4f5013b..d24dcfd 100644 --- a/ui/hud_overlay_clean.py +++ b/ui/hud_overlay_clean.py @@ -754,39 +754,63 @@ class HUDOverlay(QWidget): def _refresh_display(self): """Refresh all display labels.""" - # Profit/Loss - profit = self._stats.profit_loss - color = "#7FFF7F" if profit >= 0 else "#FF7F7F" - self._safe_set_text('profit_label', f"{profit:+.2f} PED") - if hasattr(self, 'profit_label') and self.profit_label is not None: - try: - self.profit_label.setStyleSheet(f"font-size: 18px; font-weight: bold; color: {color};") - except RuntimeError: - pass + try: + # Profit/Loss + if hasattr(self, 'profit_label') and self.profit_label is not None: + try: + profit = self._stats.profit_loss + color = "#7FFF7F" if profit >= 0 else "#FF7F7F" + self.profit_label.setText(f"{profit:+.2f} PED") + self.profit_label.setStyleSheet(f"font-size: 18px; font-weight: bold; color: {color};") + except RuntimeError: + pass - # Return % - ret = self._stats.return_percentage - if ret >= 100: - color = "#7FFF7F" - elif ret >= 90: - color = "#FFFF7F" - else: - color = "#FF7F7F" - self._safe_set_text('return_label', f"{ret:.1f}%") - if hasattr(self, 'return_label') and self.return_label is not None: - try: - self.return_label.setStyleSheet(f"font-size: 16px; font-weight: bold; color: {color};") - except RuntimeError: - pass + # Return % + if hasattr(self, 'return_label') and self.return_label is not None: + try: + ret = self._stats.return_percentage + if ret >= 100: + color = "#7FFF7F" + elif ret >= 90: + color = "#FFFF7F" + else: + color = "#FF7F7F" + self.return_label.setText(f"{ret:.1f}%") + self.return_label.setStyleSheet(f"font-size: 16px; font-weight: bold; color: {color};") + except RuntimeError: + pass - # Total Cost + Loot breakdown + Highest - self._safe_set_text('total_cost_label', f"Cost: {self._stats.cost_total:.2f}") - self._safe_set_text('total_loot_label', f"Total: {self._stats.loot_total:.2f}") - self._safe_set_text('shrapnel_value_label', f"S: {self._stats.shrapnel_total:.2f}") - self._safe_set_text('regular_loot_label', f"R: {self._stats.loot_other:.2f}") - self._safe_set_text('highest_loot_label', f"Highest: {self._stats.highest_loot:.2f}") + # Total Cost + Loot breakdown + Highest + self._safe_set_text('total_cost_label', f"Cost: {self._stats.cost_total:.2f}") + self._safe_set_text('total_loot_label', f"Total: {self._stats.loot_total:.2f}") + self._safe_set_text('shrapnel_value_label', f"S: {self._stats.shrapnel_total:.2f}") + self._safe_set_text('regular_loot_label', f"R: {self._stats.loot_other:.2f}") + self._safe_set_text('highest_loot_label', f"Highest: {self._stats.highest_loot:.2f}") - # Cost metrics + # Cost metrics + self._safe_set_text('cps_label', f"Shot: {self._stats.cost_per_shot:.4f}") + self._safe_set_text('cph_label', f"Hit: {self._stats.cost_per_hit:.4f}") + self._safe_set_text('cphl_label', f"Heal: {self._stats.cost_per_heal:.4f}") + + # Gear + self._safe_set_text('weapon_label', f"W: {self._stats.current_weapon[:20]}") + self._safe_set_text('armor_label', f"A: {self._stats.current_armor[:20]}") + self._safe_set_text('loadout_label', f"L: {self._stats.current_loadout[:20]}") + + # Cost breakdown + self._safe_set_text('wep_cost_label', f"{self._stats.weapon_cost_total:.2f}") + self._safe_set_text('arm_cost_label', f"{self._stats.armor_cost_total:.2f}") + self._safe_set_text('heal_cost_label', f"{self._stats.healing_cost_total:.2f}") + + # Combat + self._safe_set_text('kills_label', f"Kills: {self._stats.kills}") + self._safe_set_text('globals_label', f"Globals: {self._stats.globals_count}") + + # Damage stats + self._safe_set_text('damage_dealt_label', f"Dealt: {int(self._stats.damage_dealt)}") + self._safe_set_text('damage_taken_label', f"Taken: {int(self._stats.damage_taken)}") + except Exception as e: + logger.error(f"Error in _refresh_display: {e}") self._safe_set_text('cps_label', f"Shot: {self._stats.cost_per_shot:.4f}") self._safe_set_text('cph_label', f"Hit: {self._stats.cost_per_hit:.4f}") self._safe_set_text('cphl_label', f"Heal: {self._stats.cost_per_heal:.4f}")