コード例 #1
0
ファイル: Character.cs プロジェクト: tmacblane/PlayerBounties
        public int GetHunterRankingsByShard(Guid shardId, Guid characterId)
        {
            Bounty bounty = new Bounty();
            var topPlayers = new List<TopPlayers>();

            // Find all characters for the provided shardid
            IEnumerable<Character> characterList = this.db.Characters.Where(c => c.ShardId == shardId);

            // get killed count for each character
            foreach (Character characterListItem in characterList)
            {
                topPlayers.Add(new TopPlayers
                {
                    CharacterId = characterListItem.Id,
                    count = bounty.GetBountiesCompletedCount(characterListItem.Id)
                });
            }

            // sort by killed count
            List<TopPlayers> sortedTopPlayers = topPlayers.OrderBy(c => c.count).ThenBy(c => c.CharacterId).Reverse().ToList();

            // find position in the list

            return (sortedTopPlayers.IndexOf(sortedTopPlayers.Where(c => c.CharacterId == characterId).Single()) + 1);
        }
コード例 #2
0
ファイル: Character.cs プロジェクト: tmacblane/PlayerBounties
        public int GetBountiesKilledCount(Guid characterId)
        {
            Bounty bounty = new Bounty();

            return bounty.GetBountiesCompletedCount(characterId);
        }