diff --git a/Source/Framework/Constants/SharedConst.cs b/Source/Framework/Constants/SharedConst.cs index 974e612e8..b8c91b5fb 100644 --- a/Source/Framework/Constants/SharedConst.cs +++ b/Source/Framework/Constants/SharedConst.cs @@ -952,7 +952,7 @@ namespace Framework.Constants // Db Scripting Commands public enum ScriptCommands { - Talk = 0, // Source/Target = Creature, Target = Any, Datalong = Talk Type (0=Say, 1=Whisper, 2=Yell, 3=Emote Text, 4=Boss Emote Text), Datalong2 & 1 = Player Talk (Instead Of Creature), Dataint = StringId + Talk = 0, // Source/Target = Creature, Target = Any, Datalong = Talk Type (see ChatType enum), datalong2 & 1 = player talk (instead of creature), dataint = string_id Emote = 1, // Source/Target = Creature, Datalong = Emote Id, Datalong2 = 0: Set Emote State; > 0: Play Emote State FieldSetDeprecated = 2, MoveTo = 3, // Source/Target = Creature, Datalong2 = Time To Reach, X/Y/Z = Destination @@ -1111,6 +1111,7 @@ namespace Framework.Constants ChatYellLevelReq, CheckGobjectLos, CleanCharacterDb, + CleanOldMailTime, ClientCacheVersion, Compression, CorpseDecayElite, diff --git a/Source/Game/Server/WorldConfig.cs b/Source/Game/Server/WorldConfig.cs index 3f3b5f1b3..59bd89ec1 100644 --- a/Source/Game/Server/WorldConfig.cs +++ b/Source/Game/Server/WorldConfig.cs @@ -562,6 +562,12 @@ namespace Game Values[WorldCfg.GroupVisibility] = GetDefaultValue("Visibility.GroupMode", 1); Values[WorldCfg.MailDeliveryDelay] = GetDefaultValue("MailDeliveryDelay", Time.Hour); + Values[WorldCfg.CleanOldMailTime] = GetDefaultValue("CleanOldMailTime", 4); + if (Values[WorldCfg.CleanOldMailTime] > 23) + { + Log.outError(LogFilter.ServerLoading, $"CleanOldMailTime ({Values[WorldCfg.CleanOldMailTime]}) must be an hour, between 0 and 23. Set to 4."); + Values[WorldCfg.CleanOldMailTime] = 4; + } Values[WorldCfg.UptimeUpdate] = GetDefaultValue("UpdateUptimeInterval", 10); if ((int)Values[WorldCfg.UptimeUpdate] <= 0) diff --git a/Source/Game/Server/WorldManager.cs b/Source/Game/Server/WorldManager.cs index 6819cfb66..6558791a2 100644 --- a/Source/Game/Server/WorldManager.cs +++ b/Source/Game/Server/WorldManager.cs @@ -963,7 +963,8 @@ namespace Game //one second is 1000 -(tested on win system) // @todo Get rid of magic numbers var localTime = Time.UnixTimeToDateTime(GameTime.GetGameTime()).ToLocalTime(); - mail_timer = ((((localTime.Hour + 20) % 24) * Time.Hour * Time.InMilliseconds) / m_timers[WorldTimers.Auctions].GetInterval()); + byte CleanOldMailsTime = WorldConfig.GetIntValue(WorldCfg.CleanOldMailTime); + mail_timer = ((((localTime.Hour + (24 - CleanOldMailsTime)) % 24) * Time.Hour * Time.InMilliseconds) / m_timers[WorldTimers.Auctions].GetInterval()); //1440 mail_timer_expires = ((Time.Day * Time.InMilliseconds) / (m_timers[(int)WorldTimers.Auctions].GetInterval())); Log.outInfo(LogFilter.ServerLoading, "Mail timer set to: {0}, mail return is called every {1} minutes", mail_timer, mail_timer_expires); diff --git a/Source/WorldServer/WorldServer.conf.dist b/Source/WorldServer/WorldServer.conf.dist index 2cab41979..220393325 100644 --- a/Source/WorldServer/WorldServer.conf.dist +++ b/Source/WorldServer/WorldServer.conf.dist @@ -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.