Esempio n. 1
0
 public Cursor GetCursor()
 {
     Log($"Pokebox.Boxlist.GetCursor()");
     try
     {
         VideoCapture.Freeze();
         if (VideoCapture.Match(600, 957, Color.FromArgb(0, 0, 0), DefaultColorCap))
         {
             return(new Cursor(Section.BoxList));
         }
         if (VideoCapture.Match(979, 960, Color.FromArgb(0, 0, 0), DefaultColorCap))
         {
             return(new Cursor(Section.Search));
         }
         for (int x = 0; x < 8; x++)
         {
             for (int y = 0; y < 4; y++)
             {
                 if (VideoCapture.Match(946 + 122 * x, 298 + 154 * y, Color.FromArgb(235, 40, 76), DefaultColorCap))
                 {
                     return(new Cursor(Section.Box, x, y));
                 }
             }
         }
         return(new Cursor());
     }
     finally
     {
         VideoCapture.Unfreeze();
     }
 }
Esempio n. 2
0
 public Cursor GetCursor()
 {
     Log($"Pokebox.GetCursor()");
     try
     {
         VideoCapture.Freeze();
         if (VideoCapture.Match(523, 960, Color.FromArgb(0, 0, 0), DefaultColorCap))
         {
             return(new Cursor(Section.BoxList));
         }
         if (VideoCapture.Match(902, 960, Color.FromArgb(0, 0, 0), DefaultColorCap))
         {
             return(new Cursor(Section.Search));
         }
         if (VideoCapture.Match(59, 132, Color.FromArgb(0, 0, 0), DefaultColorCap))
         {
             return(new Cursor(Section.PartyTitle));
         }
         if (VideoCapture.Match(663, 116, Color.FromArgb(0, 0, 0), DefaultColorCap))
         {
             return(new Cursor(Section.BoxTitle));
         }
         for (int y = 0; y < MAX_L; y++)
         {
             if (VideoCapture.Match(112, 232 + 136 * y, Color.FromArgb(235, 40, 76), DefaultColorCap) ||
                 VideoCapture.Match(112, 232 + 136 * y, Color.FromArgb(14, 136, 222), DefaultColorCap) ||
                 VideoCapture.Match(112, 232 + 136 * y, Color.FromArgb(19, 236, 122), DefaultColorCap))
             {
                 return(new Cursor(Section.Party, 0, y));
             }
         }
         for (int x = 0; x < MAX_X; x++)
         {
             for (int y = 0; y < MAX_Y; y++)
             {
                 if (VideoCapture.Match(546 + 136 * x, 237 + 136 * y, Color.FromArgb(235, 40, 76), DefaultColorCap) ||
                     VideoCapture.Match(546 + 136 * x, 237 + 136 * y, Color.FromArgb(14, 136, 222), DefaultColorCap) ||
                     VideoCapture.Match(546 + 136 * x, 237 + 136 * y, Color.FromArgb(19, 236, 122), DefaultColorCap))
                 {
                     return(new Cursor(Section.Box, x, y));
                 }
             }
         }
         return(new Cursor());
     }
     finally
     {
         VideoCapture.Unfreeze();
     }
 }
Esempio n. 3
0
        public void RunGetRareDen()
        {
            Msg(Colors.Highlight, "SL紫光柱");
            while (true)
            {
                Press(Keys.A);
                Wait(3300);
                Press(Keys.A);
                Wait(2500);
                Press(Keys.A);
                Wait(1300);

                Battle.Raid.BeamColor c;
                try
                {
                    VideoCapture.Freeze();
                    Press(Keys.HOME);
                    c = Module <Battle.Raid>().GetBeamColor();
                }
                finally
                {
                    VideoCapture.Unfreeze();
                }

                if (c == Battle.Raid.BeamColor.Red)
                {
                    // red beam
                    Msg(Colors.Fail, "红光柱,重新读档");
                    Wait(1000);
                    Module <SwitchOS>().RestartGame();
                    Wait(500);
                    continue;
                }
                else if (c == Battle.Raid.BeamColor.Purple)
                {
                    // purple beam
                    Msg(Colors.Success, "成功获得紫光柱");
                    Wait(1000);
                    Press(Keys.HOME);
                    return;
                }
                else
                {
                    ScreenShot("RareDen Failed");
                    throw new ScriptException("光柱检测失败");
                }
            }
        }
Esempio n. 4
0
        internal bool CheckFilter(Filter filter, out bool isShiny)
        {
            isShiny = false;
            if (IsEmptySlot())
            {
                return(false);
            }
            Bool3VL shiny = Bool3VL.Unknown;

            filter.Reset();
            // check pokemon
            Wait(200);
            var page0 = Module <Pokebox>().GetSummaryPage();
            var page  = page0;

            while (true)
            {
                try
                {
                    VideoCapture.Freeze();
                    // check shiny
                    if (shiny.IsUnknown && (page == Pokebox.SummaryPage.Status || page == Pokebox.SummaryPage.IV))
                    {
                        shiny = Module <Pokebox>().IsShiny();
                    }
                    // check filter
                    filter.Check(this, page);
                }
                finally
                {
                    VideoCapture.Unfreeze();
                }
                if (shiny.IsKnown && filter.Result.IsKnown)
                {
                    break;
                }
                // next page
                Press(Keys.PLUS);
                Wait(500);
                page = Module <Pokebox>().GetSummaryPage();
            }
            isShiny = shiny.Boolean;
            return(isShiny || filter.Result.Boolean);
        }
Esempio n. 5
0
 public bool CheckBlackScreen()
 {
     Log($"SwitchOS.CheckBlackScreen()");
     try
     {
         VideoCapture.Freeze();
         for (int x = 500; x <= 1000; x += 100)
         {
             for (int y = 100; y <= 200; y += 100)
             {
                 if (!VideoCapture.Match(x, y, Color.FromArgb(0, 0, 0), DefaultColorCap))
                 {
                     return(false);
                 }
             }
         }
         return(true);
     }
     finally
     {
         VideoCapture.Unfreeze();
     }
 }
Esempio n. 6
0
 private void buttonGraphicFreeze_Click(object sender, EventArgs e)
 {
     VideoCapture.Freeze();
 }