Add store and marketplace deep links and coupon resale

Register bundle GUIDs at build time and return local store item URLs.
Route marketplace item links to the requested coupon. Update vehicle
and cosmetic prices from the marketplace snapshot and support selling
coupons back to the system at the configured fee.

Type checking, an isolated build, and local service checks passed.
In-game acceptance is pending.
This commit is contained in:
N0VAN0M4LY committed 2026-11-26 07:12:38 +08:00
1 parent b6964658d7
commit c01ee8ae5a
16 files changed
+588 -250

No files matched your search

+1
View File
@@ -12,3 +12,4 @@ export { BlkLabel, decodeBlk, encodeBlk, type SharedNameContext } from './binary
export { parseSharedNameMap, type SharedNameMap } from './shared-name-map.ts';
export { appendParam, ensureBlock, findBlock, findParam, setParam, visitParams } from './tree.ts';
export { formatBlkText } from './text/format-text.ts';
export { singleVehiclePackId, stableGuid } from './stable-guid.ts';
+18
View File
@@ -0,0 +1,18 @@
/**
* Deterministic GUID derived from a text (SHA-1, formatted 8-4-4-4-12, upper case). The build
* registers `stableGuid(<entitlement>)` for the offline vehicle packs in config/gui.blk
* `bundles/guid`, and the local service gives the same GUID to the same store product, so the
* game's `getBundleId` → `get_url_for_purchase` → `item_info.php` chain finds the pack
*. One definition, used by both packages.
*/
import { createHash } from 'node:crypto';
export function stableGuid(text: string): string {
const hex = createHash('sha1').update(`wto-bundle:${text}`).digest('hex').toUpperCase();
return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20, 32)}`;
}
/** Entitlement name of a single-vehicle offline pack (store-catalogue.ts and the build agree on it). */
export function singleVehiclePackId(vehicle: string): string {
return `wto_pack_${vehicle}`;
}