Guild Wars Template Decoder

7/04/2007

About

Guild Wars has recently had a build template system added to the game. With this system your builds are stored in a text file in the form of a base64 encoded string. I’ve written this little class to decode the string into its component data.

Please note this class requires PHP 5 or higher, it will not work on PHP 3 or 4.

Download

Latest Version: 1.2
Guild Wars Template Decoder V1.2

Usage

Using the code is as simple as extracting the php file into your website or script’s directory and using code similar to this:

  1. <?php
  2.     include(‘gwtemplate.php’);
  3.     try {
  4.         $gw = new GWTemplate(‘AxNREp8XH/CgJwEBBAAAXmAA’);
  5.         $gw->secondary = 1; // Change secondary profession to Warrior
  6.         $gw->save();
  7.         echo $gw->code; // Echo the new template code.
  8.         $gw->code = ‘AZMSpaqo7Ajfw1YesPmrUhl3′; // set a new build template code
  9.         $gw->load(); // load the new build template code.
  10.         foreach($gw->skills as $skill) { // loop through skills for the build
  11.             echo $skill; // echo the skill id.
  12.         }
  13.         foreach($gw->attribs as $attrib) { // loop through attributes for the build
  14.             echo $attrib[‘attribute’] . " = " . $attrib[‘value’]; // echo the attribute name id and the value.
  15.         }
  16.     } catch (Exception $e) {
  17.         die($e->getMessage());
  18.     }
  19. ?>

The public class members primary, secondary, attribs and skills contain the primary proffession, secondary profession, attributes and their values and the skills for the build respectively.

3 Comments