Example #1
0
        public static void SetParticipantCustomFields(Participant participant, Match match, string jsonData)
        {
            var pathBuilder         = new UrlPathBuilder();
            var participantIdentity = match.ParticipantIdentities.FirstOrDefault(pi => pi.ParticipantId == participant.ParticipantId);

            if (participantIdentity == null)
            {
                return;
            }

            participant.Player             = participantIdentity.Player;
            participant.ChampionPlayedIcon = pathBuilder.GetChampionIconUrl(participant.ChampionId);

            var displayedSummonerName = participant.Player.SummonerName.Truncate(150);

            participant.DisplayedSummonerName = displayedSummonerName == participant.Player.SummonerName ? displayedSummonerName : displayedSummonerName + "...";
        }
Example #2
0
        private static ParticipantForDisplay SetParticipantForDisplay(Match match, Participant participant, ParticipantIdentity participantIdentity)
        {
            var pathBuilder    = new UrlPathBuilder();
            var summonerSpells = GetSummonerSpellsPaths(participant);
            var runes          = GetRunesPaths(participant);

            return(new ParticipantForDisplay()
            {
                ChampionIconUrl = pathBuilder.GetChampionIconUrl(participant.ChampionId),
                SummonerSpell1IconUrl = pathBuilder.GetSummonerSpellIcon(summonerSpells.Item1.Replace("/lol-game-data/assets/", "").ToLower()),
                SummonerSpell2IconUrl = pathBuilder.GetSummonerSpellIcon(summonerSpells.Item2.Replace("/lol-game-data/assets/", "").ToLower()),
                RuneKeystoneIconUrl = runes.Item1,
                RuneSecondaryPathIconUrl = runes.Item2,
                KillParticipationPercentage = GetKillParticipation(match, participant),
                Items = GetItems(participant),
                ChampionName = Champions.FirstOrDefault(x => x.Key == participant.ChampionId.ToString()) == null ? "Default" : Champions.FirstOrDefault(x => x.Key == participant.ChampionId.ToString()).Name,
                Participant = participant,
                ParticipantIdentity = participantIdentity
            });
        }