Exemplo n.º 1
0
 private static bool isValidPlayer(Dictionary<string, string> player, NBA2KVersion nba2KVersion)
 {
     if ((player["IsFA"] == "0" && player["TeamID1"] != "-1") || (player["IsFA"] == "1"))
     {
         if (nba2KVersion == NBA2KVersion.NBA2K12)
         {
             if (player["PlType"] == "4" || player["PlType"] == "5" || player["PlType"] == "6")
             {
                 return true;
             }
         }
         else if (nba2KVersion == NBA2KVersion.NBA2K13)
         {
             if (player["IsRegNBA"] == "1" || player["IsSpecial"] == "1")
             {
                 return true;
             }
         }
         else
         {
             Debug.Assert(nba2KVersion == NBA2KVersion.NBA2K14);
             if (player["IsRegular"] == "1")
             {
                 return true;
             }
         }
     }
     return false;
 }
Exemplo n.º 2
0
        private static void importPlayerStats(
            PlayerStats ps, Dictionary<string, string> redPlayerStats, NBA2KVersion nba2KVersion, bool playoffs)
        {
            var arr = !playoffs ? ps.Totals : ps.PlTotals;
            arr[PAbbrT.GP] = Convert.ToUInt16(redPlayerStats["GamesP"]);
            arr[PAbbrT.GS] = Convert.ToUInt16(redPlayerStats["GamesS"]);
            arr[PAbbrT.MINS] = Convert.ToUInt16(redPlayerStats["Minutes"]);
            arr[PAbbrT.PTS] = Convert.ToUInt16(redPlayerStats["Points"]);
            arr[PAbbrT.DREB] = Convert.ToUInt16(redPlayerStats["DRebs"]);
            arr[PAbbrT.OREB] = Convert.ToUInt16(redPlayerStats["ORebs"]);
            arr[PAbbrT.AST] = Convert.ToUInt16(redPlayerStats["Assists"]);
            arr[PAbbrT.STL] = Convert.ToUInt16(redPlayerStats["Steals"]);
            arr[PAbbrT.BLK] = Convert.ToUInt16(redPlayerStats["Blocks"]);
            arr[PAbbrT.TOS] = Convert.ToUInt16(redPlayerStats["TOs"]);
            arr[PAbbrT.FOUL] = Convert.ToUInt16(redPlayerStats["Fouls"]);
            arr[PAbbrT.FGM] = Convert.ToUInt16(redPlayerStats["FGMade"]);
            arr[PAbbrT.FGA] = Convert.ToUInt16(redPlayerStats["FGAtt"]);
            try
            {
                arr[PAbbrT.TPM] = Convert.ToUInt16(redPlayerStats["3PTMade"]);
                arr[PAbbrT.TPA] = Convert.ToUInt16(redPlayerStats["3PTAtt"]);
            }
            catch (KeyNotFoundException)
            {
                arr[PAbbrT.TPM] = Convert.ToUInt16(redPlayerStats["TPTMade"]);
                arr[PAbbrT.TPA] = Convert.ToUInt16(redPlayerStats["TPTAtt"]);
            }
            arr[PAbbrT.FTM] = Convert.ToUInt16(redPlayerStats["FTMade"]);
            arr[PAbbrT.FTA] = Convert.ToUInt16(redPlayerStats["FTAtt"]);

            if (nba2KVersion == NBA2KVersion.NBA2K12)
            {
                ps.IsAllStar = Convert.ToBoolean(Convert.ToInt32(redPlayerStats["IsAStar"]));
                ps.IsNBAChampion = Convert.ToBoolean(Convert.ToInt32(redPlayerStats["IsChamp"]));
            }
            else if (nba2KVersion >= NBA2KVersion.NBA2K13)
            {
                ps.IsAllStar = Convert.ToBoolean(Convert.ToInt32(redPlayerStats["IsAllStar"]));
                ps.IsNBAChampion = Convert.ToBoolean(Convert.ToInt32(redPlayerStats["IsNBAChamp"]));
            }
        }
Exemplo n.º 3
0
 /// <summary>
 ///     Populates the REDitor dictionary lists by importing the CSV data into them. Each dictionary has Setting-Value pairs, where
 ///     Setting is the column header, and Value is the corresponding value of that particular record.
 /// </summary>
 /// <param name="folder">The folder containing the REDitor-exported CSV files.</param>
 /// <param name="teams">The resulting teams information dictionary list.</param>
 /// <param name="players">The resulting players information dictionary list.</param>
 /// <param name="teamStats">The resulting team stats dictionary list.</param>
 /// <param name="playerStats">The resulting player stats dictionary list.</param>
 /// <param name="nba2KVersion">Returns the detected NBA 2K version.</param>
 /// <returns>0 if the dictionaries were populated correctly, -1 if an error occurred.</returns>
 private static int populateREDitorDictionaryLists(
     string folder,
     out List<Dictionary<string, string>> teams,
     out List<Dictionary<string, string>> players,
     out List<Dictionary<string, string>> teamStats,
     out List<Dictionary<string, string>> playerStats,
     out NBA2KVersion nba2KVersion)
 {
     try
     {
         teams = CSV.DictionaryListFromCSVFile(folder + @"\Teams.csv");
         players = CSV.DictionaryListFromCSVFile(folder + @"\Players.csv");
         teamStats = CSV.DictionaryListFromCSVFile(folder + @"\Team_Stats.csv");
         playerStats = CSV.DictionaryListFromCSVFile(folder + @"\Player_Stats.csv");
         if (players[0].ContainsKey("PlType"))
         {
             nba2KVersion = NBA2KVersion.NBA2K12;
         }
         else if (players[0].ContainsKey("IsRegNBA"))
         {
             nba2KVersion = NBA2KVersion.NBA2K13;
         }
         else if (players[0].ContainsKey("IsRegular"))
         {
             nba2KVersion = NBA2KVersion.NBA2K14;
         }
         else
         {
             throw new Exception("This is an unknown format");
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Error: " + ex.Message);
         teams = null;
         players = null;
         teamStats = null;
         playerStats = null;
         nba2KVersion = NBA2KVersion.NBA2K12;
         return -1;
     }
     return 0;
 }
Exemplo n.º 4
0
 private static void initializeLegalTeamTypes(NBA2KVersion nba2KVersion)
 {
     switch (nba2KVersion)
     {
         case NBA2KVersion.NBA2K12:
             legalTTypes = new List<string> { "0", "4" };
             break;
         case NBA2KVersion.NBA2K13:
             legalTTypes = new List<string> { "0", "21" };
             break;
         case NBA2KVersion.NBA2K14:
             legalTTypes = new List<string> { "0", "22" };
             break;
         default:
             throw new ArgumentOutOfRangeException();
     }
 }