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>
|
||||
/// 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 }
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -579,59 +579,68 @@ namespace NadekoBot.Modules {
|
||||
|
||||
//THIS IS INTENTED TO BE USED ONLY BY THE ORIGINAL BOT OWNER
|
||||
cgb.CreateCommand(".adddon")
|
||||
.Description("Add a donator to the database.")
|
||||
.Parameter("donator")
|
||||
.Parameter("amount")
|
||||
.Do(e => {
|
||||
try {
|
||||
if (NadekoBot.OwnerID != e.User.Id)
|
||||
return;
|
||||
var donator = e.Server.FindUsers(e.GetArg("donator")).FirstOrDefault();
|
||||
var amount = int.Parse(e.GetArg("amount"));
|
||||
Classes.DBHandler.Instance.InsertData(new Donator {
|
||||
Amount = amount,
|
||||
UserName = donator.Name,
|
||||
UserId = (long)e.User.Id
|
||||
});
|
||||
e.Channel.SendMessage("Successfuly added a new donator. 👑");
|
||||
} catch (Exception ex) {
|
||||
Console.WriteLine(ex);
|
||||
Console.WriteLine("---------------\nInner error:\n" + ex.InnerException);
|
||||
}
|
||||
});
|
||||
.Alias(".donadd")
|
||||
.Description("Add a donator to the database.")
|
||||
.Parameter("donator")
|
||||
.Parameter("amount")
|
||||
.Do(e => {
|
||||
try {
|
||||
if (NadekoBot.OwnerID != e.User.Id)
|
||||
return;
|
||||
var donator = e.Server.FindUsers(e.GetArg("donator")).FirstOrDefault();
|
||||
var amount = int.Parse(e.GetArg("amount"));
|
||||
Classes.DBHandler.Instance.InsertData(new Donator {
|
||||
Amount = amount,
|
||||
UserName = donator.Name,
|
||||
UserId = (long)e.User.Id
|
||||
});
|
||||
e.Channel.SendMessage("Successfuly added a new donator. 👑");
|
||||
} catch (Exception ex) {
|
||||
Console.WriteLine(ex);
|
||||
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")
|
||||
.Description("Enabled or disabled voice to text channel connection. Only people in a certain voice channel will see ")
|
||||
|
||||
cgb.CreateCommand(".jsontype")
|
||||
.Do(async e => {
|
||||
Newtonsoft.Json.Linq.JArray data = Newtonsoft.Json.Linq.JArray.Parse(File.ReadAllText("data.json"));
|
||||
if (data == null || data.Count == 0) return;
|
||||
});
|
||||
|
||||
var wer = data.Where(jt => jt["Description"].ToString().Length > 120);
|
||||
var list = wer.Select(jt => {
|
||||
var obj = new Parse.ParseObject("TypingArticles");
|
||||
obj["text"] = jt["Description"].ToString();
|
||||
return obj;
|
||||
});
|
||||
await Parse.ParseObject.SaveAllAsync(list);
|
||||
await e.Send("saved to parse");
|
||||
cgb.CreateCommand(".voicetext")
|
||||
.Description("Enabled or disabled voice to text channel connection. Only people in a certain voice channel will see ")
|
||||
|
||||
});
|
||||
cgb.CreateCommand(".jsontype")
|
||||
.Do(async e => {
|
||||
Newtonsoft.Json.Linq.JArray data = Newtonsoft.Json.Linq.JArray.Parse(File.ReadAllText("data.json"));
|
||||
if (data == null || data.Count == 0) return;
|
||||
|
||||
cgb.CreateCommand(".repeat")
|
||||
.Do(async e => {
|
||||
if (e.User.Id != NadekoBot.OwnerID) return;
|
||||
var wer = data.Where(jt => jt["Description"].ToString().Length > 120);
|
||||
var list = wer.Select(jt => {
|
||||
var obj = new Parse.ParseObject("TypingArticles");
|
||||
obj["text"] = jt["Description"].ToString();
|
||||
return obj;
|
||||
});
|
||||
await Parse.ParseObject.SaveAllAsync(list);
|
||||
await e.Send("saved to parse");
|
||||
|
||||
string[] notifs = { "Admin use .bye .greet", "Unstable - fixing", "fixing ~ani, ~mang", "join NadekoLog server", "-h is help, .stats",};
|
||||
int i = notifs.Length;
|
||||
while (true) {
|
||||
await e.Channel.SendMessage($".setgame {notifs[--i]}");
|
||||
await Task.Delay(20000);
|
||||
if (i == 0) i = notifs.Length;
|
||||
}
|
||||
});
|
||||
*/
|
||||
});
|
||||
|
||||
cgb.CreateCommand(".repeat")
|
||||
.Do(async e => {
|
||||
if (e.User.Id != NadekoBot.OwnerID) return;
|
||||
|
||||
string[] notifs = { "Admin use .bye .greet", "Unstable - fixing", "fixing ~ani, ~mang", "join NadekoLog server", "-h is help, .stats",};
|
||||
int i = notifs.Length;
|
||||
while (true) {
|
||||
await e.Channel.SendMessage($".setgame {notifs[--i]}");
|
||||
await Task.Delay(20000);
|
||||
if (i == 0) i = notifs.Length;
|
||||
}
|
||||
});
|
||||
*/
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -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)
|
||||
|
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