Item Functions and Methods
Complete reference for all Item Handler functions and methods available in Aurora.
Core Item Methods
Item Information
local item = Aurora.ItemHandler.NewItem(12345)
Properties populated:
id
- Actual item IDname
- Item nameicon
- Item icon texture IDitemType
- Item type stringitemSubType
- Item subtype stringclassID
- Numeric class IDsubclassID
- Numeric subclass IDisEquipment
- Boolean for weapons/armorisConsumable
- Boolean for consumablesitemSlot
- Equipment slot typehasOnUse
- Boolean for on-use effects
Item State Checks
item:equipped()
Checks if the item is currently equipped.
local trinket = Aurora.ItemHandler.NewItem(12345)
if trinket:equipped() then
print("Trinket is equipped!")
end
Returns: boolean
- True if equipped
item:isknown()
Checks if the item is known (usable and in inventory).
if item:isknown() then
-- Item is available for use
end
Returns: boolean
- True if known and available
item:isusable()
Checks if the item can be used according to game rules.
local usable, noMana = item:isusable()
Returns:
boolean
usable - True if usableboolean
noMana - True if unusable due to mana
item:ready()
Checks if the item is ready to be used (off cooldown).
if item:ready() then
-- Item cooldown has expired
end
Returns: boolean
- True if ready
Item Usage
item:use(unit, onSuccess)
Uses the item on the specified unit.
-- Use on target
item:use(target)
-- Use on self
item:use(player)
-- Use with callback
item:use(target, function()
print("Item used successfully!")
end)
Parameters:
unit
(UnitArray) - Target unitonSuccess
(function, optional) - Success callback
Returns: boolean
- True if used successfully
item:usable(unit)
Comprehensive check if item can be used on the unit.
if item:usable(target) then
item:use(target)
end
Parameters:
unit
(UnitArray, optional) - Target unit
Returns: boolean
- True if usable
Checks performed:
- Equipment status (if equipment)
- Item availability
- Cooldown status
- Line of sight (if unit specified)
- Casting/channeling state
item:castandclickraw(x, y, z)
Uses item and clicks at world coordinates for ground-targeted items.
-- Use item at specific coordinates
item:castandclickraw(100, 200, 0)
Parameters:
x, y, z
(number) - World coordinates
Returns: boolean
- True if executed successfully
Cooldown and Timing
item:cooldown()
Gets the remaining cooldown time.
local remainingCD = item:cooldown()
if remainingCD <= 0 then
-- Item is ready
end
Returns: number
- Remaining cooldown in seconds
Item Quantity
item:count()
Gets the number of items in inventory.
local potionCount = healthPotion:count()
print("Potions remaining: " .. potionCount)
Returns: number
- Item count
item:getcharges()
Alias for item:count()
.
local charges = item:getcharges()
Returns: number
- Item charges/count
Usage Tracking
item:waslastused()
Checks if this item was the last one used.
if item:waslastused() then
print("This item was just used!")
end
Returns: boolean
- True if last used
item:callback(callbackFunc)
Sets a callback function for the item.
item:callback(function(self, unit)
print("Using " .. self.name .. " on " .. unit.name)
end)
Parameters:
callbackFunc
(function) - Callback function
item:execute(unit, ...)
Executes the item's callback if ready.
item:execute(target, additionalParam)
Parameters:
unit
(UnitID, optional) - Target unit...
(any) - Additional arguments
Returns: boolean
- True if callback executed
Usage Examples
Basic Item Usage
-- Create and use a health potion
local potion = Aurora.ItemHandler.NewItem(33447)
if player.hp < 50 and potion:usable(player) then
potion:use(player)
end