Lua API
On this page

SpellBook

Inherits from

Information about spells

Fields:

Count number

read only

The number of spells in this spell book

KnownSpellsIds number[]

read only

A list of known spell ids

Events:

OnChanged EventArgs

Fired when your spellbook changes. (Added or removed spell)

Methods:

Get(spellId: number) : Spell

Get a spell by id

Parameters:
NameTypeDefaultSummary
spellIdnumber

The spell id to get

Returns:Spell

GetPropertyKeys() : string[]

Returns a list of strings of all public property / field names. Useful for reflection on UserData in lua scripts

Returns:string[]

GetSelfBuffs(skillModifier?: number = 5, force?: boolean = nil, minDurationMilliseconds?: number = 300000) : Spell[]

Get a list of all self buff spells that would benefit your character.

Parameters:
NameTypeDefaultSummary
skillModifiernumber5

Skill modifier to use. This number is added to your current skill level when checking if you have the required skill to cast a spell

forcebooleanfalse

If true, will ignore current character enchantments and return a full list of wanted buffs.

minDurationMillisecondsnumber300000

Minimum duration left on an enchantment for it to be considered still active, and excluded from this list.

Returns:Spell[]

HasSkillToCastSpell(spellId: number, spellDifficultyModifier?: number = 20) : boolean

Checks if the current character has the skill required to cast the specified spell successfully.

Parameters:
NameTypeDefaultSummary
spellIdnumber

The id of the spell to check

spellDifficultyModifiernumber20

The number of skill points above the spell's difficulty that you must have in order to cast

Returns:boolean

IsKnown(spellId: number) : boolean

Check if the specified spell id is known by your character

Parameters:
NameTypeDefaultSummary
spellIdnumber

The spell id to check

Returns:boolean

IsValid(spellId) spellId number

ToString()

TryGet(spellId) spellId number