コード例 #1
0
ファイル: DatabaseAccess.cs プロジェクト: cocely/RealmPlayers
        public static VF_RealmPlayersDatabase.PlayersOnlineDB GetRealmOnlinePlayers(System.Web.UI.Page _Page, WowRealm _Realm, NotLoadedDecision _Decision = NotLoadedDecision.SpinWait)
        {
            var realm = _FindRealmDB(_Page, _Realm, _Decision);

            if (realm == null || (realm.IsPlayersOnlineLoadComplete() == false && _Decision != NotLoadedDecision.SpinWait))
            {
                if (_Decision == NotLoadedDecision.RedirectAndWait)
                {
                    PageUtility.RedirectErrorLoading(_Page, StaticValues.ConvertRealmParam(_Realm));
                }
                return(null);
            }
            return(realm.PlayersOnlineData);
        }
コード例 #2
0
ファイル: DatabaseAccess.cs プロジェクト: cocely/RealmPlayers
        //public static RealmDatabase GetRealmDB(System.Web.UI.Page _Page, WowRealm _Realm, string _RedirectSubRealmSection = "")
        //{
        //    var rppDatabase = ApplicationInstance.Instance.GetRPPDatabase(false);
        //    if (rppDatabase == null)
        //    {
        //        PageUtility.RedirectErrorLoading(_Page, StaticValues.ConvertRealmParam(_Realm) + _RedirectSubRealmSection);
        //        return null;
        //    }
        //    return rppDatabase.GetRealm(_Realm);
        //}
        //public static PlayerData.PlayerHistory GetRealmPlayerHistory(System.Web.UI.Page _Page, WowRealm _Realm, string _Player)
        //{
        //    var realm = GetRealmDB(_Page, _Realm, "-history");
        //    if (realm.IsPlayersHistoryLoadComplete() == false)
        //    {
        //        PageUtility.RedirectErrorLoading(_Page, StaticValues.ConvertRealmParam(_Realm) + "-history");
        //        return null;
        //    }
        //    PlayerData.PlayerHistory playerHistory;
        //    if (realm.PlayersHistory.TryGetValue(_Player, out playerHistory) == false)
        //        return null;
        //    return playerHistory;
        //}
        //public static PlayerData.Player GetRealmPlayer(System.Web.UI.Page _Page, WowRealm _Realm, string _Player)
        //{
        //    var realm = GetRealmDB(_Page, _Realm, "-latest");
        //    if (realm.IsPlayersLoadComplete() == false)
        //    {
        //        PageUtility.RedirectErrorLoading(_Page, StaticValues.ConvertRealmParam(_Realm) + "-latest");
        //        return null;
        //    }
        //    PlayerData.Player player;
        //    if (realm.Players.TryGetValue(_Player, out player) == false)
        //        return null;
        //    return player;
        //}
        //public static Dictionary<int, List<Tuple<DateTime, string>>> GetRealmCacheDB_ItemsUsed(System.Web.UI.Page _Page, WowRealm _Realm)
        //{
        //    var realm = GetRealmDB(_Page, _Realm, "-itemsused");
        //    if (realm.IsLoadComplete() == false)
        //    {
        //        PageUtility.RedirectErrorLoading(_Page, StaticValues.ConvertRealmParam(_Realm) + "-itemsused");
        //        return null;
        //    }
        //}
        public static RealmDatabase _FindRealmDB(System.Web.UI.Page _Page, WowRealm _Realm, NotLoadedDecision _Decision = NotLoadedDecision.SpinWait)
        {
            var rppDatabase = Hidden.ApplicationInstance.Instance._GetRPPDatabase(_Decision == NotLoadedDecision.SpinWait);

            if (rppDatabase == null)
            {
                if (_Decision == NotLoadedDecision.RedirectAndWait)
                {
                    PageUtility.RedirectErrorLoading(_Page, StaticValues.ConvertRealmParam(_Realm));
                }
                return(null);
            }
            return(rppDatabase.GetRealm(_Realm));
        }
コード例 #3
0
ファイル: DatabaseAccess.cs プロジェクト: cocely/RealmPlayers
        public static Dictionary <string, PlayerData.PlayerHistory> _GetRealmPlayersHistory(System.Web.UI.Page _Page, WowRealm _Realm, NotLoadedDecision _Decision = NotLoadedDecision.RedirectAndWait)
        {
            var realm = _FindRealmDB(_Page, _Realm);

            if (realm == null || (realm.IsPlayersHistoryLoadComplete() == false && _Decision != NotLoadedDecision.SpinWait))
            {
                if (_Decision == NotLoadedDecision.RedirectAndWait)
                {
                    PageUtility.RedirectErrorLoading(_Page, StaticValues.ConvertRealmParam(_Realm) + "-history");
                }
                return(null);
            }
            return(realm.PlayersHistory);
        }
コード例 #4
0
        public Player[] _NotCached_FindPlayersMatching(string _PartOfName, WowRealm _Realm, string _Race, string _Class, string _Level, PlayersMatchingSortBy _SortBy)
        {
            int lowerLevel = int.MinValue;
            int upperLevel = int.MaxValue;

            if (_Level != "All")
            {
                try
                {
                    string[] levelsStr = _Level.SplitVF("to");
                    if (levelsStr.Length >= 2)
                    {
                        lowerLevel = int.Parse(levelsStr[0]);
                        upperLevel = int.Parse(levelsStr[1]);
                    }
                }
                catch (Exception)
                { }
            }
            PlayerRace[] races = null;
            if (_Race != "All")
            {
                try
                {
                    if (_Race == "Horde")
                    {
                        races = new PlayerRace[] { PlayerRace.Orc, PlayerRace.Undead, PlayerRace.Troll, PlayerRace.Tauren, PlayerRace.Blood_Elf }
                    }
                    ;
                    else if (_Race == "Alliance")
                    {
                        races = new PlayerRace[] { PlayerRace.Human, PlayerRace.Night_Elf, PlayerRace.Gnome, PlayerRace.Dwarf, PlayerRace.Draenei }
                    }
                    ;
                    else
                    {
                        PlayerRace currRace = StaticValues.ConvertRace(_Race);
                        if (currRace != PlayerRace.Unknown)
                        {
                            races = new PlayerRace[] { currRace }
                        }
                        ;
                    }
                }
                catch (Exception)
                { }
            }
            PlayerClass[] classes = null;
            if (_Class != "All")
            {
                var currClass = StaticValues.ConvertClass(_Class);
                if (currClass != PlayerClass.Unknown)
                {
                    classes = new PlayerClass[] { currClass }
                }
                ;
            }

            List <Player> playerMatchList = new List <Player>(100000);

            foreach (var _RealmDB in DatabaseAccess.GetRealmDBs(this))
            {
                if (_Realm != WowRealm.All && _Realm != _RealmDB.Key)
                {
                    continue;
                }

                foreach (var player in _RealmDB.Value.Players)
                {
                    if (races != null && races.Contains(player.Value.Character.Race) == false)
                    {
                        continue;
                    }
                    if (classes != null && classes.Contains(player.Value.Character.Class) == false)
                    {
                        continue;
                    }
                    if (player.Value.Character.Level < lowerLevel || player.Value.Character.Level > upperLevel)
                    {
                        continue;
                    }
                    if (player.Value.Character.Race == PlayerRace.Unknown || player.Value.Character.Class == PlayerClass.Unknown)
                    {
                        continue;
                    }
                    if (_PartOfName == "" || player.Key.ToLower().Contains(_PartOfName) == true)
                    {
                        playerMatchList.Add(player.Value);
                    }
                }
            }
            if (_SortBy == PlayersMatchingSortBy.SortBy_NameSearch)
            {
                if (_PartOfName.Length >= 2)
                {
                    string nameFormattedSearchStr = char.ToUpper(_PartOfName[0]) + _PartOfName.Substring(1).ToLower();
                    return(playerMatchList.OrderByDescending(_Player => {
                        var sortValue = _Player.LastSeen;
                        if (_Player.Name.StartsWith(nameFormattedSearchStr))
                        {
                            sortValue = sortValue.AddYears(2);
                            if (_Player.Name == nameFormattedSearchStr)
                            {
                                sortValue = sortValue.AddYears(10);
                            }
                        }
                        return sortValue;
                    }).ToArray());
                }
                else
                {
                    return(playerMatchList.OrderBy(_Player => _Player.Name).ToArray());
                }
            }
            else if (_SortBy == PlayersMatchingSortBy.SortBy_Rank)
            {
                return(playerMatchList.OrderByDescending(_Player => _Player.GetRankTotal()).ToArray());
            }
            else if (_SortBy == PlayersMatchingSortBy.SortBy_Name)
            {
                return(playerMatchList.OrderBy(_Player => _Player.Name).ToArray());
            }
            else if (_SortBy == PlayersMatchingSortBy.SortBy_Guild)
            {
                return(playerMatchList.OrderBy(_Player => _Player.Guild.GuildName).ToArray());
            }
            else if (_SortBy == PlayersMatchingSortBy.SortBy_Level)
            {
                return(playerMatchList.OrderByDescending(_Player => _Player.Character.Level).ToArray());
            }
            else if (_SortBy == PlayersMatchingSortBy.SortBy_RaceClass)
            {
                return(playerMatchList.OrderBy(_Player => ((int)_Player.Character.Race) * 100 + (int)_Player.Character.Class).ToArray());
            }
            else if (_SortBy == PlayersMatchingSortBy.SortBy_TotalHKs)
            {
                return(playerMatchList.OrderByDescending(_Player => _Player.Honor.LifetimeHK).ToArray());
            }
            else if (_SortBy == PlayersMatchingSortBy.SortBy_Honor)
            {
                return(playerMatchList.OrderByDescending(_Player => _Player.Honor.LastWeekHonor).ToArray());
            }
            else if (_SortBy == PlayersMatchingSortBy.SortBy_HKs)
            {
                return(playerMatchList.OrderByDescending(_Player => _Player.Honor.LastWeekHK).ToArray());
            }
            else if (_SortBy == PlayersMatchingSortBy.SortBy_Server)
            {
                return(playerMatchList.OrderByDescending(_Player => _Player.Realm).ToArray());
            }
            else if (_SortBy == PlayersMatchingSortBy.SortBy_Seen)
            {
                return(playerMatchList.OrderByDescending(_Player => _Player.LastSeen).ToArray());
            }
            else
            {
                return(playerMatchList.ToArray());
            }
        }
コード例 #5
0
        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;
            }

            string searchStr   = PageUtility.GetQueryString(Request, "search", "null");
            string searchRealm = PageUtility.GetQueryString(Request, "realm", "All");
            string searchRace  = PageUtility.GetQueryString(Request, "race", "All");
            string searchClass = PageUtility.GetQueryString(Request, "class", "All");
            string searchLevel = PageUtility.GetQueryString(Request, "level", "All");
            string searchSort  = PageUtility.GetQueryString(Request, "sort", "NameSearch");

            if (searchStr != "")
            {
                this.Title = "Search \"" + searchStr + "\" | RealmPlayers";
            }
            else
            {
                this.Title = "Search | RealmPlayers";
            }
            //List<Tuple<WowRealm, Player>>

            WowRealm realm = StaticValues.ConvertRealm(searchRealm);

            if (realm == WowRealm.Unknown)
            {
                realm = WowRealm.All;
            }

            int nr = 0;

            if (searchStr.Length >= 4 || searchStr.Contains(' '))
            {
                var guildSummaryDB = Hidden.ApplicationInstance.Instance.GetGuildSummaryDatabase();

                var searchStrLower = searchStr.ToLower();
                var guildArray     = guildSummaryDB.GetGuilds(realm).Where((_Value) => _Value.Value.GuildName.ToLower().Contains(searchStrLower));

                if (guildArray.Count() > pageIndex * count)
                {
                    Dictionary <string, Player> realmDB = null;
                    if (realm != WowRealm.All)
                    {
                        realmDB = DatabaseAccess.GetRealmPlayers(this, realm);
                    }
                    var realmDBRealm = realm;

                    System.Text.StringBuilder guildResultTable = new System.Text.StringBuilder(10000);
                    guildResultTable.Append("<h3>Guilds matching &quot;" + searchStr + "&quot;</h3>");
                    guildResultTable.Append("<table id=\"guild-table\" class=\"table\"><thead>");
                    guildResultTable.Append(PageUtility.CreateGuildTableHeaderRow(Table_GuildColumns));
                    guildResultTable.Append("</thead><tbody>");
                    var orderedGuildArray = guildArray.OrderBy((_Value) => _Value.Key);
                    foreach (var guild in orderedGuildArray)
                    {
                        if (realmDBRealm != guild.Value.Realm)
                        {
                            realmDB      = DatabaseAccess.GetRealmPlayers(this, guild.Value.Realm);
                            realmDBRealm = guild.Value.Realm;
                        }
                        guild.Value.GenerateCache(realmDB);
                    }
                    orderedGuildArray = orderedGuildArray.OrderByDescending((_Value) => _Value.Value.GetMembers().Count);
                    foreach (var guild in orderedGuildArray)
                    {
                        if (guild.Value.GetMembers().Count < 2)
                        {
                            continue;
                        }
                        nr++;
                        if (nr > pageIndex * count && nr <= (pageIndex + 1) * count)
                        {
                            guildResultTable.Append(PageUtility.CreateGuildRow(0, guild.Value, Table_GuildColumns));
                        }
                        if (nr >= (pageIndex + 1) * count)
                        {
                            break;
                        }
                    }
                    guildResultTable.Append("</tbody></table>");
                    guildResultTable.Append("<h3>Players matching &quot;" + searchStr + "&quot;</h3>");
                    if (nr > 0)
                    {
                        m_GuildResultTableHTML = new MvcHtmlString(guildResultTable.ToString());
                    }
                }
                else
                {
                    m_GuildResultTableHTML = null;
                    nr += guildArray.Count();
                }
            }

            var playersList = FindPlayersMatching(searchStr, searchRealm, searchRace, searchClass, searchLevel, searchSort);//.OrderBy((_Value) => { return ((int)_Value.Item1).ToString() + _Value.Item2.Name; });

            System.Text.StringBuilder page = new System.Text.StringBuilder(10000);

            IEnumerable <Player> orderedPlayersList = playersList;
            //if (playersList.Count() > 500 || searchStr.Length < 2)
            //    orderedPlayersList = playersList;//.OrderBy(_Player => _Player.Item2.Name);
            //else
            //if (searchStr.Length >= 1)
            //{
            //    string nameFormattedSearchStr = char.ToUpper(searchStr[0]) + searchStr.Substring(1).ToLower();
            //    orderedPlayersList = playersList.OrderByDescending(_Player => _Player.LastSeen.AddYears(_Player.Name.StartsWith(nameFormattedSearchStr) ? 2 : 0));
            //}
            //else
            //{
            //    orderedPlayersList = playersList.OrderBy(_Player => _Player.Name);
            //}
            var playerListCount = playersList.Count();

            foreach (Player player in orderedPlayersList)
            {
                if (playerListCount < count && player.Character.Level < 10 && searchStr.Length <= (double)player.Name.Length * 0.7)
                {
                    continue;
                }

                nr++;
                if (nr > pageIndex * count && nr <= (pageIndex + 1) * count)
                {
                    page.Append(PageUtility.CreatePlayerRow(0, player.Realm, player, Table_Columns));
                }
                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_BreadCrumbHTML   = new MvcHtmlString(PageUtility.BreadCrumb_AddHome() + PageUtility.BreadCrumb_AddFinish("Characters"));
            m_CharListInfoHTML = new MvcHtmlString(CreateCharListInfo(searchStr, playersList.Count()));
            m_TableHeadHTML    = new MvcHtmlString(PageUtility.CreatePlayerTableHeaderRow(Table_Columns, null, Request));
            m_TableBodyHTML    = new MvcHtmlString(page.ToString());

            m_PaginationHTML = new MvcHtmlString(PageUtility.CreatePagination(Request, pageNr, ((playersList.Count() - 1) / count) + 1));
        }
コード例 #6
0
        public Player[] FindPlayersMatching(string _PartOfName, string _Realm, string _Race, string _Class, string _Level, string _SortBy = "NameSearch")
        {
            //FIX PARAMS
            _PartOfName = _PartOfName.ToLower();

            WowRealm realm = StaticValues.ConvertRealm(_Realm);

            if (realm == WowRealm.Unknown)
            {
                realm = WowRealm.All;
            }

            int lowerLevel = int.MinValue;
            int upperLevel = int.MaxValue;

            if (_Level != "All")
            {
                try
                {
                    string[] levelsStr = _Level.SplitVF("to");
                    if (levelsStr.Length >= 2)
                    {
                        lowerLevel = int.Parse(levelsStr[0]);
                        upperLevel = int.Parse(levelsStr[1]);
                    }
                }
                catch (Exception)
                { }
            }

            if (lowerLevel < 1 || upperLevel > 60 || upperLevel < lowerLevel)
            {
                _Level = "All";
            }
            else
            {
                _Level = lowerLevel + "to" + upperLevel;
            }

            PlayerRace[] races = null;
            if (_Race != "All")
            {
                try
                {
                    if (_Race == "Horde")
                    {
                        races = new PlayerRace[] { PlayerRace.Orc, PlayerRace.Undead, PlayerRace.Troll, PlayerRace.Tauren, PlayerRace.Blood_Elf }
                    }
                    ;
                    else if (_Race == "Alliance")
                    {
                        races = new PlayerRace[] { PlayerRace.Human, PlayerRace.Night_Elf, PlayerRace.Gnome, PlayerRace.Dwarf, PlayerRace.Draenei }
                    }
                    ;
                    else
                    {
                        PlayerRace currRace = StaticValues.ConvertRace(_Race);
                        if (currRace != PlayerRace.Unknown)
                        {
                            races = new PlayerRace[] { currRace };
                            _Race = currRace.ToString();
                        }
                    }
                }
                catch (Exception)
                { }
            }
            if (races == null)
            {
                _Race = "All";
            }

            PlayerClass[] classes = null;
            if (_Class != "All")
            {
                var currClass = StaticValues.ConvertClass(_Class);
                if (currClass != PlayerClass.Unknown)
                {
                    classes = new PlayerClass[] { currClass };
                    _Class  = currClass.ToString();
                }
            }

            if (classes == null)
            {
                _Class = "All";
            }

            PlayersMatchingSortBy sortBy = PlayersMatchingSortBy.SortBy_NameSearch;

            if (Enum.TryParse("SortBy_" + _SortBy, true, out sortBy) == false)
            {
                sortBy = PlayersMatchingSortBy.SortBy_NameSearch;
            }
            //FIX PARAMS

            if (_PartOfName.Length >= 3 || (_Race != "All" && _Class != "All"))
            {
                return(_NotCached_FindPlayersMatching(_PartOfName, realm, _Race, _Class, _Level, sortBy));
            }
            else
            {
                return(Hidden.ApplicationInstance.Instance.m_ThreadSafeCache.Get("FindPlayersMatching", _NotCached_FindPlayersMatching, _PartOfName, realm, _Race, _Class, _Level, sortBy));
            }
        }
コード例 #7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            this.Title = "Contributors | RealmPlayers";
            //var statisticsData = DatabaseAccess.GetContributorStatistics();
            //if (statisticsData == null)
            //{
            //    PageUtility.RedirectErrorLoading(this, "contributors");
            //    return;
            //}
            m_BreadCrumbHTML = new MvcHtmlString(PageUtility.BreadCrumb_AddHome() + PageUtility.BreadCrumb_AddFinish("Contributors"));

            var statsRealms = new WowRealm[] { WowRealm.Emerald_Dream, WowRealm.Warsong, WowRealm.Al_Akir, WowRealm.Rebirth, WowRealm.Nostalrius, WowRealm.Kronos, WowRealm.Archangel };

            Dictionary <WowRealm, int> totalRealmInspects = new Dictionary <WowRealm, int>();

            string realmInspectsHeaderColumns = "";

            foreach (var statsRealm in statsRealms)
            {
                realmInspectsHeaderColumns += PageUtility.CreateTableColumnHead(StaticValues.ConvertRealmViewing(statsRealm));
                totalRealmInspects.Add(statsRealm, 0);
            }

            m_TableHeadHTML = new MvcHtmlString(PageUtility.CreateTableRow("", PageUtility.CreateTableColumnHead("#Nr")
                                                                           + PageUtility.CreateTableColumnHead("Name")
                                                                           + PageUtility.CreateTableColumnHead("Total inspects")
                                                                           + realmInspectsHeaderColumns
                                                                           + PageUtility.CreateTableColumnHead("Active since")
                                                                           + PageUtility.CreateTableColumnHead("Last active")));

            SortedList <int, string> tableRows = new SortedList <int, string>();
            string tableBody = "";

            using (VF.SQLComm comm = new VF.SQLComm())
            {
                var contributors = ContributorDB.GetAllTrustWorthyContributors();
                foreach (var statRealm in statsRealms)
                {
                    totalRealmInspects[statRealm] = comm.GetRealmInspectsTotal(statRealm);
                }

                //return DynamicReloader.GetData<ContributorStatistics>(() =>
                //{
                //    VF_RPDatabase.GuildSummaryDatabase summaryDB = null;
                //    summaryDB = VF_RPDatabase.GuildSummaryDatabase.LoadSummaryDatabase(Constants.RPPDbDir);
                //    return summaryDB;
                //}, (_ContributorStatistics, _LastLoadTime) => { return (DateTime.UtcNow - _LastLoadTime).TotalMinutes > 30; });

                //DynamicReloader.GetData(() => { }, () => { return true; }, TimeSpan.FromMinutes(30), false)
                int contributorCounter = 0;
                if (false)
                {
                    foreach (var data in contributors)
                    {
                        var contributor = data.GetAsContributor();

                        DateTime earliestActive;
                        DateTime latestActive;
                        int      totalInspects;
                        if (comm.GetInspectsInfoForContributor(contributor, out earliestActive, out latestActive, out totalInspects) == true)
                        {
                            string realmInspectsColumns = "";

                            if (totalInspects > 0 && data.Name != "Unknown" &&
                                ((DateTime.UtcNow - latestActive).TotalDays < 15 ||
                                 (totalInspects > 5000 && (DateTime.UtcNow - latestActive).TotalDays < 60)))
                            {
                                foreach (var statRealm in statsRealms)
                                {
                                    int inspects = comm.GetRealmInspectsForContributor(contributor, statRealm);
                                    realmInspectsColumns += PageUtility.CreateTableColumn(inspects.ToString());
                                }

                                int keyToUse = int.MaxValue - totalInspects * 100;
                                while (tableRows.ContainsKey(keyToUse) == true)
                                {
                                    keyToUse += 1;
                                }


                                tableRows.Add(keyToUse, PageUtility.CreateTableColumn(data.Name)
                                              + PageUtility.CreateTableColumn(totalInspects.ToString())
                                              + realmInspectsColumns
                                              + PageUtility.CreateTableColumn(earliestActive.ToString("yyy-MM-dd"))
                                              + PageUtility.CreateTableColumn(StaticValues.GetTimeSinceLastSeenUTC(latestActive)));
                            }
                        }


                        if (contributorCounter++ % 100 == 0)
                        {
                            Logger.ConsoleWriteLine("Generated Contributor Inspects Info for Contributor Nr " + contributorCounter);
                        }
                    }
                }
            }
            int    totalALLInspects         = 0;
            string totalRealmInspectsColumn = "";

            foreach (var statRealm in statsRealms)
            {
                totalRealmInspectsColumn += PageUtility.CreateTableColumn(totalRealmInspects[statRealm].ToString());
                totalALLInspects         += totalRealmInspects[statRealm];
            }
            tableBody += PageUtility.CreateTableRow("", PageUtility.CreateTableColumn("#ALL") + PageUtility.CreateTableColumn("TOTAL")
                                                    + PageUtility.CreateTableColumn(totalALLInspects.ToString())
                                                    + totalRealmInspectsColumn
                                                    + PageUtility.CreateTableColumn("-")
                                                    + PageUtility.CreateTableColumn("-"));
            int i = 1;

            foreach (var tableRow in tableRows)
            {
                tableBody += PageUtility.CreateTableRow("", PageUtility.CreateTableColumn("#" + i++) + tableRow.Value);
            }
            m_TableBodyHTML = new MvcHtmlString(tableBody);

            m_ContributorsInfoHTML = new MvcHtmlString(
                "<h1>Contributors<span class='badge badge-inverse'>" + tableRows.Count() + " Players</span></h1>"
                + "<p>List displays the persons that contribute data to this project. Sorted by the amount of inspects they have contributed with.</p>"
                + "<br/><p>The more contributors the better! If you are interested in being a contributor to help out the project please do not hesitate contacting <a href='http://forum.realmplayers.com/memberlist.php?mode=viewprofile&u=51'>Sethzer</a> on RealmPlayers forums. Make sure you also read the thread: <a href='http://realmplayers.com:5555/viewtopic.php?f=14&t=15'>About Data Contribution</a>.</p><br/>");
        }
コード例 #8
0
        public string CreateInventoryInfo(List <PlayerItemInfo> _Items, PlayerRace _Race, PlayerClass _Class, PlayerSex _Sex, WowRealm _Realm = WowRealm.All, WowVersionEnum _WowVersion = WowVersionEnum.Vanilla)
        {
            string invInfo = "";

            string currentItemDatabase = DatabaseAccess.GetCurrentItemDatabaseAddress();

            var itemSummaryDB = Hidden.ApplicationInstance.Instance.GetItemSummaryDatabase();

            string modelEqString = "";
            var    itemIDs       = _Items.Select((_Value) => _Value.ItemID);

            foreach (var item in _Items)
            {
                var itemInfo = DatabaseAccess.GetItemInfo(item.ItemID, _WowVersion);
                if (itemInfo == null)
                {
                    invInfo += "<div class='equipment-slot' id='" + CharacterViewer.ItemSlotToIDConversion[item.Slot] + "'><div class='quality' id='epic'></div><img src='assets/img/icons/inv_misc_questionmark.png'/></div>";
                }
                else
                {
                    string currInvInfo = "<div class='equipment-slot' id='" + CharacterViewer.ItemSlotToIDConversion[item.Slot] + "'>"
                                         + "<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, _WowVersion, itemInfo.GenerateSetPcsStr(itemIDs));

                    if (item.Slot == ItemSlot.Head && ModelViewerOptions.HideHead == true)
                    {
                    }
                    else
                    {
                        if ((_Class == VF_RealmPlayersDatabase.PlayerClass.Hunter && (item.Slot == ItemSlot.Main_Hand || item.Slot == ItemSlot.Off_Hand)) ||
                            (_Class != VF_RealmPlayersDatabase.PlayerClass.Hunter && item.Slot == ItemSlot.Ranged))
                        {
                        }
                        else
                        {
                            int modelViewerID   = 0;
                            int modelViewerSlot = 0;
                            if (itemInfo.GetModelViewerIDAndSlot(item.Slot, out modelViewerID, out modelViewerSlot, true) == true)
                            {
                                if (item.Slot == ItemSlot.Off_Hand)
                                {
                                    if (itemInfo.AjaxTooltip.Contains("Shield") == false)
                                    {
                                        modelViewerSlot = 22;
                                    }
                                }
                                if (modelViewerID != 0)
                                {
                                    modelEqString = modelEqString + "," + modelViewerSlot + "," + modelViewerID;
                                }
                            }
                        }
                    }
                    //List<Tuple<DateTime, string>> players = null;
                    if (_Realm != WowRealm.All)
                    {
                        int usageCount = itemSummaryDB.GetItemUsageCount(_Realm, item);
                        currInvInfo += "<a class='itemplayersframe' href='ItemUsageInfo.aspx?realm=" + StaticValues.ConvertRealmParam(_Realm) + "&item=" + item.ItemID + (item.SuffixID != 0 ? "&suffix=" + item.SuffixID : "") + "'>" + usageCount + "</a>";
                    }
                    currInvInfo += "</div>";
                    invInfo     += currInvInfo;
                }
            }
            invInfo += "<img style='position: absolute;z-index: 1; pointer-events: none;' src='assets/img/bg/CharacterBackgroundTransparent.png'></img>";

            string modelViewerQuery = PageUtility.GetQueryString(Request, "modelviewer", "unknown").ToLower();

            if (modelViewerQuery != "false" && modelEqString != "" && ModelViewerOptions.View3DModel == true)
            {
                if (modelEqString[0] == ',')//För att bli av med det första ","
                {
                    modelEqString = modelEqString.Substring(1);
                }
                //modelEqString = "1,33743,3,33653,5,33650,6,31110,7,31115,8,31111,9,31127,10,33651,13,25629";
                string modelCharString = ((_Race == VF_RealmPlayersDatabase.PlayerRace.Undead) ? "Scourge" : _Race.ToString().Replace("_", "")) + _Sex.ToString();// "orcmale";

                invInfo += "<div style='z-index: 0; position: absolute; margin: 33px 77px; width:385px; height:512px;'><object type='application/x-shockwave-flash' data='http://wow.zamimg.com/modelviewer/ZAMviewerfp11.swf' width='385' height='512' id='dsjkgbdsg2346' style='visibility: visible;'>"
                           + "<param name='quality' value='low'>"
                           + "<param name='allowscriptaccess' value='always'>"
                           + "<param name='allowfullscreen' value='false'>"
                           + "<param name='menu' value='false'>"
                           + "<param name='bgcolor' value='#181818'>"
                           + "<param name='wmode' value='direct'>"
                           + "<param name='flashvars' value='hd=false&amp;model="
                           + modelCharString
                           + "&amp;modelType=16&amp;contentPath=http://wow.zamimg.com/modelviewer/&amp;equipList="
                           + modelEqString
                           + "'>"
                           + "</object></div>";
            }
            else
            {
                invInfo += "<img class='characterimage' src='" + StaticValues.GetRaceCrestImageUrl(_Race) + "'></img>";
            }

            Hidden.ApplicationInstance.Instance.BackupItemInfos();
            return(invInfo);
        }
