mirror of
https://gitlab.com/Kwoth/nadekobot.git
synced 2025-09-12 02:08:27 -04:00
Replaced .wheel with .lula (lucky ladder). It looks nicer but plays the same. Also it is more customizable as you can have more or less multipliers. Cleaned up some trivia code. Sorted lula multipliers in gambling.yml. Improved .slottest
This commit is contained in:
@@ -834,7 +834,7 @@ public partial class Gambling : GamblingModule<GamblingService>
|
||||
new[] { "⬆", "↖", "⬅", "↙", "⬇", "↘", "➡", "↗" }.ToImmutableArray();
|
||||
|
||||
[Cmd]
|
||||
public async partial Task WheelOfFortune(ShmartNumber amount)
|
||||
public async partial Task LuckyLadder(ShmartNumber amount)
|
||||
{
|
||||
if (!await CheckBetMandatory(amount))
|
||||
return;
|
||||
@@ -846,13 +846,29 @@ public partial class Gambling : GamblingModule<GamblingService>
|
||||
return;
|
||||
}
|
||||
|
||||
var wofMultipliers = Config.WheelOfFortune.Multipliers;
|
||||
await SendConfirmAsync(Format.Bold($@"{ctx.User} won: {N(result.Won)}
|
||||
var multis = result.Multipliers;
|
||||
|
||||
『{wofMultipliers[1]}』 『{wofMultipliers[0]}』 『{wofMultipliers[7]}』
|
||||
var sb = new StringBuilder();
|
||||
foreach (var multi in multis)
|
||||
{
|
||||
sb.Append($"╠══╣");
|
||||
|
||||
『{wofMultipliers[2]}』 {_emojis[result.Index]} 『{wofMultipliers[6]}』
|
||||
if (multi == result.Multiplier)
|
||||
sb.Append($"{Format.Bold($"x{multi:0.##}")} ⬅️");
|
||||
else
|
||||
sb.Append($"||x{multi:0.##}||");
|
||||
|
||||
sb.AppendLine();
|
||||
}
|
||||
|
||||
『{wofMultipliers[3]}』 『{wofMultipliers[4]}』 『{wofMultipliers[5]}』"));
|
||||
var eb = _eb.Create(ctx)
|
||||
.WithOkColor()
|
||||
.WithDescription(sb.ToString())
|
||||
.AddField(GetText(strs.multiplier), $"{result.Multiplier:0.##}x", true)
|
||||
.AddField(GetText(strs.won), $"{(long)result.Won}", true)
|
||||
.WithAuthor(ctx.User);
|
||||
|
||||
|
||||
await ctx.Channel.EmbedAsync(eb);
|
||||
}
|
||||
}
|
@@ -39,8 +39,8 @@ Set 0 for unlimited")]
|
||||
[Comment(@"How much will each user's owned currency decay over time.")]
|
||||
public DecayConfig Decay { get; set; }
|
||||
|
||||
[Comment(@"Settings for Wheel Of Fortune command.")]
|
||||
public WheelOfFortuneSettings WheelOfFortune { get; set; }
|
||||
[Comment(@"Settings for LuckyLadder command")]
|
||||
public LuckyLadderSettings LuckyLadder { get; set; }
|
||||
|
||||
[Comment(@"Settings related to waifus")]
|
||||
public WaifuConfig Waifu { get; set; }
|
||||
@@ -59,7 +59,6 @@ This will work only if you've set up VotesApi and correct credentials for topgg
|
||||
public GamblingConfig()
|
||||
{
|
||||
BetRoll = new();
|
||||
WheelOfFortune = new();
|
||||
Waifu = new();
|
||||
Currency = new();
|
||||
BetFlip = new();
|
||||
@@ -67,6 +66,7 @@ This will work only if you've set up VotesApi and correct credentials for topgg
|
||||
Timely = new();
|
||||
Decay = new();
|
||||
Slots = new();
|
||||
LuckyLadder = new();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -173,13 +173,13 @@ public partial class DecayConfig
|
||||
}
|
||||
|
||||
[Cloneable]
|
||||
public partial class WheelOfFortuneSettings
|
||||
public partial class LuckyLadderSettings
|
||||
{
|
||||
[Comment(@"Self-Explanatory. Has to have 8 values, otherwise the command won't work.")]
|
||||
public decimal[] Multipliers { get; set; }
|
||||
|
||||
public WheelOfFortuneSettings()
|
||||
=> Multipliers = new[] { 1.7M, 1.5M, 0.2M, 0.1M, 0.3M, 0.5M, 1.2M, 2.4M };
|
||||
public LuckyLadderSettings()
|
||||
=> Multipliers = new[] { 2.4M, 1.7M, 1.5M, 1.2M, 0.5M, 0.3M, 0.2M, 0.1M };
|
||||
}
|
||||
|
||||
[Cloneable]
|
||||
|
@@ -174,5 +174,13 @@ public sealed class GamblingConfigService : ConfigServiceBase<GamblingConfig>
|
||||
c.Version = 5;
|
||||
});
|
||||
}
|
||||
|
||||
if (data.Version < 6)
|
||||
{
|
||||
ModifyConfig(c =>
|
||||
{
|
||||
c.Version = 6;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
@@ -81,6 +81,11 @@ public partial class Gambling
|
||||
if (tests <= 0)
|
||||
return;
|
||||
//multi vs how many times it occured
|
||||
|
||||
int streak = 0;
|
||||
int maxW = 0;
|
||||
int maxL = 0;
|
||||
|
||||
var dict = new Dictionary<decimal, int>();
|
||||
for (var i = 0; i < tests; i++)
|
||||
{
|
||||
@@ -90,16 +95,39 @@ public partial class Gambling
|
||||
dict[multi] += 1;
|
||||
else
|
||||
dict.Add(multi, 1);
|
||||
}
|
||||
|
||||
if (multi == 0)
|
||||
{
|
||||
if (streak <= 0)
|
||||
--streak;
|
||||
else
|
||||
streak = -1;
|
||||
|
||||
maxL = Math.Max(maxL, -streak);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (streak >= 0)
|
||||
++streak;
|
||||
else
|
||||
streak = 1;
|
||||
|
||||
maxW = Math.Max(maxW, streak);
|
||||
}
|
||||
}
|
||||
|
||||
var sb = new StringBuilder();
|
||||
decimal payout = 0;
|
||||
foreach (var key in dict.Keys.OrderByDescending(x => x))
|
||||
{
|
||||
sb.AppendLine($"x{key} occured {dict[key]} times. {dict[key] * 1.0f / tests * 100}%");
|
||||
sb.AppendLine($"x{key} occured `{dict[key]}` times. {dict[key] * 1.0f / tests * 100}%");
|
||||
payout += key * dict[key];
|
||||
}
|
||||
|
||||
sb.AppendLine();
|
||||
sb.AppendLine($"Longest win streak: `{maxW}`");
|
||||
sb.AppendLine($"Longest lose streak: `{maxL}`");
|
||||
|
||||
await SendConfirmAsync("Slot Test Results",
|
||||
sb.ToString(),
|
||||
footer: $"Total Bet: {tests} | Payout: {payout:F0} | {payout * 1.0M / tests * 100}%");
|
||||
|
@@ -7,7 +7,7 @@ namespace NadekoBot.Modules.Gambling;
|
||||
|
||||
public interface IGamblingService
|
||||
{
|
||||
Task<OneOf<WofResult, GamblingError>> WofAsync(ulong userId, long amount);
|
||||
Task<OneOf<LuLaResult, GamblingError>> WofAsync(ulong userId, long amount);
|
||||
Task<OneOf<BetrollResult, GamblingError>> BetRollAsync(ulong userId, long amount);
|
||||
Task<OneOf<BetflipResult, GamblingError>> BetFlipAsync(ulong userId, long amount, byte guess);
|
||||
Task<OneOf<SlotResult, GamblingError>> SlotAsync(ulong userId, long amount);
|
||||
|
@@ -19,7 +19,7 @@ public sealed class NewGamblingService : IGamblingService, INService
|
||||
|
||||
// todo input checks
|
||||
// todo ladder of fortune
|
||||
public async Task<OneOf<WofResult, GamblingError>> WofAsync(ulong userId, long amount)
|
||||
public async Task<OneOf<LuLaResult, GamblingError>> WofAsync(ulong userId, long amount)
|
||||
{
|
||||
if (amount < 0)
|
||||
throw new ArgumentOutOfRangeException(nameof(amount));
|
||||
@@ -34,7 +34,7 @@ public sealed class NewGamblingService : IGamblingService, INService
|
||||
}
|
||||
}
|
||||
|
||||
var game = new WofGame(_bcs.Data.WheelOfFortune.Multipliers);
|
||||
var game = new LulaGame(_bcs.Data.LuckyLadder.Multipliers);
|
||||
var result = game.Spin(amount);
|
||||
|
||||
var won = (long)result.Won;
|
||||
|
Reference in New Issue
Block a user