Skip to content

Add "buff not present" to conditions. #41

@Rurahk

Description

@Rurahk

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions