WoW:API GetSpellInfo: Difference between revisions

From AddOn Studio
Jump to navigation Jump to search
(New page: {{wowapi}} __NOTOC__ <!-- Describe the purpose of the function, exhausting detail can be saved for a later section --> Get information about a spell. <!-- List return values and arguments...)
 
m (Move page script moved page API GetSpellInfo to API GetSpellInfo without leaving a redirect)
 
(8 intermediate revisions by 8 users not shown)
Line 4: Line 4:
Get information about a spell.
Get information about a spell.
<!-- List return values and arguments as well as function name, follow Blizzard usage convention for args -->
<!-- List return values and arguments as well as function name, follow Blizzard usage convention for args -->
  name, rank, icon, cost, isFunnel, powerType, castTime, minRange, maxRange  
  name, rank, icon, castTime, minRange, maxRange  
  = GetSpellInfo(spellId or spellName or spellLink)
  = GetSpellInfo(spellId or spellName or spellLink)


Line 10: Line 10:
== Arguments ==
== Arguments ==
<!-- List each argument, together with its type -->
<!-- List each argument, together with its type -->
:(spellId or spellName or spellLink
:spellId or spellName or spellLink


:;spellId : Integer - The global spell number, found on wowhead or through [[API_COMBAT_LOG_EVENT|COMBAT_LOG_EVENT]].
:;spellId : Integer - The global spell number, found on wowhead or through [[API_COMBAT_LOG_EVENT|COMBAT_LOG_EVENT]].
:;spellName : String - The Name of the spell.
:;spellName : String - The Name of the spell.
:;[[SpellLink|spellLink]] : String - The formatted link to the spell
:;[[SpellLink|spellLink]] : String - The formatted link to the spell [Note: this appears to be broken, see Discussion page]




== Returns ==
== Returns ==
<!-- List each return value, together with its type -->
: name, rank, icon, castTime, minRange, maxRange
:name, rank, icon, cost, isFunnel, powerType, castTime, minRange, maxRange <!-- remove this line if it's just one value -->


:;name : String - The name of the spell.
; name : String - The name of the spell.
:;rank : String - The rank of the spell. Returns as an empty string if there is no rank.
; rank : String - The rank line from the tooltip of the spell, e.g. "Rank 2". Returns some other classification (like "Summon" for a summoning spell) or an empty string if there is no rank.
:;icon : String - The interface path to the icon texture.
; icon : String - The interface path to the icon texture.
:;cost : Number - The cost of the spell in Mana/Rage/Energy/Focus.
; castTime : Number - The cast time, in milliseconds.
:;isFunnel : Boolean - Returns true if the spell is a health funnel effect. Returns false 99% of the time.
; minRange : Number - The minimum range of the spell.
:;powerType : Number - The power type required:
; maxRange : Number - The maximum range of the spell.
::* 0 for Mana
::* 1 for Rage
::* 2 for Focus (hunter pets)
::* 3 for Energy
::* 4 for Happiness
:;castTime : Number - The cast time, in milliseconds.
:;minRange : Number - The minimum range of the spell.
:;maxRange : Number - The maximum range of the spell.


== Details ==
== Details ==
cost, powerType, and isFunnel was removed in 6.0
===Arguments===
===Arguments===
Using '''spellId''' as the argument will always return the info.  Using '''spellName''' or '''spellLink''' will only return the info if the spell is in your spellbook. Otherwise it will return nil.
Using '''spellId''' as the argument will always return the info.  Using '''spellName''' or '''spellLink''' will only return the info if the spell is in your spellbook. Otherwise it will return nil.
===isFunnel===
Currently the only spells isFunnel returns true on are a warlock's [[Health Funnel]] spells, and a few other mischellaneous NPC spells.
===PowerType===
It is unknown at this point, but unlikely, that Happyness (PowerType 4) is passed as a spell cost.

Latest revision as of 04:46, 15 August 2023

WoW API < GetSpellInfo

Get information about a spell.

name, rank, icon, castTime, minRange, maxRange 
= GetSpellInfo(spellId or spellName or spellLink)


Arguments[edit]

spellId or spellName or spellLink
spellId
Integer - The global spell number, found on wowhead or through COMBAT_LOG_EVENT.
spellName
String - The Name of the spell.
spellLink
String - The formatted link to the spell [Note: this appears to be broken, see Discussion page]


Returns[edit]

name, rank, icon, castTime, minRange, maxRange
name
String - The name of the spell.
rank
String - The rank line from the tooltip of the spell, e.g. "Rank 2". Returns some other classification (like "Summon" for a summoning spell) or an empty string if there is no rank.
icon
String - The interface path to the icon texture.
castTime
Number - The cast time, in milliseconds.
minRange
Number - The minimum range of the spell.
maxRange
Number - The maximum range of the spell.

Details[edit]

cost, powerType, and isFunnel was removed in 6.0

Arguments[edit]

Using spellId as the argument will always return the info. Using spellName or spellLink will only return the info if the spell is in your spellbook. Otherwise it will return nil.