summaryrefslogtreecommitdiff
path: root/dsa/DSALib/Commands/HeldList.cs
blob: 6943f21b5920e3092b5a06409d50cece99a2ef5c (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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DSALib.Auxiliary;
using DSALib.DSA_Game;
using DSALib.DSA_Game.Characters;

namespace DSALib.Commands {
    public class HeldList {
        public static string ListAsync(ulong id, params string[] prop_list) {
            var res = new List<string>();

            var character = Dsa.GetCharacter(id) as Character;

            var first_column_width = 18;


            if (prop_list.Length == 0 || prop_list[0].ToLower().StartsWith("all") ||
                prop_list[0].ToLower().StartsWith("brief") || prop_list[0].ToLower().StartsWith("zettel")) {
                res.Add(character.Name + ":\n");
                //Eigenschaften
                res.AddRange(
                    character.Eigenschaften.Take(9).Select(s => s.Key + ":\t " + s.Value));
                res.Add("");
                //LE/AE
                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);
                res.Add("");
                //Kampfwerte
                res.Add("".AddSpaces(first_column_width) + " AT/PA");
                res.AddRange(
                    character.Kampftalente.Select(s =>
                        s.Name.AddSpaces(first_column_width) + " " + s.At.ToString().AddSpacesAtHead(2) + "/" +
                        s.Pa.ToString().AddSpacesAtHead(2)));
                res.Add("");
                //Fernkampf
                res.Add("".AddSpaces(first_column_width) + " FK");
                res.AddRange(
                    character.Talente.Where(x => x.IstFernkampftalent()).Select(s =>
                        s.Name.AddSpaces(first_column_width) + " " +
                        (character.Eigenschaften["fk"] + s.Value).ToString().AddSpacesAtHead(2)));
                res.Add("");
                //Vorteile
                res.AddRange(
                    character.Vorteile
                        .Select(s => s.Name + "\t " + s.Value));
                res.Add("");
                //Talente
                res.AddRange(
                    character.Talente.Select(s =>
                        (s.Name.AddSpaces(first_column_width) + " " + s.Value).AddSpaces(first_column_width + 5) + " " +
                        s.Probe));
                res.Add("");
                //evtl Zauber
                if (character.Zauber.Count > 0)
                    res.AddRange(
                        character.Zauber.Select(s =>
                            (s.Name.AddSpaces(first_column_width) + " " + s.Value).AddSpaces(first_column_width + 5) +
                            " " + s.Probe));
            }
            else if (prop_list[0].ToLower().StartsWith("man") || prop_list[0].ToLower().StartsWith("help") ||
                     prop_list[0].ToLower().StartsWith("hilf")) {
                return "```xl\n" + Help.Get_Specific_Help("Held") + "\n```";
            }
            else {
                res.Add(character.Name + ":\n");

                foreach (var prop in prop_list) {
                    switch (prop.ToLower()) {
                        case "e":
                        case "eig":
                        case "eigenschaft":
                        case "eigenschaften":
                            res.AddRange(
                                character.Eigenschaften.Take(8).Select(s => s.Key + ":\t " + s.Value));
                            break;
                        case "stat":
                        case "stats":
                            res.AddRange(
                                character.Eigenschaften.Take(9).Select(s => s.Key + ":\t " + s.Value));
                            res.Add("");
                            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 "le":
                            res.Add("LE:\t " + character.Lebenspunkte_Aktuell + "/" + character.Lebenspunkte_Basis);
                            break;
                        case "ae":
                            res.Add("AE:\t " + character.Astralpunkte_Aktuell + "/" + character.Astralpunkte_Basis);
                            break;
                        case "t":
                        case "ta":
                        case "talent":
                        case "talente":
                            res.AddRange(
                                character.Talente.Select(s =>
                                    (s.Name.AddSpaces(first_column_width) + " " + s.Value).AddSpaces(
                                        first_column_width + 5) + " " + s.Probe));
                            break;
                        case "zauber":
                        case "z":
                            res.AddRange(
                                character.Zauber.Select(s =>
                                    (s.Name.AddSpaces(first_column_width) + " " + s.Value).AddSpaces(
                                        first_column_width + 5) + " " + s.Probe));
                            break;
                        case "w":
                        case "waffe":
                        case "waffen":
                        case "kampf":
                        case "kampfwert":
                        case "kampfwerte":
                            res.Add("".AddSpaces(first_column_width) + " AT/PA");
                            res.AddRange(
                                character.Kampftalente.Select(s =>
                                    s.Name.AddSpaces(first_column_width) + " " + s.At.ToString().AddSpacesAtHead(2) +
                                    "/" + s.Pa.ToString().AddSpacesAtHead(2)));
                            break;
                        case "f":
                        case "fern":
                            res.Add("".AddSpaces(first_column_width) + " FK");
                            res.AddRange(
                                character.Talente.Where(x => x.IstFernkampftalent()).Select(s =>
                                    s.Name.AddSpaces(first_column_width) + " " +
                                    (character.Eigenschaften["fk"] + s.Value).ToString().AddSpacesAtHead(2)));
                            break;
                        case "v":
                        case "vt":
                        case "vor":
                        case "vorteil":
                        case "vorteile":
                        case "nachteil":
                        case "nachteile":
                            res.AddRange(
                                character.Vorteile
                                    .Select(s => s.Name + "\t " + s.Value));
                            break;

                        default:
                            res.Add($"Kommando {prop} nicht gefunden");
                            break;
                    }

                    res.Add("");
                }
            }


            var sb = new StringBuilder();
            foreach (var re in res) sb.AppendLine(re);

            return sb.ToString();
            /* 
            if (persist == 1)
            {
                await this.ReplyAsync(res, true);
            }
            else
            {
                await this.ReplyAsync(res, TimeSpan.FromSeconds(90));
            }*/
        }
    }
}