Implement new mangos.conf setting HeroicCharactersPerRealm for set cstiom (default 1) amount heroic class chanarcters for account per realm.

Note: set option to 0 disable heroic characters creating.
Also non-player account not have now any limits (except 10 clinet limit) for heroic characters creating.
This commit is contained in:
VladimirMangos 2008-12-21 04:40:40 +03:00
parent 4090872bfa
commit c1ae939fb1
5 changed files with 48 additions and 8 deletions

View file

@ -308,6 +308,15 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data )
} }
} }
// speedup check for heroic class disabled case
uint32 heroic_free_slots = sWorld.getConfig(CONFIG_HEROIC_CHARACTERS_PER_REALM);
if(heroic_free_slots==0 && GetSecurity()==SEC_PLAYER && class_ == CLASS_DEATH_KNIGHT)
{
data << (uint8)CHAR_CREATE_UNIQUE_CLASS_LIMIT;
SendPacket( &data );
return;
}
bool AllowTwoSideAccounts = !sWorld.IsPvPRealm() || sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_ACCOUNTS) || GetSecurity() > SEC_PLAYER; bool AllowTwoSideAccounts = !sWorld.IsPvPRealm() || sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_ACCOUNTS) || GetSecurity() > SEC_PLAYER;
uint32 skipCinematics = sWorld.getConfig(CONFIG_SKIP_CINEMATICS); uint32 skipCinematics = sWorld.getConfig(CONFIG_SKIP_CINEMATICS);
@ -323,14 +332,20 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data )
Field* field = result2->Fetch(); Field* field = result2->Fetch();
uint8 acc_race = field[0].GetUInt32(); uint8 acc_race = field[0].GetUInt32();
if(class_ == CLASS_DEATH_KNIGHT) if(GetSecurity()==SEC_PLAYER && class_ == CLASS_DEATH_KNIGHT)
{ {
uint8 acc_class = field[1].GetUInt32(); uint8 acc_class = field[1].GetUInt32();
if(acc_class == CLASS_DEATH_KNIGHT) if(acc_class == CLASS_DEATH_KNIGHT)
{ {
data << (uint8)CHAR_CREATE_UNIQUE_CLASS_LIMIT; if(heroic_free_slots > 0)
SendPacket( &data ); --heroic_free_slots;
return;
if(heroic_free_slots==0)
{
data << (uint8)CHAR_CREATE_UNIQUE_CLASS_LIMIT;
SendPacket( &data );
return;
}
} }
} }
@ -364,14 +379,20 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data )
if(!have_same_race) if(!have_same_race)
have_same_race = race_ == acc_race; have_same_race = race_ == acc_race;
if(class_ == CLASS_DEATH_KNIGHT) if(GetSecurity()==SEC_PLAYER && class_ == CLASS_DEATH_KNIGHT)
{ {
uint8 acc_class = field[1].GetUInt32(); uint8 acc_class = field[1].GetUInt32();
if(acc_class == CLASS_DEATH_KNIGHT) if(acc_class == CLASS_DEATH_KNIGHT)
{ {
data << (uint8)CHAR_CREATE_UNIQUE_CLASS_LIMIT; if(heroic_free_slots > 0)
SendPacket( &data ); --heroic_free_slots;
return;
if(heroic_free_slots==0)
{
data << (uint8)CHAR_CREATE_UNIQUE_CLASS_LIMIT;
SendPacket( &data );
return;
}
} }
} }
} }

View file

@ -690,6 +690,11 @@ bool Player::Create( uint32 guidlow, const std::string& name, uint8 race, uint8
uint32 item_id = oEntry->ItemId[j]; uint32 item_id = oEntry->ItemId[j];
// Hack for not existed item id in dbc 3.0.3
if(item_id==40582)
continue;
ItemPrototype const* iProto = objmgr.GetItemPrototype(item_id); ItemPrototype const* iProto = objmgr.GetItemPrototype(item_id);
if(!iProto) if(!iProto)
{ {

View file

@ -633,6 +633,13 @@ void World::LoadConfigSettings(bool reload)
m_configs[CONFIG_CHARACTERS_PER_REALM] = 10; m_configs[CONFIG_CHARACTERS_PER_REALM] = 10;
} }
m_configs[CONFIG_HEROIC_CHARACTERS_PER_REALM] = sConfig.GetIntDefault("HeroicCharactersPerRealm", 1);
if(m_configs[CONFIG_HEROIC_CHARACTERS_PER_REALM] < 0 || m_configs[CONFIG_HEROIC_CHARACTERS_PER_REALM] > 10)
{
sLog.outError("HeroicCharactersPerRealm (%i) must be in range 0..10. Set to 1.",m_configs[CONFIG_HEROIC_CHARACTERS_PER_REALM]);
m_configs[CONFIG_HEROIC_CHARACTERS_PER_REALM] = 1;
}
// must be after CONFIG_CHARACTERS_PER_REALM // must be after CONFIG_CHARACTERS_PER_REALM
m_configs[CONFIG_CHARACTERS_PER_ACCOUNT] = sConfig.GetIntDefault("CharactersPerAccount", 50); m_configs[CONFIG_CHARACTERS_PER_ACCOUNT] = sConfig.GetIntDefault("CharactersPerAccount", 50);
if(m_configs[CONFIG_CHARACTERS_PER_ACCOUNT] < m_configs[CONFIG_CHARACTERS_PER_REALM]) if(m_configs[CONFIG_CHARACTERS_PER_ACCOUNT] < m_configs[CONFIG_CHARACTERS_PER_REALM])

View file

@ -100,6 +100,7 @@ enum WorldConfigs
CONFIG_CHARACTERS_CREATING_DISABLED, CONFIG_CHARACTERS_CREATING_DISABLED,
CONFIG_CHARACTERS_PER_ACCOUNT, CONFIG_CHARACTERS_PER_ACCOUNT,
CONFIG_CHARACTERS_PER_REALM, CONFIG_CHARACTERS_PER_REALM,
CONFIG_HEROIC_CHARACTERS_PER_REALM,
CONFIG_SKIP_CINEMATICS, CONFIG_SKIP_CINEMATICS,
CONFIG_MAX_PLAYER_LEVEL, CONFIG_MAX_PLAYER_LEVEL,
CONFIG_START_PLAYER_LEVEL, CONFIG_START_PLAYER_LEVEL,

View file

@ -408,6 +408,11 @@ LogColors = ""
# Default: 10 (client limitation) # Default: 10 (client limitation)
# The number must be between 1 and 10 # The number must be between 1 and 10
# #
# HeroicCharactersPerRealm
# Limit numbers of heroic class characters for account at realm
# Default: 1
# The number must be between 0 (not allowed) and 10
#
# SkipCinematics # SkipCinematics
# Disable in-game script movie at first character's login(allows to prevent buggy intro in case of custom start location coordinates) # Disable in-game script movie at first character's login(allows to prevent buggy intro in case of custom start location coordinates)
# Default: 0 - show intro for each new characrer # Default: 0 - show intro for each new characrer
@ -574,6 +579,7 @@ StrictPetNames = 0
CharactersCreatingDisabled = 0 CharactersCreatingDisabled = 0
CharactersPerAccount = 50 CharactersPerAccount = 50
CharactersPerRealm = 10 CharactersPerRealm = 10
HeroicCharactersPerRealm = 1
SkipCinematics = 0 SkipCinematics = 0
MaxPlayerLevel = 80 MaxPlayerLevel = 80
StartPlayerLevel = 1 StartPlayerLevel = 1