Ejemplo n.º 1
0
        private static List <Tuple <string, IComparer <Skill> > > GenerateSortList()
        {
            List <Tuple <string, IComparer <Skill> > > ret = new List <Tuple <string, IComparer <Skill> > >(9)
            {
                new Tuple <string, IComparer <Skill> >(LanguageManager.GetString("Skill_SortAlphabetical"),
                                                       new SkillSorter(SkillsSection.CompareSkills)),
                new Tuple <string, IComparer <Skill> >(LanguageManager.GetString("Skill_SortRating"),
                                                       new SkillSorter((x, y) =>
                {
                    int intReturn = y.Rating.CompareTo(x.Rating);
                    if (intReturn == 0)
                    {
                        if (y.Specializations.Count > 0 || x.Specializations.Count > 0)
                        {
                            if (x.Specializations.Count == 0)
                            {
                                return(1);
                            }
                            if (y.Specializations.Count == 0)
                            {
                                return(-1);
                            }
                            if (y.Specializations.Count > x.Specializations.Count)
                            {
                                return(1);
                            }
                            if (y.Specializations.Count < x.Specializations.Count)
                            {
                                return(-1);
                            }
                        }
                        intReturn = SkillsSection.CompareSkills(x, y);
                    }
                    return(intReturn);
                })),
                new Tuple <string, IComparer <Skill> >(LanguageManager.GetString("Skill_SortDicepool"),
                                                       new SkillSorter((x, y) =>
                {
                    int intReturn = y.Pool.CompareTo(x.Pool);
                    if (intReturn == 0)
                    {
                        if (y.Specializations.Count > 0 || x.Specializations.Count > 0)
                        {
                            if (x.Specializations.Count == 0)
                            {
                                return(1);
                            }
                            if (y.Specializations.Count == 0)
                            {
                                return(-1);
                            }
                            int intLeftMax  = x.Specializations.Max(z => z.SpecializationBonus);
                            int intRightMax = y.Specializations.Max(z => z.SpecializationBonus);
                            if (intRightMax > intLeftMax)
                            {
                                return(1);
                            }
                            if (intRightMax < intLeftMax)
                            {
                                return(-1);
                            }
                            if (y.Specializations.Count > x.Specializations.Count)
                            {
                                return(1);
                            }
                            if (y.Specializations.Count < x.Specializations.Count)
                            {
                                return(-1);
                            }
                        }
                        intReturn = SkillsSection.CompareSkills(x, y);
                    }

                    return(intReturn);
                })),
                new Tuple <string, IComparer <Skill> >(LanguageManager.GetString("Skill_SortLowerDicepool"),
                                                       new SkillSorter((x, y) =>
                {
                    int intReturn = x.Pool.CompareTo(y.Pool);
                    if (intReturn == 0)
                    {
                        if (y.Specializations.Count > 0 || x.Specializations.Count > 0)
                        {
                            if (x.Specializations.Count == 0)
                            {
                                return(-1);
                            }
                            if (y.Specializations.Count == 0)
                            {
                                return(1);
                            }
                            int intLeftMax  = x.Specializations.Max(z => z.SpecializationBonus);
                            int intRightMax = y.Specializations.Max(z => z.SpecializationBonus);
                            if (intRightMax > intLeftMax)
                            {
                                return(-1);
                            }
                            if (intRightMax < intLeftMax)
                            {
                                return(1);
                            }
                            if (y.Specializations.Count > x.Specializations.Count)
                            {
                                return(-1);
                            }
                            if (y.Specializations.Count < x.Specializations.Count)
                            {
                                return(1);
                            }
                        }
                        intReturn = SkillsSection.CompareSkills(x, y);
                    }
                    return(intReturn);
                })),
                new Tuple <string, IComparer <Skill> >(LanguageManager.GetString("Skill_SortAttributeValue"),
                                                       new SkillSorter((x, y) =>
                {
                    int intReturn = y.AttributeModifiers.CompareTo(x.AttributeModifiers);
                    if (intReturn == 0)
                    {
                        intReturn = string.Compare(x.DisplayAttribute, y.DisplayAttribute, false, GlobalSettings.CultureInfo);
                        if (intReturn == 0)
                        {
                            intReturn = SkillsSection.CompareSkills(x, y);
                        }
                    }
                    return(intReturn);
                })),
                new Tuple <string, IComparer <Skill> >(LanguageManager.GetString("Skill_SortAttributeName"),
                                                       new SkillSorter((x, y) =>
                {
                    int intReturn = string.Compare(x.DisplayAttribute, y.DisplayAttribute, false, GlobalSettings.CultureInfo);
                    if (intReturn == 0)
                    {
                        intReturn = SkillsSection.CompareSkills(x, y);
                    }
                    return(intReturn);
                })),
                new Tuple <string, IComparer <Skill> >(LanguageManager.GetString("Skill_SortGroupName"),
                                                       new SkillSorter((x, y) =>
                {
                    int intReturn = SkillsSection.CompareSkillGroups(x.SkillGroupObject, y.SkillGroupObject);
                    if (intReturn == 0)
                    {
                        intReturn = SkillsSection.CompareSkills(x, y);
                    }
                    return(intReturn);
                })),
                new Tuple <string, IComparer <Skill> >(LanguageManager.GetString("Skill_SortGroupRating"),
                                                       new SkillSortBySkillGroup()),
                new Tuple <string, IComparer <Skill> >(LanguageManager.GetString("Skill_SortCategory"),
                                                       new SkillSorter((x, y) =>
                {
                    int intReturn = string.Compare(x.CurrentDisplayCategory, y.CurrentDisplayCategory, false, GlobalSettings.CultureInfo);
                    if (intReturn == 0)
                    {
                        intReturn = SkillsSection.CompareSkills(x, y);
                    }
                    return(intReturn);
                }))
            };

            return(ret);
        }
Ejemplo n.º 2
0
        private static List <Tuple <string, IComparer <KnowledgeSkill> > > GenerateKnowledgeSortList()
        {
            List <Tuple <string, IComparer <KnowledgeSkill> > > ret = new List <Tuple <string, IComparer <KnowledgeSkill> > >(7)
            {
                new Tuple <string, IComparer <KnowledgeSkill> >(LanguageManager.GetString("Skill_SortAlphabetical"),
                                                                new KnowledgeSkillSorter(SkillsSection.CompareSkills)),
                new Tuple <string, IComparer <KnowledgeSkill> >(LanguageManager.GetString("Skill_SortRating"),
                                                                new KnowledgeSkillSorter((x, y) =>
                {
                    int intReturn = y.Rating.CompareTo(x.Rating);
                    if (intReturn == 0)
                    {
                        intReturn = SkillsSection.CompareSkills(x, y);
                    }
                    return(intReturn);
                })),
                new Tuple <string, IComparer <KnowledgeSkill> >(LanguageManager.GetString("Skill_SortDicepool"),
                                                                new KnowledgeSkillSorter((x, y) =>
                {
                    int intReturn = y.Pool.CompareTo(x.Pool);
                    if (intReturn == 0)
                    {
                        intReturn = SkillsSection.CompareSkills(x, y);
                    }
                    return(intReturn);
                })),
                new Tuple <string, IComparer <KnowledgeSkill> >(LanguageManager.GetString("Skill_SortLowerDicepool"),
                                                                new KnowledgeSkillSorter((x, y) =>
                {
                    int intReturn = x.Pool.CompareTo(y.Pool);
                    if (intReturn == 0)
                    {
                        intReturn = SkillsSection.CompareSkills(x, y);
                    }
                    return(intReturn);
                })),
                new Tuple <string, IComparer <KnowledgeSkill> >(LanguageManager.GetString("Skill_SortAttributeValue"),
                                                                new KnowledgeSkillSorter((x, y) =>
                {
                    int intReturn = y.AttributeModifiers.CompareTo(x.AttributeModifiers);
                    if (intReturn == 0)
                    {
                        intReturn = string.Compare(x.DisplayAttribute, y.DisplayAttribute, false, GlobalSettings.CultureInfo);
                        if (intReturn == 0)
                        {
                            intReturn = SkillsSection.CompareSkills(x, y);
                        }
                    }
                    return(intReturn);
                })),
                new Tuple <string, IComparer <KnowledgeSkill> >(LanguageManager.GetString("Skill_SortAttributeName"),
                                                                new KnowledgeSkillSorter((x, y) =>
                {
                    int intReturn = string.Compare(x.DisplayAttribute, y.DisplayAttribute, false, GlobalSettings.CultureInfo);
                    if (intReturn == 0)
                    {
                        intReturn = SkillsSection.CompareSkills(x, y);
                    }
                    return(intReturn);
                })),
                new Tuple <string, IComparer <KnowledgeSkill> >(LanguageManager.GetString("Skill_SortCategory"),
                                                                new KnowledgeSkillSorter((x, y) =>
                {
                    int intReturn = string.Compare(x.CurrentDisplayCategory, y.CurrentDisplayCategory, false, GlobalSettings.CultureInfo);
                    if (intReturn == 0)
                    {
                        intReturn = SkillsSection.CompareSkills(x, y);
                    }
                    return(intReturn);
                }))
            };

            return(ret);
        }
