feat(saves): seed new saves and reveal eligible hidden vehicles

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.
This commit is contained in:
N0VAN0M4LY committed 2026-11-24 14:45:28 +08:00
1 parent ed0136f5fc
commit e5452e925f
12 files changed
+282 -12

No files matched your search

+9 -3
View File
@@ -1,11 +1,13 @@
/**
* Rebuild char.vromfs.bin: config/network.blk pointed at the local service, and the offline
* version's features turned on in config/game_settings.blk.
* 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';
@@ -14,14 +16,18 @@ export interface CharPackResult {
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 };
return { pack, network: network!, features, revealedVehicles };
}
+1
View File
@@ -49,6 +49,7 @@ function main(): number {
for (const change of charPack.network.addresses) console.log(` ${change.path}: ${change.before} -> ${change.after}`);
}
console.log(`game_settings.blk: features on for every player: ${charPack.features.join(', ') || '(already on)'}`);
console.log(`shop.blk: ${charPack.revealedVehicles} hidden vehicles shown in the tech tree`);
const mainPack = rebuildMainPack(readFileSync(join(values.game, GAME_FILES.mainPack)), endpoint);
console.log(`settings.blk: ${mainPack.addresses.length} address(es) now point to ${endpoint.host}:${endpoint.port}`);
@@ -0,0 +1,53 @@
/**
* Show every vehicle in the tech tree, including the ones the live game hides from players
* who have not researched or bought them (local verification: e.g. the German Maus and Panther II).
*
* char.vromfs.bin config/shop.blk: country -> branch -> column -> vehicle (grouped vehicles one
* level deeper). The stock UI hides a vehicle (gui.vromfs.bin scripts/unit/unit.nut
* isVisibleInShop) when its entry has
* showOnlyWhenResearch:b until the player researches it (2.61.0.37: 22 vehicles)
* showOnlyWhenBought:b until the player owns it (208)
* showOnlyWhenAvailableForPurchase:b except while a promotion sells it (74)
* Removing these flags lets the stock rule show them.
*
* Kept hidden:
* - the parts of split vehicles: a vehicle another entry names as its slaveUnit (2.61.0.37: the
* launchers of the 10 split air-defence systems) comes with its master vehicle and is not a
* vehicle of its own in the tech tree (local verification);
* - platform and language variants (showByPlatform, hideByPlatform, hideForLangs,
* hideFeature): they pick one of several versions of the same vehicle.
*/
import type { BlkBlock } from '@wto/blk';
export const SHOP_PATH = 'config/shop.blk';
const HIDING_FLAGS = new Set(['showOnlyWhenResearch', 'showOnlyWhenBought', 'showOnlyWhenAvailableForPurchase']);
const SLAVE_UNIT = 'slaveUnit';
/** Remove the hiding flags in place; returns how many vehicles were hidden before. */
export function revealHiddenVehicles(shop: BlkBlock): number {
const entries = shopEntries(shop);
const parts = new Set(entries.flatMap((entry) => entry.params.flatMap((param) => (param.name === SLAVE_UNIT && param.value.type === 'string' ? [param.value.value] : []))));
let revealed = 0;
for (const entry of entries) {
if (parts.has(entry.name)) continue;
const kept = entry.params.filter((param) => !HIDING_FLAGS.has(param.name));
if (kept.length === entry.params.length) continue;
entry.params = kept;
revealed++;
}
return revealed;
}
/** Every block below the countries: branches, columns, groups and vehicles. */
function shopEntries(shop: BlkBlock): BlkBlock[] {
const entries: BlkBlock[] = [];
const walk = (block: BlkBlock): void => {
for (const entry of block.blocks) {
entries.push(entry);
walk(entry);
}
};
for (const country of shop.blocks) walk(country);
return entries;
}