コード例 #9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string   dataStr  = PageUtility.GetQueryString(Request, "data");
            string   charStr  = PageUtility.GetQueryString(Request, "char");
            string   itemsStr = PageUtility.GetQueryString(Request, "items");
            WowRealm realm    = PageUtility.GetQueryRealm(Request);

            if (realm == WowRealm.Unknown)
            {
                realm = WowRealm.All;
            }
            var wowVersion = PageUtility.GetQueryWowVersion(Request);

            if (PageUtility.GetQueryString(Request, "generateShortURL") != "null")
            {
                var    fullURL  = "http://realmplayers.com/CharacterDesigner.aspx?char=" + charStr + "&items=" + itemsStr;
                string shortURL = "";
                if (g_CachedShortURLs.TryGetValue(fullURL, out shortURL) == false)
                {
                    shortURL = VF.URLShortener.CreateShortURL(fullURL);
                    if (shortURL == "")
                    {
                        Response.Redirect(PageUtility.CreateUrlWithNewQueryValue(Request, "generateShortURL", "null"));
                    }

                    g_CachedShortURLs.TryAdd(fullURL, shortURL);
                    g_CachedShortURLs.TryAdd(shortURL, fullURL);
                }
                //if (Request.Url.Host == "localhost")
                //    Response.Redirect("localhost:4633/CharacterDesigner.aspx?char=" + charStr + "&items=" + itemsStr);
                //else
                Response.Redirect("CharacterDesigner.aspx?data=" + shortURL.Substring(shortURL.LastIndexOf("/") + 1));
            }
            if (dataStr == "null" && itemsStr == "null")
            {
                return;
            }
            if (dataStr != "null" && itemsStr == "null")
            {
                try
                {
                    string fullURL = "";
                    if (g_CachedShortURLs.TryGetValue("http://goo.gl/" + dataStr, out fullURL) == false)
                    {
                        fullURL = VF.URLShortener.GetFullURL("http://goo.gl/" + dataStr);
                        if (fullURL == "")
                        {
                            return;
                        }
                        g_CachedShortURLs.TryAdd("http://goo.gl/" + dataStr, fullURL);
                    }
                    var url         = new Uri(fullURL);
                    var queryString = System.Web.HttpUtility.ParseQueryString(url.Query);
                    itemsStr = queryString.Get("items");
                    if (itemsStr == null)
                    {
                        return;
                    }
                    var tempcharStr = queryString.Get("char");
                    if (tempcharStr != null)
                    {
                        charStr = tempcharStr;
                    }
                }
                catch (Exception)
                {
                    return;
                }
            }
            m_BreadCrumbHTML = new MvcHtmlString(PageUtility.BreadCrumb_AddFinish("Character Designer"));

            List <PlayerItemInfo> itemsList = new List <PlayerItemInfo>();
            var itemsStrSplit = itemsStr.Split(',', '+', ' ');

            Func <PlayerItemInfo, PlayerItemInfo, bool> slotEqualFunc = (_Value1, _Value2) => _Value1.Slot == _Value2.Slot;

            foreach (string itemLink in itemsStrSplit)
            {
                try
                {
                    itemsList.AddUnique(new PlayerItemInfo(itemLink, wowVersion), slotEqualFunc);
                }
                catch (Exception)
                {
                    try
                    {
                        var splittedLink = itemLink.Split(':', 'x');
                        if (splittedLink.Length > 1)
                        {
                            PlayerItemInfo itemInfo = new PlayerItemInfo("1:0:0:0:0:0:0:0:0", wowVersion);
                            if (Enum.TryParse(splittedLink[0], true, out itemInfo.Slot) == false)
                            {
                                itemInfo.Slot = (ItemSlot)int.Parse(splittedLink[0]);
                            }

                            itemInfo.ItemID = int.Parse(splittedLink[1]);

                            if (splittedLink.Length > 2)
                            {
                                itemInfo.EnchantID = int.Parse(splittedLink[2]);
                            }
                            if (splittedLink.Length > 3)
                            {
                                itemInfo.SuffixID = int.Parse(splittedLink[3]);
                            }
                            if (splittedLink.Length > 4)
                            {
                                itemInfo.UniqueID = int.Parse(splittedLink[4]);
                            }
                            if (splittedLink.Length > 5 && wowVersion == WowVersionEnum.TBC)
                            {
                                itemInfo.GemIDs    = new int[4];
                                itemInfo.GemIDs[0] = int.Parse(splittedLink[5]);
                                itemInfo.GemIDs[1] = 0;
                                itemInfo.GemIDs[2] = 0;
                                itemInfo.GemIDs[3] = 0;
                                if (splittedLink.Length > 6)
                                {
                                    itemInfo.GemIDs[1] = int.Parse(splittedLink[6]);
                                }
                                if (splittedLink.Length > 7)
                                {
                                    itemInfo.GemIDs[2] = int.Parse(splittedLink[7]);
                                }
                                if (splittedLink.Length > 8)
                                {
                                    itemInfo.GemIDs[3] = int.Parse(splittedLink[8]);
                                }
                            }

                            itemsList.AddUnique(itemInfo, slotEqualFunc);
                        }
                    }
                    catch (Exception)
                    {}
                }
            }
            PlayerRace  playerRace  = PlayerRace.Orc;
            PlayerClass playerClass = PlayerClass.Warrior;
            PlayerSex   playerSex   = PlayerSex.Male;

            if (charStr != "null")
            {
                try
                {
                    var charStrSplit = charStr.Split(',', '+', ' ');
                    if (charStrSplit.Length > 0)
                    {
                        if (Enum.TryParse(charStrSplit[0], true, out playerRace) == false)
                        {
                            playerRace = (PlayerRace)int.Parse(charStrSplit[0]);
                        }
                    }
                    if (charStrSplit.Length > 1)
                    {
                        if (Enum.TryParse(charStrSplit[1], true, out playerClass) == false)
                        {
                            playerClass = (PlayerClass)int.Parse(charStrSplit[1]);
                        }
                    }
                    if (charStrSplit.Length > 2)
                    {
                        if (Enum.TryParse(charStrSplit[2], true, out playerSex) == false)
                        {
                            playerSex = (PlayerSex)int.Parse(charStrSplit[2]);
                        }
                    }
                }
                catch (Exception)
                {}
            }
            if (playerRace == PlayerRace.Unknown)
            {
                playerRace = PlayerRace.Orc;
            }
            if (playerClass == PlayerClass.Unknown)
            {
                playerClass = PlayerClass.Warrior;
            }
            if (playerSex == PlayerSex.Unknown)
            {
                playerSex = PlayerSex.Male;
            }

            m_InventoryInfoHTML = new MvcHtmlString(CreateInventoryInfo(itemsList, playerRace, playerClass, playerSex, realm, wowVersion));
            GenerateGearStats(itemsList, wowVersion);
            if (dataStr != "null")
            {
                m_CharacterDesignerInfo = new MvcHtmlString("Short link for this Character: <br /><a href='http://realmplayers.com/vchar/" + dataStr + ".aspx'>http://realmplayers.com/vchar/" + dataStr + ".aspx</a> or <a href='http://goo.gl/" + dataStr + "'>http://goo.gl/" + dataStr + "</a>");
            }
            else
            {
                m_CharacterDesignerInfo = new MvcHtmlString("<a href='" + PageUtility.CreateUrlWithNewQueryValue(Request, "generateShortURL", "true") + "'>Click here to create a short link for this Character</a>");
            }

            if (IsPostBack == false)
            {
                foreach (var item in itemsList)
                {
                    int    gemIDcount = item.GetGemIDCount();
                    string itemStr    = item.ItemID.ToString();
                    if (item.EnchantID != 0 || item.SuffixID != 0 || item.UniqueID != 0 || gemIDcount != 0)
                    {
                        itemStr += "x" + item.EnchantID.ToString();
                        if (item.SuffixID != 0 || item.UniqueID != 0 || gemIDcount != 0)
                        {
                            itemStr += "x" + item.SuffixID.ToString();
                        }
                        if (item.UniqueID != 0 || gemIDcount != 0)
                        {
                            itemStr += "x" + item.UniqueID.ToString();
                        }
                        if (gemIDcount != 0)
                        {
                            for (int i = 0; i < gemIDcount; ++i)
                            {
                                itemStr += "x" + item.GemIDs[i].ToString();
                            }
                        }
                    }
                    switch (item.Slot)
                    {
                    case ItemSlot.Head:
                        txtHeadSlot.Text = itemStr;
                        break;

                    case ItemSlot.Neck:
                        txtNeckSlot.Text = itemStr;
                        break;

                    case ItemSlot.Shoulder:
                        txtShoulderSlot.Text = itemStr;
                        break;

                    case ItemSlot.Shirt:
                        txtShirtSlot.Text = itemStr;
                        break;

                    case ItemSlot.Chest:
                        txtChestSlot.Text = itemStr;
                        break;

                    case ItemSlot.Belt:
                        txtBeltSlot.Text = itemStr;
                        break;

                    case ItemSlot.Legs:
                        txtLegsSlot.Text = itemStr;
                        break;

                    case ItemSlot.Feet:
                        txtFeetSlot.Text = itemStr;
                        break;

                    case ItemSlot.Wrist:
                        txtWristSlot.Text = itemStr;
                        break;

                    case ItemSlot.Gloves:
                        txtGlovesSlot.Text = itemStr;
                        break;

                    case ItemSlot.Finger_1:
                        txtRing1Slot.Text = itemStr;
                        break;

                    case ItemSlot.Finger_2:
                        txtRing2Slot.Text = itemStr;
                        break;

                    case ItemSlot.Trinket_1:
                        txtTrinket1Slot.Text = itemStr;
                        break;

                    case ItemSlot.Trinket_2:
                        txtTrinket2Slot.Text = itemStr;
                        break;

                    case ItemSlot.Back:
                        txtBackSlot.Text = itemStr;
                        break;

                    case ItemSlot.Main_Hand:
                        txtMainhandSlot.Text = itemStr;
                        break;

                    case ItemSlot.Off_Hand:
                        txtOffhandSlot.Text = itemStr;
                        break;

                    case ItemSlot.Ranged:
                        txtRangedSlot.Text = itemStr;
                        break;

                    case ItemSlot.Tabard:
                        txtTabardSlot.Text = itemStr;
                        break;

                    default:
                        break;
                    }
                }

                ddlRace.SelectedValue = playerRace.ToString();
                if (StaticValues.GetFaction(playerRace) == VF_RealmPlayersDatabase.PlayerFaction.Horde)
                {
                    ddlRace.Style.Add("color", "#ff4546");
                }
                else
                {
                    ddlRace.Style.Add("color", "#45a3ff");
                }

                ddlClass.SelectedValue = playerClass.ToString();
                ddlClass.Style.Add("color", PageUtility.GetClassColor(playerClass));

                ddlSex.SelectedValue = playerSex.ToString();
            }
        }
コード例 #10
0
ファイル: Error.aspx.cs プロジェクト: Vipeax/RealmPlayers
        protected void Page_Load(object sender, EventArgs e)
        {
            this.Title = "Error | RealmPlayers";
            string reasonStr = Request.QueryString.Get("reason");

            if (reasonStr == "loading")
            {
                Response.AppendHeader("Refresh", "10");

                string returnStr = Request.QueryString.Get("return");
                if (returnStr != null)
                {
                    returnStr = System.Web.HttpUtility.UrlDecode(returnStr);
                }
                else
                {
                    returnStr = "";
                }

                var rppDatabase      = Hidden.ApplicationInstance.Instance.GetRPPDatabase(false);
                var itemInfoCache    = Hidden.ApplicationInstance.Instance.GetItemInfoCache(VF_RealmPlayersDatabase.WowVersionEnum.Vanilla, false);
                var itemInfoCacheTBC = Hidden.ApplicationInstance.Instance.GetItemInfoCache(VF_RealmPlayersDatabase.WowVersionEnum.TBC, false);

                m_ErrorTextData = new MvcHtmlString("<h1>Website Database Loading</h1>" +
                                                    "<p>The website is currently loading the database which means you will unfortunately have to wait a bit before it is done."
                                                    + "<br />Depending on what section you are trying to visit this may take anywhere between 10 seconds and 5 minutes."
                                                    + "<br />You can have a look around other parts of the website while the database is loading" + (rppDatabase != null ? ", may i suggest <a class='nav' href='PVPList.aspx?section=lifetime_kills'>Lifetime Kills</a>?" : "")
                                                    + "<br /><br />The website auto refreshes every 10 seconds and when loading is done will redirect you automatically to"
                                                    + "<br /><a class='nav' href='" + returnStr + "'>" + returnStr + "</a></p>");

                if (rppDatabase != null && itemInfoCache != null && itemInfoCacheTBC != null)
                {
                    string waitStr = Request.QueryString.Get("wait");
                    if (waitStr != null)
                    {
                        if (waitStr.Contains('-'))
                        {
                            string[] waitParts = waitStr.Split('-');
                            var      realm     = StaticValues.ConvertRealm(waitParts[0]);
                            if (realm != VF_RealmPlayersDatabase.WowRealm.Unknown)
                            {
                                var realmDatabase = rppDatabase.GetRealm(realm);
                                if (realmDatabase.IsPlayersLoadComplete() == false)
                                {
                                    return;
                                }
                                if (waitParts.Length > 1)
                                {
                                    if (waitParts[1] == "history")
                                    {
                                        if (realmDatabase.IsPlayersHistoryLoadComplete() == false)
                                        {
                                            return;
                                        }
                                    }
                                    //else if (waitParts[1] == "itemsused")
                                    //{
                                    //    if (realmDatabase.IsLoadComplete() == false)
                                    //        return;
                                    //    var cacheDB = realmDatabase.GetCacheDatabase(false, true);
                                    //    if (cacheDB == null || cacheDB.IsItemsUsedLoaded() == false)
                                    //        return;
                                    //}
                                    else if (waitParts[1] == "guilds")
                                    {
                                        if (realmDatabase.IsLoadComplete() == false)
                                        {
                                            return;
                                        }
                                    }
                                }
                            }
                            else
                            {
                                if (waitParts[0] == "itemdropdatabase")
                                {
                                    if (DatabaseAccess.GetItemDropDatabase(this, VF_RealmPlayersDatabase.WowVersionEnum.Vanilla, NotLoadedDecision.ReturnNull) == null)
                                    {
                                        return;
                                    }
                                }
                            }
                        }
                        else if (waitStr == "contributors")
                        {
                            if (DatabaseAccess.GetContributorStatistics() == null)
                            {
                                return;
                            }
                        }
                    }
                    Response.Redirect(returnStr);
                }
            }
            else if (reasonStr == "website_error")
            {
                string returnStr = Request.QueryString.Get("return");
                if (returnStr != null)
                {
                    returnStr = System.Web.HttpUtility.UrlDecode(returnStr);
                }
                else
                {
                    returnStr = "";
                }

                Response.AppendHeader("Refresh", "20;URL=" + returnStr);

                m_ErrorTextData = new MvcHtmlString("<h1>Website Error</h1>" +
                                                    "<p>There was some error that caused you to be redirect to this site."
                                                    + "<br />The error you encountered has been logged. Please report this error at the forum <a href='http://forum.realmplayers.com'>http://forum.realmplayers.com</a> so i can investigate it and solve it as soon as possible."
                                                    + "<br />You will get redirected to another section of the website to avoid further errors."
                                                    + "<br /><br />The website will refresh after 20 seconds and will redirect you automatically to"
                                                    + "<br /><a class='nav' href='" + returnStr + "'>" + returnStr + "</a></p>");
            }
        }
コード例 #11
0
 public string GetRealmParam()
 {
     return(StaticValues.ConvertRealmParam(m_Realm));
 }
コード例 #12
0
        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 + "' };");
        }
