refactor: remove separate shrapnel display option
- Shrapnel is now integrated in the loot summary box (S: prefix) - Remove show_shrapnel config option - Remove shrapnel UI section from _setup_ui - Remove shrapnel checkbox from settings dialog - Update window size calculation - Keep shrapnel data in HUDStats for internal tracking
This commit is contained in:
parent
e356b037ac
commit
61c45fac8b
|
|
@ -46,7 +46,7 @@ class HUDConfig:
|
||||||
show_combat_stats: bool = False # Kills, Globals, DPP
|
show_combat_stats: bool = False # Kills, Globals, DPP
|
||||||
show_damage_stats: bool = False # Damage dealt/taken
|
show_damage_stats: bool = False # Damage dealt/taken
|
||||||
show_cost_metrics: bool = True # Cost per shot/hit/heal
|
show_cost_metrics: bool = True # Cost per shot/hit/heal
|
||||||
show_shrapnel: bool = False
|
show_shrapnel: bool = False # Deprecated - now integrated in loot summary
|
||||||
show_gear_info: bool = True
|
show_gear_info: bool = True
|
||||||
|
|
||||||
compact_mode: bool = False
|
compact_mode: bool = False
|
||||||
|
|
@ -61,7 +61,6 @@ class HUDConfig:
|
||||||
'show_combat_stats': self.show_combat_stats,
|
'show_combat_stats': self.show_combat_stats,
|
||||||
'show_damage_stats': self.show_damage_stats,
|
'show_damage_stats': self.show_damage_stats,
|
||||||
'show_cost_metrics': self.show_cost_metrics,
|
'show_cost_metrics': self.show_cost_metrics,
|
||||||
'show_shrapnel': self.show_shrapnel,
|
|
||||||
'show_gear_info': self.show_gear_info,
|
'show_gear_info': self.show_gear_info,
|
||||||
'compact_mode': self.compact_mode,
|
'compact_mode': self.compact_mode,
|
||||||
}
|
}
|
||||||
|
|
@ -77,7 +76,6 @@ class HUDConfig:
|
||||||
show_combat_stats=data.get('show_combat_stats', False),
|
show_combat_stats=data.get('show_combat_stats', False),
|
||||||
show_damage_stats=data.get('show_damage_stats', False),
|
show_damage_stats=data.get('show_damage_stats', False),
|
||||||
show_cost_metrics=data.get('show_cost_metrics', True),
|
show_cost_metrics=data.get('show_cost_metrics', True),
|
||||||
show_shrapnel=data.get('show_shrapnel', False),
|
|
||||||
show_gear_info=data.get('show_gear_info', True),
|
show_gear_info=data.get('show_gear_info', True),
|
||||||
compact_mode=data.get('compact_mode', False),
|
compact_mode=data.get('compact_mode', False),
|
||||||
)
|
)
|
||||||
|
|
@ -111,14 +109,14 @@ 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
|
loot_other: Decimal = Decimal('0.0') # Non-shrapnel loot
|
||||||
|
|
||||||
# Session records
|
# Session records
|
||||||
highest_loot: Decimal = Decimal('0.0') # Highest total loot from single kill
|
highest_loot: Decimal = Decimal('0.0') # Highest total loot from single kill
|
||||||
|
|
||||||
# Kill tracking buffer
|
# Kill tracking buffer
|
||||||
_current_kill_loot: Decimal = Decimal('0.0')
|
_current_kill_loot: Decimal = Decimal('0.0')
|
||||||
_last_loot_time: Optional[datetime] = None
|
_last_loot_time: Optional[datetime] = None
|
||||||
|
|
||||||
# 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')
|
||||||
|
|
@ -228,11 +226,7 @@ class HUDSettingsDialog(QDialog):
|
||||||
self.cb_damage = QCheckBox("Damage Stats (Dealt/Taken)")
|
self.cb_damage = QCheckBox("Damage Stats (Dealt/Taken)")
|
||||||
self.cb_damage.setChecked(self.config.show_damage_stats)
|
self.cb_damage.setChecked(self.config.show_damage_stats)
|
||||||
form.addRow(self.cb_damage)
|
form.addRow(self.cb_damage)
|
||||||
|
|
||||||
self.cb_shrapnel = QCheckBox("Shrapnel Amount")
|
|
||||||
self.cb_shrapnel.setChecked(self.config.show_shrapnel)
|
|
||||||
form.addRow(self.cb_shrapnel)
|
|
||||||
|
|
||||||
# Display mode
|
# Display mode
|
||||||
form.addRow(QLabel("<b>Display Mode</b>"))
|
form.addRow(QLabel("<b>Display Mode</b>"))
|
||||||
|
|
||||||
|
|
@ -267,7 +261,6 @@ class HUDSettingsDialog(QDialog):
|
||||||
self.config.show_cost_breakdown = self.cb_cost_breakdown.isChecked()
|
self.config.show_cost_breakdown = self.cb_cost_breakdown.isChecked()
|
||||||
self.config.show_combat_stats = self.cb_combat.isChecked()
|
self.config.show_combat_stats = self.cb_combat.isChecked()
|
||||||
self.config.show_damage_stats = self.cb_damage.isChecked()
|
self.config.show_damage_stats = self.cb_damage.isChecked()
|
||||||
self.config.show_shrapnel = self.cb_shrapnel.isChecked()
|
|
||||||
self.config.compact_mode = self.cb_compact.isChecked()
|
self.config.compact_mode = self.cb_compact.isChecked()
|
||||||
self.accept()
|
self.accept()
|
||||||
|
|
||||||
|
|
@ -445,7 +438,7 @@ class HUDOverlay(QWidget):
|
||||||
summary_layout = QVBoxLayout(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)
|
summary_layout.setSpacing(2)
|
||||||
|
|
||||||
# Cost row
|
# Cost row
|
||||||
cost_layout = QHBoxLayout()
|
cost_layout = QHBoxLayout()
|
||||||
self.total_cost_label = QLabel("Cost: 0.00")
|
self.total_cost_label = QLabel("Cost: 0.00")
|
||||||
|
|
@ -453,26 +446,26 @@ class HUDOverlay(QWidget):
|
||||||
cost_layout.addWidget(self.total_cost_label)
|
cost_layout.addWidget(self.total_cost_label)
|
||||||
cost_layout.addStretch()
|
cost_layout.addStretch()
|
||||||
summary_layout.addLayout(cost_layout)
|
summary_layout.addLayout(cost_layout)
|
||||||
|
|
||||||
# Loot breakdown row
|
# Loot breakdown row
|
||||||
loot_layout = QHBoxLayout()
|
loot_layout = QHBoxLayout()
|
||||||
|
|
||||||
self.total_loot_label = QLabel("Total: 0.00")
|
self.total_loot_label = QLabel("Total: 0.00")
|
||||||
self.total_loot_label.setStyleSheet("font-size: 11px; color: #AAFFAA;")
|
self.total_loot_label.setStyleSheet("font-size: 11px; color: #AAFFAA;")
|
||||||
|
|
||||||
self.shrapnel_value_label = QLabel("S: 0.00")
|
self.shrapnel_value_label = QLabel("S: 0.00")
|
||||||
self.shrapnel_value_label.setStyleSheet("font-size: 11px; color: #87CEEB;")
|
self.shrapnel_value_label.setStyleSheet("font-size: 11px; color: #87CEEB;")
|
||||||
|
|
||||||
self.regular_loot_label = QLabel("R: 0.00")
|
self.regular_loot_label = QLabel("R: 0.00")
|
||||||
self.regular_loot_label.setStyleSheet("font-size: 11px; color: #FFD700;")
|
self.regular_loot_label.setStyleSheet("font-size: 11px; color: #FFD700;")
|
||||||
|
|
||||||
loot_layout.addWidget(self.total_loot_label)
|
loot_layout.addWidget(self.total_loot_label)
|
||||||
loot_layout.addStretch()
|
loot_layout.addStretch()
|
||||||
loot_layout.addWidget(self.shrapnel_value_label)
|
loot_layout.addWidget(self.shrapnel_value_label)
|
||||||
loot_layout.addWidget(self.regular_loot_label)
|
loot_layout.addWidget(self.regular_loot_label)
|
||||||
|
|
||||||
summary_layout.addLayout(loot_layout)
|
summary_layout.addLayout(loot_layout)
|
||||||
|
|
||||||
# Highest loot row
|
# Highest loot row
|
||||||
highest_layout = QHBoxLayout()
|
highest_layout = QHBoxLayout()
|
||||||
self.highest_loot_label = QLabel("Highest: 0.00")
|
self.highest_loot_label = QLabel("Highest: 0.00")
|
||||||
|
|
@ -480,7 +473,7 @@ class HUDOverlay(QWidget):
|
||||||
highest_layout.addWidget(self.highest_loot_label)
|
highest_layout.addWidget(self.highest_loot_label)
|
||||||
highest_layout.addStretch()
|
highest_layout.addStretch()
|
||||||
summary_layout.addLayout(highest_layout)
|
summary_layout.addLayout(highest_layout)
|
||||||
|
|
||||||
layout.addWidget(summary_frame)
|
layout.addWidget(summary_frame)
|
||||||
|
|
||||||
# Separator before cost metrics
|
# Separator before cost metrics
|
||||||
|
|
@ -589,28 +582,6 @@ class HUDOverlay(QWidget):
|
||||||
sep_footer.setStyleSheet("background-color: rgba(255, 215, 0, 50);")
|
sep_footer.setStyleSheet("background-color: rgba(255, 215, 0, 50);")
|
||||||
sep_footer.setFixedHeight(1)
|
sep_footer.setFixedHeight(1)
|
||||||
layout.addWidget(sep_footer)
|
layout.addWidget(sep_footer)
|
||||||
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()
|
||||||
|
|
@ -668,8 +639,6 @@ class HUDOverlay(QWidget):
|
||||||
height += 25
|
height += 25
|
||||||
if self.hud_config.show_damage_stats:
|
if self.hud_config.show_damage_stats:
|
||||||
height += 25
|
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
|
||||||
|
|
||||||
|
|
@ -731,11 +700,11 @@ class HUDOverlay(QWidget):
|
||||||
self._stats.cost_per_shot = cost_per_shot
|
self._stats.cost_per_shot = cost_per_shot
|
||||||
self._stats.cost_per_hit = cost_per_hit
|
self._stats.cost_per_hit = cost_per_hit
|
||||||
self._stats.cost_per_heal = cost_per_heal
|
self._stats.cost_per_heal = cost_per_heal
|
||||||
|
|
||||||
# Initialize kill tracking
|
# Initialize kill tracking
|
||||||
self._stats._current_kill_loot = Decimal('0.0')
|
self._stats._current_kill_loot = Decimal('0.0')
|
||||||
self._stats._last_loot_time = None
|
self._stats._last_loot_time = None
|
||||||
|
|
||||||
self.session_active = True
|
self.session_active = True
|
||||||
|
|
||||||
self._timer.start(1000)
|
self._timer.start(1000)
|
||||||
|
|
@ -753,7 +722,7 @@ class HUDOverlay(QWidget):
|
||||||
if self._stats._current_kill_loot > self._stats.highest_loot:
|
if self._stats._current_kill_loot > self._stats.highest_loot:
|
||||||
self._stats.highest_loot = self._stats._current_kill_loot
|
self._stats.highest_loot = self._stats._current_kill_loot
|
||||||
self._refresh_display()
|
self._refresh_display()
|
||||||
|
|
||||||
self.session_active = False
|
self.session_active = False
|
||||||
self._timer.stop()
|
self._timer.stop()
|
||||||
self.status_label.setText("● Stopped")
|
self.status_label.setText("● Stopped")
|
||||||
|
|
@ -846,7 +815,7 @@ class HUDOverlay(QWidget):
|
||||||
"""Update loot value - tracks per-kill totals for highest loot."""
|
"""Update loot value - tracks per-kill totals for highest loot."""
|
||||||
if self.session_active:
|
if self.session_active:
|
||||||
now = datetime.now()
|
now = datetime.now()
|
||||||
|
|
||||||
# Check if this is a new kill (gap of >2 seconds since last loot)
|
# Check if this is a new kill (gap of >2 seconds since last loot)
|
||||||
if self._stats._last_loot_time is not None:
|
if self._stats._last_loot_time is not None:
|
||||||
time_since_last = (now - self._stats._last_loot_time).total_seconds()
|
time_since_last = (now - self._stats._last_loot_time).total_seconds()
|
||||||
|
|
@ -862,15 +831,15 @@ class HUDOverlay(QWidget):
|
||||||
else:
|
else:
|
||||||
# First loot of session
|
# First loot of session
|
||||||
self._stats._current_kill_loot = value_ped
|
self._stats._current_kill_loot = value_ped
|
||||||
|
|
||||||
self._stats._last_loot_time = now
|
self._stats._last_loot_time = now
|
||||||
|
|
||||||
# Add to totals
|
# Add to totals
|
||||||
if is_shrapnel:
|
if is_shrapnel:
|
||||||
self._stats.shrapnel_total += value_ped
|
self._stats.shrapnel_total += value_ped
|
||||||
else:
|
else:
|
||||||
self._stats.loot_other += value_ped
|
self._stats.loot_other += value_ped
|
||||||
|
|
||||||
self._stats.recalculate()
|
self._stats.recalculate()
|
||||||
self._refresh_display()
|
self._refresh_display()
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue