public int TotalTalentAdvances(string tName) { int adv = 0; Talent charTalent = Talents.Find(t => t.Name == tName); if (charTalent != null) { adv = charTalent.Advances; } foreach (CareerAdvancement career in Careers) { Talent careerTalent = career.TalentsAdvanced.Find(t => t.Name == tName); if (careerTalent != null) { adv += careerTalent.Advances; } } return(adv); }
static TalentReader() { Assembly assembly = Assembly.GetExecutingAssembly(); StreamReader sr = new StreamReader(assembly.GetManifestResourceStream("WFRP_NPC_Creator.Data.TalentData.txt")); string[] talentData = sr.ReadToEnd().Split('\n'); string max, name, tests, description; bool relevance; for (int i = 0; i < talentData.Length; i++) { if (talentData[i].Length > 4 && talentData[i].Substring(0, 4) == "Max:") { max = talentData[i].Substring(5).Trim(); name = talentData[i - 5].Trim(); relevance = talentData[i - 4].Trim() == "1"; if (talentData[i + 1].Length > 6 && talentData[i + 1].Substring(0, 4) == "Test") { tests = talentData[i + 1].Substring(6).Trim(); } else { tests = ""; } if (tests == "") { description = talentData[i + 2]; } else { description = talentData[i + 3]; } Talent.TalentList.Add(new TalentInfo(Talent.GenericName(name), max, tests, relevance, description.Trim())); } } sr.Close(); }
public int TotalTalentAdvances(Talent t) { return(TotalTalentAdvances(t.Name)); }