private void preventIdle() { //Move to main screen center Point centerPoint = new Point(MAIN_SCREEN_WIDTH / 2, MAIN_SCREEN_HEIGHT / 2); MouseSimulator.LeftClick(centerPoint); if (sleep(SECONDS_ONE)) { MouseSimulator.MoveTo(centerPoint.X, (centerPoint.Y - 1)); } if (sleep(SECONDS_ONE)) { MouseSimulator.MoveTo(centerPoint); } sleep(SECONDS_TEN); }
//TODO: Refactor it ... private void buyGoodsOnChair(Point point1, Point point2, Point point3, Point point4, Point point5) { //State update ... mRepeatTimes--; mLastDoTime = Time.getUnixTimestamp(); if (sleep(SECONDS_THREE)) { //Be a CEO and Open the Web. KeyboardSimulator.click(KeyScanCode.ENTER, KeyId.ENTER); } //Web operate if (sleep(SECONDS_FIVE)) { MouseSimulator.LeftClick(point1); } if (sleep(SECONDS_THREE)) { MouseSimulator.LeftClick(point2); } if (sleep(SECONDS_THREE)) { MouseSimulator.LeftClick(point3); } if (sleep(SECONDS_THREE)) { MouseSimulator.LeftClick(point4); } //Close Web if (sleep(SECONDS_THREE)) { KeyboardSimulator.click(KeyScanCode.ESC, KeyId.ESC); } if (sleep(SECONDS_THREE)) { KeyboardSimulator.click(KeyScanCode.ESC, KeyId.ESC); } //Close CEO if (sleep(SECONDS_THREE)) { KeyboardSimulator.click(KeyScanCode.M, KeyId.M); } if (sleep(SECONDS_THREE)) { KeyboardSimulator.click(KeyScanCode.ENTER, KeyId.ENTER); } if (sleep(SECONDS_THREE)) { MouseSimulator.LeftClick(point5); } if (sleep(SECONDS_THREE)) { KeyboardSimulator.click(KeyScanCode.ENTER, KeyId.ENTER); } sleep(SECONDS_FIVE); }