User:Dr ishmael/specialization collection tables

From Guild Wars 2 Wiki
Jump to navigationJump to search

I created these so I could see my progress on all of the elite specialization weapon collections at a glance. For each expansion, I built a table summarizing the 14 items required for all 9 collections, with notes on how to acquire them - including specific notes on individual items where needed (e.g. for Path of Fire, one item is purchased from renown heart vendors, I list the specific vendor for each one). I also summarized the total cost of the items that have to be purchased; this is mainly a concern for Heart of Thorns, which requires a significant amount of map currencies.

This page combines the three main tables, leaving out the extra notes and cost summaries. It's probably overkill, but who's counting.

Dev notes

Initially, I had used the dynamic approach below for these tables. But then I decided I'd like to add notes directly in the same table cells as the collection items, and the ordering anomalies in the HoT Revenant and Mesmer collections were bugging me, so I took the generated HTML and converted them to static wiki tables.

Performance didn't appreciably improve, which means it's probably the 200+ item icons that are the problem. But since this is just a userpage for my personal reference, I'll stop worrying about it.

Original dynamic approach

While it would be nice to lookup the ids dynamically with something like the following query, I'm pretty sure there's no way to return them in the wiki's profession order.

{{#vardefine:achievement ids|{{#ask:[[Has context::Achievement]][[Has achievement category::Specialization Collections]][[Gives item::Expurgation||Guerrilla Arc||Silence of a Thousand Years||The Cutting Edge||Fang of Mokèlé||Cursed Flintlock||Warpblade||Veilrender||Guide for the Lost]]|?Has game id#|headers=hide|mainlabel=-|link=none|default=|format=plainlist}}}}

So instead I just took those results and rearrange them in a static var.

{{#vardefine:achievement ids|3756~3848~3621~3893~3768~3597~3745~3685~3787}}

Then I retrieved the collection lists into variables per collection.

{{#arraymap:{{#var:achievement ids}}|~|@@@|{{#vardefine:@@@ collection list|{{#ask: [[Has context::Achievement]] [[Has game id::@@@]]|?Has achievement collection|headers=hide|mainlabel=-|format=plainlist|default=}}}}}}

Finally initialize array indexes.

{{#vardefine:bit|0}}{{#vardefine:xbit|0}}

Unless there's a more efficient algorithm I haven't thought of, this requires iterating across the collection array for every table cell. That's 196 iterations through 14-member arrays (plus another 84 for the Machined weapons in HoT). Normally I wouldn't worry about performance on that, but with all the SMW stuff also going on, it does seem to be bogging down MW with HoT and PoF on the same page. Thus, I've split this up by expansion.