コード例 #13
0
        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", 50);

            if (count > 500)
            {
                count = 500;
            }

            var realm = RealmControl.Realm;

            if (realm == WowRealm.Unknown)
            {
                return;
            }

            this.Title = "Guilds @ " + StaticValues.ConvertRealmParam(realm) + " | RealmPlayers";

            var realmDB = DatabaseAccess.GetRealmPlayers(this, realm, NotLoadedDecision.RedirectAndWait);

            var guildSummaryDB = Hidden.ApplicationInstance.Instance.GetGuildSummaryDatabase();
            //;// DatabaseAccess.GetRealmGuilds(this, realm, NotLoadedDecision.RedirectAndWait).Where((guild) => { return guild.Value.GetTotalPlayers() > 0; })
            var    guildArray = guildSummaryDB.GetGuilds(realm);//.OrderByDescending((guild) => { return guild.Value.Players.Count; });
            string page       = "";
            int    nr         = 0;

            string guildProgressData = "";

            List <Tuple <int, Tuple <VF_RPDatabase.GuildSummary, string> > > progressGuilds = new List <Tuple <int, Tuple <VF_RPDatabase.GuildSummary, string> > >();

            foreach (var guild in guildArray)
            {
                guild.Value.GenerateCache(realmDB);
                if (guild.Value.GetMembers().Count > 0)
                {
                    string thisGuildProgressData   = guild.Value.m_GuildProgressData.Item1;
                    int    progressComparisonValue = guild.Value.m_GuildProgressData.Item2;
                    if (thisGuildProgressData == "" && guild.Value.Stats_GetTotalMaxLevels() >= 25)
                    {
                        try
                        {
                            thisGuildProgressData           = CreateProgressStr(this, guild.Value, realm, out progressComparisonValue);
                            guild.Value.m_GuildProgressData = Tuple.Create(thisGuildProgressData, progressComparisonValue);
                        }
                        catch (Exception ex)
                        {
                            Logger.LogException(ex);
                        }
                    }
                    progressGuilds.Add(Tuple.Create(progressComparisonValue, Tuple.Create(guild.Value, thisGuildProgressData)));
                }
            }
            var orderedProgressGuilds = progressGuilds.OrderByDescending(_Value =>
            {
                UInt64 sortValue = (((UInt64)_Value.Item1) << 32);
                if (sortValue != 0)
                {
                    //sortValue |= (((UInt64)(UInt32)_Value.Item2.Item1.Stats_GetAveragePVPRank()) << 16) | ((UInt64)(UInt32)_Value.Item2.Item1.GetMembers().Count);
                    sortValue |= (((UInt64)(UInt32)_Value.Item2.Item1.Stats_GetAverageMemberHKs()) << 16) | ((UInt64)(UInt32)_Value.Item2.Item1.GetMembers().Count);
                }
                else
                {
                    sortValue |= (UInt64)(UInt32)_Value.Item2.Item1.Stats_GetTotalMaxLevels();
                }
                return(sortValue);
            });

            if (orderedProgressGuilds.Count() > 0)
            {
                if (GuildProgress.GetProgressAQ40(orderedProgressGuilds.First().Item1) == 0) //AQ Content not released
                {
                    guildProgressData += "g_AQReleased = false;";
                }
                else
                {
                    guildProgressData += "g_AQReleased = true;";
                }
                if (GuildProgress.GetProgressNaxx(orderedProgressGuilds.First().Item1) == 0) //Naxx Content not released
                {
                    guildProgressData += "g_NaxxReleased = false;";
                }
                else
                {
                    guildProgressData += "g_NaxxReleased = true;";
                }
            }
            foreach (var guild in orderedProgressGuilds)
            {
                nr++;
                if (nr > pageIndex * count && nr <= (pageIndex + 1) * count)
                {
                    page += PageUtility.CreateGuildRow(nr, guild.Item2.Item1, Table_Columns);
                    guildProgressData += guild.Item2.Item2;
                }
                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_BreadCrumbHTML = new MvcHtmlString(PageUtility.BreadCrumb_AddHome()
                                                 + PageUtility.BreadCrumb_AddRealm(RealmControl.Realm)
                                                 + PageUtility.BreadCrumb_AddFinish("Guilds"));
            m_GuildListInfoHTML = new MvcHtmlString(CreateGuildListInfo(StaticValues.GetWowVersion(RealmControl.Realm), progressGuilds.Count));
            m_TableHeadHTML     = new MvcHtmlString(PageUtility.CreateGuildTableHeaderRow(Table_Columns));
            m_TableBodyHTML     = new MvcHtmlString(page);

            m_PaginationHTML  = new MvcHtmlString(PageUtility.CreatePagination(Request, pageNr, ((guildArray.Count() - 1) / count) + 1));
            m_GuildScriptData = new MvcHtmlString("<script>var guildProgress = new Array();"
                                                  + guildProgressData
                                                  + "</script>");
        }
コード例 #14
0
ファイル: PVPList.aspx.cs プロジェクト: cocely/RealmPlayers
        public string CreateStandingsTable(WowRealm _Realm, int _Count, Func <Player, bool> _RequirementLambda)
        {
            int pageIndex = PageUtility.GetQueryInt(Request, "page", 1) - 1;//Change range from 0 to * instead of 1 to *

            string commonTable = "<table id='characters-table' class='table'>";

            commonTable += "<thead>" + PageUtility.CreatePlayerTableHeaderRow(Table_Standings_Columns) + "</thead>";
            string hordeTable    = commonTable + "<tbody>";
            string allianceTable = commonTable + "<tbody>";
            Func <KeyValuePair <string, Player>, double> sortLambda = (KeyValuePair <string, Player> player) =>
            {
                double daysSinceLastSeen = (DateTime.UtcNow - player.Value.LastSeen).TotalDays;
                if (daysSinceLastSeen > 7)
                {
                    return(int.MaxValue);
                }
                return((double)player.Value.Honor.LastWeekStanding + (daysSinceLastSeen / 10.0));
            };
            var playerArray = DatabaseAccess.GetRealmPlayers(this, _Realm, NotLoadedDecision.RedirectAndWait).OrderBy(sortLambda);

            DateTime lastRankUpdateDateUTC = StaticValues.CalculateLastRankUpdadeDateUTC(_Realm);

            int hordeCount    = 0;
            int allianceCount = 0;

            foreach (var player in playerArray)
            {
                if ((player.Value.LastSeen - lastRankUpdateDateUTC).TotalHours > 0)
                {
                    var playerFaction = StaticValues.GetFaction(player.Value.Character.Race);
                    if (playerFaction == VF_RealmPlayersDatabase.PlayerFaction.Horde &&
                        hordeCount < (pageIndex + 1) * _Count &&
                        _RequirementLambda(player.Value) == true)
                    {
                        hordeCount++;
                        if (hordeCount > pageIndex * _Count && hordeCount <= (pageIndex + 1) * _Count)
                        {
                            hordeTable += PageUtility.CreatePlayerRow(hordeCount, _Realm, player.Value, Table_Standings_Columns);
                        }
                    }
                    else if (playerFaction == VF_RealmPlayersDatabase.PlayerFaction.Alliance &&
                             allianceCount < (pageIndex + 1) * _Count &&
                             _RequirementLambda(player.Value) == true)
                    {
                        allianceCount++;
                        if (allianceCount > pageIndex * _Count && allianceCount <= (pageIndex + 1) * _Count)
                        {
                            allianceTable += PageUtility.CreatePlayerRow(allianceCount, _Realm, player.Value, Table_Standings_Columns);
                        }
                    }
                }
                if (hordeCount >= (pageIndex + 1) * _Count && allianceCount >= (pageIndex + 1) * _Count)
                {
                    break;
                }
            }
            hordeTable    += "</tbody></table>";
            allianceTable += "</tbody></table>";
            string pageTable = "";

            pageTable += PageUtility.CreateDiv("span6", hordeTable);
            pageTable += PageUtility.CreateDiv("span6", allianceTable);
            pageTable  = PageUtility.CreateDiv("row", pageTable);

            if ((hordeCount != 0 && hordeCount < pageIndex * _Count) && (allianceCount != 0 && allianceCount < pageIndex * _Count))
            {
                pageIndex = (hordeCount - 1) / _Count;
                if (pageIndex < (allianceCount - 1) / _Count)
                {
                    pageIndex = (allianceCount - 1) / _Count;
                }
                Response.Redirect(PageUtility.CreateUrlWithNewQueryValue(Request, "page", (pageIndex + 1).ToString()));
            }
            return(pageTable);
        }
