Seed new saves and reveal hidden vehicles in the tech tree
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:
1 parent
2fc28dd7a5
commit
8b31277c58
12 files changed
+282
-12
No files matched your search
@@ -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;
|
||||
}
|
||||
Reference in new issue
Block a user