mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-22 13:16:23 +00:00
fix(Core/Mails): Do not load expired mails from database. (#10917)
This commit is contained in:
@@ -6180,6 +6180,8 @@ Item* Player::_LoadMailedItem(ObjectGuid const& playerGuid, Player* player, uint
|
||||
|
||||
void Player::_LoadMail(PreparedQueryResult mailsResult, PreparedQueryResult mailItemsResult)
|
||||
{
|
||||
time_t cur_time = GameTime::GetGameTime().count();
|
||||
|
||||
m_mail.clear();
|
||||
|
||||
std::unordered_map<uint32, Mail*> mailById;
|
||||
@@ -6205,6 +6207,12 @@ void Player::_LoadMail(PreparedQueryResult mailsResult, PreparedQueryResult mail
|
||||
m->stationery = fields[11].Get<uint8>();
|
||||
m->mailTemplateId = fields[12].Get<int16>();
|
||||
|
||||
if (cur_time > m->expire_time)
|
||||
{
|
||||
LOG_DEBUG("entities.player", "Player::_LoadMail: Mail ({}) has expired - ignored.", m->messageID);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (m->mailTemplateId && !sMailTemplateStore.LookupEntry(m->mailTemplateId))
|
||||
{
|
||||
LOG_ERROR("entities.player", "Player::_LoadMail: Mail ({}) has nonexistent MailTemplateId ({}), remove at load", m->messageID, m->mailTemplateId);
|
||||
|
||||
Reference in New Issue
Block a user