Wowpedia

We have moved to Warcraft Wiki. Click here for information and the new URL.

READ MORE

Wowpedia
MPX4132 (talk | contribs)
Tag: WoW API docs
(14 intermediate revisions by 11 users not shown)
Line 1: Line 1:
{{wowapi}} __NOTOC__
+
{{wowapi}}
 
Returns information about a spell
  +
name, rank, icon, castTime, minRange, maxRange, spellId = GetSpellInfo(spellId or "spellName"[, "spellRank"])
   
 
== Arguments ==
<!-- Describe the purpose of the function, exhausting detail can be saved for a later section -->
 
  +
The first argument has two forms, affecting how the function behaves (see details):
Get information about a spell.
 
  +
;spellId : Number - Any valid unique spell ID
<!-- List return values and arguments as well as function name, follow Blizzard usage convention for args -->
 
 
;spellName : String - A spell name known to the player character
name, rank, icon, cost, isFunnel, powerType, castTime, minRange, maxRange
 
= GetSpellInfo(spellId or spellName)
 
   
   
  +
The optional second argument may accompany either form:
== Arguments ==
 
  +
;spellRank : String - Rank (or subtext) of a spell known to the player character, e.g. "Pig" for pig-transforming variant of [[Polymorph]].
<!-- List each argument, together with its type -->
 
:(spellId or spellName)
 
 
:;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.
 
   
 
== Returns ==
 
== Returns ==
 
;name : String - The localized name of the spell.
:name, rank, icon, cost, isFunnel, powerType, castTime, minRange, maxRange
 
  +
;rank: Since 8.0, this return value is always nil.<ref name="BFA" /> You may use {{api|GetSpellSubtext}} to retrieve the rank of cached spells.
 
:;name : String - The name of the spell.
+
;icon : Number - ([[fileID]]) The spell's icon texture.
 
;castTime : Number - The spell's cast time in milliseconds, or 0 for instant spells
:;rank: String - The secondary text of the spell, displayed in the top right-hand corner of the spell's tooltip. e.g "Racial", "Turtle", "Battle Stance".
 
:;icon : String - The interface path to the icon texture.
+
;minRange : Number - The minimum range of the spell, or 0 if not applicable
:;cost : Number - The cost of the spell in Mana/Rage/Energy/Focus.
+
;maxRange : Number - The maximum range of the spell, or 0 if not applicable
:;isFunnel : Boolean - Returns true if the spell is a health funnel effect.
+
;spellId : Number - The spell's unique ID.
:;powerType : Number - The power type required.
 
::* -2 for Health
 
::* Others: See [[PowerType]]
 
:;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 ==
  +
* Using '''spellId''' as the argument will return info for any valid spellId:
===Arguments===
 
  +
** Spells castable by any player
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. The values returned by this function are '''affected by the player's form or stance''' on relevant spells, such as a warlock's Corruption spell transforming to Doom when Metamorphosis is active.
 
  +
** Spells castable by any NPC
  +
** [[Buff|Buffs]] and debuffs regardless if the source was a 'spell', such as Well Fed from eating food.
  +
* Using '''spellName''' or '''spellLink''' only returns the info if the spell is in your spellbook; otherwise it returns nil.
  +
* The player's form or stance affects return values on relevant spells, such as a warlock's Corruption spell transforming to Doom while Metamorphosis is active.
   
===isFunnel===
+
== Patch changes ==
  +
* {{Patch 8.0.1|note=The <code>rank</code> return value is now always <code>nil</code>.<ref name="BFA">[https://us.battle.net/forums/en/wow/topic/20762318007 ''Battle for Azeroth Addon Changes''] forum [[blue post]] by [[Ythisens]], 24 Apr 2018</ref>}}
Currently the only spells isFunnel returns true on are a warlock's [[Health Funnel]] spells, and a few other miscellaneous NPC spells.
 
  +
* {{Patch 6.0.2|note=Removed <code>cost</code>, <code>isFunnel</code>, and <code>powerType</code> return values}}
   
===PowerType===
+
== References ==
  +
<references />
It is unknown at this time whether Happiness (PowerType 4) is ever passed as a spell cost.
 

Revision as of 03:06, 31 October 2020

Returns information about a spell

name, rank, icon, castTime, minRange, maxRange, spellId = GetSpellInfo(spellId or "spellName"[, "spellRank"])

Arguments

The first argument has two forms, affecting how the function behaves (see details):

spellId
Number - Any valid unique spell ID
spellName
String - A spell name known to the player character


The optional second argument may accompany either form:

spellRank
String - Rank (or subtext) of a spell known to the player character, e.g. "Pig" for pig-transforming variant of Spell nature polymorph [Polymorph].

Returns

name
String - The localized name of the spell.
rank
Since 8.0, this return value is always nil.[1] You may use GetSpellSubtext to retrieve the rank of cached spells.
icon
Number - (fileID) The spell's icon texture.
castTime
Number - The spell's cast time in milliseconds, or 0 for instant spells
minRange
Number - The minimum range of the spell, or 0 if not applicable
maxRange
Number - The maximum range of the spell, or 0 if not applicable
spellId
Number - The spell's unique ID.

Details

  • Using spellId as the argument will return info for any valid spellId:
    • Spells castable by any player
    • Spells castable by any NPC
    • Buffs and debuffs regardless if the source was a 'spell', such as Well Fed from eating food.
  • Using spellName or spellLink only returns the info if the spell is in your spellbook; otherwise it returns nil.
  • The player's form or stance affects return values on relevant spells, such as a warlock's Corruption spell transforming to Doom while Metamorphosis is active.

Patch changes

  • Battle for Azeroth Patch 8.0.1 (2018-07-17): The rank return value is now always nil.[1]
  • Warlords of Draenor Patch 6.0.2 (2014-10-14): Removed cost, isFunnel, and powerType return values

References