fix(training): persist tutorial completions and grant first-time rewards
On returning from a stock training mission, the client reports the outcome in cln_update under missionAwards while sending an empty pveProgress block. Because the local server did not record this completion, the hangar repeated tutorial prompts after restart and never credited first-completion rewards. Add a cached training-missions dataset (config/mislist.blk, config/pve_awards.blk, config/unlocks.blk), pure completion rules in TrainingCatalogue, and missionAwards parsing in clientUpdateAction. Completed tutorials now persist pveProgress/missions and grant per-mission decals, the shared first-basic-tutorial Golden Eagles unlock, and per-difficulty first-win Silver Lions once per account during cln_update before replying. Credit to duduyagame for identifying the cln_update missionAwards reporting flow and stock reward definitions (PR #6). Checks: root `npm run typecheck` passed; verified training-missions dataset extraction/caching and TrainingCatalogue idempotency against read-only stock 2.61.0.37 files in a temporary data folder. In-game acceptance pending on an isolated client copy. Co-authored-by: duduyagame <[email protected]>
This commit is contained in:
1 parent
42b8275151
commit
4e99d2c484
6 files changed
+240
-8
No files matched your search
@@ -17,12 +17,20 @@
|
||||
* script function get_mission_progress (0x179c900 -> 0xebad60) looks up. It returns the
|
||||
* highest difficulty completed (0, 1, 2), or 3 or more when there is none.
|
||||
*/
|
||||
import { ensureBlock, setParam, type BlkBlock } from '@wto/blk';
|
||||
import { ensureBlock, findBlock, findParam, setParam, type BlkBlock } from '@wto/blk';
|
||||
|
||||
const PVE_PROGRESS = 'pveProgress';
|
||||
const MISSIONS = 'missions';
|
||||
const DIFFICULTIES = [0, 1, 2] as const;
|
||||
|
||||
export function hasCompletedMissionDifficulty(profile: BlkBlock, fullMissionName: string, difficulty: 0 | 1 | 2): boolean {
|
||||
const pve = findBlock(profile, PVE_PROGRESS);
|
||||
const missions = pve && findBlock(pve, MISSIONS);
|
||||
const mission = missions && findBlock(missions, fullMissionName);
|
||||
const flag = mission && findParam(mission, `diff_${difficulty}`)?.value;
|
||||
return flag?.type === 'bool' && flag.value;
|
||||
}
|
||||
|
||||
/** Record the mission as completed on every difficulty up to and including `highest` (0, 1 or 2). */
|
||||
export function recordMissionCompleted(profile: BlkBlock, fullMissionName: string, highest: 0 | 1 | 2): void {
|
||||
const entry = ensureBlock(ensureBlock(ensureBlock(profile, PVE_PROGRESS), MISSIONS), fullMissionName);
|
||||
|
||||
Reference in new issue
Block a user