From 3a143b9b5b01341b8d4dffe64f9a93872ba7dee2 Mon Sep 17 00:00:00 2001 From: Kelsi Date: Fri, 13 Mar 2026 06:37:26 -0700 Subject: [PATCH] fix: use playerNameCache fallback and show zone name in summon/trade requests - SMSG_SUMMON_REQUEST: fall back to playerNameCache when entity not in range; include zone name from getAreaName() in the summon message (e.g. "Bob is summoning you to Stormwind.") - SMSG_TRADE_STATUS BEGIN_TRADE: fall back to playerNameCache when the trade initiator's entity is not visible --- src/game/game_handler.cpp | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/src/game/game_handler.cpp b/src/game/game_handler.cpp index f41a978b..7829ca67 100644 --- a/src/game/game_handler.cpp +++ b/src/game/game_handler.cpp @@ -21936,7 +21936,7 @@ void GameHandler::handleSummonRequest(network::Packet& packet) { if (packet.getSize() - packet.getReadPos() < 16) return; summonerGuid_ = packet.readUInt64(); - /*uint32_t zoneId =*/ packet.readUInt32(); + uint32_t zoneId = packet.readUInt32(); uint32_t timeoutMs = packet.readUInt32(); summonTimeoutSec_ = timeoutMs / 1000.0f; pendingSummonRequest_= true; @@ -21946,6 +21946,11 @@ void GameHandler::handleSummonRequest(network::Packet& packet) { if (auto* unit = dynamic_cast(entity.get())) { summonerName_ = unit->getName(); } + if (summonerName_.empty()) { + auto nit = playerNameCache.find(summonerGuid_); + if (nit != playerNameCache.end()) + summonerName_ = nit->second; + } if (summonerName_.empty()) { char tmp[32]; std::snprintf(tmp, sizeof(tmp), "0x%llX", @@ -21953,9 +21958,14 @@ void GameHandler::handleSummonRequest(network::Packet& packet) { summonerName_ = tmp; } - addSystemChatMessage(summonerName_ + " is summoning you."); + std::string msg = summonerName_ + " is summoning you"; + std::string zoneName = getAreaName(zoneId); + if (!zoneName.empty()) + msg += " to " + zoneName; + msg += '.'; + addSystemChatMessage(msg); LOG_INFO("SMSG_SUMMON_REQUEST: summoner=", summonerName_, - " timeout=", summonTimeoutSec_, "s"); + " zoneId=", zoneId, " timeout=", summonTimeoutSec_, "s"); } void GameHandler::acceptSummon() { @@ -22001,6 +22011,11 @@ void GameHandler::handleTradeStatus(network::Packet& packet) { if (auto* unit = dynamic_cast(entity.get())) { tradePeerName_ = unit->getName(); } + if (tradePeerName_.empty()) { + auto nit = playerNameCache.find(tradePeerGuid_); + if (nit != playerNameCache.end()) + tradePeerName_ = nit->second; + } if (tradePeerName_.empty()) { char tmp[32]; std::snprintf(tmp, sizeof(tmp), "0x%llX",