Sync rosters at match start, harden dedup and TIME handling, add scoreboard and damage summary

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <[email protected]>
This commit is contained in:
Debian
2026-09-18 13:04:34 +02:00
co-authored by Sisyphus
parent 43758f980c
commit c636557849
3 changed files with 105 additions and 30 deletions
+25
View File
@@ -431,6 +431,26 @@ def _draw_server_menu(screen, servers, names, selected):
screen.refresh()
def format_damage_summary(server_info):
"""One-line damage summary (top 3 by damage dealt) from LIVESTATS counters;
None when no damage data exists yet. Dealt/taken are stored as strings."""
entries = []
for player_name, player_data in server_info.players.items():
try:
dealt = int(player_data.get('dealt', 0))
taken = int(player_data.get('taken', 0))
except (TypeError, ValueError):
continue
if dealt <= 0 and taken <= 0:
continue
entries.append((strip_color_codes(player_name), dealt, taken))
if not entries:
return None
entries.sort(key=lambda x: x[1], reverse=True)
summary = ' '.join(f"{name} {dealt}/{taken}" for name, dealt, taken in entries[:3])
return f"^8^3DMG^7 {summary}\n"
class UIManager:
"""Manages curses windows and display"""
@@ -872,6 +892,11 @@ class UIManager:
line = f"^8{col1}^0{' ' * col1_pad}^8{col2}^0\n"
print_colored(self.info_window, line, 0)
# Damage summary from LIVESTATS counters (top 3 by damage dealt)
damage_line = format_damage_summary(server_info)
if damage_line:
print_colored(self.info_window, damage_line, 0)
# Blank lines to fill
try:
self.info_window.addstr("\n")