protected void Page_Load(object sender, EventArgs e) { string pageView = RealmPlayersServer.PageUtility.GetQueryString(Request, "view", "players"); var realm = PageUtility.GetQueryRealm(Request); if (realm == WowRealm.Unknown) { return; } var wowVersion = StaticValues.GetWowVersion(realm); string guildStr = PageUtility.GetQueryString(Request, "guild"); var realmDB = DatabaseAccess.GetRealmPlayers(this, realm); var guildSummaryDB = Hidden.ApplicationInstance.Instance.GetGuildSummaryDatabase(); var guild = guildSummaryDB.GetGuildSummary(realm, guildStr);// DatabaseAccess.GetRealmGuild(this, realm, guildStr, NotLoadedDecision.RedirectAndWait); if (guild == null) { return; } guild.GenerateCache(realmDB); this.Title = guildStr + " @ " + StaticValues.ConvertRealmParam(realm) + " | RealmPlayers"; m_ProgressInfoHTML = new MvcHtmlString("<div id='" + guild.GuildName.Replace(' ', '_') + "-Progress'></div>"); var membersArray = guild.GetMembers(); var orderedPlayersArray = membersArray.OrderBy((player) => { return(player.Item2.History.Last().GuildRankNr); }); int progressComparisonValue = 0; string guildProgressData = GuildList.CreateProgressStr(this, guild, realm, out progressComparisonValue); m_GuildScriptData = new MvcHtmlString("<script>var guildProgress = new Array();" + guildProgressData + "</script>"); if (pageView == "players") { m_BreadCrumbHTML = new MvcHtmlString(PageUtility.BreadCrumb_AddHome() + PageUtility.BreadCrumb_AddRealm(realm) + PageUtility.BreadCrumb_AddGuilds(realm) + PageUtility.BreadCrumb_AddFinish(guild.GuildName)); m_GuildInfoHTML = new MvcHtmlString("<h1><img src='assets/img/icons/ui-pvp-" + StaticValues.GetFactionCSSName(guild.Faction) + ".png'/><span class='" + StaticValues.GetFactionCSSName(guild.Faction) + "-color'>" + guild.GuildName + "</span><span class='badge badge-inverse'>" + membersArray.Count + " Members</span></h1>" + "<p>Guild on the server " + StaticValues.ConvertRealmViewing(realm) + "</p>" + "<p><a href='/GuildViewer.aspx?realm=" + StaticValues.ConvertRealmParam(realm) + "&guild=" + guildStr + "&view=latestevents'>View Latest Events</a></p>" + "<p><a href='/RaidStats/RaidList.aspx?realm=" + StaticValues.ConvertRealmParam(realm) + "&guild=" + guildStr + "'>View recorded raids on RaidStats</a></p>"); string page = ""; foreach (var player in orderedPlayersArray) { page += PageUtility.CreatePlayerRow(0, realm, player.Item1, Table_Columns); } m_CharactersTableHeadHTML = new MvcHtmlString(PageUtility.CreatePlayerTableHeaderRow(Table_Columns)); m_CharactersTableBodyHTML = new MvcHtmlString(page); } else if (pageView == "latestmembers") { m_BreadCrumbHTML = new MvcHtmlString(PageUtility.BreadCrumb_AddHome() + PageUtility.BreadCrumb_AddRealm(realm) + PageUtility.BreadCrumb_AddGuilds(realm) + PageUtility.BreadCrumb_AddGuild(realm, guild.GuildName) + PageUtility.BreadCrumb_AddFinish("Latest Members")); m_GuildInfoHTML = new MvcHtmlString("<h1><img src='assets/img/icons/ui-pvp-" + StaticValues.GetFactionCSSName(guild.Faction) + ".png'/><span class='" + StaticValues.GetFactionCSSName(guild.Faction) + "-color'>" + guild.GuildName + "</span><span class='badge badge-inverse'>" + membersArray.Count + " Members</span></h1>" + "<p>Guild on the server " + StaticValues.ConvertRealmViewing(realm) + "</p>" + "<p><a href='/GuildViewer.aspx?realm=" + StaticValues.ConvertRealmParam(realm) + "&guild=" + guildStr + "'>View Members</a></p>" + "<p><a href='/RaidStats/RaidList.aspx?realm=" + StaticValues.ConvertRealmParam(realm) + "&guild=" + guildStr + "'>View recorded raids on RaidStats</a></p>"); } else if (pageView == "latestitems") { m_BreadCrumbHTML = new MvcHtmlString(PageUtility.BreadCrumb_AddHome() + PageUtility.BreadCrumb_AddRealm(realm) + PageUtility.BreadCrumb_AddGuilds(realm) + PageUtility.BreadCrumb_AddGuild(realm, guild.GuildName) + PageUtility.BreadCrumb_AddFinish("Latest Items")); m_GuildInfoHTML = new MvcHtmlString("<h1><img src='assets/img/icons/ui-pvp-" + StaticValues.GetFactionCSSName(guild.Faction) + ".png'/><span class='" + StaticValues.GetFactionCSSName(guild.Faction) + "-color'>" + guild.GuildName + "</span><span class='badge badge-inverse'>" + membersArray.Count + " Members</span></h1>" + "<p>Guild on the server " + StaticValues.ConvertRealmViewing(realm) + "</p>" + "<p><a href='/GuildViewer.aspx?realm=" + StaticValues.ConvertRealmParam(realm) + "&guild=" + guildStr + "'>View Members</a></p>" + "<p><a href='/RaidStats/RaidList.aspx?realm=" + StaticValues.ConvertRealmParam(realm) + "&guild=" + guildStr + "'>View recorded raids on RaidStats</a></p>"); } else if (pageView == "latestevents") { m_BreadCrumbHTML = new MvcHtmlString(PageUtility.BreadCrumb_AddHome() + PageUtility.BreadCrumb_AddRealm(realm) + PageUtility.BreadCrumb_AddGuilds(realm) + PageUtility.BreadCrumb_AddGuild(realm, guild.GuildName) + PageUtility.BreadCrumb_AddFinish("Latest Events")); m_GuildInfoHTML = new MvcHtmlString("<h1><img src='assets/img/icons/ui-pvp-" + StaticValues.GetFactionCSSName(guild.Faction) + ".png'/><span class='" + StaticValues.GetFactionCSSName(guild.Faction) + "-color'>" + guild.GuildName + "</span><span class='badge badge-inverse'>" + membersArray.Count + " Members</span></h1>" + "<p>Guild on the server " + StaticValues.ConvertRealmViewing(realm) + "</p>" + "<p><a href='/GuildViewer.aspx?realm=" + StaticValues.ConvertRealmParam(realm) + "&guild=" + guildStr + "'>View Members</a></p>" + "<p><a href='/RaidStats/RaidList.aspx?realm=" + StaticValues.ConvertRealmParam(realm) + "&guild=" + guildStr + "'>View recorded raids on RaidStats</a></p>"); } if (pageView == "latestmembers" || pageView == "latestevents") { var guildSummary = Hidden.ApplicationInstance.Instance.GetGuildSummary(realm, guildStr); if (guildSummary == null) { return; } var statusChanges = guildSummary.GenerateLatestStatusChanges(DateTime.UtcNow.AddDays(-14)); string latestmembersStr = ""; statusChanges.Reverse(); foreach (var sChange in statusChanges) { if (realmDB.ContainsKey(sChange.Player)) { var playerData = realmDB[sChange.Player]; string statusChangeDescription = ""; if (sChange.FromStatus == null || sChange.FromStatus.IsInGuild == false) { if (sChange.ToStatus.IsInGuild == true) { statusChangeDescription = "Added to the Guild as Rank \"" + sChange.ToStatus.GuildRank + "\""; } else { continue; } } else if (sChange.ToStatus.IsInGuild == false) { statusChangeDescription = "Removed from the Guild"; } else { statusChangeDescription = "Changed Rank From \"" + sChange.FromStatus.GuildRank + "\" to \"" + sChange.ToStatus.GuildRank + "\""; } latestmembersStr += PageUtility.CreateTableRow("" , PageUtility.CreateTableColumn(PageUtility.CreateColorCodedPlayerLink(realm, playerData)) + PageUtility.CreateTableColumn("<div style='overflow: hidden;white-space: nowrap;'>" + statusChangeDescription + "</div>") + PageUtility.CreateTableColumn("<div style='overflow: hidden;white-space: nowrap;'>" + sChange.ToStatus.DateTime.ToLocalTime().ToString("yyyy-MM-dd") + "</div>")); } } m_LatestMembersHTML = new MvcHtmlString(latestmembersStr); } if (pageView == "latestitems" || pageView == "latestevents") { List <Tuple <DateTime, Player, List <Tuple <PlayerItemInfo, ItemInfo> > > > latestItems = new List <Tuple <DateTime, Player, List <Tuple <PlayerItemInfo, ItemInfo> > > >(); var realmHistory = DatabaseAccess._GetRealmPlayersHistory(this, realm, NotLoadedDecision.SpinWait); foreach (var data in orderedPlayersArray) { Player player = data.Item1; PlayerHistory playerHistory = null; if (realmHistory.TryGetValue(player.Name, out playerHistory) == true) { var recvItems = HistoryGenerator.GenerateLatestReceivedItems(playerHistory, DateTime.MinValue); var orderedRecvItems = recvItems.OrderByDescending(_Value => _Value.Key); int i = 0; foreach (var recvItem in orderedRecvItems) { if (i++ > 10) { break; } List <Tuple <PlayerItemInfo, ItemInfo> > newestItems = new List <Tuple <PlayerItemInfo, ItemInfo> >(); foreach (var item in recvItem.Value) { var itemInfo = DatabaseAccess.GetItemInfo(item.ItemID, wowVersion); if (itemInfo.ItemQuality >= 4) //Atleast epic(4) { newestItems.Add(Tuple.Create(item, itemInfo)); } } if (newestItems.Count > 0) { latestItems.Add(Tuple.Create(recvItem.Key, player, newestItems)); } } } } string latestItemsStr = ""; { var itemSummaryDB = Hidden.ApplicationInstance.Instance.GetItemSummaryDatabase(); string currentItemDatabase = DatabaseAccess.GetCurrentItemDatabaseAddress(); var orderedLatestItems = latestItems.OrderByDescending((_Value) => _Value.Item1); int i = 0; foreach (var recvItem in orderedLatestItems) { if (i++ > 100) { break; } int recvItemIndex = 0; int xMax = 58 * 3; int yMax = (int)((recvItem.Item3.Count - 1) / 3) * 58; yMax += 58; string itemLinks = "<div class='inventory' style='background: none; width: " + xMax + "px; height: " + yMax + "px;'>"; foreach (var item in recvItem.Item3) { int xPos = (recvItemIndex % 3) * 58; int yPos = (int)(recvItemIndex / 3) * 58; //string itemLink = currentItemDatabase + "?item=" + item.Item1.ItemID + "' rel='rand=" + item.Item1.SuffixID + ";ench=0"; var itemInfo = item.Item2; itemLinks += "<div style='background: none; width: 58px; height: 58px;margin: " + yPos + "px " + xPos + "px;'>" + "<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, item.Item1, wowVersion); var itemUsageCount = itemSummaryDB.GetItemUsageCount(realm, item.Item1); itemLinks += "<a class='itemplayersframe' href='ItemUsageInfo.aspx?realm=" + StaticValues.ConvertRealmParam(realm) + "&item=" + item.Item1.ItemID + (item.Item1.SuffixID != 0 ? "&suffix=" + item.Item1.SuffixID : "") + "'>" + itemUsageCount + "</a>"; itemLinks += "</div>"; ++recvItemIndex; } itemLinks += "</div>"; latestItemsStr += PageUtility.CreateTableRow("" , PageUtility.CreateTableColumn(itemLinks) + PageUtility.CreateTableColumn(PageUtility.CreateColorCodedPlayerLink(realm, recvItem.Item2)) + PageUtility.CreateTableColumn("<div style='overflow: hidden;white-space: nowrap;'>" + recvItem.Item1.ToString("yyyy-MM-dd") + "</div>")); } } m_LatestItemsHTML = new MvcHtmlString(latestItemsStr); } }
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); }