Blizzard To Wowhead Talent converter

Wowhead has not officially released the code they use to convert convert, but a long while back someone asked in their forums about it. And from there people convert the code they shared into something readable, and worked pretty well.

In my short project to make a Wowarmory mirror type site, i wanted a way to convert blizzards talent build to wowheads. After lots of work, iv finely come out with a nice function that does pretty well.

Iv also been talking with one of the programmers of Armorylite to share this code with him. They just link to blizzard calculator and i thought it be nice for them to be able to link to the best calculator, Wowhead.

I am gonna share the function with all who want to use it for free, after the break.

Updated – October 4th 2010
– Now using Github Gist

Let me know what you think, and if there might be a bug somewhere.

Tags: , , , , ,

9 comments

  1. Do you know if there is anything documented for their hunter pet talent calculator? I can see that they are encoding something along with the talent points – I’m guessing it’s the pet family since that would be the equivalent of the $classes encoding.

    I might have a bit of a poke around and see if I can see what they are doing. I can’t imagine they’ve moved far away from the algorithm you present here.

  2. I’ll go and see what i can come up with. Shouldn’t be that much different. It never dawned on me to take a look at the pet talents. Thanx

  3. Hi, thanks for the code here. I was working on reversing the algorithm so I could de-encode these as well, and I think I found a bug with your encoding algorithm. Specifically I tried encoding a cookie-cutter mage arcane build, but I removed the point from arcane barrage for testing. When I did that the encoded build no longer loaded into wowhead correctly. I believe the problem is in this line:

    $return .= (strlen($b)==strlen($cur_tree))? $pre_return: $pre_return.$none;

    The problem here is that the wowhead links encode 1 character for every 2 lines, so if the blizzard string uses 29 of the 30 allotted characters it will fill the full 15 lines of the wowhead string and not require a Z terminator. However because your check for the Z terminator uses the blizzard string, it will incorrectly use a Z terminator whenever the only right-trimmed zero is in the last space. I have a correction here:

    $return .= (strlen($pre_return) == ceil($trees[$class][$tree_index] / 2)) ? $pre_return : $pre_return . $none;

    This checks the length of the wowhead encoded string for the Z terminator, which fixed my issue and should work correctly. I haven’t tested this against a tree with an odd number of characters in the blizzard string since all mage trees contain an even number, but I’m pretty sure ceil() will come up with the correct result for odd-numbered trees. Let me know if that works!

  4. If i read you correctly when you removed the one point from arcane barrage you made the string shorter, in turn making the string invalid. Blizzard build strings will always be the same length. In this instance (mage tree) it will always be 30+28+28 characters long, no matter how many talents you’ve spent. Let me know if im wrong.

    In the new version of the function ill add a check to make sure the provided string is the correct length for that character

  5. While attempting to use this code in my Wowhead Tooltips script, it seems that the function seems to fail in the third talent tree, was just wondering if there was an update for this? This is something my users have been asking for, for quite a while.

    Regards,
    Lockslap

  6. Here’s the updated talent tree counts for 4.0.1. The function still works to perfection.

    // tree count order by wowhead order
    $tree_counts = array(
    array(20, 22, 21), // druid
    array(19, 19, 20), // hunter
    array(21, 21, 19), // mage
    array(20, 20, 20), // paladin
    array(21, 20, 21), // priest
    array(19, 19, 19), // rogue
    array(19, 19, 19), // shaman
    array(18, 19, 19), // warlock
    array(20, 21, 20), // warrior
    array(20, 20, 19) // death knight
    );

  7. Awesome thanks, ill update the Gist.

  8. is there a way to include the encryption for glyphs if we know the spell id for the glyph? according to the wowhead page its after the build info separated by a :

    also, shaman build (at least, haven’t checked others) added a point is now 19,19,20

Leave a comment