예제 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string playerStr = PageUtility.GetQueryString(Request, "player");
            var    realm     = PageUtility.GetQueryRealm(Request);

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

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

            string rankingDetailsInstance = PageUtility.GetQueryString(Request, "RankDetailInstance", null);

            this.Title       = playerStr + " @ " + RealmPlayersServer.StaticValues.ConvertRealmParam(realm) + " | RaidStats";
            m_BreadCrumbHTML = new MvcHtmlString(PageUtility.BreadCrumb_AddHome()
                                                 + PageUtility.BreadCrumb_AddFinish(realm.ToString())
                                                 + PageUtility.BreadCrumb_AddFinish(playerStr));

            var summaryDatabase = ApplicationInstance.Instance.GetSummaryDatabase();

            if (summaryDatabase == null)
            {
                return;
            }

            var currPlayerSummary = summaryDatabase.GetPlayerSummary(playerStr, realm);

            if (currPlayerSummary == null || currPlayerSummary.PlayerBossStats == null || currPlayerSummary.PlayerBossStats.Count == 0)
            {
                return;
            }

            var realmPlayer = ApplicationInstance.Instance.GetRealmPlayer(playerStr, realm);

            System.Text.StringBuilder pageBuilder = new System.Text.StringBuilder(10000);
            pageBuilder.Append("<h1>" + realmPlayer.Name + "</h1>");
            pageBuilder.Append("<h4>Character profile: " + PageUtility.CreateLink_Armory_Player_Colored(realmPlayer) + "</h4>");

            pageBuilder.Append("<h4>Attended raids in groups</h4>");

            var orderedBossFights = currPlayerSummary.AttendedFights.OrderByDescending((_Value) => _Value.EndDateTime);
            List <VF_RDDatabase.Raid> attendedRaids = new List <VF_RDDatabase.Raid>();

            foreach (var attendedBossFight in orderedBossFights)
            {
                attendedRaids.AddUnique(attendedBossFight.CacheRaid);
            }
            List <string> groupsAttended = new List <string>();

            attendedRaids.ForEach((_Value) => groupsAttended.AddUnique(_Value.CacheGroup.GroupName));
            foreach (var group in groupsAttended)
            {
                var raidsInGroup = attendedRaids.Where((_Value) => _Value.CacheGroup.GroupName == group); //Sorted, last raid attended is the first in list!
                var factionColor = PageUtility.GetFactionTextColor(raidsInGroup.First().CacheGroup.GetFaction(ApplicationInstance.Instance.GetRealmDB));
                pageBuilder.Append(PageUtility.CreateColorString(group, factionColor)
                                   + "(" + raidsInGroup.Count() + " raids between " + raidsInGroup.Last().RaidStartDate.ToDateStr() + " and " + raidsInGroup.First().RaidEndDate.ToDateStr() + ")<br/>");
                //foreach (var raid in raidsInGroup)
                //{
                //    pageBuilder.Append(PageUtility.CreateLink_RaidOverview(raid, raid.RaidStartDate.ToString("yyyy-MM-dd")) + ", ");
                //}
                //pageBuilder.Append("<br/>");
            }

            pageBuilder.Append("<h4><a href='BossList.aspx?realm=" + RealmPlayersServer.StaticValues.ConvertRealmParam(realmPlayer.Realm) + "&player=" + realmPlayer.Name + "'>Best boss performances</a></h4>");

            //pageBuilder.Append("<p><h3>vs Everything</h3>");
            //var averageAll = AverageOverview.GenerateAverageDataSet("All", null, null, realm, guildLimit);
            //float averageDPS, averageHPS;
            //var dpsRank = GetDPSRank(averageAll, realmPlayer.Name, out averageDPS);
            //var hpsRank = GetHPSRank(averageAll, realmPlayer.Name, out averageHPS);
            //pageBuilder.Append("<h4>Average DPS rank: " + PageUtility.CreateLink("AverageOverview.aspx?Instance=All&realm=" + RealmPlayersServer.StaticValues.ConvertRealmParam(realmPlayer.Realm) + "&andplayer=" + realmPlayer.Name, "#" + dpsRank) + " with DPS " + averageDPS.ToStringDot("0.0") + "</h4>");
            //pageBuilder.Append("<h4>Average HPS rank: " + PageUtility.CreateLink("AverageOverview.aspx?Instance=All&realm=" + RealmPlayersServer.StaticValues.ConvertRealmParam(realmPlayer.Realm) + "&andplayer=" + realmPlayer.Name, "#" + hpsRank) + " with HPS " + averageHPS.ToStringDot("0.0") + "</h4>");
            //pageBuilder.Append("</p>");
            //pageBuilder.Append("<br />");

            var    realmProgress   = GetRealmProgress(realm);
            string instanceSummary = "";

            if (rankingDetailsInstance == "Naxxramas" || (instanceSummary == "" && (int)realmProgress >= (int)VF_RealmPlayersDatabase.WowInstance.Naxxramas))
            {
                instanceSummary = GenerateSummaryForInstance(currPlayerSummary, realmPlayer, "Naxxramas - All Quarters", realm, guildLimit);
            }
            if (rankingDetailsInstance == "AQ40" || (instanceSummary == "" && (int)realmProgress >= (int)VF_RealmPlayersDatabase.WowInstance.Temple_Of_Ahn_Qiraj))
            {
                instanceSummary = GenerateSummaryForInstance(currPlayerSummary, realmPlayer, "Ahn'Qiraj Temple", realm, guildLimit);
            }
            if (rankingDetailsInstance == "BWL" || (instanceSummary == "" && (int)realmProgress >= (int)VF_RealmPlayersDatabase.WowInstance.Blackwing_Lair))
            {
                instanceSummary = GenerateSummaryForInstance(currPlayerSummary, realmPlayer, "Blackwing Lair", realm, guildLimit);
            }
            if (rankingDetailsInstance == "MC" || instanceSummary == "")
            {
                instanceSummary = GenerateSummaryForInstance(currPlayerSummary, realmPlayer, "Molten Core", realm, guildLimit);
            }
            if (rankingDetailsInstance == "ZG" || instanceSummary == "")
            {
                instanceSummary = GenerateSummaryForInstance(currPlayerSummary, realmPlayer, "Zul'Gurub", realm, guildLimit);
            }
            pageBuilder.Append(instanceSummary);

            /////////////////////////////////////////////
            pageBuilder.Append("<h2>Attended raids</h2>");
            foreach (var attendedRaid in attendedRaids)
            {
                pageBuilder.Append(PageUtility.CreateLink_RaidOverview(attendedRaid, attendedRaid.RaidInstance + " @ " + attendedRaid.RaidStartDate) + "<br/>");
            }

            //pageBuilder.Append("<h2>Average Performance vs</h2>");
            //foreach (var bossData in currPlayerSummary.PlayerBossStats)
            //{
            //    if (bossData.Value.GetSamplesCount() < 3)
            //        continue;
            //    List<VF_RDDatabase.PlayerFightData> dpsSamplesUsed = null;
            //    List<VF_RDDatabase.PlayerFightData> hpsSamplesUsed = null;
            //    List<VF_RDDatabase.PlayerFightData> deathSamplesUsed = null;
            //    float averageDPS = bossData.Value.GetAverageDPS(5, 6, 3, out dpsSamplesUsed);
            //    float averageEffectiveHPS = bossData.Value.GetAverageEffectiveHPS(5, 6, 3, out hpsSamplesUsed);
            //    float averageRawHPS = bossData.Value.GetAverageRawHPS(5, 6, 3);
            //    float averageDeaths = bossData.Value.GetAverageDeaths(5, 6, 3, out deathSamplesUsed);

            //    pageBuilder.Append("<h3>" + bossData.Key + ":</h3>");
            //    if (averageDPS > 100 || averageEffectiveHPS < 20)
            //    {
            //        pageBuilder.Append("<br/>DPS(<font color='#ff0000'>" + averageDPS.ToStringDot("0.0") + "</font>) Samples(");
            //        foreach (var dpsSample in dpsSamplesUsed)
            //        {
            //            pageBuilder.Append(PageUtility.CreateLink_FightOverview(dpsSample.CacheBossFight, dpsSample.CacheBossFight.StartDateTime.ToString("yyyy-MM-dd")) + ", ");
            //        }
            //        pageBuilder.Length = pageBuilder.Length - 2;
            //        pageBuilder.Append(")");
            //    }
            //    if(averageEffectiveHPS >= 20)
            //    {
            //        pageBuilder.Append("<br/>Effective HPS(<font color='#ff0000'>" + averageEffectiveHPS.ToStringDot("0.0") + "</font>) Samples(");
            //        foreach (var hpsSample in hpsSamplesUsed)
            //        {
            //            pageBuilder.Append(PageUtility.CreateLink_FightOverview(hpsSample.CacheBossFight, hpsSample.CacheBossFight.StartDateTime.ToString("yyyy-MM-dd")) + ", ");
            //        }
            //        pageBuilder.Length = pageBuilder.Length - 2;
            //        pageBuilder.Append(")");
            //    }
            //    pageBuilder.Append("<br/>Deaths(<font color='#ff0000'>" + averageDeaths.ToStringDot("0%") + "</font>) Samples(");
            //    foreach (var deathSample in deathSamplesUsed)
            //    {
            //        pageBuilder.Append(PageUtility.CreateLink_FightOverview(deathSample.CacheBossFight, deathSample.CacheBossFight.StartDateTime.ToString("yyyy-MM-dd")) + ", ");
            //    }
            //    pageBuilder.Length = pageBuilder.Length - 2;
            //    pageBuilder.Append(")<br/>");
            //}

            m_PageHTML = new MvcHtmlString(pageBuilder.ToString());
        }