Ejemplo n.º 1
0
    def start(first_run: bool) -> int:
        """Starts the process to complete a run for Quest Farming Mode and returns the number of items detected.

        Args:
            first_run (bool): Flag that determines whether or not to run the navigation process again. Should be False if the Farming Mode supports the "Play Again" feature for repeated runs.

        Returns:
            (int): Number of items detected.
        """
        from bot.game import Game

        number_of_items_dropped: int = 0

        # Start the navigation process.
        if first_run:
            Quest._navigate()
        elif Game.find_and_click_button("play_again"):
            Game.check_for_popups()
        else:
            # If the bot cannot find the "Play Again" button, check for Pending Battles and then perform navigation again.
            Game.check_for_pending()
            Quest._navigate()

        # Check for AP.
        Game.check_for_ap()

        # Check if the bot is at the Summon Selection screen.
        if ImageUtils.confirm_location("select_a_summon", tries=30):
            summon_check = Game.select_summon(Settings.summon_list,
                                              Settings.summon_element_list)
            if summon_check:
                # Select the Party.
                Game.find_party_and_start_mission(Settings.group_number,
                                                  Settings.party_number)

                # Close the "Item Picked Up" popup.
                if ImageUtils.confirm_location("items_picked_up"):
                    Game.find_and_click_button("ok")

                # Now start Combat Mode and detect any item drops.
                if CombatMode.start_combat_mode():
                    number_of_items_dropped = Game.collect_loot(
                        is_completed=True)
        else:
            raise QuestException(
                "Failed to arrive at the Summon Selection screen.")

        return number_of_items_dropped
