public static RaceData ReadRaceData(int raceID) { if (database == null) { database = new List<RaceData>(); //Get the entirety of the race database var raceDB = DatabaseHandling.GetDatabase(Archetype.RACE); //Parse it and shove it in the array foreach (List<string> dbRace in raceDB.Values) { RaceData datum = new RaceData() { RaceID = Int32.Parse(dbRace[0]), RaceName = dbRace[1], IsIntelligent = bool.Parse(dbRace[2]), BrawnModifier = Int32.Parse(dbRace[3]), AgilModifier = Int32.Parse(dbRace[4]), DexModifier = Int32.Parse(dbRace[5]), PercModifier = Int32.Parse(dbRace[6]), IntelModifier = Int32.Parse(dbRace[7]) }; database.Add(datum); } } return database.Where(d => d.RaceID.Equals(raceID)).FirstOrDefault(); }
/// <summary> /// Reads the race data for a particular race /// </summary> /// <param name="race"></param> /// <returns></returns> private static RaceData ReadRaceData(string race) { if (database == null) { database = new List<RaceData>(); //Get the entirety of the race database var raceDB = DatabaseHandling.GetDatabase(Archetype.RACE); //Parse it and shove it in the array foreach (List<string> dbRace in raceDB.Values) { RaceData datum = new RaceData() { RaceID = Int32.Parse(dbRace[0]), RaceName = dbRace[1], IsIntelligent = bool.Parse(dbRace[2]), BrawnModifier = Int32.Parse(dbRace[3]), AgilModifier = Int32.Parse(dbRace[4]), DexModifier = Int32.Parse(dbRace[5]), PercModifier = Int32.Parse(dbRace[6]), IntelModifier = Int32.Parse(dbRace[7]), IsHumanoid = Boolean.Parse(dbRace[8]), IsUndead = Boolean.Parse(dbRace[9]) }; database.Add(datum); } } return database.Where(d => d.RaceName.Equals(race, StringComparison.OrdinalIgnoreCase)).FirstOrDefault(); }