Crafting
constCrafting: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.
Type Declaration
Section titled “Type Declaration”cancel()
Section titled “cancel()”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.
Parameters
Section titled “Parameters”player
Section titled “player”Returns
Section titled “Returns”boolean
isAvailable()
Section titled “isAvailable()”isAvailable(
kind?):boolean
True: alchemy and smithing are both ruled by the server. Omitted kind checks alchemy.
Parameters
Section titled “Parameters”"alchemy" | "smithing"
Returns
Section titled “Returns”boolean
knowledge()
Section titled “knowledge()”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.
Parameters
Section titled “Parameters”player
Section titled “player”Returns
Section titled “Returns”Record<string, number>
occupancy()
Section titled “occupancy()”occupancy(
stationId,virtualWorld?):CraftStationOccupancy|null
Who holds a station. World defaults to 0. Null for an unknown station.
Parameters
Section titled “Parameters”stationId
Section titled “stationId”string
virtualWorld?
Section titled “virtualWorld?”number
Returns
Section titled “Returns”CraftStationOccupancy | null
recipes()
Section titled “recipes()”recipes(
player,kind?): readonlyCraftRecipeInfo[]
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.
Parameters
Section titled “Parameters”player
Section titled “player”"alchemy" | "smithing"
Returns
Section titled “Returns”readonly CraftRecipeInfo[]
session()
Section titled “session()”session(
player):CraftSessionInfo|null
The player’s alchemy session or the table they kept between batches, else their smithing workpiece, else null.
Parameters
Section titled “Parameters”player
Section titled “player”Returns
Section titled “Returns”CraftSessionInfo | null
setKnowledge()
Section titled “setKnowledge()”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.
Parameters
Section titled “Parameters”player
Section titled “player”recipeId
Section titled “recipeId”string | number
number
Returns
Section titled “Returns”boolean
stations()
Section titled “stations()”stations(
kind?): readonlyCraftStationInfo[]
Placed stations in this server’s level. Does not load deferred layers or bypass quests.
Parameters
Section titled “Parameters”"alchemy" | "smithing"
Returns
Section titled “Returns”readonly CraftStationInfo[]