diff --git a/BoosterManager/Boosters/BoosterQueue.cs b/BoosterManager/Boosters/BoosterQueue.cs index 0de484c..1a319b9 100644 --- a/BoosterManager/Boosters/BoosterQueue.cs +++ b/BoosterManager/Boosters/BoosterQueue.cs @@ -105,7 +105,7 @@ internal void AddBooster(uint gameID, BoosterType type) { void handler() { try { if (!BoosterInfos.TryGetValue(gameID, out Steam.BoosterInfo? boosterInfo)) { - Bot.ArchiLogger.LogGenericError(String.Format("Can't craft boosters for {0}", gameID)); + Bot.ArchiLogger.LogGenericError(String.Format(Strings.BoosterUncraftable, gameID)); return; } @@ -118,7 +118,7 @@ void handler() { } if (!BoosterHandler.AllowCraftUnmarketableBoosters && !MarketableApps.AppIDs.Contains(gameID)) { - Bot.ArchiLogger.LogGenericError(String.Format("Won't craft unmarketable boosters for {0}", gameID)); + Bot.ArchiLogger.LogGenericError(String.Format(Strings.BoosterUnmarketable, gameID)); return; } @@ -203,11 +203,11 @@ private void VerifyCraftBoosterError(Booster booster) { // For any error we get, we'll need to refresh the booster page and see if the AvailableAtTime has changed to determine if we really failed to craft void handler() { try { - Bot.ArchiLogger.LogGenericInfo(String.Format("An error was encountered when trying to craft a booster from {0}, trying to resolve it now", booster.GameID)); + Bot.ArchiLogger.LogGenericInfo(String.Format(Strings.BoosterCreationError, booster.GameID)); if (!BoosterInfos.TryGetValue(booster.GameID, out Steam.BoosterInfo? newBoosterInfo)) { // No longer have access to craft boosters for this game (game removed from account, or sometimes due to very rare Steam bugs) - BoosterHandler.PerpareStatusReport(String.Format("No longer able to craft boosters from {0} ({1})", booster.Info.Name, booster.GameID)); + BoosterHandler.PerpareStatusReport(String.Format(Strings.BoosterUnexpectedlyUncraftable, booster.Info.Name, booster.GameID)); RemoveBooster(booster.GameID); CheckIfFinished(booster.Type); @@ -228,7 +228,7 @@ void handler() { return; } - Bot.ArchiLogger.LogGenericInfo(String.Format("Booster from {0} was not created, retrying", booster.GameID)); + Bot.ArchiLogger.LogGenericInfo(String.Format(Strings.BoosterCreationRetry, booster.GameID)); } finally { OnBoosterInfosUpdated -= handler; } diff --git a/BoosterManager/Commands.cs b/BoosterManager/Commands.cs index 6bbbc84..0861d33 100644 --- a/BoosterManager/Commands.cs +++ b/BoosterManager/Commands.cs @@ -798,11 +798,11 @@ internal static class Commands { } if (!uint.TryParse(appIDAsText, out uint appID)) { - return FormatBotResponse(bot, String.Format(Strings.ErrorIsInvalid, nameof(appIDAsText))); + return FormatBotResponse(bot, String.Format(ArchiSteamFarm.Localization.Strings.ErrorIsInvalid, nameof(appIDAsText))); } if (!ulong.TryParse(contextIDAsText, out ulong contextID)) { - return FormatBotResponse(bot, String.Format(Strings.ErrorIsInvalid, nameof(contextIDAsText))); + return FormatBotResponse(bot, String.Format(ArchiSteamFarm.Localization.Strings.ErrorIsInvalid, nameof(contextIDAsText))); } if (String.IsNullOrEmpty(itemIdentifierAsText)) { @@ -1285,7 +1285,7 @@ internal static class Commands { } if (!bot.IsConnectedAndLoggedOn) { - return FormatBotResponse(bot, Strings.BotNotConnected); + return FormatBotResponse(bot, ArchiSteamFarm.Localization.Strings.BotNotConnected); } return await MarketHandler.RemovePendingListings(bot).ConfigureAwait(false); @@ -1299,7 +1299,7 @@ internal static class Commands { Bot? bot = Bot.GetBot(botName); if (bot == null) { - return access >= EAccess.Owner ? FormatStaticResponse(String.Format(Strings.BotNotFound, botName)) : null; + return access >= EAccess.Owner ? FormatStaticResponse(String.Format(ArchiSteamFarm.Localization.Strings.BotNotFound, botName)) : null; } return await ResponseRemovePendingListings(bot, ArchiSteamFarm.Steam.Interaction.Commands.GetProxyAccess(bot, access, steamID)).ConfigureAwait(false); @@ -1379,7 +1379,7 @@ internal static class Commands { (bool success, string message) = await bot.Actions.SendInventory(appID: appID, contextID: contextID, targetSteamID: targetSteamID, filterFunction: item => itemIdentifiers.Any(itemIdentifier => itemIdentifier.IsItemMatch(item))).ConfigureAwait(false); - return FormatBotResponse(bot, success ? message : String.Format(Strings.WarningFailedWithError, message)); + return FormatBotResponse(bot, success ? message : String.Format(ArchiSteamFarm.Localization.Strings.WarningFailedWithError, message)); } private static async Task ResponseSendItemToBot(EAccess access, ulong steamID, string senderBotNames, ItemIdentifier itemIdentifier, bool? marketable = null, string? recieverBotName = null) { diff --git a/BoosterManager/Handlers/InventoryHandler.cs b/BoosterManager/Handlers/InventoryHandler.cs index 933ae23..b389606 100644 --- a/BoosterManager/Handlers/InventoryHandler.cs +++ b/BoosterManager/Handlers/InventoryHandler.cs @@ -206,7 +206,7 @@ internal static async Task GetItemCount(Bot bot, uint appID, ulong conte inventory = await bot.ArchiWebHandler.GetInventoryAsync(appID: appID, contextID: contextID).Where(item => itemIdentifier.IsItemMatch(item)).ToHashSetAsync().ConfigureAwait(false); } catch (Exception e) { bot.ArchiLogger.LogGenericException(e); - return Commands.FormatBotResponse(bot, Strings.WarningFailed); + return Commands.FormatBotResponse(bot, ArchiSteamFarm.Localization.Strings.WarningFailed); } (uint tradable, uint untradable) items = (0,0); @@ -219,9 +219,13 @@ internal static async Task GetItemCount(Bot bot, uint appID, ulong conte } } - return Commands.FormatBotResponse(bot, String.Format("Tradable: {0:N0}{1}", items.tradable, - (items.untradable) == 0 ? "" : String.Format("; Untradable: {0:N0}", items.untradable)) - ); + string response = String.Format(Strings.ItemsCountTradable, String.Format("{0:N0}", items.tradable)); + + if (items.untradable > 0) { + response += String.Format("; {0}", String.Format(Strings.ItemsCountUntradable, String.Format("{0:N0}", items.untradable))); + } + + return Commands.FormatBotResponse(bot, response); } } } diff --git a/BoosterManager/Handlers/MarketHandler.cs b/BoosterManager/Handlers/MarketHandler.cs index 18f7ea2..6553bcb 100644 --- a/BoosterManager/Handlers/MarketHandler.cs +++ b/BoosterManager/Handlers/MarketHandler.cs @@ -95,11 +95,11 @@ internal static async Task RemovePendingListings(Bot bot) { (Steam.MarketListingsResponse? marketListings, _) = await WebRequest.GetMarketListings(bot).ConfigureAwait(false); if (marketListings == null || marketListings.ListingsToConfirm == null || !marketListings.Success) { - return "Failed to load Market Listings"; + return Strings.MarketListingsFetchFailed; } if (marketListings.ListingsToConfirm.Count == 0) { - return "No pending market listings found"; + return Strings.PendingListingsNotFound; } HashSet pendingListingIDs = new(); @@ -108,14 +108,14 @@ internal static async Task RemovePendingListings(Bot bot) { if (listing == null) { bot.ArchiLogger.LogNullError(listing); - return "Failed to load Market Listings"; + return Strings.MarketListingsFetchFailed; } ulong? listingid = listing["listingid"]?.ToString().ToJsonObject(); if (listingid == null) { bot.ArchiLogger.LogNullError(listingid); - return "Failed to load Market Listings"; + return Strings.MarketListingsFetchFailed; } pendingListingIDs.Add(listingid.Value); @@ -131,10 +131,10 @@ internal static async Task RemovePendingListings(Bot bot) { } if (failedToRemove != 0) { - return String.Format("Successfully removed {0} pending market listings, failed to remove {1} listings", pendingListingIDs.Count - failedToRemove, failedToRemove); + return String.Format(Strings.PendingListingsRemovedFailed, pendingListingIDs.Count - failedToRemove, failedToRemove); } - return String.Format("Successfully removed {0} pending market listings", pendingListingIDs.Count); + return String.Format(Strings.PendingListingsRemovedSuccess, pendingListingIDs.Count); } internal static async Task FindAndRemoveListings(Bot bot, List itemIdentifiers) { diff --git a/BoosterManager/Localization/Strings.resx b/BoosterManager/Localization/Strings.resx index 6048867..63f79ec 100644 --- a/BoosterManager/Localization/Strings.resx +++ b/BoosterManager/Localization/Strings.resx @@ -509,4 +509,20 @@ Bot has {0} incoming trades {0} will be replaced by a number + + No pending market listings found + + + + Successfully removed {0} pending market listings, failed to remove {1} listings + {0} will be replaced by a number, {1} will be replaced by a number + + + Successfully removed {0} pending market listings + {0} will be replaced by a number + + + Won't craft unmarketable boosters for {0} + {0} will be replaced by an appID + \ No newline at end of file