public string GetColorClassesStr() { if (m_ClassLimits == null) { return(""); } string colorClasses = ""; foreach (var classLimit in m_ClassLimits) { colorClasses = colorClasses + PageUtility.CreateColorCodedName(classLimit.ToString(), classLimit) + ", "; } return(colorClasses.Substring(0, colorClasses.Length - 2)); }
public string GetColorFactionStr() { if (m_FactionLimits == null) { return(""); } if (m_FactionLimits.Contains(PlayerFaction.Horde)) { return(PageUtility.CreateColorCodedName("Horde", PlayerFaction.Horde)); } else if (m_FactionLimits.Contains(PlayerFaction.Alliance)) { return(PageUtility.CreateColorCodedName("Alliance", PlayerFaction.Alliance)); } else { return(""); } }
private static string GeneratePlayerDeaths(VF_RaidDamageDatabase.RealmDB realmDB, List <Tuple <string, VF_RaidDamageDatabase.UnitData> > fullUnitDatas) { var playerDeaths = new List <Tuple <int, string> >(); foreach (var data in fullUnitDatas) { if (data.Item2.I.Death > 0 || data.Item2.I.Dmg > 0 || data.Item2.I.RawHeal > 0) { playerDeaths.Add(Tuple.Create(data.Item2.I.Death, data.Item1)); } } if (playerDeaths.Count == 0) { return(""); } int totalPlayerDeaths = 0; string playerDeathsStr = ""; var orderedPlayerDeaths = playerDeaths.OrderByDescending((_Value) => _Value.Item1); int lastDeathCount = orderedPlayerDeaths.First().Item1; playerDeathsStr += lastDeathCount.ToString() + " Deaths: "; foreach (var playerDeath in orderedPlayerDeaths) { var playerData = realmDB.FindPlayer(playerDeath.Item2); if (playerData != null) { if (lastDeathCount != playerDeath.Item1) { playerDeathsStr += "<br/>" + playerDeath.Item1.ToString() + " Deaths: "; lastDeathCount = playerDeath.Item1; } playerDeathsStr += PageUtility.CreateColorCodedName(playerData) + ", "; totalPlayerDeaths += playerDeath.Item1; } } return("<h3>Player deaths(total " + totalPlayerDeaths + ")</h3>" + playerDeathsStr); }
//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()); } } }
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); }
protected void Page_Load(object sender, EventArgs e) { bool filteredData = PageUtility.GetQueryString(Request, "Filtered", "true") == "true"; int uniqueDungeonID = PageUtility.GetQueryInt(Request, "Dungeon", -1); if (uniqueDungeonID == -1) { Response.Redirect("DungeonList.aspx"); } this.Title = "Dungeon " + uniqueDungeonID + " | RaidStats"; var orderedFights = ApplicationInstance.Instance.GetDungeonBossFights(uniqueDungeonID); if (orderedFights == null || orderedFights.Count() == 0) { Response.Redirect("DungeonList.aspx"); } var realmDB = ApplicationInstance.Instance.GetRealmDB(orderedFights.First().GetDungeon().Realm); var currDungeon = orderedFights.First().GetDungeon(); if (currDungeon.Realm == VF_RealmPlayersDatabase.WowRealm.Test_Server && PageUtility.GetQueryString(Request, "Debug") == "null") { Response.Redirect("DungeonList.aspx"); } m_BreadCrumbHTML = new MvcHtmlString(PageUtility.BreadCrumb_AddHome() + PageUtility.BreadCrumb_AddDungeonList() + PageUtility.BreadCrumb_AddFinish(currDungeon.m_Dungeon + "(" + currDungeon.m_UniqueDungeonID.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("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> attendingDungeonPlayers = new List <string>(); string tableBody = ""; foreach (var fight in orderedFights) { var attendingFightPlayers = fight.GetAttendingUnits((_Name) => { return(realmDB.RD_IsPlayer(_Name, fight)); }); attendingDungeonPlayers.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.GetDungeon().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?Dungeon=" + uniqueDungeonID + "&Fight=" + fight.GetRaidBossFightIndex(), */ "<font color='#f70002'>" + fight.GetFightData().FightName + "</font>" /*)*/ + attemptStr) + PageUtility.CreateTableColumn(attendingFightPlayers.Count.ToString()) + (displayLoot == true ? PageUtility.CreateTableColumn(lootDropped) : "") + 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)); } m_TableBodyHTML = new MvcHtmlString(tableBody); ///////////////////// List <Tuple <string, VF_RealmPlayersDatabase.PlayerClass> > playersAttending = new List <Tuple <string, VF_RealmPlayersDatabase.PlayerClass> >(); foreach (var playerName in attendingDungeonPlayers.Distinct()) { var playerData = realmDB.RD_FindPlayer(playerName, attendingDungeonPlayers); 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 = currDungeon.GetRecordedByPlayers(); string recordedByString = ""; foreach (var playerName in recordedBy) { var playerData = realmDB.RD_FindPlayer(playerName, attendingDungeonPlayers); 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>\"" + currDungeon.m_GroupMembers.MergeToStringVF("\", \"") + "\" vs " + currDungeon.m_Dungeon + "(" + currDungeon.m_UniqueDungeonID.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>" + "<p><font color='red'>Did you attend this dungeon run and dont want this dungeon recording being publicly available? Send a PM to <a href='http://realmplayers.com:5555/memberlist.php?mode=viewprofile&u=2'>Dilatazu</a> on <a href='http://forum.realmplayers.com'>RealmPlayers forum</a>. Include some kind of proof that you are the player you say you are, dont forget to mention the unique DungeonID of the dungeon run. I will remove any dungeon recordings that requests to be hidden by any attending player.</font></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 += RaidOverview.GenerateTotalMeters(filteredData, orderedFights, realmDB, attendingDungeonPlayers); m_GraphSection = new MvcHtmlString(graphStyle + "<div class='blackframe'>" + totalBossMeters + "</div><br/><div class='blackframe'>" + totalTrashMeters + "</div>"); }
protected void Page_Load(object sender, EventArgs e) { m_BreadCrumbHTML = new MvcHtmlString(PageUtility.BreadCrumb_AddHome() + PageUtility.BreadCrumb_AddFinish("RareItemsList")); var realm = RealmControl.Realm; if (realm == WowRealm.Unknown) { return; } var wowVersion = StaticValues.GetWowVersion(realm); int count = PageUtility.GetQueryInt(Request, "count", 100); var itemSummaryDB = Hidden.ApplicationInstance.Instance.GetItemSummaryDatabase(); m_ItemUsageInfoHTML = new MvcHtmlString("<h1>Rarest items<span class='badge badge-inverse'>" + count + " Items</span></h1>" + "<p>List contains the most rarest items on the realm.</p>"); Dictionary <PlayerColumn, string[]> extraColumns = new Dictionary <PlayerColumn, string[]>(); PlayerColumn ItemAndAquiredDateAfterColumn = PlayerColumn.Number; extraColumns.Add(ItemAndAquiredDateAfterColumn, new string[] { "Item", "Count", "First Aquired", "First Player(s)" }); m_TableHeadHTML = new MvcHtmlString(PageUtility.CreatePlayerTableHeaderRow(Table_Columns, extraColumns)); string currentItemDatabase = DatabaseAccess.GetCurrentItemDatabaseAddress(); string tableBody = ""; int nr = 1; Func <KeyValuePair <ulong, VF_RPDatabase.ItemSummary>, int> lambdaComparison = (_Tuple) => { return(_Tuple.Value.m_ItemOwners.Count((_Value) => (itemSummaryDB.GetPlayerRealm(_Value.Item1) == realm))); }; Func <Tuple <ulong, DateTime>, DateTime> lambdaDateTimeComparison = (_Tuple) => { return(_Tuple.Item2); }; var rareItemsList = itemSummaryDB.m_Items.OrderBy(lambdaComparison); foreach (var rareItem in rareItemsList) { if (nr >= count) { break; } int rareItemCount = rareItem.Value.m_ItemOwners.Count((_Value) => (itemSummaryDB.GetPlayerRealm(_Value.Item1) == realm)); if (rareItemCount > 0 && Code.Resources.ItemAnalyzer.IsRareItem(rareItem.Value.m_ItemID) == true) { var itemInfo = DatabaseAccess.GetItemInfo(rareItem.Value.m_ItemID, wowVersion); if (itemInfo.ItemQuality < 4) { continue; } //rareItem. Player player = null; var orderedAquires = rareItem.Value.m_ItemOwners.OrderBy(lambdaDateTimeComparison); DateTime dateTimeCutoff = orderedAquires.First((_Value) => (itemSummaryDB.GetPlayerRealm(_Value.Item1) == realm)).Item2; if (dateTimeCutoff < new DateTime(2013, 8, 1, 0, 0, 0)) { dateTimeCutoff = new DateTime(2013, 8, 1, 0, 0, 0); } else { dateTimeCutoff = dateTimeCutoff.AddDays(3); } string firstPlayers = "<div style='overflow: hidden; display: table; height: 58px;'>"; var interestingItems = orderedAquires.Where((_Tuple) => { return(_Tuple.Item2 < dateTimeCutoff && (itemSummaryDB.GetPlayerRealm(_Tuple.Item1) == realm)); }); if (interestingItems.Count() < 5) { foreach (var playerAquire in interestingItems) { if (playerAquire.Item2 < dateTimeCutoff) { player = DatabaseAccess.FindRealmPlayer(this, realm, itemSummaryDB.GetPlayerName(playerAquire.Item1)); if (player != null) { var playerFaction = StaticValues.GetFaction(player.Character.Race); firstPlayers += "<div class='" + StaticValues.GetFactionCSSName(playerFaction) + "_col' style='display: table-cell; width:160px;" /*"background-color: " + (playerFaction == PlayerFaction.Horde ? "#372727" : "#272f37")*/ + "'>"; firstPlayers += "<p style='text-align:center;'><a href='CharacterViewer.aspx?realm=" + StaticValues.ConvertRealmParam(realm) + "&player=" + System.Web.HttpUtility.HtmlEncode(player.Name) + "'>" + PageUtility.CreateColorCodedName(player.Name, player.Character.Class) + "</a>"; if (player.Guild.GuildName != "nil") { string visualGuildName = PageUtility.BreakLongStr(player.Guild.GuildName, 16, 8); firstPlayers += "<br>" + PageUtility.CreateLink("GuildViewer.aspx?realm=" + StaticValues.ConvertRealmParam(realm) + "&guild=" + System.Web.HttpUtility.HtmlEncode(player.Guild.GuildName), "<" + visualGuildName + ">") + "</p>"; } firstPlayers += "</div>"; } } else { break; } } } else { firstPlayers += "Data not detailed enough<br>(more than 5 players within aquire timespan)"; } firstPlayers += "</div>"; extraColumns[ItemAndAquiredDateAfterColumn] = new string[] { "<div class='inventory' style='background: none; width: 58px; height: 58px;'><div>" + "<img class='itempic' src='" + "http://realmplayers.com/" + itemInfo.GetIconImageAddress() + "'/>" + "<div class='quality' id='" + CharacterViewer.ItemQualityConversion[itemInfo.ItemQuality] + "'></div>" + "<img class='itemframe' src='assets/img/icons/ItemNormalFrame.png'/>" + CharacterViewer.GenerateItemLink(currentItemDatabase, rareItem.Value.m_ItemID, rareItem.Value.m_SuffixID, wowVersion) + "<a class='itemplayersframe' href='ItemUsageInfo.aspx?realm=" + StaticValues.ConvertRealmParam(realm) + "&item=" + rareItem.Value.m_ItemID + (rareItem.Value.m_SuffixID != 0 ? "&suffix=" + rareItem.Value.m_SuffixID : "") + "'>" + rareItemCount.ToString() + "</a>" + "</div></div>" , rareItemCount.ToString() , " > " + interestingItems.First().Item2.ToString("yyyy-MM-dd") + "<br> < " + dateTimeCutoff.ToString("yyyy-MM-dd") , firstPlayers }; tableBody += PageUtility.CreateTableRow("", PageUtility.CreateTableColumn("#" + (nr++)) + PageUtility.CreateTableColumn(extraColumns[ItemAndAquiredDateAfterColumn][0]) + PageUtility.CreateTableColumn(extraColumns[ItemAndAquiredDateAfterColumn][1]) + PageUtility.CreateTableColumn(extraColumns[ItemAndAquiredDateAfterColumn][2]) + PageUtility.CreateTableColumn(extraColumns[ItemAndAquiredDateAfterColumn][3])); } } m_TableBodyHTML = new MvcHtmlString(tableBody); }