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

@ -990,9 +990,11 @@ static int lua_GetSpellInfo(lua_State* L) {
std::string iconPath = gh->getSpellIconPath(spellId);
if (!iconPath.empty()) lua_pushstring(L, iconPath.c_str());
else lua_pushnil(L); // 3: icon texture path
lua_pushnumber(L, 0); // 4: castTime (ms) — not tracked
lua_pushnumber(L, 0); // 5: minRange
lua_pushnumber(L, 0); // 6: maxRange
// Resolve cast time and range from Spell.dbc → SpellCastTimes.dbc / SpellRange.dbc
auto spellData = gh->getSpellData(spellId);
lua_pushnumber(L, spellData.castTimeMs); // 4: castTime (ms)
lua_pushnumber(L, spellData.minRange); // 5: minRange (yards)
lua_pushnumber(L, spellData.maxRange); // 6: maxRange (yards)
lua_pushnumber(L, spellId); // 7: spellId
return 7;
}