Core/Misc: Removed Death knight creation restrictions

Closes #20987
This commit is contained in:
joschiwald
2017-12-10 12:39:33 +01:00
parent b7797607e0
commit eee5a4f248
5 changed files with 5 additions and 107 deletions

View File

@@ -68,7 +68,7 @@ enum RBACPermissions
RBAC_PERM_SKIP_CHECK_CHARACTER_CREATION_CLASSMASK = 15,
RBAC_PERM_SKIP_CHECK_CHARACTER_CREATION_RACEMASK = 16,
RBAC_PERM_SKIP_CHECK_CHARACTER_CREATION_RESERVEDNAME = 17,
RBAC_PERM_SKIP_CHECK_CHARACTER_CREATION_DEATH_KNIGHT = 18,
RBAC_PERM_SKIP_CHECK_CHARACTER_CREATION_DEATH_KNIGHT = 18, // deprecated since Draenor DON'T reuse
RBAC_PERM_SKIP_CHECK_CHAT_CHANNEL_REQ = 19,
RBAC_PERM_SKIP_CHECK_DISABLE_MAP = 20,
RBAC_PERM_SKIP_CHECK_MORE_TALENTS_THAN_ALLOWED = 21,

View File

@@ -517,23 +517,6 @@ void WorldSession::HandleCharCreateOpcode(WorldPackets::Character::CreateCharact
return;
}
if (charCreate.CreateInfo->Class == CLASS_DEATH_KNIGHT && !HasPermission(rbac::RBAC_PERM_SKIP_CHECK_CHARACTER_CREATION_DEATH_KNIGHT))
{
// speedup check for death knight class disabled case
if (!sWorld->getIntConfig(CONFIG_DEATH_KNIGHTS_PER_REALM))
{
SendCharCreate(CHAR_CREATE_UNIQUE_CLASS_LIMIT);
return;
}
// speedup check for death knight class disabled case
if (sWorld->getIntConfig(CONFIG_CHARACTER_CREATING_MIN_LEVEL_FOR_DEATH_KNIGHT) > sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL))
{
SendCharCreate(CHAR_CREATE_LEVEL_REQUIREMENT);
return;
}
}
std::shared_ptr<WorldPackets::Character::CharacterCreateInfo> createInfo = charCreate.CreateInfo;
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHECK_NAME);
stmt->setString(0, charCreate.CreateInfo->Name);
@@ -590,47 +573,20 @@ void WorldSession::HandleCharCreateOpcode(WorldPackets::Character::CreateCharact
std::function<void(PreparedQueryResult)> finalizeCharacterCreation = [this, createInfo](PreparedQueryResult result)
{
bool haveSameRace = false;
uint32 deathKnightReqLevel = sWorld->getIntConfig(CONFIG_CHARACTER_CREATING_MIN_LEVEL_FOR_DEATH_KNIGHT);
uint32 demonHunterReqLevel = sWorld->getIntConfig(CONFIG_CHARACTER_CREATING_MIN_LEVEL_FOR_DEMON_HUNTER);
bool hasDeathKnightReqLevel = (deathKnightReqLevel == 0);
bool hasDemonHunterReqLevel = (demonHunterReqLevel == 0);
bool allowTwoSideAccounts = !sWorld->IsPvPRealm() || HasPermission(rbac::RBAC_PERM_TWO_SIDE_CHARACTER_CREATION);
uint32 skipCinematics = sWorld->getIntConfig(CONFIG_SKIP_CINEMATICS);
bool checkDeathKnightReqs = createInfo->Class == CLASS_DEATH_KNIGHT && !HasPermission(rbac::RBAC_PERM_SKIP_CHECK_CHARACTER_CREATION_DEATH_KNIGHT);
bool checkDemonHunterReqs = createInfo->Class == CLASS_DEMON_HUNTER && !HasPermission(rbac::RBAC_PERM_SKIP_CHECK_CHARACTER_CREATION_DEMON_HUNTER);
if (result)
{
uint32 team = Player::TeamForRace(createInfo->Race);
uint32 freeDeathKnightSlots = sWorld->getIntConfig(CONFIG_DEATH_KNIGHTS_PER_REALM);
uint32 freeDemonHunterSlots = sWorld->getIntConfig(CONFIG_DEMON_HUNTERS_PER_REALM);
Field* field = result->Fetch();
uint8 accRace = field[1].GetUInt8();
if (checkDeathKnightReqs)
{
uint8 accClass = field[2].GetUInt8();
if (accClass == CLASS_DEATH_KNIGHT)
{
if (freeDeathKnightSlots > 0)
--freeDeathKnightSlots;
if (freeDeathKnightSlots == 0)
{
SendCharCreate(CHAR_CREATE_UNIQUE_CLASS_LIMIT);
return;
}
}
if (!hasDeathKnightReqLevel)
{
uint8 accLevel = field[0].GetUInt8();
if (accLevel >= deathKnightReqLevel)
hasDeathKnightReqLevel = true;
}
}
if (checkDemonHunterReqs)
{
uint8 accClass = field[2].GetUInt8();
@@ -671,7 +627,7 @@ void WorldSession::HandleCharCreateOpcode(WorldPackets::Character::CreateCharact
// search same race for cinematic or same class if need
/// @todo check if cinematic already shown? (already logged in?; cinematic field)
while ((skipCinematics == 1 && !haveSameRace) || createInfo->Class == CLASS_DEATH_KNIGHT || createInfo->Class == CLASS_DEMON_HUNTER)
while ((skipCinematics == 1 && !haveSameRace) || createInfo->Class == CLASS_DEMON_HUNTER)
{
if (!result->NextRow())
break;
@@ -682,29 +638,6 @@ void WorldSession::HandleCharCreateOpcode(WorldPackets::Character::CreateCharact
if (!haveSameRace)
haveSameRace = createInfo->Race == accRace;
if (checkDeathKnightReqs)
{
uint8 acc_class = field[2].GetUInt8();
if (acc_class == CLASS_DEATH_KNIGHT)
{
if (freeDeathKnightSlots > 0)
--freeDeathKnightSlots;
if (freeDeathKnightSlots == 0)
{
SendCharCreate(CHAR_CREATE_UNIQUE_CLASS_LIMIT);
return;
}
}
if (!hasDeathKnightReqLevel)
{
uint8 acc_level = field[0].GetUInt8();
if (acc_level >= deathKnightReqLevel)
hasDeathKnightReqLevel = true;
}
}
if (checkDemonHunterReqs)
{
uint8 accClass = field[2].GetUInt8();
@@ -730,15 +663,9 @@ void WorldSession::HandleCharCreateOpcode(WorldPackets::Character::CreateCharact
}
}
if (checkDeathKnightReqs && !hasDeathKnightReqLevel)
{
SendCharCreate(CHAR_CREATE_LEVEL_REQUIREMENT);
return;
}
if (checkDemonHunterReqs && !hasDemonHunterReqLevel)
{
SendCharCreate(CHAR_CREATE_LEVEL_REQUIREMENT);
SendCharCreate(CHAR_CREATE_FAILED);
return;
}
@@ -786,7 +713,7 @@ void WorldSession::HandleCharCreateOpcode(WorldPackets::Character::CreateCharact
newChar.CleanupsBeforeDelete();
};
if (allowTwoSideAccounts && !skipCinematics && createInfo->Class != CLASS_DEATH_KNIGHT && createInfo->Class != CLASS_DEMON_HUNTER)
if (allowTwoSideAccounts && !skipCinematics && createInfo->Class != CLASS_DEMON_HUNTER)
{
finalizeCharacterCreation(PreparedQueryResult(nullptr));
return;
@@ -794,7 +721,7 @@ void WorldSession::HandleCharCreateOpcode(WorldPackets::Character::CreateCharact
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_CREATE_INFO);
stmt->setUInt32(0, GetAccountId());
stmt->setUInt32(1, (skipCinematics == 1 || createInfo->Class == CLASS_DEATH_KNIGHT || createInfo->Class == CLASS_DEMON_HUNTER) ? 12 : 1);
stmt->setUInt32(1, (skipCinematics == 1 || createInfo->Class == CLASS_DEMON_HUNTER) ? 12 : 1);
queryCallback.WithPreparedCallback(std::move(finalizeCharacterCreation)).SetNextQuery(CharacterDatabase.AsyncQuery(stmt));
}));
}

View File

@@ -820,15 +820,6 @@ void World::LoadConfigSettings(bool reload)
m_int_configs[CONFIG_CHARACTERS_PER_ACCOUNT] = m_int_configs[CONFIG_CHARACTERS_PER_REALM];
}
m_int_configs[CONFIG_DEATH_KNIGHTS_PER_REALM] = sConfigMgr->GetIntDefault("DeathKnightsPerRealm", 1);
if (int32(m_int_configs[CONFIG_DEATH_KNIGHTS_PER_REALM]) < 0 || m_int_configs[CONFIG_DEATH_KNIGHTS_PER_REALM] > 12)
{
TC_LOG_ERROR("server.loading", "DeathKnightsPerRealm (%i) must be in range 0..12. Set to 1.", m_int_configs[CONFIG_DEATH_KNIGHTS_PER_REALM]);
m_int_configs[CONFIG_DEATH_KNIGHTS_PER_REALM] = 1;
}
m_int_configs[CONFIG_CHARACTER_CREATING_MIN_LEVEL_FOR_DEATH_KNIGHT] = sConfigMgr->GetIntDefault("CharacterCreating.MinLevelForDeathKnight", 55);
m_int_configs[CONFIG_DEMON_HUNTERS_PER_REALM] = sConfigMgr->GetIntDefault("DemonHuntersPerRealm", 1);
if (int32(m_int_configs[CONFIG_DEMON_HUNTERS_PER_REALM]) < 0 || m_int_configs[CONFIG_DEMON_HUNTERS_PER_REALM] > 12)
{

View File

@@ -242,8 +242,6 @@ enum WorldIntConfigs
CONFIG_CHARACTER_CREATING_DISABLED_CLASSMASK,
CONFIG_CHARACTERS_PER_ACCOUNT,
CONFIG_CHARACTERS_PER_REALM,
CONFIG_DEATH_KNIGHTS_PER_REALM,
CONFIG_CHARACTER_CREATING_MIN_LEVEL_FOR_DEATH_KNIGHT,
CONFIG_DEMON_HUNTERS_PER_REALM,
CONFIG_CHARACTER_CREATING_MIN_LEVEL_FOR_DEMON_HUNTER,
CONFIG_SKIP_CINEMATICS,

View File

@@ -797,24 +797,6 @@ CharactersPerAccount = 50
CharactersPerRealm = 12
#
# DeathKnightsPerRealm
# Description: Limit number of death knight characters per account on this realm.
# Range: 1-12
# Default: 1
DeathKnightsPerRealm = 1
#
# CharacterCreating.MinLevelForDeathKnight
# Description: Limit creating death knights only for account with another
# character of specific level (ignored for GM accounts).
# Default: 55 - (Enabled, Requires at least another level 55 character)
# 0 - (Disabled)
# 1 - (Enabled, Requires at least another level 1 character)
CharacterCreating.MinLevelForDeathKnight = 55
#
# DemonHuntersPerRealm
# Description: Limit number of demon hunter characters per account on this realm.