Пример #1
0
        public bool OpenTab(string stash_tab)
        {
            _LoggerService.Log($"Search {stash_tab} trade tab...");
            var screen   = ScreenCapture.CaptureScreen();
            var position = OpenCV_Service.ContainsText(screen, stash_tab);

            if (position != null)
            {
                Win32.MoveTo(position.Center.X, position.Center.Y);
                Thread.Sleep(50);
                Win32.DoMouseClick();
            }
            return(false);
        }
Пример #2
0
        public bool OpenStash()
        {
            Bitmap   screen_shot = null;
            Position found_pos   = null;

            if (Win32.GetActiveWindowTitle() != "Path of Exile")
            {
                Win32.PoE_MainWindow();
            }

            //find stash poition

            _LoggerService.Log("Search stash in location...");

            for (int search_pos = 0; search_pos < 20; search_pos++)
            {
                screen_shot = ScreenCapture.CaptureScreen();
                found_pos   = OpenCV_Service.FindObject(screen_shot, $"Assets/{Properties.Settings.Default.UI_Fragments}/stashtitle.png");

                if (found_pos != null && found_pos.IsVisible)
                {
                    Win32.MoveTo(found_pos.Left + found_pos.Width / 2, found_pos.Top + found_pos.Height);

                    Thread.Sleep(100);

                    Win32.DoMouseClick();

                    Thread.Sleep(100);

                    Win32.MoveTo(screen_shot.Width / 2, screen_shot.Height / 2);

                    var timer = DateTime.Now + new TimeSpan(0, 0, 5);

                    while (true)
                    {
                        screen_shot = ScreenCapture.CaptureRectangle(140, 32, 195, 45);

                        var pos = OpenCV_Service.FindObject(screen_shot, $"Assets/{Properties.Settings.Default.UI_Fragments}/open_stash.png");

                        if (pos != null && pos.IsVisible)
                        {
                            screen_shot.Dispose();

                            return(true);
                        }

                        if (timer < DateTime.Now)
                        {
                            break;
                        }

                        Thread.Sleep(500);
                    }
                }

                screen_shot.Dispose();

                Thread.Sleep(500);
            }

            _LoggerService.Log("Stash is not found");

            return(false);
        }