Searching the massive achievments array

#1 - May 28, 2013, 3:13 a.m.
Blizzard Post
I was hoping someone might be so kind as to point me in the right direction, or share with me their solution to searching the massive array we get from here: http://us.battle.net/api/wow/data/character/achievements for a given achievement ID.

Other threads on this:
http://stackoverflow.com/questions/16783278/php-search-massive-array-for-value-return-parent-key


Sofar ive started breaking down the original array into its 10 categories and I was then going to search each one of those arrays until I found the ID i was looking for, but i feel as if there must be an easier way.

ex of what I have sofar:

$allAchieves = file_get_contents('http://us.battle.net/api/wow/data/character/achievements');
$allAchieves = json_decode($allAchieves, true);

$generalAchieves = $allAchieves[achievements][0][achievements];
$quests = $allAchieves[achievements][1][categories];
$explorationAchieves = $allAchieves[achievements][2][categories];
$pvp = $allAchieves[achievements][3][categories];
$dungeonAndRaids = $allAchieves[achievements][4][categories];
$professions = $allAchieves[achievements][5][categories];
$reputation = $allAchieves[achievements][6][categories];
$scenarios = $allAchieves[achievements][7][categories];
$worldEvents = $allAchieves[achievements][8][categories];
$petbattle = $allAchieves[achievements][9][categories];
$featsOfStrength = $allAchieves[achievements][10][categories];


As always, thanks for any help / guidance / or input!
Forum Avatar
Battle.net Developer
#6 - May 30, 2013, 5:23 p.m.
Blizzard Post
Would people want achievements changed to be in a different format instead of the giant id lists? I know this would cause a bunch of code to be rewritten if we made the change now.

If we were to add public statistics would we want to add it identical to the achievement list or should we go with a new format?
Forum Avatar
Battle.net Developer
#14 - May 31, 2013, 11:18 p.m.
Blizzard Post
Billymayys:
As for Statistics, What exactly does that refer to?

If you are talking about something that would read like:

HK's this week: #
Raid Bosses Killed This Week: #
LFR's Completed This Week: #
etc...
etc...

Or something to that effect, then that would be Absolutely Amazing.


It would be the data that's on your in game and web profile:
http://us.battle.net/wow/en/character/magtheridon/Billymayys/statistic