UnitStat

From Warcraft Wiki
Jump to navigation Jump to search

Returns the basic attributes for a unit (strength, agility, stamina, intellect).

currentStat, effectiveStat, statPositiveBuff, statNegativeBuff = UnitStat(unit, statID)

Arguments

unit
string : UnitToken - Only works for "player" and "pet". Will work on "target" as long as it is equal to "player")
statID
number - An internal id corresponding to one of the stats.
  • 1: LE_UNIT_STAT_STRENGTH
  • 2: LE_UNIT_STAT_AGILITY
  • 3: LE_UNIT_STAT_STAMINA
  • 4: LE_UNIT_STAT_INTELLECT
  • 5: LE_UNIT_STAT_SPIRIT (not anymore available in 9.0.5)

Return

currentStat
number - The unit's stat. Seems to always return the same as effectiveStat, regardless of values of pos/negBuff.
effectiveStat
number - The unit's current stat, as displayed in the paper doll frame.
statPositiveBuff
number - Any positive buffs applied to the stat. Including gear.
statNegativeBuff
number - Any negative buffs applied to the stat.

Example

Shows your current strength.

local stat, effectiveStat, posBuff, negBuff = UnitStat("player", 1);
DEFAULT_CHAT_FRAME:AddMessage("Your current Strength is ".. stat);