mirror of
https://github.com/JustArchiNET/ArchiSteamFarm.git
synced 2025-12-18 07:20:30 +00:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
621a1dc2cb | ||
|
|
1a832780a2 | ||
|
|
ab531c80df | ||
|
|
f20ea0a87f | ||
|
|
3e7f726afb |
@@ -46,6 +46,10 @@ namespace ArchiSteamFarm {
|
|||||||
}
|
}
|
||||||
|
|
||||||
internal ArchiWebHandler(Bot bot) {
|
internal ArchiWebHandler(Bot bot) {
|
||||||
|
if (bot == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Bot = bot;
|
Bot = bot;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ using System.Threading.Tasks;
|
|||||||
namespace ArchiSteamFarm {
|
namespace ArchiSteamFarm {
|
||||||
internal sealed class CardsFarmer {
|
internal sealed class CardsFarmer {
|
||||||
internal readonly ConcurrentDictionary<uint, float> GamesToFarm = new ConcurrentDictionary<uint, float>();
|
internal readonly ConcurrentDictionary<uint, float> GamesToFarm = new ConcurrentDictionary<uint, float>();
|
||||||
internal readonly List<uint> CurrentGamesFarming = new List<uint>();
|
internal readonly HashSet<uint> CurrentGamesFarming = new HashSet<uint>();
|
||||||
|
|
||||||
private readonly ManualResetEvent FarmResetEvent = new ManualResetEvent(false);
|
private readonly ManualResetEvent FarmResetEvent = new ManualResetEvent(false);
|
||||||
private readonly SemaphoreSlim Semaphore = new SemaphoreSlim(1);
|
private readonly SemaphoreSlim Semaphore = new SemaphoreSlim(1);
|
||||||
@@ -47,24 +47,28 @@ namespace ArchiSteamFarm {
|
|||||||
private bool NowFarming = false;
|
private bool NowFarming = false;
|
||||||
|
|
||||||
internal CardsFarmer(Bot bot) {
|
internal CardsFarmer(Bot bot) {
|
||||||
|
if (bot == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Bot = bot;
|
Bot = bot;
|
||||||
|
|
||||||
if (Timer == null) {
|
if (Program.GlobalConfig.IdleFarmingPeriod > 0 && Timer == null) {
|
||||||
Timer = new Timer(
|
Timer = new Timer(
|
||||||
async e => await CheckGamesForFarming().ConfigureAwait(false),
|
async e => await CheckGamesForFarming().ConfigureAwait(false),
|
||||||
null,
|
null,
|
||||||
TimeSpan.FromMinutes(15), // Delay
|
TimeSpan.FromHours(Program.GlobalConfig.IdleFarmingPeriod), // Delay
|
||||||
TimeSpan.FromMinutes(60) // Period
|
TimeSpan.FromHours(Program.GlobalConfig.IdleFarmingPeriod) // Period
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static List<uint> GetGamesToFarmSolo(ConcurrentDictionary<uint, float> gamesToFarm) {
|
internal static HashSet<uint> GetGamesToFarmSolo(ConcurrentDictionary<uint, float> gamesToFarm) {
|
||||||
if (gamesToFarm == null) {
|
if (gamesToFarm == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
List<uint> result = new List<uint>();
|
HashSet<uint> result = new HashSet<uint>();
|
||||||
foreach (KeyValuePair<uint, float> keyValue in gamesToFarm) {
|
foreach (KeyValuePair<uint, float> keyValue in gamesToFarm) {
|
||||||
if (keyValue.Value >= 2) {
|
if (keyValue.Value >= 2) {
|
||||||
result.Add(keyValue.Key);
|
result.Add(keyValue.Key);
|
||||||
@@ -177,10 +181,10 @@ namespace ArchiSteamFarm {
|
|||||||
if (Bot.BotConfig.CardDropsRestricted) { // If we have restricted card drops, we use complex algorithm
|
if (Bot.BotConfig.CardDropsRestricted) { // If we have restricted card drops, we use complex algorithm
|
||||||
Logging.LogGenericInfo("Chosen farming algorithm: Complex", Bot.BotName);
|
Logging.LogGenericInfo("Chosen farming algorithm: Complex", Bot.BotName);
|
||||||
while (GamesToFarm.Count > 0) {
|
while (GamesToFarm.Count > 0) {
|
||||||
List<uint> gamesToFarmSolo = GetGamesToFarmSolo(GamesToFarm);
|
HashSet<uint> gamesToFarmSolo = GetGamesToFarmSolo(GamesToFarm);
|
||||||
if (gamesToFarmSolo.Count > 0) {
|
if (gamesToFarmSolo.Count > 0) {
|
||||||
while (gamesToFarmSolo.Count > 0) {
|
while (gamesToFarmSolo.Count > 0) {
|
||||||
uint appID = gamesToFarmSolo[0];
|
uint appID = gamesToFarmSolo.First();
|
||||||
if (await FarmSolo(appID).ConfigureAwait(false)) {
|
if (await FarmSolo(appID).ConfigureAwait(false)) {
|
||||||
farmedSomething = true;
|
farmedSomething = true;
|
||||||
Logging.LogGenericInfo("Done farming: " + appID, Bot.BotName);
|
Logging.LogGenericInfo("Done farming: " + appID, Bot.BotName);
|
||||||
@@ -193,7 +197,6 @@ namespace ArchiSteamFarm {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (FarmMultiple(GamesToFarm)) {
|
if (FarmMultiple(GamesToFarm)) {
|
||||||
farmedSomething = true;
|
|
||||||
Logging.LogGenericInfo("Done farming: " + string.Join(", ", GamesToFarm.Keys), Bot.BotName);
|
Logging.LogGenericInfo("Done farming: " + string.Join(", ", GamesToFarm.Keys), Bot.BotName);
|
||||||
} else {
|
} else {
|
||||||
NowFarming = false;
|
NowFarming = false;
|
||||||
|
|||||||
@@ -50,6 +50,9 @@ namespace ArchiSteamFarm {
|
|||||||
[JsonProperty(Required = Required.DisallowNull)]
|
[JsonProperty(Required = Required.DisallowNull)]
|
||||||
internal byte MaxFarmingTime { get; private set; } = 10;
|
internal byte MaxFarmingTime { get; private set; } = 10;
|
||||||
|
|
||||||
|
[JsonProperty(Required = Required.DisallowNull)]
|
||||||
|
internal byte IdleFarmingPeriod { get; private set; } = 3;
|
||||||
|
|
||||||
[JsonProperty(Required = Required.DisallowNull)]
|
[JsonProperty(Required = Required.DisallowNull)]
|
||||||
internal byte FarmingDelay { get; private set; } = 5;
|
internal byte FarmingDelay { get; private set; } = 5;
|
||||||
|
|
||||||
|
|||||||
@@ -464,7 +464,7 @@ namespace ArchiSteamFarm {
|
|||||||
string botName = Path.GetFileNameWithoutExtension(configFile);
|
string botName = Path.GetFileNameWithoutExtension(configFile);
|
||||||
Logging.LogGenericWarning("Found legacy " + botName + ".xml config file, it will now be converted to new ASF V2.0 format!");
|
Logging.LogGenericWarning("Found legacy " + botName + ".xml config file, it will now be converted to new ASF V2.0 format!");
|
||||||
Bot bot = new Bot(botName);
|
Bot bot = new Bot(botName);
|
||||||
if (!bot.BotConfig.Enabled) {
|
if (bot.BotConfig == null || !bot.BotConfig.Enabled) {
|
||||||
Logging.LogGenericInfo("Not starting this instance because it's disabled in config file", botName);
|
Logging.LogGenericInfo("Not starting this instance because it's disabled in config file", botName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
|||||||
// You can specify all the values or you can default the Build and Revision Numbers
|
// You can specify all the values or you can default the Build and Revision Numbers
|
||||||
// by using the '*' as shown below:
|
// by using the '*' as shown below:
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
[assembly: AssemblyVersion("2.0.0.3")]
|
[assembly: AssemblyVersion("2.0.0.5")]
|
||||||
[assembly: AssemblyFileVersion("2.0.0.3")]
|
[assembly: AssemblyFileVersion("2.0.0.5")]
|
||||||
|
|||||||
@@ -46,6 +46,10 @@ namespace ArchiSteamFarm {
|
|||||||
}
|
}
|
||||||
|
|
||||||
internal Trading(Bot bot) {
|
internal Trading(Bot bot) {
|
||||||
|
if (bot == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Bot = bot;
|
Bot = bot;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
"AutoUpdates": true,
|
"AutoUpdates": true,
|
||||||
"UpdateChannel": 1,
|
"UpdateChannel": 1,
|
||||||
"MaxFarmingTime": 10,
|
"MaxFarmingTime": 10,
|
||||||
|
"IdleFarmingPeriod": 3,
|
||||||
"FarmingDelay": 5,
|
"FarmingDelay": 5,
|
||||||
"AccountPlayingDelay": 5,
|
"AccountPlayingDelay": 5,
|
||||||
"LoginLimiterDelay": 7,
|
"LoginLimiterDelay": 7,
|
||||||
|
|||||||
Reference in New Issue
Block a user