PHP code example of buildwars / gw-skilldata

1. Go to this page and download the library: Download buildwars/gw-skilldata 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-skilldata example snippets


use Buildwars\GWSkillData\SkillDataAwareInterface;
use Buildwars\GWSkillData\SkillDataAwareTrait;

class MyClass implements SkillDataAwareInterface{
	use SkillDataAwareTrait

	public function __construct(string $lang){
		// set the language and initialize $this->skillData
		$this->setSkillDataLanguage($lang);
	}

	public function getSkill(int $skillID):mixed{
		// $this->skillData is now available
		$data = $this->skillData->get($skillID);

		// do stuff with the $data array
		// the available array keys are in $this->skillData->keys
	}
}

$data = [
	'id'              => 979,
	'campaign'        => 3,
	'profession'      => 5,
	'attribute'       => 2,
	'type'            => 24,
	'is_elite'        => false,
	'is_rp'           => false,
	'is_pvp'          => false,
	'pvp_split'       => true,
	'split_id'        => 3191,
	'upkeep'          => 0,
	'energy'          => 10,
	'activation'      => 2,
	'recharge'        => 12,
	'adrenaline'      => 0,
	'sacrifice'       => 0,
	'overcast'        => 0,
	'name'            => 'Mistrust',
	'description'     => 'For 6 seconds, the next spell that target foe casts on one of your allies fails and deals 10...100 damage to that foe and all nearby foes.',
	'concise'         => '(6 seconds.) The next spell that target foe casts on one of your allies fails and deals 10...100 damage to target and nearby foes.',
	'campaign_name'   => 'Nightfall',
	'profession_name' => 'Mesmer',
	'profession_abbr' => 'Me',
	'attribute_name'  => 'Domination Magic',
	'type_name'       => 'Hex Spell',
];

$data = [
	'id'              => 3191,
	'campaign'        => 3,
	'profession'      => 5,
	'attribute'       => 2,
	'type'            => 24,
	'is_elite'        => false,
	'is_rp'           => false,
	'is_pvp'          => true,
	'pvp_split'       => false,
	'split_id'        => 0,
	'upkeep'          => 0,
	'energy'          => 10,
	'activation'      => 2,
	'recharge'        => 12,
	'adrenaline'      => 0,
	'sacrifice'       => 0,
	'overcast'        => 0,
	'name'            => 'Mistrust (PvP)',
	'description'     => 'For 6 seconds, the next spell that target foe casts on one of your allies fails and deals 10...75 damage to that foe and all nearby foes.',
	'concise'         => '(6 seconds.) The next spell that target foe casts on one of your allies fails and deals 10...75 damage to target and nearby foes.',
	'campaign_name'   => 'Nightfall',
	'profession_name' => 'Mesmer',
	'profession_abbr' => 'Me',
	'attribute_name'  => 'Domination Magic',
	'type_name'       => 'Hex Spell',
];