feat(store): add item deep links and marketplace 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:
1 parent
f829c9a45f
commit
a73635407d
16 files changed
+588
-250
No files matched your search
@@ -14,6 +14,7 @@
|
||||
import { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
|
||||
import { dirname, join } from 'node:path';
|
||||
import { parseArgs } from 'node:util';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import { rebuildCharPack } from './char-pack.ts';
|
||||
import { patchExecutable } from './executable.ts';
|
||||
import { assertWritableCopy, GAME_FILES } from './game-copy.ts';
|
||||
@@ -21,6 +22,10 @@ import { rebuildGuiPack } from './gui-pack.ts';
|
||||
import { rebuildMainPack } from './main-pack.ts';
|
||||
import { localEndpoint } from './network/local-endpoint.ts';
|
||||
import { NETWORK_HOOK_LIBRARY, networkHookSettings } from './network/network-hook.ts';
|
||||
import { offlinePackBundleGuids } from './store/offline-bundles.ts';
|
||||
|
||||
/** The local service's default store tuning; its multi-vehicle pack ids get bundle GUIDs too. */
|
||||
const STORE_TUNING_PATH = fileURLToPath(new URL('../../local-service/tuning/store.jsonc', import.meta.url));
|
||||
|
||||
function main(): number {
|
||||
const { values } = parseArgs({
|
||||
@@ -53,7 +58,8 @@ function main(): number {
|
||||
return 1;
|
||||
}
|
||||
|
||||
const charPack = rebuildCharPack(readFileSync(join(values.game, GAME_FILES.charPack)), endpoint);
|
||||
const stockCharPack = readFileSync(join(values.game, GAME_FILES.charPack));
|
||||
const charPack = rebuildCharPack(stockCharPack, endpoint);
|
||||
console.log(`network.blk: ${charPack.network.addresses.length} address(es) now point to ${endpoint.host}:${endpoint.port}; ` +
|
||||
`environments configured: ${charPack.network.environments.join(', ')}`);
|
||||
if (values.verbose) {
|
||||
@@ -62,7 +68,9 @@ function main(): number {
|
||||
console.log(`game_settings.blk: features on for every player: ${charPack.features.join(', ') || '(already on)'}`);
|
||||
console.log(`shop.blk: ${charPack.revealedVehicles} hidden vehicles shown in the tech tree`);
|
||||
|
||||
const mainPack = rebuildMainPack(readFileSync(join(values.game, GAME_FILES.mainPack)), endpoint);
|
||||
const packBundles = offlinePackBundleGuids(stockCharPack, STORE_TUNING_PATH);
|
||||
const mainPack = rebuildMainPack(readFileSync(join(values.game, GAME_FILES.mainPack)), endpoint, packBundles);
|
||||
console.log(`gui.blk: ${packBundles.length} offline vehicle pack bundle GUID(s) registered`);
|
||||
console.log(`settings.blk: ${mainPack.addresses.length} address(es) now point to ${endpoint.host}:${endpoint.port}`);
|
||||
for (const change of mainPack.addresses) console.log(` ${change.path}: ${change.before} -> ${change.after}`);
|
||||
|
||||
|
||||
Reference in new issue
Block a user