Ejemplo n.º 3
0
        private static List <Tuple <string, IComparer <Skill> > > GenerateSortList()
        {
            List <Tuple <string, IComparer <Skill> > > ret = new List <Tuple <string, IComparer <Skill> > >(9)
            {
                new Tuple <string, IComparer <Skill> >(LanguageManager.GetString("Skill_SortAlphabetical"),
                                                       new SkillSorter(SkillsSection.CompareSkills)),
                new Tuple <string, IComparer <Skill> >(LanguageManager.GetString("Skill_SortRating"),
                                                       new SkillSorter((x, y) =>
                {
                    int intReturn = y.Rating.CompareTo(x.Rating);
                    if (intReturn == 0)
                    {
                        intReturn = SkillsSection.CompareSkills(x, y);
                    }
                    return(intReturn);
                })),
                new Tuple <string, IComparer <Skill> >(LanguageManager.GetString("Skill_SortDicepool"),
                                                       new SkillSorter((x, y) =>
                {
                    int intReturn = y.Pool.CompareTo(x.Pool);
                    if (intReturn == 0)
                    {
                        intReturn = SkillsSection.CompareSkills(x, y);
                    }
                    return(intReturn);
                })),
                new Tuple <string, IComparer <Skill> >(LanguageManager.GetString("Skill_SortLowerDicepool"),
                                                       new SkillSorter((x, y) =>
                {
                    int intReturn = x.Pool.CompareTo(y.Pool);
                    if (intReturn == 0)
                    {
                        intReturn = SkillsSection.CompareSkills(x, y);
                    }
                    return(intReturn);
                })),
                new Tuple <string, IComparer <Skill> >(LanguageManager.GetString("Skill_SortAttributeValue"),
                                                       new SkillSorter((x, y) =>
                {
                    int intReturn = y.AttributeModifiers.CompareTo(x.AttributeModifiers);
                    if (intReturn == 0)
                    {
                        intReturn = string.Compare(x.DisplayAttribute, y.DisplayAttribute, false, GlobalOptions.CultureInfo);
                        if (intReturn == 0)
                        {
                            intReturn = SkillsSection.CompareSkills(x, y);
                        }
                    }
                    return(intReturn);
                })),
                new Tuple <string, IComparer <Skill> >(LanguageManager.GetString("Skill_SortAttributeName"),
                                                       new SkillSorter((x, y) =>
                {
                    int intReturn = string.Compare(x.DisplayAttribute, y.DisplayAttribute, false, GlobalOptions.CultureInfo);
                    if (intReturn == 0)
                    {
                        intReturn = SkillsSection.CompareSkills(x, y);
                    }
                    return(intReturn);
                })),
                new Tuple <string, IComparer <Skill> >(LanguageManager.GetString("Skill_SortGroupName"),
                                                       new SkillSorter((x, y) =>
                {
                    int intReturn = SkillsSection.CompareSkillGroups(x.SkillGroupObject, y.SkillGroupObject);
                    if (intReturn == 0)
                    {
                        intReturn = SkillsSection.CompareSkills(x, y);
                    }
                    return(intReturn);
                })),
                new Tuple <string, IComparer <Skill> >(LanguageManager.GetString("Skill_SortGroupRating"),
                                                       new SkillSortBySkillGroup()),
                new Tuple <string, IComparer <Skill> >(LanguageManager.GetString("Skill_SortCategory"),
                                                       new SkillSorter((x, y) =>
                {
                    int intReturn = string.Compare(x.DisplayCategory(GlobalOptions.Language), y.DisplayCategory(GlobalOptions.Language), false, GlobalOptions.CultureInfo);
                    if (intReturn == 0)
                    {
                        intReturn = SkillsSection.CompareSkills(x, y);
                    }
                    return(intReturn);
                })),
            };

            return(ret);
        }