Fix GamesPlayedWhileIdle for limited accounts

This commit is contained in:
JustArchi 2016-11-14 13:07:02 +01:00
parent cba64531fa
commit 2f5dc8b191
2 changed files with 12 additions and 7 deletions

View file

@ -89,16 +89,15 @@ namespace ArchiSteamFarm {
[JsonProperty]
internal bool KeepRunning { get; private set; }
internal bool IsLimitedUser { get; private set; }
internal BotConfig BotConfig { get; private set; }
internal bool HasMobileAuthenticator => BotDatabase.MobileAuthenticator != null;
internal bool IsConnectedAndLoggedOn => SteamClient.IsConnected && (SteamClient.SteamID != null);
internal bool IsFarmingPossible => !IsLimitedUser && IsPlayingPossible;
internal bool IsPlayingPossible => !PlayingBlocked && (LibraryLockedBySteamID == 0);
internal ulong SteamID => SteamClient.SteamID;
private bool IsPlayingPossible => !PlayingBlocked && (LibraryLockedBySteamID == 0);
private bool FirstTradeSent, IsLimitedUser, PlayingBlocked, SkipFirstShutdown;
private bool FirstTradeSent, PlayingBlocked, SkipFirstShutdown;
private string AuthCode, TwoFactorCode;
private ulong LibraryLockedBySteamID;
private EResult LastLogOnResult;

View file

@ -143,14 +143,19 @@ namespace ArchiSteamFarm {
}
internal async Task StartFarming() {
if (NowFarming || Paused || !Bot.IsFarmingPossible) {
if (NowFarming || Paused || !Bot.IsPlayingPossible) {
return;
}
if (Bot.IsLimitedUser) {
await Bot.OnFarmingFinished(false).ConfigureAwait(false);
return;
}
await FarmingSemaphore.WaitAsync().ConfigureAwait(false);
try {
if (NowFarming || Paused || !Bot.IsFarmingPossible) {
if (NowFarming || Paused || !Bot.IsPlayingPossible) {
return;
}
@ -163,7 +168,7 @@ namespace ArchiSteamFarm {
Bot.ArchiLogger.LogGenericInfo("We have a total of " + GamesToFarm.Count + " games (" + GamesToFarm.Sum(game => game.CardsRemaining) + " cards) to farm on this account...");
// This is the last moment for final check if we can farm
if (!Bot.IsFarmingPossible) {
if (!Bot.IsPlayingPossible) {
Bot.ArchiLogger.LogGenericInfo("But farming is currently unavailable, we'll try later!");
return;
}
@ -242,6 +247,7 @@ namespace ArchiSteamFarm {
if (NowFarming) {
Bot.ArchiLogger.LogGenericWarning("Timed out!");
NowFarming = !NowFarming;
}
Bot.ArchiLogger.LogGenericInfo("Farming stopped!");