From 216c83d44542db3b2594cffa97257822e80070b6 Mon Sep 17 00:00:00 2001 From: Kelsi Date: Sun, 22 Mar 2026 20:03:18 -0700 Subject: [PATCH] feat: add spell descriptions to tooltips via GetSpellDescription MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Spell tooltips now show the spell description text (e.g., "Hurls a fiery ball that causes 565 to 655 Fire Damage") in gold/yellow text between the cast info and cooldown display. New GetSpellDescription(spellId) C function exposes the description field from SpellNameEntry (loaded from Spell.dbc via the spell name cache). Descriptions contain the raw DBC text which may include template variables ($s1, $d, etc.) — these show as-is until template substitution is implemented. --- src/addons/lua_engine.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/addons/lua_engine.cpp b/src/addons/lua_engine.cpp index 4fe95efa..d85c56ad 100644 --- a/src/addons/lua_engine.cpp +++ b/src/addons/lua_engine.cpp @@ -1624,6 +1624,16 @@ static int lua_GetSpellBookItemName(lua_State* L) { return 1; } +// GetSpellDescription(spellId) → description string +static int lua_GetSpellDescription(lua_State* L) { + auto* gh = getGameHandler(L); + if (!gh) { lua_pushstring(L, ""); return 1; } + uint32_t spellId = static_cast(luaL_checknumber(L, 1)); + const std::string& desc = gh->getSpellDescription(spellId); + lua_pushstring(L, desc.c_str()); + return 1; +} + static int lua_GetSpellCooldown(lua_State* L) { auto* gh = getGameHandler(L); if (!gh) { lua_pushnumber(L, 0); lua_pushnumber(L, 0); return 2; } @@ -4929,6 +4939,7 @@ void LuaEngine::registerCoreAPI() { {"GetSpellBookItemName", lua_GetSpellBookItemName}, {"GetSpellCooldown", lua_GetSpellCooldown}, {"GetSpellPowerCost", lua_GetSpellPowerCost}, + {"GetSpellDescription", lua_GetSpellDescription}, {"IsSpellInRange", lua_IsSpellInRange}, {"UnitDistanceSquared", lua_UnitDistanceSquared}, {"CheckInteractDistance", lua_CheckInteractDistance}, @@ -5593,6 +5604,11 @@ void LuaEngine::registerCoreAPI() { " else\n" " self:AddDoubleLine('Instant', '', 1,1,1, 1,1,1)\n" " end\n" + " -- Description\n" + " local desc = GetSpellDescription(spellId)\n" + " if desc and desc ~= '' then\n" + " self:AddLine(desc, 1, 0.82, 0)\n" + " end\n" " -- Cooldown\n" " local start, dur = GetSpellCooldown(spellId)\n" " if dur and dur > 0 then\n"