Files
WT-Offline/packages/local-service/src/profile/client-profile.ts
T
N0VAN0M4LY e4227bb8ba feat(store): add a shopping cart and refresh the storefront
Save carts per account and settle each order in one profile update. Add featured packs, a screenshot and video gallery, and premium artwork from the game files.
2026-11-26 19:07:48 +08:00

23 lines
1.0 KiB
TypeScript

/**
* The profile as the char service hands it to the client: the saved profile plus the
* account data and server clock the char server attaches on the wire.
*
* charDrivenNick: the client reads the player's nick from this top-level string when it
* loads a profile (name looked up at aces.exe 2.61.0.37 0x8fe0aa, value stored at 0x91874d).
*
* serverTime:i64: the char server's clock; without it the client
* takes the server time as 0 and every expiry and time limit is wrong.
*/
import { setParam, type BlkBlock } from '@wto/blk';
import type { Account } from '../accounts/account-store.ts';
import { clearStoreCart } from './profile-store-cart.ts';
import { serverTimeNow } from './server-time.ts';
export function clientProfile(saved: BlkBlock, account: Account): BlkBlock {
const profile = structuredClone(saved);
clearStoreCart(profile);
setParam(profile, 'charDrivenNick', { type: 'string', value: account.nick });
setParam(profile, 'serverTime', { type: 'int64', value: serverTimeNow() });
return profile;
}