Skip to content
This repository has been archived by the owner on Jun 11, 2024. It is now read-only.

Commit

Permalink
fix window closing bug
Browse files Browse the repository at this point in the history
one type of popup window (about purchasing dlcs) wasn't getting closed
bump version
release v0.1.3
  • Loading branch information
amamic1803 committed Jun 17, 2023
1 parent f24e0ff commit 73bc694
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 11 deletions.
2 changes: 1 addition & 1 deletion build.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def build(name, console, onefile, uac_admin, icon, files, folders):

def main():
name = "Autofish"
version = "0.1.2"
version = "0.1.3"

console = False
onefile = True
Expand Down
38 changes: 28 additions & 10 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ def checks(tip):
changes = True
while changes:
changes = False
for image in bot_data["images"]["pop_ups"]:
for image in bot_data["images"]["pop_ups"]["list"]:
inf = cv2.minMaxLoc(cv2.matchTemplate(cv2.cvtColor(np.array(ImageGrab.grab()), cv2.COLOR_RGB2GRAY), image, cv2.TM_SQDIFF))
if inf[0] <= 1000000:
mouse.move(inf[2][0], inf[2][1], absolute=True, duration=0)
Expand All @@ -153,6 +153,18 @@ def checks(tip):
ret_changes = True
time.sleep(2)
break
if changes:
continue
# buy
inf = cv2.minMaxLoc(cv2.matchTemplate(cv2.cvtColor(np.array(ImageGrab.grab()), cv2.COLOR_RGB2GRAY), bot_data["images"]["pop_ups"]["buy"][0], cv2.TM_SQDIFF))
if inf[0] <= 1_000_000:
inf2 = cv2.minMaxLoc(cv2.matchTemplate(cv2.cvtColor(np.array(ImageGrab.grab()), cv2.COLOR_RGB2GRAY), bot_data["images"]["pop_ups"]["buy"][1], cv2.TM_SQDIFF))
shape = np.shape(bot_data["images"]["pop_ups"]["buy"][1])
mouse.move(inf2[2][0] + shape[1] // 2, inf2[2][1] + shape[0] // 2, absolute=True, duration=0)
mouse.click(button="left")
changes = True
ret_changes = True
time.sleep(2)
return ret_changes
case "after_reel_in":
while True:
Expand Down Expand Up @@ -251,15 +263,21 @@ def load_data():
for j in ("", "_dark"):
bot_data["images"]["digits"].append(cv2.imread(resource_path(f"run_data\\images\\cv_templates\\digits\\{i}{j}.png"), cv2.IMREAD_GRAYSCALE))

bot_data["images"]["pop_ups"] = [
cv2.imread(resource_path(r"run_data/images/cv_templates/pop_ups/claim_green.png"), cv2.IMREAD_GRAYSCALE),
cv2.imread(resource_path(r"run_data/images/cv_templates/pop_ups/close_gray.png"), cv2.IMREAD_GRAYSCALE),
cv2.imread(resource_path(r"run_data/images/cv_templates/pop_ups/close_gray_2.png"), cv2.IMREAD_GRAYSCALE),
cv2.imread(resource_path(r"run_data/images/cv_templates/pop_ups/close_orange.png"), cv2.IMREAD_GRAYSCALE),
cv2.imread(resource_path("run_data/images/cv_templates/pop_ups/close_orange_2.png"), cv2.IMREAD_GRAYSCALE),
cv2.imread(resource_path(r"run_data/images/cv_templates/pop_ups/extend_orange.png"), cv2.IMREAD_GRAYSCALE),
cv2.imread(resource_path(r"run_data/images/cv_templates/pop_ups/ok_orange.png"), cv2.IMREAD_GRAYSCALE)
]
bot_data["images"]["pop_ups"] = {
"list": [
cv2.imread(resource_path(r"run_data/images/cv_templates/pop_ups/claim_green.png"), cv2.IMREAD_GRAYSCALE),
cv2.imread(resource_path(r"run_data/images/cv_templates/pop_ups/close_gray.png"), cv2.IMREAD_GRAYSCALE),
cv2.imread(resource_path(r"run_data/images/cv_templates/pop_ups/close_gray_2.png"), cv2.IMREAD_GRAYSCALE),
cv2.imread(resource_path(r"run_data/images/cv_templates/pop_ups/close_orange.png"), cv2.IMREAD_GRAYSCALE),
cv2.imread(resource_path("run_data/images/cv_templates/pop_ups/close_orange_2.png"), cv2.IMREAD_GRAYSCALE),
cv2.imread(resource_path(r"run_data/images/cv_templates/pop_ups/extend_orange.png"), cv2.IMREAD_GRAYSCALE),
cv2.imread(resource_path(r"run_data/images/cv_templates/pop_ups/ok_orange.png"), cv2.IMREAD_GRAYSCALE)
],
"buy": [
cv2.imread(resource_path(r"run_data/images/cv_templates/pop_ups/buy_orange.png"), cv2.IMREAD_GRAYSCALE),
cv2.imread(resource_path(r"run_data/images/cv_templates/pop_ups/x.png"), cv2.IMREAD_GRAYSCALE),
],
}

bot_data["images"]["caught_fish"] = {
"discard": cv2.imread(resource_path(r"run_data/images/cv_templates/caught_fish/discard_gray.png"), cv2.IMREAD_GRAYSCALE),
Expand Down
Binary file added run_data/images/cv_templates/pop_ups/buy_orange.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added run_data/images/cv_templates/pop_ups/x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 73bc694

Please sign in to comment.