public string CreatePVPTable(WowRealm _Realm, int _Count, PlayerColumn[] _Columns, Func <KeyValuePair <string, Player>, double> _SortLambda, Func <Player, bool> _RequirementLambda) { int pageIndex = PageUtility.GetQueryInt(Request, "page", 1) - 1;//Change range from 0 to * instead of 1 to * bool needHistory = false; if (_Columns.Contains(PlayerColumn.RankChange)) { needHistory = true; } string table = "<table id='characters-table' class='table'>"; table += "<thead>" + PageUtility.CreatePlayerTableHeaderRow(_Columns) + "</thead>"; table += "<tbody>"; var playerArray = DatabaseAccess.GetRealmPlayers(this, _Realm, NotLoadedDecision.RedirectAndWait).OrderByDescending(_SortLambda); var playersHistoryArray = DatabaseAccess._GetRealmPlayersHistory(this, _Realm, NotLoadedDecision.ReturnNull); int nr = 0; foreach (var player in playerArray) { if (_RequirementLambda(player.Value) == true) { nr++; if (nr > pageIndex * _Count && nr <= (pageIndex + 1) * _Count) { if (needHistory == true) { VF_RealmPlayersDatabase.PlayerData.PlayerHistory playerHistory = null; if (playersHistoryArray != null) { if (playersHistoryArray.TryGetValue(player.Key, out playerHistory) == false) { playerHistory = null; } } table += PageUtility.CreatePlayerRow(nr, _Realm, player.Value, _Columns, playerHistory); } else { table += PageUtility.CreatePlayerRow(nr, _Realm, player.Value, _Columns); } } } if (nr >= (pageIndex + 1) * _Count) { break; } } table += "</tbody></table>"; if (nr != 0 && nr <= pageIndex * _Count) { pageIndex = (nr - 1) / _Count; Response.Redirect(PageUtility.CreateUrlWithNewQueryValue(Request, "page", (pageIndex + 1).ToString())); } return(table); }
internal static int CalculateHKChange(Player _Player, PlayerHistory _PlayerHistory) { DateTime beforeLastRankUpdate = CalculateLastRankUpdadeDateUTC(_Player.Realm, _Player.LastSeen).AddHours(-1.0); var lastweekHonorEntry = _PlayerHistory.GetHonorItemAtTime(beforeLastRankUpdate); var lastweekHonorData = lastweekHonorEntry.Data; if (lastweekHonorEntry.Uploader.GetTime() < CalculateLastRankUpdadeDateUTC(_Player.Realm, _Player.LastSeen).AddDays(-6.5)) { return(-1); } return((_Player.Honor.LifetimeHK - _Player.Honor.ThisWeekHK) - (lastweekHonorData.LifetimeHK - lastweekHonorData.ThisWeekHK)); }
public static float CalculateRankChange(Player _Player, PlayerHistory _PlayerHistory) { DateTime beforeLastRankUpdate = CalculateLastRankUpdadeDateUTC(_Player.Realm, _Player.LastSeen).AddHours(-1.0); var lastweekHonorData = _PlayerHistory.GetHonorItemAtTime(beforeLastRankUpdate).Data; if (lastweekHonorData != null) { return(_Player.GetRankTotal() - lastweekHonorData.GetRankTotal()); } else { return(_Player.GetRankTotal()); } }
protected void Page_Load(object sender, EventArgs e) { int pageNr = PageUtility.GetQueryInt(Request, "page", 1); int pageIndex = pageNr - 1;//Change range from 0 to * instead of 1 to * int count = PageUtility.GetQueryInt(Request, "count", 100); if (count > 500) { count = 500; } var realm = RealmControl.Realm; if (realm == VF_RealmPlayersDatabase.WowRealm.Unknown) { return; } var wowVersion = StaticValues.GetWowVersion(realm); int itemID = PageUtility.GetQueryInt(Request, "item", 19364); int suffixID = PageUtility.GetQueryInt(Request, "suffix", 0); this.Title = "\"" + itemID + "\" ItemUsage @ " + StaticValues.ConvertRealmParam(realm) + " | RealmPlayers"; m_BreadCrumbHTML = new MvcHtmlString(PageUtility.BreadCrumb_AddHome() + PageUtility.BreadCrumb_AddFinish("ItemUsage")); var itemSummaryDB = Hidden.ApplicationInstance.Instance.GetItemSummaryDatabase(); using (VF.SQLComm comm = new VF.SQLComm()) { List <Tuple <DateTime, string> > players = null; players = itemSummaryDB.GetItemUsage(realm, itemID, suffixID);//, out players) == true) { string currentItemDatabase = DatabaseAccess.GetCurrentItemDatabaseAddress(); var itemInfo = DatabaseAccess.GetItemInfo(itemID, wowVersion); m_ItemUsageInfoHTML = new MvcHtmlString("<div style='overflow: hidden; display: table;'><div style='display: table-cell;'><h1>Players with <h1></div>" + "<div class='inventory' style='background: none; width: 58px; height: 58px; display: table-cell;'><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, itemID, suffixID, wowVersion) + "</div></div>" + "<span class='badge badge-inverse'>" + players.Count + " Players</span></div>" + "<p>Sorted by date \"aquired\"</p>"); Dictionary <PlayerColumn, string[]> extraColumns = new Dictionary <PlayerColumn, string[]>(); PlayerColumn ItemAndAquiredDateAfterColumn = PlayerColumn.Number; extraColumns.Add(ItemAndAquiredDateAfterColumn, new string[] { "Item", "Date Aquired" }); m_TableHeadHTML = new MvcHtmlString(PageUtility.CreatePlayerTableHeaderRow(Table_Columns, extraColumns)); string tableBody = ""; int nr = 0; Func <Tuple <DateTime, string>, DateTime> lambdaComparison = (_Tuple) => { return(_Tuple.Item1); }; players = players.OrderBy(lambdaComparison).ToList(); foreach (var playerDateAndName in players) { Player player = DatabaseAccess.FindRealmPlayer(this, realm, playerDateAndName.Item2); if (player != null) { ++nr; // style='position: absolute; margin: auto; width:58px; height:58px;' if (nr > pageIndex * count && nr <= (pageIndex + 1) * count) { //string itemLink = ""; VF_RealmPlayersDatabase.PlayerData.ItemInfo playerItemData = null; try { playerItemData = player.Gear.Items.First((_Item) => { return(_Item.Value.ItemID == itemID); }).Value; } catch (Exception) { playerItemData = null; } if (playerItemData != null) { //Data fanns i gearen som playern använder för tillfället! //itemLink = currentItemDatabase + "?item=" + playerItemData.ItemID + "' rel='rand=" + playerItemData.SuffixID + ";ench=" + playerItemData.EnchantID; } else { //Måste titta igenom history! #if NO_SQL PlayerHistory playerHistory = DatabaseAccess.FindRealmPlayerHistory(this, realm, playerDateAndName.Item2); if (playerHistory != null) { for (int i = playerHistory.GearHistory.Count - 1; i >= 0; --i) { try { playerItemData = playerHistory.GearHistory[i].Data.Items.First((_Item) => { return(_Item.Value.ItemID == itemID); }).Value; } catch (Exception) { playerItemData = null; } if (playerItemData != null) { //Data fanns i gearen som playern använder för tillfället! //itemLink = currentItemDatabase + "?item=" + playerItemData.ItemID + "' rel='rand=" + playerItemData.SuffixID + ";ench=" + playerItemData.EnchantID; break; } } } #else /*Disable this for now. it is too slow...*/ //playerItemData = comm.GetLatestItemInfoForPlayer(playerDateAndName.Item2, realm, itemID); #endif } if (playerItemData == null) { playerItemData = new VF_RealmPlayersDatabase.PlayerData.ItemInfo { Slot = VF_RealmPlayersDatabase.ItemSlot.Unknown, ItemID = itemID, SuffixID = 0, EnchantID = 0, UniqueID = 0, GemIDs = null }; } 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, playerItemData, wowVersion) + "</div></div>" , playerDateAndName.Item1.ToString("yyyy-MM-dd") }; tableBody += PageUtility.CreatePlayerRow(nr, realm, player, Table_Columns, null, extraColumns); } if (nr >= (pageIndex + 1) * count) { break; } } } if (nr != 0 && nr <= pageIndex * count) { pageIndex = (nr - 1) / count; Response.Redirect(PageUtility.CreateUrlWithNewQueryValue(Request, "page", (pageIndex + 1).ToString())); } m_TableBodyHTML = new MvcHtmlString(tableBody); int maxPageNr = 1000000 / count; m_PaginationHTML = new MvcHtmlString(PageUtility.CreatePagination(Request, pageNr, ((players.Count - 1) / count) + 1)); } } }
public static List <HonorHKDay> GeneratePlayerHonor(PlayerHistory _PlayerHistory) { DateTime dayAccuracyLoggingDate = DateTime.Parse("2013-08-02 01:00:00"); DateTime firstTime = _PlayerHistory.HonorHistory.First().Uploader.GetTime().ToLocalTime(); DateTime lastTime = _PlayerHistory.HonorHistory.Last().Uploader.GetTime().ToLocalTime(); firstTime = firstTime.AddHours(-firstTime.Hour); firstTime = firstTime.AddMinutes(-firstTime.Minute); //firstTime = firstTime.ToLocalTime(); //lastTime = lastTime.AddHours(-lastTime.Hour); //lastTime = lastTime.AddMinutes(-lastTime.Minute); //lastTime = lastTime.ToLocalTime(); List <HonorHKDay> dataList = new List <HonorHKDay>(); int totalDays = (int)((lastTime - firstTime).TotalDays + 1); DateTime currentDate = firstTime; for (int i = 0; i < totalDays; ++i) { bool todayAddedHKDay = false; DateTime researchDate = currentDate.AddHours(23.59); var honorItem = _PlayerHistory.GetHonorItemAtTime(researchDate); if ((researchDate - honorItem.Uploader.GetTime().ToLocalTime()).TotalHours < 23.59) { dataList.Add(new HonorHKDay { m_DateTime = currentDate , m_BasedOn = BasedOn.TodayHK , m_Accuracy = (int)(researchDate - honorItem.Uploader.GetTime().ToLocalTime()).TotalHours , m_HonorValue = -1 , m_HKValue = honorItem.Data.TodayHK }); todayAddedHKDay = true; } researchDate = researchDate.AddHours(24.0); honorItem = _PlayerHistory.GetHonorItemAtTime(researchDate); if ((researchDate - honorItem.Uploader.GetTime().ToLocalTime()).TotalHours < 23.59) { if (todayAddedHKDay == true) { var dataLast = dataList.Last(); if (dataLast.m_HKValue == honorItem.Data.YesterdayHK) { dataLast.m_HonorValue = honorItem.Data.YesterdayHonor; dataLast.m_BasedOn = BasedOn.TodayHK_And_YesterdayHK; dataLast.m_Accuracy = (int)(researchDate - honorItem.Uploader.GetTime().ToLocalTime()).TotalHours; dataList[dataList.Count - 1] = dataLast; } } dataList.Add(new HonorHKDay { m_DateTime = currentDate , m_BasedOn = BasedOn.YesterdayHK , m_Accuracy = (int)(researchDate - honorItem.Uploader.GetTime().ToLocalTime()).TotalHours , m_HonorValue = honorItem.Data.YesterdayHonor , m_HKValue = honorItem.Data.YesterdayHK }); todayAddedHKDay = true; } if (todayAddedHKDay == false) { dataList.Add(new HonorHKDay { m_DateTime = currentDate , m_BasedOn = BasedOn.Nothing , m_Accuracy = 0 , m_HonorValue = 0 , m_HKValue = 0 }); } currentDate = currentDate.AddDays(1.0); } for (int i = 0; i < dataList.Count; ++i) { var currData = dataList[i]; if (currData.m_BasedOn == BasedOn.Nothing || (currData.m_DateTime < dayAccuracyLoggingDate && currData.m_HKValue == 0)) { DateTime weekUpdateDate = DateTime_GotoSunday(currData.m_DateTime.AddDays(7)); DateTime researchDate = weekUpdateDate.AddDays(6.95); var honorItem = _PlayerHistory.GetHonorItemAtTime(researchDate); if ((researchDate - honorItem.Uploader.GetTime().ToLocalTime()).TotalDays < 6.95) { currData.m_Accuracy = (int)(researchDate - honorItem.Uploader.GetTime().ToLocalTime()).TotalDays; currData.m_HKValue = honorItem.Data.LastWeekHK / 7; currData.m_HonorValue = honorItem.Data.LastWeekHonor / 7; currData.m_BasedOn = BasedOn.LastWeekHK; dataList[i] = currData; } else { double currentDaysInThisWeek = (honorItem.Uploader.GetTime().ToLocalTime() - DateTime_GotoSunday(currData.m_DateTime)).TotalDays; if (currentDaysInThisWeek < 1.0) { currentDaysInThisWeek = 1.0; } currData.m_Accuracy = (int)(researchDate - honorItem.Uploader.GetTime().ToLocalTime()).TotalDays; currData.m_HKValue = (int)(honorItem.Data.ThisWeekHK / currentDaysInThisWeek); currData.m_HonorValue = (int)(honorItem.Data.ThisWeekHonor / currentDaysInThisWeek); currData.m_BasedOn = BasedOn.ThisWeekHK; dataList[i] = currData; } } if (currData.m_HonorValue == -1) { DateTime weekUpdateDate = DateTime_GotoSunday(currData.m_DateTime.AddDays(7)); DateTime researchDate = weekUpdateDate.AddDays(6.95); var honorItem = _PlayerHistory.GetHonorItemAtTime(researchDate); double currentDaysInThisWeek = (honorItem.Uploader.GetTime().ToLocalTime() - DateTime_GotoSunday(currData.m_DateTime)).TotalDays; if (currentDaysInThisWeek < 1.0) { currentDaysInThisWeek = 1.0; } currData.m_HonorValue = (int)(honorItem.Data.ThisWeekHonor / currentDaysInThisWeek); currData.m_BasedOn = BasedOn.ThisWeekHK; dataList[i] = currData; } } //dataList.Distinct(); return(dataList.Distinct().ToList()); }
public static Dictionary <DateTime, List <VF_RealmPlayersDatabase.PlayerData.ItemInfo> > GenerateLatestReceivedItems(PlayerHistory _PlayerHistory, VF_RealmPlayersDatabase.PlayerData.ExtraData _ExtraData, DateTime _EarliestDate) { Dictionary <DateTime, List <VF_RealmPlayersDatabase.PlayerData.ItemInfo> > recvItems = new Dictionary <DateTime, List <VF_RealmPlayersDatabase.PlayerData.ItemInfo> >(); List <int> itemIDs = new List <int>(); List <int> duplicateItemIDs = new List <int>(); foreach (var gearHistoryItem in _PlayerHistory.GearHistory) { DateTime historyDate = gearHistoryItem.Uploader.GetTime().Date; int oneRingID = -1; int oneTrinketID = -1; int oneWeaponID = -1; foreach (var item in gearHistoryItem.Data.Items) { int currItemID = item.Value.ItemID; if (itemIDs.Contains(currItemID) == false) { itemIDs.Add(currItemID); if (historyDate > _EarliestDate) { recvItems.AddToList(historyDate, item.Value); } } else { if (currItemID == oneRingID || currItemID == oneTrinketID || currItemID == oneWeaponID) { if (duplicateItemIDs.Contains(currItemID) == false) { duplicateItemIDs.Add(currItemID); if (historyDate > _EarliestDate) { recvItems.AddToList(historyDate, item.Value); } } } } if (item.Key == VF_RealmPlayersDatabase.ItemSlot.Finger_1 || item.Key == VF_RealmPlayersDatabase.ItemSlot.Finger_2) { oneRingID = currItemID; } else if (item.Key == VF_RealmPlayersDatabase.ItemSlot.Trinket_1 || item.Key == VF_RealmPlayersDatabase.ItemSlot.Trinket_2) { oneTrinketID = currItemID; } else if (item.Key == VF_RealmPlayersDatabase.ItemSlot.Main_Hand || item.Key == VF_RealmPlayersDatabase.ItemSlot.Off_Hand) { oneWeaponID = currItemID; } } } if (_ExtraData != null) { try { foreach (var mount in _ExtraData.Mounts) { var mountRecvDateTime = mount.GetEarliestUpload().GetTime(); var mountItem = new VF_RealmPlayersDatabase.PlayerData.ItemInfo { ItemID = VF.ItemTranslations.FindItemID(mount.Mount), SuffixID = 0, EnchantID = 0, UniqueID = 0, GemIDs = null, Slot = VF_RealmPlayersDatabase.ItemSlot.Unknown }; recvItems.AddToList(mountRecvDateTime, mountItem); } } catch (Exception ex) { Logger.LogException(ex); } } return(recvItems); }
public static Dictionary <DateTime, List <VF_RealmPlayersDatabase.PlayerData.ItemInfo> > GenerateLatestReceivedItems(PlayerHistory _PlayerHistory, DateTime _EarliestDate) { return(GenerateLatestReceivedItems(_PlayerHistory, null, _EarliestDate)); }
public static string CreateProgressStr(System.Web.UI.Page _Page, VF_RPDatabase.GuildSummary _Guild, WowRealm _Realm, out int _RetProgressComparisonValue) { string mcString = ""; string onyString = ""; string bwlString = ""; string zgString = ""; string aq20String = ""; string aq40String = ""; string naxxString = ""; string wbString = ""; #if USE_RAIDSTATS_FOR_PROGRESS_STR _RetProgressComparisonValue = 0; VF_RDDatabase.GroupInfo guildRaidProgressInfo = null; var groupSummaryDB = Hidden.ApplicationInstance.Instance.GetGroupSummaryDatabase(); if (groupSummaryDB != null) { guildRaidProgressInfo = groupSummaryDB.GetGroupInfo(_Realm, _Guild.GuildName); } if (guildRaidProgressInfo != null) { try { Dictionary <WowBoss, int> m_BestBossKillTimes = new Dictionary <WowBoss, int>(); for (int i = (int)WowBoss.MCFirst; i <= (int)WowBoss.MCLast; ++i) { m_BestBossKillTimes.Add((WowBoss)i, int.MaxValue); } for (int i = (int)WowBoss.OnyFirst; i <= (int)WowBoss.OnyLast; ++i) { m_BestBossKillTimes.Add((WowBoss)i, int.MaxValue); } for (int i = (int)WowBoss.BWLFirst; i <= (int)WowBoss.BWLLast; ++i) { m_BestBossKillTimes.Add((WowBoss)i, int.MaxValue); } for (int i = (int)WowBoss.ZGFirst; i <= (int)WowBoss.ZGLast; ++i) { m_BestBossKillTimes.Add((WowBoss)i, int.MaxValue); } for (int i = (int)WowBoss.AQ20First; i <= (int)WowBoss.AQ20Last; ++i) { m_BestBossKillTimes.Add((WowBoss)i, int.MaxValue); } for (int i = (int)WowBoss.AQ40First; i <= (int)WowBoss.AQ40Last; ++i) { m_BestBossKillTimes.Add((WowBoss)i, int.MaxValue); } for (int i = (int)WowBoss.NaxxFirst; i <= (int)WowBoss.NaxxLast; ++i) { m_BestBossKillTimes.Add((WowBoss)i, int.MaxValue); } for (int i = (int)WowBoss.WBFirst; i <= (int)WowBoss.WBLast; ++i) { m_BestBossKillTimes.Add((WowBoss)i, int.MaxValue); } foreach (var bossKill in guildRaidProgressInfo.FastestBossKills) { if (bossKill.Value.Count > 0) { var wowBoss = StaticValues.ConvertWowBoss(bossKill.Key); int fastestKillTime = int.MaxValue; foreach (var killInfo in bossKill.Value) { int currKillTime = killInfo.GetKillTimeSeconds(); if (currKillTime < fastestKillTime) { fastestKillTime = currKillTime; } } if (wowBoss == WowBoss.Renataki_Of_The_Thousand_Blades || wowBoss == WowBoss.Wushoolay_the_Storm_Witch || wowBoss == WowBoss.Gri_Lek_Of_The_Iron_Blood || wowBoss == WowBoss.Hazzarah_The_Dreamweaver) { wowBoss = WowBoss.Edge_Of_Madness; } if (m_BestBossKillTimes.ContainsKey(wowBoss) == true) { if (fastestKillTime < m_BestBossKillTimes[wowBoss]) { m_BestBossKillTimes[wowBoss] = fastestKillTime; } } else { m_BestBossKillTimes.Add(wowBoss, fastestKillTime); } } } for (int i = (int)WowBoss.MCFirst; i <= (int)WowBoss.MCLast; ++i) { mcString += ((m_BestBossKillTimes[(WowBoss)i] < int.MaxValue) ? "1" : "0"); } for (int i = (int)WowBoss.OnyFirst; i <= (int)WowBoss.OnyLast; ++i) { onyString += ((m_BestBossKillTimes[(WowBoss)i] < int.MaxValue) ? "1" : "0"); } for (int i = (int)WowBoss.BWLFirst; i <= (int)WowBoss.BWLLast; ++i) { bwlString += ((m_BestBossKillTimes[(WowBoss)i] < int.MaxValue) ? "1" : "0"); } for (int i = (int)WowBoss.ZGFirst; i <= (int)WowBoss.ZGLast; ++i) { zgString += ((m_BestBossKillTimes[(WowBoss)i] < int.MaxValue) ? "1" : "0"); } for (int i = (int)WowBoss.AQ20First; i <= (int)WowBoss.AQ20Last; ++i) { aq20String += ((m_BestBossKillTimes[(WowBoss)i] < int.MaxValue) ? "1" : "0"); } for (int i = (int)WowBoss.AQ40First; i <= (int)WowBoss.AQ40Last; ++i) { aq40String += ((m_BestBossKillTimes[(WowBoss)i] < int.MaxValue) ? "1" : "0"); } for (int i = (int)WowBoss.NaxxFirst; i <= (int)WowBoss.NaxxLast; ++i) { naxxString += ((m_BestBossKillTimes[(WowBoss)i] < int.MaxValue) ? "1" : "0"); } for (int i = (int)WowBoss.WBFirst; i <= (int)WowBoss.WBLast; ++i) { wbString += ((m_BestBossKillTimes[(WowBoss)i] < int.MaxValue) ? "1" : "0"); } } catch (Exception ex) { Logger.LogException(ex); } } else #endif { var wowVersion = StaticValues.GetWowVersion(_Realm); Dictionary <WowBoss, int> m_MembersWithBossItems = new Dictionary <WowBoss, int>(); for (int i = (int)WowBoss.MCFirst; i <= (int)WowBoss.MCLast; ++i) { m_MembersWithBossItems.Add((WowBoss)i, 0); } for (int i = (int)WowBoss.OnyFirst; i <= (int)WowBoss.OnyLast; ++i) { m_MembersWithBossItems.Add((WowBoss)i, 0); } for (int i = (int)WowBoss.BWLFirst; i <= (int)WowBoss.BWLLast; ++i) { m_MembersWithBossItems.Add((WowBoss)i, 0); } for (int i = (int)WowBoss.ZGFirst; i <= (int)WowBoss.ZGLast; ++i) { m_MembersWithBossItems.Add((WowBoss)i, 0); } for (int i = (int)WowBoss.AQ20First; i <= (int)WowBoss.AQ20Last; ++i) { m_MembersWithBossItems.Add((WowBoss)i, 0); } for (int i = (int)WowBoss.AQ40First; i <= (int)WowBoss.AQ40Last; ++i) { m_MembersWithBossItems.Add((WowBoss)i, 0); } for (int i = (int)WowBoss.NaxxFirst; i <= (int)WowBoss.NaxxLast; ++i) { m_MembersWithBossItems.Add((WowBoss)i, 0); } for (int i = (int)WowBoss.WBFirst; i <= (int)WowBoss.WBLast; ++i) { m_MembersWithBossItems.Add((WowBoss)i, 0); } var itemDropdatabase = DatabaseAccess.GetItemDropDatabase(_Page, wowVersion, NotLoadedDecision.RedirectAndWait).GetDatabase(); var playersHistory = DatabaseAccess._GetRealmPlayersHistory(_Page, _Realm, NotLoadedDecision.RedirectAndWait); foreach (var guildPlayer in _Guild.Players) { if (guildPlayer.Value.IsInGuild == false) { continue; } List <int> ignoredItems = new List <int>(); VF_RealmPlayersDatabase.PlayerData.PlayerHistory playerHistory = null; if (playersHistory.TryGetValue(guildPlayer.Value.PlayerName, out playerHistory) == true) { try { if (playerHistory.HaveValidHistory() == false) { continue; } foreach (var gear in playerHistory.GearHistory) { bool isInGuild = (playerHistory.GetGuildItemAtTime(gear.Uploader.GetTime()).Data.GuildName == _Guild.GuildName); foreach (var item in gear.Data.Items) { if (ignoredItems.Contains(item.Value.ItemID)) { continue; } if (isInGuild == false) { ignoredItems.Add(item.Value.ItemID); continue; } List <VF_RealmPlayersDatabase.ItemDropDataItem> itemDropDataList = null; if (itemDropdatabase.TryGetValue(item.Value.ItemID, out itemDropDataList) == true) { foreach (var itemDropData in itemDropDataList) { WowBoss itemBoss = itemDropData.m_Boss; if (itemBoss == WowBoss.Renataki_Of_The_Thousand_Blades || itemBoss == WowBoss.Wushoolay_the_Storm_Witch || itemBoss == WowBoss.Gri_Lek_Of_The_Iron_Blood || itemBoss == WowBoss.Hazzarah_The_Dreamweaver) { itemBoss = WowBoss.Edge_Of_Madness; } if (m_MembersWithBossItems.ContainsKey(itemBoss)) { m_MembersWithBossItems[itemBoss] = m_MembersWithBossItems[itemBoss] + 1; ignoredItems.Add(item.Value.ItemID); } /*if (itemBoss >= WowBoss.MCFirst && itemBoss <= WowBoss.MCLast) * {} * else if (itemBoss >= WowBoss.OnyFirst && itemBoss <= WowBoss.OnyLast) * {} * else if (itemBoss >= WowBoss.BWLFirst && itemBoss <= WowBoss.BWLLast) * {} * else if (itemBoss >= WowBoss.ZGFirst && itemBoss <= WowBoss.ZGLast) * {} * else if (itemBoss >= WowBoss.AQ20First && itemBoss <= WowBoss.AQ20Last) * {} * else if (itemBoss >= WowBoss.AQ40First && itemBoss <= WowBoss.AQ40Last) * {} * else if (itemBoss >= WowBoss.NaxxFirst && itemBoss <= WowBoss.NaxxLast) * {}*/ } } } } } catch (Exception ex) { Logger.ConsoleWriteLine("GuildList.aspx could not look through gear for player \"" + guildPlayer.Value.PlayerName + "\" Exception:" + ex.ToString(), ConsoleColor.Red); } } } for (int i = (int)WowBoss.MCFirst; i <= (int)WowBoss.MCLast; ++i) { mcString += ((m_MembersWithBossItems[(WowBoss)i] >= 2) ? "1" : "0"); } for (int i = (int)WowBoss.OnyFirst; i <= (int)WowBoss.OnyLast; ++i) { onyString += ((m_MembersWithBossItems[(WowBoss)i] >= 2) ? "1" : "0"); } for (int i = (int)WowBoss.BWLFirst; i <= (int)WowBoss.BWLLast; ++i) { bwlString += ((m_MembersWithBossItems[(WowBoss)i] >= 2) ? "1" : "0"); } for (int i = (int)WowBoss.ZGFirst; i <= (int)WowBoss.ZGLast; ++i) { zgString += ((m_MembersWithBossItems[(WowBoss)i] >= 2) ? "1" : "0"); } for (int i = (int)WowBoss.AQ20First; i <= (int)WowBoss.AQ20Last; ++i) { aq20String += ((m_MembersWithBossItems[(WowBoss)i] >= 2) ? "1" : "0"); } for (int i = (int)WowBoss.AQ40First; i <= (int)WowBoss.AQ40Last; ++i) { aq40String += ((m_MembersWithBossItems[(WowBoss)i] >= 2) ? "1" : "0"); } for (int i = (int)WowBoss.NaxxFirst; i <= (int)WowBoss.NaxxLast; ++i) { naxxString += ((m_MembersWithBossItems[(WowBoss)i] >= 2) ? "1" : "0"); } for (int i = (int)WowBoss.WBFirst; i <= (int)WowBoss.WBLast; ++i) { wbString += ((m_MembersWithBossItems[(WowBoss)i] >= 2) ? "1" : "0"); } } string oldMCstring = mcString; string oldBWLstring = bwlString; string oldZGstring = zgString; string oldAQ20string = aq20String; string oldAQ40string = aq40String; string oldNaxxstring = naxxString; if (mcString[9] == '1') //If Ragnaros is killed, everything is killed { mcString = "1111111111"; } else if (mcString[8] == '1') //If Majordomo is killed, everything up to Majordomo is killed { mcString = "1111111110"; } if (bwlString[7] == '1') //If Nefarian is killed, everything is killed { bwlString = "11111111"; } else if (bwlString.LastIndexOf('1') != -1)//If boss X is killed, everything up to boss X is killed { bwlString = new string('1', bwlString.LastIndexOf('1') + 1) + bwlString.Substring(bwlString.LastIndexOf('1') + 1); } if (zgString[5] == '1') //If Hakkar is killed, everything except optionals is killed { zgString = "111111" + zgString.Substring(6); } if (aq20String[2] == '1') //If Ossirian is killed, everything except optionals is killed { aq20String = "111" + aq20String.Substring(3); } if (aq40String[5] == '1') //If C'thun is killed, everything except optionals is killed { aq40String = "111111" + aq40String.Substring(6); } else if (aq40String.LastIndexOf('1', 5, 6) != -1) //If boss X is killed, everything up to boss X is killed { aq40String = new string('1', aq40String.LastIndexOf('1', 5, 6) + 1) + aq40String.Substring(aq40String.LastIndexOf('1', 5, 6) + 1); } if (naxxString[14] == '1') { naxxString = "111111111111111"; } else if (naxxString[13] == '1') { naxxString = "111111111111110"; } //if (oldMCstring != mcString) //{ // //take notes // System.Diagnostics.Debugger.Break(); //} //if (oldBWLstring != bwlString) //{ // //take notes // System.Diagnostics.Debugger.Break(); //} //if (oldZGstring != zgString) //{ // //take notes // System.Diagnostics.Debugger.Break(); //} //if (oldAQ20string != aq20String) //{ // //take notes // System.Diagnostics.Debugger.Break(); //} //if (oldAQ40string != aq40String) //{ // //take notes // System.Diagnostics.Debugger.Break(); //} //if (oldNaxxstring != naxxString) //{ // //take notes // System.Diagnostics.Debugger.Break(); //} _RetProgressComparisonValue = GuildProgress.CreateProgressInt( zgString.Count(_Char => _Char == '1'), aq20String.Count(_Char => _Char == '1'), mcString.Count(_Char => _Char == '1'), onyString.Count(_Char => _Char == '1'), wbString.Count(_Char => _Char == '1'), bwlString.Count(_Char => _Char == '1'), aq40String.Count(_Char => _Char == '1'), naxxString.Count(_Char => _Char == '1') ); return("guildProgress['" + _Guild.GuildName.Replace(' ', '_') + "'] = { MC: '" + mcString + "', Ony: '" + onyString + "', BWL: '" + bwlString + "', ZG: '" + zgString + "', AQ20: '" + aq20String + "', AQ40: '" + aq40String + "', Naxx: '" + naxxString + "', WB: '" + wbString + "' };"); }
public static bool HasPlayerNameChanged(Dictionary <string, PlayerHistory> _PlayersHistory, string _Name, WowVersionEnum _WowVersion, out string _OldName) { _OldName = _Name; PlayerHistory thisHistory = null; if (_PlayersHistory.TryGetValue(_Name, out thisHistory) == false) { return(false); } var lastCharHistory = thisHistory.CharacterHistory.Last(); if (lastCharHistory.Data.Level < 60) { return(false);//No one name changes a character below lvl 60 right? } if (thisHistory.HonorHistory.Last().Data.LifetimeHK < 500) { return(false);//If someone has less than 500 HKs they probably were not important to note, makes the algorithm faster if we can skip already here } var firstCharHistory = thisHistory.CharacterHistory.First(); if (firstCharHistory.Data.Level < 60) { return(false); //Assume false for now, only care about 60s from nowhere /* * //This player have level history, check if the history makes sense * for(int i = thisHistory.CharacterHistory.Count - 1; i >= 0; --i) * { * var charHistory = thisHistory.CharacterHistory[i]; * if(charHistory.Data.Level < 60) * { * int beforelevel60Hks = thisHistory.GetHonorItemAtTime(charHistory.Uploader.GetTime()).Data.LifetimeHK; * int afterlevel60HKs = thisHistory.GetHonorItemAtTime(thisHistory.CharacterHistory[i+1].Uploader.GetTime()).Data.LifetimeHK; * * if(beforelevel60Hks > afterlevel60HKs) * { * return true;//This is very strange, return true so that we can review this at another time * } * else * { * if(beforelevel60Hks < 500 && afterlevel60HKs > * } * } * } * return false; */ } else { var firstHonorHistory = thisHistory.HonorHistory.First(); if (firstHonorHistory.Data.LifetimeHK < 500) { return(false); //If someone had less than 500 HKs when transfering they probably were not important to note, makes the algorithm faster if we can skip already here } DateTime earliestPlayerTime = firstHonorHistory.Uploader.GetTime(); List <KeyValuePair <string, PlayerHistory> > candidates = new List <KeyValuePair <string, PlayerHistory> >(); foreach (var playerHistory in _PlayersHistory) { if (playerHistory.Value.CharacterHistory.Count < 1 || playerHistory.Value.HonorHistory.Count < 1 || playerHistory.Value.GearHistory.Count < 1) { continue; } if (playerHistory.Value.CharacterHistory.Last().Data.Class != lastCharHistory.Data.Class) { continue;//It is not possible to change class, so ignore all that arnt same class } if (playerHistory.Value.GetLatestDateTime() < earliestPlayerTime) { //Only possible if they were not updated after(assuming no other character have been made in the old name yet) if (playerHistory.Value.HonorHistory.Last().Data.LifetimeHighestRank != firstHonorHistory.Data.LifetimeHighestRank) { continue; //Must have same LifetimehighestRank } if (playerHistory.Value.HonorHistory.Last().Data.LifetimeHK <= firstHonorHistory.Data.LifetimeHK) { //Only possible if they did not have more HKs(cant go backwards in lifetime HK count) int hkDiff = firstHonorHistory.Data.LifetimeHK - playerHistory.Value.HonorHistory.Last().Data.LifetimeHK; if (hkDiff > 300) { continue; //Too big difference, hard to calculate } if (hkDiff != 0) { hkDiff -= firstHonorHistory.Data.ThisWeekHK; if (hkDiff != 0) { hkDiff -= firstHonorHistory.Data.LastWeekHK; if (hkDiff != 0) { hkDiff += playerHistory.Value.HonorHistory.Last().Data.ThisWeekHK + playerHistory.Value.HonorHistory.Last().Data.LastWeekHK; } } } if (hkDiff == 0) { //Very high chance of being the correct player if (playerHistory.Key != _Name) { //Only add if "not this" for obvious reasons //This check is placed all the way inside here for small performance gain candidates.Add(playerHistory); } } } } } if (candidates.Count == 0) { return(false);//No HK matches } var firstGearHistory = thisHistory.GearHistory.First(); foreach (var candidate in candidates) { var candidateLastGearHistory = candidate.Value.GearHistory.Last(); bool allGearSame = true; foreach (var item in firstGearHistory.Data.Items) { if (candidateLastGearHistory.Data.Items.ContainsKey(item.Key)) { if (candidateLastGearHistory.Data.Items[item.Key].ItemID != item.Value.ItemID) { allGearSame = false; break; } } } if (allGearSame == true) { //Extremely high chance of this being the correct one! good enough for me! _OldName = candidate.Key; if (sm_PlayerNameChanged.ContainsKey(_Name) == false) { if (sm_PlayerNameChanged.TryAdd(_Name, _OldName) == true) { Logger.ConsoleWriteLine("Name Change Detected: " + _OldName + "->" + _Name, ConsoleColor.Green); } } return(true); } else { //Can still be the correct candidate //if atleast 80% of the gear equipped exists in the candidates history we have found our guy! if (StaticValues.GetFaction(candidate.Value.CharacterHistory.First().Data.Race) != StaticValues.GetFaction(lastCharHistory.Data.Race)) { //If faction is different we need to exclude all PVP items var itemDropDatabase = DatabaseAccess.GetItemDropDatabase(null, _WowVersion, NotLoadedDecision.SpinWait).GetDatabase(); int itemCount = 0;//firstGearHistory.Data.Items.Count; foreach (var item in firstGearHistory.Data.Items) { List <VF_RealmPlayersDatabase.ItemDropDataItem> itemDropInfoList = null; if (itemDropDatabase.TryGetValue(item.Value.ItemID, out itemDropInfoList) == true) { bool wasPvpItem = false; foreach (var itemdropInfo in itemDropInfoList) { if (((int)itemdropInfo.m_Boss >= (int)VF_RealmPlayersDatabase.WowBoss.PVPOffsetFirst && (int)itemdropInfo.m_Boss <= (int)VF_RealmPlayersDatabase.WowBoss.PVPOffsetLast) || ((int)itemdropInfo.m_Boss >= (int)VF_RealmPlayersDatabase.WowBoss.PVPSetFirst && (int)itemdropInfo.m_Boss <= (int)VF_RealmPlayersDatabase.WowBoss.PVPSetLast)) { ++itemCount; wasPvpItem = true; break; } } if (wasPvpItem == true) { continue; } } if (candidate.Value.HaveItem(item.Value) == true)//Pretty expensive, but whatever! { ++itemCount; } } if ((float)itemCount / (float)firstGearHistory.Data.Items.Count > 0.75f) { _OldName = candidate.Key; if (sm_PlayerNameChanged.ContainsKey(_Name) == false) { if (sm_PlayerNameChanged.TryAdd(_Name, _OldName) == true) { Logger.ConsoleWriteLine("Name Change Detected: " + _OldName + "->" + _Name, ConsoleColor.Green); } } return(true); } } else { int itemCount = 0;//firstGearHistory.Data.Items.Count; foreach (var item in firstGearHistory.Data.Items) { if (candidate.Value.HaveItem(item.Value) == true)//Pretty expensive, but whatever! { ++itemCount; } } if ((float)itemCount / (float)firstGearHistory.Data.Items.Count > 0.75f) { _OldName = candidate.Key; if (sm_PlayerNameChanged.ContainsKey(_Name) == false) { if (sm_PlayerNameChanged.TryAdd(_Name, _OldName) == true) { Logger.ConsoleWriteLine("Name Change Detected: " + _OldName + "->" + _Name, ConsoleColor.Green); } } return(true); } } } } } return(false); }
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); } }