Files
nampower/SCRIPTS.md
T

25 KiB

Nampower Custom Lua Functions

This document describes all custom Lua functions and events added by Nampower.

For installation, configuration, and general usage information, see the main README.md.

Table of Contents


Custom Lua Functions

Spell/Item/Unit information

GetItemStats(itemId)

Returns a Lua table containing all fields for the item's ItemStats record (including localized displayName and description). Returns nil if the item cannot be found or loaded.

Full field name lists are in DBC_FIELDS.md.

GetItemStatsField(itemId, fieldName)

Fast lookup for a single field on an item. Returns the requested field value; returns nil if the item is not found; raises a Lua error if the field name is invalid.

Full field name lists are in DBC_FIELDS.md.

Examples:

-- Get item name
local name = GetItemStatsField(19019, "displayName")
print(name) -- "Thunderfury, Blessed Blade of the Windseeker"

-- Get item level
local ilvl = GetItemStatsField(22589, "itemLevel")
print("Atiesh item level: " .. ilvl) -- 90

-- Get item quality (0=Poor, 1=Common, 2=Uncommon, 3=Rare, 4=Epic, 5=Legendary)
local quality = GetItemStatsField(19019, "quality")
print("Quality: " .. quality) -- 5 (Legendary)

-- Get item delay (weapon speed in milliseconds)
local delay = GetItemStatsField(19019, "delay")
print("Weapon speed: " .. (delay / 1000) .. " seconds") -- 1.9 seconds

FindPlayerItemSlot(itemId or itemName)

Searches the player's inventory for an item by ID or name and returns its location.

Parameters:

  • itemId (number): The item ID to search for, OR
  • itemName (string): The item name to search for (case-insensitive)

Returns:

  • 1st param (number or nil): Bag index where the item was found
    • nil = Equipped item (check 2nd param for equipment slot 0-18)
    • 0 = Inventory pack
    • 1-4 = Regular bags
    • -1 = Bank item slots
    • 5-9 = Bank bags
    • -2 = Keyring
  • 2nd param (number): Slot number within the bag (or equipment slot if 1st param is nil)
    • For equipped items: 0-18 (equipment slots are 0-indexed)
    • For bag 0, -1, -2: Returns relative slot position (1-indexed, 0-based within bag + 1)
      • Bag 0: slots 1-16 (corresponding to absolute slots 23-38)
      • Bag -1: slots 1-24 (corresponding to absolute bank slots 39-62)
      • Bag -2: slots 1-16 (corresponding to absolute keyring slots 81-96)
    • For regular bags (1-4) and bank bags (5-9): Returns 1-indexed slot within the bag
  • Returns nil,nil if the item is not found

Examples:

-- Find Thunderfury in player inventory
local bag, slot = FindPlayerItemSlot(19019)
if bag then
    print("Found in bag " .. bag .. " slot " .. slot)
    if bag == -1 or (bag >= 5 and bag <= 9) then
        print("Item is in bank")
    end
elseif bag == nil and slot then
    print("Item is equipped in slot " .. slot)
else
    print("Item not found")
end

-- Find item by name (uses cache for performance after first lookup)
local bag, slot = FindPlayerItemSlot("Hearthstone")
if slot then
    if bag == nil then
        print("Hearthstone is equipped in slot " .. slot)
    elseif bag == 0 then
        print("Hearthstone is in inventory pack slot " .. slot .. " (1-16)")
    elseif bag == -1 then
        print("Hearthstone is in bank slot " .. slot .. " (1-24)")
    elseif bag == -2 then
        print("Hearthstone is in keyring slot " .. slot .. " (1-16)")
    else
        print("Hearthstone is in bag " .. bag .. " slot " .. slot)
    end
end

GetEquippedItems(unitToken)

Returns a table containing all equipped items for the specified unit.

Parameters:

  • unitToken (string): Can be a standard unit token ("player", "target", "pet", etc.) or a GUID string

Returns:

  • A Lua table with equipment slot indices as keys (0-18) and item info tables as values
  • Returns nil if the unit cannot be found or inspected

For the player, item info includes:

  • itemId: The item's ID
  • stackCount: Number of items in the stack
  • duration: Item duration in milliseconds
  • spellCharges: Table of spell charges (indices 1-5)
  • flags: Item flags
  • permanentEnchantId: Permanent enchantment ID
  • tempEnchantId: Temporary enchantment ID
  • tempEnchantmentTimeLeftMs: Time remaining on temp enchant in milliseconds
  • tempEnchantmentCharges: Charges remaining on temp enchant
  • durability: Current durability
  • maxDurability: Maximum durability

