We have updated our Terms of Service and Privacy Policy.
Dismiss
Regional FlagSearching the massive achievments arraySource
avatar
Billymayys
Target Source
#1 - 2013/05/28 03:13:00 AM
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!

avatar
Battle.net Developer
Target Source
#6 - 2013/05/30 05:23:00 PM
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?

avatar
Battle.net Developer
Target Source
#14 - 2013/05/31 11:18:00 PM
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