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;
uint32 skipCinematics = sWorld.getConfig(CONFIG_SKIP_CINEMATICS);
@ -323,14 +332,20 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data )
Field* field = result2->Fetch();
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();
if(acc_class == CLASS_DEATH_KNIGHT)
{
data << (uint8)CHAR_CREATE_UNIQUE_CLASS_LIMIT;
SendPacket( &data );
return;
if(heroic_free_slots > 0)
--heroic_free_slots;
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)
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();
if(acc_class == CLASS_DEATH_KNIGHT)
{
data << (uint8)CHAR_CREATE_UNIQUE_CLASS_LIMIT;
SendPacket( &data );
return;
if(heroic_free_slots > 0)
--heroic_free_slots;
if(heroic_free_slots==0)
{
data << (uint8)CHAR_CREATE_UNIQUE_CLASS_LIMIT;
SendPacket( &data );
return;
}
}
}
}