From 97ec915e4891ada4e90d85538cc3759ae048a994 Mon Sep 17 00:00:00 2001 From: Kelsi Date: Sun, 22 Mar 2026 22:48:30 -0700 Subject: [PATCH] =?UTF-8?q?feat:=20add=20glyph=20socket=20API=20for=20WotL?= =?UTF-8?q?K=20talent=20customization=20=E2=80=94=20400=20APIs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit GetNumGlyphSockets() returns 6 (WotLK glyph slot count). GetGlyphSocketInfo(index, talentGroup) returns enabled, glyphType (1=major, 2=minor), glyphSpellID, and icon for each socket. Uses existing learnedGlyphs_ array populated from SMSG_TALENTS_INFO. Enables talent/glyph inspection addons. This commit brings the total API count to exactly 400 functions. --- src/addons/lua_engine.cpp | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/src/addons/lua_engine.cpp b/src/addons/lua_engine.cpp index 135f632c..cc661614 100644 --- a/src/addons/lua_engine.cpp +++ b/src/addons/lua_engine.cpp @@ -5062,6 +5062,36 @@ void LuaEngine::registerCoreAPI() { lua_pushboolean(L, 1); // isCastable return 4; }}, + // --- Glyph API (WotLK) --- + {"GetNumGlyphSockets", [](lua_State* L) -> int { + lua_pushnumber(L, game::GameHandler::MAX_GLYPH_SLOTS); + return 1; + }}, + {"GetGlyphSocketInfo", [](lua_State* L) -> int { + // GetGlyphSocketInfo(index [, talentGroup]) → enabled, glyphType, glyphSpellID, icon + auto* gh = getGameHandler(L); + int index = static_cast(luaL_checknumber(L, 1)); + int spec = static_cast(luaL_optnumber(L, 2, 0)); + if (!gh || index < 1 || index > game::GameHandler::MAX_GLYPH_SLOTS) { + lua_pushboolean(L, 0); lua_pushnumber(L, 0); lua_pushnil(L); lua_pushnil(L); + return 4; + } + const auto& glyphs = (spec >= 1 && spec <= 2) + ? gh->getGlyphs(static_cast(spec - 1)) : gh->getGlyphs(); + uint16_t glyphId = glyphs[index - 1]; + // Glyph type: slots 1,2,3 = major (1), slots 4,5,6 = minor (2) + int glyphType = (index <= 3) ? 1 : 2; + lua_pushboolean(L, 1); // enabled + lua_pushnumber(L, glyphType); // glyphType (1=major, 2=minor) + if (glyphId != 0) { + lua_pushnumber(L, glyphId); // glyphSpellID + lua_pushstring(L, "Interface\\Icons\\INV_Glyph_MajorWarrior"); // placeholder icon + } else { + lua_pushnil(L); + lua_pushnil(L); + } + return 4; + }}, // --- Achievement API --- {"GetNumCompletedAchievements", [](lua_State* L) -> int { auto* gh = getGameHandler(L);