コード例 #1
0
        private async Task <Db_LccCachedTeamInformation> CreateCachedTeamInformationFromRiotMatch(RiotSharp.Endpoints.MatchEndpoint.Match match, IEnumerable <Participant> teamParticipants, Timeline timeline, int teamId)
        {
            Db_LccCachedTeamInformation teamInformation = new Db_LccCachedTeamInformation
            {
                TotalKills      = teamParticipants.Sum(x => x.Stats.Kills),
                TotalDeaths     = teamParticipants.Sum(x => x.Stats.Kills),
                TotalAssists    = teamParticipants.Sum(x => x.Stats.Kills),
                DragonKills     = match.Teams.FirstOrDefault(x => x.TeamId == teamId).DragonKills,
                BaronKills      = match.Teams.FirstOrDefault(x => x.TeamId == teamId).BaronKills,
                RiftHeraldKills = match.Teams.FirstOrDefault(x => x.TeamId == teamId).RiftHeraldKills,
                InhibitorKills  = match.Teams.FirstOrDefault(x => x.TeamId == teamId).InhibitorKills
            };

            teamInformation.Players = new List <Db_LccCachedPlayerStats>();
            foreach (Participant participant in teamParticipants)
            {
                ParticipantIdentity participantIdentity = match.ParticipantIdentities.FirstOrDefault(x => x.ParticipantId == participant.ParticipantId);
                teamInformation.Players.Add(await
                                            CreateCachedPlayerStatsFromMatchupInfo
                                            (
                                                participantIdentity,
                                                participant,
                                                timeline
                                            )
                                            );
            }

            return(teamInformation);
        }
コード例 #2
0
        private LccTeamInformation CreateLccTeamInformationFromCache(Db_LccCachedTeamInformation cachedTeamInformation)
        {
            LccTeamInformation lccTeamInformation = new LccTeamInformation()
            {
                TotalKills      = cachedTeamInformation.Players.Sum(x => x.Kills),
                TotalDeaths     = cachedTeamInformation.Players.Sum(x => x.Deaths),
                TotalAssists    = cachedTeamInformation.Players.Sum(x => x.Assists),
                DragonKills     = cachedTeamInformation.DragonKills,
                BaronKills      = cachedTeamInformation.BaronKills,
                RiftHeraldKills = cachedTeamInformation.RiftHeraldKills,
                InhibitorKills  = cachedTeamInformation.InhibitorKills
            };

            foreach (Db_LccCachedPlayerStats player in cachedTeamInformation.Players)
            {
                lccTeamInformation.Players.Add(CreateLccPlayerStatsFromCache(player));
            }

            return(lccTeamInformation);
        }