PHP code example of buildwars / gw-templates

1. Go to this page and download the library: Download buildwars/gw-templates library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

buildwars / gw-templates example snippets


$code = (new SkillTemplate)->encode(
	prof_pri:   7,
	prof_sec:   1,
	attributes: [29 => 12, 31 => 3, 35 => 12],
	skills:     [782, 780, 775, 1954, 952, 2356, 1649, 1018],
);
// -> base64 skill template

$skills = (new SkillTemplate)->decode('OwFj0xfzITOMMMHMie4O0kxZ6PA');

$equipmentTemplate = new EquipmentTemplate;

// add iems (will overwrite previous items with same slot id)
$equipmentTemplate->addItem(
	id:    279,
	color: 0,
	mods:  [190, 204, 329],
);

// ... add more items

$code = $equipmentTemplate->encode(); // -> base64 equipment template

$equipment = (new EquipmentTemplate)->decode('PkpxFP9FzSqIlpI90MlpIDLfopInVBgpILlLlpIFF');

$pwndTemplate = new PwndTemplate;

$pwndTemplate->addBuild(
	skills:      'OwFj0xfzITOMMMHMie4O0kxZ6PA',
	equipment:   'PkpxFP9FzSqIlpI90MlpIDLfopInVBgpILlLlpIFF',
	weaponsets:  ['PcZQ8zoRpkC'],
	player:      '<assigned player/hero>',
	description: "<build name>\r\n<description>",
);

// add more builds (up to 12)

$pwnd = $pwndTemplate->encode(); // -> pwnd template code

$team = (new PwndTemplate)->decode($pwnd);
js
let code = new SkillTemplate().encode(
	7,
	1,
	{'29': 12, '31': 3, '35': 12},
	[782, 780, 775, 1954, 952, 2356, 1649, 1018],
);
// -> base64 skill template