Documentation › Lua
Spells and Npc
Spells gives the spells' data and their cooldown. Npc buys and sells in the open trade window.
Spells#
The data comes from the bot's spell list. The cooldown comes from the cooldown notices the server sends after each spell: until you use the spell once, it shows as ready.
Spells.getIdByWords(words)#
Spells.getIdByWords(words) → number
Spell id by its words. Returns -1 if it does not exist.
local id = Spells.getIdByWords("exura vita")Spells.getIdByName(name)#
Spells.getIdByName(name) → number
Spell id by its name. Returns -1 if it does not exist.
local id = Spells.getIdByName("Ultimate Healing")Spells.getDataById(id)#
Spells.getDataById(id) → table or nil
The spell's data:
| Field | Description |
|---|---|
id, name, words | Id, name and words |
primaryGroup | Group, as in Enums.SpellGroups |
secondaryGroup | Always 0 |
vocations | List of vocations that use the spell |
mana, level, cooldown, icon | Mana, minimum level, cooldown in ms and icon (extras) |
local s = Spells.getDataById(Spells.getIdByWords("exura vita"))
if s then print(s.name, s.mana, s.cooldown) endSpells.isInCooldown(id)#
Spells.isInCooldown(id) → boolean
Whether the spell is on cooldown.
local id = Spells.getIdByWords("exori gran")
if not Spells.isInCooldown(id) then Game.talk("exori gran") endSpells.getLeftCooldownTime(id)#
Spells.getLeftCooldownTime(id) → number
Milliseconds until the spell is ready. Returns -1 when it is already ready or the time is unknown.
print(Spells.getLeftCooldownTime(Spells.getIdByWords("utani hur")))Spells.groupIsInCooldown(group)#
Spells.groupIsInCooldown(group) → boolean
Whether the spell group is on cooldown.
if not Spells.groupIsInCooldown(Enums.SpellGroups.SPELLGROUP_HEALING) then Game.talk("exura") endSpells.getLeftGroupCooldownTime(group)#
Spells.getLeftGroupCooldownTime(group) → number
Milliseconds until the group is ready, or -1.
print(Spells.getLeftGroupCooldownTime(Enums.SpellGroups.SPELLGROUP_ATTACK))Npc#
These work with the NPC's trade window open. To know whether it is open, use Client.isTradeShopOpen().
Npc.buy(itemId, count, ignoreCap, inBackpacks)#
Npc.buy(itemId, count, ignoreCap, inBackpacks) → true
| Parameter | Type | Description |
|---|---|---|
| itemId | number | Item to buy |
| count | number, optional | Default 1 |
| ignoreCap | boolean, optional | Buys even without cap (default false) |
| inBackpacks | boolean, optional | Buys inside backpacks (default false) |
Game.talk("hi") wait(1000) Game.talk("trade") wait(1500)
if Client.isTradeShopOpen() then Npc.buy(268, 100) endNpc.sell(itemId, count, ignoreEquipped)#
Npc.sell(itemId, count, ignoreEquipped) → true
| Parameter | Type | Description |
|---|---|---|
| itemId | number | Item to sell |
| count | number, optional | Default 1 |
| ignoreEquipped | boolean, optional | Does not sell what is equipped (default true) |
Npc.sell(3357, 1) -- 3357 = plate armor
Comments
to comment.