From ed26623e17e8dfcc036f88cca6de10d5a35697ec Mon Sep 17 00:00:00 2001 From: uzvkl Date: Mon, 20 May 2019 00:54:14 +0200 Subject: Reorganize Code delete ZoBotanica --- DSALib/Audio/Sound.cs | 18 ---- DSALib/Auxiliary/Calculator/Argument.cs | 2 +- DSALib/Auxiliary/Calculator/ISolvable.cs | 2 +- DSALib/Auxiliary/Calculator/Operator.cs | 4 +- DSALib/Auxiliary/Calculator/Ops.cs | 2 +- DSALib/Auxiliary/Calculator/StringSolver.cs | 4 +- DSALib/Auxiliary/CommandInfo.cs | 2 +- DSALib/Auxiliary/Dice.cs | 2 +- DSALib/Auxiliary/Extensions.cs | 2 +- DSALib/Auxiliary/IDataObjectEnumerableExtension.cs | 25 +++++ DSALib/Auxiliary/RandomMisc.cs | 2 +- DSALib/Auxiliary/SpellCorrect.cs | 105 ++++++--------------- DSALib/Auxiliary/TalentEnumerableExtension.cs | 27 +++--- DSALib/Auxiliary/WeaponImporter.cs | 6 +- DSALib/Characters/Critter.cs | 1 + DSALib/Commands/CommandHandler.cs | 11 ++- DSALib/Commands/CommandTypes.cs | 2 +- DSALib/Commands/FileHandler.cs | 7 +- DSALib/Commands/Gm.cs | 2 +- DSALib/Commands/HeldList.cs | 8 +- DSALib/Commands/Help.cs | 8 +- DSALib/Commands/LebenUndAstral.cs | 6 +- DSALib/Commands/List.cs | 11 +-- DSALib/Commands/MiscCommands.cs | 4 +- DSALib/Commands/NpcCommands.cs | 18 ++-- DSALib/Commands/ProbenTest.cs | 2 +- DSALib/CritterAttack.cs | 21 ----- DSALib/DSALib.csproj | 8 +- DSALib/DSA_Game/Characters/Character.cs | 22 ++--- DSALib/DSA_Game/Characters/NPC.cs | 4 +- DSALib/DSA_Game/Characters/SaveChar.cs | 2 +- DSALib/DSA_Game/Dsa.cs | 11 ++- DSALib/DSA_Game/Save/Properties.cs | 10 +- DSALib/DSA_Game/Save/SaveCommand.cs | 2 +- DSALib/DSA_Game/Save/Session.cs | 4 +- DSALib/FireBase/Database.cs | 94 +++++++++--------- DSALib/KampfTalent.cs | 18 ---- DSALib/Models/Database/DSA/Advantage.cs | 2 +- DSALib/Models/Database/DSA/CharSpell.cs | 2 +- DSALib/Models/Database/DSA/DatabaseChar.cs | 4 +- DSALib/Models/Database/DSA/Field.cs | 2 +- DSALib/Models/Database/DSA/GeneralSpell.cs | 2 +- DSALib/Models/Database/DSA/GroupChar.cs | 2 +- DSALib/Models/Database/DSA/Inventory.cs | 2 +- DSALib/Models/Database/DSA/Talent.cs | 6 +- DSALib/Models/Database/DSA/Weapon.cs | 2 +- DSALib/Models/Database/DSA/WeaponTalent.cs | 2 +- DSALib/Models/Database/DataObject.cs | 13 +++ DSALib/Models/Database/Groups/DSAGroup.cs | 4 +- DSALib/Models/Database/Groups/Group.cs | 3 +- DSALib/Models/Database/IDataObject.cs | 7 ++ DSALib/Models/Dsa/CritterAttack.cs | 19 ++++ DSALib/Models/Dsa/KampfTalent.cs | 16 ++++ DSALib/Models/Dsa/Talent.cs | 43 +++++++++ DSALib/Models/Dsa/Vorteil.cs | 16 ++++ DSALib/Models/Dsa/Zauber.cs | 16 ++++ DSALib/Models/Network/Command.cs | 2 +- DSALib/Models/Network/CommandResponse.cs | 2 +- DSALib/Models/Network/Group.cs | 2 +- DSALib/Models/Network/Token.cs | 2 +- DSALib/Models/Network/User.cs | 2 +- .../PropertiesNewtonsoft-Json-Linq-JProperty.json | 2 +- DSALib/Talent.cs | 45 --------- DSALib/Vorteil.cs | 18 ---- DSALib/Zauber.cs | 16 ---- DSALib/helden/Felis.xml | 4 - DSALib/helden/Gardist.xml | 4 - DSALib/helden/HartmutReiher.xml | 4 - .../helden/Helga_vom_Drachenei_Tausendsasserin.xml | 4 - DSALib/helden/Krenko.xml | 4 - DSALib/helden/Ledur Torfinson.xml | 4 - DSALib/helden/Morla.xml | 4 - DSALib/helden/Numeri.xml | 4 - DSALib/helden/Potus.xml | 4 - DSALib/helden/PumpausderGosse.xml | 4 - DSALib/helden/Rhoktar4.xml | 4 - DSALib/helden/Volant.xml | 4 - 77 files changed, 347 insertions(+), 434 deletions(-) delete mode 100644 DSALib/Audio/Sound.cs create mode 100644 DSALib/Auxiliary/IDataObjectEnumerableExtension.cs delete mode 100644 DSALib/CritterAttack.cs delete mode 100644 DSALib/KampfTalent.cs create mode 100644 DSALib/Models/Database/DataObject.cs create mode 100644 DSALib/Models/Database/IDataObject.cs create mode 100644 DSALib/Models/Dsa/CritterAttack.cs create mode 100644 DSALib/Models/Dsa/KampfTalent.cs create mode 100644 DSALib/Models/Dsa/Talent.cs create mode 100644 DSALib/Models/Dsa/Vorteil.cs create mode 100644 DSALib/Models/Dsa/Zauber.cs delete mode 100644 DSALib/Talent.cs delete mode 100644 DSALib/Vorteil.cs delete mode 100644 DSALib/Zauber.cs delete mode 100644 DSALib/helden/Felis.xml delete mode 100644 DSALib/helden/Gardist.xml delete mode 100644 DSALib/helden/HartmutReiher.xml delete mode 100644 DSALib/helden/Helga_vom_Drachenei_Tausendsasserin.xml delete mode 100644 DSALib/helden/Krenko.xml delete mode 100644 DSALib/helden/Ledur Torfinson.xml delete mode 100644 DSALib/helden/Morla.xml delete mode 100644 DSALib/helden/Numeri.xml delete mode 100644 DSALib/helden/Potus.xml delete mode 100644 DSALib/helden/PumpausderGosse.xml delete mode 100644 DSALib/helden/Rhoktar4.xml delete mode 100644 DSALib/helden/Volant.xml (limited to 'DSALib') diff --git a/DSALib/Audio/Sound.cs b/DSALib/Audio/Sound.cs deleted file mode 100644 index aee3060..0000000 --- a/DSALib/Audio/Sound.cs +++ /dev/null @@ -1,18 +0,0 @@ -namespace DSACore.Audio -{ - public class Sound - { - public Sound(string name, string url, int volume) - { - Name = name; - Url = url; - Volume = volume; - } - - public string Name { get; } - - public string Url { get; } - - public int Volume { get; } - } -} \ No newline at end of file diff --git a/DSALib/Auxiliary/Calculator/Argument.cs b/DSALib/Auxiliary/Calculator/Argument.cs index 5ed9ee3..e681377 100644 --- a/DSALib/Auxiliary/Calculator/Argument.cs +++ b/DSALib/Auxiliary/Calculator/Argument.cs @@ -1,6 +1,6 @@ using System; -namespace DSACore.Auxiliary.Calculator +namespace DSALib.Auxiliary.Calculator { /// /// Provides an ISolvable class to save numbers. The class handles Argument checking and conversion from string to int. diff --git a/DSALib/Auxiliary/Calculator/ISolvable.cs b/DSALib/Auxiliary/Calculator/ISolvable.cs index 7be4d19..844e9b3 100644 --- a/DSALib/Auxiliary/Calculator/ISolvable.cs +++ b/DSALib/Auxiliary/Calculator/ISolvable.cs @@ -1,4 +1,4 @@ -namespace DSACore.Auxiliary.Calculator +namespace DSALib.Auxiliary.Calculator { /// /// Object has to be able to return an integer as it's value diff --git a/DSALib/Auxiliary/Calculator/Operator.cs b/DSALib/Auxiliary/Calculator/Operator.cs index 31b2a9b..e6aeec6 100644 --- a/DSALib/Auxiliary/Calculator/Operator.cs +++ b/DSALib/Auxiliary/Calculator/Operator.cs @@ -1,7 +1,7 @@ using System; -using DSACorev.Auxiliary.Calculator; +using DSALibv.Auxiliary.Calculator; -namespace DSACore.Auxiliary.Calculator +namespace DSALib.Auxiliary.Calculator { /// /// The Operator Class represents a binary operator with tow Arguments and an Operation type diff --git a/DSALib/Auxiliary/Calculator/Ops.cs b/DSALib/Auxiliary/Calculator/Ops.cs index a5c9a2d..93046d0 100644 --- a/DSALib/Auxiliary/Calculator/Ops.cs +++ b/DSALib/Auxiliary/Calculator/Ops.cs @@ -1,4 +1,4 @@ -namespace DSACorev.Auxiliary.Calculator +namespace DSALibv.Auxiliary.Calculator { /// /// The Different Operations, witch can be performed in execution-order diff --git a/DSALib/Auxiliary/Calculator/StringSolver.cs b/DSALib/Auxiliary/Calculator/StringSolver.cs index b2a7d83..bf903da 100644 --- a/DSALib/Auxiliary/Calculator/StringSolver.cs +++ b/DSALib/Auxiliary/Calculator/StringSolver.cs @@ -1,9 +1,9 @@ using System; using System.Collections.Generic; using System.Linq; -using DSACorev.Auxiliary.Calculator; +using DSALibv.Auxiliary.Calculator; -namespace DSACore.Auxiliary.Calculator +namespace DSALib.Auxiliary.Calculator { /// /// The StringSolver divides the calculation string into operations and SubStringSolvers if the string contains diff --git a/DSALib/Auxiliary/CommandInfo.cs b/DSALib/Auxiliary/CommandInfo.cs index 1472587..d8e2188 100644 --- a/DSALib/Auxiliary/CommandInfo.cs +++ b/DSALib/Auxiliary/CommandInfo.cs @@ -1,6 +1,6 @@ using System.Linq; -namespace DSACore.Auxiliary +namespace DSALib.Auxiliary { public struct CommandInfo { diff --git a/DSALib/Auxiliary/Dice.cs b/DSALib/Auxiliary/Dice.cs index 3dd6562..b07d47f 100644 --- a/DSALib/Auxiliary/Dice.cs +++ b/DSALib/Auxiliary/Dice.cs @@ -1,7 +1,7 @@ using System; using System.Linq; -namespace DSACore.Auxiliary +namespace DSALib.Auxiliary { public static class Dice // roll it! { diff --git a/DSALib/Auxiliary/Extensions.cs b/DSALib/Auxiliary/Extensions.cs index f8e9d8e..7d367a5 100644 --- a/DSALib/Auxiliary/Extensions.cs +++ b/DSALib/Auxiliary/Extensions.cs @@ -1,4 +1,4 @@ -namespace DSACore.Auxiliary +namespace DSALib.Auxiliary { public static class StringExtension { diff --git a/DSALib/Auxiliary/IDataObjectEnumerableExtension.cs b/DSALib/Auxiliary/IDataObjectEnumerableExtension.cs new file mode 100644 index 0000000..b8a6067 --- /dev/null +++ b/DSALib/Auxiliary/IDataObjectEnumerableExtension.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text.RegularExpressions; +using System.Threading.Tasks; +using DSALib.Auxiliary; +using DSALib.Models.Database; + +namespace DSACore.Auxiliary +{ + public static class DataObjectEnumerableExtension + { + public static IDataObject Match(this IEnumerable dataObjects, string name) + { + return (dataObjects as IOrderedEnumerable ?? throw new InvalidOperationException()).OrderBy(x => SpellCorrect.Compare(name,x.Name)).Last(); + } + + public static bool TryMatch(this IEnumerable dataObjects,out IDataObject data, string name) + { + data = (dataObjects as IOrderedEnumerable ?? throw new InvalidOperationException()).OrderBy(x => SpellCorrect.Compare(name,x.Name)).Last(); + + return SpellCorrect.IsMatch(name, data.Name); + } + } +} diff --git a/DSALib/Auxiliary/RandomMisc.cs b/DSALib/Auxiliary/RandomMisc.cs index 72c2234..2723930 100644 --- a/DSALib/Auxiliary/RandomMisc.cs +++ b/DSALib/Auxiliary/RandomMisc.cs @@ -2,7 +2,7 @@ using System.Linq; using System.Text; -namespace DSACore.Auxiliary +namespace DSALib.Auxiliary { public static class RandomMisc { diff --git a/DSALib/Auxiliary/SpellCorrect.cs b/DSALib/Auxiliary/SpellCorrect.cs index 77d1cf3..79908c4 100644 --- a/DSALib/Auxiliary/SpellCorrect.cs +++ b/DSALib/Auxiliary/SpellCorrect.cs @@ -1,106 +1,61 @@ using System; -using System.Diagnostics; -using System.Linq; -namespace DSACore.Auxiliary +namespace DSALib.Auxiliary { - public class SpellCorrect : StringComparer + public class SpellCorrect { - public const int ErrorThreshold = 94100; + public const double ErrorThreshold = 1 / 3.0; + private const double Match = 3.0; + private const double Gap = -1.5; + private const double Mismatch = -2.0; - public override int Compare(string x, string y) - { - return CompareEasy(x, y); - } - - public static int CompareEasy(string x, string y) - { - if (string.IsNullOrEmpty(x)) throw new ArgumentException("message", nameof(x)); - - if (string.IsNullOrEmpty(y)) throw new ArgumentException("message", nameof(y)); - - if (x.Equals(y)) return 0; - - x = x.ToLower(); - y = y.ToLower(); - if (x.Equals(y)) return 1; - - var subs = y.Split(' ', '/'); - var score = subs.Count(); - foreach (var s in subs) - if (s.Equals(x)) - score--; - - if (score < subs.Count()) return score + 1; - - return 100000 - (int) (CompareExact(x, y) * 1000.0); - /*if (y.Contains(x)) - return 6;*/ - } - - public override bool Equals(string x, string y) - { - Debug.Assert(x != null, nameof(x) + " != null"); - return x.Equals(y); - } - - public override int GetHashCode(string obj) - { - throw new NotImplementedException(); - } - - public static double CompareExact(string s, string q) + public static double Compare(string s, string q) { s = s.ToLower(); q = q.ToLower(); int i, j; - const double Match = 3.0; - const double Gap = -2.0; - const double Mismatch = -2.0; - - double decay; - + var matrix = new double[s.Length + 1, q.Length + 1]; var max = 0.0; matrix[0, 0] = 0.0; for (i = 1; i < s.Length; i++) - // matrix[i, 0] = 0.0; matrix[i, 0] = i * Gap; for (i = 1; i < q.Length; i++) matrix[0, i] = 0.0; for (i = 1; i <= s.Length; i++) - for (j = 1; j <= q.Length; j++) - { - decay = j / (double) (s.Length * 1000); - var add = s[i - 1] == q[j - 1] ? Match - decay : Mismatch; - var score = matrix[i - 1, j - 1] + add; - - if (score < matrix[i - 1, j] + Gap) score = matrix[i - 1, j] + Gap; + for (j = 1; j <= q.Length; j++) + { + double decay = j / (s.Length * 1000.0); + var add = s[i - 1] == q[j - 1] ? Match - decay : Mismatch; + var score = matrix[i - 1, j - 1] + add; - if (score < matrix[i, j - 1] + Gap) score = matrix[i, j - 1] + Gap; + if (score < matrix[i - 1, j] + Gap) score = matrix[i - 1, j] + Gap; - if (i > 1 && j > 1) - if (s[i - 1] == q[j - 2] && s[i - 2] == q[j - 1]) - { - add = 3 / 2.0 * Match - decay; - if (score < matrix[i - 2, j - 2] + add) score = matrix[i - 2, j - 2] + add; - } + if (score < matrix[i, j - 1] + Gap) score = matrix[i, j - 1] + Gap; - // if (score < 0) - // { - // score = 0; - // } + if (i > 1 && j > 1) + if (s[i - 1] == q[j - 2] && s[i - 2] == q[j - 1]) + { + add = 3 / 2.0 * Match - decay; + if (score < matrix[i - 2, j - 2] + add) score = matrix[i - 2, j - 2] + add; + } - if (max < score && i == s.Length) max = score; + if (max < score && i == s.Length) max = score; - matrix[i, j] = score; - } + matrix[i, j] = score; + } return max; } + + public static bool IsMatch(string s1, string s2) + { + var score = Compare(s1, s2); + return score > ErrorThreshold * s1.Length; + } } } \ No newline at end of file diff --git a/DSALib/Auxiliary/TalentEnumerableExtension.cs b/DSALib/Auxiliary/TalentEnumerableExtension.cs index d83114c..6ec7fcc 100644 --- a/DSALib/Auxiliary/TalentEnumerableExtension.cs +++ b/DSALib/Auxiliary/TalentEnumerableExtension.cs @@ -1,33 +1,34 @@ using System.Collections.Generic; using System.Linq; using System.Text; -using DSACore.DSA_Game.Characters; -using DSALib; +using DSACore.Auxiliary; +using DSALib.DSA_Game.Characters; +using DSALib.Models.Dsa; -namespace DSACore.Auxiliary +namespace DSALib.Auxiliary { public static class TalentEnumerableExtension { - public static string ProbenTest(this IEnumerable List, Character c, string talent, int erschwernis = 0) + public static string ProbenTest(this IEnumerable List, Character c, string talentName, int erschwernis = 0) { var output = new StringBuilder(); var sc = new SpellCorrect(); - var tTalent = List.OrderBy(x => sc.Compare(talent, x.Name)).First(); - if (sc.Compare(talent, tTalent.Name) > SpellCorrect.ErrorThreshold) - return $"{c.Name} kann nicht {talent}..."; + if (!List.TryMatch(out var iTalent, talentName)) + return $"{c.Name} kann nicht {talentName}..."; - var props = tTalent.GetEigenschaften(); // get the required properties - var tap = tTalent.Value; // get taw - var werte = props.Select(p => c.Eigenschaften[c.PropTable[p]]).ToList(); + var talent = (Talent) iTalent; + var props = talent.GetEigenschaften(); // get the required properties + var tap = talent.Value; // get taw + var werte = props.Select(p => c.Eigenschaften[c.PropTable[p]]).ToArray(); output.AppendFormat( "{0} würfelt: {1} \n{2} - {3} taw:{4} {5} \n", c.Name, - tTalent.Name, - tTalent.Probe, + talent.Name, + talent.Probe, string.Join("/", werte), - tTalent.Value, + talent.Value, erschwernis.Equals(0) ? string.Empty : "Erschwernis: " + erschwernis); output.Append(" "); diff --git a/DSALib/Auxiliary/WeaponImporter.cs b/DSALib/Auxiliary/WeaponImporter.cs index 3375236..12d243f 100644 --- a/DSALib/Auxiliary/WeaponImporter.cs +++ b/DSALib/Auxiliary/WeaponImporter.cs @@ -4,10 +4,10 @@ using System.Linq; using System.Net.Http; using System.Text.RegularExpressions; using System.Threading.Tasks; -using DSACore.FireBase; -using DSACore.Models.Database.DSA; +using DSALib.Models.Database.DSA; +using DSALib.FireBase; -namespace DSACore.Auxiliary +namespace DSALib.Auxiliary { public class WeaponImporter { diff --git a/DSALib/Characters/Critter.cs b/DSALib/Characters/Critter.cs index d9f8b53..dcedccb 100644 --- a/DSALib/Characters/Critter.cs +++ b/DSALib/Characters/Critter.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.IO; using DiscoBot.DSA_Game.Characters; +using DSALib.Models.Dsa; using Newtonsoft.Json; namespace DSALib.Characters diff --git a/DSALib/Commands/CommandHandler.cs b/DSALib/Commands/CommandHandler.cs index f74f87f..e63d7b8 100644 --- a/DSALib/Commands/CommandHandler.cs +++ b/DSALib/Commands/CommandHandler.cs @@ -1,10 +1,11 @@ using System; -using DSACore.Auxiliary; -using DSACore.Auxiliary.Calculator; -using DSACore.DSA_Game; -using DSACore.Models.Network; +using DSALib.Auxiliary; +using DSALib.Auxiliary.Calculator; +using DSALib.Commands; +using DSALib.DSA_Game; +using DSALib.Models.Network; -namespace DSACore.Commands +namespace DSALib.Commands { public class CommandHandler { diff --git a/DSALib/Commands/CommandTypes.cs b/DSALib/Commands/CommandTypes.cs index 6838ac2..62b8b0f 100644 --- a/DSALib/Commands/CommandTypes.cs +++ b/DSALib/Commands/CommandTypes.cs @@ -1,4 +1,4 @@ -namespace DSACore.Commands +namespace DSALib.Commands { public enum CommandTypes { diff --git a/DSALib/Commands/FileHandler.cs b/DSALib/Commands/FileHandler.cs index bce7c54..d117040 100644 --- a/DSALib/Commands/FileHandler.cs +++ b/DSALib/Commands/FileHandler.cs @@ -1,11 +1,12 @@ using System; using System.Linq; using System.Net; -using DSACore.DSA_Game; -using DSACore.DSA_Game.Characters; +using DSALib.DSA_Game; +using DSALib.DSA_Game.Characters; using DSALib; +using DSALib.Models.Dsa; -namespace DSACore.Commands +namespace DSALib.Commands { public class FileHandler { diff --git a/DSALib/Commands/Gm.cs b/DSALib/Commands/Gm.cs index 98b62db..74fd673 100644 --- a/DSALib/Commands/Gm.cs +++ b/DSALib/Commands/Gm.cs @@ -1,4 +1,4 @@ -namespace DSACore.Commands +namespace DSALib.Commands { /*public class Iam { diff --git a/DSALib/Commands/HeldList.cs b/DSALib/Commands/HeldList.cs index 370af34..ef29a14 100644 --- a/DSALib/Commands/HeldList.cs +++ b/DSALib/Commands/HeldList.cs @@ -1,11 +1,11 @@ using System.Collections.Generic; using System.Linq; using System.Text; -using DSACore.Auxiliary; -using DSACore.DSA_Game; -using DSACore.DSA_Game.Characters; +using DSALib.Auxiliary; +using DSALib.DSA_Game; +using DSALib.DSA_Game.Characters; -namespace DSACore.Commands +namespace DSALib.Commands { public class HeldList { diff --git a/DSALib/Commands/Help.cs b/DSALib/Commands/Help.cs index 974c44c..4506821 100644 --- a/DSALib/Commands/Help.cs +++ b/DSALib/Commands/Help.cs @@ -1,8 +1,8 @@ using System.Linq; -using DSACore.Auxiliary; -using DSACore.DSA_Game.Save; +using DSALib.Auxiliary; +using DSALib.DSA_Game.Save; -namespace DSACore.Commands +namespace DSALib.Commands { public class Help { @@ -13,7 +13,7 @@ namespace DSACore.Commands { // return command specific help var com = Properties.CommandInfos - .OrderBy(x => SpellCorrect.CompareEasy(x.Name, command.ToLower())).First(); // get best fit command + .OrderBy(x => SpellCorrect.Compare(x.Name, command.ToLower())).Last(); // get best fit command return com.GetDescription(); } diff --git a/DSALib/Commands/LebenUndAstral.cs b/DSALib/Commands/LebenUndAstral.cs index a671296..ac11c91 100644 --- a/DSALib/Commands/LebenUndAstral.cs +++ b/DSALib/Commands/LebenUndAstral.cs @@ -1,9 +1,9 @@ using System; -using DSACore.Auxiliary; -using DSACore.DSA_Game; +using DSALib.Auxiliary; +using DSALib.DSA_Game; using DSALib.Characters; -namespace DSACore.Commands +namespace DSALib.Commands { public class LE { diff --git a/DSALib/Commands/List.cs b/DSALib/Commands/List.cs index 7fc682f..1213f85 100644 --- a/DSALib/Commands/List.cs +++ b/DSALib/Commands/List.cs @@ -1,10 +1,9 @@ using System; using System.Collections.Generic; using System.Linq; -using DSACore.Audio; -using DSACore.DSA_Game; +using DSALib.DSA_Game; -namespace DSACore.Commands +namespace DSALib.Commands { public class List { @@ -27,12 +26,6 @@ namespace DSACore.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"); diff --git a/DSALib/Commands/MiscCommands.cs b/DSALib/Commands/MiscCommands.cs index ebd1598..69b2ffe 100644 --- a/DSALib/Commands/MiscCommands.cs +++ b/DSALib/Commands/MiscCommands.cs @@ -1,4 +1,4 @@ -namespace DSACore.Commands +namespace DSALib.Commands { public class MiscCommands { @@ -13,7 +13,7 @@ [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```"); + return this.ReplyAsync("```xl\n" + new DSALib.Auxiliary.Calculator.StringSolver(roll).Solve() + "\n```"); }*/ /* diff --git a/DSALib/Commands/NpcCommands.cs b/DSALib/Commands/NpcCommands.cs index 95243ca..510b78b 100644 --- a/DSALib/Commands/NpcCommands.cs +++ b/DSALib/Commands/NpcCommands.cs @@ -1,11 +1,11 @@ using System; using System.Collections.Generic; using System.Linq; -using DSACore.Characters; -using DSACore.DSA_Game; -using DSACore.DSA_Game.Characters; +using DSALib.Characters; +using DSALib.DSA_Game; +using DSALib.DSA_Game.Characters; -namespace DSACore.Commands +namespace DSALib.Commands { public class NpcCommands { @@ -19,17 +19,17 @@ namespace DSACore.Commands 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"; + //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"; + //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/DSALib/Commands/ProbenTest.cs b/DSALib/Commands/ProbenTest.cs index d0800d6..7c88480 100644 --- a/DSALib/Commands/ProbenTest.cs +++ b/DSALib/Commands/ProbenTest.cs @@ -1,4 +1,4 @@ -namespace DSACore.Commands +namespace DSALib.Commands { public class ProbenTest { diff --git a/DSALib/CritterAttack.cs b/DSALib/CritterAttack.cs deleted file mode 100644 index 3b0a11d..0000000 --- a/DSALib/CritterAttack.cs +++ /dev/null @@ -1,21 +0,0 @@ -namespace DSALib -{ - public class CritterAttack - { - public CritterAttack(string name, int at, string tp, string comment = "") - { - Name = name; - At = at; - Tp = tp; - Comment = comment; - } - - public string Name { get; set; } - - public int At { get; set; } - - public string Tp { get; set; } - - public string Comment { get; set; } - } -} \ No newline at end of file diff --git a/DSALib/DSALib.csproj b/DSALib/DSALib.csproj index afada82..2281bd6 100644 --- a/DSALib/DSALib.csproj +++ b/DSALib/DSALib.csproj @@ -1,11 +1,11 @@ - + - netstandard2.0 + netcoreapp2.2 - + - + diff --git a/DSALib/DSA_Game/Characters/Character.cs b/DSALib/DSA_Game/Characters/Character.cs index ac890cb..aea5671 100644 --- a/DSALib/DSA_Game/Characters/Character.cs +++ b/DSALib/DSA_Game/Characters/Character.cs @@ -5,10 +5,11 @@ using System.Linq; using System.Text; using System.Xml; using DSACore.Auxiliary; -using DSALib; +using DSALib.Auxiliary; using DSALib.Characters; +using DSALib.Models.Dsa; -namespace DSACore.DSA_Game.Characters +namespace DSALib.DSA_Game.Characters { public class Character : Being, ICharacter { @@ -99,11 +100,9 @@ namespace DSACore.DSA_Game.Characters public string Angriff(string talent, int erschwernis = 0) // pretty self explanatory { var output = new StringBuilder(); - var sc = new SpellCorrect(); - var attack = Kampftalente.OrderBy(x => sc.Compare(talent, x.Name)).First(); - if (sc.Compare(talent, attack.Name) > SpellCorrect.ErrorThreshold) + if (!Kampftalente.TryMatch(out var iattack, talent)) return $"{Name} kann nicht mit der Waffenart {talent} umgehen..."; - + var attack = (KampfTalent) iattack; var tap = attack.At; output.AppendFormat( "{0}-Angriff taw:{1} {2} \n", @@ -119,12 +118,12 @@ namespace DSACore.DSA_Game.Characters public string Parade(string talent, int erschwernis = 0) { var output = new StringBuilder(); - var sc = new SpellCorrect(); - var attack = Kampftalente.OrderBy(x => sc.Compare(talent, x.Name)).First(); - if (sc.Compare(talent, attack.Name) > SpellCorrect.ErrorThreshold) + if (Kampftalente.TryMatch(out var iAttack , talent)) return $"{Name} kann nicht mit der Waffenart {talent} umgehen..."; + + var attack = (KampfTalent) iAttack; var tap = attack.Pa; output.AppendFormat( "{0}-Parade taw:{1} {2}\n", @@ -140,12 +139,11 @@ namespace DSACore.DSA_Game.Characters public string Fernkampf(string talent, int erschwernis = 0) { var output = new StringBuilder(); - var sc = new SpellCorrect(); var fk = Eigenschaften["fk"]; - var attack = Talente.OrderBy(x => sc.Compare(talent, x.Name)).First(); - if (sc.Compare(talent, attack.Name) > SpellCorrect.ErrorThreshold) + if (! Talente.TryMatch(out var iAttack, talent)) return $"{Name} kann nicht mit der Waffenart {talent} umgehen..."; + var attack = (Talent) iAttack; var tap = attack.Value; output.AppendFormat( "{0} taw:{1} {2} \n", diff --git a/DSALib/DSA_Game/Characters/NPC.cs b/DSALib/DSA_Game/Characters/NPC.cs index 75c3fe9..105adda 100644 --- a/DSALib/DSA_Game/Characters/NPC.cs +++ b/DSALib/DSA_Game/Characters/NPC.cs @@ -1,8 +1,8 @@ using System; -using DSACore.Auxiliary; +using DSALib.Auxiliary; using DSALib.Characters; -namespace DSACore.Characters +namespace DSALib.Characters { public class Npc : Being, ICharacter { diff --git a/DSALib/DSA_Game/Characters/SaveChar.cs b/DSALib/DSA_Game/Characters/SaveChar.cs index 7b29b4e..00e2f86 100644 --- a/DSALib/DSA_Game/Characters/SaveChar.cs +++ b/DSALib/DSA_Game/Characters/SaveChar.cs @@ -1,6 +1,6 @@ using DSALib.Characters; -namespace DSACore.DSA_Game.Characters +namespace DSALib.DSA_Game.Characters { public class SaveChar { diff --git a/DSALib/DSA_Game/Dsa.cs b/DSALib/DSA_Game/Dsa.cs index 18d0b81..bcd8951 100644 --- a/DSALib/DSA_Game/Dsa.cs +++ b/DSALib/DSA_Game/Dsa.cs @@ -1,20 +1,21 @@ using System; using System.Collections.Generic; using System.Linq; -using DSACore.DSA_Game.Characters; -using DSACore.DSA_Game.Save; +using DSALib.DSA_Game.Characters; +using DSALib.DSA_Game.Save; using DSALib; using DSALib.Characters; +using DSALib.Models.Dsa; -namespace DSACore.DSA_Game +namespace DSALib.DSA_Game { public static class Dsa { #if DEBUG public const string - rootPath = ""; //"C:\\Users\\Dennis\\Source\\Repos\\DiscoBot\\DSACore\\";//"DiscoBot\\DSACore\\"; + rootPath = ""; //"C:\\Users\\Dennis\\Source\\Repos\\DiscoBot\\DSALib\\";//"DiscoBot\\DSALib\\"; #else - public const string rootPath = "";//"DiscoBot\\DSACore\\"; + public const string rootPath = "";//"DiscoBot\\DSALib\\"; #endif private static Session s_session; diff --git a/DSALib/DSA_Game/Save/Properties.cs b/DSALib/DSA_Game/Save/Properties.cs index 7eba911..2312af0 100644 --- a/DSALib/DSA_Game/Save/Properties.cs +++ b/DSALib/DSA_Game/Save/Properties.cs @@ -3,11 +3,10 @@ using System.Collections; using System.Collections.Generic; using System.IO; using System.Linq; -using DSACore.Audio; -using DSACore.Auxiliary; +using DSALib.Auxiliary; using Newtonsoft.Json; -namespace DSACore.DSA_Game.Save +namespace DSALib.DSA_Game.Save { public static class Properties { @@ -26,11 +25,6 @@ namespace DSACore.DSA_Game.Save set => objects["CommandInfo"] = value; } // use Properties.Commandinfos to access the abstract Object array - public static List Sounds - { - get => objects["Sound"] as List; - set => objects["Sound"] = value; - } public static void Deserialize(string path = @"Properties") { diff --git a/DSALib/DSA_Game/Save/SaveCommand.cs b/DSALib/DSA_Game/Save/SaveCommand.cs index f358047..c5a1bb4 100644 --- a/DSALib/DSA_Game/Save/SaveCommand.cs +++ b/DSALib/DSA_Game/Save/SaveCommand.cs @@ -2,7 +2,7 @@ using System.IO; using System.Linq; -namespace DSACore.DSA_Game.Save +namespace DSALib.DSA_Game.Save { public class SaveCommand { diff --git a/DSALib/DSA_Game/Save/Session.cs b/DSALib/DSA_Game/Save/Session.cs index 6944fb1..62aa8f6 100644 --- a/DSALib/DSA_Game/Save/Session.cs +++ b/DSALib/DSA_Game/Save/Session.cs @@ -1,10 +1,10 @@ using System; using System.Collections.Generic; using System.IO; -using DSACore.DSA_Game.Characters; +using DSALib.DSA_Game.Characters; using Newtonsoft.Json; -namespace DSACore.DSA_Game.Save +namespace DSALib.DSA_Game.Save { public class Session { diff --git a/DSALib/FireBase/Database.cs b/DSALib/FireBase/Database.cs index 8946cf0..2debd27 100644 --- a/DSALib/FireBase/Database.cs +++ b/DSALib/FireBase/Database.cs @@ -2,18 +2,18 @@ using System.IO; using System.Linq; using System.Threading.Tasks; -using DSACore.DSA_Game; -using DSACore.DSA_Game.Characters; -using DSACore.Models.Database.DSA; -using DSACore.Models.Network; +using DSALib.DSA_Game; +using DSALib.DSA_Game.Characters; +using DSALib.Models.Database.DSA; +using DSALib.Models.Network; using Firebase.Database; using Firebase.Database.Query; -namespace DSACore.FireBase +namespace DSALib.FireBase { public static class Database { - public static FirebaseClient firebase; + public static FirebaseClient Firebase; public static Dictionary Chars = new Dictionary(); @@ -21,7 +21,7 @@ namespace DSACore.FireBase public static Dictionary RangedWeapons = new Dictionary(); - public static Dictionary Talents = new Dictionary(); + public static Dictionary Talents = new Dictionary(); public static Dictionary Spells = new Dictionary(); @@ -29,7 +29,7 @@ namespace DSACore.FireBase { var auth = File.ReadAllText(Dsa.rootPath + "Token"); ; // your app secret - firebase = new FirebaseClient( + Firebase = new FirebaseClient( "https://heldenonline-4d828.firebaseio.com/", new FirebaseOptions { @@ -39,18 +39,18 @@ namespace DSACore.FireBase Initialize(); } - private static async Task Initialize() + private static void Initialize() { - IntializeCollection("Chars", Chars); - IntializeCollection("MeleeWeapons", MeleeList); - IntializeCollection("RangedWeapons", RangedWeapons); - IntializeCollection("Talents", Talents); - IntializeCollection("Spells", Spells); + IntializeCollection("Chars", Chars).Start(); + IntializeCollection("MeleeWeapons", MeleeList).Start(); + IntializeCollection("RangedWeapons", RangedWeapons).Start(); + IntializeCollection("Talents", Talents).Start(); + IntializeCollection("Spells", Spells).Start(); } private static async Task IntializeCollection(string path, Dictionary list) { - var temp = await firebase + var temp = await Firebase .Child(path) .OrderByKey() .OnceAsync(); @@ -62,26 +62,26 @@ namespace DSACore.FireBase { DatabaseChar.LoadChar(file, out var groupChar, out var data); - var lastChar = await firebase + var lastChar = await Firebase .Child("Chars") .OrderByKey() .LimitToLast(1) .OnceAsync(); var id = groupChar.Id = data.Id = lastChar.First().Object.Id + 1; - await firebase //TODO Reomve await Operators + await Firebase //TODO Reomve await Operators .Child("Groups") .Child("Char" + id) .PutAsync(groupChar); - await firebase + await Firebase .Child("Chars") .Child("Char" + id) .PutAsync(data); Chars["Char" + id] = data; - await firebase + await Firebase .Child("Inventories") .Child("Inventory" + id) .PutAsync(new Inventory()); @@ -91,25 +91,25 @@ namespace DSACore.FireBase public static async Task RemoveChar(int id) { - await firebase + await Firebase .Child("Groups") .Child("Char" + id) .DeleteAsync(); - await firebase + await Firebase .Child("Chars") .Child("Char" + id) .DeleteAsync(); Chars.Remove("Char" + id); - await firebase + await Firebase .Child("Inventories") .Child("Inventory" + id) .DeleteAsync(); } - public static async Task GetChar(int id) + public static DatabaseChar GetChar(int id) { /*var chr = await firebase .Child("Chars") @@ -121,7 +121,7 @@ namespace DSACore.FireBase public static async Task GetInventory(int id) { - var inv = await firebase + var inv = await Firebase .Child("Inventories") .Child("Inventory" + id) .OnceSingleAsync(); @@ -130,15 +130,15 @@ namespace DSACore.FireBase public static async Task SetInventory(int id, Inventory inv) { - await firebase + await Firebase .Child("Inventories") .Child("Inventory" + id) .PutAsync(inv); } - public static async Task AddTalent(Talent tal) + public static async Task AddTalent(DSALib.Models.Database.DSA.Talent tal) { - await firebase + await Firebase .Child("Talents") .Child(tal.Name) .PutAsync(tal); @@ -146,13 +146,13 @@ namespace DSACore.FireBase public static async Task RemoveTalent(string talent) { - await firebase + await Firebase .Child("Talents") .Child(talent) .DeleteAsync(); } - public static async Task GetTalent(string talent) + public static DSALib.Models.Database.DSA.Talent GetTalent(string talent) { /* return await firebase @@ -164,7 +164,7 @@ namespace DSACore.FireBase public static async Task AddSpell(GeneralSpell tal) { - await firebase + await Firebase .Child("Spells") .Child(tal.Name) .PutAsync(tal); @@ -172,13 +172,13 @@ namespace DSACore.FireBase public static async Task RemoveSpell(string spell) { - await firebase + await Firebase .Child("Spells") .Child(spell) .DeleteAsync(); } - public static async Task GetSpell(string spell) + public static GeneralSpell GetSpell(string spell) { /*return await firebase .Child("Spells") @@ -191,7 +191,7 @@ namespace DSACore.FireBase public static async Task AddWeapon(Weapon wep) { var collection = wep.GetType() == typeof(MeleeWeapon) ? "MeleeWeapons" : "RangedWeapons"; - await firebase + await Firebase .Child(collection) .Child(wep.Name) .PutAsync(wep); @@ -200,7 +200,7 @@ namespace DSACore.FireBase public static async Task RemoveWeapon(string weapon, bool ranged = false) { var collection = ranged ? "RangedWeapons" : "MeleeWeapons"; - await firebase + await Firebase .Child(collection) .Child(weapon) .DeleteAsync(); @@ -209,7 +209,7 @@ namespace DSACore.FireBase public static async Task GetWeapon(string weapon, bool ranged = false) { var collection = ranged ? "RangedWeapons" : "MeleeWeapons"; - return await firebase + return await Firebase .Child(collection) .Child(weapon) .OnceSingleAsync(); @@ -217,10 +217,10 @@ namespace DSACore.FireBase public static async Task> GetGroups() { - var groups = await firebase + var groups = await Firebase .Child("Groups") .OrderByKey() - .OnceAsync(); + .OnceAsync(); var ret = new List(); foreach (var firebaseObject in groups) @@ -229,33 +229,33 @@ namespace DSACore.FireBase return ret; } - public static async Task GetGroup(int id) + public static async Task GetGroup(int id) { - var group = await firebase + var group = await Firebase .Child("Groups") .Child("Group" + id) - .OnceSingleAsync(); + .OnceSingleAsync(); return group; } - public static async Task AddGroup(Models.Database.Groups.Group group) + public static async Task AddGroup(DSALib.Models.Database.Groups.Group group) { - var lastChar = await firebase + var lastChar = await Firebase .Child("Groups") .OrderByKey() .LimitToLast(1) - .OnceAsync(); + .OnceAsync(); var id = group.Id = lastChar.First().Object.Id + 1; - await firebase + await Firebase .Child("Groups") .Child("Group" + id) .PutAsync(group); } - public static async void SetGroup(Models.Database.Groups.Group group) + public static async void SetGroup(DSALib.Models.Database.Groups.Group group) { - await firebase + await Firebase .Child("Groups") .Child("Group" + group.Id) .PutAsync(group); @@ -263,7 +263,7 @@ namespace DSACore.FireBase public static async void DeleteGroup(int id) { - await firebase + await Firebase .Child("Groups") .Child("Group" + id) .DeleteAsync(); diff --git a/DSALib/KampfTalent.cs b/DSALib/KampfTalent.cs deleted file mode 100644 index 7c7eed4..0000000 --- a/DSALib/KampfTalent.cs +++ /dev/null @@ -1,18 +0,0 @@ -namespace DSALib -{ - public class KampfTalent - { - public KampfTalent(string name, int at, int pa) - { - Name = name; - At = at; - Pa = pa; - } - - public string Name { get; set; } - - public int At { get; set; } - - public int Pa { get; set; } - } -} \ No newline at end of file diff --git a/DSALib/Models/Database/DSA/Advantage.cs b/DSALib/Models/Database/DSA/Advantage.cs index cc8f5cc..500cf6d 100644 --- a/DSALib/Models/Database/DSA/Advantage.cs +++ b/DSALib/Models/Database/DSA/Advantage.cs @@ -1,6 +1,6 @@ using System; -namespace DSACore.Models.Database.DSA +namespace DSALib.Models.Database.DSA { public class Advantage { diff --git a/DSALib/Models/Database/DSA/CharSpell.cs b/DSALib/Models/Database/DSA/CharSpell.cs index fabd456..77a8dc8 100644 --- a/DSALib/Models/Database/DSA/CharSpell.cs +++ b/DSALib/Models/Database/DSA/CharSpell.cs @@ -1,6 +1,6 @@ using System; -namespace DSACore.Models.Database.DSA +namespace DSALib.Models.Database.DSA { public class CharSpell { diff --git a/DSALib/Models/Database/DSA/DatabaseChar.cs b/DSALib/Models/Database/DSA/DatabaseChar.cs index 872b82e..cfd7174 100644 --- a/DSALib/Models/Database/DSA/DatabaseChar.cs +++ b/DSALib/Models/Database/DSA/DatabaseChar.cs @@ -1,9 +1,9 @@ using System; using System.Collections.Generic; using System.Linq; -using DSACore.DSA_Game.Characters; +using DSALib.DSA_Game.Characters; -namespace DSACore.Models.Database.DSA +namespace DSALib.Models.Database.DSA { public class DatabaseChar { diff --git a/DSALib/Models/Database/DSA/Field.cs b/DSALib/Models/Database/DSA/Field.cs index e63aeb4..1b10232 100644 --- a/DSALib/Models/Database/DSA/Field.cs +++ b/DSALib/Models/Database/DSA/Field.cs @@ -1,6 +1,6 @@ using System; -namespace DSACore.Models.Database.DSA +namespace DSALib.Models.Database.DSA { public class Field { diff --git a/DSALib/Models/Database/DSA/GeneralSpell.cs b/DSALib/Models/Database/DSA/GeneralSpell.cs index b4dbc0b..6fe6a78 100644 --- a/DSALib/Models/Database/DSA/GeneralSpell.cs +++ b/DSALib/Models/Database/DSA/GeneralSpell.cs @@ -1,4 +1,4 @@ -namespace DSACore.Models.Database.DSA +namespace DSALib.Models.Database.DSA { public class GeneralSpell : Talent { diff --git a/DSALib/Models/Database/DSA/GroupChar.cs b/DSALib/Models/Database/DSA/GroupChar.cs index 31fc583..0c1ecf1 100644 --- a/DSALib/Models/Database/DSA/GroupChar.cs +++ b/DSALib/Models/Database/DSA/GroupChar.cs @@ -1,4 +1,4 @@ -namespace DSACore.Models.Database.DSA +namespace DSALib.Models.Database.DSA { public class GroupChar { diff --git a/DSALib/Models/Database/DSA/Inventory.cs b/DSALib/Models/Database/DSA/Inventory.cs index 9a025d4..086564c 100644 --- a/DSALib/Models/Database/DSA/Inventory.cs +++ b/DSALib/Models/Database/DSA/Inventory.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; -namespace DSACore.Models.Database.DSA +namespace DSALib.Models.Database.DSA { public class Inventory { diff --git a/DSALib/Models/Database/DSA/Talent.cs b/DSALib/Models/Database/DSA/Talent.cs index 59ff4bc..578d93c 100644 --- a/DSALib/Models/Database/DSA/Talent.cs +++ b/DSALib/Models/Database/DSA/Talent.cs @@ -1,8 +1,8 @@ using System; -namespace DSACore.Models.Database.DSA +namespace DSALib.Models.Database.DSA { - public class Talent + public class Talent : DSALib.Models.Database.DataObject { public Talent() { @@ -19,8 +19,6 @@ namespace DSACore.Models.Database.DSA Roll = roll.Split('/'); } - public string Name { get; set; } - public string[] Roll { get; set; } = new string[3]; } } \ No newline at end of file diff --git a/DSALib/Models/Database/DSA/Weapon.cs b/DSALib/Models/Database/DSA/Weapon.cs index 58a44cd..8ed63d7 100644 --- a/DSALib/Models/Database/DSA/Weapon.cs +++ b/DSALib/Models/Database/DSA/Weapon.cs @@ -1,6 +1,6 @@ using System; -namespace DSACore.Models.Database.DSA +namespace DSALib.Models.Database.DSA { public class Weapon { diff --git a/DSALib/Models/Database/DSA/WeaponTalent.cs b/DSALib/Models/Database/DSA/WeaponTalent.cs index 98eb38d..f65fb3f 100644 --- a/DSALib/Models/Database/DSA/WeaponTalent.cs +++ b/DSALib/Models/Database/DSA/WeaponTalent.cs @@ -1,6 +1,6 @@ using System; -namespace DSACore.Models.Database.DSA +namespace DSALib.Models.Database.DSA { public class WeaponTalent { diff --git a/DSALib/Models/Database/DataObject.cs b/DSALib/Models/Database/DataObject.cs new file mode 100644 index 0000000..59cfdf2 --- /dev/null +++ b/DSALib/Models/Database/DataObject.cs @@ -0,0 +1,13 @@ +namespace DSALib.Models.Database +{ + public class DataObject : IDataObject + { + + public override string ToString() + { + return Name; + } + + public string Name { get; set; } + } +} diff --git a/DSALib/Models/Database/Groups/DSAGroup.cs b/DSALib/Models/Database/Groups/DSAGroup.cs index 89fac2f..377376e 100644 --- a/DSALib/Models/Database/Groups/DSAGroup.cs +++ b/DSALib/Models/Database/Groups/DSAGroup.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; -using DSACore.Models.Database.DSA; +using DSALib.Models.Database.DSA; -namespace DSACore.Models.Database.Groups +namespace DSALib.Models.Database.Groups { public class DSAGroup : Group { diff --git a/DSALib/Models/Database/Groups/Group.cs b/DSALib/Models/Database/Groups/Group.cs index 77d3a64..096f2be 100644 --- a/DSALib/Models/Database/Groups/Group.cs +++ b/DSALib/Models/Database/Groups/Group.cs @@ -1,9 +1,8 @@ -namespace DSACore.Models.Database.Groups +namespace DSALib.Models.Database.Groups { public class Group { public string Name { get; set; } - public string Discord { get; set; } public string Password { get; set; } public int Id { get; set; } } diff --git a/DSALib/Models/Database/IDataObject.cs b/DSALib/Models/Database/IDataObject.cs new file mode 100644 index 0000000..bdc88b7 --- /dev/null +++ b/DSALib/Models/Database/IDataObject.cs @@ -0,0 +1,7 @@ +namespace DSALib.Models.Database +{ + public interface IDataObject + { + string Name { get; set; } + } +} \ No newline at end of file diff --git a/DSALib/Models/Dsa/CritterAttack.cs b/DSALib/Models/Dsa/CritterAttack.cs new file mode 100644 index 0000000..8cd8b09 --- /dev/null +++ b/DSALib/Models/Dsa/CritterAttack.cs @@ -0,0 +1,19 @@ +namespace DSALib.Models.Dsa +{ + public class CritterAttack : Database.DataObject + { + public CritterAttack(string name, int at, string tp, string comment = "") + { + Name = name; + At = at; + Tp = tp; + Comment = comment; + } + + public int At { get; set; } + + public string Tp { get; set; } + + public string Comment { get; set; } + } +} \ No newline at end of file diff --git a/DSALib/Models/Dsa/KampfTalent.cs b/DSALib/Models/Dsa/KampfTalent.cs new file mode 100644 index 0000000..51ad255 --- /dev/null +++ b/DSALib/Models/Dsa/KampfTalent.cs @@ -0,0 +1,16 @@ +namespace DSALib.Models.Dsa +{ + public class KampfTalent : Database.DataObject + { + public KampfTalent(string name, int at, int pa) + { + Name = name; + At = at; + Pa = pa; + } + + public int At { get; set; } + + public int Pa { get; set; } + } +} \ No newline at end of file diff --git a/DSALib/Models/Dsa/Talent.cs b/DSALib/Models/Dsa/Talent.cs new file mode 100644 index 0000000..5771a74 --- /dev/null +++ b/DSALib/Models/Dsa/Talent.cs @@ -0,0 +1,43 @@ +namespace DSALib.Models.Dsa +{ + public class Talent : Database.DataObject // talent objekt + { + public Talent(string name, string probe, int value) + { + Name = name; + Probe = probe; + Value = value; + } + + public string Probe { get; set; } + + public int Value { get; set; } + + public string[] GetEigenschaften() // turn XX/XX/XX into string[]{XX,XX,XX} + { + var temp = Probe.Split('/'); + for (var index = 0; index < temp.Length; index++) temp[index] = temp[index].Replace("/", string.Empty); + + return temp; + } + + public bool IstFernkampftalent() + { + switch (Name) + { + case "Armbrust": + case "Belagerungswaffen": + case "Blasrohr": + case "Bogen": + case "Diskus": + case "Schleuder": + case "Wurfbeile": + case "Wurfmesser": + case "Wurfspeere": + return true; + default: + return false; + } + } + } +} \ No newline at end of file diff --git a/DSALib/Models/Dsa/Vorteil.cs b/DSALib/Models/Dsa/Vorteil.cs new file mode 100644 index 0000000..e37af20 --- /dev/null +++ b/DSALib/Models/Dsa/Vorteil.cs @@ -0,0 +1,16 @@ +namespace DSALib.Models.Dsa +{ + public class Vorteil : Database.DataObject // talent objekt + { + public Vorteil(string name, string value = "") + { + Name = name; + Value = value; + // this.Choice = choice; + } + + public string Value { get; set; } + + //public string Choice { get; set; } + } +} \ No newline at end of file diff --git a/DSALib/Models/Dsa/Zauber.cs b/DSALib/Models/Dsa/Zauber.cs new file mode 100644 index 0000000..e4387bf --- /dev/null +++ b/DSALib/Models/Dsa/Zauber.cs @@ -0,0 +1,16 @@ +namespace DSALib.Models.Dsa +{ + public class Zauber : Talent + { + public Zauber(string name, string probe, int value, char complexity = 'A', string representation = "Magier") + : base(name, probe, value) + { + Complexity = complexity; + Representation = Representation; + } + + public char Complexity { get; } + + public string Representation { get; } + } +} \ No newline at end of file diff --git a/DSALib/Models/Network/Command.cs b/DSALib/Models/Network/Command.cs index 00b00a6..5a97e88 100644 --- a/DSALib/Models/Network/Command.cs +++ b/DSALib/Models/Network/Command.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; using System.Linq; -namespace DSACore.Models.Network +namespace DSALib.Models.Network { public class Command { diff --git a/DSALib/Models/Network/CommandResponse.cs b/DSALib/Models/Network/CommandResponse.cs index c7a410a..0816e4a 100644 --- a/DSALib/Models/Network/CommandResponse.cs +++ b/DSALib/Models/Network/CommandResponse.cs @@ -1,6 +1,6 @@ using System; -namespace DSACore.Models.Network +namespace DSALib.Models.Network { public class CommandResponse { diff --git a/DSALib/Models/Network/Group.cs b/DSALib/Models/Network/Group.cs index efe12ee..608e5ea 100644 --- a/DSALib/Models/Network/Group.cs +++ b/DSALib/Models/Network/Group.cs @@ -1,7 +1,7 @@ using System; using System.Collections.Generic; -namespace DSACore.Models.Network +namespace DSALib.Models.Network { public class Group { diff --git a/DSALib/Models/Network/Token.cs b/DSALib/Models/Network/Token.cs index 451cafc..2310607 100644 --- a/DSALib/Models/Network/Token.cs +++ b/DSALib/Models/Network/Token.cs @@ -1,6 +1,6 @@ using System; -namespace DSACore.Models.Network +namespace DSALib.Models.Network { public class Token { diff --git a/DSALib/Models/Network/User.cs b/DSALib/Models/Network/User.cs index 8b8008c..314a0bf 100644 --- a/DSALib/Models/Network/User.cs +++ b/DSALib/Models/Network/User.cs @@ -1,4 +1,4 @@ -namespace DSACore.Models.Network +namespace DSALib.Models.Network { public class User { diff --git a/DSALib/PropertiesNewtonsoft-Json-Linq-JProperty.json b/DSALib/PropertiesNewtonsoft-Json-Linq-JProperty.json index 0ed0f48..2544397 100644 --- a/DSALib/PropertiesNewtonsoft-Json-Linq-JProperty.json +++ b/DSALib/PropertiesNewtonsoft-Json-Linq-JProperty.json @@ -17,7 +17,7 @@ "ASPNETCORE_ENVIRONMENT": "Development" } }, - "DSACore": { + "DSALib": { "commandName": "Project", "launchBrowser": true, "launchUrl": "api/commands", diff --git a/DSALib/Talent.cs b/DSALib/Talent.cs deleted file mode 100644 index a39709c..0000000 --- a/DSALib/Talent.cs +++ /dev/null @@ -1,45 +0,0 @@ -namespace DSALib -{ - public class Talent // talent objekt - { - public Talent(string name, string probe, int value) - { - Name = name; - Probe = probe; - Value = value; - } - - public string Name { get; set; } - - public string Probe { get; set; } - - public int Value { get; set; } - - public string[] GetEigenschaften() // turn XX/XX/XX into string[]{XX,XX,XX} - { - var temp = Probe.Split('/'); - for (var index = 0; index < temp.Length; index++) temp[index] = temp[index].Replace("/", string.Empty); - - return temp; - } - - public bool IstFernkampftalent() - { - switch (Name) - { - case "Armbrust": - case "Belagerungswaffen": - case "Blasrohr": - case "Bogen": - case "Diskus": - case "Schleuder": - case "Wurfbeile": - case "Wurfmesser": - case "Wurfspeere": - return true; - default: - return false; - } - } - } -} \ No newline at end of file diff --git a/DSALib/Vorteil.cs b/DSALib/Vorteil.cs deleted file mode 100644 index c239676..0000000 --- a/DSALib/Vorteil.cs +++ /dev/null @@ -1,18 +0,0 @@ -namespace DSALib -{ - public class Vorteil // talent objekt - { - public Vorteil(string name, string value = "") - { - Name = name; - Value = value; - // this.Choice = choice; - } - - public string Name { get; set; } - - public string Value { get; set; } - - //public string Choice { get; set; } - } -} \ No newline at end of file diff --git a/DSALib/Zauber.cs b/DSALib/Zauber.cs deleted file mode 100644 index 0f460a1..0000000 --- a/DSALib/Zauber.cs +++ /dev/null @@ -1,16 +0,0 @@ -namespace DSALib -{ - public class Zauber : Talent - { - public Zauber(string name, string probe, int value, char complexity = 'A', string representation = "Magier") - : base(name, probe, value) - { - Complexity = complexity; - Representation = Representation; - } - - public char Complexity { get; } - - public string Representation { get; } - } -} \ No newline at end of file diff --git a/DSALib/helden/Felis.xml b/DSALib/helden/Felis.xml deleted file mode 100644 index 7440aaf..0000000 --- a/DSALib/helden/Felis.xml +++ /dev/null @@ -1,4 +0,0 @@ -pA70izIxomtGcRb/16T9inwwXw8=VJwVRJxgJH4HZS+IjrA6Xwv5BHNXoEDLNFGY0OJX0t1jR6laSNhNsw==

/KaCzo4Syrom78z3EQ5SbbB4sF7ey80etKII864WF64B81uRpH5t9jQTxeEu0ImbzRMqzVDZkVG9 -xD7nN1kuFw==

li7dzDacuo67Jg7mtqEm2TRuOMU=Z4Rxsnqc9E7pGknFFH2xqaryRPBaQ01khpMdLRQnG541Awtx/XPaF5Bpsy4pNWMOHCBiNU0Nogps -QW5QvnlMpA==uVrvWkzIbUdL7E80AiD0PJDX3Ck0beY5StXp1wDAA1/ePpemd6rTBNd8YoCzOovNrX016YMcTSiO -iExM4RWtJA==
\ No newline at end of file diff --git a/DSALib/helden/Gardist.xml b/DSALib/helden/Gardist.xml deleted file mode 100644 index c97c607..0000000 --- a/DSALib/helden/Gardist.xml +++ /dev/null @@ -1,4 +0,0 @@ -1SsAf+YaDGZWDsYew0x45jON/J4=Qx8xnAFVnlqg5baXpuYlluB0/As90tox235IqoOR77xyQXeGUBC/og==

/KaCzo4Syrom78z3EQ5SbbB4sF7ey80etKII864WF64B81uRpH5t9jQTxeEu0ImbzRMqzVDZkVG9 -xD7nN1kuFw==

li7dzDacuo67Jg7mtqEm2TRuOMU=Z4Rxsnqc9E7pGknFFH2xqaryRPBaQ01khpMdLRQnG541Awtx/XPaF5Bpsy4pNWMOHCBiNU0Nogps -QW5QvnlMpA==uVrvWkzIbUdL7E80AiD0PJDX3Ck0beY5StXp1wDAA1/ePpemd6rTBNd8YoCzOovNrX016YMcTSiO -iExM4RWtJA==
\ No newline at end of file diff --git a/DSALib/helden/HartmutReiher.xml b/DSALib/helden/HartmutReiher.xml deleted file mode 100644 index 114a5c9..0000000 --- a/DSALib/helden/HartmutReiher.xml +++ /dev/null @@ -1,4 +0,0 @@ -aJ0llXd+H5R2PCWNIxq2nQGUcls=Brx39LfbpQRgCi75Yc6tx9hl8O5Jg4CPbwkaFBRunag4UXIjQv9sqQ==

/KaCzo4Syrom78z3EQ5SbbB4sF7ey80etKII864WF64B81uRpH5t9jQTxeEu0ImbzRMqzVDZkVG9 -xD7nN1kuFw==

li7dzDacuo67Jg7mtqEm2TRuOMU=Z4Rxsnqc9E7pGknFFH2xqaryRPBaQ01khpMdLRQnG541Awtx/XPaF5Bpsy4pNWMOHCBiNU0Nogps -QW5QvnlMpA==uVrvWkzIbUdL7E80AiD0PJDX3Ck0beY5StXp1wDAA1/ePpemd6rTBNd8YoCzOovNrX016YMcTSiO -iExM4RWtJA==
\ No newline at end of file diff --git a/DSALib/helden/Helga_vom_Drachenei_Tausendsasserin.xml b/DSALib/helden/Helga_vom_Drachenei_Tausendsasserin.xml deleted file mode 100644 index b0f3930..0000000 --- a/DSALib/helden/Helga_vom_Drachenei_Tausendsasserin.xml +++ /dev/null @@ -1,4 +0,0 @@ -vMcyanAncITxP9wTw9/1L9KzWWw=Enznpogl943QhgW3XnOs6Tc1RoeGaF4C/DHVS7+yB9fTdYhVvYge+Q==

/KaCzo4Syrom78z3EQ5SbbB4sF7ey80etKII864WF64B81uRpH5t9jQTxeEu0ImbzRMqzVDZkVG9 -xD7nN1kuFw==

li7dzDacuo67Jg7mtqEm2TRuOMU=Z4Rxsnqc9E7pGknFFH2xqaryRPBaQ01khpMdLRQnG541Awtx/XPaF5Bpsy4pNWMOHCBiNU0Nogps -QW5QvnlMpA==uVrvWkzIbUdL7E80AiD0PJDX3Ck0beY5StXp1wDAA1/ePpemd6rTBNd8YoCzOovNrX016YMcTSiO -iExM4RWtJA==
\ No newline at end of file diff --git a/DSALib/helden/Krenko.xml b/DSALib/helden/Krenko.xml deleted file mode 100644 index 620deae..0000000 --- a/DSALib/helden/Krenko.xml +++ /dev/null @@ -1,4 +0,0 @@ -9rk+qJMY4v0RmLNh88Itq6VXLIg=GlTXU1OtSEcmoziBrTxBe0f0XFCOmzsCcTBjMeqQfA8KvC84N1AYbQ==

/KaCzo4Syrom78z3EQ5SbbB4sF7ey80etKII864WF64B81uRpH5t9jQTxeEu0ImbzRMqzVDZkVG9 -xD7nN1kuFw==

li7dzDacuo67Jg7mtqEm2TRuOMU=Z4Rxsnqc9E7pGknFFH2xqaryRPBaQ01khpMdLRQnG541Awtx/XPaF5Bpsy4pNWMOHCBiNU0Nogps -QW5QvnlMpA==uVrvWkzIbUdL7E80AiD0PJDX3Ck0beY5StXp1wDAA1/ePpemd6rTBNd8YoCzOovNrX016YMcTSiO -iExM4RWtJA==
\ No newline at end of file diff --git a/DSALib/helden/Ledur Torfinson.xml b/DSALib/helden/Ledur Torfinson.xml deleted file mode 100644 index a2bf8cb..0000000 --- a/DSALib/helden/Ledur Torfinson.xml +++ /dev/null @@ -1,4 +0,0 @@ -kwjCKNgoekrV8U2sOc1tmHX96Zw=FNYdF3Pwx3vu+tV+1fIbeNMb6r0k5KYsSPOR0MmM8BevaZb0hPws4g==

/KaCzo4Syrom78z3EQ5SbbB4sF7ey80etKII864WF64B81uRpH5t9jQTxeEu0ImbzRMqzVDZkVG9 -xD7nN1kuFw==

li7dzDacuo67Jg7mtqEm2TRuOMU=Z4Rxsnqc9E7pGknFFH2xqaryRPBaQ01khpMdLRQnG541Awtx/XPaF5Bpsy4pNWMOHCBiNU0Nogps -QW5QvnlMpA==uVrvWkzIbUdL7E80AiD0PJDX3Ck0beY5StXp1wDAA1/ePpemd6rTBNd8YoCzOovNrX016YMcTSiO -iExM4RWtJA==
\ No newline at end of file diff --git a/DSALib/helden/Morla.xml b/DSALib/helden/Morla.xml deleted file mode 100644 index 5dd39d4..0000000 --- a/DSALib/helden/Morla.xml +++ /dev/null @@ -1,4 +0,0 @@ -J0Qxa803dVWpDpWef6bwYS1dkbA=JMNNANEdxh4uTF9dr5Trjm0oxW1WhII4n2udLqB7ULX4Pw6URbN0lA==

/KaCzo4Syrom78z3EQ5SbbB4sF7ey80etKII864WF64B81uRpH5t9jQTxeEu0ImbzRMqzVDZkVG9 -xD7nN1kuFw==

li7dzDacuo67Jg7mtqEm2TRuOMU=Z4Rxsnqc9E7pGknFFH2xqaryRPBaQ01khpMdLRQnG541Awtx/XPaF5Bpsy4pNWMOHCBiNU0Nogps -QW5QvnlMpA==uVrvWkzIbUdL7E80AiD0PJDX3Ck0beY5StXp1wDAA1/ePpemd6rTBNd8YoCzOovNrX016YMcTSiO -iExM4RWtJA==
\ No newline at end of file diff --git a/DSALib/helden/Numeri.xml b/DSALib/helden/Numeri.xml deleted file mode 100644 index b907d8d..0000000 --- a/DSALib/helden/Numeri.xml +++ /dev/null @@ -1,4 +0,0 @@ -AmaaAfieEHvF5Ub8YB+OQD2D+6s=Div+yr0UvnraVfHhejvu1NDe2NU4iaZ935d1Bv3KLmYktGZcKG/jVQ==

/KaCzo4Syrom78z3EQ5SbbB4sF7ey80etKII864WF64B81uRpH5t9jQTxeEu0ImbzRMqzVDZkVG9 -xD7nN1kuFw==

li7dzDacuo67Jg7mtqEm2TRuOMU=Z4Rxsnqc9E7pGknFFH2xqaryRPBaQ01khpMdLRQnG541Awtx/XPaF5Bpsy4pNWMOHCBiNU0Nogps -QW5QvnlMpA==uVrvWkzIbUdL7E80AiD0PJDX3Ck0beY5StXp1wDAA1/ePpemd6rTBNd8YoCzOovNrX016YMcTSiO -iExM4RWtJA==
\ No newline at end of file diff --git a/DSALib/helden/Potus.xml b/DSALib/helden/Potus.xml deleted file mode 100644 index c1c04fa..0000000 --- a/DSALib/helden/Potus.xml +++ /dev/null @@ -1,4 +0,0 @@ -F7OrYyirJlEv52YqskViItN47ms=FyqxL9I3EtXVrj/SY6NLFw6F7hdqzBdNiV8rgccdkWWtvZEAGfOPtQ==

/KaCzo4Syrom78z3EQ5SbbB4sF7ey80etKII864WF64B81uRpH5t9jQTxeEu0ImbzRMqzVDZkVG9 -xD7nN1kuFw==

li7dzDacuo67Jg7mtqEm2TRuOMU=Z4Rxsnqc9E7pGknFFH2xqaryRPBaQ01khpMdLRQnG541Awtx/XPaF5Bpsy4pNWMOHCBiNU0Nogps -QW5QvnlMpA==uVrvWkzIbUdL7E80AiD0PJDX3Ck0beY5StXp1wDAA1/ePpemd6rTBNd8YoCzOovNrX016YMcTSiO -iExM4RWtJA==
\ No newline at end of file diff --git a/DSALib/helden/PumpausderGosse.xml b/DSALib/helden/PumpausderGosse.xml deleted file mode 100644 index d67ddf8..0000000 --- a/DSALib/helden/PumpausderGosse.xml +++ /dev/null @@ -1,4 +0,0 @@ -oQXQFL8j6dy53bBPLAHJsrCvDFs=UY3KHtwStSmd2pFDgHIThNF3OfFY7iasQImMyHxa+9dRGlaTEDDNug==

/KaCzo4Syrom78z3EQ5SbbB4sF7ey80etKII864WF64B81uRpH5t9jQTxeEu0ImbzRMqzVDZkVG9 -xD7nN1kuFw==

li7dzDacuo67Jg7mtqEm2TRuOMU=Z4Rxsnqc9E7pGknFFH2xqaryRPBaQ01khpMdLRQnG541Awtx/XPaF5Bpsy4pNWMOHCBiNU0Nogps -QW5QvnlMpA==uVrvWkzIbUdL7E80AiD0PJDX3Ck0beY5StXp1wDAA1/ePpemd6rTBNd8YoCzOovNrX016YMcTSiO -iExM4RWtJA==
\ No newline at end of file diff --git a/DSALib/helden/Rhoktar4.xml b/DSALib/helden/Rhoktar4.xml deleted file mode 100644 index be9b2ae..0000000 --- a/DSALib/helden/Rhoktar4.xml +++ /dev/null @@ -1,4 +0,0 @@ -btq5PhE94OQZjxRHb7Hxq539JUM=Q3g3k/lQX2jsJCxyHpcATHs1TY0aPOlnruNdqJGMgIfucIgwsdmU6A==

/KaCzo4Syrom78z3EQ5SbbB4sF7ey80etKII864WF64B81uRpH5t9jQTxeEu0ImbzRMqzVDZkVG9 -xD7nN1kuFw==

li7dzDacuo67Jg7mtqEm2TRuOMU=Z4Rxsnqc9E7pGknFFH2xqaryRPBaQ01khpMdLRQnG541Awtx/XPaF5Bpsy4pNWMOHCBiNU0Nogps -QW5QvnlMpA==uVrvWkzIbUdL7E80AiD0PJDX3Ck0beY5StXp1wDAA1/ePpemd6rTBNd8YoCzOovNrX016YMcTSiO -iExM4RWtJA==
\ No newline at end of file diff --git a/DSALib/helden/Volant.xml b/DSALib/helden/Volant.xml deleted file mode 100644 index 4fd0c8c..0000000 --- a/DSALib/helden/Volant.xml +++ /dev/null @@ -1,4 +0,0 @@ -1SwyFEXG5zhwYMHNYtyeHv4ZgF0=B03LcgbDPOAkiu9tsiLkAXmTW9mVoZipUw/T1FZrQUfouAM2rtskIg==

/KaCzo4Syrom78z3EQ5SbbB4sF7ey80etKII864WF64B81uRpH5t9jQTxeEu0ImbzRMqzVDZkVG9 -xD7nN1kuFw==

li7dzDacuo67Jg7mtqEm2TRuOMU=Z4Rxsnqc9E7pGknFFH2xqaryRPBaQ01khpMdLRQnG541Awtx/XPaF5Bpsy4pNWMOHCBiNU0Nogps -QW5QvnlMpA==uVrvWkzIbUdL7E80AiD0PJDX3Ck0beY5StXp1wDAA1/ePpemd6rTBNd8YoCzOovNrX016YMcTSiO -iExM4RWtJA==
\ No newline at end of file -- cgit v1.3.1