From 6285967d1cf6e9322f584de761eea31ade32b3e5 Mon Sep 17 00:00:00 2001 From: TrueDoctor Date: Mon, 1 Oct 2018 02:28:42 +0200 Subject: Completed Weapon import function to automagically load data from an dsa website into the database --- DSACore/Models/Database/Group.cs | 3 +++ DSACore/Models/Database/Weapon.cs | 40 ++++++++++++++++++++++++++++++++++++++- DSACore/Models/Network/Group.cs | 24 +++++++++++++++++++++++ 3 files changed, 66 insertions(+), 1 deletion(-) (limited to 'DSACore/Models') 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 Chars { get; set; }= new List(); + } + + } 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 Users { get; set; } = new List(); + + 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); + } } } -- cgit v1.2.3-54-g00ecf