123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128 |
- import cv2
- import time
- import pyautogui
-
- def find(image):
- print(f"\n{image} |")
- template = cv2.imread("assets/{}".format(image), 0)
- width, height = template.shape[::-1]
- pyautogui.screenshot("screenshot.png")
- screen = cv2.imread("screenshot.png", 0)
- width2, height2 = screen.shape[::-1]
- print(f"Breite: {width} | Höhe: {height}\nBreite: {width2} | Höhe: {height2}")
- match = cv2.matchTemplate(screen, template, cv2.TM_CCOEFF_NORMED)
- value, location = cv2.minMaxLoc(match)[1], cv2.minMaxLoc(match)[3]
- if (value >= 0.8):
- return (location[0], location[1], width, height, value)
- else:
- return None
-
- while True:
- # Start
-
- time.sleep(3)
-
- try:
- print(f"Start Duell")
- # Assist Duel
- Assist = find("assistduel.png")
- if Assist == None:
- pass
- else:
- test = pyautogui.click((Assist[0], Assist[1]))
- except:
- print(f"Start Duell nicht gefunden")
-
- try:
- Rndclick = find("rndclick.png")
- if Rndclick == None:
- pass
- else:
- pyautogui.click((Rndclick[0], Rndclick[1]))
- except:
- print(f"Dialog nicht gefunden")
-
- try:
- # Auto-Duel
- autoduel = find("autoduel.png")
- if autoduel == None:
- pass
- else:
- pyautogui.click((autoduel[0], autoduel[1]))
- except:
- print(f"Auto-Duel nicht gefunden")
-
- try:
- # Result
- result = find("ok.png")
- if result == None:
- pass
- else:
- pyautogui.click((result[0], result[1]))
- except:
- print(f"Result nicht gefunden")
-
- try:
- # Duel Result
- duelresult = find("ok.png")
- if duelresult == None:
- pass
- else:
- pyautogui.click((duelresult[0], duelresult[1]))
- except:
- print(f"Duel Result nicht gefunden")
-
-
- try:
- # Event Points Obtained
- EPO = find("ok.png")
- if EPO == None:
- pass
- else:
- pyautogui.click((EPO[0], EPO[1]))
- except:
- print(f"Event Points Obtained nicht gefunden")
-
-
- try:
- # Rescue Complete
- RC = find("mark.png")
- if RC == None:
- pass
- else:
- pyautogui.click((RC[0], RC[1]))
- except:
- print(f"Rescue Complete nicht gefunden")
-
-
- try:
- # Assisting Players
- AP = find("next.png")
- if AP == None:
- pass
- else:
- pyautogui.click((AP[0], AP[1]))
- except:
- print(f"Assisting Players nicht gefunden")
-
-
- try:
- # Treasure Boxes Obtained
- TBO = find("ok.png")
- if TBO == None:
- pass
- else:
- pyautogui.click((TBO[0], TBO[1]))
- except:
- print(f"Treasure Boxes Obtained nicht gefunden")
-
-
- try:
- # Lootboxen
- LB = find("next.png")
- if LB == None:
- pass
- else:
- pyautogui.click((LB[0], LB[1]))
- except:
- print(f"Lootboxen nicht gefunden")
|