feat(mission): wire Tier 1 emits — rank/free/challenge match events
Adds IMissionProgressService to RankBattle, FreeBattle, ArenaTwoPickBattle, and ArenaTwoPick controllers. Each finish handler emits the appropriate MissionEventKeys builder result: - RankBattle.Finish (win) → Ranked.WinAll(classId) Includes AI-rank routes; on a private server AI wins count the same. - FreeBattle.Finish (win) → Free.WinAll() (aggregates only) - ArenaTwoPickBattle.Finish → Challenge.MatchPlayAll or MatchWinAll Always fires challenge_play; wins additionally fire challenge_win and the ranked/arena/daily aggregates. - ArenaTwoPick.Finish (5-win full clear) → Challenge.FullClearAll Gated on RunFinishOutcome.WasFullClear from the previous commit. This closes six of the eight remaining catalog wire-up gaps; class_level_up and rank_achieved follow in Tier 2 (need pre-state detection). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using SVSim.Database.Services;
|
||||
using SVSim.EmulatedEntrypoint.Models.Dtos.Requests.ArenaTwoPick;
|
||||
using SVSim.EmulatedEntrypoint.Services;
|
||||
|
||||
@@ -8,7 +9,13 @@ namespace SVSim.EmulatedEntrypoint.Controllers;
|
||||
public class ArenaTwoPickController : SVSimController
|
||||
{
|
||||
private readonly IArenaTwoPickService _svc;
|
||||
public ArenaTwoPickController(IArenaTwoPickService svc) => _svc = svc;
|
||||
private readonly IMissionProgressService _missionProgress;
|
||||
|
||||
public ArenaTwoPickController(IArenaTwoPickService svc, IMissionProgressService missionProgress)
|
||||
{
|
||||
_svc = svc;
|
||||
_missionProgress = missionProgress;
|
||||
}
|
||||
|
||||
[HttpPost("top")]
|
||||
public async Task<IActionResult> Top([FromBody] TopRequest _)
|
||||
@@ -46,12 +53,17 @@ public class ArenaTwoPickController : SVSimController
|
||||
}
|
||||
|
||||
[HttpPost("finish")]
|
||||
public async Task<IActionResult> Finish([FromBody] FinishRequest _)
|
||||
public async Task<IActionResult> Finish([FromBody] FinishRequest _, CancellationToken ct = default)
|
||||
{
|
||||
if (!TryGetViewerId(out var vid)) return Unauthorized();
|
||||
return await GuardAsync(async () =>
|
||||
{
|
||||
var outcome = await _svc.FinishAsync(vid);
|
||||
if (outcome.WasFullClear)
|
||||
{
|
||||
await _missionProgress.RecordEventAsync(
|
||||
vid, MissionEventKeys.Challenge.FullClearAll(), ct: ct);
|
||||
}
|
||||
return outcome.Response;
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user