From 3c229a0952a59ce32d2b2b2a9399833962ccb0e1 Mon Sep 17 00:00:00 2001 From: TrueDoctor Date: Thu, 7 Jun 2018 12:37:39 +0200 Subject: fixed clerar command changed Leben und asp to IChar extension --- DiscoBot/Commands/FileHandler.cs | 8 +- DiscoBot/Commands/Gm.cs | 4 +- DiscoBot/Commands/LebenUndAstral.cs | 161 ++++++++++++++++++------------------ DiscoBot/Commands/MiscCommands.cs | 6 +- 4 files changed, 91 insertions(+), 88 deletions(-) (limited to 'DiscoBot/Commands') diff --git a/DiscoBot/Commands/FileHandler.cs b/DiscoBot/Commands/FileHandler.cs index 7885aa9..0e8af60 100644 --- a/DiscoBot/Commands/FileHandler.cs +++ b/DiscoBot/Commands/FileHandler.cs @@ -3,7 +3,9 @@ using System; using System.Linq; using System.Net; - + + using DiscoBot.Auxiliary; + using DiscoBot.Characters; using DiscoBot.DSA_Game; using DiscoBot.DSA_Game.Characters; @@ -11,7 +13,7 @@ public class FileHandler : ModuleBase { - [Command("add"), Summary("fügt Helden hinzu")] + [Command("send"), Summary("fügt Helden hinzu")] public void AddChar() { var msg = this.Context.Message; @@ -40,4 +42,4 @@ } } } -} +} \ No newline at end of file diff --git a/DiscoBot/Commands/Gm.cs b/DiscoBot/Commands/Gm.cs index b0d9def..af152fa 100644 --- a/DiscoBot/Commands/Gm.cs +++ b/DiscoBot/Commands/Gm.cs @@ -97,7 +97,7 @@ temp = erschwernis.ToString(); } - res = le.get_LE_Text(name, waffe.Trim() + temp); + res = Dsa.Chars.OrderBy(x => SpellCorrect.CompareEasy(Dsa.Relation[this.Context.User.Username], x.Name)).First().get_LE_Text(waffe.Trim() + temp); break; case "ae": @@ -111,7 +111,7 @@ temp = erschwernis.ToString(); } - res = ae.get_AE_Text(name, waffe.Trim() + temp); + res = Dsa.Chars.OrderBy(x => SpellCorrect.CompareEasy(Dsa.Relation[this.Context.User.Username], x.Name)).First().get_AE_Text(waffe.Trim() + temp); break; default: diff --git a/DiscoBot/Commands/LebenUndAstral.cs b/DiscoBot/Commands/LebenUndAstral.cs index 3796475..530f1c2 100644 --- a/DiscoBot/Commands/LebenUndAstral.cs +++ b/DiscoBot/Commands/LebenUndAstral.cs @@ -12,12 +12,88 @@ public class LE : ModuleBase { - public string get_LE_Text(string name, string prop) + + + [Command("LE"), Summary("Ändert aktuellen Lebenspunktestand")] + [Alias("le", "leben", "LP", "lp", "Le", "Lp")] + + public async Task LEAsync([Summary("LE Modifier")] string prop = "", string s = "") + { + //This is the string that will be printed + string res = ""; + + if (prop.ToLower().Equals("help") || prop.ToLower().Equals("man")) + { + + Man man = new Man(); + await this.ReplyAsync("```xl\n" + man.Man_LE() + "\n```"); + return; + + + } + + //In case the input is badly formated + prop = prop.Trim() + s.Trim(); + + + //Get the actual text + res += Dsa.Chars.OrderBy(x => SpellCorrect.CompareEasy(Dsa.Relation[this.Context.User.Username], x.Name)).First().get_LE_Text(prop); + + + await this.ReplyAsync("```xl\n" + res + "\n```"); + } + } + + + + + + + public class AE : ModuleBase + { + + + [Command("AE"), Summary("Ändert aktuellen Astralpunktestand")] + [Alias("ae", "astral", "ASP", "Asp", "asp", "Astral")] + + public async Task AEAsync([Summary("AE Modifier")] string prop = "", string s = "") + { + //This is the string that will be printed + string res = ""; + + if (prop.ToLower().Equals("help") || prop.ToLower().Equals("man")) + { + + Man man = new Man(); + await this.ReplyAsync("```xl\n" + man.Man_AE() + "\n```"); + return; + + } + + //Incase the input is badly formated + prop = prop.Trim() + s.Trim(); + + + //Get the actual text + res += Dsa.Chars.OrderBy(x => SpellCorrect.CompareEasy(Dsa.Relation[this.Context.User.Username], x.Name)).First().get_AE_Text(prop); + + + + await this.ReplyAsync("```xl\n" + res + "\n```"); + } + + + + } + + public static class StatExtension + { + public static string get_LE_Text(this ICharacter c, string prop) { string res = ""; var comp = new SpellCorrect(); - var character = Dsa.Chars.OrderBy(x => comp.Compare(name, x.Name)).First(); - + var character = c; + res += (character.Name + ":\n"); //If there is actual input we process it @@ -69,54 +145,11 @@ return res; } - - - [Command("LE"), Summary("Ändert aktuellen Lebenspunktestand")] - [Alias("le", "leben", "LP", "lp", "Le", "Lp")] - - public async Task LEAsync([Summary("LE Modifier")] string prop = "", string s = "") - { - //This is the string that will be printed - string res =""; - - if(prop.ToLower().Equals("help") || prop.ToLower().Equals("man")) - { - - Man man = new Man(); - await this.ReplyAsync("```xl\n" + man.Man_LE() + "\n```"); - return; - - - } - - //In case the input is badly formated - prop = prop.Trim() + s.Trim(); - - - //Get the actual text - res += get_LE_Text(Dsa.Relation[this.Context.User.Username], prop); - - - await this.ReplyAsync("```xl\n" + res + "\n```"); - } - - - - } - - - - - - -public class AE : ModuleBase -{ - - public string get_AE_Text(string name, string prop) + public static string get_AE_Text(this ICharacter c, string prop) { string res = ""; var comp = new SpellCorrect(); - var character = Dsa.Chars.OrderBy(x => comp.Compare(name, x.Name)).First(); + var character = c; res += (character.Name + ":\n"); @@ -177,40 +210,8 @@ public class AE : ModuleBase return res; } - [Command("AE"), Summary("Ändert aktuellen Astralpunktestand")] - [Alias("ae", "astral", "ASP", "Asp", "asp", "Astral")] - - public async Task AEAsync([Summary("AE Modifier")] string prop = "", string s = "") - { - //This is the string that will be printed - string res = ""; - - if (prop.ToLower().Equals("help") || prop.ToLower().Equals("man")) - { - - Man man = new Man(); - await this.ReplyAsync("```xl\n" + man.Man_AE() + "\n```"); - return; - - } - - //Incase the input is badly formated - prop = prop.Trim() + s.Trim(); - - - //Get the actual text - res += get_AE_Text(Dsa.Relation[this.Context.User.Username], prop); - - - - await this.ReplyAsync("```xl\n" + res + "\n```"); } - - - -} } - diff --git a/DiscoBot/Commands/MiscCommands.cs b/DiscoBot/Commands/MiscCommands.cs index 46cd6eb..7de0f10 100644 --- a/DiscoBot/Commands/MiscCommands.cs +++ b/DiscoBot/Commands/MiscCommands.cs @@ -157,8 +157,8 @@ namespace DiscoBot.Commands } - [Command("clear"), Summary("Echos a message.")] - public async Task DeletekAsync(int count) + [Command("clear"), Summary("Cleans up messages.")] + public async Task DeleteAsync(int count) { var messagesAsync = Context.Channel.GetMessagesAsync(count); Task.WaitAll(messagesAsync.ToArray()); @@ -169,7 +169,7 @@ namespace DiscoBot.Commands messages.AddRange(task.ToList()); } - if (Permissions.Check(Context, new[] { "Admin", "Mod" })) + if (Permissions.Check(Context, new[] { "Admin", "Mod", "Meister" })) { await Context.Channel.DeleteMessagesAsync(messages); } -- cgit v1.2.3-70-g09d2