Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 32 additions & 31 deletions game/gw2_provider.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,11 @@ public function get_armor_types(): array
* meta play, not every possible build — several specs (e.g. Catalyst,
* Vindicator) can flex into other roles depending on traits/gear.
*
* spec_icon intentionally left empty: no icon assets exist yet for
* these specs. Core handles the empty-icon case already (roster spec
* resolution has dedicated test coverage for it). Tracked separately
* as a follow-up.
* spec_icon names a file in images/spec_icons/ (core resolves it as
* spec_icons/<spec_icon>.png, see roster::resolve_spec()). The assets
* are the official elite-specialization icons from the Guild Wars 2
* API's render service (/v2/specializations), normalised from their
* native 64x64 to the 56x56 used by bbguildwow's spec icons.
*
* @return array<int, list<array{spec_name:string,role_id:int,spec_icon:string,spec_order:int}>>
*/
Expand All @@ -157,49 +158,49 @@ public static function spec_catalog(): array

return array(
1 => array( // Warrior
array('spec_name' => 'Berserker', 'role_id' => $damage, 'spec_icon' => '', 'spec_order' => 1),
array('spec_name' => 'Spellbreaker', 'role_id' => $control, 'spec_icon' => '', 'spec_order' => 2),
array('spec_name' => 'Bladesworn', 'role_id' => $damage, 'spec_icon' => '', 'spec_order' => 3),
array('spec_name' => 'Berserker', 'role_id' => $damage, 'spec_icon' => 'warrior_berserker', 'spec_order' => 1),
array('spec_name' => 'Spellbreaker', 'role_id' => $control, 'spec_icon' => 'warrior_spellbreaker', 'spec_order' => 2),
array('spec_name' => 'Bladesworn', 'role_id' => $damage, 'spec_icon' => 'warrior_bladesworn', 'spec_order' => 3),
),
2 => array( // Guardian
array('spec_name' => 'Dragonhunter', 'role_id' => $damage, 'spec_icon' => '', 'spec_order' => 1),
array('spec_name' => 'Firebrand', 'role_id' => $support, 'spec_icon' => '', 'spec_order' => 2),
array('spec_name' => 'Willbender', 'role_id' => $damage, 'spec_icon' => '', 'spec_order' => 3),
array('spec_name' => 'Dragonhunter', 'role_id' => $damage, 'spec_icon' => 'guardian_dragonhunter', 'spec_order' => 1),
array('spec_name' => 'Firebrand', 'role_id' => $support, 'spec_icon' => 'guardian_firebrand', 'spec_order' => 2),
array('spec_name' => 'Willbender', 'role_id' => $damage, 'spec_icon' => 'guardian_willbender', 'spec_order' => 3),
),
3 => array( // Engineer
array('spec_name' => 'Scrapper', 'role_id' => $support, 'spec_icon' => '', 'spec_order' => 1),
array('spec_name' => 'Holosmith', 'role_id' => $damage, 'spec_icon' => '', 'spec_order' => 2),
array('spec_name' => 'Mechanist', 'role_id' => $support, 'spec_icon' => '', 'spec_order' => 3),
array('spec_name' => 'Scrapper', 'role_id' => $support, 'spec_icon' => 'engineer_scrapper', 'spec_order' => 1),
array('spec_name' => 'Holosmith', 'role_id' => $damage, 'spec_icon' => 'engineer_holosmith', 'spec_order' => 2),
array('spec_name' => 'Mechanist', 'role_id' => $support, 'spec_icon' => 'engineer_mechanist', 'spec_order' => 3),
),
4 => array( // Ranger
array('spec_name' => 'Druid', 'role_id' => $support, 'spec_icon' => '', 'spec_order' => 1),
array('spec_name' => 'Soulbeast', 'role_id' => $damage, 'spec_icon' => '', 'spec_order' => 2),
array('spec_name' => 'Untamed', 'role_id' => $damage, 'spec_icon' => '', 'spec_order' => 3),
array('spec_name' => 'Druid', 'role_id' => $support, 'spec_icon' => 'ranger_druid', 'spec_order' => 1),
array('spec_name' => 'Soulbeast', 'role_id' => $damage, 'spec_icon' => 'ranger_soulbeast', 'spec_order' => 2),
array('spec_name' => 'Untamed', 'role_id' => $damage, 'spec_icon' => 'ranger_untamed', 'spec_order' => 3),
),
5 => array( // Thief
array('spec_name' => 'Daredevil', 'role_id' => $damage, 'spec_icon' => '', 'spec_order' => 1),
array('spec_name' => 'Deadeye', 'role_id' => $damage, 'spec_icon' => '', 'spec_order' => 2),
array('spec_name' => 'Specter', 'role_id' => $support, 'spec_icon' => '', 'spec_order' => 3),
array('spec_name' => 'Daredevil', 'role_id' => $damage, 'spec_icon' => 'thief_daredevil', 'spec_order' => 1),
array('spec_name' => 'Deadeye', 'role_id' => $damage, 'spec_icon' => 'thief_deadeye', 'spec_order' => 2),
array('spec_name' => 'Specter', 'role_id' => $support, 'spec_icon' => 'thief_specter', 'spec_order' => 3),
),
6 => array( // Elementalist
array('spec_name' => 'Tempest', 'role_id' => $support, 'spec_icon' => '', 'spec_order' => 1),
array('spec_name' => 'Weaver', 'role_id' => $damage, 'spec_icon' => '', 'spec_order' => 2),
array('spec_name' => 'Catalyst', 'role_id' => $support, 'spec_icon' => '', 'spec_order' => 3),
array('spec_name' => 'Tempest', 'role_id' => $support, 'spec_icon' => 'elementalist_tempest', 'spec_order' => 1),
array('spec_name' => 'Weaver', 'role_id' => $damage, 'spec_icon' => 'elementalist_weaver', 'spec_order' => 2),
array('spec_name' => 'Catalyst', 'role_id' => $support, 'spec_icon' => 'elementalist_catalyst', 'spec_order' => 3),
),
7 => array( // Mesmer
array('spec_name' => 'Chronomancer', 'role_id' => $control, 'spec_icon' => '', 'spec_order' => 1),
array('spec_name' => 'Mirage', 'role_id' => $damage, 'spec_icon' => '', 'spec_order' => 2),
array('spec_name' => 'Virtuoso', 'role_id' => $damage, 'spec_icon' => '', 'spec_order' => 3),
array('spec_name' => 'Chronomancer', 'role_id' => $control, 'spec_icon' => 'mesmer_chronomancer', 'spec_order' => 1),
array('spec_name' => 'Mirage', 'role_id' => $damage, 'spec_icon' => 'mesmer_mirage', 'spec_order' => 2),
array('spec_name' => 'Virtuoso', 'role_id' => $damage, 'spec_icon' => 'mesmer_virtuoso', 'spec_order' => 3),
),
8 => array( // Necromancer
array('spec_name' => 'Reaper', 'role_id' => $damage, 'spec_icon' => '', 'spec_order' => 1),
array('spec_name' => 'Scourge', 'role_id' => $control, 'spec_icon' => '', 'spec_order' => 2),
array('spec_name' => 'Harbinger', 'role_id' => $damage, 'spec_icon' => '', 'spec_order' => 3),
array('spec_name' => 'Reaper', 'role_id' => $damage, 'spec_icon' => 'necromancer_reaper', 'spec_order' => 1),
array('spec_name' => 'Scourge', 'role_id' => $control, 'spec_icon' => 'necromancer_scourge', 'spec_order' => 2),
array('spec_name' => 'Harbinger', 'role_id' => $damage, 'spec_icon' => 'necromancer_harbinger', 'spec_order' => 3),
),
9 => array( // Revenant
array('spec_name' => 'Herald', 'role_id' => $support, 'spec_icon' => '', 'spec_order' => 1),
array('spec_name' => 'Renegade', 'role_id' => $control, 'spec_icon' => '', 'spec_order' => 2),
array('spec_name' => 'Vindicator', 'role_id' => $damage, 'spec_icon' => '', 'spec_order' => 3),
array('spec_name' => 'Herald', 'role_id' => $support, 'spec_icon' => 'revenant_herald', 'spec_order' => 1),
array('spec_name' => 'Renegade', 'role_id' => $control, 'spec_icon' => 'revenant_renegade', 'spec_order' => 2),
array('spec_name' => 'Vindicator', 'role_id' => $damage, 'spec_icon' => 'revenant_vindicator', 'spec_order' => 3),
),
);
}
Expand Down
Binary file added images/spec_icons/elementalist_catalyst.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/spec_icons/elementalist_tempest.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/spec_icons/elementalist_weaver.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/spec_icons/engineer_holosmith.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/spec_icons/engineer_mechanist.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/spec_icons/engineer_scrapper.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/spec_icons/guardian_dragonhunter.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/spec_icons/guardian_firebrand.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/spec_icons/guardian_willbender.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/spec_icons/mesmer_chronomancer.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/spec_icons/mesmer_mirage.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/spec_icons/mesmer_virtuoso.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/spec_icons/necromancer_harbinger.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/spec_icons/necromancer_reaper.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/spec_icons/necromancer_scourge.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/spec_icons/ranger_druid.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/spec_icons/ranger_soulbeast.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/spec_icons/ranger_untamed.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/spec_icons/revenant_herald.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/spec_icons/revenant_renegade.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/spec_icons/revenant_vindicator.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/spec_icons/thief_daredevil.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/spec_icons/thief_deadeye.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/spec_icons/thief_specter.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/spec_icons/warrior_berserker.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/spec_icons/warrior_bladesworn.png
Binary file added images/spec_icons/warrior_spellbreaker.png
28 changes: 28 additions & 0 deletions tests/game/gw2_provider_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,34 @@ public function test_api_locales_empty(): void
$this->assertEmpty($this->provider->get_api_locales());
}

public function test_every_elite_spec_has_an_icon_asset(): void
{
$missing_value = array();
$missing_file = array();

foreach (gw2_provider::spec_catalog() as $class_id => $specs)
{
foreach ($specs as $spec)
{
if ($spec['spec_icon'] === '')
{
$missing_value[] = $spec['spec_name'];
continue;
}

$file = dirname(__DIR__, 2) . '/images/spec_icons/' . $spec['spec_icon'] . '.png';

if (!file_exists($file))
{
$missing_file[] = $spec['spec_name'] . ' => ' . $spec['spec_icon'] . '.png';
}
}
}

$this->assertSame(array(), $missing_value, 'Specs with an empty spec_icon: ' . implode(', ', $missing_value));
$this->assertSame(array(), $missing_file, 'Specs whose icon file is missing: ' . implode(', ', $missing_file));
}

public function test_armor_types(): void
{
$armor = $this->provider->get_armor_types();
Expand Down
Loading