mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-20 09:17:36 +01:00
Core/Player: Add option to prevent rename during character customization
Closes #17420
This commit is contained in:
@@ -56,7 +56,7 @@ void CharacterDatabaseConnection::DoPrepareStatements()
|
||||
PrepareStatement(CHAR_SEL_CHAR_RACE, "SELECT race FROM characters WHERE guid = ?", CONNECTION_SYNCH);
|
||||
PrepareStatement(CHAR_SEL_CHAR_LEVEL, "SELECT level FROM characters WHERE guid = ?", CONNECTION_SYNCH);
|
||||
PrepareStatement(CHAR_SEL_CHAR_ZONE, "SELECT zone FROM characters WHERE guid = ?", CONNECTION_SYNCH);
|
||||
PrepareStatement(CHAR_SEL_CHARACTER_NAME_DATA, "SELECT race, class, gender, level FROM characters WHERE guid = ?", CONNECTION_SYNCH);
|
||||
PrepareStatement(CHAR_SEL_CHARACTER_NAME_DATA, "SELECT race, class, gender, level, name FROM characters WHERE guid = ?", CONNECTION_SYNCH);
|
||||
PrepareStatement(CHAR_SEL_CHAR_POSITION_XYZ, "SELECT map, position_x, position_y, position_z FROM characters WHERE guid = ?", CONNECTION_SYNCH);
|
||||
PrepareStatement(CHAR_SEL_CHAR_POSITION, "SELECT position_x, position_y, position_z, orientation, map, taxi_path FROM characters WHERE guid = ?", CONNECTION_SYNCH);
|
||||
|
||||
|
||||
@@ -1370,6 +1370,7 @@ void WorldSession::HandleCharCustomize(WorldPacket& recvData)
|
||||
uint8 plrRace = fields[0].GetUInt8();
|
||||
uint8 plrClass = fields[1].GetUInt8();
|
||||
uint8 plrGender = fields[2].GetUInt8();
|
||||
std::string plrName = fields[4].GetString();
|
||||
|
||||
if (!Player::ValidateAppearance(plrRace, plrClass, plrGender, customizeInfo.HairStyle, customizeInfo.HairColor, customizeInfo.Face, customizeInfo.FacialHair, customizeInfo.Skin, true))
|
||||
{
|
||||
@@ -1398,6 +1399,13 @@ void WorldSession::HandleCharCustomize(WorldPacket& recvData)
|
||||
return;
|
||||
}
|
||||
|
||||
// prevent character rename
|
||||
if (sWorld->getBoolConfig(CONFIG_PREVENT_RENAME_CUSTOMIZATION) && (customizeInfo.Name != plrName))
|
||||
{
|
||||
SendCharCustomize(CHAR_NAME_FAILURE, customizeInfo);
|
||||
return;
|
||||
}
|
||||
|
||||
// prevent character rename to invalid name
|
||||
if (!normalizePlayerName(customizeInfo.Name))
|
||||
{
|
||||
@@ -1614,6 +1622,7 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recvData)
|
||||
return;
|
||||
}
|
||||
|
||||
std::string oldName = nameData->Name;
|
||||
uint8 oldRace = nameData->Race;
|
||||
uint8 playerClass = nameData->Class;
|
||||
uint8 level = nameData->Level;
|
||||
@@ -1656,6 +1665,13 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recvData)
|
||||
}
|
||||
}
|
||||
|
||||
// prevent character rename
|
||||
if (sWorld->getBoolConfig(CONFIG_PREVENT_RENAME_CUSTOMIZATION) && (factionChangeInfo.Name != oldName))
|
||||
{
|
||||
SendCharFactionChange(CHAR_NAME_FAILURE, factionChangeInfo);
|
||||
return;
|
||||
}
|
||||
|
||||
// prevent character rename to invalid name
|
||||
if (!normalizePlayerName(factionChangeInfo.Name))
|
||||
{
|
||||
|
||||
@@ -1331,6 +1331,9 @@ void World::LoadConfigSettings(bool reload)
|
||||
m_bool_configs[CONFIG_HOTSWAP_INSTALL_ENABLED] = sConfigMgr->GetBoolDefault("HotSwap.EnableInstall", true);
|
||||
m_bool_configs[CONFIG_HOTSWAP_PREFIX_CORRECTION_ENABLED] = sConfigMgr->GetBoolDefault("HotSwap.EnablePrefixCorrection", true);
|
||||
|
||||
// prevent character rename on character customization
|
||||
m_bool_configs[CONFIG_PREVENT_RENAME_CUSTOMIZATION] = sConfigMgr->GetBoolDefault("PreventRenameCharacterOnCustomization", false);
|
||||
|
||||
// call ScriptMgr if we're reloading the configuration
|
||||
if (reload)
|
||||
sScriptMgr->OnConfigLoad(reload);
|
||||
|
||||
@@ -175,6 +175,7 @@ enum WorldBoolConfigs
|
||||
CONFIG_HOTSWAP_BUILD_FILE_RECREATION_ENABLED,
|
||||
CONFIG_HOTSWAP_INSTALL_ENABLED,
|
||||
CONFIG_HOTSWAP_PREFIX_CORRECTION_ENABLED,
|
||||
CONFIG_PREVENT_RENAME_CUSTOMIZATION,
|
||||
BOOL_CONFIG_VALUE_COUNT
|
||||
};
|
||||
|
||||
|
||||
@@ -3028,6 +3028,16 @@ Calculate.Gameoject.Zone.Area.Data = 0
|
||||
NoGrayAggro.Above = 0
|
||||
NoGrayAggro.Below = 0
|
||||
|
||||
#
|
||||
# PreventRenameCharacterOnCustomization
|
||||
# Description: If option is set to 1, player can not rename the character in character customization.
|
||||
# Applies to all character customization commands.
|
||||
# Default: 0 - (Disabled, character can be renamed in Character Customization)
|
||||
# 1 - (Enabled, character can not be renamed in Character Customization)
|
||||
#
|
||||
|
||||
PreventRenameCharacterOnCustomization = 0
|
||||
|
||||
#
|
||||
###################################################################################################
|
||||
|
||||
|
||||
Reference in New Issue
Block a user