Now modifyable: Trivia flower win amount (default 0), minimum bet amount (default 3), betflip multiplier (default 1.8), currency drop amount (default 1), betroll multipliers on 67+/91+/100+ (default 2/3/10)
This commit is contained in:
parent
cdad149b0d
commit
2ecec9d0a4
@ -96,8 +96,18 @@ namespace NadekoBot.Migrations
|
|||||||
b.Property<int>("Id")
|
b.Property<int>("Id")
|
||||||
.ValueGeneratedOnAdd();
|
.ValueGeneratedOnAdd();
|
||||||
|
|
||||||
|
b.Property<float>("BetflipMultiplier");
|
||||||
|
|
||||||
|
b.Property<float>("Betroll100Multiplier");
|
||||||
|
|
||||||
|
b.Property<float>("Betroll67Multiplier");
|
||||||
|
|
||||||
|
b.Property<float>("Betroll91Multiplier");
|
||||||
|
|
||||||
b.Property<ulong>("BufferSize");
|
b.Property<ulong>("BufferSize");
|
||||||
|
|
||||||
|
b.Property<int>("CurrencyDropAmount");
|
||||||
|
|
||||||
b.Property<float>("CurrencyGenerationChance");
|
b.Property<float>("CurrencyGenerationChance");
|
||||||
|
|
||||||
b.Property<int>("CurrencyGenerationCooldown");
|
b.Property<int>("CurrencyGenerationCooldown");
|
||||||
@ -118,10 +128,14 @@ namespace NadekoBot.Migrations
|
|||||||
|
|
||||||
b.Property<int>("MigrationVersion");
|
b.Property<int>("MigrationVersion");
|
||||||
|
|
||||||
|
b.Property<int>("MinimumBetAmount");
|
||||||
|
|
||||||
b.Property<string>("RemindMessageFormat");
|
b.Property<string>("RemindMessageFormat");
|
||||||
|
|
||||||
b.Property<bool>("RotatingStatuses");
|
b.Property<bool>("RotatingStatuses");
|
||||||
|
|
||||||
|
b.Property<int>("TriviaCurrencyReward");
|
||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
b.ToTable("BotConfig");
|
b.ToTable("BotConfig");
|
||||||
@ -191,6 +205,27 @@ namespace NadekoBot.Migrations
|
|||||||
b.ToTable("CommandCooldown");
|
b.ToTable("CommandCooldown");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("NadekoBot.Services.Database.Models.CommandPrice", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd();
|
||||||
|
|
||||||
|
b.Property<int?>("BotConfigId");
|
||||||
|
|
||||||
|
b.Property<string>("CommandName");
|
||||||
|
|
||||||
|
b.Property<int>("Price");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("BotConfigId");
|
||||||
|
|
||||||
|
b.HasIndex("Price")
|
||||||
|
.IsUnique();
|
||||||
|
|
||||||
|
b.ToTable("CommandPrice");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("NadekoBot.Services.Database.Models.ConvertUnit", b =>
|
modelBuilder.Entity("NadekoBot.Services.Database.Models.ConvertUnit", b =>
|
||||||
{
|
{
|
||||||
b.Property<int>("Id")
|
b.Property<int>("Id")
|
||||||
@ -823,6 +858,13 @@ namespace NadekoBot.Migrations
|
|||||||
.HasForeignKey("GuildConfigId");
|
.HasForeignKey("GuildConfigId");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("NadekoBot.Services.Database.Models.CommandPrice", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("NadekoBot.Services.Database.Models.BotConfig")
|
||||||
|
.WithMany("CommandPrices")
|
||||||
|
.HasForeignKey("BotConfigId");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("NadekoBot.Services.Database.Models.EightBallResponse", b =>
|
modelBuilder.Entity("NadekoBot.Services.Database.Models.EightBallResponse", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("NadekoBot.Services.Database.Models.BotConfig")
|
b.HasOne("NadekoBot.Services.Database.Models.BotConfig")
|
||||||
|
@ -53,9 +53,9 @@ namespace NadekoBot.Modules.Gambling
|
|||||||
if (guessStr != "H" && guessStr != "T" && guessStr != "HEADS" && guessStr != "TAILS")
|
if (guessStr != "H" && guessStr != "T" && guessStr != "HEADS" && guessStr != "TAILS")
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (amount < 3)
|
if (amount < NadekoBot.BotConfig.MinimumBetAmount)
|
||||||
{
|
{
|
||||||
await Context.Channel.SendErrorAsync($"You can't bet less than 3{CurrencySign}.")
|
await Context.Channel.SendErrorAsync($"You can't bet less than {NadekoBot.BotConfig.MinimumBetAmount}{CurrencySign}.")
|
||||||
.ConfigureAwait(false);
|
.ConfigureAwait(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -84,7 +84,7 @@ namespace NadekoBot.Modules.Gambling
|
|||||||
string str;
|
string str;
|
||||||
if (isHeads == result)
|
if (isHeads == result)
|
||||||
{
|
{
|
||||||
var toWin = (int)Math.Round(amount * 1.8);
|
var toWin = (int)Math.Round(amount * NadekoBot.BotConfig.BetflipMultiplier);
|
||||||
str = $"{Context.User.Mention}`You guessed it!` You won {toWin}{CurrencySign}";
|
str = $"{Context.User.Mention}`You guessed it!` You won {toWin}{CurrencySign}";
|
||||||
await CurrencyHandler.AddCurrencyAsync(Context.User, "Betflip Gamble", toWin, false).ConfigureAwait(false);
|
await CurrencyHandler.AddCurrencyAsync(Context.User, "Betflip Gamble", toWin, false).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
@ -173,17 +173,17 @@ namespace NadekoBot.Modules.Gambling
|
|||||||
}
|
}
|
||||||
else if (rng < 91)
|
else if (rng < 91)
|
||||||
{
|
{
|
||||||
str += $"Congratulations! You won {amount * 2}{CurrencySign} for rolling above 66";
|
str += $"Congratulations! You won {amount * NadekoBot.BotConfig.Betroll67Multiplier}{CurrencySign} for rolling above 66";
|
||||||
await CurrencyHandler.AddCurrencyAsync(Context.User, "Betroll Gamble", amount * 2, false).ConfigureAwait(false);
|
await CurrencyHandler.AddCurrencyAsync(Context.User, "Betroll Gamble", amount * 2, false).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
else if (rng < 100)
|
else if (rng < 100)
|
||||||
{
|
{
|
||||||
str += $"Congratulations! You won {amount * 3}{CurrencySign} for rolling above 90.";
|
str += $"Congratulations! You won {amount * NadekoBot.BotConfig.Betroll91Multiplier}{CurrencySign} for rolling above 90.";
|
||||||
await CurrencyHandler.AddCurrencyAsync(Context.User, "Betroll Gamble", amount * 3, false).ConfigureAwait(false);
|
await CurrencyHandler.AddCurrencyAsync(Context.User, "Betroll Gamble", amount * 3, false).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
str += $"👑 Congratulations! You won {amount * 10}{CurrencySign} for rolling **100**. 👑";
|
str += $"👑 Congratulations! You won {amount * NadekoBot.BotConfig.Betroll100Multiplier}{CurrencySign} for rolling **100**. 👑";
|
||||||
await CurrencyHandler.AddCurrencyAsync(Context.User, "Betroll Gamble", amount * 10, false).ConfigureAwait(false);
|
await CurrencyHandler.AddCurrencyAsync(Context.User, "Betroll Gamble", amount * 10, false).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -78,14 +78,32 @@ namespace NadekoBot.Modules.Games
|
|||||||
{
|
{
|
||||||
lastGenerations.AddOrUpdate(channel.Id, DateTime.Now, (id, old) => DateTime.Now);
|
lastGenerations.AddOrUpdate(channel.Id, DateTime.Now, (id, old) => DateTime.Now);
|
||||||
|
|
||||||
var sent = await channel.SendFileAsync(
|
var dropAmount = NadekoBot.BotConfig.CurrencyDropAmount;
|
||||||
File.Open(GetRandomCurrencyImagePath(), FileMode.OpenOrCreate),
|
|
||||||
"RandomFlower.jpg",
|
|
||||||
$"❗ A random { NadekoBot.BotConfig.CurrencyName } appeared! Pick it up by typing `{NadekoBot.ModulePrefixes[typeof(Games).Name]}pick`")
|
|
||||||
.ConfigureAwait(false);
|
|
||||||
plantedFlowers.AddOrUpdate(channel.Id, new List<IUserMessage>() { sent }, (id, old) => { old.Add(sent); return old; });
|
|
||||||
|
|
||||||
|
if (dropAmount > 0)
|
||||||
|
{
|
||||||
|
var msgs = new List<IUserMessage>(dropAmount);
|
||||||
|
|
||||||
|
string firstPart;
|
||||||
|
if (dropAmount == 1)
|
||||||
|
{
|
||||||
|
firstPart = $"A random { NadekoBot.BotConfig.CurrencyName } appeared!";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
firstPart = $"{dropAmount} random { NadekoBot.BotConfig.CurrencyPluralName } appeared!";
|
||||||
|
}
|
||||||
|
|
||||||
|
var sent = await channel.SendFileAsync(
|
||||||
|
File.Open(GetRandomCurrencyImagePath(), FileMode.OpenOrCreate),
|
||||||
|
"RandomFlower.jpg",
|
||||||
|
$"❗ {firstPart} Pick it up by typing `{NadekoBot.ModulePrefixes[typeof(Games).Name]}pick`")
|
||||||
|
.ConfigureAwait(false);
|
||||||
|
|
||||||
|
msgs.Add(sent);
|
||||||
|
|
||||||
|
plantedFlowers.AddOrUpdate(channel.Id, msgs, (id, old) => { old.AddRange(msgs); return old; });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch { }
|
catch { }
|
||||||
@ -108,11 +126,11 @@ namespace NadekoBot.Modules.Games
|
|||||||
|
|
||||||
List<IUserMessage> msgs;
|
List<IUserMessage> msgs;
|
||||||
|
|
||||||
try { await Context.Message.DeleteAsync().ConfigureAwait(false); } catch { }
|
try { await Context.Message.DeleteAsync().ConfigureAwait(false); } catch { }
|
||||||
if (!plantedFlowers.TryRemove(channel.Id, out msgs))
|
if (!plantedFlowers.TryRemove(channel.Id, out msgs))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
await Task.WhenAll(msgs.Select(toDelete => toDelete.DeleteAsync())).ConfigureAwait(false);
|
await Task.WhenAll(msgs.Where(m => m != null).Select(toDelete => toDelete.DeleteAsync())).ConfigureAwait(false);
|
||||||
|
|
||||||
await CurrencyHandler.AddCurrencyAsync((IGuildUser)Context.User, $"Picked {NadekoBot.BotConfig.CurrencyPluralName}", msgs.Count, false).ConfigureAwait(false);
|
await CurrencyHandler.AddCurrencyAsync((IGuildUser)Context.User, $"Picked {NadekoBot.BotConfig.CurrencyPluralName}", msgs.Count, false).ConfigureAwait(false);
|
||||||
var msg = await channel.SendConfirmAsync($"**{Context.User}** picked {msgs.Count}{NadekoBot.BotConfig.CurrencySign}!").ConfigureAwait(false);
|
var msg = await channel.SendConfirmAsync($"**{Context.User}** picked {msgs.Count}{NadekoBot.BotConfig.CurrencySign}!").ConfigureAwait(false);
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
using Discord.Net;
|
using Discord.Net;
|
||||||
using Discord.WebSocket;
|
using Discord.WebSocket;
|
||||||
using NadekoBot.Extensions;
|
using NadekoBot.Extensions;
|
||||||
|
using NadekoBot.Services;
|
||||||
using NLog;
|
using NLog;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Concurrent;
|
using System.Collections.Concurrent;
|
||||||
@ -177,7 +178,10 @@ namespace NadekoBot.Modules.Games.Trivia
|
|||||||
if (Users[guildUser] == WinRequirement)
|
if (Users[guildUser] == WinRequirement)
|
||||||
{
|
{
|
||||||
ShouldStopGame = true;
|
ShouldStopGame = true;
|
||||||
await channel.SendConfirmAsync("Trivia Game", $"{guildUser.Mention} guessed it and WON the game! The answer was: **{CurrentQuestion.Answer}**").ConfigureAwait(false);
|
try { await channel.SendConfirmAsync("Trivia Game", $"{guildUser.Mention} guessed it and WON the game! The answer was: **{CurrentQuestion.Answer}**").ConfigureAwait(false); } catch { }
|
||||||
|
var reward = NadekoBot.BotConfig.TriviaCurrencyReward;
|
||||||
|
if (reward > 0)
|
||||||
|
await CurrencyHandler.AddCurrencyAsync(guildUser.Id, "Won trivia", reward).ConfigureAwait(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
await channel.SendConfirmAsync("Trivia Game", $"{guildUser.Mention} guessed it! The answer was: **{CurrentQuestion.Answer}**").ConfigureAwait(false);
|
await channel.SendConfirmAsync("Trivia Game", $"{guildUser.Mention} guessed it! The answer was: **{CurrentQuestion.Answer}**").ConfigureAwait(false);
|
||||||
|
@ -18,12 +18,22 @@ namespace NadekoBot.Services.Database.Models
|
|||||||
|
|
||||||
public bool RotatingStatuses { get; set; } = false;
|
public bool RotatingStatuses { get; set; } = false;
|
||||||
public string RemindMessageFormat { get; set; } = "❗⏰**I've been told to remind you to '%message%' now by %user%.**⏰❗";
|
public string RemindMessageFormat { get; set; } = "❗⏰**I've been told to remind you to '%message%' now by %user%.**⏰❗";
|
||||||
|
|
||||||
|
//currency
|
||||||
public string CurrencySign { get; set; } = "🌸";
|
public string CurrencySign { get; set; } = "🌸";
|
||||||
public string CurrencyName { get; set; } = "Nadeko Flower";
|
public string CurrencyName { get; set; } = "Nadeko Flower";
|
||||||
public string CurrencyPluralName { get; set; } = "Nadeko Flowers";
|
public string CurrencyPluralName { get; set; } = "Nadeko Flowers";
|
||||||
|
|
||||||
|
public int TriviaCurrencyReward { get; set; } = 0;
|
||||||
|
public int MinimumBetAmount { get; set; } = 3;
|
||||||
|
public float BetflipMultiplier { get; set; } = 1.8f;
|
||||||
|
public int CurrencyDropAmount { get; set; } = 1;
|
||||||
|
public float Betroll67Multiplier { get; set; } = 2;
|
||||||
|
public float Betroll91Multiplier { get; set; } = 3;
|
||||||
|
public float Betroll100Multiplier { get; set; } = 10;
|
||||||
|
public HashSet<CommandPrice> CommandPrices { get; set; } = new HashSet<CommandPrice>();
|
||||||
|
|
||||||
|
|
||||||
public HashSet<EightBallResponse> EightBallResponses { get; set; } = new HashSet<EightBallResponse>();
|
public HashSet<EightBallResponse> EightBallResponses { get; set; } = new HashSet<EightBallResponse>();
|
||||||
public HashSet<RaceAnimal> RaceAnimals { get; set; } = new HashSet<RaceAnimal>();
|
public HashSet<RaceAnimal> RaceAnimals { get; set; } = new HashSet<RaceAnimal>();
|
||||||
|
|
||||||
|
@ -234,9 +234,10 @@ namespace NadekoBot.Services.Database
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Protection
|
#region CommandPrice
|
||||||
|
modelBuilder.Entity<CommandPrice>()
|
||||||
|
.HasIndex(cp => cp.Price)
|
||||||
|
.IsUnique();
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user