From 4986308581c93924707dd1005aca4aeb9ddc7d4a Mon Sep 17 00:00:00 2001 From: Kelsi Date: Tue, 10 Mar 2026 20:59:02 -0700 Subject: [PATCH] feat: rich item tooltips in vendor and loot-roll windows MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Vendor window: replace manual stat-only tooltip with full renderItemTooltip (now shows bind type, slot, weapon stats, armor, extra stats, spell effects, flavor text, and sell price — consistent with inventory) - Loot-roll popup: add item icon and hover tooltip via renderItemTooltip - Loot-roll: pre-fetch item info via queryItemInfo when roll prompt appears --- src/game/game_handler.cpp | 2 ++ src/ui/game_screen.cpp | 31 +++++++++++++------------------ 2 files changed, 15 insertions(+), 18 deletions(-) diff --git a/src/game/game_handler.cpp b/src/game/game_handler.cpp index ac47f913..0895685b 100644 --- a/src/game/game_handler.cpp +++ b/src/game/game_handler.cpp @@ -18567,6 +18567,8 @@ void GameHandler::handleLootRoll(network::Packet& packet) { pendingLootRoll_.objectGuid = objectGuid; pendingLootRoll_.slot = slot; pendingLootRoll_.itemId = itemId; + // Ensure item info is in cache; query if not + queryItemInfo(itemId, 0); // Look up item name from cache auto* info = getItemInfo(itemId); pendingLootRoll_.itemName = info ? info->name : std::to_string(itemId); diff --git a/src/ui/game_screen.cpp b/src/ui/game_screen.cpp index 282d1ecb..e70bf2ac 100644 --- a/src/ui/game_screen.cpp +++ b/src/ui/game_screen.cpp @@ -5775,7 +5775,19 @@ void GameScreen::renderLootRollPopup(game::GameHandler& gameHandler) { ImVec4 col = (q < 6) ? kQualityColors[q] : kQualityColors[1]; ImGui::Text("An item is up for rolls:"); + + // Show item icon if available + const auto* rollInfo = gameHandler.getItemInfo(roll.itemId); + uint32_t rollDisplayId = rollInfo ? rollInfo->displayInfoId : 0; + VkDescriptorSet rollIcon = rollDisplayId ? inventoryScreen.getItemIcon(rollDisplayId) : VK_NULL_HANDLE; + if (rollIcon) { + ImGui::Image((ImTextureID)(uintptr_t)rollIcon, ImVec2(24, 24)); + ImGui::SameLine(); + } ImGui::TextColored(col, "[%s]", roll.itemName.c_str()); + if (ImGui::IsItemHovered() && rollInfo && rollInfo->valid) { + inventoryScreen.renderItemTooltip(*rollInfo); + } ImGui::Spacing(); if (ImGui::Button("Need", ImVec2(80, 30))) { @@ -7229,24 +7241,7 @@ void GameScreen::renderVendorWindow(game::GameHandler& gameHandler) { ImGui::TextColored(qualityColors[q], "%s", info->name.c_str()); // Tooltip with stats on hover if (ImGui::IsItemHovered()) { - ImGui::BeginTooltip(); - ImGui::TextColored(qualityColors[q], "%s", info->name.c_str()); - if (info->damageMax > 0.0f) { - ImGui::Text("%.0f - %.0f Damage", info->damageMin, info->damageMax); - if (info->delayMs > 0) { - float speed = static_cast(info->delayMs) / 1000.0f; - float dps = ((info->damageMin + info->damageMax) * 0.5f) / speed; - ImGui::Text("Speed %.2f", speed); - ImGui::Text("%.1f damage per second", dps); - } - } - if (info->armor > 0) ImGui::Text("Armor: %d", info->armor); - if (info->stamina > 0) ImGui::Text("+%d Stamina", info->stamina); - if (info->strength > 0) ImGui::Text("+%d Strength", info->strength); - if (info->agility > 0) ImGui::Text("+%d Agility", info->agility); - if (info->intellect > 0) ImGui::Text("+%d Intellect", info->intellect); - if (info->spirit > 0) ImGui::Text("+%d Spirit", info->spirit); - ImGui::EndTooltip(); + inventoryScreen.renderItemTooltip(*info); } } else { ImGui::Text("Item %u", item.itemId);