Esempio n. 1
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. 2
0
		Color must be supplied in hex.
		"""
		bmp = self.get_bitmap()
		width, height = bmp.size
		for y in range(y_start, y_end):
			for x in range(x_start, x_end):
				if y > height or x > width:
					continue
				t = bmp.getpixel((x, y))
				if (self.rgb_to_hex(t) == color):
					return x - 8, y - 8

		return None


'''
i.get_bitmap().save("herp.png")
locs = find_multi_image_search("herp.png", "images\\The Beardverse.png")
for x in locs:
	win32api.SetCursorPos((locs[x]["X"], locs[x]["Y"]))
	input("right place?")
'''

'''
x1 = 302
y1 = 446
x2 = 522
y2 = 465
for y in range(y1 - 1, y2 + 1):
	for x in range(x1 - 1, x2 + 1):
		pixel = get_pixel_color(x, y)