Ejemplo n.º 1
0
        private void Generate()
        {
            if (maskedTextBoxYear.Text == "")
            {
                MessageBox.Show("You must enter a year.", "Please Enter a Year", MessageBoxButtons.OK);
                return;
            }

            int lockedSecond = 0;

            if (maskedTextBoxSeconds.Text == "" && checkBoxLockSeconds.Checked)
            {
                MessageBox.Show("You must enter a seconds value.", "Please Enter Seconds", MessageBoxButtons.OK);
                return;
            }

            if (checkBoxLockSeconds.Checked)
            {
                lockedSecond = int.Parse(maskedTextBoxSeconds.Text);
            }

            if (textBoxSeed.Text != "")
            {
                Seed = uint.Parse(textBoxSeed.Text, NumberStyles.HexNumber);
            }

            if (radioBtnDPPt.Checked)
            {
                labelVerificationType.Text = "Coin Flips for Seed:";
                labelFlipsElmsForSeed.Text = CoinFlips.GetFlips(Seed, 15);
                labelRoamerRoutes.Text     = "";
            }
            else if (radioBtnHgSs.Checked)
            {
                labelVerificationType.Text = "Elm Responses for Seed:";
                //labelFlipsElmsForSeed.Text = ElmResponse.GetResponses(seed, 10, 0);

                // Handle all of the roaming Pokemon here
                uint rRoute = 0;
                uint eRoute = 0;
                uint lRoute = 0;

                // need to tryparse out all of the route values
                if (maskedTextBoxRRoute.Text != "")
                {
                    rRoute = uint.Parse(maskedTextBoxRRoute.Text);
                }

                if (maskedTextBoxERoute.Text != "")
                {
                    eRoute = uint.Parse(maskedTextBoxERoute.Text);
                }

                if (maskedTextBoxLRoute.Text != "")
                {
                    lRoute = uint.Parse(maskedTextBoxLRoute.Text);
                }

                //  We need to know two things, forced advancement and the
                //  starting route of each of the roamers the user has
                //  shown interest in --
                HgSsRoamerInformation information = HgSsRoamers.GetHgSsRoamerInformation(
                    Seed,
                    checkBoxRPresent.Checked,
                    checkBoxEPresent.Checked,
                    checkBoxLPresent.Checked,
                    rRoute,
                    eRoute,
                    lRoute);

                //  Build our roaming monster string
                //labelRoamerRoutes.Text = "";

                string labelRoamerRoutesText = "";

                bool firstDisplay = true;

                if (checkBoxRPresent.Checked)
                {
                    labelRoamerRoutesText += "R: " + information.RCurrentRoute;
                    firstDisplay           = false;
                }

                if (checkBoxEPresent.Checked)
                {
                    if (!firstDisplay)
                    {
                        labelRoamerRoutesText += "  ";
                    }

                    labelRoamerRoutesText += "E: " + information.ECurrentRoute;
                    firstDisplay           = false;
                }

                if (checkBoxLPresent.Checked)
                {
                    if (!firstDisplay)
                    {
                        labelRoamerRoutesText += "  ";
                    }

                    labelRoamerRoutesText += "L: " + information.LCurrentRoute;
                    firstDisplay           = false;
                }

                if (!firstDisplay)
                {
                    labelRoamerRoutesText += "  ---  ";
                    labelRoamerRoutesText += "Frame(s) Advanced: " + information.RngCalls;
                }

                labelRoamerRoutes.Text = labelRoamerRoutesText;

                //  Handle elm here, letting it know the foced advancement
                labelFlipsElmsForSeed.Text = Responses.ElmResponses(Seed, 15, information.RngCalls);
            }
            else
            {
                labelVerificationType.Text = "First 10 IVs in Seed:";
                labelFlipsElmsForSeed.Text = Gen5IVs.GetIVs(Seed, 1, 10);
                labelRoamerRoutes.Text     = "";
            }

            //  Break seed out into parts
            if (!radioBtnBW.Checked)
            {
                MAC_Address = 0;
            }
            uint partialmac = (uint)MAC_Address & 0xFFFFFF;
            uint ab         = (Seed - partialmac) >> 24;
            uint cd         = ((Seed - partialmac) & 0x00FF0000) >> 16;
            uint efgh       = (Seed - partialmac) & 0x0000FFFF;

            //  Get the year and the seed from the dialog
            //  we need to get the year because we let the
            //  user change this in the dialog

            // wfy this can fail if nothing entred
            int generateYear = int.Parse(maskedTextBoxYear.Text);

            //  Get Delay
            int delay = (int)efgh + (2000 - generateYear);

            //  Get Hour
            var hour = (int)cd;

            //  We need to check here, as a user could have entered a seed
            //  that is not possible (invalid hour) to lets warn and exit
            //  on it.
            if (hour > 23)
            {
                MessageBox.Show("This seed is invalid, please verify that you have entered it correctly and try again.",
                                "Invalid Seed", MessageBoxButtons.OK);

                return;
            }

            var timeAndDeleays = new List <TimeAndDelay>();

            //  Loop through all months
            for (int month = 1; month <= 12; month++)
            {
                int daysInMonth = DateTime.DaysInMonth(generateYear, month);

                //  Loop through all days
                for (int day = 1; day <= daysInMonth; day++)
                {
                    //  Loop through all minutes
                    for (int minute = 0; minute <= 59; minute++)
                    {
                        //  Loop through all seconds
                        for (int second = 0; second <= 59; second++)
                        {
                            if (ab == ((month * day + minute + second) % 0x100))
                            {
                                if (!checkBoxLockSeconds.Checked || second == lockedSecond)
                                {
                                    //  Create Date/Time and add item to collection
                                    var timeAndDelay = new TimeAndDelay();

                                    //  Build DateTime
                                    var dateTime = new DateTime(generateYear, month, day, hour, minute, second);

                                    timeAndDelay.Date  = dateTime;
                                    timeAndDelay.Delay = delay;

                                    //  Add to collection
                                    timeAndDeleays.Add(timeAndDelay);
                                }
                            }
                        }
                    }
                }
            }

            //  Do our databind to the grid here so the user
            //  can get the time listing.
            dataGridViewValues.DataSource = timeAndDeleays;
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            bool loop = true;

            do
            {
                Console.Title = $"The Game - Current Wins: {totalWins}";
                Console.WriteLine($"Welcome to the GAME\nSelect an item below\n--------------------------\n" +
                                  $"  - 1. Guess a number\n" +
                                  $"  - 2. Rock Paper Scissors\n" +
                                  $"  - 3. 200 IQ Super Quiz\n" +
                                  $"  - 4. Random Math Questions\n" +
                                  $"  - 5. \n" +
                                  $"  - 6. \n" +
                                  $"  - 7. \n" +
                                  $"  - 8. Roll The Dice\n" +
                                  $"  - 9. Heads or Tails\n" +
                                  $"  - 0. Exit");

                try {
                    int input = Convert.ToInt32(Console.ReadLine());
                    switch (input)
                    {
                    case 1:
                        Console.Clear();
                        GuessNumber.GuessingGame();
                        break;

                    case 2:
                        Console.Clear();
                        RockPaperScissor.RockPaperScissors();
                        break;

                    case 3:
                        Console.Clear();
                        Quiz.The200IQSuperQuiz();
                        break;

                    case 4:
                        Console.Clear();
                        Mg.MathGame();
                        break;

                    case 5:
                        Console.Clear();
                        //none yet
                        break;

                    case 6:
                        Console.Clear();
                        //none yet
                        break;

                    case 7:
                        Console.Clear();
                        //none yet
                        break;

                    case 8:
                        Console.Clear();
                        RTD.RollTheDice();
                        break;

                    case 9:
                        CoinFlips.CoinFlip();
                        Console.Clear();
                        break;

                    case 0:
                        loop = false;
                        break;

                    default:
                        Console.Clear();
                        break;
                    }
                }
                catch (FormatException) {
                    Console.Clear();
                    Console.WriteLine("Input has to be a number.\n");
                }
            } while (loop);
        }