Commit 6ecad05f authored by Robin Schoonover's avatar Robin Schoonover

Hook into a few tooltips on the achievment UI for achievement IDs.

parent 539fd272
Pipeline #441 passed with stages
in 9 seconds
......@@ -35,6 +35,91 @@ function event_frame:ADDON_LOADED(addon_name)
end
event_frame:RegisterEvent("ADDON_LOADED")
--
-- Achievements
--
OnAddOnLoaded("Blizzard_AchievementUI", function()
for _, button in ipairs(AchievementFrameAchievementsContainer.buttons) do
button.shield:HookScript("OnEnter", function(frame)
local parent = frame:GetParent()
if GameTooltip:GetOwner() ~= frame then
return
end
addon:AddIDLine(GameTooltip, "Achievement", parent.id)
end)
end
hooksecurefunc("AchievementFrameSummaryAchievement_OnEnter", function(frame)
if GameTooltip:GetOwner() == nil then
GameTooltip:SetOwner(frame, "ANCHOR_RIGHT")
end
addon:AddIDLine(GameTooltip, "Achievement", frame.id)
GameTooltip:Show()
end)
--
-- mini achievements (aka progressive)
--
local mini_achievements = {}
local function miniAchievement_OnEnter(frame)
local idx = frame._alltheid_index
if idx == nil then
return
end
addon:AddIDLine(GameTooltip, "Achievement", mini_achievements[#mini_achievements-idx+1])
end
hooksecurefunc("AchievementObjectives_DisplayProgressiveAchievement", function(frame, id)
wipe(mini_achievements)
while id do
tinsert(mini_achievements, id)
id = GetPreviousAchievement(id)
end
local idx = 1
while true do
local mini = _G["AchievementFrameMiniAchievement"..idx]
if mini == nil then
break
end
if mini:IsShown() and mini._alltheid_index == nil then
mini:HookScript("OnEnter", miniAchievement_OnEnter)
mini._alltheid_index = idx
end
idx = idx + 1
end
end)
--
-- meta achievements
--
local function metaAchievement_OnEnter(frame)
addon:AddIDLine(GameTooltip, "Achievement", frame.id)
end
hooksecurefunc("AchievementObjectives_DisplayCriteria", function(frame, id)
local idx = 1
while true do
local metacrit = _G["AchievementFrameMeta"..idx]
if metacrit == nil then
break
end
if metacrit:IsShown() and metacrit._alltheid_onenter == nil then
metacrit:HookScript("OnEnter", metaAchievement_OnEnter)
metacrit._alltheid_onenter = true
end
idx = idx + 1
end
end)
end)
--
-- Mount Collection
--
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment