Skip to content

Commit

Permalink
Fix booster timers not firing properly when PC wakes from hibernation
Browse files Browse the repository at this point in the history
  • Loading branch information
Citrinate committed Jul 10, 2024
1 parent 01b5e39 commit 2de4e85
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
13 changes: 12 additions & 1 deletion BoosterManager/BoosterManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@
using ArchiSteamFarm.Steam.Exchange;
using System.Text.Json;
using ArchiSteamFarm.Helpers.Json;
using SteamKit2;

namespace BoosterManager {
[Export(typeof(IPlugin))]
public sealed class BoosterManager : IASF, IBotModules, IBotCommand2, IBotTradeOfferResults, IGitHubPluginUpdates {
public sealed class BoosterManager : IASF, IBotModules, IBotCommand2, IBotTradeOfferResults, IGitHubPluginUpdates, IBotConnection {
public string Name => nameof(BoosterManager);
public string RepositoryName => "Citrinate/BoosterManager";
public Version Version => typeof(BoosterManager).Assembly.GetName().Version ?? new Version("0");
Expand Down Expand Up @@ -131,5 +132,15 @@ public Task OnBotTradeOfferResults(Bot bot, IReadOnlyCollection<ParseTradeResult

return Task.CompletedTask;
}

public Task OnBotLoggedOn(Bot bot) {
BoosterHandler.BoosterHandlers[bot.BotName].OnBotLoggedOn();

return Task.CompletedTask;
}

public Task OnBotDisconnected(Bot bot, EResult reason) {
return Task.FromResult(0);
}
}
}
4 changes: 4 additions & 0 deletions BoosterManager/Handlers/BoosterHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,10 @@ internal void OnGemsRecieved() {
BoosterQueue.Start();
}

internal void OnBotLoggedOn() {
BoosterQueue.Start();
}

internal static void GetBoosterInfos(HashSet<Bot> bots, Action<Dictionary<Bot, Dictionary<uint, Steam.BoosterInfo>>> callback) {
ConcurrentDictionary<Bot, Dictionary<uint, Steam.BoosterInfo>> boosterInfos = new();

Expand Down

0 comments on commit 2de4e85

Please sign in to comment.