For other inspected units (limited data):

  • itemId: The item's ID
  • permanentEnchantId: Permanent enchantment ID
  • tempEnchantId: Temporary enchantment ID

Examples:

-- Get all equipped items for your target
local items = GetEquippedItems("target")
if items then
    for slot, itemInfo in pairs(items) do
        print("Slot " .. slot .. ": Item ID " .. itemInfo.itemId)
        if itemInfo.permanentEnchantId and itemInfo.permanentEnchantId > 0 then
            print("  Permanent enchant: " .. itemInfo.permanentEnchantId)
        end
    end
end

-- Check player's weapon durability
local items = GetEquippedItems("player")
if items and items[15] then -- slot 15 is main hand
    local weapon = items[15]
    print("Weapon durability: " .. weapon.durability .. "/" .. weapon.maxDurability)
end

GetEquippedItem(unitToken, slot)

Returns item info for a specific equipment slot on the specified unit.

Parameters:

  • unitToken (string): Can be a standard unit token ("player", "target", "pet", etc.) or a GUID string
  • slot (number): Equipment slot number (0-18)
    • 1 = Head, 2 = Neck, 3 = Shoulder, 4 = Shirt, 5 = Chest
    • 6 = Waist, 7 = Legs, 8 = Feet, 9 = Wrist, 10 = Hands
    • 11 = Finger 1, 12 = Finger 2, 13 = Trinket 1, 14 = Trinket 2
    • 15 = Back, 16 = Main Hand, 17 = Off Hand, 18 = Ranged, 19 = Tabard

Returns:

  • A Lua table containing the item info (same fields as GetEquippedItems)
  • Returns nil if the slot is empty, unit cannot be found, or unit cannot be inspected

Examples:

-- Check target's main hand weapon
local weapon = GetEquippedItem("target", 16)
if weapon then
    print("Target has weapon: " .. weapon.itemId)
else
    print("Target has no main hand weapon")
end

-- Check your own helmet
local helm = GetEquippedItem("player", 1)
if helm and helm.durability then
    local durabilityPercent = (helm.durability / helm.maxDurability) * 100
    print("Helmet durability: " .. string.format("%.1f%%", durabilityPercent))
end

GetBagItems()

Returns a nested table containing all items in all bags (including bank if open).

Returns:

  • A Lua table with bag indices as keys and bag contents as values
  • Each bag contains 1-indexed slot numbers as keys and item info tables as values
  • Bag indices:
    • 0 = Inventory pack (16 slots)
    • 1-4 = Regular bags
    • -1 = Bank item slots (24 slots, only if bank is open)
    • 5-9 = Bank bags (only if bank is open)
    • -2 = Keyring

Item info table fields (same as GetEquippedItems for player):

  • itemId, stackCount, duration, spellCharges, flags
  • permanentEnchantId, tempEnchantId, tempEnchantmentTimeLeftMs, tempEnchantmentCharges
  • durability, maxDurability

Examples:

-- Get all items in all bags
local allItems = GetBagItems()
for bagIndex, bagContents in pairs(allItems) do
    print("Bag " .. bagIndex .. ":")
    for slot, itemInfo in pairs(bagContents) do
        print("  Slot " .. slot .. ": " .. itemInfo.itemId .. " (x" .. itemInfo.stackCount .. ")")
    end
end

-- Count total number of a specific item
local function CountItem(itemId)
    local total = 0
    local allItems = GetBagItems()
    for bagIndex, bagContents in pairs(allItems) do
        for slot, itemInfo in pairs(bagContents) do
            if itemInfo.itemId == itemId then
                total = total + itemInfo.stackCount
            end
        end
    end
    return total
end

local soulShardCount = CountItem(6265)
print("Soul Shards: " .. soulShardCount)

GetBagItem(bagIndex, slot)

Returns item info for a specific slot in a specific bag.

Parameters:

  • bagIndex (number): The bag to check
    • 0 = Inventory pack
    • 1-4 = Regular bags
    • -1 = Bank item slots or buyback slots
    • 5-9 = Bank bags (requires bank to be open)
    • -2 = Keyring
  • slot (number): 1-indexed slot number within the bag

