mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-22 18:15:31 +01:00
Merge branch 'master' of github.com:TrinityCore/TrinityCore into 4.3.4
Conflicts: src/server/game/Handlers/CharacterHandler.cpp src/server/game/World/World.h
This commit is contained in:
@@ -229,7 +229,7 @@ void WorldSession::HandleCharEnum(PreparedQueryResult result)
|
||||
bitBuffer.WriteBit(1);
|
||||
if (result)
|
||||
{
|
||||
_allowedCharsToLogin.clear();
|
||||
_legitCharacters.clear();
|
||||
|
||||
charCount = uint32(result->GetRowCount());
|
||||
bitBuffer.reserve(24 * charCount / 8);
|
||||
@@ -245,7 +245,9 @@ void WorldSession::HandleCharEnum(PreparedQueryResult result)
|
||||
|
||||
Player::BuildEnumData(result, &dataBuffer, &bitBuffer);
|
||||
|
||||
_allowedCharsToLogin.insert(guidLow);
|
||||
_legitCharacters.insert(guidLow);
|
||||
if (!sWorld->HasCharacterNameData(guidLow)) // This can happen if characters are inserted into the database manually. Core hasn't loaded name data yet.
|
||||
sWorld->AddCharacterNameData(guidLow, (*result)[1].GetString(), (*result)[4].GetUInt8(), (*result)[2].GetUInt8(), (*result)[3].GetUInt8(), (*result)[7].GetUInt8());
|
||||
} while (result->NextRow());
|
||||
|
||||
bitBuffer.FlushBits();
|
||||
@@ -800,7 +802,7 @@ void WorldSession::HandlePlayerLoginOpcode(WorldPacket& recvData)
|
||||
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "Character (Guid: %u) logging in", GUID_LOPART(playerGuid));
|
||||
|
||||
if (!CharCanLogin(GUID_LOPART(playerGuid)))
|
||||
if (!IsLegitCharacterForAccount(GUID_LOPART(playerGuid)))
|
||||
{
|
||||
sLog->outError(LOG_FILTER_NETWORKIO, "Account (%u) can't login with that character (%u).", GetAccountId(), GUID_LOPART(playerGuid));
|
||||
KickPlayer();
|
||||
@@ -1473,6 +1475,15 @@ void WorldSession::HandleCharCustomize(WorldPacket& recvData)
|
||||
std::string newName;
|
||||
|
||||
recvData >> guid;
|
||||
if (!IsLegitCharacterForAccount(GUID_LOPART(guid)))
|
||||
{
|
||||
sLog->outError(LOG_FILTER_NETWORKIO, "Account %u, IP: %s tried to customise character %u, but it does not belong to their account!",
|
||||
GetAccountId(), GetRemoteAddress().c_str(), GUID_LOPART(guid));
|
||||
recvData.rfinish();
|
||||
KickPlayer();
|
||||
return;
|
||||
}
|
||||
|
||||
recvData >> newName;
|
||||
|
||||
uint8 gender, skin, face, hairStyle, hairColor, facialHair;
|
||||
@@ -1704,6 +1715,16 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recvData)
|
||||
std::string newname;
|
||||
uint8 gender, skin, face, hairStyle, hairColor, facialHair, race;
|
||||
recvData >> guid;
|
||||
|
||||
if (!IsLegitCharacterForAccount(GUID_LOPART(guid)))
|
||||
{
|
||||
sLog->outError(LOG_FILTER_NETWORKIO, "Account %u, IP: %s tried to factionchange character %u, but it does not belong to their account!",
|
||||
GetAccountId(), GetRemoteAddress().c_str(), GUID_LOPART(guid));
|
||||
recvData.rfinish();
|
||||
KickPlayer();
|
||||
return;
|
||||
}
|
||||
|
||||
recvData >> newname;
|
||||
recvData >> gender >> skin >> hairColor >> hairStyle >> facialHair >> face >> race;
|
||||
|
||||
@@ -1711,6 +1732,14 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recvData)
|
||||
|
||||
// get the players old (at this moment current) race
|
||||
CharacterNameData const* nameData = sWorld->GetCharacterNameData(lowGuid);
|
||||
if (!nameData)
|
||||
{
|
||||
WorldPacket data(SMSG_CHAR_FACTION_CHANGE, 1);
|
||||
data << uint8(CHAR_CREATE_ERROR);
|
||||
SendPacket(&data);
|
||||
return;
|
||||
}
|
||||
|
||||
uint8 oldRace = nameData->m_race;
|
||||
uint8 playerClass = nameData->m_class;
|
||||
uint8 level = nameData->m_level;
|
||||
|
||||
Reference in New Issue
Block a user