oUF

99.9k Downloads

custom filter

fafaraway opened this issue · 2 comments

commented

hey guys ⚡️

these filters suppose to filter my buffs and debuffs, but since oUF7.0 or BfA, they dont work anymore, any idea 😭

local Debuffs = CreateFrame("Frame", nil, self)
Debuffs.initialAnchor = "CENTER"
Debuffs:SetPoint("BOTTOM", 0, powerHeight - 1)
Debuffs["growth-x"] = "RIGHT"
Debuffs["spacing-x"] = 4

Debuffs:SetHeight(16)
Debuffs:SetWidth(37)
Debuffs.num = 2
Debuffs.size = 16

Debuffs.showDebuffType = true
Debuffs.showStealableBuffs = true
Debuffs.disableCooldown = true

self.Debuffs = Debuffs

-- Import the global table for faster usage
local hideDebuffs = C.hideDebuffs

Debuffs.CustomFilter = function(_, _, _, _, _, _, _, _, _, _, caster, _, _, spellID)
	if hideDebuffs[spellID] then
		return false
	end
	return true
end

Debuffs.PostUpdate = function(icons)
	local vb = icons.visibleDebuffs

	if vb == 2 then
		Debuffs:SetPoint("BOTTOM", -9, 0)
	else
		Debuffs:SetPoint("BOTTOM")
	end
end

Debuffs.PostCreateIcon = PostCreateIcon
Debuffs.PostUpdateIcon = PostUpdateIcon
local Buffs = CreateFrame("Frame", nil, self)
		Buffs.initialAnchor = "CENTER"
		Buffs:SetPoint("TOP", 0, -2)
		Buffs["growth-x"] = "RIGHT"
		Buffs["spacing-x"] = 3

		Buffs:SetSize(43, 12)
		Buffs.num = 3
		Buffs.size = 12

		Buffs.showDebuffType = true
		Buffs.showStealableBuffs = true
		Buffs.disableCooldown = true

		self.Buffs = Buffs


		local myBuffs = C.myBuffs
		local allBuffs = C.allBuffs

		Buffs.CustomFilter = function(_, unit, button, _, _, _, _, _, _, _, caster, _, _, spellID)
			if (button.isPlayer and myBuffs[spellID]) or allBuffs[spellID] then
				return true
			end
			return false
		end



		Buffs.PostUpdate = function(icons)
			local vb = icons.visibleBuffs

			if vb == 3 then
				Buffs:SetPoint("TOP", -15, -2)
			elseif vb == 2 then
				Buffs:SetPoint("TOP", -7, -2)
			else
				Buffs:SetPoint("TOP", 0, -2)
			end
		end

		Buffs.PostCreateIcon = PostCreateIcon
		Buffs.PostUpdateIcon = PostUpdateIcon
commented

The arguments to CustomFilter was changed in 8.0. It's mentioned in the upgrade guide. Just removing one of the , _ parameters before caster should be enough to fix it.

commented

wow, thanks haste, it's lifesaving 👍