Esempio n. 1
0
            public void SaveImage()
            {
                var name = form.comboBoxGraphicFilename.Text;

                SampleImage.Save(ImageRes.GetImagePath(name));
                LoadImageList();
                form.textBoxGraphicCode.Text = GenerateCode(form.textBoxGraphicX.Text, form.textBoxGraphicY.Text, name);
            }
Esempio n. 2
0
 public void LoadImageList()
 {
     form.comboBoxGraphicFilename.Items.Clear();
     foreach (var fi in ImageRes.GetImages())
     {
         form.comboBoxGraphicFilename.Items.Add(fi.Name.Substring(0, fi.Name.Length - fi.Extension.Length));
     }
 }
Esempio n. 3
0
        private void buttonGraphicSaveShadow_Click(object sender, EventArgs e)
        {
            var path = ImageRes.GetImagePath(comboBoxGraphicFilename.Text);

            Directory.CreateDirectory(Path.GetDirectoryName(path));
            if (File.Exists(path) && MessageBox.Show("文件已存在,是否覆盖?", "", MessageBoxButtons.YesNo) != DialogResult.Yes)
            {
                return;
            }
            tabSampling.SaveShadow();
        }
Esempio n. 4
0
        public void ChangeDate(int days = 1, bool resetdate = false)
        {
            Log($"SwitchOS.ChangeDate({days},{resetdate})");
            const int WAIT_MS = 100;

            Press(Keys.HAT.Down);
            Wait(WAIT_MS);
            Press(Keys.HAT.Right);
            Wait(WAIT_MS);
            Press(Keys.HAT.Right);
            Wait(WAIT_MS);
            Press(Keys.HAT.Right);
            Wait(WAIT_MS);
            Press(Keys.HAT.Right);
            Wait(WAIT_MS);
            Press(Keys.A);
            Wait(1500);
            Press(Keys.HAT.Down, 2000);
            Wait(100);
            Press(Keys.HAT.Right);
            Wait(WAIT_MS);
            Press(Keys.HAT.Down);
            Wait(WAIT_MS);
            Press(Keys.HAT.Down);
            Wait(WAIT_MS);
            Press(Keys.HAT.Down);
            Wait(WAIT_MS);
            Press(Keys.HAT.Down);
            Wait(WAIT_MS);
            Press(Keys.A);
            Wait(500);
            var sync = VideoCapture.Match(1510, 240, ImageRes.Get("os_synctime"), DefaultImageCap, VideoCapture.LineSampler(3));

            if (sync)
            {
                Press(Keys.A);
                Wait(500);
            }
            else if (!sync && resetdate)
            {
                Press(Keys.A);
                Wait(500);
                Press(Keys.A);
                Wait(500);
            }
            Press(Keys.HAT.Down);
            Wait(WAIT_MS);
            Press(Keys.HAT.Down);
            Wait(WAIT_MS);
            for (int i = 0; i < days; i++)
            {
                ChangeDateCore();
            }
        }
Esempio n. 5
0
 public Bool3VL IsFainted()
 {
     Log($"Battle.IsFainted()");
     if (VideoCapture.Match(850, 10, ImageRes.Get("battle_fainted"), DefaultImageCap, VideoCapture.LineSampler(3)))
     {
         return(Bool3VL.True);
     }
     if (VideoCapture.Match(850, 10, ImageRes.Get("battle_notfainted"), DefaultImageCap, VideoCapture.LineSampler(3)))
     {
         return(Bool3VL.False);
     }
     return(Bool3VL.Unknown);
 }
