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

  1. isKnown: If item or spell see their respective lib:*Info functions, otherwise this is always true (returned for consistency with lib:SpellCastInfo).
  2. hasReact: True if player is not on a taxi, the spell is not currently 'enabled', and all reactive conditions have been met.
  3. isReady: True if the spell is enabled and off cooldown.
  4. 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.
  5. hasUnit: True if the given target exists and is a valid target for the given spell.
  6. noMove: If item or spell see their respective lib:*Info functions, otherwise this is always true (returned for consistency with lib:SpellCastInfo).
  7. hasMana: True if the player has enough resources to use the action.
  8. hasEquip: If item or spell see their respective lib:*Info functions, otherwise this is always true (returned for consistency with lib:SpellCastInfo).
  9. hasReagent: If item or spell see their respective lib:*Info functions, otherwise this is always true (returned for consistency with lib:SpellCastInfo).
  10. 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

  1. mainType: The object's type (ie. spell, item, etc...).
  2. index: The objects id (ie. spellID, itemID, etc...).
  3. subType: The object's sub type (if applicable).
  4. 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

  1. itemID: The determined item id (or item link if 'objLink' is defined).
  2. spellID: The determined spell id.
  3. target: The determined target (or nil if not specified).
  4. 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

  1. hasReqs: Boolean indicating whether or not all action requirements are met.
  2. hasEquip: Boolean indicating whether or not equipment requirements are met.
  3. inForm: Boolean indicating whether or not stance/form requirements are met.
  4. 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

  1. hasReqs: Boolean indicating whether or not all spell requirements are met.
  2. hasEquip: Boolean indicating whether or not equipment requirements are met.
  3. inForm: Boolean indicating whether or not stance/form requirements are met.
  4. 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

  1. isKnown: Always true (returned for consistency with lib:SpellCastInfo).
  2. hasReact: True if player is not on a taxi, the spell is not currently 'enabled', and all reactive conditions have been met.
  3. isReady: True if the spell is enabled and off cooldown.
  4. 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.
  5. hasUnit: True if the given target exists and is a valid target for the given spell.
  6. noMove: Always true (returned for consistency with lib:SpellCastInfo).
  7. hasMana: True if the player has enough resources to use the item.
  8. hasEquip: True if the item is not eqquipable or the item is equipped.
  9. hasReagent: Always true (returned for consistency with lib:SpellCastInfo).
  10. 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

  1. isKnown: True if the given is a valid player spell/companion/mount.
  2. hasReact: True if player is not on a taxi, the spell is not currently 'enabled', and all reactive conditions have been met.
  3. isReady: True if the spell is enabled and off cooldown.
  4. 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.
  5. hasUnit: True if the given target exists and is a valid target for the given spell.
  6. noMove: True if the player is not taxiing/moving/falling or if the spell cast is instant.
  7. hasMana: True if the player has enough resources to cast the spell.
  8. hasEquip: See lib:HasSpellEquipment
  9. hasReagent: See lib:HasSpellReagent
  10. 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

Posts Quoted:
Reply
Clear All Quotes