corporategoth / rotationmaster

MIT License
2 stars 4 forks source link

Add "buff not present" to conditions. #41

Open Rurahk opened 8 months ago

Rurahk commented 8 months ago

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_holydivinespirit", 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.