diff options
author | TrueDoctor <d-kobert@web.de> | 2018-09-26 20:51:37 +0200 |
---|---|---|
committer | TrueDoctor <d-kobert@web.de> | 2018-09-26 20:51:37 +0200 |
commit | b411aa2128c2724bec0ecedb8cb4e1ffa59f3b53 (patch) | |
tree | 14e0a0cca2cf66b95fda402c8c7d7b6bd5b7b222 /DSACore/DSA_Game/Dsa.cs | |
parent | 92e8bb7523c775014ccf68355e3f0178ebf4a61c (diff) |
disconnected most vital calles from the Discord Bot
Diffstat (limited to 'DSACore/DSA_Game/Dsa.cs')
-rw-r--r-- | DSACore/DSA_Game/Dsa.cs | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/DSACore/DSA_Game/Dsa.cs b/DSACore/DSA_Game/Dsa.cs new file mode 100644 index 0000000..8907f96 --- /dev/null +++ b/DSACore/DSA_Game/Dsa.cs @@ -0,0 +1,61 @@ +using DSALib; +using DSALib.Characters; + +namespace DiscoBot.DSA_Game +{ + using System.Collections.Generic; + using System.IO; + using System.Linq; + using DiscoBot.DSA_Game.Characters; + using DiscoBot.DSA_Game.Save; + + public static class Dsa + { + private static Session s_session; + + public static List<ICharacter> Chars { get; set; } = new List<ICharacter>(); // list of all characters + + public static List<Talent> Talente { get; set; } = new List<Talent>(); + + public static Session Session + { + get + { + s_session.Chars = Chars.Select(x => SaveChar.FromICharacter(x)).ToList(); + return s_session; + } + + set + { + s_session = value; + foreach (var x in value.Chars) + { + Chars.Find(c => c.Name.Equals(x.Name)).Update(x); + } + } + } + + public static void Startup() + { + //new DiscoBot.Auxiliary.Calculator.StringSolver("1d100 - (1d200 + 1) * -50000").Solve(); + /*Session = new Session();*/ + // relation.Add("Papo", "Pump aus der Gosse"); + foreach (var filename in Directory.GetFiles("helden", "*.xml")) + { + Chars.Add(new Character(filename)); + (Chars.Last() as Character)?.Talente.Select(x => new Talent(x.Name, x.Probe, 0)) + .Where(c => !Talente.Exists(v => v.Name.Equals(c.Name))).ToList().ForEach(v => Talente.Add(v)); + } + + Properties.Deserialize(); + Properties.Serialize(); + + Talente = Talente.OrderBy(x => x.Name).ToList(); + Session = new Session + { + Chars = Chars.Select(x => SaveChar.FromICharacter(x)).ToList() + }; + Session.Save(); + } + } +}
\ No newline at end of file |