Ejemplo n.º 1
0
        internal static SkillGroup Get(Skill skill)
        {
            if(skill.SkillGroupObject != null) return skill.SkillGroupObject;

            if (skill.SkillGroup == null) return null;

            foreach (SkillGroup skillGroup in skill.CharacterObject.SkillsSection.SkillGroups)
            {
                if (skillGroup._groupName == skill.SkillGroup)
                {
                    if(!skillGroup._affectedSkills.Contains(skill))
                        skillGroup.Add(skill);
                    return skillGroup;

                }
            }

            if (string.IsNullOrWhiteSpace(skill.SkillGroup)) return null;

            SkillGroup newGroup = new SkillGroup(skill.CharacterObject, skill.SkillGroup);
            newGroup.Add(skill);
            skill.CharacterObject.SkillsSection.SkillGroups.MergeInto(newGroup, (l, r) => String.Compare(l.DisplayName, r.DisplayName, StringComparison.Ordinal));

            return newGroup;
        }
Ejemplo n.º 2
0
        internal static SkillGroup Get(Skill skill)
        {
            if (skill.SkillGroupObject != null)
            {
                return(skill.SkillGroupObject);
            }

            if (skill.SkillGroup == null)
            {
                return(null);
            }

            foreach (SkillGroup skillGroup in skill.CharacterObject.SkillsSection.SkillGroups)
            {
                if (skillGroup._groupName == skill.SkillGroup)
                {
                    if (!skillGroup._affectedSkills.Contains(skill))
                    {
                        skillGroup.Add(skill);
                    }
                    return(skillGroup);
                }
            }

            if (string.IsNullOrWhiteSpace(skill.SkillGroup))
            {
                return(null);
            }

            SkillGroup newGroup = new SkillGroup(skill.CharacterObject, skill.SkillGroup);

            newGroup.Add(skill);
            skill.CharacterObject.SkillsSection.SkillGroups.MergeInto(newGroup, (l, r) => l.DisplayName.CompareTo(r.DisplayName));

            return(newGroup);
        }
Ejemplo n.º 3
0
        internal static SkillGroup Get(Skill skill)
        {
            if (skill.SkillGroupObject != null)
            {
                return(skill.SkillGroupObject);
            }

            if (string.IsNullOrWhiteSpace(skill.SkillGroup))
            {
                return(null);
            }

            foreach (SkillGroup skillGroup in skill.CharacterObject.SkillsSection.SkillGroups)
            {
                if (skillGroup._groupName == skill.SkillGroup)
                {
                    if (!skillGroup._affectedSkills.Contains(skill))
                    {
                        skillGroup.Add(skill);
                    }
                    return(skillGroup);
                }
            }

            SkillGroup newGroup = new SkillGroup(skill.CharacterObject, skill.SkillGroup);

            newGroup.Add(skill);
            skill.CharacterObject.SkillsSection.SkillGroups.MergeInto(newGroup, (l, r) => String.Compare(l.DisplayName, r.DisplayName, StringComparison.Ordinal),
                                                                      (l, r) => { foreach (Skill x in r.SkillList.Where(y => !l.SkillList.Contains(y)))
                                                                                  {
                                                                                      l.SkillList.Add(x);
                                                                                  }
                                                                      });

            return(newGroup);
        }