WoW:API UnitStat: Difference between revisions

From AddOn Studio
Jump to navigation Jump to search
No edit summary
 
m (Move page script moved page API UnitStat to API UnitStat without leaving a redirect)
 
(3 intermediate revisions by 3 users not shown)
Line 1: Line 1:
<center>'''UnitStat''' ''-Documentation by [[user:geekgirljess|geekgirljess]]-''</center>
{{wowapi}} __NOTOC__
 
Returns info about one of the unit's stats (strength, agility, stamina, intellect, spirit).
  base, stat, posBuff, negBuff = UnitStat("unit", statID);
  base, stat, posBuff, negBuff = UnitStat("unit", statID);


Returns info about one of the unit's stats (strength, agility, stamina, intellect, spirit).
==Parameters==
 
===Arguments===
----
:;unit : String - The [[API TYPE UnitId|UnitId]] to get information from. (Only works for <tt>"player"</tt> and <tt>"pet"</tt>. Will work on <tt>"target"</tt> as long as it is equal to <tt>"player"</tt>)
;''Arguments''
:;statID : Number - An internal id corresponding to one of the stats.
 
::#Strength
:;unit : String - The [[API TYPE UnitId|UnitId]] to get information from. (Likely only works for <tt>"player"</tt> and <tt>"pet"</tt> -- unconfirmed)
::#Agility
 
::#Stamina
:;statID : Number - An internal id corresponding to one of the stats. (1-5)
::#Intellect
 
::#Spirit
----
===Return===
;''Returns''
 
:base, stat, posBuff, negBuff
:base, stat, posBuff, negBuff
:;base : Number - The unit's base stat.
:;base : Number - The unit's base stat.
Line 21: Line 19:
:;negBuff : Number - Any negative buffs applied to the stat.
:;negBuff : Number - Any negative buffs applied to the stat.


----
==Example==
;''Example''
 
  local base, stat, posBuff, negBuff = UnitStat("player",1);
  local base, stat, posBuff, negBuff = UnitStat("player",1);
  DEFAULT_CHAT_FRAME:AddMessage("Your current Strength is "..stat);
  DEFAULT_CHAT_FRAME:AddMessage("Your current Strength is ".. stat);
 
===Result===
----
A chat message stating your current strength is displayed
{{Template:WoW API}}
[[Category:API Unit Functions|UnitStat]]

Latest revision as of 04:47, 15 August 2023

WoW API < UnitStat

Returns info about one of the unit's stats (strength, agility, stamina, intellect, spirit).

base, stat, posBuff, negBuff = UnitStat("unit", statID);

Parameters

Arguments

unit
String - The UnitId to get information from. (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. Strength
  2. Agility
  3. Stamina
  4. Intellect
  5. Spirit

Return

base, stat, posBuff, negBuff
base
Number - The unit's base stat.
stat
Number - The unit's current stat.
posBuff
Number - Any positive buffs applied to the stat.
negBuff
Number - Any negative buffs applied to the stat.

Example

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

Result

A chat message stating your current strength is displayed