From c55c5e668f10cbae9938e02ca743feb6d5d03cf4 Mon Sep 17 00:00:00 2001 From: Skjalf <47818697+Nyeriah@users.noreply.github.com> Date: Mon, 4 Oct 2021 10:44:04 -0300 Subject: [PATCH] fix(Core/Commands): partially fix an issue with mails sent from console never showing up the 'Customer Support' sender in-game (#8064) --- src/server/scripts/Commands/cs_misc.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/server/scripts/Commands/cs_misc.cpp b/src/server/scripts/Commands/cs_misc.cpp index 9e9f6ec62..6263d46d7 100644 --- a/src/server/scripts/Commands/cs_misc.cpp +++ b/src/server/scripts/Commands/cs_misc.cpp @@ -2691,8 +2691,10 @@ public: std::string subject = msgSubject; std::string text = msgText; - // from console show not existed sender - MailSender sender(MAIL_NORMAL, handler->GetSession() ? handler->GetSession()->GetPlayer()->GetGUID().GetCounter() : 0, MAIL_STATIONERY_GM); + ObjectGuid::LowType senderGuid; + // If the message is sent from console, set it as sent by the target itself, like the other Customer Support mails. + senderGuid = handler->GetSession() ? handler->GetSession()->GetPlayer()->GetGUID().GetCounter() : targetGuid.GetCounter(); + MailSender sender(MAIL_NORMAL, senderGuid, MAIL_STATIONERY_GM); //- TODO: Fix poor design CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction(); @@ -2789,8 +2791,10 @@ public: } } - // from console show not existed sender - MailSender sender(MAIL_NORMAL, handler->GetSession() ? handler->GetSession()->GetPlayer()->GetGUID().GetCounter() : 0, MAIL_STATIONERY_GM); + ObjectGuid::LowType senderGuid; + // If the message is sent from console, set it as sent by the target itself, like the other Customer Support mails. + senderGuid = handler->GetSession() ? handler->GetSession()->GetPlayer()->GetGUID().GetCounter() : receiverGuid.GetCounter(); + MailSender sender(MAIL_NORMAL, senderGuid, MAIL_STATIONERY_GM); // fill mail MailDraft draft(subject, text);