I dont know if you remember but a while back i wote a php function that will turn blizzards talent builds into wowhead links (link). Well since then blizzard has added hunter pets to the armory, and along with them come their build. So we now need a way to convert that to a wowhead link. Well iv got another function for you.
Enjoy it after the break ![]()
Again let me know what you think and if there are any problems.
function b2wpet($family, $build, $return_as_url = true)
{
// the encryption code
$encrypt = '0zMcmVokRsaqbdrfwihuGINALpTjnyxtgevElBCDFHJKOPQSUWXYZ123456789';
// familyId => name
$families = array(1=>'wolf',2=>'cat',3=>'spider',4=>'bear',5=>'boar',6=>'crocolisk',7=>'carrionbird',8=>'crab',9=>'gorilla',11=>'raptor',12=>'tallstrider',20=>'scorpid',21=>'turtle',24=>'bat',25=>'hyena',26=>'birdofprey',27=>'windserpent',30=>'dragonhawk',31=>'ravager',32=>'warpstalker',33=>'sporebat',34=>'netherray',35=>'serpent',37=>'moth',38=>'chimaera',39=>'devilsaur',41=>'silithid',42=>'worm',43=>'rhino',44=>'wasp',45=>'corehound',46=>'spiritbeast');
// convert family name to a id
for ($i = 0; $i < count($families); $i++)
if (strtolower($family) == $families[$i])
$family = $i;
// check if its a BM build - should this be put in the function call?
$bm = (array_sum(str_split($build, '1')) > 16)? true: false;
// start the return with the
$return = $encrypt[floor($family / 10)].$encrypt[(2*($family % 10)) + ($bm ? 1 : 0) ];
// encode the tree
for ($i=0; $i
Tags: function, php, World of Warcraft, wowhead

Oh well done!
BTW, any idea where they got this algorithm from? Why wouldn’t they just do base64 or some, like y’know, *standard* thing?
Well i found a old topic on Wowhead forums, that helped me create/convert the code. (cant remember the url) I also took the compressed JS code from the page, uncompreessed it and did my best to decipher the code to help out a bit.
I dont know why they created their own algorithm