Implement vehicle research and purchases
Recompute unlocked ranks, prerequisites, and unit states before serving profiles. Add research target selection, research conversion, vehicle and slot purchases, and the price table. Support editing convertible RP and restrict hidden vehicle visibility to eligible entries. The client still displays zero purchase prices pending price table integration.
This commit is contained in:
1 parent
8b31277c58
commit
7a08fff85e
37 files changed
+1336
-75
No files matched your search
@@ -1,36 +1,31 @@
|
||||
/**
|
||||
* 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).
|
||||
* Show the tech-tree vehicles the live game hides until they are researched or on sale (user
|
||||
* quote 98: 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.
|
||||
* showOnlyWhenResearch:b until the player researches it (2.61.0.37: 22
|
||||
* vehicles, among them the Maus and the Panther II)
|
||||
* showOnlyWhenAvailableForPurchase:b except while a promotion sells it (74 premium vehicles)
|
||||
* showOnlyWhenBought:b unless the player owns it (208)
|
||||
* The first two are removed, so the stock rule shows those vehicles.
|
||||
*
|
||||
* 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.
|
||||
* showOnlyWhenBought stays: it marks vehicles that are not part of the tree for anyone who has
|
||||
* not been given them: event and promotion prizes, mission copies of tree vehicles (nt_f_4e,
|
||||
* f_4e_event ...), the drones of the premium columns, the floatplanes that come with ships,
|
||||
* and the launchers of the split air-defence systems (lab round 20, user feedback).
|
||||
*/
|
||||
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';
|
||||
const HIDING_FLAGS = new Set(['showOnlyWhenResearch', 'showOnlyWhenAvailableForPurchase']);
|
||||
|
||||
/** 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;
|
||||
for (const entry of shopEntries(shop)) {
|
||||
const kept = entry.params.filter((param) => !HIDING_FLAGS.has(param.name));
|
||||
if (kept.length === entry.params.length) continue;
|
||||
entry.params = kept;
|
||||
|
||||
Reference in new issue
Block a user