private void WRbyChampion()
        {
            Summoner    _s    = db.getSummonerInfo(cboSummoner.SelectedItem + "");
            List <Game> games = db.getGames(_s, new Champion(), true);
            Dictionary <string, winloss> champion = new Dictionary <string, winloss>();

            foreach (Game _g in games)
            {
                string champname = db.getChampion(_g.championId).name;

                if (!champion.ContainsKey(champname))
                {
                    champion.Add(champname, new winloss());
                }

                var temp = champion[champname];

                if (_g.stats.win)
                {
                    temp.win += 1;
                }
                else
                {
                    temp.loss += 1;
                }

                champion[champname] = temp;
            }
            Form2 _form2 = new Form2();

            _form2.Text = "Win Rates by Champion";
            _form2.statsDisplay.ColumnCount     = 3;
            _form2.statsDisplay.Columns[0].Name = "Win";
            _form2.statsDisplay.Columns[1].Name = "Loss";
            _form2.statsDisplay.Columns[2].Name = "Ratio";
            foreach (var d in champion)
            {
                var index = _form2.statsDisplay.Rows.Add();
                _form2.statsDisplay.Rows[index].HeaderCell.Value = d.Key;
                _form2.statsDisplay.Rows[index].Cells[0].Value   = d.Value.win;
                _form2.statsDisplay.Rows[index].Cells[1].Value   = d.Value.loss;
                _form2.statsDisplay.Rows[index].Cells[2].Value   = (double)(d.Value.win) / (d.Value.win + d.Value.loss);
            }
            _form2.Show();
        }
 /// <summary>
 /// Adds a summoners data to the database. This way we can save on
 /// API calls by storing unchanging data locally.
 /// </summary>
 /// <param name="s">Summoner object to be saved.</param>
 public void addSummonerInfo(Summoner s)
 {
     using (SQLiteConnection con = new SQLiteConnection(dbString))
     {
         con.Open();
         try
         {
             using (SQLiteCommand command = new SQLiteCommand("INSERT INTO Summoner VALUES(@ID, @username)", con))
             {
                 command.Parameters.Add(new SQLiteParameter("ID", s.id));
                 command.Parameters.Add(new SQLiteParameter("username", s.name));
                 command.ExecuteNonQuery();
             }
         }
         catch
         {}
     }
 }
        /// <summary>
        /// Gets a specific game from the database.
        ///
        /// Requires both gameID and a summoner object
        /// in case two different summoners were a part
        /// of the same game.
        /// </summary>
        /// <param name="gameID">ID of the game</param>
        /// <param name="_s">Summoner object of the summoner whos stats you want</param>
        /// <returns>Game object requested</returns>
        public Game getGameInfo(int gameID, Summoner _s)
        {
            Game _game = new Game();

            using (SQLiteConnection con = new SQLiteConnection(dbString))
            {
                con.Open();
                try
                {
                    using (SQLiteCommand command = new SQLiteCommand("SELECT * FROM Games WHERE ID = @ID AND summonerID = @summonerID", con))
                    {
                        command.Parameters.Add(new SQLiteParameter("ID", gameID));
                        command.Parameters.Add(new SQLiteParameter("summonerID", _s.id));

                        SQLiteDataReader reader = command.ExecuteReader();
                        while (reader.Read())
                        {
                            _game.gameId        = reader.GetInt32(0);
                            _game.gameType      = reader.GetString(1);
                            _game.spell1        = reader.GetInt32(2);
                            _game.spell2        = reader.GetInt32(3);
                            _game.gameMode      = reader.GetString(4);
                            _game.mapId         = reader.GetInt32(5);
                            _game.level         = reader.GetInt32(6);
                            _game.subType       = reader.GetString(7);
                            _game.championId    = reader.GetInt32(8);
                            _game.stats         = JsonConvert.DeserializeObject <Stats>(reader.GetString(9));
                            _game.fellowPlayers = JsonConvert.DeserializeObject <List <FellowPlayer> >(reader.GetString(10));
                            return(_game);
                        }
                    }
                    return(_game);
                }
                catch
                {
                    return(_game);
                }
            }
        }
        /// <summary>
        /// Returns a list of games for a particular summoner. Can either return all
        /// of the games they have been a part of or only games where
        /// they used a specific champion.
        /// </summary>
        /// <param name="s">Summoner oject of desired summoner</param>
        /// <param name="c">Champion to retrieve stats of</param>
        /// <param name="allChamps">Decides whether all champions are returned or not</param>
        /// <returns>List of Game objects</returns>
        public List <Game> getGames(Summoner s, Champion c, bool allChamps = false)
        {
            List <Game> games = new List <Game>();

            using (SQLiteConnection con = new SQLiteConnection(dbString))
            {
                con.Open();
                try
                {
                    string query = (allChamps ? "SELECT * FROM Games WHERE summonerID=@summonerID ORDER BY ID DESC" : "SELECT * FROM Games WHERE ChampionID=@ChampionID AND summonerID=@summonerID ORDER BY ID DESC");
                    using (SQLiteCommand command = new SQLiteCommand(query, con))
                    {
                        command.Parameters.Add(new SQLiteParameter("ChampionID", c.id));
                        command.Parameters.Add(new SQLiteParameter("summonerID", s.id));

                        SQLiteDataReader reader = command.ExecuteReader();
                        while (reader.Read())
                        {
                            Game g = new Game();
                            g.gameId     = reader.GetInt32(0);
                            g.gameType   = reader.GetString(1);
                            g.spell1     = reader.GetInt32(2);
                            g.spell2     = reader.GetInt32(3);
                            g.gameMode   = reader.GetString(4);
                            g.mapId      = reader.GetInt32(5);
                            g.level      = reader.GetInt32(6);
                            g.subType    = reader.GetString(7);
                            g.championId = reader.GetInt32(8);
                            g.stats      = JsonConvert.DeserializeObject <Stats>(reader.GetString(9));
                            try { g.fellowPlayers = JsonConvert.DeserializeObject <List <FellowPlayer> >(reader.GetString(10)); } catch { }
                            games.Add(g);
                        }
                    }
                    return(games);
                }
                catch { return(games); }
            }
        }
        /// <summary>
        /// Adds some info to the games list. Only enough
        /// info is added to distinguish a particular game.
        /// This overload displays only games of a particular
        /// champion.
        /// </summary>
        /// <param name="_s">Summoner object to get games of.</param>
        /// <param name="_c">Champion object to get games of.</param>
        public void populateGamesList(Summoner _s, Champion _c)
        {
            List <Game> games = db.getGames(_s, _c);

            s = _s;
            gamesList.ColumnCount     = 6;
            gamesList.Columns[0].Name = "Champion";
            gamesList.Columns[1].Name = "Win/Loss";
            gamesList.Columns[2].Name = "Kills";
            gamesList.Columns[3].Name = "Deaths";
            gamesList.Columns[4].Name = "Assists";
            gamesList.Columns[5].Name = "gameID";

            foreach (Game _g in games)
            {
                int index = gamesList.Rows.Add();
                gamesList.Rows[index].Cells[0].Value = db.getChampion(_g.championId).name;
                gamesList.Rows[index].Cells[1].Value = (_g.stats.win ? "Win" : "Loss");
                gamesList.Rows[index].Cells[2].Value = _g.stats.championsKilled;
                gamesList.Rows[index].Cells[3].Value = _g.stats.numDeaths;
                gamesList.Rows[index].Cells[4].Value = _g.stats.assists;
                gamesList.Rows[index].Cells[5].Value = _g.gameId;
            }
        }
 /// <summary>
 /// Adds all of the games from a summoners RecentGames to the database.
 ///
 /// </summary>
 /// <param name="_r"></param>
 /// <param name="s"></param>
 public void addGameInfo(RecentGames _r, Summoner s)
 {
     using (SQLiteConnection con = new SQLiteConnection(dbString))
     {
         con.Open();
         try
         {
             foreach (Game g in _r.games)
             {
                 using (SQLiteCommand command = new SQLiteCommand("INSERT INTO Games VALUES(@ID, @gameType, @spell1, @spell2, @gameMode, @mapID, @level, @subType, @championID, @stats, @fellowPlayers, @summonerID, @uniqueKey)", con))
                 {
                     command.Parameters.Add(new SQLiteParameter("ID", g.gameId));
                     command.Parameters.Add(new SQLiteParameter("gameType", g.gameType));
                     command.Parameters.Add(new SQLiteParameter("spell1", g.spell1));
                     command.Parameters.Add(new SQLiteParameter("spell2", g.spell2));
                     command.Parameters.Add(new SQLiteParameter("gameMode", g.gameMode));
                     command.Parameters.Add(new SQLiteParameter("mapID", g.mapId));
                     command.Parameters.Add(new SQLiteParameter("level", g.level));
                     command.Parameters.Add(new SQLiteParameter("subType", g.subType));
                     command.Parameters.Add(new SQLiteParameter("championID", g.championId));
                     command.Parameters.Add(new SQLiteParameter("stats", g.statsToJSON()));
                     try
                     {
                         command.Parameters.Add(new SQLiteParameter("fellowPlayers", g.fellowPlayersToJSON()));
                     }
                     catch { }
                     command.Parameters.Add(new SQLiteParameter("summonerID", s.id));
                     command.Parameters.Add(new SQLiteParameter("uniqueKey", g.gameId + " " + s.id));
                     command.ExecuteNonQuery();
                 }
             }
         }
         catch
         { }
     }
 }
        private void BestChampStats()
        {
            Summoner    _s     = db.getSummonerInfo(cboSummoner.SelectedItem + "");
            Champions   champs = db.getAllChampions();
            List <Game> games  = db.getGames(_s, new Champion(), true);
            Dictionary <int, champStats> championStats = new Dictionary <int, champStats>();

            foreach (Game _g in games)
            {
                if (!championStats.ContainsKey(_g.championId))
                {
                    championStats.Add(_g.championId, new champStats());
                }
                var temp = championStats[_g.championId];
                temp.kills   += _g.stats.championsKilled;
                temp.loss    += _g.stats.numDeaths;
                temp.assists += _g.stats.assists;
                if (_g.stats.win)
                {
                    temp.wins += 1;
                }
                else
                {
                    temp.loss += 1;
                }
                temp.totalPhysDamage        += _g.stats.physicalDamageDealtToChampions;
                temp.totalMagicDamage       += _g.stats.magicDamageDealtToChampions;
                temp.totalDamage            += _g.stats.totalDamageDealtToChampions;
                temp.minionKill             += _g.stats.minionsKilled;
                temp.monsterKill            += _g.stats.neutralMinionsKilled;
                temp.goldEarned             += _g.stats.goldEarned;
                championStats[_g.championId] = temp;
            }

            champStats BestChampsIDs  = new champStats();
            champStats BestChampStats = new champStats();

            foreach (Champion c in champs.champions)
            {
                var temp = championStats[c.id];
                if (temp.kills > BestChampStats.kills)
                {
                    BestChampsIDs.kills = c.id; BestChampStats.kills = temp.kills;
                }
                if (temp.deaths > BestChampStats.deaths)
                {
                    BestChampsIDs.deaths = c.id; BestChampStats.deaths = temp.deaths;
                }
                if (temp.assists > BestChampStats.assists)
                {
                    BestChampsIDs.assists = c.id; BestChampStats.assists = temp.assists;
                }

                var kda = (!(temp.deaths == 0) ? (double)((temp.kills + temp.assists) / temp.deaths) : (double)((temp.kills + temp.assists) / 1));
                if (temp.kda > BestChampStats.kda)
                {
                    BestChampsIDs.kda = c.id; BestChampStats.kda = temp.kda;
                }

                if (temp.wins > BestChampStats.wins)
                {
                    BestChampsIDs.wins = c.id; BestChampStats.wins = temp.wins;
                }
                if (temp.loss > BestChampStats.loss)
                {
                    BestChampsIDs.loss = c.id; BestChampStats.loss = temp.loss;
                }
                if (temp.assists > BestChampStats.assists)
                {
                    BestChampsIDs.assists = c.id; BestChampStats.assists = temp.assists;
                }
                var totalGame = temp.wins + temp.loss;
                if (temp.totalGames > BestChampStats.totalGames)
                {
                    BestChampsIDs.totalGames = c.id; BestChampStats.totalGames = temp.totalGames;
                }
                if (temp.totalPhysDamage > BestChampStats.totalPhysDamage)
                {
                    BestChampsIDs.totalPhysDamage = c.id; BestChampStats.totalPhysDamage = temp.totalPhysDamage;
                }
                if (temp.totalMagicDamage > BestChampStats.totalMagicDamage)
                {
                    BestChampsIDs.totalMagicDamage = c.id; BestChampStats.totalMagicDamage = temp.totalMagicDamage;
                }
                if (temp.totalDamage > BestChampStats.totalDamage)
                {
                    BestChampsIDs.totalDamage = c.id; BestChampStats.totalDamage = temp.totalDamage;
                }

                if (temp.minionKill > BestChampStats.minionKill)
                {
                    BestChampsIDs.minionKill = c.id; BestChampStats.minionKill = temp.minionKill;
                }
                if (temp.monsterKill > BestChampStats.monsterKill)
                {
                    BestChampsIDs.monsterKill = c.id; BestChampStats.monsterKill = temp.monsterKill;
                }
                if (temp.goldEarned > BestChampStats.goldEarned)
                {
                    BestChampsIDs.goldEarned = c.id; BestChampStats.goldEarned = temp.goldEarned;
                }
            }
        }
        private void WRbyTeam()
        {
            Summoner    _s    = db.getSummonerInfo(cboSummoner.SelectedItem + "");
            List <Game> games = db.getGames(_s, new Champion(), true);
            Dictionary <int, winloss> player = new Dictionary <int, winloss>();
            List <int> IDs = new List <int>();

            foreach (Game _g in games)
            {
                if (_g.fellowPlayers != null)
                {
                    foreach (FellowPlayer _f in _g.fellowPlayers)
                    {
                        if (_f.teamId == _g.stats.team)
                        {
                            winloss _t;
                            if (player.ContainsKey(_f.summonerId))
                            {
                                _t = player[_f.summonerId];
                            }
                            else
                            {
                                _t = new winloss();
                            }
                            if (_g.stats.win)
                            {
                                _t.win += 1;
                            }
                            else
                            {
                                _t.loss += 1;
                            }

                            player[_f.summonerId] = _t;

                            if (!IDs.Contains(_f.summonerId))
                            {
                                IDs.Add(_f.summonerId);
                            }
                        }
                    }
                }
            }

            var   summoners = league.getSummonerNameList(IDs);
            Form2 _form2    = new Form2();

            _form2.Text = "Win Rates by Team Mate";
            _form2.statsDisplay.ColumnCount     = 3;
            _form2.statsDisplay.Columns[0].Name = "Win";
            _form2.statsDisplay.Columns[1].Name = "Loss";
            _form2.statsDisplay.Columns[2].Name = "Ratio";
            int i = 0;

            foreach (var __s in summoners)
            {
                var index = _form2.statsDisplay.Rows.Add();
                _form2.statsDisplay.Rows[index].HeaderCell.Value = __s.Value;
                _form2.statsDisplay.Rows[index].Cells[0].Value   = player[int.Parse(__s.Key)].win;
                _form2.statsDisplay.Rows[index].Cells[1].Value   = player[int.Parse(__s.Key)].loss;
                _form2.statsDisplay.Rows[index].Cells[2].Value   = (double)(player[int.Parse(__s.Key)].win) / (player[int.Parse(__s.Key)].win + player[int.Parse(__s.Key)].loss);
                i++;
            }
            _form2.Show();
        }
