import aircv as ac import numpy as np import Win32Ctrl as ct import time from PIL import ImageGrab zudui=ac.imread('zudui.png') zudui2=ac.imread('zudui2.png') yaoqifengyin=ac.imread('yaoqifengyin.png') yaoqifengyin2=ac.imread('yaoqifengyin2.png') shuaxin=ac.imread('shuaxin.png') jiaru=ac.imread('jiaru.png') zhunbei=ac.imread('zhunbei.png') shengli=ac.imread('shengli.png') zuduiyaoqi=ac.imread('zuduiyaoqi.png') pipeizhong=ac.imread('pipeizhong.png') zidongpipei=ac.imread('zidongpipei.png') kaishizhandou=ac.imread('kaishizhandou.png')
while (1): pic = np.array(ImageGrab.grab()) #在主页点击组队 pos=ac.find_template(zudui,pic) iftype(pos)==dict: print('组队') print(pos['confidence']) if pos['confidence']>0.8: ct.mouse_click(220,575) time.sleep(1) #进入妖气封印界面 while (1): pic = np.array(ImageGrab.grab()) pos=ac.find_template(pipeizhong,pic) iftype(pos)!=dict: ct.mouse_click(700,600) time.sleep(1) else: break #自己变成了队长点一次开始 pos=ac.find_template(kaishizhandou,pic) iftype(pos)==dict: print('开始战斗') print(pos['confidence']) if pos['confidence']>0.8: ct.mouse_click(900,570) #在开始战斗页面点准备 pos=ac.find_template(zhunbei,pic) iftype(pos)==dict: print('开始') print(pos['confidence']) if pos['confidence']>0.8: ct.mouse_click(1055,523) #在胜利页面随意点击 pos=ac.find_template(shengli,pic) iftype(pos)==dict: print('胜利') print(pos['confidence']) if pos['confidence']>0.8: ct.mouse_click(1055,523) time.sleep(2) ct.mouse_click(1055,523) time.sleep(2) ct.mouse_click(1055,523) x,y =ct.get_mouse_point() print (x,y) time.sleep(0.5) x,y =ct.get_mouse_point() print (x,y) time.sleep(0.5) if x < 10and y < 10: break