mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-22 23:30:14 +00:00
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.
This commit is contained in:
parent
48bcee32b4
commit
103bb5a513
2 changed files with 12 additions and 1 deletions
|
|
@ -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<uint8_t>(info->quality) : 0;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue