From 55076c5161ee59a6873b2db88b518f312a82628b Mon Sep 17 00:00:00 2001 From: Citrinate Date: Wed, 31 Jul 2024 17:33:17 -0400 Subject: [PATCH] Include non-pending amounts in value command --- BoosterManager/Handlers/MarketHandler.cs | 15 ++++++++++++--- BoosterManager/Localization/Strings.resx | 8 ++++++++ 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/BoosterManager/Handlers/MarketHandler.cs b/BoosterManager/Handlers/MarketHandler.cs index 0a0c80b..20b048b 100644 --- a/BoosterManager/Handlers/MarketHandler.cs +++ b/BoosterManager/Handlers/MarketHandler.cs @@ -31,13 +31,22 @@ internal static async Task GetValue(Bot bot, uint subtractFrom = 0) { return Strings.MarketListingsFetchFailed; } - var value = (listingsValue + bot.WalletBalance + bot.WalletBalanceDelayed) / 100.0; + var value = (listingsValue + bot.WalletBalance) / 100.0; + var valueWithDelayed = (listingsValue + bot.WalletBalance + bot.WalletBalanceDelayed) / 100.0; if (subtractFrom != 0) { - return Commands.FormatBotResponse(bot, String.Format(Strings.AccountValueRemaining, String.Format("{0:#,#0.00}", subtractFrom - value), bot.WalletCurrency.ToString())); + if (bot.WalletBalanceDelayed > 0) { + return Commands.FormatBotResponse(bot, String.Format(Strings.AccountValueRemainingWithDelayed, String.Format("{0:#,#0.00}", subtractFrom - value), String.Format("{0:#,#0.00}", subtractFrom - valueWithDelayed), bot.WalletCurrency.ToString())); + } else { + return Commands.FormatBotResponse(bot, String.Format(Strings.AccountValueRemaining, String.Format("{0:#,#0.00}", subtractFrom - value), bot.WalletCurrency.ToString())); + } } - return Commands.FormatBotResponse(bot, String.Format(Strings.AccountValue, String.Format("{0:#,#0.00}", value), bot.WalletCurrency.ToString())); + if (bot.WalletBalanceDelayed > 0) { + return Commands.FormatBotResponse(bot, String.Format(Strings.AccountValueWithDelayed, String.Format("{0:#,#0.00}", value), String.Format("{0:#,#0.00}", valueWithDelayed), bot.WalletCurrency.ToString())); + } else { + return Commands.FormatBotResponse(bot, String.Format(Strings.AccountValue, String.Format("{0:#,#0.00}", value), bot.WalletCurrency.ToString())); + } } private static async Task GetMarketListingsValue(Bot bot) { diff --git a/BoosterManager/Localization/Strings.resx b/BoosterManager/Localization/Strings.resx index a413979..0938fa1 100644 --- a/BoosterManager/Localization/Strings.resx +++ b/BoosterManager/Localization/Strings.resx @@ -565,4 +565,12 @@ Failed to fetch marketable apps data + + Remaining: {0} ({1}) {2} + {0} will be replaced by a number, {1} will be replaced by a number, {2} will be replaced by a currency name + + + Value: {0} ({1}) {2} + {0} will be replaced by a number, {1} will be replaced by a number, {2} will be replaced by a currency name + \ No newline at end of file