Exemplo n.º 1
0
        private DataGridViewRow getRow(int i, EggRNGSearch rng, EggRNGSearch.EggRNGResult result, DataGridView dgv)
        {
            var    true_psv    = rng.PIDRerolls > 0 ? result.PSV.ToString("d") : "-";
            string true_pid    = International.Checked || omamori.Checked ? result.PID.ToString("X8") : STR_TEMP_PID;
            string true_nature = rng.Everstone ? (rng.Both_Everstone ? (result.BE_InheritParents == 0 ? STR_FIRST : STR_SECOND) : items[0]) : natures[result.Nature];

            DataGridViewRow row = new DataGridViewRow();

            row.CreateCells(dgv);
            row.SetValues(
                i, result.FramesUsed, result.Seed128,
                result.IVs[0], result.IVs[1], result.IVs[2], result.IVs[3], result.IVs[4], result.IVs[5],
                genders[result.Gender], abilities[result.Ability], true_nature,
                true_pid, true_psv, result.EC.ToString("X8"), result.row_r.ToString("X8")
                );

            for (int k = 0; k < result.InheritStats.Length; k++)
            {
                var color = result.InheritParents[k] == 0 ? pre.ForeColor : post.ForeColor;
                row.Cells[3 + (int)result.InheritStats[k]].Style.ForeColor = color;
            }
            if (result.Shiny)
            {
                row.DefaultCellStyle.BackColor = Color.LightCyan;
            }
            return(row);
        }
Exemplo n.º 2
0
        private bool frameMatch(EggRNGSearch.EggRNGResult result, SearchSetting setting)
        {
            //ここで弾く
            if (setting.Skip)
            {
                return(true);
            }

            if (!(International.Checked || omamori.Checked) && shiny.Checked)
            {
                return(false);
            }

            if (!other_TSV.Checked)
            {
                if (shiny.Checked && !result.Shiny)
                {
                    return(false);
                }
            }
            else
            {
                if (International.Checked || omamori.Checked)
                {
                    result.Shiny = other_tsv.Any(item => result.PSV == item);
                }
                if (!result.Shiny)
                {
                    return(false);
                }
            }
            if (!setting.validIVs(result.IVs))
            {
                return(false);
            }
            if (!setting.mezapa_check(result.IVs))
            {
                return(false);
            }

            if (setting.Nature != -1 && setting.Nature != result.Nature)
            {
                return(false);
            }
            if (setting.Ability != -1 && setting.Ability != result.Ability)
            {
                return(false);
            }
            if (setting.Gender != -1 && setting.Gender != result.Gender)
            {
                return(false);
            }
            if (setting.Ball != -1 && setting.Ball != result.Ball)
            {
                return(false);
            }
            return(true);
        }
Exemplo n.º 3
0
        private void EggList_search()
        {
            int min = (int)n_min.Value;
            int max = (int)n_max.Value;

            uint[] st =
            {
                (uint)L_status0a.Value,
                (uint)L_status1a.Value,
                (uint)L_status2a.Value,
                (uint)L_status3a.Value,
            };

            uint[] status = { st[0], st[1], st[2], st[3] };
            var    tiny   = new TinyMT(status, new TinyMTParameter(0x8f7011ee, 0xfc78ff1f, 0x3793fdff));

            List <DataGridViewRow> list = new List <DataGridViewRow>();

            L_dataGridView.Rows.Clear();

            var rng        = getRNGSettings();
            int frameCount = 0;

            for (int i = 1; i <= max; i++)
            {
                //statusの更新
                tiny.status.CopyTo(st, 0);
                EggRNGSearch.EggRNGResult result = rng.Generate(st);
                int ctr = result.FramesUsed;
                result.FramesUsed = frameCount;
                frameCount       += ctr;

                if (i >= min)
                {
                    var row = getRow(i, rng, result, L_dataGridView);
                    list.Add(row);
                }
                // Continue adjacents
                rng.tiny.status.CopyTo(tiny.status, 0);
            }

            L_dataGridView.Rows.AddRange(list.ToArray());
            L_dataGridView.CurrentCell = null;
        }
Exemplo n.º 4
0
        private void search()
        {
            int min = (int)s_min.Value;
            int max = (int)s_max.Value;

            uint[] st =
            {
                (uint)status0.Value,
                (uint)status1.Value,
                (uint)status2.Value,
                (uint)status3.Value,
            };

            uint[] status = { st[0], st[1], st[2], st[3] };
            var    tiny   = new TinyMT(status, new TinyMTParameter(0x8f7011ee, 0xfc78ff1f, 0x3793fdff));

            List <DataGridViewRow> list = new List <DataGridViewRow>();

            k_dataGridView.Rows.Clear();

            var setting = getSettings();
            var rng     = getRNGSettings();

            for (int i = 0; i < min; i++)
            {
                tiny.nextState();
            }
            for (int i = min; i <= max; i++, tiny.nextState())
            {
                //statusの更新
                tiny.status.CopyTo(st, 0);
                EggRNGSearch.EggRNGResult result = rng.Generate(st);

                if (!frameMatch(result, setting))
                {
                    continue;
                }
                list.Add(getRow(i, rng, result, k_dataGridView));
            }

            k_dataGridView.Rows.AddRange(list.ToArray());
            k_dataGridView.CurrentCell = null;
        }