Returns:

  • A Lua table containing the item info (same fields as GetBagItems)
  • Returns nil if the slot is empty or invalid

Examples:

-- Get item in first slot of first bag
local item = GetBagItem(1, 1)
if item then
    print("Item ID: " .. item.itemId)
    print("Stack count: " .. item.stackCount)
else
    print("Slot is empty")
end

-- Check durability of an item in inventory pack
local item = GetBagItem(0, 1)
if item and item.durability then
    print("Durability: " .. item.durability .. "/" .. item.maxDurability)
end

-- Check if a specific bank slot has an item (bank must be open)
local bankItem = GetBagItem(-1, 1)
if bankItem then
    print("Bank slot 1 contains: " .. bankItem.itemId)
end

GetSpellRec(spellId)

Returns a Lua table containing all fields for the spell's SpellRec record (including localized name and rank). Returns nil if the spell cannot be found.

Full field name lists are in DBC_FIELDS.md.

GetSpellRecField(spellId, fieldName)

Fast lookup for a single field on a spell. Returns the requested field value; returns nil if the spell is not found; raises a Lua error if the field name is invalid.

Full field name lists are in DBC_FIELDS.md.

Examples:

-- Get spell name
local name = GetSpellRecField(116, "name")
print(name) -- "Frostbolt"

-- Get spell rank
local rank = GetSpellRecField(116, "rank")
print(rank) -- "Rank 1"

-- Get spell cast time in milliseconds
local castTime = GetSpellRecField(133, "castTime")
print("Fireball cast time: " .. (castTime / 1000) .. " seconds") -- 3.5 seconds

-- Get spell range (max range in yards * 10, so divide by 10)
local maxRange = GetSpellRecField(116, "rangeMax")
print("Frostbolt max range: " .. (maxRange / 10) .. " yards") -- 30 yards

-- Get spell mana cost
local manaCost = GetSpellRecField(116, "manaCost")
print("Mana cost: " .. manaCost)

-- Get spell school (0=Physical, 1=Holy, 2=Fire, 3=Nature, 4=Frost, 5=Shadow, 6=Arcane)
local school = GetSpellRecField(116, "school")
print("School: " .. school) -- 4 (Frost)

-- Get spell icon ID
local spellIconID = GetSpellRecField(116, "spellIconID")
print("Icon ID: " .. spellIconID)

GetSpellModifiers(spellId, modifierType)

Returns the current spell modifiers applied to a spell for the player. This includes buffs, talents, and other effects that modify spell behavior.

Parameters:

  • spellId (number): The spell ID to check
  • modifierType (number): The type of modifier to check (see list below)

Returns:

  • 1st param (number): Flat modification value (e.g., +50 damage)
  • 2nd param (number): Percent modification value (e.g., 10 for +10%)
  • 3rd param (number): Return value from the function (whether there was any percent or flat modifier)

Modifier Types:

  • 0 = DAMAGE
  • 1 = DURATION
  • 2 = THREAT
  • 3 = ATTACK_POWER
  • 4 = CHARGES
  • 5 = RANGE
  • 6 = RADIUS
  • 7 = CRITICAL_CHANCE
  • 8 = ALL_EFFECTS
  • 9 = NOT_LOSE_CASTING_TIME
  • 10 = CASTING_TIME
  • 11 = COOLDOWN
  • 12 = SPEED
  • 14 = COST
  • 15 = CRIT_DAMAGE_BONUS
  • 16 = RESIST_MISS_CHANCE
  • 17 = JUMP_TARGETS
  • 18 = CHANCE_OF_SUCCESS
  • 19 = ACTIVATION_TIME
  • 20 = EFFECT_PAST_FIRST
  • 21 = CASTING_TIME_OLD
  • 22 = DOT
  • 23 = HASTE
  • 24 = SPELL_BONUS_DAMAGE
  • 27 = MULTIPLE_VALUE
  • 28 = RESIST_DISPEL_CHANCE

Example:

-- Check damage modifiers on Frostbolt (spell ID 116)
local flatMod, percentMod, ret = GetSpellModifiers(116, 0)
print("Flat damage bonus: " .. flatMod)
print("Percent damage bonus: " .. percentMod .. "%")

GetUnitData(unitToken)

Returns a Lua table containing all unit fields for the specified unit. This provides access to low-level unit data like health, mana, stats, auras, resistances, and more.

Parameters:

  • unitToken (string): Can be a standard unit token ("player", "target", "pet", "mouseover", etc.) or a GUID string (e.g., "0xF5300000000000A5")

Returns:

  • A Lua table containing all unit fields, or nil if the unit cannot be found

Full field name lists are in UNIT_FIELDS.md.

Example:

-- Get all unit data for your current target
local data = GetUnitData("target")
if data then
    print("Target health: " .. data.health .. "/" .. data.maxHealth)
    print("Target level: " .. data.level)
    print("Target display ID: " .. data.displayId)
end

-- Using a GUID
local data = GetUnitData("0xF5300000000000A5")

GetUnitField(unitToken, fieldName)

Fast lookup for a single field on a unit. More efficient than GetUnitData when you only need one specific field.

Parameters:

  • unitToken (string): Can be a standard unit token ("player", "target", "pet", "mouseover", etc.) or a GUID string
  • fieldName (string): The name of the field to retrieve

Returns:

  • The requested field value; returns nil if the unit is not found; raises a Lua error if the field name is invalid
  • For array fields (like "aura", "resistances"), returns a Lua table with numeric indices

Full field name lists are in UNIT_FIELDS.md.

Examples:

-- Get target's current health
local health = GetUnitField("target", "health")
print("Target health: " .. health)

-- Get player's current mana (power1)
local mana = GetUnitField("player", "power1")
print("Player mana: " .. mana)

-- Get all auras on target (returns a table)
local auras = GetUnitField("target", "aura")
for i, auraId in ipairs(auras) do
    print("Aura " .. i .. ": " .. auraId)
end

-- Get all resistances (returns a table)
local resistances = GetUnitField("player", "resistances")
-- resistances[1] = armor, [2] = holy, [3] = fire, [4] = nature, [5] = frost, [6] = shadow, [7] = arcane

QueueSpellByName(spellName)

Will force queue a spell regardless of the appropriate queue window. If no spell is currently being cast it will be cast immediately. For example can make a macro with

/run QueueSpellByName("Frostbolt");QueueSpellByName("Frostbolt")

to cast 2 frostbolts in a row. Currently, can only queue 1 GCD spell at a time and 5 non gcd spells. This means you can't do 3 frostbolts in a row with one macro.

CastSpellByNameNoQueue(spellName)

Will force a spell cast to never queue even if your settings would normally queue. Can be used to fix addons that don't work with queued spells.

QueueScript(script, [priority])

Queues any arbitrary script using the same logic as a regular spell using NP_SpellQueueWindowMs as the window. If no spell is being cast and you are not on the gcd the script will be run immediately.

Priority is optional and defaults to 1.
Priority 1 means the script will run before any other queued spells. Priority 2 means the script will run after any queued non gcd spells but before any queued normal spells. Priority 3 means the script will run after any type of queued spells.

Convert slash commands from other addons like /equip to their function form SlashCmdList.EQUIP to use them inside QueueScript.

For example, you can equip a libram before casting a queued heal using

/run QueueScript('SlashCmdList.EQUIP("Libram of +heal")')

IsSpellInRange(spellName, [target]) or IsSpellInRange(spellId, [target])

Takes a spell name or spell id and an optional target. Target can the usual UNIT tokens like "player", "target", "mouseover", etc or a unit guid.

If using spell name it must be a spell you have in your spellbook. If using spell id it can be any spell id.

Returns 1 if the spell is in range, 0 if not in range, and -1 if the spell is not valid for this check (must be TARGET_UNIT_PET, TARGET_UNIT_TARGET_ENEMY, TARGET_UNIT_TARGET_ALLY, TARGET_UNIT_TARGET_ANY). This is because this uses the same underlying function as IsActionInRange which returns 1 for spells that are not single target which can be misleading.

Examples:

/run local result=IsSpellInRange("Frostbolt"); if result == 1 then print("In range") else if result == 0 then print("Out of range") else print("Not single target") end

IsSpellUsable(spellName) or IsSpellUsable(spellId)

Takes a spell name or spell id.

Usable does not equal castable. This is most often used to check if a reactive spell is usable.

If using spell name it must be a spell you have in your spellbook. If using spell id it can be any spell id.

Returns:

1st param: 1 if the spell is usable, 0 if not usable. 2nd param: Always 0 if spell is not usable for a different reason other than mana. 1 if out of mana, 0 if not out of mana.

Examples:

/run local result=IsSpellUsable("Frostbolt"); if result == 1 then print("Frostbolt usable") else print("Frostbolt not usable") end

