m (→Arguments) |
m (→Returns) Tag: WoW API docs |
||
(14 intermediate revisions by 11 users not shown) | |||
Line 1: | Line 1: | ||
− | {{wowapi}} |
+ | {{wowapi}} |
⚫ | |||
+ | name, rank, icon, castTime, minRange, maxRange, spellId = GetSpellInfo(spellId or "spellName"[, "spellRank"]) |
||
⚫ | |||
− | <!-- 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): |
||
⚫ | |||
+ | ;spellId : Number - Any valid unique spell ID |
||
− | <!-- 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 |
||
− | = GetSpellInfo(spellId or spellName) |
||
+ | 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 [[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]]. |
||
⚫ | |||
== Returns == |
== Returns == |
||
⚫ | |||
− | :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. |
||
− | |||
− | + | ;icon : Number - ([[fileID]]) The spell's icon texture. |
|
⚫ | |||
− | :;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". |
||
− | + | ;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. |
|
− | :;powerType : Number - The power type required. |
||
− | ::* -2 for Health |
||
− | ::* Others: See [[PowerType]] |
||
⚫ | |||
⚫ | |||
− | :;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. |
||
− | == |
+ | == 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}} |
||
− | == |
+ | == 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
Automated updating of API pages at this location, to reflect patch changes, has ceased from 10.1.7 onwards. |
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 [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
- Patch 8.0.1 (2018-07-17): The
rank
return value is now alwaysnil
.[1] - Patch 6.0.2 (2014-10-14): Removed
cost
,isFunnel
, andpowerType
return values
References
- ^ a b Battle for Azeroth Addon Changes forum blue post by Ythisens, 24 Apr 2018