Beispiel #1
0
 public override void action(WindowDetection.Structure ws)
 {
     if (isBuyingActive)
     {
         //TODO
     }
     Expectation.current = new ChoosingScreenExpectation();
 }
Beispiel #2
0
        public static void randomizeClickInArea(WindowDetection.Structure ws, PositionScope scope)
        {
            int basePixelX = (int)(scope.from.x * ws.currentFrame.Width);
                int diffAmountX = (int)((scope.to.x - scope.from.x) * ws.currentFrame.Width);

                int basePixelY = (int)(scope.from.y * ws.currentFrame.Height);
                int diffAmountY = (int)((scope.to.y - scope.from.y) * ws.currentFrame.Height);

                Random r = new Random();
                Point p = new Point((int)(diffAmountX * r.NextDouble()) + basePixelX,
                    (int)(diffAmountY * r.NextDouble()) + basePixelY);

                simulateClick(ws, p, true);
        }
Beispiel #3
0
        public override void action(WindowDetection.Structure ws)
        {
            MouseInterface.PositionScope startButton = new MouseInterface.PositionScope();

            startButton.from.x = 0.71442f;
            startButton.from.y = 0.65831f;

            startButton.to.x = 0.85485f;
            startButton.to.y = 0.73668f;

            MouseInterface.randomizeClickInArea(ws, startButton);

            Expectation.current = new RunEndedExpectation();
        }
Beispiel #4
0
 public static void simulateClick(WindowDetection.Structure ws, Point position)
 {
     simulateClick(ws, position, false);
 }
Beispiel #5
0
        private static Point prepareClickPoint(WindowDetection.Structure ws, Point position, bool exact)
        {
            int clickPositionX = position.X;
                int clickPositionY = position.Y;

                if (!exact)
                {
                    Random r = new Random();
                    clickPositionX += (int)(r.NextDouble() * 20);
                    clickPositionY += (int)(r.NextDouble() * 10);
                }
                return new Point(clickPositionX, clickPositionY);
        }
Beispiel #6
0
        public static void simulateClickMechanically(WindowDetection.Structure ws, Point position, bool exact)
        {
            IntPtr previousTopWindow = WindowDetection.GetForegroundWindow();
                WindowDetection.SetForegroundWindow(ws.mainWindow);
                WindowDetection.SetFocus(ws.mainWindow);
                System.Threading.Thread.Sleep(25);

                POINT p = new POINT();
                GetCursorPos(out p);

                position.X += ws.position.Left;
                position.Y += ws.position.Top;

                Point clickPos = prepareClickPoint(ws, position, exact);

                SetCursorPos(clickPos.X, clickPos.Y);
                System.Threading.Thread.Sleep(1);

                mouse_event(MouseEventFlags.MOUSEEVENTF_LEFTDOWN, (uint)clickPos.X, (uint)clickPos.Y, (uint)0, UIntPtr.Zero);
                mouse_event(MouseEventFlags.MOUSEEVENTF_LEFTUP, (uint)clickPos.X, (uint)clickPos.Y, 0, UIntPtr.Zero);

                SetCursorPos(p.X, p.Y);

                WindowDetection.SetForegroundWindow(previousTopWindow);
                WindowDetection.SetFocus(previousTopWindow);
        }
Beispiel #7
0
        public static void simulateClick(WindowDetection.Structure ws, Point position, bool exactFlag)
        {
            Point clickPoint = prepareClickPoint(ws, position, exactFlag);

                IntPtr captureWindow = SetCapture(ws.contentWindow);
                WindowDetection.PostMessage(ws.contentWindow, WM_LBUTTONDOWN, IntPtr.Add(IntPtr.Zero, 1), makeLParam(clickPoint));
                WindowDetection.PostMessage(ws.contentWindow, WM_LBUTTONUP, IntPtr.Zero, makeLParam(clickPoint));
                ReleaseCapture();
                SetCapture(captureWindow);
        }
Beispiel #8
0
 public CycleState(WindowDetection.Structure ws)
 {
     this.ws = ws;
     Expectation.current = new ChoosingScreenExpectation();
 }
Beispiel #9
0
 public override void action(WindowDetection.Structure ws)
 {
     switch (expectationMet)
     {
         case DYING_SCREEN_FLAG:
             dyingExpectation.action(ws);
             Expectation.current = new LevelingScreenExpectation(true);
             break;
         case SUCCESS_SCREEN_FLAG:
             successExpectation.action(ws);
             break;
     }
 }
Beispiel #10
0
        public override void action(WindowDetection.Structure ws)
        {
            //Click in the middle of the window, twice
            MouseInterface.PositionScope ps = new MouseInterface.PositionScope();
            ps.from.x = ps.from.y = 0.45f;
            ps.to.x = ps.from.y = 0.55f;

            MouseInterface.randomizeClickInArea(ws, ps);

            Random r = new Random();
            int timeout = (int)1000 + (int)(r.NextDouble() * 400);
            System.Threading.Thread.Sleep(timeout);

            if (!runFailedFlag)
            {
                MouseInterface.randomizeClickInArea(ws, ps);
                timeout = (int)1000 + (int)(r.NextDouble() * 200);
                System.Threading.Thread.Sleep(timeout);
                Expectation.current = new DropScreenExpectation();
            }
            else
            {
                Expectation.current = new DecisionExpectation();
            }
        }
Beispiel #11
0
 public virtual void action(WindowDetection.Structure ws)
 {
 }
Beispiel #12
0
        public override void action(WindowDetection.Structure ws)
        {
            MouseInterface.PositionScope ps = new MouseInterface.PositionScope();
            ps.from.x = 0.56641f;
            ps.to.x = 0.659375f;

            ps.from.y = 0.61458f;
            ps.to.y = 0.68f;

            MouseInterface.randomizeClickInArea(ws, ps);

            Expectation.current = new LevelingScreenExpectation(true);
        }
Beispiel #13
0
        public override void action(WindowDetection.Structure ws)
        {
            MouseInterface.PositionScope ps = new MouseInterface.PositionScope();
            ps.from.y = 0.72901f;
            ps.to.y = 0.78056f;

            switch (buttonAmount)
            {
                case COLLECTABLE_DROP:
                    ps.from.x = 0.415929f;
                    ps.to.x = 0.50885f;
                    break;
                case SELLABLE_DROP:
                    ps.from.x = 0.323009f;
                    ps.to.x = 0.43363f;
                    break;
            }

            MouseInterface.randomizeClickInArea(ws, ps);

            //Give it time to sell
            System.Threading.Thread.Sleep(2000);

            Expectation.current = new DecisionExpectation();
        }
Beispiel #14
0
        public override void action(WindowDetection.Structure ws)
        {
            MouseInterface.PositionScope replayButton = new MouseInterface.PositionScope();
            replayButton.from.x = 0.20102f;
            replayButton.from.y = 0.505698f;

            replayButton.to.x = 0.3524f;
            replayButton.to.y = 0.56267f;

            MouseInterface.randomizeClickInArea(ws, replayButton);
            System.Threading.Thread.Sleep(500);

            Expectation.current = new BuyEnergyExpectation();
        }