npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@buildwars/gw-skilldata

v1.0.3

Published

Guild Wars skill data

Downloads

2

Readme

build-wars/gw-skilldata

Guild Wars skill data and skill descriptions for use with template decoders, e.g. in BBCode, Wikis etc.

PHP Version Support Packagist version NPM version License Continuous Integration Coverage Packagist downloads

Overview

Features

  • Guild Wars skill data
    • Skill descriptions for English and German
  • Toolset to add other translations (hopefully maybe)

Requirements

  • PHP 8.1+

Quickstart

PHP

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
	}
}

The returned skill data array from SkillDataInterface::get(979) looks as follows:

$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',
];

JavaScript :coffee:

JavaScript doesn't have traits, so you will need to implement that part by yourself:

class MyClass{

	_languages = {
		de: SkillLangGerman,
		en: SkillLangEnglish,
	};

	skillData;

	constructor(lang){
		this.setSkillDataLanguage(lang);
	}

	setSkillDataLanguage(lang){

		if(!this._languages[lang]){
			throw new Error('invalid language');
		}

		this.skillData = new this._languages[lang]();

		return this;
	}

	getSkill(skillID){
		// this.skillData is now available
		let data = this.skillData.get(skillID);

		// do stuff with the data array
	}

}

which outputs:

let 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'
}

PvP skill redirect

When the $pvp parameter is set to true, SkillDataInterface::get(979, true) will redirect to the PvP version of the given skill (if available, pvp_split and split_id):

$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',
];

HTML tags in descriptions

The skill descriptions may contain the custom HTML tags <gray>...</gray> and <sic/> that you can either replace or use to style, for example:

<gray>No effect unless hexed foe attacks.</gray>

Each attack that hits deals +13...30 Holy damage <sic/>

API

SkillDataInterface

(The API is similar for the JavaScript version)

| Method | Description | |-------------------------------------------------------|------------------------------------------------------------------------------------------| | get(int $id, bool $pvp = false) | Returns the data for the given skill ID, including descriptions for the current language | | getAll(array $IDs, bool $pvp = false) | Returns an array with the skill data for each of the given skill IDs | | getByCampaign(int $campaign, bool $pvp = false) | Returns all skills for the given campaign ID | | getByProfession(int $profession, bool $pvp = false) | Returns all skills for the given profession ID | | getByAttribute(int $attribute, bool $pvp = false) | Returns all skills for the given attribute ID | | getByType(int $type, bool $pvp = false) | Returns all skills for the given skill type ID | | getElite(bool $pvp = false) | Returns all elite skills | | getRoleplay() | Returns all roleplay skills |

Disclaimer

Use at your own risk!