GW2Armory usage

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/armory-embeds@^0.x.x/armory-embeds.js"></script> 

Available selections

  • Items
  • Skills
  • Traits
  • Specializations
  • Character

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:

  • data-armory-inline-text=”wiki” // Wiki will provide a wiki link to item/skill/trait. Any other text can be passed here as a link, gw2spidy has the same function as wiki.
  • data-armory-size=”60″ //Size of icon in PX
  • data-armory-blank-text =”text” //Use an ID of -1 to make a empty icon, use this option to pass text to tooltip.
  • data-armory-{ITEM_ID}-skin=”value” //changes the icon and tooltip to make a ‘transmuted’ like item display.
  • data-armory-{ITEM_ID}-upgrades=”value” //renders sigil or rune into tooltip and inline text.
  • data-armory-{ITEM_ID}-infusions=”value” //Displays infusions in tooltip.
  • data-armory- {ITEM_ID} -upgrade-count=”{\”value\”: number}” //renders a total amount of upgrades to see numbers of total applied. ie full set of runes.

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


Posted

in

by

Tags: