feat(Core): add argument to .character rename to add name to reserved_name (#6163)

This commit is contained in:
Axel Cocat
2021-06-18 17:09:29 +02:00
committed by GitHub
parent 5a564ea498
commit 848bb0891b
6 changed files with 45 additions and 1 deletions

View File

@@ -7553,6 +7553,26 @@ bool ObjectMgr::IsReservedName(const std::string& name) const
return _reservedNamesStore.find(wstr) != _reservedNamesStore.end();
}
void ObjectMgr::AddReservedPlayerName(std::string const& name)
{
if (!IsReservedName(name))
{
std::wstring wstr;
if (!Utf8toWStr(name, wstr))
{
LOG_ERROR("server", "Could not add invalid name to reserved player names: %s", name.c_str());
return;
}
wstrToLower(wstr);
_reservedNamesStore.insert(wstr);
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_RESERVED_PLAYER_NAME);
stmt->setString(0, name);
CharacterDatabase.Execute(stmt);
}
}
enum LanguageType
{
LT_BASIC_LATIN = 0x0000,