Esempio n. 1
0
        public void GeneratePageDetails(string _PVPSection, int _CharCount, string _PageExplanation = "Page explanation will be here.")
        {
            m_BreadCrumbHTML = new MvcHtmlString(PageUtility.BreadCrumb_AddHome()
                                                 + PageUtility.BreadCrumb_AddRealm(RealmControl.Realm)
                                                 + PageUtility.BreadCrumb_AddFinish(_PVPSection));

            string charListInfo
                = "<h1>" + _PVPSection /*+ "<span class='badge badge-inverse'>" + _CharCount + " Characters</span>"*/
                  + "</h1><p>" + _PageExplanation + "</p>";

            m_CharListInfoHTML = new MvcHtmlString(charListInfo);
        }
Esempio n. 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string        bossName        = BossesControl.GetBossFilterType();
            string        instanceName    = BossesControl.GetBossFilterType();
            List <string> bosses          = BossesControl.GetBossFilter();
            string        andPlayer       = PageUtility.GetQueryString(Request, "AndPlayer", null);
            int           showPlayerCount = PageUtility.GetQueryInt(Request, "Count", 100);

            if (showPlayerCount > 200)
            {
                showPlayerCount = 200;
            }

            this.Title = "Rankings | RaidStats";

            List <PlayerClass>   classLimits   = ClassControl.GetClassLimits();// FightOverallOverview.GetClassLimits(PageUtility.GetQueryString(Request, "ClassLimit", "WrIWaIWlIMaIPrIShIRoIPaIDrIHu"));
            List <PlayerFaction> factionLimits = ClassControl.GetFactionLimits();
            bool showMultipleEntries           = PageUtility.GetQueryString(Request, "MultipleEntries", "false").ToLower() != "false";

            var realm = RealmControl.Realm;

            string guildLimit = PageUtility.GetQueryString(Request, "Guild", null);

            List <VF_RDDatabase.BossFight> fightInstances = new List <VF_RDDatabase.BossFight>();

            DateTime earliestCompatibleDate = new DateTime(2013, 10, 23, 0, 0, 0);
            //var raidCollection = ApplicationInstance.Instance.GetRaidCollection();

            List <Tuple <PlayerData, AverageStats> > dataset = GenerateAverageDataSet(bosses, classLimits, factionLimits, realm, guildLimit);

            if (dataset == null)
            {
                return;
            }

            string infoText         = "";
            string breadCrumbCommon = "";

            if (guildLimit != null)
            {
                string colorClasses = ClassControl.GetColorClassesStr();

                infoText         = "<h1>Average Performance for players in " + guildLimit + " vs " + bossName + "</h1>";
                breadCrumbCommon = PageUtility.BreadCrumb_AddHome()
                                   + PageUtility.BreadCrumb_AddRealm(realm)
                                   + PageUtility.BreadCrumb_AddGuildRaidList(guildLimit);
            }
            else
            {
                string vsText = bossName;
                if (vsText == "Specific Bosses")
                {
                    vsText = "<span title='" + bosses.MergeToStringVF(" & ") + "'>" + bossName + "</span>";
                }
                infoText         = "<h1>Average Performance for players vs " + vsText + "</h1>";
                breadCrumbCommon = PageUtility.BreadCrumb_AddHome()
                                   + PageUtility.BreadCrumb_AddRealm(realm);
            }

            if (ClassControl.HasClassLimits() == true)
            {
                string colorClasses = ClassControl.GetColorClassesStr();
                string breadCrumb   = breadCrumbCommon + PageUtility.BreadCrumb_AddThisPageWithout("Average Performance vs " + bossName, Request, "ClassLimit");

                if (ClassControl.HasFactionLimits() == true)
                {
                    breadCrumb += PageUtility.BreadCrumb_AddFinish("for " + colorClasses);
                    breadCrumb += PageUtility.BreadCrumb_AddFinish(ClassControl.GetColorFactionStr());
                }
                else
                {
                    breadCrumb += PageUtility.BreadCrumb_AddFinish("for " + colorClasses);
                }
                m_BreadCrumbHTML = new MvcHtmlString(breadCrumb);
            }
            else
            {
                if (ClassControl.HasFactionLimits() == true)
                {
                    m_BreadCrumbHTML = new MvcHtmlString(breadCrumbCommon
                                                         + PageUtility.BreadCrumb_AddThisPageWithout("Average Performance vs " + bossName, Request, "FactionLimit")
                                                         + PageUtility.BreadCrumb_AddFinish(ClassControl.GetColorFactionStr()));
                }
                else
                {
                    m_BreadCrumbHTML = new MvcHtmlString(breadCrumbCommon
                                                         + PageUtility.BreadCrumb_AddFinish("Average Performance vs " + bossName));
                }
            }

            infoText += "<p>Average Performance is calculated by taking all the boss fight averages from the following bosses: <br/><font color=#fff>" + bosses.MergeToStringVF(", ") + "</font></p>";
            infoText += "<p>Boss fight average is calculated by taking the 5 best performing(for the player) encounters out of the last 6 attended.</p>";
            infoText += "<p>If there are less than 3 encounters for the player in the database or the last attended encounter was more than 1 month ago, the player will not be included in the list.</p>";

            m_InfoTextHTML = new MvcHtmlString(infoText);

            if (dataset.Count == 0)
            {
                return;
            }

            string graphSection = "<style>" + PageUtility.CreateStatsBars_HTML_CSSCode() + "</style>";

            PageUtility.StatsBarStyle statsBarStyle = new PageUtility.StatsBarStyle
            {
                m_TitleText          = "Average DPS",
                m_BarTextColor       = "#000",
                m_LeftSideTitleText  = "#",
                m_RightSideTitleText = "",
                m_BeforeBarWidth     = 30,
                m_MaxWidth           = 400,
                m_AfterBarWidth      = 0
            };
            {
                int maxCount = showPlayerCount;

                var   orderedByDPS = dataset.OrderByDescending((_Value) => _Value.Item2.m_DPS);
                float highestDPS   = orderedByDPS.First().Item2.m_DPS;
                int   players      = 0;
                List <PageUtility.StatsBarData> dpsStatsBars = new List <PageUtility.StatsBarData>();
                foreach (var data in orderedByDPS)
                {
                    if (++players > maxCount || data.Item2.m_DPS < 1)
                    {
                        if (andPlayer == null)
                        {
                            break;
                        }
                        else if (data.Item1.Name != andPlayer)
                        {
                            continue;
                        }
                    }
                    float  averageDPS        = data.Item2.m_DPS;
                    double displayPercentage = averageDPS / highestDPS;
                    string rightSideText     = averageDPS.ToStringDot("0.0") + "/s";
                    dpsStatsBars.Add(new PageUtility.StatsBarData
                    {
                        m_BeforeBarText   = "#" + players,
                        m_OnBarLeftText   = PageUtility.CreateLink_RaidStats_Player(data.Item1),
                        m_BarColor        = PageUtility.GetClassColor(data.Item1),
                        m_PercentageWidth = displayPercentage,
                        m_AfterBarText    = "",
                        //m_BarTextColor = "#000",
                        m_OnBarRightText = rightSideText,
                        m_OnBarTextWidth = StaticValues.MeasureStringLength(data.Item1.Name + " " + rightSideText)
                    });
                }
                var   orderedByHPS = dataset.OrderByDescending((_Value) => _Value.Item2.m_HPS);
                float highestHPS   = orderedByHPS.First().Item2.m_HPS;
                players = 0;
                List <PageUtility.StatsBarData> hpsStatsBars = new List <PageUtility.StatsBarData>();
                foreach (var data in orderedByHPS)
                {
                    if (++players > maxCount || data.Item2.m_HPS < 1)
                    {
                        if (andPlayer == null)
                        {
                            break;
                        }
                        else if (data.Item1.Name != andPlayer)
                        {
                            continue;
                        }
                    }
                    float  averageHPS        = data.Item2.m_HPS;
                    double displayPercentage = averageHPS / highestHPS;

                    string rightSideText = averageHPS.ToStringDot("0.0") + "/s";
                    hpsStatsBars.Add(new PageUtility.StatsBarData
                    {
                        m_BeforeBarText   = "#" + players,
                        m_OnBarLeftText   = PageUtility.CreateLink_RaidStats_Player(data.Item1),
                        m_BarColor        = PageUtility.GetClassColor(data.Item1),
                        m_PercentageWidth = displayPercentage,
                        m_AfterBarText    = "",
                        //m_BarTextColor = "#000",
                        m_OnBarRightText = rightSideText,
                        m_OnBarTextWidth = StaticValues.MeasureStringLength(data.Item1.Name + " " + rightSideText)
                    });
                }

                while (dpsStatsBars.Count > hpsStatsBars.Count)
                {
                    hpsStatsBars.Add(new PageUtility.StatsBarData
                    {
                        m_AfterBarText    = "",
                        m_BarColor        = "#CCCCCC",
                        m_BeforeBarText   = "",
                        m_OnBarLeftText   = "",
                        m_OnBarRightText  = "",
                        m_PercentageWidth = 0.0,
                    });
                }
                while (hpsStatsBars.Count > dpsStatsBars.Count)
                {
                    dpsStatsBars.Add(new PageUtility.StatsBarData
                    {
                        m_AfterBarText    = "",
                        m_BarColor        = "#CCCCCC",
                        m_BeforeBarText   = "",
                        m_OnBarLeftText   = "",
                        m_OnBarRightText  = "",
                        m_PercentageWidth = 0.0,
                    });
                }
                statsBarStyle.m_TitleText = "Average DPS vs " + bossName;
                graphSection += PageUtility.CreateStatsBars_HTML(statsBarStyle, dpsStatsBars, 50, 1);
                graphSection += "&nbsp;&nbsp;&nbsp;&nbsp;";
                statsBarStyle.m_TitleText = "Average Effective HPS vs " + bossName;
                graphSection += PageUtility.CreateStatsBars_HTML(statsBarStyle, hpsStatsBars, 50, 1);
            }

            m_GraphSection = new MvcHtmlString(graphSection);
        }
Esempio n. 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            var realm = PageUtility.GetQueryRealm(Request);

            if (realm == WowRealm.Unknown)
            {
                return;
            }
            var wowVersion = StaticValues.GetWowVersion(realm);

            var onlinePlayersDB = DatabaseAccess.GetRealmOnlinePlayers(this, realm);

            this.Title = "OnlineStats @ " + StaticValues.ConvertRealmParam(realm) + " | RealmPlayers";

            m_BreadCrumbHTML = new MvcHtmlString(PageUtility.BreadCrumb_AddHome()
                                                 + PageUtility.BreadCrumb_AddRealm(realm)
                                                 + PageUtility.BreadCrumb_AddFinish("OnlineStats"));

            m_PageInfoHTML = new MvcHtmlString("<h1>OnlineStats"
                                               + "</h1><p>OnlineStats for realm " + StaticValues.ConvertRealmViewing(realm) + "</p>"
                                               + "<p>" + onlinePlayersDB.OnlineEntries.Count + " nr of onlinestats entries!</p>");

            string graphSection = "";

            {
                List <int>    dataX  = new List <int>();
                List <int>    dataY1 = new List <int>();
                List <int>    dataY2 = new List <int>();
                List <int>    dataY3 = new List <int>();
                List <int>    dataY4 = new List <int>();
                List <int>    dataY5 = new List <int>();
                List <string> labels = new List <string>();

                DateTime currOnlineDateTime = DateTime.UtcNow.AddDays(-14);
                currOnlineDateTime = currOnlineDateTime.AddMinutes(-currOnlineDateTime.Minute).AddSeconds(-currOnlineDateTime.Second).AddHours(1);
                //Remove minute and second significants

                int day = 0;

                HashSet <string> onlinePlayers            = new HashSet <string>();
                HashSet <string> playersInRaidAndDungeons = new HashSet <string>();
                HashSet <string> playersInBattlegrounds   = new HashSet <string>();
                HashSet <string> playersAtLvl60           = new HashSet <string>();

                Action addGraphEntry = () =>
                {
                    labels.Add(currOnlineDateTime.ToDateStr() + "<br />Players online: " + PageUtility.CreateColorString(onlinePlayers.Count.ToString(), System.Drawing.Color.Green)
                               + "<br />Players in Raids/Dungeons: " + PageUtility.CreateColorString(playersInRaidAndDungeons.Count.ToString()
                                                                                                     + (onlinePlayers.Count != 0 ? " ( " + (((double)playersInRaidAndDungeons.Count / (double)onlinePlayers.Count) * 100).ToStringDot("0.0") + "% )" : ""), System.Drawing.Color.Yellow)
                               + "<br />Players in Battlegrounds: " + PageUtility.CreateColorString(playersInBattlegrounds.Count.ToString()
                                                                                                    + (onlinePlayers.Count != 0 ? " ( " + (((double)playersInBattlegrounds.Count / (double)onlinePlayers.Count) * 100).ToStringDot("0.0") + "% )" : ""), System.Drawing.Color.Red)
                               + "<br />Players below lvl 60: " + PageUtility.CreateColorString((onlinePlayers.Count - playersAtLvl60.Count).ToString()
                                                                                                + (onlinePlayers.Count != 0 ? " ( " + (((double)(onlinePlayers.Count - playersAtLvl60.Count) / (double)onlinePlayers.Count) * 100).ToStringDot("0.0") + "% )" : ""), System.Drawing.Color.Cyan)
                               + "<br />Players at lvl 60: " + PageUtility.CreateColorString(playersAtLvl60.Count.ToString()
                                                                                             + (onlinePlayers.Count != 0 ? " ( " + (((double)playersAtLvl60.Count / (double)onlinePlayers.Count) * 100).ToStringDot("0.0") + "% )" : ""), System.Drawing.Color.Purple));
                    dataX.Add(++day);
                    dataY1.Add(onlinePlayers.Count);
                    dataY2.Add(playersInRaidAndDungeons.Count);
                    dataY3.Add(playersInBattlegrounds.Count);
                    dataY4.Add(playersAtLvl60.Count);
                    dataY5.Add(onlinePlayers.Count - playersAtLvl60.Count);
                    onlinePlayers.Clear();
                    playersInRaidAndDungeons.Clear();
                    playersInBattlegrounds.Clear();
                    playersAtLvl60.Clear();
                };
                foreach (var onlineEntry in onlinePlayersDB.OnlineEntries)
                {
                    if (onlineEntry.DateTime_EndSpan < currOnlineDateTime)
                    {
                        continue;
                    }

                    while (currOnlineDateTime <= onlineEntry.DateTime_StartSpan.AddHours(-8))
                    {
                        addGraphEntry();
                        currOnlineDateTime = currOnlineDateTime.AddHours(8);
                    }

                    foreach (var entry in onlineEntry.OnlinePlayers)
                    {
                        onlinePlayers.Add(entry.Key);
                        if (StaticValues.IsZoneRaid(entry.Value.Zone) || StaticValues.IsZoneDungeon(entry.Value.Zone))
                        {
                            playersInRaidAndDungeons.Add(entry.Key);
                        }
                        if (StaticValues.IsZoneBattleground(entry.Value.Zone))
                        {
                            playersInBattlegrounds.Add(entry.Key);
                        }
                        if (entry.Value.Level == 60)
                        {
                            playersAtLvl60.Add(entry.Key);
                        }
                    }
                    foreach (var entry in onlineEntry.OnlinePlayers_Duplicates)
                    {
                        if (StaticValues.IsZoneRaid(entry.Zone) || StaticValues.IsZoneDungeon(entry.Zone))
                        {
                            playersInRaidAndDungeons.Add(entry.Name);
                        }
                        if (StaticValues.IsZoneBattleground(entry.Zone))
                        {
                            playersInBattlegrounds.Add(entry.Name);
                        }
                        if (entry.Level == 60)
                        {
                            playersAtLvl60.Add(entry.Name);
                        }
                    }
                }

                addGraphEntry();

                graphSection += "<div class='fame' style='min-width: 1100px; max-width: 1100px'>" + PageUtility.CreateGraph(dataX,
                                                                                                                            new List <Tuple <List <int>, System.Drawing.Color> >
                {
                    new Tuple <List <int>, System.Drawing.Color>(dataY5, System.Drawing.Color.Cyan),
                    new Tuple <List <int>, System.Drawing.Color>(dataY4, System.Drawing.Color.Purple),
                    new Tuple <List <int>, System.Drawing.Color>(dataY3, System.Drawing.Color.Red),
                    new Tuple <List <int>, System.Drawing.Color>(dataY2, System.Drawing.Color.Yellow),
                    new Tuple <List <int>, System.Drawing.Color>(dataY1, System.Drawing.Color.Green)
                },
                                                                                                                            labels
                                                                                                                            , 1100, 400) + "</div>";
            }
            m_BodyHTML = new MvcHtmlString(graphSection);
        }
Esempio n. 4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            int pageNr    = PageUtility.GetQueryInt(Request, "page", 1);
            int pageIndex = pageNr - 1;//Change range from 0 to * instead of 1 to *
            int count     = PageUtility.GetQueryInt(Request, "count", 50);

            if (count > 500)
            {
                count = 500;
            }

            var realm = RealmControl.Realm;

            if (realm == VF_RealmPlayersDatabase.WowRealm.Unknown || realm == VF_RealmPlayersDatabase.WowRealm.All)
            {
                InstanceControl.SetAllMode();
            }
            else if (StaticValues.GetWowVersion(realm, true) == VF_RealmPlayersDatabase.WowVersionEnum.TBC)
            {
                InstanceControl.SetTBCMode();
            }
            else
            {
                InstanceControl.SetVanillaMode();
            }
            string guildStr = PageUtility.GetQueryString(Request, "Guild", null);

            if (guildStr != null)
            {
                this.Title = "Raids for " + guildStr + " | RaidStats";

                m_BreadCrumbHTML = new MvcHtmlString(PageUtility.BreadCrumb_AddHome()
                                                     + PageUtility.BreadCrumb_AddRealm(realm)
                                                     + PageUtility.BreadCrumb_AddFinish(guildStr)
                                                     + PageUtility.BreadCrumb_AddFinish("Raids"));
                m_RaidListInfoHTML = new MvcHtmlString("<h1>Recorded raids for " + guildStr + "</h1><p>Sorted by the time the raid ended</p><p>"
                                                       + PageUtility.CreateLink("InstanceList.aspx?realm=" + RealmPlayersServer.StaticValues.ConvertRealmParam(realm) + "&Guild=" + guildStr, "Instances statistics by guild") + "</p><p>"
                                                       + PageUtility.CreateLink("BossList.aspx?realm=" + RealmPlayersServer.StaticValues.ConvertRealmParam(realm) + "&Guild=" + guildStr, "Bosses statistics by guild") + "</p><p>"
                                                       + (guildStr != "PUG" ? PageUtility.CreateLink(PageUtility.HOSTURL_Armory + "GuildViewer.aspx?realm=" + RealmPlayersServer.StaticValues.ConvertRealmParam(realm) + "&Guild=" + guildStr, "View guild on RealmPlayers(Armory)") : "") + "</p>");
            }
            else
            {
                this.Title = "Raids | RaidStats";

                m_BreadCrumbHTML = new MvcHtmlString(PageUtility.BreadCrumb_AddHome()
                                                     + PageUtility.BreadCrumb_AddRealm(realm) + PageUtility.BreadCrumb_AddFinish("Raids"));
                m_RaidListInfoHTML = new MvcHtmlString("<h1>All recorded raids</h1><p>Sorted by the time the raid ended</p>");
            }
            var raidCollection = ApplicationInstance.Instance.GetRaidCollection();
            var orderedRaids   = raidCollection.m_Raids.OrderByDescending((_Value) => { return(_Value.Value.RaidEndDate); });

            m_TableHeadHTML = new MvcHtmlString(
                PageUtility.CreateTableRow("",
                                           PageUtility.CreateTableColumnHead("#Nr") +
                                           PageUtility.CreateTableColumnHead("Guild") +
                                           PageUtility.CreateTableColumnHead("Raid Instance(ID)") +
                                           PageUtility.CreateTableColumnHead("Start Date") +
                                           PageUtility.CreateTableColumnHead("End Date") +
                                           PageUtility.CreateTableColumnHead("Realm")));

            VF_RaidDamageDatabase.RealmDB realmDB = null;
            var guildSummaryDB = ApplicationInstance.Instance.GetGuildSummaryDatabase();
            int nr             = 0;

            int    i         = orderedRaids.Count();
            string tableBody = "";

            foreach (var raid in orderedRaids)
            {
                if (raid.Value.Realm == VF_RealmPlayersDatabase.WowRealm.Test_Server)
                {
                    continue;//Skip Test_Server
                }
                if (raid.Value.RaidOwnerName == "")
                {
                    continue;//Skip RaidOwnerName == "" because something is obviously wrong!
                }
                if ((realm == VF_RealmPlayersDatabase.WowRealm.All || realm == raid.Value.Realm) &&
                    (guildStr == null || guildStr == raid.Value.RaidOwnerName) &&
                    InstanceControl.IsFiltered(raid.Value.RaidInstance) == true)
                {
                    nr++;
                    if (nr > pageIndex * count && nr <= (pageIndex + 1) * count)
                    {
                        string raidOwnerVisual = raid.Value.RaidOwnerName;
                        var    recordedBy      = raid.Value.GetRecordedByPlayers();
                        if (recordedBy.Count > 0)
                        {
                            VF_RealmPlayersDatabase.PlayerFaction faction = VF_RealmPlayersDatabase.PlayerFaction.Unknown;
                            if (raid.Value.RaidOwnerName != "PUG")
                            {
                                try
                                {
                                    faction = guildSummaryDB.GetGuildSummary(raid.Value.Realm, raid.Value.RaidOwnerName).Faction;
                                }
                                catch (Exception)
                                {}
                            }
                            else
                            {
                                if (realmDB == null || realmDB.Realm != raid.Value.Realm)
                                {
                                    realmDB = ApplicationInstance.Instance.GetRealmDB(raid.Value.Realm);
                                }
                                faction = RealmPlayersServer.StaticValues.GetFaction(realmDB.GetPlayer(recordedBy.First()).Character.Race);
                            }
                            if (faction == VF_RealmPlayersDatabase.PlayerFaction.Horde)
                            {
                                raidOwnerVisual = PageUtility.CreateImage("assets/img/Horde_32.png") + raidOwnerVisual;
                            }
                            else if (faction == VF_RealmPlayersDatabase.PlayerFaction.Alliance)
                            {
                                raidOwnerVisual = PageUtility.CreateImage("assets/img/Alliance_32.png") + raidOwnerVisual;
                            }
                        }
                        tableBody += PageUtility.CreateTableRow("", PageUtility.CreateTableColumn("#" + i) +
                                                                PageUtility.CreateTableColumn(PageUtility.CreateLink("RaidList.aspx?realm=" + RealmPlayersServer.StaticValues.ConvertRealmParam(raid.Value.Realm) + "&Guild=" + raid.Value.RaidOwnerName, raidOwnerVisual)) +
                                                                PageUtility.CreateTableColumn(PageUtility.CreateLink("RaidOverview.aspx?Raid=" + raid.Value.UniqueRaidID, PageUtility.CreateImage(StaticValues._RaidInstanceImages[raid.Value.RaidInstance]) + " " + raid.Value.RaidInstance + "(" + raid.Value.RaidID + ")")) +
                                                                PageUtility.CreateTableColumn(raid.Value.RaidStartDate.ToLocalTime().ToString("yyy-MM-dd HH:mm:ss")) +
                                                                PageUtility.CreateTableColumn(raid.Value.RaidEndDate.ToLocalTime().ToString("yyy-MM-dd HH:mm:ss")) +
                                                                PageUtility.CreateTableColumn(RealmPlayersServer.StaticValues.ConvertRealmViewing(raid.Value.Realm)));
                    }
                    if (nr >= (pageIndex + 1) * count)
                    {
                        break;
                    }
                }
                --i;
            }
            if (nr != 0 && nr <= pageIndex * count)
            {
                pageIndex = (nr - 1) / count;
                Response.Redirect(PageUtility.CreateUrlWithNewQueryValue(Request, "page", (pageIndex + 1).ToString()));
            }
            m_TableBodyHTML = new MvcHtmlString(tableBody);

            m_PaginationHTML = new MvcHtmlString(PageUtility.CreatePagination(Request, pageNr, ((orderedRaids.Count() - 1) / count) + 1));
        }
Esempio n. 5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            int pageNr    = PageUtility.GetQueryInt(Request, "page", 1);
            int pageIndex = pageNr - 1;//Change range from 0 to * instead of 1 to *
            int count     = PageUtility.GetQueryInt(Request, "count", 50);

            if (count > 500)
            {
                count = 500;
            }

            var realm = RealmControl.Realm;

            if (realm == WowRealm.Unknown)
            {
                return;
            }

            this.Title = "Guilds @ " + StaticValues.ConvertRealmParam(realm) + " | RealmPlayers";

            var realmDB = DatabaseAccess.GetRealmPlayers(this, realm, NotLoadedDecision.RedirectAndWait);

            var guildSummaryDB = Hidden.ApplicationInstance.Instance.GetGuildSummaryDatabase();
            //;// DatabaseAccess.GetRealmGuilds(this, realm, NotLoadedDecision.RedirectAndWait).Where((guild) => { return guild.Value.GetTotalPlayers() > 0; })
            var    guildArray = guildSummaryDB.GetGuilds(realm);//.OrderByDescending((guild) => { return guild.Value.Players.Count; });
            string page       = "";
            int    nr         = 0;

            string guildProgressData = "";

            List <Tuple <int, Tuple <VF_RPDatabase.GuildSummary, string> > > progressGuilds = new List <Tuple <int, Tuple <VF_RPDatabase.GuildSummary, string> > >();

            foreach (var guild in guildArray)
            {
                guild.Value.GenerateCache(realmDB);
                if (guild.Value.GetMembers().Count > 0)
                {
                    string thisGuildProgressData   = guild.Value.m_GuildProgressData.Item1;
                    int    progressComparisonValue = guild.Value.m_GuildProgressData.Item2;
                    if (thisGuildProgressData == "" && guild.Value.Stats_GetTotalMaxLevels() >= 25)
                    {
                        try
                        {
                            thisGuildProgressData           = CreateProgressStr(this, guild.Value, realm, out progressComparisonValue);
                            guild.Value.m_GuildProgressData = Tuple.Create(thisGuildProgressData, progressComparisonValue);
                        }
                        catch (Exception ex)
                        {
                            Logger.LogException(ex);
                        }
                    }
                    progressGuilds.Add(Tuple.Create(progressComparisonValue, Tuple.Create(guild.Value, thisGuildProgressData)));
                }
            }
            var orderedProgressGuilds = progressGuilds.OrderByDescending(_Value =>
            {
                UInt64 sortValue = (((UInt64)_Value.Item1) << 32);
                if (sortValue != 0)
                {
                    //sortValue |= (((UInt64)(UInt32)_Value.Item2.Item1.Stats_GetAveragePVPRank()) << 16) | ((UInt64)(UInt32)_Value.Item2.Item1.GetMembers().Count);
                    sortValue |= (((UInt64)(UInt32)_Value.Item2.Item1.Stats_GetAverageMemberHKs()) << 16) | ((UInt64)(UInt32)_Value.Item2.Item1.GetMembers().Count);
                }
                else
                {
                    sortValue |= (UInt64)(UInt32)_Value.Item2.Item1.Stats_GetTotalMaxLevels();
                }
                return(sortValue);
            });

            if (orderedProgressGuilds.Count() > 0)
            {
                if (GuildProgress.GetProgressAQ40(orderedProgressGuilds.First().Item1) == 0) //AQ Content not released
                {
                    guildProgressData += "g_AQReleased = false;";
                }
                else
                {
                    guildProgressData += "g_AQReleased = true;";
                }
                if (GuildProgress.GetProgressNaxx(orderedProgressGuilds.First().Item1) == 0) //Naxx Content not released
                {
                    guildProgressData += "g_NaxxReleased = false;";
                }
                else
                {
                    guildProgressData += "g_NaxxReleased = true;";
                }
            }
            foreach (var guild in orderedProgressGuilds)
            {
                nr++;
                if (nr > pageIndex * count && nr <= (pageIndex + 1) * count)
                {
                    page += PageUtility.CreateGuildRow(nr, guild.Item2.Item1, Table_Columns);
                    guildProgressData += guild.Item2.Item2;
                }
                if (nr >= (pageIndex + 1) * count)
                {
                    break;
                }
            }
            if (nr != 0 && nr <= pageIndex * count)
            {
                pageIndex = (nr - 1) / count;
                Response.Redirect(PageUtility.CreateUrlWithNewQueryValue(Request, "page", (pageIndex + 1).ToString()));
            }
            m_BreadCrumbHTML = new MvcHtmlString(PageUtility.BreadCrumb_AddHome()
                                                 + PageUtility.BreadCrumb_AddRealm(RealmControl.Realm)
                                                 + PageUtility.BreadCrumb_AddFinish("Guilds"));
            m_GuildListInfoHTML = new MvcHtmlString(CreateGuildListInfo(StaticValues.GetWowVersion(RealmControl.Realm), progressGuilds.Count));
            m_TableHeadHTML     = new MvcHtmlString(PageUtility.CreateGuildTableHeaderRow(Table_Columns));
            m_TableBodyHTML     = new MvcHtmlString(page);

            m_PaginationHTML  = new MvcHtmlString(PageUtility.CreatePagination(Request, pageNr, ((guildArray.Count() - 1) / count) + 1));
            m_GuildScriptData = new MvcHtmlString("<script>var guildProgress = new Array();"
                                                  + guildProgressData
                                                  + "</script>");
        }
