def select_player(): # 选人 start = time() while 1: if time() - start > 60: raise OvertimeError("select_player1") sleep(2) point = mathc_img(get_img(), "ADDGIRL", 0.8) point = remove_same(point) if point: click(point[0]) break # 确定 start = time() while 1: if time() - start > 60: raise OvertimeError("select_player2") point = mathc_img(get_img(), "YES", 0.8) point = remove_same(point) if point: click(point[0]) break sleep(2) click(75, 186) up_swipe()
def receive_done_sub(get_img=get_img): """收远征完成""" sleep(1) for num in range(0, 3): # 找完成的远征 point = mathc_img(get_img(), "DONE", 0.9) point = remove_same(point) # 找到可以收的远征 if point: game_log.info("RECEIVE") click(point[0]) point = [] sleep(1) # 找MARCHDONE start = time() while 1: if time() - start > 60: raise OvertimeError("receive1") point = mathc_img(get_img(), "MARCHDONE", 0.9) if point: point = [] break sleep(STEP * 2) # 在回到远征界面前一直点 start = time() while 1: if time() - start > 60: raise OvertimeError("receive2") if marchfind(): break click(792, 818) sleep(2) # 没远征可收 else: return
def select_stage(self, number): """选关""" def selection(stage): if isinstance(stage, int): if stage == 1: click(1105, 231) # 选关1 elif stage == 2: click(1105, 426) # 选关2 elif stage == 3: click(1105, 612) # 选关3 else: point = mathc_img(get_img(), stage, 0.9) if point: click(point[0]) else: self.before_fight() self.select_stage(self, number) start = time() while 1: if time() - start > 60: raise OvertimeError("stage") offlinefind(1) if startfind(): selection(number) sleep(2) break sleep(STEP * 2)
def select_team(number): """选队伍和点击出发""" start = time() while 1: if time() - start > 60: raise OvertimeError("team") offlinefind() if gofind(): power_use = go(number) sleep(2) return power_use sleep(STEP * 2)
def go_to_march(): """进入远征界面""" click(1387, 543) sleep(3) start = time() while 1: if time() - start > 60: raise OvertimeError("go") marchfind() offlinefind() if marchfind(): break sleep(STEP * 2)
def exit_to_main(): """返回主界面""" click_s(1559, 35) start = time() while 1: if time() - start > 60: raise OvertimeError("exit") offlinefind() if mainpagefind(): break if time() - start > 10: click_s(1559, 35) sleep(5) sleep(STEP * 2)
def select_bossfight(abnormal): """boss战斗选择""" start = time() while 1: if time() - start > 60: raise OvertimeError("bossfight") offlinefind() if boostfind(): # 战斗 return 0 elif endfind(): # 结束 return 1 sleep(STEP * 3)
def go(team): """队伍选择""" # 判断当前队伍 计算距目标的距离 start = time() while 1: if time() - start > 60: raise OvertimeError("go") value = search("TEAMFIND") value = value + 1 - team if value == 0: power_use = powerfind() # print(power_use) click(1338, 796) return power_use elif value > 0: click(58, 534) else: click(1030, 534) sleep(2)
def select_wavefight(abnormal=0): """wave战斗选择""" start = time() while 1: if time() - start > 60: raise OvertimeError("wavefight") offlinefind() if boostfind(): if fullfind(): # 满血 return 0 else: # 残血 return select_notfull(abnormal) start = time() elif endfind(): # 结束 return 1 sleep(STEP * 3)
def end(sel): """结束处理""" click(500, 500) start = time() while 1: if time() - start > 60: raise OvertimeError("end") offlinefind() if againfind() or nextfind(): break sleep(STEP * 3) if waterfind(): print("water find") click(1415, 813) raise Watererror("end") elif sel == "next": click(1415, 813) elif sel == "again": click(181, 814)
def skill_room(): """道场续书""" # 设施有红点吗 if not mainpage_buildingfind(): return click(800, 800, 3) # 道场有红点吗 if not mainpage_building_skill_room_point(): click(792, 772) return click(1316, 464) start = time() num = 0 while 1: sleep(5) if time() - start > 60: break raise OvertimeError("skill_room") # 道场技能150 point = mathc_img(get_img(), "EXP", 0.8) point = remove_same(point) if point: for p in point: if p[0] > 800: point.remove(p) # print(point) click(int(point[1][0]), int(point[1][1] + 50), 1) # 银书 click(1322, 764, 1) click(992, 632, 1) num += 1 continue # 道场确定 point = mathc_img(get_img(), "SKILLPOINT", 0.9) if point: point = remove_same(point) click(point[0]) continue if num == 3: break exit_to_main()
def select_notfull(abnormal=0): """残血处理""" next_abnormal = extra(abnormal) sleep(5) start = time() while 1: if time() - start > 30: raise OvertimeError("notfull") if boostfind(): if fullfind(): # 残血打完发现现在是满血 return 0 else: # 残血打完发现现在是残血 if next_abnormal: select_notfull(next_abnormal) else: select_notfull(abnormal) start = time() elif endfind(): # 残血打完发现现在是结束 return 1 sleep(STEP * 2)