summaryrefslogtreecommitdiff
path: root/DiscoBot/Commands/List.cs
blob: 9c745b234737390584b741e4b286768a9e6e4f3e (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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
namespace DiscoBot.Commands
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;

    using DiscoBot.Audio;
    using DiscoBot.Auxiliary;
    using DiscoBot.DSA_Game;
    using DiscoBot.DSA_Game.Characters;

    using Discord.Commands;

    public class List : ModuleBase
    {
        [Command("list"), Summary("gibt eine Auflistung  aus")]
        public async Task ListAsync([Summary("Aktion")] string prop)
        {
            var res = new List<string>();

            var character = ((Character)Dsa.Chars.Find(x => x.Name.Equals(Dsa.Relation[this.Context.User.Username])));


            switch (prop.ToLower())
            {
                case "chars":
                case "Chars":
                    res.AddRange(Dsa.Chars.Select(x => x.Name));
                    break;
                case "e":
                case "eig":
                case "eigenschaft":
                case "eigenschaften":
                    res.Add(character.Name + ":");
                    res.AddRange(
                    character.Eigenschaften.Take(8).Select(s => s.Key + ":\t " + s.Value));
                    break;
                case "stat":
                case "stats":
                    res.Add(character.Name + ":");
                    res.AddRange(
                    //character.Eigenschaften.Select(s => s.Key + ":\t " + s.Value));
                    character.Eigenschaften.Take(9).Select(s => s.Key + ":\t " + s.Value));
                    res.Add("LE:\t " + character.Lebenspunkte_Aktuell + "/" + character.Lebenspunkte_Basis);
                    if (character.Astralpunkte_Basis > 0)
                    {
                        res.Add("AE:\t " + character.Astralpunkte_Aktuell + "/" + character.Astralpunkte_Basis);
                    }
                    break;
                case "t":
                case "ta":
                case "talent":
                case "zauber":
                    res.Add(character.Name + ":");
                    res.AddRange(
                        character.Talente.Select(s => s.Name + "\t " + s.Value + "\t " + s.Probe));
                    break;
                case "w":
                case "waffe":
                case "waffen":
                    res.Add(character.Name + ":");
                    res.AddRange(
                        character.Kampftalente.Select(s => s.Name));
                    break;
                case "fern":
                    res.Add(character.Name + ":");
                    res.AddRange(
                        character.Talente.Select(s => s.Name));
                    break;
                case "sound":
                case "sounds":
                    res.AddRange(
                        Enum.GetNames(typeof(Sound)));
                    break;
                case "v":
                case "vt":
                case "vor":
                case "vorteil":
                    res.Add(character.Name + ":");
                    res.AddRange(
                        character.Vorteile
                        .Select(s => s.Name + "\t " + s.Value));// (s.Value == 0 ? string.Empty : s.Value.ToString())));
                    break;

                default:
                    res.Add($"Kommando {prop} nicht gefunden");
                    break;
            }
            
            var sb = new StringBuilder();
            foreach (string re in res)
            {
                if (sb.Length + re.Length > 1798)
                {
                    await this.ReplyTimedAsync(sb.ToString(), TimeSpan.FromSeconds(90));
                    sb.Clear();
                }

                sb.AppendLine(re);
            }

            await this.ReplyTimedAsync(sb.ToString(), TimeSpan.FromSeconds(90));
        }
    }
}