Skip to content

Commit

Permalink
fix: fix the multiple times hook
Browse files Browse the repository at this point in the history
  • Loading branch information
fang2hou committed Aug 18, 2024
1 parent 6f3a9cb commit c8df2d0
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions Modules/Tooltips/Progression.lua
Original file line number Diff line number Diff line change
Expand Up @@ -347,10 +347,6 @@ function T:Progression(tt, unit, guid)
return
end

if not C_AddOns_IsAddOnLoaded("Blizzard_AchievementUI") then
AchievementFrame_LoadUI()
end

if not cache[guid] or (GetTime() - cache[guid].timer) > 120 then
if guid == E.myguid then
UpdateProgression(guid, unit)
Expand Down Expand Up @@ -388,10 +384,6 @@ function T:Progression(tt, unit, guid)
end

SetProgressionInfo(tt, guid)

hooksecurefunc("AchievementFrameComparison_SetUnit", AchievementFrameComparison_SetUnit)
hooksecurefunc(_G.AchievementFrame, "Show", OnAchievementShow)
hooksecurefunc(_G.AchievementFrame, "SetShown", OnAchievementShow)
end

function T:INSPECT_ACHIEVEMENT_READY(event, GUID)
Expand All @@ -412,4 +404,20 @@ function T:INSPECT_ACHIEVEMENT_READY(event, GUID)
ClearAchievementComparisonUnit()
end


function T:InitializeProgression()
if not E.private.WT.tooltips.progression.enable then
return
end

if not C_AddOns_IsAddOnLoaded("Blizzard_AchievementUI") then
AchievementFrame_LoadUI()
end

hooksecurefunc("AchievementFrameComparison_SetUnit", AchievementFrameComparison_SetUnit)
hooksecurefunc(_G.AchievementFrame, "Show", OnAchievementShow)
hooksecurefunc(_G.AchievementFrame, "SetShown", OnAchievementShow)
end

T:AddInspectInfoCallback(2, "Progression", true)
T:AddCallback("InitializeProgression")

0 comments on commit c8df2d0

Please sign in to comment.