Files
WT-Offline/packages/build/src/features/offline-features.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

41 lines
1.9 KiB
TypeScript

/**
* Game features (feature flags) the offline version turns on for every player.
*
* char.vromfs.bin config/game_settings.blk lists features as features{ <name>{ condition:t } };
* condition:t="" means every player has it (the UI scripts ask with hasFeature, which falls
* back to the native local_player_has_feature, scripts/user/features.nut).
*
* AllowedToSkipBaseTutorials / AllowedToSkipBaseTankTutorials: let the player skip or close
* every branch's base tutorial offer. `scripts/tutorials/tutorialsData.nut` gates air and naval
* base tutorials on `AllowedToSkipBaseTutorials` and ground base tutorials (`lightTank`,
* `lightTank_action`) on `AllowedToSkipBaseTankTutorials`; without both, `NextTutorialHandler`
* hides its "do not ask me again" checkbox and close button until the tutorial is started once.
*
* PaymentMethods: lets scripts/onlineShop/onlinePurchase.nut offer GJN payment directly
* inside the Golden Eagles and Premium Account windows (stock game_settings.blk restricts it
* with PS4Access; implementation notes).
*/
import { ensureBlock, setParam, type BlkBlock } from '@wto/blk';
export const GAME_SETTINGS_PATH = 'config/game_settings.blk';
export const OFFLINE_FEATURES: readonly string[] = [
'AllowedToSkipBaseTutorials',
'AllowedToSkipBaseTankTutorials',
'PaymentMethods',
];
/** Give every player the features; returns the ones that were not on for everyone before. */
export function enableFeaturesForEveryone(gameSettings: BlkBlock, names: readonly string[]): string[] {
const features = ensureBlock(gameSettings, 'features');
const changed: string[] = [];
for (const name of names) {
const feature = ensureBlock(features, name);
const condition = feature.params.find((param) => param.name === 'condition')?.value;
if (condition?.type === 'string' && condition.value === '') continue;
setParam(feature, 'condition', { type: 'string', value: '' });
changed.push(name);
}
return changed;
}