Core: add possibility to disable creating of characters of specified races/classes.

--HG--
branch : trunk
This commit is contained in:
azazel
2010-09-06 23:34:16 +06:00
parent d54225189e
commit 7afc640ef4
4 changed files with 52 additions and 14 deletions

View File

@@ -175,7 +175,7 @@ void WorldSession::HandleCharCreateOpcode(WorldPacket & recv_data)
if (GetSecurity() == SEC_PLAYER)
{
if (uint32 mask = sWorld.getIntConfig(CONFIG_CHARACTERS_CREATING_DISABLED))
if (uint32 mask = sWorld.getIntConfig(CONFIG_CHARACTER_CREATING_DISABLED))
{
bool disabled = false;
@@ -224,6 +224,25 @@ void WorldSession::HandleCharCreateOpcode(WorldPacket & recv_data)
return;
}
if (GetSecurity() == SEC_PLAYER)
{
uint32 raceMaskDisabled = sWorld.getIntConfig(CONFIG_CHARACTER_CREATING_DISABLED_RACEMASK);
if ((1 << (race_ - 1)) & raceMaskDisabled)
{
data << uint8(CHAR_CREATE_DISABLED);
SendPacket(&data);
return;
}
uint32 classMaskDisabled = sWorld.getIntConfig(CONFIG_CHARACTER_CREATING_DISABLED_CLASSMASK);
if ((1 << (class_ - 1)) & classMaskDisabled)
{
data << uint8(CHAR_CREATE_DISABLED);
SendPacket(&data);
return;
}
}
// prevent character creating with invalid name
if (!normalizePlayerName(name))
{
@@ -295,7 +314,7 @@ void WorldSession::HandleCharCreateOpcode(WorldPacket & recv_data)
}
// speedup check for heroic class disabled case
uint32 req_level_for_heroic = sWorld.getIntConfig(CONFIG_MIN_LEVEL_FOR_HEROIC_CHARACTER_CREATING);
uint32 req_level_for_heroic = sWorld.getIntConfig(CONFIG_CHARACTER_CREATING_MIN_LEVEL_FOR_HEROIC_CHARACTER);
if (GetSecurity() == SEC_PLAYER && class_ == CLASS_DEATH_KNIGHT && req_level_for_heroic > sWorld.getIntConfig(CONFIG_MAX_PLAYER_LEVEL))
{
data << (uint8)CHAR_CREATE_LEVEL_REQUIREMENT;

View File

@@ -705,7 +705,9 @@ void World::LoadConfigSettings(bool reload)
m_int_configs[CONFIG_MIN_PET_NAME] = 2;
}
m_int_configs[CONFIG_CHARACTERS_CREATING_DISABLED] = sConfig.GetIntDefault ("CharactersCreatingDisabled", 0);
m_int_configs[CONFIG_CHARACTER_CREATING_DISABLED] = sConfig.GetIntDefault("CharacterCreating.Disabled", 0);
m_int_configs[CONFIG_CHARACTER_CREATING_DISABLED_RACEMASK] = sConfig.GetIntDefault("CharacterCreating.Disabled.RaceMask", 0);
m_int_configs[CONFIG_CHARACTER_CREATING_DISABLED_CLASSMASK] = sConfig.GetIntDefault("CharacterCreating.Disabled.ClassMask", 0);
m_int_configs[CONFIG_CHARACTERS_PER_REALM] = sConfig.GetIntDefault("CharactersPerRealm", 10);
if (m_int_configs[CONFIG_CHARACTERS_PER_REALM] < 1 || m_int_configs[CONFIG_CHARACTERS_PER_REALM] > 10)
@@ -729,7 +731,7 @@ void World::LoadConfigSettings(bool reload)
m_int_configs[CONFIG_HEROIC_CHARACTERS_PER_REALM] = 1;
}
m_int_configs[CONFIG_MIN_LEVEL_FOR_HEROIC_CHARACTER_CREATING] = sConfig.GetIntDefault("MinLevelForHeroicCharacterCreating", 55);
m_int_configs[CONFIG_CHARACTER_CREATING_MIN_LEVEL_FOR_HEROIC_CHARACTER] = sConfig.GetIntDefault("CharacterCreating.MinLevelForHeroicCharacter", 55);
m_int_configs[CONFIG_SKIP_CINEMATICS] = sConfig.GetIntDefault("SkipCinematics", 0);
if (int32(m_int_configs[CONFIG_SKIP_CINEMATICS]) < 0 || m_int_configs[CONFIG_SKIP_CINEMATICS] > 2)

