From eb7a842b8fe784891a8f865cf47cc20e4fcb22b0 Mon Sep 17 00:00:00 2001 From: TrueDoctor Date: Tue, 22 Aug 2017 19:44:55 +0200 Subject: implemented charackter class implemented xml readout --- DiscoBot/Commands.cs | 67 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 DiscoBot/Commands.cs (limited to 'DiscoBot/Commands.cs') diff --git a/DiscoBot/Commands.cs b/DiscoBot/Commands.cs new file mode 100644 index 0000000..9fe9513 --- /dev/null +++ b/DiscoBot/Commands.cs @@ -0,0 +1,67 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Discord; +using Discord.Commands; +using Discord.WebSocket; + + +namespace DiscoBot +{ + class Commands + { + } + public class Info : ModuleBase + { + // ~say hello -> hello + [Command("say"), Summary("Echos a message.")] + public async Task Say([Remainder, Summary("The text to echo")] string echo) + { + + + // ReplyAsync is a method on ModuleBase + await ReplyAsync(echo); + + } + } + + public class Abfrage : ModuleBase + { + // ~say hello -> hello + [Command("t"), Summary("tests a talent.")] + public async Task Say([Remainder, Summary("The text to echo")] string talent) + { + // + //a.talente.First(x=>) + + + // ReplyAsync is a method on ModuleBase + + await ReplyAsync(talent); + + } + } + + [Group("sample")] + public class Sample : ModuleBase + { + // ~sample square 20 -> 400 + [Command("square"), Summary("Squares a number.")] + public async Task Square([Summary("The number to square.")] int num) + { + // We can also access the channel from the Command Context. + await Context.Channel.SendMessageAsync($"{num}^2 = {Math.Pow(num, 2)}"); + } + + [Command("userinfo"), Summary("Returns info about the current user, or the user parameter, if one passed.")] + [Alias("user", "whois")] + public async Task UserInfo([Summary("The (optional) user to get info for")] IUser user = null) + { + var userInfo = user ?? Context.Client.CurrentUser; + await ReplyAsync($"{userInfo.Username}#{userInfo.Discriminator}"); + } + } + +} -- cgit v1.2.3-70-g09d2 From d59a67e552628b464f079bccae20349d649bdd61 Mon Sep 17 00:00:00 2001 From: TrueDoctor Date: Tue, 22 Aug 2017 20:58:49 +0200 Subject: added syntax highlighting --- DiscoBot/Char.cs | 27 +++++++++++++++++++-------- DiscoBot/Commands.cs | 7 ++----- 2 files changed, 21 insertions(+), 13 deletions(-) (limited to 'DiscoBot/Commands.cs') diff --git a/DiscoBot/Char.cs b/DiscoBot/Char.cs index 250810d..28ed7b9 100644 --- a/DiscoBot/Char.cs +++ b/DiscoBot/Char.cs @@ -64,23 +64,34 @@ namespace DiscoBot Proptable.Add("IN", "Intuition"); Proptable.Add("CH", "Charisma"); Proptable.Add("FF", "Fingerfertigkeit"); - Proptable.Add("GE", "Gewandheit"); + Proptable.Add("GE", "Gewandtheit"); Proptable.Add("KO", "Konstitution"); Proptable.Add("KK", "Körperkraft"); } - string TestTalent(string talent) + public string TestTalent(string talent) { - var props =talente.Find(v => v.name.Equals(talent)).Test(); - - return ""; + var output = new StringBuilder(); + var ttalent = talente.Find(v => v.name.Equals(talent)); + var props =ttalent.Test(); + int tap = ttalent.value; + for (int i = 0; i <= 2; i++) + { + int temp = dice.Rolld20(); + int eigenschaft = eigenschaften[Proptable[props[i]]]; + if (eigenschaft < temp) + tap -= temp - eigenschaft ; + output.Append(temp+" "); + } + output.Append("tap: "+ tap); + return output.ToString(); } } public class Talent { public string name, probe; - private int value; + public int value; public Talent(string name, string probe, int value) { this.name = name; this.probe = probe; this.value = value; } public string[] Test() { @@ -100,10 +111,10 @@ namespace DiscoBot } public static class dice { + static System.Random rnd = new System.Random(); public static int Rolld20() { - System.Random rnd = new System.Random(); - return rnd.Next(19) + 1; + return rnd.Next(1,21) ; } } } diff --git a/DiscoBot/Commands.cs b/DiscoBot/Commands.cs index 9fe9513..6984761 100644 --- a/DiscoBot/Commands.cs +++ b/DiscoBot/Commands.cs @@ -29,17 +29,14 @@ namespace DiscoBot public class Abfrage : ModuleBase { + Char test = new Char(); // ~say hello -> hello [Command("t"), Summary("tests a talent.")] public async Task Say([Remainder, Summary("The text to echo")] string talent) { - // - //a.talente.First(x=>) - - // ReplyAsync is a method on ModuleBase - await ReplyAsync(talent); + await ReplyAsync("```xl\n" + test.TestTalent(talent) + "\n```"); } } -- cgit v1.2.3-70-g09d2