import { type KitBlueprint, type KitOwnerIdKind, type KitTrustedAuthority } from './core.js'; /** One weighted entry of a loot table. */ export interface LootEntrySpec { itemId: string; /** Relative weight (> 0); probabilities are weights normalized per table. */ weight: number; /** Minimum quantity granted. Defaults to 1. */ minQty?: number; /** Maximum quantity granted. Defaults to `minQty`. */ maxQty?: number; } /** One loot table, unrolled into a single expression at blueprint-build time. */ export interface LootTableSpec { /** Stable table identifier; also derives the roll function name. */ tableId: string; /** 1–16 weighted entries (the expression parser caps chain length). */ entries: LootEntrySpec[]; } /** An event-triggered drop: rolls a pooled LootRoll when a model event fires. */ export interface LootDropSpec { /** Automation name (unique per app), e.g. `'goblin-drop'`. */ name: string; /** The table to roll. */ tableId: string; /** The model event that triggers the drop (e.g. a `mob_died` function). */ onEvent: 'function_invoked' | 'property_changed' | 'container_created'; functionName?: string; containerTypeName?: string; propertyKey?: string; /** * `property_changed` only: which writes roll the drop. Properties mutated * by kit functions (a mob's `hp` reaching 0, say) need `'function'` or * `'any'`; the default `'direct'` only sees client `setProperty` calls. */ writeSource?: 'direct' | 'function' | 'any'; debounceMs?: number; /** Rolls per event. Defaults to 1. */ maxTargets?: number; } /** Options for {@link lootBlueprint}. */ export interface LootBlueprintOptions { /** Prefix for the type/function names. Defaults to none. */ typePrefix?: string; /** The loot tables; entries are unrolled into expressions at build time. */ tables: LootTableSpec[]; /** * Who may roll. Defaults to `'server'` (app admins / studio backend); * automations configured via `drops` may always roll (trusted automations * bypass invoke policies, and the roll functions are marked * `autonomousInvocable` when drops reference their table). */ rollAuthority?: KitTrustedAuthority; /** * Event-triggered drops: each rolls an UNROLLED pooled `LootRoll` container * of its table when the event fires (automations mutate — they cannot * create containers — so keep a small pool of pre-created rolls per table). */ drops?: LootDropSpec[]; /** Owner-mirror typing (see the kit convention). Defaults to `'int'`. */ ownerIdKind?: KitOwnerIdKind; } /** Names derived by {@link lootBlueprint} for a given prefix. */ export interface LootNames { rollType: string; claimFn: string; /** Snake-cased function-name prefix (empty without a `typePrefix`). */ fnPrefix: string; } /** Compute the type/function names a loot blueprint (and its runtime helper) uses. */ export declare function lootNames(typePrefix?: string): LootNames; /** The roll function name for one table. */ export declare function lootRollFn(tableId: string, typePrefix?: string): string; /** * Blueprint for **loot tables & drops**: weighted tables are unrolled into * pure expressions at blueprint-build time (the expression language is * loop-free), rolled server-side into durable `LootRoll` containers, and * claimed atomically into an item stack. Covers chest rolls, mob drops, and * gacha pulls. * * Flow: create a `LootRoll` (member) for a table → `roll_` (trusted: * server scope by default, or an event automation via `drops`) stores a * single `rand()` seed and resolves item + quantity from it in one * transaction → the owner claims with `claim_roll`, which marks the roll * claimed AND grants the stack in the same invoke (no double-claim, no * client-chosen rewards). * * Runtime counterpart: `client.kit(appId).loot`. */ export declare function lootBlueprint(options: LootBlueprintOptions): KitBlueprint; //# sourceMappingURL=loot.d.ts.map