Esempio n. 6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            int pageNr    = PageUtility.GetQueryInt(Request, "page", 1);
            int pageIndex = pageNr - 1;//Change range from 0 to * instead of 1 to *
            int count     = PageUtility.GetQueryInt(Request, "count", 50);

            if (count > 500)
            {
                count = 500;
            }

            var realm = RealmControl.Realm;

            this.Title = "Raids | RaidStats";

            m_BreadCrumbHTML = new MvcHtmlString(PageUtility.BreadCrumb_AddHome()
                                                 + PageUtility.BreadCrumb_AddRealm(realm) + PageUtility.BreadCrumb_AddFinish("Dungeons"));
            m_DungeonListInfoHTML = new MvcHtmlString("<h1>All recorded dungeons</h1><p>Sorted by the time the dungeon ended</p>");

            var raidCollection  = ApplicationInstance.Instance.GetRaidCollection();
            var orderedDungeons = raidCollection.m_Dungeons.OrderByDescending((_Value) => { return(_Value.Value.m_DungeonEndDate); });

            m_TableHeadHTML = new MvcHtmlString(
                PageUtility.CreateTableRow("",
                                           PageUtility.CreateTableColumnHead("#Nr") +
                                           PageUtility.CreateTableColumnHead("Players") +
                                           PageUtility.CreateTableColumnHead("Dungeon") +
                                           PageUtility.CreateTableColumnHead("Start Date") +
                                           PageUtility.CreateTableColumnHead("End Date") +
                                           PageUtility.CreateTableColumnHead("Realm")));


            int nr = 0;

            int    i         = orderedDungeons.Count();
            string tableBody = "";

            foreach (var dungeon in orderedDungeons)
            {
                if (dungeon.Value.Realm == VF_RealmPlayersDatabase.WowRealm.Test_Server)
                {
                    continue;//Skip Test_Server
                }
                if ((realm == VF_RealmPlayersDatabase.WowRealm.All || realm == dungeon.Value.Realm))
                {
                    nr++;
                    if (nr > pageIndex * count && nr <= (pageIndex + 1) * count)
                    {
                        string dungeonOwnerVisual = "\"" + dungeon.Value.m_GroupMembers.MergeToStringVF("\", \"") + "\"";

                        tableBody += PageUtility.CreateTableRow("", PageUtility.CreateTableColumn("#" + i) +
                                                                PageUtility.CreateTableColumn(dungeonOwnerVisual) +
                                                                PageUtility.CreateTableColumn(PageUtility.CreateLink("DungeonOverview.aspx?Dungeon=" + dungeon.Value.m_UniqueDungeonID, dungeon.Value.m_Dungeon)) +
                                                                PageUtility.CreateTableColumn(dungeon.Value.m_DungeonStartDate.ToLocalTime().ToString("yyy-MM-dd HH:mm:ss")) +
                                                                PageUtility.CreateTableColumn(dungeon.Value.m_DungeonEndDate.ToLocalTime().ToString("yyy-MM-dd HH:mm:ss")) +
                                                                PageUtility.CreateTableColumn(RealmPlayersServer.StaticValues.ConvertRealmViewing(dungeon.Value.Realm)));
                    }
                    if (nr >= (pageIndex + 1) * count)
                    {
                        break;
                    }
                }
                --i;
            }
            if (nr != 0 && nr <= pageIndex * count)
            {
                pageIndex = (nr - 1) / count;
                Response.Redirect(PageUtility.CreateUrlWithNewQueryValue(Request, "page", (pageIndex + 1).ToString()));
            }
            m_TableBodyHTML = new MvcHtmlString(tableBody);

            m_PaginationHTML = new MvcHtmlString(PageUtility.CreatePagination(Request, pageNr, ((orderedDungeons.Count() - 1) / count) + 1));
        }
Esempio n. 7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string               fightName     = PageUtility.GetQueryString(Request, "FightName");
            List <PlayerClass>   classLimits   = ClassControl.GetClassLimits();//PageUtility.GetQueryString(Request, "ClassLimit", "WrIWaIWlIMaIPrIShIRoIPaIDrIHu"));
            List <PlayerFaction> factionLimits = ClassControl.GetFactionLimits();
            bool showMultipleEntries           = PageUtility.GetQueryString(Request, "MultipleEntries", "false").ToLower() != "false";

            string guildLimit       = PageUtility.GetQueryString(Request, "Guild", null);
            string playerLimit      = PageUtility.GetQueryString(Request, "PlayerLimit", null);
            string andPlayer        = PageUtility.GetQueryString(Request, "AndPlayer", null);
            int    showEntriesCount = PageUtility.GetQueryInt(Request, "Count", 50);

            if (showEntriesCount > 100)
            {
                showEntriesCount = 100;
            }

            var realm = RealmControl.Realm;

            var realmDB = ApplicationInstance.Instance.GetRealmDB(VF_RealmPlayersDatabase.WowRealm.Emerald_Dream);
            //var raidCollection = ApplicationInstance.Instance.GetRaidCollection();

            var summaryDatabase = ApplicationInstance.Instance.GetSummaryDatabase();

            if (summaryDatabase == null)
            {
                return;
            }

            if (guildLimit != null)
            {
                this.Title = fightName + " Highscore for " + guildLimit + " | RaidStats";
            }
            else if (playerLimit != null)
            {
                this.Title = fightName + " Highscore for " + playerLimit + " | RaidStats";
            }
            else
            {
                this.Title = fightName + " Highscore | RaidStats";
            }
            IEnumerable <VF_RaidDamageDatabase.Models.PurgedPlayer> purgePlayers = ApplicationInstance.Instance.GetPurgedPlayers(realm);

            var fightInstances = summaryDatabase.GetHSElligibleBossFights(fightName, realm, guildLimit, null, purgePlayers);

            //Remove fights that have too low precision
            if (fightInstances.Count > 0)
            {
                string breadCrumbCommon = "";
                if (guildLimit != null)
                {
                    breadCrumbCommon = PageUtility.BreadCrumb_AddHome()
                                       + PageUtility.BreadCrumb_AddRealm(realm)
                                       + PageUtility.BreadCrumb_AddLink("RaidList.aspx?Guild=" + guildLimit, guildLimit)
                                       + PageUtility.BreadCrumb_AddLink("BossList.aspx?Guild=" + guildLimit, "Bosses");
                }
                else if (playerLimit != null)
                {
                    breadCrumbCommon = PageUtility.BreadCrumb_AddHome()
                                       + PageUtility.BreadCrumb_AddRealm(realm)
                                       + PageUtility.BreadCrumb_AddLink("PlayerOverview.aspx?realm=" + RealmPlayersServer.StaticValues.ConvertRealmParam(realm) + "&player=" + playerLimit, playerLimit)
                                       + PageUtility.BreadCrumb_AddLink("BossList.aspx?realm=" + RealmPlayersServer.StaticValues.ConvertRealmParam(realm) + "&player=" + playerLimit, "Bosses");
                }
                else
                {
                    breadCrumbCommon = PageUtility.BreadCrumb_AddHome()
                                       + PageUtility.BreadCrumb_AddRealm(realm)
                                       + PageUtility.BreadCrumb_AddLink("BossList.aspx", "Bosses");
                }

                if (ClassControl.HasClassLimits() == true)
                {
                    string colorClasses = ClassControl.GetColorClassesStr();
                    string breadCrumb   = breadCrumbCommon + PageUtility.BreadCrumb_AddThisPageWithout(fightName, Request, "ClassLimit");

                    if (ClassControl.HasFactionLimits() == true)
                    {
                        breadCrumb += PageUtility.BreadCrumb_AddFinish("vs " + colorClasses);
                        breadCrumb += PageUtility.BreadCrumb_AddFinish("Only " + ClassControl.GetColorFactionStr());
                    }
                    else
                    {
                        breadCrumb += PageUtility.BreadCrumb_AddFinish("vs " + colorClasses);
                    }
                    m_BreadCrumbHTML = new MvcHtmlString(breadCrumb);
                }
                else
                {
                    if (ClassControl.HasFactionLimits() == true)
                    {
                        m_BreadCrumbHTML = new MvcHtmlString(breadCrumbCommon
                                                             + PageUtility.BreadCrumb_AddThisPageWithout(fightName, Request, "FactionLimit")
                                                             + PageUtility.BreadCrumb_AddFinish("Only " + ClassControl.GetColorFactionStr()));
                    }
                    else
                    {
                        m_BreadCrumbHTML = new MvcHtmlString(breadCrumbCommon
                                                             + PageUtility.BreadCrumb_AddFinish(fightName));
                    }
                }

                string graphSection = "<h1>Highscore for ";
                if (playerLimit != null)
                {
                    graphSection += playerLimit;
                }
                else
                {
                    graphSection += "players";
                }
                graphSection += " vs " + fightName + "</h1><p>Fights with unrealistic dmg spikes(SW_Stats reset bug) are disqualified from this list.</p>";
                //graphSection += "<p>View Highscore for class: ";
                //foreach (var classLimit in ClassLimitConverter)
                //{
                //    graphSection += PageUtility.CreateLink(PageUtility.CreateUrlWithNewQueryValue(Request, "ClassLimit", classLimit.Key), PageUtility.CreateColorCodedName(classLimit.Value.ToString(), classLimit.Value)) + ", ";
                //}
                if (playerLimit != null)
                {
                    showMultipleEntries = true;//Force it to true
                }
                else
                {
                    if (showMultipleEntries == false)
                    {
                        graphSection += "<p>Currently <u>not</u> showing multiple entries per player/guild. <a href='" + PageUtility.CreateUrlWithNewQueryValue(Request, "MultipleEntries", "true") + "'>Click here if you want to show multiple entries per entities</a></p>";
                    }
                    else
                    {
                        graphSection += "<p>Currently showing multiple entries per player/guild. <a href='" + PageUtility.CreateUrlWithNewQueryValue(Request, "MultipleEntries", "false") + "'>Click here if you do not want to show multiple entries per entities</a></p>";
                    }
                }
                //if (showEntriesCount < 50)
                //{
                //    graphSection += "<p>Currently showing " + showEntriesCount + " entries per data table. <a href='" + PageUtility.CreateUrlWithNewQueryValue(Request, "Count", "50") + "'>Click here if you want to show up to 50</a></p>";
                //}
                //else if (showEntriesCount >= 50)
                //{
                //    graphSection += "<p>Currently showing " + showEntriesCount + " entries per data table. <a href='" + PageUtility.CreateUrlWithNewQueryValue(Request, "Count", "25") + "'>Click here if you want to show only 25</a></p>";
                //}

                if (guildLimit != null)
                {
                    graphSection += "<p>Note that this does only show data from the guild " + guildLimit + ".<br />If you want to see for all guilds click " + PageUtility.CreateLink(PageUtility.CreateUrlWithNewQueryValue(Request, "Guild", "null"), "here") + "</p>";
                }
                //graphSection += "</p>";
                m_InfoTextHTML = new MvcHtmlString(graphSection);

                PlayerFaction factionFilter = PlayerFaction.Unknown;
                if (factionLimits != null && factionLimits.Count == 1)
                {
                    factionFilter = factionLimits[0];
                }

                List <string> includePlayers = null;
                if (andPlayer != null)
                {
                    includePlayers = new List <string> {
                        andPlayer
                    };
                }
                m_GraphSection = new MvcHtmlString(VF.FightOverallOverviewGenerator.Generate(fightInstances, ApplicationInstance.Instance.GetRPPDatabase(), new VF.FightOverallOverviewGenerator.GenerateDetails {
                    ClassFilter = classLimits, EntriesCount = showEntriesCount, ShowMultipleEntries = showMultipleEntries, RealmFilter = realm, GuildFilter = guildLimit, PlayerFilter = playerLimit, FactionFilter = factionFilter, IncludePlayers = includePlayers
                }));
            }
        }
