1 QuestHelper_File
["collect_achievement.lua"] = "Development Version"
2 QuestHelper_Loadtime
["collect_achievement.lua"] = GetTime()
11 local function ScanAchievements(oldADB
, newADB
)
12 --QuestHelper:TextOut("scanach")
14 for k
, v
in pairs(newADB
.achievements
) do
15 if v
.complete
~= oldADB
.achievements
[k
].complete
then
19 for k
, v
in pairs(newADB
.criteria
) do
20 if v
.complete
and not oldADB
.criteria
[k
].complete
then
25 if changes
< 10 then -- if someone gets 10 criteria at once, well, I guess that's just what happens
26 for k
, v
in pairs(newADB
.achievements
) do
27 if v
.complete
~= oldADB
.achievements
[k
].complete
then
28 QuestHelper
: Assert(v
.complete
and not oldADB
.achievements
[k
].complete
)
29 if not QHCA
[k
] then QHCA
[k
] = {} end
30 QHCA
[k
].achieved
= (QHCA
[k
].achieved
or "") .. cloc
32 --QuestHelper:TextOut(string.format("Achievement complete, %s", select(2, GetAchievementInfo(k))))
36 for k
, v
in pairs(newADB
.criteria
) do
37 if v
.complete
and not oldADB
.criteria
[k
].complete
then -- Note that it's possible for objectives to be "uncompleted" when it's things like "do a bunch of shit in one run of this battleground" (see: isle of conquest)
38 --QuestHelper:TextOut(string.format("Criteria complete, %d", k))
39 --QuestHelper:TextOut(string.format("Criteria complete, %s", select(1, GetAchievementCriteriaInfo(k))))
40 if not QHCA
[v
.parent
] then QHCA
[v
.parent
] = {} end
41 QHCA
[v
.parent
][k
] = (QHCA
[v
.parent
][k
] or "") .. cloc
42 elseif v
.progress
> oldADB
.criteria
[k
].progress
then
43 --QuestHelper:TextOut(string.format("Criteria progress, %d", k))
44 --QuestHelper:TextOut(string.format("Criteria progress, %s", select(1, GetAchievementCriteriaInfo(k))))
51 cloc
= GetLoc() -- yoink
54 function QH_Collect_Achievement_Init(QHCData
, API
)
55 if not QHCData
.achievement
then QHCData
.achievement
= {} end
56 QHCA
= QHCData
.achievement
58 GetLoc
= API
.Callback_LocationBolusCurrent
59 QuestHelper
: Assert(GetLoc
)
61 Merger
= API
.Utility_Merger
62 QuestHelper
: Assert(Merger
)
64 QH_AchievementManagerRegister(ScanAchievements
)
65 QH_AchievementManagerRegister_Prescan(SetCloc
)
67 QH_AchievementManager_Init()