summaryrefslogtreecommitdiff
path: root/DSACore/DSA_Game/Dsa.cs
blob: 18d0b8128e784078a588d01a2860bc29fde2b8ff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
using System;
using System.Collections.Generic;
using System.Linq;
using DSACore.DSA_Game.Characters;
using DSACore.DSA_Game.Save;
using DSALib;
using DSALib.Characters;

namespace DSACore.DSA_Game
{
    public static class Dsa
    {
#if DEBUG
        public const string
            rootPath = ""; //"C:\\Users\\Dennis\\Source\\Repos\\DiscoBot\\DSACore\\";//"DiscoBot\\DSACore\\";
#else
        public const string rootPath = "";//"DiscoBot\\DSACore\\";
#endif
        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 List<Zauber> Zauber { get; set; } = new List<Zauber>();

        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 .Auxiliary.Calculator.StringSolver("1d100 - (1d200 + 1) * -50000").Solve();
            /*Session = new Session();*/
            // relation.Add("Papo", "Pump aus der Gosse");
            /*foreach (var filename in Directory.GetFiles(rootPath + "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));
                (Chars.Last() as Character)?.Zauber.Select(x => new Zauber(x.Name, x.Probe, 0, x.Complexity))
                    .Where(c => !Zauber.Exists(v => v.Name.Equals(c.Name))).ToList().ForEach(v => Zauber.Add(v));
            }
*/

            Properties.Deserialize();
            Properties.Serialize(rootPath + "Properties");


            Talente = Talente.OrderBy(x => x.Name).ToList();
            Zauber = Zauber.OrderBy(x => x.Name).ToList();

            /*foreach (var talent in Talente)
            {
                Database.AddTalent(new Models.Database.Talent(talent.Name, talent.Probe));
            }

            foreach (var talent in Zauber)
            {
                Database.AddSpell(new Models.Database.GeneralSpell(talent.Name, talent.Probe, talent.Complexity));
            }*/

            //new WeaponImporter().DownloadWeapons().Wait();


            Session = new Session
            {
                Chars = Chars.Select(SaveChar.FromICharacter).ToList()
            };
            //Session.Save();
        }

        public static ICharacter GetCharacter(ulong id)
        {
            throw new NotImplementedException();
        }

        public static ICharacter GetCharacter(string name, ulong groupId)
        {
            throw new NotImplementedException();
        }
    }
}