コード例 #1
0
        private void Search7_TimelineLeap2(List <int> framelist, List <ModelStatus> statuslist, int target, List <int> timelist)
        {
            // Prepare
            SFMT sfmt = new SFMT(Seed.Value);

            for (int i = 0; i < target; i++)
            {
                sfmt.Next();
            }
            getsetting(sfmt);
            Frame.standard = timelist.Last() * 2;

            // Start
            for (int i = 0; i < framelist.Count; i++)
            {
                RNGPool.CopyStatus(statuslist[i]);
                var result = RNGPool.Generate7();
                if (!filter.CheckResult(result))
                {
                    continue;
                }
                Frames.Add(new Frame(result, frame: target, time: timelist[i] * 2)
                {
                    Frame0 = framelist[i]
                });
            }
        }
コード例 #2
0
        private void Search7_Timeline()
        {
            SFMT sfmt        = new SFMT(Seed.Value);
            int  start_frame = (int)Frame_min.Value;

            FuncUtil.getblinkflaglist(start_frame, start_frame, sfmt, Modelnum);
            // Advance
            for (int i = 0; i < start_frame; i++)
            {
                sfmt.Next();
            }
            // Prepare
            ModelStatus status = new ModelStatus(Modelnum, sfmt);

            getsetting(sfmt);
            int totaltime = (int)TimeSpan.Value * 30;
            int frame = (int)Frame_min.Value;
            int frameadvance, Currentframe;

            // Start
            for (int i = 0; i <= totaltime; i++)
            {
                Currentframe = frame;

                RNGPool.CopyStatus(status);

                var result = RNGPool.Generate7() as Result7;

                frameadvance = status.NextState();
                frame       += frameadvance;
                for (int j = 0; j < frameadvance; j++)
                {
                    RNGPool.AddNext(sfmt);
                }

                if (!filter.CheckResult(result))
                {
                    continue;
                }

                Frames.Add(new Frame(result, frame: Currentframe, time: i * 2));

                if (Frames.Count > 100000)
                {
                    break;
                }
            }
            if (Frames.FirstOrDefault()?.FrameNum == (int)Frame_min.Value)
            {
                Frames[0].Blink = FuncUtil.blinkflaglist[0];
            }
        }
コード例 #3
0
        private void Search7_TimelineLeap1(int newstartframe, int targetframe, ModelStatus status, int totaltime)
        {
            // Prepare
            SFMT sfmt = new SFMT(Seed.Value);

            for (int i = 0; i < newstartframe; i++)
            {
                sfmt.Next();
            }
            getsetting(sfmt);
            int frame = newstartframe;
            int frameadvance, Currentframe;

            // Start
            for (int i = 0; i <= totaltime; i++)
            {
                Currentframe = frame;

                RNGPool.CopyStatus(status);

                var result = RNGPool.Generate7();

                byte Jumpflag = (byte)(status.fidget_cd == 1 ? 1 : 0);
                frameadvance = status.NextState();
                frame       += frameadvance;
                for (int j = 0; j < frameadvance; j++)
                {
                    RNGPool.AddNext(sfmt);
                }
                if (Currentframe <= targetframe && targetframe < frame)
                {
                    Frame.standard = i * 2;
                }

                if (!filter.CheckResult(result))
                {
                    continue;
                }

                Frames.Add(new Frame(result, frame: Currentframe, time: i * 2, blink: Jumpflag));
            }
        }
