Esempio n. 1
0
 def sellout():
     """Navigate to sellout shop."""
     if Navigation.current_menu == 'sellout':
         return
     Inputs.click(*coords.SELLOUT)
     time.sleep(userset.SHORT_SLEEP)
     Navigation.current_menu = "sellout"
Esempio n. 2
0
 def info():
     """Click info 'n stuff."""
     if Navigation.current_menu == 'info':
         return
     Inputs.click(*coords.INFO)
     time.sleep(userset.SHORT_SLEEP)
     Navigation.current_menu = 'info'
Esempio n. 3
0
 def challenges() -> None:
     if Navigation.current_menu == 'challenges':
         return
     Navigation.rebirth()
     Inputs.click(*coords.CHALLENGE_BUTTON)
     time.sleep(userset.SHORT_SLEEP)
     Navigation.current_menu == 'challenges'
Esempio n. 4
0
    def run_challenge(challenge: int, cont: bool = False) -> None:
        """Run the selected challenge.
        
        Keyword arguments
        challenge -- The index of the challenge, starting at 1 for Basic challenge,
                     ending at 11 for No TM challenge
        cont      -- Whether the challenge is already running.
        """
        global ChList
        Navigation.challenges()

        if cont: pass
        else:
            x = coords.CHALLENGE.x
            y = coords.CHALLENGE.y + challenge * coords.CHALLENGEOFFSET
            Inputs.click(x, y)
            time.sleep(userset.LONG_SLEEP)
            Navigation.confirm()

        chall = ChList[challenge - 1]
        print(f"Starting {chall.name} Challenge script.")
        for x in chall.extra:
            if callable(x): print(x())
            else: print(x)
        chall.script()
Esempio n. 5
0
 def exp():
     """Navigate to EXP Menu."""
     if Navigation.current_menu == 'exp':
         return
     Inputs.click(*coords.XP_MENU)
     time.sleep(userset.SHORT_SLEEP)
     Navigation.current_menu = 'exp'
Esempio n. 6
0
 def rebirth():
     """Click rebirth menu."""
     if Navigation.current_menu == 'rebirth':
         return
     Inputs.click(*coords.REBIRTH)
     time.sleep(userset.SHORT_SLEEP)
     Navigation.current_menu = 'rebirth'
Esempio n. 7
0
 def perks():
     """Navigate to Perks screen."""
     if Navigation.current_menu == 'perks':
         return
     Navigation.menu('adventure')
     Inputs.click(*coords.ITOPOD_PERKS)
     time.sleep(userset.SHORT_SLEEP)
     Navigation.current_menu = 'perks'
Esempio n. 8
0
 def misc():
     """Navigate to Misc stats."""
     if Navigation.current_menu == 'misc':
         return
     Navigation.info()
     Inputs.click(*coords.MISC)
     time.sleep(userset.SHORT_SLEEP)
     Navigation.current_menu = 'misc'
Esempio n. 9
0
 def spells():
     """Navigate to the spells menu within the magic menu."""
     if Navigation.current_menu == 'spells':
         return
     Navigation.menu('bloodmagic')
     Inputs.click(*coords.BM_SPELL)
     time.sleep(userset.SHORT_SLEEP)
     Navigation.current_menu = 'spells'
Esempio n. 10
0
 def exp_rich():
     """Navigate to the misc menu within the EXP menu."""
     if Navigation.current_menu == "exp_rich":
         return
     Navigation.exp()
     Inputs.click(*coords.RICH_MENU)
     time.sleep(userset.SHORT_SLEEP)
     Navigation.current_menu = "exp_rich"
Esempio n. 11
0
 def menu(target):
     """Navigate through main menu."""
     target = target.lower()
     if Navigation.current_menu == target:
         return
     Inputs.click(*Navigation.menus[target])
     time.sleep(userset.LONG_SLEEP)
     Navigation.current_menu = target
Esempio n. 12
0
 def exp_magic():
     """Navigate to the magic menu within the EXP menu."""
     if Navigation.current_menu == 'exp_magic':
         return
     Navigation.exp()
     Inputs.click(*coords.MAGIC_MENU)
     time.sleep(userset.SHORT_SLEEP)
     Navigation.current_menu = 'exp_magic'
