From 99f4ded3b58b6517f007b58a6f53047db4218735 Mon Sep 17 00:00:00 2001 From: Kelsi Date: Fri, 20 Mar 2026 19:22:59 -0700 Subject: [PATCH] feat: show random suffix names in loot roll popup and roll-won messages Apply getRandomPropertyName() to SMSG_LOOT_START_ROLL and SMSG_LOOT_ROLL_WON handlers so items with random suffixes display correctly in group loot contexts (e.g., "Leggings of the Eagle" in the Need/Greed popup and "Player wins Leggings of the Eagle (Need 85)" in chat). --- src/game/game_handler.cpp | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/game/game_handler.cpp b/src/game/game_handler.cpp index ce4098e1..26bef831 100644 --- a/src/game/game_handler.cpp +++ b/src/game/game_handler.cpp @@ -2372,9 +2372,10 @@ void GameHandler::handlePacket(network::Packet& packet) { /*uint32_t mapId =*/ packet.readUInt32(); uint32_t slot = packet.readUInt32(); uint32_t itemId = packet.readUInt32(); + int32_t rollRandProp = 0; if (isWotLK) { /*uint32_t randSuffix =*/ packet.readUInt32(); - /*uint32_t randProp =*/ packet.readUInt32(); + rollRandProp = static_cast(packet.readUInt32()); } uint32_t countdown = packet.readUInt32(); uint8_t voteMask = packet.readUInt8(); @@ -2384,11 +2385,14 @@ void GameHandler::handlePacket(network::Packet& packet) { 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); + std::string rollItemName = info ? info->name : std::to_string(itemId); + if (rollRandProp != 0) { + std::string suffix = getRandomPropertyName(rollRandProp); + if (!suffix.empty()) rollItemName += " " + suffix; + } + pendingLootRoll_.itemName = rollItemName; pendingLootRoll_.itemQuality = info ? static_cast(info->quality) : 0; pendingLootRoll_.rollCountdownMs = (countdown > 0 && countdown <= 120000) ? countdown : 60000; pendingLootRoll_.voteMask = voteMask; @@ -25854,9 +25858,10 @@ void GameHandler::handleLootRollWon(network::Packet& packet) { /*uint32_t slot =*/ packet.readUInt32(); uint64_t winnerGuid = packet.readUInt64(); uint32_t itemId = packet.readUInt32(); + int32_t wonRandProp = 0; if (isWotLK) { /*uint32_t randSuffix =*/ packet.readUInt32(); - /*uint32_t randProp =*/ packet.readUInt32(); + wonRandProp = static_cast(packet.readUInt32()); } uint8_t rollNum = packet.readUInt8(); uint8_t rollType = packet.readUInt8(); @@ -25875,6 +25880,10 @@ void GameHandler::handleLootRollWon(network::Packet& packet) { auto* info = getItemInfo(itemId); std::string iName = info && !info->name.empty() ? info->name : std::to_string(itemId); + if (wonRandProp != 0) { + std::string suffix = getRandomPropertyName(wonRandProp); + if (!suffix.empty()) iName += " " + suffix; + } uint32_t wonItemQuality = info ? info->quality : 1u; std::string wonItemLink = buildItemLink(itemId, wonItemQuality, iName);