Пример #1
0
        private void GenerateBossFightPage(bool DEBUG_Website, bool filteredData, int uniqueRaidID, RaidBossFight interestingFight)
        {
            if (interestingFight == null)
            {
                Response.Redirect("RaidList.aspx");
            }

            var realmDB = ApplicationInstance.Instance.GetRealmDB(interestingFight.GetRaid().Realm);

            if (interestingFight != null)
            {
                //int fightDuration = timeEnd - timeStart;
                //if (fightDuration <= 0)
                //{
                //    if (timeEnd < timeStart)
                //        fightDuration = interestingFight.GetFightData().GetFightRecordDuration() - timeStart;
                //    else
                //        fightDuration = interestingFight.GetFightData().GetFightRecordDuration();
                //}
                m_BreadCrumbHTML = new MvcHtmlString(PageUtility.BreadCrumb_AddHome()
                                                     + PageUtility.BreadCrumb_AddRaidList()
                                                     + PageUtility.BreadCrumb_AddLink("RaidList.aspx?Guild=" + interestingFight.GetRaid().RaidOwnerName + "&realm=" + StaticValues.ConvertRealmParam(realmDB.Realm), interestingFight.GetRaid().RaidOwnerName)
                                                     + PageUtility.BreadCrumb_AddRaidOverview(interestingFight.GetRaid())
                                                     + PageUtility.BreadCrumb_AddFinish(interestingFight.GetBossName()));

                var raidSummary = ApplicationInstance.Instance.GetSummaryDatabase().GetRaid(uniqueRaidID);
                m_FightOverviewInfoHTML = new MvcHtmlString(FightOverviewGenerator.Generate(realmDB, raidSummary, interestingFight
                                                                                            , new FightOverviewGenerator.GenerateDetails
                {
                    FilterSpikes          = filteredData
                    , DebugInfo           = DEBUG_Website
                    , DebugBuff           = PageUtility.GetQueryString(Request, "DebugBuff", null)
                    , FilterSpikesURL     = PageUtility.CreateUrlWithNewQueryValue(Request, "Filtered", "true")
                    , NoFilterSpikesURL   = PageUtility.CreateUrlWithNewQueryValue(Request, "Filtered", "false")
                    , VersionChangeURL    = PageUtility.CreateUrlWithNewQueryValue(Request, "Version", "versionchangeid")
                    , ItemSummaryDatabase = ApplicationInstance.Instance.GetItemSummaryDatabase()
                    , GetItemInfoFunc     = ApplicationInstance.Instance.GetItemInfo
                }));
            }
            else
            {
                Response.Redirect("RaidOverview.aspx?Raid=" + uniqueRaidID);
            }
        }
Пример #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
                }));
            }
        }
Пример #3
0
        //public static bool derp = false;
        //public static void ValidateCacheOutput(HttpContext context, Object data,
        //    ref HttpValidationStatus status)
        //{
        //    if (derp == true)
        //        status = HttpValidationStatus.Valid;
        //    else
        //        status = HttpValidationStatus.Invalid;
        //    if (context.Request.QueryString["Status"] != null)
        //    {
        //        string pageStatus = context.Request.QueryString["Status"];

        //        if (pageStatus == "invalid")
        //            status = HttpValidationStatus.Invalid;
        //        else if (pageStatus == "ignore")
        //            status = HttpValidationStatus.IgnoreThisRequest;
        //        else
        //            status = HttpValidationStatus.Valid;
        //    }
        //    else
        //        status = HttpValidationStatus.Valid;
        //}
        protected void Page_Load(object sender, EventArgs e)
        {
            //Response.Cache.AddValidationCallback(
            //    new HttpCacheValidateHandler(ValidateCacheOutput),
            //    null);
            //Response.Cache.SetExpires(DateTime.Now.AddSeconds(600));
            //Response.Cache.SetCacheability(HttpCacheability.ServerAndNoCache);
            //Response.Cache.SetValidUntilExpires(true);

            bool filteredData = PageUtility.GetQueryString(Request, "Filtered", "true") == "true";
            int  uniqueRaidID = PageUtility.GetQueryInt(Request, "Raid", -1);

            if (uniqueRaidID == -1)
            {
                Response.Redirect("RaidList.aspx");
            }

            this.Title = "Raid " + uniqueRaidID + " | RaidStats";

#if false//LIMIT_USERS_USING_LOGIN_SYSTEM
            if ((DateTime.Now - ApplicationInstance.Instance.GetRaidDate(uniqueRaidID)).TotalDays > 30)
            {
                var user = Authentication.GetSessionUser(Page, true);
                if (user.IsPremium() == false)
                {
                    m_TrashHTML = new MvcHtmlString("Sorry. Raids that are older than 30 days are only viewable for Premium users!");
                    return;
                }
            }
#endif
            if (PageUtility.GetQueryString(Request, "Debug", "null") != "null")
            {
                var raidFiles = ApplicationInstance.Instance.GetRaidFiles(uniqueRaidID);
                if (raidFiles != null)
                {
                    Logger.ConsoleWriteLine("RaidOverview::Debug(): GetRaidFiles was: \"" + raidFiles.MergeToStringVF("\", \"") + "\"", ConsoleColor.DarkYellow);
                }
                else
                {
                    Logger.ConsoleWriteLine("RaidOverview::Debug(): GetRaidFiles was null!", ConsoleColor.DarkYellow);
                }
            }
            var orderedFights = ApplicationInstance.Instance.GetRaidBossFights(uniqueRaidID);
            if (orderedFights == null || orderedFights.Count() == 0)
            {
                Response.Redirect("RaidList.aspx");
            }

            var orderedTrashFights = ApplicationInstance.Instance.GetRaidTrashFights(uniqueRaidID);

            var realmDB = ApplicationInstance.Instance.GetRealmDB(orderedFights.First().GetRaid().Realm);

            var currRaid = orderedFights.First().GetRaid();
            if (currRaid.Realm == VF_RealmPlayersDatabase.WowRealm.Test_Server && PageUtility.GetQueryString(Request, "Debug") == "null")
            {
                Response.Redirect("RaidList.aspx");
            }
            m_BreadCrumbHTML = new MvcHtmlString(PageUtility.BreadCrumb_AddHome()
                                                 + PageUtility.BreadCrumb_AddRaidList()
                                                 + PageUtility.BreadCrumb_AddLink("RaidList.aspx?Guild=" + currRaid.RaidOwnerName + "&realm=" + StaticValues.ConvertRealmParam(realmDB.Realm), currRaid.RaidOwnerName)
                                                 + PageUtility.BreadCrumb_AddFinish(currRaid.RaidInstance + "(" + currRaid.RaidID.ToString() + ")"));

            bool displayLoot = false;
            if (orderedFights.FindIndex((_Value) => _Value.GetItemDrops().Count > 0) != -1)
            {
                displayLoot = true;
            }

            m_TableHeadHTML = new MvcHtmlString(
                PageUtility.CreateTableRow("",
                                           PageUtility.CreateTableColumnHead("#Nr") +
                                           PageUtility.CreateTableColumnHead("Boss") +
                                           PageUtility.CreateTableColumnHead("Players") +
                                           (displayLoot == true ? PageUtility.CreateTableColumnHead("Items Dropped") : "") +
                                           //PageUtility.CreateTableColumnHead(PageUtility.CreateTooltipText("Recorded Damage", "Recorded damage done by players during the fight")) +
                                           PageUtility.CreateTableColumnHead("Player Deaths") +
                                           PageUtility.CreateTableColumnHead("Fight Duration") +
                                           PageUtility.CreateTableColumnHead("Kill Time") +
                                           PageUtility.CreateTableColumnHead(PageUtility.CreateTooltipText("Precision", "How much percentage of the recorded fight is vs the boss intended. Calculated using the formula: Boss+Adds DmgTaken/Recorded Damage"))));


            List <string> attendingRaidPlayers = new List <string>();
            string        tableBody            = "";
            foreach (var fight in orderedFights)
            {
                var attendingFightPlayers = fight.GetAttendingUnits((_Name) => { return(realmDB.RD_IsPlayer(_Name, fight)); });
                attendingRaidPlayers.AddRange(attendingFightPlayers);

                double precision = fight.CalculatePrecision(realmDB.RD_IsPlayerFunc(fight));

                var    attemptType = fight.GetFightData().GetAttemptType();
                string attemptStr  = "";
                if (attemptType == VF_RaidDamageDatabase.FightData.AttemptType.KillAttempt)
                {
                    attemptStr = "(kill)";
                }
                else if (attemptType == VF_RaidDamageDatabase.FightData.AttemptType.WipeAttempt)
                {
                    attemptStr = "(attempt)";
                }

                string trashPercentageStr = "<font color='#FF0000'>???</font>";
                if (precision != 0)
                {
                    double trashPercentage = precision;
                    if (precision >= 1.0)
                    {
                        precision = 1.0;
                    }
                    trashPercentageStr = PageUtility.CreateColorisedPercentage(precision);
                }
                var realm = fight.GetRaid().Realm;
                ///////////////////////
                string lootDropped = "";
                if (attemptType == VF_RaidDamageDatabase.FightData.AttemptType.KillAttempt)
                {
                    lootDropped = LootGenerator.CreateLootDroppedData(fight.GetItemDrops(), realmDB, ApplicationInstance.Instance.GetItemSummaryDatabase(), ApplicationInstance.Instance.GetItemInfo);
                }
                ///////////////////////

                tableBody += PageUtility.CreateTableRow("", PageUtility.CreateTableColumn("#" + (fight.GetRaidBossFightIndex() + 1)) +
                                                        PageUtility.CreateTableColumn(PageUtility.CreateLink("FightOverview.aspx?Raid=" + uniqueRaidID + "&Fight=" + fight.GetRaidBossFightIndex(), "<font color='#f70002'>" + fight.GetFightData().FightName + "</font>") + attemptStr) +
                                                        PageUtility.CreateTableColumn(attendingFightPlayers.Count.ToString()) +
                                                        (displayLoot == true ? PageUtility.CreateTableColumn(lootDropped) : "") +
                                                        //PageUtility.CreateTableColumn(((int)(totalValue / 1000)).ToString() + "k") +
                                                        PageUtility.CreateTableColumn(((int)fight.GetTotal((_Value) => { return(_Value.I.Death); }
                                                                                                           , (_Value) => { return(realmDB.RD_IsPlayer(_Value.Item1, fight) && _Value.Item2.I.Death > 0); })).ToString()) +
                                                        PageUtility.CreateTableColumn(fight.GetFightDuration().ToString() + " sec") +
                                                        PageUtility.CreateTableColumn(fight.GetFightData().StartDateTime.AddSeconds(fight.GetFightData().GetFightRecordDuration()).ToLocalTime().ToString("yyy-MM-dd HH:mm:ss")) +
                                                        PageUtility.CreateTableColumn(trashPercentageStr));//PageUtility.CreateTooltipText(trashPercentageStr, (bossPlusAddsDmgTaken != 0 ? bossPlusAddsDmgTaken.ToString() : "???") + "/" + totalValue.ToString())));
            }
            m_TableBodyHTML = new MvcHtmlString(tableBody);

            /////////////////////
            List <Tuple <string, VF_RealmPlayersDatabase.PlayerClass> > playersAttending = new List <Tuple <string, VF_RealmPlayersDatabase.PlayerClass> >();

            foreach (var playerName in attendingRaidPlayers.Distinct())
            {
                var playerData = realmDB.RD_FindPlayer(playerName, attendingRaidPlayers);
                if (playerData != null)
                {
                    playersAttending.Add(new Tuple <string, VF_RealmPlayersDatabase.PlayerClass>(playerName, playerData.Character.Class));
                }
            }
            string playersAttendingStr     = "<h3>Players attending(" + playersAttending.Count + "):</h3>";
            var    orderedPlayersAttending = playersAttending.OrderBy((_Value) => { return("" + (int)_Value.Item2 + _Value.Item1); });

            try
            {
                var lastClass = orderedPlayersAttending.First().Item2;
                foreach (var player in orderedPlayersAttending)
                {
                    if (lastClass != player.Item2)
                    {
                        playersAttendingStr += "<br />";
                    }
                    playersAttendingStr += PageUtility.CreateColorCodedName(player.Item1, player.Item2) + " ";
                    lastClass            = player.Item2;
                }
            }
            catch (Exception ex)
            {
            }
            /////////////////////

            var    recordedBy       = currRaid.GetRecordedByPlayers();
            string recordedByString = "";
            foreach (var playerName in recordedBy)
            {
                var playerData = realmDB.RD_FindPlayer(playerName, attendingRaidPlayers);
                if (playerData != null)
                {
                    if (recordedByString == "")
                    {
                        recordedByString += " by ";
                    }
                    recordedByString += PageUtility.CreateColorCodedName(playerData) + ", ";
                }
            }
            if (recordedByString != "")
            {
                recordedByString = recordedByString.Substring(0, recordedByString.Length - 2); //Get rid of last ", "
                if (recordedByString.Contains(", "))
                {
                    var subStr      = recordedByString.Substring(recordedByString.LastIndexOf(", "));
                    var replacement = subStr.Replace(", ", " and ");
                    recordedByString = recordedByString.Replace(subStr, replacement);
                }
            }

            var startRecordTime = orderedFights.First().GetFightData().StartDateTime.ToLocalTime();
            var endRecordTime   = orderedFights.Last().GetFightData().GetEndDateTime().ToLocalTime();

            var totalRecordTime = " (" + ((int)(endRecordTime - startRecordTime).TotalMinutes) + " minutes and " + (endRecordTime - startRecordTime).Seconds + " seconds)";

            m_RaidOverviewInfoHTML = "<h1>" + currRaid.RaidOwnerName + " vs "
                                     + currRaid.RaidInstance + "(" + currRaid.RaidID.ToString() + ")<span class='badge badge-inverse'>" + orderedFights.Count() + " fights</span></h1>"
                                     + "<p>Fights recorded" + recordedByString + " between " + startRecordTime.ToString("yyy-MM-dd HH:mm:ss") + " and "
                                     + endRecordTime.ToString("yyy-MM-dd HH:mm:ss") + totalRecordTime + "</p>" + playersAttendingStr;

            string graphStyle      = "<style>" + PageUtility.CreateStatsBars_HTML_CSSCode() + "</style>";
            string totalBossMeters = "<h2>Damage/Healing total(only bosses)</h2>" +
                                     "<p>Total for all boss fights";
            string totalTrashMeters = "<h2>Damage/Healing total(only trash)</h2>" +
                                      "<p>Total for all trash fights";

            if (filteredData == true)
            {
                totalBossMeters += ", unrealistic dmg/heal spikes are filtered. <a href='"
                                   + PageUtility.CreateUrlWithNewQueryValue(Request, "Filtered", "false")
                                   + "'>View Unfiltered</a></p><br />";
                totalTrashMeters += ", unrealistic dmg/heal spikes are filtered. <a href='"
                                    + PageUtility.CreateUrlWithNewQueryValue(Request, "Filtered", "false")
                                    + "'>View Unfiltered</a></p><br />";
            }
            else
            {
                totalBossMeters += ", unrealistic dmg/heal spikes are not filtered. <a href='"
                                   + PageUtility.CreateUrlWithNewQueryValue(Request, "Filtered", "true")
                                   + "'>View Filtered</a></p><br />";
                totalTrashMeters += ", unrealistic dmg/heal spikes are not filtered. <a href='"
                                    + PageUtility.CreateUrlWithNewQueryValue(Request, "Filtered", "true")
                                    + "'>View Filtered</a></p><br />";
            }

            totalBossMeters += GenerateTotalMeters(filteredData, orderedFights, realmDB, attendingRaidPlayers);
            if (orderedTrashFights.Count > 0)
            {
                totalTrashMeters += GenerateTotalMeters(filteredData, orderedTrashFights, realmDB, attendingRaidPlayers);
            }
            else
            {
                totalTrashMeters = "";
            }
            m_GraphSection = new MvcHtmlString(graphStyle + "<div class='blackframe'>" + totalBossMeters + "</div><br/><div class='blackframe'>" + totalTrashMeters + "</div>");

            //TRASH HANDLING
            {
                if (orderedTrashFights.Count > 0)
                {
                    System.Text.StringBuilder trashSection = new System.Text.StringBuilder(4000);

                    trashSection.Append("<div class='row'><div class='span12'><table class='table'><thead>");
                    trashSection.Append(PageUtility.CreateTableRow("",
                                                                   PageUtility.CreateTableColumnHead("Trash") +
                                                                   PageUtility.CreateTableColumnHead("Players") +
                                                                   PageUtility.CreateTableColumnHead("Player Deaths") +
                                                                   PageUtility.CreateTableColumnHead("Trash Duration")));

                    trashSection.Append("</thead><tbody>");

                    foreach (var fight in orderedTrashFights)
                    {
                        var attendingFightPlayers = fight.GetAttendingUnits((_Name) => { return(realmDB.RD_IsPlayer(_Name, attendingRaidPlayers)); });

                        var endTime = fight.GetStartDateTime().AddSeconds(fight.GetFightData().GetFightRecordDuration());
                        trashSection.Append(PageUtility.CreateTableRow("",
                                                                       PageUtility.CreateTableColumn(PageUtility.CreateLink("FightOverview.aspx?Raid=" + uniqueRaidID + "&Trash=" + fight.GetRaidBossFightIndex(), "<font color='#f70002'>" + fight.GetStartDateTime().ToLocalTime().ToString("yyyy-MM-dd HH:mm:ss") + " to " + endTime.ToLocalTime().ToString("yyyy-MM-dd HH:mm:ss") + "</font>")) +
                                                                       PageUtility.CreateTableColumn(attendingFightPlayers.Count.ToString()) +
                                                                       PageUtility.CreateTableColumn(((int)fight.GetTotal((_Value) => { return(_Value.I.Death); }
                                                                                                                          , (_Value) => { return(realmDB.RD_IsPlayer(_Value.Item1, attendingRaidPlayers) && _Value.Item2.I.Death > 0); })).ToString()) +
                                                                       PageUtility.CreateTableColumn((int)(endTime - fight.GetStartDateTime()).TotalMinutes + " min")
                                                                       ));
                    }

                    trashSection.Append("</tbody></table></div></div>");

                    m_TrashHTML = new MvcHtmlString(trashSection.ToString());
                }
            }
        }
Пример #4
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);
        }
Пример #5
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);
        }