We use GW2armory all over the site for our builds. As a reference, I’m making this page to show off all the parameters and compatibility with it, and how our how uses it in the choosy system.

The first thing you should do is add the script into the page or global footer to call GW2armory’s functions in. This is in each build template so it doesn’t make unnecessary calls, and is inserted at the bottom of this page. It’s hidden by default so you won’t see it unless you inspect.

 <script async src="https://unpkg.com/[email protected]^0.x.x/armory-embeds.js"></script> 

Available selections

There can be styled separately by using these class names in CSS:

.gw2a-character-embed {}
.gw2a-skills-embed {}
.gw2a-items-embed {}
.gw2a-amulets-embed {}
.gw2a-traits-embed {}
.gw2a-specializations-embed {}

How to call data in:

Items, Skills, Traits and Specializations require an ID, so instead of data-armory-name, you will have data-armory-ids. This also allows multiple to be called at once.

 <div data-armory-embed="skills" data-armory-ids="5507,5508,5510,5515"></div> 

In your DIV you can specify icon size, text alongside for a Wiki link and Upgrades to be rendered into the tool tip.
Additional settings:

Traits and Specializations:

Call a Specialization:

 <div data-armory-embed="specializations" data-armory-ids="3"   data-armory-3-traits="1761,1774,1749" > </div> 

You must specify a Specialization (see https://api.guildwars2.com/v2/specializations for choices, you can refine this down by checking against https://api.guildwars2.com/v2/professions).
Without specifying correct values in the traits part, no traits will light up as ‘selected’. There are no other options for Specializations as adding text will look a mess.

Call a Trait:

 <div   data-armory-embed="traits"   data-armory-ids="820,-1,1694"   data-armory-blank-text="This could be anything you want!" > </div> 

Like Items, you have sizing, custom text and wiki link options.

These are pretty much the basics, and should work on any HTML based thing (as long as you call the armory script in from its CDN).

I’ve used Advanced Custom Fields to populate selectable boxes in the back end to provide choices on all these aspects. The choices are saved to each post and called by post_meta into shortcodes. Probably lost you at this point so I’ll be happy to explain it or help deploy a better solution for other site.

For the author’s work and more information, check out Madou’s GitHub for the project: https://github.com/madou/armory-embeds

Leave a Reply

Your email address will not be published. Required fields are marked *