コード例 #4
0
        private void Search7_FishyTimeline()
        {
            SFMT sfmt        = new SFMT(Seed.Value);
            int  start_frame = (int)Frame_min.Value;
            int  targetframe = (int)TargetFrame.Value;

            // Advance
            for (int i = 0; i < start_frame; i++)
            {
                sfmt.Next();
            }
            // Prepare
            ModelStatus status = new ModelStatus(Modelnum, sfmt)
            {
                raining = Raining.Checked
            };

            getsetting(sfmt);
            int totaltime = (int)TimeSpan.Value * 30;
            int frameinput1 = (int)Frame_min.Value;         // Input 1: Cast the rod
            int frameadvance, fishingdelay, frameinput2;    // Input 2: Pull the rod off water
            var fsetting   = getFishingSetting;
            int Timewindow = 2;

            // Start
            for (int i = 0; i <= totaltime; i++)
            {
                RNGPool.Save();

                // 2 Frames for delay calc
                // USUM v1.1 sub_39E2F0
                RNGPool.Rewind(0); RNGPool.CopyStatus(status);
                fishingdelay = (int)(RNGPool.getrand64 % 60) + fsetting.basedelay;
                if (Overview.Checked)
                {
                    RNGPool.Advance(1); // Keep timewindow at 2 to avoid calculation
                }
                else
                {
                    Timewindow = (int)(RNGPool.getrand64 % 15) + fsetting.platdelay + 14;
                }

                // Fishing Delay
                RNGPool.time_elapse7(fishingdelay);

                // Bitechance
                if (fsetting.suctioncups || (int)(RNGPool.getrand64 % 100) < 50)
                {
                    RNGPool.time_elapse7(1);
                    frameinput2 = RNGPool.index + frameinput1;
                    RNGPool.SaveStatus();

                    for (int j = 2; j <= Timewindow; j++)
                    {
                        RNGPool.LoadStatus();
                        RNGPool.time_elapse7(1);
                        frameinput2 += RNGPool.index;
                        RNGPool.SaveStatus();
                        RNGPool.DelayTime = fsetting.pkmdelay + Math.Max(0, fsetting.platdelay - j); //  Duplicates

                        var result = RNGPool.Generate7() as ResultW7;

                        if (!filter.CheckResult(result))
                        {
                            continue;
                        }
                        if (Overview.Checked)
                        {
                            result.RandNum = RNGPool.getsavepoint;
                        }
                        result.FrameDelayUsed += frameinput2 - frameinput1;
                        Frames.Add(new Frame(result, frame: frameinput2, time: (i + j + fishingdelay) * 2)
                        {
                            Frame0 = frameinput1
                        });
                    }
                }

                RNGPool.Load();

                if (Frames.Count > MAX_RESULTS_NUM)
                {
                    break;
                }

                // Move to next Frame, Update RNGPool
                frameadvance = status.NextState();
                frameinput1 += frameadvance;
                for (int j = 0; j < frameadvance; j++)
                {
                    RNGPool.AddNext(sfmt);
                }
            }
        }
コード例 #5
0
        private void Search7_Timeline()
        {
            if (gen7fishing)
            {
                Search7_FishyTimeline();
                return;
            }
            SFMT sfmt        = new SFMT(Seed.Value);
            int  start_frame = (int)Frame_min.Value;
            int  targetframe = (int)TargetFrame.Value;

            FuncUtil.getblinkflaglist(start_frame, start_frame, sfmt, Modelnum);
            // Advance
            for (int i = 0; i < start_frame; i++)
            {
                sfmt.Next();
            }
            // Prepare
            ModelStatus status = new ModelStatus(Modelnum, sfmt)
            {
                IsBoy = Boy.Checked, raining = Raining.Checked
            };

            getsetting(sfmt);
            int totaltime = (int)TimeSpan.Value * 30;
            int frame = (int)Frame_min.Value;
            int frameadvance, Currentframe;
            int FirstJumpFrame = (int)JumpFrame.Value;

            FirstJumpFrame = FirstJumpFrame >= start_frame && gen7fidgettimeline ? FirstJumpFrame : int.MaxValue;
            // Start
            for (int i = 0; i <= totaltime; i++)
            {
                Currentframe = frame;

                RNGPool.CopyStatus(status);

                var result = RNGPool.Generate7();

                if (frame >= FirstJumpFrame) // Find the first call
                {
                    status.fidget_cd = XMenu.Checked ? 3 : 1;
                    FirstJumpFrame   = int.MaxValue; // Disable this part
                }
                byte Jumpflag = (byte)(status.fidget_cd == 1 ? 1 : 0);
                frameadvance = status.NextState();
                frame       += frameadvance;
                for (int j = 0; j < frameadvance; j++)
                {
                    RNGPool.AddNext(sfmt);
                }
                if (Currentframe <= targetframe && targetframe < frame)
                {
                    Frame.standard = i * 2;
                }

                if (!filter.CheckResult(result))
                {
                    continue;
                }

                Frames.Add(new Frame(result, frame: Currentframe, time: i * 2, blink: Jumpflag));

                if (Frames.Count > MAX_RESULTS_NUM)
                {
                    break;
                }
            }
            if (Frames.FirstOrDefault()?.FrameNum == (int)Frame_min.Value)
            {
                Frames[0].Blink = FuncUtil.blinkflaglist[0];
            }
        }
コード例 #6
0
        private void Search7_AroundTarget()
        {
            SFMT sfmt   = new SFMT(Seed.Value);
            int  start  = (int)Frame_min.Value;
            int  target = (int)TargetFrame.Value;
            int  min    = target - 100;
            int  max    = target + 100;

            if (start > min)
            {
                start = min;
            }

            // Blinkflag
            FuncUtil.getblinkflaglist(min, max, sfmt, Modelnum);

            // Prepare
            int  i         = 0;
            byte blinkflag = 0;

            for (; i < start; i++)
            {
                sfmt.Next();
            }
            ModelStatus status = new ModelStatus(Modelnum, sfmt);
            ModelStatus stmp   = new ModelStatus(Modelnum, sfmt);

            status.raining = stmp.raining = Raining.Checked;
            getsetting(sfmt);
            int frameadvance = 0;
            int realtime     = 0;
            int frametime    = 0;

            // Calc frames around target
            for (; i <= max;)
            {
                for (; frameadvance == 0; frameadvance = status.NextState())
                {
                    realtime++;
                }
                for (; frameadvance > 0; frameadvance--, i++)
                {
                    if (min <= i && i <= max)
                    {
                        RNGPool.CopyStatus(stmp);
                        var result = RNGPool.Generate7();
                        blinkflag = FuncUtil.blinkflaglist[i - min];
                        Frames.Add(new Frame(result, frame: i, time: frametime * 2, blink: blinkflag));
                    }
                    RNGPool.AddNext(sfmt);
                }

                // Backup current status
                status.CopyTo(stmp);
                frametime = realtime;
            }

            // Get all possible results by EC matching
            // Can't identify MainRNGEggs by EC
            if (Method < 3)
            {
                Frames = Frames.OrderBy(f => f.FrameNum + (f.rt as Result7).FrameDelayUsed).ToList();

                var EClist = Frames.Select(f => f.rt.EC).ToArray();

                // Another Buffer
                sfmt = new SFMT(Seed.Value);
                int starting = Frames[0].FrameNum + (Frames[0].rt as Result7).FrameDelayUsed;
                for (i = 0; i < starting; i++)
                {
                    sfmt.Next();
                }
                RNGPool.CreateBuffer(sfmt);

                // Skip Delay
                RNGPool.Considerdelay = false;
                if (RNGPool.igenerator is Stationary7 st7)
                {
                    st7.AssumeSynced = Nature.CheckBoxItems[SyncNature.SelectedIndex].Checked;
                }

                uint  EC;
                uint  EClast = EClist.Last();
                int   Nframe = -1;
                ulong rand   = 0;
                do
                {
                    RNGPool.modelnumber = Modelnum;
                    RNGPool.ResetModelStatus();
                    var result = RNGPool.Generate7() as Result7;
                    EC = result.EC;
                    RNGPool.AddNext(sfmt);
                    if (EClist.Contains(EC))
                    {
                        var framenow = Frames.LastOrDefault(f => f.EC == EC);
                        Nframe    = framenow.FrameNum;
                        frametime = framenow.realtime;
                        rand      = framenow.Rand64;
                        continue;
                    }
                    else if (Nframe > -1)
                    {
                        result.RandNum = rand;
                        Frames.Add(new Frame(result, frame: Nframe, time: frametime, blink: 4));
                    }
                }while (EC != EClast);
            }

            // Filters
            RNGResult.IsPokemon = true;
            Frames = Frames.Where(f => filter.CheckResult(f.rt))
                     .OrderBy(f => f.FrameNum)
                     .ToList();
        }
コード例 #7
0
        private void Search7_Normal()
        {
            SFMT sfmt = new SFMT(Seed.Value);
            int  min  = (int)Frame_min.Value;
            int  max  = (int)Frame_max.Value;

            if (min > max)
            {
                return;
            }
            // Blinkflag
            FuncUtil.getblinkflaglist(min, max, sfmt, Modelnum);
            // Advance
            for (int i = 0; i < min; i++)
            {
                sfmt.Next();
            }
            // Prepare
            ModelStatus status = new ModelStatus(Modelnum, sfmt);
            ModelStatus stmp   = new ModelStatus(Modelnum, sfmt);

            status.raining = stmp.raining = Raining.Checked;
            getsetting(sfmt);
            int frameadvance;
            int realtime  = 0;
            int frametime = 0;

            // Start
            for (int i = min; i <= max;)
            {
                do
                {
                    frameadvance = status.NextState();
                    realtime++;
                }while (frameadvance == 0); // Keep the starting status of a longlife frame(for npc=0 case)
                do
                {
                    RNGPool.CopyStatus(stmp);
                    var result = RNGPool.Generate7();

                    RNGPool.AddNext(sfmt);

                    frameadvance--;
                    i++;
                    if (i > max + 1)
                    {
                        continue;
                    }
                    byte blinkflag = FuncUtil.blinkflaglist[i - min - 1];
                    if (BlinkFOnly.Checked && blinkflag < 4)
                    {
                        continue;
                    }
                    if (SafeFOnly.Checked && blinkflag >= 2)
                    {
                        continue;
                    }
                    if (!filter.CheckResult(result))
                    {
                        continue;
                    }
                    Frames.Add(new Frame(result, frame: i - 1, time: frametime * 2, blink: blinkflag));
                }while (frameadvance > 0);

                if (Frames.Count > MAX_RESULTS_NUM)
                {
                    return;
                }
                // Backup current status
                status.CopyTo(stmp);
                frametime = realtime;
            }
        }