feat: combat stats backend + frontend (Mag-Tools style)

Backend:
- db_async.py: new combat_stats + combat_stats_sessions tables
- main.py: combat_stats message handler with DB upsert (lifetime +
  session snapshots), in-memory live_combat_stats dict, broadcast
  to browser clients.
- REST: GET /combat-stats and GET /combat-stats/{character_name}

Frontend:
- index.html: new "Combat Stats" sidebar link
- script.js: full Combat Stats window with two panels:
  - Top: monster list (name, kills, dmg recv, dmg given) with
    clickable rows and "All" aggregate, matching CombatTrackerGUI.cs
  - Bottom: damage breakdown grid matching CombatTrackerGUIInfo.cs
    layout — element × attack type matrix (Mel/Msl + Magic columns),
    Attacks (hit%), Evades (%), Resists (%), A.Surges (%), C.Surges (%),
    normal Avg/Max, Crits (%), Crit Avg/Max, Total Damage.
  - Session / Lifetime toggle button
- style.css: combat-stats-toggle styles

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Erik 2026-04-12 09:42:11 +02:00
parent da4e840581
commit c03b1c19f2
5 changed files with 509 additions and 0 deletions

View file

@ -2872,3 +2872,19 @@ table.ts-allegiance td:first-child {
.user-info-logout:hover {
color: #ff6b6b;
}
/* ---------- Combat Stats window ---------- */
.combat-stats-toggle {
padding: 2px 10px;
font-size: 0.75rem;
background: #2a2a2a;
color: #aaa;
border: 1px solid #555;
cursor: pointer;
border-radius: 3px;
}
.combat-stats-toggle.active {
background: #3a5070;
color: #fff;
border-color: #5588bb;
}