From a3186b3846c60dadefab0a854b1f3b9562b4bf61 Mon Sep 17 00:00:00 2001 From: Karth <148375244+Karth-Xyver@users.noreply.github.com> Date: Tue, 16 Jan 2024 17:05:04 +0100 Subject: [PATCH] Fix NPC name in new mail notification when receiving mails from NPCs If a player received a mail from a NPC with the same id as an existing character's guid, the mail notification would show the player's name instead. --- src/game/Mails/MailHandler.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/game/Mails/MailHandler.cpp b/src/game/Mails/MailHandler.cpp index ea5106b7340..802b3da34a3 100644 --- a/src/game/Mails/MailHandler.cpp +++ b/src/game/Mails/MailHandler.cpp @@ -824,20 +824,22 @@ void WorldSession::HandleQueryNextMailTime(WorldPacket& /**recv_data*/) if (now < m->deliver_time) continue; - data << ObjectGuid(HIGHGUID_PLAYER, m->sender); // sender guid + HighGuid guidType = HIGHGUID_PLAYER; switch (m->messageType) { - case MAIL_AUCTION: - data << uint32(m->sender); // auction house id - data << uint32(MAIL_AUCTION); // message type + case MAIL_CREATURE: + guidType = HIGHGUID_UNIT; break; - default: - data << uint32(0); - data << uint32(0); + case MAIL_GAMEOBJECT: + guidType = HIGHGUID_GAMEOBJECT; break; } + data << ObjectGuid(guidType, m->sender); // sender guid + data << static_cast(m->sender); // sender id + data << static_cast(m->messageType); // message type + data << uint32(m->stationery); data << uint32(0xC6000000); // float unk, time or something