Navigation menu

WoW:API UnitBuff: Difference between revisions

Jump to navigation Jump to search
m
Move page script moved page API UnitBuff to WoW:API UnitBuff without leaving a redirect
mNo edit summary
m (Move page script moved page API UnitBuff to WoW:API UnitBuff without leaving a redirect)
 
(12 intermediate revisions by 10 users not shown)
Line 1: Line 1:
{{wowapi}} __NOTOC__
{{wowapi}} __NOTOC__
Retrieve info about a certain buff on a certain unit.
Retrieves info about a certain buff on a certain unit. This is essentially an alias of [[API_UnitAura|UnitAura]] with the "HELPFUL" filter.
  name, rank, iconTexture, count, duration, timeLeft = UnitBuff(unit, buffIndex[, castable]);
  name, rank, icon, count, debuffType, duration, expirationTime, unitCaster, isStealable,
shouldConsolidate, spellId = UnitBuff("unit", [index] or ["name", "rank"][, "filter"])  


In 3.0, the returns will change:
== Arguments ==
name, rank, icon, count, debuffType, duration, expirationTime, isMine, isStealable = UnitBuff(unit, buffIndex[, castable])
;unitId : String - The [[unitId|unit]] to query information for
;index or name : Number or string - The index or name of the buff to retrieve information for. Indices start at 1 and go up indefinitely until there are no more buffs on target.
;filter : String - zero or more of "PLAYER", "RAID", "CANCELABLE", "NOT_CANCELABLE", separated by pipe ("|") or space characters.


== Parameters ==
== Returns ==
=== Arguments ===
;name : String - The name of the spell or effect of the buff, or nil if no buff was found with the specified name or at the specified index. This is the name shown in yellow when you mouse over the icon.
 
;rank : String - The rank line from the tooltip of the spell or effect that caused the buff, e.g. "Rank 2". Returns "" if there is no rank.
:(unit, buffIndex, showCastable)
;iconTexture : String - The identifier of (path and filename to) the indicated buff.
 
;count : Number - The number of times the buff has been applied to the target.
:;unit : String - The [[unitId|unit]] to query information for
;debuffType : String - The magic type of the buff
 
;duration : Number - The full duration of the buff in seconds
:;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.
;expirationTime : Number - Time the buff will expire in seconds
 
;source : String - The [[unitId|unit]] that cast the buff
:;castable : Boolean - If present and true (1), then only player-castable buffs will be returned; buffIndex still starts at 1.
;isStealable : Boolean - 1 if it is stealable otherwise nil
 
;shouldConsolidate : Boolean - 1 if the buff should be placed in a buff consolidation box (usually long-term effects).
=== Returns ===
;spellId : Number - spell ID of the aura.
:;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 56: Line 53:
* Patch 2.4 (Live) has corrected the bug introduced in 2.3.2. The castable parameter correctly filters non-castable buffs once again.
* Patch 2.4 (Live) has corrected the bug introduced in 2.3.2. The castable parameter correctly filters non-castable buffs once again.
* Patch 3.0 updated the return values.
* Patch 3.0 updated the return values.
* Patch 3.1 changed the boolean return value isMine to the string value source.


== See also ==
== See also ==
Anonymous user