diff --git a/packages/patcher/src/tech-tree/reveal-hidden-vehicles.ts b/packages/patcher/src/tech-tree/reveal-hidden-vehicles.ts index 8237776..50be1a1 100644 --- a/packages/patcher/src/tech-tree/reveal-hidden-vehicles.ts +++ b/packages/patcher/src/tech-tree/reveal-hidden-vehicles.ts @@ -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; }