You can now specify 'allin' instead of the amount when playing .wheel, .br and .bf
This commit is contained in:
parent
8c278fd1bd
commit
2a411a00a6
@ -20,14 +20,16 @@ namespace NadekoBot.Modules.Gambling
|
|||||||
private readonly IImageCache _images;
|
private readonly IImageCache _images;
|
||||||
private readonly IBotConfigProvider _bc;
|
private readonly IBotConfigProvider _bc;
|
||||||
private readonly CurrencyService _cs;
|
private readonly CurrencyService _cs;
|
||||||
|
private readonly DbService _db;
|
||||||
private static readonly NadekoRandom rng = new NadekoRandom();
|
private static readonly NadekoRandom rng = new NadekoRandom();
|
||||||
|
|
||||||
public FlipCoinCommands(IDataCache data, CurrencyService cs, IBotConfigProvider bc)
|
public FlipCoinCommands(IDataCache data, CurrencyService cs,
|
||||||
|
IBotConfigProvider bc, DbService db)
|
||||||
{
|
{
|
||||||
_images = data.LocalImages;
|
_images = data.LocalImages;
|
||||||
_bc = bc;
|
_bc = bc;
|
||||||
_cs = cs;
|
_cs = cs;
|
||||||
|
_db = db;
|
||||||
}
|
}
|
||||||
|
|
||||||
[NadekoCommand, Usage, Description, Aliases]
|
[NadekoCommand, Usage, Description, Aliases]
|
||||||
@ -86,7 +88,18 @@ namespace NadekoBot.Modules.Gambling
|
|||||||
}
|
}
|
||||||
|
|
||||||
[NadekoCommand, Usage, Description, Aliases]
|
[NadekoCommand, Usage, Description, Aliases]
|
||||||
public async Task Betflip(int amount, BetFlipGuess guess)
|
public Task Betflip(Allin _, BetFlipGuess guess)
|
||||||
|
{
|
||||||
|
long cur;
|
||||||
|
using (var uow = _db.UnitOfWork)
|
||||||
|
{
|
||||||
|
cur = uow.Currency.GetUserCurrency(Context.User.Id);
|
||||||
|
}
|
||||||
|
return Betflip(cur, guess);
|
||||||
|
}
|
||||||
|
|
||||||
|
[NadekoCommand, Usage, Description, Aliases]
|
||||||
|
public async Task Betflip(long amount, BetFlipGuess guess)
|
||||||
{
|
{
|
||||||
if (amount < _bc.BotConfig.MinimumBetAmount)
|
if (amount < _bc.BotConfig.MinimumBetAmount)
|
||||||
{
|
{
|
||||||
|
@ -278,9 +278,9 @@ namespace NadekoBot.Modules.Gambling
|
|||||||
// });
|
// });
|
||||||
// return Task.CompletedTask;
|
// return Task.CompletedTask;
|
||||||
//}
|
//}
|
||||||
|
public enum Allin { Allin, All }
|
||||||
|
|
||||||
[NadekoCommand, Usage, Description, Aliases]
|
private async Task InternallBetroll(long amount)
|
||||||
public async Task BetRoll(long amount)
|
|
||||||
{
|
{
|
||||||
if (amount < 1)
|
if (amount < 1)
|
||||||
return;
|
return;
|
||||||
@ -321,6 +321,21 @@ namespace NadekoBot.Modules.Gambling
|
|||||||
await Context.Channel.SendConfirmAsync(str).ConfigureAwait(false);
|
await Context.Channel.SendConfirmAsync(str).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[NadekoCommand, Usage, Description, Aliases]
|
||||||
|
public Task BetRoll(long amount)
|
||||||
|
=> InternallBetroll(amount);
|
||||||
|
|
||||||
|
[NadekoCommand, Usage, Description, Aliases]
|
||||||
|
public Task BetRoll(Allin _)
|
||||||
|
{
|
||||||
|
long cur;
|
||||||
|
using (var uow = _db.UnitOfWork)
|
||||||
|
{
|
||||||
|
cur = uow.Currency.GetUserCurrency(Context.User.Id);
|
||||||
|
}
|
||||||
|
return InternallBetroll(cur);
|
||||||
|
}
|
||||||
|
|
||||||
[NadekoCommand, Usage, Description, Aliases]
|
[NadekoCommand, Usage, Description, Aliases]
|
||||||
public async Task Leaderboard(int page = 1)
|
public async Task Leaderboard(int page = 1)
|
||||||
{
|
{
|
||||||
|
@ -15,16 +15,31 @@ namespace NadekoBot.Modules.Gambling
|
|||||||
{
|
{
|
||||||
private readonly CurrencyService _cs;
|
private readonly CurrencyService _cs;
|
||||||
private readonly IBotConfigProvider _bc;
|
private readonly IBotConfigProvider _bc;
|
||||||
|
private readonly DbService _db;
|
||||||
|
|
||||||
public WheelOfFortuneCommands(CurrencyService cs, IBotConfigProvider bc)
|
public WheelOfFortuneCommands(CurrencyService cs, IBotConfigProvider bc,
|
||||||
|
DbService db)
|
||||||
{
|
{
|
||||||
_cs = cs;
|
_cs = cs;
|
||||||
_bc = bc;
|
_bc = bc;
|
||||||
|
_db = db;
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum Allin { Allin, All }
|
||||||
|
|
||||||
|
[NadekoCommand, Usage, Description, Aliases]
|
||||||
|
public Task WheelOfFortune(Allin _)
|
||||||
|
{
|
||||||
|
long cur;
|
||||||
|
using (var uow = _db.UnitOfWork)
|
||||||
|
{
|
||||||
|
cur = uow.Currency.GetUserCurrency(Context.User.Id);
|
||||||
|
}
|
||||||
|
return WheelOfFortune(cur);
|
||||||
}
|
}
|
||||||
|
|
||||||
[NadekoCommand, Usage, Description, Aliases]
|
[NadekoCommand, Usage, Description, Aliases]
|
||||||
[RequireContext(ContextType.Guild)]
|
public async Task WheelOfFortune(long bet)
|
||||||
public async Task WheelOfFortune(int bet)
|
|
||||||
{
|
{
|
||||||
const int minBet = 10;
|
const int minBet = 10;
|
||||||
if (bet < minBet)
|
if (bet < minBet)
|
||||||
|
Loading…
Reference in New Issue
Block a user