API UnitDebuff

From Wowpedia
Jump to: navigation, search

Retrieve info about a certain debuff on a certain unit. This is essentially an alias of UnitAura with the "HARMFUL" filter applied.

name, rank, icon, count, debuffType, duration, expirationTime, unitCaster, isStealable, nameplateShowPersonal, spellId, canApplyAura, isBossDebuff, nameplateShowAll, timeMod, value1, value2, value3
 = UnitDebuff("unit", index or "name"[, "rank"[, "filter"]])

If the second parameter is a string, then the third parameter is the rank (which can be nil)

Either use:
unit, index, filter
or
unit, name, rank, filter

Examples:

  • UnitDebuff("target", 1) -- First debuff on target
  • UnitDebuff("target", 1, "PLAYER") -- First debuff, cast by the player, on the target
  • UnitDebuff("player", "Immolate") -- first instance of "Immolate" on the player

Arguments

unit 
String - The unit you want debuff information for.
index 
Number - The index of the debuff to retrieve info for. Starts at 1, maximum 40.
filter 
This parameter can be any of "PLAYER", "RAID", "CANCELABLE", "NOT_CANCELABLE". You can also specify several filters separated by a | or space character to chain multiple filters together (e.g. "NOT_CANCELABLE|RAID" or "NOT_CANCELABLE RAID" == un-cancelable debuffs that you can cast on your raid).

Returns

name 
String - The name of the spell or effect of the debuff, or nil if no debuff 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 of the spell or effect that caused the debuff. Returns "" if there is no rank.
icon 
String - The identifier of (path and filename to) the indicated debuff, or nil if no debuff
count 
Number - The number of times the debuff has been applied to the target. Returns 0 for any debuff which doesn't stack. ( Changed in 1.11 ).
debuffType 
String - The type of the debuff: Magic, Disease, Poison, Curse, or nothing for those with out a type.
duration 
Number - The full duration of the debuff in seconds; nil if the debuff was not cast by the player.
expirationTime 
Number - Time at which the debuff expires (GetTime() as a reference frame).
unitCaster 
String - unitId reference to the unit that cast the buff/debuff.
isStealable 
Boolean - true if it is sealable
nameplateShowPersonal 
Boolean - true if the buff should be shown on the player/pet/vehicle nameplate
spellId 
Number - spell ID of the aura.
canApplyAura 
Boolean - true if the player can apply the aura (not necessarily if the player did apply the aura, just if the player can apply the aura).
isBossDebuff 
Boolean - true if the aura was cast by a boss.
nameplateShowAll 
Boolean - true if the buff should be shown on nameplates
timeMod 
Number - scaling factor for displaying time left
value1
Number - Value of variable effect 1 of the aura. (HoTs, resource-capturing trinkets, etc.)
value2
Number - Value of variable effect 2 of the aura. (HoTs, resource-capturing trinkets, etc.) - Malkorok's shield value (for all versions of the debuff), and Tortus' heroic's shield value.
value3
Number - Value of variable effect 3 of the aura. (HoTs, resource-capturing trinkets, etc.) - Norushen's Corruption debuff power value for example.

Example

Retrieves the name, rank and icon texture of the first debuff on the player's pet:

name, rank, texture = UnitDebuff("pet", 1);

Or to obtain Malkorok's barrier value then:

local unit = "player"
local barriervalue = select(17,UnitDebuff(unit,"Strong Ancient Barrier")) or 0
if barriervalue==0 then
        barriervalue = select(17,UnitDebuff(unit,"Ancient Barrier")) or 0
end
if barriervalue==0 then
        barriervalue = select(17,UnitDebuff(unit,"Weak Ancient Barrier")) or 0
end

Macros

Macro to print a list of the target's debuffs:

/run for i=1,40 do local D= UnitDebuff("target",i); if D then print(i.."="..D) end end

Notes

  • UnitDebuff and other UnitAura-based queries may not be accurate immediately after casting a spells that applies an aura to its target.

Patch changes

  • Legion Patch 7.0.3 (2016-07-19): Added return values "nameplateShowAll" and "timeMod"; changed "shouldConsolidate" to "nameplateShowPersonal".
  • Cataclysm Patch 4.2.0 (2011-06-28): Re-added the return values "canApplyAura" and "isBossDebuff" and added return values value[1-3].
  • Cataclysm Patch 4.0.1 (2010-10-12): Removed the return values "canApplyAura" and "isBossDebuff".
  • WotLK Patch 3.3.0 (2009-12-08): Added shouldConsolidate and spellId.
  • WotLK Patch 3.1.0 (2009-04-14): Changed "isMine" to "unitCaster". It is now possible for addons to retrieve the unitId that cast the buff/debuff.
  • WotLK Patch 3.0.2 (2008-10-14): Changed this into an alias of UnitAura; durations are now available for all debuffs.
  • TBC Patch 2.1.0 (2007-05-22): Introduced duration and timeLeft return values.
  • TBC Patch 2.0.1 (2006-12-05): Introduced name and rank return values and extended the maximum number of debuffs to 40 (from 16).
  • WoW Icon 16x16.png Patch 1.9.0 (2006-01-03): Introduced the removable argument.

See also

UnitAura, UnitBuff.
HOWTO: Identify Buffs Using Textures
List of known buff and debuff effects that can be queried