Esempio n. 13
0
 def exp_adventure():
     """Navigate to the adventure menu within the EXP menu."""
     if Navigation.current_menu == "exp_adventure":
         return
     Navigation.exp()
     Inputs.click(*coords.ADVENTURE_MENU)
     time.sleep(userset.SHORT_SLEEP)
     Navigation.current_menu = "exp_adventure"
Esempio n. 14
0
 def ngu_magic():
     """Navigate to NGU magic."""
     if Navigation.current_menu == 'ngu_magic':
         return
     Navigation.menu('ngu')
     Inputs.click(*coords.NGU_MAGIC)
     time.sleep(userset.SHORT_SLEEP)
     Navigation.current_menu = 'ngu_magic'
Esempio n. 15
0
 def stat_breakdown():
     """Navigate to stat breakdown."""
     if Navigation.current_menu == 'stat_breakdown':
         return
     Navigation.misc()
     Inputs.click(*coords.STAT_BREAKDOWN)
     time.sleep(userset.SHORT_SLEEP)
     Navigation.current_menu = 'stat_breakdown'
Esempio n. 16
0
 def sellout_boost_2():
     """Navigate to Boost 2 menu within the sellout shop."""
     if Navigation.current_menu == 'boost_2':
         return
     Navigation.sellout()
     Inputs.click(*coords.SELLOUT_BOOST_2)
     time.sleep(userset.SHORT_SLEEP)
     Navigation.current_menu = "boost_2"
Esempio n. 17
0
 def exp_hack():
     """Navigate to the hacks menu within the EXP menu."""
     if Navigation.current_menu == "exp_hack":
         return
     Navigation.exp()
     Inputs.click(*coords.EXP_HACK_MENU)
     time.sleep(userset.SHORT_SLEEP)
     Navigation.current_menu = "exp_hack"
Esempio n. 18
0
    def buy(self):
        """Buy upgrades for both attack and defense

        Requires the confirmation popup button for EXP purchases in settings
        to be turned OFF.

        This uses all available exp, so use with caution.
        """
        Stats.set_value_with_ocr("XP")

        if Stats.OCR_failed:
            print('OCR failed, exiting upgrade routine.')
            return

        current_exp = Stats.xp

        if current_exp < 1000:
            return

        total_price = (coords.RATTACK_COST * self.attack)
        total_price += (coords.RDEFENSE_COST * self.defense)

        # Skip upgrading if we don't have enough exp to buy at least one
        # complete set of upgrades, in order to maintain our perfect ratios :)

        if total_price > current_exp:
            if self.report:
                print("No XP Upgrade :{:^8} of {:^8}".format(
                    Helper.human_format(current_exp),
                    Helper.human_format(total_price)))
            return

        amount = int(current_exp // total_price)

        a_attack = amount * self.attack
        a_defense = amount * self.defense

        Navigation.exp_rich()

        Inputs.click(*coords.EM_ADV_BOX)
        Inputs.send_string(str(a_attack))
        time.sleep(userset.MEDIUM_SLEEP)

        Inputs.click(*coords.EM_ADV_BOX)
        Inputs.send_string(str(a_defense))
        time.sleep(userset.MEDIUM_SLEEP)

        Inputs.click(*coords.EM_ADV_BOX)
        Inputs.click(*coords.EM_ADV_BOX)

        Stats.set_value_with_ocr("XP")

        total_spent = coords.RATTACK_COST * a_attack
        total_spent += coords.RDEFENSE_COST * a_defense

        if self.report:
            print("Spent XP:{:^8}{:^3}Attack:{:^8}{:^3}Defense:{:^8}".format(
                Helper.human_format(total_spent), "|",
                Helper.human_format(a_attack), "|",
                Helper.human_format(a_defense)))
Esempio n. 19
0
    def get24boss():
        try:
            x = coords.CHALLENGE.x
            y = coords.CHALLENGE.y + 3 * coords.CHALLENGEOFFSET

            Navigation.challenges()
            Inputs.click(x, y, button="right")
            time.sleep(userset.LONG_SLEEP)
            target = Inputs.ocr(*coords.OCR_CHALLENGE_24HC_TARGET)
            target = Inputs.get_numbers(target)[0]
            return f"Target boss: {target}"
        except ValueError:
            Discord.send_message("Couldn't detect the target level of 24HC",
                                 Discord.ERROR)
            return "Couldn't detect the target level of 24HC"
Esempio n. 20
0
    def init(printCoords: bool = False) -> None:
        """Initialize Window class variables.
        Helper.init() should go at the very top of any script, straight after imports.
        """
        rect = Window.init()
        w = rect[2] - rect[0]
        h = rect[3] - rect[1]

        cds = Inputs.pixel_search(coords.TOP_LEFT_COLOR, 0, 0, w, h)
        if cds is None:
            raise RuntimeError("Game window not found. Maybe it's minimized?")
        Window.setPos(*cds)

        # Sometimes the very first click is ignored, this makes sure the first click is unimportant.
        Inputs.click(*coords.WASTE_CLICK)

        if printCoords: print(f"Top left found at: {Window.x}, {Window.y}")
Esempio n. 21
0
 def loop() -> None:
     while len(Glop.reagents["glop.png"]) < Glop.target:
         Navigation.menu("inventory")
         # Find the glop reagent we have the fewest of
         target = min(Glop.reagents,
                      key=lambda x: len(Glop.reagents[x])
                      if x != "glop.png" else float('Inf'))
         for reagent in Glop.reagents[target]:
             Inputs.click(*coords.INVENTORY_PAGE[reagent.page])
             Inputs.click(reagent.x, reagent.y, button="right")
             Inputs.ctrl_click(reagent.x, reagent.y)
         print(f"converted {len(Glop.reagents[target])} glops")
         Adventure.snipe(Glop.GLOP_ZONE_MAP[target], 2)
         Glop.update_inventory()
     elapsed = round(time.time() - Glop.start)
     print(
         f"Finished collecting {Glop.target} glops in {datetime.timedelta(seconds=elapsed)}"
     )
Esempio n. 22
0
    def init(printCoords: bool = False) -> None:
        """Initialize Window class variables.
        Helper.init() should go at the very top of any script, straight after imports.
        """
        rects = Window.init()
        for window_id, rect in rects.items():
            if printCoords: print(f"Scanning window id: {window_id}")
            w = rect[2] - rect[0]
            h = rect[3] - rect[1]
            Window.id = window_id
            cds = Inputs.pixel_search(coords.TOP_LEFT_COLOR, 0, 0, w, h)
            if cds:
                Window.setPos(*cds)
                break
        if cds is None:
            raise RuntimeError(
                "Game window not found. Maybe it's minimized or the game is not fully visible?"
            )
        # Sometimes the very first click is ignored, this makes sure the first click is unimportant.
        Inputs.click(*coords.WASTE_CLICK)

        if printCoords: print(f"Top left found at: {Window.x}, {Window.y}")
Esempio n. 23
0
    def update_inventory() -> None:
        """Scan all inventory pages for glop related items."""
        Navigation.menu("inventory")
        for item in coords.GLOP_FILENAMES:
            Glop.reagents[item] = []

        for page in range(Glop.inv_pages_unlocked):
            Inputs.click(*coords.INVENTORY_PAGE[page])
            time.sleep(userset.LONG_SLEEP)
            bmp = Inputs.get_bitmap()

            for item in coords.GLOP_FILENAMES:
                path = Inputs.get_file_path("images", item)
                # Using the whole window instead of cropping out just the inventory yields higher accuracy
                rect = (Window.x, Window.y, Window.x + 960, Window.y + 600)
                res = Inputs.find_all(*rect, path, threshold=0.9, bmp=bmp)
                reagents = list(
                    map(lambda x: Reagent(x[0], x[1], item, page), res))
                if reagents: Glop.reagents[item].extend(reagents)

        print("\nScan found these glop reagents\n")
        for item in coords.GLOP_FILENAMES:
            print(f"{item}: {len(Glop.reagents[item])}")
Esempio n. 24
0
 def add_emr(self, wish, emr):
     """Add EMR to wish."""
     alloc_coords = [
         coords.WISH_E_ADD, coords.WISH_M_ADD, coords.WISH_R_ADD
     ]
     Navigation.menu("wishes")
     page = ((wish.id - 1) // 21)
     Inputs.click(*coords.WISH_PAGE[page])
     x = coords.WISH_SELECTION.x + (
         (wish.id - 1) % 21 % 7) * coords.WISH_SELECTION_OFFSET.x
     y = coords.WISH_SELECTION.y + (
         (wish.id - 1) % 21 // 7) * coords.WISH_SELECTION_OFFSET.y
     # have to add to add some offset here, otherwise the clicks don't register for some reason.
     Inputs.click(x + 20, y + 20)
     for i, e in enumerate(emr):
         Navigation.input_box()
         Inputs.send_string(e)
         Inputs.click(*alloc_coords[i])
Esempio n. 25
0
    def get_breakdowns(self):
        """Go to stat breakdowns and fetch the necessary stats."""
        Navigation.stat_breakdown()
        Inputs.click(*coords.BREAKDOWN_E)
        time.sleep(userset.MEDIUM_SLEEP)
        print("OCR is scanning a large area, this might take a few seconds")
        e_list = self.fix_text(Inputs.ocr(*coords.OCR_BREAKDOWN))
        Inputs.click(*coords.BREAKDOWN_M)
        time.sleep(userset.MEDIUM_SLEEP)
        m_list = self.fix_text(Inputs.ocr(*coords.OCR_BREAKDOWN))
        Inputs.click(*coords.BREAKDOWN_R)
        time.sleep(userset.MEDIUM_SLEEP)
        r_list = self.fix_text(Inputs.ocr(*coords.OCR_BREAKDOWN))
        Inputs.click(*coords.BREAKDOWN_MISC)
        time.sleep(userset.MEDIUM_SLEEP)
        Inputs.click_drag(*coords.BREAKDOWN_MISC_SCROLL_DRAG_START,
                          *coords.BREAKDOWN_MISC_SCROLL_DRAG_END)
        misc_list = self.fix_text(Inputs.ocr(*coords.OCR_BREAKDOWN))

        fields = [
            "total energy power:", "total magic power:", "total r power:",
            "total wish speed:"
        ]

        try:
            for e in e_list:
                if e[0].lower() in fields:
                    self.epow = float(e[1])
        except ValueError:
            print("couldn't fetch energy power")
            self.epow = 1
        try:
            for e in m_list:
                if e[0].lower() in fields:
                    self.mpow = float(e[1])
        except ValueError:
            print("couldn't fetch magic power")
            self.mpow = 1

        try:
            for e in r_list:
                if e[0].lower() in fields:
                    self.rpow = float(e[1])
        except ValueError:
            print("couldn't fetch R3 power")
            self.rpow = 1
        try:
            for e in misc_list:
                if e[0].lower() in fields:
                    self.wish_speed = int(e[1]) / 100

        except ValueError:
            print("Couldn't fetch wish speed, defaulting to 100%")
            self.wish_speed = 1

        if not self.wish_speed:
            print("Couldn't get wish speed")
            self.wish_speed = 1
        if not self.epow:
            print("Couldn't get epow")
            self.epow = 1
        if not self.mpow:
            print("Couldn't get mpow")
            self.mpow = 1
        if not self.rpow:
            print("Couldn't get rpow")
            self.rpow = 1

        self.get_caps()
Esempio n. 26
0
    def get_wish_status(self):
        """Check which wishes are done and which are level 1 or higher."""
        Navigation.menu("wishes")
        self.wishes_completed = []  # completed wishes
        self.wishes_in_progress = []  # wishes above level 0
        self.wishes_active = []  # wishes that currently are progressing
        Inputs.click(
            *coords.WISH_PAGE[1]
        )  # go to page 2 and select the first wish to get rid of the green border
        time.sleep(userset.MEDIUM_SLEEP)
        Inputs.click(*coords.WISH_PORTRAIT)
        time.sleep(userset.MEDIUM_SLEEP)
        Inputs.click(*coords.WISH_PAGE[0])

        for i, page in enumerate(coords.WISH_PAGE):
            Inputs.click(*page)
            for y in range(3):
                for x in range(7):
                    border_color = Inputs.get_pixel_color(
                        coords.WISH_BORDER.x + x * 92,
                        coords.WISH_BORDER.y + y * 106)
                    if border_color == coords.COLOR_WISH_COMPLETED:
                        self.wishes_completed.append(1 + x + y + y * 6 +
                                                     i * 21)

                    if border_color == coords.COLOR_WISH_STARTED:
                        self.wishes_in_progress.append(1 + x + y + y * 6 +
                                                       i * 21)

                    active_color = Inputs.get_pixel_color(
                        coords.WISH_SELECTION.x + x * 92,
                        coords.WISH_SELECTION.y + y * 106)
                    if active_color == coords.COLOR_WISH_ACTIVE:
                        self.wishes_active.append(1 + x + y + y * 6 + i * 21)
                    if active_color == coords.COLOR_WISH_INACTIVE:
                        Inputs.click(coords.WISH_SELECTION.x + x * 92,
                                     coords.WISH_SELECTION.y + y * 106)
                        Inputs.click(*coords.WISH_CLEAR_WISH)
                        self.wishes_in_progress.append(1 + x + y + y * 6 +
                                                       i * 21)

            if i == 0:  # after page 1 is scanned, select first wish
                Inputs.click(*coords.WISH_PORTRAIT)
        used_slots = len(self.wishes_active)
        self.available_slots = self.wish_slots - used_slots
        if used_slots > 0:
            print(
                f"{used_slots} wish slots are already in use and will be ignored."
            )
Esempio n. 27
0
# Helper classes
from classes.inputs import Inputs

import coordinates as coords
from time import sleep

i = Inputs()

#sets everything to the proper requirements to run the script

i.click(*coords.GAME_SETTINGS)
i.click(*coords.TO_SCIENTIFIC)
i.click(*coords.CHECK_FOR_UPDATE_OFF)
i.click(*coords.FANCY_TITAN_HP_BAR_OFF)
i.click(*coords.DISABLE_HIGHSCORE)
i.click(*coords.SETTINGS_PAGE_2)
i.click(*coords.SIMPLE_INVENTORY_SHORTCUT_ON)
Esempio n. 28
0
import coordinates as coords

Helper.init(True)
Helper.requirements()

parser = argparse.ArgumentParser()
parser.add_argument("-z",
                    "--zone",
                    required=True,
                    type=int,
                    help="select which zone you wish to snipe")
args = parser.parse_args()

Adventure.adventure(0)
if Inputs.check_pixel_color(*coords.IS_IDLE):
    Inputs.click(*coords.ABILITY_IDLE_MODE)
time.sleep(userset.MEDIUM_SLEEP)

while True:  # main loop
    GoldDiggers.diggers([4, 1])

    if Inputs.check_pixel_color(*coords.COLOR_MEGA_BUFF_READY):
        Adventure.snipe(args.zone, 1, manual=True, bosses=True, once=True)
        Adventure.adventure(0)  # go wait at safe zone
        if Inputs.check_pixel_color(*coords.IS_IDLE):
            Inputs.click(*coords.ABILITY_IDLE_MODE)
            Inputs.click(*coords.WASTE_CLICK)

    else:
        MoneyPit.pit()
        MoneyPit.spin()
Esempio n. 29
0
 def input_box():
     """Click input box."""
     Inputs.click(*coords.NUMBER_INPUT_BOX)
     time.sleep(userset.SHORT_SLEEP)
Esempio n. 30
0
 def confirm():
     """Click yes in confirm window."""
     Inputs.click(*coords.CONFIRM)
     time.sleep(userset.SHORT_SLEEP)