Ejemplo n.º 1
0
    def run(self):
        """
        Starts the fishing
        code explained in comments in detail
        """
        fishing_event.init()
        self.fishPixWindow = WindowClient(color=cv2.COLOR_RGB2HSV)

        # check for game window and stuff
        self.gui.bot_started(True)

        if self.get_gui:
            logging.info(
                "Starting the bot engine, look at the fishing hole to start fishing"
            )
            Thread(target=self._wait_and_check).start()

        while self.start and WindowClient.running():
            capture = self.fishPixWindow.get_capture()

            if capture is None:
                # if window server crashed
                self.gui.bot_started(False)
                self.toggle_start()
                continue

            self.fishPixWindow.crop = PixelLoc.val
            fishing_mode.loop(capture[0][0])

        logging.info("Fishing engine stopped")
        self.gui.bot_started(False)
        fishing_event.unsubscribe()
        self.fishPixWindow.destory()
Ejemplo n.º 2
0
    def _start_route(self):
        timeline = _get_rec_file()
        if not timeline:
            logging.log("data not found, can't start")
            return

        FullAuto.state = State.PLAYING
        logging.info("starting to move")

        forward = True
        i = 0
        while self.start_moving_flag:
            action = timeline[i]

            if action[0] == "move_to":
                self.engine.move_to(action[1])
            elif action[0] == "check_fish":
                self.engine.move_to(action[1])
                self.engine.rotate_to(action[1][2])
                fishing_event.subscribe()
                fishing_mode.subscribers.append(self._hole_complete_callback)
                # scan for fish hole
                logging.info("scanning")
                if self.engine.look_for_hole():
                    logging.info("starting fishing")
                    self.hole_complete_flag = False
                    helper.wait_until(lambda: self.hole_complete_flag or
                                      not self.start_moving_flag)
                    self.engine.rotate_back()
                else:
                    logging.info("no hole found")
                # if found start fishing and wait for hole to complete
                # contine when hole completes
                fishing_event.unsubscribe()
                fishing_mode.subscribers.remove(self._hole_complete_callback)

            i += 1 if forward else -1
            if i >= len(timeline):
                forward = False
                i = len(timeline) - 1
            elif i < 0:
                forward = True
                i = 0

        logging.info("stopped")
        FullAuto.state = State.NONE
Ejemplo n.º 3
0
    def run(self):

        addons_req = [libgps, lam2, fishyqr]
        for addon in addons_req:
            if not helper.addon_exists(*addon):
                helper.install_addon(*addon)

        FullAuto.state = State.NONE

        self.gui.bot_started(True)
        self.window = WindowClient(color=cv2.COLOR_RGB2GRAY, show_name="Full auto debug")

        try:
            self.window.crop = get_qr_location(self.window.get_capture())
            if self.window.crop is None:
                logging.warning("FishyQR not found")
                self.start = False
                raise Exception("FishyQR not found")

            if not self.calibrator.all_callibrated():
                logging.error("you need to calibrate first")

            self.fisher.toggle_start()
            fishing_event.unsubscribe()

            self.controls.initialize()
            while self.start and WindowClient.running():
                if self.show_crop:
                    self.window.show(self.show_crop, func=image_pre_process)
                else:
                    time.sleep(0.1)
        except:
            traceback.print_exc()

            if self.window.get_capture() is None:
                logging.error("Game window not found")

        self.gui.bot_started(False)
        self.controls.unassign_keys()
        self.window.show(False)
        logging.info("Quitting")
        self.window.destory()
        self.fisher.toggle_start()
Ejemplo n.º 4
0
    def run(self):
        self.show_crop = False
        FullAuto.state = State.NONE

        self.gui.bot_started(True)
        fishing_event.unsubscribe()
        self.fisher.toggle_start()

        self.window = WindowClient(color=cv2.COLOR_RGB2GRAY, show_name="Full auto debug")

        try:
            if self.calibrate.crop is None:
                self.calibrate.update_crop(enable_crop=False)
            self.window.crop = self.calibrate.crop

            if not is_tesseract_installed():
                logging.info("tesseract not found")
                downlaoad_and_extract_tesseract()

            if not self.calibrate.all_callibrated():
                logging.error("you need to callibrate first")

            self.controls.initialize()
            while self.start and WindowClient.running():
                self.window.show(self.show_crop, func=image_pre_process)
                if not self.show_crop:
                    time.sleep(0.1)
        except:
            traceback.print_exc()

            if self.window.get_capture() is None:
                logging.error("Game window not found")

        self.gui.bot_started(False)
        self.controls.unassign_keys()
        self.window.show(False)
        logging.info("Quitting")
        self.window.destory()
        self.fisher.toggle_start()
Ejemplo n.º 5
0
    def run(self):
        """
        Starts the fishing
        code explained in comments in detail
        """
        if self.get_gui:
            logging.info(
                "Starting the bot engine, look at the fishing hole to start fishing"
            )
            Thread(target=self._wait_and_check).start()

        time.sleep(0.2)

        fishing_event.init()
        # noinspection PyBroadException
        try:
            self._engine_loop()
        except Exception:
            logging.error("exception occurred while running engine loop")
            print_exc()

        fishing_event.unsubscribe()
        self.first_loop_done = False