Okay, so what I gave you will do what you want. All you need to do is utilise what I did for 1 achievement to make it work for multiple achievements.
For example:
Initialisation Stage
You could use that for loop to add to a list of achievement id, criteria id items.
Processing Stage
You could then go through the generated list of achievement/criteria ids and do what you want with them.
Here's what might work to get the first part of it working.
Lua Code:
local addonName, addon = ...
-- Make sure achievements to track table exists
local achievementsToMonitor = {
[6351] = {},
[6975] = {},
[6977] = {},
-- And any others you want to grab the information for
}
-- Create variables for the values you are using in the loops
local numCriteria, criteriaString, criteriaType, completed, quantity, reqQuantity, charName, flags, assetID, quantityString, criteriaID, eligible
local function InitialiseMonitorTable()
-- Go through each achievement in the monitor list
for achievementID,data in pairs(achievementsToMonitor) do
numCriteria = GetAchievementNumCriteria(achievementID)
-- Go through each criteria for this achievement
for criteriaIndex = 1,numCriteria do
-- Grab the data for this criteriaIndex
criteriaString, criteriaType, completed, quantity, reqQuantity, charName, flags, assetID, quantityString, criteriaID, eligible
= GetAchievementCriteriaInfo(achievementID, criteriaIndex)
-- This is where you might want to decide what to do with the information while it is available.
data.criteriaID = criteriaID
data.criteriaString = criteriaString
data.criteriaType = criteriaType
data.completed = completed
data.assetID = assetID
-- Any others you might want to store in the table
-- I am not 100% sure that this keeps the data in the table once you store it here
-- But if not replace the data part with the following and see if that works
-- achievementsToMonitor[achievementID]
end
end
end
local function ProcessMonitorTable()
-- Do whatever code you want to do in here and call it when you want it to be called
end
-- The usual EventWatcher code block
local eventWatcher = CreateFrame("Frame")
local function OnEvent(self,event,...)
if event == "ADDON_LOADED" then
local addonLoaded = ...
local okayToContinue = okayToContinue or false
if addonLoaded == addonName then
-- If you forget to add the Achievement Addon in the required dependancies part
-- of the TOC do this to ensure the addon is loaded before you do any work
local isAchievementsLoaded = C_AddOns.IsAddOnLoaded("Blizzard_AchievementUI")
if isAchievementsLoaded then
okayToContinue = true
else
okayToContinue = false
LoadAddOn("Blizzard_AchievementUI")
end
elseif addonLoaded == "Blizzard_AchievementUI" then
-- Make sure our addon is loaded ( hopefully by now it is )
local isMyAddonLoaded = C_AddOns.IsAddOnLoaded(addonName)
if isMyAddonLoaded then
okayToContinue = true
end
end
-- The two above checks should make sure that both addons are available before
-- setting the okayToContinue variable to true.
if okayToContinue then
InitialiseMonitorTable()
end
end
end
eventWatcher:SetScript( "OnEvent", OnEvent );
eventWatcher:RegisterEvent( "ADDON_LOADED" );
-- Add whatever other events you might be needing to be watched for the rest of the addons workload
-- And the appropriate section in the OnEvent function
I added the assetID into the mix as you may find this useful
At the bottom of the wiki.gg page for the criteriainfo function it shows a table highlight what the assetID will be based on the type.
https://warcraft.wiki.gg/wiki/API_Ge...ntCriteriaInfo
For example:
A criteriaType of 0 will mean that this is a monster kill and the assetID will be the monsterID. The monsterID may be it's current GUID ( the GUID gets reset periodically for some things so it may be different week to week or month to month ).
A criteriaType of 43 denotes an exploration criteria and the assetID might be an ID that represents the location. Maybe a mapID, zoneID or subZone etc They don't seem to be 100% sure of this so you might find it out through testing.
Hopefully that will help you with that first part of your addon.