refactor(controllers): migrate practice/story/item_purchase to MissionEventKeys
PracticeController.Finish now uses MissionEventKeys.Practice.WinAll — the counter keys emitted match the catalog's named form (practice_win:elite:arisa etc.), closing the numeric-vs-named mismatch that had all practice-elite achievements silently at zero. Also removes the "bridging is a follow-up" TODO. StoryController.Finish uses MissionEventKeys.Story.ChapterFinishAll for the same shape. ItemPurchaseController.CounterKey routes through MissionEventKeys.ItemPurchase so the "item_purchase:" prefix has one owner. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -4,6 +4,7 @@ using SVSim.Database.Enums;
|
||||
using SVSim.EmulatedEntrypoint.Models.Dtos;
|
||||
using SVSim.Database.Repositories.Globals;
|
||||
using SVSim.Database.Repositories.Viewer;
|
||||
using SVSim.Database.Services;
|
||||
using SVSim.Database.Services.BattleXp;
|
||||
using SVSim.EmulatedEntrypoint.Models.Dtos.Requests;
|
||||
using SVSim.EmulatedEntrypoint.Models.Dtos.Requests.Common;
|
||||
@@ -109,18 +110,15 @@ public class PracticeController : SVSimController
|
||||
};
|
||||
}
|
||||
|
||||
// Mission/achievement progress hook. Catalog rows for practice_win achievements use
|
||||
// opponent NAMES (e.g. "practice_win:elite:arisa") — we only have numeric class_id /
|
||||
// difficulty here, so we emit numeric forms. Bridging numeric→name to match captured
|
||||
// catalog rows is a follow-up; the infrastructure is in place.
|
||||
// Mission/achievement progress hook. Wire values (difficulty int, enemy_class_id int)
|
||||
// are mapped to catalog-facing names by MissionEventKeys.Practice — the catalog
|
||||
// authors keys like "practice_win:elite:arisa", so the emitter must match. Wire
|
||||
// difficulties outside 4/6/7 (elite/elite2/elite3) only advance the top-level counter.
|
||||
if (isWin)
|
||||
{
|
||||
await _missionProgress.RecordEventAsync(viewerId, new[]
|
||||
{
|
||||
"practice_win",
|
||||
$"practice_win:{request.Difficulty}",
|
||||
$"practice_win:{request.Difficulty}:{request.EnemyClassId}",
|
||||
});
|
||||
await _missionProgress.RecordEventAsync(
|
||||
viewerId,
|
||||
MissionEventKeys.Practice.WinAll(request.Difficulty, request.EnemyClassId));
|
||||
}
|
||||
|
||||
int gainXp = 0, totalXp = 0, level = 1;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using SVSim.Database.Entities.Story;
|
||||
using SVSim.Database.Services;
|
||||
using SVSim.EmulatedEntrypoint.Models.Dtos.Story;
|
||||
using SVSim.EmulatedEntrypoint.Services;
|
||||
|
||||
@@ -83,12 +84,8 @@ public class StoryController : SVSimController
|
||||
};
|
||||
if (prefix is not null && req.StoryId != 0)
|
||||
{
|
||||
await _missionProgress.RecordEventAsync(vid, new[]
|
||||
{
|
||||
"story_chapter_finish",
|
||||
$"story_chapter_finish:{prefix}",
|
||||
$"story_chapter_finish:{prefix}:{req.StoryId}",
|
||||
});
|
||||
await _missionProgress.RecordEventAsync(
|
||||
vid, MissionEventKeys.Story.ChapterFinishAll(prefix, req.StoryId));
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
Reference in New Issue
Block a user