//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) { 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>"); }