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

30
Migrations/002_Events.sql Normal file
View file

@ -0,0 +1,30 @@
-- One row per kill, bomb plant and bomb defuse, written as it happens (0.2.0+). Nothing during
-- warmup. Kills leave out suicides and team kills.
-- kind: 1 kill, 2 bomb planted, 3 bomb defused. steamid64 is who did it: the killer, planter or
-- defuser. The kill-only columns are NULL for plants and defuses, and site is NULL for kills.
-- victim_steamid64 is NULL when the victim was a bot (victim_bot 1).
CREATE TABLE IF NOT EXISTS `pt_events` (
`id` bigint unsigned NOT NULL AUTO_INCREMENT,
`event_key` char(32) NOT NULL,
`server_id` int NOT NULL,
`session_key` char(32) NULL,
`steamid64` bigint unsigned NOT NULL,
`kind` tinyint NOT NULL,
`at` datetime NOT NULL,
`map` varchar(64) NOT NULL,
`team` tinyint NOT NULL,
`weapon` varchar(64) NULL,
`headshot` tinyint NULL,
`noscope` tinyint NULL,
`thrusmoke` tinyint NULL,
`wallbang` tinyint NULL,
`blind` tinyint NULL,
`victim_steamid64` bigint unsigned NULL,
`victim_bot` tinyint NULL,
`site` int NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `uq_event_key` (`event_key`),
KEY `ix_kind_at` (`kind`, `at`),
KEY `ix_steamid_at` (`steamid64`, `at`),
KEY `ix_at` (`at`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;