WoW:API UnitPowerType

From AddOn Studio
Revision as of 06:49, 29 March 2005 by WoWWiki>Flickering (Corrected comment about Focus. Fixed indentation a bit.)
Jump to navigation Jump to search
UnitPowerType -Documentation by blackaxe-

Returns a number corresponding to the power type (e.g., mana, rage or energy) of the specified unit.

local powerType = UnitPowerType(unit);

Arguments
(String unit)
arg1
the unit's power type to query

Returns
powerType
powerType
the power type of the query as a number. Values seen so far are
  • 0 for Mana
  • 1 for Rage
  • 2 for Focus (hunter pets)
  • 3 for Energy
  • 4 for Happiness

Example
if (UnitPowerType("player") == 1) then
  ChatFrame1:AddMessage('players rage: ' .. UnitMana("player"));
elseif (UnitPowerType("player") == 0) then
  ChatFrame1:AddMessage('players mana: ' .. UnitMana("player"));
elseif (UnitPowerType("player") == 3) then
  ChatFrame1:AddMessage('players energy: ' .. UnitMana("player"));
end
Result
'players rage: 0' - For warriors(and probably druids in bear form)
'players energy: 0' - For Rogues (and druids in cat form)
'players mana: 0' - Otherwise

Description
Returns a number corresponding to the power type (e.g., mana, rage, energy or happiness) of the specified unit.

Template:WoW API