GetCurrentCastingInfo()

Returns:

1st param: Casting spell id or 0 2nd param: Visual spell id or 0. This won't always get cleared after a spell finishes. 3rd param: Auto repeating spell id or 0. 4th param: 1 if casting spell with a cast time, 0 if not. 5th param: 1 if channeling, 0 if not. 6th param: 1 if on swing spell is pending, 0 if not. 7th param: 1 if auto attacking, 0 if not.

For normal spells these will be the same. For some spells like auto-repeating and channeling spells only the visual spell id will be set.

Examples:

/run local castId,visId,autoId,casting,channeling,onswing,autoattack=GetCurrentCastingInfo();print(castId);print(visId);print(autoId);print(casting);print(channeling);print(onswing);print(autoattack);

GetCastInfo()

Returns detailed information about the currently active cast or channel. Returns nil if there is no active cast or channel. GetCurrentCastingInfo was made very early on and doesn't provide enough information for many use cases, but still has some uses and is available for backwards compatibility.

Returns: A Lua table with the following fields, or nil if no cast is active:

  • castId (number): Unique identifier for this cast
  • spellId (number): The spell ID being cast
  • guid (number): Target GUID (0 if no explicit target)
  • castType (number): Type of cast - 0=NORMAL, 3=CHANNEL, 4=TARGETING
  • castStartS (number): When the cast started in WoW time (seconds with decimals, e.g., 1234567.890)
  • castEndS (number): When the cast will end in WoW time (seconds with decimals)
  • castRemainingMs (number): Milliseconds remaining until cast ends
  • castDurationMs (number): Total cast duration in milliseconds
  • gcdEndS (number): When the GCD will end in WoW time (seconds with decimals)
  • gcdRemainingMs (number): Milliseconds remaining until GCD expires

Notes:

  • Time fields ending in S (castStartS, castEndS, gcdEndS) are absolute timestamps in seconds with decimal precision to match GetTime() in Lua
  • Duration and remaining fields ending in Ms (castRemainingMs, castDurationMs, gcdRemainingMs) are in milliseconds for precision
  • Returns nil if there is no active cast (castSpellId is 0) and no active channel (channelSpellId is 0)

Examples:

-- Check current cast information
local info = GetCastInfo()
if info then
    print("Casting spell: " .. info.spellId)
    print("Cast ends at: " .. info.castEndS)
    print("Time remaining: " .. info.castRemainingMs .. "ms")
    print("GCD ends at: " .. info.gcdEndS)
    print("GCD remaining: " .. info.gcdRemainingMs .. "ms")
else
    print("No active cast")
end

-- Check if you can cast another spell (GCD check)
local info = GetCastInfo()
if not info or info.gcdRemainingMs == 0 then
    print("Ready to cast!")
else
    print("On GCD for " .. info.gcdRemainingMs .. "ms more")
end

-- Monitor cast progress
local info = GetCastInfo()
if info and info.castDurationMs > 0 then
    local progress = ((info.castDurationMs - info.castRemainingMs) / info.castDurationMs) * 100
    print("Cast progress: " .. string.format("%.1f%%", progress))
end

GetSpellIdCooldown(spellId)

Returns detailed cooldown information for a spell from the spell history. This provides precise timing data for individual spell cooldowns, category cooldowns, and GCD.

Parameters:

  • spellId (number): The spell ID to check

Returns: A Lua table with the following fields:

  • isOnCooldown (number): 1 if any cooldown is active, 0 otherwise
  • cooldownRemainingMs (number): Maximum remaining time across all cooldown types in milliseconds

Individual Spell Cooldown:

  • individualStartS (number): When the individual spell cooldown started (seconds, WoW time)
  • individualDurationMs (number): Total duration of the individual spell cooldown in milliseconds
  • individualRemainingMs (number): Milliseconds remaining on the individual spell cooldown
  • isOnIndividualCooldown (number): 1 if the spell-specific cooldown is active, 0 otherwise

Category Cooldown:

  • categoryId (number): The cooldown category ID (0 if no category cooldown)
  • categoryStartS (number): When the category cooldown started (seconds, WoW time)
  • categoryDurationMs (number): Total duration of the category cooldown in milliseconds
  • categoryRemainingMs (number): Milliseconds remaining on the category cooldown
  • isOnCategoryCooldown (number): 1 if the category cooldown is active, 0 otherwise

