8ball, donator stuff, fixed card draws - thx gucci

This commit is contained in:
Master Kwoth 2016-02-10 17:27:49 +01:00
parent 4668985d26
commit d203f6032a
4 changed files with 108 additions and 58 deletions

View File

@ -113,6 +113,7 @@ public class Cards
}
}
}
private Random r = new Random();
/// <summary>
/// Take a card from the pool, you either take it from the top if the deck is shuffled, or from a random place if the deck is in the default order.
/// </summary>
@ -122,7 +123,7 @@ public class Cards
if (CardPool.Count == 0)
Restart();
//you can either do this if your deck is not shuffled
Random r = new Random((int)DateTime.Now.Ticks);
int num = r.Next(0, cardPool.Count);
Card c = cardPool[num];
cardPool.RemoveAt(num);
@ -141,7 +142,6 @@ public class Cards
private void Shuffle() {
if (cardPool.Count > 1)
{
Random r = new Random();
cardPool.OrderBy(x => r.Next());
}
}
@ -195,15 +195,15 @@ public class Cards
handValues = new Dictionary<string, Func<List<Card>, bool>>
{
{ "A Pair", isPair },
{ "Two Pairs", isTwoPair },
{ "Three Of A Kind", isThreeOfKind },
{ "Straight", isStraight },
{ "Flush", isFlush },
{ "Full House", isFullHouse },
{ "Four Of A Kind", isFourOfKind },
{ "Royal Flush", isRoyalFlush },
{ "Straight Flush", isStraightFlush },
{ "Royal Flush", isRoyalFlush }
{ "Four Of A Kind", isFourOfKind },
{ "Full House", isFullHouse },
{ "Flush", isFlush },
{ "Straight", isStraight },
{ "Three Of A Kind", isThreeOfKind },
{ "Two Pairs", isTwoPair },
{ "A Pair", isPair }
};
}

View File

@ -579,6 +579,7 @@ namespace NadekoBot.Modules {
//THIS IS INTENTED TO BE USED ONLY BY THE ORIGINAL BOT OWNER
cgb.CreateCommand(".adddon")
.Alias(".donadd")
.Description("Add a donator to the database.")
.Parameter("donator")
.Parameter("amount")
@ -599,8 +600,16 @@ namespace NadekoBot.Modules {
Console.WriteLine("---------------\nInner error:\n" + ex.InnerException);
}
});
/*
cgb.CreateCommand(".no")
.Description("desc")
.Parameter("arg", ParameterType.Required)
.Do(async e => {
var arg = e.GetArg("arg");
/*cgb.CreateCommand(".voicetext")
});
cgb.CreateCommand(".voicetext")
.Description("Enabled or disabled voice to text channel connection. Only people in a certain voice channel will see ")
cgb.CreateCommand(".jsontype")

View File

@ -3,16 +3,23 @@ using System.Linq;
using Discord.Modules;
using NadekoBot.Extensions;
using NadekoBot.Commands;
using Newtonsoft.Json.Linq;
using System.IO;
//🃏
//🏁
namespace NadekoBot.Modules
{
class Games : DiscordModule
{
private string[] _8BallAnswers;
private Random _r = new Random();
public Games() : base() {
commands.Add(new Trivia());
commands.Add(new SpeedTyping());
commands.Add(new PollCommand());
_8BallAnswers = JArray.Parse(File.ReadAllText("data/8ball.json")).Select(t => t.ToString()).ToArray();
}
public override void Install(ModuleManager manager)
@ -34,6 +41,17 @@ namespace NadekoBot.Modules
await e.Send(list[new Random().Next(0, list.Length)]);
});
cgb.CreateCommand(">8ball")
.Description("Ask the 8ball a yes/no question.")
.Parameter("question",Discord.Commands.ParameterType.Unparsed)
.Do(async e => {
string question = e.GetArg("question").Replace("@everyone","[everyone]");
if (string.IsNullOrWhiteSpace(question))
return;
await e.Channel.SendMessage(
$":question: **Question:{question}**\n:crystal_ball: **8Ball Answers:**{_8BallAnswers[_r.Next(0, _8BallAnswers.Length)]}");
});
cgb.CreateCommand(">")
.Description("Attack a person. Supported attacks: 'splash', 'strike', 'burn', 'surge'.\n**Usage**: > strike @User")
.Parameter("attack_type",Discord.Commands.ParameterType.Required)

View File

@ -0,0 +1,23 @@
[
"Most definitely yes",
"For sure",
"As I see it, yes",
"My sources say yes",
"Yes",
"Most likely",
"Perhaps",
"Maybe",
"Not sure",
"It is uncertain",
"Ask me again later",
"Don't count on it",
"Probably not",
"Very doubtful",
"Most likely no",
"Nope",
"No",
"My sources say no",
"Dont even think about it",
"Definitely no",
"NO - It may cause disease contraction"
]