fix(patcher): strip cross-promo locks so promo gift vehicles can be ordered

Strip isCrossPromo and crossPromoBanner from config/shop.blk entries alongside tech-tree hiding flags so cross-promotion gift vehicles (bf-109c_1_promo, us_m4_sherman_promo, jp_destroyer_hatsuzuki) can be ordered directly through their generated local store packs while keeping showOnlyWhenBought intact.
This commit is contained in:
N0VAN0M4LY committed 2026-12-04 19:55:03 +08:00
1 parent f2e73c1cfe
commit 48f01b533e
1 file changed
+28 -4
@@ -15,21 +15,45 @@
* 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).
*
* Cross-promotion gift vehicles (e.g. us_m4_sherman_promo, bf-109c_1_promo,
* jp_destroyer_hatsuzuki) also carry `isCrossPromo:b` and `crossPromoBanner:t`. When
* `isCrossPromo` is true, stock client scripts (availabilitybuyonline.nut, unitcontextmenu.nut,
* slotactions.nut) hide the "Order" action and show a cross-promo locked banner instead of
* routing to the local store pack and bundle GUID generated for gift vehicles. Both parameters
* are stripped here so those vehicles can be ordered directly from the tech tree.
*/
import type { BlkBlock } from '@wto/blk';
export const SHOP_PATH = 'config/shop.blk';
const HIDING_FLAGS = new Set(['showOnlyWhenResearch', 'showOnlyWhenAvailableForPurchase']);
const CROSS_PROMO_PARAMS = new Set(['isCrossPromo', 'crossPromoBanner']);
/** Remove the hiding flags in place; returns how many vehicles were hidden before. */
/**
* Remove tech-tree hiding flags and cross-promo lock parameters in place.
* Returns how many vehicles had a hiding flag removed (cross-promo unlocks are not counted).
*/
export function revealHiddenVehicles(shop: BlkBlock): number {
let revealed = 0;
for (const entry of shopEntries(shop)) {
const kept = entry.params.filter((param) => !HIDING_FLAGS.has(param.name));
if (kept.length === entry.params.length) continue;
let wasHidden = false;
let stripped = false;
const kept = entry.params.filter((param) => {
if (HIDING_FLAGS.has(param.name)) {
wasHidden = true;
stripped = true;
return false;
}
if (CROSS_PROMO_PARAMS.has(param.name)) {
stripped = true;
return false;
}
return true;
});
if (!stripped) continue;
entry.params = kept;
revealed++;
if (wasHidden) revealed++;
}
return revealed;
}