diff options
author | megamage <none@none> | 2008-12-22 10:59:38 -0600 |
---|---|---|
committer | megamage <none@none> | 2008-12-22 10:59:38 -0600 |
commit | 65ef38963ddc60e05491ca9d3e2685913c0038bb (patch) | |
tree | 740f287e537982028ac4b0974d4a88aeae9075d8 /src/game/Guild.cpp | |
parent | f7dd2df7955f5c5d17ee2ad27fb6c9a0f89d7196 (diff) |
*The last merge from Mangos TBC. Update to Mangos v0.12.
--HG--
branch : trunk
Diffstat (limited to 'src/game/Guild.cpp')
-rw-r--r-- | src/game/Guild.cpp | 33 |
1 files changed, 23 insertions, 10 deletions
diff --git a/src/game/Guild.cpp b/src/game/Guild.cpp index df2554db9ea..897110afe55 100644 --- a/src/game/Guild.cpp +++ b/src/game/Guild.cpp @@ -376,28 +376,41 @@ bool Guild::FillPlayerData(uint64 guid, MemberSlot* memslot) } else { - if(!objmgr.GetPlayerNameByGUID(guid, plName)) // player doesn't exist - return false; + QueryResult *result = CharacterDatabase.PQuery("SELECT name,data,zone,class FROM characters WHERE guid = '%u'", GUID_LOPART(guid)); + 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 { sLog.outError("Player (GUID: %u) has a broken data in field `characters`.`data`.",GUID_LOPART(guid)); return false; } - plZone = Player::GetZoneIdFromDB(guid); - QueryResult *result = CharacterDatabase.PQuery("SELECT class FROM characters WHERE guid='%u'", GUID_LOPART(guid)); - if(!result) - return false; - plClass = (*result)[0].GetUInt32(); + if(!plZone) + { + sLog.outError("Player (GUID: %u) has broken zone-data",GUID_LOPART(guid)); + //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 { sLog.outError("Player (GUID: %u) has a broken data in field `characters`.`class`.",GUID_LOPART(guid)); return false; } - - delete result; } } |