public void Merge(SkillRequirements other) { for (int i = 0; i < (int)Skill.kCount; ++i) { min_required[i] = Math.Max(min_required[i], other.min_required[i]); } }
protected bool ParseOtherRequirements(HtmlNode requirements_table) { if (requirements_table == null) { return(false); } foreach (HtmlNode skill_req in requirements_table.QuerySelectorAll("ul")) { if (skill_req.ParentNode != requirements_table) { continue; } string[] split_reqs = skill_req.InnerText.Split('\n'); foreach (string current in split_reqs) { string to_parse = current.ToLower(); bool found = false; for (int i = 0; i < (int)SkillRequirements.Skill.kCount; ++i) { SkillRequirements.Skill current_skill = (SkillRequirements.Skill)i; string to_check = SkillRequirements.SkillToSkillName(current_skill); if (to_parse.Contains(to_check.ToLower()) == true) { string[] split_skill = to_parse.Split(' '); string level_string = split_skill.First(); int required_level; if (int.TryParse(level_string, out required_level)) { skill_requirements.SetRequiredLevel(current_skill, required_level); found = true; } break; } } if (found == false) { if (skill_req.InnerText != "None" && current.Length > 0) { misc_requirements.Add(current); } } } } return(true); }
public void ListSkillRequirements(ListDelegate del = null) { for (int i = 0; i < (int)SkillRequirements.Skill.kCount; ++i) { SkillRequirements.Skill skill = (SkillRequirements.Skill)i; int level = skill_requirements.GetRequiredLevel(skill); if (level > 0) { string output = SkillRequirements.SkillToSkillName(skill) + ": " + level; if (del == null) { Console.WriteLine(output); } else { del(output); } } } }
public Quest(string url, List <string> already_parsed = null) { name = ""; skill_requirements = new SkillRequirements(); required_quests = new List <Quest>(); required_quest_points = 0; misc_requirements = new List <string>(); if (already_parsed == null) { already_parsed = new List <string>(); } if (already_parsed.Contains(url)) { return; } RetrieveData(url, already_parsed); Merge(); }