fix(Core/Config): Added new config to make pet's health be modified b… (#14051)

This commit is contained in:
UltraNix
2023-02-11 04:08:28 +01:00
committed by GitHub
parent 2a29acac74
commit da70db415b
4 changed files with 16 additions and 0 deletions

View File

@@ -3820,6 +3820,14 @@ QuestPOI.Enabled = 1
ChangeFaction.MaxMoney = 0
#
# Pet.RankMod.Health
# Description: Allows pet health to be modified by rank health rates (set in config)
# Default: 1 - Enabled
# 0 - Disabled
Pet.RankMod.Health = 1
#
###################################################################################################

View File

@@ -1108,6 +1108,11 @@ bool Guardian::InitStatsForLevel(uint8 petlevel)
float factorHealth = owner->GetTypeId() == TYPEID_PLAYER ? std::min(1.0f, cinfo->ModHealth) : cinfo->ModHealth;
float factorMana = owner->GetTypeId() == TYPEID_PLAYER ? std::min(1.0f, cinfo->ModMana) : cinfo->ModMana;
if (sWorld->getBoolConfig(CONFIG_ALLOWS_RANK_MOD_FOR_PET_HEALTH))
{
factorHealth *= _GetHealthMod(cinfo->rank);
}
SetCreateHealth(std::max<uint32>(1, stats->BaseHealth[cinfo->expansion]*factorHealth));
SetModifierValue(UNIT_MOD_HEALTH, BASE_VALUE, GetCreateHealth());
SetCreateMana(stats->BaseMana * factorMana);

View File

@@ -179,6 +179,7 @@ enum WorldBoolConfigs
CONFIG_OBJECT_SPARKLES,
CONFIG_LOW_LEVEL_REGEN_BOOST,
CONFIG_OBJECT_QUEST_MARKERS,
CONFIG_ALLOWS_RANK_MOD_FOR_PET_HEALTH,
BOOL_CONFIG_VALUE_COUNT
};

View File

@@ -1282,6 +1282,8 @@ void World::LoadConfigSettings(bool reload)
_int_configs[CONFIG_CHANGE_FACTION_MAX_MONEY] = sConfigMgr->GetOption<uint32>("ChangeFaction.MaxMoney", 0);
_bool_configs[CONFIG_ALLOWS_RANK_MOD_FOR_PET_HEALTH] = sConfigMgr->GetOption<bool>("Pet.RankMod.Health", true);
///- 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) != '\\'))