Skip to content

feature: Player Management counts assists, headshots, damage, rounds and MVPs for the community stats - #282

Merged
lukepolo merged 15 commits into
mainfrom
feature/community-more-counters
Nov 2, 2026
Merged

lukepolo merged 15 commits into
mainfrom
feature/community-more-counters

Conversation

@Flegma

@Flegma Flegma commented Oct 30, 2026 •

Copy link
Copy Markdown
Collaborator

Player Management counts the stats that 5stackgg/api#886 stores. Stacked on #281 (merge that first).

What

  • PlayerRoster.cs: each connection keeps running assists, headshots, damage, rounds played, rounds won and MVPs, reset with a new conn like kills and deaths, and carried on departed entries. Died(victim, killer, warmup, assister, headshot), Hurt, RoundEnded, Mvp, all under the roster lock. Each takes a required warmup flag and drops the event when it is set.
  • PlayerSanction.cs: the six fields on RosterPlayer and DepartedPlayer (snake_case, ignored by older panels).
  • Both plugins (SwiftlyS2 and CounterStrikeSharp) hook player_death (flash assists excluded, headshot only on a counted kill), player_hurt (enemy damage only, a lethal hit capped at the victim's remembered health), player_spawn (forgets that health), round_end (skips Game_Commencing) and round_mvp.
  • Nothing done in warmup counts: kills, deaths, assists, headshots, damage, MVPs and rounds. Each hook reads the game rules' WarmupPeriod at the event, so no warmup convar is read, and it holds for any warmup length, mp_warmup_end or a paused warmup. Unreadable rules count as live, as on a server without warmup. Kills and deaths counted in warmup before this PR.

Open points from review

  • Health raised without a hurt event (an HP refill plugin) under-credits the next lethal hit, the same limit the match plugin has.
  • Check live whether a round_end at the end of warmup counts a phantom round.

Tests

apps/player-management-sw/test: 158/158 (one new test for warmup) in mcr.microsoft.com/dotnet/sdk:10.0. Both plugins build.

…e map, so the panel can keep a map's last kills on that map

The roster sends the counts it had when a map ended in a sync of its
own, before it holds through the map change, and every sync names the
map. A map-end report the panel misses is sent again, and given up
after the hold cap so it cannot hold up the reports after it. Panels
that predate per-map sessions ignore the map.
…nd the map is read from the map load event

A roster that changed over the map change differed from the pending
report on every poll, so each poll became a sync until the report was
taken. The map name now comes with SwiftlyS2's map load event, and a
plugin only asks the engine for it on a hot reload, where it has missed
that event and the engine has a map to answer with.
…and MVPs for the community stats

Each connection now keeps running totals of assists, headshots, damage,
rounds played, rounds won and MVPs next to its kills and deaths, and
sends them on the roster and with every departure. Flash assists, team
damage and warmup rounds do not count, a headshot only counts with a
counted kill, and a lethal hit is credited only with the health the
victim had left. Panels that predate the counters ignore them.
Kills, deaths, assists, headshots, damage and MVPs are now dropped while
the game rules say warmup is on, the same way warmup rounds already
were. The flag is read at each event, so it holds however long warmup
runs and however it ends; a server without warmup counts everything.
@Flegma
Flegma marked this pull request as ready for review October 30, 2026 10:17
…end report, and a kill during the hold stays out of it
… next round's start, so a second round end before then adds nothing
…cks the new map's roster, not the snapshot taken at the map's end
…oo, so it closes the round's MVP like any other
Base automatically changed from feature/community-session-map to main November 2, 2026 14:10
…e-counters

# Conflicts:
#	apps/player-management-css/src/PlayerManagementPlugin.cs
#	apps/player-management-sw/src/PlayerManagementPlugin.cs
#	apps/player-management-sw/test/PlayerRosterTests.cs
#	shared/dotnet/FiveStack.Utilities/PlayerRoster.cs
… side they spawned on, so sitting on a side or joining the winning one farms no rounds
…they claim, and leaving a side or the game restarting forgets it
@lukepolo
lukepolo merged commit 24afe56 into main Nov 2, 2026
7 of 8 checks passed
@lukepolo
lukepolo deleted the feature/community-more-counters branch November 2, 2026 15:48
lukepolo added a commit that referenced this pull request Nov 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants