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 get_mode(img): """获取类别""" point = mathc_img(img, "BOOK", 0.8) point = remove_same(point) # print(x) string = "nothing" if point: string = "book" # 指南书 point = mathc_img(img, "GOLD1", 0.9) point = remove_same(point) # print(x) if point: string = "gold1" # 封结晶 point = mathc_img(img, "GOLD2", 0.9) point = remove_same(point) # print(x) if point: string = "gold2" # 神结晶 point = mathc_img(img, "CARD", 0.8) point = remove_same(point) # print(x) if point: string = "card" # 绘扎 point = mathc_img(img, "POWER", 0.8) point = remove_same(point) # print(x) if point: string = "power" # 灵力 return string
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 get_situation(img): """获取状态""" point1 = mathc_img(img, "DONE", 0.9) point2 = mathc_img(img, "WORKING", 0.9) if point1: return "done" # 状态为完成 elif point2: return "doing" # 状态为进行中 else: return "available" # 状态为可选
def waterfind(): "出水判定" point = mathc_img(get_img(), "WATER", 0.9) if point: return True else: return False
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 cut(img): """切出每个远征的小图""" # 找到所以基准点 point = mathc_img(img, "LV", 0.7) point = remove_same(point) # 图片切片 piclist = [] for num in range(0, len(point)): y0 = point[num][1] - 34 y1 = point[num][1] + 186 x0 = point[num][0] - 296 x1 = point[num][0] + 907 piclist.append(cut_image(y0, y1, x0, x1, img)) return piclist
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)
# 做远征 self.send(march_list, modelist) game_log.info("march done") exit_to_main() click(1472, 717) sleep(3) except OvertimeError as err: game_log.error(err.type) self.start() if __name__ == "__main__": Sub.start() while 1: # 道场技能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) x = int(point[1][0]) y = int(point[1][1] + 30) click(x, y, 2) # 银书 click(1322, 764, 1) click(992, 632, 1) sleep(3) continue # 道场确定 point = mathc_img(get_img(), "SKILLPOINT", 0.9)