WoW API: UnitPowerType

From AddOn Studio
Revision as of 20:16, 20 October 2010 by WoWWiki>DrDoom (Formatting changes and removed note, since the information is documented in the powerType page.)
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, powerTypeString = UnitPowerType(UnitId);

Arguments

UnitId
String - The unit whose power type to query.

Returns

powerType
Integer - the power type.
powerTypeString
String - also the power type:
  • "MANA"
  • "RAGE"
  • "FOCUS"
  • "ENERGY"
  • "HAPPINESS"
  • "RUNES"
  • "RUNIC_POWER"
  • "SOUL_SHARDS"
  • "ECLIPSE"
  • "HOLY_POWER"
  • "AMMOSLOT" (vehicles, 3.1)
  • "FUEL" (vehicles, 3.1)

Example

local t = {[0] = "mana", [1] = "rage", [2] = "focus", [3] = "energy", [4] = "happiness", [5] = "runes", [6] = "runic power", [7] = "soul shards", [8] = "eclipse", [9] = "holy power"};
DEFAULT_CHAT_FRAME:AddMessage(UnitName("player") .. "'s " .. t[UnitPowerType("player")] .. ": " .. UnitPower("player"));

Result

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