using System.ComponentModel.DataAnnotations; namespace DorkNet.Server.Data.Entities; /// /// One leaderboard stat row per (room, player, statChannel). Backs /// api/Leaderboard/v1/SetStats + api/Leaderboard/v2/getPlayerRank. /// /// The 2020 watch's RecNet.Leaderboards uses an int channel /// id (e.g. 1=PaintballWins, 2=DodgeballHits, etc.) and a single /// long value per channel. A player's "rank" is computed as /// 1 + count(*) of rows in the same channel with a higher /// value. /// public class LeaderboardStatEntity { public long Id { get; set; } public long PlayerId { get; set; } /// Room the score was reported from. The same stat channel /// id is reused by different rooms, so room scope is part of the /// leaderboard identity. 0 means legacy/global/unscoped. public long RoomId { get; set; } /// RecNet stat channel id (small int per game mode + /// stat type — e.g. paintball-CTF-wins, dodgeball-hits). public int StatChannel { get; set; } /// Aggregate stat value. Set semantics depend on /// : 0=Always, 1=OnlyIfHigher, 2=OnlyIfLower, /// 3=Increment. Most stat channels are mode 1 (high score). public long Value { get; set; } public DateTime UpdatedAt { get; set; } = DateTime.UtcNow; } /// /// Match-result Elo per (player, game mode). Backs /// api/PlayerElo/v1/reportPlayerElo. The 2020 watch reports /// an Elo delta after each ranked match (Royale, Paintball, /// Soccer); we accumulate it per game mode for matchmaking. /// public class PlayerEloEntity { public long Id { get; set; } public long PlayerId { get; set; } /// RecNet game mode id (small int). We don't enumerate /// these; the wire just sends an int and we pass it through. public int GameMode { get; set; } /// Current Elo. Default 1000 on first row. public int Elo { get; set; } = 1000; public int Wins { get; set; } public int Losses { get; set; } public int MatchesPlayed { get; set; } public DateTime UpdatedAt { get; set; } = DateTime.UtcNow; }