def com2us_login(self, apk_path): """ :return: """ apk_info = self.info.get_package_and_activity(apk_path) # 初始化活动页面以及登录主页面 login = Base.get_img(r'..\images\login\login.png') login2 = Base.get_img(r'..\images\login\login2.png') # 打开app driver = Base(self.cap) driver.open_app(*apk_info) driver.implicitly_wait(50) # 第一次截图 template = Base.get_screen() Base.get_rand_time(3, 4) # 每30截一次图,直到进入登入界面,停止截图 while Base.match(login, template) < 0.9: template = Base.get_screen() Base.get_rand_time(10, 20) print(Base.match(login2, template)) if Base.match(login2, template) < 0.9: continue else: print('开始关闭活动页面') click = Base.get_rand_xy(self.login_activity_x, self.login_activity_y) Base.click(*click) Base.get_rand_time(1, 2) Base.click(*Base.get_rand_xy([460, 470], [430, 460])) print('进入主界面') print('关闭邮箱') Base.get_rand_time(1, 2) Base.click(*Base.get_rand_xy(self.mail_x, self.mail_y)) print('关闭限时优惠') Base.get_rand_time(1, 2) Base.click(*Base.get_rand_xy(self.price_x, self.price_y))
def underworld(self): template = Base.get_screen() img = Base.get_img(r'..\images\login\fight.png') while Base.match(img, template) < 0.9: Base.get_rand_time(2, 3) Base.get_screen() Base.click(*Base.get_rand_xy(self.fight_x, self.fight_y)) pass
def experiences(): """ 刷火山口 :return: """ sets = Settings('experience') img = cv2.imread(r'images\\login\\again2.png') times = 1 max_times = 50 while True: print('——————第 %d 次 经验副本 自动开始——————' % times) # 传入截图 Base.get_rand_time(2, 4) template = Base.get_screen() if Base.match(img, template) > 0.9: # 再来一次坐标 again = Base.get_rand_xy(sets.again_x, sets.again_y) # 点击再来一次 Base.click(*again) Base.get_rand_time(60, 80) # 点击遮罩 Base.click(*Base.get_rand_xy(sets.start_x, sets.start_y)) Base.get_rand_time(2, 4) # 点击箱子 Base.click(*Base.get_rand_xy([450, 490], [320, 340])) Base.get_rand_time(2, 4) # 点击确认按钮 Base.click(*Base.get_rand_xy([440, 520], [430, 470])) Base.get_rand_time(2, 4) # 出售符文 Base.click(*Base.get_rand_xy([350, 440], [420, 450])) Base.get_rand_time(2, 4) # 确认出售符文 Base.click(*Base.get_rand_xy([340, 440], [310, 340])) Base.get_rand_time(2, 4) # 活动硬币点击 Base.click(*Base.get_rand_xy(sets.activity_x, sets.activity_y)) times += 1 else: Base.get_rand_time(20, 30) # 点击遮罩 Base.click(*Base.get_rand_xy(sets.start_x, sets.start_y)) Base.get_rand_time(2, 4) # 点击箱子 Base.click(*Base.get_rand_xy([450, 490], [320, 340])) Base.get_rand_time(2, 4) # 点击确认按钮 Base.click(*Base.get_rand_xy([440, 520], [430, 470])) Base.get_rand_time(2, 4) # 出售符文 Base.click(*Base.get_rand_xy([350, 440], [420, 450])) Base.get_rand_time(2, 4) # 确认出售符文 Base.click(*Base.get_rand_xy([340, 440], [310, 340])) Base.get_rand_time(2, 4) # 活动硬币点击 Base.click(*Base.get_rand_xy(sets.activity_x, sets.activity_y)) times += 1 print('——————第 %d 次自动结束——————' % (times - 1)) if times > max_times: break