public static ResourceSystem CheckAndSaveResourceSystem(ResourceSystem rs, ResourceSystemType newType, int chrId) { if (rs != null && rs.Type != newType) { rs.SaveToDatabase(chrId); //This actually doesn't always do something } if (rs == null || rs.Type != newType) { switch (newType) { case ResourceSystemType.Hunter: return(new QuiverCartridgeSystem()); case ResourceSystemType.Bandit: return(new BodyCountSystem()); case ResourceSystemType.Aran: return(new AranSystem()); case ResourceSystemType.Phantom: PhantomSystem phantomResource = new PhantomSystem(); using (LeattyContext DBContext = new LeattyContext()) { phantomResource.PopulateSkills(DBContext.StolenSkills.Where(x => x.CharacterId == chrId).ToList()); } return(phantomResource); case ResourceSystemType.Luminous: return(new LuminousSystem()); default: return(null); } } return(rs); }
public ResourceSystem(ResourceSystemType type) { Type = type; }