fix: add missing UI elements for damage stats and shrapnel

- Add damage_dealt and damage_taken to HUDStats
- Add shrapnel_total to HUDStats
- Add UI elements for damage stats in _setup_ui
- Add UI element for shrapnel in _setup_ui
- Update window size calculation for new elements
- Update _refresh_display to show damage and shrapnel
- Add update_damage() and update_shrapnel() public methods
This commit is contained in:
LemonNexus 2026-02-09 22:52:33 +00:00
parent 5c4ce8f307
commit 61d2ad2019
1 changed files with 191 additions and 128 deletions

View File

@ -101,6 +101,13 @@ class HUDStats:
globals_count: int = 0 globals_count: int = 0
hofs_count: int = 0 hofs_count: int = 0
# Damage stats (optional)
damage_dealt: Decimal = Decimal('0.0')
damage_taken: Decimal = Decimal('0.0')
# Shrapnel (optional)
shrapnel_total: Decimal = Decimal('0.0')
# Cost metrics (core) # Cost metrics (core)
cost_per_shot: Decimal = Decimal('0.0') cost_per_shot: Decimal = Decimal('0.0')
cost_per_hit: Decimal = Decimal('0.0') cost_per_hit: Decimal = Decimal('0.0')
@ -470,6 +477,33 @@ class HUDOverlay(QWidget):
layout.addWidget(combat_frame) layout.addWidget(combat_frame)
# === OPTIONAL: Damage Stats ===
if self.hud_config.show_damage_stats:
damage_frame = QFrame()
damage_layout = QHBoxLayout(damage_frame)
damage_layout.setContentsMargins(0, 0, 0, 0)
self.damage_dealt_label = QLabel("Dealt: 0")
self.damage_taken_label = QLabel("Taken: 0")
damage_layout.addWidget(self.damage_dealt_label)
damage_layout.addStretch()
damage_layout.addWidget(self.damage_taken_label)
layout.addWidget(damage_frame)
# === OPTIONAL: Shrapnel ===
if self.hud_config.show_shrapnel:
shrapnel_frame = QFrame()
shrapnel_layout = QHBoxLayout(shrapnel_frame)
shrapnel_layout.setContentsMargins(0, 0, 0, 0)
self.shrapnel_label = QLabel("💎 Shrapnel: 0.00 PED")
shrapnel_layout.addWidget(self.shrapnel_label)
shrapnel_layout.addStretch()
layout.addWidget(shrapnel_frame)
# === FOOTER: Session Time + Drag Hint === # === FOOTER: Session Time + Drag Hint ===
footer = QHBoxLayout() footer = QHBoxLayout()
@ -524,6 +558,10 @@ class HUDOverlay(QWidget):
height += 70 height += 70
if self.hud_config.show_combat_stats: if self.hud_config.show_combat_stats:
height += 25 height += 25
if self.hud_config.show_damage_stats:
height += 25
if self.hud_config.show_shrapnel:
height += 25
if self.hud_config.show_session_time: if self.hud_config.show_session_time:
height += 20 height += 20
@ -670,6 +708,16 @@ class HUDOverlay(QWidget):
if hasattr(self, 'globals_label'): if hasattr(self, 'globals_label'):
self.globals_label.setText(f"Globals: {self._stats.globals_count}") self.globals_label.setText(f"Globals: {self._stats.globals_count}")
# Damage stats
if hasattr(self, 'damage_dealt_label'):
self.damage_dealt_label.setText(f"Dealt: {int(self._stats.damage_dealt)}")
if hasattr(self, 'damage_taken_label'):
self.damage_taken_label.setText(f"Taken: {int(self._stats.damage_taken)}")
# Shrapnel
if hasattr(self, 'shrapnel_label'):
self.shrapnel_label.setText(f"💎 Shrapnel: {self._stats.shrapnel_total:.2f} PED")
# === Public Update Methods === # === Public Update Methods ===
def update_loot(self, value_ped: Decimal): def update_loot(self, value_ped: Decimal):
@ -715,6 +763,21 @@ class HUDOverlay(QWidget):
self._stats.globals_count += 1 self._stats.globals_count += 1
self._refresh_display() self._refresh_display()
def update_damage(self, dealt: Decimal = Decimal('0'), taken: Decimal = Decimal('0')):
"""Update damage stats."""
if self.session_active:
if dealt > 0:
self._stats.damage_dealt += dealt
if taken > 0:
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 === # === Mouse Handling ===
def mousePressEvent(self, event: QMouseEvent): def mousePressEvent(self, event: QMouseEvent):