From a5103912b48f9efa6585d1c6bd37b4d09a398438 Mon Sep 17 00:00:00 2001 From: shagu Date: Fri, 25 Apr 2025 15:56:33 +0200 Subject: [PATCH] tracking: move menu refresh into separate function --- modules/tracking.lua | 44 ++++++++++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/modules/tracking.lua b/modules/tracking.lua index 9caaa9ff..ba05e1ca 100644 --- a/modules/tracking.lua +++ b/modules/tracking.lua @@ -72,26 +72,7 @@ pfUI:RegisterModule("tracking", "vanilla", function () end this:RefreshSpells() - local texture = GetTrackingTexture() - if texture and texture ~= state.texture then - state.texture = texture - this.pulse = nil - this.icon:SetTexture(texture) - this.icon:SetVertexColor(1,1,1,1) - this:Show() - elseif not texture then - state.texture = nil - - if pulse and HasEntries(state.spells) then - this.pulse = true - this.icon:SetTexture("Interface\\Icons\\INV_Misc_QuestionMark") - this.icon:SetVertexColor(1,1,1,1) - this:Show() - else - this.pulse = nil - this:Hide() - end - end + this:RefreshMenu() end) pfUI.tracking:SetScript("OnUpdate", function() @@ -174,6 +155,29 @@ pfUI:RegisterModule("tracking", "vanilla", function () end end + function pfUI.tracking:RefreshMenu() + local texture = GetTrackingTexture() + if texture and texture ~= state.texture then + state.texture = texture + pfUI.tracking.pulse = nil + pfUI.tracking.icon:SetTexture(texture) + pfUI.tracking.icon:SetVertexColor(1,1,1,1) + pfUI.tracking:Show() + elseif not texture then + state.texture = nil + + if pulse and HasEntries(state.spells) then + pfUI.tracking.pulse = true + pfUI.tracking.icon:SetTexture("Interface\\Icons\\INV_Misc_QuestionMark") + pfUI.tracking.icon:SetVertexColor(1,1,1,1) + pfUI.tracking:Show() + else + pfUI.tracking.pulse = nil + pfUI.tracking:Hide() + end + end + end + function pfUI.tracking:PlayerIsDruidInCatForm(playerClass) if playerClass == "DRUID" then for i = 0, 31 do