Skip to content

Commit dbd3f7f

Browse files
committed
GetItemStats: add weapon DPS and equip-spell stats
Weapon DPS (avg damage across the slots / swing time) is emitted under ITEM_MOD_DAMAGE_PER_SECOND_SHORT, matching 3.3.5's GetItemStats. Vanilla stores the "special" gear stats (crit, attack power, spell power/healing, hit, mp5, defense) as on-equip spells rather than stat slots, so decode each item's SpellTrigger == ON_EQUIP spells - and the random-suffix equip enchants - through the SPELL_AURA_* effects and fold them into the modern GetItemStats keys. Percent stats (crit/hit/defense) are reported as the raw vanilla percentage under the *_RATING key, since vanilla has no (level-dependent) rating conversion; e.g. Krol Blade's +1% crit is CRIT_MELEE_RATING = 1, not the 13 rating TBC/Era would show. Generic attack power subsumes its paired ranged-AP aura; rarer auras with no clean key (percent AP, per-weapon-line skill, procs) are skipped. Documents the full key set and its sources in docs/API.md.
1 parent 2f5cec3 commit dbd3f7f

2 files changed

Lines changed: 235 additions & 94 deletions

File tree

docs/API.md

Lines changed: 53 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -4710,45 +4710,69 @@ item actually carries are present.
47104710

47114711
```lua
47124712
C_Item.GetItemStats("item:2244") -- Krol Blade
4713-
-- { ITEM_MOD_STRENGTH_SHORT = 7, ITEM_MOD_STAMINA_SHORT = 5 }
4713+
-- { ITEM_MOD_STRENGTH_SHORT = 7, ITEM_MOD_STAMINA_SHORT = 5,
4714+
-- ITEM_MOD_DAMAGE_PER_SECOND_SHORT = 40.89,
4715+
-- ITEM_MOD_CRIT_MELEE_RATING = 1, ITEM_MOD_CRIT_RANGED_RATING = 1 }
47144716

47154717
C_Item.GetItemStats("item:12022:0:769") -- "of the Owl" random suffix
47164718
-- { ITEM_MOD_INTELLECT_SHORT = 6, ITEM_MOD_SPIRIT_SHORT = 6 }
47174719
```
47184720

4719-
**Reported stat set.** Vanilla's stored item stats: the base attributes
4720-
plus armor and the six resistance schools.
4721-
4722-
| Key | Stat |
4723-
|-----|------|
4724-
| `ITEM_MOD_STRENGTH_SHORT` / `_AGILITY_` / `_STAMINA_` / `_INTELLECT_` / `_SPIRIT_SHORT` | Base attributes |
4725-
| `ITEM_MOD_MANA_SHORT` / `ITEM_MOD_HEALTH_SHORT` | Mana / health on equip |
4726-
| `RESISTANCE0_NAME` | Armor |
4727-
| `RESISTANCE1_NAME``RESISTANCE6_NAME` | Holy / Fire / Nature / Frost / Shadow / Arcane resistance |
4728-
4729-
The rating stats later expansions added (crit / haste / mastery / …)
4730-
don't exist in 1.12 data, so those keys never appear.
4721+
**Sources.** The table is assembled from three places, so it reflects
4722+
what the item actually grants — not just its stored stat slots:
4723+
4724+
1. **Base record** — the stored attributes, armor, resistances, and (for
4725+
weapons) DPS.
4726+
2. **On-equip spells** (`SpellTrigger == ON_EQUIP`) — vanilla stores the
4727+
"special" bonuses (crit, attack power, spell power, hit, mp5, defense,
4728+
…) as an equip spell whose aura effect carries the value, not as a
4729+
stat slot. Their auras are decoded into the keys below.
4730+
3. **Random suffix** — the link's third `item:id:enchant:SUFFIX:unique`
4731+
field (`ItemRandomProperties.dbc``SpellItemEnchantment.dbc`): stat
4732+
suffixes ("of the Owl") are themselves equip spells, armor suffixes
4733+
("of Toughness") are direct resistance enchants. A bare itemID or a
4734+
suffix-less link contributes nothing here.
4735+
4736+
**Keys.**
4737+
4738+
| Key | Stat | Source |
4739+
|-----|------|--------|
4740+
| `ITEM_MOD_STRENGTH_SHORT` / `_AGILITY_` / `_STAMINA_` / `_INTELLECT_` / `_SPIRIT_SHORT` | Base attributes | record / `MOD_STAT` |
4741+
| `ITEM_MOD_MANA_SHORT` / `ITEM_MOD_HEALTH_SHORT` | Mana / health on equip | record |
4742+
| `RESISTANCE0_NAME` | Armor | record / `MOD_RESISTANCE` bit 0 |
4743+
| `RESISTANCE1_NAME``RESISTANCE6_NAME` | Holy / Fire / Nature / Frost / Shadow / Arcane resistance | record / `MOD_RESISTANCE` / type-4 enchant |
4744+
| `ITEM_MOD_DAMAGE_PER_SECOND_SHORT` | Weapon DPS (float) | avg damage ÷ swing time |
4745+
| `ITEM_MOD_ATTACK_POWER_SHORT` | Attack power | `MOD_ATTACK_POWER` (99) |
4746+
| `ITEM_MOD_RANGED_ATTACK_POWER_SHORT` | Ranged attack power (ranged-only items) | `MOD_RANGED_ATTACK_POWER` (124) |
4747+
| `ITEM_MOD_CRIT_MELEE_RATING` + `ITEM_MOD_CRIT_RANGED_RATING` | Crit % | weapon-crit aura (52) |
4748+
| `ITEM_MOD_HIT_MELEE_RATING` + `ITEM_MOD_HIT_RANGED_RATING` | Hit % | hit aura (54) |
4749+
| `ITEM_MOD_HIT_SPELL_RATING` | Spell hit % | spell-hit aura (55) |
4750+
| `ITEM_MOD_SPELL_DAMAGE_DONE_SHORT` | Spell damage | `MOD_DAMAGE_DONE` (13) |
4751+
| `ITEM_MOD_SPELL_HEALING_DONE_SHORT` | Healing | `MOD_HEALING_DONE` (135) |
4752+
| `ITEM_MOD_MANA_REGENERATION` | mp5 (mana) | `MOD_POWER_REGEN` (85) |
4753+
| `ITEM_MOD_DEFENSE_SKILL_RATING` | Defense skill | `MOD_SKILL` (30, misc 95) |
4754+
4755+
> **Values are vanilla-native, not ratings.** Vanilla has no rating
4756+
> system, so the percent-based stats (crit / hit / defense) report the raw
4757+
> **percentage** under the modern `*_RATING` key — e.g. Krol Blade's
4758+
> "+1% crit" is `ITEM_MOD_CRIT_MELEE_RATING = 1`, where TBC/Era would
4759+
> show the level-scaled rating (`13`). A native percent is the only
4760+
> value that's honest and level-independent. Flat stats (attack power,
4761+
> spell damage, healing, mp5) are the item's actual magnitudes.
4762+
>
4763+
> Rating stats that didn't exist in 1.12 at all (haste, mastery,
4764+
> versatility, expertise, resilience) never appear. A generic "+N attack
4765+
> power" item carries both a melee and a ranged AP aura in vanilla; the
4766+
> generic `ITEM_MOD_ATTACK_POWER_SHORT` key subsumes it, so
4767+
> `ITEM_MOD_RANGED_ATTACK_POWER_SHORT` shows only for ranged-only items
4768+
> (scopes, ranged weapons). Rarer auras with no clean single key —
4769+
> percent attack power, per-weapon-line skill, damage-taken, on-hit /
4770+
> on-use procs — are skipped.
47314771
47324772
**Input.** Accepts a full chat hyperlink, an `item:N…` link string, or a
47334773
bare itemID (a superset of retail, which is link-only). Returns `nil` if
47344774
the item isn't cached yet — warm it via `GetItemInfo` and retry.
47354775

4736-
**Random suffixes** ("of the Bear", "of Arcane Resistance", …) are
4737-
resolved from the link's third `item:id:enchant:SUFFIX:unique` field and
4738-
folded into the same stat keys. In 1.12 the stat suffixes apply their
4739-
bonus as an equip spell (`ItemRandomProperties.dbc`
4740-
`SpellItemEnchantment.dbc` type 3 → a spell whose `SPELL_AURA_MOD_STAT` /
4741-
`MOD_RESISTANCE` effect carries the value); armor suffixes use a direct
4742-
resistance enchant. Both are decoded. A bare itemID or a link with no
4743-
suffix field yields base stats only.
4744-
4745-
> Suffix bonuses granted through *other* spell auras — attack power,
4746-
> spell power, healing, mp5, weapon skill — are intentionally **not**
4747-
> reported. Those aren't part of vanilla's item-stat set, and the base
4748-
> item stores them the same way (via equip spells we likewise don't
4749-
> count), so the scope stays consistent between a plain item and its
4750-
> suffixed variant.
4751-
47524776
### `C_Item.GetItemSubClassInfo(classID, subClassID)`
47534777

47544778
Returns `subClassName, subClassUsesInvType` for an item class/subclass pair.

0 commit comments

Comments
 (0)