mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-17 10:55:43 +00:00
refactor(Core/Mail): avoid big mail loading/saving time, only load 50 mails at a time (#3420)
This commit is contained in:
@@ -584,13 +584,9 @@ void WorldSession::HandleGetMailList(WorldPacket& recvData)
|
||||
return;
|
||||
|
||||
Player* player = _player;
|
||||
player->_LoadMail();
|
||||
|
||||
//load players mails, and mailed items
|
||||
if (!player->m_mailsLoaded)
|
||||
player->_LoadMail();
|
||||
|
||||
uint32 mailsCount = 0; // real send to client mails amount
|
||||
uint32 realCount = 0; // real mails amount
|
||||
uint32 mailsCount = 0; // real send to client mails amount // real mails amount
|
||||
|
||||
WorldPacket data(SMSG_MAIL_LIST_RESULT, (200)); // guess size
|
||||
data << uint32(0); // real mail's count
|
||||
@@ -602,8 +598,7 @@ void WorldSession::HandleGetMailList(WorldPacket& recvData)
|
||||
// prevent client storage overflow
|
||||
if (mailsCount >= MAX_INBOX_CLIENT_CAPACITY)
|
||||
{
|
||||
realCount += 1;
|
||||
continue;
|
||||
break;
|
||||
}
|
||||
|
||||
// skip deleted or not delivered (deliver delay not expired) mails
|
||||
@@ -616,7 +611,6 @@ void WorldSession::HandleGetMailList(WorldPacket& recvData)
|
||||
|
||||
if (data.wpos() + next_mail_size > MAX_NETCLIENT_PACKET_SIZE)
|
||||
{
|
||||
realCount += 1;
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -692,11 +686,10 @@ void WorldSession::HandleGetMailList(WorldPacket& recvData)
|
||||
data << uint8(0);
|
||||
}
|
||||
|
||||
++realCount;
|
||||
++mailsCount;
|
||||
}
|
||||
|
||||
data.put<uint32>(0, realCount); // this will display warning about undelivered mail to player if realCount > mailsCount
|
||||
data.put<uint32>(0, player->totalMailCount); // this will display warning about undelivered mail to player if realCount > mailsCount
|
||||
data.put<uint8>(4, uint8(mailsCount)); // set real send mails to client
|
||||
SendPacket(&data);
|
||||
|
||||
@@ -778,8 +771,7 @@ void WorldSession::HandleQueryNextMailTime(WorldPacket& /*recvData*/)
|
||||
{
|
||||
WorldPacket data(MSG_QUERY_NEXT_MAIL_TIME, 8);
|
||||
|
||||
if (!_player->m_mailsLoaded)
|
||||
_player->_LoadMail();
|
||||
_player->_LoadMail();
|
||||
|
||||
if (_player->unReadMails > 0)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user