Ejemplo n.º 2
0
    def start(first_run: bool) -> int:
        """Starts the process to complete a run for Raid Farming Mode and returns the number of items detected.

        Args:
            first_run (bool): Flag that determines whether or not to run the navigation process again. Should be False if the Farming Mode supports the "Play Again" feature for repeated runs.

        Returns:
            (int): Number of items detected.
        """
        from bot.game import Game

        number_of_items_dropped: int = 0

        # Start the navigation process.
        if first_run:
            Raid._navigate()
        else:
            # Check for Pending Battles and then perform navigation again.
            Game.check_for_pending()
            Raid._navigate()

        # Check for EP.
        Game.check_for_ep()

        # Check if the bot is at the Summon Selection screen.
        if ImageUtils.confirm_location("select_a_summon", tries=30):
            summon_check = Game.select_summon(Settings.summon_list,
                                              Settings.summon_element_list)

            if summon_check:
                # Select the Party.
                if Game.find_party_and_start_mission(Settings.group_number,
                                                     Settings.party_number):
                    # Handle the rare case where joining the Raid after selecting the Summon and Party led the bot to the Quest Results screen with no loot to collect.
                    if ImageUtils.confirm_location("no_loot", tries=2):
                        MessageLog.print_message(
                            "\n[RAID] Seems that the Raid just ended. Moving back to the Home screen and joining another Raid..."
                        )
                    elif CombatMode.start_combat_mode():
                        number_of_items_dropped = Game.collect_loot(
                            is_completed=True)
                else:
                    MessageLog.print_message(
                        "\n[RAID] Seems that the Raid ended before the bot was able to join. Now looking for another Raid to join..."
                    )
        else:
            raise RaidException(
                "Failed to arrive at the Summon Selection screen.")

        return number_of_items_dropped
    def check_for_event_nightmare():
        """Checks for Event Nightmare and if it appears and the user enabled it in user settings, start it.

        Returns:
            (bool): Return True if Event Nightmare was detected and successfully completed. Otherwise, return False.
        """
        from bot.game import Game

        if Settings.enable_nightmare and ImageUtils.confirm_location(
                "limited_time_quests", tries=1):
            # First check if the Event Nightmare is skippable.
            event_claim_loot_location = ImageUtils.find_button(
                "event_claim_loot", tries=1, suppress_error=True)
            if event_claim_loot_location is not None:
                MessageLog.print_message(
                    "\n[EVENT] Skippable Event Nightmare detected. Claiming it now..."
                )
                MouseUtils.move_and_click_point(event_claim_loot_location[0],
                                                event_claim_loot_location[1],
                                                "event_claim_loot")
                Game.collect_loot(is_completed=False, is_event_nightmare=True)
                return True
            else:
                MessageLog.print_message(
                    "\n[EVENT] Detected Event Nightmare. Starting it now...")

                MessageLog.print_message(
                    "\n********************************************************************************"
                )
                MessageLog.print_message(
                    "********************************************************************************"
                )
                MessageLog.print_message(f"[EVENT] Event Nightmare")
                MessageLog.print_message(
                    f"[EVENT] Event Nightmare Summon Elements: {Settings.nightmare_summon_elements_list}"
                )
                MessageLog.print_message(
                    f"[EVENT] Event Nightmare Summons: {Settings.nightmare_summon_list}"
                )
                MessageLog.print_message(
                    f"[EVENT] Event Nightmare Group Number: {Settings.nightmare_group_number}"
                )
                MessageLog.print_message(
                    f"[EVENT] Event Nightmare Party Number: {Settings.nightmare_party_number}"
                )
                MessageLog.print_message(
                    f"[EVENT] Event Nightmare Combat Script: {Settings.nightmare_combat_script_name}"
                )
                MessageLog.print_message(
                    "********************************************************************************"
                )
                MessageLog.print_message(
                    "********************************************************************************\n"
                )

                # Click the "Play Next" button to head to the Summon Selection screen.
                Game.find_and_click_button("play_next")

                Game.wait(1)

                # Once the bot is at the Summon Selection screen, select your Summon and Party and start the mission.
                if ImageUtils.confirm_location("select_a_summon"):
                    Game.select_summon(Settings.nightmare_summon_list,
                                       Settings.nightmare_summon_elements_list)
                    start_check = Game.find_party_and_start_mission(
                        int(Settings.nightmare_group_number),
                        int(Settings.nightmare_party_number))

                    # Once preparations are completed, start Combat Mode.
                    if start_check and CombatMode.start_combat_mode(
                            is_nightmare=True):
                        Game.collect_loot(is_completed=False,
                                          is_event_nightmare=True)
                        return True

        elif not Settings.enable_nightmare and ImageUtils.confirm_location(
                "limited_time_quests", tries=1):
            # First check if the Event Nightmare is skippable.
            event_claim_loot_location = ImageUtils.find_button(
                "event_claim_loot", tries=1, suppress_error=True)
            if event_claim_loot_location is not None:
                MessageLog.print_message(
                    "\n[EVENT] Skippable Event Nightmare detected but user opted to not run it. Claiming it regardless..."
                )
                MouseUtils.move_and_click_point(event_claim_loot_location[0],
                                                event_claim_loot_location[1],
                                                "event_claim_loot")
                Game.collect_loot(is_completed=False, is_event_nightmare=True)
                return True
            else:
                MessageLog.print_message(
                    "\n[EVENT] Event Nightmare detected but user opted to not run it. Moving on..."
                )
                Game.find_and_click_button("close")
        else:
            MessageLog.print_message(
                "\n[EVENT] No Event Nightmare detected. Moving on...")

        return False
