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.EmulatedEntrypoint.Models.Dtos;
|
||||||
using SVSim.Database.Repositories.Globals;
|
using SVSim.Database.Repositories.Globals;
|
||||||
using SVSim.Database.Repositories.Viewer;
|
using SVSim.Database.Repositories.Viewer;
|
||||||
|
using SVSim.Database.Services;
|
||||||
using SVSim.Database.Services.BattleXp;
|
using SVSim.Database.Services.BattleXp;
|
||||||
using SVSim.EmulatedEntrypoint.Models.Dtos.Requests;
|
using SVSim.EmulatedEntrypoint.Models.Dtos.Requests;
|
||||||
using SVSim.EmulatedEntrypoint.Models.Dtos.Requests.Common;
|
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
|
// Mission/achievement progress hook. Wire values (difficulty int, enemy_class_id int)
|
||||||
// opponent NAMES (e.g. "practice_win:elite:arisa") — we only have numeric class_id /
|
// are mapped to catalog-facing names by MissionEventKeys.Practice — the catalog
|
||||||
// difficulty here, so we emit numeric forms. Bridging numeric→name to match captured
|
// authors keys like "practice_win:elite:arisa", so the emitter must match. Wire
|
||||||
// catalog rows is a follow-up; the infrastructure is in place.
|
// difficulties outside 4/6/7 (elite/elite2/elite3) only advance the top-level counter.
|
||||||
if (isWin)
|
if (isWin)
|
||||||
{
|
{
|
||||||
await _missionProgress.RecordEventAsync(viewerId, new[]
|
await _missionProgress.RecordEventAsync(
|
||||||
{
|
viewerId,
|
||||||
"practice_win",
|
MissionEventKeys.Practice.WinAll(request.Difficulty, request.EnemyClassId));
|
||||||
$"practice_win:{request.Difficulty}",
|
|
||||||
$"practice_win:{request.Difficulty}:{request.EnemyClassId}",
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int gainXp = 0, totalXp = 0, level = 1;
|
int gainXp = 0, totalXp = 0, level = 1;
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using SVSim.Database.Entities.Story;
|
using SVSim.Database.Entities.Story;
|
||||||
|
using SVSim.Database.Services;
|
||||||
using SVSim.EmulatedEntrypoint.Models.Dtos.Story;
|
using SVSim.EmulatedEntrypoint.Models.Dtos.Story;
|
||||||
using SVSim.EmulatedEntrypoint.Services;
|
using SVSim.EmulatedEntrypoint.Services;
|
||||||
|
|
||||||
@@ -83,12 +84,8 @@ public class StoryController : SVSimController
|
|||||||
};
|
};
|
||||||
if (prefix is not null && req.StoryId != 0)
|
if (prefix is not null && req.StoryId != 0)
|
||||||
{
|
{
|
||||||
await _missionProgress.RecordEventAsync(vid, new[]
|
await _missionProgress.RecordEventAsync(
|
||||||
{
|
vid, MissionEventKeys.Story.ChapterFinishAll(prefix, req.StoryId));
|
||||||
"story_chapter_finish",
|
|
||||||
$"story_chapter_finish:{prefix}",
|
|
||||||
$"story_chapter_finish:{prefix}:{req.StoryId}",
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|||||||
Reference in New Issue
Block a user