From da5b464cf6822e2b3f1bff88b08ece05df458fee Mon Sep 17 00:00:00 2001 From: Kelsi Date: Mon, 23 Mar 2026 02:53:34 -0700 Subject: [PATCH] feat: add IsPlayerSpell, IsCurrentSpell, and spell state queries IsPlayerSpell(spellId) checks if the spell is in the player's known spells set. Used by action bar addons to distinguish permanent spells from temporary proc/buff-granted abilities. IsCurrentSpell(spellId) checks if the spell is currently being cast. IsSpellOverlayed() and IsAutoRepeatSpell() are stubs for addon compat. --- src/addons/lua_engine.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/addons/lua_engine.cpp b/src/addons/lua_engine.cpp index ab41c206..67821932 100644 --- a/src/addons/lua_engine.cpp +++ b/src/addons/lua_engine.cpp @@ -5182,6 +5182,25 @@ void LuaEngine::registerCoreAPI() { if (gh) gh->requestPvpLog(); return 0; }}, + // --- Spell Utility --- + {"IsPlayerSpell", [](lua_State* L) -> int { + auto* gh = getGameHandler(L); + uint32_t spellId = static_cast(luaL_checknumber(L, 1)); + lua_pushboolean(L, gh && gh->getKnownSpells().count(spellId) ? 1 : 0); + return 1; + }}, + {"IsSpellOverlayed", [](lua_State* L) -> int { + (void)L; lua_pushboolean(L, 0); return 1; // No proc overlay tracking + }}, + {"IsCurrentSpell", [](lua_State* L) -> int { + auto* gh = getGameHandler(L); + uint32_t spellId = static_cast(luaL_checknumber(L, 1)); + lua_pushboolean(L, gh && gh->getCurrentCastSpellId() == spellId ? 1 : 0); + return 1; + }}, + {"IsAutoRepeatSpell", [](lua_State* L) -> int { + (void)L; lua_pushboolean(L, 0); return 1; // Stub + }}, // --- Titles --- {"GetCurrentTitle", [](lua_State* L) -> int { auto* gh = getGameHandler(L);