mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 07:37:01 +00:00
[6937] Implement another character level requirement for heroic character creating.
Add option to mangosd.conf for set required level for this limitation or let disable limitation.
This commit is contained in:
parent
e6e35f38d1
commit
eeabb03e2d
5 changed files with 60 additions and 13 deletions
|
|
@ -317,24 +317,37 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data )
|
|||
return;
|
||||
}
|
||||
|
||||
// speedup check for heroic class disabled case
|
||||
uint32 req_level_for_heroic = sWorld.getConfig(CONFIG_MIN_LEVEL_FOR_HEROIC_CHARACTER_CREATING);
|
||||
if(GetSecurity()==SEC_PLAYER && class_ == CLASS_DEATH_KNIGHT && req_level_for_heroic > sWorld.getConfig(CONFIG_MAX_PLAYER_LEVEL))
|
||||
{
|
||||
data << (uint8)CHAR_CREATE_LEVEL_REQUIREMENT;
|
||||
SendPacket( &data );
|
||||
return;
|
||||
}
|
||||
|
||||
bool AllowTwoSideAccounts = !sWorld.IsPvPRealm() || sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_ACCOUNTS) || GetSecurity() > SEC_PLAYER;
|
||||
uint32 skipCinematics = sWorld.getConfig(CONFIG_SKIP_CINEMATICS);
|
||||
|
||||
bool have_same_race = false;
|
||||
|
||||
// if 0 then allowed creating without any characters
|
||||
bool have_req_level_for_heroic = (req_level_for_heroic==0);
|
||||
|
||||
if(!AllowTwoSideAccounts || skipCinematics == 1 || class_ == CLASS_DEATH_KNIGHT)
|
||||
{
|
||||
QueryResult *result2 = CharacterDatabase.PQuery("SELECT race,class FROM characters WHERE account = '%u' %s",
|
||||
QueryResult *result2 = CharacterDatabase.PQuery("SELECT guid,race,class FROM characters WHERE account = '%u' %s",
|
||||
GetAccountId(), (skipCinematics == 1 || class_ == CLASS_DEATH_KNIGHT) ? "" : "LIMIT 1");
|
||||
if(result2)
|
||||
{
|
||||
uint32 team_= Player::TeamForRace(race_);
|
||||
|
||||
Field* field = result2->Fetch();
|
||||
uint8 acc_race = field[0].GetUInt32();
|
||||
uint8 acc_race = field[1].GetUInt32();
|
||||
|
||||
if(GetSecurity()==SEC_PLAYER && class_ == CLASS_DEATH_KNIGHT)
|
||||
{
|
||||
uint8 acc_class = field[1].GetUInt32();
|
||||
uint8 acc_class = field[2].GetUInt32();
|
||||
if(acc_class == CLASS_DEATH_KNIGHT)
|
||||
{
|
||||
if(heroic_free_slots > 0)
|
||||
|
|
@ -347,6 +360,14 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data )
|
|||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if(!have_req_level_for_heroic)
|
||||
{
|
||||
uint32 acc_guid = field[0].GetUInt32();
|
||||
uint32 acc_level = Player::GetUInt32ValueFromDB(UNIT_FIELD_LEVEL,acc_guid);
|
||||
if(acc_level >= req_level_for_heroic)
|
||||
have_req_level_for_heroic = true;
|
||||
}
|
||||
}
|
||||
|
||||
// need to check team only for first character
|
||||
|
|
@ -374,14 +395,14 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data )
|
|||
break;
|
||||
|
||||
field = result2->Fetch();
|
||||
acc_race = field[0].GetUInt32();
|
||||
acc_race = field[1].GetUInt32();
|
||||
|
||||
if(!have_same_race)
|
||||
have_same_race = race_ == acc_race;
|
||||
|
||||
if(GetSecurity()==SEC_PLAYER && class_ == CLASS_DEATH_KNIGHT)
|
||||
{
|
||||
uint8 acc_class = field[1].GetUInt32();
|
||||
uint8 acc_class = field[2].GetUInt32();
|
||||
if(acc_class == CLASS_DEATH_KNIGHT)
|
||||
{
|
||||
if(heroic_free_slots > 0)
|
||||
|
|
@ -394,12 +415,27 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data )
|
|||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if(!have_req_level_for_heroic)
|
||||
{
|
||||
uint32 acc_guid = field[0].GetUInt32();
|
||||
uint32 acc_level = Player::GetUInt32ValueFromDB(UNIT_FIELD_LEVEL,acc_guid);
|
||||
if(acc_level >= req_level_for_heroic)
|
||||
have_req_level_for_heroic = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
delete result2;
|
||||
}
|
||||
}
|
||||
|
||||
if(GetSecurity()==SEC_PLAYER && class_ == CLASS_DEATH_KNIGHT && !have_req_level_for_heroic)
|
||||
{
|
||||
data << (uint8)CHAR_CREATE_LEVEL_REQUIREMENT;
|
||||
SendPacket( &data );
|
||||
return;
|
||||
}
|
||||
|
||||
// extract other data required for player creating
|
||||
uint8 gender, skin, face, hairStyle, hairColor, facialHair, outfitId;
|
||||
recv_data >> gender >> skin >> face;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue