From 01f907f71c031d62ef35812d60b2782be593f208 Mon Sep 17 00:00:00 2001 From: Sumsebrum Date: Sat, 18 Sep 2021 13:15:27 +0200 Subject: [PATCH] fix import for TW and general issue with BuffsDebuffs --- Libs/LibClassAuras-1.0/LibClassAuras-1.0.lua | 39 +++++++++++++++----- Modules/BuffsDebuffs.lua | 18 +++++++-- 2 files changed, 45 insertions(+), 12 deletions(-) diff --git a/Libs/LibClassAuras-1.0/LibClassAuras-1.0.lua b/Libs/LibClassAuras-1.0/LibClassAuras-1.0.lua index 396f988..1a67d4c 100644 --- a/Libs/LibClassAuras-1.0/LibClassAuras-1.0.lua +++ b/Libs/LibClassAuras-1.0/LibClassAuras-1.0.lua @@ -7,6 +7,7 @@ LibClassAuras.debuffs = {} LibClassAuras.debuffToId = {} LibClassAuras.buffs = {} LibClassAuras.buffToId = {} +LibClassAuras.altNames = {} local function Spell(id, opts, class, spellTable, idTable) if not opts or not class then @@ -26,9 +27,20 @@ local function Spell(id, opts, class, spellTable, idTable) return end if opts.altName then - idTable[opts.altName] = {id = id , class = class} + for _,v in ipairs(id) do + LibClassAuras.altNames[v] = opts.altName + end + if idTable[opts.altName] then + tinsert(idTable[opts.altName], {id = id , class = class}) + else + idTable[opts.altName] = {[1] = {id = id , class = class}} + end else - idTable[spellName] = {id = id , class = class} + if idTable[spellName] then + tinsert(idTable[spellName], {id = id , class = class}) + else + idTable[spellName] = {[1] = {id = id , class = class}} + end end if type(id) == "table" then @@ -54,9 +66,11 @@ LibClassAuras.Buff = Buff local function getClassDebuffs(class) local classSpells = {} - for k,v in pairs(LibClassAuras.debuffToId) do - if v.class == class then - tinsert(classSpells, {name = k, id = v.id}) + for name, spells in pairs(LibClassAuras.debuffToId) do + for _, spellInfo in ipairs(spells) do + if spellInfo.class == class then + tinsert(classSpells, {name = name, id = spellInfo.id}) + end end end return classSpells @@ -65,9 +79,11 @@ LibClassAuras.GetClassDebuffs = getClassDebuffs local function getClassBuffs(class) local classSpells = {} - for k,v in pairs(LibClassAuras.buffToId) do - if v.class == class then - tinsert(classSpells, {name = k, id = v.id}) + for name, spells in pairs(LibClassAuras.buffToId) do + for _, spellInfo in ipairs(spells) do + if spellInfo.class == class then + tinsert(classSpells, {name = name, id = spellInfo.id}) + end end end return classSpells @@ -82,4 +98,9 @@ local function getSpellNameToId(auraType) end end -LibClassAuras.GetSpellNameToId = getSpellNameToId \ No newline at end of file +LibClassAuras.GetSpellNameToId = getSpellNameToId + +local function getAltName(spellID) + return LibClassAuras.altNames[spellID] +end +LibClassAuras.GetAltName = getAltName \ No newline at end of file diff --git a/Modules/BuffsDebuffs.lua b/Modules/BuffsDebuffs.lua index 7940fd6..61eed84 100644 --- a/Modules/BuffsDebuffs.lua +++ b/Modules/BuffsDebuffs.lua @@ -138,7 +138,8 @@ function BuffsDebuffs:Test(unit) BuffsDebuffs:AURA_FADE(unit, AURA_TYPE_DEBUFF) BuffsDebuffs:AURA_FADE(unit, AURA_TYPE_BUFF) - + --BuffsDebuffs:AURA_GAIN(unit, AURA_TYPE_BUFF, 1243, select(1, GetSpellInfo(1243)), select(3, GetSpellInfo(1243)), 10, GetTime() + 10, 1, "physical") + --self:AURA_GAIN(unit, AURA_TYPE_DEBUFF, 31117, select(1, GetSpellInfo(31117)), select(3, GetSpellInfo(31117)), 10, GetTime() + 10, 1, "physical") local i = 1 for spellID, enabled in pairs(Gladdy.db.trackedDebuffs) do if i > 4 then @@ -197,13 +198,24 @@ function BuffsDebuffs:AURA_GAIN(unit, auraType, spellID, spellName, texture, dur return end local auraFrame = self.frames[unit] + spellName = LibClassAuras.GetAltName(spellID) or spellName local aura = Gladdy:GetImportantAuras()[spellName] and Gladdy.db.auraListDefault[tostring(Gladdy:GetImportantAuras()[spellName].spellID)].enabled if aura and Gladdy.db.buffsShowAuraDebuffs then aura = false end local auraNames = LibClassAuras.GetSpellNameToId(auraType) - local spellId = auraNames[spellName] and auraNames[spellName].id[1] - if not aura and spellID and spellId and expirationTime and (Gladdy.db.trackedBuffs[tostring(spellId)] or Gladdy.db.trackedDebuffs[tostring(spellId)]) then + local spellId + local isTracked = false + if auraNames[spellName] then + for _, spellInfo in ipairs(auraNames[spellName]) do + spellId = spellInfo.id[1] + if (Gladdy.db.trackedBuffs[tostring(spellId)] or Gladdy.db.trackedDebuffs[tostring(spellId)]) then + isTracked = true + break + end + end + end + if not aura and spellID and expirationTime and isTracked then local index if auraType == AURA_TYPE_DEBUFF then auraFrame.numDebuffs = auraFrame.numDebuffs + 1