gdmp.economy
이 콘텐츠는 아직 번역되지 않았습니다.
Gems, game passes and developer products (see Selling things). The store is the package’s store.json, published
on the GDMP Hub by the experience’s creator. The prompt is GDMP’s (above everything an experience draws), with the
store’s price: a script asks for one, never answers it.
| Call | What it does |
|---|---|
server: items() → item[] |
the store: {id, kind: "pass" | "product", name, description, price} |
server: currency() |
"Gems" |
server: ownsPass(playerId, passId) → bool |
known once the player’s account is (onAccount) |
server: accountOf(playerId) → {userId, name, passes} | null |
who the hub says the player is |
server: promptPurchase(playerId, itemId) → bool |
GDMP asks that player |
server: onAccount(cb) |
cb(playerId, account) — the hub vouched for a player (after join) |
server: onPassPurchased(cb) |
cb(playerId, passId) |
server: onProductPurchased(cb) |
cb({receipt, playerId, itemId, name, price}) → return true when GRANTED. Otherwise the hub keeps the receipt and the server delivers it again the next time that player joins |
client: promptPurchase(itemId) → bool |
GDMP asks this player |
TypeScript
Section titled “TypeScript”The declarations from the GDMP types (namespace GDMP), comments included:
interface StoreItem { readonly id: string; readonly kind: 'pass' | 'product'; readonly name: string; readonly description: string; readonly price: number }
interface Account { readonly userId: string; readonly name: string; readonly passes: string[] }
interface ProductPurchase { readonly receipt: string; readonly playerId: PlayerId; readonly itemId: string; readonly name: string; readonly price: number }
interface EconomyServer { items(): StoreItem[]; currency(): string; ownsPass(playerId: PlayerId, passId: string): boolean; accountOf(playerId: PlayerId): Account | null; promptPurchase(playerId: PlayerId, itemId: string): boolean; onAccount(cb: Callback<[playerId: PlayerId, account: Account]>): void; onPassPurchased(cb: Callback<[playerId: PlayerId, passId: string]>): void; /** Return `true` when GRANTED; otherwise the receipt is delivered again the next time that player joins. */ onProductPurchased(cb: (purchase: ProductPurchase) => boolean): void;}
interface EconomyClient { /** GDMP asks this player (GDMP's own prompt, never the script's). */ promptPurchase(itemId: string): boolean;}