Open invahak opened 11 months ago
Hi, thanks for bringing this up. I don't know why finding next morning button fails, but the part of the bot that deals with time warp is unfortunately pretty bad/almost non existant so it may have to do something with that. The intended behaviour for when the cage gets filled should be to try to time warp or to stop running bot (if time warp option wasn't enabled). If the bot continued to catch more fish after the cage keepnet/stringer was already full, then it is also a bug. If you do find out the reason it fails, feel free to fix and open pull request. π
After filling sodka, the bot includes a window "rewind time" and then on the button "next morning" does not click, if I forcefully click myself, the bot stops catching fish, apparently you made it so that after rewinding time was sent "true" and it was not sent, and the bot endlessly waiting).
I wrote my code that finds all these buttons, it rewinds the time, but your bot does not want to fish when the next day comes, I can not find the reason )
My code:
import pyautogui
import cv2
import time
import keyboard
import threading
from plyer import notification
# Π£ΡΡΠ°Π½ΠΎΠ²ΠΈ ΠΏΠΎΡΠΎΠ³ Π΄Π»Ρ ΠΎΠΏΡΠ΅Π΄Π΅Π»Π΅Π½ΠΈΡ ΡΠΎΠ²ΠΏΠ°Π΄Π΅Π½ΠΈΡ
threshold = 0.8
# ΠΠ°Π³ΡΡΠ·ΠΈ ΠΈΠ·ΠΎΠ±ΡΠ°ΠΆΠ΅Π½ΠΈΡ ΠΊΠ½ΠΎΠΏΠΎΠΊ
button_images = [
cv2.imread("zabrat.png"),
cv2.imread("zakrit_ispitanie.png"),
cv2.imread("lvlup1.png"),
cv2.imread("lvlup2.png"),
cv2.imread("buy.png"),
cv2.imread("time.png"),
cv2.imread("nezabrat.png"),
cv2.imread("time2.png")
]
# Π£ΠΊΠ°ΠΆΠΈ ΠΊΠΎΠΎΡΠ΄ΠΈΠ½Π°ΡΡ ΠΎΠ±Π»Π°ΡΡΠ΅ΠΉ ΠΏΠΎΠΈΡΠΊΠ° Π΄Π»Ρ ΠΊΠ°ΠΆΠ΄ΠΎΠΉ ΠΊΠ½ΠΎΠΏΠΊΠΈ
search_areas = [
((957, 907), (1236, 1000)),
((357, 730), (696, 837)),
((791, 864), (1127, 974)),
((510, 863), (844, 966)),
((690, 855), (955, 925)),
((788, 850), (1130, 930)),
((957, 907), (1236, 1000)),
((666, 795), (1080, 900))
]
while True:
for i, button_image in enumerate(button_images):
search_area_top_left, search_area_bottom_right = search_areas[i]
# Π‘Π½ΠΈΠΌΠΈ ΡΠΊΡΠΈΠ½ΡΠΎΡ ΡΠΊΠ°Π·Π°Π½Π½ΠΎΠΉ ΠΎΠ±Π»Π°ΡΡΠΈ ΡΠΊΡΠ°Π½Π°
screenshot = pyautogui.screenshot(region=(search_area_top_left[0], search_area_top_left[1],
search_area_bottom_right[0] - search_area_top_left[0],
search_area_bottom_right[1] - search_area_top_left[1]))
screenshot.save(f"screenshot{i}.png")
# ΠΠ°Π³ΡΡΠ·ΠΈ ΡΠΊΡΠΈΠ½ΡΠΎΡ
screenshot = cv2.imread(f"screenshot{i}.png")
# ΠΡΠΈ ΠΊΠ½ΠΎΠΏΠΊΡ Π½Π° ΡΠΊΡΠΈΠ½ΡΠΎΡΠ΅
result = cv2.matchTemplate(screenshot, button_image, cv2.TM_CCOEFF_NORMED)
_, max_val, _, max_loc = cv2.minMaxLoc(result)
if max_val >= threshold:
button_x, button_y = max_loc
button_center_x = button_x + int(button_image.shape[1] / 2)
button_center_y = button_y + int(button_image.shape[0] / 2)
print(f"ΠΠ½ΠΎΠΏΠΊΠ° {i+1} Π½Π°ΠΉΠ΄Π΅Π½Π°!")
if i == 4:
click_x = 1630
click_y = 82
elif i == 5:
click_x = button_center_x + search_area_top_left[0]
click_y = button_center_y + search_area_top_left[1]
pyautogui.click(click_x, click_y)
time.sleep(3) # ΠΠΎΠ΄ΠΎΠΆΠ΄Π°ΡΡ 3 ΡΠ΅ΠΊΡΠ½Π΄Ρ
click_x = 800
click_y = 660
elif i == 6:
click_x = button_center_x + search_area_top_left[0]
click_y = button_center_y + search_area_top_left[1]
else:
click_x = button_center_x + search_area_top_left[0]
click_y = button_center_y + search_area_top_left[1]
# ΠΡΠΏΠΎΠ»Π½ΠΈ ΠΊΠ»ΠΈΠΊ
pyautogui.click(click_x, click_y)
else:
print(f"ΠΠ½ΠΎΠΏΠΊΠ° {i+1} Π½Π΅ Π½Π°ΠΉΠ΄Π΅Π½Π°.")
time.sleep(5) # ΠΠΎΠ΄ΠΎΠΆΠ΄ΠΈ 5 ΡΠ΅ΠΊΡΠ½Π΄ ΠΏΠ΅ΡΠ΅Π΄ ΡΠ»Π΅Π΄ΡΡΡΠ΅ΠΉ ΠΈΡΠ΅ΡΠ°ΡΠΈΠ΅ΠΉ
After filling sodka, the bot includes a window "rewind time" and then on the button "next morning" does not click, if I forcefully click myself, the bot stops catching fish, apparently you made it so that after rewinding time was sent "true" and it was not sent, and the bot endlessly waiting).
I wrote my code that finds all these buttons, it rewinds the time, but your bot does not want to fish when the next day comes, I can not find the reason )
My code:
import pyautogui import cv2 import time import keyboard import threading from plyer import notification # Π£ΡΡΠ°Π½ΠΎΠ²ΠΈ ΠΏΠΎΡΠΎΠ³ Π΄Π»Ρ ΠΎΠΏΡΠ΅Π΄Π΅Π»Π΅Π½ΠΈΡ ΡΠΎΠ²ΠΏΠ°Π΄Π΅Π½ΠΈΡ threshold = 0.8 # ΠΠ°Π³ΡΡΠ·ΠΈ ΠΈΠ·ΠΎΠ±ΡΠ°ΠΆΠ΅Π½ΠΈΡ ΠΊΠ½ΠΎΠΏΠΎΠΊ button_images = [ cv2.imread("zabrat.png"), cv2.imread("zakrit_ispitanie.png"), cv2.imread("lvlup1.png"), cv2.imread("lvlup2.png"), cv2.imread("buy.png"), cv2.imread("time.png"), cv2.imread("nezabrat.png"), cv2.imread("time2.png") ] # Π£ΠΊΠ°ΠΆΠΈ ΠΊΠΎΠΎΡΠ΄ΠΈΠ½Π°ΡΡ ΠΎΠ±Π»Π°ΡΡΠ΅ΠΉ ΠΏΠΎΠΈΡΠΊΠ° Π΄Π»Ρ ΠΊΠ°ΠΆΠ΄ΠΎΠΉ ΠΊΠ½ΠΎΠΏΠΊΠΈ search_areas = [ ((957, 907), (1236, 1000)), ((357, 730), (696, 837)), ((791, 864), (1127, 974)), ((510, 863), (844, 966)), ((690, 855), (955, 925)), ((788, 850), (1130, 930)), ((957, 907), (1236, 1000)), ((666, 795), (1080, 900)) ] while True: for i, button_image in enumerate(button_images): search_area_top_left, search_area_bottom_right = search_areas[i] # Π‘Π½ΠΈΠΌΠΈ ΡΠΊΡΠΈΠ½ΡΠΎΡ ΡΠΊΠ°Π·Π°Π½Π½ΠΎΠΉ ΠΎΠ±Π»Π°ΡΡΠΈ ΡΠΊΡΠ°Π½Π° screenshot = pyautogui.screenshot(region=(search_area_top_left[0], search_area_top_left[1], search_area_bottom_right[0] - search_area_top_left[0], search_area_bottom_right[1] - search_area_top_left[1])) screenshot.save(f"screenshot{i}.png") # ΠΠ°Π³ΡΡΠ·ΠΈ ΡΠΊΡΠΈΠ½ΡΠΎΡ screenshot = cv2.imread(f"screenshot{i}.png") # ΠΡΠΈ ΠΊΠ½ΠΎΠΏΠΊΡ Π½Π° ΡΠΊΡΠΈΠ½ΡΠΎΡΠ΅ result = cv2.matchTemplate(screenshot, button_image, cv2.TM_CCOEFF_NORMED) _, max_val, _, max_loc = cv2.minMaxLoc(result) if max_val >= threshold: button_x, button_y = max_loc button_center_x = button_x + int(button_image.shape[1] / 2) button_center_y = button_y + int(button_image.shape[0] / 2) print(f"ΠΠ½ΠΎΠΏΠΊΠ° {i+1} Π½Π°ΠΉΠ΄Π΅Π½Π°!") if i == 4: click_x = 1630 click_y = 82 elif i == 5: click_x = button_center_x + search_area_top_left[0] click_y = button_center_y + search_area_top_left[1] pyautogui.click(click_x, click_y) time.sleep(3) # ΠΠΎΠ΄ΠΎΠΆΠ΄Π°ΡΡ 3 ΡΠ΅ΠΊΡΠ½Π΄Ρ click_x = 800 click_y = 660 elif i == 6: click_x = button_center_x + search_area_top_left[0] click_y = button_center_y + search_area_top_left[1] else: click_x = button_center_x + search_area_top_left[0] click_y = button_center_y + search_area_top_left[1] # ΠΡΠΏΠΎΠ»Π½ΠΈ ΠΊΠ»ΠΈΠΊ pyautogui.click(click_x, click_y) else: print(f"ΠΠ½ΠΎΠΏΠΊΠ° {i+1} Π½Π΅ Π½Π°ΠΉΠ΄Π΅Π½Π°.") time.sleep(5) # ΠΠΎΠ΄ΠΎΠΆΠ΄ΠΈ 5 ΡΠ΅ΠΊΡΠ½Π΄ ΠΏΠ΅ΡΠ΅Π΄ ΡΠ»Π΅Π΄ΡΡΡΠ΅ΠΉ ΠΈΡΠ΅ΡΠ°ΡΠΈΠ΅ΠΉ
this code still work for next morning click button?
Friend, everything works except for finding the next morning button, I tried replacing the picture, didn't help.
Oh yeah, also doesn't release more fish than the cage can hold.