8ball, donator stuff, fixed card draws - thx gucci
This commit is contained in:
parent
4668985d26
commit
d203f6032a
@ -113,6 +113,7 @@ public class Cards
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
private Random r = new Random();
|
||||||
/// <summary>
|
/// <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.
|
/// 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>
|
/// </summary>
|
||||||
@ -122,7 +123,7 @@ public class Cards
|
|||||||
if (CardPool.Count == 0)
|
if (CardPool.Count == 0)
|
||||||
Restart();
|
Restart();
|
||||||
//you can either do this if your deck is not shuffled
|
//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);
|
int num = r.Next(0, cardPool.Count);
|
||||||
Card c = cardPool[num];
|
Card c = cardPool[num];
|
||||||
cardPool.RemoveAt(num);
|
cardPool.RemoveAt(num);
|
||||||
@ -141,7 +142,6 @@ public class Cards
|
|||||||
private void Shuffle() {
|
private void Shuffle() {
|
||||||
if (cardPool.Count > 1)
|
if (cardPool.Count > 1)
|
||||||
{
|
{
|
||||||
Random r = new Random();
|
|
||||||
cardPool.OrderBy(x => r.Next());
|
cardPool.OrderBy(x => r.Next());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -195,15 +195,15 @@ public class Cards
|
|||||||
|
|
||||||
handValues = new Dictionary<string, Func<List<Card>, bool>>
|
handValues = new Dictionary<string, Func<List<Card>, bool>>
|
||||||
{
|
{
|
||||||
{ "A Pair", isPair },
|
{ "Royal Flush", isRoyalFlush },
|
||||||
{ "Two Pairs", isTwoPair },
|
|
||||||
{ "Three Of A Kind", isThreeOfKind },
|
|
||||||
{ "Straight", isStraight },
|
|
||||||
{ "Flush", isFlush },
|
|
||||||
{ "Full House", isFullHouse },
|
|
||||||
{ "Four Of A Kind", isFourOfKind },
|
|
||||||
{ "Straight Flush", isStraightFlush },
|
{ "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 }
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -579,6 +579,7 @@ namespace NadekoBot.Modules {
|
|||||||
|
|
||||||
//THIS IS INTENTED TO BE USED ONLY BY THE ORIGINAL BOT OWNER
|
//THIS IS INTENTED TO BE USED ONLY BY THE ORIGINAL BOT OWNER
|
||||||
cgb.CreateCommand(".adddon")
|
cgb.CreateCommand(".adddon")
|
||||||
|
.Alias(".donadd")
|
||||||
.Description("Add a donator to the database.")
|
.Description("Add a donator to the database.")
|
||||||
.Parameter("donator")
|
.Parameter("donator")
|
||||||
.Parameter("amount")
|
.Parameter("amount")
|
||||||
@ -599,8 +600,16 @@ namespace NadekoBot.Modules {
|
|||||||
Console.WriteLine("---------------\nInner error:\n" + ex.InnerException);
|
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 ")
|
.Description("Enabled or disabled voice to text channel connection. Only people in a certain voice channel will see ")
|
||||||
|
|
||||||
cgb.CreateCommand(".jsontype")
|
cgb.CreateCommand(".jsontype")
|
||||||
|
@ -3,16 +3,23 @@ using System.Linq;
|
|||||||
using Discord.Modules;
|
using Discord.Modules;
|
||||||
using NadekoBot.Extensions;
|
using NadekoBot.Extensions;
|
||||||
using NadekoBot.Commands;
|
using NadekoBot.Commands;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
|
using System.IO;
|
||||||
//🃏
|
//🃏
|
||||||
//🏁
|
//🏁
|
||||||
namespace NadekoBot.Modules
|
namespace NadekoBot.Modules
|
||||||
{
|
{
|
||||||
class Games : DiscordModule
|
class Games : DiscordModule
|
||||||
{
|
{
|
||||||
|
private string[] _8BallAnswers;
|
||||||
|
private Random _r = new Random();
|
||||||
|
|
||||||
public Games() : base() {
|
public Games() : base() {
|
||||||
commands.Add(new Trivia());
|
commands.Add(new Trivia());
|
||||||
commands.Add(new SpeedTyping());
|
commands.Add(new SpeedTyping());
|
||||||
commands.Add(new PollCommand());
|
commands.Add(new PollCommand());
|
||||||
|
|
||||||
|
_8BallAnswers = JArray.Parse(File.ReadAllText("data/8ball.json")).Select(t => t.ToString()).ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Install(ModuleManager manager)
|
public override void Install(ModuleManager manager)
|
||||||
@ -34,6 +41,17 @@ namespace NadekoBot.Modules
|
|||||||
await e.Send(list[new Random().Next(0, list.Length)]);
|
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(">")
|
cgb.CreateCommand(">")
|
||||||
.Description("Attack a person. Supported attacks: 'splash', 'strike', 'burn', 'surge'.\n**Usage**: > strike @User")
|
.Description("Attack a person. Supported attacks: 'splash', 'strike', 'burn', 'surge'.\n**Usage**: > strike @User")
|
||||||
.Parameter("attack_type",Discord.Commands.ParameterType.Required)
|
.Parameter("attack_type",Discord.Commands.ParameterType.Required)
|
||||||
|
23
NadekoBot/bin/Debug/data/8ball.json
Normal file
23
NadekoBot/bin/Debug/data/8ball.json
Normal 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"
|
||||||
|
]
|
Loading…
Reference in New Issue
Block a user