Ejemplo n.º 4
0
    def check_for_dimensional_halo():
        """Checks for Dimensional Halo and if it appears and the user enabled it in user settings, start it.

        Returns:
            (bool): Return True if Dimensional Halo was detected and successfully completed. Otherwise, return False.
        """
        from bot.game import Game

        if Settings.enable_nightmare and ImageUtils.confirm_location(
                "limited_time_quests", tries=1):
            MessageLog.print_message(
                "\n[D.HALO] Detected Dimensional Halo. Starting it now...")
            Special._dimensional_halo_amount += 1

            MessageLog.print_message(
                "\n********************************************************************************"
            )
            MessageLog.print_message(
                "********************************************************************************"
            )
            MessageLog.print_message(f"[D.HALO] Dimensional Halo")
            MessageLog.print_message(
                f"[D.HALO] Dimensional Halo Summon Elements: {Settings.nightmare_summon_elements_list}"
            )
            MessageLog.print_message(
                f"[D.HALO] Dimensional Halo Summons: {Settings.nightmare_summon_list}"
            )
            MessageLog.print_message(
                f"[D.HALO] Dimensional Halo Group Number: {Settings.nightmare_group_number}"
            )
            MessageLog.print_message(
                f"[D.HALO] Dimensional Halo Party Number: {Settings.nightmare_party_number}"
            )
            MessageLog.print_message(
                f"[D.HALO] Dimensional Halo Combat Script: {Settings.nightmare_combat_script_name}"
            )
            MessageLog.print_message(
                "********************************************************************************"
            )
            MessageLog.print_message(
                "********************************************************************************\n"
            )

            # Click the "Play Next" button to head to the Summon Selection screen.
            Game.find_and_click_button("play_next")

            Game.wait(1)

            # Once the bot is at the Summon Selection screen, select your Summon and Party and start the mission.
            if ImageUtils.confirm_location("select_a_summon"):
                Game.select_summon(Settings.nightmare_summon_list,
                                   Settings.nightmare_summon_elements_list)
                start_check = Game.find_party_and_start_mission(
                    int(Settings.nightmare_group_number),
                    int(Settings.nightmare_party_number))

                # Once preparations are completed, start Combat Mode.
                if start_check and CombatMode.start_combat_mode(
                        is_nightmare=True):
                    Game.collect_loot(is_completed=False,
                                      is_event_nightmare=True)
                    return True

        elif not Settings.enable_nightmare and ImageUtils.confirm_location(
                "limited_time_quests", tries=1):
            MessageLog.print_message(
                "\n[D.HALO] Dimensional Halo detected but user opted to not run it. Moving on..."
            )
            Game.find_and_click_button("close")
        else:
            MessageLog.print_message(
                "\n[D.HALO] No Dimensional Halo detected. Moving on...")

        return False
    def check_for_rotb_extreme_plus():
        """Checks for Extreme+ for Rise of the Beasts and if it appears and the user enabled it in user settings, start it.

        Returns:
            (bool): Return True if Extreme+ was detected and successfully completed. Otherwise, return False.
        """
        from bot.game import Game

        if Settings.enable_nightmare and ImageUtils.confirm_location(
                "rotb_extreme_plus", tries=1):
            MessageLog.print_message(
                "\n[ROTB] Detected Extreme+. Starting it now...")

            MessageLog.print_message(
                "\n********************************************************************************"
            )
            MessageLog.print_message(
                "********************************************************************************"
            )
            MessageLog.print_message(f"[ROTB] Rise of the Beasts Extreme+")
            MessageLog.print_message(
                f"[ROTB] Rise of the Beasts Extreme+ Summon Elements: {Settings.nightmare_summon_elements_list}"
            )
            MessageLog.print_message(
                f"[ROTB] Rise of the Beasts Extreme+ Summons: {Settings.nightmare_summon_list}"
            )
            MessageLog.print_message(
                f"[ROTB] Rise of the Beasts Extreme+ Group Number: {Settings.nightmare_group_number}"
            )
            MessageLog.print_message(
                f"[ROTB] Rise of the Beasts Extreme+ Party Number: {Settings.nightmare_party_number}"
            )
            MessageLog.print_message(
                f"[ROTB] Rise of the Beasts Extreme+ Combat Script: {Settings.nightmare_combat_script_name}"
            )
            MessageLog.print_message(
                "********************************************************************************"
            )
            MessageLog.print_message(
                "********************************************************************************\n"
            )

            # Click the "Play Next" button to head to the Summon Selection screen.
            Game.find_and_click_button("play_next")

            Game.wait(1)

            # Once the bot is at the Summon Selection screen, select your Summon and Party and start the mission.
            if ImageUtils.confirm_location("select_a_summon"):
                Game.select_summon(Settings.nightmare_summon_list,
                                   Settings.nightmare_summon_elements_list)
                start_check = Game.find_party_and_start_mission(
                    int(Settings.nightmare_group_number),
                    int(Settings.nightmare_party_number))

                # Once preparations are completed, start Combat mode.
                if start_check and CombatMode.start_combat_mode(
                        is_nightmare=True):
                    Game.collect_loot(is_completed=False,
                                      is_event_nightmare=True)
                    return True

        elif not Settings.enable_nightmare and ImageUtils.confirm_location(
                "rotb_extreme_plus", tries=2):
            MessageLog.print_message(
                "\n[ROTB] Rise of the Beasts Extreme+ detected but user opted to not run it. Moving on..."
            )
            Game.find_and_click_button("close")
        else:
            MessageLog.print_message(
                "\n[ROTB] No Rise of the Beasts Extreme+ detected. Moving on..."
            )

        return False
    def start(first_run: bool) -> int:
        """Starts the process to complete a run for Coop Farming Mode and returns the number of items detected.

        Args:
            first_run (bool): Flag that determines whether or not to run the navigation process again. Should be False if the Farming Mode supports the "Play Again" feature for repeated runs.

        Returns:
            (int): Number of items detected.
        """
        from bot.game import Game

        number_of_items_dropped: int = 0

        # Start the navigation process.
        if first_run:
            Coop._navigate()
        else:
            # Head back to the Coop Room.
            Game.find_and_click_button("coop_room")

            Game.wait(1)

            # Check for "Daily Missions" popup for Coop.
            if ImageUtils.confirm_location("coop_daily_missions", tries=1):
                Game.find_and_click_button("close")

            Game.wait(1)

            # Now that the bot is back at the Coop Room/Lobby, check if it closed due to time running out.
            if ImageUtils.confirm_location("coop_room_closed", tries=1):
                MessageLog.print_message(
                    "\n[COOP] Coop room has closed due to time running out.")
                return -1

            # Start the Coop Mission again.
            Game.find_and_click_button("coop_start")

            Game.wait(1)

        # Check for AP.
        Game.check_for_ap()

        # Check if the bot is at the Party Selection screen. Note that the bot is hosting solo so no support summon selection.
        if first_run and ImageUtils.confirm_location(
                "coop_without_support_summon", tries=30):
            # Select the Party.
            Game.find_party_and_start_mission(Settings.group_number,
                                              Settings.party_number)

            # Now click the "Start" button to start the Coop Mission.
            Game.find_and_click_button("coop_start")

            # Now start Combat Mode and detect any item drops.
            if CombatMode.start_combat_mode():
                number_of_items_dropped = Game.collect_loot(is_completed=True)
        elif first_run is False:
            MessageLog.print_message("\n[COOP] Starting Coop Mission again.")

            # Now start Combat Mode and detect any item drops.
            if CombatMode.start_combat_mode():
                number_of_items_dropped = Game.collect_loot(is_completed=True)
        else:
            raise CoopException(
                "Failed to arrive at the Summon Selection screen.")

        return number_of_items_dropped
    def start() -> int:
        """Starts the process of completing Arcarum expeditions.

        Returns:
            (int): Number of runs completed.
        """
        from bot.game import Game

        runs_completed = 0
        while runs_completed < Settings.item_amount_to_farm:
            Arcarum._navigate_to_map()

            while True:
                action = Arcarum._choose_action()
                MessageLog.print_message(
                    f"[ARCARUM] Action to take will be: {action}")

                if action == "Combat":
                    # Start Combat Mode.
                    if Game.find_party_and_start_mission(
                            Settings.group_number, Settings.party_number):
                        if ImageUtils.confirm_location("elemental_damage",
                                                       tries=1):
                            raise ArcarumException(
                                "Encountered an important mob for Arcarum and the selected party does not conform to the enemy's weakness. Perhaps you would like to do this battle yourself?"
                            )
                        elif ImageUtils.confirm_location("arcarum_restriction",
                                                         tries=1):
                            raise ArcarumException(
                                "Encountered a party restriction for Arcarum. Perhaps you would like to complete this section by yourself?"
                            )

                        if CombatMode.start_combat_mode():
                            Game.collect_loot(is_completed=False,
                                              skip_info=True)
                            Game.find_and_click_button("expedition")
                elif action == "Navigating":
                    # Move to the next available node.
                    Game.find_and_click_button("move")
                elif action == "Next Area":
                    # Either navigate to the next area or confirm the expedition's conclusion.
                    if Game.find_and_click_button("arcarum_next_stage"):
                        Game.find_and_click_button("ok")
                        MessageLog.print_message(
                            f"[ARCARUM] Moving to the next area...")
                    elif Game.find_and_click_button("arcarum_checkpoint"):
                        Game.find_and_click_button("arcarum")
                        MessageLog.print_message(
                            f"[ARCARUM] Expedition is complete.")
                        runs_completed += 1

                        Game.wait(1)
                        Game.check_for_skyscope()
                        break
                elif action == "Boss Detected":
                    MessageLog.print_message(
                        f"[ARCARUM] Boss has been detected. Stopping the bot.")
                    raise ArcarumException(
                        "Boss has been detected. Stopping the bot.")

                Game.wait(1)

        return runs_completed