Exemple #1
0
        /// <summary>
        /// Eat the EVE window and inject
        /// </summary>
        private void initialize()
        {
            RECT      eveWindowRect = new RECT();
            HandleRef windowRef     = new HandleRef(this, appWin);

            /*if (this.IsVisible())
             *  this.Hide();
             * this.Show();
             */

            GetWindowRect(windowRef, out eveWindowRect);

            // Move the window to overlay it on this window
            int eveWindowWidth  = eveWindowRect._Right - eveWindowRect._Left;
            int eveWindowHeight = eveWindowRect._Bottom - eveWindowRect._Top;

            //MoveWindow(appWin, 0, 0, eveWindowWidth-10, eveWindowHeight, true);


            Console.WriteLine("Eve width = " + eveWindowWidth);

            if (eveWindowHeight > 10 && eveWindowWidth > 10)
            {
                this.Width  = eveWindowWidth;
                this.Height = eveWindowHeight;
            }

            //Add the screen to global list
            DrawAbleScreenFetcher.addScreen(drawingScreen);
            DrawAbleScreenFetcher.addScreen(drawingPanel);

            //Initialize input methods
            drawingScreen.setPid(getPid());
            drawingPanel.setPid(getPid());

            mouse.setPid(getPid());
            pmouse.setPid(getPid());
            pmouse.setWindowHandle(appWin);
            keyboard.setWindowHandle(appWin);
            mouse.setWindowHandle(appWin);
            //drawingScreen.TopLevel = false;
            //drawingScreen.Parent = this;

            StringBuilder sb = new StringBuilder(300);

            GetWindowText(appWin, sb, sb.Capacity);

            if (sb.ToString().Contains(title))
            {
                loaded = true;
            }
            // cw.Size = new Size(900, 800);


        #if DEBUG
            ;
        #else
            inject();
        #endif
        }
Exemple #2
0
 /// <summary>
 /// Updates the location of the drawable area
 /// </summary>
 /// <param name="e">EventArgs for the event</param>
 protected override void OnVisibleChanged(EventArgs e)
 {
     if (bots.Count > 0)
     {
         WindowHandler tmp = bots[0].getHandle();
         if (tmp != null)
         {
             foreach (Utils util in DrawAbleScreenFetcher.fetchAllScreens(tmp.getPid()))
             {
                 if (util != null)
                 {
                     util.setLocation(new Point(this.Location.X + 10, this.Location.Y + 80));
                 }
             }
         }
     }
     //this.tabControl1.Size = this.Size;
     base.OnVisibleChanged(e);
 }
Exemple #3
0
        /// <summary>
        /// Move the mouse to Point p
        /// </summary>
        /// <param name="p">The point to move the mouse to</param>
        public void moveMouse(Point p)
        {
            Cursor cur = Cursors.Default;

            screen = DrawAbleScreenFetcher.fetchOpaque(getPid());
            if (screen == null)
            {
                Console.WriteLine("Screen is null");
                return;
            }


            if (appWin == IntPtr.Zero)
            {
                Console.WriteLine("Mouse appWin is null1: " + getPid());
                return;
            }


            this.X = p.X;
            this.Y = p.Y;



            //PostMessage(appWin, (int)WMessages.WM_NCHITTEST, 0, 0x009803CE);
            //SendMessage(appWin, (int)WMessages.WM_SETCURSOR, (long)appWin, ZiadSpace.Util.BitHelper.MakeLong(300, 200));
            //PostMessage(hWndCalc, (int)WMessages.WM_MOUSEMOVE, 0, ZiadSpace.Util.BitHelper.MakeDword(300, 200));

            //PostMessage(hWndCalc, (int)WMessages.WM_LBUTTONDOWN, 0, ZiadSpace.Util.BitHelper.MakeDword(300, 200));
            //PostMessage(hWndCalc, (int)WMessages.WM_LBUTTONUP, 0, ZiadSpace.Util.BitHelper.MakeDword(300,200));

            //screen.Invalidate();


            //screen.Invalidate();

            //dllMoveMouse(appWin, X, Y);
            //dllMuseClick(appWin, X, Y);
            screen.drawMouse(new Point(p.X, p.Y), cur);
            //screen.drawLine(Pens.BurlyWood, p, new Point(p.X + 5, p.Y));
            dllMoveMouse(appWin, p.X, p.Y);
        }
