diff --git a/BoosterManager/Boosters/BoosterJob.cs b/BoosterManager/Boosters/BoosterJob.cs index 6f0ae25..90bacbd 100644 --- a/BoosterManager/Boosters/BoosterJob.cs +++ b/BoosterManager/Boosters/BoosterJob.cs @@ -153,7 +153,7 @@ internal void Stop() { } } - private void Update() { + private void SaveJobState() { if (JobStopped) { return; } @@ -165,17 +165,19 @@ private void Update() { void OnBoosterInfosUpdated(Dictionary boosterInfos) { try { // At this point, all boosters that can be added to the queue have been - DateTime? lastBoosterCraftTime = LastBoosterCraftTime; - if (lastBoosterCraftTime == null) { + if (NumBoosters == 0) { StatusReporter.Report(Bot, Strings.BoostersUncraftable, log: CreatedFromSaveState); Finish(); return; } - Update(); + SaveJobState(); - if (lastBoosterCraftTime.Value.Date == DateTime.Today) { + DateTime? lastBoosterCraftTime = LastBoosterCraftTime; + if (lastBoosterCraftTime == null) { + StatusReporter.Report(Bot, String.Format(Strings.QueueStatusShortWithoutTime, NumBoosters, String.Format("{0:N0}", GemsNeeded)), log: CreatedFromSaveState); + } else if (lastBoosterCraftTime.Value.Date == DateTime.Today) { StatusReporter.Report(Bot, String.Format(Strings.QueueStatusShort, NumBoosters, String.Format("{0:N0}", GemsNeeded), String.Format("{0:t}", lastBoosterCraftTime)), log: CreatedFromSaveState); } else { StatusReporter.Report(Bot, String.Format(Strings.QueueStatusShortWithDate, NumBoosters, String.Format("{0:N0}", GemsNeeded), String.Format("{0:d}", lastBoosterCraftTime), String.Format("{0:t}", lastBoosterCraftTime)), log: CreatedFromSaveState); @@ -225,7 +227,7 @@ internal void OnBoosterUnqueueable (uint gameID, BoosterDequeueReason reason) { GameIDsToBooster.RemoveAll(x => x == gameID); } - Update(); + SaveJobState(); } internal void OnBoosterDequeued(Booster booster, BoosterDequeueReason reason) { @@ -235,7 +237,7 @@ internal void OnBoosterDequeued(Booster booster, BoosterDequeueReason reason) { Boosters.Remove(booster); } StatusReporter.Report(Bot, String.Format(Strings.BoosterUnexpectedlyUncraftable, booster.Info.Name, booster.GameID)); - Update(); + SaveJobState(); return; } @@ -249,6 +251,7 @@ internal void OnBoosterDequeued(Booster booster, BoosterDequeueReason reason) { Bot.ArchiLogger.LogGenericInfo(String.Format(Strings.PermanentBoosterRequeued, booster.GameID)); BoosterQueue.AddBooster(booster.GameID, this); + BoosterQueue.Start(); return; } @@ -260,7 +263,7 @@ internal void OnBoosterDequeued(Booster booster, BoosterDequeueReason reason) { } } - Update(); + SaveJobState(); return; } @@ -305,7 +308,7 @@ internal bool RemoveUnqueuedBooster(uint gameID) { removed = GameIDsToBooster.Remove(gameID); } - Update(); + SaveJobState(); return removed; } @@ -341,7 +344,7 @@ internal List RemoveAllBoosters() { } } - Update(); + SaveJobState(); return gameIDsRemoved; } diff --git a/BoosterManager/Localization/Strings.resx b/BoosterManager/Localization/Strings.resx index be6662f..60abb63 100644 --- a/BoosterManager/Localization/Strings.resx +++ b/BoosterManager/Localization/Strings.resx @@ -549,4 +549,8 @@ Attempting to assign {0} boosters... {0} will be replaced by a number of boosters + + {0} boosters from {1} gems will be crafted + {0} will be replaced by a number of boosters, {1} will be replaced by a number of gems + \ No newline at end of file