From 572b3ce7ca3f628863a1ff467796c334ab4cd255 Mon Sep 17 00:00:00 2001 From: Kelsi Date: Sun, 22 Mar 2026 19:59:52 -0700 Subject: [PATCH] feat: show gem sockets and item set ID in item tooltips MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add gem socket display to item tooltips — shows [Meta Socket], [Red Socket], [Yellow Socket], [Blue Socket], or [Prismatic Socket] based on socketColor mask from ItemQueryResponseData. Also pass itemSetId through _GetItemTooltipData for addons that track set bonuses. --- 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 5611c0eb..4fe95efa 100644 --- a/src/addons/lua_engine.cpp +++ b/src/addons/lua_engine.cpp @@ -2090,6 +2090,28 @@ static int lua_GetItemTooltipData(lua_State* L) { if (info->frostRes != 0) { lua_pushnumber(L, info->frostRes); lua_setfield(L, -2, "frostRes"); } if (info->shadowRes != 0) { lua_pushnumber(L, info->shadowRes); lua_setfield(L, -2, "shadowRes"); } if (info->arcaneRes != 0) { lua_pushnumber(L, info->arcaneRes); lua_setfield(L, -2, "arcaneRes"); } + // Gem sockets (WotLK/TBC) + int numSockets = 0; + for (int i = 0; i < 3; ++i) { + if (info->socketColor[i] != 0) ++numSockets; + } + if (numSockets > 0) { + lua_newtable(L); + for (int i = 0; i < 3; ++i) { + if (info->socketColor[i] != 0) { + lua_newtable(L); + lua_pushnumber(L, info->socketColor[i]); + lua_setfield(L, -2, "color"); + lua_rawseti(L, -2, i + 1); + } + } + lua_setfield(L, -2, "sockets"); + } + // Item set + if (info->itemSetId != 0) { + lua_pushnumber(L, info->itemSetId); + lua_setfield(L, -2, "itemSetId"); + } return 1; } @@ -5500,6 +5522,14 @@ void LuaEngine::registerCoreAPI() { " if data.frostRes and data.frostRes ~= 0 then self:AddLine('+'..data.frostRes..' Frost Resistance', 0, 1, 0) end\n" " if data.shadowRes and data.shadowRes ~= 0 then self:AddLine('+'..data.shadowRes..' Shadow Resistance', 0, 1, 0) end\n" " if data.arcaneRes and data.arcaneRes ~= 0 then self:AddLine('+'..data.arcaneRes..' Arcane Resistance', 0, 1, 0) end\n" + " -- Gem sockets\n" + " if data.sockets then\n" + " local socketNames = {[1]='Meta',[2]='Red',[4]='Yellow',[8]='Blue'}\n" + " for _, sock in ipairs(data.sockets) do\n" + " local colorName = socketNames[sock.color] or 'Prismatic'\n" + " self:AddLine('[' .. colorName .. ' Socket]', 0.5, 0.5, 0.5)\n" + " end\n" + " end\n" " -- Required level\n" " if data.requiredLevel and data.requiredLevel > 1 then\n" " self:AddLine('Requires Level '..data.requiredLevel, 1, 1, 1)\n"