User:Aikan/API scraping/Attributes and prefixes

From Guild Wars 2 Wiki
Jump to navigationJump to search

Equipment attribute value is derived from a simple formula[1],

attribute = round(hidden_item_number * multiplier + value)

where multiplier and value are given by the /v2/itemstats API endpoint, and hidden_item_number is a number specific to each piece of equipment (and for now inaccessible). Using that formula, it is possible to give bounds to the hidden number.

Obtaining the hidden number bounds[edit]

Bonetti's Rapier has a +120 bonus in power and +85 in precision and ferocity. Its prefix ID is 161, which corresponds to a 0.35 multiplier for power and 0.25 for precision and ferocity.

+120 is the rounded value of its hidden number (h), so we have 119.5 < 0.35*h < 120.5 meaning 341.43 < h < 344.29

Doing the same with the precision and ferocity bonuses gives 338 < h < 342 , which combines to 341.43 < h < 342

Weapons[edit]

First applied to weapons

Assumptions[edit]

Two assumptions are done here.

  • The hidden number only depends on the item level[1], rarity and handedness, except for a few, well-defined outliers.
  • For a given level and rarity, the hidden number of a two-handed weapon is twice the one of a one-handed weapon.

Rounding[edit]

With these assumptions, it's easy to prove that rounding is an actual rounding and not a truncation. Compare these items, two level 75 masterwork weapons with the same prefix, one being one-handed and the other being two-handed. Having a truncation would give hidden numbers h1 and h2 such that 256 < h1 < 257.14 and 254.29 < h2/2 < 255.71, which contradicts the second assumption.

Outliers[edit]

There are three sets of outliers.

  • Leveling equipment whose numbers are explicitely the same ones as regular weapons with three extra levels. A weapon is part of this set if and only if its ID is between 50120 and 62500 (note that these bounds are the same for their containers, for ineffable inscription/insignias and for leveling armors)
  • 16 specific level 80 basic weapons, one for each terrestrial weapon type. These weapons are the same as the ones sold by lvl 80 weaponsmiths, except that their value is a bit higher and that they roughly are 10% more powerful; compare for example these two weapons. A weapon is part of this set if and only if it is a level 80, basic weapon, whose vendor value is 35 or 52.
  • Level 0 weapons. Compare for example these two level 0 fine weapons, one having a +9 bonus and the other one a +10 bonus.

Removing these two sets from the weapon database yields, for each available rarity/level pair, a single and consistent[2] range for the weapon hidden number.

Rarity[edit]

There is no rarity factor, as suggested here, such that the hidden number for a given level and rarity is such a rarity factor multiplied by a level factor. This can be proven by contradiction.

Let's suppose there is such a factor. For any fine and masterwork weapon of the same level, the ratio of hidden numbers r = h_m/h_f is the ratio of these factors for masterwork and fine gear, and does not depend on level. Now let us consider these four weapons

ID Name Level Rarity Prefix ID First attribute Second attribute Lower bound for h Upper bound for h
25325 Mending Shiverpeak Arquebus 26 Fine 147 +38 +27 106 110
25339 Mending Shiverpeak Arquebus of Accuracy 26 Masterwork 147 +43 +31 122 124.29
28041 Honed Iron Rifle 52 Fine 152 +98 +70 278.57 281.43
28146 Hearty iron Rifle of Smoldering 52 Masterwork 149 +106 +76 302 304.29

At level 26, h_m > 122 and h_f < 110 so r > 122/110 = 1.109

At level 52, h_m < 304.29 and h_f > 278.57 so r < 304.29/278.57 = 1.092

These two bounds are not consistent, so such a factor doesn't exist.


General equipment[edit]

Applied to more general equipment (armor including aquabreathers, back items, trinkets and weapons.

Outliers[edit]

  • Pieces whose level is 0.
  • "Boosted" level 80 basic weapons (see above)
  • Leveling gear
  • Some trinkets, whose IDs are in the list [23105, 23106, 23107, 23131, 23134, 23153, 23231, 23263, 23265, 23267, 23538, 23541, 23618, 23757, 24014, 24037, 24038, 38473, 77688]. They often correspond to anomalies on the wiki.

Computing attributes back[edit]

For every rarity/level (existing) pair, it is possible to compute bounds a single hidden numbers. That number is the same for all pieces of equipment (outliers excepted), with the following coefficients:

Equipment type Coefficient
Coat 9
Leggings 6
Helm 4
Boots 3
Gloves 3
Shoulders 3
Aquabreather 3
Back 2
Accessory 5
Amulet 8
Ring 6
One-handed weapon 8
Two-handed weapon 16

With these coefficients and the hidden numbers found at /hidden item number values, it is possible to exactly get back the attributes found in the API. For example, the hidden number for a level 80 rare is a number between 37.708 and 37.75. For any number in that range (say, 37.71), multiplying it by 6 gives a plausible (means that applying the formula gives back the exact attribute bonuses) hidden item value for any level 80 rare leg armor.


  1. ^ a b Daniel Snider, ArenaNet API gitter - "Effectively, each item has a single generated number based on level/item type/handedness, etc. That number is then multiplied across those "multiplier" values you see in the response. The "value" is added on top of that, so the formula to compute a stat for an item is hidden_item_number * multiplier + value where multiplier and value are from the itemstat response. hidden_item_number isn't exposed anywhere (as of 22nd May 2018), but I'd like to do so in v2/items/:id"

    "Bonetti's Rapier has a hidden value of 341.44 It's infix upgrade is https://api.guildwars2.com/v2/itemstats/161 so Precision will be round(341.44 * 0.25 + 0) == 85"
  2. ^ That means that, for all weapons with this rarity and this level, the hidden number ranges have a non-empty overlap