示例#1
0
        public static string GenerateTotalMeters(bool filteredData, List <VF_RaidDamageDatabase.RaidBossFight> orderedFights, VF_RaidDamageDatabase.RealmDB realmDB, List <string> attendingRaidPlayers)
        {
            string graphSection = "";
            List <Tuple <string, VF_RaidDamageDatabase.UnitData> > fullUnitDatas = new List <Tuple <string, VF_RaidDamageDatabase.UnitData> >();

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

                string dmgThreatSection    = "<div class='span4' style='min-width: 460px;'>";
                string healSection         = "<div class='span4' style='min-width: 460px;'>";
                int    totalBarsCount      = 0;
                int    totalFightDurations = 0;
                foreach (var fight in orderedFights)
                {
                    List <Tuple <string, VF_RaidDamageDatabase.UnitData> > unitsData = null;
                    if (filteredData == true)
                    {
                        unitsData = fight.GetFilteredPlayerUnitsDataCopy(true, realmDB.RD_GetPlayerIdentifierFunc(fight));
                    }
                    else
                    {
                        unitsData = fight.GetUnitsDataCopy(true);
                    }
                    var petData = fight.GetFilteredPetUnitsData();
                    List <Tuple <string, VF_RaidDamageDatabase.UnitData> > abusingPets = new List <Tuple <string, VF_RaidDamageDatabase.UnitData> >();
                    foreach (var unitPet in petData)
                    {
                        if (fight.GetFightCacheData().m_FightDataCollection.m_RaidMembers.Contains(unitPet.Item1.Split('(').First()) == true)
                        {
                            //Player with Pet UnitPet should be banned from damagemeter or has its damage purged
                            string abusingPlayer = unitPet.Item1.Split(new string[] { "(Pet for ", ")" }, StringSplitOptions.RemoveEmptyEntries)[1];
                            abusingPets.Add(Tuple.Create(abusingPlayer, unitPet.Item2));
                        }
                    }
                    unitsData.AddRange(petData);
                    foreach (var unit in unitsData)
                    {
                        int index         = fullUnitDatas.FindIndex((_Value) => { return(_Value.Item1 == unit.Item1); });
                        var unitFightData = unit.Item2.CreateCopy();
                        var petsAbused    = abusingPets.FindAll((_Value) => { return(_Value.Item1 == unit.Item1); });
                        if (petsAbused != null && petsAbused.Count > 0)
                        {
                            foreach (var petAbused in petsAbused)
                            {
                                unitFightData.SubtractUnitData(petAbused.Item2);
                            }
                        }
                        if (index == -1)
                        {
                            fullUnitDatas.Add(new Tuple <string, VF_RaidDamageDatabase.UnitData>(unit.Item1, unitFightData));
                        }
                        else
                        {
                            fullUnitDatas[index].Item2.AddUnitData(unitFightData);
                        }
                    }
                    totalFightDurations += fight.GetFightDuration();
                }

                foreach (var dataPresentTypeInfo in m_DataPresentTypeInfoList)
                {
                    var sortedUnits = fullUnitDatas.OrderByDescending((_Unit) => { return(dataPresentTypeInfo.m_GetValue(_Unit.Item2)); });
                    if (sortedUnits.Count() > 0)
                    {
                        List <PageUtility.StatsBarData> statsBars = new List <PageUtility.StatsBarData>();
                        //string newBossSection = "";
                        double totalValue = 0;
                        double maxValue   = 0;
                        VF_RaidDamageDatabase.UnitData.CalculateTotalAndMax(fullUnitDatas.AsReadOnly(), dataPresentTypeInfo.m_GetValue
                                                                            , (_Value) => { return(realmDB.RD_IsPlayer(_Value.Item1, attendingRaidPlayers) && dataPresentTypeInfo.m_ValidCheck(_Value.Item2)); }
                                                                            , out totalValue, out maxValue);
                        //newBossSection += "VF_CreateDmgBar(1.0, '#000000', '" + dataPresentTypeInfo.m_TypeName + "','#ffffff', '" + (totalValue / 1000).ToString("0.0", System.Globalization.CultureInfo.InvariantCulture) + "k total');";
                        int players = 0;
                        foreach (var unit in sortedUnits)
                        {
                            var    playerData = realmDB.RD_FindPlayer(unit.Item1, attendingRaidPlayers);
                            double currValue  = dataPresentTypeInfo.m_GetValue(unit.Item2);
                            if (playerData != null && currValue > 0 && dataPresentTypeInfo.m_ValidCheck(unit.Item2))
                            {
                                double percentage = (double)currValue / totalValue;

                                double displayPercentage = percentage / (maxValue / totalValue);
                                //percentage *= maxValue;
                                //if (players < dataPresentTypeInfo.m_Count)
                                {
                                    ++players;
                                    string classColor = "#CCCCCC";
                                    classColor = RealmPlayersServer.Code.Resources.VisualResources._ClassColors[playerData.Character.Class];
                                    //newBossSection += "VF_CreateDmgBar(" + displaypercentage.ToString(System.Globalization.CultureInfo.InvariantCulture) + ", '" + classColor + "', '<player," + unit.Item1 + ">" + unit.Item1 + "(" + (currValue / totalFightDurations).ToString("0.0", System.Globalization.CultureInfo.InvariantCulture) + "/s)','#000000', '" + (int)currValue + "(" + string.Format("{0:0.0%}", percentage) + ")');";

                                    if (dataPresentTypeInfo.m_TypeName == "Deaths")
                                    {
                                        string rightSideText = "" + (int)currValue + " death" + (currValue > 1 ? "s" : "");
                                        statsBars.Add(new PageUtility.StatsBarData
                                        {
                                            m_BeforeBarText   = "#" + players,// + " " + PageUtility.CreateLink("http://realmplayers.com/CharacterViewer.aspx?realm=" + RealmPlayersServer.StaticValues.ConvertRealmParam(realmDB.Realm) + "&player=" + unit.Item1, unit.Item1),
                                            m_OnBarLeftText   = PageUtility.CreateLink_RaidStats_Player(playerData),
                                            m_BarColor        = classColor,
                                            m_PercentageWidth = displayPercentage,
                                            m_AfterBarText    = percentage.ToStringDot("0.0%"),
                                            m_OnBarRightText  = rightSideText,
                                            m_OnBarTextWidth  = StaticValues.MeasureStringLength(playerData.Name + " " + rightSideText)
                                        });
                                    }
                                    else
                                    {
                                        string rightSideText = "" + (int)currValue + "(" + (currValue / totalFightDurations).ToStringDot("0") + "/s)";
                                        statsBars.Add(new PageUtility.StatsBarData
                                        {
                                            m_BeforeBarText   = "#" + players,// + "(" + string.Format("{0:0.0%}", percentage) + ")",
                                            m_OnBarLeftText   = PageUtility.CreateLink_RaidStats_Player(playerData),
                                            m_BarColor        = classColor,
                                            m_PercentageWidth = displayPercentage,
                                            m_AfterBarText    = percentage.ToStringDot("0.0%"),
                                            m_OnBarRightText  = rightSideText,
                                            m_OnBarTextWidth  = StaticValues.MeasureStringLength(playerData.Name + " " + rightSideText)
                                        });
                                    }
                                }
                            }
                            else if (unit.Item1.Contains("(Pet for"))
                            {
                                double percentage = (double)currValue / totalValue;

                                double displayPercentage = percentage / (maxValue / totalValue);
                                //percentage *= maxValue;
                                //if (players < dataPresentTypeInfo.m_Count)
                                {
                                    ++players;
                                    string classColor = "#00FF00";
                                    //newBossSection += "VF_CreateDmgBar(" + displaypercentage.ToString(System.Globalization.CultureInfo.InvariantCulture) + ", '" + classColor + "', '<player," + unit.Item1 + ">" + unit.Item1 + "(" + (currValue / totalFightDurations).ToString("0.0", System.Globalization.CultureInfo.InvariantCulture) + "/s)','#000000', '" + (int)currValue + "(" + string.Format("{0:0.0%}", percentage) + ")');";

                                    if (dataPresentTypeInfo.m_TypeName == "Deaths")
                                    {
                                        string rightSideText = "" + (int)currValue + " death" + (currValue > 1 ? "s" : "");
                                        statsBars.Add(new PageUtility.StatsBarData
                                        {
                                            m_BeforeBarText   = "#" + players,// + " " + PageUtility.CreateLink("http://realmplayers.com/CharacterViewer.aspx?realm=" + RealmPlayersServer.StaticValues.ConvertRealmParam(realmDB.Realm) + "&player=" + unit.Item1, unit.Item1),
                                            m_OnBarLeftText   = unit.Item1,
                                            m_BarColor        = classColor,
                                            m_PercentageWidth = displayPercentage,
                                            m_AfterBarText    = percentage.ToStringDot("0.0%"),
                                            m_OnBarRightText  = rightSideText,
                                            m_OnBarTextWidth  = StaticValues.MeasureStringLength(unit.Item1 + " " + rightSideText)
                                        });
                                    }
                                    else
                                    {
                                        string rightSideText = "" + (int)currValue + "(" + (currValue / totalFightDurations).ToStringDot("0") + "/s)";
                                        statsBars.Add(new PageUtility.StatsBarData
                                        {
                                            m_BeforeBarText   = "#" + players,// + "(" + string.Format("{0:0.0%}", percentage) + ")",
                                            m_OnBarLeftText   = unit.Item1,
                                            m_BarColor        = classColor,
                                            m_PercentageWidth = displayPercentage,
                                            m_AfterBarText    = percentage.ToStringDot("0.0%"),
                                            m_OnBarRightText  = rightSideText,
                                            m_OnBarTextWidth  = StaticValues.MeasureStringLength(unit.Item1 + " " + rightSideText)
                                        });
                                    }
                                }
                            }
                        }
                        //graphSection += newBossSection;
                        totalBarsCount           += 1 + players;
                        statsBarStyle.m_TitleText = dataPresentTypeInfo.m_TypeName + "(" + (totalValue / 1000).ToStringDot("0.0") + "k)";
                        if (dataPresentTypeInfo.m_TypeName == "Deaths")
                        {
                            statsBarStyle.m_TitleText = dataPresentTypeInfo.m_TypeName + "(" + totalValue + " total)";
                        }

                        if (dataPresentTypeInfo.m_TypeName == "Damage" || dataPresentTypeInfo.m_TypeName == "Threat" || dataPresentTypeInfo.m_TypeName == "Damage Taken")
                        {
                            dmgThreatSection += PageUtility.CreateStatsBars_HTML(statsBarStyle, statsBars, dataPresentTypeInfo.m_Count);
                        }
                        else
                        {
                            healSection += PageUtility.CreateStatsBars_HTML(statsBarStyle, statsBars, dataPresentTypeInfo.m_Count);
                        }
                    }
                }
                dmgThreatSection += "</div>";
                healSection      += "</div>";
                graphSection     += "<div class='row'>" + dmgThreatSection + healSection + "</div>";
            }
            return(GeneratePlayerDeaths(realmDB, fullUnitDatas) + "<br/><br/>" + graphSection);
        }
示例#2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string        bossName        = BossesControl.GetBossFilterType();
            string        instanceName    = BossesControl.GetBossFilterType();
            List <string> bosses          = BossesControl.GetBossFilter();
            string        andPlayer       = PageUtility.GetQueryString(Request, "AndPlayer", null);
            int           showPlayerCount = PageUtility.GetQueryInt(Request, "Count", 100);

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

            this.Title = "Rankings | RaidStats";

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

            var realm = RealmControl.Realm;

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

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

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

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

            if (dataset == null)
            {
                return;
            }

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

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

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

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

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

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

            m_InfoTextHTML = new MvcHtmlString(infoText);

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

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

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

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

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

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

            m_GraphSection = new MvcHtmlString(graphSection);
        }
示例#3
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);
        }