diff options
author | TrueDoctor <d-kobert@web.de> | 2018-10-01 02:28:42 +0200 |
---|---|---|
committer | TrueDoctor <d-kobert@web.de> | 2018-10-01 02:28:42 +0200 |
commit | 6285967d1cf6e9322f584de761eea31ade32b3e5 (patch) | |
tree | 2f2227e85c18011d5122924e56ecde00e2f47ec8 /DSACore/Models | |
parent | 560f454c9beb2f691730b126fc6b3e23d68d6681 (diff) |
Completed Weapon import function to automagically load data from an dsa website into the database
Diffstat (limited to 'DSACore/Models')
-rw-r--r-- | DSACore/Models/Database/Group.cs | 3 | ||||
-rw-r--r-- | DSACore/Models/Database/Weapon.cs | 40 | ||||
-rw-r--r-- | DSACore/Models/Network/Group.cs | 24 |
3 files changed, 66 insertions, 1 deletions
diff --git a/DSACore/Models/Database/Group.cs b/DSACore/Models/Database/Group.cs index 0273aed..a7bb929 100644 --- a/DSACore/Models/Database/Group.cs +++ b/DSACore/Models/Database/Group.cs @@ -12,5 +12,8 @@ namespace DSACore.Models.Database public string Password { get; set; } public int Id { get; set; } public List<GroupChar> Chars { get; set; }= new List<GroupChar>(); + } + + } diff --git a/DSACore/Models/Database/Weapon.cs b/DSACore/Models/Database/Weapon.cs index 9c75b30..b2f8a1e 100644 --- a/DSACore/Models/Database/Weapon.cs +++ b/DSACore/Models/Database/Weapon.cs @@ -7,9 +7,47 @@ namespace DSACore.Models.Database { public class Weapon { + public Weapon() + { + } + + public Weapon(string name, string damage, int weight, string weaponTalent, string price) + { + Name = name ?? throw new ArgumentNullException(nameof(name)); + Damage = damage ?? throw new ArgumentNullException(nameof(damage)); + Weight = weight; + WeaponTalent = weaponTalent ?? throw new ArgumentNullException(nameof(weaponTalent)); + Price = price; + } + public string Name { get; set; } public string Damage { get; set; } + public int Weight { get; set; } public string WeaponTalent { get; set; } - public string Modifier { get; set; } + public string Price { get; set; } + } + + public class MeleeWeapon : Weapon + { + public string TpKK { get; set; } + public int INI { get; set; } + public string MW { get; set; } + + public MeleeWeapon(string name, string damage, int weight, string weaponTalent, string price) : base(name, damage, weight, weaponTalent, price) + { + } + } + + public class RangedWeapon : Weapon + { + public int AtMod { get; set; } + public int KKMod { get; set; } + public string AtReach { get; set; } + public string TpReach { get; set; } + public int LoadTime { get; set; } + + public RangedWeapon(string name, string damage, int weight, string weaponTalent, string price) : base(name, damage, weight, weaponTalent, price) + { + } } } diff --git a/DSACore/Models/Network/Group.cs b/DSACore/Models/Network/Group.cs index 80a5a81..6e62dc8 100644 --- a/DSACore/Models/Network/Group.cs +++ b/DSACore/Models/Network/Group.cs @@ -7,14 +7,38 @@ namespace DSACore.Models.Network { public class Group { + private int _online; + public Group(string name, string password) { Name = name; Password = password; } + public Group(string name, int userCount) + { + Name = name ?? throw new ArgumentNullException(nameof(name)); + UserCount = userCount; + } + public string Name { get; set; } public string Password { get; set; } public List<User> Users { get; set; } = new List<User>(); + + public int UserCount + { + get { return _online; RefreshOnline();} + set { _online = value; RefreshOnline();} + } + + private void RefreshOnline() + { + _online = Users.Count; + } + + public Group SendGroup() + { + return new Group( Name, UserCount); + } } } |