feat(Core/Config): Configurable Water Breath Timer (#11945)

* feat(Core/Config): Configurable Water Breath Timer

* Config Formatting

Add missing linebreaks

* Use int instead of float for water breath timer

* Correctly get CONFIG_WATER_BREATH as Int instead of Float value

* Move CONFIG_WATER_BREATH_TIMER to WorldInt configs

* More logical WaterBreath configuration
This commit is contained in:
ZhengPeiRu21
2022-07-10 12:14:27 -06:00
committed by GitHub
parent 5930eed646
commit a6e8f060a5
4 changed files with 18 additions and 1 deletions

View File

@@ -2423,8 +2423,17 @@ Rate.InstanceResetTime = 1
# The lower the rate the less experience is required.
# Default: 0.05
#
Rate.Pet.LevelXP = 0.05
#
# WaterBreath.Timer
# Description: The timer for player's breath underwater in milliseconds
# Default: 180000 (3 minutes)
#
WaterBreath.Timer = 180000
#
# SkillGain.Crafting
# SkillGain.Defense

View File

@@ -813,7 +813,7 @@ int32 Player::getMaxTimer(MirrorTimerType timer)
{
if (!IsAlive() || HasAuraType(SPELL_AURA_WATER_BREATHING) || GetSession()->GetSecurity() >= AccountTypes(sWorld->getIntConfig(CONFIG_DISABLE_BREATHING)))
return DISABLED_MIRROR_TIMER;
int32 UnderWaterTime = 3 * MINUTE * IN_MILLISECONDS;
int32 UnderWaterTime = sWorld->getIntConfig(CONFIG_WATER_BREATH_TIMER);
AuraEffectList const& mModWaterBreathing = GetAuraEffectsByType(SPELL_AURA_MOD_WATER_BREATHING);
for (AuraEffectList::const_iterator i = mModWaterBreathing.begin(); i != mModWaterBreathing.end(); ++i)
AddPct(UnderWaterTime, (*i)->GetAmount());

View File

@@ -401,6 +401,7 @@ enum WorldIntConfigs
CONFIG_LFG_MAX_KICK_COUNT,
CONFIG_LFG_KICK_PREVENTION_TIMER,
CONFIG_CHANGE_FACTION_MAX_MONEY,
CONFIG_WATER_BREATH_TIMER,
INT_CONFIG_VALUE_COUNT
};

View File

@@ -1184,6 +1184,13 @@ void World::LoadConfigSettings(bool reload)
m_bool_configs[CONFIG_OFFHAND_CHECK_AT_SPELL_UNLEARN] = sConfigMgr->GetOption<bool>("OffhandCheckAtSpellUnlearn", true);
m_int_configs[CONFIG_CREATURE_STOP_FOR_PLAYER] = sConfigMgr->GetOption<uint32>("Creature.MovingStopTimeForPlayer", 3 * MINUTE * IN_MILLISECONDS);
m_int_configs[CONFIG_WATER_BREATH_TIMER] = sConfigMgr->GetOption<uint32>("WaterBreath.Timer", 180000);
if (m_int_configs[CONFIG_WATER_BREATH_TIMER] <= 0)
{
LOG_ERROR("server.loading", "WaterBreath.Timer ({}) must be > 0. Using 180000 instead.", m_int_configs[CONFIG_WATER_BREATH_TIMER]);
m_int_configs[CONFIG_WATER_BREATH_TIMER] = 180000;
}
if (int32 clientCacheId = sConfigMgr->GetOption<int32>("ClientCacheVersion", 0))
{
// overwrite DB/old value