Back to Home

ESO Lua File v101041

ingame/achievements/achievements_shared.lua

[◄ back to folders ]
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
function ZO_GetNextInProgressAchievementInLine(achievementId)
    local nextAchievementId = achievementId
    while nextAchievementId ~= 0 do
        achievementId = nextAchievementId
        if not IsAchievementComplete(achievementId) then
            return achievementId
        end
        nextAchievementId = GetNextAchievementInLine(achievementId)
    end
    return achievementId
end
    if filterType == SI_ACHIEVEMENT_FILTER_SHOW_ALL then
        return true
    end
    while id ~= 0 do
        local completed = select(5, GetAchievementInfo(id))
        if completed then
            if filterType == SI_ACHIEVEMENT_FILTER_SHOW_EARNED then
                return true
            end
            -- This achievement was completed, but we want to show unearned, so see if there are any unearned achievements in this line
            id = GetNextAchievementInLine(id)
        else -- This achievement wasn't completed
            if filterType == SI_ACHIEVEMENT_FILTER_SHOW_UNEARNED then
                return true
            end
            -- Otherwise we only want to show earned achievements, so find the first completed achievement working backwards from this one
            id = GetPreviousAchievementInLine(id)
        end
    end
    -- Either this achievement wasn't a line, or everything in it was filtered.
    return false
end
function ZO_GetAchievementIds(categoryIndex, subcategoryIndex, numAchievements, considerSearchResults)
    local result = {}
    local searchResults = considerSearchResults and ACHIEVEMENTS_MANAGER:GetSearchResults()
    if searchResults then
        local effectiveSubcategoryIndex = subcategoryIndex or ZO_ACHIEVEMENTS_ROOT_SUBCATEGORY
        searchResults = searchResults[categoryIndex][effectiveSubcategoryIndex]
    end
    for achievementIndex = 1, numAchievements do
        if not searchResults or searchResults[achievementIndex] then
            table.insert(result, GetAchievementId(categoryIndex, subcategoryIndex, achievementIndex))
        end
    end
    return result
end