Skip to content

Commit

Permalink
Include non-pending amounts in value command
Browse files Browse the repository at this point in the history
  • Loading branch information
Citrinate committed Jul 31, 2024
1 parent 2de4e85 commit 55076c5
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
15 changes: 12 additions & 3 deletions BoosterManager/Handlers/MarketHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,22 @@ internal static async Task<string> 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<uint?> GetMarketListingsValue(Bot bot) {
Expand Down
8 changes: 8 additions & 0 deletions BoosterManager/Localization/Strings.resx
Original file line number Diff line number Diff line change
Expand Up @@ -565,4 +565,12 @@
<value>Failed to fetch marketable apps data</value>
<comment/>
</data>
<data name="AccountValueRemainingWithDelayed" xml:space="preserve">
<value>Remaining: {0} ({1}) {2}</value>
<comment>{0} will be replaced by a number, {1} will be replaced by a number, {2} will be replaced by a currency name</comment>
</data>
<data name="AccountValueWithDelayed" xml:space="preserve">
<value>Value: {0} ({1}) {2}</value>
<comment>{0} will be replaced by a number, {1} will be replaced by a number, {2} will be replaced by a currency name</comment>
</data>
</root>

0 comments on commit 55076c5

Please sign in to comment.