mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-03-16 05:55:07 +00:00
fix(Core/Mail): do not show expired mails in packets (#10560)
Fixed #5920
This commit is contained in:
@@ -6180,10 +6180,6 @@ Item* Player::_LoadMailedItem(ObjectGuid const& playerGuid, Player* player, uint
|
||||
|
||||
void Player::_LoadMail(PreparedQueryResult mailsResult, PreparedQueryResult mailItemsResult)
|
||||
{
|
||||
std::set<uint32> pendingAuctions;
|
||||
std::unordered_map<uint32, Mail*> pendingAuctionMails;
|
||||
CharacterDatabaseTransaction pendingAuctionsTrans = CharacterDatabase.BeginTransaction();
|
||||
|
||||
m_mail.clear();
|
||||
|
||||
std::unordered_map<uint32, Mail*> mailById;
|
||||
@@ -6208,7 +6204,6 @@ void Player::_LoadMail(PreparedQueryResult mailsResult, PreparedQueryResult mail
|
||||
m->checked = fields[10].Get<uint8>();
|
||||
m->stationery = fields[11].Get<uint8>();
|
||||
m->mailTemplateId = fields[12].Get<int16>();
|
||||
m->auctionId = fields[13].Get<int32>();
|
||||
|
||||
if (m->mailTemplateId && !sMailTemplateStore.LookupEntry(m->mailTemplateId))
|
||||
{
|
||||
@@ -6218,52 +6213,6 @@ void Player::_LoadMail(PreparedQueryResult mailsResult, PreparedQueryResult mail
|
||||
|
||||
m->state = MAIL_STATE_UNCHANGED;
|
||||
|
||||
// Do not load expired pending sale mail if there is already delivery auction mail
|
||||
if (m->auctionId < 0 && m->expire_time <= GameTime::GetGameTime().count())
|
||||
{
|
||||
uint32 auctionId = std::abs(m->auctionId);
|
||||
if (pendingAuctions.count(auctionId))
|
||||
{
|
||||
CharacterDatabasePreparedStatement* stmt2 = CharacterDatabase.GetPreparedStatement(CHAR_DEL_MAIL_BY_ID);
|
||||
stmt2->SetData(0, m->messageID);
|
||||
pendingAuctionsTrans->Append(stmt2);
|
||||
|
||||
if (unReadMails > 0 && (m->checked & MAIL_CHECK_MASK_READ) == 0)
|
||||
--unReadMails;
|
||||
|
||||
delete m;
|
||||
continue;
|
||||
}
|
||||
|
||||
pendingAuctionMails[auctionId] = m;
|
||||
}
|
||||
else if (m->auctionId > 0)
|
||||
{
|
||||
pendingAuctions.insert(m->auctionId);
|
||||
}
|
||||
|
||||
for (auto itr : pendingAuctionMails)
|
||||
{
|
||||
uint32 auctionId = itr.first;
|
||||
if (pendingAuctions.count(auctionId))
|
||||
{
|
||||
Mail* mail = itr.second;
|
||||
|
||||
CharacterDatabasePreparedStatement* stmt2 = CharacterDatabase.GetPreparedStatement(CHAR_DEL_MAIL_BY_ID);
|
||||
stmt2->SetData(0, mail->messageID);
|
||||
pendingAuctionsTrans->Append(stmt2);
|
||||
|
||||
if (unReadMails > 0 && (mail->checked & MAIL_CHECK_MASK_READ) == 0)
|
||||
{
|
||||
--unReadMails;
|
||||
}
|
||||
|
||||
m_mail.erase(std::remove(m_mail.begin(), m_mail.end(), mail));
|
||||
|
||||
delete mail;
|
||||
}
|
||||
}
|
||||
|
||||
m_mail.push_back(m);
|
||||
mailById[m->messageID] = m;
|
||||
} while (mailsResult->NextRow());
|
||||
@@ -6279,7 +6228,6 @@ void Player::_LoadMail(PreparedQueryResult mailsResult, PreparedQueryResult mail
|
||||
} while (mailItemsResult->NextRow());
|
||||
}
|
||||
|
||||
CharacterDatabase.CommitTransaction(pendingAuctionsTrans);
|
||||
UpdateNextMailTimeAndUnreads();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user