def startMatch(): # Searching for play button pos = imagesearch_loop("./images/btn_play.png", 1) moveTo(pos[0], pos[1]) click() # Searching for coop button pos = imagesearch_loop("./images/coop_match.png", 1) moveTo(pos[0], pos[1]) click() # Searching for confirm button pos = imagesearch_loop("./images/btn_confirm.png", 1) moveTo(pos[0], pos[1]) click() # Getting in queue pos = imagesearch_loop("./images/btn_findmatch.png", 1) moveTo(pos[0], pos[1]) click() # Accept found queue pos = imagesearch_loop("./images/btn_accept.png", 1) moveTo(pos[0], pos[1]) click()
def do_unlock_manifolds(self): for i in range(10): pos = imagesearch_loop( self.main_path + "\\task_images\\unlock_manifolds\\" + str(i + 1) + ".jpg", 0) pyautogui.click(x=pos[0] + 10, y=pos[1] + 10)
def waitImageCheck(imageName): pos = imagesearch_loop(imageName, 0.2) if pos[0] != -1: return True else: print("Could not find: " + imageName) return False
def playAgain(): # Getting in queue pos = imagesearch_loop("./images/btn_playagain.png", 1) moveTo(pos[0], pos[1]) click() # Getting in queue pos = imagesearch_loop("./images/btn_findmatch.png", 1) moveTo(pos[0], pos[1]) click() # Accept found queue pos = imagesearch_loop("./images/btn_accept.png", 1) moveTo(pos[0], pos[1]) click() selectChampion() playsYuumi()
from python_imagesearch.imagesearch import imagesearch from python_imagesearch.imagesearch import imagesearch_loop from python_imagesearch.imagesearch import imagesearch_from_folder from utils import getCarouselItem from utils import getCards from utils import buyOnlyOP import pyautogui import time ############## START LOL ############## #Launch LoL print('searching lol...') lol_icon = imagesearch_loop("./assets/outGameIcons/lol_icon.png", 1) pyautogui.moveTo(lol_icon[0] + 20, lol_icon[1] + 20) pyautogui.doubleClick() print("starting lol...") #Play Icon play_menu = imagesearch_loop("./assets/outGameIcons/play_menu.png", 1) pyautogui.moveTo(play_menu[0] + 20, play_menu[1] + 20) pyautogui.click() print("searching playmode...") #Choose PVP pvp_text = imagesearch_loop("./assets/outGameIcons/pvp_text.png", 1) pyautogui.moveTo(pvp_text[0] + 10, pvp_text[1] + 10) pyautogui.click() print("pvp") #Confirm Icon (NEEDS TO CHOSE RANKED)
def do_buy_beverage(self): x_locs = (480, 680, 880, 1080) y_locs = (270, 650, 990) beverage = (None, None) for drawing in os.listdir(self.main_path + "\\task_images\\buy_beverage\\drawings"): if self.debug: print(drawing) pos = imagesearch(self.main_path + "\\task_images\\buy_beverage\\drawings\\" + drawing, precision=.6) if pos[0] != -1: beverage = (pos, drawing) beverage_to_get = [ imagesearch_loop( self.main_path + "\\task_images\\buy_beverage\\beverages\\" + beverage[1], 0), 0, 0 ] if self.debug: print(f"need to get {beverage}") print(beverage_to_get) letters = [(1240, 400), (1350, 400), (1480, 400)] numbers = [(1240, 520), (1350, 520), (1480, 520), (1350, 640)] if beverage_to_get[0][0] < x_locs[0]: beverage_to_get[1] = 0 elif beverage_to_get[0][0] < x_locs[1]: beverage_to_get[1] = 1 elif beverage_to_get[0][0] < x_locs[2]: beverage_to_get[1] = 2 elif beverage_to_get[0][0] < x_locs[3]: beverage_to_get[1] = 3 if beverage_to_get[0][1] < y_locs[0]: beverage_to_get[2] = 0 elif beverage_to_get[0][1] < y_locs[1]: beverage_to_get[2] = 1 elif beverage_to_get[0][1] < y_locs[2]: beverage_to_get[2] = 2 pyautogui.moveTo(letters[beverage_to_get[2]][0], letters[beverage_to_get[2]][1]) pyautogui.mouseDown() pyautogui.mouseUp() pyautogui.moveTo(numbers[beverage_to_get[1]][0], numbers[beverage_to_get[1]][1]) pyautogui.mouseDown() pyautogui.mouseUp() pyautogui.moveTo(1475, 645) pyautogui.mouseDown() pyautogui.mouseUp()
def do_upload_data(self): pos = imagesearch_loop( self.main_path + "\\task_images\\upload_data\\key.jpg", 0) pyautogui.click(x=pos[0] + 40, y=pos[1] + 5)
def do_accept_diverted_power(self): pos = imagesearch_loop( self.main_path + "\\task_images\\accept_diverted_power\\key.jpg", 0) pyautogui.click(x=pos[0] + 10, y=pos[1] + 40)
from mss import mss from mss.base import MSSBase, ScreenShot from python_imagesearch.imagesearch import imagesearch, imagesearch_loop from PIL import Image # load reference data ref1Name = "img_x1.png" #refImage1 = Image.open(ref1Name) t1 = time.time() #refPoint_1 = pa.locateCenterOnScreen("img_x1.png", grayscale=True) #refPoint_1 = imagesearch(ref1Name, precision=0.8) refPoint_1 = imagesearch_loop(ref1Name, timesample=0.5, precision=0.8) t2 = time.time() print("time taken:", (t2 - t1) * 1000) print(refPoint_1) xRef, yRef = refPoint_1 yRef -= 25 print(xRef) Ref1 = (xRef - 680, yRef) Ref2 = (Ref1[0] + 120, yRef) Ref3 = (Ref2[0] + 135, yRef) Ref4 = (Ref3[0] + 135, yRef)
def selectChampion(): for x in range(3): # Searchs for Yuumi pos = imagesearch("./images/search_champion.png") if pos[0] != -1: print("im gonna pick yuumi") moveTo(pos[0], pos[1]) click() time.sleep(2) # Type yuumi typewrite('Soraka') time.sleep(5) # Select Yuumi #pos = imagesearch_loop("./images/yuumi_face.png", 1) #moveTo(pos[0], pos[1]) moveTo(700, 332) time.sleep(5) click() time.sleep(2) # Confirm the champion select pos = imagesearch_loop("./images/confirm_champion.png", 1) moveTo(pos[0], pos[1]) time.sleep(5) click() print("champion selected") print("awaiting 2 minutes before start playing yuumi") time.sleep(200) playsYuumi() else: print("button accepted") time.sleep( 20) # in case clients is slow or someone dodge the queue # if someone dodges the queue the bot still on queue # Accept found queue pos = imagesearch("./images/btn_accept.png") if pos[0] != -1: moveTo(pos[0], pos[1]) click() print("match accepted again") time.sleep(10) selectChampion() else: selectChampion()
def waitAndPress(imageName): pos = imagesearch_loop(imageName, 0.2) if pos[0] != -1: pyautogui.click(pos[0], pos[1]) else: print("Could not find: " + imageName)