Post by Neffi
There is no one-off way to detect this on other units right now. I tried when I was developing a CC alert like the one added to the default UI. Your only option is tracking individual spells. You can do this in one of two ways.
Store a table of known spells. Eg:
local freeze_effects = {
= true,
}
You either need to listen to UNIT_AURA or COMBAT_LOG_EVENT_UNFILTERED.
If you listen to UNIT_AURA, you need to compare argument1 to the unit in quest, and then iterate over the table to look for effects present:
local function UNIT_AURA(unit)
if unit ~= 'target' then return end
for spell in pairs(freeze_effects) do
local _,_,_ = UnitAura(target,'HARMFUL',spell)
end
Check the returns to see if the debuff exists (first arg will be non-nil) and then check the other returns to obtain the duration. Track it as you please.
The other way is listening to the combat log. I can give you an example from my own code that you can adapt. See the
procs section:
http://code.google.com/p/neffi-wow/source/browse/trunk/nfCombatText/regions/alerts.lua#85 . It looks for a specific sub-event (aura application), checks that the unit is the unit I care about (player) by comparing GUID, and then checks if the spell being applied is one of the spells I care about (within the table).
Edit: The line might be confusing:
if not player(dest) then return end
That's a utility function which is essentially just doing:
if dest ~= UnitGUID('player') then return end