Beispiel #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;
        }
Beispiel #2
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;
        }
        private void listValidTimes(int monthFilter, int dayFilter)
        {
            var timeAndDelays = new List<TimeAndDelay>();

            int minMonth;
            int maxMonth;
            int minDay;
            int maxDay;

            if (monthFilter != 0)
                minMonth = maxMonth = monthFilter;
            else
            {
                minMonth = 1;
                maxMonth = 12;
            }

            minDay = maxDay = dayFilter;
            if (dayFilter == 0)
                minDay = 1;

            //  Loop through all months
            for (int month = minMonth; month <= maxMonth; month++)
            {
                if (dayFilter == 0)
                    maxDay = DateTime.DaysInMonth(year, month);

                //  Loop through all days
                for (int day = minDay; day <= maxDay; 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))
                            {
                                //  Create Date/Time and add item to collection
                                var timeAndDelay = new TimeAndDelay();

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

                                timeAndDelay.Date = dateTime;
                                timeAndDelay.Delay = (int) delay;

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

            //  Do our databind to the grid here so the user
            //  can get the time listing.
            dataGridViewValues.DataSource = timeAndDelays;
        }
Beispiel #4
0
        private void listValidTimes(int monthFilter, int dayFilter)
        {
            var timeAndDelays = new List <TimeAndDelay>();

            int minMonth;
            int maxMonth;
            int minDay;
            int maxDay;

            if (monthFilter != 0)
            {
                minMonth = maxMonth = monthFilter;
            }
            else
            {
                minMonth = 1;
                maxMonth = 12;
            }

            minDay = maxDay = dayFilter;
            if (dayFilter == 0)
            {
                minDay = 1;
            }

            //  Loop through all months
            for (int month = minMonth; month <= maxMonth; month++)
            {
                if (dayFilter == 0)
                {
                    maxDay = DateTime.DaysInMonth(year, month);
                }

                //  Loop through all days
                for (int day = minDay; day <= maxDay; 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))
                            {
                                //  Create Date/Time and add item to collection
                                var timeAndDelay = new TimeAndDelay();

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

                                timeAndDelay.Date  = dateTime;
                                timeAndDelay.Delay = (int)delay;

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

            //  Do our databind to the grid here so the user
            //  can get the time listing.
            dataGridViewValues.DataSource = timeAndDelays;
        }