示例#1
0
        private void createtimeline()
        {
            SFMT sfmt    = new SFMT((uint)Seed.Value);
            bool Isevent = Poke.SelectedIndex == 1;

            for (int i = 0; i < (int)Frame_min.Value; i++)
            {
                sfmt.NextUInt64();
            }

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

            DGV.Rows.Clear();

            var st      = CreateNPCStatus(sfmt);
            var setting = getSettings();
            var rng     = getRNGSettings();

            RNGSearch.ResetNPCStatus();
            RNGSearch.CreateBuffer(sfmt);

            if (Isevent)
            {
                e = geteventsetting();
            }

            int totaltime    = (int)TimeSpan.Value * 30;
            int frame        = (int)Frame_min.Value;
            int frameadvance = 0;

            for (int i = 0; i <= totaltime; i++)
            {
                RNGSearch.remain_frame = (int[])st.remain_frame.Clone();
                RNGSearch.blink_flag   = (bool[])st.blink_flag.Clone();

                RNGSearch.RNGResult result = Isevent ? rng.GenerateEvent(e) : rng.Generate();

                result.realtime = i;
                frameadvance    = st.NextState();
                frame          += frameadvance;

                for (int j = 0; j < frameadvance; j++)
                {
                    RNGSearch.Rand.RemoveAt(0);
                    RNGSearch.Rand.Add(sfmt.NextUInt64());
                }

                if (!frameMatch(result, setting))
                {
                    continue;
                }

                list.Add(getRow_Sta(frame - frameadvance, rng, result, DGV));

                if (list.Count > 100000)
                {
                    break;
                }
            }
            DGV.Rows.AddRange(list.ToArray());
            DGV.CurrentCell = null;
        }
示例#2
0
        private DataGridViewRow getRow_Sta(int i, RNGSearch rng, RNGSearch.RNGResult result, DataGridView dgv)
        {
            int    d               = i - (int)Time_max.Value;
            string true_nature     = SearchSetting.naturestr[result.Nature];
            string SynchronizeFlag = (result.Synchronize ? "O" : "X");

            if ((result.UbValue < UB_th.Value) && (ConsiderDelay.Checked) && (!ShowResultsAfterDelay.Checked))
            {
                result.Blink = -1;
            }
            string BlinkFlag = "";

            switch (result.Blink)
            {
            case -2: BlinkFlag = "★+?"; break;

            case -1: BlinkFlag = "?"; break;

            case 0: BlinkFlag = "-"; break;

            case 1: BlinkFlag = "★"; break;

            default: BlinkFlag = result.Blink.ToString(); break;
            }
            string PSV       = result.PSV.ToString("D4");
            string Ability   = result.Ability.ToString();
            string Encounter = (result.Encounter == -1) ? "-" : result.Encounter.ToString();
            string Slot      = (result.Slot == -1) ? "-" : result.Slot.ToString();
            string Lv        = (result.Lv == -1) ? "-" : result.Lv.ToString();
            string Item      = (result.Item == -1) ? "-" : result.Item.ToString();
            string UbValue   = (result.UbValue == 100) ? "-" : result.UbValue.ToString();
            string randstr   = result.row_r.ToString("X16");
            string PID       = result.PID.ToString("X8");
            string EC        = result.EC.ToString("X8");
            string time      = (CreateTimeline.Checked) ? (2 * result.realtime).ToString() + "F" : "-";

            if (!Advanced.Checked)
            {
                if (Encounter != "-")
                {
                    Encounter = (result.Encounter < Encounter_th.Value) ? "O" : "X";
                }
                if (UbValue != "-")
                {
                    UbValue = (result.UbValue < UB_th.Value) ? "O" : "X";
                }
                if (UbValue == "O")
                {
                    Slot = "UB";
                }
                if (result.Item < 50)
                {
                    Item = "50%";
                }
                else if (result.Item < 55)
                {
                    Item = "5%";
                }
                else
                {
                    Item = "-";
                }
                time = (CreateTimeline.Checked) ? ((float)result.realtime / 30).ToString("F") + "s" : "-";
            }

            if (Poke.SelectedIndex == 1)
            {
                if (e.AbilityLocked)
                {
                    Ability = "-";
                }
                if (e.NatureLocked)
                {
                    true_nature = "-";
                }
                if (e.PIDType != 0)
                {
                    PID = "-"; PSV = "-"; EC = "-";
                }
            }

            string frameadvance = result.frameshift.ToString("+#;-#;0");

            if (ConsiderDelay.Checked && !ShowResultsAfterDelay.Checked)
            {
                RNGSearch.Resetindex(); RNGSearch.ResetNPCStatus();
                frameadvance = (Poke.SelectedIndex == 1) ? rng.getframeshift(e).ToString("+#;-#;0") : rng.getframeshift().ToString("+#;-#;0");
            }

            int[] Status = new int[6] {
                0, 0, 0, 0, 0, 0
            };
            if (ShowStats.Checked)
            {
                Status = result.p_Status;
            }
            else
            {
                Status = result.IVs;
            }

            DataGridViewRow row = new DataGridViewRow();

            row.CreateCells(dgv);

            row.SetValues(
                i, d.ToString("+#;-#;0"), BlinkFlag,
                Status[0], Status[1], Status[2], Status[3], Status[4], Status[5],
                true_nature, SynchronizeFlag, result.Clock, PSV, frameadvance, UbValue, Slot, Lv, SearchSetting.genderstr[result.Gender], Ability, Item, Encounter,
                randstr, PID, EC, time
                );

            if (result.Shiny)
            {
                row.DefaultCellStyle.BackColor = Color.LightCyan;
            }

            return(row);
        }
示例#3
0
        private void StationarySearch()
        {
            int max, min;

            if (AroundTarget.Checked)
            {
                min = (int)Time_max.Value - 100;
                max = (int)Time_max.Value + 100;
            }
            else
            {
                min = (int)Frame_min.Value;
                max = (int)Frame_max.Value;
            }

            bool Isevent = Poke.SelectedIndex == 1;

            SFMT sfmt = new SFMT((uint)Seed.Value);
            List <DataGridViewRow> list = new List <DataGridViewRow>();

            DGV.Rows.Clear();

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

            //Blink flag history
            int blink_flag  = 0;
            int UnsafeRange = 41 * (int)NPC.Value;

            if (UnsafeRange == 0)
            {
                for (int i = 0; i < min - 2; i++)
                {
                    sfmt.NextUInt64();
                }
                for (int i = 0; i < 2; i++)
                {
                    switch (blink_flag)
                    {
                    case 0:
                        if ((sfmt.NextUInt64() & 0x7F) == 0)
                        {
                            blink_flag = 1;
                        }
                        break;

                    case 1:
                        blink_flag = (sfmt.NextUInt64() % 3) == 0 ? 36 : 30; break;
                    }
                }
            }
            else if (!Honey.Checked)
            {
                for (int i = 0; i < Math.Max(418, min - UnsafeRange); i++)
                {
                    sfmt.NextUInt64();
                }
                for (int i = Math.Max(418, min - UnsafeRange); i < min; i++)
                {
                    if ((sfmt.NextUInt64() & 0x7F) == 0)
                    {
                        blink_flag = UnsafeRange;
                    }
                    else
                    if (blink_flag > 0)
                    {
                        blink_flag--;
                    }
                }
            }
            else
            {
                for (int i = 0; i < min; i++)
                {
                    sfmt.NextUInt64();
                }
            }

            RNGSearch.CreateBuffer(sfmt);

            if (Isevent)
            {
                e = geteventsetting();
            }

            for (int i = min; i <= max; i++, RNGSearch.Rand.RemoveAt(0), RNGSearch.Rand.Add(sfmt.NextUInt64()))
            {
                RNGSearch.RNGResult result = Isevent ? rng.GenerateEvent(e) : rng.Generate();

                if (NPC.Value == 0)
                {
                    switch (blink_flag)
                    {
                    case 0:
                        if (result.Blink == 1)
                        {
                            blink_flag = 1;
                        }
                        break;

                    case 1:
                        blink_flag = (result.row_r % 3) == 0 ? 36 : 30; result.Blink = 5; break;

                    default:
                        result.Blink = blink_flag; blink_flag = 0; break;
                    }
                }
                else if (!Honey.Checked)
                {
                    if (result.Blink == 1)
                    {
                        if (blink_flag > 0)
                        {
                            result.Blink = -2;
                        }
                        blink_flag = UnsafeRange;
                    }
                    else if (blink_flag > 0)
                    {
                        blink_flag--;
                        result.Blink = -1;
                    }
                }

                if (!frameMatch(result, setting))
                {
                    continue;
                }

                list.Add(getRow_Sta(i, rng, result, DGV));

                if (list.Count > 100000)
                {
                    break;
                }
            }
            DGV.Rows.AddRange(list.ToArray());
            DGV.CurrentCell = null;
        }
示例#4
0
        private bool frameMatch(RNGSearch.RNGResult result, SearchSetting setting)
        {
            setting.getStatus(result, setting);

            if (setting.Skip)
            {
                return(true);
            }

            if (ShinyOnly.Checked && !result.Shiny)
            {
                return(false);
            }

            if (BlinkOnly.Checked && result.Blink < 5)
            {
                return(false);
            }

            if (SafeFOnly.Checked && result.Blink < 0)
            {
                return(false);
            }

            if (ByIVs.Checked && !setting.validIVs(result.IVs))
            {
                return(false);
            }

            if (ByStats.Checked && !setting.validStatus(result, setting))
            {
                return(false);
            }

            if (!setting.mezapa_check(result.IVs))
            {
                return(false);
            }

            if (setting.Nature != -1 && setting.Nature != result.Nature)
            {
                return(false);
            }

            if (Wild.Checked)
            {
                if (setting.Lv != 0 && setting.Lv != result.Lv)
                {
                    return(false);
                }

                if (EncounteredOnly.Checked && result.Encounter >= Encounter_th.Value)
                {
                    return(false);
                }

                if (UBOnly.Checked && result.UbValue >= UB_th.Value)
                {
                    return(false);
                }

                if (!UB.Checked || result.UbValue >= UB_th.Value)
                {
                    if (setting.Slot[0] && !setting.Slot[result.Slot])
                    {
                        return(false);
                    }

                    if (setting.Gender != 0 && setting.Gender != result.Gender)
                    {
                        return(false);
                    }

                    if (setting.Ability != 0 && setting.Ability != result.Ability)
                    {
                        return(false);
                    }
                }
            }

            return(true);
        }