From 6204b82c8890d769d1bde1c1d32db2ea2cac5200 Mon Sep 17 00:00:00 2001 From: LemonNexus Date: Mon, 9 Feb 2026 22:59:16 +0000 Subject: [PATCH] feat: detailed loot breakdown in HUD (Total, Shrapnel, Regular) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add loot_other field to HUDStats for non-shrapnel loot - Loot summary now shows: Total | 💎 Shrapnel | 📦 Regular - Each type with distinct color coding - update_loot() now accepts is_shrapnel parameter - Remove duplicate shrapnel UI section (now integrated in summary) - Update window height for two-row summary --- ui/hud_overlay_clean.py | 68 +++++++++++++++++++++++++++++------------ 1 file changed, 48 insertions(+), 20 deletions(-) diff --git a/ui/hud_overlay_clean.py b/ui/hud_overlay_clean.py index 2f343bd..09c7f7d 100644 --- a/ui/hud_overlay_clean.py +++ b/ui/hud_overlay_clean.py @@ -110,7 +110,8 @@ class HUDStats: # Shrapnel (optional) shrapnel_total: Decimal = Decimal('0.0') - + loot_other: Decimal = Decimal('0.0') # Non-shrapnel loot + # Cost metrics (core) cost_per_shot: Decimal = Decimal('0.0') cost_per_hit: Decimal = Decimal('0.0') @@ -124,6 +125,8 @@ class HUDStats: def recalculate(self): """Recalculate derived values.""" + # Total loot is shrapnel + other loot + self.loot_total = self.shrapnel_total + self.loot_other self.profit_loss = self.loot_total - self.cost_total if self.cost_total > 0: self.return_percentage = (self.loot_total / self.cost_total) * Decimal('100') @@ -143,6 +146,10 @@ class HUDStats: 'kills': self.kills, 'globals_count': self.globals_count, 'hofs_count': self.hofs_count, + 'damage_dealt': str(self.damage_dealt), + 'damage_taken': str(self.damage_taken), + 'shrapnel_total': str(self.shrapnel_total), + 'loot_other': str(self.loot_other), 'cost_per_shot': str(self.cost_per_shot), 'cost_per_hit': str(self.cost_per_hit), 'cost_per_heal': str(self.cost_per_heal), @@ -421,18 +428,36 @@ class HUDOverlay(QWidget): if self.hud_config.show_total_cost: summary_frame = QFrame() summary_frame.setStyleSheet("background-color: rgba(0, 0, 0, 100); border-radius: 4px;") - summary_layout = QHBoxLayout(summary_frame) + summary_layout = QVBoxLayout(summary_frame) summary_layout.setContentsMargins(8, 4, 8, 4) + summary_layout.setSpacing(2) + # Cost row + cost_layout = QHBoxLayout() self.total_cost_label = QLabel("Cost: 0.00") self.total_cost_label.setStyleSheet("font-size: 12px; color: #FFAAAA;") + cost_layout.addWidget(self.total_cost_label) + cost_layout.addStretch() + summary_layout.addLayout(cost_layout) - self.total_loot_label = QLabel("Loot: 0.00") - self.total_loot_label.setStyleSheet("font-size: 12px; color: #AAFFAA;") + # Loot breakdown row + loot_layout = QHBoxLayout() - summary_layout.addWidget(self.total_cost_label) - summary_layout.addStretch() - summary_layout.addWidget(self.total_loot_label) + self.total_loot_label = QLabel("Total: 0.00") + self.total_loot_label.setStyleSheet("font-size: 11px; color: #AAFFAA;") + + self.shrapnel_value_label = QLabel("💎 0.00") + self.shrapnel_value_label.setStyleSheet("font-size: 11px; color: #87CEEB;") + + self.regular_loot_label = QLabel("📦 0.00") + self.regular_loot_label.setStyleSheet("font-size: 11px; color: #FFD700;") + + loot_layout.addWidget(self.total_loot_label) + loot_layout.addStretch() + loot_layout.addWidget(self.shrapnel_value_label) + loot_layout.addWidget(self.regular_loot_label) + + summary_layout.addLayout(loot_layout) layout.addWidget(summary_frame) @@ -560,7 +585,7 @@ class HUDOverlay(QWidget): if self.hud_config.show_profit_loss or self.hud_config.show_return_pct: height += 40 if self.hud_config.show_total_cost: - height += 25 + height += 50 # Two rows now: cost + loot breakdown if self.hud_config.show_cost_metrics: height += 30 if self.hud_config.show_cost_breakdown: @@ -699,9 +724,11 @@ class HUDOverlay(QWidget): except RuntimeError: pass - # Total Cost + Loot + # Total Cost + Loot breakdown self._safe_set_text('total_cost_label', f"Cost: {self._stats.cost_total:.2f}") - self._safe_set_text('total_loot_label', f"Loot: {self._stats.loot_total:.2f}") + self._safe_set_text('total_loot_label', f"Total: {self._stats.loot_total:.2f}") + self._safe_set_text('shrapnel_value_label', f"💎 {self._stats.shrapnel_total:.2f}") + self._safe_set_text('regular_loot_label', f"📦 {self._stats.loot_other:.2f}") # Cost metrics self._safe_set_text('cps_label', f"Shot: {self._stats.cost_per_shot:.4f}") @@ -726,18 +753,25 @@ class HUDOverlay(QWidget): 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)}") - # Shrapnel - self._safe_set_text('shrapnel_label', f"💎 Shrapnel: {self._stats.shrapnel_total:.2f} PED") + # Shrapnel (in summary section now) + self._safe_set_text('shrapnel_value_label', f"💎 {self._stats.shrapnel_total:.2f}") # === Public Update Methods === - def update_loot(self, value_ped: Decimal): + def update_loot(self, value_ped: Decimal, is_shrapnel: bool = False): """Update loot value.""" if self.session_active: - self._stats.loot_total += value_ped + if is_shrapnel: + self._stats.shrapnel_total += value_ped + else: + self._stats.loot_other += value_ped self._stats.recalculate() self._refresh_display() + def update_shrapnel(self, amount: Decimal): + """Update shrapnel amount (convenience method).""" + self.update_loot(amount, is_shrapnel=True) + def update_weapon_cost(self, cost_ped: Decimal): """Update weapon cost.""" if self.session_active: @@ -783,12 +817,6 @@ class HUDOverlay(QWidget): self._stats.damage_taken += taken self._refresh_display() - def update_shrapnel(self, amount: Decimal): - """Update shrapnel amount.""" - if self.session_active: - self._stats.shrapnel_total += amount - self._refresh_display() - # === Mouse Handling === def mousePressEvent(self, event: QMouseEvent):