feat: show gem sockets and item set ID in item tooltips

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.
This commit is contained in:
Kelsi 2026-03-22 19:59:52 -07:00
parent a70f42d4f6
commit 572b3ce7ca

View file

@ -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"