View Single Post
04-17-24, 04:44 AM   #11
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,951
You have an achievement you want identify the criteria IDs for ?

At the top of that GetAchievementCriteriaInfo page I linked is the set of values returned by that function
criteriaString, criteriaType, completed, quantity, reqQuantity, charName, flags, assetID, quantityString, criteriaID, eligible
= GetAchievementCriteriaInfo(achievementID, criteriaIndex [, countHidden])

It also explains how to get the criteriaIndex on the same page
criteriaIndex
number - Index of the criteria to query, ascending from 1 up to GetAchievementNumCriteria(achievementID).


So, you have the achievementID from wowhead.

After you have ensured the AchievementUI blizzard addon is loaded ( to get access to these functions ) as I explained. You can then use:

Lua Code:
  1. local achievementID = 7439 -- Glorious! Achievement ID
  2. local numCriteria = GetAchievementNumCriteria(achievementID)
  3. local criteriaString, criteriaType, completed, quantity, reqQuantity, charName, flags, assetID, quantityString, criteriaID, eligible
  4.  
  5. for criteriaIndex = 1,numCriteria do
  6.     criteriaString, criteriaType, completed, quantity, reqQuantity, charName, flags, assetID, quantityString, criteriaID, eligible
  7.    = GetAchievementCriteriaInfo(achievementID, criteriaIndex)
  8.  
  9.    -- This is where you might want to decide what to do with the information while it is available.
  10.  
  11.  
  12. end

In your addon.

Other tasks to do before doing this would be

Set up your addon's toc file so that it has a line
Lua Code:
  1. ## RequiredDeps: Blizzard_AchievementUI
This is because this is an addon that only loads up when you open the achievement window manually. If you want to access the achievement functions you have to either wait for the achievement UI to be opened by the user and watch for the appropriate event for that, or, you load the addon automatically to access the functionality.

Watch for ADDON_LOADED as usual and when your addon is loaded, immediately check and make sure that "Blizzard_AchievementUI" is loaded using
Lua Code:
  1. C_AddOns.IsAddOnLoaded("Blizzard_AchievementUI")
as I mentioned in my post. You should have learned how to do this by now with the addons you have been working on so far.

And as in the other addons you have done, you can then use the functions your addon needs at this point to do their work. The code block above is a good starting point.
__________________


Characters:
Gwynedda - 70 - Demon Warlock
Galaviel - 65 - Resto Druid
Gamaliel - 61 - Disc Priest
Gwynytha - 60 - Survival Hunter
Lienae - 60 - Resto Shaman
Plus several others below level 60

Info Panel IDs : http://www.wowinterface.com/forums/s...818#post136818

Last edited by Xrystal : 04-17-24 at 04:54 AM.
  Reply With Quote