Add "buff not present" to conditions.
Rurahk opened this issue ยท 0 comments
Usefull for if you need to know if a buff has expired, copy everythin from "BUFF", invert the return values:
addon:RegisterCondition("NO_BUFF", {
description = L["Buff Not Present"],
icon = "Interface\Icons\spell_holy_divinespirit",
fields = { unit = "string", spell = "string", ownbuff = "boolean" },
valid = function(_, value)
return (value.unit ~= nil and addon.isin(addon.units, value.unit) and value.spell ~= nil)
end,
evaluate = function(value, cache)
for i = 1, 40 do
local name, _, _, _, _, _, caster = addon.getCached(cache, UnitBuff, value.unit, i)
if (name == nil) then
break
end
if name == value.spell then
if (not value.ownbuff or caster == "player") then
return false
end
end
end
return true
end,
The rest of the function is identical to the BUFF function.