From 1d36610c1f99b671e159228c03224a4b3ebfe140 Mon Sep 17 00:00:00 2001 From: Kobert-P Date: Mon, 11 Jun 2018 23:39:49 +0200 Subject: Trennung von !list in !list und !Held --- DiscoBot/Commands/List.cs | 130 ++-------------------------------------------- 1 file changed, 3 insertions(+), 127 deletions(-) (limited to 'DiscoBot/Commands/List.cs') diff --git a/DiscoBot/Commands/List.cs b/DiscoBot/Commands/List.cs index e87c675..a251183 100644 --- a/DiscoBot/Commands/List.cs +++ b/DiscoBot/Commands/List.cs @@ -19,11 +19,7 @@ public async Task ListAsync([Summary("Aktion")] string prop) { var res = new List(); - - var character = ((Character)Dsa.Chars.Find(x => x.Name.Equals(Dsa.Relation[this.Context.User.Username]))); - - int first_column_width = 18; - + int persist = 0; switch (prop.ToLower()) @@ -33,46 +29,6 @@ await this.ReplyAsync("```xl\n" + Help.Get_Specific_Help("List") + "\n```"); return; // break; - case "all": - case "held": - case "char": - case "brief": - case "zettel": - persist = 1; - - 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(""); - //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)); - } - break; case "chars": res.AddRange(Dsa.Chars.Select(x => x.Name)); break; @@ -80,106 +36,26 @@ // res.AddRange(Help.Commands.Select(x => x.Name)); res.Add(Help.Get_Generic_Help()); break; - case "e": - case "eig": - case "eigenschaft": - case "eigenschaften": - res.Add(character.Name + ":\n"); - res.AddRange( - character.Eigenschaften.Take(8).Select(s => s.Key + ":\t " + s.Value)); - break; - case "stat": - case "stats": - res.Add(character.Name + ":\n"); - res.AddRange( - //character.Eigenschaften.Select(s => s.Key + ":\t " + s.Value)); - 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 "t": - case "ta": - case "talent": - case "talente": - res.Add(character.Name + ":\n"); - 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.Add(character.Name + ":\n"); - 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(character.Name + ":"); - 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 "fern": - res.Add(character.Name + ":\n"); - res.AddRange( - character.Talente.Select(s => s.Name)); - break; case "play": case "sound": case "sounds": res.AddRange( Enum.GetNames(typeof(Sound))); break; - case "v": - case "vt": - case "vor": - case "vorteil": - case "vorteile": - case "nachteil": - case "nachteile": - res.Add(character.Name + ":\n"); - 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) - { - if (persist == 1) - { - await this.ReplyAsync("```xl\n" + sb.ToString() + "\n```"); - } - else - { - await this.ReplyTimedAsync(sb.ToString(), TimeSpan.FromSeconds(90)); - } - sb.Clear(); - } - sb.AppendLine(re); - } if (persist == 1) { - await this.ReplyAsync("```xl\n" + sb.ToString() + "\n```"); + await this.ReplyAsync(res); } else { - await this.ReplyTimedAsync(sb.ToString(), TimeSpan.FromSeconds(90)); + await this.ReplyAsync(res, TimeSpan.FromSeconds(90)); } } } -- cgit v1.2.3-70-g09d2