Example #1
0
        public static void check_stats(player line)
        {
            // GOLD
            if (line.Ball_Control == constants.stats_gold &&
                line.Dribbling == constants.stats_gold &&
                line.Low_Pass == constants.stats_gold &&
                line.Lofted_Pass == constants.stats_gold &&
                line.Finishing == constants.stats_gold &&
                line.Place_Kicking == constants.stats_gold &&
                line.Controlled_Spin == constants.stats_gold &&
                line.Header == constants.stats_gold &&
                line.Ball_Winning == constants.stats_gold &&
                line.Kicking_Power == constants.stats_gold &&
                line.Speed == constants.stats_gold &&
                line.Explosive_Power == constants.stats_gold &&
                line.Body_Balance == constants.stats_gold &&
                line.Jump == constants.stats_gold &&
                line.Goalkeeping == constants.stats_gold &&
                line.Saving == constants.stats_gold &&
                line.Stamina == constants.stats_gold)
            {
                line.is_gold = true;
            }

            // GOLD SYSTEM 1 --- SUMMER 2015 HEIGHT ABUSE EDITION
            else if (line.Ball_Control == constants.stats_gold_system1 &&
                     line.Dribbling == constants.stats_gold_system1 &&
                     line.Low_Pass == constants.stats_gold_system1 &&
                     line.Lofted_Pass == constants.stats_gold_system1 &&
                     line.Finishing == constants.stats_gold_system1 &&
                     line.Place_Kicking == constants.stats_gold_system1 &&
                     line.Controlled_Spin == constants.stats_gold_system1 &&
                     line.Header == constants.stats_gold_system1 &&
                     line.Ball_Winning == constants.stats_gold_system1 &&
                     line.Kicking_Power == constants.stats_gold_system1 &&
                     line.Speed == constants.stats_gold_system1 &&
                     line.Explosive_Power == constants.stats_gold_system1 &&
                     line.Body_Balance == constants.stats_gold_system1 &&
                     line.Jump == constants.stats_gold_system1 &&
                     line.Goalkeeping == constants.stats_gold_system1 &&
                     line.Saving == constants.stats_gold_system1 &&
                     line.Stamina == constants.stats_gold_system1)
            {
                line.is_gold         = true;
                line.is_gold_system1 = true;
            }

            // SILVER
            else if (line.Ball_Control == constants.stats_silver &&
                     line.Dribbling == constants.stats_silver &&
                     line.Low_Pass == constants.stats_silver &&
                     line.Lofted_Pass == constants.stats_silver &&
                     line.Finishing == constants.stats_silver &&
                     line.Place_Kicking == constants.stats_silver &&
                     line.Controlled_Spin == constants.stats_silver &&
                     line.Header == constants.stats_silver &&
                     line.Ball_Winning == constants.stats_silver &&
                     line.Kicking_Power == constants.stats_silver &&
                     line.Speed == constants.stats_silver &&
                     line.Explosive_Power == constants.stats_silver &&
                     line.Body_Balance == constants.stats_silver &&
                     line.Jump == constants.stats_silver &&
                     line.Goalkeeping == constants.stats_silver &&
                     line.Saving == constants.stats_silver &&
                     line.Stamina == constants.stats_silver)
            {
                line.is_silver = true;
            }

            // SILVER SYSTEM 1 --- SUMMER 2015 HEIGHT ABUSE EDITION
            else if (line.Ball_Control == constants.stats_silver_system1 &&
                     line.Dribbling == constants.stats_silver_system1 &&
                     line.Low_Pass == constants.stats_silver_system1 &&
                     line.Lofted_Pass == constants.stats_silver_system1 &&
                     line.Finishing == constants.stats_silver_system1 &&
                     line.Place_Kicking == constants.stats_silver_system1 &&
                     line.Controlled_Spin == constants.stats_silver_system1 &&
                     line.Header == constants.stats_silver_system1 &&
                     line.Ball_Winning == constants.stats_silver_system1 &&
                     line.Kicking_Power == constants.stats_silver_system1 &&
                     line.Speed == constants.stats_silver_system1 &&
                     line.Explosive_Power == constants.stats_silver_system1 &&
                     line.Body_Balance == constants.stats_silver_system1 &&
                     line.Jump == constants.stats_silver_system1 &&
                     line.Goalkeeping == constants.stats_silver_system1 &&
                     line.Saving == constants.stats_silver_system1 &&
                     line.Stamina == constants.stats_silver_system1)
            {
                line.is_silver         = true;
                line.is_silver_system1 = true;
            }

            // REGULAR
            else if (line.Ball_Control == constants.stats_regular &&
                     line.Dribbling == constants.stats_regular &&
                     line.Low_Pass == constants.stats_regular &&
                     line.Lofted_Pass == constants.stats_regular &&
                     line.Finishing == constants.stats_regular &&
                     line.Place_Kicking == constants.stats_regular &&
                     line.Controlled_Spin == constants.stats_regular &&
                     line.Header == constants.stats_regular &&
                     line.Ball_Winning == constants.stats_regular &&
                     line.Kicking_Power == constants.stats_regular &&
                     line.Speed == constants.stats_regular &&
                     line.Explosive_Power == constants.stats_regular &&
                     line.Body_Balance == constants.stats_regular &&
                     line.Jump == constants.stats_regular &&
                     line.Goalkeeping == constants.stats_regular &&
                     line.Saving == constants.stats_regular &&
                     line.Stamina == constants.stats_regular)
            {
                line.is_regular = true;
            }

            // REGULAR SYSTEM 1 --- SUMMER 2015 HEIGHT ABUSE EDITION
            else if (line.Ball_Control == constants.stats_regular_system1 &&
                     line.Dribbling == constants.stats_regular_system1 &&
                     line.Low_Pass == constants.stats_regular_system1 &&
                     line.Lofted_Pass == constants.stats_regular_system1 &&
                     line.Finishing == constants.stats_regular_system1 &&
                     line.Place_Kicking == constants.stats_regular_system1 &&
                     line.Controlled_Spin == constants.stats_regular_system1 &&
                     line.Header == constants.stats_regular_system1 &&
                     line.Ball_Winning == constants.stats_regular_system1 &&
                     line.Kicking_Power == constants.stats_regular_system1 &&
                     line.Speed == constants.stats_regular_system1 &&
                     line.Explosive_Power == constants.stats_regular_system1 &&
                     line.Body_Balance == constants.stats_regular_system1 &&
                     line.Jump == constants.stats_regular_system1 &&
                     line.Goalkeeping == constants.stats_regular_system1 &&
                     line.Saving == constants.stats_regular_system1 &&
                     line.Stamina == constants.stats_regular_system1)
            {
                line.is_regular         = true;
                line.is_regular_system1 = true;
            }

            // GK
            else if (line.Ball_Control == constants.stats_goalkeeper &&
                     line.Dribbling == constants.stats_goalkeeper &&
                     line.Low_Pass == constants.stats_goalkeeper &&
                     line.Lofted_Pass == constants.stats_goalkeeper &&
                     line.Finishing == constants.stats_goalkeeper &&
                     line.Place_Kicking == constants.stats_goalkeeper &&
                     line.Controlled_Spin == constants.stats_goalkeeper &&
                     line.Header == constants.stats_goalkeeper &&
                     line.Ball_Winning == constants.stats_goalkeeper &&
                     line.Kicking_Power == constants.stats_goalkeeper &&
                     line.Speed == constants.stats_goalkeeper &&
                     line.Explosive_Power == constants.stats_goalkeeper &&
                     line.Body_Balance == constants.stats_goalkeeper &&
                     line.Jump == constants.stats_goalkeeper &&
                     line.Goalkeeping == constants.stats_goalkeeper &&
                     line.Saving == constants.stats_goalkeeper &&
                     line.Stamina == constants.stats_goalkeeper)
            {
                line.is_goalkeeper = true;
            }

            // GOALKEEPER SYSTEM 1 --- SUMMER 2015 HEIGHT ABUSE EDITION
            else if (line.Ball_Control == constants.stats_goalkeeper_system1 &&
                     line.Dribbling == constants.stats_goalkeeper_system1 &&
                     line.Low_Pass == constants.stats_goalkeeper_system1 &&
                     line.Lofted_Pass == constants.stats_goalkeeper_system1 &&
                     line.Finishing == constants.stats_goalkeeper_system1 &&
                     line.Place_Kicking == constants.stats_goalkeeper_system1 &&
                     line.Controlled_Spin == constants.stats_goalkeeper_system1 &&
                     line.Header == constants.stats_goalkeeper_system1 &&
                     line.Ball_Winning == constants.stats_goalkeeper_system1 &&
                     line.Kicking_Power == constants.stats_goalkeeper_system1 &&
                     line.Speed == constants.stats_goalkeeper_system1 &&
                     line.Explosive_Power == constants.stats_goalkeeper_system1 &&
                     line.Body_Balance == constants.stats_goalkeeper_system1 &&
                     line.Jump == constants.stats_goalkeeper_system1 &&
                     line.Goalkeeping == constants.stats_goalkeeper_system1 &&
                     line.Saving == constants.stats_goalkeeper_system1 &&
                     line.Stamina == constants.stats_goalkeeper_system1)
            {
                line.is_goalkeeper         = true;
                line.is_goalkeeper_system1 = true;
            }

            // If it doesn't match anything
            else
            {
                Console.WriteLine(line.id + "\t" + line.name + " has invalid stats");
                variables.errors++;
            }
        }
