Thread Tools Display Modes
09-10-24, 10:01 PM   #1
Codger
An Aku'mai Servant
AddOn Author - Click to view addons
Join Date: Mar 2021
Posts: 35
How to identify Achievement Id's (AchivementId)

I looked all over for this info and found an old snippet of code that could be used to generate the list of achivementId's. Because the number of AchivementId's is now greater than 20000 rather than post the list, I've decided to show you how I generated it. This is a simple addon consisting of two files, the .toc and core.lua. Place the files into the Addon directory in a directory labeled "AchivementLister". Load the addon in game and execute the slash command /alister The list of AchivementId's will be saved into an account wide saved variable called "AchivementList.lua" Here is a sample of the listing to show what it looks like (this is a table dumped into a lua file):

"ID: 14171 Name: Memento Mori Description: Obtain 10000 Corrupted Mementos.",
"ID: 14172 Name: A Monumental Amount of Mementos Description: Obtain 50000 Corrupted Mementos.",
"ID: 14173 Name: A Mountain of Mementos Description: Obtain 100000 Corrupted Mementos.",
"ID: 14175 Name: Master of Deepwind Gorge Description: Complete the Deepwind Gorge achievements listed below.",


AchievementLister.toc file
Code:
## Interface: 110200
## Title: AchievementLister
## Author: Sundur - Galakrond (US) from code on Wowinterface.com by Drshow https://www.wowinterface.com/forums/showthread.php?t=28535 
## Notes: Creates a list of achievement id's and names and saves the list into an account saved variable "AchievementList".
## Version: 11.0.2 
## SavedVariables: AchievementList
core.lua

core.lua file:
Code:
local AchievementLister = {}

AchievementList = {} -- account variables
AchievementLister.frame = CreateFrame("Frame", nil, UIParent)

local function AchievementListerRunSlash()
   local max = 25000
   local count = 1
   for x=1,max do
      local id,name,_,_,_,_,_,description = GetAchievementInfo(x)
      if name then
         AchievementList[ count ] = "ID: "..x .. "    Name: " .. name .. "    Description: " .. description
         count=count+1
      end
   end
   print("AchivementList saved to saved variables 'AchivementList'")
end

SLASH_ACHIEVEMENTLISTER1 = "/alister"
SLASH_ACHIEVEMENTLISTER2 = "/achievementlister"
SlashCmdList[ "ACHIEVEMENTLISTER" ] = function() AchievementListerRunSlash() end
  Reply With Quote
09-10-24, 11:24 PM   #2
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,358
The API itself has functions to iterate through all achievements.

See:
GetCategoryList()
GetCategoryNumAchievements()
GetAchievementInfo()


Example:
Lua Code:
  1. for _,CategoryID in ipairs(GetCategoryList()) do
  2.     for i=1,(GetCategoryNumAchievements(CategoryID,true)) do
  3.         local AchievementID,Name=GetAchievementInfo(CategoryID,i);
  4. --      Do whatever
  5.     end
  6. end
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)
  Reply With Quote

WoWInterface » Developer Discussions » Tutorials & Other Helpful Info. » How to identify Achievement Id's (AchivementId)


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off