summaryrefslogtreecommitdiff
path: root/DSACore/Commands
diff options
context:
space:
mode:
authorDennis Kobert <d-kobert@web.de>2019-05-19 17:58:42 +0200
committerDennis Kobert <d-kobert@web.de>2019-05-19 17:58:42 +0200
commit2ab4051c6fe720dc47e99b0c305a0d779ee02d51 (patch)
tree9510ddbb174a54474934adf7991a5ba2aa39f818 /DSACore/Commands
parentc4d046858e0822b7c2c540ac2368b2c0e88e7a26 (diff)
Moved Gamelogic to DSALib
Diffstat (limited to 'DSACore/Commands')
-rw-r--r--DSACore/Commands/CommandHandler.cs134
-rw-r--r--DSACore/Commands/CommandTypes.cs13
-rw-r--r--DSACore/Commands/FileHandler.cs31
-rw-r--r--DSACore/Commands/Gm.cs176
-rw-r--r--DSACore/Commands/HeldList.cs174
-rw-r--r--DSACore/Commands/Help.cs54
-rw-r--r--DSACore/Commands/LebenUndAstral.cs172
-rw-r--r--DSACore/Commands/List.cs46
-rw-r--r--DSACore/Commands/MiscCommands.cs219
-rw-r--r--DSACore/Commands/NpcCommands.cs35
-rw-r--r--DSACore/Commands/ProbenTest.cs85
11 files changed, 0 insertions, 1139 deletions
diff --git a/DSACore/Commands/CommandHandler.cs b/DSACore/Commands/CommandHandler.cs
deleted file mode 100644
index f74f87f..0000000
--- a/DSACore/Commands/CommandHandler.cs
+++ /dev/null
@@ -1,134 +0,0 @@
-using System;
-using DSACore.Auxiliary;
-using DSACore.Auxiliary.Calculator;
-using DSACore.DSA_Game;
-using DSACore.Models.Network;
-
-namespace DSACore.Commands
-{
- public class CommandHandler
- {
- public static CommandResponse ExecuteCommand(Command cmd)
- {
- var res = string.Empty;
- var type = ResponseType.Broadcast;
- switch (cmd.CmdIdentifier.ToLower())
- {
- case "addChar":
- res = FileHandler.AddChar(cmd.CharId, cmd.CmdText);
- break;
- case "held":
- case "wert":
- case "werte":
- case "char":
- res = HeldList.ListAsync(cmd.CharId, cmd.CmdText);
- break;
- case "help":
- case "man":
- case "hilfe":
- case "h":
- res = Help.ShowHelp(cmd.CmdTexts.ToArray());
- type = ResponseType.Caller;
- break;
- case "le":
- case "leben":
- case "lp":
- res = LE.LEAsync(cmd.CharId, cmd.CmdText);
- break;
- case "ae":
- case "astral":
- case "asp":
- res = AE.AEAsync(cmd.CharId, cmd.CmdText);
- break;
- case "list":
- res = List.ListAsync(cmd.CmdText);
- type = ResponseType.Caller;
- break;
- case "r":
- case "roll":
- res = RandomMisc.Roll(cmd.CmdText + " " + cmd.Cmdmodifier);
- break;
- case "solve":
- 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);
- return new CommandResponse($"Kommando {cmd.CmdIdentifier} nicht gefunden", ResponseType.Error);
- }
-
- private static string Proben(string name, string command, string waffe, int erschwernis = 0)
- {
- var res = string.Empty;
- switch (command.ToLower())
- {
- case "f":
- case "fern":
- case "fernkampf":
- res = CheckCommand(name, CommandTypes.Fernkampf, waffe, erschwernis);
- break;
- case "t":
- case "ta":
- case "talent":
- case "talente":
- res = CheckCommand(name, CommandTypes.Talent, waffe, erschwernis);
- break;
- case "e":
- case "ei":
- case "eigenschaft":
- res = CheckCommand(name, CommandTypes.Eigenschaft, waffe, erschwernis);
- break;
- case "z":
- case "za":
- case "zauber":
- case "magie":
- case "m":
- res = CheckCommand(name, CommandTypes.Talent, waffe, erschwernis);
- break;
- case "a":
- case "at":
- case "an":
- case "angrif":
- case "angriff":
- res = CheckCommand(name, CommandTypes.Angriff, waffe, erschwernis);
- break;
- case "p":
- case "pa":
- case "parade":
- res = CheckCommand(name, CommandTypes.Parade, waffe, erschwernis);
- break;
- }
-
- return res;
- }
-
- private static string CheckCommand(string name, CommandTypes command, string waffe, int erschwernis = 0)
- {
- var chr = Dsa.GetCharacter(0);
-
- switch (command)
- {
- case CommandTypes.Talent:
- return chr.TestTalent(waffe, erschwernis);
- case CommandTypes.Eigenschaft:
- return chr.TestEigenschaft(waffe, erschwernis);
- case CommandTypes.Angriff:
- return chr.Angriff(waffe, erschwernis);
- case CommandTypes.Parade:
- return chr.Parade(waffe, erschwernis);
- case CommandTypes.Fernkampf:
- return chr.Fernkampf(waffe, erschwernis);
- case CommandTypes.Zauber:
- return chr.TestZauber(waffe, erschwernis);
- }
-
- return $"{name} verwendet {waffe}";
-
- 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
deleted file mode 100644
index 6838ac2..0000000
--- a/DSACore/Commands/CommandTypes.cs
+++ /dev/null
@@ -1,13 +0,0 @@
-namespace DSACore.Commands
-{
- public enum CommandTypes
- {
- Talent,
- Eigenschaft,
- Angriff,
- Parade,
- Fernkampf,
- KeinChar,
- Zauber
- }
-} \ No newline at end of file
diff --git a/DSACore/Commands/FileHandler.cs b/DSACore/Commands/FileHandler.cs
deleted file mode 100644
index bce7c54..0000000
--- a/DSACore/Commands/FileHandler.cs
+++ /dev/null
@@ -1,31 +0,0 @@
-using System;
-using System.Linq;
-using System.Net;
-using DSACore.DSA_Game;
-using DSACore.DSA_Game.Characters;
-using DSALib;
-
-namespace DSACore.Commands
-{
- 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.EndsWith(".xml")) throw new ArgumentException("Es wurde kein xml Held mitgeschickt");
-
- 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));
-
- return $"{url.Split("/").Last()} wurde erfolgreich gespeichert";
- }
- }
-} \ No newline at end of file
diff --git a/DSACore/Commands/Gm.cs b/DSACore/Commands/Gm.cs
deleted file mode 100644
index 98b62db..0000000
--- a/DSACore/Commands/Gm.cs
+++ /dev/null
@@ -1,176 +0,0 @@
-namespace DSACore.Commands
-{
- /*public class Iam
- {
-
- [Command("Iam"), Summary("Wechselt den Character")]
- [Alias("iam", "I_am", "i_am", "IchBin", "ichbin", "Ichbin", "Ich_bin", "ich_bin", "Ich", "ich", "I", "i")]
- public Task Change_Character(params string[] givenName) // use fancy parameters
- {
- string res;
- string name;
-
- if (givenName.Length == 0 || (givenName.Length == 1 && (givenName[0].ToLower().Equals("bin") || givenName[0].ToLower().Equals("am"))))
- {
- res = " \nDu bist " + Dsa.Session.Relation[this.Context.User.Username] + "!\n \n";
-
- return this.ReplyAsync("```xl\n" + res + "\n```");
- }
-
- if (givenName.Length > 1 && (givenName[0].ToLower().Equals("bin") || givenName[0].ToLower().Equals("am")) )
- {
- name = givenName.Skip(1).Aggregate((s, c) => s + c); // (Skip(1)) don't use the first element; Aggregate: take source s and do operation s = s+c for all elements
- }
- else
- {
- name = givenName.Aggregate((s, c) => s + c);
- }
-
- if (name.ToLower().Equals("man") || name.ToLower().Equals("help"))
- {
- return this.ReplyAsync("```xl\n" + Help.Get_Specific_Help("ich bin") + "\n```");
-
- }
-
- var character = Dsa.Chars.OrderBy(x => SpellCorrect.CompareEasy(name, x.Name)).First(); // usage of compareEasy
-
- Dsa.Session.Relation[this.Context.User.Username] = character.Name;
- res = " \nWillkommen " + character.Name + "!\n \n";
-
-
- return this.ReplyAsync("```xl\n" + res + "\n```");
- }
- }
-
-
- public class Gm : ModuleBase
- {
- public static string CheckCommand(string name, CommandTypes command, string waffe, int erschwernis = 0)
- {
- var comp = new SpellCorrect();
- var chr = Dsa.Chars.OrderBy(x => comp.Compare(name, x.Name)).First();
-
- switch (command)
- {
- case CommandTypes.Talent:
- return chr.TestTalent(waffe, erschwernis);
- case CommandTypes.Eigenschaft:
- return chr.TestEigenschaft(waffe, erschwernis);
- case CommandTypes.Angriff:
- return chr.Angriff(waffe, erschwernis);
- case CommandTypes.Parade:
- return chr.Parade(waffe, erschwernis);
- case CommandTypes.Fernkampf:
- return chr.Fernkampf(waffe, erschwernis);
- case CommandTypes.Zauber:
- return chr.TestZauber(waffe, erschwernis);
- }
-
- return $"{name} verwendet {waffe}";
- }
-
- [Command("gm"), Summary("Führt eine probe aus")]
- [Alias("GM", "as", "As", "als")]
- public async Task ProbeAsync([Summary("Fernkampfwaffe")] string name, string command, string cmdText = "", int modifier = 0)
- {
- if (!Permissions.Test(this.Context, "Meister")) return;
-
- command = command.ToLower();
-
- string res;
- string temp = string.Empty;
- ICharacter cha = Dsa.Chars.OrderBy(x =>
- SpellCorrect.CompareEasy(name, x.Name)).First();
- switch (command)
- {
- case "le":
- case "leben":
- case "lp":
- LE le = new LE();
- temp = string.Empty;
-
- if (modifier != 0)
- {
- temp = modifier.ToString();
- }
-
- res = cha.get_LE_Text(cmdText.Trim() + temp);
-
- break;
- case "ae":
- case "asp":
- case "astral":
- AE ae = new AE();
- temp = string.Empty;
-
- if (modifier != 0)
- {
- temp = modifier.ToString();
- }
-
- res = cha.get_AE_Text(cmdText.Trim() + temp);
-
- break;
- default:
- res = this.Test(name, command, cmdText, modifier);
- break;
- }
-
-
- if (Dsa.GeneralContext != null && Dsa.GeneralContext.Channel.Id != this.Context.Channel.Id)
- {
- await Dsa.GeneralContext.Channel.SendMessageAsync("```xl\n" + res + "\n```");
- }
-
- await this.ReplyAsync("```xl\n" + res + "\n```");
- }
-
- private string Test(string name, string command, string waffe, int erschwernis = 0)
- {
- string res;
- switch (command.ToLower())
- {
- case "f":
- case "fern":
- case "fernkampf":
- res = CheckCommand(name, CommandTypes.Fernkampf, waffe, erschwernis);
- break;
- case "t":
- case "ta":
- case "talent":
- case "talente":
- res = CheckCommand(name, CommandTypes.Talent, waffe, erschwernis);
- break;
- case "e":
- case "ei":
- case "eigenschaft":
- res = CheckCommand(name, CommandTypes.Eigenschaft, waffe, erschwernis);
- break;
- case "z":
- case "za":
- case "zauber":
- case "magie":
- case "m":
- res = CheckCommand(name, CommandTypes.Talent, waffe, erschwernis);
- break;
- case "a":
- case "at":
- case "an":
- case "angrif":
- case "angriff":
- res = CheckCommand(name, CommandTypes.Angriff, waffe, erschwernis);
- break;
- case "p":
- case "pa":
- case "parade":
- res = CheckCommand(name, CommandTypes.Parade, waffe, erschwernis);
- break;
- default:
- res = $"Kommando {command} nicht gefunden";
- break;
- }
-
- return res;
- }
- }*/
-} \ No newline at end of file
diff --git a/DSACore/Commands/HeldList.cs b/DSACore/Commands/HeldList.cs
deleted file mode 100644
index 370af34..0000000
--- a/DSACore/Commands/HeldList.cs
+++ /dev/null
@@ -1,174 +0,0 @@
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using DSACore.Auxiliary;
-using DSACore.DSA_Game;
-using DSACore.DSA_Game.Characters;
-
-namespace DSACore.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));
- }*/
- }
- }
-} \ No newline at end of file
diff --git a/DSACore/Commands/Help.cs b/DSACore/Commands/Help.cs
deleted file mode 100644
index 974c44c..0000000
--- a/DSACore/Commands/Help.cs
+++ /dev/null
@@ -1,54 +0,0 @@
-using System.Linq;
-using DSACore.Auxiliary;
-using DSACore.DSA_Game.Save;
-
-namespace DSACore.Commands
-{
- public class Help
- {
- //public static List<CommandInfo> Commands { get; } = new List<CommandInfo>();
-
-
- public static string Get_Specific_Help(string command)
- {
- // return command specific help
- 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()
- {
- var res = "";
- foreach (var com in Properties.CommandInfos)
- {
- 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\n";
- }
-
- return res;
- }
-
- public static string ShowHelp(params string[] commandList)
- {
- var command = "";
- if (commandList.Length > 0) command = commandList.Aggregate((s, c) => s + " " + c);
-
- if (command.Equals(string.Empty)) // return 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
deleted file mode 100644
index a671296..0000000
--- a/DSACore/Commands/LebenUndAstral.cs
+++ /dev/null
@@ -1,172 +0,0 @@
-using System;
-using DSACore.Auxiliary;
-using DSACore.DSA_Game;
-using DSALib.Characters;
-
-namespace DSACore.Commands
-{
- public class LE
- {
- public static string LEAsync(ulong id, string modifier)
- {
- //This is the string that will be printed
- var res = "";
-
-
- //Get the actual text
- res += Dsa.GetCharacter(id).get_LE_Text(modifier);
-
-
- return res;
- }
- }
-
- public class AE
- {
- public static string AEAsync(ulong id, string modifier)
- {
- //This is the string that will be printed
- var res = "";
-
-
- //Get the actual text
- res += Dsa.GetCharacter(id).get_AE_Text(modifier);
-
- return res;
- }
- }
-
- public static class StatExtension
- {
- public static string get_LE_Text(this ICharacter c, string prop)
- {
- var res = "";
- var comp = new SpellCorrect();
- var character = c;
-
- res += character.Name + ":\n";
-
- //If there is actual input we process it
- if (prop.Length > 0)
- {
- res += "LE: ";
- res += character.Lebenspunkte_Aktuell + "/" + character.Lebenspunkte_Basis + " -> ";
-
- // Apply a change to current value
- if (prop.StartsWith("+") || prop.StartsWith("-"))
- {
- //Allow overflowing the max
- if (prop.StartsWith("++"))
- {
- character.Lebenspunkte_Aktuell = character.Lebenspunkte_Aktuell +
- Convert.ToInt32(prop.Substring(1, prop.Length - 1));
- }
- else
- {
- 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;
- res += " Maximale Lebenspunkte sind erreicht ";
- }
- //Simply apply change
- else
- {
- character.Lebenspunkte_Aktuell = character.Lebenspunkte_Aktuell + Convert.ToInt32(prop);
- }
- }
-
- res += character.Lebenspunkte_Aktuell + "/" + character.Lebenspunkte_Basis;
- }
- else
- {
- // Set to new value regardless of original
- character.Lebenspunkte_Aktuell = Convert.ToInt32(prop);
-
- res += character.Lebenspunkte_Aktuell + "/" + character.Lebenspunkte_Basis;
- }
- }
- //If no value is passed, the curent value is displayed
- else
- {
- res += "LE: " + character.Lebenspunkte_Aktuell + "/" + character.Lebenspunkte_Basis;
- }
-
- return res;
- }
-
- public static string get_AE_Text(this ICharacter c, string prop)
- {
- var res = "";
- var comp = new SpellCorrect();
- var character = c;
-
- 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 + " -> ";
-
- // Apply a change to current value
- if (prop.StartsWith("+") || prop.StartsWith("-"))
- {
- //Allow overflowing the max
- if (prop.StartsWith("++"))
- {
- character.Astralpunkte_Aktuell = character.Astralpunkte_Aktuell +
- Convert.ToInt32(prop.Substring(1, prop.Length - 1));
- }
- else
- {
- 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;
- res += " Maximale Astralpunkte sind erreicht ";
- }
- //Simply apply change
- else
- {
- character.Astralpunkte_Aktuell = character.Astralpunkte_Aktuell + Convert.ToInt32(prop);
- }
- }
-
- if (character.Astralpunkte_Aktuell < 0)
- {
- res += "Nicht genügend Astralpunkte! ";
- character.Astralpunkte_Aktuell = 0;
- }
-
- res += character.Astralpunkte_Aktuell + "/" + character.Astralpunkte_Basis;
- }
- //Set to new value regardless of original
- else
- {
- character.Astralpunkte_Aktuell = Convert.ToInt32(prop);
-
- res += character.Astralpunkte_Aktuell + "/" + character.Astralpunkte_Basis;
- }
- }
- //If no value is passed, the curent value is displayed
- else
- {
- 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
deleted file mode 100644
index 7fc682f..0000000
--- a/DSACore/Commands/List.cs
+++ /dev/null
@@ -1,46 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using DSACore.Audio;
-using DSACore.DSA_Game;
-
-namespace DSACore.Commands
-{
- public class List
- {
- public static string ListAsync(string prop)
- {
- var res = new List<string>();
-
- //int persist = 0;
-
- switch (prop.ToLower())
- {
- case "man":
- case "help":
- return Help.Get_Specific_Help("List");
- // break;
- case "chars":
- res.AddRange(Dsa.Chars.Select(x => x.Name));
- break;
- case "commands":
- // res.AddRange(Help.Commands.Select(x => x.Name));
- res.Add(Help.Get_Generic_Help());
- break;
- case "play":
- case "sound":
- case "sounds":
- res.AddRange(
- Enum.GetNames(typeof(Sound)));
- break;
-
- default:
- res.Add($"Kommando {prop} nicht gefunden");
- break;
- }
-
-
- return res.ToString();
- }
- }
-} \ No newline at end of file
diff --git a/DSACore/Commands/MiscCommands.cs b/DSACore/Commands/MiscCommands.cs
deleted file mode 100644
index ebd1598..0000000
--- a/DSACore/Commands/MiscCommands.cs
+++ /dev/null
@@ -1,219 +0,0 @@
-namespace DSACore.Commands
-{
- public class MiscCommands
- {
- /*[Command("r"), Summary("Würfelt ")]
- [Alias("R", "Roll", "roll", "Würfle")]
- public Task RollAsync([Remainder, Summary("Weapon")] string roll)
- {
- //return this.ReplyAsync("```xl\n" + new Auxiliary.Calculator.StringSolver(roll).Solve() + "\n```");
- return this.ReplyAsync("```xl\n" + RandomMisc.Roll(roll) + "\n```");
- }
-
- [Command("rd"), Summary("Würfel Dennis ")]
- public Task RollDennisAsync([Remainder, Summary("Weapon")] string roll)
- {
- return this.ReplyAsync("```xl\n" + new DSACore.Auxiliary.Calculator.StringSolver(roll).Solve() + "\n```");
- }*/
-/*
-
- [Command("general"), Summary("Set General ")]
- public Task SetGeneralAsync([Remainder, Summary("Set General")] int i = 0)
- {
- Dsa.GeneralContext = this.Context;
- return this.Context.Channel.SendMessageAsync($"```xl\n Der Dachs hat in '{this.Context.Channel.Name}' ein Zuhause gefunden. Gm Nachrichten werden nun auch in diesem Channel gepostet. \n```");
- }
-
- [Command("say"), Summary("Echos a message.")]
- [Alias("s")]
- public Task SayAsync([Remainder, Summary("The text to echo")] string echo)
- {
- return this.ReplyAsync(echo);
- }
-
- [Command("liebe"), Summary("Echos a message.")]
- [Alias("Liebe", "<3", "love")]
- public async Task LoveAsync()
- {
- Random rand = new Random();
- var user = HostingApplication.Context.Channel.GetUsersAsync().ToList().Result.ToList().First().Where(x=>x.Status!= UserStatus.Offline).OrderBy(x => rand.Next()).First();
- await this.ReplyAsync(":heart: :heart: :heart: Verteilt die Liebe! :heart: :heart: :heart: \n Besondere Liebe geht an " + user.Username);
- //await this.ReplyAsync("!liebe");
- }
-
- [Command("maul"), Summary("Echos a message.")]
- public Task MaulAsync()
- {
- return this.ReplyAsync("Maul...? Du meintest doch sicher Maulwürfe oder? \n:heart: :heart: :heart: \nGanz viel Liebe für Maulwürfe !\n:heart: :heart: :heart:");
-
- }
-
- [Command("report"), Summary("Report a Tweet")]
- public async Task ReportAsync([Remainder, Summary("Link")] string link)
- {
- var content = new System.Net.Http.StringContent(link);
-
- using (HttpClient client = new HttpClient())
- {
- var response = await client.PostAsync("http://www.example.com/recepticle.aspx", content);
- }
-
- await this.ReplyAsync($"Dein report wurde hinzugefügt");
- }
-
- [Command("match"), Summary("Tinder.")]
- [Alias("mach","pass", "passt")]
- public Task TinderAsync(string s1, string s2)
- {
-
- var sc = new SpellCorrect();
- var rand = new System.Random((s1+s2).GetHashCode());
-
- var wert = Math.Log10(Math.Floor(1000.0 * (SpellCorrect.CompareExact(s1, s2) + rand.NextDouble() * 10.0)) / 1000.0);
- wert = ((wert * 100.0) < 100.0 ? wert * 100.0 : 100.0 - wert);
- wert = wert < 0 ? -wert : wert;
- return this.ReplyAsync($"Ihr passt zu {Math.Floor(100.0 * wert )/ 100.0}% zusammen");
-
- }
-
- [Command("reddit"), Summary("Reddit.")]
- public Task RedditAsync()
- {
- return this.ReplyAsync($"Ein Archiv der Vergangenen Aktionen findet man hier: https://www.reddit.com/r/ReconquistaInternet/");
-
- }
-
- [Command("compare"), Summary("Echos a message.")]
- public async Task KickAsync()
- {
- //await this.Context.Guild.DownloadUsersAsync();
- var users = HostingApplication.Context.Guild.GetUsersAsync(CacheMode.AllowDownload);
- var test = File.ReadAllLines("RG.txt");
- await users;
- var us = users.Result.Select(x => x.Username);
-
- var lines = test.Where(x => !x.Equals(string.Empty)).ToList();
-
-
- var sc = new SpellCorrect();
-
- var res = new List<string>();
-
- foreach (string line in lines)
- {
- var best = us.OrderBy(user => sc.Compare(user, line)).First();
-
- double fit = sc.Compare(best, line);
-
- if (fit < SpellCorrect.ErrorThreshold - 20000)
- {
- if (fit.Equals(0))
- {
- res.Add($"@\t{best} !!! => {line}");
- }
- else
- {
- res.Add($"-\t{best} hat Ähnlichkeit mit: {line}");
- }
- }
- }
-
- 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);
- }
-
- if(Permissions.Check(this.Context, new []{"Admin", "Mod"}))
- await this.ReplyTimedAsync(sb.ToString(), TimeSpan.FromSeconds(90));
-
- //await this.ReplyAsync($"{count} Duplikate gefunden");
-
- }
-
-
- [Command("clear"), Summary("Cleans up messages.")]
- public async Task DeleteAsync(int count)
- {
- var messagesAsync = HostingApplication.Context.Channel.GetMessagesAsync(count);
- Task.WaitAll(messagesAsync.ToArray());
- var list = messagesAsync.ToEnumerable().ToList();
- var messages = new List<IMessage>();
- foreach (var task in list)
- {
- messages.AddRange(task.ToList());
- }
-
- if (Permissions.Check(HostingApplication.Context, new[] { "Admin", "Mod", "Meister" }))
- {
-
- var waiters = new List<Task>();
- foreach (var message in messages)
- {
- waiters.Add((message as IUserMessage).DeleteAsync());
- }
-
- Task.WaitAll(waiters.ToArray());
- }
-
- }
-
- [Command("check"), Summary("Echos a message.")]
- [Alias("Check")]
- public async Task CheckAsync(string quarry)
- {
- var perm = new List<string> { "Admin", "Mod", "Privatpolizei" };
-
- Permissions.Test(this.Context, perm.ToArray());
-
- var test = File.ReadAllLines("RG.txt");
-
- var lines = test.Where(x => !x.Equals(string.Empty)).ToList();
-
-
- var sc = new SpellCorrect();
- var count = lines.OrderBy(line => sc.Compare(quarry, line)).First();
-
- var fit = sc.Compare(count, quarry);
-
- string Antwort;
-
- if (fit < SpellCorrect.ErrorThreshold - 20000)
- {
- Antwort= $"```xl\nAuf anderem Server Match gefunden: {count}";
- }
- else
- {
- Antwort = $"```xl\nAuf anderem Server Kein Match gefunden: {quarry}";
- }
-
-
- var users = HostingApplication.Context.Guild.GetUsersAsync(CacheMode.AllowDownload);
- await users;
- var us = users.Result.Select(x => x.Username);
-
- sc = new SpellCorrect();
- count = us.OrderBy(line => sc.Compare(quarry, line)).First();
-
- fit = sc.Compare(count, quarry);
-
- if (fit < SpellCorrect.ErrorThreshold - 20000)
- {
- Antwort = Antwort + $"\nAuf unserem Server Match gefunden: {count}\n```";
- }
- else
- {
- Antwort = Antwort + $"\nAuf unserem Server Kein Match gefunden: {quarry} \n```";
- }
-
- await ReplyAsync(Antwort);
-
- }*/
- }
-} \ No newline at end of file
diff --git a/DSACore/Commands/NpcCommands.cs b/DSACore/Commands/NpcCommands.cs
deleted file mode 100644
index 95243ca..0000000
--- a/DSACore/Commands/NpcCommands.cs
+++ /dev/null
@@ -1,35 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using DSACore.Characters;
-using DSACore.DSA_Game;
-using DSACore.DSA_Game.Characters;
-
-namespace DSACore.Commands
-{
- public class NpcCommands
- {
- public static string CreateNpc(ulong id, IEnumerable<string> props, int 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)
- {
- throw new NotImplementedException();
- 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");
- throw new NotImplementedException();
- var chr = Dsa.GetCharacter(id);
- Dsa.Chars.Add(new Character(chr as Character, npcName, stDv));
- return $"{npcName} wurde als variierte Kopie von {source} erstellt";
- }
- }
-} \ No newline at end of file
diff --git a/DSACore/Commands/ProbenTest.cs b/DSACore/Commands/ProbenTest.cs
deleted file mode 100644
index d0800d6..0000000
--- a/DSACore/Commands/ProbenTest.cs
+++ /dev/null
@@ -1,85 +0,0 @@
-namespace DSACore.Commands
-{
- public class ProbenTest
- {
- /*[Command("t"), Summary("Würfelt ein Talent-/Zauberprobe")]
- [Alias("T", "Talent", "talent", "versuche")]
- public Task TalentAsync([Summary("Talent oder Zaubername")] string talent, int erschwernis = 0)
- {
- string res;
- try
- {
- res = Gm.CheckCommand(
- Dsa.Session.Relation[this.Context.User.Username],
- CommandTypes.Talent,
- talent,
- erschwernis);
- }
- catch
- {
- res = Gm.CheckCommand(
- Dsa.Session.Relation["Tardis"],
- CommandTypes.Talent,
- talent,
- erschwernis);
- }
-
- return this.ReplyAsync("```xl\n" + res + "\n```");
- }
-
- [Command("Zauber"), Summary("Würfelt ein Zauberprobe")]
- [Alias("Z", "zauber", "z")]
- public Task ZauberAsync([Summary("Zaubername")] string zauber, int erschwernis = 0)
- {
- string res;
- try
- {
- res = Gm.CheckCommand(
- Dsa.Session.Relation[this.Context.User.Username],
- CommandTypes.Zauber,
- zauber,
- erschwernis);
- }
- catch
- {
- res = Gm.CheckCommand(
- Dsa.Session.Relation["Tardis"],
- CommandTypes.Zauber,
- zauber,
- erschwernis);
- }
-
- return this.ReplyAsync("```xl\n" + res + "\n```");
- }
-
- [Command("e"), Summary("Würfelt eine Eigenschaftsprobe")]
- [Alias("E", "Eigenschaft", "eigenschaft", "eigen")]
- public Task EigenschaftAsync([Summary("Eigenschaftskürzel und Erschwernis")] string talent, int erschwernis = 0)
- {
- var chr = Dsa.Chars.Find(x => x.Name.Equals(Dsa.Session.Relation[this.Context.User.Username]));
- string res = chr.TestEigenschaft(talent, erschwernis);
- return this.ReplyAsync("```xl\n" + res + "\n```");
- }
-
- [Command("a"), Summary("Würfelt ein Angriff")]
- [Alias("A", "At", "at", "Angriff", "angriff", "attackiere_mit", "attacke", "Attacke")]
- public Task AngriffAsync([Summary("Weapon")] string weapon, int erschwernis = 0)
- {
- return this.ReplyAsync("```xl\n" + Dsa.Chars.Find(x => x.Name.Equals(Dsa.Session.Relation[this.Context.User.Username])).Angriff(weapon, erschwernis) + "\n```");
- }
-
- [Command("p"), Summary("Würfelt eine Parade Probe")]
- [Alias("P", "Parade", "parade", "pariere_mit")]
- public Task ParadeAsync([Summary("Parade Weapon")] string talent, int erschwernis = 0)
- {
- return this.ReplyAsync("```xl\n" + Dsa.Chars.Find(x => x.Name.Equals(Dsa.Session.Relation[this.Context.User.Username])).Parade(talent, erschwernis) + "\n```");
- }
-
- [Command("f"), Summary("Führt eine Fernkampfprobe aus")]
- [Alias("F", "fern", "Fern", "Schuss", "schuss", "fernkampf", "Fernkampf", "schieße", "schieße_mit")]
- public Task FernkampfAsync([Summary("Fernkampfwaffe")] string waffe, int erschwernis = 0)
- {
- 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