Example #2
0
        public static void check_cards(player line, team squad)
        {
            int  total_cards = 0;
            bool captaincy   = false;

            // Count how many Style Cards the player has
            foreach (int i in line.Cards_Style)
            {
                if (i == 1)
                {
                    total_cards++;
                }
            }

            // Count how many Skill Cards the player has
            foreach (int i in line.Cards_Skills)
            {
                if (i == 1)
                {
                    total_cards++;
                }
            }

            // Captaincy Cards are excluded from the limit
            if (line.Cards_Skills[19] == 1)
            {
                captaincy = true;
            }

            // Check the card counts
            if ((line.is_regular) || (line.is_regular_system1))
            {
                if (total_cards > constants.cards_limit_regular)
                {
                    if ((total_cards == constants.cards_limit_regular + 1) && (captaincy))
                    {
                        Console.WriteLine(line.id + "\t" + line.name + " has CAPTAINCY");
                        squad.captains++;
                    }
                    else
                    {
                        Console.WriteLine(line.id + "\t" + line.name + " has too many Cards (Has " + total_cards + ", can only have " + constants.cards_limit_regular + " max)");
                        variables.errors++;
                    }
                }
            }
            else if ((line.is_silver) || (line.is_silver_system1))
            {
                if (total_cards > constants.cards_limit_silver)
                {
                    if ((total_cards == constants.cards_limit_silver + 1) && (captaincy))
                    {
                        Console.WriteLine(line.id + "\t" + line.name + " has CAPTAINCY");
                        squad.captains++;
                    }
                    else
                    {
                        Console.WriteLine(line.id + "\t" + line.name + " has too many Cards (Has " + total_cards + ", can only have " + constants.cards_limit_silver + " max)");
                        variables.errors++;
                    }
                }
            }
            else if ((line.is_gold) || (line.is_gold_system1))
            {
                if (total_cards > constants.cards_limit_gold)
                {
                    if ((total_cards == constants.cards_limit_gold + 1) && (captaincy))
                    {
                        Console.WriteLine(line.id + "\t" + line.name + " has CAPTAINCY");
                        squad.captains++;
                    }
                    else
                    {
                        Console.WriteLine(line.id + "\t" + line.name + " has too many Cards (Has " + total_cards + ", can only have " + constants.cards_limit_gold + " max)");
                        variables.errors++;
                    }
                }
            }
            else if ((line.is_goalkeeper) || (line.is_goalkeeper_system1))
            {
                if (total_cards > constants.cards_limit_goalkeeper)
                {
                    if ((total_cards == constants.cards_limit_goalkeeper + 1) && (captaincy))
                    {
                        Console.WriteLine(line.id + "\t" + line.name + " has CAPTAINCY");
                        squad.captains++;
                    }
                    else
                    {
                        Console.WriteLine(line.id + "\t" + line.name + " has too many Cards (Has " + total_cards + ", can only have " + constants.cards_limit_goalkeeper + " max)");
                        variables.errors++;
                    }
                }
            }
            else
            {
            }
        }
