Exemplo n.º 1
0
        private void BuildList()
        {
            if (List != null)
            {
                ColUtility.Free(List);
            }

            switch (Profile.SortFilter)
            {
            default:
            case SortFilter.None:
                List = AchievementSystem.GetAchievements(Profile, Profile.FilterType, true).ToList();
                break;

            case SortFilter.NotAchieved:
                List = AchievementSystem.GetAchievements(Profile, Profile.FilterType, true).Where(a => !Profile.HasAchieved(a)).ToList();
                break;

            case SortFilter.Achieved:
                List = AchievementSystem.GetAchievements(Profile, Profile.FilterType, true).Where(a => Profile.HasAchieved(a)).ToList();
                break;

            case SortFilter.Locked:
                List = AchievementSystem.GetAchievements(Profile, Profile.FilterType, true).Where(a => a.Locked && !Profile.HasUnlocked(a)).ToList();
                break;

            case SortFilter.Unlocked:
                List = AchievementSystem.GetAchievements(Profile, Profile.FilterType, true).Where(a => a.Locked && Profile.HasUnlocked(a)).ToList();
                break;

            case SortFilter.Ascending:
                List = AchievementSystem.GetAchievements(Profile, Profile.FilterType, true).OrderBy(a => a.Name.Number > 0 ? VendorSearch.StringList.GetString(a.Name.Number) : a.Name.ToString()).ToList();
                break;

            case SortFilter.Descending:
                List = AchievementSystem.GetAchievements(Profile, Profile.FilterType, true).OrderByDescending(a => a.Name.Number > 0 ? VendorSearch.StringList.GetString(a.Name.Number) : a.Name.ToString()).ToList();
                break;
            }
        }
Exemplo n.º 2
0
        private void BuildSummary()
        {
            bool ec = User.NetState != null && User.NetState.IsEnhancedClient;

            AddHtml(182, 64, 470, 20, ColorAndCenter(ec ? "#FFFFFF" : "yellow", "Recent Achievements"), false, false);

            int count = 4;
            int y     = 80;

            foreach (var achievement in AchievementSystem.GetAchievements(User, AchievementType.All, true).Where(a => Profile.HasAchieved(a)).OrderByDescending(a => Profile.AchievedTime(a)))
            {
                AddBackground(190, y, 459, 60, 1579);
                AddHtmlLocalized(190, y + 5, 459, 20, CenterLoc, achievement.Name.ToString(), C32216(0x444444), false, false);
                AddImageTiled(260, y + 26, 300, 2, 96);
                AddHtmlLocalized(260, y + 31, 305, 40, CenterLoc, achievement.Description.ToString(), C32216(0x2A2A2A), false, false);

                AddHtml(527, y + 7, 100, 20, ColorAndAlignRight("#444444", Profile.AchievedTime(achievement).ToShortDateString()), false, false);
                AddHtml(527, y + 28, 100, 20, ColorAndAlignRight("#444444", String.Format("{0} Points", achievement.Points.ToString())), false, false);

                if (achievement.GumpImage > 0)
                {
                    AddImage(198 + achievement.GumpImageOffset.X, y + achievement.GumpImageOffset.Y, achievement.GumpImage);
                }

                if (--count == 0)
                {
                    break;
                }

                y += 60;
            }

            AddHtml(182, 328, 470, 20, ColorAndCenter("yellow", "Progress Overview"), false, false);

            int has   = Profile.GetTotalAchieved(AchievementType.All);
            int total = AchievementSystem.Achievements.Count;

            AddImage(282, 350, 0x477);
            BuildProgressBar(Profile.GetTotalAchieved(AchievementType.All), AchievementSystem.Achievements.Count, 250, 293, 356, 30584, false);
            AddLabel(294, 353, 51, "Achievements Earned");
            AddHtml(293, 353, 252, 20, ColorAndAlignRight("#FFFFFF", String.Format("{0}/{1}", has, total)), false, false);

            y = 390;
            int index = 0;

            foreach (var i in Enum.GetValues(typeof(AchievementType)))
            {
                var type = (AchievementType)i;
                int x    = index % 2 == 0 ? 215 : 434;

                if (type == AchievementType.All)
                {
                    continue;
                }

                has   = Profile.GetTotalAchieved(type);
                total = AchievementSystem.Achievements.Values.Where(a => a.Type == type).Count();

                AddImage(x, y, 2446);
                BuildProgressBar(Profile.GetTotalAchieved(type), AchievementSystem.Achievements.Values.Where(a => a.Type == type).Count(), 162, x + 8, y + 5, 30584, false);
                AddLabel(x + 10, y + 2, 51, AchievementSystem.TypeToString(type));
                AddHtml(x, y + 3, 170, 20, ColorAndAlignRight("#FFFFFF", String.Format("{0}/{1}", has, total)), false, false);

                if (index > 0 && index % 2 != 0)
                {
                    y += 40;
                }

                index++;
            }
        }
Exemplo n.º 3
0
 public int GetTotalAchieved(AchievementType type)
 {
     return(AchievementSystem.GetAchievements(this, type, true).Where(a => HasAchieved(a)).Count());
 }