diff --git a/ArchiSteamFarm/Bot.cs b/ArchiSteamFarm/Bot.cs index e21fff98a..68c463858 100755 --- a/ArchiSteamFarm/Bot.cs +++ b/ArchiSteamFarm/Bot.cs @@ -406,7 +406,7 @@ namespace ArchiSteamFarm { return appID; } - string[] dlcAppIDsString = listOfDlc.Split(','); + string[] dlcAppIDsString = listOfDlc.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries); foreach (string dlcAppIDString in dlcAppIDsString) { uint dlcAppID; if (!uint.TryParse(dlcAppIDString, out dlcAppID)) { @@ -794,7 +794,7 @@ namespace ArchiSteamFarm { string[] botNames = args.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries); HashSet result = new HashSet(); - foreach (string botName in botNames.Where(botName => !string.IsNullOrEmpty(botName))) { + foreach (string botName in botNames) { if (botName.Equals(SharedInfo.ASF, StringComparison.OrdinalIgnoreCase)) { foreach (Bot bot in Bots.OrderBy(bot => bot.Key).Select(bot => bot.Value)) { result.Add(bot); @@ -1912,7 +1912,7 @@ namespace ArchiSteamFarm { string[] gameIDs = games.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries); HashSet gamesToRedeem = new HashSet(); - foreach (string game in gameIDs.Where(game => !string.IsNullOrEmpty(game))) { + foreach (string game in gameIDs) { uint gameID; if (!uint.TryParse(game, out gameID)) { return FormatBotResponse(string.Format(Strings.ErrorParsingObject, nameof(gameID))); @@ -2250,19 +2250,24 @@ namespace ArchiSteamFarm { StringBuilder response = new StringBuilder(); string[] games = query.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries); - foreach (string game in games.Where(game => !string.IsNullOrEmpty(game))) { - // Check if this is appID - uint appID; - if (uint.TryParse(game, out appID)) { + foreach (string game in games) { + // Check if this is gameID + uint gameID; + if (uint.TryParse(game, out gameID)) { + if (OwnedPackageIDs.Contains(gameID)) { + response.Append(FormatBotResponse(string.Format(Strings.BotOwnedAlready, gameID))); + continue; + } + string ownedName; - response.Append(FormatBotResponse(ownedGames.TryGetValue(appID, out ownedName) ? string.Format(Strings.BotOwnedAlready, appID, ownedName) : string.Format(Strings.BotNotOwnedYet, appID))); + response.Append(FormatBotResponse(ownedGames.TryGetValue(gameID, out ownedName) ? string.Format(Strings.BotOwnedAlreadyWithName, gameID, ownedName) : string.Format(Strings.BotNotOwnedYet, gameID))); continue; } // This is a string, so check our entire library foreach (KeyValuePair ownedGame in ownedGames.Where(ownedGame => ownedGame.Value.IndexOf(game, StringComparison.OrdinalIgnoreCase) >= 0)) { - response.Append(FormatBotResponse(string.Format(Strings.BotOwnedAlready, ownedGame.Key, ownedGame.Value))); + response.Append(FormatBotResponse(string.Format(Strings.BotOwnedAlreadyWithName, ownedGame.Key, ownedGame.Value))); } } @@ -2442,7 +2447,7 @@ namespace ArchiSteamFarm { string[] gameIDs = games.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries); HashSet gamesToPlay = new HashSet(); - foreach (string game in gameIDs.Where(game => !string.IsNullOrEmpty(game))) { + foreach (string game in gameIDs) { uint gameID; if (!uint.TryParse(game, out gameID)) { return FormatBotResponse(string.Format(Strings.ErrorParsingObject, nameof(gameID))); diff --git a/ArchiSteamFarm/Localization/Strings.Designer.cs b/ArchiSteamFarm/Localization/Strings.Designer.cs index fd6c3ab30..805f0339f 100644 --- a/ArchiSteamFarm/Localization/Strings.Designer.cs +++ b/ArchiSteamFarm/Localization/Strings.Designer.cs @@ -475,7 +475,7 @@ namespace ArchiSteamFarm.Localization { } /// - /// Looks up a localized string similar to Owned already: {0} | {1}. + /// Looks up a localized string similar to Owned already: {0}. /// internal static string BotOwnedAlready { get { @@ -483,6 +483,15 @@ namespace ArchiSteamFarm.Localization { } } + /// + /// Looks up a localized string similar to Owned already: {0} | {1}. + /// + internal static string BotOwnedAlreadyWithName { + get { + return ResourceManager.GetString("BotOwnedAlreadyWithName", resourceCulture); + } + } + /// /// Looks up a localized string similar to Rate limit exceeded, we will retry after {0} minutes of cooldown.... /// diff --git a/ArchiSteamFarm/Localization/Strings.resx b/ArchiSteamFarm/Localization/Strings.resx index 5160eac05..a6015cd5f 100644 --- a/ArchiSteamFarm/Localization/Strings.resx +++ b/ArchiSteamFarm/Localization/Strings.resx @@ -381,11 +381,11 @@ StackTrace: Bot is idling game: {0} ({1}, {2} card drops remaining) from a total of {3} games ({4} cards) left to idle (~{5} remaining). - {0} will be replaced by game's appID (number), {1} will be replaced by game's name, {2} will be replaced by number of cards left to idle, {3} will be replaced by total number of games to idle, {4} will be replaced by total number of cards to idle, {5} will be replaced by translated TimeSpan string built from TimeSpan* translation parts + {0} will be replaced by game's ID (number), {1} will be replaced by game's name, {2} will be replaced by number of cards left to idle, {3} will be replaced by total number of games to idle, {4} will be replaced by total number of cards to idle, {5} will be replaced by translated TimeSpan string built from TimeSpan* translation parts Bot is idling games: {0} from a total of {1} games ({2} cards) left to idle (~{3} remaining). - {0} will be replaced by list of the games (appIDs, numbers), {1} will be replaced by total number of games to idle, {2} will be replaced by total number of cards to idle, {3} will be replaced by translated TimeSpan string built from TimeSpan* translation parts + {0} will be replaced by list of the games (IDs, numbers), {1} will be replaced by total number of games to idle, {2} will be replaced by total number of cards to idle, {3} will be replaced by translated TimeSpan string built from TimeSpan* translation parts Checking first badge page... @@ -409,15 +409,15 @@ StackTrace: Finished idling: {0} ({1}) after {2} of playtime! - {0} will be replaced by game's appID (number), {1} will be replaced by game's name, {2} will be replaced by translated TimeSpan string built from TimeSpan* translation parts + {0} will be replaced by game's ID (number), {1} will be replaced by game's name, {2} will be replaced by translated TimeSpan string built from TimeSpan* translation parts Finished idling games: {0} - {0} will be replaced by list of the games (appIDs, numbers), separated by a comma + {0} will be replaced by list of the games (IDs, numbers), separated by a comma Idling status for {0} ({1}): {2} cards remaining - {0} will be replaced by game's appID (number), {1} will be replaced by game's name, {2} will be replaced by number of cards left to idle + {0} will be replaced by game's ID (number), {1} will be replaced by game's name, {2} will be replaced by number of cards left to idle Idling stopped! @@ -430,30 +430,30 @@ StackTrace: Now idling: {0} ({1}) - {0} will be replaced by game's appID (number), {1} will be replaced by game's name + {0} will be replaced by game's ID (number), {1} will be replaced by game's name Now idling: {0} - {0} will be replaced by list of the games (appIDs, numbers), separated by a comma + {0} will be replaced by list of the games (IDs, numbers), separated by a comma Playing is currently unavailable, we'll try again later! Still idling: {0} ({1}) - {0} will be replaced by game's appID (number), {1} will be replaced by game's name + {0} will be replaced by game's ID (number), {1} will be replaced by game's name Still idling: {0} - {0} will be replaced by list of the games (appIDs, numbers), separated by a comma + {0} will be replaced by list of the games (IDs, numbers), separated by a comma Stopped idling: {0} ({1}) - {0} will be replaced by game's appID (number), {1} will be replaced by game's name + {0} will be replaced by game's ID (number), {1} will be replaced by game's name Stopped idling: {0} - {0} will be replaced by list of the games (appIDs, numbers), separated by a comma + {0} will be replaced by list of the games (IDs, numbers), separated by a comma Unknown command! @@ -463,7 +463,7 @@ StackTrace: Could not check cards status for: {0} ({1}), we will try again later! - {0} will be replaced by game's appID (number), {1} will be replaced by game's name + {0} will be replaced by game's ID (number), {1} will be replaced by game's name Accepting gift: {0}... @@ -478,7 +478,7 @@ StackTrace: GameID: {0} | Status: {1} | Items: {2} - {0} will be replaced by gameID (number), {1} will be replaced by status string, {2} will be replaced by list of granted appIDs (numbers), separated by a comma + {0} will be replaced by gameID (number), {1} will be replaced by status string, {2} will be replaced by list of granted IDs (numbers), separated by a comma This bot is already running! @@ -580,9 +580,9 @@ StackTrace: Not owned yet: {0} {0} will be replaced by query (string) - + Owned already: {0} | {1} - {0} will be replaced by game's appID (number), {1} will be replaced by game's name + {0} will be replaced by game's ID (number), {1} will be replaced by game's name Rate limit exceeded, we will retry after {0} minutes of cooldown... @@ -691,11 +691,11 @@ StackTrace: Idling {0} ({1}) is temporarily disabled, as ASF is not able to play that game at the moment. - {0} will be replaced by game's appID (number), {1} will be replaced by game's name + {0} will be replaced by game's ID (number), {1} will be replaced by game's name - ASF detected appID mismatch for {0} ({1}) and will use appID of {2} instead. - {0} will be replaced by game's appID (number), {1} will be replaced by game's name, {2} will be replaced by game's appID (number) + ASF detected ID mismatch for {0} ({1}) and will use ID of {2} instead. + {0} will be replaced by game's ID (number), {1} will be replaced by game's name, {2} will be replaced by game's ID (number) {0} V{1} @@ -710,4 +710,8 @@ StackTrace: This function is available only in headless mode! + + Owned already: {0} + {0} will be replaced by game's ID (number), {1} will be replaced by game's name + \ No newline at end of file