[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

@ -82,8 +82,6 @@ bool LoginQueryHolder::Initialize()
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADREPUTATION, "SELECT faction,standing,flags FROM character_reputation WHERE guid = '%u'", GUID_LOPART(m_guid));
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADINVENTORY, "SELECT data,bag,slot,item,item_template FROM character_inventory JOIN item_instance ON character_inventory.item = item_instance.guid WHERE character_inventory.guid = '%u' ORDER BY bag,slot", GUID_LOPART(m_guid));
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADACTIONS, "SELECT spec,button,action,type FROM character_action WHERE guid = '%u' ORDER BY button", GUID_LOPART(m_guid));
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADMAILCOUNT, "SELECT COUNT(id) FROM mail WHERE receiver = '%u' AND (checked & 1)=0 AND deliver_time <= '" UI64FMTD "'", GUID_LOPART(m_guid), (uint64)time(NULL));
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADMAILDATE, "SELECT MIN(deliver_time) FROM mail WHERE receiver = '%u' AND (checked & 1)=0", GUID_LOPART(m_guid));
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADSOCIALLIST, "SELECT friend,flags,note FROM character_social WHERE guid = '%u' LIMIT 255", GUID_LOPART(m_guid));
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADHOMEBIND, "SELECT map,zone,position_x,position_y,position_z FROM character_homebind WHERE guid = '%u'", GUID_LOPART(m_guid));
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADSPELLCOOLDOWNS, "SELECT spell,item,time FROM character_spell_cooldown WHERE guid = '%u'", GUID_LOPART(m_guid));

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();

View file

@ -875,22 +875,20 @@ enum PlayerLoginQueryIndex
PLAYER_LOGIN_QUERY_LOADREPUTATION = 7,
PLAYER_LOGIN_QUERY_LOADINVENTORY = 8,
PLAYER_LOGIN_QUERY_LOADACTIONS = 9,
PLAYER_LOGIN_QUERY_LOADMAILCOUNT = 10,
PLAYER_LOGIN_QUERY_LOADMAILDATE = 11,
PLAYER_LOGIN_QUERY_LOADSOCIALLIST = 12,
PLAYER_LOGIN_QUERY_LOADHOMEBIND = 13,
PLAYER_LOGIN_QUERY_LOADSPELLCOOLDOWNS = 14,
PLAYER_LOGIN_QUERY_LOADDECLINEDNAMES = 15,
PLAYER_LOGIN_QUERY_LOADGUILD = 16,
PLAYER_LOGIN_QUERY_LOADARENAINFO = 17,
PLAYER_LOGIN_QUERY_LOADACHIEVEMENTS = 18,
PLAYER_LOGIN_QUERY_LOADCRITERIAPROGRESS = 19,
PLAYER_LOGIN_QUERY_LOADEQUIPMENTSETS = 20,
PLAYER_LOGIN_QUERY_LOADBGDATA = 21,
PLAYER_LOGIN_QUERY_LOADACCOUNTDATA = 22,
PLAYER_LOGIN_QUERY_LOADSKILLS = 23,
PLAYER_LOGIN_QUERY_LOADGLYPHS = 24,
MAX_PLAYER_LOGIN_QUERY = 25
PLAYER_LOGIN_QUERY_LOADSOCIALLIST = 10,
PLAYER_LOGIN_QUERY_LOADHOMEBIND = 11,
PLAYER_LOGIN_QUERY_LOADSPELLCOOLDOWNS = 12,
PLAYER_LOGIN_QUERY_LOADDECLINEDNAMES = 13,
PLAYER_LOGIN_QUERY_LOADGUILD = 14,
PLAYER_LOGIN_QUERY_LOADARENAINFO = 15,
PLAYER_LOGIN_QUERY_LOADACHIEVEMENTS = 16,
PLAYER_LOGIN_QUERY_LOADCRITERIAPROGRESS = 17,
PLAYER_LOGIN_QUERY_LOADEQUIPMENTSETS = 18,
PLAYER_LOGIN_QUERY_LOADBGDATA = 19,
PLAYER_LOGIN_QUERY_LOADACCOUNTDATA = 20,
PLAYER_LOGIN_QUERY_LOADSKILLS = 21,
PLAYER_LOGIN_QUERY_LOADGLYPHS = 22,
MAX_PLAYER_LOGIN_QUERY = 23
};
enum PlayerDelayedOperations
@ -2321,7 +2319,6 @@ class MANGOS_DLL_SPEC Player : public Unit
void _LoadAuras(QueryResult *result, uint32 timediff);
void _LoadBoundInstances(QueryResult *result);
void _LoadInventory(QueryResult *result, uint32 timediff);
void _LoadMailInit(QueryResult *resultUnread, QueryResult *resultDelivery);
void _LoadMail();
void _LoadMailedItems(Mail *mail);
void _LoadQuestStatus(QueryResult *result);

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "9389"
#define REVISION_NR "9390"
#endif // __REVISION_NR_H__