From 632781d1adf54287ecfe7cbcbc17074e14a769b2 Mon Sep 17 00:00:00 2001 From: TrueDoctor Date: Sat, 29 Sep 2018 23:59:42 +0200 Subject: added database methods --- DSACore/Models/Database/DatabaseChar.cs | 47 +++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 DSACore/Models/Database/DatabaseChar.cs (limited to 'DSACore/Models/Database/DatabaseChar.cs') diff --git a/DSACore/Models/Database/DatabaseChar.cs b/DSACore/Models/Database/DatabaseChar.cs new file mode 100644 index 0000000..03383b8 --- /dev/null +++ b/DSACore/Models/Database/DatabaseChar.cs @@ -0,0 +1,47 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using DSALib; + +namespace DSACore.Models.Database +{ + public class DatabaseChar + { + public int Id { get; set; } + + public string Name { get; set; } + + public string Rasse { get; set; } + + public List Skills { get; set; } = new List(); + + public List Talents { get; set; } = new List(); + + public List Advantages { get; set; } = new List(); + + public List Spells { get; set; } = new List(); + + public List WeaponTalents { get; set; } = new List(); + + + public static void LoadChar(DSA_Game.Characters.Character file, out GroupChar group, out DatabaseChar data) + { + group = new GroupChar(); + data = new DatabaseChar(); + + group.Name = file.Name.Split(' ').First(); + group.Weapon = new Weapon(); + group.Lp = group.LpMax = file.Lebenspunkte_Basis; + group.As = group.AsMax = file.Astralpunkte_Basis; + group.Weapon = new Weapon(); + + data.Name = file.Name; + data.Advantages = file.Vorteile.Select(x => new Advantage(x.Name, x.Value)).ToList(); + data.Skills = file.Eigenschaften.Select(x => new Field(x.Key, x.Value)).ToList(); + data.Spells = file.Zauber.Select(x => new CharSpell(x.Representation, x.Value)).ToList(); + data.Talents = file.Talente.Select(x => new Field(x.Name, x.Value)).ToList(); + data.WeaponTalents = file.Kampftalente.Select(x => new WeaponTalent(x.Name, x.At, x.Pa)).ToList(); + } + } +} -- cgit v1.2.3-70-g09d2