View Single Post
04/24/14, 06:55 AM   #2
Iyanga
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 183
Originally Posted by Asto View Post
1
I have a problem with the functionality of GetPreviousAchievementInLine

If i get an achievement update event, i have a achievement id. i pass it into the function and now the following happens:

if there is no previous achievement, for example
/zgoo GetPreviousAchievementInLine(38)
it return 0. Okay.

if there is a previous achievement that is completed, for example in my case
/zgoo GetPreviousAchievementInLine(67)
it returns the id 66. Perfect.

if there is a previous achievement in line that is not completed, for example in my case
/zgoo GetPreviousAchievementInLine(68)
it returns also 0. What the hell... :/

I would have assumed that if there is no prev achievement it returns false or nil or similiar but it is also 0. Or the function returns the correct id if there is a previous achievement but it's not completed yet.

Well, if you read it as GetPreviousCompletedAchievementInLine it is consistent behavior.
How does GetNextAchievementInLine() react? If it also only returns completed achievements, the behavior is really consistent and intended.

How should i deal with it? Any ideas?
First you would need to tell what you actually want to achieve.

The second problem is the following... when getting category infos for an achievementId, in some cases i get the wrong data!? If i collect the data of achievementId 68 with GetCategoryInfoFromAchievementId(68) it returns 2, nil, 2. But 2, the toplevelindex, is the wrong category. It is in another in the journal. And if i pass those parameters into the reverse function GetAchievementId(2, nil, 2) i don't get 68 again. I get 838 as Id... but that is the correct one for the values 2 nil 2...

Hm, I've done a little cross check:

GetNumAchievementCategories, GetAchievementCategoryInfo, GetAchievementId and GetCategoryInfoFromAchievementId are in itself consistent.

You can do a successful roundtrip - what you get from these and feed into them again, is correct. You can traverse down to the achievement id of an achievement and from that achievement id back to the correct category.

This leads to the question: Where do you get the 68 from and why do you think it's a valid achievement id?

Traversing through the crafting achievements, I get as valid ids: 66, 69, 779 , ....

The 68 is an id for an information about a criterion progress it seems:
AchievementCategory->Subcategory->Achievement->Criterion->Progress

If you feed this progress id into GetCategoryInfoFromAchievementId(), you always get 2, nil, 2, no matter which progress id you use, so I assume it's some kind of error result.

That's what I can say at the moment...
  Reply With Quote