Skip to content
KCKingdoms Connected Scripting APIScripting guides and API
Global objectServer APIGenerated

Crafting

const Crafting: object

Defined in: server/api.d.ts:3594

Crafting catalogs, station occupancy, alchemy and smithing sessions, and alchemy recipe knowledge. Held in memory for each connection; nothing is saved.

cancel(player): boolean

Ends the player’s session as leaving the station would, and their game closes it. Alchemy: wholly unmilled groups go back to the inventory, the rest is spent. Smithing: the workpiece fails, spending its failure share. craftingEnded follows next tick. False when there was nothing to end.

Player

boolean

isAvailable(kind?): boolean

True: alchemy and smithing are both ruled by the server. Omitted kind checks alchemy.

"alchemy" | "smithing"

boolean

knowledge(player): Record<string, number>

The player’s recipe knowledge: recipe id to a mask of its 29 authored steps, 536870911 when the whole recipe is known. A recipe not listed is unknown. Starts empty every session; save it from craftingCompleted or here and restore it with setKnowledge.

Player

Record<string, number>

occupancy(stationId, virtualWorld?): CraftStationOccupancy | null

Who holds a station. World defaults to 0. Null for an unknown station.

string

number

CraftStationOccupancy | null

recipes(player, kind?): readonly CraftRecipeInfo[]

Production recipes enabled by server DLC policy. The player must be connected but does not change the list. Catalog presence does not establish knowledge or skill.

Player

"alchemy" | "smithing"

readonly CraftRecipeInfo[]

session(player): CraftSessionInfo | null

The player’s alchemy session or the table they kept between batches, else their smithing workpiece, else null.

Player

CraftSessionInfo | null

setKnowledge(player, recipeId, mask): boolean

Sets which steps of one recipe the player knows, and sends it to their game’s recipe book. 0 forgets the recipe. False for an unknown recipe, a mask above 536870911, or a player who is not connected.

Player

string | number

number

boolean

stations(kind?): readonly CraftStationInfo[]

Placed stations in this server’s level. Does not load deferred layers or bypass quests.

"alchemy" | "smithing"

readonly CraftStationInfo[]