mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-24 14:16:31 +00:00
feat(Core): add argument to .character rename to add name to reserved_name (#6163)
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -1255,6 +1255,7 @@ public:
|
||||
// reserved names
|
||||
void LoadReservedPlayersNames();
|
||||
[[nodiscard]] bool IsReservedName(std::string const& name) const;
|
||||
void AddReservedPlayerName(std::string const& name);
|
||||
|
||||
// name with valid structure and symbols
|
||||
static uint8 CheckPlayerName(std::string const& name, bool create = false);
|
||||
|
||||
Reference in New Issue
Block a user