Skip to content

Commit

Permalink
auto set seconds to 0 in pvp cron
Browse files Browse the repository at this point in the history
  • Loading branch information
moonheart committed Dec 30, 2023
1 parent 278c6f3 commit f33d6be
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions MementoMori/Jobs/TimeZoneAwareJobRegister.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.Reflection;
using System.Text.RegularExpressions;
using MementoMori.Common.Localization;
using MementoMori.Option;
using MementoMori.Ortega.Share;
Expand Down Expand Up @@ -61,8 +61,8 @@ public async Task RegisterJobs(long userId)
{
AddJob<DailyJob>(scheduler, _gameConfig.Value.AutoJob.DailyJobCron, ResourceStrings.DailyJob, userId, networkManager.TimeManager.DiffFromUtc);
AddJob<HourlyJob>(scheduler, _gameConfig.Value.AutoJob.HourlyJobCron, ResourceStrings.RewardClaimJob, userId, networkManager.TimeManager.DiffFromUtc);
AddJob<PvpJob>(scheduler, _gameConfig.Value.AutoJob.PvpJobCron, Masters.TextResourceTable.Get("[CommonHeaderLocalPvpLabel]"), userId, networkManager.TimeManager.DiffFromUtc);
AddJob<LegendLeagueJob>(scheduler, _gameConfig.Value.AutoJob.LegendLeagueJobCron, Masters.TextResourceTable.Get("[CommonHeaderGlobalPvpLabel]"), userId, networkManager.TimeManager.DiffFromUtc);
AddJob<PvpJob>(scheduler, NormalizeCron(_gameConfig.Value.AutoJob.PvpJobCron), Masters.TextResourceTable.Get("[CommonHeaderLocalPvpLabel]"), userId, networkManager.TimeManager.DiffFromUtc);
AddJob<LegendLeagueJob>(scheduler, NormalizeCron(_gameConfig.Value.AutoJob.LegendLeagueJobCron), Masters.TextResourceTable.Get("[CommonHeaderGlobalPvpLabel]"), userId, networkManager.TimeManager.DiffFromUtc);
AddJob<GuildRaidBossReleaseJob>(scheduler, _gameConfig.Value.AutoJob.GuildRaidBossReleaseCron, Masters.TextResourceTable.Get("[GuildRaidReleaseConfirmTitle]"), userId,
networkManager.TimeManager.DiffFromUtc);
AddJob<AutoBuyShopItemJob>(scheduler, _gameConfig.Value.AutoJob.AutoBuyShopItemJobCron, ResourceStrings.ShopAutoBuyItems, userId, networkManager.TimeManager.DiffFromUtc);
Expand All @@ -77,6 +77,11 @@ public async Task RegisterJobs(long userId)
}
}

private string NormalizeCron(string cron)
{
return Regex.Replace(cron, @"^[\S]+", "0");
}

private void RemoveJob<T>(IScheduler scheduler, long userId) where T : IJob
{
var type = typeof(T);
Expand Down

0 comments on commit f33d6be

Please sign in to comment.