From 3c5bea6850daecc503cd72b46fd937428c3e6c06 Mon Sep 17 00:00:00 2001 From: JustArchi Date: Tue, 4 Oct 2016 22:02:34 +0200 Subject: [PATCH] Enhance !statusall --- ArchiSteamFarm/Bot.cs | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/ArchiSteamFarm/Bot.cs b/ArchiSteamFarm/Bot.cs index 01819faef..e61c14ee1 100755 --- a/ArchiSteamFarm/Bot.cs +++ b/ArchiSteamFarm/Bot.cs @@ -852,18 +852,12 @@ namespace ArchiSteamFarm { return null; } - StringBuilder result = new StringBuilder(Environment.NewLine); + HashSet botsRunning = new HashSet(Bots.Where(bot => bot.Value.KeepRunning).OrderBy(bot => bot.Key).Select(bot => bot.Value)); + IEnumerable statuses = botsRunning.Select(bot => bot.ResponseStatus(steamID)); - byte runningBotsCount = 0; - foreach (Bot bot in Bots.OrderBy(bot => bot.Key).Select(bot => bot.Value)) { - result.Append(bot.ResponseStatus(steamID) + Environment.NewLine); - if (bot.KeepRunning) { - runningBotsCount++; - } - } - - result.Append("There are " + runningBotsCount + "/" + Bots.Count + " bots running."); - return result.ToString(); + return Environment.NewLine + + string.Join(Environment.NewLine, statuses) + Environment.NewLine + + "There are " + botsRunning.Count + "/" + Bots.Count + " bots running, with total of " + botsRunning.Sum(bot => bot.CardsFarmer.GamesToFarm.Count) + " games (" + botsRunning.Sum(bot => bot.CardsFarmer.GamesToFarm.Sum(game => game.CardsRemaining)) + " cards) left to farm."; } private async Task ResponseLoot(ulong steamID) {