Feat: chat archiving + ranked OP rewards + admin award OP

- ChatChannel: add ArchivedAt (nullable DateTimeOffset)
- ChatChannelMembership.EndMatchMembershipsAsync: set channel.ArchivedAt
  so match channels are archived when games end
- GameHandlerBase.FinalizeGameAsync: add IEventBus param; compute
  OriginPoints rewards scaled by rank diff; publish GameEndedEvent so
  ChatLifecycleHostedService triggers archival
- GameRuleSet: add WinnerOpReward (50), LoserOpReward (10),
  RankDiffOpMultiplierPct (0) with NOT NULL + defaults
- GameMessages.GameOverPush: add WinnerOpDelta / LoserOpDelta fields
- GameConcedeHandler + GameAttackHandler: inject IEventBus, pass to
  FinalizeGameAsync
- Migrations: 20260309200000_AddArchivedAtToChatChannel (ChatDbContext),
  20260309210000_AddOpRewardFields (GameDbContext)
- Admin GameSessionsPage: inject ChatDbContext; purge Match channels
  before deleting sessions in PurgeAllAsync
- Admin RankedRulesPage: new "Origin Points Rewards" card with three
  number inputs (WinnerOpReward, LoserOpReward, RankDiffOpMultiplierPct)
- Admin AccountDetail: display RankScore + OriginPoints in Profile card;
  new "Award OP" card that credits OP directly to the account balance

Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
This commit is contained in:
dingo
2026-03-09 16:16:22 -04:00
co-authored by Claude Happy
parent c9f7c22bf0
commit 0600326db7
16 changed files with 848 additions and 9 deletions
@@ -49,6 +49,21 @@ public sealed class GameRuleSet
/// <summary>Battlefield height (rows). Default: 8.</summary>
public int BoardHeight { get; set; } = 8;
// ── Origin Points Rewards ─────────────────────────────────────────────────
/// <summary>OP awarded to the winner of a ranked game.</summary>
public int WinnerOpReward { get; set; } = 50;
/// <summary>OP awarded to the loser of a ranked game (consolation).</summary>
public int LoserOpReward { get; set; } = 10;
/// <summary>
/// Per-rank-point scaling for the OP award (in thousandths, i.e. 0 = flat).
/// adjustment = (loserRank − winnerRank) × RankDiffOpMultiplierPct / 1000.
/// Positive diff = winner was underdog → pays more. Negative = expected win → pays less.
/// </summary>
public int RankDiffOpMultiplierPct { get; set; } = 0;
// ── Timestamps ───────────────────────────────────────────────────────────
public DateTimeOffset CreatedAt { get; set; }