tracking: move menu refresh into separate function

This commit is contained in:
shagu
2025-04-25 15:56:33 +02:00
parent fa431cd2f1
commit a5103912b4
+24 -20
View File
@@ -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