Files
WT-Offline/apps/server/src/profile/profile-upgrades.ts
T
N0VAN0M4LY d58ba9fb9b feat(saves)!: add offline crew editing
Add per-country crew slot controls and skill level previews to the launcher. Keep archived crews and their stable IDs in the save, update affected lineups, and back up the save before closing a slot.

Verified with both type checks, the launcher build, 2.61.0.64 patch checks, and temporary save read and write checks.

BREAKING CHANGE: The launcher automatically upgrades existing saves to format 4. Keep a pre-upgrade backup to use a save with an older launcher.
2026-12-06 15:34:24 +08:00

23 lines
1.1 KiB
TypeScript

/**
* The save format's upgrade steps (saves/save-upgrades.ts), in version order. A later change
* to what saves hold adds a new step; released steps are not removed.
*/
import { ensureBlock } from '@wto/blk';
import { SaveUpgrades } from '../saves/save-upgrades.ts';
import { CLOSED_CREWS } from './profile-crews.ts';
import { applyStartingContent, type StartingContent } from './starting-content.ts';
export function profileUpgrades(content: StartingContent): SaveUpgrades {
// Applying the starting content is idempotent, so each step brings the save up to the
// starting content of this release.
const addStartingContent = (profile: Parameters<typeof applyStartingContent>[0]): void => applyStartingContent(profile, content);
return new SaveUpgrades([
// 1 -> 2: reserve vehicles of every branch, completed difficulty-gating tutorials.
addStartingContent,
// 2 -> 3: rank I open in every branch.
addStartingContent,
// 3 -> 4: archive closed crew slots separately from active crews.
(profile) => { ensureBlock(profile, CLOSED_CREWS); },
]);
}