Files
WT-Offline/packages/local-service/src/profile/profile-mission-progress.ts
T
N0VAN0M4LY ed0136f5fc feat(crew): add crew presets and grant reserve vehicles
Derive reserve vehicles from the stock economy data. Grant all reserves
and mark the basic takeoff and landing tutorials complete in new saves.
Apply the same grants through the format 2 migration.

Use shared crew slot rules for first-run selection, presets, training,
assignment, and removal.
2026-11-24 14:18:02 +08:00

33 lines
1.5 KiB
TypeScript

/**
* Mission completion in the profile: which difficulties the player has completed a mission
* on (tutorials and other single-player missions).
*
* pveProgress{
* missions{
* "tutorial/tutorialB_takeoff_and_landing"{ diff_0:b=yes diff_1:b=yes diff_2:b=yes }
* }
* }
*
* Read by the client's profile serializer (aces.exe 2.61.0.37 0x92bd40: "pveProgress" ->
* "missions", one sub-block per mission, 0x92f090), each entry by 0x92f7d0:
* onlineDiff:i, singleDiff:i optional, -1 when missing
* timesCompleted:i, timesPlayed:i optional, 0 when missing
* diff_0:b, diff_1:b, diff_2:b completed on arcade, historical, simulator
* The entry's name is the mission's full name, "<chapter>/<mission>", the key that the
* 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';
const PVE_PROGRESS = 'pveProgress';
const MISSIONS = 'missions';
const DIFFICULTIES = [0, 1, 2] as const;
/** 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);
for (const difficulty of DIFFICULTIES) {
if (difficulty <= highest) setParam(entry, `diff_${difficulty}`, { type: 'bool', value: true });
}
}