View File

@@ -202,11 +202,13 @@ enum WorldIntConfigs
CONFIG_MIN_PLAYER_NAME,
CONFIG_MIN_CHARTER_NAME,
CONFIG_MIN_PET_NAME,
CONFIG_CHARACTERS_CREATING_DISABLED,
CONFIG_CHARACTER_CREATING_DISABLED,
CONFIG_CHARACTER_CREATING_DISABLED_RACEMASK,
CONFIG_CHARACTER_CREATING_DISABLED_CLASSMASK,
CONFIG_CHARACTERS_PER_ACCOUNT,
CONFIG_CHARACTERS_PER_REALM,
CONFIG_HEROIC_CHARACTERS_PER_REALM,
CONFIG_MIN_LEVEL_FOR_HEROIC_CHARACTER_CREATING,
CONFIG_CHARACTER_CREATING_MIN_LEVEL_FOR_HEROIC_CHARACTER,
CONFIG_SKIP_CINEMATICS,
CONFIG_MAX_PLAYER_LEVEL,
CONFIG_MIN_DUALSPEC_LEVEL,

View File

@@ -695,7 +695,11 @@ ChatLogTimestamp = 0
# Minimal name length (1..12)
# Default: 2
#
# CharactersCreatingDisabled
# MaxWhoListReturns
# Set the max number of players returned in the /who list and interface.
# Default: 49 (stable)
#
# CharacterCreating.Disabled
# Disable characters creating for specific team or any
# (non-player accounts not affected)
# Default: 0 - enabled
@@ -703,9 +707,19 @@ ChatLogTimestamp = 0
# 2 - disabled only for Horde
# 3 - disabled for both teams
#
# MaxWhoListReturns
# Set the max number of players returned in the /who list and interface.
# Default: 49 (stable)
# CharacterCreating.Disabled.RaceMask
# Mask of races which cannot be created (ignored for GM accounts).
# Default: 0 - all races are enabled
# Check http://www.trinitycore.info/index.php/Characters_tc2#race
# for race mask values.
# Example: 1536 = 1024 + 512 - Blood Elf and Draenei races are disabled.
#
# CharacterCreating.Disabled.ClassMask
# Mask of classes which cannot be created (ignored for GM accounts).
# Default: 0 - all classes are enabled
# Check http://www.trinitycore.info/index.php/Characters_tc2#class
# for class mask values.
# Example: 288 = 32 + 256 - Death Knight and Warlock classes are disabled.
#
# CharactersPerAccount
# Limit numbers of characters per account (at all realms).
@@ -724,14 +738,13 @@ ChatLogTimestamp = 0
# Default: 1
# The number must be between 0 (not allowed) and 10
#
# MinLevelForHeroicCharacterCreating
# CharacterCreating.MinLevelForHeroicCharacter
# Limit creating heroic characters only for account with another
# character of specific level (ignored for GM accounts)
# 0 - not require any existed chaarcter
# 1 - require at least any character existed
# Default: 55 - default requirement
#
#
# SkipCinematics
# Disable in-game script movie at first character's login
# (allows to prevent buggy intro in case of custom start
@@ -962,11 +975,13 @@ MaxWhoListReturns = 49
MinPlayerName = 2
MinCharterName = 2
MinPetName = 2
CharactersCreatingDisabled = 0
CharacterCreating.Disabled = 0
CharacterCreating.Disabled.RaceMask = 0
CharacterCreating.Disabled.ClassMask = 0
CharactersPerAccount = 50
CharactersPerRealm = 10
HeroicCharactersPerRealm = 1
MinLevelForHeroicCharacterCreating = 55
CharacterCreating.MinLevelForHeroicCharacter = 55
SkipCinematics = 0
MaxPlayerLevel = 80
MinDualSpecLevel = 40