Ejemplo n.º 1
0
        private static Match ToDomain(string targetAccountId, SingleMatchJsonBinding binding)
        {
            var humanPlayers = binding.ParticipantIdentities
                               .Where(p => p.Player.SummonerId != null);

            var participantId = binding.ParticipantIdentities.SingleOrDefault(p => p.Player.AccountId == targetAccountId)?.ParticipantId;

            if (participantId == null)
            {
                return(null);
            }

            var participantData = binding.Participants.Single(p => p.ParticipantId == participantId);

            var spells = new SummonerSpellPair(participantData.Spell1Id, participantData.Spell2Id);

            var stats = participantData.Stats;

            var runes = new[]
            {
                stats.Perk0,
                stats.Perk1,
                stats.Perk2,
                stats.Perk3,
                stats.Perk4,
                stats.Perk5
            };

            var visionScore = new VisionStats(stats.VisionScore,
                                              stats.VisionWardsBoughtInGame,
                                              stats.WardsKilled,
                                              stats.WardsPlaced);

            return(new Match(humanPlayers.Select(s => new Account(s.Player.SummonerName, s.Player.AccountId)),
                             runes,
                             spells,
                             visionScore,
                             stats.TotalMinionsKilled));
        }
Ejemplo n.º 2
0
 public bool Equals(SummonerSpellPair other)
 {
     return(First == other.First && Second == other.Second);
 }