public ParticipantStat GetParticipantStat(Match match, MatchParticipant participant, int participantNum, int id) { ParticipantStat stats = new ParticipantStat(); // StatID needs to be pulled stats.Winner = match.Participants[participantNum].Stats.Winner.ToString(); //Oops stats.Kills = (int)match.Participants[participantNum].Stats.Kills; // This is a long? stats.Assists = (int)match.Participants[participantNum].Stats.Assists; // Why are all of these longs... stats.GoldSpent = (int)match.Participants[participantNum].Stats.GoldSpent; stats.GoldEarned = (int)match.Participants[participantNum].Stats.GoldEarned; stats.TotalDamageTaken = (int)match.Participants[participantNum].Stats.TotalDamageTaken; stats.TotalDamageDealtToChampions = (int)match.Participants[participantNum].Stats.TotalDamageDealtToChampions; stats.TotalDamageDealt = (int)match.Participants[participantNum].Stats.TotalDamageDealt; stats.PhysicalDamageTaken = (int)match.Participants[participantNum].Stats.PhysicalDamageTaken; stats.PhysicalDamageDealtToChampions = (int)match.Participants[participantNum].Stats.PhysicalDamageDealtToChampions; stats.PhysicalDamageDealt = (int)match.Participants[participantNum].Stats.PhysicalDamageDealt; stats.MagicDamageTaken = (int)match.Participants[participantNum].Stats.MagicDamageTaken; stats.MagicDamageDealtToChampions = (int)match.Participants[participantNum].Stats.MagicDamageDealtToChampions; stats.MagicDamageDealt = (int)match.Participants[participantNum].Stats.MagicDamageDealt; stats.TrueDamageTaken = (int)match.Participants[participantNum].Stats.TrueDamageTaken; stats.TrueDamageDealtToChampions = (int)match.Participants[participantNum].Stats.TrueDamageDealtToChampions; stats.TrueDamageDealt = (int)match.Participants[participantNum].Stats.TrueDamageDealt; stats.TotalUnitsHealed = (int)match.Participants[participantNum].Stats.TotalUnitsHealed; stats.TotalHeal = (int)match.Participants[participantNum].Stats.TotalHeal; stats.TotalTimeCrowdControlDealt = (int)match.Participants[participantNum].Stats.TotalTimeCrowdControlDealt; stats.WardsPlaced = (int)match.Participants[participantNum].Stats.WardsPlaced; stats.WardsKilled = (int)match.Participants[participantNum].Stats.WardsKilled; stats.VisionWardsBoughtInGame = (int)match.Participants[participantNum].Stats.VisionWardsBoughtInGame; stats.VisionScore = (int)match.Participants[participantNum].Stats.VisionScore; stats.SightWardsBoughtInGame = (int)match.Participants[participantNum].Stats.SightWardsBoughtInGame; stats.TowerKills = (int)match.Participants[participantNum].Stats.TowerKills; stats.InhibitorKills = (int)match.Participants[participantNum].Stats.InhibitorKills; stats.FirstTowerKill = match.Participants[participantNum].Stats.FirstTowerKill; stats.FirstTowerAssist = match.Participants[participantNum].Stats.FirstTowerAssist; stats.FirstInhibitorKill = match.Participants[participantNum].Stats.FirstInhibitorKill; stats.FirstInhibitorAssist = match.Participants[participantNum].Stats.FirstInhibitorAssist; stats.FirstBloodKill = match.Participants[participantNum].Stats.FirstBloodKill; stats.FirstBloodAssist = match.Participants[participantNum].Stats.FirstBloodAssist; stats.DoubleKills = (int)match.Participants[participantNum].Stats.DoubleKills; stats.TripleKills = (int)match.Participants[participantNum].Stats.TripleKills; stats.QuadraKills = (int)match.Participants[participantNum].Stats.QuadraKills; stats.PentaKills = (int)match.Participants[participantNum].Stats.PentaKills; stats.UnrealKills = (int)match.Participants[participantNum].Stats.UnrealKills; stats.KillingSprees = (int)match.Participants[participantNum].Stats.KillingSprees; stats.LargestKillingSpree = (int)match.Participants[participantNum].Stats.LargestKillingSpree; stats.LargestCriticalStrike = (int)match.Participants[participantNum].Stats.LargestCriticalStrike; stats.NeutralMinionsKilledEnemyJungle = (int)match.Participants[participantNum].Stats.NeutralMinionsKilledEnemyJungle; stats.NeutralMinionsKilledJungle = (int)match.Participants[participantNum].Stats.NeutralMinionsKilledJungle; stats.TotalMinionsKilled = (int)match.Participants[participantNum].Stats.TotalMinionsKilled; stats.ParticipantID = id; stats.Deaths = match.Participants[participantNum].Stats.Deaths; stats.ChampionLevel = match.Participants[participantNum].Stats.ChampLevel; // TODO: // The stat io stats.StatID = statIO.InsertParticipantStat(stats); return(stats); }
public List <MatchParticipant> GetMatchParticipants(Match match) { //MatchParticipantManager mpManager = new MatchParticipantManager(); List <MatchParticipant> participants = new List <MatchParticipant>(); int numParticipants = match.Participants.Count; //foreach (Participant participant in match.Participants) for (int x = 0; x < 10; x++) { MatchParticipant newParticipant = new MatchParticipant(); newParticipant.ParticipantID = match.Participants[x].ParticipantId; newParticipant.MatchID = match.GameId; newParticipant.SummonerID = match.ParticipantIdentities[x].Player.SummonerId; //Getting summoner ID from participantindent newParticipant.ChampionID = match.Participants[x].ChampionId; newParticipant.TeamID = match.Participants[x].TeamId; newParticipant.Spell1ID = match.Participants[x].Spell1Id; newParticipant.Spell2ID = match.Participants[x].Spell2Id; // If summoner not in DB, insert if (!summonerIO.SummonerExists(newParticipant.SummonerID)) { Summoner summoner = new Summoner() { SummonerID = match.ParticipantIdentities[x].Player.SummonerId, SummonerName = match.ParticipantIdentities[x].Player.SummonerName, AccountID = match.ParticipantIdentities[x].Player.AccountId, ProfileIconID = match.ParticipantIdentities[x].Player.ProfileIcon }; summonerIO.InsertSummoner(summoner); } // Insert the participant into the DB matchParticipantIO.InsertMatchParticipant(newParticipant); int participantID = matchParticipantIO.GetParticipantIDBySummonerID(newParticipant.SummonerID, newParticipant.MatchID); // Insert the stats in the DB and retrieve them ParticipantStat stats = statManager.GetParticipantStat(match, newParticipant, x, participantID); } return(participants); }
public static Participant MapParticipant(MatchResponse matchData, ParticipantResponse participant, ParticipantStat stats) { return(new Participant { MatchId = matchData.MatchId, ChampionId = participant.ChampionId, HighestAchievedSeasonTier = participant.HighestAchievedSeasonTier, ParticipantId = participant.ParticipantId, ParticipantStat = stats, Spell1Id = participant.Spell1Id, Spell2Id = participant.Spell2Id, TeamId = participant.TeamId }); }