def this_zhang_dou_zhong(self, argument, handle): if self.huang_flag: # 如果要换狗粮 # 如果没有全部稀有度按钮 if Game.if_exist("yys/全部稀有度按钮.bmp") != 0: if Game.if_exist("yys/N卡选择按钮.bmp") != 0: # 点晴明附近 x = int(handle.left + (handle.right - handle.left) / 4) y = int(handle.top + (handle.bottom - handle.top) * 3 / 4) m = Mouse() m.click(x, y) else: # 找没满级狗粮和拖上去替换 gouliang = Gouliang(self.metrics_x, self.metrics_y, handle) gouliang.find_and_huang( False, bool(1 - self.Beater) and self.BeatMax) self.click_img("yys/战斗中准备按钮.bmp", handle) self.huang_flag = False else: if Game.if_exist("yys/N卡选择按钮.bmp") != 0: if self.click_img("yys/全部稀有度按钮.bmp", handle) == 0: time.sleep(0.3) self.click_img("yys/N卡选择按钮.bmp", handle) else: self.click_img("yys/战斗中准备按钮.bmp", handle) self.waiting(argument, handle) return codedef.NORMAL_END
def feng_mo_zhi_shi(self, argument, handle): # 点完退出 if self.can_exited: if self.click_img("yys/退出探索.bmp", handle) == 0: time.sleep(1) else: # 看奖励按钮位置,没的话退出 re, x, y = self.window.find_img(handle, "yys/奖励不可拿.bmp", 0.9) if re == 0: if self.jiang_li_x == 0 and self.jiang_li_y == 0: self.jiang_li_x = x self.jiang_li_y = y else: self.can_exited = True if self.jiang_li_x == 0 and self.jiang_li_y == 0: pass else: m = Mouse(self.metrics_x, self.metrics_y) m.click(self.jiang_li_x, self.jiang_li_y) time.sleep(1) self.jiang_li_x = 0 self.jiang_li_y = 0 # 有气泡可以点就点 if Game.if_exist("yys/可以点.bmp") == 0: if self.click_img("yys/现世逢魔按钮.bmp", handle, 0.90) == 0: time.sleep(2) return codedef.NORMAL_END
def da_liao_jie_jie_main(self, handle): na = self.ge_ren_or_liao(handle) if na == -1: return 1 if na == 0: self.enter_liao_jie_jie(handle) return 0 if self.jie_tu_if_exist(handle, "yys/会长未选择寮进行突破.bmp") == 0: print("会长未选择寮进行突破") return 2 times = self.get_ji_bai_times() if times <= 0: return 3 r1, r2, r3 = self.jie_jie_number(handle) if r1 == 0: # 向下滚四排 Liaojiejie.xia_yi_pai(4, handle) return 0 if r3 == 0: # 向上滚一排 Liaojiejie.xia_yi_pai(-1, handle) return 0 # 此时已经找到最底部且没打过的 re, x, y = self.jie_chu_tu_po_block_liao(handle) if re != 0: return 4 mouse = Mouse() mouse.click(x, y) self.waiting(handle) if self.click_img("yys/进攻结界按钮.bmp", handle, 0.90) == 0: print("进攻结界按钮") return 0
def get_text(self, name): re = Window.get_window(self.m_handle, None, name) if re != 0: print("找不到窗口:" + name) return "" else: print("窗口:" + name) win32gui.ShowWindow(self.m_handle.hwnd, 1) win32gui.SetForegroundWindow(self.m_handle.hwnd) time.sleep(0.3) re = Window.get_window(self.m_handle, None, name) if re != 0: print("找不到窗口:" + name) return "" else: print("窗口:" + name) center_x = (self.m_handle.right + self.m_handle.left) / 2 center_y = (self.m_handle.bottom + self.m_handle.top) / 2 mouse = Mouse() mouse.click(int(center_x), int(center_y)) time.sleep(0.3) key_board = Keyboard() key_board.ctrl_A_C() time.sleep(0.3) win32gui.ShowWindow(self.m_handle.hwnd, 2) text = SendQQ.get_clipboard_text() cmd = SendQQ.get_last_cmd(text, name) return cmd
def enter_game(self, argument, handle): # if self.can_exited is False: src_x = int((handle.left + handle.right) / 2) src_y = handle.top + int((handle.bottom - handle.top) * 4 / 5) m = Mouse(self.metrics_x, self.metrics_y) m.click(src_x, src_y) # m.mouse_to(src_x, src_y) time.sleep(3) self.can_exited = False #、。。。。。。。 return codedef.FIGHT_BEGIN
def dian_guai_11(self): yys1 = self.comboBox_1.currentText() yys_handle = Handle() self.add_in_text_browser("点主怪\r\n") if Window.get_window(yys_handle, None, "[#] [yys" + yys1 + "] 阴阳师-网易游戏 [#]") == codedef.NORMAL_END: x = int((yys_handle.right + yys_handle.left) / 2) xishu = 0.2 y = int((yys_handle.top + (yys_handle.bottom - yys_handle.top) * xishu)) m = Mouse() m.click(x, y)
def dian_friend(self, handle, index): # (0.4 0.3)(0.6 0.3) # (0.4 0.45)(0.6 0.45) # (0.4 0.6)(0.6 0.6) dxy = [[0.4, 0.35], [0.6, 0.35], [0.4, 0.45], [0.6, 0.45], [0.4, 0.6], [0.6, 0.6]] x = dxy[index][0] y = dxy[index][1] xx = int(handle.left + x * (handle.right - handle.left)) yy = int(handle.top + y * (handle.bottom - handle.top)) m = Mouse() m.click(xx, yy) return codedef.NORMAL_END
def witch_up(self, handle, UP, src_img_path, target_img_path): pos_list = Img.find_all_pos_img_in_img(src_img_path, target_img_path, 0.9) if pos_list is None: return codedef.ERROR_END for i in range(len(pos_list)): x = int(pos_list[i]['result'][0]) y = int(pos_list[i]['result'][1]) if self.find_UP(x, y, UP, src_img_path) == codedef.NORMAL_END: mouse = Mouse() # mouse.mouse_to(handle.left + x, handle.top + y) mouse.click(handle.left + x, handle.top + y) return codedef.NORMAL_END return codedef.ERROR_END
def deng_lu(self, argument, handle): if self.click_img("yys/batch_feng/下拉按钮.bmp", handle, 0.90) == 0: time.sleep(0.2) return codedef.NORMAL_END else: if Game.if_exist("yys/batch_feng/收回按钮.bmp") == 0: time.sleep(0.2) if self.mod == 0: # re, x, y = self.window.find_img(handle, "yys/batch_feng/扫码登录.bmp", 0.9) # if re == 0: # mouse = Mouse() # mouse.click(x, y - 40) # time.sleep(2) # if self.click_img("yys/batch_feng/登录按钮.bmp", handle, 0.90) == 0: # time.sleep(1) # else: re, x, y = self.window.find_img(handle, "yys/batch_feng/叉叉按钮.bmp", 0.9) if re == 0: i = 5 while i > 0: i += 1 src_x = x + 22 xisu = 0.565 src_y = handle.top + int( (handle.bottom - handle.top) * xisu) tar_x = src_x tar_y = src_y + 150 # mouse = Mouse() # mouse.mouse_to(src_x, src_y) self.tuo(src_x, src_y, tar_x, tar_y) time.sleep(0.2) return codedef.ERROR_END re, x, y = self.window.find_img( handle, "yys/batch_feng/叉叉按钮.bmp", 0.9) if re == 0: mouse = Mouse() mouse.click(x - 40, y) time.sleep(2) if self.click_img("yys/batch_feng/登录按钮.bmp", handle, 0.90) == 0: time.sleep(1) else: src_x = int((handle.left + handle.right) / 2) src_y = handle.top + int( (handle.bottom - handle.top) * 2 / 3) m = Mouse(self.metrics_x, self.metrics_y) m.click(src_x, src_y) time.sleep(1) if self.click_img("yys/batch_feng/登录按钮.bmp", handle, 0.90) == 0: time.sleep(1) return codedef.NORMAL_END
def personal_jiejie_main(self, argument, handle): print("personal_jiejie_main") if self.click_img("yys/结界奖励.bmp", handle, 0.98) == 0: print("结界奖励") da_guo, da_bug_uo, mei_da_guo = self.jie_jie_number(handle) if da_guo >= 3 or mei_da_guo == 0: return self.refresh_jie_jie(handle) re, x, y = self.jie_chu_tu_po_block(handle) if re != 0: return -2 time.sleep(random.randint(0, 5)) mouse = Mouse() mouse.click(x, y) self.waiting(argument, handle) if self.click_img("yys/进攻结界按钮.bmp", handle, 0.90) == 0: return codedef.NORMAL_END else: if self.click_img("yys/进攻结界按钮2.bmp", handle, 0.90) == 0: return codedef.NORMAL_END return codedef.NORMAL_END
def xia_yi_pai(pai, handle): m = Mouse() m.mouse_to(handle.left + 600, handle.top + 200) time.sleep(0.2) # 滚轮滚2为一排 m.gun_lun(-2 * pai, 0) time.sleep(0.2)
def find_feng_mo(self, argument, handle): if self.click_img("yys/batch_feng/取消按钮.bmp", handle, 0.90) == 0: time.sleep(0.5) if self.can_exited is False: if self.click_img("yys/土曜按钮.bmp", handle, 0.90) == 0: time.sleep(0.5) else: src_x = handle.left + int((handle.right - handle.left) / 3) src_y = handle.top + int((handle.bottom - handle.top) * 2 / 3) tar_x = int(handle.left + handle.right / 2) tar_y = src_y self.tuo(src_x, src_y, tar_x, tar_y) else: # 可以退出,点左上角头像 src_x = handle.left + int((handle.right - handle.left) / 20) src_y = handle.top + int((handle.bottom - handle.top) / 10) m = Mouse(self.metrics_x, self.metrics_y) m.click(src_x, src_y) time.sleep(2) return codedef.NORMAL_END
def __init__(self, buyyan=0, buyyu=0, mod=0): super(rilunzhicheng, self).__init__() # 获取分辨率 self.m = Mouse(GetSystemMetrics(0), GetSystemMetrics(1)) self.HadOpenEye = False self.mod = mod # 0刷玉,1刷层 self.top = 0.25 self.left = 0.15 self.img = Img() self.mouse = Mouse() self.arr1 = [[1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [2, 1], [2, 4], [2, 6], [3, 1], [3, 4], [3, 6]] self.arr2 = [[1, 7], [1, 6], [1, 5], [1, 4], [1, 3], [1, 2], [1, 1], [1, 0], [2, 1], [2, 4], [2, 6], [3, 1], [3, 4], [3, 6]] self.arr3 = [[2, 0], [2, 1], [2, 2], [2, 3], [2, 4] , [2, 5], [2, 6], [2, 7], [1, 1], [1, 4], [1, 6], [0, 1], [0, 4], [0, 6]] self.arr4 = [[2, 7], [2, 6], [2, 5], [2, 4], [2, 3], [2, 2], [2, 1], [2, 0], [1, 1], [1, 4], [1, 6], [0, 1], [0, 4], [0, 6]] self.da_wang = False self.buyyan = buyyan # 花勾玉买眼的最大次数 self.buyyu = buyyu # 花勾玉买溯玉的最大次数 self.jiao_pos = 0
def main1(): print("开始") tMouse = Mouse() time.sleep(3) while 1: print("grab") re = lianjie() if re == 0: print("find") print("当前时间戳为:") print(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())) tMouse.mouse_to(1920 - 200, 10) tMouse.click(1920 - 200, 10) break time.sleep(10 * 60) print("end")
def this_tang_suo(self, argument, handle): # 4 管 1-6 ;10 管 7-12; # 选28章 if self.click_img("yys/" + self.Chapter + ".bmp", handle) != 0: m = Mouse(self.metrics_x, self.metrics_y) dx = 0 dy = -1 * int(0.5 * (handle.top - handle.bottom)) imax = 6 index = 0 while index < imax: x1 = int(handle.left + 0.85 * (handle.right - handle.left)) y1 = int(handle.top + 0.35 * (handle.bottom - handle.top)) m.absolute(x1, y1, dx, dy) time.sleep(1.5) window_img = self.window.jie_tu(handle) window_img.save('temp/temp.bmp') if Game.if_exist("yys/第一章.bmp", 0.95) == 0: break index += 1 index = 0 imax = 12 dy = int(-1 * dy / 3) while index < imax: window_img = self.window.jie_tu(handle) window_img.save('temp/temp.bmp') if self.click_img("yys/" + self.Chapter + ".bmp", handle) == 0: break x1 = int(handle.left + 0.85 * (handle.right - handle.left)) y1 = int(handle.top + 0.8 * (handle.bottom - handle.top)) m.absolute(x1, y1, dx, dy) time.sleep(1.5) index += 1 time.sleep(1.5) else: time.sleep(3) return codedef.NORMAL_END
class rilunzhicheng(Game): def __init__(self, buyyan=0, buyyu=0, mod=0): super(rilunzhicheng, self).__init__() # 获取分辨率 self.m = Mouse(GetSystemMetrics(0), GetSystemMetrics(1)) self.HadOpenEye = False self.mod = mod # 0刷玉,1刷层 self.top = 0.25 self.left = 0.15 self.img = Img() self.mouse = Mouse() self.arr1 = [[1, 0], [1, 1], [1, 2], [1, 3], [1, 4], [1, 5], [1, 6], [1, 7], [2, 1], [2, 4], [2, 6], [3, 1], [3, 4], [3, 6]] self.arr2 = [[1, 7], [1, 6], [1, 5], [1, 4], [1, 3], [1, 2], [1, 1], [1, 0], [2, 1], [2, 4], [2, 6], [3, 1], [3, 4], [3, 6]] self.arr3 = [[2, 0], [2, 1], [2, 2], [2, 3], [2, 4] , [2, 5], [2, 6], [2, 7], [1, 1], [1, 4], [1, 6], [0, 1], [0, 4], [0, 6]] self.arr4 = [[2, 7], [2, 6], [2, 5], [2, 4], [2, 3], [2, 2], [2, 1], [2, 0], [1, 1], [1, 4], [1, 6], [0, 1], [0, 4], [0, 6]] self.da_wang = False self.buyyan = buyyan # 花勾玉买眼的最大次数 self.buyyu = buyyu # 花勾玉买溯玉的最大次数 self.jiao_pos = 0 def do_work(self, argument, handle): switcher = { SceneKey.NUKOWN: self.error_scene, SceneKey.ZHANG_DOU_JIANG_LI: self.fight_end, SceneKey.ZHANG_DOU_SHENG_LI: self.fight_end, SceneKey.ZHANG_DOU_SHI_BAI: self.fight_end, SceneKey.XUAN_SHANG_FENG_YING_YAO_QING: self.fight_end, SceneKey.LUN_HUI_MI_JING: self.this_main, SceneKey.DA_GUAI_KAI_SHI: self.kai_shi_da_guai, SceneKey.XUAN_ZI_YUAN: self.xuan_zi_yuan, } # Get the function from switcher dictionary func = switcher.get(argument, self.father)(argument, handle) # Execute the function return func def father(self, argument, handle): Game.do_work(self, argument, handle) return codedef.NORMAL_END def get_scene(self, handle): window_img = self.window.jie_tu(handle) window_img.save('temp/temp.bmp') path = "yys/scene/" if Game.if_exist(path + "悬赏封印邀请界面.bmp") == 0: return SceneKey.XUAN_SHANG_FENG_YING_YAO_QING if Game.if_exist(path + "战斗奖励界面.bmp") == 0: return SceneKey.ZHANG_DOU_JIANG_LI if Game.if_exist(path + "战斗胜利界面.bmp") == 0: return SceneKey.ZHANG_DOU_SHENG_LI if Game.if_exist(path + "战斗失败界面.bmp") == 0: return SceneKey.ZHANG_DOU_SHI_BAI if Game.if_exist("yys/日轮之城/轮回秘境界面.bmp") == 0: return SceneKey.LUN_HUI_MI_JING if Game.if_exist("yys/日轮之城/打怪开始界面.bmp") == 0: return SceneKey.DA_GUAI_KAI_SHI if Game.if_exist("yys/日轮之城/选资源界面.bmp") == 0: return SceneKey.XUAN_ZI_YUAN return SceneKey.NUKOWN def xuan_zi_yuan(self, argument, handle): if self.click_img("yys/日轮之城/选金币按钮.bmp", handle) == 0: time.sleep(1) if self.click_img("yys/日轮之城/确认按钮.bmp", handle) == 0: time.sleep(1) return codedef.NORMAL_END def re_set(self): self.jiao_pos = 0 self.HadOpenEye = False self.da_wang = False return codedef.NORMAL_END def this_main(self, argument, handle): self.HadOpenEye = False self.da_wang = False # 如果是刷层,先看看有没有下一关 if self.if_exist("yys/日轮之城/已开眼.bmp", 0.8) == 0: self.HadOpenEye = True elif self.if_exist("yys/日轮之城/已开眼2.bmp", 0.8) == 0: self.HadOpenEye = True if self.click_img("yys/日轮之城/获取时玉.bmp", handle, 0.8) == 0: time.sleep(1) if self.click_img("yys/日轮之城/获取奖励.bmp", handle, 0.8) == 0: time.sleep(1) if self.click_img("yys/日轮之城/获取轮回眼.bmp", handle, 0.8) == 0: time.sleep(1) if self.mod == 1: if self.click_img("yys/日轮之城/时玉.bmp", handle, 0.8) == 0: time.sleep(1.5) return codedef.NORMAL_END elif self.click_img("yys/日轮之城/轮回眼.bmp", handle, 0.8) == 0: time.sleep(1.5) return codedef.NORMAL_END elif self.click_img("yys/日轮之城/下一关.bmp", handle, 0.8) == 0: time.sleep(1) if self.click_img("yys/日轮之城/确定按钮.bmp", handle, 0.8) == 0: time.sleep(1) self.re_set() return codedef.NORMAL_END # 没开眼 if self.HadOpenEye is False: # 分格子,看看缺口在哪个角 # if self.jiao_pos == 0: self.jiao_pos = self.checkJiao(handle) re = codedef.NORMAL_END if self.jiao_pos == 1: re = self.xunhuan_da(handle, self.arr1) elif self.jiao_pos == 2: re = self.xunhuan_da(handle, self.arr2) elif self.jiao_pos == 3 : re = self.xunhuan_da(handle, self.arr3) elif self.jiao_pos == 4: re = self.xunhuan_da(handle, self.arr4) if re == codedef.ERROR_END: self.da_wang = True else: time.sleep(1) # 如果还在轮回秘境界面,重新判断 # if self.if_exist("yys/日轮之城/轮回秘境界面.bmp", 0.98) == 0: # self.jiao_pos = self.checkJiao(handle) if self.da_wang: if self.if_exist("yys/日轮之城/已开眼.bmp", 0.98) == 0: self.HadOpenEye = True elif self.if_exist("yys/日轮之城/已开眼2.bmp", 0.98) == 0: self.HadOpenEye = True else: if self.if_exist("yys/日轮之城/买眼按钮.bmp") == 0: if self.buyyan > 0: self.buyyan -= 1 if self.click_img("yys/日轮之城/买眼按钮.bmp", handle, 0.98) == 0: time.sleep(2) else: # 直接当做打完,这样副本次数就会累加,最后结束脚本 return codedef.FIGHT_END elif self.click_img("yys/日轮之城/开眼按钮.bmp", handle, 0.98) == 0: time.sleep(2) else: if self.click_img("yys/日轮之城/时玉.bmp", handle, 0.8) == 0: time.sleep(1.5) elif self.click_img("yys/日轮之城/轮回眼.bmp", handle, 0.8) == 0: time.sleep(1.5) elif self.click_img("yys/日轮之城/下一关.bmp", handle, 0.8) == 0: time.sleep(1) if self.click_img("yys/日轮之城/确定按钮.bmp", handle, 0.8) == 0: time.sleep(1) self.re_set() elif self.click_img("yys/日轮之城/奖励.bmp", handle, 0.8) == 0: time.sleep(1) return codedef.NORMAL_END def kai_shi_da_guai(self, argument, handle): if self.click_img("yys/未固定阵容.bmp", handle) == 0: time.sleep(0.5) if self.click_img("yys/日轮之城/单人.bmp", handle) == 0: time.sleep(1) return codedef.NORMAL_END # 返回缺口位置 1左上角,2右上角,3左下角,4右下角 def checkJiao(self, handle): jiao1 = self.Jiao(handle, 0, 0) jiao2 = self.Jiao(handle, 7, 0) jiao3 = self.Jiao(handle, 0, 3) jiao4 = self.Jiao(handle, 7, 3) if jiao1 != 0 and jiao2 == 0 and jiao3 == 0 and jiao4 == 0: return 1 pass elif jiao1 == 0 and jiao2 != 0 and jiao3 == 0 and jiao4 == 0: return 2 pass elif jiao1 == 0 and jiao2 == 0 and jiao3 != 0 and jiao4 == 0: return 3 pass elif jiao1 == 0 and jiao2 == 0 and jiao3 == 0 and jiao4 != 0: return 4 pass jiao1 = self.Jiao(handle, 0, 0) jiao2 = self.Jiao(handle, 7, 0) jiao3 = self.Jiao(handle, 0, 3) jiao4 = self.Jiao(handle, 7, 3) if jiao1 != 0 and jiao2 == 0 and jiao3 == 0 and jiao4 == 0: return 1 pass elif jiao1 == 0 and jiao2 != 0 and jiao3 == 0 and jiao4 == 0: return 2 pass elif jiao1 == 0 and jiao2 == 0 and jiao3 != 0 and jiao4 == 0: return 3 pass elif jiao1 == 0 and jiao2 == 0 and jiao3 == 0 and jiao4 != 0: return 4 pass if jiao1 != 0: return 1 pass elif jiao2 != 0: return 2 pass elif jiao3 != 0: return 3 pass elif jiao4 != 0: return 4 pass return 1 # 判断某个位置是否是没打过,是未打过的话,返回0,否则返回非0 def Jiao(self, handle, i, j): name = "temp/checkJiao.bmp" self.savekuai(handle, i, j, name) re, x, y = self.img.find_img_in_img(name, "yys/日轮之城/未打过.bmp") return re def savekuai(self, handle, i, j, name): kuang = int(0.1 * (handle.right - handle.left)) point = [int(self.left * (handle.right - handle.left)) + kuang * (i + 0), int(self.top * (handle.bottom - handle.top)) + kuang * (j + 0)] point2 = [int(self.left * (handle.right - handle.left)) + kuang * (i + 1), int(self.top * (handle.bottom - handle.top)) + kuang * (j + 1)] tag_img = self.img.cut_img_path('temp/temp.bmp', point, point2) self.img.save(name, tag_img) return codedef.NORMAL_END def da(self, handle, i, j): name = "temp/da.bmp" self.savekuai(handle, i, j, name) re, x, y = self.img.find_img_in_img(name, "yys/日轮之城/未打过.bmp") if re != 0: re, x, y = self.img.find_img_in_img(name, "yys/日轮之城/未打过2.bmp") if re == 0: kuang = int(0.1 * (handle.right - handle.left)) point = [int(self.left * (handle.right - handle.left)) + kuang * (i + 0), int(self.top * (handle.bottom - handle.top)) + kuang * (j + 0)] x += handle.left + point[0] y += handle.top + point[1] self.mouse.click(x, y) return codedef.NORMAL_END return codedef.ERROR_END def xunhuan_da(self, handle, arr): name = 0 # 0是刷玉,1是刷层,直接打一排就开眼 if self.mod == 0: ilen = len(arr) else: ilen = 8 while name < ilen: p = arr[name] i = p[1] j = p[0] if self.da(handle, i, j) == codedef.NORMAL_END: time.sleep(1) return codedef.NORMAL_END name += 1 return codedef.ERROR_END
def __init__(self): super(shengxing, self).__init__() # 获取分辨率 self.m = Mouse(GetSystemMetrics(0), GetSystemMetrics(1))
def __init__(self): super(Zabaigui, self).__init__() self.m = Mouse()
class Zabaigui(Game): def __init__(self): super(Zabaigui, self).__init__() self.m = Mouse() def do_work(self, argument, handle): switcher = { SceneKey.NUKOWN: self.error_scene, SceneKey.BAI_GUI_YE_XING: self.this_begin, SceneKey.BAI_GUI_ZHONG: self.this_za, SceneKey.BAI_GUI_QI_YUE_SHU: self.fight_end, SceneKey.BAI_GUI_GUI_WANG: self.xuan_gui_wang } # Get the function from switcher dictionary func = switcher.get(argument, self.father)(argument, handle) # Execute the function return func def father(self, argument, handle): Game.do_work(self, argument, handle) return codedef.NORMAL_END def get_scene(self, handle): window_img = self.window.jie_tu(handle) window_img.save('temp/temp.bmp') path = "yys/scene/" if Game.if_exist(path + "百鬼夜行界面.bmp") == 0: return SceneKey.BAI_GUI_YE_XING if Game.if_exist(path + "百鬼中界面.bmp") == 0: return SceneKey.BAI_GUI_ZHONG if Game.if_exist(path + "百鬼契约书界面.bmp") == 0: return SceneKey.BAI_GUI_QI_YUE_SHU if Game.if_exist(path + "百鬼鬼王界面.bmp") == 0: return SceneKey.BAI_GUI_GUI_WANG return SceneKey.NUKOWN def this_begin(self, argument, handle): if self.click_img("yys/进入百鬼按钮.bmp", handle, 0.98) == 0: time.sleep(1.5) return codedef.NORMAL_END def this_za(self, argument, handle): x = handle.left + int((handle.right - handle.left) * 5 / 6) y = handle.top + int((handle.bottom - handle.top) / 2) self.m.click(x, y) time.sleep(0.2) self.m.click(x, y) time.sleep(0.4) x = handle.left + int((handle.right - handle.left) * 4 / 6) y = handle.top + int((handle.bottom - handle.top) / 2) self.m.click(x, y) time.sleep(0.2) self.m.click(x, y) time.sleep(0.4) x = handle.left + int((handle.right - handle.left) * 3 / 6) y = handle.top + int((handle.bottom - handle.top) / 2) self.m.click(x, y) time.sleep(0.2) self.m.click(x, y) time.sleep(0.4) return codedef.NORMAL_END def xuan_gui_wang(self, argument, handle): x = handle.left + int((handle.right - handle.left) / 2) y = handle.top + int((handle.bottom - handle.top) / 2) self.m.click(x, y) time.sleep(0.2) self.click_img("yys/开始百鬼按钮.bmp", handle, 0.98) return codedef.FIGHT_BEGIN
def tuo(self, src_x, src_y, tar_x, tar_y): m = Mouse(self.metrics_x, self.metrics_y) dx = tar_x - src_x dy = tar_y - src_y x = src_x y = src_y m.mouse_to(x, y) # 鼠标移动到 m.left_down() i = 1 # ddy = int(dy / 10) # while i < 10: # time.sleep(0.03) # m.mouse_to(x, y + ddy * i) # 鼠标移动到 # i += 1 # # i = 1 ddx = int(dx / 6) while i < 6: time.sleep(0.05) m.mouse_to(x + ddx * i, tar_y) # 鼠标移动到 i += 1 time.sleep(0.1) m.mouse_to(tar_x + 3, tar_y) # 鼠标移动到 time.sleep(0.3) m.left_up() # time.sleep(1) # Window.temp_jie_tu(self.handle)# 更新截图 return
def tuo(self, src_x, src_y, tar_x, tar_y): m = Mouse(self.metrics_x, self.metrics_y) dx = tar_x - src_x dy = tar_y - src_y x = src_x y = src_y m.mouse_to(x, y) # 鼠标移动到 m.left_down() i = 1 ddy = int(dy / 10) ddx = int(dx / 10) while i < 10: time.sleep(0.03) m.mouse_to(x + ddx * i, y + ddy * i) # 鼠标移动到 i += 1 time.sleep(0.02) m.mouse_to(tar_x, tar_y) # 鼠标移动到 time.sleep(0.1) m.left_up() time.sleep(1) return
def dian_guai_11(self, handle): x = int((handle.right + handle.left) / 2) xishu = 0.2 y = int((handle.top + (handle.bottom - handle.top) * xishu)) m = Mouse() m.click(x, y)