Wowpedia

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

READ MORE

Wowpedia
No edit summary
Tag: WoW API docs
No edit summary
Tag: WoW API docs
Line 1: Line 1:
 
{{wowapi}}
 
{{wowapi}}
 
Returns a table describing the resource cost of a spell.
 
Returns a table describing the resource cost of a spell.
 
 
costs = GetSpellPowerCost(spell)
 
costs = GetSpellPowerCost(spell)
  +
= GetSpellPowerCost(index, bookType)
   
 
==Arguments==
 
==Arguments==
;spell : <span class="apitype">number</span>|<span class="apitype">string</span> - Spell ID or Name.
+
;spell: <span class="apitype">number</span>|<span class="apitype">string</span> - Spell ID or Name.
  +
----
  +
;index : <span class="apitype">number</span> - Spellbook slot index, ranging from 1 through total number of spells across all tabs and pages.
  +
;bookType: <span class="apitype">string</span>
  +
{{:Const_BOOKTYPE}}
   
 
==Returns==
 
==Returns==
; costs : <span class="apitype">table</span> - an array of tables describing spell resource costs, using the following keys:
+
;costs : <span class="apitype">table</span>[]
  +
{| class="sortable darktable zebra" style="margin-left: 2em"
::;hasRequiredAura : Boolean - returns false for every spell in the game.
 
  +
! Key !! Type !! Description
::;type : [[Enum.PowerType]] - the powerType of the spell's cost.
 
  +
|-
::;name : String - the powerToken of the spell's cost, one of "MANA", "RAGE", "FOCUS", "ENERGY", "HAPPINESS", "RUNES", "RUNIC_POWER", "SOUL_SHARDS", "HOLY_POWER", "STAGGER", "CHI", "FURY", "PAIN", "LUNAR_POWER", "INSANITY".
 
  +
| minCost || <span class="apitype">number</span> || minimum cost
::;cost: Number - the maximum cost.
 
  +
|-
::;minCost: Number - the minimum cost.
 
  +
| cost || <span class="apitype">number</span> || maximum cost
::;requiredAuraID: Number - returns zero for the vast majority of spells. Read bellow for more detailed information.
 
  +
|-
::;costPercent: Number - percentual cost.
 
  +
| costPercent || <span class="apitype">number</span> || percentual cost
::;costPerSec: Number - the cost per second for channeled spells.
 
  +
|-
 
| costPerSec || <span class="apitype">number</span> || The cost per second for channeled spells.
  +
|-
 
| type || <span class="apitype">[[Enum.PowerType]]</span> || powerType of the cost
  +
|-
 
| name || <span class="apitype">string</span> || powerToken: "MANA", "RAGE", "FOCUS", "ENERGY", "HAPPINESS", "RUNES", "RUNIC_POWER", "SOUL_SHARDS", "HOLY_POWER", "STAGGER", "CHI", "FURY", "PAIN", "LUNAR_POWER", "INSANITY"
  +
|-
  +
| hasRequiredAura || <span class="apitype">boolean</span> ||
  +
|-
  +
| requiredAuraID || <span class="apitype">number</span> ||
  +
|}
   
 
==Details==
 
==Details==
Line 29: Line 44:
 
}
 
}
 
</div>
 
</div>
  +
<!-- emmylua
  +
---@param spell number|string Spell ID or Name
  +
---@return SpellPowerCost[] costs
  +
function GetSpellPowerCost(spell) end
  +
  +
---@param index number
  +
---@param bookType string
  +
---@return SpellPowerCost[] costs
  +
function GetSpellPowerCost(index, bookType) end
  +
  +
---@type SpellPowerCost
  +
---@field minCost number
  +
---@field cost number
  +
---@field costPercent number
  +
---@field costPerSec number
  +
---@field type PowerType
  +
---@field name string
  +
---@field hasRequiredAura boolean
  +
---@field requiredAuraID number
  +
-->

Revision as of 04:51, 20 May 2022

Returns a table describing the resource cost of a spell.

costs = GetSpellPowerCost(spell)
      = GetSpellPowerCost(index, bookType)

Arguments

spell
number|string - Spell ID or Name.

index
number - Spellbook slot index, ranging from 1 through total number of spells across all tabs and pages.
bookType
string
Constant Value Description
BOOKTYPE_SPELL "spell" The General, Class, Specs and Professions tabs[1]
BOOKTYPE_PET "pet" The Pet tab

Returns

costs
table[]
Key Type Description
minCost number minimum cost
cost number maximum cost
costPercent number percentual cost
costPerSec number The cost per second for channeled spells.
type Enum.PowerType powerType of the cost
name string powerToken: "MANA", "RAGE", "FOCUS", "ENERGY", "HAPPINESS", "RUNES", "RUNIC_POWER", "SOUL_SHARDS", "HOLY_POWER", "STAGGER", "CHI", "FURY", "PAIN", "LUNAR_POWER", "INSANITY"
hasRequiredAura boolean
requiredAuraID number

Details

  • Returns an empty table if the spell has no resource cost.
  • Reflects resource discounts provided by auras.
  • requiredAuraID has a return value different than zero for 36 spells. Most are spellIDs associated with a hidden healing/damage modifier spec aura, one refers to Ability racial bearform [Bear Form], two seem to be connected to Helya; some are honor talents, and some don't refer to a valid aura spellID. This return value mostly exists for spells that change their cost depending on which spec the player is in.
  • Some spells may have costs composed of multiple resource types. In this case, the costs array contains multiple tables. For example, GetSpellPowerCost("Rip") returns
{
  {type=3, name="ENERGY", cost=30, minCost=30, costPercent=0, costPerSec=0, hasRequiredAura=false, requiredAuraID=0},
  {type=4, name="COMBO_POINTS", cost=5, minCost=1, costPercent=0, costPerSec=0, hasRequiredAura=false, requiredAuraID=0}
}