Add FarmingPeriod

This commit is contained in:
JustArchi
2016-03-11 02:07:20 +01:00
parent 3e7f726afb
commit f20ea0a87f
4 changed files with 18 additions and 3 deletions

View File

@@ -46,6 +46,10 @@ namespace ArchiSteamFarm {
}
internal ArchiWebHandler(Bot bot) {
if (bot == null) {
return;
}
Bot = bot;
}

View File

@@ -47,14 +47,18 @@ namespace ArchiSteamFarm {
private bool NowFarming = false;
internal CardsFarmer(Bot bot) {
if (bot == null) {
return;
}
Bot = bot;
if (Timer == null) {
if (Program.GlobalConfig.FarmingPeriod > 0 && Timer == null) {
Timer = new Timer(
async e => await CheckGamesForFarming().ConfigureAwait(false),
null,
TimeSpan.FromMinutes(15), // Delay
TimeSpan.FromMinutes(60) // Period
TimeSpan.FromHours(Program.GlobalConfig.FarmingPeriod), // Delay
TimeSpan.FromHours(Program.GlobalConfig.FarmingPeriod) // Period
);
}
}

View File

@@ -50,6 +50,9 @@ namespace ArchiSteamFarm {
[JsonProperty(Required = Required.DisallowNull)]
internal byte MaxFarmingTime { get; private set; } = 10;
[JsonProperty(Required = Required.DisallowNull)]
internal byte FarmingPeriod { get; private set; } = 3;
[JsonProperty(Required = Required.DisallowNull)]
internal byte FarmingDelay { get; private set; } = 5;

View File

@@ -46,6 +46,10 @@ namespace ArchiSteamFarm {
}
internal Trading(Bot bot) {
if (bot == null) {
return;
}
Bot = bot;
}