LibPlayerSpellInfo-1.0 API
lib:ActionUseInfo(action, target)
Returns a series of boolean values which correspond to an action's usage requirements.
Parameters
- action
- The action id.
- target
- The unitID of the required target.
Return values
- isKnown: If item or spell see their respective lib:*Info functions, otherwise this is always true (returned for consistency with lib:SpellCastInfo).
- hasReact: True if player is not on a taxi, the spell is not currently 'enabled', and all reactive conditions have been met.
- isReady: True if the spell is enabled and off cooldown.
- inRange: True if no target is specified, if the spell has no range, if the spell is in range or if the spell cannot target the given unit.
- hasUnit: True if the given target exists and is a valid target for the given spell.
- noMove: If item or spell see their respective lib:*Info functions, otherwise this is always true (returned for consistency with lib:SpellCastInfo).
- hasMana: True if the player has enough resources to use the action.
- hasEquip: If item or spell see their respective lib:*Info functions, otherwise this is always true (returned for consistency with lib:SpellCastInfo).
- hasReagent: If item or spell see their respective lib:*Info functions, otherwise this is always true (returned for consistency with lib:SpellCastInfo).
- inForm: If item or spell see their respective lib:*Info functions, otherwise this is always true (returned for consistency with lib:SpellCastInfo).
Usage
local isKnown, hasReact, isReady, inRange, hasUnit, noMove, hasMana, hasEquip, hasReagent, inForm = lib:ActionUseInfo(action, target)
See also
- lib:SpellCastInfo
lib:GetExtActionInfo(action)
Similar to the default API's GetActionInfo except this parses a macro's contents and returns the actual spell/item.
Parameters
- action
- The queried action slot id.
Return values
- mainType: The object's type (ie. spell, item, etc...).
- index: The objects id (ie. spellID, itemID, etc...).
- subType: The object's sub type (if applicable).
- target: If a macrobject the determined target, otherwise nil.
lib:GetMacroTextObject(macrotext, objLink)
Determines the spell/item and target of a macrotext object.
Parameters
- macrotext
- The specified macrotext.
- objLink
- Boolean indicating whether an item should be returned as an item link (useful if you want enchant/gem info) or item id (the default).
Return values
- itemID: The determined item id (or item link if 'objLink' is defined).
- spellID: The determined spell id.
- target: The determined target (or nil if not specified).
- showTooltip: Whether '#showtooltip' was present in the macrotext otherwise '#show" or neither were used.
lib:HasActionEquipment(action)
Determine whether or not the given spell meets all equipment requirements.
Parameters
- action
- The action id.
Return value
Boolean indicating whether or not equipment requirements are met.
lib:HasActionReagent(action)
Determine whether or not the given action meets all reagent requirements.
Parameters
- action
- The action id.
Return value
Boolean indicating whether or not reagent requirements are met.
lib:HasActionRequirements(action)
Determine whether or not the given action meets all spell requirements (or returns true if the action isn't a player spell).
Parameters
- action
- The action id.
Return values
- hasReqs: Boolean indicating whether or not all action requirements are met.
- hasEquip: Boolean indicating whether or not equipment requirements are met.
- inForm: Boolean indicating whether or not stance/form requirements are met.
- hasReagent: Boolean indicating whether or not reagent requirements are met.
lib:HasSpellEquipment(spell)
Determine whether or not the given spell meets all equipment requirements.
Parameters
- spell
- The spell name/link/id.
Return value
lib:HasSpellReagent(spell)
Determine whether or not the given spell meets all reagent requirements.
Parameters
- spell
- The spell name/link/id.
Return value
Boolean indicating whether or not reagent requirements are met.
lib:HasSpellRequirements(spell)
Determine whether or not the given spell meets all spell requirements.
Parameters
- spell
- The spell name/link/id.
Return values
- hasReqs: Boolean indicating whether or not all spell requirements are met.
- hasEquip: Boolean indicating whether or not equipment requirements are met.
- inForm: Boolean indicating whether or not stance/form requirements are met.
- hasReagent: Boolean indicating whether or not reagent requirements are met.
lib:InActionForm(action)
Determine whether or not the given action meets stance/form requirements.
Parameters
- action
- The action id.
Return value
Boolean indicating whether or not stance/form requirements are met.
lib:InSpellForm(spell)
Determine whether or not the given spell meets stance/form requirements.
Parameters
- spell
- The spell name/link/id.
Return value
Boolean indicating whether or not stance/form requirements are met.
lib:IsPlayerSpell(spell)
Determine whether or not the given spell is a player spell (or mount/pet).
Parameters
- spell
- The spell name/link/id.
Return value
The spellid if found, otherwise false.
lib:ItemUseInfo(item, target)
Returns a series of boolean values which correspond to an item's usage requirements.
Parameters
- item
- The item name/link/id.
- target
- The unitID of the required target.
Return values
- isKnown: Always true (returned for consistency with lib:SpellCastInfo).
- hasReact: True if player is not on a taxi, the spell is not currently 'enabled', and all reactive conditions have been met.
- isReady: True if the spell is enabled and off cooldown.
- inRange: True if no target is specified, if the spell has no range, if the spell is in range or if the spell cannot target the given unit.
- hasUnit: True if the given target exists and is a valid target for the given spell.
- noMove: Always true (returned for consistency with lib:SpellCastInfo).
- hasMana: True if the player has enough resources to use the item.
- hasEquip: True if the item is not eqquipable or the item is equipped.
- hasReagent: Always true (returned for consistency with lib:SpellCastInfo).
- inForm: Always true (returned for consistency with lib:SpellCastInfo).
Usage
local isKnown, hasReact, isReady, inRange, hasUnit, noMove, hasMana, hasEquip, hasReagent, inForm = lib:ItemUseInfo(item, target)
lib:SpellCastInfo(spell, target)
Returns a series of boolean values which correspond to a spell's casting requirements.
Parameters
- spell
- The spell name/link/id.
- target
- The unitID of the required target.
Return values
- isKnown: True if the given is a valid player spell/companion/mount.
- hasReact: True if player is not on a taxi, the spell is not currently 'enabled', and all reactive conditions have been met.
- isReady: True if the spell is enabled and off cooldown.
- inRange: True if no target is specified, if the spell has no range, if the spell is in range or if the spell cannot target the given unit.
- hasUnit: True if the given target exists and is a valid target for the given spell.
- noMove: True if the player is not taxiing/moving/falling or if the spell cast is instant.
- hasMana: True if the player has enough resources to cast the spell.
- hasEquip: See lib:HasSpellEquipment
- hasReagent: See lib:HasSpellReagent
- inForm: See lib:InSpellForm
Usage
local isKnown, hasReact, isReady, inRange, hasUnit, noMove, hasMana, hasEquip, hasReagent, inForm = lib:SpellCastInfo(spell, target)
See also
- lib:HasSpellEquipment
- lib:HasSpellReagent
- lib:InSpellForm
Comments