feat: detailed loot breakdown in HUD (Total, Shrapnel, Regular)

- 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
This commit is contained in:
LemonNexus 2026-02-09 22:59:16 +00:00
parent 64a68f3857
commit 6204b82c88
1 changed files with 48 additions and 20 deletions

View File

@ -110,6 +110,7 @@ class HUDStats:
# Shrapnel (optional) # Shrapnel (optional)
shrapnel_total: Decimal = Decimal('0.0') shrapnel_total: Decimal = Decimal('0.0')
loot_other: Decimal = Decimal('0.0') # Non-shrapnel loot
# Cost metrics (core) # Cost metrics (core)
cost_per_shot: Decimal = Decimal('0.0') cost_per_shot: Decimal = Decimal('0.0')
@ -124,6 +125,8 @@ class HUDStats:
def recalculate(self): def recalculate(self):
"""Recalculate derived values.""" """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 self.profit_loss = self.loot_total - self.cost_total
if self.cost_total > 0: if self.cost_total > 0:
self.return_percentage = (self.loot_total / self.cost_total) * Decimal('100') self.return_percentage = (self.loot_total / self.cost_total) * Decimal('100')
@ -143,6 +146,10 @@ class HUDStats:
'kills': self.kills, 'kills': self.kills,
'globals_count': self.globals_count, 'globals_count': self.globals_count,
'hofs_count': self.hofs_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_shot': str(self.cost_per_shot),
'cost_per_hit': str(self.cost_per_hit), 'cost_per_hit': str(self.cost_per_hit),
'cost_per_heal': str(self.cost_per_heal), 'cost_per_heal': str(self.cost_per_heal),
@ -421,18 +428,36 @@ class HUDOverlay(QWidget):
if self.hud_config.show_total_cost: if self.hud_config.show_total_cost:
summary_frame = QFrame() summary_frame = QFrame()
summary_frame.setStyleSheet("background-color: rgba(0, 0, 0, 100); border-radius: 4px;") 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.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 = QLabel("Cost: 0.00")
self.total_cost_label.setStyleSheet("font-size: 12px; color: #FFAAAA;") 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") # Loot breakdown row
self.total_loot_label.setStyleSheet("font-size: 12px; color: #AAFFAA;") loot_layout = QHBoxLayout()
summary_layout.addWidget(self.total_cost_label) self.total_loot_label = QLabel("Total: 0.00")
summary_layout.addStretch() self.total_loot_label.setStyleSheet("font-size: 11px; color: #AAFFAA;")
summary_layout.addWidget(self.total_loot_label)
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) 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: if self.hud_config.show_profit_loss or self.hud_config.show_return_pct:
height += 40 height += 40
if self.hud_config.show_total_cost: if self.hud_config.show_total_cost:
height += 25 height += 50 # Two rows now: cost + loot breakdown
if self.hud_config.show_cost_metrics: if self.hud_config.show_cost_metrics:
height += 30 height += 30
if self.hud_config.show_cost_breakdown: if self.hud_config.show_cost_breakdown:
@ -699,9 +724,11 @@ class HUDOverlay(QWidget):
except RuntimeError: except RuntimeError:
pass 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_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 # Cost metrics
self._safe_set_text('cps_label', f"Shot: {self._stats.cost_per_shot:.4f}") 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_dealt_label', f"Dealt: {int(self._stats.damage_dealt)}")
self._safe_set_text('damage_taken_label', f"Taken: {int(self._stats.damage_taken)}") self._safe_set_text('damage_taken_label', f"Taken: {int(self._stats.damage_taken)}")
# Shrapnel # Shrapnel (in summary section now)
self._safe_set_text('shrapnel_label', f"💎 Shrapnel: {self._stats.shrapnel_total:.2f} PED") self._safe_set_text('shrapnel_value_label', f"💎 {self._stats.shrapnel_total:.2f}")
# === Public Update Methods === # === Public Update Methods ===
def update_loot(self, value_ped: Decimal): def update_loot(self, value_ped: Decimal, is_shrapnel: bool = False):
"""Update loot value.""" """Update loot value."""
if self.session_active: 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._stats.recalculate()
self._refresh_display() 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): def update_weapon_cost(self, cost_ped: Decimal):
"""Update weapon cost.""" """Update weapon cost."""
if self.session_active: if self.session_active:
@ -783,12 +817,6 @@ class HUDOverlay(QWidget):
self._stats.damage_taken += taken self._stats.damage_taken += taken
self._refresh_display() 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 === # === Mouse Handling ===
def mousePressEvent(self, event: QMouseEvent): def mousePressEvent(self, event: QMouseEvent):