From 114c0ac96d39eca8ef2e618c7c17e0e8fa0b2883 Mon Sep 17 00:00:00 2001 From: Sumsebrum Date: Tue, 11 Jan 2022 00:29:30 +0100 Subject: [PATCH] clean up --- EventListener.lua | 2 +- Modules/Cooldowns.lua | 5 +-- Modules/ExportImport.lua | 5 ++- Modules/Healthbar.lua | 16 +------- Modules/XiconProfiles.lua | 81 ++++++--------------------------------- 5 files changed, 19 insertions(+), 90 deletions(-) diff --git a/EventListener.lua b/EventListener.lua index e867791..aef0ae1 100644 --- a/EventListener.lua +++ b/EventListener.lua @@ -136,7 +136,7 @@ function EventListener:COMBAT_LOG_EVENT_UNFILTERED() else unitClass = Gladdy.buttons[srcUnit].race end - Cooldowns:CooldownUsed(srcUnit, unitClass, spellId, spellName) + Cooldowns:CooldownUsed(srcUnit, unitClass, spellId) Gladdy:DetectSpec(srcUnit, Gladdy.specSpells[spellName]) end end diff --git a/Modules/Cooldowns.lua b/Modules/Cooldowns.lua index f5803da..3ca104e 100644 --- a/Modules/Cooldowns.lua +++ b/Modules/Cooldowns.lua @@ -42,7 +42,7 @@ local function getDefaultCooldown() if spellName then cooldowns[tostring(spellId)] = true else - Gladdy:Print("spellid does not exist " .. spellId) + Gladdy:Debug("ERROR", "spellid does not exist " .. spellId) end end end @@ -79,7 +79,7 @@ function Cooldowns:Initialize() self.cooldownSpellIds[spellName] = spellId self.spellTextures[spellId] = texture else - Gladdy:Print("spellid does not exist " .. spellId) + Gladdy:Debug("ERROR", "spellid does not exist " .. spellId) end end end @@ -373,7 +373,6 @@ function Cooldowns:DetectSpec(unit, spec) end end end - --end end ---------------------- --- RACE FUNCTIONALITY diff --git a/Modules/ExportImport.lua b/Modules/ExportImport.lua index 889189a..2ac8895 100644 --- a/Modules/ExportImport.lua +++ b/Modules/ExportImport.lua @@ -72,6 +72,7 @@ importButton:SetCallback("OnClick", function(widget) Gladdy:Reset() Gladdy:HideFrame() Gladdy:ToggleFrame(3) + LibStub("AceConfigRegistry-3.0"):NotifyChange("Gladdy") end) import:AddChild(importButton) import.button = importButton @@ -117,7 +118,7 @@ local function checkIsDeletedOption(k, str, msg, errorFound, errorMsg) for key, _ in pairs(deletedOptions) do if str_match(k, key) then isDeleted = true - Gladdy:Warn("found deleted option =", str .. "." .. k) + Gladdy:Debug("WARN", "found deleted option =", str .. "." .. k) end end if errorFound then @@ -231,7 +232,7 @@ function ExportImport:ApplyImport(t, table, str) if (table[k] ~= nil) then ExportImport:ApplyImport(v, table[k], str .. "." .. k) else - Gladdy:Warn("ApplyImport failed for", str .. "." .. k) + Gladdy:Debug("ERROR", "ApplyImport failed for", str .. "." .. k) end else diff --git a/Modules/Healthbar.lua b/Modules/Healthbar.lua index 31e850a..bda54ef 100644 --- a/Modules/Healthbar.lua +++ b/Modules/Healthbar.lua @@ -251,7 +251,7 @@ function Healthbar:ENEMY_SPOTTED(unit) healthBar.hp:SetValue(health) Healthbar:SetHealthText(healthBar, health, healthMax) end - if Gladdy.db.healthName and not Gladdy.db.healthNameToArenaId then + if button.name and Gladdy.db.healthName and not Gladdy.db.healthNameToArenaId then healthBar.nameText:SetText(button.name) end @@ -504,20 +504,6 @@ function Healthbar:GetOptions() width = "full", disabled = function() return not Gladdy.db.healthName end }), - healthActual = option({ - type = "toggle", - name = L["Show the actual health"], - desc = L["Show the actual health on the health bar"], - order = 4, - width = "full", - }), - healthMax = option({ - type = "toggle", - name = L["Show max health"], - desc = L["Show max health on the health bar"], - order = 5, - width = "full", - }), healthPercentage = option({ type = "toggle", name = L["Show health percentage"], diff --git a/Modules/XiconProfiles.lua b/Modules/XiconProfiles.lua index ab871d9..bd12442 100644 --- a/Modules/XiconProfiles.lua +++ b/Modules/XiconProfiles.lua @@ -4,74 +4,17 @@ local L = Gladdy.L local XiconProfiles = Gladdy:NewModule("XiconProfiles", nil, { }) -function XiconProfiles:ApplyKlimp() - local deserialized = Gladdy.modules["Export Import"]:Decode(Gladdy:GetKlimpProfile()) - if deserialized then - Gladdy.modules["Export Import"]:ApplyImport(deserialized, Gladdy.db) - end - Gladdy:Reset() - Gladdy:HideFrame() - Gladdy:ToggleFrame(3) -end - -function XiconProfiles:ApplyKnall() - local deserialized = Gladdy.modules["Export Import"]:Decode(Gladdy:GetKnallProfile()) - if deserialized then - Gladdy.modules["Export Import"]:ApplyImport(deserialized, Gladdy.db) - end - Gladdy:Reset() - Gladdy:HideFrame() - Gladdy:ToggleFrame(3) -end - -function XiconProfiles:ApplyClassic() - local deserialized = Gladdy.modules["Export Import"]:Decode(Gladdy:GetClassicProfile()) - if deserialized then - Gladdy.modules["Export Import"]:ApplyImport(deserialized, Gladdy.db) - end - Gladdy:Reset() - Gladdy:HideFrame() - Gladdy:ToggleFrame(3) -end - -function XiconProfiles:ApplyClassicNoPet() - local deserialized = Gladdy.modules["Export Import"]:Decode(Gladdy:GetClassicProfileNoPet()) - if deserialized then - Gladdy.modules["Export Import"]:ApplyImport(deserialized, Gladdy.db) - end - Gladdy:Reset() - Gladdy:HideFrame() - Gladdy:ToggleFrame(3) -end - -function XiconProfiles:ApplyBlizz() - local deserialized = Gladdy.modules["Export Import"]:Decode(Gladdy:GetBlizzardProfile()) - if deserialized then - Gladdy.modules["Export Import"]:ApplyImport(deserialized, Gladdy.db) - end - Gladdy:Reset() - Gladdy:HideFrame() - Gladdy:ToggleFrame(3) -end - -function XiconProfiles:ApplyRukk() - local deserialized = Gladdy.modules["Export Import"]:Decode(Gladdy:GetRukkProfile()) - if deserialized then - Gladdy.modules["Export Import"]:ApplyImport(deserialized, Gladdy.db) - end - Gladdy:Reset() - Gladdy:HideFrame() - Gladdy:ToggleFrame(3) -end - -function XiconProfiles:ApplyMir() - local deserialized = Gladdy.modules["Export Import"]:Decode(Gladdy:GetMirProfile()) +local function applyProfile(profileString) + local deserialized = Gladdy.modules["Export Import"]:Decode(profileString) if deserialized then Gladdy.modules["Export Import"]:ApplyImport(deserialized, Gladdy.db) end Gladdy:Reset() Gladdy:HideFrame() Gladdy:ToggleFrame(3) + Gladdy.options.args.lock.name = Gladdy.db.locked and L["Unlock frame"] or L["Lock frame"] + Gladdy.options.args.showMover.name = Gladdy.db.showMover and L["Hide Mover"] or L["Show Mover"] + LibStub("AceConfigRegistry-3.0"):NotifyChange("Gladdy") end function XiconProfiles:GetOptions() @@ -85,7 +28,7 @@ function XiconProfiles:GetOptions() type = "execute", func = function() Gladdy.dbi:ResetProfile(Gladdy.dbi:GetCurrentProfile()) - XiconProfiles:ApplyBlizz() + applyProfile(Gladdy:GetBlizzardProfile()) end, name = " ", desc = "Blizzard " .. L["Profile"], @@ -104,7 +47,7 @@ function XiconProfiles:GetOptions() type = "execute", func = function() Gladdy.dbi:ResetProfile(Gladdy.dbi:GetCurrentProfile()) - XiconProfiles:ApplyClassic() + applyProfile(Gladdy:GetClassicProfile()) end, name = " ", desc = "Classic " .. L["Profile"], @@ -123,7 +66,7 @@ function XiconProfiles:GetOptions() type = "execute", func = function() Gladdy.dbi:ResetProfile(Gladdy.dbi:GetCurrentProfile()) - XiconProfiles:ApplyClassicNoPet() + applyProfile(Gladdy:GetClassicProfileNoPet()) end, name = " ", desc = "Classic " .. L["Profile"] .. L[" No Pet"], @@ -142,7 +85,7 @@ function XiconProfiles:GetOptions() type = "execute", func = function() Gladdy.dbi:ResetProfile(Gladdy.dbi:GetCurrentProfile()) - XiconProfiles:ApplyKnall() + applyProfile(Gladdy:GetKnallProfile()) end, name = " ", desc = "Knall's " .. L["Profile"], @@ -161,7 +104,7 @@ function XiconProfiles:GetOptions() type = "execute", func = function() Gladdy.dbi:ResetProfile(Gladdy.dbi:GetCurrentProfile()) - XiconProfiles:ApplyKlimp() + applyProfile(Gladdy:GetKlimpProfile()) end, image = "Interface\\AddOns\\Gladdy\\Images\\BasicProfiles\\Klimp1.blp", imageWidth = 350, @@ -180,7 +123,7 @@ function XiconProfiles:GetOptions() type = "execute", func = function() Gladdy.dbi:ResetProfile(Gladdy.dbi:GetCurrentProfile()) - XiconProfiles:ApplyRukk() + applyProfile(Gladdy:GetRukkProfile()) end, name = " ", desc = "Rukk1's " .. L["Profile"], @@ -199,7 +142,7 @@ function XiconProfiles:GetOptions() type = "execute", func = function() Gladdy.dbi:ResetProfile(Gladdy.dbi:GetCurrentProfile()) - XiconProfiles:ApplyMir() + applyProfile(Gladdy:GetMirProfile()) end, name = " ", desc = "Mir's " .. L["Profile"],