Ejemplo n.º 1
0
 def init(target: int) -> None:
     """Counts available inventory pages."""
     Glop.start = time.time()
     Glop.target = target
     Navigation.menu("inventory")
     for btn in coords.INVENTORY_PAGE:
         res = Inputs.check_pixel_color(*btn, coords.COLOR_INVENTORY_BG)
         if not res:
             Glop.inv_pages_unlocked += 1
     Glop.update_inventory()
Ejemplo n.º 2
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."
            )
Ejemplo n.º 3
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])
Ejemplo n.º 4
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)}"
     )
Ejemplo n.º 5
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])}")
Ejemplo n.º 6
0

#    print("Going into Sleep till 30 mins up?")
#    print(str(f.rt_to_seconds()) + " < end")

    if rt > end:
        f.do_rebirth()
        time.sleep(1)
        rt = f.rt_to_seconds()
    return

w = Window()
i = Inputs()
nav = Navigation()
feature = Features()
#ngui = NGUI(nav)

Window.x, Window.y = i.pixel_search(coords.TOP_LEFT_COLOR, 0, 0, 400, 600)
nav.menu("inventory")

u = UpgradeEM(37500, 37500, 1, 1, 3)
r3unlocked = False

print(f"Top left found at: {w.x}, {w.y}")

tracker = Tracker(30)

while True:  # main loop
    speedrun(30, feature)
    tracker.progress()