Ejemplo n.º 1
0
        /// <summary>
        /// Main trigger thread.
        /// </summary>
        public void Run()
        {
            while (true)
            {
                if (SettingsManager.Triggerbot.IsEnabled)
                {
                    if (MouseHelper.GetAsyncKeyState(SettingsManager.Triggerbot.AimKey) < 0)
                    {
                        // Get the screen capture.
                        var screenCapture = ScreenHelper.GetScreenCapture(MyFov.FieldOfView);

                        // Search for a target.
                        var coordinates = SearchHelper.SearchColor(ref screenCapture, SettingsManager.Triggerbot.TargetColor, 100);

                        if (coordinates.X != 0 || coordinates.Y != 0)
                        {
                            MouseHelper.Click();
                        }

                        // Destroy the bitmap.
                        screenCapture.Dispose();
                        screenCapture = null;
                    }
                }

                Thread.Sleep(1);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Main trigger thread.
        /// </summary>
        public void Run()
        {
            // Retrieve the Fov.
            var myFov = Fovs.First(x => x.Resolution == new Point(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height));

            while (true)
            {
                if (MouseHelper.GetAsyncKeyState(Settings.Triggerbot.AimKey) < 0)
                {
                    // Get the screen capture.
                    var screenCapture = ScreenHelper.GetScreenCapture(myFov.FieldOfView);

                    // Search for a target.
                    var coordinates = SearchHelper.SearchColor(ref screenCapture, Settings.Triggerbot.TargetColor, 100);

                    if (coordinates.X != 0 || coordinates.Y != 0)
                    {
                        MouseHelper.Click();
                    }

                    // Destroy the bitmap.
                    screenCapture.Dispose();
                    screenCapture = null;
                }

                Thread.Sleep(1);
            }
        }
Ejemplo n.º 3
0
        private static void SetupFilters()
        {
            for (int i = 0; i < 5; i++)
            {
                Console.Write("\rSending a lot of ctr+v in " + (5 - i) + "...");
                System.Threading.Thread.Sleep(1000);
            }

            var mouse   = new MouseHelper();
            var filters = File.ReadAllLines("Affixcombos.txt");

            TextCopy.Clipboard.SetText(filters.First());
            mouse.Click(33, 678);
            System.Threading.Thread.Sleep(100);
            foreach (var filter in filters)
            {
                TextCopy.Clipboard.SetText(filter);

                mouse.Click(2315, 804);
                System.Threading.Thread.Sleep(66);

                mouse.Click(1574, 811);
                System.Threading.Thread.Sleep(66);

                uint KEYEVENTF_KEYUP = 2;
                byte VK_CONTROL      = 0x11;
                keybd_event(VK_CONTROL, 0, 0, 0);
                System.Threading.Thread.Sleep(66);
                keybd_event(0x56, 0, 0, 0);
                System.Threading.Thread.Sleep(66);

                keybd_event(0x56, 0, KEYEVENTF_KEYUP, 0);
                System.Threading.Thread.Sleep(66);
                keybd_event(VK_CONTROL, 0, KEYEVENTF_KEYUP, 0);// 'Left Control Up
                System.Threading.Thread.Sleep(66);

                mouse.Click(2424, 805);
                System.Threading.Thread.Sleep(200);
            }
        }
Ejemplo n.º 4
0
        public void doLoot()
        {
            //int idx = (int)Status.loot1+mlootidx;

            DbMsg.Msg("do loot");
            //Point pt = mpositions[idx, mlootidx];
            mlootidx++;
            if (mlootidx >= 4)
            {
                mlootidx = 0;
            }

            //remember current position;
            Point curpos = new Point(0, 0);

            WinApis.GetCursorPos(ref curpos);

            for (int i = 0; i < 4; i++)
            {
                int idx = (int)Status.loot1 + i;// mlootidx;
                //pt = mwowmacro.getLootPos();
                //DbMsg.Msg("pos=" + pt.X.ToString() + "," + pt.Y.ToString());
                //if (j>0)
                {
                    Point pt = new Point(0, 0);// = mpositions[idx, 1];
                    //pt.X = mpositions[idx, 0].X;
                    //pt.Y = mpositions[idx, 0].Y;
                    pt = mpositions[idx, 0];
                    WinApis.ClientToScreen(this.getHwndDraw(), ref pt); // DrawFormMan._this.mformhwnd, ref pt);

                    MouseHelper.Click(1, pt.X, pt.Y);
                    DbMsg.Msg("mouse-click=" + pt.X.ToString() + "," + pt.Y.ToString());
                }
                //Thread.Sleep(10);
            }
            //MouseHelper.setPos(curpos);


            //return pt;
        }
Ejemplo n.º 5
0
        private static void TestRivenStuff()
        {
            var c  = new GameCapture();
            var rp = new RivenParser();
            var ss = new ScreenStateHandler();

            var image = "test.png";
            var b     = c.GetFullImage();

            b.Save("test.png");
            b.Dispose();

            var p       = new ChatParser();
            var results = p.ParseChatImage(new Bitmap(image), true, true, 27).Where(r => r is ChatMessageLineResult).Cast <ChatMessageLineResult>();

            var clean  = new ImageCleaner();
            var coords = new CoordinateList();

            results.SelectMany(r => r.ClickPoints).ToList().ForEach(i => coords.Add(i.X, i.Y));
            clean.SaveClickMarkers("test.png", "test_marked.png", coords);

            var mouse = new MouseHelper();

            var index = 0;
            var sw    = new Stopwatch();

            foreach (var clr in results.Where(r => r is ChatMessageLineResult).Cast <ChatMessageLineResult>())
            {
                foreach (var click in clr.ClickPoints)
                {
                    b = c.GetFullImage();
                    if (ss.IsChatOpen(b))
                    {
                        //Hover over riven
                        System.Threading.Thread.Sleep(17);
                        mouse.MoveTo(click.X, click.Y);

                        //Click riven
                        System.Threading.Thread.Sleep(17);
                        mouse.Click(click.X, click.Y);
                        System.Threading.Thread.Sleep(17);
                    }

                    //Move mouse out of the way
                    mouse.MoveTo(0, 0);
                    sw.Restart();
                    var tries = 0;
                    while (true)
                    {
                        try
                        {
                            var bitmap2 = c.GetFullImage();
                            if (ss.GetScreenState(bitmap2) == ScreenState.RivenWindow)
                            {
                                var crop = rp.CropToRiven(bitmap2);
                                crop.Save(index.ToString() + ".png");
                                crop.Dispose();
                                bitmap2.Dispose();
                                break;
                            }
                            bitmap2.Dispose();
                        }
                        catch { }
                        tries++;
                        if (tries > 15)
                        {
                            Console.WriteLine("Riven not detected! Abort!");
                            break;
                        }
                    }
                    Console.WriteLine("Got \"riven\" in " + sw.Elapsed.TotalSeconds + " seconds");

                    //Hover over exit
                    System.Threading.Thread.Sleep(33);
                    mouse.MoveTo(3816, 2013);

                    //Click exit
                    var bitmap = c.GetFullImage();
                    if (ss.GetScreenState(bitmap) == ScreenState.RivenWindow)
                    {
                        System.Threading.Thread.Sleep(17);
                        mouse.Click(3816, 2013);
                        System.Threading.Thread.Sleep(17);
                    }
                    bitmap.Dispose();

                    //Move mouse out of the way
                    System.Threading.Thread.Sleep(17);
                    mouse.MoveTo(0, 0);

                    System.Threading.Thread.Sleep(17);
                    index++;
                }
            }
            //c.Dispose();
        }