Example #3
0
        public static team export_importer(string input_file)
        {
            // Create a new team
            team squad = new team();

            // Import the raw, encrypted texport.bin
            byte[] raw_texport;
            raw_texport = File.ReadAllBytes(input_file);

            // Decrypt it
            byte[] texport;
            texport = BinFileUtility.BinFile.decryptFile(raw_texport);

            // Go 128 bytes in to get the team name
            int team_name_offset = 128;

            byte[] texport_team_name = new byte[10];

            Array.Copy(texport, team_name_offset, texport_team_name, 0, 10);

            string team_name_str = System.Text.Encoding.Default.GetString(texport_team_name);

            // Setup teams
            Hashtable teams_4cc = new Hashtable();

            teams_4cc = Lookup.setup_teams_4cc();

            // Since we don't have access to the team table, we have it hardcoded
            Hashtable team_table = new Hashtable();

            team_table = Lookup.setup_team_table();

            squad.team_name = team_name_str.TrimEnd(chars_to_trim);

            // Get the teamID
            int team_ID_offset = 94524;

            byte[] texport_team_ID = new byte[2];

            Array.Copy(texport, team_ID_offset, texport_team_ID, 0, 2);

            squad.teamID = BitConverter.ToInt16(texport_team_ID, 0);

            // Go to the first player in the export
            int player1_offset = 5338532;

            // Set the pointer
            pointer = player1_offset;

            // Loop through all the players
            while (true)
            {
                // Now we have a pointer to the start of the first player
                int    chunk_size = 180;
                byte[] chunk      = new byte[chunk_size];
                Array.Copy(texport, pointer, chunk, 0, chunk_size);

                // Create a new Player
                player line = new player();

                line.id = readPlayerID(chunk);

                if (line.id == 0)
                {
                    break;
                }

                line.name       = texPlayerName(chunk);
                line.shirt_name = texShirtName(chunk);

                line.Team_id   = readTeamID(line.id, team_table);
                line.Team_name = readTeamName(line.Team_id, teams_4cc);

                line.position    = readMainPosition(chunk);
                line.PosRats     = readPositionRatings(chunk);
                line.nationality = readCountry(chunk);

                line.height = readHeight(chunk);
                line.weight = readWeight(chunk);
                line.age    = readAge(chunk);

                line.stronger_foot = readStrongerFoot(chunk);

                line.Attacking_Prowess = readAtkProw(chunk);
                line.Dribbling         = readDribbling(chunk);
                line.Ball_Control      = readBallControl(chunk);
                line.Low_Pass          = readLowPass(chunk);
                line.Lofted_Pass       = readLoftedPass(chunk);
                line.Finishing         = readFinishing(chunk);
                line.Place_Kicking     = readPlaceKicking(chunk);
                line.Controlled_Spin   = readControlledSpin(chunk);
                line.Header            = readHeader(chunk);
                line.Defensive_Prowess = readDefProw(chunk);
                line.Ball_Winning      = readBallWinning(chunk);
                line.Kicking_Power     = readKickingPower(chunk);
                line.Speed             = readSpeed(chunk);
                line.Explosive_Power   = readExplosivePower(chunk);
                line.Body_Balance      = readBodyBalance(chunk);
                line.Jump        = readJump(chunk);
                line.Goalkeeping = readGoalkeeping(chunk);
                line.Saving      = readSaving(chunk);
                line.Stamina     = readStamina(chunk);

                line.Form = readForm(chunk);
                line.Injury_Resistance  = readInjuryTol(chunk);
                line.Weak_Foot_Usage    = readWeakFootUsage(chunk);
                line.Weak_Foot_Accuracy = readWeakFootAccuracy(chunk);
                line.playing_style      = readPlayerStyle(chunk);
                line.Cards_Style        = readCardsPlayStyles(chunk);
                line.Cards_Skills       = readCardsPlaySkills(chunk);

                // Add to the global table
                squad.team_players.Add(line);

                // DEBUG - add to list of players
                squad.team_names.Add(line.name);

                pointer += chunk_size;
            }

            // Count how many players were in the export
            int num_of_players = squad.team_players.Count;

            if (num_of_players > constants.players_per_team)
            {
                Console.WriteLine("ERROR: Export has too many players!");
                Console.WriteLine("\t\t(Has " + num_of_players + ", should have " + constants.players_per_team + ")");
                Console.WriteLine();
                variables.errors++;
            }
            else if (num_of_players < constants.players_per_team)
            {
                Console.WriteLine("ERROR: Export has too few players!");
                Console.WriteLine("\t\t(Has " + num_of_players + ", should have " + constants.players_per_team + ")");
                Console.WriteLine();
                variables.errors++;
            }
            else
            {
                // Correct number of players
            }

            return(squad);
        }
