[9390] Remove unneeded mail related queries on character load.

Signed-off-by: hunuza <hunuza@gmail.com>
This commit is contained in:
hunuza 2010-02-15 15:30:37 +01:00
parent ebfb0f9835
commit 462117198e
4 changed files with 16 additions and 44 deletions

View file

@ -15010,6 +15010,7 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder )
// Mail
_LoadMail();
UpdateNextMailTimeAndUnreads();
m_specsCount = fields[59].GetUInt8();
m_activeSpec = fields[60].GetUInt8();
@ -15043,9 +15044,6 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder )
_LoadActions(holder->GetResult(PLAYER_LOGIN_QUERY_LOADACTIONS));
// unread mails and next delivery time, actual mails not loaded
_LoadMailInit(holder->GetResult(PLAYER_LOGIN_QUERY_LOADMAILCOUNT), holder->GetResult(PLAYER_LOGIN_QUERY_LOADMAILDATE));
m_social = sSocialMgr.LoadFromDB(holder->GetResult(PLAYER_LOGIN_QUERY_LOADSOCIALLIST), GetGUIDLow());
// check PLAYER_CHOSEN_TITLE compatibility with PLAYER__FIELD_KNOWN_TITLES
@ -15597,27 +15595,6 @@ void Player::_LoadMailedItems(Mail *mail)
delete result;
}
void Player::_LoadMailInit(QueryResult *resultUnread, QueryResult *resultDelivery)
{
//set a count of unread mails
//QueryResult *resultMails = CharacterDatabase.PQuery("SELECT COUNT(id) FROM mail WHERE receiver = '%u' AND (checked & 1)=0 AND deliver_time <= '" UI64FMTD "'", GUID_LOPART(playerGuid),(uint64)cTime);
if (resultUnread)
{
Field *fieldMail = resultUnread->Fetch();
unReadMails = fieldMail[0].GetUInt8();
delete resultUnread;
}
// store nearest delivery time (it > 0 and if it < current then at next player update SendNewMaill will be called)
//resultMails = CharacterDatabase.PQuery("SELECT MIN(deliver_time) FROM mail WHERE receiver = '%u' AND (checked & 1)=0", GUID_LOPART(playerGuid));
if (resultDelivery)
{
Field *fieldMail = resultDelivery->Fetch();
m_nextMailDelivereTime = (time_t)fieldMail[0].GetUInt64();
delete resultDelivery;
}
}
void Player::_LoadMail()
{
m_mail.clear();