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:
@@ -2,6 +2,7 @@ namespace SOR.Game.Handlers;
|
||||
|
||||
using System.Text.Json;
|
||||
using SOR.Database.Contexts;
|
||||
using SOR.Networking.Abstractions.EventBus;
|
||||
using SOR.Networking.Abstractions.Messaging;
|
||||
using SOR.Networking.Abstractions.Push;
|
||||
using SOR.Networking.Abstractions.Transport;
|
||||
@@ -16,17 +17,20 @@ internal sealed class GameConcedeHandler : GameHandlerBase, IMessageHandler
|
||||
private readonly GameDbContext _gameDb;
|
||||
private readonly SorIdentityDbContext _identityDb;
|
||||
private readonly IClientPush _clientPush;
|
||||
private readonly IEventBus _eventBus;
|
||||
|
||||
public GameConcedeHandler(
|
||||
IMessageSerializer serializer,
|
||||
GameDbContext gameDb,
|
||||
SorIdentityDbContext identityDb,
|
||||
IClientPush clientPush)
|
||||
IClientPush clientPush,
|
||||
IEventBus eventBus)
|
||||
{
|
||||
_serializer = serializer;
|
||||
_gameDb = gameDb;
|
||||
_identityDb = identityDb;
|
||||
_clientPush = clientPush;
|
||||
_eventBus = eventBus;
|
||||
}
|
||||
|
||||
public string MessageType => "game.concede";
|
||||
@@ -52,7 +56,7 @@ internal sealed class GameConcedeHandler : GameHandlerBase, IMessageHandler
|
||||
: session.PlayerOneAccountId;
|
||||
|
||||
await FinalizeGameAsync(
|
||||
_gameDb, _identityDb, _clientPush,
|
||||
_gameDb, _identityDb, _clientPush, _eventBus,
|
||||
session,
|
||||
winnerAccountId: winnerId,
|
||||
loserAccountId: Guid.Parse(actorId),
|
||||
|
||||
Reference in New Issue
Block a user