コード例 #15
0
ファイル: PVPList.aspx.cs プロジェクト: cocely/RealmPlayers
        protected void Page_Load(object sender, EventArgs e)
        {
            string sectionStr = PageUtility.GetQueryString(Request, "section", "ranks");
            int    count      = PageUtility.GetQueryInt(Request, "count", 100);

            if (count > 500)
            {
                count = 500;
            }

            var realm = RealmControl.Realm;

            if (realm == WowRealm.Unknown)
            {
                return;
            }
            var wowVersion = StaticValues.GetWowVersion(realm);

            PlayerColumn[] lifetimeKillsColumns = Table_Lifetime_Kills_Columns;
            PlayerColumn[] rankColumns          = Table_Ranks_Columns;
            Func <KeyValuePair <string, Player>, double> rankSorterLambda = (KeyValuePair <string, Player> _Player) => { return(_Player.Value.GetRankTotal()); };
            Func <Player, bool> rankShowLambda = (Player _Player) => { return(_Player.ReceivedStandingLastWeek() == true && ((DateTime.UtcNow - _Player.LastSeen).TotalDays <= 7.0)); };

            if (wowVersion == VF_RealmPlayersDatabase.WowVersionEnum.TBC)
            {
                lifetimeKillsColumns = Table_Lifetime_Kills_Columns_TBC;
                rankColumns          = Table_Ranks_Columns_TBC;
                rankSorterLambda     = (KeyValuePair <string, Player> _Player) => {
                    return(_Player.Value.GetArenaRatingTotal());
                };
                rankShowLambda = (Player _Player) => {
                    return(_Player.Arena != null);
                };
            }
            if (sectionStr == "standings")
            {
                this.Title = "Standings @ " + StaticValues.ConvertRealmParam(realm) + " | RealmPlayers";

                m_PageHTML = new MvcHtmlString(CreateStandingsTable(realm, count, (player) => { return(player.ReceivedStandingLastWeek()); }));

                if (wowVersion == VF_RealmPlayersDatabase.WowVersionEnum.TBC)
                {
                    GeneratePageDetails("Standings", count * 2, "TBC works with a different PVP system so there are no standings.");
                }
                else
                {
                    var rankUpdateDay = StaticValues.GetRankUpdadeDayType(realm);
                    switch (rankUpdateDay)
                    {
                    case VF_RealmPlayersDatabase.StaticValues.RankUpdateDayType.Wednesday_Morning:
                        GeneratePageDetails("Standings", count * 2, "Last weeks standings for players. Only shows players who received a standing last week. This list resets when the realm calculates new standings for players every wednesday morning.");
                        break;

                    case VF_RealmPlayersDatabase.StaticValues.RankUpdateDayType.Wednesday_Midday:
                        GeneratePageDetails("Standings", count * 2, "Last weeks standings for players. Only shows players who received a standing last week. This list resets when the realm calculates new standings for players every wednesday.");
                        break;

                    case VF_RealmPlayersDatabase.StaticValues.RankUpdateDayType.Sunday_Midnight:
                        GeneratePageDetails("Standings", count * 2, "Last weeks standings for players. Only shows players who received a standing last week. This list resets when the realm calculates new standings for players every sunday midnight.");
                        break;

                    default:
                        break;
                    }
                }
            }
            else if (sectionStr == "twink_ranks")
            {
                this.Title = "Twinks @ " + StaticValues.ConvertRealmParam(realm) + " | RealmPlayers";

                m_PageHTML = new MvcHtmlString(CreatePVPTable(realm, count, Table_Twink_Ranks_Columns
                                                              , (KeyValuePair <string, Player> _Player) => { return(_Player.Value.GetRankTotal()); }
                                                              , (Player _Player) => { return(_Player.Character.Level > 10 && _Player.Character.Level < 60 && _Player.Honor.CurrentRank > 0 && (DateTime.UtcNow - _Player.LastSeen).TotalDays <= 30); }));
                GeneratePageDetails("Twinks", count, "PVP Ranks for players that are below lvl 60. This is meant to show active twinks on the realm. Only shows players that was seen less than 30 days ago");
            }
            else if (sectionStr == "lifetime_kills")
            {
                this.Title = "Lifetime Kills @ " + StaticValues.ConvertRealmParam(realm) + " | RealmPlayers";

                m_PageHTML = new MvcHtmlString(CreatePVPTable(realm, count, lifetimeKillsColumns
                                                              , (KeyValuePair <string, Player> _Player) => { return(_Player.Value.Honor.LifetimeHK); }
                                                              , (Player _Player) => { return(true); }));

                GeneratePageDetails("Lifetime Kills", count, "List sorted by the amount of total honorable kills received. This is to show the players who have pvped the most overall.");
            }
            else if (sectionStr == "highest_ranks")
            {
                this.Title = "Highest Ranks @ " + StaticValues.ConvertRealmParam(realm) + " | RealmPlayers";

                if (wowVersion == VF_RealmPlayersDatabase.WowVersionEnum.TBC)
                {
                    m_PageHTML = new MvcHtmlString("");
                    GeneratePageDetails("Highest Ranks", count, "TBC works with a different PVP system so there are no lifetime highest ranks.");
                }
                else
                {
                    var      playerSummaryDB     = Hidden.ApplicationInstance.Instance.GetPlayerSummaryDatabase();
                    var      pvpSummaries        = playerSummaryDB.GetPVPSummaries(realm);
                    DateTime referenceDateTime   = new DateTime(2010, 1, 1);
                    var      orderedPVPSummaries = pvpSummaries.OrderByDescending((_Value) => ((int)_Value.Value.m_HighestRank.Key) * 100000 - (_Value.Value.m_HighestRank.Value != DateTime.MinValue ? (int)((_Value.Value.m_HighestRank.Value - referenceDateTime).TotalDays) : 0));
                    //////////////////////////////////
                    int pageIndex = PageUtility.GetQueryInt(Request, "page", 1) - 1;//Change range from 0 to * instead of 1 to *

                    PlayerColumn[] playerColumns = new PlayerColumn[] {
                        PlayerColumn.Number,
                        PlayerColumn.Character_And_Guild,
                        PlayerColumn.Race_And_Class,
                        PlayerColumn.Total_HKs,
                        PlayerColumn.LastSeen,
                    };
                    Dictionary <PlayerColumn, string[]> extraColumns = new Dictionary <PlayerColumn, string[]>();

                    extraColumns[PlayerColumn.Number] = new string[] { "Rank", "Date Achieved" };
                    //extraColumns[PlayerColumn.Total_HKs] = new string[] { "Weeks with standing" };

                    string table = "<table class='table'>";
                    table += "<thead>" + PageUtility.CreatePlayerTableHeaderRow(playerColumns, extraColumns) + "</thead>";
                    table += "<tbody>";
                    var playerArray = DatabaseAccess.GetRealmPlayers(this, realm, NotLoadedDecision.RedirectAndWait);
                    int nr          = 0;
                    foreach (var pvpSummary in orderedPVPSummaries)
                    {
                        nr++;
                        if (nr > pageIndex * count && nr <= (pageIndex + 1) * count)
                        {
                            Player playerData = null;
                            if (playerArray.TryGetValue(playerSummaryDB.GetPlayer(pvpSummary), out playerData) == true)
                            {
                                VF_RealmPlayersDatabase.PlayerFaction playerFaction = StaticValues.GetFaction(playerData.Character.Race);
                                int   rank         = (int)pvpSummary.Value.m_HighestRank.Key;
                                float rankProgress = pvpSummary.Value.m_HighestRank.Key - (float)rank;
                                extraColumns[PlayerColumn.Number] = new string[] { PageUtility.CreatePlayerRankDiv(rank, rankProgress, playerFaction), pvpSummary.Value.m_HighestRank.Value.ToString("yyyy-MM-dd") };
                                //extraColumns[PlayerColumn.Total_HKs] = new string[] { pvpSummary.Value.m_ActivePVPWeeks.ToString() };
                                table += PageUtility.CreatePlayerRow(nr, realm, playerData, playerColumns, null, extraColumns);
                            }
                        }
                        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()));
                    }
                    m_PageHTML = new MvcHtmlString(table);
                    //////////////////////////////////

                    GeneratePageDetails("Highest Ranks", count, "Highest lifetime achieved PVP Ranks for players, sorted by date of achievment");
                }
            }
            else// if (sectionStr == "ranks")
            {
                this.Title = "Ranks @ " + StaticValues.ConvertRealmParam(realm) + " | RealmPlayers";

                if (realm == WowRealm.Nostalrius || realm == WowRealm.NostalriusPVE)
                {
                    rankShowLambda = (Player _Player) =>
                    {
                        return((DateTime.UtcNow - _Player.LastSeen).TotalDays < 14);
                    };
                    GeneratePageDetails("Ranks", count, "Highest PVP Ranks for active players.");
                }
                else if (wowVersion == VF_RealmPlayersDatabase.WowVersionEnum.TBC)
                {
                    GeneratePageDetails("Arena Ranking", count, "Shows the highest rated arena teams, sorted by a sum of the total rating for 5v5, 3v3 and 2v2.");
                }
                else
                {
                    GeneratePageDetails("Ranks", count, "Highest PVP Ranks for players. Only lists players who received standing last week. This is because no rank decay would make the list extremely boring(filled with players that dont even pvp).");
                }
                m_PageHTML = new MvcHtmlString(CreatePVPTable(realm, count, rankColumns
                                                              , rankSorterLambda, rankShowLambda));
            }
            //href='javascript:navigateWithNewQuery(\"page\",\"1\")'
            int pageNr    = PageUtility.GetQueryInt(Request, "page", 1);
            int maxPageNr = 1000000 / count;

            m_PaginationHTML = new MvcHtmlString(PageUtility.CreatePagination(Request, pageNr, maxPageNr));
        }
コード例 #16
0
        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&nbsp;<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));
                }
            }
        }
コード例 #17
0
        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);
            }
        }
