summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--DiscoBot/DSA_Game/Characters/SaveChar.cs14
-rw-r--r--DiscoBot/DSA_Game/Dsa.cs31
-rw-r--r--DiscoBot/sessions/test/test-2.json81
-rw-r--r--DiscoBot/sessions/test/test-3.json81
-rw-r--r--DiscoBot/sessions/test/test-4.json81
5 files changed, 281 insertions, 7 deletions
diff --git a/DiscoBot/DSA_Game/Characters/SaveChar.cs b/DiscoBot/DSA_Game/Characters/SaveChar.cs
index 89ca98a..4c9a940 100644
--- a/DiscoBot/DSA_Game/Characters/SaveChar.cs
+++ b/DiscoBot/DSA_Game/Characters/SaveChar.cs
@@ -6,6 +6,8 @@ using System.Threading.Tasks;
namespace DiscoBot.DSA_Game.Characters
{
+ using Discord;
+
public class SaveChar
{
public string Name { get; set; }
@@ -27,4 +29,16 @@ namespace DiscoBot.DSA_Game.Characters
};
}
}
+
+
+ public static class ICharExtension
+ {
+ public static void Update(this ICharacter c, SaveChar s)
+ {
+ c.Astralpunkte_Aktuell = s.Astralpunkte_Aktuell;
+ c.Ausdauer_Aktuell = s.Ausdauer_Aktuell;
+ c.Lebenspunkte_Aktuell = s.Lebenspunkte_Aktuell;
+ c.Name = s.Name;
+ }
+ }
}
diff --git a/DiscoBot/DSA_Game/Dsa.cs b/DiscoBot/DSA_Game/Dsa.cs
index f1ed069..09e874d 100644
--- a/DiscoBot/DSA_Game/Dsa.cs
+++ b/DiscoBot/DSA_Game/Dsa.cs
@@ -14,6 +14,8 @@
public static class Dsa
{
+ private static Session s_session;
+
public static ICommandContext GeneralContext { get; set; }
public static AudioService Service { get; set; }
@@ -22,11 +24,27 @@
public static List<Talent> Talente { get; set; } = new List<Talent>();
- public static Session Session { get; set; } = new Session();
+ 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()
{
-
+ /*Session = new Session();*/
// relation.Add("Papo", "Pump aus der Gosse");
foreach (var filename in Directory.GetFiles("helden", "*.xml"))
{
@@ -39,12 +57,11 @@
Properties.Serialize();
Talente = Talente.OrderBy(x => x.Name).ToList();
-
Session = new Session
- {
- Chars = Chars.Select(x => SaveChar.FromICharacter(x)).ToList(),
- GeneralContext = GeneralContext
- };
+ {
+ Chars = Chars.Select(x => SaveChar.FromICharacter(x)).ToList(),
+ GeneralContext = GeneralContext
+ };
Session.Save();
}
}
diff --git a/DiscoBot/sessions/test/test-2.json b/DiscoBot/sessions/test/test-2.json
new file mode 100644
index 0000000..3458c52
--- /dev/null
+++ b/DiscoBot/sessions/test/test-2.json
@@ -0,0 +1,81 @@
+{
+ "GeneralContext": null,
+ "Relation": {
+ "The Doctor": "Felis Exodus Schattenwald"
+ },
+ "Chars": [
+ {
+ "Name": "Felis Exodus Schattenwald",
+ "Lebenspunkte_Aktuell": 30,
+ "Ausdauer_Aktuell": 0,
+ "Astralpunkte_Aktuell": 20
+ },
+ {
+ "Name": "Gardist",
+ "Lebenspunkte_Aktuell": 29,
+ "Ausdauer_Aktuell": 0,
+ "Astralpunkte_Aktuell": 0
+ },
+ {
+ "Name": "Hartmut Reiher",
+ "Lebenspunkte_Aktuell": 31,
+ "Ausdauer_Aktuell": 0,
+ "Astralpunkte_Aktuell": 0
+ },
+ {
+ "Name": "Helga vom Drachenei, Tausendsasserin",
+ "Lebenspunkte_Aktuell": 21,
+ "Ausdauer_Aktuell": 0,
+ "Astralpunkte_Aktuell": 35
+ },
+ {
+ "Name": "Krenko",
+ "Lebenspunkte_Aktuell": 25,
+ "Ausdauer_Aktuell": 0,
+ "Astralpunkte_Aktuell": 0
+ },
+ {
+ "Name": "Ledur Torfinson",
+ "Lebenspunkte_Aktuell": 39,
+ "Ausdauer_Aktuell": 0,
+ "Astralpunkte_Aktuell": 0
+ },
+ {
+ "Name": "Morla",
+ "Lebenspunkte_Aktuell": 26,
+ "Ausdauer_Aktuell": 0,
+ "Astralpunkte_Aktuell": 13
+ },
+ {
+ "Name": "Numeri Illuminus",
+ "Lebenspunkte_Aktuell": 28,
+ "Ausdauer_Aktuell": 0,
+ "Astralpunkte_Aktuell": 40
+ },
+ {
+ "Name": "Potus",
+ "Lebenspunkte_Aktuell": 39,
+ "Ausdauer_Aktuell": 0,
+ "Astralpunkte_Aktuell": 16
+ },
+ {
+ "Name": "Pump aus der Gosse",
+ "Lebenspunkte_Aktuell": 18,
+ "Ausdauer_Aktuell": 0,
+ "Astralpunkte_Aktuell": 13
+ },
+ {
+ "Name": "Rhoktar4",
+ "Lebenspunkte_Aktuell": 34,
+ "Ausdauer_Aktuell": 0,
+ "Astralpunkte_Aktuell": 17
+ },
+ {
+ "Name": "Volant",
+ "Lebenspunkte_Aktuell": 28,
+ "Ausdauer_Aktuell": 0,
+ "Astralpunkte_Aktuell": 43
+ }
+ ],
+ "SessionName": null
+} \ No newline at end of file
diff --git a/DiscoBot/sessions/test/test-3.json b/DiscoBot/sessions/test/test-3.json
new file mode 100644
index 0000000..3458c52
--- /dev/null
+++ b/DiscoBot/sessions/test/test-3.json
@@ -0,0 +1,81 @@
+{
+ "GeneralContext": null,
+ "Relation": {
+ "The Doctor": "Felis Exodus Schattenwald"
+ },
+ "Chars": [
+ {
+ "Name": "Felis Exodus Schattenwald",
+ "Lebenspunkte_Aktuell": 30,
+ "Ausdauer_Aktuell": 0,
+ "Astralpunkte_Aktuell": 20
+ },
+ {
+ "Name": "Gardist",
+ "Lebenspunkte_Aktuell": 29,
+ "Ausdauer_Aktuell": 0,
+ "Astralpunkte_Aktuell": 0
+ },
+ {
+ "Name": "Hartmut Reiher",
+ "Lebenspunkte_Aktuell": 31,
+ "Ausdauer_Aktuell": 0,
+ "Astralpunkte_Aktuell": 0
+ },
+ {
+ "Name": "Helga vom Drachenei, Tausendsasserin",
+ "Lebenspunkte_Aktuell": 21,
+ "Ausdauer_Aktuell": 0,
+ "Astralpunkte_Aktuell": 35
+ },
+ {
+ "Name": "Krenko",
+ "Lebenspunkte_Aktuell": 25,
+ "Ausdauer_Aktuell": 0,
+ "Astralpunkte_Aktuell": 0
+ },
+ {
+ "Name": "Ledur Torfinson",
+ "Lebenspunkte_Aktuell": 39,
+ "Ausdauer_Aktuell": 0,
+ "Astralpunkte_Aktuell": 0
+ },
+ {
+ "Name": "Morla",
+ "Lebenspunkte_Aktuell": 26,
+ "Ausdauer_Aktuell": 0,
+ "Astralpunkte_Aktuell": 13
+ },
+ {
+ "Name": "Numeri Illuminus",
+ "Lebenspunkte_Aktuell": 28,
+ "Ausdauer_Aktuell": 0,
+ "Astralpunkte_Aktuell": 40
+ },
+ {
+ "Name": "Potus",
+ "Lebenspunkte_Aktuell": 39,
+ "Ausdauer_Aktuell": 0,
+ "Astralpunkte_Aktuell": 16
+ },
+ {
+ "Name": "Pump aus der Gosse",
+ "Lebenspunkte_Aktuell": 18,
+ "Ausdauer_Aktuell": 0,
+ "Astralpunkte_Aktuell": 13
+ },
+ {
+ "Name": "Rhoktar4",
+ "Lebenspunkte_Aktuell": 34,
+ "Ausdauer_Aktuell": 0,
+ "Astralpunkte_Aktuell": 17
+ },
+ {
+ "Name": "Volant",
+ "Lebenspunkte_Aktuell": 28,
+ "Ausdauer_Aktuell": 0,
+ "Astralpunkte_Aktuell": 43
+ }
+ ],
+ "SessionName": null
+} \ No newline at end of file
diff --git a/DiscoBot/sessions/test/test-4.json b/DiscoBot/sessions/test/test-4.json
new file mode 100644
index 0000000..46853cf
--- /dev/null
+++ b/DiscoBot/sessions/test/test-4.json
@@ -0,0 +1,81 @@
+{
+ "GeneralContext": null,
+ "Relation": {
+ "The Doctor": "Felis Exodus Schattenwald"
+ },
+ "Chars": [
+ {
+ "Name": "Felis Exodus Schattenwald",
+ "Lebenspunkte_Aktuell": 20,
+ "Ausdauer_Aktuell": 0,
+ "Astralpunkte_Aktuell": 20
+ },
+ {
+ "Name": "Gardist",
+ "Lebenspunkte_Aktuell": 29,
+ "Ausdauer_Aktuell": 0,
+ "Astralpunkte_Aktuell": 0
+ },
+ {
+ "Name": "Hartmut Reiher",
+ "Lebenspunkte_Aktuell": 31,
+ "Ausdauer_Aktuell": 0,
+ "Astralpunkte_Aktuell": 0
+ },
+ {
+ "Name": "Helga vom Drachenei, Tausendsasserin",
+ "Lebenspunkte_Aktuell": 21,
+ "Ausdauer_Aktuell": 0,
+ "Astralpunkte_Aktuell": 35
+ },
+ {
+ "Name": "Krenko",
+ "Lebenspunkte_Aktuell": 25,
+ "Ausdauer_Aktuell": 0,
+ "Astralpunkte_Aktuell": 0
+ },
+ {
+ "Name": "Ledur Torfinson",
+ "Lebenspunkte_Aktuell": 39,
+ "Ausdauer_Aktuell": 0,
+ "Astralpunkte_Aktuell": 0
+ },
+ {
+ "Name": "Morla",
+ "Lebenspunkte_Aktuell": 26,
+ "Ausdauer_Aktuell": 0,
+ "Astralpunkte_Aktuell": 13
+ },
+ {
+ "Name": "Numeri Illuminus",
+ "Lebenspunkte_Aktuell": 28,
+ "Ausdauer_Aktuell": 0,
+ "Astralpunkte_Aktuell": 40
+ },
+ {
+ "Name": "Potus",
+ "Lebenspunkte_Aktuell": 39,
+ "Ausdauer_Aktuell": 0,
+ "Astralpunkte_Aktuell": 16
+ },
+ {
+ "Name": "Pump aus der Gosse",
+ "Lebenspunkte_Aktuell": 18,
+ "Ausdauer_Aktuell": 0,
+ "Astralpunkte_Aktuell": 13
+ },
+ {
+ "Name": "Rhoktar4",
+ "Lebenspunkte_Aktuell": 34,
+ "Ausdauer_Aktuell": 0,
+ "Astralpunkte_Aktuell": 17
+ },
+ {
+ "Name": "Volant",
+ "Lebenspunkte_Aktuell": 28,
+ "Ausdauer_Aktuell": 0,
+ "Astralpunkte_Aktuell": 43
+ }
+ ],
+ "SessionName": null
+} \ No newline at end of file