Esempio n. 8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            bool showMultipleEntries = PageUtility.GetQueryString(Request, "MultipleEntries", "false").ToLower() != "false";

            int maxCount = PageUtility.GetQueryInt(Request, "Count", 50);

            if (maxCount > 100)
            {
                maxCount = 100;
            }

            string guildLimit = PageUtility.GetQueryString(Request, "Guild", null);

            var realm = RealmControl.Realm;

            string graphSection = "";

            string breadCrumbCommon = "";

            if (guildLimit != null)
            {
                showMultipleEntries = true;
                this.Title          = "Instance records for " + guildLimit + " | RaidStats";

                breadCrumbCommon = PageUtility.BreadCrumb_AddHome()
                                   + PageUtility.BreadCrumb_AddRealm(realm)
                                   + PageUtility.BreadCrumb_AddLink("RaidList.aspx?Guild=" + guildLimit + "&realm=" + StaticValues.ConvertRealmParam(realm), guildLimit);
                //  + PageUtility.BreadCrumb_AddFinish("Instances"));

                m_PageInfoHTML = new MvcHtmlString("<h1>Raid Instances for " + guildLimit + "</h1>"
                                                   + "<p>Fastest instance clears by " + guildLimit + ". Sorted by difficulty.</p>"
                                                   + "<p>Note that this does only show data from the guild " + guildLimit + ".<br />If you want to see for all guilds click " + PageUtility.CreateLink("InstanceList.aspx?realm=" + RealmPlayersServer.StaticValues.ConvertRealmParam(realm), "here") + "</p>");
            }
            else
            {
                if (showMultipleEntries == false)
                {
                    graphSection += "<p>Currently <u>not</u> showing multiple entries per guild. <a href='" + PageUtility.CreateUrlWithNewQueryValue(Request, "MultipleEntries", "true") + "'>Click here if you want to show multiple entries per guild</a></p>";
                }
                else
                {
                    graphSection += "<p>Currently showing multiple entries per guild. <a href='" + PageUtility.CreateUrlWithNewQueryValue(Request, "MultipleEntries", "false") + "'>Click here if you do not want to show multiple entries per guild</a></p>";
                }

                this.Title = "Instance records | RaidStats";

                breadCrumbCommon = PageUtility.BreadCrumb_AddHome()
                                   + PageUtility.BreadCrumb_AddRealm(realm);
                //    + PageUtility.BreadCrumb_AddFinish("Instances"));

                m_PageInfoHTML = new MvcHtmlString("<h1>Raid Instances</h1>"
                                                   + "<p>Fastest instance clears by guilds. Sorted by difficulty.</p>");
            }

            m_BreadCrumbHTML = new MvcHtmlString(breadCrumbCommon
                                                 + PageUtility.BreadCrumb_AddFinish("Instances"));

            graphSection += "<style>" + PageUtility.CreateStatsBars_HTML_CSSCode() + "</style>";

            PageUtility.StatsBarStyle statsBarStyle = new PageUtility.StatsBarStyle
            {
                m_TitleText          = "",
                m_BarTextColor       = "#000",
                m_LeftSideTitleText  = "#",
                m_RightSideTitleText = "",
                m_BeforeBarWidth     = 100,
                m_MaxWidth           = 700,
                m_AfterBarWidth      = 30
            };

            //var raidCollection = ApplicationInstance.Instance.GetRaidCollection();
            var summaryDatabase = ApplicationInstance.Instance.GetSummaryDatabase();

            if (summaryDatabase == null)
            {
                return;
            }

            Dictionary <string, List <RaidInstanceClearData> > raidInstanceClears = new Dictionary <string, List <RaidInstanceClearData> >();

            foreach (var groupRC in summaryDatabase.GroupRCs)
            {
                if (realm != VF_RealmPlayersDatabase.WowRealm.All && realm != groupRC.Value.Realm)
                {
                    continue;
                }

                if (groupRC.Value.Realm == VF_RealmPlayersDatabase.WowRealm.Unknown || groupRC.Value.Realm == VF_RealmPlayersDatabase.WowRealm.Test_Server)
                {
                    continue;
                }

                if (guildLimit != null && guildLimit != groupRC.Value.GroupName)
                {
                    continue;
                }

                foreach (var raid in groupRC.Value.Raids)
                {
                    Dictionary <string, string[]> instanceRuns;
                    if (BossInformation.InstanceRuns.TryGetValue(raid.Value.RaidInstance, out instanceRuns) == false)
                    {
                        continue;
                    }
                    foreach (var instanceRun in instanceRuns)
                    {
                        var instanceClearData = RaidInstanceClearData.Generate(raid, instanceRun.Value);
                        if (instanceClearData != null)
                        {
                            raidInstanceClears.AddToList(instanceRun.Key, instanceClearData);
                        }
                    }
                }
            }
            var orderedInstanceClears = raidInstanceClears.OrderBy((_Value) =>
            {
                if (_Value.Key == "Zul'Gurub")
                {
                    return(0);
                }
                else if (_Value.Key == "Ruins of Ahn'Qiraj")
                {
                    return(10);
                }
                else if (_Value.Key == "Molten Core")
                {
                    return(20);
                }
                else if (_Value.Key == "Blackwing Lair")
                {
                    return(30);
                }
                else if (_Value.Key == "Temple of Ahn'Qiraj")
                {
                    return(40);
                }
                else if (_Value.Key == "Naxxramas - Arachnid Quarter")
                {
                    return(50);
                }
                else if (_Value.Key == "Naxxramas - Construct Quarter")
                {
                    return(60);
                }
                else if (_Value.Key == "Naxxramas - Plague Quarter")
                {
                    return(70);
                }
                else if (_Value.Key == "Naxxramas - Military Quarter")
                {
                    return(80);
                }
                else if (_Value.Key == "Naxxramas - All Quarters")
                {
                    return(85);
                }
                else if (_Value.Key == "Naxxramas")
                {
                    return(90);
                }
                else
                {
                    return(100);
                }
            });

            foreach (var riclears in orderedInstanceClears)
            {
                List <PageUtility.StatsBarData> statsBars = new List <PageUtility.StatsBarData>();

                var orderedClears = riclears.Value.OrderBy((_Value) => { return(_Value.GetTimeSpan()); });

                int    clearNr = 0;
                double firstClearCompareValue = 1 / orderedClears.First().GetTimeSpan().TotalSeconds;

                List <string> ignoreGuilds = new List <string>();
                foreach (var riclear in orderedClears)
                {
                    if (showMultipleEntries == false)
                    {
                        if (ignoreGuilds.Contains(riclear.m_Raid.CacheGroup.GroupName + (int)riclear.m_Raid.CacheGroup.Realm) == true)
                        {
                            continue;
                        }
                        else
                        {
                            ignoreGuilds.Add(riclear.m_Raid.CacheGroup.GroupName + (int)riclear.m_Raid.CacheGroup.Realm);
                        }
                    }

                    if (++clearNr > maxCount)
                    {
                        break;
                    }

                    double compareValue = 1 / riclear.GetTimeSpan().TotalSeconds;
                    string totalTimeStr = "" + (int)riclear.GetTimeSpan().TotalMinutes + " mins";//ser bäst ut

                    /*if (riclear.GetTimeSpan().Days > 0)
                     *  totalTimeStr += riclear.GetTimeSpan().Days + " days ";
                     * if (riclear.GetTimeSpan().Hours > 0)
                     *  totalTimeStr += riclear.GetTimeSpan().Hours + " hours ";
                     * if (riclear.GetTimeSpan().Minutes > 0)
                     *  totalTimeStr += riclear.GetTimeSpan().Minutes + " mins ";
                     * if (riclear.GetTimeSpan().Seconds > 0)
                     *  totalTimeStr += riclear.GetTimeSpan().Seconds + " secs ";*/
                    string factionColor = "#CCCCCC";

                    try
                    {
                        var recordedByPlayer = ApplicationInstance.Instance.GetRealmDB(riclear.m_Raid.CacheGroup.Realm).RD_FindPlayer(riclear.m_Raid.BossFights.Last().PlayerFightData.First().Item1, riclear.m_Raid.m_RaidMembers);
                        var guildFaction     = VF_RealmPlayersDatabase.StaticValues.GetFaction(recordedByPlayer.Character.Race);
                        if (guildFaction == VF_RealmPlayersDatabase.PlayerFaction.Horde)
                        {
                            factionColor = "#A75757";
                        }
                        else if (guildFaction == VF_RealmPlayersDatabase.PlayerFaction.Alliance)
                        {
                            factionColor = "#575fA7";
                        }
                        else
                        {
                            factionColor = "#FFFFFF";
                        }
                    }
                    catch (Exception)
                    {
                        factionColor = "#CCCCCC";
                    }

                    statsBars.Add(new PageUtility.StatsBarData
                    {
                        m_BeforeBarText = "#" + clearNr + " (" + PageUtility.CreateLink("RaidOverview.aspx?Raid="
                                                                                        + riclear.m_Raid.UniqueRaidID
                                                                                        , riclear.m_Raid.RaidStartDate.ToString("yyyy-MM-dd")) + ")",
                        m_OnBarLeftText = PageUtility.CreateLink("RaidList.aspx?realm=" + StaticValues.ConvertRealmParam(riclear.m_Raid.CacheGroup.Realm) + "&Guild=" + riclear.m_Raid.CacheGroup.GroupName, riclear.m_Raid.CacheGroup.GroupName + (realm == VF_RealmPlayersDatabase.WowRealm.All ? " (" + StaticValues.ConvertRealmParam(riclear.m_Raid.CacheGroup.Realm) + ")" : "")),

                        /*PageUtility.CreateLink("http://realmplayers.com/GuildViewer.aspx?realm="
                         + RealmPlayersServer.StaticValues.ConvertRealmParam(riclear.m_Raid.Realm)
                         + "&guild=" + riclear.m_Raid.RaidOwnerName, riclear.m_Raid.RaidOwnerName)*/
                        m_BarColor        = factionColor,
                        m_PercentageWidth = compareValue / firstClearCompareValue,
                        m_AfterBarText    = PageUtility.CreateColorisedFactor(1.0),
                        //m_BarTextColor = "#000",
                        m_OnBarRightText = totalTimeStr,
                        m_OnBarTextWidth = StaticValues.MeasureStringLength(riclear.m_Raid.CacheGroup.GroupName + (realm == VF_RealmPlayersDatabase.WowRealm.All ? StaticValues.ConvertRealmParam(realm) + " ()" : "") + "  " + totalTimeStr)
                    });
                }

                statsBarStyle.m_TitleText = riclears.Key;
                graphSection += PageUtility.CreateStatsBars_HTML(statsBarStyle, statsBars, 25);
            }

            m_GraphsHTML = new MvcHtmlString(graphSection);
        }
Esempio n. 9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string guildLimit  = PageUtility.GetQueryString(Request, "Guild", "null");
            string playerLimit = PageUtility.GetQueryString(Request, "player", "null");

            var realm = RealmControl.Realm;

            string breadCrumbCommon = "";

            if (guildLimit != "null")
            {
                playerLimit = "null";
                this.Title  = "Boss records for " + guildLimit + " | RaidStats";

                breadCrumbCommon = PageUtility.BreadCrumb_AddHome()
                                   + PageUtility.BreadCrumb_AddRealm(realm)
                                   + PageUtility.BreadCrumb_AddLink("RaidList.aspx?Guild=" + guildLimit, guildLimit);

                m_BossListInfoHTML = new MvcHtmlString("<h1>Raid Bosses for " + guildLimit + "</h1>"
                                                       + "<p>Top DPS, HPS and fastest kill times are listed below for the different bosses</p>"
                                                       + "<p>Note that this does only show data from the guild " + guildLimit + ".<br />If you want to see for all guilds click " + PageUtility.CreateLink("BossList.aspx?realm=" + RealmPlayersServer.StaticValues.ConvertRealmParam(realm), "here") + "</p>");
            }
            else if (playerLimit != "null")
            {
                this.Title = "Boss records for " + playerLimit + " | RaidStats";

                breadCrumbCommon = PageUtility.BreadCrumb_AddHome()
                                   + PageUtility.BreadCrumb_AddRealm(realm)
                                   + PageUtility.BreadCrumb_AddLink("PlayerOverview.aspx?realm=" + RealmPlayersServer.StaticValues.ConvertRealmParam(realm) + "&player=" + playerLimit, playerLimit);

                m_BossListInfoHTML = new MvcHtmlString("<h1>Raid Boss records for " + playerLimit + "</h1>"
                                                       + "<p>Top DPS, HPS and fastest kill times are listed below for the different bosses</p>"
                                                       + "<p>Note that this does only show data for player " + playerLimit + ".<br />If you want to see for all players on the realm click " + PageUtility.CreateLink("BossList.aspx?realm=" + RealmPlayersServer.StaticValues.ConvertRealmParam(realm), "here") + "</p>");
            }
            else
            {
                this.Title = "Boss records | RaidStats";

                breadCrumbCommon = PageUtility.BreadCrumb_AddHome()
                                   + PageUtility.BreadCrumb_AddRealm(realm);

                m_BossListInfoHTML = new MvcHtmlString("<h1>Raid Bosses</h1>"
                                                       + "<p>Top DPS, HPS and fastest kill times are listed below for the different bosses</p>");
            }

            if (ClassControl.HasClassLimits() == true)
            {
                string colorClasses = ClassControl.GetColorClassesStr();
                string breadCrumb   = breadCrumbCommon + PageUtility.BreadCrumb_AddThisPageWithout("Bosses", Request, "ClassLimit");

                if (ClassControl.HasFactionLimits() == true)
                {
                    breadCrumb += PageUtility.BreadCrumb_AddFinish("vs " + colorClasses);
                    breadCrumb += PageUtility.BreadCrumb_AddFinish("Only " + ClassControl.GetColorFactionStr());
                }
                else
                {
                    breadCrumb += PageUtility.BreadCrumb_AddFinish("vs " + colorClasses);
                }
                m_BreadCrumbHTML = new MvcHtmlString(breadCrumb);
            }
            else
            {
                if (ClassControl.HasFactionLimits() == true)
                {
                    m_BreadCrumbHTML = new MvcHtmlString(breadCrumbCommon
                                                         + PageUtility.BreadCrumb_AddThisPageWithout("Bosses", Request, "FactionLimit")
                                                         + PageUtility.BreadCrumb_AddFinish("Only " + ClassControl.GetColorFactionStr()));
                }
                else
                {
                    m_BreadCrumbHTML = new MvcHtmlString(breadCrumbCommon
                                                         + PageUtility.BreadCrumb_AddFinish("Bosses"));
                }
            }

            m_TableHeadHTML = new MvcHtmlString(
                PageUtility.CreateTableRow("",
                                           PageUtility.CreateTableColumnHead("Instance") +
                                           PageUtility.CreateTableColumnHead("Boss") +
                                           PageUtility.CreateTableColumnHead("Top DPS") +
                                           PageUtility.CreateTableColumnHead("Top HPS") +
                                           PageUtility.CreateTableColumnHead("Fastest Kill") +
                                           PageUtility.CreateTableColumnHead("Kill Count")));

            DateTime earliestCompatibleDate = new DateTime(2013, 10, 23, 0, 0, 0);
            var      realmDB = ApplicationInstance.Instance.GetRealmDB(VF_RealmPlayersDatabase.WowRealm.Emerald_Dream);
            //var raidCollection = ApplicationInstance.Instance.GetRaidCollection();

            var summaryDatabase = ApplicationInstance.Instance.GetSummaryDatabase();

            if (summaryDatabase == null)
            {
                return;
            }

            IEnumerable <VF_RaidDamageDatabase.Models.PurgedPlayer> purgePlayers = ApplicationInstance.Instance.GetPurgedPlayers(realm);

            var classLimits   = ClassControl.GetClassLimits();
            var factionLimits = ClassControl.GetFactionLimits();

            string tableBody = "";

            foreach (var boss in BossInformation.BossFights)
            {
                var bossFights = summaryDatabase.GetHSElligibleBossFights(boss.Key, realm, guildLimit == "null" ? null : guildLimit, playerLimit == "null" ? null : playerLimit, purgePlayers);
                if (bossFights.Count > 0)
                {
                    //averagePrecision /= bossFights.Count;
                    Tuple <string, int>    fastestKill = new Tuple <string, int>("", int.MaxValue);
                    Tuple <string, double> topDPS      = new Tuple <string, double>("", 0.0);
                    Tuple <string, double> topHPS      = new Tuple <string, double>("", 0.0);
                    foreach (var fight in bossFights)
                    {
                        if (realmDB.Realm != fight.CacheRaid.CacheGroup.Realm)
                        {
                            realmDB = ApplicationInstance.Instance.GetRealmDB(fight.CacheRaid.CacheGroup.Realm);
                        }
                        //if (fight.DataDetails.FightPrecision < averagePrecision - 0.05)
                        //    continue;
                        if (fight.FightDuration < fastestKill.Item2)
                        {
                            fastestKill = new Tuple <string, int>(
                                PageUtility.CreateLink("FightOverview.aspx?Raid=" + fight.CacheRaid.UniqueRaidID
                                                       + "&Fight=" + fight.StartDateTime.ToString("ddHHmmss"), fight.FightDuration.ToString() + " seconds")
                                , fight.FightDuration);
                        }

                        var unitsData = fight.PlayerFightData;//.GetFilteredPlayerUnitsData(true, realmDB.RD_GetPlayerIdentifier);
                        Tuple <string, int> topDmg  = new Tuple <string, int>("", 0);
                        Tuple <string, int> topHeal = new Tuple <string, int>("", 0);
                        foreach (var unit in unitsData)
                        {
                            if (unit.Item2.Damage > topDmg.Item2)
                            {
                                var playerName = unit.Item1;
                                if (playerName == "Unknown")
                                {
                                    continue;
                                }
                                if (playerLimit != "null" && playerLimit != playerName)
                                {
                                    continue;
                                }
                                if (BossInformation.BossFights.ContainsKey(playerName) == true)
                                {
                                    continue;
                                }

                                var playerData = realmDB.RD_FindPlayer(playerName, fight);
                                if (playerData != null && (classLimits == null || classLimits.Contains(playerData.Character.Class)) &&
                                    (factionLimits == null || factionLimits.Contains(StaticValues.GetFaction(playerData.Character.Race))))
                                {
                                    topDmg = new Tuple <string, int>(unit.Item1, unit.Item2.Damage);
                                }
                            }
                            if (unit.Item2.EffectiveHeal > topHeal.Item2)
                            {
                                var playerName = unit.Item1;
                                if (playerName == "Unknown")
                                {
                                    continue;
                                }
                                if (playerLimit != "null" && playerLimit != playerName)
                                {
                                    continue;
                                }
                                if (BossInformation.BossFights.ContainsKey(playerName) == true)
                                {
                                    continue;
                                }

                                var playerData = realmDB.RD_FindPlayer(playerName, fight);
                                if (playerData != null && (classLimits == null || classLimits.Contains(playerData.Character.Class)) &&
                                    (factionLimits == null || factionLimits.Contains(StaticValues.GetFaction(playerData.Character.Race))))
                                {
                                    topHeal = new Tuple <string, int>(unit.Item1, unit.Item2.EffectiveHeal);
                                }
                            }
                        }
                        double topThisDPS = (double)topDmg.Item2 / (double)fight.FightDuration;
                        double topThisHPS = (double)topHeal.Item2 / (double)fight.FightDuration;
                        if (topThisDPS > topDPS.Item2)
                        {
                            topDPS = new Tuple <string, double>(PageUtility.CreateLink_RaidStats_Player(topDmg.Item1, realmDB.Realm
                                                                                                        , PageUtility.CreateColorCodedName(topDmg.Item1, realmDB.GetPlayer(topDmg.Item1).Character.Class))
                                                                + "(" + PageUtility.CreateLink("FightOverview.aspx?Raid=" + fight.CacheRaid.UniqueRaidID
                                                                                               + "&Fight=" + fight.StartDateTime.ToString("ddHHmmss")
                                                                                               , topThisDPS.ToStringDot("0.0")) + ")", topThisDPS);
                        }
                        if (topThisHPS > topHPS.Item2)
                        {
                            topHPS = new Tuple <string, double>(PageUtility.CreateLink_RaidStats_Player(topHeal.Item1, realmDB.Realm
                                                                                                        , PageUtility.CreateColorCodedName(topHeal.Item1, realmDB.GetPlayer(topHeal.Item1).Character.Class))
                                                                + "(" + PageUtility.CreateLink("FightOverview.aspx?Raid=" + fight.CacheRaid.UniqueRaidID
                                                                                               + "&Fight=" + fight.StartDateTime.ToString("ddHHmmss")
                                                                                               , topThisHPS.ToStringDot("0.0")) + ")", topThisHPS);
                        }
                    }
                    int killCount = bossFights.Count((_Value) => { return(_Value.AttemptType == VF_RDDatabase.AttemptType.KillAttempt); });

                    tableBody += PageUtility.CreateTableRow("", PageUtility.CreateTableColumn(PageUtility.CreateImage(StaticValues._RaidInstanceImages[boss.Value]) + boss.Value) +
                                                            PageUtility.CreateTableColumn(PageUtility.CreateLink("FightOverallOverview.aspx?FightName=" + boss.Key + (guildLimit != "null" ? "&Guild=" + guildLimit : "") + (playerLimit != "null" ? "&realm=" + StaticValues.ConvertRealmParam(realm) + "&PlayerLimit=" + playerLimit : ""), boss.Key)) +
                                                            PageUtility.CreateTableColumn(topDPS.Item1) +
                                                            PageUtility.CreateTableColumn(topHPS.Item1) +
                                                            PageUtility.CreateTableColumn(fastestKill.Item1) +
                                                            PageUtility.CreateTableColumn(killCount.ToString()));
                }
            }
            m_TableBodyHTML = new MvcHtmlString(tableBody);
        }
Esempio n. 10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string pageView = RealmPlayersServer.PageUtility.GetQueryString(Request, "view", "players");
            var    realm    = PageUtility.GetQueryRealm(Request);

            if (realm == WowRealm.Unknown)
            {
                return;
            }
            var wowVersion = StaticValues.GetWowVersion(realm);

            string guildStr = PageUtility.GetQueryString(Request, "guild");

            var realmDB        = DatabaseAccess.GetRealmPlayers(this, realm);
            var guildSummaryDB = Hidden.ApplicationInstance.Instance.GetGuildSummaryDatabase();
            var guild          = guildSummaryDB.GetGuildSummary(realm, guildStr);// DatabaseAccess.GetRealmGuild(this, realm, guildStr, NotLoadedDecision.RedirectAndWait);

            if (guild == null)
            {
                return;
            }
            guild.GenerateCache(realmDB);

            this.Title = guildStr + " @ " + StaticValues.ConvertRealmParam(realm) + " | RealmPlayers";

            m_ProgressInfoHTML = new MvcHtmlString("<div id='" + guild.GuildName.Replace(' ', '_') + "-Progress'></div>");

            var    membersArray            = guild.GetMembers();
            var    orderedPlayersArray     = membersArray.OrderBy((player) => { return(player.Item2.History.Last().GuildRankNr); });
            int    progressComparisonValue = 0;
            string guildProgressData       = GuildList.CreateProgressStr(this, guild, realm, out progressComparisonValue);

            m_GuildScriptData = new MvcHtmlString("<script>var guildProgress = new Array();" + guildProgressData + "</script>");

            if (pageView == "players")
            {
                m_BreadCrumbHTML = new MvcHtmlString(PageUtility.BreadCrumb_AddHome()
                                                     + PageUtility.BreadCrumb_AddRealm(realm)
                                                     + PageUtility.BreadCrumb_AddGuilds(realm)
                                                     + PageUtility.BreadCrumb_AddFinish(guild.GuildName));

                m_GuildInfoHTML = new MvcHtmlString("<h1><img src='assets/img/icons/ui-pvp-"
                                                    + StaticValues.GetFactionCSSName(guild.Faction) + ".png'/><span class='"
                                                    + StaticValues.GetFactionCSSName(guild.Faction) + "-color'>" + guild.GuildName
                                                    + "</span><span class='badge badge-inverse'>" + membersArray.Count + " Members</span></h1>"
                                                    + "<p>Guild on the server " + StaticValues.ConvertRealmViewing(realm) + "</p>"
                                                    + "<p><a href='/GuildViewer.aspx?realm=" + StaticValues.ConvertRealmParam(realm) + "&guild=" + guildStr + "&view=latestevents'>View Latest Events</a></p>"
                                                    + "<p><a href='/RaidStats/RaidList.aspx?realm=" + StaticValues.ConvertRealmParam(realm) + "&guild=" + guildStr + "'>View recorded raids on RaidStats</a></p>");

                string page = "";
                foreach (var player in orderedPlayersArray)
                {
                    page += PageUtility.CreatePlayerRow(0, realm, player.Item1, Table_Columns);
                }
                m_CharactersTableHeadHTML = new MvcHtmlString(PageUtility.CreatePlayerTableHeaderRow(Table_Columns));
                m_CharactersTableBodyHTML = new MvcHtmlString(page);
            }
            else if (pageView == "latestmembers")
            {
                m_BreadCrumbHTML = new MvcHtmlString(PageUtility.BreadCrumb_AddHome()
                                                     + PageUtility.BreadCrumb_AddRealm(realm)
                                                     + PageUtility.BreadCrumb_AddGuilds(realm)
                                                     + PageUtility.BreadCrumb_AddGuild(realm, guild.GuildName)
                                                     + PageUtility.BreadCrumb_AddFinish("Latest Members"));

                m_GuildInfoHTML = new MvcHtmlString("<h1><img src='assets/img/icons/ui-pvp-"
                                                    + StaticValues.GetFactionCSSName(guild.Faction) + ".png'/><span class='"
                                                    + StaticValues.GetFactionCSSName(guild.Faction) + "-color'>" + guild.GuildName
                                                    + "</span><span class='badge badge-inverse'>" + membersArray.Count + " Members</span></h1>"
                                                    + "<p>Guild on the server " + StaticValues.ConvertRealmViewing(realm) + "</p>"
                                                    + "<p><a href='/GuildViewer.aspx?realm=" + StaticValues.ConvertRealmParam(realm) + "&guild=" + guildStr + "'>View Members</a></p>"
                                                    + "<p><a href='/RaidStats/RaidList.aspx?realm=" + StaticValues.ConvertRealmParam(realm) + "&guild=" + guildStr + "'>View recorded raids on RaidStats</a></p>");
            }
            else if (pageView == "latestitems")
            {
                m_BreadCrumbHTML = new MvcHtmlString(PageUtility.BreadCrumb_AddHome()
                                                     + PageUtility.BreadCrumb_AddRealm(realm)
                                                     + PageUtility.BreadCrumb_AddGuilds(realm)
                                                     + PageUtility.BreadCrumb_AddGuild(realm, guild.GuildName)
                                                     + PageUtility.BreadCrumb_AddFinish("Latest Items"));

                m_GuildInfoHTML = new MvcHtmlString("<h1><img src='assets/img/icons/ui-pvp-"
                                                    + StaticValues.GetFactionCSSName(guild.Faction) + ".png'/><span class='"
                                                    + StaticValues.GetFactionCSSName(guild.Faction) + "-color'>" + guild.GuildName
                                                    + "</span><span class='badge badge-inverse'>" + membersArray.Count + " Members</span></h1>"
                                                    + "<p>Guild on the server " + StaticValues.ConvertRealmViewing(realm) + "</p>"
                                                    + "<p><a href='/GuildViewer.aspx?realm=" + StaticValues.ConvertRealmParam(realm) + "&guild=" + guildStr + "'>View Members</a></p>"
                                                    + "<p><a href='/RaidStats/RaidList.aspx?realm=" + StaticValues.ConvertRealmParam(realm) + "&guild=" + guildStr + "'>View recorded raids on RaidStats</a></p>");
            }
            else if (pageView == "latestevents")
            {
                m_BreadCrumbHTML = new MvcHtmlString(PageUtility.BreadCrumb_AddHome()
                                                     + PageUtility.BreadCrumb_AddRealm(realm)
                                                     + PageUtility.BreadCrumb_AddGuilds(realm)
                                                     + PageUtility.BreadCrumb_AddGuild(realm, guild.GuildName)
                                                     + PageUtility.BreadCrumb_AddFinish("Latest Events"));

                m_GuildInfoHTML = new MvcHtmlString("<h1><img src='assets/img/icons/ui-pvp-"
                                                    + StaticValues.GetFactionCSSName(guild.Faction) + ".png'/><span class='"
                                                    + StaticValues.GetFactionCSSName(guild.Faction) + "-color'>" + guild.GuildName
                                                    + "</span><span class='badge badge-inverse'>" + membersArray.Count + " Members</span></h1>"
                                                    + "<p>Guild on the server " + StaticValues.ConvertRealmViewing(realm) + "</p>"
                                                    + "<p><a href='/GuildViewer.aspx?realm=" + StaticValues.ConvertRealmParam(realm) + "&guild=" + guildStr + "'>View Members</a></p>"
                                                    + "<p><a href='/RaidStats/RaidList.aspx?realm=" + StaticValues.ConvertRealmParam(realm) + "&guild=" + guildStr + "'>View recorded raids on RaidStats</a></p>");
            }

            if (pageView == "latestmembers" || pageView == "latestevents")
            {
                var guildSummary = Hidden.ApplicationInstance.Instance.GetGuildSummary(realm, guildStr);
                if (guildSummary == null)
                {
                    return;
                }

                var statusChanges = guildSummary.GenerateLatestStatusChanges(DateTime.UtcNow.AddDays(-14));

                string latestmembersStr = "";
                statusChanges.Reverse();
                foreach (var sChange in statusChanges)
                {
                    if (realmDB.ContainsKey(sChange.Player))
                    {
                        var playerData = realmDB[sChange.Player];

                        string statusChangeDescription = "";
                        if (sChange.FromStatus == null || sChange.FromStatus.IsInGuild == false)
                        {
                            if (sChange.ToStatus.IsInGuild == true)
                            {
                                statusChangeDescription = "Added to the Guild as Rank \"" + sChange.ToStatus.GuildRank + "\"";
                            }
                            else
                            {
                                continue;
                            }
                        }
                        else if (sChange.ToStatus.IsInGuild == false)
                        {
                            statusChangeDescription = "Removed from the Guild";
                        }
                        else
                        {
                            statusChangeDescription = "Changed Rank From \"" + sChange.FromStatus.GuildRank + "\" to \"" + sChange.ToStatus.GuildRank + "\"";
                        }

                        latestmembersStr += PageUtility.CreateTableRow(""
                                                                       , PageUtility.CreateTableColumn(PageUtility.CreateColorCodedPlayerLink(realm, playerData))
                                                                       + PageUtility.CreateTableColumn("<div style='overflow: hidden;white-space: nowrap;'>" + statusChangeDescription + "</div>")
                                                                       + PageUtility.CreateTableColumn("<div style='overflow: hidden;white-space: nowrap;'>" + sChange.ToStatus.DateTime.ToLocalTime().ToString("yyyy-MM-dd") + "</div>"));
                    }
                }
                m_LatestMembersHTML = new MvcHtmlString(latestmembersStr);
            }

            if (pageView == "latestitems" || pageView == "latestevents")
            {
                List <Tuple <DateTime, Player, List <Tuple <PlayerItemInfo, ItemInfo> > > > latestItems = new List <Tuple <DateTime, Player, List <Tuple <PlayerItemInfo, ItemInfo> > > >();

                var realmHistory = DatabaseAccess._GetRealmPlayersHistory(this, realm, NotLoadedDecision.SpinWait);
                foreach (var data in orderedPlayersArray)
                {
                    Player        player        = data.Item1;
                    PlayerHistory playerHistory = null;
                    if (realmHistory.TryGetValue(player.Name, out playerHistory) == true)
                    {
                        var recvItems = HistoryGenerator.GenerateLatestReceivedItems(playerHistory, DateTime.MinValue);

                        var orderedRecvItems = recvItems.OrderByDescending(_Value => _Value.Key);
                        int i = 0;
                        foreach (var recvItem in orderedRecvItems)
                        {
                            if (i++ > 10)
                            {
                                break;
                            }

                            List <Tuple <PlayerItemInfo, ItemInfo> > newestItems = new List <Tuple <PlayerItemInfo, ItemInfo> >();
                            foreach (var item in recvItem.Value)
                            {
                                var itemInfo = DatabaseAccess.GetItemInfo(item.ItemID, wowVersion);
                                if (itemInfo.ItemQuality >= 4) //Atleast epic(4)
                                {
                                    newestItems.Add(Tuple.Create(item, itemInfo));
                                }
                            }
                            if (newestItems.Count > 0)
                            {
                                latestItems.Add(Tuple.Create(recvItem.Key, player, newestItems));
                            }
                        }
                    }
                }

                string latestItemsStr = "";
                {
                    var itemSummaryDB = Hidden.ApplicationInstance.Instance.GetItemSummaryDatabase();

                    string currentItemDatabase = DatabaseAccess.GetCurrentItemDatabaseAddress();

                    var orderedLatestItems = latestItems.OrderByDescending((_Value) => _Value.Item1);

                    int i = 0;
                    foreach (var recvItem in orderedLatestItems)
                    {
                        if (i++ > 100)
                        {
                            break;
                        }

                        int recvItemIndex = 0;
                        int xMax          = 58 * 3;
                        int yMax          = (int)((recvItem.Item3.Count - 1) / 3) * 58;

                        yMax += 58;
                        string itemLinks = "<div class='inventory' style='background: none; width: " + xMax + "px; height: " + yMax + "px;'>";
                        foreach (var item in recvItem.Item3)
                        {
                            int xPos = (recvItemIndex % 3) * 58;
                            int yPos = (int)(recvItemIndex / 3) * 58;
                            //string itemLink = currentItemDatabase + "?item=" + item.Item1.ItemID + "' rel='rand=" + item.Item1.SuffixID + ";ench=0";

                            var itemInfo = item.Item2;
                            itemLinks += "<div style='background: none; width: 58px; height: 58px;margin: " + yPos + "px " + xPos + "px;'>"
                                         + "<img class='itempic' src='" + "http://realmplayers.com/" + itemInfo.GetIconImageAddress() + "'/>"
                                         + "<div class='quality' id='" + CharacterViewer.ItemQualityConversion[itemInfo.ItemQuality] + "'></div>"
                                         + "<img class='itemframe' src='assets/img/icons/ItemNormalFrame.png'/>"
                                         + CharacterViewer.GenerateItemLink(currentItemDatabase, item.Item1, wowVersion);

                            var itemUsageCount = itemSummaryDB.GetItemUsageCount(realm, item.Item1);
                            itemLinks += "<a class='itemplayersframe' href='ItemUsageInfo.aspx?realm=" + StaticValues.ConvertRealmParam(realm) + "&item=" + item.Item1.ItemID + (item.Item1.SuffixID != 0 ? "&suffix=" + item.Item1.SuffixID : "") + "'>" + itemUsageCount + "</a>";
                            itemLinks += "</div>";
                            ++recvItemIndex;
                        }

                        itemLinks      += "</div>";
                        latestItemsStr += PageUtility.CreateTableRow(""
                                                                     , PageUtility.CreateTableColumn(itemLinks)
                                                                     + PageUtility.CreateTableColumn(PageUtility.CreateColorCodedPlayerLink(realm, recvItem.Item2))
                                                                     + PageUtility.CreateTableColumn("<div style='overflow: hidden;white-space: nowrap;'>" + recvItem.Item1.ToString("yyyy-MM-dd") + "</div>"));
                    }
                }
                m_LatestItemsHTML = new MvcHtmlString(latestItemsStr);
            }
        }