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.
This commit is contained in:
Kelsi 2026-03-23 02:53:34 -07:00
parent 9cd2cfa46e
commit da5b464cf6

View file

@ -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<uint32_t>(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<uint32_t>(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);