This commit is contained in:
tomrus88 2009-08-28 19:14:16 +04:00
parent 0f5380a385
commit 94fdc7e37e
3 changed files with 208 additions and 282 deletions

View file

@ -1466,6 +1466,12 @@ bool ObjectMgr::GetPlayerNameByGUID(const uint64 &guid, std::string &name) const
uint32 ObjectMgr::GetPlayerTeamByGUID(const uint64 &guid) const
{
// prevent DB access for online player
if(Player* player = GetPlayer(guid))
{
return Player::TeamForRace(player->getRace());
}
QueryResult *result = CharacterDatabase.PQuery("SELECT race FROM characters WHERE guid = '%u'", GUID_LOPART(guid));
if(result)
@ -1480,6 +1486,12 @@ uint32 ObjectMgr::GetPlayerTeamByGUID(const uint64 &guid) const
uint32 ObjectMgr::GetPlayerAccountIdByGUID(const uint64 &guid) const
{
// prevent DB access for online player
if(Player* player = GetPlayer(guid))
{
return player->GetSession()->GetAccountId();
}
QueryResult *result = CharacterDatabase.PQuery("SELECT account FROM characters WHERE guid = '%u'", GUID_LOPART(guid));
if(result)
{