def main(): time.sleep(2) util.logOut( __file__, '通常' + str(CHAPTER_NUM) + '-' + str(CHAPTER_NUM2) + ' 不打boss 开始') const.chapterProcess(CHAPTER_NUM, 'N') while True: # 进入12-4 util.logOut(__file__, '-------------一局开始------------') const.intoStageProcess(CHAPTER_X, CHAPTER_Y, 3, 6, True) # 走格子 X, Y = START_X, START_Y # 打CNT个出boss for n in range(CNT): util.logOut(__file__, '------------一把开始-----------') const.picLoop(const.publicPath() + 'bmp/withdraw.jpg') # 等待搜索雷达 time.sleep(4.000) X, Y = const.findShip(X, Y, const.getPicNum(path), path) util.click(X, Y) const.anchorProcess(redFace=True) util.logOut(__file__, '------------一把结束-----------') # boss 不打boss x, y = const.picLoop(const.publicPath() + 'bmp/withdraw.jpg') util.click(x, y) x, y = const.picLoop(const.publicPath() + 'bmp/OK.jpg') util.click(x, y) util.logOut(__file__, '-------------一局结束------------')
def main(): time.sleep(2) util.logOut(__file__, '通常9-1 打n把 开始') const.chapterProcess(CHAPTER_NUM, 'N') while True: # 进入 util.logOut(__file__, '9-1开始') const.intoStageProcess(CHAPTER_X, CHAPTER_Y, 3, 6) # 走格子 X, Y = START_X, START_Y # 打CNT个出boss for n in range(CNT): const.picLoop(const.publicPath() + 'bmp/withdraw.jpg') #紧急委托 特殊 xx, yy = util.findPic(const.publicPath() + 'bmp/OK.jpg') if xx != -1 and yy != -1: util.click(xx, yy) # 等待搜索雷达 time.sleep(4.000) X, Y = const.findShip(X, Y, const.getPicNum(path), path) util.click(X, Y) const.anchorProcess() # boss 不打boss x, y = const.picLoop(const.publicPath() + 'bmp/withdraw.jpg') util.click(x, y) x, y = const.picLoop(const.publicPath() + 'bmp/OK.jpg') util.click(x, y) util.logOut(__file__, '-------------------------')
def main(): PIC_NUM = const.getPicNum(path) time.sleep(2) util.logOut(__file__,'activity脚本开始') chapterProcess() while True: # 进入 time.sleep(2) const.intoStageProcess(CHAPTER_X, CHAPTER_Y) util.logOut(__file__,'活动图开始-------------------------') time.sleep(60.000) def noTipAgain(): util.logOut(__file__,'findPicLoop 循环找图开始 '+const.publicPath() + 'bmp/again.jpg') util.logOut(__file__,'findPicLoop 循环找图开始 '+const.publicPath() + 'bmp/zhengli.jpg') for i in range(600): x, y = util.findPic(const.publicPath() + 'bmp/again.jpg', threshold=0.8, size=(0, 0, 0, 0)) if x != -1 and y != -1: util.logOut(__file__,'findPicLoop 循环找图结束 '+const.publicPath() + 'bmp/again.jpg') util.logOut(__file__,'活动图结束-------------------------') x,y = const.picLoop(const.publicPath() + 'bmp/leave.jpg') util.click(x,y) return x, y = util.findPic(const.publicPath() + 'bmp/zhengli.jpg', threshold=0.8, size=(0, 0, 0, 0)) if x != -1 and y != -1: util.logOut(__file__,'findPicLoop 循环找图结束 '+const.publicPath() + 'bmp/zhengli.jpg') util.logOut(__file__,'船坞已满') time.sleep(2) util.click(x,y) const.retireProcess() time.sleep(4.000) x,y = const.picLoop(const.publicPath() + 'bmp/zilv.jpg') util.click(x,y) #红脸特殊(屑) if redFace and util.isFindPic(const.publicPath() + 'bmp/OK.jpg'): util.logOut(__file__,'红脸判断 开始') list = util.getWords((237, 201 , 627, 263)) isRedFace = False if len(list) != 0: for m in list: if '低心情' in list[m]: isRedFace = True break if len(list) != 0 and isRedFace: util.logOut(__file__,'我是粪提 结束') x, y = const.picLoop(const.publicPath() + 'bmp/OK.jpg') util.click(x, y) util.logOut(__file__,'picLoop没找到图 需要重启脚本!!!!!!') const.restartProcess() raise ValueError('restart') noTipAgain()
def main(): # 通常 PIC_NUM = const.getPicNum(path) # 问号 # PIC_NUM = getQuestionNum(path) templates = [] SEARCH_SIZE = (84, 36, 864, 439) for i in range(PIC_NUM): # 通常 template = cv2.imread(path + str(i) + '.jpg', 0) # 问号 # template = cv2.imread(path + 'question' + str(i) + '.jpg', 0) templates.append(template) img = util.grab(SEARCH_SIZE) # 通常 cv2.rectangle(img, (0, 0), (263, 65), (255, 0, 0), -1) # 问号 # cv2.rectangle(img,(0,0),(263, 65),(0,0,0),-1) # cv2.rectangle(img,(400-184, 309-136),(237-184, 188-136),(0,0,0),-1) tarImg = img.copy() def foo(i): # 通常 temp = util.findPic(None, threshold=0.7, img=img, template=templates[i]) # 问号 # temp = util.findPic(None, threshold=0.9, img=img,template=templates[i]) if temp[0] == -1 and temp[1] == -1: return print(i, temp) # 通常 a = (int(temp[0] - 20), int(temp[1] - 20)) b = (int(temp[0] + 20), int(temp[1] + 20)) # 问号 # a = (int(temp[0]-20), int(temp[1]-20) +35) # b = (int(temp[0]+20), int(temp[1]+20) +35) cv2.rectangle(tarImg, a, b, (0, 0, 255), 2) for i in range(PIC_NUM): foo(i) time.sleep(2) cv2.imshow('', tarImg) cv2.waitKey(0)
def main(): time.sleep(2) util.logOut(__file__, str(CHAPTER_NUM) + '-' + str(CHAPTER_NUM2) + '脚本开始') const.chapterProcess(CHAPTER_NUM, 'N') while True: # 进入 util.logOut(__file__, str(CHAPTER_NUM) + '-' + str(CHAPTER_NUM2) + '开始') const.intoStageProcess(CHAPTER_X, CHAPTER_Y, 3, 2) # 走格子 X, Y = START_X, START_Y # 打CNT个出boss for n in range(CNT): const.picLoop(const.publicPath() + 'bmp/withdraw.jpg') # 等待搜索雷达 if n == 0: time.sleep(4.000) X, Y = const.findShip(X, Y, const.getPicNum(path), path) util.click(X, Y) const.anchorProcess() # boss const.picLoop(const.publicPath() + 'bmp/withdraw.jpg') const.goBossProcess() util.logOut(__file__, '-------------------------')