mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-05-03 08:03:50 +00:00
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
This commit is contained in:
parent
8a81ffa29c
commit
3a143b9b5b
1 changed files with 18 additions and 3 deletions
|
|
@ -21936,7 +21936,7 @@ void GameHandler::handleSummonRequest(network::Packet& packet) {
|
||||||
if (packet.getSize() - packet.getReadPos() < 16) return;
|
if (packet.getSize() - packet.getReadPos() < 16) return;
|
||||||
|
|
||||||
summonerGuid_ = packet.readUInt64();
|
summonerGuid_ = packet.readUInt64();
|
||||||
/*uint32_t zoneId =*/ packet.readUInt32();
|
uint32_t zoneId = packet.readUInt32();
|
||||||
uint32_t timeoutMs = packet.readUInt32();
|
uint32_t timeoutMs = packet.readUInt32();
|
||||||
summonTimeoutSec_ = timeoutMs / 1000.0f;
|
summonTimeoutSec_ = timeoutMs / 1000.0f;
|
||||||
pendingSummonRequest_= true;
|
pendingSummonRequest_= true;
|
||||||
|
|
@ -21946,6 +21946,11 @@ void GameHandler::handleSummonRequest(network::Packet& packet) {
|
||||||
if (auto* unit = dynamic_cast<Unit*>(entity.get())) {
|
if (auto* unit = dynamic_cast<Unit*>(entity.get())) {
|
||||||
summonerName_ = unit->getName();
|
summonerName_ = unit->getName();
|
||||||
}
|
}
|
||||||
|
if (summonerName_.empty()) {
|
||||||
|
auto nit = playerNameCache.find(summonerGuid_);
|
||||||
|
if (nit != playerNameCache.end())
|
||||||
|
summonerName_ = nit->second;
|
||||||
|
}
|
||||||
if (summonerName_.empty()) {
|
if (summonerName_.empty()) {
|
||||||
char tmp[32];
|
char tmp[32];
|
||||||
std::snprintf(tmp, sizeof(tmp), "0x%llX",
|
std::snprintf(tmp, sizeof(tmp), "0x%llX",
|
||||||
|
|
@ -21953,9 +21958,14 @@ void GameHandler::handleSummonRequest(network::Packet& packet) {
|
||||||
summonerName_ = tmp;
|
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_,
|
LOG_INFO("SMSG_SUMMON_REQUEST: summoner=", summonerName_,
|
||||||
" timeout=", summonTimeoutSec_, "s");
|
" zoneId=", zoneId, " timeout=", summonTimeoutSec_, "s");
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameHandler::acceptSummon() {
|
void GameHandler::acceptSummon() {
|
||||||
|
|
@ -22001,6 +22011,11 @@ void GameHandler::handleTradeStatus(network::Packet& packet) {
|
||||||
if (auto* unit = dynamic_cast<Unit*>(entity.get())) {
|
if (auto* unit = dynamic_cast<Unit*>(entity.get())) {
|
||||||
tradePeerName_ = unit->getName();
|
tradePeerName_ = unit->getName();
|
||||||
}
|
}
|
||||||
|
if (tradePeerName_.empty()) {
|
||||||
|
auto nit = playerNameCache.find(tradePeerGuid_);
|
||||||
|
if (nit != playerNameCache.end())
|
||||||
|
tradePeerName_ = nit->second;
|
||||||
|
}
|
||||||
if (tradePeerName_.empty()) {
|
if (tradePeerName_.empty()) {
|
||||||
char tmp[32];
|
char tmp[32];
|
||||||
std::snprintf(tmp, sizeof(tmp), "0x%llX",
|
std::snprintf(tmp, sizeof(tmp), "0x%llX",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue