Core/Player: Check Player race and class on login

Don't allow login for Players with bad race/class combination to avoid any further crash later.
This commit is contained in:
jackpoz committed 2014-04-23 21:37:27 +02:00
1 parent 6b42f99540
commit 9d1afbba57
1 file changed
+8
@@ -17183,6 +17183,14 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
bytes0 |= gender << 16; // gender
SetUInt32Value(UNIT_FIELD_BYTES_0, bytes0);
// check if race/class combination is valid
PlayerInfo const* info = sObjectMgr->GetPlayerInfo(getRace(), getClass());
if (!info)
{
TC_LOG_ERROR("entities.player", "Player (GUID: %u) has wrong race/class (%u/%u), can't be loaded.", guid, getRace(), getClass());
return false;
}
SetUInt32Value(UNIT_FIELD_LEVEL, fields[6].GetUInt8());
SetUInt32Value(PLAYER_XP, fields[7].GetUInt32());