From cc347b0f12fd29c57271b36a9de6427e99ef560b Mon Sep 17 00:00:00 2001 From: jordon <29447509+jordonwow@users.noreply.github.com> Date: Sat, 9 Sep 2023 14:00:05 -0700 Subject: [PATCH] fix for Hide unwanted Debuffs by ID --- .luacheckrc | 1 + BigDebuffs.lua | 39 ++++++++++++++++++--------------------- BigDebuffs_Mainline.lua | 9 +++++++++ Custom.lua | 20 -------------------- 4 files changed, 28 insertions(+), 41 deletions(-) delete mode 100644 Custom.lua diff --git a/.luacheckrc b/.luacheckrc index eab47aa..c04d6c6 100644 --- a/.luacheckrc +++ b/.luacheckrc @@ -89,6 +89,7 @@ read_globals = { "WOW_PROJECT_ID", "WOW_PROJECT_MAINLINE", "WOW_PROJECT_WRATH_CLASSIC", + "tContains", } globals = { "BigDebuffs", diff --git a/BigDebuffs.lua b/BigDebuffs.lua index c885ddd..1a9daba 100755 --- a/BigDebuffs.lua +++ b/BigDebuffs.lua @@ -168,6 +168,8 @@ local defaults = { BigDebuffs.WarningDebuffs = addon.WarningDebuffs or {} BigDebuffs.Spells = addon.Spells +BigDebuffs.HiddenDebuffs = addon.HiddenDebuffs or {} +local tContains = tContains -- create a lookup table since CombatLogGetCurrentEventInfo() returns 0 for spellId local spellIdByName @@ -1834,26 +1836,21 @@ if WOW_PROJECT_ID == WOW_PROJECT_MAINLINE then local function addDebuffs(aura) -- aura struct https://wowpedia.fandom.com/wiki/Struct_UnitAuraInfo if (not aura) then return end - if (not BigDebuffsUnwantedSpell(aura.spellId)) then - if aura.spellId ~= unwantedSpellID then - local reaction = aura.sourceUnit and UnitReaction("player", aura.sourceUnit) or 0 - local friendlySmokeBomb = aura.spellId == 212183 and reaction > 4 - local isDispellable = self:IsDispellable(unitId, aura.dispelName); - local size = self:GetDebuffSize(aura.spellId, isDispellable) - -- make sure certain debuffs aren't dispalyed as boss auras - if size then - aura.isBossAura = false - end - if size and not friendlySmokeBomb then - tinsert(debuffs, { aura, size, self:GetDebuffPriority(aura.spellId) }) - elseif self.db.profile.raidFrames.redirectBliz then - if not frame.optionTable.displayOnlyDispellableDebuffs or isDispellable then - tinsert(debuffs, { aura, self.db.profile.raidFrames.default, 0 }) - end - end + if tContains(self.HiddenDebuffs, aura.spellId) then return end + local reaction = aura.sourceUnit and UnitReaction("player", aura.sourceUnit) or 0 + local friendlySmokeBomb = aura.spellId == 212183 and reaction > 4 + local isDispellable = self:IsDispellable(unitId, aura.dispelName); + local size = self:GetDebuffSize(aura.spellId, isDispellable) + -- make sure certain debuffs aren't dispalyed as boss auras + if size then + aura.isBossAura = false + end + if size and not friendlySmokeBomb then + tinsert(debuffs, { aura, size, self:GetDebuffPriority(aura.spellId) }) + elseif self.db.profile.raidFrames.redirectBliz then + if not frame.optionTable.displayOnlyDispellableDebuffs or isDispellable then + tinsert(debuffs, { aura, self.db.profile.raidFrames.default, 0 }) end - else - CompactUnitFrame_HideAllDebuffs(frame) end end @@ -2064,7 +2061,7 @@ function BigDebuffs:UNIT_AURA(unit) -- Check debuffs local _, n, _, _, d, e, caster, _, _, id = UnitDebuff(unit, i) if id then - if self.Spells[id] then + if self.Spells[id] and (not tContains(self.HiddenDebuffs, id)) then if LibClassicDurations then local durationNew, expirationTimeNew = LibClassicDurations:GetAuraDurationByUnit(unit, id, caster) if d == 0 and durationNew then @@ -2195,7 +2192,7 @@ function BigDebuffs:UNIT_AURA_NAMEPLATE(unit) -- Check debuffs local _, n, _, _, d, e, caster, _, _, id = UnitDebuff(unit, i) if id then - if self.Spells[id] then + if self.Spells[id] and (not tContains(self.HiddenDebuffs, id)) then if LibClassicDurations then local durationNew, expirationTimeNew = LibClassicDurations:GetAuraDurationByUnit(unit, id, caster) if d == 0 and durationNew then diff --git a/BigDebuffs_Mainline.lua b/BigDebuffs_Mainline.lua index 6e41d76..6567ca1 100644 --- a/BigDebuffs_Mainline.lua +++ b/BigDebuffs_Mainline.lua @@ -11,6 +11,15 @@ local ROOT = "roots" local IMMUNITY = "immunities" local IMMUNITY_SPELL = "immunities_spells" +addon.HiddenDebuffs = { + 80354, -- Temporal Displacement + 371070, -- Rotting From Within + 390435, -- Exhaustion + 57723, -- Exhaustion + 206151, -- Challenger's Burden + 264689, -- Fatigued +} + addon.Units = { "player", "pet", diff --git a/Custom.lua b/Custom.lua deleted file mode 100644 index 493e049..0000000 --- a/Custom.lua +++ /dev/null @@ -1,20 +0,0 @@ --- Table for function "addDebuffs(aura)" in BigDebuffs Code -BigDebuffsUnwantedSpells = { - 80354, -- Temporal Displacement - 371070, -- Rotting From Within - 390435, -- Exhaustion - 57723, -- Exhaustion - 206151, -- Challenger's Burden - 264689, -- Fatigued -} - --- Iterate through unwanted debuffs -function BigDebuffsUnwantedSpell(spellId) - for _, unwantedSpellID in ipairs(BigDebuffsUnwantedSpells) do - if unwantedSpellID == spellId then - return true - end - end - - return false -end \ No newline at end of file