Exemple #4
0
        /// <summary>
        /// More insane mouse logic
        /// </summary>
        /// <param name="speed"></param>
        /// <param name="x"></param>
        /// <param name="y"></param>
        /// <param name="randX"></param>
        /// <param name="randY"></param>
        /// <param name="afterOffset"></param>

        public void move(int speed, int x, int y, int randX, int randY, int afterOffset)
        {
            int    e = 0, f = 0, g = 0, nx = 0, ny = 0, hypo = 0, seg = 0, cx = 0, cy = 0;
            double a = 0, b = 0, c = 0, randSpeed = 0;
            bool   miss = false;



            cx = cursorLocation().X;
            cy = cursorLocation().Y;

            if (x != -1 || y != -1)
            {
                screen = DrawAbleScreenFetcher.fetchOpaque(getPid());


                if (screen == null)
                {
                    Console.WriteLine("screen is null");
                    Console.WriteLine("Mouse PID: " + getPid());
                    return;
                }

                miss = random.Next(missChance) == 0;
                a    = x - cx;
                b    = y - cy;
                c    = Math.Pow(a, 2) + Math.Pow(b, 2);
                hypo = (int)Math.Round(Math.Sqrt(c));

                if (hypo == 0)
                {
                    return;
                }
                else if (hypo > 1 && hypo < 225)
                {
                    seg = 1;
                }
                else if (hypo > 225 && hypo < 600)
                {
                    seg = random.Next(2) + 1;
                }
                else if (hypo > 600 && hypo < 1800)
                {
                    seg = random.Next(3) + 2;
                }
                else
                {
                    seg = 5;
                }

                Console.WriteLine("Seg = " + seg);

                f = (int)Math.Round(a / seg);
                g = (int)Math.Round(b / seg);

                while (e != seg)
                {
                    System.Threading.Thread.Sleep(30 + random.Next(50));
                    randSpeed = (random.Next(speed) / 2.0 + speed) / 10.0;
                    if (randSpeed == 0)
                    {
                        randSpeed = 0.1;
                    }

                    nx = (cursorLocation().X + (f * e)) + random.Next(randX, randX);
                    ny = (cursorLocation().Y + (g * e)) + random.Next(randY, randY);

                    if (miss)
                    {
                        nx = nx + random.Next(randX, randX * 2);
                        ny = ny + random.Next(randY, randY * 2);
                    }
                    WindMouse(cx, cy, nx, ny, 11, 8, 10 / randSpeed, 12 / randSpeed, 10 * randSpeed, 10 * randSpeed);
                    e++;
                }
                cx = cursorLocation().X;
                cy = cursorLocation().Y;

                if (!atPosition(x, y))
                {
                    System.Threading.Thread.Sleep(30 + random.Next(30));
                    WindMouse(cx, cy, (x + random.Next(randX)), (y + random.Next(randY)), 11, 6, 10 / randSpeed, 15 / randSpeed, 10 * randSpeed, 10 * randSpeed);
                }

                //               PostMessage(appWin, (int)WMessages.WM_LBUTTONDOWN, 0, MakeLParam(x, y));
                //               PostMessage(appWin, (int)WMessages.WM_LBUTTONUP, 0, MakeLParam(x, y));
            }
        }
Exemple #5
0
 /// <summary>
 /// Get the bot's drawable screen reference
 /// </summary>
 /// <param name="pid">The bot's attached pid</param>
 /// <returns>The drawing screen</returns>
 protected Utils fetchScreen(uint pid)
 {
     return(DrawAbleScreenFetcher.fetch(pid));
 }