Example #1
0
        private MappedSkillPart[] MapSkillParts(IList <IList <IEquipment> > allEquipment, IDictionary <int, int> desiredDict, MappedSkill[] skills)
        {
            IEnumerable <IArmorSetSkillPart> parts = allEquipment
                                                     .SelectMany(x => x)
                                                     .Where(x => x.Type != EquipmentType.Charm)
                                                     .Cast <IArmorPiece>()
                                                     .Where(x => x.ArmorSetSkills != null)
                                                     .SelectMany(x => x.ArmorSetSkills)
                                                     .SelectMany(x => x.Parts);
            var newParts = new Dictionary <int, MappedSkillPart>();

            foreach (IArmorSetSkillPart part in parts)
            {
                MappedSkill[] desiredPartAbilities = part.GrantedSkills
                                                     .Where(x => desiredDict.ContainsKey(x.Skill.Id))
                                                     .Select(x => skills[desiredDict[x.Skill.Id]].CopyWithLevel(x.Level))
                                                     .ToArray();
                if (desiredPartAbilities.Length == 0)
                {
                    continue;
                }
                var newPart = new MappedSkillPart();
                newPart.Requirement = part.RequiredArmorPieces;
                newPart.Skills      = desiredPartAbilities;
                newPart.Part        = part;
                newParts[part.Id]   = newPart;
            }
            MappedSkillPart[] mappedArr = newParts.Values.ToArray();
            for (int i = 0; i < mappedArr.Length; i++)
            {
                MappedSkillPart part = mappedArr[i];
                part.MappedId = i;
            }
            return(mappedArr);
        }
 public ArmorSetSkillGrant(MappedSkillPart part)
 {
     Part = part;
 }