Example #4
0
        public static List <player> save_importer(string input_file)
        {
            // Import the raw, encrypted EDIT.bin
            byte[] raw_ebin;
            raw_ebin = File.ReadAllBytes(input_file);

            // Decrypt it
            byte[] ebin;
            ebin = BinFileUtility.BinFile.decryptFile(raw_ebin);

            List <player> player_table = new List <player>();
            Hashtable     team_table   = new Hashtable();
            Hashtable     teams_4cc    = new Hashtable();

            // Setup teams
            teams_4cc  = Lookup.setup_teams_4cc();
            team_table = import_team_table(ebin, teams_4cc);

            // Go 384 bytes in, get the size of the png
            int first_offet   = 384;
            int second_offset = 80;
            int png_size      = 0;

            // Set the pointer
            pointer = 0;

            png_size = BitConverter.ToInt32(ebin, first_offet);

            // Move pointer to after png
            pointer = png_size + first_offet + 4 + second_offset;

            // Jump to 5111808 blocks in, here its safe to assume we're before the first team but not too far
            int block_jump = 5111808;

            // Iterate until you find a 1
            int i   = 0;
            int ind = block_jump;

            while (i != 1)
            {
                ind++;
                i = ebin[ind];
            }

            while (true)
            {
                // Now we have a pointer to the start of the first team
                // Grab the next 48 bytes
                int size_of_player = 48;

                byte[] chunk = new byte[size_of_player];
                Array.Copy(ebin, pointer, chunk, 0, size_of_player);

                // Set the new pointer for the next iteration
                pointer += size_of_player;

                // Create a new Player
                player line = new player();

                // Read PlayerID
                line.id         = readPlayerID(chunk);
                line.name       = readPlayerName(ebin);
                line.shirt_name = readShirtName(ebin);

                if (line.id == 0)
                {
                    // If the playerID is zero, we've reach the end of the player table
                    break;
                }

                // Check if the player is a valid 4cc player
                if (team_table.Contains(line.id))
                {
                    // Read Values
                    line.position    = readMainPosition(chunk);
                    line.PosRats     = readPositionRatings(chunk);
                    line.nationality = readCountry(chunk);

                    line.Team_id   = readTeamID(line.id, team_table);
                    line.Team_name = readTeamName(line.Team_id, teams_4cc);

                    line.height        = readHeight(chunk);
                    line.weight        = readWeight(chunk);
                    line.age           = readAge(chunk);
                    line.stronger_foot = readStrongerFoot(chunk);

                    line.Attacking_Prowess = readAtkProw(chunk);
                    line.Dribbling         = readDribbling(chunk);
                    line.Ball_Control      = readBallControl(chunk);
                    line.Low_Pass          = readLowPass(chunk);
                    line.Lofted_Pass       = readLoftedPass(chunk);
                    line.Finishing         = readFinishing(chunk);
                    line.Place_Kicking     = readPlaceKicking(chunk);
                    line.Controlled_Spin   = readControlledSpin(chunk);
                    line.Header            = readHeader(chunk);
                    line.Defensive_Prowess = readDefProw(chunk);
                    line.Ball_Winning      = readBallWinning(chunk);
                    line.Kicking_Power     = readKickingPower(chunk);
                    line.Speed             = readSpeed(chunk);
                    line.Explosive_Power   = readExplosivePower(chunk);
                    line.Body_Balance      = readBodyBalance(chunk);
                    line.Jump        = readJump(chunk);
                    line.Goalkeeping = readGoalkeeping(chunk);
                    line.Saving      = readSaving(chunk);
                    line.Stamina     = readStamina(chunk);

                    line.Form = readForm(chunk);
                    line.Injury_Resistance  = readInjuryTol(chunk);
                    line.Weak_Foot_Usage    = readWeakFootUsage(chunk);
                    line.Weak_Foot_Accuracy = readWeakFootAccuracy(chunk);
                    line.playing_style      = readPlayerStyle(chunk);
                    line.Cards_Style        = readCardsPlayStyles(chunk);
                    line.Cards_Skills       = readCardsPlaySkills(chunk);

                    // Add to the global table
                    player_table.Add(line);
                }
            }

            return(player_table);
        }
