WoW API: UnitPowerType

From AddOn Studio
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[edit]

UnitId
String - The unit whose power type to query.

Returns[edit]

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

Example[edit]

local t = {[0] = "mana", [1] = "rage", [2] = "focus", [3] = "energy", [4] = "combo points", [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[edit]

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