View Single Post
09/07/16, 08:17 AM   #1
Woeler
 
Woeler's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2014
Posts: 40
Question Getting sub achievement info

Hey all,

I'm working on an auto-updated for eso-database and it's working great so far, however I run into one problem. I'm exporting all the achievements, so iconpath, name, description etc. All the achievements get exported except the ones that have sub-achievements.

With achievements like the one below, only the first one gets exported.


Here is the piece of code:
Lua Code:
  1. local function ExportAchievements()
  2.  
  3.     -- Reset achievements
  4.     table.remove(ESODB.SV["Achievements"])
  5.     ESODB.SV["Achievements"] = {}
  6.  
  7.     for categoryIndex = 1, GetNumAchievementCategories() do
  8.  
  9.         local _, numSubCategories, numAchievements = GetAchievementCategoryInfo(categoryIndex)
  10.  
  11.         for i = 1, numAchievements do
  12.  
  13.             local achievementId = GetAchievementId(categoryIndex, nil, i)
  14.             local name, description, points, icon, completed, date, time = GetAchievementInfo(achievementId)
  15.  
  16.            
  17.                 table.insert(ESODB.SV.Achievements, {
  18.                     achievementId = achievementId,
  19.                     name = name,
  20.                     description = description,
  21.                         points = points,
  22.                         icon = icon,
  23.                     date = date,
  24.                     time = time
  25.                 })
  26.  
  27.  
  28.                
  29.  
  30.            
  31.         end
  32.  
  33.         for subCategoryIndex = 1, numSubCategories do
  34.             local _, subNumAchievements = GetAchievementSubCategoryInfo(categoryIndex, subCategoryIndex)
  35.  
  36.             for i = 1, subNumAchievements do
  37.  
  38.                 local achievementId = GetAchievementId(categoryIndex, subCategoryIndex, i)
  39.                 local name, description, points, icon, completed, date, time = GetAchievementInfo(achievementId)
  40.  
  41.                
  42.                     table.insert(ESODB.SV.Achievements, {
  43.                    
  44.                         achievementId = achievementId,
  45.                         name = name,
  46.                         description = description,
  47.                         points = points,
  48.                         icon = icon,
  49.                         date = date,
  50.                         time = time
  51.                     })
  52.  
  53.                
  54.             end
  55.         end
  56.     end
  57. end

Any idea for a workaround?
  Reply With Quote