public async Task GetChipsAsync(long amount = 0) { if (amount < 0) { await Context.Channel.SendMessageAsync($"> 👁️ You can't specify a **negative** value.\n> *\"I know what you were trying to do.\"*"); return; } if (amount == 0) { // $"> ⚠️ You need to specify a positive amount of **Orite** to convert. await Context.Channel.SendMessageAsync(CommandDetailsViewer.WriteGetChips()); return; } if (amount > Context.Account.Balance) { await Context.Channel.SendMessageAsync($"> ⚠️ You don't have enough **Orite** to convert this amount."); return; } var chips = MoneyConvert.ToChips(amount); Context.Account.Take(amount); Context.Account.ChipBalance += chips; await Context.Channel.SendMessageAsync($"> You have traded in **💸 {amount:##,0}** in exchange for **🧩 {chips:##,0}**."); }
public async Task CashOutAsync(long amount = 0) { if (amount < 0) { await Context.Channel.SendMessageAsync($"> 👁️ You can't specify a **negative** value.\n> *\"I know what you were trying to do.\"*"); return; } if (amount == 0) { // $"> ⚠️ You need to specify a positive amount of **Orite** to convert. await Context.Channel.SendMessageAsync(CommandDetailsViewer.WriteCashOut()); return; } if (amount > Context.Account.TokenBalance) { await Context.Channel.SendMessageAsync($"> ⚠️ You don't have enough **Tokens** to convert this amount."); return; } long money = MoneyConvert.TokensToMoney(amount); Context.Account.Take(amount, CurrencyType.Tokens); Context.Account.Give(money, CurrencyType.Money); await Context.Channel.SendMessageAsync($"> You have traded in **{Icons.Tokens} {amount:##,0}** in exchange for **{Icons.Balance} {money:##,0}**."); }
public async Task DoublerAsync(long wager = 0, int expectedTick = 1, TickWinMethod method = TickWinMethod.Below) { if (wager < 0) { await Context.Channel.SendMessageAsync($"> 👁️ You can't specify a **negative** value.\n> *\"I know what you were trying to do.\"*"); return; } if (wager == 0) { // $"> ⚠️ You need to specify a positive amount of **Chips** to bet." await Context.Channel.SendMessageAsync(CommandDetailsViewer.WriteTick()); return; } if (wager > Context.Account.ChipBalance) { await Context.Channel.SendMessageAsync($"> ⚠️ You don't have enough **Chips** to bet with."); return; } if (expectedTick <= 0) { await Context.Channel.SendMessageAsync($"> ⚠️ You have specified an invalid tick. Try something that's above **0**."); return; } var tick = new Tick(expectedTick, method); TickResult result = tick.Next(wager, Context.Account.GetVar(TickStats.CurrentLossStreak)); Message message = result.ApplyAndDisplay(Context.Account); await Context.Channel.SendMessageAsync(Context.Account, message); }