summaryrefslogtreecommitdiff
path: root/DiscoBot/Char.cs
diff options
context:
space:
mode:
authorTrueDoctor <d-kobert@web.de>2017-08-22 19:44:55 +0200
committerTrueDoctor <d-kobert@web.de>2017-08-22 19:44:55 +0200
commiteb7a842b8fe784891a8f865cf47cc20e4fcb22b0 (patch)
treea309f068cf316c50a1d419d9d0ddc8ccb93c6511 /DiscoBot/Char.cs
parent27c9c6266cf7e2e2d06b4cb7be3360c9259407a3 (diff)
implemented charackter class
implemented xml readout
Diffstat (limited to 'DiscoBot/Char.cs')
-rw-r--r--DiscoBot/Char.cs109
1 files changed, 109 insertions, 0 deletions
diff --git a/DiscoBot/Char.cs b/DiscoBot/Char.cs
new file mode 100644
index 0000000..250810d
--- /dev/null
+++ b/DiscoBot/Char.cs
@@ -0,0 +1,109 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Xml;
+
+namespace DiscoBot
+{
+ public class Char
+ {
+
+ string name;
+ public Dictionary<string, int> eigenschaften = new Dictionary<string, int>();
+ public List<Talent> talente = new List<Talent>();
+ public List<Kampf> kampftalente = new List<Kampf>();
+
+ public Dictionary<string, string> Proptable = new Dictionary<string, string>();
+
+
+ public Char(String path = "Felis.xml")
+ {
+
+ Load(path);
+ }
+
+ private void Load(string path)
+ {
+ XmlTextReader reader = new XmlTextReader(path);
+ while (reader.Read())
+ {
+ if (reader.NodeType == XmlNodeType.Element)
+ switch (reader.Name)
+ {
+ case "held":
+ name = reader.GetAttribute("name");
+ break;
+ case "eigenschaft":
+ eigenschaften.Add(reader.GetAttribute("name"), Convert.ToInt32(reader.GetAttribute("value")) + Convert.ToInt32(reader.GetAttribute("mod")));
+ break;
+ case "talentliste":
+ reader.Read();
+ while (reader.Name.Equals("talent"))
+ {
+ talente.Add(new Talent(reader.GetAttribute("name"), reader.GetAttribute("probe").Remove(0, 2).Trim(')'), Convert.ToInt32(reader.GetAttribute("value"))));
+ reader.Read();
+ }
+ break;
+ case "kampfwerte":
+ string atname = reader.GetAttribute("name");
+ reader.Read();
+ int at = Convert.ToInt32(reader.GetAttribute("value"));
+ reader.Read();
+ int pa = Convert.ToInt32(reader.GetAttribute("value"));
+ kampftalente.Add(new Kampf(atname, at, pa));
+ break;
+ }
+
+
+
+ }
+ Proptable.Add("MU", "Mut");
+ Proptable.Add("KL", "Klugheit");
+ Proptable.Add("IN", "Intuition");
+ Proptable.Add("CH", "Charisma");
+ Proptable.Add("FF", "Fingerfertigkeit");
+ Proptable.Add("GE", "Gewandheit");
+ Proptable.Add("KO", "Konstitution");
+ Proptable.Add("KK", "Körperkraft");
+
+ }
+ string TestTalent(string talent)
+ {
+ var props =talente.Find(v => v.name.Equals(talent)).Test();
+
+ return "";
+ }
+
+ }
+ public class Talent
+ {
+ public string name, probe;
+ private int value;
+ public Talent(string name, string probe, int value) { this.name = name; this.probe = probe; this.value = value; }
+ public string[] Test()
+ {
+ var temp = probe.Split('/');
+ foreach (string s in temp)
+ s.Replace("/", "");
+ return temp;
+ }
+
+ }
+ public class Kampf
+ {
+ string name;
+ private int at, pa;
+ public Kampf(string name, int at, int pa) { this.name = name; this.at = at; this.pa = pa; }
+ void Test() { }
+ }
+ public static class dice
+ {
+ public static int Rolld20()
+ {
+ System.Random rnd = new System.Random();
+ return rnd.Next(19) + 1;
+ }
+ }
+}