da Wowhead code

July 16, 2009

Next time you use the Wowhead talent calculator, have a look at the URL in your browser’s address box. You should see that the talent points get encoded in an odd looking alphanumeric string. Your class, or pet category in the case of hunter pet talents, gets encoded as well. Something like this:

wowhead.com/?petcalc#MRbc00bdkozM.

That encoding is a Wowhead thing; the armoury itself doesn’t use it. Blizz just stores talent points as a simple string of numbers “00020010230…” where each number refers to a corresponding talent, in the same left-to-right and top-to-bottom order that you see the talents in the calculator.

Unfortunately, the algorithm to generate this encoding seems to be some sort of Wowhead state secret. The Enigma machine was probably less well protected. I have no idea why. It is in the javascript in the Wowhead HTML source, but in a highly compressed form that just makes my brain hurt.

Fortunately an intrepid explorer called Gizzmo has reversed-engineered the damn thing and made his findings available for all of us. You can find the algorithm for the class talent encoding here and for the pet encoding here. Thanks Gizzmo!

Generally I prefer to link to Wowhead’s calculator rather than the official Blizz ones. It seems to have a snappier response. And let’s face it, you’re going there anyway – sooner or later – so let’s just pass Go and collect the $200 now.

But I had to pull the links out last time because they were based on the unencoded Blizz talent string and the Wowhead calculator was failing to convert the URL. (Caused, as I discovered later, by Wowhead treating class names as case sensitive. D’Oh!) So it will be nice to be able to generate the encoded URLs here.

Advertisements

6 Responses to “da Wowhead code”

  1. chronic Says:

    You can just use links like this:

    http://www.wowhead.com/?talent=Rogue-30530310500210252210320100000500000000000000000000000005320232030002120000000000000

    If you want to use wowhead but don’t want to do the conversion.

  2. chronic Says:

    (um, “Rogue” in the above URL should be “rogue”, teach me not to check before I post)

  3. zardoz Says:

    Ah that’s what caught me out last time – I wasn’t expecting the capital ‘R’ to matter…

    Anyway, it’s handy to store the strings in the encoded form – saves some space in the database.

  4. d07.RiV Says:

    I appreciate the info, I tried to figure it out myself one day and my head exploded after reading about 1% code.

  5. zardoz Says:

    Obfuscated javascript will do that, every time…

  6. gizzmo Says:

    Hey, nice post zardos. thanx for linking to me 😉 but its weird that i didnt get a pingback or a trackback, or i probably would have commented earlier


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: