private void SetSkillsInternal() { var skills = new Dictionary <int, int>(); foreach (IArmorPiece armorPiece in armorPieces.Where(x => x != null)) { foreach (IAbility ability in armorPiece.Abilities) { IncrementSkillLevel(skills, ability); } } CheckAbilitiesOnArmorSet(skills); if (charm != null) { foreach (IAbility ability in charm.Abilities) { IncrementSkillLevel(skills, ability); } } foreach (ArmorSetJewelViewModel jewelViewModel in jewels) { foreach (IAbility ability in jewelViewModel.Jewel.Abilities) { for (int i = 0; i < jewelViewModel.Count; i++) { IncrementSkillLevel(skills, ability); } } } // ------------------------------------ var localAdditionalSkills = new List <SearchResultSkillViewModel>(); foreach (KeyValuePair <int, int> skillKeyValue in skills) { ISkill skill = GlobalData.Instance.Skills.First(s => s.Id == skillKeyValue.Key); int totalLevel = skillKeyValue.Value; IAbility foundAbility = DesiredAbilities.FirstOrDefault(a => a.Skill.Id == skill.Id); if (foundAbility == null) { localAdditionalSkills.Add(new SearchResultSkillViewModel(skill, totalLevel, true)); } else if (totalLevel > foundAbility.Level) { localAdditionalSkills.Add(new SearchResultSkillViewModel(skill, totalLevel, false)); } } additionalSkills = localAdditionalSkills.OrderBy(x => x.Skill.Id).ToArray(); }
private void RemoveEquipmentsBySkillExclusion() { IList <IAbility> excludedAbilities = DesiredAbilities.Where(x => x.Level == 0).ToList(); RemoveEquipmentsBySkillExclusion(excludedAbilities, inputHeads); RemoveEquipmentsBySkillExclusion(excludedAbilities, inputChests); RemoveEquipmentsBySkillExclusion(excludedAbilities, inputGloves); RemoveEquipmentsBySkillExclusion(excludedAbilities, inputWaists); RemoveEquipmentsBySkillExclusion(excludedAbilities, inputLegs); RemoveEquipmentsBySkillExclusion(excludedAbilities, inputCharms); }
private bool IsMatchingExcludedSkill(IAbility ability) { foreach (IAbility desiredAbility in DesiredAbilities.Where(x => x.Level == 0)) { if (DataUtility.AreAbilitiesOnSameSkill(ability, desiredAbility)) { return(true); } } return(false); }