WoW API: UnitPowerType

From AddOn Studio
Revision as of 18:04, 23 December 2006 by WoWWiki>Starlightblunder ({{wowapi}}, format, example)
Jump to navigation Jump to search

WoW API < UnitPowerType

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

powerType = UnitPowerType(unit);

Parameters

Arguments

unit
UnitId - the unit whose power type to query.

Returns

powerType
Integer - the power type:
  • 0 for Mana
  • 1 for Rage
  • 2 for Focus (hunter pets)
  • 3 for Energy
  • 4 for Happiness

Example

local t = {[0] = "mana", [1] = "rage", [2] = "Focus", [3] = "Energy", [4] = "Happiness"};
DEFAULT_CHAT_FRAME:AddMessage(UnitName("player") .. "'s " .. t[UnitPowerType("player")] .. ": " .. UnitMana("player"));

Result

Displays the player's current mana/rage/energy in the default chat frame.