0.2.0: log kills, bomb plants and defuses as they happen; leave warmup out of match stats

This commit is contained in:
Astra 2026-10-04 21:36:31 +01:00
parent 905acd8f1d
commit bba0471f20
5 changed files with 144 additions and 9 deletions

14
Ops.cs
View file

@ -16,6 +16,7 @@ namespace PlaytimeHistory;
[JsonDerivedType(typeof(SegmentClose), "segment_close")]
[JsonDerivedType(typeof(Heartbeat), "heartbeat")]
[JsonDerivedType(typeof(OnlineSnapshot), "online_snapshot")]
[JsonDerivedType(typeof(EventRecord), "event")]
public abstract record Op;
public sealed record ServerSeen(int ServerId, string Address, string Hostname, DateTime At) : Op;
@ -47,6 +48,12 @@ public sealed record Heartbeat(int ServerId, DateTime At) : Op;
public sealed record OnlineSnapshot(int ServerId, DateTime At, int Players, int Bots, int MaxPlayers, string Map) : Op;
// A kill, bomb plant or bomb defuse, as it happens. The kill-only fields are null otherwise.
public sealed record EventRecord(
string EventKey, int ServerId, string? SessionKey, ulong SteamId, EventKind Kind, DateTime At, string Map, int Team,
string? Weapon = null, bool? Headshot = null, bool? Noscope = null, bool? Thrusmoke = null, bool? Wallbang = null,
bool? Blind = null, ulong? VictimSteamId = null, bool? VictimBot = null, int? Site = null) : Op;
public sealed record MatchStats(int Kills, int Deaths, int Assists, int Headshots, int Damage, int Mvp, int Score);
public sealed record PingStats(int Avg, int Min, int Max, int Samples);
@ -60,6 +67,13 @@ public enum EndKind
Stale = 4,
}
public enum EventKind
{
Kill = 1,
BombPlanted = 2,
BombDefused = 3,
}
public static class Teams
{
public const int None = 0;