コード例 #1
0
 public string GetRealmViewing()
 {
     return(StaticValues.ConvertRealmViewing(m_Realm));
 }
コード例 #2
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);
        }
コード例 #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            this.Title = "Contributors | RealmPlayers";
            var statisticsData = DatabaseAccess.GetContributorStatistics();

            if (statisticsData == null)
            {
                PageUtility.RedirectErrorLoading(this, "contributors");
                return;
            }
            m_BreadCrumbHTML = new MvcHtmlString(PageUtility.BreadCrumb_AddHome() + PageUtility.BreadCrumb_AddFinish("Contributors"));

            var statsRealms = new WowRealm[] { WowRealm.Emerald_Dream, WowRealm.Warsong, WowRealm.Al_Akir, WowRealm.Rebirth, WowRealm.Nostalrius, WowRealm.Kronos, WowRealm.Archangel };

            Dictionary <WowRealm, int> totalRealmInspects = new Dictionary <WowRealm, int>();

            string realmInspectsHeaderColumns = "";

            foreach (var statsRealm in statsRealms)
            {
                realmInspectsHeaderColumns += PageUtility.CreateTableColumnHead(StaticValues.ConvertRealmViewing(statsRealm));
                totalRealmInspects.Add(statsRealm, 0);
            }

            m_TableHeadHTML = new MvcHtmlString(PageUtility.CreateTableRow("", PageUtility.CreateTableColumnHead("#Nr")
                                                                           + PageUtility.CreateTableColumnHead("Name")
                                                                           + PageUtility.CreateTableColumnHead("Total inspects")
                                                                           + realmInspectsHeaderColumns
                                                                           + PageUtility.CreateTableColumnHead("Active since")
                                                                           + PageUtility.CreateTableColumnHead("Last active")));

            SortedList <int, string> tableRows = new SortedList <int, string>();
            string tableBody = "";

            var contributors = ContributorDB.GetAllTrustWorthyContributors();

            foreach (var data in contributors)
            {
                DateTime earliestActive       = DateTime.MaxValue;
                DateTime latestActive         = DateTime.MinValue;
                int      totalInspects        = 0;
                string   realmInspectsColumns = "";
                foreach (var statRealm in statsRealms)
                {
                    int inspects = 0;
                    Code.ContributorStatisticItem stats = null;
                    if (statisticsData[statRealm].TryGetValue(data.ContributorID, out stats) == false)
                    {
                        stats = new Code.ContributorStatisticItem(-1);
                    }
                    earliestActive = (stats.m_EarliestActiveUTC < earliestActive ? stats.m_EarliestActiveUTC : earliestActive);
                    latestActive   = (stats.m_LatestActiveUTC > latestActive ? stats.m_LatestActiveUTC : latestActive);

                    foreach (var inspection in stats.m_PlayerInspects)
                    {
                        inspects += inspection.Value;
                    }
                    totalInspects += inspects;
                    totalRealmInspects[statRealm] += inspects;
                    realmInspectsColumns          += PageUtility.CreateTableColumn(inspects.ToString());
                }

                if (totalInspects > 0 && data.Name != "Unknown" &&
                    ((DateTime.UtcNow - latestActive).TotalDays < 15 ||
                     (totalInspects > 5000 && (DateTime.UtcNow - latestActive).TotalDays < 60)))
                {
                    int keyToUse = int.MaxValue - totalInspects * 100;
                    while (tableRows.ContainsKey(keyToUse) == true)
                    {
                        keyToUse += 1;
                    }


                    tableRows.Add(keyToUse, PageUtility.CreateTableColumn(data.Name)
                                  + PageUtility.CreateTableColumn(totalInspects.ToString())
                                  + realmInspectsColumns
                                  + PageUtility.CreateTableColumn(earliestActive.ToString("yyy-MM-dd"))
                                  + PageUtility.CreateTableColumn(StaticValues.GetTimeSinceLastSeenUTC(latestActive)));
                }
            }
            int    totalALLInspects         = 0;
            string totalRealmInspectsColumn = "";

            foreach (var statRealm in statsRealms)
            {
                totalRealmInspectsColumn += PageUtility.CreateTableColumn(totalRealmInspects[statRealm].ToString());
                totalALLInspects         += totalRealmInspects[statRealm];
            }
            tableBody += PageUtility.CreateTableRow("", PageUtility.CreateTableColumn("#ALL") + PageUtility.CreateTableColumn("TOTAL")
                                                    + PageUtility.CreateTableColumn(totalALLInspects.ToString())
                                                    + totalRealmInspectsColumn
                                                    + PageUtility.CreateTableColumn("-")
                                                    + PageUtility.CreateTableColumn("-"));
            int i = 1;

            foreach (var tableRow in tableRows)
            {
                tableBody += PageUtility.CreateTableRow("", PageUtility.CreateTableColumn("#" + i++) + tableRow.Value);
            }
            m_TableBodyHTML = new MvcHtmlString(tableBody);

            m_ContributorsInfoHTML = new MvcHtmlString(
                "<h1>Contributors<span class='badge badge-inverse'>" + tableRows.Count() + " Players</span></h1>"
                + "<p>List displays the persons that contribute data to this project. Sorted by the amount of inspects they have contributed with.</p>"
                + "<br/><p>The more contributors the better! If you are interested in being a contributor to help out the project please do not hesitate contacting <a href='http://forum.realmplayers.com/memberlist.php?mode=viewprofile&u=51'>Sethzer</a> on RealmPlayers forums. Make sure you also read the thread: <a href='http://realmplayers.com:5555/viewtopic.php?f=14&t=15'>About Data Contribution</a>.</p><br/>");
        }
コード例 #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            this.Title = "Contributors | RealmPlayers";
            //var statisticsData = DatabaseAccess.GetContributorStatistics();
            //if (statisticsData == null)
            //{
            //    PageUtility.RedirectErrorLoading(this, "contributors");
            //    return;
            //}
            m_BreadCrumbHTML = new MvcHtmlString(PageUtility.BreadCrumb_AddHome() + PageUtility.BreadCrumb_AddFinish("Contributors"));

            var statsRealms = new WowRealm[] { WowRealm.Emerald_Dream, WowRealm.Warsong, WowRealm.Al_Akir, WowRealm.Rebirth, WowRealm.Nostalrius, WowRealm.Kronos, WowRealm.Archangel };

            Dictionary <WowRealm, int> totalRealmInspects = new Dictionary <WowRealm, int>();

            string realmInspectsHeaderColumns = "";

            foreach (var statsRealm in statsRealms)
            {
                realmInspectsHeaderColumns += PageUtility.CreateTableColumnHead(StaticValues.ConvertRealmViewing(statsRealm));
                totalRealmInspects.Add(statsRealm, 0);
            }

            m_TableHeadHTML = new MvcHtmlString(PageUtility.CreateTableRow("", PageUtility.CreateTableColumnHead("#Nr")
                                                                           + PageUtility.CreateTableColumnHead("Name")
                                                                           + PageUtility.CreateTableColumnHead("Total inspects")
                                                                           + realmInspectsHeaderColumns
                                                                           + PageUtility.CreateTableColumnHead("Active since")
                                                                           + PageUtility.CreateTableColumnHead("Last active")));

            SortedList <int, string> tableRows = new SortedList <int, string>();
            string tableBody = "";

            using (VF.SQLComm comm = new VF.SQLComm())
            {
                var contributors = ContributorDB.GetAllTrustWorthyContributors();
                foreach (var statRealm in statsRealms)
                {
                    totalRealmInspects[statRealm] = comm.GetRealmInspectsTotal(statRealm);
                }

                //return DynamicReloader.GetData<ContributorStatistics>(() =>
                //{
                //    VF_RPDatabase.GuildSummaryDatabase summaryDB = null;
                //    summaryDB = VF_RPDatabase.GuildSummaryDatabase.LoadSummaryDatabase(Constants.RPPDbDir);
                //    return summaryDB;
                //}, (_ContributorStatistics, _LastLoadTime) => { return (DateTime.UtcNow - _LastLoadTime).TotalMinutes > 30; });

                //DynamicReloader.GetData(() => { }, () => { return true; }, TimeSpan.FromMinutes(30), false)
                int contributorCounter = 0;
                if (false)
                {
                    foreach (var data in contributors)
                    {
                        var contributor = data.GetAsContributor();

                        DateTime earliestActive;
                        DateTime latestActive;
                        int      totalInspects;
                        if (comm.GetInspectsInfoForContributor(contributor, out earliestActive, out latestActive, out totalInspects) == true)
                        {
                            string realmInspectsColumns = "";

                            if (totalInspects > 0 && data.Name != "Unknown" &&
                                ((DateTime.UtcNow - latestActive).TotalDays < 15 ||
                                 (totalInspects > 5000 && (DateTime.UtcNow - latestActive).TotalDays < 60)))
                            {
                                foreach (var statRealm in statsRealms)
                                {
                                    int inspects = comm.GetRealmInspectsForContributor(contributor, statRealm);
                                    realmInspectsColumns += PageUtility.CreateTableColumn(inspects.ToString());
                                }

                                int keyToUse = int.MaxValue - totalInspects * 100;
                                while (tableRows.ContainsKey(keyToUse) == true)
                                {
                                    keyToUse += 1;
                                }


                                tableRows.Add(keyToUse, PageUtility.CreateTableColumn(data.Name)
                                              + PageUtility.CreateTableColumn(totalInspects.ToString())
                                              + realmInspectsColumns
                                              + PageUtility.CreateTableColumn(earliestActive.ToString("yyy-MM-dd"))
                                              + PageUtility.CreateTableColumn(StaticValues.GetTimeSinceLastSeenUTC(latestActive)));
                            }
                        }


                        if (contributorCounter++ % 100 == 0)
                        {
                            Logger.ConsoleWriteLine("Generated Contributor Inspects Info for Contributor Nr " + contributorCounter);
                        }
                    }
                }
            }
            int    totalALLInspects         = 0;
            string totalRealmInspectsColumn = "";

            foreach (var statRealm in statsRealms)
            {
                totalRealmInspectsColumn += PageUtility.CreateTableColumn(totalRealmInspects[statRealm].ToString());
                totalALLInspects         += totalRealmInspects[statRealm];
            }
            tableBody += PageUtility.CreateTableRow("", PageUtility.CreateTableColumn("#ALL") + PageUtility.CreateTableColumn("TOTAL")
                                                    + PageUtility.CreateTableColumn(totalALLInspects.ToString())
                                                    + totalRealmInspectsColumn
                                                    + PageUtility.CreateTableColumn("-")
                                                    + PageUtility.CreateTableColumn("-"));
            int i = 1;

            foreach (var tableRow in tableRows)
            {
                tableBody += PageUtility.CreateTableRow("", PageUtility.CreateTableColumn("#" + i++) + tableRow.Value);
            }
            m_TableBodyHTML = new MvcHtmlString(tableBody);

            m_ContributorsInfoHTML = new MvcHtmlString(
                "<h1>Contributors<span class='badge badge-inverse'>" + tableRows.Count() + " Players</span></h1>"
                + "<p>List displays the persons that contribute data to this project. Sorted by the amount of inspects they have contributed with.</p>"
                + "<br/><p>The more contributors the better! If you are interested in being a contributor to help out the project please do not hesitate contacting <a href='http://forum.realmplayers.com/memberlist.php?mode=viewprofile&u=51'>Sethzer</a> on RealmPlayers forums. Make sure you also read the thread: <a href='http://realmplayers.com:5555/viewtopic.php?f=14&t=15'>About Data Contribution</a>.</p><br/>");
        }
コード例 #5
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);
            }
        }