Skip to content

Commit

Permalink
Don't interrupt automatic farming with nonsense requests
Browse files Browse the repository at this point in the history
  • Loading branch information
JustArchi committed Feb 13, 2016
1 parent 1a2616c commit 334d2df
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
5 changes: 3 additions & 2 deletions ArchiSteamFarm/Bot.cs
Original file line number Diff line number Diff line change
Expand Up @@ -783,8 +783,9 @@ internal async Task<string> ResponsePlay(HashSet<uint> gameIDs) {
}

if (gameIDs.Contains(0)) {
await CardsFarmer.SwitchToManualMode(false).ConfigureAwait(false);
ArchiHandler.PlayGames(0);
if (await CardsFarmer.SwitchToManualMode(false).ConfigureAwait(false)) {
ArchiHandler.PlayGames(0);
}
} else {
await CardsFarmer.SwitchToManualMode(true).ConfigureAwait(false);
ArchiHandler.PlayGames(gameIDs);
Expand Down
6 changes: 4 additions & 2 deletions ArchiSteamFarm/CardsFarmer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@ internal static uint GetAnyGameToFarm(ConcurrentDictionary<uint, float> gamesToF
return 0;
}

internal async Task SwitchToManualMode(bool manualMode) {
internal async Task<bool> SwitchToManualMode(bool manualMode) {
if (ManualMode == manualMode) {
return;
return false;
}

ManualMode = manualMode;
Expand All @@ -100,6 +100,8 @@ internal async Task SwitchToManualMode(bool manualMode) {
Logging.LogGenericInfo("Now running in Automatic Farming mode", Bot.BotName);
var start = Task.Run(async () => await StartFarming().ConfigureAwait(false));
}

return true;
}

internal bool FarmMultiple(ConcurrentDictionary<uint, float> appIDs) {
Expand Down

0 comments on commit 334d2df

Please sign in to comment.