View Single Post
04/25/14, 12:03 AM   #9
Asto
 
Asto's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 18
Yeah you are right. What i am actually doing is:

I do the reverse check to test if the achievement has a valid category. The ID at the end from the category data has to match the achievement ID so i know that it is correct. Because of the valid category, i can tell that i have a solo or a first achievement of a line (the event doesn't fire for completed achievements of progression lines).

Lua Code:
  1. -- Check if the category of an achievement is valid (reverse check)
  2. function AchievementInfo.checkForValidCategory(achId)
  3.     local categoryTopLevelIndex, categoryIndex, achievementIndex = GetCategoryInfoFromAchievementId(achId)
  4.     local reverseAchievementId = GetAchievementId(categoryTopLevelIndex, categoryIndex, achievementIndex)
  5.  
  6.     if achId == reverseAchievementId then
  7.         return true
  8.     end
  9.  
  10.     return false
  11. end

Is the category invalid, i know i am on a higher achievement in the line. Has this achievement a previousId value of 0 i can ignore it because it is to high. Has it a value of ~= 0 i can recursively check the previous achievement for the category

Last edited by Asto : 04/25/14 at 01:39 AM.
  Reply With Quote