Core/Players: Greatly simplifiy fdb2b90685ebc3852740c424170101a196c29ebb
This commit is contained in:
1 parent
1c83dcac98
commit
3c066b1ed3
4 files changed
+8
-26
No files matched your search
@@ -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