Exemple #9
0
        /// <summary>
        /// Displays a new form with all of the stats requested.
        ///
        /// Stats are displayed in a DataGridView.
        /// </summary>
        private void btnReport_Click(object sender, EventArgs e)
        {
            if (cboReportUser.SelectedIndex >= 0)
            {
                //Creates a summoner object from the selected username
                Summoner _s = db.getSummonerInfo(cboReportUser.SelectedItem + "");

                //Creates a champion object from the selected champion
                Champion _c = db.getChampion(cboReportChampion.SelectedItem + "");


                List <Game> _games = db.getGames(_s, _c, ckAllChamps.Checked);

                if (_games.Count > 0)
                {
                    Game _totalStats = _games[0];

                    //Initial values for the stats to track.
                    int maxKills = _games[0].stats.championsKilled;
                    int maxDeath = _games[0].stats.numDeaths;
                    int numWins  = (_games[0].stats.win ? 1 : 0);

                    for (int i = 1; i < _games.Count; i++)
                    {
                        _totalStats = _totalStats + _games[i];
                        if (_games[i].stats.championsKilled > maxKills)
                        {
                            maxKills = _games[i].stats.championsKilled;
                        }
                        if (_games[i].stats.numDeaths > maxDeath)
                        {
                            maxDeath = _games[i].stats.numDeaths;
                        }
                        if (_games[i].stats.win)
                        {
                            numWins += 1;
                        }
                    }

                    //Creates a new Form2 object.
                    Form2 _f = new Form2();

                    //Sets the Title of the new form.
                    _f.Text = (ckAllChamps.Checked ? "All Champions Stats" : _c.name + " Stats");
                    _f.statsDisplay.ColumnCount     = 2;
                    _f.statsDisplay.Columns[0].Name = "Total Stats";
                    _f.statsDisplay.Columns[1].Name = "Average Stats";

                    //Kills
                    var index = _f.statsDisplay.Rows.Add();
                    _f.statsDisplay.Rows[index].HeaderCell.Value = "Kills";
                    _f.statsDisplay.Rows[index].Cells[0].Value   = _totalStats.stats.championsKilled;
                    _f.statsDisplay.Rows[index].Cells[1].Value   = Math.Round(_totalStats.stats.championsKilled / (double)_games.Count, 2);

                    //Deaths
                    index = _f.statsDisplay.Rows.Add();
                    _f.statsDisplay.Rows[index].HeaderCell.Value = "Deaths";
                    _f.statsDisplay.Rows[index].Cells[0].Value   = _totalStats.stats.numDeaths;
                    _f.statsDisplay.Rows[index].Cells[1].Value   = Math.Round(_totalStats.stats.numDeaths / (double)_games.Count, 2);

                    //Assists
                    index = _f.statsDisplay.Rows.Add();
                    _f.statsDisplay.Rows[index].HeaderCell.Value = "Assists";
                    _f.statsDisplay.Rows[index].Cells[0].Value   = _totalStats.stats.assists;
                    _f.statsDisplay.Rows[index].Cells[1].Value   = Math.Round(_totalStats.stats.assists / (double)_games.Count, 2);

                    //Level
                    index = _f.statsDisplay.Rows.Add();
                    _f.statsDisplay.Rows[index].HeaderCell.Value = "Level";
                    _f.statsDisplay.Rows[index].Cells[0].Value   = _totalStats.stats.level;
                    _f.statsDisplay.Rows[index].Cells[1].Value   = Math.Round(_totalStats.stats.level / (double)_games.Count, 2);

                    //Number of Wins
                    index = _f.statsDisplay.Rows.Add();
                    _f.statsDisplay.Rows[index].HeaderCell.Value = "Wins";
                    _f.statsDisplay.Rows[index].Cells[0].Value   = numWins;
                    _f.statsDisplay.Rows[index].Cells[1].Value   = Math.Round(numWins / (double)(_games.Count), 2) + "%";

                    //Turrets Destroyed
                    index = _f.statsDisplay.Rows.Add();
                    _f.statsDisplay.Rows[index].HeaderCell.Value = "Turrets Destroyed";
                    _f.statsDisplay.Rows[index].Cells[0].Value   = _totalStats.stats.turretsKilled;
                    _f.statsDisplay.Rows[index].Cells[1].Value   = Math.Round(_totalStats.stats.turretsKilled / (double)_games.Count, 2);

                    //Minions Killed
                    index = _f.statsDisplay.Rows.Add();
                    _f.statsDisplay.Rows[index].HeaderCell.Value = "Minions";
                    _f.statsDisplay.Rows[index].Cells[0].Value   = _totalStats.stats.minionsKilled;
                    _f.statsDisplay.Rows[index].Cells[1].Value   = Math.Round(_totalStats.stats.minionsKilled / (double)_games.Count, 2);

                    //Jungle Monsters Killed
                    index = _f.statsDisplay.Rows.Add();
                    _f.statsDisplay.Rows[index].HeaderCell.Value = "Monsters";
                    _f.statsDisplay.Rows[index].Cells[0].Value   = _totalStats.stats.neutralMinionsKilled;
                    _f.statsDisplay.Rows[index].Cells[1].Value   = Math.Round(_totalStats.stats.neutralMinionsKilled / (double)_games.Count, 2);

                    //Double Kills
                    index = _f.statsDisplay.Rows.Add();
                    _f.statsDisplay.Rows[index].HeaderCell.Value = "Double Kills";
                    _f.statsDisplay.Rows[index].Cells[0].Value   = _totalStats.stats.doubleKills;
                    _f.statsDisplay.Rows[index].Cells[1].Value   = Math.Round(_totalStats.stats.doubleKills / (double)_games.Count, 2);

                    //Triple Kills
                    index = _f.statsDisplay.Rows.Add();
                    _f.statsDisplay.Rows[index].HeaderCell.Value = "Triple Kills";
                    _f.statsDisplay.Rows[index].Cells[0].Value   = _totalStats.stats.tripleKills;
                    _f.statsDisplay.Rows[index].Cells[1].Value   = Math.Round(_totalStats.stats.tripleKills / (double)_games.Count, 2);

                    //Quadra Kills
                    index = _f.statsDisplay.Rows.Add();
                    _f.statsDisplay.Rows[index].HeaderCell.Value = "Quadra Kills";
                    _f.statsDisplay.Rows[index].Cells[0].Value   = _totalStats.stats.quadraKills;
                    _f.statsDisplay.Rows[index].Cells[1].Value   = Math.Round(_totalStats.stats.quadraKills / (double)_games.Count, 2);

                    //Penta Kills
                    index = _f.statsDisplay.Rows.Add();
                    _f.statsDisplay.Rows[index].HeaderCell.Value = "Penta Kills";
                    _f.statsDisplay.Rows[index].Cells[0].Value   = _totalStats.stats.pentaKills;
                    _f.statsDisplay.Rows[index].Cells[1].Value   = Math.Round(_totalStats.stats.pentaKills / (double)_games.Count, 2);

                    //Physical Damage Dealt to Champions
                    index = _f.statsDisplay.Rows.Add();
                    _f.statsDisplay.Rows[index].HeaderCell.Value = "Phys. Damage Dealt to Champions";
                    _f.statsDisplay.Rows[index].Cells[0].Value   = _totalStats.stats.physicalDamageDealtToChampions;
                    _f.statsDisplay.Rows[index].Cells[1].Value   = Math.Round(_totalStats.stats.physicalDamageDealtToChampions / (double)_games.Count, 2);

                    //Magic Damage Dealt to Champions
                    index = _f.statsDisplay.Rows.Add();
                    _f.statsDisplay.Rows[index].HeaderCell.Value = "Magic Damage Dealt to Champions";
                    _f.statsDisplay.Rows[index].Cells[0].Value   = _totalStats.stats.magicDamageDealtToChampions;
                    _f.statsDisplay.Rows[index].Cells[1].Value   = Math.Round(_totalStats.stats.magicDamageDealtToChampions / (double)_games.Count, 2);

                    //True Damage Dealt to Champions
                    index = _f.statsDisplay.Rows.Add();
                    _f.statsDisplay.Rows[index].HeaderCell.Value = "True Damage Dealt to Champions";
                    _f.statsDisplay.Rows[index].Cells[0].Value   = _totalStats.stats.trueDamageDealtToChampions;
                    _f.statsDisplay.Rows[index].Cells[1].Value   = Math.Round(_totalStats.stats.trueDamageDealtToChampions / (double)_games.Count, 2);

                    //Wards Placed
                    index = _f.statsDisplay.Rows.Add();
                    _f.statsDisplay.Rows[index].HeaderCell.Value = "Wards Placed";
                    _f.statsDisplay.Rows[index].Cells[0].Value   = _totalStats.stats.wardPlaced;
                    _f.statsDisplay.Rows[index].Cells[1].Value   = Math.Round(_totalStats.stats.wardPlaced / (double)_games.Count, 2);

                    //Wards Killed
                    index = _f.statsDisplay.Rows.Add();
                    _f.statsDisplay.Rows[index].HeaderCell.Value = "Wards Killed";
                    _f.statsDisplay.Rows[index].Cells[0].Value   = _totalStats.stats.assists;
                    _f.statsDisplay.Rows[index].Cells[1].Value   = Math.Round(_totalStats.stats.assists / (double)_games.Count, 2);

                    //Vision Wards Bought
                    index = _f.statsDisplay.Rows.Add();
                    _f.statsDisplay.Rows[index].HeaderCell.Value = "Vision Wards Bought";
                    _f.statsDisplay.Rows[index].Cells[0].Value   = _totalStats.stats.visionWardsBought;
                    _f.statsDisplay.Rows[index].Cells[1].Value   = Math.Round(_totalStats.stats.visionWardsBought / (double)_games.Count, 2);

                    //Total Crowd Control Dealt
                    index = _f.statsDisplay.Rows.Add();
                    _f.statsDisplay.Rows[index].HeaderCell.Value = "Crowd Control Dealt";
                    _f.statsDisplay.Rows[index].Cells[0].Value   = _totalStats.stats.totalTimeCrowdControlDealt;
                    _f.statsDisplay.Rows[index].Cells[1].Value   = Math.Round(_totalStats.stats.totalTimeCrowdControlDealt / (double)_games.Count, 2);

                    //Length of the game
                    index = _f.statsDisplay.Rows.Add();
                    _f.statsDisplay.Rows[index].HeaderCell.Value = "Game Length (minutes)";
                    _f.statsDisplay.Rows[index].Cells[0].Value   = Math.Round((double)_totalStats.stats.timePlayed / 60, 2);
                    _f.statsDisplay.Rows[index].Cells[1].Value   = Math.Round(((double)_totalStats.stats.timePlayed / 60) / (double)_games.Count, 2);

                    //Physical Damage Taken
                    index = _f.statsDisplay.Rows.Add();
                    _f.statsDisplay.Rows[index].HeaderCell.Value = "Phys. Damage Taken";
                    _f.statsDisplay.Rows[index].Cells[0].Value   = _totalStats.stats.physicalDamageTaken;
                    _f.statsDisplay.Rows[index].Cells[1].Value   = Math.Round(_totalStats.stats.physicalDamageTaken / (double)_games.Count, 2);

                    //Magic Damage Taken
                    index = _f.statsDisplay.Rows.Add();
                    _f.statsDisplay.Rows[index].HeaderCell.Value = "Magic Damage Taken";
                    _f.statsDisplay.Rows[index].Cells[0].Value   = _totalStats.stats.magicDamageTaken;
                    _f.statsDisplay.Rows[index].Cells[1].Value   = Math.Round(_totalStats.stats.magicDamageTaken / (double)_games.Count, 2);

                    //True Damage Taken
                    index = _f.statsDisplay.Rows.Add();
                    _f.statsDisplay.Rows[index].HeaderCell.Value = "True Damage Taken";
                    _f.statsDisplay.Rows[index].Cells[0].Value   = _totalStats.stats.trueDamageTaken;
                    _f.statsDisplay.Rows[index].Cells[1].Value   = Math.Round(_totalStats.stats.trueDamageTaken / (double)_games.Count, 2);

                    //Displays the form after all of the information has been added.
                    _f.Show();
                }
            }
        }