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 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 |
ZO_ACHIEVEMENTS_ROOT_SUBCATEGORY = "root"
ZO_ACHIEVEMENTS_COMPLETION_STATUS =
{
NOT_APPLICABLE = 1 ,
INCOMPLETE = 2 ,
IN_PROGRESS = 3 ,
COMPLETE = 4 ,
}
return manager
end
-- ESO-747009: Ensure that the last search string stored in C++ is reset when we reinitialize UI
-- When the data is getting rebuilt, the indicies can change so our old search results are no longer any good
local FORCE_REFRESH = true
end
end
EVENT_MANAGER : RegisterForEvent ( "Achievements_Manager" , EVENT_ACHIEVEMENTS_UPDATED , OnAchievementsUpdated )
EVENT_MANAGER : RegisterForEvent ( "Achievements_Manager" , EVENT_ACHIEVEMENT_AWARDED , OnAchievementsUpdated )
EVENT_MANAGER : RegisterForEvent ( "Achievements_Manager" , EVENT_ACHIEVEMENTS_SEARCH_RESULTS_READY , function ( ) self : UpdateSearchResults ( ) end )
end
end
if requiresImmediateRefresh then
-- If we're relying on results being cleared this frame, do this now so any checks will work, and let the "search" run in the background
-- so that C stays in sync. This will result in a double update, but sometimes it can't be avoided
end
end
end
end
end
local categoryData = searchResults [ categoryIndex ]
if not categoryData then
categoryData = { }
searchResults [ categoryIndex ] = categoryData
end
local effectiveSubcategoryIndex = subcategoryIndex or ZO_ACHIEVEMENTS_ROOT_SUBCATEGORY
local effectiveSubcategoryData = categoryData [ effectiveSubcategoryIndex ]
if not effectiveSubcategoryData then
effectiveSubcategoryData = { }
categoryData [ effectiveSubcategoryIndex ] = effectiveSubcategoryData
end
effectiveSubcategoryData [ achievementIndex ] = true
end
end
end
return nil
end
if searchResults then
local effectiveSubcategoryIndex = subcategoryIndex or ZO_ACHIEVEMENTS_ROOT_SUBCATEGORY
return searchResults [ categoryIndex ] and searchResults [ categoryIndex ] [ effectiveSubcategoryIndex ] and searchResults [ categoryIndex ] [ effectiveSubcategoryIndex ] [ achievementIndex ]
else
return true
end
end
local completed = 0
local total = 0
for criterionIndex = 1 , numCriteria do
completed = completed + numCompleted
total = total + numRequired
end
if total > 0 then
if completed > 0 then
if completed == total then
return ZO_ACHIEVEMENTS_COMPLETION_STATUS . COMPLETE
else
return ZO_ACHIEVEMENTS_COMPLETION_STATUS . IN_PROGRESS
end
else
return ZO_ACHIEVEMENTS_COMPLETION_STATUS . INCOMPLETE
end
end
return ZO_ACHIEVEMENTS_COMPLETION_STATUS . NOT_APPLICABLE
end
|