Esempio n. 6
0
        public void ChangeDateCore()
        {
            Log($"SwitchOS.ChangeDateCore()");
            Press(Keys.A);
            Wait(500);
            var cur = GetDateCursor();

            while (cur > 2)
            {
                Press(Keys.HAT.Left);
                Wait(200);
                cur--;
            }
            while (cur < 2)
            {
                Press(Keys.HAT.Right);
                Wait(200);
                cur++;
            }
            Press(Keys.HAT.Up);
            Wait(300);
            if (VideoCapture.Match(772, 676, ImageRes.Get("os_day01"), DefaultImageCap, VideoCapture.LineSampler(3)))
            {
                // change month
                Press(Keys.HAT.Left);
                Wait(200);
                Press(Keys.HAT.Up);
                Wait(300);
                if (VideoCapture.Match(573, 671, ImageRes.Get("os_month01"), DefaultImageCap, VideoCapture.LineSampler(3)))
                {
                    // change years
                    Press(Keys.HAT.Left);
                    Wait(200);
                    Press(Keys.HAT.Up);
                    Wait(200);
                    Press(Keys.HAT.Right);
                    Wait(200);
                }
                Press(Keys.HAT.Right);
                Wait(200);
            }
            Press(Keys.HAT.Right);
            Wait(200);
            Press(Keys.HAT.Right);
            Wait(200);
            Press(Keys.HAT.Right);
            Wait(200);
            Press(Keys.A);
            Wait(500);
        }
Esempio n. 7
0
        public List <bool> CheckEggs()
        {
            Log($"Pokelist.CheckEggs()");
            List <bool> list = new List <bool>(6);

            for (int i = 0; i < 6; i++)
            {
                int x = 145;
                int y = 256 + i * 144;
                list.Add(VideoCapture.Match(x, y, ImageRes.Get("pokelist_egg"), DefaultImageCap));
            }
            Log(list);
            return(list);
        }
        /// <summary>
        /// Set the image processing resolution. The RES_AUTO setting is highly
        /// recommended, as it adapts via a formula according to the stop range,
        /// whereas the other ranges are fixed values, and should only be used
        /// in specialized cases, such as requesting high resolution for longer
        /// distances (which will increase the processing time required to
        /// create the image). R-Theta images may use either this function or
        /// SetRangeResolution(), depending on the degree of control required.
        /// </summary>
        /// <param name="resolutionPolicy">Resolution constant (IMAGERES_*)</param>
        public void SetImageResolutionPolicy(ImageRes resolutionPolicy)
        {
            if (_disposed)
            {
                throw new ObjectDisposedException("BVTImageGenerator");
            }
            int error_code = NativeMethods.BVTImageGenerator_SetImageResolutionPolicy(_handle, ((int)resolutionPolicy));

            GC.KeepAlive(this);
            if (0 != error_code)
            {
                throw new SdkException(error_code);
            }
        }
Esempio n. 9
0
        public void AcceptFriends(int accountindex = 1)
        {
            Log($"SwitchOS.AcceptFriends()");
            if (accountindex <= 0)
            {
                return;
            }
            Press(Keys.HOME);
            Wait(1000);
            Press(Keys.HAT.Up);
            Wait(500);
            for (int i = 0; i < accountindex - 1; i++)
            {
                Press(Keys.HAT.Right);
                Wait(500);
            }
            Press(Keys.A);
            Wait(2500);
            if (VideoCapture.Match(1210, 685, ImageRes.Get("os_disconnect"), DefaultImageCap, VideoCapture.LineSampler(3)))
            {
                Press(Keys.A);
                Wait(500);
            }
            int cur = -1;

            WaitUntil(Keys.A, 5, () => (cur = GetProfileCursor()) != -1);
            while (cur < 4)
            {
                Press(Keys.HAT.Down);
                Wait(300);
                cur++;
            }
            while (cur > 4)
            {
                Press(Keys.HAT.Up);
                Wait(300);
                cur--;
            }
            PressUntil(Keys.A, 300, NoFriendRequest, TimeoutThrow(30));
            Wait(300);
            Press(Keys.HOME);
            Wait(1500);
            Press(Keys.A);
            WaitUntil(Keys.A, 10, Module <Idle>().Check);
            Wait(500);
        }
Esempio n. 10
0
        public Tuple <int, int> LocateEntry(Entry entry)
        {
            Log($"Menu.LocateEntry({entry.GetName()})");
            var image = ImageRes.Get($"menuentry_{entry.GetName().ToLower()}");

            for (int x = 0; x < 5; x++)
            {
                for (int y = 0; y < 2; y++)
                {
                    if (VideoCapture.Match(235 + x * 352, 180 + y * 360, image, DefaultImageCap, VideoCapture.LineSampler(3)))
                    {
                        return(new Tuple <int, int>(x, y));
                    }
                }
            }
            return(new Tuple <int, int>(-1, -1));
        }
Esempio n. 11
0
        public List <int> GetIVs()
        {
            Log($"Pokebox.GetIVs()");
            List <int> list = new List <int>(6);

            for (int i = 0; i < 6; i++)
            {
                int x  = 1500;
                int y  = 225 + i * 56;
                int iv = -1;
                if (VideoCapture.Match(x, y, ImageRes.Get("pokebox_iv31"), DefaultImageCap, VideoCapture.LineSampler(3)))
                {
                    iv = 31;
                }
                else if (VideoCapture.Match(x, y, ImageRes.Get("pokebox_iv0"), DefaultImageCap, VideoCapture.LineSampler(3)))
                {
                    iv = 0;
                }
                list.Add(iv);
            }
            Log(list);
            return(list);
        }
Esempio n. 12
0
 int GetDateCursor()
 {
     if (VideoCapture.Match(348, 895, ImageRes.Get("os_yearselected"), DefaultImageCap, VideoCapture.LineSampler(3)))
     {
         return(0);
     }
     if (VideoCapture.Match(602, 895, ImageRes.Get("os_monthselected"), DefaultImageCap, VideoCapture.LineSampler(3)))
     {
         return(1);
     }
     if (VideoCapture.Match(798, 895, ImageRes.Get("os_dayselected"), DefaultImageCap, VideoCapture.LineSampler(3)))
     {
         return(2);
     }
     if (VideoCapture.Match(1052, 895, ImageRes.Get("os_hourselected"), DefaultImageCap, VideoCapture.LineSampler(3)))
     {
         return(3);
     }
     if (VideoCapture.Match(1247, 895, ImageRes.Get("os_minuteselected"), DefaultImageCap, VideoCapture.LineSampler(3)))
     {
         return(4);
     }
     return(5);
 }
Esempio n. 13
0
 public bool CheckInput()
 {
     Log($"SwitchOS.CheckInput()");
     return(VideoCapture.Match(1530, 600, ImageRes.Get("os_input"), DefaultImageCap, VideoCapture.LineSampler(3)));
 }
Esempio n. 14
0
 public bool HasEgg()
 {
     Log($"EggHatch.HasEgg()");
     return(VideoCapture.Match(710, 900, ImageRes.Get("egg_hasegg"), DefaultImageCap, VideoCapture.LineSampler(3)));
 }
Esempio n. 15
0
 public bool Check()
 {
     Log($"SwitchOS.Check()");
     return(VideoCapture.Match(522, 787, ImageRes.Get("os"), DefaultImageCap, VideoCapture.LineSampler(3)));
 }
Esempio n. 16
0
 public bool NoEgg()
 {
     Log($"EggHatch.NoEgg()");
     return(VideoCapture.Match(420, 900, ImageRes.Get("egg_noegg"), DefaultImageCap, VideoCapture.LineSampler(3)));
 }
Esempio n. 17
0
 public bool Check()
 {
     Log($"Bag.Check()");
     return(VideoCapture.Match(35, 50, ImageRes.Get("bag"), DefaultImageCap, VideoCapture.LineSampler(3)));
 }
Esempio n. 18
0
 public bool Check()
 {
     Log($"Battle.Check()");
     return(VideoCapture.Match(1800, 540, ImageRes.Get("battle"), DefaultImageCap, VideoCapture.LineSampler(3)));
 }
Esempio n. 19
0
 public bool EggToBox()
 {
     Log($"EggHatch.EggToBox()");
     return(VideoCapture.Match(545, 890, ImageRes.Get("egg_tobox"), DefaultImageCap, VideoCapture.LineSampler(3)));
 }
Esempio n. 20
0
 public bool IsDisabled()
 {
     Log($"Battle.IsDisabled()");
     return(VideoCapture.Match(180, 970, ImageRes.Get("battle_disabled"), DefaultImageCap, VideoCapture.LineSampler(3)));
 }
Esempio n. 21
0
 public bool EggToList()
 {
     Log($"EggHatch.EggToList()");
     return(VideoCapture.Match(550, 890, ImageRes.Get("egg_tolist"), DefaultImageCap, VideoCapture.LineSampler(3)));
 }
Esempio n. 22
0
 public bool Check()
 {
     Log($"Pokelist.Check()");
     return(VideoCapture.Match(1655, 980, ImageRes.Get("pokelist"), DefaultImageCap, VideoCapture.LineSampler(3)) || VideoCapture.Match(96, 70, ImageRes.Get("pokelist2"), DefaultImageCap, VideoCapture.LineSampler(3)));
 }
Esempio n. 23
0
 public bool CheckEnd()
 {
     Log($"Battle.Raid.CheckEnd()");
     return(VideoCapture.Match(880, 170, ImageRes.Get("battle_raidend"), DefaultImageCap, VideoCapture.LineSampler(3)));
 }
Esempio n. 24
0
 public bool CheckCatch()
 {
     Log($"Battle.Raid.CheckCatch()");
     return(VideoCapture.Match(1680, 915, ImageRes.Get("battle_raidcatch"), DefaultImageCap, VideoCapture.LineSampler(3)) ||
            VideoCapture.Match(180, 990, ImageRes.Get("battle_raidcatch2"), DefaultImageCap, VideoCapture.LineSampler(3)));
 }
Esempio n. 25
0
 public bool CheckGetPokemon()
 {
     Log($"Dialog.CheckGetPokemon()");
     return(VideoCapture.Match(410, 970, ImageRes.Get("dialog_getpokemon"), DefaultImageCap, VideoCapture.LineSampler(3)));
 }
Esempio n. 26
0
 public bool NoFriendRequest()
 {
     Log($"SwitchOS.NoFriendRequest()");
     return(VideoCapture.Match(805, 525, ImageRes.Get("os_nofriendrequest"), DefaultImageCap, VideoCapture.LineSampler(3)));
 }
Esempio n. 27
0
 public bool CheckMenuCode()
 {
     Log($"Battle.Raid.CheckMenuCode()");
     return(VideoCapture.Match(1830, 1040, ImageRes.Get("battle_raidmenucode"), DefaultImageCap, VideoCapture.LineSampler(3)) ||
            VideoCapture.Match(1750, 1040, ImageRes.Get("battle_raidmenucode2"), DefaultImageCap, VideoCapture.LineSampler(3)));
 }
Esempio n. 28
0
 public bool Hatching()
 {
     Log($"EggHatch.Hatched()");
     return(VideoCapture.Match(415, 895, ImageRes.Get("egg_hatched"), DefaultImageCap, VideoCapture.LineSampler(3)));
 }
Esempio n. 29
0
 public bool CheckTimeout()
 {
     Log($"Battle.Raid.CheckTimeout()");
     return(VideoCapture.Match(665, 945, ImageRes.Get("battle_raidtimeout"), DefaultImageCap, VideoCapture.LineSampler(3)) ||
            VideoCapture.Match(540, 950, ImageRes.Get("battle_raidtimeout2"), DefaultImageCap, VideoCapture.LineSampler(3)));
 }
Esempio n. 30
0
 public bool CheckSelectSkill()
 {
     Log($"Battle.CheckSelectSkill()");
     return(VideoCapture.Match(1765, 540, ImageRes.Get("battle_skills"), DefaultImageCap, VideoCapture.LineSampler(3)) ||
            VideoCapture.Match(1770, 545, ImageRes.Get("battle_skills2"), DefaultImageCap, VideoCapture.LineSampler(3)));
 }