WoW:API UnitBuff: Difference between revisions
Jump to navigation
Jump to search
m (Robot: Automated text replacement (-\[\[\s*(\w[^]|]*\w)\s*\|\s*\1\s*]] +1)) |
|||
Line 1: | Line 1: | ||
{{wowapi}} __NOTOC__ | {{wowapi}} __NOTOC__ | ||
Retrieve info about a certain buff on a certain unit. | Retrieve info about a certain buff on a certain unit. | ||
name, rank, iconTexture, count, duration, timeLeft = UnitBuff(unit, buffIndex[, castable]); | |||
== Parameters == | == Parameters == | ||
Line 10: | Line 8: | ||
:(unit, buffIndex, showCastable) | :(unit, buffIndex, showCastable) | ||
:;unit : String - The [[unitId]] to query information for | :;unit : String - The [[unitId|unit]] to query information for | ||
:;buffIndex : Integer - The index of the buff to retrieve information for. Starts at 1 and goes up indefinitely until there are no more buffs on target. | :;buffIndex : Integer - The index of the buff to retrieve information for. Starts at 1 and goes up indefinitely until there are no more buffs on target. | ||
:; | :;castable : Boolean - If present and true (1), then only player-castable buffs will be returned; buffIndex still starts at 1. | ||
=== Returns === | === Returns === | ||
:;name : String - The name of the spell or effect of the buff. This is the name shown in yellow when you mouse over the icon. | |||
:; | :;rank : String - The rank of the spell or effect that caused the buff. Returns "" if there is no rank. | ||
:;iconTexture : String - The identifier of (path and filename to) the indicated buff. | |||
:; | :;count : String - The number of times the buff has been applied to the target. | ||
:;duration : Number - Full duration of a buff you cast, in seconds; nil if you did not cast this buff. | |||
:; | :;timeLeft : Number - Time left before a buff expires, in seconds; nil if you did not cast this buff. | ||
:; | |||
== Example == | == Example == | ||
Line 40: | Line 36: | ||
=== Result === | === Result === | ||
Print the names of all buffs you're currently buffed with. | |||
== History == | |||
* Path 1.9 added castable to the list of parameters. | |||
* Patch 2.0 added name and rank return values. | |||
* Patch 2.1 added duration and timeLeft return values. | |||
== See also == | == See also == | ||
: [[API UnitDebuff|UnitDebuff]] | : [[API UnitDebuff|UnitDebuff]] | ||
: [[ | : [[HOWTO: Identify Buffs Using Textures]] | ||
: [[Queriable Buff effects|List of known buff and debuff effects that can be queried]] | : [[Queriable Buff effects|List of known buff and debuff effects that can be queried]] |
Revision as of 11:10, 30 June 2007
Retrieve info about a certain buff on a certain unit.
name, rank, iconTexture, count, duration, timeLeft = UnitBuff(unit, buffIndex[, castable]);
Parameters
Arguments
- (unit, buffIndex, showCastable)
- unit
- String - The unit to query information for
- buffIndex
- Integer - The index of the buff to retrieve information for. Starts at 1 and goes up indefinitely until there are no more buffs on target.
- castable
- Boolean - If present and true (1), then only player-castable buffs will be returned; buffIndex still starts at 1.
Returns
- name
- String - The name of the spell or effect of the buff. This is the name shown in yellow when you mouse over the icon.
- rank
- String - The rank of the spell or effect that caused the buff. Returns "" if there is no rank.
- iconTexture
- String - The identifier of (path and filename to) the indicated buff.
- count
- String - The number of times the buff has been applied to the target.
- duration
- Number - Full duration of a buff you cast, in seconds; nil if you did not cast this buff.
- timeLeft
- Number - Time left before a buff expires, in seconds; nil if you did not cast this buff.
Example
local x, i = "You're currently buffed with the following buffs: ", 1; while (UnitBuff("player",i) ~= nil) do x = x .. UnitBuff("player",i) .. ", "; i = i + 1; end if (i == 1) then x = x .. "no buffs."; else x = strsub(x,0,-3) .. "."; end DEFAULT_CHAT_FRAME:AddMessage(x);
Result
Print the names of all buffs you're currently buffed with.
History
- Path 1.9 added castable to the list of parameters.
- Patch 2.0 added name and rank return values.
- Patch 2.1 added duration and timeLeft return values.