-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIvoryTower_AchievementFrame.lua
More file actions
32 lines (30 loc) · 1.39 KB
/
IvoryTower_AchievementFrame.lua
File metadata and controls
32 lines (30 loc) · 1.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
local _, IvoryTower = ...
local results = {}
function AchievementFrame_GetCategoryNumAchievements_CharacterIncomplete(categoryID)
if (not results[categoryID]) then
local incomplete, total = 0, GetCategoryNumAchievements(categoryID)
for i = 1, total do
local _, _, _, completed, _, _, _, _, _, _, _, _, wasEarnedByMe = GetAchievementInfo(categoryID, i)
if ((completed and not wasEarnedByMe) or not completed) then
incomplete = incomplete + 1
end
end
results[categoryID] = {incomplete, 0, total - incomplete}
end
return unpack(results[categoryID])
end
local frame = CreateFrame("Frame", "IvoryTower_AchievementFrame", UIParent)
frame:RegisterEvent("ACHIEVEMENT_EARNED")
frame:RegisterEvent("ADDON_LOADED")
frame:SetScript("OnEvent", function(self, event, arg1, ...)
if (event == "ACHIEVEMENT_EARNED") then
categoryID = GetAchievementCategory(arg1)
IvoryTower:Debug("Achievement earned: |cffffffff" .. arg1)
results[categoryID] = nil
return
end
if (event == "ADDON_LOADED" and arg1 == "Blizzard_AchievementUI") then
table.insert(AchievementFrameFilters, {text = "Character Incomplete", func = AchievementFrame_GetCategoryNumAchievements_CharacterIncomplete})
table.insert(AchievementFrameFilterStrings, "Show achievements not completed by this character")
end
end)