Example #1
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);
        }
Example #2
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
                }));
            }
        }
        private static string GenerateSummaryForInstance(VF_RDDatabase.PlayerSummary _PlayerSummary, PlayerData _Player, string _Instance, VF_RealmPlayersDatabase.WowRealm _Realm, string _GuildLimit = null)
        {
            string realmStr = RealmPlayersServer.StaticValues.ConvertRealmParam(_Realm);

            System.Text.StringBuilder page = new System.Text.StringBuilder("");

            int bossesData = 0;

            foreach (var boss in BossInformation.BossesInInstanceNoOptional[_Instance])
            {
                if (_PlayerSummary.PlayerBossStats.ContainsKey(boss) == false)
                {
                    continue;
                }

                if (bossesData == 0)
                {
                    page.Append("<table class='table'><thead><tr><th>Boss</th><th>DPS #Rank</th><th>HPS #Rank</th><th>Average DPS</th><th>Average HPS</th><th>Top DPS</th><th>Top HPS</th><th>Kill Count</th></thead><tbody>");
                }
                ++bossesData;

                List <VF_RDDatabase.PlayerFightData> dpsSamplesUsed = null;
                List <VF_RDDatabase.PlayerFightData> hpsSamplesUsed = null;

                var playerBossData = _PlayerSummary.PlayerBossStats[boss];
                if (playerBossData.m_PlayerFightDatas.Count < 3 || (_Instance != "Molten Core" && playerBossData.m_PlayerFightDatas.Count < 4))
                {
                    return("");
                }
                playerBossData.GetAverageDPS(5, 6, 3, out dpsSamplesUsed);
                playerBossData.GetAverageEffectiveHPS(5, 6, 3, out hpsSamplesUsed);

                float bwlBossDPS          = 0.0f;
                float bwlBossHPS          = 0.0f;
                var   bwlBossDataSet      = AverageOverview.GenerateAverageDataSet(boss, null, null, _Realm, _GuildLimit);
                var   bwlBossDPSRank      = GetDPSRank(bwlBossDataSet, _PlayerSummary.Name, out bwlBossDPS);
                var   bwlBossDPSRankClass = GetDPSRank(bwlBossDataSet, _PlayerSummary.Name, out bwlBossDPS, (PlayerData _Character) => { return(_Character.Character.Class == _Player.Character.Class); });
                var   bwlBossHPSRank      = GetHPSRank(bwlBossDataSet, _PlayerSummary.Name, out bwlBossHPS);
                var   bwlBossHPSRankClass = GetHPSRank(bwlBossDataSet, _PlayerSummary.Name, out bwlBossHPS, (PlayerData _Character) => { return(_Character.Character.Class == _Player.Character.Class); });
                //page += "<h5>" + boss + "</h5>";
                //page += "DPS Rank: #" + bwlBossDPSRank + " with DPS " + bwlBossDPS.ToStringDot("0.0");

                string dpsSamplesStr = "";

                if (dpsSamplesUsed.Count > 0)
                {
                    dpsSamplesStr = " (";

                    for (int i = 0; i < dpsSamplesUsed.Count; ++i)
                    {
                        dpsSamplesStr += PageUtility.CreateLink_FightOverview(dpsSamplesUsed[i].CacheBossFight, dpsSamplesUsed[i].DPS.ToStringDot("0.0")) + ", ";
                    }
                    dpsSamplesStr  = dpsSamplesStr.Substring(0, dpsSamplesStr.Length - 2);
                    dpsSamplesStr += ")";
                }

                string hpsSamplesStr = "";
                if (hpsSamplesUsed.Count > 0)
                {
                    hpsSamplesStr = " (";

                    for (int i = 0; i < hpsSamplesUsed.Count; ++i)
                    {
                        hpsSamplesStr += PageUtility.CreateLink_FightOverview(hpsSamplesUsed[i].CacheBossFight, hpsSamplesUsed[i].EffectiveHPS.ToStringDot("0.0")) + ", ";
                    }
                    hpsSamplesStr  = hpsSamplesStr.Substring(0, hpsSamplesStr.Length - 2);
                    hpsSamplesStr += ")";
                }

                page.Append("<tr>");
                page.Append("<td>" + boss + "</td>");
                if (bwlBossDPS != 0.0f || bwlBossHPS != 0.0f)
                {
                    page.Append("<td>" + PageUtility.CreateLink("AverageOverview.aspx?Boss=" + boss + "&realm=" + realmStr + "&andplayer=" + _PlayerSummary.Name, PageUtility.CreateColorString("#" + bwlBossDPSRank, RPColor.Red)) + " / ");
                    page.Append(PageUtility.CreateLink("AverageOverview.aspx?Boss=" + boss + "&realm=" + realmStr + "&andplayer=" + _PlayerSummary.Name + "&ClassLimit=" + ClassControl.GetClassLimitStr(_Player.Character.Class), PageUtility.CreateColorString("#" + bwlBossDPSRankClass, _Player.Character.Class)) + "</td>");
                    page.Append("<td>" + PageUtility.CreateLink("AverageOverview.aspx?Boss=" + boss + "&realm=" + realmStr + "&andplayer=" + _PlayerSummary.Name, PageUtility.CreateColorString("#" + bwlBossHPSRank, RPColor.Green)) + " / ");
                    page.Append(PageUtility.CreateLink("AverageOverview.aspx?Boss=" + boss + "&realm=" + realmStr + "&andplayer=" + _PlayerSummary.Name + "&ClassLimit=" + ClassControl.GetClassLimitStr(_Player.Character.Class), PageUtility.CreateColorString("#" + bwlBossHPSRankClass, _Player.Character.Class)) + "</td>");
                }
                else
                {
                    page.Append("<td>#??(inactive)</td>");
                    page.Append("<td>#??(inactive)</td>");
                }
                page.Append("<td>" + PageUtility.CreateLink("AverageOverview.aspx?Boss=" + boss + "&realm=" + realmStr + "&andplayer=" + _PlayerSummary.Name, PageUtility.CreateColorString(bwlBossDPS.ToStringDot("0.0"), RPColor.Red))
                            + dpsSamplesStr
                            + "</td>");
                page.Append("<td>" + PageUtility.CreateLink("AverageOverview.aspx?Boss=" + boss + "&realm=" + realmStr + "&andplayer=" + _PlayerSummary.Name, PageUtility.CreateColorString(bwlBossHPS.ToStringDot("0.0"), RPColor.Green))
                            + hpsSamplesStr
                            + "</td>");
                page.Append("<td>" + PageUtility.CreateLink("FightOverallOverview.aspx?FightName=" + boss + "&realm=" + realmStr + "&andplayer=" + _PlayerSummary.Name, "view") + "</td>");
                page.Append("<td>" + PageUtility.CreateLink("FightOverallOverview.aspx?FightName=" + boss + "&realm=" + realmStr + "&andplayer=" + _PlayerSummary.Name, "view") + "</td>");
                page.Append("<td>" + _PlayerSummary.AttendedFights.Count((_Value) => _Value.BossName == boss) + "</td>");
                page.Append("</tr>");
            }
            if (bossesData == 0)
            {
                return("");
            }
            else if (bossesData > 0)
            {
                page.Append("</tbody></table>");
            }

            string averagePageData = "<p><h3>Active Ranking in " + _Instance + "</h3>";

            {
                var bwlDataSet = AverageOverview.GenerateAverageDataSet(_Instance, null, null, _Realm, _GuildLimit);

                float  bwlDPS          = 0.0f;
                string bwlDPSRank      = GetDPSRank(bwlDataSet, _PlayerSummary.Name, out bwlDPS).ToString();
                string bwlDPSRankClass = GetDPSRank(bwlDataSet, _PlayerSummary.Name, out bwlDPS, (PlayerData _Character) => { return(_Character.Character.Class == _Player.Character.Class); }).ToString();


                float  bwlHPS          = 0.0f;
                string bwlHPSRank      = GetHPSRank(bwlDataSet, _PlayerSummary.Name, out bwlHPS).ToString();
                string bwlHPSRankClass = GetHPSRank(bwlDataSet, _PlayerSummary.Name, out bwlHPS, (PlayerData _Character) => { return(_Character.Character.Class == _Player.Character.Class); }).ToString();

                if (bwlDPS != 0.0f || bwlHPS != 0.0f)
                {
                    string bossIdentifierStr = BossesControl.MC_ALL;
                    if (_Instance == "Molten Core")
                    {
                        bossIdentifierStr = BossesControl.MC_ALL;
                    }
                    else if (_Instance == "Blackwing Lair")
                    {
                        bossIdentifierStr = BossesControl.BWL_ALL;
                    }
                    else if (_Instance == "Ahn'Qiraj Temple")
                    {
                        bossIdentifierStr = BossesControl.AQ40_ALL;
                    }
                    else if (_Instance == "Naxxramas - All Quarters")
                    {
                        bossIdentifierStr = BossesControl.NAXX_ALL_QUARTERS;
                    }

                    bwlDPSRank = PageUtility.CreateLink("Ranking.aspx?Bosses=" + bossIdentifierStr + "&realm=" + realmStr + "&andplayer=" + _PlayerSummary.Name, PageUtility.CreateColorString("#" + bwlDPSRank, RPColor.Red));
                    bwlHPSRank = PageUtility.CreateLink("Ranking.aspx?Bosses=" + bossIdentifierStr + "&realm=" + realmStr + "&andplayer=" + _PlayerSummary.Name, PageUtility.CreateColorString("#" + bwlHPSRank, RPColor.Green));

                    bwlDPSRankClass = PageUtility.CreateLink("Ranking.aspx?Bosses=" + bossIdentifierStr + "&realm=" + realmStr + "&andplayer=" + _PlayerSummary.Name + "&ClassLimit=" + ClassControl.GetClassLimitStr(_Player.Character.Class)
                                                             , PageUtility.CreateColorString("#" + bwlDPSRankClass, _Player.Character.Class));
                    bwlHPSRankClass = PageUtility.CreateLink("Ranking.aspx?Bosses=" + bossIdentifierStr + "&realm=" + realmStr + "&andplayer=" + _PlayerSummary.Name + "&ClassLimit=" + ClassControl.GetClassLimitStr(_Player.Character.Class)
                                                             , PageUtility.CreateColorString("#" + bwlHPSRankClass, _Player.Character.Class));


                    averagePageData += "<h5>DPS Rank: " + bwlDPSRank + " / " + bwlDPSRankClass + " with DPS " + bwlDPS.ToStringDot("0.0") + "</h5>";
                    averagePageData += "<h5>HPS Rank: " + bwlHPSRank + " / " + bwlHPSRankClass + " with HPS " + bwlHPS.ToStringDot("0.0") + "</h5>";
                }
                else
                {
                    averagePageData += "<h5>DPS Rank: #??(inactive)</h5>";
                    averagePageData += "<h5>HPS Rank: #??(inactive)</h5>";
                }
            }

            return(averagePageData + page.ToString());
        }
Example #4
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);
        }