mirror of
https://github.com/mangosfour/server.git
synced 2025-12-16 13:37:00 +00:00
[6924] Faster guild-loading.
Signed-off-by: VladimirMangos <vladimir@getmangos.com>
This commit is contained in:
parent
6d62e595b6
commit
d4a69e4789
2 changed files with 24 additions and 11 deletions
|
|
@ -359,28 +359,41 @@ bool Guild::FillPlayerData(uint64 guid, MemberSlot* memslot)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(!objmgr.GetPlayerNameByGUID(guid, plName)) // player doesn't exist
|
QueryResult *result = CharacterDatabase.PQuery("SELECT name,data,zone,class FROM characters WHERE guid = '%u'", GUID_LOPART(guid));
|
||||||
return false;
|
if(!result)
|
||||||
|
return false; // player doesn't exist
|
||||||
|
|
||||||
|
Field *fields = result->Fetch();
|
||||||
|
|
||||||
|
plName = fields[0].GetCppString();
|
||||||
|
|
||||||
|
Tokens data = StrSplit(fields[1].GetCppString(), " ");
|
||||||
|
plLevel = Player::GetUInt32ValueFromArray(data,UNIT_FIELD_LEVEL);
|
||||||
|
|
||||||
|
plZone = fields[2].GetUInt32();
|
||||||
|
plClass = fields[3].GetUInt32();
|
||||||
|
delete result;
|
||||||
|
|
||||||
plLevel = Player::GetUInt32ValueFromDB(UNIT_FIELD_LEVEL, guid);
|
|
||||||
if(plLevel<1||plLevel>STRONG_MAX_LEVEL) // can be at broken `data` field
|
if(plLevel<1||plLevel>STRONG_MAX_LEVEL) // can be at broken `data` field
|
||||||
{
|
{
|
||||||
sLog.outError("Player (GUID: %u) has a broken data in field `characters`.`data`.",GUID_LOPART(guid));
|
sLog.outError("Player (GUID: %u) has a broken data in field `characters`.`data`.",GUID_LOPART(guid));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
plZone = Player::GetZoneIdFromDB(guid);
|
|
||||||
|
|
||||||
QueryResult *result = CharacterDatabase.PQuery("SELECT class FROM characters WHERE guid='%u'", GUID_LOPART(guid));
|
if(!plZone)
|
||||||
if(!result)
|
{
|
||||||
return false;
|
sLog.outError("Player (GUID: %u) has broken zone-data",GUID_LOPART(guid));
|
||||||
plClass = (*result)[0].GetUInt32();
|
//here it will also try the same, to get the zone from characters-table, but additional it tries to find
|
||||||
|
plZone = Player::GetZoneIdFromDB(guid);
|
||||||
|
//the zone through xy coords.. this is a bit redundant, but
|
||||||
|
//shouldn't be called often
|
||||||
|
}
|
||||||
|
|
||||||
if(plClass<CLASS_WARRIOR||plClass>=MAX_CLASSES) // can be at broken `class` field
|
if(plClass<CLASS_WARRIOR||plClass>=MAX_CLASSES) // can be at broken `class` field
|
||||||
{
|
{
|
||||||
sLog.outError("Player (GUID: %u) has a broken data in field `characters`.`class`.",GUID_LOPART(guid));
|
sLog.outError("Player (GUID: %u) has a broken data in field `characters`.`class`.",GUID_LOPART(guid));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
delete result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
memslot->name = plName;
|
memslot->name = plName;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "6923"
|
#define REVISION_NR "6924"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue