From cddea2e0945bc4945c8ab2338f75931f9f07befa Mon Sep 17 00:00:00 2001 From: Sumsebrum Date: Tue, 18 May 2021 18:31:03 +0200 Subject: [PATCH] v1.06-Beta hotfix BuffDebuff module --- Gladdy.lua | 2 +- Gladdy.toc | 2 +- Libs/LibClassAuras-1.0/LibClassAuras-1.0.lua | 13 +++++- Modules/BuffsDebuffs.lua | 48 +++++++++++--------- Modules/Racial.lua | 2 +- Options.lua | 28 ++++++++---- README.md | 7 ++- 7 files changed, 67 insertions(+), 35 deletions(-) diff --git a/Gladdy.lua b/Gladdy.lua index cbc593a..9db4aa1 100644 --- a/Gladdy.lua +++ b/Gladdy.lua @@ -25,7 +25,7 @@ local MAJOR, MINOR = "Gladdy", 4 local Gladdy = LibStub:NewLibrary(MAJOR, MINOR) local L Gladdy.version_major_num = 1 -Gladdy.version_minor_num = 0.05 +Gladdy.version_minor_num = 0.06 Gladdy.version_num = Gladdy.version_major_num + Gladdy.version_minor_num Gladdy.version_releaseType = RELEASE_TYPES.beta Gladdy.version = PREFIX .. Gladdy.version_num .. "-" .. Gladdy.version_releaseType diff --git a/Gladdy.toc b/Gladdy.toc index 2e09d39..d8269e9 100644 --- a/Gladdy.toc +++ b/Gladdy.toc @@ -1,6 +1,6 @@ ## Interface: 20501 ## Title: Gladdy - TBC -## Version: 1.0.5-Beta +## Version: 1.06-Beta ## Notes: The most powerful arena AddOn for WoW 2.5.1 ## Author: XiconQoo, DnB_Junkee, Knall ## X-Email: contact me on discord Knall#1751 diff --git a/Libs/LibClassAuras-1.0/LibClassAuras-1.0.lua b/Libs/LibClassAuras-1.0/LibClassAuras-1.0.lua index 6836a00..396f988 100644 --- a/Libs/LibClassAuras-1.0/LibClassAuras-1.0.lua +++ b/Libs/LibClassAuras-1.0/LibClassAuras-1.0.lua @@ -1,5 +1,6 @@ local type, ipairs, pairs, tinsert = type, ipairs, pairs, tinsert local GetSpellInfo = GetSpellInfo +local AURA_TYPE_DEBUFF, AURA_TYPE_BUFF = AURA_TYPE_DEBUFF, AURA_TYPE_BUFF local LibClassAuras = LibStub:NewLibrary("LibClassAuras-1.0", 1) LibClassAuras.debuffs = {} @@ -71,4 +72,14 @@ local function getClassBuffs(class) end return classSpells end -LibClassAuras.GetClassBuffs = getClassBuffs \ No newline at end of file +LibClassAuras.GetClassBuffs = getClassBuffs + +local function getSpellNameToId(auraType) + if auraType == AURA_TYPE_DEBUFF then + return LibClassAuras.debuffToId + else + return LibClassAuras.buffToId + end +end + +LibClassAuras.GetSpellNameToId = getSpellNameToId \ No newline at end of file diff --git a/Modules/BuffsDebuffs.lua b/Modules/BuffsDebuffs.lua index 35e21da..3af6759 100644 --- a/Modules/BuffsDebuffs.lua +++ b/Modules/BuffsDebuffs.lua @@ -1,7 +1,7 @@ local GetSpellInfo = GetSpellInfo local CreateFrame = CreateFrame local GetTime = GetTime -local select, lower, ceil, tremove, tinsert, pairs, ipairs = select, string.lower, ceil, tremove, tinsert, pairs, ipairs +local select, lower, ceil, tremove, tinsert, pairs, ipairs, tostring = select, string.lower, ceil, tremove, tinsert, pairs, ipairs, tostring local auraTypeColor = { } local AURA_TYPE_DEBUFF, AURA_TYPE_BUFF = AURA_TYPE_DEBUFF, AURA_TYPE_BUFF local auraTypes = {AURA_TYPE_BUFF, AURA_TYPE_DEBUFF} @@ -21,9 +21,10 @@ auraTypeColor[""] = auraTypeColor["none"] --------------------------- local Gladdy = LibStub("Gladdy") +local LibClassAuras = LibStub("LibClassAuras-1.0") local L = Gladdy.L -local defaultTrackedDebuffs = select(2, Gladdy:GetAuras("debuff")) -local defaultTrackedBuffs = select(2, Gladdy:GetAuras("buff")) +local defaultTrackedDebuffs = select(2, Gladdy:GetAuras(AURA_TYPE_DEBUFF)) +local defaultTrackedBuffs = select(2, Gladdy:GetAuras(AURA_TYPE_BUFF)) local BuffsDebuffs = Gladdy:NewModule("BuffsDebuffs", nil, { buffsEnabled = true, buffsShowAuraDebuffs = false, @@ -145,18 +146,23 @@ end function BuffsDebuffs:Test(unit) if Gladdy.db.buffsEnabled then if unit == "arena1" or unit == "arena3" then - self:AddOrRefreshAura(unit, 1943, AURA_TYPE_DEBUFF, 10, 10, 1,"physical", select(3, GetSpellInfo(1943)), 1) - self:AddOrRefreshAura(unit, 18647, AURA_TYPE_DEBUFF, 10, 10,1, "immune", select(3, GetSpellInfo(18647)), 2) - self:AddOrRefreshAura(unit, 27218, AURA_TYPE_DEBUFF, 24, 20,1, "curse", select(3, GetSpellInfo(27218)), 3) - self:AddOrRefreshAura(unit, 27216, AURA_TYPE_DEBUFF, 18, 18,1, "magic", select(3, GetSpellInfo(27216)), 4) - self:AddOrRefreshAura(unit, 27189, AURA_TYPE_DEBUFF, 12, 12,5, "poison", select(3, GetSpellInfo(27189)), 5) - self:AddOrRefreshAura(unit, 1, AURA_TYPE_BUFF, 20, 20,5, "magic", select(3, GetSpellInfo(32999)), 1) - self:AddOrRefreshAura(unit, 1, AURA_TYPE_BUFF, 20, 20,5, "magic", select(3, GetSpellInfo(25389)), 2) + BuffsDebuffs:AURA_FADE(unit, AURA_TYPE_DEBUFF) + BuffsDebuffs:AURA_FADE(unit, AURA_TYPE_BUFF) + BuffsDebuffs:AURA_GAIN(unit, AURA_TYPE_DEBUFF, 1943, select(1, GetSpellInfo(1943)), select(3, GetSpellInfo(1943)), 10, GetTime() + 10, 1, "physical") + BuffsDebuffs:AURA_GAIN(unit, AURA_TYPE_DEBUFF, 18647, select(1, GetSpellInfo(18647)), select(3, GetSpellInfo(18647)), 10, GetTime() + 10, 1, "immune") + BuffsDebuffs:AURA_GAIN(unit, AURA_TYPE_DEBUFF, 27218, select(1, GetSpellInfo(27218)), select(3, GetSpellInfo(27218)), 24, GetTime() + 20, 1, "curse") + BuffsDebuffs:AURA_GAIN(unit, AURA_TYPE_DEBUFF, 27216, select(1, GetSpellInfo(27216)), select(3, GetSpellInfo(27216)), 18, GetTime() + 18, 1, "magic") + BuffsDebuffs:AURA_GAIN(unit, AURA_TYPE_DEBUFF, 27189, select(1, GetSpellInfo(27189)), select(3, GetSpellInfo(27189)), 12, GetTime() + 12, 5, "poison") + BuffsDebuffs:AURA_GAIN(unit, AURA_TYPE_BUFF, 33076, select(1, GetSpellInfo(33076)), select(3, GetSpellInfo(33076)), 20, GetTime() + 20, 1, "magic") + BuffsDebuffs:AURA_GAIN(unit, AURA_TYPE_BUFF, 26980, select(1, GetSpellInfo(26980)), select(3, GetSpellInfo(26980)), 20, GetTime() + 20, 5, "magic") elseif unit == "arena2" then - self:AddOrRefreshAura(unit, 1943, AURA_TYPE_DEBUFF, 10, 10, 1, "physical", select(3, GetSpellInfo(1943)), 1) - self:AddOrRefreshAura(unit, 1, AURA_TYPE_DEBUFF, 20, 20,5, "poison", select(3, GetSpellInfo(1)), 2) - self:AddOrRefreshAura(unit, 1, AURA_TYPE_BUFF, 20, 20,5, "magic", select(3, GetSpellInfo(32999)), 1) - self:AddOrRefreshAura(unit, 1, AURA_TYPE_BUFF, 20, 20,5, "magic", select(3, GetSpellInfo(25389)), 2) + BuffsDebuffs:AURA_FADE(unit, AURA_TYPE_DEBUFF) + BuffsDebuffs:AURA_FADE(unit, AURA_TYPE_BUFF) + BuffsDebuffs:AURA_GAIN(unit, AURA_TYPE_DEBUFF, 1943, select(1, GetSpellInfo(1943)), select(3, GetSpellInfo(1943)), 10, GetTime() + 10, 1, "physical") + BuffsDebuffs:AURA_GAIN(unit, AURA_TYPE_DEBUFF, 1, select(1, GetSpellInfo(1)), select(3, GetSpellInfo(1)), 20, GetTime() + 20, 5, "poison") + BuffsDebuffs:AURA_GAIN(unit, AURA_TYPE_BUFF, 27009, select(1, GetSpellInfo(27009)), select(3, GetSpellInfo(27009)), 20, GetTime() + 15, 1, "magic") + BuffsDebuffs:AURA_GAIN(unit, AURA_TYPE_BUFF, 11426, select(1, GetSpellInfo(11426)), select(3, GetSpellInfo(11426)), 10, GetTime() + 10, 1, "magic") + end end end @@ -196,11 +202,13 @@ function BuffsDebuffs:AURA_GAIN(unit, auraType, spellID, spellName, texture, dur return end local auraFrame = self.frames[unit] - local aura = Gladdy.db.auraListDefault[spellName] and Gladdy.db.auraListDefault[spellName].enabled + 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 - if not aura and spellID and expirationTime and (Gladdy.db.trackedBuffs[spellName] or Gladdy.db.trackedDebuffs[spellName]) then + 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 index if auraType == AURA_TYPE_DEBUFF then auraFrame.numDebuffs = auraFrame.numDebuffs + 1 @@ -459,10 +467,6 @@ function BuffsDebuffs:UpdateAurasOnUnit(unit) end end -function BuffsDebuffs:UNIT_DEATH(destUnit) - self:RemoveAuras(destUnit) -end - local function iconTimer(auraFrame, elapsed) if auraFrame.endtime ~= "undefined" then local timeLeftMilliSec = auraFrame.endtime - GetTime() @@ -1021,7 +1025,7 @@ function BuffsDebuffs:GetOptions() type = "group", order = 11, childGroups = "tree", - args = select(1, Gladdy:GetAuras("debuff")), + args = select(1, Gladdy:GetAuras(AURA_TYPE_DEBUFF)), set = function(info, state) local optionKey = info[#info] Gladdy.dbi.profile.trackedDebuffs[optionKey] = state @@ -1036,7 +1040,7 @@ function BuffsDebuffs:GetOptions() type = "group", order = 12, childGroups = "tree", - args = select(1, Gladdy:GetAuras("buffs")), + args = select(1, Gladdy:GetAuras(AURA_TYPE_BUFF)), set = function(info, state) local optionKey = info[#info] Gladdy.dbi.profile.trackedBuffs[optionKey] = state diff --git a/Modules/Racial.lua b/Modules/Racial.lua index 9d6725d..7736504 100644 --- a/Modules/Racial.lua +++ b/Modules/Racial.lua @@ -194,7 +194,7 @@ function Racial:ResetUnit(unit) if (not racial) then return end - + racial.texture:SetTexture(nil) racial.timeLeft = nil racial.active = false racial.cooldown:Clear() diff --git a/Options.lua b/Options.lua index fc7fa5d..318f7f6 100644 --- a/Options.lua +++ b/Options.lua @@ -4,6 +4,7 @@ local InterfaceOptionsFrame_OpenToFrame = InterfaceOptionsFrame_OpenToFrame local GetSpellInfo = GetSpellInfo local LOCALIZED_CLASS_NAMES_MALE = LOCALIZED_CLASS_NAMES_MALE local CLASS_ICON_TCOORDS = CLASS_ICON_TCOORDS +local AURA_TYPE_DEBUFF, AURA_TYPE_BUFF = AURA_TYPE_DEBUFF, AURA_TYPE_BUFF local Gladdy = LibStub("Gladdy") local LibClassAuras = LibStub("LibClassAuras-1.0") @@ -597,8 +598,14 @@ function Gladdy:GetAuras(auraType) name = "Check All", type = "execute", func = function(info) - for k,v in pairs(Gladdy.dbi.profile.trackedDebuffs) do - Gladdy.dbi.profile.trackedDebuffs[k] = true + if auraType == AURA_TYPE_DEBUFF then + for k,v in pairs(Gladdy.defaults.profile.trackedDebuffs) do + Gladdy.dbi.profile.trackedDebuffs[k] = true + end + else + for k,v in pairs(Gladdy.defaults.profile.trackedBuffs) do + Gladdy.dbi.profile.trackedBuffs[k] = true + end end end, }, @@ -608,8 +615,14 @@ function Gladdy:GetAuras(auraType) name = "Uncheck All", type = "execute", func = function(info) - for k,v in pairs(Gladdy.dbi.profile.trackedDebuffs) do - Gladdy.dbi.profile.trackedDebuffs[k] = false + if auraType == AURA_TYPE_DEBUFF then + for k,v in pairs(Gladdy.defaults.profile.trackedDebuffs) do + Gladdy.dbi.profile.trackedDebuffs[k] = false + end + else + for k,v in pairs(Gladdy.defaults.profile.trackedBuffs) do + Gladdy.dbi.profile.trackedBuffs[k] = false + end end end, }, @@ -689,13 +702,12 @@ function Gladdy:GetAuras(auraType) local defaultDebuffs = {} local assignForClass = function(class) local args = {} - local classSpells = auraType == "debuff" and LibClassAuras.GetClassDebuffs(class) or LibClassAuras.GetClassBuffs(class) + local classSpells = auraType == AURA_TYPE_DEBUFF and LibClassAuras.GetClassDebuffs(class) or LibClassAuras.GetClassBuffs(class) table.sort(classSpells, function(a, b) return a.name:upper() < b.name:upper() end) for i=1, #classSpells do - local spellName, _, texture = GetSpellInfo(classSpells[i].id[#classSpells[i].id]) - --spellName = (classSpells[i].id[#classSpells[i].id] == 31117 or classSpells[i].id[#classSpells[i].id] == 43523) and "Unstable Affliction Silence" or spellName + local _, _, texture = GetSpellInfo(classSpells[i].id[#classSpells[i].id]) if classSpells[i].texture then texture = classSpells[i].texture end @@ -705,7 +717,7 @@ function Gladdy:GetAuras(auraType) type = "toggle", image = texture, width = "2", - arg = classSpells[i].name + arg = tostring(classSpells[i].id[1]) } defaultDebuffs[tostring(classSpells[i].id[1])] = true end diff --git a/README.md b/README.md index 674fd38..3650a36 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Gladdy - TBC ### The most powerful arena addon for WoW TBC 2.5.1 -## [v1.0.5-Beta Download Here](https://github.com/XiconQoo/Gladdy-TBC/releases/download/v1.0.5-Beta/Gladdy_TBC-Classic_v1.0.5-Beta.zip) +## [v1.06-Beta Download Here](https://github.com/XiconQoo/Gladdy-TBC/releases/download/v1.06-Beta/Gladdy_TBC-Classic_v1.06-Beta.zip) ###### Please consider donating if you like my work @@ -35,6 +35,11 @@ The goal is to make Gladdy highly configurable in it's appearance. Everything ca ### Changes +#### v1.06-Beta +- fixed BuffsDebuff module +- fix racial texture reset +- minor bugfixes + #### v1.0.5-Beta - fixed Aura-Module - Racial module added to EventListener and Version check updated