Add Whitelist|Blacklist for (De)buffs
pquerner opened this issue ยท 3 comments
-- Debuffs Blacklist
defaults[#defaults+1] = {tab = {
type="tab",
value="Debuffs Blacklist",
}}
defaults[#defaults+1] = {text = {
type="text",
value="Add Debuffs to the Blacklist you don't want to see."
}}
local debuffblacklist = {
};
defaults[#defaults+1] = {debuffblacklist = {
type = "list",
value = debuffblacklist,
label = "Blacklisted Debuffs",
}}
I have added this to core.lua and check whether or not I show the icon:
local function UpdateAura(self, index, filter)
local unit = self:GetParent():GetAttribute('unit')
local filter = self:GetParent():GetAttribute('filter')
local name,b1,texture,count,b2,b3, expiration = UnitAura(unit, index, filter)
if(name) then
if(filter == 'HARMFUL' and debuffblacklist) then
for k,v in pairs(debuffblacklist) do
if k == name then
self:SetSize(0,0);
end
end
end
self.texture:SetTexture(texture)
self.count:SetText(count > 1 and count or '')
self.expiration = expiration - GetTime()
end
end
However, what I dont understand is how to use the "database" (WTF) file. It always goes back to default (local variable). Can you help with this? I'm sure its just a one-liner but I dont have much exp in addon developing.
If its working just fine I'll PR this to you so it can be added in the original addon.
The debuffblacklist table you made would just be the default values that the list is populated with for the first time (when it initializes that db entry)
To reference the actual database you'd use config.debuffblacklist
I'll have to test this code more when I'm home, the icons have to remain untainted in order to allow for right-click buff cancelling, and I think modifying the size of them mid-combat taints the header.