refactor(Core/Mails): centralize mail count bookkeeping in a new MailMgr (#26727)

This commit is contained in:
Andrew
2026-07-23 21:22:08 -03:00
committed by GitHub
parent a8d75f59c5
commit a8c3736879
13 changed files with 346 additions and 168 deletions
+4 -3
View File
@@ -26,6 +26,7 @@
#include "Language.h"
#include "Log.h"
#include "Mail.h"
#include "MailMgr.h"
#include "ObjectMgr.h"
#include "Opcodes.h"
#include "Player.h"
@@ -416,7 +417,7 @@ void WorldSession::HandleMailDelete(WorldPacket& recvData)
Mail* m = _player->GetMail(mailId);
Player* player = _player;
player->m_mailsUpdated = true;
if (m)
if (m && m->state != MAIL_STATE_DELETED)
{
// delete shouldn't show up for COD mails
if (m->COD)
@@ -427,7 +428,7 @@ void WorldSession::HandleMailDelete(WorldPacket& recvData)
m->state = MAIL_STATE_DELETED;
sCharacterCache->DecreaseCharacterMailCount(player->GetGUID());
sMailMgr->OnMailDeleted(player->GetGUID().GetCounter());
}
player->SendMailResult(mailId, MAIL_DELETED, MAIL_OK);
}
@@ -509,7 +510,7 @@ void WorldSession::HandleMailReturnToSender(WorldPacket& recvData)
delete m; //we can deallocate old mail
player->SendMailResult(mailId, MAIL_RETURNED_TO_SENDER, MAIL_OK);
sCharacterCache->DecreaseCharacterMailCount(player->GetGUID());
sMailMgr->OnMailDeleted(player->GetGUID().GetCounter());
}
//called when player takes item attached in mail