summaryrefslogtreecommitdiff
path: root/DiscoBot/Commands/NpcCommands.cs
blob: b314494f127fc1d75fbc78fd7d3edba12b64c554 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
namespace DiscoBot.Commands
{
    using System;
    using System.Linq;
    using System.Threading.Tasks;

    using DiscoBot.Auxiliary;
    using DiscoBot.Characters;
    using DiscoBot.DSA_Game;
    using DiscoBot.DSA_Game.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");
        }
    }
}