Core/Misc: Added the possibility to configure the hour at which the server will be return old mails or delete them. (#20305)

This commit is contained in:
Gildor
2017-10-20 23:34:45 +02:00
committed by Shauren
parent b507acf1c0
commit 3eb0cfc687
3 changed files with 17 additions and 1 deletions

View File

@@ -973,6 +973,12 @@ void World::LoadConfigSettings(bool reload)
m_int_configs[CONFIG_GROUP_VISIBILITY] = sConfigMgr->GetIntDefault("Visibility.GroupMode", 1);
m_int_configs[CONFIG_MAIL_DELIVERY_DELAY] = sConfigMgr->GetIntDefault("MailDeliveryDelay", HOUR);
m_int_configs[CONFIG_CLEAN_OLD_MAIL_TIME] = sConfigMgr->GetIntDefault("CleanOldMailTime", 4);
if (m_int_configs[CONFIG_CLEAN_OLD_MAIL_TIME] > 23)
{
TC_LOG_ERROR("server.loading", "CleanOldMailTime (%u) must be an hour, between 0 and 23. Set to 4.", m_int_configs[CONFIG_CLEAN_OLD_MAIL_TIME]);
m_int_configs[CONFIG_CLEAN_OLD_MAIL_TIME] = 4;
}
m_int_configs[CONFIG_UPTIME_UPDATE] = sConfigMgr->GetIntDefault("UpdateUptimeInterval", 10);
if (int32(m_int_configs[CONFIG_UPTIME_UPDATE]) <= 0)
@@ -2024,7 +2030,8 @@ void World::SetInitialWorldSettings()
tm localTm;
time_t gameTime = GameTime::GetGameTime();
localtime_r(&gameTime, &localTm);
mail_timer = ((((localTm.tm_hour + 20) % 24)* HOUR * IN_MILLISECONDS) / m_timers[WUPDATE_AUCTIONS].GetInterval());
uint8 CleanOldMailsTime = getIntConfig(CONFIG_CLEAN_OLD_MAIL_TIME);
mail_timer = ((((localTm.tm_hour + (24 - CleanOldMailsTime)) % 24)* HOUR * IN_MILLISECONDS) / m_timers[WUPDATE_AUCTIONS].GetInterval());
//1440
mail_timer_expires = ((DAY * IN_MILLISECONDS) / (m_timers[WUPDATE_AUCTIONS].GetInterval()));
TC_LOG_INFO("server.loading", "Mail timer set to: " UI64FMTD ", mail return is called every " UI64FMTD " minutes", uint64(mail_timer), uint64(mail_timer_expires));

View File

@@ -262,6 +262,7 @@ enum WorldIntConfigs
CONFIG_FORCE_SHUTDOWN_THRESHOLD,
CONFIG_GROUP_VISIBILITY,
CONFIG_MAIL_DELIVERY_DELAY,
CONFIG_CLEAN_OLD_MAIL_TIME,
CONFIG_UPTIME_UPDATE,
CONFIG_SKILL_CHANCE_ORANGE,
CONFIG_SKILL_CHANCE_YELLOW,

View File

@@ -1111,6 +1111,14 @@ MaxRecruitAFriendBonusDistance = 100
MailDeliveryDelay = 3600
#
# CleanOldMailTime
# Description: The hour at which old mails will be returned or deleted by the server.
# This can be any integer number from 0 to 23. 20 will be 8pm server time.
# Default: 4 - 4am
CleanOldMailTime = 4
#
# SkillChance.Prospecting
# Description: Allow skill increase from prospecting.