Files
WT-Offline/packages/local-service/src/profile/starting-content.ts
T
N0VAN0M4LY 98812fa9c2 feat(store): add store and marketplace item views and image sources
Add catalogue filters, item detail views, and purchase and resale
actions. Resolve images from the player's asset pack, public image
URLs, or local game data. Add a utility for creating the optional
local asset pack.

Type checking and JavaScript syntax checks passed. Embedded browser
appearance and in-game behavior still need acceptance.
2026-11-26 07:12:38 +08:00

51 lines
2.8 KiB
TypeScript

/**
* What every account starts with besides Gaijin's new-account template
* (config/default_user.blk), which owns only reserve aircraft and opens no rank.
*
* - Every reserve vehicle of every country and branch (aircraft, ground vehicles, boats,
* ships), as accounts have them online. The stock first-choice window and the slotbar
* only offer reserve vehicles the player owns (scripts/slotbar/slotbarStateData.nut
* checkReserveUnit: isBought), so without them a new player only has aircraft.
* - Rank I open for research in every country's branches (profile-eras.ts), as online;
* this allows research to start immediately. Higher ranks open through
* research.
* - The base tutorials that gate a difficulty count as completed on every difficulty, so no
* game mode requires a tutorial first. The tutorials remain playable.
* The stock rule (gui.vromfs.bin scripts/tutorials/tutorialsState.nut isDiffUnlocked)
* locks historical and simulator battles for a vehicle type until the player has either
* played 60 s in one of them or completed the type's required tutorial on that difficulty;
* the required tutorials are the table reqTutorial there (2.61.0.37: aircraft only,
* tutorialB_takeoff_and_landing, chapter "tutorial" in char.vromfs.bin config/mislist.blk
* block "training").
*
* Applying it again changes nothing, so it also brings older saves up to date
* (profile-upgrades.ts). The starting money is only for new accounts (new-profile.ts).
*/
import type { Balance } from './profile-currency.ts';
import type { BlkBlock } from '@wto/blk';
import type { ReserveVehicle } from '../game-data/datasets/reserve-vehicles.ts';
import type { ShopBranches } from '../game-data/datasets/shop-branches.ts';
import { vehicleTypeOfBranch } from '../research/vehicle-types.ts';
import { openRanksUpTo } from './profile-eras.ts';
import { addOwnedVehicle } from './profile-hangar.ts';
import { recordMissionCompleted } from './profile-mission-progress.ts';
const DIFFICULTY_GATING_TUTORIALS = ['tutorial/tutorialB_takeoff_and_landing'] as const;
const HIGHEST_DIFFICULTY = 2;
const FIRST_RANK = 1;
export interface StartingContent {
readonly reserveVehicles: readonly ReserveVehicle[];
readonly branches: ShopBranches;
/** Starting money (tuning/new-profile.jsonc). */
readonly startingBalance: Balance;
}
export function applyStartingContent(profile: BlkBlock, content: StartingContent): void {
for (const vehicle of content.reserveVehicles) addOwnedVehicle(profile, vehicle.name);
for (const [country, branches] of Object.entries(content.branches)) {
for (const branch of branches) openRanksUpTo(profile, country, vehicleTypeOfBranch(branch), FIRST_RANK);
}
for (const tutorial of DIFFICULTY_GATING_TUTORIALS) recordMissionCompleted(profile, tutorial, HIGHEST_DIFFICULTY);
}