Example #5
0
        public static void check_player_positions(player line)
        {
            // Player should only have one position with an A rating
            // This position should be the registered position
            int i          = 0;
            int a_ratings  = 0;
            int a_position = 0;

            for (i = 0; i < 13; i++)
            {
                if (line.PosRats[i] == 2)
                {
                    a_ratings++;
                    a_position = i;
                }
                else if (line.PosRats[i] == 1)
                {
                    // B ratings aren't allowed ever
                    Console.WriteLine(line.id + "\t" + line.name + " has a B rating in position " + Position_Lookup(i));
                    variables.errors++;
                }
                else if (line.PosRats[i] == 0)
                {
                    // C rating is allowed
                }
                else
                {
                    // Oh shit n***a what are you doing
                    Console.WriteLine(line.id + "\t" + line.name + " has an unknown rating in position " + Position_Lookup(i));
                    variables.errors++;
                }
            }

            if (a_ratings == 0)
            {
                // Player has no A ratings
                Console.WriteLine(line.id + "\t" + line.name + " has no proficiency in any position");
                variables.errors++;
            }
            else if (a_ratings >= 2)
            {
                // Player has an A rating in more than 1 position
                Console.WriteLine(line.id + "\t" + line.name + " has proficiency in more than one position");
                variables.errors++;
            }
            else // a_ratings == 1
            {
                // Check if the only A rating is the registered position
                if (line.position != a_position)
                {
                    Console.WriteLine(line.id + "\t" + line.name + " is registered in position " + Position_Lookup(line.position) + " but has an A Rating in " + Position_Lookup(a_position));
                    variables.errors++;
                }
                else
                {
                    // Setup the player position type
                    if (line.position == 0)
                    {
                        line.is_goalkeeper = true;
                    }
                    else if ((line.position >= 1) && (line.position <= 3))
                    {
                        line.is_defender = true;
                    }
                    else if ((line.position >= 4) && (line.position <= 8))
                    {
                        line.is_midfielder = true;
                    }
                    else if ((line.position >= 9) && (line.position <= 12))
                    {
                        line.is_striker = true;
                    }
                    else
                    {
                        // Oh shit n***a what are you doing
                        Console.WriteLine(line.id + "\t" + line.name + " has an invalid registered position");
                        variables.errors++;
                    }
                }
            }
        }