mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-29 13:22:48 +01:00
Core/Players: Greatly simplifiy fdb2b90685
This commit is contained in:
@@ -427,14 +427,6 @@ void WorldSession::HandleCharCreateOpcode(WorldPacket& recvData)
|
||||
}
|
||||
}
|
||||
|
||||
// Reserve the name for the duration of callback chain
|
||||
createInfo->NameToken = sCharacterCache->TryCreateCharacterWithName(createInfo->Name);
|
||||
if (!createInfo->NameToken)
|
||||
{
|
||||
SendCharCreate(CHAR_CREATE_NAME_IN_USE);
|
||||
return;
|
||||
}
|
||||
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHECK_NAME);
|
||||
stmt->setString(0, createInfo->Name);
|
||||
|
||||
@@ -586,6 +578,13 @@ void WorldSession::HandleCharCreateOpcode(WorldPacket& recvData)
|
||||
return;
|
||||
}
|
||||
|
||||
// Check name uniqueness in the same step as saving to database
|
||||
if (sCharacterCache->GetCharacterCacheByName(createInfo->Name))
|
||||
{
|
||||
SendCharCreate(CHAR_CREATE_NAME_IN_USE);
|
||||
return;
|
||||
}
|
||||
|
||||
Player newChar(this);
|
||||
newChar.GetMotionMaster()->Initialize();
|
||||
if (!newChar.Create(sObjectMgr->GetGenerator<HighGuid::Player>().Generate(), createInfo.get()))
|
||||
|
||||
Reference in New Issue
Block a user