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

Buffs

const Buffs: object

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

The game’s status-effect table, and which of it this server decides.

readonly classes: string[]

The kinds of effect a server can take over, which is what claim accepts: the ones carrying state nobody can work out for themselves – potions, poison, injury, drunkenness, illness, unconsciousness. The game has other kinds, and they read back in BuffInfo.class, but they either shadow something that already replicates or are the game’s own plumbing, so there is no decision in them to take.

readonly modifiers: string[]

Supported custom modifier names: progression tracks, charisma, maxStamina (stamina alias), maxHealth, carryCapacity, runSpeed, armorRating, bodyArmor, hungerDrain, energyDrain, staminaRegeneration and healthRegeneration. Native query bounds and contexts still apply.

readonly tags: string[]

The families the game groups effects into, which is what player.clearBuffs takes: poison, bleed, alcohol_drunk, unconscious and nineteen more. These are the game’s own words, and its own AI reasons in them.

claim(classNames): string[]

Takes over whole kinds of effect. Every client then turns down an effect of that kind the game tried to give its own player, and raises playerBuffBlocked instead – which is where the resource decides what really happens, usually player.addBuff with its own rule applied. A claim nothing listens to does not move the gameplay here, it removes it.

Two things to plan around. The refusal covers the game’s follow-on effects too: claim alcohol and the six alcoholism_level* steps stop arriving along with the drink, so the resource owns the whole progression. And an effect has no strength – the handler can block it, swap it for another, or let it through, but it cannot make the drink half as strong.

Replaces the previous claim rather than adding to it, and reaches every connected client at once.

string[]

The kinds of effect to decide, from Buffs.classes. [] hands them all back. Throws for anything else.

string[]

The kinds now claimed.

find(query): BuffInfo | null

Looks a status effect up, so a resource can check a name is real before handing it to a player and can see what the effect is before applying it.

string

An effect’s name, as the game’s buff tables spell it, or its GUID.

BuffInfo | null

What the tables say about it, or null for a name they do not carry.

register(id, definition): string

Registers a custom native effect and publishes it to connected and future clients. An identical registration is idempotent; an existing id with another definition throws. Returns a GUID accepted by the existing player buff methods, like Items.register.

string

Unique resource-qualified identifier, such as my_resource:blessing.

CustomBuffDefinition

Immutable definition; unknown keys, unsupported modifiers and invalid values throw.

string

Custom buff GUID.