feat(Config): Max gold on change faction (#11147)

* feat(Config): Max gold on change faction

* build
This commit is contained in:
Nefertumm
2022-04-02 11:46:57 -03:00
committed by GitHub
parent ff654397e8
commit 0ef2781ede
4 changed files with 14 additions and 7 deletions

View File

@@ -2015,13 +2015,8 @@ void WorldSession::HandleCharFactionOrRaceChangeCallback(std::shared_ptr<Charact
return;
}
// xinef: check money
bool valid = Player::TeamIdForRace(oldRace) == Player::TeamIdForRace(factionChangeInfo->Race);
if ((level < 10 && money <= 0) || (level > 10 && level <= 30 && money <= 3000000) || (level > 30 && level <= 50 && money <= 10000000) ||
(level > 50 && level <= 70 && money <= 50000000) || (level > 70 && money <= 200000000))
valid = true;
if (!valid)
uint32 maxMoney = sWorld->getIntConfig(CONFIG_CHANGE_FACTION_MAX_MONEY);
if (maxMoney && money > maxMoney)
{
SendCharFactionChange(CHAR_CREATE_CHARACTER_GOLD_LIMIT, factionChangeInfo.get());
return;

View File

@@ -398,6 +398,7 @@ enum WorldIntConfigs
CONFIG_LOOT_NEED_BEFORE_GREED_ILVL_RESTRICTION,
CONFIG_LFG_MAX_KICK_COUNT,
CONFIG_LFG_KICK_PREVENTION_TIMER,
CONFIG_CHANGE_FACTION_MAX_MONEY,
INT_CONFIG_VALUE_COUNT
};

View File

@@ -1263,6 +1263,8 @@ void World::LoadConfigSettings(bool reload)
m_bool_configs[CONFIG_ALLOW_JOIN_BG_AND_LFG] = sConfigMgr->GetOption<bool>("JoinBGAndLFG.Enable", false);
m_int_configs[CONFIG_CHANGE_FACTION_MAX_MONEY] = sConfigMgr->GetOption<uint32>("ChangeFaction.MaxMoney", 0);
///- Read the "Data" directory from the config file
std::string dataPath = sConfigMgr->GetOption<std::string>("DataDir", "./");
if (dataPath.empty() || (dataPath.at(dataPath.length() - 1) != '/' && dataPath.at(dataPath.length() - 1) != '\\'))

View File

@@ -3709,6 +3709,15 @@ EnablePlayerSettings = 0
JoinBGAndLFG.Enable = 0
#
# ChangeFaction.MaxMoney
# Description: Maximum amount of gold allowed on the character to perform a faction change.
# Default: 0 - Disabled
# > 0 - Enabled (money in copper)
# Example: If set to 10000, the maximum amount of money allowed on the character would be 1 gold.
ChangeFaction.MaxMoney = 0
#
###################################################################################################