feat: resolve spell cast time and range from DBC for GetSpellInfo

Add SpellDataResolver that lazily loads Spell.dbc, SpellCastTimes.dbc,
and SpellRange.dbc to provide cast time and range data. GetSpellInfo()
now returns real castTime (ms), minRange, and maxRange instead of
hardcoded 0 values.

This enables spell tooltip addons, cast bar addons (Quartz), and range
check addons to display accurate spell information. The DBC chain is:
  Spell.dbc[CastingTimeIndex] → SpellCastTimes.dbc[Base ms]
  Spell.dbc[RangeIndex] → SpellRange.dbc[MinRange, MaxRange]

Follows the same lazy-loading pattern as SpellIconPathResolver and
ItemIconPathResolver.
This commit is contained in:
Kelsi 2026-03-21 04:16:12 -07:00
parent cfb9e09e1d
commit c7e16646fc
3 changed files with 84 additions and 3 deletions

View file

@ -294,6 +294,14 @@ public:
return spellIconPathResolver_ ? spellIconPathResolver_(spellId) : std::string{};
}
// Spell data resolver: spellId -> {castTimeMs, minRange, maxRange}
struct SpellDataInfo { uint32_t castTimeMs = 0; float minRange = 0; float maxRange = 0; };
using SpellDataResolver = std::function<SpellDataInfo(uint32_t)>;
void setSpellDataResolver(SpellDataResolver r) { spellDataResolver_ = std::move(r); }
SpellDataInfo getSpellData(uint32_t spellId) const {
return spellDataResolver_ ? spellDataResolver_(spellId) : SpellDataInfo{};
}
// Item icon path resolver: displayInfoId -> texture path (e.g., "Interface\\Icons\\INV_Sword_04")
using ItemIconPathResolver = std::function<std::string(uint32_t)>;
void setItemIconPathResolver(ItemIconPathResolver r) { itemIconPathResolver_ = std::move(r); }
@ -2680,6 +2688,7 @@ private:
AddonEventCallback addonEventCallback_;
SpellIconPathResolver spellIconPathResolver_;
ItemIconPathResolver itemIconPathResolver_;
SpellDataResolver spellDataResolver_;
RandomPropertyNameResolver randomPropertyNameResolver_;
EmoteAnimCallback emoteAnimCallback_;