Core/Players: Prevent creating characters with duplicate names

Port From (https://github.com/TrinityCore/TrinityCore/commit/52de393f10dae4b21b84bd02aadf929b2283d8fe)
This commit is contained in:
hondacrx
2021-09-26 11:38:16 -04:00
parent 7befdbd11b
commit 1bcd5a876e
+7
View File
@@ -509,6 +509,13 @@ namespace Game
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);
newChar.GetMotionMaster().Initialize();
if (!newChar.Create(Global.ObjectMgr.GetGenerator(HighGuid.Player).Generate(), createInfo))