WoW:API UnitBuff: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
(Resolved buffIndex question, added a proper example.) |
||
Line 12: | Line 12: | ||
:;unit : String - The [[unitId]] to query information for | :;unit : String - The [[unitId]] to query information for | ||
:;buffIndex : | :;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. | ||
:;showCastable : [[Boolean]] - If present and true (1), then only buffs will be returned which are castable by the player. Index is still starting with 1 and counting up. (Added in 1.9, works in 1.9.3) | :;showCastable : [[Boolean]] - If present and true (1), then only buffs will be returned which are castable by the player. Index is still starting with 1 and counting up. (Added in 1.9, works in 1.9.3) | ||
Line 27: | Line 27: | ||
== Example == | == 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 === | === Result === | ||
: Print the names of all buffs you're currently buffed with. | |||
: | |||
== See also == | == See also == |
Revision as of 12:33, 16 December 2006
Retrieve info about a certain buff on a certain unit.
buffName, buffRank, buffTexture, buffApplications = UnitBuff(unit, buffIndex[, showCastable]);
Parameters
Arguments
- (unit, buffIndex, showCastable)
- unit
- String - The unitId 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.
- showCastable
- Boolean - If present and true (1), then only buffs will be returned which are castable by the player. Index is still starting with 1 and counting up. (Added in 1.9, works in 1.9.3)
Returns
- buffName
- String - The name of the spell or effect of the buff. This is the name shown in yellow when you mouse over the icon. (Added in 2.0)
- buffRank
- String - The rank of the spell or effect that caused the buff. Returns "" if there is no rank. (Added in 2.0)
- buffTexture
- String - The identifier of (path and filename to) the indicated buff, or nil if no buff
- buffApplications
- String - The number of times the buff has been applied to the target.
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.