diff options
author | TrueDoctor <d-kobert@web.de> | 2018-04-09 14:13:28 +0200 |
---|---|---|
committer | TrueDoctor <d-kobert@web.de> | 2018-04-09 14:13:28 +0200 |
commit | 5cb8346a6a3ccc55295c00ac333e410629ff7c42 (patch) | |
tree | 1603fdf24f1ead61cf7dd23c09a9784cfb1c780e /DiscoBot/Commands/NpcCommands.cs | |
parent | e49ac2778bb6d38517f14447c0675df354552528 (diff) | |
parent | 4ca7291ebee440d9f3ef2a1643d8d01b29006459 (diff) |
Merge branch 'Reset'
Diffstat (limited to 'DiscoBot/Commands/NpcCommands.cs')
-rw-r--r-- | DiscoBot/Commands/NpcCommands.cs | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/DiscoBot/Commands/NpcCommands.cs b/DiscoBot/Commands/NpcCommands.cs new file mode 100644 index 0000000..f2b17b6 --- /dev/null +++ b/DiscoBot/Commands/NpcCommands.cs @@ -0,0 +1,37 @@ +namespace DiscoBot.Commands +{ + using System; + using System.Linq; + using System.Threading.Tasks; + + using DiscoBot.Auxiliary; + using DiscoBot.Characters; + + using Discord.Commands; + + public class NpcCommands : ModuleBase + { + [Command("npc"), Summary("Erstellt ein NPC")] + [Alias("Npc", "NPc", "NPC", "nPC")] + public Task RandomAsync([Summary("Create Random")] string npcName, int mean = 9, int stDv = 1) + { + Dsa.Chars.Add(new Npc(npcName, mean, stDv)); + return this.ReplyAsync($"{npcName} wurde zufällig generiert"); + } + + [Command("npc"), Summary("Erstellt ein NPC")] + [Alias("Npc", "NPc", "NPC", "nPC")] + public Task CopyAsync([Summary("Create Copy")] string npcName, string source, int stDv = 1) + { + if (Dsa.Chars.Exists(x => x.Name.Equals(npcName))) + { + throw new Exception("Char gibt es schon"); + } + + var comp = new SpellCorrect(); + var chr = Dsa.Chars.OrderBy(x => comp.Compare(x.Name, source)).First(); + Dsa.Chars.Add(new Character(chr as Character, npcName, stDv)); + return this.ReplyAsync($"{npcName} wurde als variierte Kopie von {source} erstellt"); + } + } +} |