diff options
Diffstat (limited to 'DSACore/Commands')
-rw-r--r-- | DSACore/Commands/CommandHandler.cs | 25 | ||||
-rw-r--r-- | DSACore/Commands/CommandTypes.cs | 2 | ||||
-rw-r--r-- | DSACore/Commands/FileHandler.cs | 36 | ||||
-rw-r--r-- | DSACore/Commands/Gm.cs | 11 | ||||
-rw-r--r-- | DSACore/Commands/HeldList.cs | 74 | ||||
-rw-r--r-- | DSACore/Commands/Help.cs | 52 | ||||
-rw-r--r-- | DSACore/Commands/LebenUndAstral.cs | 56 | ||||
-rw-r--r-- | DSACore/Commands/List.cs | 9 | ||||
-rw-r--r-- | DSACore/Commands/MiscCommands.cs | 15 | ||||
-rw-r--r-- | DSACore/Commands/NpcCommands.cs | 17 | ||||
-rw-r--r-- | DSACore/Commands/ProbenTest.cs | 4 |
11 files changed, 121 insertions, 180 deletions
diff --git a/DSACore/Commands/CommandHandler.cs b/DSACore/Commands/CommandHandler.cs index f43633f..f74f87f 100644 --- a/DSACore/Commands/CommandHandler.cs +++ b/DSACore/Commands/CommandHandler.cs @@ -1,7 +1,7 @@ using System; using DSACore.Auxiliary; +using DSACore.Auxiliary.Calculator; using DSACore.DSA_Game; -using DSACore.Models; using DSACore.Models.Network; namespace DSACore.Commands @@ -10,8 +10,8 @@ namespace DSACore.Commands { public static CommandResponse ExecuteCommand(Command cmd) { - string res = string.Empty; - ResponseType type = ResponseType.Broadcast; + var res = string.Empty; + var type = ResponseType.Broadcast; switch (cmd.CmdIdentifier.ToLower()) { case "addChar": @@ -21,7 +21,7 @@ namespace DSACore.Commands case "wert": case "werte": case "char": - res = Commands.HeldList.ListAsync(cmd.CharId, cmd.CmdText); + res = HeldList.ListAsync(cmd.CharId, cmd.CmdText); break; case "help": case "man": @@ -49,28 +49,21 @@ namespace DSACore.Commands res = RandomMisc.Roll(cmd.CmdText + " " + cmd.Cmdmodifier); break; case "solve": - res = new Auxiliary.Calculator.StringSolver(cmd.CmdText + cmd.Cmdmodifier).Solve().ToString(); + res = new StringSolver(cmd.CmdText + cmd.Cmdmodifier).Solve().ToString(); break; case "npc": res = NpcCommands.CreateNpc(cmd.CharId, cmd.CmdTexts, cmd.Cmdmodifier); break; - } - if (res == string.Empty) - { - res= Proben(cmd.Name, cmd.CmdIdentifier, cmd.CmdText, cmd.Cmdmodifier); - } - if (res != string.Empty) - { - return new CommandResponse(res, type); - } + if (res == string.Empty) res = Proben(cmd.Name, cmd.CmdIdentifier, cmd.CmdText, cmd.Cmdmodifier); + if (res != string.Empty) return new CommandResponse(res, type); return new CommandResponse($"Kommando {cmd.CmdIdentifier} nicht gefunden", ResponseType.Error); } private static string Proben(string name, string command, string waffe, int erschwernis = 0) { - string res = string.Empty; + var res = string.Empty; switch (command.ToLower()) { case "f": @@ -138,4 +131,4 @@ namespace DSACore.Commands throw new NotImplementedException("access char by id ore name and group id"); } } -} +}
\ No newline at end of file diff --git a/DSACore/Commands/CommandTypes.cs b/DSACore/Commands/CommandTypes.cs index d53328b..6838ac2 100644 --- a/DSACore/Commands/CommandTypes.cs +++ b/DSACore/Commands/CommandTypes.cs @@ -10,4 +10,4 @@ KeinChar, Zauber } -} +}
\ No newline at end of file diff --git a/DSACore/Commands/FileHandler.cs b/DSACore/Commands/FileHandler.cs index af4698a..bce7c54 100644 --- a/DSACore/Commands/FileHandler.cs +++ b/DSACore/Commands/FileHandler.cs @@ -1,37 +1,29 @@ -using DSACore.DSA_Game; +using System; +using System.Linq; +using System.Net; +using DSACore.DSA_Game; using DSACore.DSA_Game.Characters; +using DSALib; namespace DSACore.Commands { - using System; - using System.Linq; - using System.Net; - - using DSALib; - public class FileHandler { public static string AddChar(ulong id, string url) { - if (url == string.Empty) - { - throw new ArgumentException("Es wurde keine Datei angehängt"); - } - + if (url == string.Empty) throw new ArgumentException("Es wurde keine Datei angehängt"); + + + if (!url.EndsWith(".xml")) throw new ArgumentException("Es wurde kein xml Held mitgeschickt"); - if (!url.EndsWith(".xml")) + using (var client = new WebClient()) { - throw new ArgumentException("Es wurde kein xml Held mitgeschickt"); + client.DownloadFile(url, "helden\\" + url.Split("/").Last()); } - - using (var client = new WebClient()) - { - client.DownloadFile(url, "helden\\" + url.Split("/").Last()); - } - Dsa.Chars.Add(new Character("helden\\" + url.Split("/").Last())); - (Dsa.Chars.Last() as Character)?.Talente.Select(x => new Talent(x.Name, x.Probe, 0)) - .Where(c => !Dsa.Talente.Exists(v => v.Name.Equals(c.Name))).ToList().ForEach(v => Dsa.Talente.Add(v)); + Dsa.Chars.Add(new Character("helden\\" + url.Split("/").Last())); + (Dsa.Chars.Last() as Character)?.Talente.Select(x => new Talent(x.Name, x.Probe, 0)) + .Where(c => !Dsa.Talente.Exists(v => v.Name.Equals(c.Name))).ToList().ForEach(v => Dsa.Talente.Add(v)); return $"{url.Split("/").Last()} wurde erfolgreich gespeichert"; } diff --git a/DSACore/Commands/Gm.cs b/DSACore/Commands/Gm.cs index a320269..98b62db 100644 --- a/DSACore/Commands/Gm.cs +++ b/DSACore/Commands/Gm.cs @@ -1,12 +1,5 @@ -using DSACore.Auxiliary; -using DSACore.DSA_Game; - -namespace DSACore.Commands +namespace DSACore.Commands { - using System.Linq; - using System.Threading.Tasks; - using DSALib.Characters; - /*public class Iam { @@ -180,4 +173,4 @@ namespace DSACore.Commands return res; } }*/ -} +}
\ No newline at end of file diff --git a/DSACore/Commands/HeldList.cs b/DSACore/Commands/HeldList.cs index 825474c..370af34 100644 --- a/DSACore/Commands/HeldList.cs +++ b/DSACore/Commands/HeldList.cs @@ -1,9 +1,9 @@ using System.Collections.Generic; using System.Linq; using System.Text; -using DSACore.DSA_Game.Characters; using DSACore.Auxiliary; using DSACore.DSA_Game; +using DSACore.DSA_Game.Characters; namespace DSACore.Commands { @@ -15,63 +15,65 @@ namespace DSACore.Commands var character = Dsa.GetCharacter(id) as Character; - int first_column_width = 18; - + 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")) - { + 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)); + 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))); + 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))); + 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)); + .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)); + 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)); - } - + 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")) + 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 (string prop in prop_list) + foreach (var prop in prop_list) { - switch (prop.ToLower()) { case "e": @@ -79,18 +81,16 @@ namespace DSACore.Commands case "eigenschaft": case "eigenschaften": res.AddRange( - character.Eigenschaften.Take(8).Select(s => s.Key + ":\t " + s.Value)); + 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)); + 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); @@ -103,12 +103,16 @@ namespace DSACore.Commands 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)); + 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)); + character.Zauber.Select(s => + (s.Name.AddSpaces(first_column_width) + " " + s.Value).AddSpaces( + first_column_width + 5) + " " + s.Probe)); break; case "w": case "waffe": @@ -118,13 +122,17 @@ namespace DSACore.Commands 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))); + 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))); + 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": @@ -135,7 +143,7 @@ namespace DSACore.Commands case "nachteile": res.AddRange( character.Vorteile - .Select(s => s.Name + "\t " + s.Value)); + .Select(s => s.Name + "\t " + s.Value)); break; default: @@ -145,15 +153,11 @@ namespace DSACore.Commands res.Add(""); } - } var sb = new StringBuilder(); - foreach (string re in res) - { - sb.AppendLine(re); - } + foreach (var re in res) sb.AppendLine(re); return sb.ToString(); /* @@ -167,4 +171,4 @@ namespace DSACore.Commands }*/ } } -} +}
\ No newline at end of file diff --git a/DSACore/Commands/Help.cs b/DSACore/Commands/Help.cs index 1575b36..974c44c 100644 --- a/DSACore/Commands/Help.cs +++ b/DSACore/Commands/Help.cs @@ -1,76 +1,54 @@ using System.Linq; -using System.Threading.Tasks; using DSACore.Auxiliary; +using DSACore.DSA_Game.Save; namespace DSACore.Commands { public class Help { - static Help() - { - /*TextReader stream = new StreamReader(@"..\..\Help.json"); // Load command-description file - var reader = new JsonTextReader(stream); // create stream reader - - reader.Read(); // step into structure, until the array starts - reader.Read(); - reader.Read(); - - try - { - var test = new JsonSerializer().Deserialize<List<CommandInfo>>(reader); // Deserialize Data and create CommandInfo Struct - - Commands.AddRange(test); // Add new CommandInfos to List - } - catch (Exception e) - { - // ignored - }*/ - } - //public static List<CommandInfo> Commands { get; } = new List<CommandInfo>(); public static string Get_Specific_Help(string command) { // return command specific help - var com = DSACore.DSA_Game.Save.Properties.CommandInfos.OrderBy(x => SpellCorrect.CompareEasy(x.Name, command.ToLower())).First(); // get best fit command + var com = Properties.CommandInfos + .OrderBy(x => SpellCorrect.CompareEasy(x.Name, command.ToLower())).First(); // get best fit command return com.GetDescription(); } public static string Get_Generic_Help() { - string res = ""; - foreach (var com in DSACore.DSA_Game.Save.Properties.CommandInfos) + var res = ""; + foreach (var com in Properties.CommandInfos) { - int first_column_width = 8; + var first_column_width = 8; res += ("!" + com.Name + ": ").AddSpaces(first_column_width) + com.Brief; if (com.Description.Length > 1) - { - res += "\n" + "".AddSpaces(first_column_width) + "(\"!man " + com.Name + "\" gibt genauere Informationen)"; - } + res += "\n" + "".AddSpaces(first_column_width) + "(\"!man " + com.Name + + "\" gibt genauere Informationen)"; res += "\n\n"; } + return res; } - + public static string ShowHelp(params string[] commandList) { var command = ""; - if (commandList.Length > 0) { - command = commandList.Aggregate((s, c) => s + " " + c); - } + if (commandList.Length > 0) command = commandList.Aggregate((s, c) => s + " " + c); if (command.Equals(string.Empty)) // return generic Help { - string res = Get_Generic_Help(); - + var res = Get_Generic_Help(); + return res; } - + return Get_Specific_Help(command); } } -} +}
\ No newline at end of file diff --git a/DSACore/Commands/LebenUndAstral.cs b/DSACore/Commands/LebenUndAstral.cs index b5bc260..a671296 100644 --- a/DSACore/Commands/LebenUndAstral.cs +++ b/DSACore/Commands/LebenUndAstral.cs @@ -1,8 +1,6 @@ using System; -using System.Linq; -using System.Threading.Tasks; -using DSACore.DSA_Game; using DSACore.Auxiliary; +using DSACore.DSA_Game; using DSALib.Characters; namespace DSACore.Commands @@ -12,9 +10,9 @@ namespace DSACore.Commands public static string LEAsync(ulong id, string modifier) { //This is the string that will be printed - string res = ""; + var res = ""; + - //Get the actual text res += Dsa.GetCharacter(id).get_LE_Text(modifier); @@ -23,17 +21,17 @@ namespace DSACore.Commands } } - public class AE + public class AE { public static string AEAsync(ulong id, string modifier) { //This is the string that will be printed - string res = ""; + var res = ""; //Get the actual text res += Dsa.GetCharacter(id).get_AE_Text(modifier); - + return res; } } @@ -42,11 +40,11 @@ namespace DSACore.Commands { public static string get_LE_Text(this ICharacter c, string prop) { - string res = ""; + var res = ""; var comp = new SpellCorrect(); var character = c; - res += (character.Name + ":\n"); + res += character.Name + ":\n"; //If there is actual input we process it if (prop.Length > 0) @@ -60,15 +58,20 @@ namespace DSACore.Commands //Allow overflowing the max if (prop.StartsWith("++")) { - character.Lebenspunkte_Aktuell = character.Lebenspunkte_Aktuell + Convert.ToInt32(prop.Substring(1, prop.Length - 1)); + character.Lebenspunkte_Aktuell = character.Lebenspunkte_Aktuell + + Convert.ToInt32(prop.Substring(1, prop.Length - 1)); } else { - int temp = character.Lebenspunkte_Aktuell + Convert.ToInt32(prop) - character.Lebenspunkte_Basis; + var temp = character.Lebenspunkte_Aktuell + Convert.ToInt32(prop) - + character.Lebenspunkte_Basis; //Stop from overflow overflow if (temp > 0 && prop.StartsWith("+")) { - character.Lebenspunkte_Aktuell = (character.Lebenspunkte_Basis > character.Lebenspunkte_Aktuell) ? character.Lebenspunkte_Basis : character.Lebenspunkte_Aktuell; + character.Lebenspunkte_Aktuell = + character.Lebenspunkte_Basis > character.Lebenspunkte_Aktuell + ? character.Lebenspunkte_Basis + : character.Lebenspunkte_Aktuell; res += " Maximale Lebenspunkte sind erreicht "; } //Simply apply change @@ -91,23 +94,23 @@ namespace DSACore.Commands //If no value is passed, the curent value is displayed else { - res += ("LE: " + character.Lebenspunkte_Aktuell + "/" + character.Lebenspunkte_Basis); + res += "LE: " + character.Lebenspunkte_Aktuell + "/" + character.Lebenspunkte_Basis; } return res; } + public static string get_AE_Text(this ICharacter c, string prop) { - string res = ""; + var res = ""; var comp = new SpellCorrect(); var character = c; - res += (character.Name + ":\n"); + res += character.Name + ":\n"; //If there is actual input we process it if (prop.Length > 0) { - res += "AE: "; res += character.Astralpunkte_Aktuell + "/" + character.Astralpunkte_Basis + " -> "; @@ -117,15 +120,20 @@ namespace DSACore.Commands //Allow overflowing the max if (prop.StartsWith("++")) { - character.Astralpunkte_Aktuell = character.Astralpunkte_Aktuell + Convert.ToInt32(prop.Substring(1, prop.Length - 1)); + character.Astralpunkte_Aktuell = character.Astralpunkte_Aktuell + + Convert.ToInt32(prop.Substring(1, prop.Length - 1)); } else { - int temp = character.Astralpunkte_Aktuell + Convert.ToInt32(prop) - character.Astralpunkte_Basis; + var temp = character.Astralpunkte_Aktuell + Convert.ToInt32(prop) - + character.Astralpunkte_Basis; //Stop from overflow overflow if (temp > 0 && prop.StartsWith("+")) { - character.Astralpunkte_Aktuell = (character.Astralpunkte_Basis > character.Astralpunkte_Aktuell) ? character.Astralpunkte_Basis : character.Astralpunkte_Aktuell; + character.Astralpunkte_Aktuell = + character.Astralpunkte_Basis > character.Astralpunkte_Aktuell + ? character.Astralpunkte_Basis + : character.Astralpunkte_Aktuell; res += " Maximale Astralpunkte sind erreicht "; } //Simply apply change @@ -142,7 +150,6 @@ namespace DSACore.Commands } res += character.Astralpunkte_Aktuell + "/" + character.Astralpunkte_Basis; - } //Set to new value regardless of original else @@ -155,14 +162,11 @@ namespace DSACore.Commands //If no value is passed, the curent value is displayed else { - res += ("AE: " + character.Astralpunkte_Aktuell + "/" + character.Astralpunkte_Basis); + res += "AE: " + character.Astralpunkte_Aktuell + "/" + character.Astralpunkte_Basis; } return res; } } -} - - - +}
\ No newline at end of file diff --git a/DSACore/Commands/List.cs b/DSACore/Commands/List.cs index 1fa0dde..7fc682f 100644 --- a/DSACore/Commands/List.cs +++ b/DSACore/Commands/List.cs @@ -1,9 +1,8 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Threading.Tasks; -using DSACore.DSA_Game; using DSACore.Audio; +using DSACore.DSA_Game; namespace DSACore.Commands { @@ -12,7 +11,7 @@ namespace DSACore.Commands public static string ListAsync(string prop) { var res = new List<string>(); - + //int persist = 0; switch (prop.ToLower()) @@ -20,7 +19,7 @@ namespace DSACore.Commands case "man": case "help": return Help.Get_Specific_Help("List"); - // break; + // break; case "chars": res.AddRange(Dsa.Chars.Select(x => x.Name)); break; @@ -44,4 +43,4 @@ namespace DSACore.Commands return res.ToString(); } } -} +}
\ No newline at end of file diff --git a/DSACore/Commands/MiscCommands.cs b/DSACore/Commands/MiscCommands.cs index 21646e7..ebd1598 100644 --- a/DSACore/Commands/MiscCommands.cs +++ b/DSACore/Commands/MiscCommands.cs @@ -1,15 +1,4 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Net.Http; -using System.Text; -using System.Threading.Tasks; -using DSACore.DSA_Game; -using DSACore.Auxiliary; -using Microsoft.AspNetCore.Hosting.Internal; - -namespace DSACore.Commands +namespace DSACore.Commands { public class MiscCommands { @@ -227,4 +216,4 @@ namespace DSACore.Commands }*/ } -} +}
\ No newline at end of file diff --git a/DSACore/Commands/NpcCommands.cs b/DSACore/Commands/NpcCommands.cs index 50ea966..95243ca 100644 --- a/DSACore/Commands/NpcCommands.cs +++ b/DSACore/Commands/NpcCommands.cs @@ -1,27 +1,19 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Threading.Tasks; using DSACore.Characters; using DSACore.DSA_Game; using DSACore.DSA_Game.Characters; -using DSACore.Auxiliary; -using Microsoft.AspNetCore.Mvc.Internal; namespace DSACore.Commands { public class NpcCommands { - public static string CreateNpc(ulong id, IEnumerable<string> props, int modifier) { - if (int.TryParse(props.Last(), out int mean)) - { - return Random(id, props.First(), mean, modifier); - } + if (int.TryParse(props.Last(), out var mean)) return Random(id, props.First(), mean, modifier); return Copy(id, props.First(), props.Last(), modifier); - } private static string Random(ulong id, string npcName, int mean = 9, int stDv = 1) @@ -30,13 +22,10 @@ namespace DSACore.Commands Dsa.Chars.Add(new Npc(npcName, mean, stDv)); return $"{npcName} wurde zufällig generiert"; } - + private static string Copy(ulong id, string npcName, string source, int stDv = 1) { - if (Dsa.Chars.Exists(x => x.Name.Equals(npcName))) - { - throw new Exception("Char gibt es schon"); - } + if (Dsa.Chars.Exists(x => x.Name.Equals(npcName))) throw new Exception("Char gibt es schon"); throw new NotImplementedException(); var chr = Dsa.GetCharacter(id); Dsa.Chars.Add(new Character(chr as Character, npcName, stDv)); diff --git a/DSACore/Commands/ProbenTest.cs b/DSACore/Commands/ProbenTest.cs index a927cd9..d0800d6 100644 --- a/DSACore/Commands/ProbenTest.cs +++ b/DSACore/Commands/ProbenTest.cs @@ -1,6 +1,6 @@ namespace DSACore.Commands { - public class ProbenTest + public class ProbenTest { /*[Command("t"), Summary("Würfelt ein Talent-/Zauberprobe")] [Alias("T", "Talent", "talent", "versuche")] @@ -82,4 +82,4 @@ return this.ReplyAsync("```xl\n" + Dsa.Chars.Find(x => x.Name.Equals(Dsa.Session.Relation[this.Context.User.Username])).Fernkampf(waffe, erschwernis) + "\n```"); }*/ } -} +}
\ No newline at end of file |