From 103bb5a513d2ac98deaddc509d7395918a2bbe47 Mon Sep 17 00:00:00 2001 From: Kelsi Date: Fri, 13 Mar 2026 05:23:31 -0700 Subject: [PATCH] fix: query item info in SMSG_LOOT_START_ROLL and use live name in roll popup SMSG_LOOT_START_ROLL was not calling queryItemInfo(), so the roll popup would display item IDs instead of names when the item had not been previously cached (e.g. first time seeing that item in the session). Also update renderLootRollPopup to prefer the live ItemQueryResponseData name/quality over the snapshot captured at parse time, so the popup shows the correct name once SMSG_ITEM_QUERY_SINGLE_RESPONSE arrives. --- src/game/game_handler.cpp | 4 ++++ src/ui/game_screen.cpp | 9 ++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/game/game_handler.cpp b/src/game/game_handler.cpp index 3d46fd31..ac884141 100644 --- a/src/game/game_handler.cpp +++ b/src/game/game_handler.cpp @@ -2084,6 +2084,10 @@ void GameHandler::handlePacket(network::Packet& packet) { pendingLootRoll_.objectGuid = objectGuid; pendingLootRoll_.slot = slot; pendingLootRoll_.itemId = itemId; + // Ensure item info is queried so the roll popup can show the name/icon. + // The popup re-reads getItemInfo() live, so the name will populate once + // SMSG_ITEM_QUERY_SINGLE_RESPONSE arrives (usually within ~100 ms). + queryItemInfo(itemId, 0); auto* info = getItemInfo(itemId); pendingLootRoll_.itemName = info ? info->name : std::to_string(itemId); pendingLootRoll_.itemQuality = info ? static_cast(info->quality) : 0; diff --git a/src/ui/game_screen.cpp b/src/ui/game_screen.cpp index 92dccefe..dd81e8eb 100644 --- a/src/ui/game_screen.cpp +++ b/src/ui/game_screen.cpp @@ -10716,7 +10716,14 @@ void GameScreen::renderLootRollPopup(game::GameHandler& gameHandler) { ImGui::Image((ImTextureID)(uintptr_t)rollIcon, ImVec2(24, 24)); ImGui::SameLine(); } - ImGui::TextColored(col, "[%s]", roll.itemName.c_str()); + // Prefer live item info (arrives via SMSG_ITEM_QUERY_SINGLE_RESPONSE after the + // roll popup opens); fall back to the name cached at SMSG_LOOT_START_ROLL time. + const char* displayName = (rollInfo && rollInfo->valid && !rollInfo->name.empty()) + ? rollInfo->name.c_str() + : roll.itemName.c_str(); + if (rollInfo && rollInfo->valid) + col = (rollInfo->quality < 6) ? kQualityColors[rollInfo->quality] : kQualityColors[1]; + ImGui::TextColored(col, "[%s]", displayName); if (ImGui::IsItemHovered() && rollInfo && rollInfo->valid) { inventoryScreen.renderItemTooltip(*rollInfo); }