Ejemplo n.º 1
0
        private void searchButton_Click(object sender, EventArgs e)
        {
            DialogResult dialogResult = MessageBox.Show("This might take a long time. Are you sure you want to start the search?", "Start a search?", MessageBoxButtons.YesNo);

            if (dialogResult == DialogResult.Yes)
            {
                ulong start_seed   = ulong.Parse(seedBox.Text, System.Globalization.NumberStyles.HexNumber);
                uint  start_frame  = uint.Parse(startFrame.Text);
                uint  end_frame    = uint.Parse(endFrame.Text);
                ulong current_seed = advance(start_seed, start_frame);
                Entry pkmn         = (Entry)((ComboboxItem)speciesList.SelectedItem).Value;
                raidContent.Rows.Clear();
                var genders   = new string[] { "Male", "Female", "Genderless" };
                var shinytype = new string[] { "No", "Star", "Square" };
                var s         = GameInfo.Strings;
                ((ISupportInitialize)raidContent).BeginInit();
                for (uint current_frame = start_frame; ; current_frame++, current_seed += XOROSHIRO.XOROSHIRO_CONST)
                {
                    Pkmn res = dm.GetPkmnFromDetails(current_seed, pkmn);
                    if (res.ivs[0] >= minHP.Value && res.ivs[0] <= maxHP.Value &&
                        res.ivs[1] >= minAtk.Value && res.ivs[1] <= maxAtk.Value &&
                        res.ivs[2] >= minDef.Value && res.ivs[2] <= maxDef.Value &&
                        res.ivs[3] >= minSpa.Value && res.ivs[3] <= maxSpa.Value &&
                        res.ivs[4] >= minSpd.Value && res.ivs[4] <= maxSpd.Value &&
                        res.ivs[5] >= MinSpe.Value && res.ivs[5] <= maxSpe.Value &&
                        (natureBox.SelectedIndex == 0 || natureBox.SelectedIndex - 1 == res.nature) &&
                        (abilityBox.SelectedIndex == 0 || (int)((ComboboxItem)abilityBox.SelectedItem).Value == res.ability) &&
                        (genderBox.SelectedIndex == 0 || (int)((ComboboxItem)genderBox.SelectedItem).Value == res.gender) &&
                        (shinyBox.SelectedIndex == 0 || (shinyBox.SelectedIndex == 1 && res.shinytype > 0 || shinyBox.SelectedIndex - 2 == res.shinytype)))
                    {
                        DataGridViewRow row = new DataGridViewRow();
                        row.CreateCells(raidContent);
                        row.Cells[0].Value  = current_frame.ToString();
                        row.Cells[1].Value  = res.ivs[0].ToString();
                        row.Cells[2].Value  = res.ivs[1].ToString();
                        row.Cells[3].Value  = res.ivs[2].ToString();
                        row.Cells[4].Value  = res.ivs[3].ToString();
                        row.Cells[5].Value  = res.ivs[4].ToString();
                        row.Cells[6].Value  = res.ivs[5].ToString();
                        row.Cells[7].Value  = s.Natures[res.nature];
                        row.Cells[8].Value  = s.Ability[res.ability];
                        row.Cells[9].Value  = genders[res.gender];
                        row.Cells[10].Value = shinytype[res.shinytype];
                        row.Cells[11].Value = current_seed.ToString("X");
                        raidContent.Rows.Add(row);
                        break;
                    }
                }
                ((ISupportInitialize)raidContent).EndInit();
            }
        }
Ejemplo n.º 2
0
        private void generateData_Click(object sender, EventArgs e)
        {
            var   genders      = new string[] { "Male", "Female", "Genderless" };
            var   shinytype    = new string[] { "No", "Star", "Square" };
            ulong start_seed   = ulong.Parse(seedBox.Text, System.Globalization.NumberStyles.HexNumber);
            uint  start_frame  = uint.Parse(startFrame.Text);
            uint  end_frame    = uint.Parse(endFrame.Text);
            ulong current_seed = advance(start_seed, start_frame);
            var   s            = GameInfo.Strings;
            Entry pkmn         = (Entry)((ComboboxItem)speciesList.SelectedItem).Value;

            raidContent.Rows.Clear();
            List <DataGridViewRow> rows = new List <DataGridViewRow>();

            ((ISupportInitialize)raidContent).BeginInit();
            for (uint current_frame = start_frame; current_frame <= end_frame; current_frame++, current_seed += XOROSHIRO.XOROSHIRO_CONST)
            {
                DataGridViewRow row = new DataGridViewRow();
                row.CreateCells(raidContent);

                Pkmn res = dm.GetPkmnFromDetails(current_seed, pkmn);
                row.Cells[0].Value  = current_frame.ToString();
                row.Cells[1].Value  = res.ivs[0].ToString();
                row.Cells[2].Value  = res.ivs[1].ToString();
                row.Cells[3].Value  = res.ivs[2].ToString();
                row.Cells[4].Value  = res.ivs[3].ToString();
                row.Cells[5].Value  = res.ivs[4].ToString();
                row.Cells[6].Value  = res.ivs[5].ToString();
                row.Cells[7].Value  = s.Natures[res.nature];
                row.Cells[8].Value  = s.Ability[res.ability];
                row.Cells[9].Value  = genders[res.gender];
                row.Cells[10].Value = shinytype[res.shinytype];
                row.Cells[11].Value = current_seed.ToString("X");
                rows.Add(row);
            }
            raidContent.Rows.AddRange(rows.ToArray());
            // Double buffering can make DGV slow in remote desktop
            if (!System.Windows.Forms.SystemInformation.TerminalServerSession)
            {
                Type         dgvType = raidContent.GetType();
                PropertyInfo pi      = dgvType.GetProperty("DoubleBuffered",
                                                           BindingFlags.Instance | BindingFlags.NonPublic);
                pi.SetValue(raidContent, true, null);
            }
            ((ISupportInitialize)raidContent).EndInit();
            //raidContent
        }
Ejemplo n.º 3
0
        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            Den den = dm.GetDen(denBox.SelectedIndex);
            Pkmn pkmn = dm.GetPkmnFromDen(den);
            activeBox.Checked = den.active_den;
            rareBox.Checked = den.rare_den;
            EventBox.Checked = den.event_den;
            denSeed.Text = den.seed.ToString("X");

            // draw stars
            var star = "\u2605";
            var output = star;
            for (int i = 0; i < den.stars; i++) output += star;
            StarLbl.Text = output;
            
            var s = GameInfo.Strings;
            abilityLbl.Text = s.Ability[pkmn.ability];

            natureLbl.Text = s.natures[pkmn.nature];
            TextBox[] ivtextw = { TB_HP_IV1, TB_ATK_IV1, TB_DEF_IV1, TB_SPA_IV1, TB_SPD_IV1, TB_SPE_IV1 };
            for(int i=0; i < 6; i++)
            {
                ivtextw[i].Text = pkmn.ivs[i].ToString();
            }

            Image sprite = PKHeX.Drawing.SpriteUtil.GetSprite(pkmn.species, pkmn.form, pkmn.gender, 0, false, pkmn.shinytype > 0);
            if (pkmn.isGigantamax)
            {
                var gm = Properties.Resources.dyna;
                sprite = ImageUtil.LayerImage(sprite, gm, (sprite.Width - gm.Width) / 2, 0);
            }
            if (!activeBox.Checked)
            {
                sprite = MakeGrayscale((Bitmap) sprite);
            }
            PB_PK1.BackgroundImage = sprite;
            shinyframes.Text = shiny_in(den.seed).ToString();
            locationLabel.Text = den.location;
        }