Set initial Silver Lions and Golden Eagles balances and add a save editing command. Open rank I for each nation and branch and migrate older saves to format 3. Reveal eligible hidden vehicles while keeping split air-defense launchers out of the tech tree. Document the currency, rank, and unit status fields observed in the offline client.
34 lines
1.6 KiB
TypeScript
34 lines
1.6 KiB
TypeScript
/**
|
|
* Rebuild char.vromfs.bin: config/network.blk pointed at the local service, the offline
|
|
* version's features turned on in config/game_settings.blk, and every vehicle shown in the
|
|
* tech tree (config/shop.blk).
|
|
*/
|
|
import { enableFeaturesForEveryone, GAME_SETTINGS_PATH, OFFLINE_FEATURES } from './features/offline-features.ts';
|
|
import type { LocalEndpoint } from './network/local-endpoint.ts';
|
|
import { redirectNetworkConfig, type NetworkRedirectReport } from './network/redirect-network-config.ts';
|
|
import { editPackBlks } from './pack-edit.ts';
|
|
import { revealHiddenVehicles, SHOP_PATH } from './tech-tree/reveal-hidden-vehicles.ts';
|
|
|
|
export const NETWORK_CONFIG_PATH = 'config/network.blk';
|
|
|
|
export interface CharPackResult {
|
|
readonly pack: Uint8Array;
|
|
readonly network: NetworkRedirectReport;
|
|
/** Features that are now on for every player. */
|
|
readonly features: readonly string[];
|
|
/** Vehicles that were hidden from players who had not researched or bought them. */
|
|
readonly revealedVehicles: number;
|
|
}
|
|
|
|
export function rebuildCharPack(stockPack: Uint8Array, endpoint: LocalEndpoint): CharPackResult {
|
|
let network: NetworkRedirectReport | undefined;
|
|
let features: string[] = [];
|
|
let revealedVehicles = 0;
|
|
const pack = editPackBlks(stockPack, [
|
|
{ path: NETWORK_CONFIG_PATH, edit: (root) => { network = redirectNetworkConfig(root, endpoint); } },
|
|
{ path: GAME_SETTINGS_PATH, edit: (root) => { features = enableFeaturesForEveryone(root, OFFLINE_FEATURES); } },
|
|
{ path: SHOP_PATH, edit: (root) => { revealedVehicles = revealHiddenVehicles(root); } },
|
|
]);
|
|
return { pack, network: network!, features, revealedVehicles };
|
|
}
|