Thread Tools Display Modes
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
09/07/16, 08:46 AM   #2
votan
 
votan's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2014
Posts: 577
In Votan's Achievement Overview I have a scan, too.

Your code looks similar. I don't know if there is a difference without debugging.
I can remember that I had the same problem. And I think the code in there is working.
Feel free to use it
Or just have a look at.
  Reply With Quote
09/07/16, 09:04 AM   #3
Ayantir
 
Ayantir's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2014
Posts: 1,019
Lua Code:
  1. if IsAchievementComplete(achievementId) and GetNextAchievementInLine(achievementId) ~= 0 then
  2.     -- AchievementLine is present and everything is done.
  3. elseif IsAchievementComplete(achievementId) and GetNextAchievementInLine(achievementId) ~= 0 and not IsAchievementComplete(GetNextAchievementInLine(achievementId)) then
  4.     -- Achievement is done but next is not.
  5. elseif not IsAchievementComplete(achievementId) and GetNextAchievementInLine(achievementId) ~= 0 and IsAchievementComplete(GetNextAchievementInLine(achievementId)) then
  6.     -- Achievement is not done but previous is.
  7. else
  8.     -- Standard
  9. end

It's a basic code, but you should consider all sublevels.
  Reply With Quote

ESOUI » Developer Discussions » Lua/XML Help » Getting sub achievement info

Thread Tools
Display Modes

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