GCD (Global Cooldown):

  • gcdCategoryId (number): The GCD category ID (typically 133 for most spells)
  • gcdCategoryStartS (number): When the GCD started (seconds, WoW time)
  • gcdCategoryDurationMs (number): Total GCD duration in milliseconds (typically 1500ms)
  • gcdCategoryRemainingMs (number): Milliseconds remaining on the GCD
  • isOnGcdCategoryCooldown (number): 1 if the GCD is active, 0 otherwise

Notes:

  • Time fields ending in S are absolute timestamps in seconds to match GetTime() in Lua
  • Fields ending in Ms are in milliseconds for precision
  • The spell must have been cast at least once for accurate data to be available
  • cooldownRemainingMs is the maximum of all three cooldown types

Example:

-- Check if Frostbolt is ready to cast
local cd = GetSpellIdCooldown(116) -- Frostbolt
if cd.isOnCooldown == 0 then
    print("Frostbolt is ready!")
else
    print("Frostbolt on cooldown for " .. cd.cooldownRemainingMs .. "ms")
    if cd.isOnGcdCategoryCooldown == 1 then
        print("  GCD: " .. cd.gcdCategoryRemainingMs .. "ms remaining")
    end
    if cd.isOnIndividualCooldown == 1 then
        print("  Spell CD: " .. cd.individualRemainingMs .. "ms remaining")
    end
    if cd.isOnCategoryCooldown == 1 then
        print("  Category CD: " .. cd.categoryRemainingMs .. "ms remaining")
    end
end

GetItemIdCooldown(itemId)

Returns detailed cooldown information for an item from the spell history. Works similarly to GetSpellIdCooldown but for items.

Parameters:

  • itemId (number): The item ID to check

Returns: A Lua table with the same structure as GetSpellIdCooldown (see above).

Notes:

  • Returns the longest cooldown among all spells associated with the item
  • If the item has multiple on-use effects, returns information for the one with the longest remaining cooldown
  • Item cooldowns are tracked through their associated spell entries in the spell history

Example:

-- Check if a trinket is ready
local cd = GetItemIdCooldown(12345) -- Replace with your trinket ID
if cd.isOnCooldown == 0 then
    print("Trinket is ready to use!")
else
    print("Trinket on cooldown for " .. cd.cooldownRemainingMs .. "ms")
end

GetSpellIdForName(spellName)

Returns:

1st param: the max rank spell id for a spell name if it exists in your spellbook. Returns 0 if the spell is not in your spellbook.

Examples:

/run local spellId=GetSpellIdForName("Frostbolt");print(spellId)
/run local spellId=GetSpellIdForName("Frostbolt(Rank 1)");print(spellId)

GetSpellNameAndRankForId(id)

Returns:

1st param: the spell name for a spell id 2nd param: the spell rank for a spell id as a string such as "Rank 1"

Examples:

/run local spellName,spellRank=GetSpellNameAndRankForId(116);print(spellName);print(spellRank)
prints "Frostbolt" and "Rank 1"

GetSpellSlotTypeIdForName(spellName)

Returns:

1st param: the 1 indexed (lua calls expect this) spell slot number for a spell name if it exists in your spellbook. Returns 0 if the spell is not in your spellbook. 2nd param: the book type of the spell, either "spell", "pet" or "unknown". 3rd param: the spell id of the spell. Returns 0 if the spell is not in your spellbook.

Examples:

/run local slot, bookType, spellId=GetSpellSlotTypeIdForName("Frostbolt");print(slot);print(bookType);print(spellId)

GetNampowerVersion()

Returns the current version of Nampower split into major, minor and patch numbers.

So if version was v2.8.6 it would return 2, 8, 6 as integers.

Examples:

/run local major, minor, patch=GetNampowerVersion();print(major);print(minor);print(patch)

The previous version of this GetSpellSlotAndTypeForName was removed as it was returning a 0 indexed slot number which was confusing to use in lua.

GetItemLevel(itemId)

Returns the item level of an item. Returns an error if the item id is invalid.

Examples:

/run local itemLevel=GetItemLevel(22589);print(itemLevel)
should print 90 for atiesh

ChannelStopCastingNextTick()

Will stop channeling early on the next tick if you have queue channeling spells enabled and try to cast a spell before the next tick (didn't know how to cancel channels without casting another spell). Uses your ChannelLatencyReductionPercentage to determine when to stop the channel.