Core/Players: Prevent creating characters with duplicate names
Port From (https://github.com/TrinityCore/TrinityCore/commit/52de393f10dae4b21b84bd02aadf929b2283d8fe)
This commit is contained in:
@@ -509,6 +509,13 @@ namespace Game
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check name uniqueness in the same step as saving to database
|
||||||
|
if (Global.CharacterCacheStorage.GetCharacterCacheByName(createInfo.Name) != null)
|
||||||
|
{
|
||||||
|
SendCharCreate(ResponseCodes.CharCreateNameInUse);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Player newChar = new(this);
|
Player newChar = new(this);
|
||||||
newChar.GetMotionMaster().Initialize();
|
newChar.GetMotionMaster().Initialize();
|
||||||
if (!newChar.Create(Global.ObjectMgr.GetGenerator(HighGuid.Player).Generate(), createInfo))
|
if (!newChar.Create(Global.ObjectMgr.GetGenerator(HighGuid.Player).Generate(), createInfo))
|
||||||
|
|||||||
Reference in New Issue
Block a user