コード例 #18
0
        protected void Page_Load(object sender, EventArgs e)
        {
            var realm = PageUtility.GetQueryRealm(Request);

            if (realm == WowRealm.Unknown)
            {
                return;
            }
            var wowVersion = StaticValues.GetWowVersion(realm);

            var onlinePlayersDB = DatabaseAccess.GetRealmOnlinePlayers(this, realm);

            this.Title = "OnlineStats @ " + StaticValues.ConvertRealmParam(realm) + " | RealmPlayers";

            m_BreadCrumbHTML = new MvcHtmlString(PageUtility.BreadCrumb_AddHome()
                                                 + PageUtility.BreadCrumb_AddRealm(realm)
                                                 + PageUtility.BreadCrumb_AddFinish("OnlineStats"));

            m_PageInfoHTML = new MvcHtmlString("<h1>OnlineStats"
                                               + "</h1><p>OnlineStats for realm " + StaticValues.ConvertRealmViewing(realm) + "</p>"
                                               + "<p>" + onlinePlayersDB.OnlineEntries.Count + " nr of onlinestats entries!</p>");

            string graphSection = "";

            {
                List <int>    dataX  = new List <int>();
                List <int>    dataY1 = new List <int>();
                List <int>    dataY2 = new List <int>();
                List <int>    dataY3 = new List <int>();
                List <int>    dataY4 = new List <int>();
                List <int>    dataY5 = new List <int>();
                List <string> labels = new List <string>();

                DateTime currOnlineDateTime = DateTime.UtcNow.AddDays(-14);
                currOnlineDateTime = currOnlineDateTime.AddMinutes(-currOnlineDateTime.Minute).AddSeconds(-currOnlineDateTime.Second).AddHours(1);
                //Remove minute and second significants

                int day = 0;

                HashSet <string> onlinePlayers            = new HashSet <string>();
                HashSet <string> playersInRaidAndDungeons = new HashSet <string>();
                HashSet <string> playersInBattlegrounds   = new HashSet <string>();
                HashSet <string> playersAtLvl60           = new HashSet <string>();

                Action addGraphEntry = () =>
                {
                    labels.Add(currOnlineDateTime.ToDateStr() + "<br />Players online: " + PageUtility.CreateColorString(onlinePlayers.Count.ToString(), System.Drawing.Color.Green)
                               + "<br />Players in Raids/Dungeons: " + PageUtility.CreateColorString(playersInRaidAndDungeons.Count.ToString()
                                                                                                     + (onlinePlayers.Count != 0 ? " ( " + (((double)playersInRaidAndDungeons.Count / (double)onlinePlayers.Count) * 100).ToStringDot("0.0") + "% )" : ""), System.Drawing.Color.Yellow)
                               + "<br />Players in Battlegrounds: " + PageUtility.CreateColorString(playersInBattlegrounds.Count.ToString()
                                                                                                    + (onlinePlayers.Count != 0 ? " ( " + (((double)playersInBattlegrounds.Count / (double)onlinePlayers.Count) * 100).ToStringDot("0.0") + "% )" : ""), System.Drawing.Color.Red)
                               + "<br />Players below lvl 60: " + PageUtility.CreateColorString((onlinePlayers.Count - playersAtLvl60.Count).ToString()
                                                                                                + (onlinePlayers.Count != 0 ? " ( " + (((double)(onlinePlayers.Count - playersAtLvl60.Count) / (double)onlinePlayers.Count) * 100).ToStringDot("0.0") + "% )" : ""), System.Drawing.Color.Cyan)
                               + "<br />Players at lvl 60: " + PageUtility.CreateColorString(playersAtLvl60.Count.ToString()
                                                                                             + (onlinePlayers.Count != 0 ? " ( " + (((double)playersAtLvl60.Count / (double)onlinePlayers.Count) * 100).ToStringDot("0.0") + "% )" : ""), System.Drawing.Color.Purple));
                    dataX.Add(++day);
                    dataY1.Add(onlinePlayers.Count);
                    dataY2.Add(playersInRaidAndDungeons.Count);
                    dataY3.Add(playersInBattlegrounds.Count);
                    dataY4.Add(playersAtLvl60.Count);
                    dataY5.Add(onlinePlayers.Count - playersAtLvl60.Count);
                    onlinePlayers.Clear();
                    playersInRaidAndDungeons.Clear();
                    playersInBattlegrounds.Clear();
                    playersAtLvl60.Clear();
                };
                foreach (var onlineEntry in onlinePlayersDB.OnlineEntries)
                {
                    if (onlineEntry.DateTime_EndSpan < currOnlineDateTime)
                    {
                        continue;
                    }

                    while (currOnlineDateTime <= onlineEntry.DateTime_StartSpan.AddHours(-8))
                    {
                        addGraphEntry();
                        currOnlineDateTime = currOnlineDateTime.AddHours(8);
                    }

                    foreach (var entry in onlineEntry.OnlinePlayers)
                    {
                        onlinePlayers.Add(entry.Key);
                        if (StaticValues.IsZoneRaid(entry.Value.Zone) || StaticValues.IsZoneDungeon(entry.Value.Zone))
                        {
                            playersInRaidAndDungeons.Add(entry.Key);
                        }
                        if (StaticValues.IsZoneBattleground(entry.Value.Zone))
                        {
                            playersInBattlegrounds.Add(entry.Key);
                        }
                        if (entry.Value.Level == 60)
                        {
                            playersAtLvl60.Add(entry.Key);
                        }
                    }
                    foreach (var entry in onlineEntry.OnlinePlayers_Duplicates)
                    {
                        if (StaticValues.IsZoneRaid(entry.Zone) || StaticValues.IsZoneDungeon(entry.Zone))
                        {
                            playersInRaidAndDungeons.Add(entry.Name);
                        }
                        if (StaticValues.IsZoneBattleground(entry.Zone))
                        {
                            playersInBattlegrounds.Add(entry.Name);
                        }
                        if (entry.Level == 60)
                        {
                            playersAtLvl60.Add(entry.Name);
                        }
                    }
                }

                addGraphEntry();

                graphSection += "<div class='fame' style='min-width: 1100px; max-width: 1100px'>" + PageUtility.CreateGraph(dataX,
                                                                                                                            new List <Tuple <List <int>, System.Drawing.Color> >
                {
                    new Tuple <List <int>, System.Drawing.Color>(dataY5, System.Drawing.Color.Cyan),
                    new Tuple <List <int>, System.Drawing.Color>(dataY4, System.Drawing.Color.Purple),
                    new Tuple <List <int>, System.Drawing.Color>(dataY3, System.Drawing.Color.Red),
                    new Tuple <List <int>, System.Drawing.Color>(dataY2, System.Drawing.Color.Yellow),
                    new Tuple <List <int>, System.Drawing.Color>(dataY1, System.Drawing.Color.Green)
                },
                                                                                                                            labels
                                                                                                                            , 1100, 400) + "</div>";
            }
            m_BodyHTML = new MvcHtmlString(graphSection);
        }
コード例 #19
0
        protected void Page_Load(object sender, EventArgs e)
        {
            this.Title = "Contributors | RealmPlayers";
            var statisticsData = DatabaseAccess.GetContributorStatistics();

            if (statisticsData == null)
            {
                PageUtility.RedirectErrorLoading(this, "contributors");
                return;
            }
            m_BreadCrumbHTML = new MvcHtmlString(PageUtility.BreadCrumb_AddHome() + PageUtility.BreadCrumb_AddFinish("Contributors"));

            var statsRealms = new WowRealm[] { WowRealm.Emerald_Dream, WowRealm.Warsong, WowRealm.Al_Akir, WowRealm.Rebirth, WowRealm.Nostalrius, WowRealm.Kronos, WowRealm.Archangel };

            Dictionary <WowRealm, int> totalRealmInspects = new Dictionary <WowRealm, int>();

            string realmInspectsHeaderColumns = "";

            foreach (var statsRealm in statsRealms)
            {
                realmInspectsHeaderColumns += PageUtility.CreateTableColumnHead(StaticValues.ConvertRealmViewing(statsRealm));
                totalRealmInspects.Add(statsRealm, 0);
            }

            m_TableHeadHTML = new MvcHtmlString(PageUtility.CreateTableRow("", PageUtility.CreateTableColumnHead("#Nr")
                                                                           + PageUtility.CreateTableColumnHead("Name")
                                                                           + PageUtility.CreateTableColumnHead("Total inspects")
                                                                           + realmInspectsHeaderColumns
                                                                           + PageUtility.CreateTableColumnHead("Active since")
                                                                           + PageUtility.CreateTableColumnHead("Last active")));

            SortedList <int, string> tableRows = new SortedList <int, string>();
            string tableBody = "";

            var contributors = ContributorDB.GetAllTrustWorthyContributors();

            foreach (var data in contributors)
            {
                DateTime earliestActive       = DateTime.MaxValue;
                DateTime latestActive         = DateTime.MinValue;
                int      totalInspects        = 0;
                string   realmInspectsColumns = "";
                foreach (var statRealm in statsRealms)
                {
                    int inspects = 0;
                    Code.ContributorStatisticItem stats = null;
                    if (statisticsData[statRealm].TryGetValue(data.ContributorID, out stats) == false)
                    {
                        stats = new Code.ContributorStatisticItem(-1);
                    }
                    earliestActive = (stats.m_EarliestActiveUTC < earliestActive ? stats.m_EarliestActiveUTC : earliestActive);
                    latestActive   = (stats.m_LatestActiveUTC > latestActive ? stats.m_LatestActiveUTC : latestActive);

                    foreach (var inspection in stats.m_PlayerInspects)
                    {
                        inspects += inspection.Value;
                    }
                    totalInspects += inspects;
                    totalRealmInspects[statRealm] += inspects;
                    realmInspectsColumns          += PageUtility.CreateTableColumn(inspects.ToString());
                }

                if (totalInspects > 0 && data.Name != "Unknown" &&
                    ((DateTime.UtcNow - latestActive).TotalDays < 15 ||
                     (totalInspects > 5000 && (DateTime.UtcNow - latestActive).TotalDays < 60)))
                {
                    int keyToUse = int.MaxValue - totalInspects * 100;
                    while (tableRows.ContainsKey(keyToUse) == true)
                    {
                        keyToUse += 1;
                    }


                    tableRows.Add(keyToUse, PageUtility.CreateTableColumn(data.Name)
                                  + PageUtility.CreateTableColumn(totalInspects.ToString())
                                  + realmInspectsColumns
                                  + PageUtility.CreateTableColumn(earliestActive.ToString("yyy-MM-dd"))
                                  + PageUtility.CreateTableColumn(StaticValues.GetTimeSinceLastSeenUTC(latestActive)));
                }
            }
            int    totalALLInspects         = 0;
            string totalRealmInspectsColumn = "";

            foreach (var statRealm in statsRealms)
            {
                totalRealmInspectsColumn += PageUtility.CreateTableColumn(totalRealmInspects[statRealm].ToString());
                totalALLInspects         += totalRealmInspects[statRealm];
            }
            tableBody += PageUtility.CreateTableRow("", PageUtility.CreateTableColumn("#ALL") + PageUtility.CreateTableColumn("TOTAL")
                                                    + PageUtility.CreateTableColumn(totalALLInspects.ToString())
                                                    + totalRealmInspectsColumn
                                                    + PageUtility.CreateTableColumn("-")
                                                    + PageUtility.CreateTableColumn("-"));
            int i = 1;

            foreach (var tableRow in tableRows)
            {
                tableBody += PageUtility.CreateTableRow("", PageUtility.CreateTableColumn("#" + i++) + tableRow.Value);
            }
            m_TableBodyHTML = new MvcHtmlString(tableBody);

            m_ContributorsInfoHTML = new MvcHtmlString(
                "<h1>Contributors<span class='badge badge-inverse'>" + tableRows.Count() + " Players</span></h1>"
                + "<p>List displays the persons that contribute data to this project. Sorted by the amount of inspects they have contributed with.</p>"
                + "<br/><p>The more contributors the better! If you are interested in being a contributor to help out the project please do not hesitate contacting <a href='http://forum.realmplayers.com/memberlist.php?mode=viewprofile&u=51'>Sethzer</a> on RealmPlayers forums. Make sure you also read the thread: <a href='http://realmplayers.com:5555/viewtopic.php?f=14&t=15'>About Data Contribution</a>.</p><br/>");
        }
コード例 #20
0
 public string GetRealmViewing()
 {
     return(StaticValues.ConvertRealmViewing(m_Realm));
 }
コード例 #21
0
        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), "&lt;" + visualGuildName + "&gt;") + "</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()
                        , " &gt; " + interestingItems.First().Item2.ToString("yyyy-MM-dd") + "<br> &lt; " + 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);
        }