Wrap the price table in the Common block

Use the block expected by the client to fix zero vehicle prices.
Document hangar settings, modification state, and price table paths.
This commit is contained in:
N0VAN0M4LY committed 2026-11-24 21:34:31 +08:00
1 parent 7a08fff85e
commit 56731efa76
1 file changed
+11 -4
@@ -3,18 +3,24 @@
*
* The client keeps the answer whole as its price table (aces.exe 2.61.0.37 0xeb7a88, job type
* 0x21; stored in the save-data object at +0x3f5c0, which warpoints::init makes the price
* source, 0x105bb4d..0x105bb67). wp_get_cost / wp_get_cost_gold (0x10514f0 / 0x1051900) look
* a vehicle up under aircrafts/<vehicle> (0x908a20) and read
* source, 0x105bb4d..0x105bb67). Every price reader goes through one lookup (0x908a20 ->
* 0x908d10): it first takes a top-level block named after a client-side string (default
* "English"), else the top-level block "Common", else finds nothing; the path is looked up
* inside that block. So the whole table sits in Common. wp_get_cost / wp_get_cost_gold
* (0x10514f0 / 0x1051900) use the path aircrafts/<vehicle> and read
* cost:i silver lions
* costGold:i golden eagles
* discount:i percent off (not sent: no discounts)
* A vehicle missing from the table costs 0 for the client, which then offers it at 0 (lab
* A vehicle the lookup does not find costs 0 for the client, which then offers it at 0 (lab
* round 20). The prices are config/wpcost.blk value and costGold, the same the purchase rule
* charges (vehicle-purchase.ts).
*/
import type { BlkBlock } from '@wto/blk';
import type { TechTree } from './tech-tree.ts';
/** The top-level block every client lookup falls back to (0x908e28). */
const COMMON_SECTION = 'Common';
export function priceTable(techTree: TechTree): BlkBlock {
const vehicles: BlkBlock[] = [];
for (const vehicle of techTree.all()) {
@@ -28,5 +34,6 @@ export function priceTable(techTree: TechTree): BlkBlock {
blocks: [],
});
}
return { name: '', params: [], blocks: [{ name: 'aircrafts', params: [], blocks: vehicles }] };
const common: BlkBlock = { name: COMMON_SECTION, params: [], blocks: [{ name: 'aircrafts', params: [], blocks: vehicles }] };
return { name: '', params: [], blocks: [common] };
}