View Single Post
01/04/21, 07:32 PM   #1
QuantumPie
AddOn Author - Click to view addons
Join Date: Sep 2019
Posts: 32
General Subcategory Missing when parsing Achievements

I'm using the following code to parse through all the achievements in the game:
Lua Code:
  1. for topLevelIndex = 1, GetNumAchievementCategories() do
  2.             local categoryName, numSubCatgories, _  = GetAchievementCategoryInfo(topLevelIndex)
  3.             d(categoryName)
  4.             if self.svAccount.achievements[categoryName] == nil then self.svAccount.achievements[categoryName] = {totalPoints = 0, categoryIndex = topLevelIndex, subCategories = {}} end
  5.             for subCategoryIndex = 1, numSubCatgories do
  6.                 local subCategoryName, numSubAchievements = GetAchievementSubCategoryInfo(topLevelIndex, subCategoryIndex)
  7.                 if self.svAccount.achievements[categoryName]["subCategories"][subCategoryName] == nil then self.svAccount.achievements[categoryName]["subCategories"][subCategoryName] = {} end
  8.                 for index = 1, numSubAchievements do
  9.                     local id = GetAchievementId(topLevelIndex, subCategoryIndex, index)
  10.                     local name, _, points, _, completed, date, _ = GetAchievementInfo(id)
  11.                     if self.svAccount.achievements[categoryName]["subCategories"][subCategoryName][name] == nil then self.svAccount.achievements[categoryName]["subCategories"][subCategoryName][name] = {id = id, characters = {}} end
  12.                     if completed then
  13.                         local characterArray = self.svAccount.achievements[categoryName]["subCategories"][subCategoryName][name]["characters"]
  14.                         characterArray[#characterArray + 1] = {name = playerName, date = date}
  15.                     end
  16.  
  17.                 end
  18.             end
  19.         end

When I use Zgoo to inspect the saved variables, I noticed that the general sub category was only recorded for the category of Harrowstorm and Stonethorns (the two most recent dungeon DLCs). It was missing from every other category. If this is the intended behavior, how do I capture the general subcategories? I don't see any other functions from the API page on the wiki which could give that info.

Last edited by QuantumPie : 01/04/21 at 08:46 PM.
  Reply With Quote