protected void Page_Load(object sender, EventArgs e) { if (!App.loaded && !Server.MapPath(".").ToLower().Contains("loading")) { try { Response.Redirect("/Loading/", false); Context.ApplicationInstance.CompleteRequest(); } catch (System.Threading.ThreadAbortException) { } return; } if ((this.Master as MasterPage).ValidForAds()) { mAds = "<ins class=\"adsbygoogle\" style=\"display:inline-block;width:336px; height: 280px; margin: 0 auto;\" data-ad-client=\"ca-pub-5192077039791210\" data-ad-slot=\"1818372262\"></ins> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script>"; } Utility.GetTypeList(ref pmMode); imgType = Utility.GetImageType(Request, "png"); imgType2 = Utility.GetImageType(Request); this.Title = "LegacyPlayers | Armory"; //App.UpdateRaidSpecificData(); m_CharID = Int32.Parse(Utility.GetQueryString(Request, "charid", "0")); //m_GearID = Int32.Parse(Utility.GetQueryString(Request, "gearid", "0")); if (!App.m_Chars.ContainsKey(m_CharID)) { Response.Redirect("/404/"); return; } m_Me = App.GetChar(m_CharID); var preSorted = App.m_AmData[m_Me.Expansion()].Where(x => x.Value.CharID == m_CharID).OrderByDescending(x => x.Value.Uploaded); var amData = preSorted.Select(x => x.Value); // Professions if (m_Me.Expansion() > 0) { // Current spec string[] current = m_Me.RefMisc.Talents.Split(';'); int specIndex1 = 0; if (current.Length >= 4) { int s1 = 0; int s2 = 0; int s3 = 0; int.TryParse(current[1], out s1); int.TryParse(current[2], out s2); int.TryParse(current[3], out s3); if (s1 > s2 && s1 > s3) { specIndex1 = m_Me.RefMisc.Class * 3; } else if (s2 > s1 && s2 > s3) { specIndex1 = m_Me.RefMisc.Class * 3 + 1; } else if (s3 > s2 && s3 > s1) { specIndex1 = m_Me.RefMisc.Class * 3 + 2; } } // Finding a second one that is not the first one int specIndex2 = 0; string[] lastOne = null; if (preSorted.Count() > 1) { var first = preSorted.First().Key; var otherThanCurrent = preSorted.Where(x => x.Key != first); if (otherThanCurrent.Any()) { lastOne = App.m_RefMisc[m_Me.Expansion()][otherThanCurrent.First().Value.Ref_Misc].Talents.Split(';'); if (lastOne.Length >= 4) { int l1 = 0; int l2 = 0; int l3 = 0; int.TryParse(lastOne[1], out l1); int.TryParse(lastOne[2], out l2); int.TryParse(lastOne[3], out l3); if (l1 > l2 && l1 > l3) { specIndex2 = m_Me.RefMisc.Class * 3; } else if (l2 > l1 && l2 > l3) { specIndex2 = m_Me.RefMisc.Class * 3 + 1; } else if (l3 > l2 && l3 > l1) { specIndex2 = m_Me.RefMisc.Class * 3 + 2; } } } } mTalents = "<table class=\"table noborder bbdesign bigger\"> <thead> <tr>" + "<td colspan=\"2\">Talent specialization</td> </tr> </thead> <tbody> <tr> " + (current.Length < 4 ? "<td><div class=\"sp icon-32 bbdesign\" style=\"background-image: url(\'/Assets/icons/inv_misc_questionmark.jpg\')\"><div>Unknown</div></div></td>" : "<td><a href=\"/Tools/Talents/#" + current[0] + "\"><div class=\"sp icon-32 bbdesign\" style=\"background-image: url(\'/Assets/icons/" + mSpecIcons[specIndex1] + ".jpg\')\"><div>" + mSpecs[specIndex1] + " (" + current[1] + "|" + current[2] + "|" + current[3] + ")</div></div></a></td> ") + "<td>" + (lastOne == null || lastOne.Length < 4 ? "<div class=\"sp icon-32 bbdesign\" style=\"background-image: url(\'/Assets/icons/inv_misc_questionmark.jpg\')\"><div>Unknown</div></div>" : "<a href=\"/Tools/Talents/#" + lastOne[0] + "\"><div class=\"sp icon-32 bbdesign\" style=\"background-image: url(\'/Assets/icons/" + mSpecIcons[specIndex2] + ".jpg\')\"><div>" + mSpecs[specIndex2] + " (" + lastOne[1] + "|" + lastOne[2] + "|" + lastOne[3] + ")</div></div></a>") + "</td> </tr> </tbody> </table>"; } else { int cur = 1; int last = 1; string current = m_Me.RefMisc.Talents; var first = preSorted.First().Key; var otherThanCurrent = preSorted.Where(x => x.Key != first); string lastOne = "0"; if (otherThanCurrent.Any()) { lastOne = otherThanCurrent.First().Value.Ref_Misc == 0 ? "0" : App.m_RefMisc[m_Me.Expansion()][otherThanCurrent.First().Value.Ref_Misc].Talents; } int.TryParse(lastOne, out last); int.TryParse(current, out cur); mTalents = "<table class=\"table noborder bbdesign bigger\"> <thead> <tr>" + "<td colspan=\"2\">Talent specialization</td> </tr> </thead> <tbody> <tr> " + (current == "0" ? "<td><div class=\"sp icon-32 bbdesign\" style=\"background-image: url(\'/Assets/icons/inv_misc_questionmark.jpg\')\"><div>Unknown</div></div></td>" : "<td><div class=\"sp icon-32 bbdesign\" style=\"background-image: url(\'/Assets/icons/" + mSpecIcons[cur - 1] + ".jpg\')\"><div>" + mSpecs[cur - 1] + "</div></div></td> ") + "<td>" + (lastOne == "0" ? "<div class=\"sp icon-32 bbdesign\" style=\"background-image: url(\'/Assets/icons/inv_misc_questionmark.jpg\')\"><div>Unknown</div></div>" : "<div class=\"sp icon-32 bbdesign\" style=\"background-image: url(\'/Assets/icons/" + mSpecIcons[last - 1] + ".jpg\')\"><div>" + mSpecs[last - 1] + "</div></div>") + "</td> </tr> </tbody> </table>"; } // Professions mProfs = "<table class=\"table noborder bbdesign bigger\"> <thead> <tr> " + "<td colspan=\"2\">Professions</td> </tr> </thead> <tbody> <tr> " + "<td><div class=\"sp icon-32 bbdesign\" style=\"background-image: url(\'/Assets/icons/" + mProfIconList[m_Me.Prof1] + ".jpg\')\"><div>" + mProfNameList[m_Me.Prof1] + "</div></div></td> " + "<td><div class=\"sp icon-32 bbdesign\" style=\"background-image: url(\'/Assets/icons/" + mProfIconList[m_Me.Prof2] + ".jpg\')\"><div>" + mProfNameList[m_Me.Prof2] + "</div></div></td> " + "</tr> </tbody> </table>"; m_GearID = m_Me.RefGear.GearId; // Getting the last 3 itemsets int rankingMode = 0; if (IsPostBack) { Int32.TryParse(itemsets.Value, out m_GearID); Int32.TryParse(pmMode.Value, out rankingMode); } itemsets.Items.Clear(); var sets = amData.GroupBy(x => x.Ref_Gear).Take(5) .ToArray(); for (int i = 0; i < sets.Length; ++i) { itemsets.Items.Add(new ListItem("Itemset " + i, sets[i].Key.ToString())); } itemsets.SelectedIndex = itemsets.Items.IndexOf(itemsets.Items.FindByValue(m_GearID.ToString())); if (m_GearID == 0 || !App.m_RefGear[m_Me.Expansion()].ContainsKey(m_GearID)) { m_Gear = m_Me.RefGear; } else { m_Gear = App.m_RefGear[m_Me.Expansion()][m_GearID]; } int[] itemparts = Utility.GetCookie(Request, "viewhead", "0") != "true" ? new[] { 0, 2, 4, 3, 18, 8, 9, 5, 6, 7, 15, 16 } : new[] { 2, 4, 3, 18, 8, 9, 5, 6, 7, 15, 16 }; foreach (int i in itemparts) { if (m_Gear.Slots[i].ItemID <= 0) { continue; } // [3, 58860], [16, 48190], [5, 60895], [19, 58700], [9, 61476], [10, 60915], [6, 61471], [7, 60898], [8, 61473], [13, 30606], [14, 51721] if (m_ItemDisplayArr == "") { m_ItemDisplayArr = "[" + (i + 1) + "," + App.m_ItemDisplayID[m_Gear.Slots[i].ItemID] + "]"; } else { m_ItemDisplayArr += ", [" + (i + 1) + "," + App.m_ItemDisplayID[m_Gear.Slots[i].ItemID] + "]"; } } // Guild history var guilds = amData.Where(x => x.Ref_Guild > 0).GroupBy(x => x.Ref_Guild).Take(5); foreach (IGrouping <int, DB_am_data> t in guilds) { m_GuildHistory.Append("<tr><td><div class=\"sp icon-32\" style=\"background-image: url('/Assets/raids/fac" + App.m_Guilds[App.m_RefGuild[m_Me.Expansion()][t.Key].GuildID].Faction + "." + imgType + "')\"><div>" + App.m_Guilds[App.m_RefGuild[m_Me.Expansion()][t.Key].GuildID].Name + "</div></div></td>"); m_GuildHistory.Append("<td>" + App.m_RefGuild[m_Me.Expansion()][t.Key].GrankName + " (" + App.m_RefGuild[m_Me.Expansion()][t.Key].GrankIndex + ")</td></tr>"); } // Attended raids SQLWrapper DB = App.GetDB(m_Me.Expansion() + 1); MySqlDataReader dr = DB.Query( "SELECT b.instanceid FROM rs_participants a " + "LEFT JOIN rs_instance_uploader b ON a.uploaderid = b.id " + "WHERE a.charid = " + m_CharID + " GROUP BY b.instanceid ORDER BY b.instanceid DESC LIMIT 5").ExecuteReaderRpll(); while (dr.Read()) { // Finding the raid foreach (var raid in App.mRSInstances[m_Me.Expansion()]) { if (raid.mId != dr.GetInt32(0)) { continue; } m_AttendedRaidsTable.Append("<tr><td>" + App.m_Instances[raid.mInstanceId].Name + "</td>" + "<td><a href=\"/Raids/Viewer/?id=" + raid.mId + "&exp=" + m_Me.Expansion() + "\">" + DateTimeOffset.FromUnixTimeMilliseconds(raid.mEnd).UtcDateTime + "</a></td></tr>"); break; } } dr.CloseRpll(); // Item history // This might be very slow the more data gets added, gotta watch this! Dictionary <int, bool> tempDone = new Dictionary <int, bool>(); Dictionary <int, bool> tempDone2 = new Dictionary <int, bool>(); List <string> m_HackItemHistory = new List <string>(); var amDataAsc = amData.Where(x => x.Ref_Gear > 0).OrderBy(x => x.Uploaded).ToArray(); foreach (DB_am_data t in amDataAsc) { if (tempDone.ContainsKey(t.Ref_Gear)) { continue; } var date = DateTimeOffset.FromUnixTimeMilliseconds(t.Uploaded).UtcDateTime; string someHackStr = ""; for (int p = 0; p < 19; ++p) { var item = App.m_RefGear[m_Me.Expansion()][t.Ref_Gear].Slots[p]; if (item.ItemID <= 0 || tempDone2.ContainsKey(item.ItemID)) { continue; } someHackStr += "<div class=\"item-template-32 qe" + item.Item(m_Me.Expansion()).Quality + "\" style=\"background-image: url('/Assets/icons/" + item.Item(m_Me.Expansion()).IconName + "." + imgType2 + "');\"><a href=\"/Armory/Item/?i=" + item.ItemID + "&exp=" + m_Me.Expansion() + "\">" + item.Item(m_Me.Expansion()).Quantity(m_Me.ServerID) + "</a><a href=\"/Raids/Loot/?i=" + item.ItemID + "&exp=" + m_Me.Expansion() + "\"><div onmouseover=\"tt_show(this, 1, " + item.ItemID + ",[]," + m_Me.Expansion() + ")\"></div></a></div>"; tempDone2[item.ItemID] = true; } if (someHackStr != "") { someHackStr = "<tr><td>" + someHackStr + "</td><td>" + date.Month + "/" + date.Day + "/" + date.Year + "</td></tr>"; m_HackItemHistory.Add(someHackStr); } tempDone[t.Ref_Gear] = true; } for (int i = m_HackItemHistory.Count - 1; i >= 0 && i > m_HackItemHistory.Count - 10; --i) { m_ItemHistoryTable.Append(m_HackItemHistory[i]); } // Rankings var rankingData = App.m_Rankings.Where(x => x.Type == rankingMode && x.CharID == m_CharID).OrderByDescending(x => x.InstanceID).ThenBy(x => x.NpcID); short someInstance = 0; foreach (var row in rankingData) { if (someInstance != row.InstanceID && someInstance != 0) { m_Rankings.Append("</tbody></table>"); } if (someInstance != row.InstanceID) { m_Rankings.Append("<table class=\"table noborder bbdesign\"><thead><tr><td colspan=\"6\">" + App.m_Instances[row.InstanceID].Name + "<div class=\"arrowdown\" onclick=\"ToggleRecordMenu('inst" + row.InstanceID + "')\">" + "</div></td></tr><tr><td>All</td><td>Class</td><td>Type</td><td>Best</td><td>Avg</td><td>Encounter</td></tr></thead>" + "<tbody id=\"inst" + row.InstanceID + "\" " + ((someInstance == 0) ? "style=\"display: table-header-group;\">" : "")); } someInstance = row.InstanceID; if (row.Best.Value > 5000) { m_Rankings.Append("<tr><td><a href=\"/Raids/Ranking/?npc=" + row.NpcID + "&exp=" + m_Me.Expansion() + "\">" + row.GetRank() + "</a></td><td><a href=\"/Raids/Ranking/?npc=" + row.NpcID + "&class=" + m_Me.RefMisc.Class + "&exp=" + m_Me.Expansion() + "\">" + row.GetClassRank() + "</a></td>" + "<td>" + ((row.Type == 0) ? "DPS" : row.Type == 1 ? "HPS" : "TPS") + "</td><td><a href=\"/Raids/Viewer/?atmt=" + row.Best.Attempt + "&exp=" + m_Me.Expansion() + "\">" + Math.Round(1000.0 * row.Best.Value / (row.Best.Time * (row.Type == 2 ? 100.0 : 1.0)), 1) + "</a></td>" + "<td>" + Math.Round(row.GetAverage() / (1000.0 * (row.Type == 2 ? 100.0 : 1.0)), 1) + "</td><td>" + App.m_Npcs[m_Me.Expansion()][row.NpcID].Name + "</td></tr>"); } } m_Rankings.Append("</tbody></table>"); // PvP Information if (m_Me.RefHonor == null) { return; } // Lifetime rank m_LifeTimeRank = m_Me.LifeTimeRank; // Today if (DateTimeOffset.FromUnixTimeMilliseconds(App.GetArmoryData(m_Me.LatestUpdate).Uploaded).Date == DateTime.Today) { foreach (var data in amData) { TimeSpan span = DateTime.Today - DateTimeOffset.FromUnixTimeMilliseconds(data.Uploaded).Date; if (span == TimeSpan.FromDays(1) && App.m_RefHonor[m_Me.Expansion()].ContainsKey(data.Ref_Honor)) { m_Today.HK = m_Me.RefHonor.HK - App.m_RefHonor[m_Me.Expansion()][data.Ref_Honor].HK; m_Today.DK = m_Me.RefHonor.DK - App.m_RefHonor[m_Me.Expansion()][data.Ref_Honor].DK; m_Today.Honor = m_Me.RefHonor.Honor - App.m_RefHonor[m_Me.Expansion()][data.Ref_Honor].Honor; break; } if (span > TimeSpan.FromDays(1)) { break; } } } // Yesterday DB_am_data yesterday = null; foreach (var data in amData) { TimeSpan span = DateTime.Today - DateTimeOffset.FromUnixTimeMilliseconds(data.Uploaded).Date; if (yesterday == null && span == TimeSpan.FromDays(2)) { yesterday = data; continue; } if (yesterday != null && span == TimeSpan.FromDays(3) && App.m_RefHonor[m_Me.Expansion()].ContainsKey(yesterday.Ref_Honor) && App.m_RefHonor[m_Me.Expansion()].ContainsKey(data.Ref_Honor)) { m_Yesterday.HK = App.m_RefHonor[m_Me.Expansion()][yesterday.Ref_Honor].HK - App.m_RefHonor[m_Me.Expansion()][data.Ref_Honor].HK; m_Yesterday.DK = App.m_RefHonor[m_Me.Expansion()][yesterday.Ref_Honor].DK - App.m_RefHonor[m_Me.Expansion()][data.Ref_Honor].DK; m_Yesterday.Honor = App.m_RefHonor[m_Me.Expansion()][yesterday.Ref_Honor].Honor - App.m_RefHonor[m_Me.Expansion()][data.Ref_Honor].Honor; break; } if (yesterday == null && span > TimeSpan.FromDays(2)) { break; } } // This week long lastReset = Utility.ConvertToTimestamp(DateTime.Today .AddDays(-(int)DateTime.Today.DayOfWeek - 7 + App.m_Server[m_Me.ServerID].PvPReset).ToUniversalTime()); DB_am_data thisWeekMark = null; foreach (var data in amData) { if (data.Uploaded >= lastReset && App.m_RefHonor[m_Me.Expansion()].ContainsKey(data.Ref_Honor)) { m_ThisWeek.HK = m_Me.RefHonor.HK - App.m_RefHonor[m_Me.Expansion()][data.Ref_Honor].HK; m_ThisWeek.DK = m_Me.RefHonor.DK - App.m_RefHonor[m_Me.Expansion()][data.Ref_Honor].DK; m_ThisWeek.Honor = m_Me.RefHonor.Honor - App.m_RefHonor[m_Me.Expansion()][data.Ref_Honor].Honor; } else { thisWeekMark = data; break; } } // last week if (thisWeekMark != null) { long lastReset2 = Utility.ConvertToTimestamp(DateTime.Today .AddDays(-(int)DateTime.Today.DayOfWeek - 7 + App.m_Server[m_Me.ServerID].PvPReset).ToUniversalTime()); foreach (var data in amData) { if (m_LastWeek.Honor == 0 && data.Uploaded >= lastReset2 && data.Uploaded < lastReset && App.m_RefHonor[m_Me.Expansion()].ContainsKey(data.Ref_Honor)) { m_LastWeek = App.m_RefHonor[m_Me.Expansion()][data.Ref_Honor]; m_CurrentWeekChange = (int)(m_Me.RefHonor.Rank * 5000.0 + 5000.0 * m_Me.RefHonor.Progress / 1000.0 - m_LastWeek.Rank * 5000 + 5000.0 * m_LastWeek.Progress / 1000.0); continue; } if (data.Uploaded < lastReset2 && App.m_RefHonor[m_Me.Expansion()].ContainsKey(data.Ref_Honor)) { m_LastWeekChange = (int)(m_LastWeek.Rank * 5000.0 + 5000.0 * m_LastWeek.Progress / 1000.0 - App.m_RefHonor[m_Me.Expansion()][data.Ref_Honor].Rank * 5000 + 5000.0 * App.m_RefHonor[m_Me.Expansion()][data.Ref_Honor].Progress / 1000.0); break; } } } if (m_CurrentWeekChange == 0) { m_CurrentWeekChange = (int)(m_Me.RefHonor.Progress / 1000.0 * 5000.0); } }
protected void Page_Load(object sender, EventArgs e) { if (!App.loaded && !Server.MapPath(".").ToLower().Contains("loading")) { try { Response.Redirect("/Loading/", false); Context.ApplicationInstance.CompleteRequest(); } catch (System.Threading.ThreadAbortException) { } return; } this.Title = "LegacyPlayers | Ranking"; Int32.TryParse(Utility.GetQueryString(Request, "page", "0"), out m_CurPage); //App.UpdateRaidSpecificData(); Utility.GetFactionList(ref pmFaction); Utility.GetClassList(ref pmClass); Utility.GetExpansionList(ref pmExpansion); if (IsPostBack) { Utility.SetCookie(Response, Request, "Ranking_Selection", Utility.SecureInput(pmSelection.Value)); Utility.SetCookie(Response, Request, "Ranking_Faction", Utility.SecureInput(pmFaction.Value)); Utility.SetCookie(Response, Request, "Ranking_Class", Utility.SecureInput(pmClass.Value)); //Utility.SetCookie(Response, Request, "Ranking_Type", Utility.SecureInput(pmType.Value)); Utility.SetCookie(Response, Request, "Ranking_Realm", Utility.SecureInput(pmRealm.Value)); Utility.SetCookie(Response, Request, "Ranking_Expansion", Utility.SecureInput(pmExpansion.Value)); Utility.SetCookie(Response, Request, "Ranking_Encounter", Utility.SecureInput(pmEncounter.Value)); m_EncounterVal = Utility.SecureInput(pmEncounter.Value); } else { pmSelection.Value = Utility.SecureInput(Utility.GetCookie(Request, "Ranking_Selection", "0")); pmFaction.Value = Utility.SecureInput(Utility.GetCookie(Request, "Ranking_Faction", "0")); pmClass.Value = Utility.SecureInput(Utility.GetCookie(Request, "Ranking_Class", "0")); //pmType.Value = Utility.SecureInput(Utility.GetCookie(Request, "Ranking_Type", "0")); pmRealm.Value = Utility.SecureInput(Utility.GetCookie(Request, "Ranking_Realm", "0")); pmExpansion.Value = Utility.SecureInput(Utility.GetCookie(Request, "Ranking_Expansion", "0")); m_EncounterVal = Utility.SecureInput(Utility.GetCookie(Request, "Ranking_Encounter", "00000000000000000001111111111")); } expansion = int.Parse(Utility.GetQueryString(Request, "exp", "") == "" ? pmExpansion.Value : Utility.GetQueryString(Request, "exp", "0")); Utility.GetRealmList(ref pmRealm, false, expansion); if (Utility.GetQueryString(Request, "exp", "") != "") { pmExpansion.Value = Utility.GetQueryString(Request, "exp", "0"); } GetEncounterList(ref pmEncounter); var getNPCId = Utility.GetQueryString(Request, "npcid", ""); if (getNPCId != "") { pmSelection.Value = "1"; if (!IsPostBack) { Utility.SetCookie(Response, Request, "Ranking_Selection", "1"); } pmEncounter.Value = GetEncounterValue(Utility.SecureInput(getNPCId)); if (!IsPostBack) { Utility.SetCookie(Response, Request, "Ranking_Encounter", Utility.SecureInput(pmEncounter.Value)); } } var getClassId = Utility.GetQueryString(Request, "class", ""); if (getClassId != "") { pmClass.Value = (Int32.Parse(Utility.SecureInput(getClassId)) + 1).ToString(); if (!IsPostBack) { Utility.SetCookie(Response, Request, "Ranking_Class", Utility.SecureInput(pmClass.Value)); } } var searchSpace = (pmSelection.Value == "1") ? GetSearchSpace(0).OrderByDescending(x => 1000.0 * x.Best.Value / (x.Best.Time / 1000.0)).ToArray() : GetSearchSpace(0).OrderByDescending(x => x.GetAverage()).ToArray(); var imgType = Utility.GetImageType(Request, "png"); if (searchSpace.Length > 0) { var bestValue = (pmSelection.Value == "1") ? 1000000.0 * searchSpace[0].Best.Value / searchSpace[0].Best.Time : searchSpace[0].GetAverage(); int count = m_CurPage * 30; foreach (var entry in searchSpace.Skip(m_CurPage * 30).Take(30)) { DBChars user = App.GetChar(entry.CharID); int value, time, attempt; uint killed; if (pmSelection.Value == "0") { value = entry.GetAverage(); time = (int)entry.Average.Average(x => x.Time); killed = entry.Average[0].Killed; attempt = entry.Average[0].Attempt; } else { value = (int)(1000.0 * entry.Best.Value / (entry.Best.Time / 1000.0)); time = entry.Best.Time; killed = entry.Best.Killed; attempt = entry.Best.Attempt; } m_Table.Append("<tr class=\"tabf" + user.Faction + "\"><td>" + ++count + "</td><td><div class=\"sp\" style=\"background-image:url(/Assets/racegender/" + user.RefMisc.Gender + "-" + user.RefMisc.Race + "." + imgType + ")\"></div><div class=\"sp\" style=\"background-image:url(/Assets/classes/ccc" + user.RefMisc.Class + "." + imgType + ")\"></div>" + "<div class=\"tstatusbar bgcolor-c" + user.RefMisc.Class + "\" style=\"width: " + (92.5 * value / bestValue) + "%;\">" + "<div onmouseover=\"tt_show(this, 5, " + user.CharId + ", [])\"><a href=\"/Armory/?charid=" + user.CharId + "\">" + user.Name + "</a> (" + Math.Round(time / 1000.0, 2) + " seconds) (" + App.m_Server[user.ServerID].Name + ") </div>" + "<div><a href=\"/Raids/Viewer/?atmt=" + attempt + "&exp=" + expansion + "\">" + Math.Round(value / 1000.0, 1) + "/s</a></div></div></td>" + //"<td><a href=\"/Raids/Viewer/?atmt="+attempt+"\">"+DateTimeOffset.FromUnixTimeSeconds(killed).UtcDateTime+"</a></td>" + "</tr>"); } } // HPS searchSpace = (pmSelection.Value == "1") ? GetSearchSpace(1).OrderByDescending(x => 1000.0 * x.Best.Value / (x.Best.Time / 1000.0)).ToArray() : GetSearchSpace(1).OrderByDescending(x => x.GetAverage()).ToArray(); if (searchSpace.Length > 0) { var bestValue = (pmSelection.Value == "1") ? 1000000.0 * searchSpace[0].Best.Value / searchSpace[0].Best.Time : searchSpace[0].GetAverage(); var count = m_CurPage * 30; foreach (var entry in searchSpace.Skip(m_CurPage * 30).Take(30)) { DBChars user = App.GetChar(entry.CharID); int value, time, attempt; uint killed; if (pmSelection.Value == "0") { value = entry.GetAverage(); time = (int)entry.Average.Average(x => x.Time); killed = entry.Average[0].Killed; attempt = entry.Average[0].Attempt; } else { value = (int)(1000.0 * entry.Best.Value / (entry.Best.Time / 1000.0)); time = entry.Best.Time; killed = entry.Best.Killed; attempt = entry.Best.Attempt; } m_Table2.Append("<tr class=\"tabf" + user.Faction + "\"><td>" + ++count + "</td><td><div class=\"sp\" style=\"background-image:url(/Assets/racegender/" + user.RefMisc.Gender + "-" + user.RefMisc.Race + "." + imgType + ")\"></div><div class=\"sp\" style=\"background-image:url(/Assets/classes/ccc" + user.RefMisc.Class + "." + imgType + ")\"></div>" + "<div class=\"tstatusbar bgcolor-c" + user.RefMisc.Class + "\" style=\"width: " + (92.5 * value / bestValue) + "%;\">" + "<div onmouseover=\"tt_show(this, 5, " + user.CharId + ", [])\"><a href=\"/Armory/?charid=" + user.CharId + "\">" + user.Name + "</a> (" + Math.Round(time / 1000.0, 2) + " seconds) (" + App.m_Server[user.ServerID].Name + ") </div>" + "<div><a href=\"/Raids/Viewer/?atmt=" + attempt + "\">" + Math.Round(value / 1000.0, 1) + "/s</a></div></div></td>" + //"<td><a href=\"/Raids/Viewer/?atmt="+attempt+"\">"+DateTimeOffset.FromUnixTimeSeconds(killed).UtcDateTime+"</a></td>" + "</tr>"); } } // TPS searchSpace = (pmSelection.Value == "1") ? GetSearchSpace(2).OrderByDescending(x => 1000.0 * x.Best.Value / (x.Best.Time / 1000.0)).ToArray() : GetSearchSpace(2).OrderByDescending(x => x.GetAverage()).ToArray(); if (searchSpace.Length > 0) { var bestValue = (pmSelection.Value == "1") ? 1000000.0 * searchSpace[0].Best.Value / searchSpace[0].Best.Time : searchSpace[0].GetAverage(); var count = m_CurPage * 30; foreach (var entry in searchSpace.Skip(m_CurPage * 30).Take(30)) { DBChars user = App.GetChar(entry.CharID); int value, time, attempt; uint killed; if (pmSelection.Value == "0") { value = entry.GetAverage(); time = (int)entry.Average.Average(x => x.Time); killed = entry.Average[0].Killed; attempt = entry.Average[0].Attempt; } else { value = (int)(1000.0 * entry.Best.Value / (entry.Best.Time / 1000.0)); time = entry.Best.Time; killed = entry.Best.Killed; attempt = entry.Best.Attempt; } m_Table3.Append("<tr class=\"tabf" + user.Faction + "\"><td>" + ++count + "</td><td><div class=\"sp\" style=\"background-image:url(/Assets/racegender/" + user.RefMisc.Gender + "-" + user.RefMisc.Race + "." + imgType + ")\"></div><div class=\"sp\" style=\"background-image:url(/Assets/classes/ccc" + user.RefMisc.Class + "." + imgType + ")\"></div>" + "<div class=\"tstatusbar bgcolor-c" + user.RefMisc.Class + "\" style=\"width: " + (92.5 * value / bestValue) + "%;\">" + "<div onmouseover=\"tt_show(this, 5, " + user.CharId + ", [])\"><a href=\"/Armory/?charid=" + user.CharId + "\">" + user.Name + "</a> (" + Math.Round(time / 1000.0, 2) + " seconds) (" + App.m_Server[user.ServerID].Name + ") </div>" + "<div><a href=\"/Raids/Viewer/?atmt=" + attempt + "\">" + Math.Round(value / 100000.0, 1) + "/s</a></div></div></td>" + //"<td><a href=\"/Raids/Viewer/?atmt="+attempt+"\">"+DateTimeOffset.FromUnixTimeSeconds(killed).UtcDateTime+"</a></td>" + "</tr>"); } } }
protected void Page_Load(object sender, EventArgs e) { if (!App.loaded && !Server.MapPath(".").ToLower().Contains("loading")) { try { Response.Redirect("/Loading/", false); Context.ApplicationInstance.CompleteRequest(); } catch (System.Threading.ThreadAbortException) { } return; } this.Title = "LegacyPlayers | Loot: Item"; var imgType = Utility.GetImageType(Request, "png"); m_CurPage = Int32.Parse(Utility.GetQueryString(Request, "page", "0")); int.TryParse(Utility.GetQueryString(Request, "item", "0"), out m_ItemID); int toLeft = 0; if (m_CurPage >= 10) { toLeft = m_CurPage - 10; } for (int i = toLeft; i < toLeft + 22; ++i) // Sometimes there may not that many pages { if (i != m_CurPage) { m_PageBar.Append("<a href=\"?page=" + i + "&item=" + m_ItemID + "\"><div class=\"bbdesign placeholder\" >" + (i + 1) + "</div></a>"); } else { m_PageBar.Append("<a href=\"?page=" + i + "&item=" + m_ItemID + "\"><div class=\"bbdesign placeholder\" style=\"color:#f28f45\">" + (i + 1) + "</div></a>"); } } if (m_ItemID == 0) { return; } for (int i = 0; i < 2; ++i) { SQLWrapper db = App.GetDB(i + 1); MySqlDataReader dr = db .Query( "SELECT a.targetid, d.`guildid`, b.`npcid`, ROUND((d.start + b.end)/1000), a.`attemptid`, d.instanceid FROM rs_loot a " + "LEFT JOIN rs_attempts b ON a.`attemptid` = b.`id` " + "LEFT JOIN rs_instance_uploader c ON a.`uploaderid` = b.`uploaderid` " + "LEFT JOIN rs_instances d ON c.`instanceid` = d.`id`" + "WHERE a.itemid = " + m_ItemID).ExecuteReaderRpll(); while (dr.Read()) { m_Loot.Add(new DB_Loot() { CharID = dr.GetInt32(0), GuildID = dr.GetInt32(1), NpcID = dr.GetInt32(2), TimeStamp = (uint)dr.GetInt64(3), AttemptID = dr.GetInt32(4), InstanceID = dr.GetInt16(5) }); } dr.CloseRpll(); } var query = m_Loot.OrderByDescending(x => x.TimeStamp).Skip(m_CurPage * 20).Take(20); foreach (var recent in query) { DBChars cr = App.GetChar(recent.CharID); m_RecentTable.Append("<tr class=\"tabf" + App.GetGuild(recent.GuildID).Faction + "\"><td><div class=\"sp bbdesign\" style=\"background-image:url(/Assets/raids/" + recent.InstanceID + "." + imgType + ")\">" + "<div>" + App.GetNpc(recent.NpcID, recent.InstanceID > 31 ? 1 : 0).Name + "</div></div></td>" + "<td><a href=\"/Armory/Guild/?guilid=" + recent.GuildID + "\" onmouseover=\"tt_show(this, 4, " + recent.GuildID + ",[])\">" + App.GetGuild(recent.GuildID).Name + "</a></td>" + "<td><a href=\"/Raids/?atmt=" + recent.AttemptID + "\">" + DateTimeOffset.FromUnixTimeSeconds(recent.TimeStamp).UtcDateTime + "</a></td></tr>"); m_PlayerTable.Append("<tr class=\"tabf" + App.GetGuild(recent.GuildID).Faction + "\"><td><div class=\"sp bbdesign\" style=\"background-image:url(/Assets/racegender/" + cr.RefMisc.Gender + "-" + cr.RefMisc.Race + "." + imgType + ")\"></div><div class=\"sp bbdesign\" style=\"background-image:url(/Assets/classes/ccc" + cr.RefMisc.Class + "." + imgType + ")\">" + "<div><a href=\"/Armory/?charid=" + recent.CharID + "\" class=\"color-c" + cr.RefMisc.Class + "\" onmouseover=\"tt_show(this, 5, " + recent.CharID + ",[])\">" + cr.Name + "</div></div></td>" + "<td><a href=\"/Armory/Guild/?guilid=" + cr.RefGuild.GuildID + "\" onmouseover=\"tt_show(this, 4, " + cr.RefGuild.GuildID + ",[])\">" + App.GetGuild(cr.RefGuild.GuildID).Name + "</a></td>" + "<td>" + App.m_Server[cr.ServerID].Name + "</td>" + "<td><a href=\"/Raids/?atmt=" + recent.AttemptID + "\">" + DateTimeOffset.FromUnixTimeSeconds(recent.TimeStamp).UtcDateTime + "</a></td></tr>"); } }