def start(self): '''单人探索主循环''' mood1 = ut.Mood(2) mood2 = ut.Mood(3) while True: # 点击挑战按钮 if self.yys.find_game_img('img\\TAN-SUO.png'): self.click_until('探索按钮', 'img\\YING-BING.png', *TansuoPos.tansuo_btn, mood1.get1mood()/1000) else: self.click_until('最后章节', 'img\\TAN-SUO.png', *TansuoPos.last_chapter, mood1.get1mood()/1000) self.click_until('探索按钮', 'img\\YING-BING.png', *TansuoPos.tansuo_btn, mood1.get1mood()/1000) # 开始打怪 i = 0 while i < 4: result = self.fight_moster(mood1, mood2) if result: continue else: self.log.writeinfo('移动至下一个场景') self.next_scene() i += 1 # 退出探索 if self.yys.find_game_img('img\\YING-BING.png'): while True: self.yys.mouse_click_bg(*TansuoPos.quit_btn) if self.yys.wait_game_img('img\\QUE-REN.png', 3, False): break self.yys.mouse_click_bg(*TansuoPos.confirm_btn) self.log.writeinfo('结束本轮探索')
def start(self): '''单人战斗主循环''' mood1 = ut.Mood() mood2 = ut.Mood() mood3 = ut.Mood(3) while self.run: # 在御魂主选单,点击“挑战”按钮, 需要使用“阵容锁定”! self.yys.wait_game_img('img\\TIAO-ZHAN.png', self.max_win_time) mood1.moodsleep() self.yys.mouse_click_bg(*YuhunPos.tiaozhan_btn) self.log.writeinfo('点击 挑战按钮') # 检测是否进入战斗 self.check_battle() # 在战斗中,标记己方式神 self.mitama_team_click() # 在战斗中,自动点怪 self.click_monster() # 检测是否打完 self.check_end() mood2.moodsleep() # 在战斗结算页面 self.yys.mouse_click_bg(ut.firstposition()) self.click_until('结算', 'img\\TIAO-ZHAN.png', *CommonPos.second_position, mood3.get1mood() / 1000) self.log.writeinfo("回到选择界面")
def start(self): '''单人探索主循环''' mood1 = ut.Mood(2) mood2 = ut.Mood(3) while self.run: # 进入探索内 self.switch_to_scene(4) # 开始打怪,随机一次回拉 back = random.randint(1, 5) i = 0 while i < 6 and self.run: result = self.fight_moster(mood1, mood2) if result == 1: continue elif result == 2: break elif i == back: self.log.writeinfo('回拉一次') self.last_scene() i += 1 else: self.log.writeinfo('移动至下一个场景') self.next_scene() i += 1 # 退出探索 self.switch_to_scene(3) self.log.writeinfo('结束本轮探索') time.sleep(random.randint(500, 1500) / 1000)
def start(self): '''单人战斗主循环''' mood1 = ut.Mood() mood2 = ut.Mood() mood3 = ut.Mood(3) while True: # 在御魂主选单,点击“挑战”按钮, 需要使用“阵容锁定”! self.yys.wait_game_img('img\\TIAO-ZHAN.png', self.max_win_time) mood1.moodsleep() self.yys.mouse_click_bg(*YuhunPos.tiaozhan_btn) self.log.writeinfo('Already clicked TIAO-ZHAN') # 检测是否进入战斗 self.check_battle() # 在战斗中,自动点怪 self.click_monster() # 检测是否打完 self.check_end() mood2.moodsleep() # 在战斗结算页面 self.yys.mouse_click_bg(ut.firstposition()) self.click_until('结算', 'img\\TIAO-ZHAN.png', *CommonPos.second_position, mood3.get1mood()/1000) self.log.writeinfo("Back to YUHUN level selection")
def start(self): '''单人战斗主循环''' mood1 = ut.Mood() mood2 = ut.Mood() mood3 = ut.Mood(3) while self.run: # 在御魂主选单,点击“挑战”按钮, 需要使用“阵容锁定”! self.yys.wait_game_img('img\\TIAO-ZHAN_YL.png', self.max_win_time) mood1.moodsleep() self.yys.mouse_click_bg(*YuhunPos.tiaozhan_btn) logging.info('点击 挑战按钮') # 检测是否进入战斗 self.check_battle() # 在战斗中,自动点怪 self.click_monster() # 检测是否打完 logging.info(self.name + '检测是战斗是否结束') self.yys.wait_game_img('img\\JIN-BI.png', self.max_win_time) logging.info(self.name + "战斗结束") mood2.moodsleep() # 在战斗结算页面 self.click_until('结算', 'img\\TIAO-ZHAN_YL.png', *CommonPos.second_position, mood3.get1mood() / 1000) logging.info("回到选择界面")
def start(self): '''单人战斗主循环''' mood1 = ut.Mood() mood2 = ut.Mood() mood3 = ut.Mood(3) while self.run: # 在御魂主选单,点击“挑战”按钮, 需要使用“阵容锁定”! self.yys.wait_game_img_knn('img\\TIAO-ZHAN.png', self.max_win_time, thread=20) mood1.moodsleep() self.click_until_knn('挑战按钮', 'img\\TIAO-ZHAN.png', *YuhunPos.tiaozhan_btn, appear=False, thread=20) # 检测是否进入战斗 self.check_battle() # 在战斗中,自动点怪 self.click_monster() # 检测是否打完 state = self.check_end() mood2.moodsleep() # 在战斗结算页面 self.get_reward(mood3, state) logging.info("回到选择界面") # 检查游戏次数 self.check_times()
def start(self): '''单人探索主循环''' mood1 = ut.Mood(3) mood2 = ut.Mood(3) while self.run: # 进入探索内 self.switch_to_scene(4) # 开始打怪 i = 0 while self.run: if i >= 4: break result = self.fight_moster(mood1, mood2) if result == 1: continue elif result == 2: break else: self.log.info('移动至下一个场景') self.next_scene() i += 1 # 退出探索 self.switch_to_scene(3) self.log.info('结束本轮探索') time.sleep(0.5) # 检查游戏次数 self.check_times()
def start(self): '''单人探索主循环''' mood1 = ut.Mood(2) mood2 = ut.Mood(3) while self.run: # 最大任务数小于等于0就不进行下一轮了 if self.max_tasks <= 0: self.log.writewarning("探索任务结束") break # 进行结界突破分支任务 self.tupo_branch() # 进入探索内 self.switch_to_scene(4) # 开始打怪 i = 0 while i < 4 and self.run: result = self.fight_moster(mood1, mood2) if result == 1: continue elif result == 2: time.sleep(random.randint(2, 3)) # 打完boss就算完成任务一次 self.max_tasks -= 1 break else: self.log.writeinfo('移动至下一个场景') self.next_scene() i += 1 # 退出探索 self.switch_to_scene(3) self.log.writeinfo('结束本轮探索') time.sleep(random.randint(500, 1500) / 1000)
def start(self): '''单人战斗主循环''' mood1 = ut.Mood() mood2 = ut.Mood() mood3 = ut.Mood(3) while self.run: # 在御魂主选单,点击“挑战”按钮, 需要使用“阵容锁定”! self.yys.wait_game_img('img\\TIAO-ZHAN.png', self.max_win_time) mood1.moodsleep() self.yys.mouse_click_bg(*YuhunPos.tiaozhan_btn) self.log.writeinfo('点击 挑战按钮') # 检测是否进入战斗 self.check_battle() # 在战斗中,自动点怪 self.click_monster() # 已经进入战斗,乘客自动点式神 if self.click_partner_enable: self.click_until('标记式神', 'IMG\\GREEN-JIAN-TOU.png', *CommonPos.left_partner_position, mood3.get1mood() / 1000) # 检测是否打完 self.check_end() mood2.moodsleep() # 在战斗结算页面 self.yys.mouse_click_bg(ut.firstposition()) self.click_until('结算', 'img\\TIAO-ZHAN.png', *CommonPos.second_position, mood3.get1mood() / 1000) self.log.writeinfo("回到御魂选择界面")
def start(self): '''单人御魂乘客''' # 设定点击疲劳度 mood2 = ut.Mood() mood3 = ut.Mood(3) # 战斗主循环 while self.run: # 检测是否进入战斗 self.check_battle() # 已经进入战斗,乘客自动点怪 self.click_monster() # 已经进入战斗,乘客自动点式神 if self.click_partner_enable: self.click_until('标记式神', 'IMG\\GREEN-JIAN-TOU.png', *CommonPos.left_partner_position, mood3.get1mood() / 1000) # 检测是否打完 self.check_end() mood2.moodsleep() # 在战斗结算页面 self.yys.mouse_click_bg(ut.firstposition()) self.click_until('结算1', 'img\\JIN-BI.png', *CommonPos.first_position, mood3.get1mood() / 1000) self.click_until('结算2', 'img\\JIN-BI.png', *CommonPos.second_position, mood3.get1mood() / 1000, False) # 等待下一轮 logging.info('Passenger: 等待下一轮') start_time = time.time() while time.time() - start_time <= 20 and self.run: # 检测是否回到队伍中 if (self.yys.wait_game_img('img\\XIE-ZHAN-DUI-WU.png', 1, False)): self.log.writeinfo('Passenger: 进入队伍') break # 检测是否有御魂邀请 yuhun_loc = self.yys.wait_game_img('img\\YU-HUN.png', 0.1, False) if yuhun_loc: # 点击自动接受邀请 if self.yys.find_game_img('img\\ZI-DONG-JIE-SHOU.png'): self.yys.mouse_click_bg((210, yuhun_loc[1])) self.log.writeinfo('Passenger: 自动接受邀请') # 点击普通接受邀请 elif self.yys.find_game_img('img\\JIE-SHOU.png'): self.yys.mouse_click_bg((125, yuhun_loc[1])) self.log.writeinfo('Passenger: 接受邀请')
def start(self): '''单人御魂司机''' # 设定点击疲劳度 mood1 = ut.Mood() mood2 = ut.Mood() mood3 = ut.Mood(3) # 战斗主循环 self.yys.wait_game_img('img\\KAI-SHI-ZHAN-DOU.png', self.max_win_time) while self.run: # 司机点击开始战斗,需要锁定御魂阵容 mood1.moodsleep() self.log.writeinfo('Driver: 点击开始战斗按钮') self.click_until('开始战斗按钮', 'img\\ZI-DONG.png', * YuhunPos.kaishizhandou_btn, mood2.get1mood()/1000) self.log.writeinfo('Driver: 已进入战斗') # 已经进入战斗,司机自动点怪 self.click_monster() if self.click_partner: # 已经进入战斗,乘客自动点式神 if self.mitama_click_partner_left: self.click_until('标记左边式神', 'IMG\\GREEN-JIAN-TOU.png', *CommonPos.left_partner_position, mood3.get1mood() / 1000) if self.mitama_click_partner_right: self.click_until('标记右边式神', 'IMG\\GREEN-JIAN-TOU.png', *CommonPos.right_partner_position, mood3.get1mood() / 1000) # 检测是否打完 self.check_end() mood2.moodsleep() # 在战斗结算页面 self.yys.mouse_click_bg(ut.firstposition()) self.click_until('结算1', 'img\\JIN-BI.png', *CommonPos.second_position, mood3.get1mood()/1000) self.click_until('结算2', 'img\\JIN-BI.png', *CommonPos.second_position, mood3.get1mood()/1000, False) # 等待下一轮 logging.info('Driver: 等待下一轮') start_time = time.time() while time.time() - start_time <= 20 and self.run: if(self.yys.wait_game_img('img\\KAI-SHI-ZHAN-DOU.png', 1, False)): self.log.writeinfo('Driver: 进入队伍') break # todo,这里有点不准,有时间了再改 # 点击默认邀请 if self.yys.find_game_img('img\\ZI-DONG-YAO-QING.png'): self.yys.mouse_click_bg((497, 319)) time.sleep(0.2) self.yys.mouse_click_bg((674, 384)) self.log.writeinfo('Driver: 自动邀请')
def start(self): '''单人御魂司机''' # 设定点击疲劳度 mood1 = ut.Mood() mood2 = ut.Mood() mood3 = ut.Mood(3) # 战斗主循环 self.yys.wait_game_color_three( ((565, 220), (575, 230)), ((960, 220), (970, 230)), (255, 255, 255), 0, self.max_win_time, True) while self.run: # 司机点击开始战斗,需要锁定御魂阵容 mood1.moodsleep() self.log.info('Driver: 点击开始战斗按钮') self.click_until('开始战斗按钮', 'img\\KAI-SHI-ZHAN-DOU.png', *YuhunPos.kaishizhandou_btn, mood2.get1mood() / 1000, False) # 检测是否进入战斗 self.check_battle() # 在战斗中,标记己方式神 self.mitama_team_click() # 已经进入战斗,司机自动点怪 self.click_monster() # 检测是否打完 state = self.check_end() mood2.moodsleep() # 在战斗结算页面 self.get_reward(mood3, state) # 等待下一轮 self.log.info('Driver: 等待下一轮') start_time = time.time() while time.time() - start_time <= 20 and self.run: if (self.yys.wait_game_color_three( ((565, 220), (575, 230)), ((960, 220), (970, 230)), (255, 255, 255), 0, 1, False)): self.log.info('Driver: 进入队伍') break # 点击默认邀请 if self.yys.find_game_img('img\\ZI-DONG-YAO-QING.png'): self.yys.mouse_click_bg((497, 319)) time.sleep(0.2) self.yys.mouse_click_bg((674, 384)) self.log.info('Driver: 自动邀请') # 检查游戏次数 self.check_times()
def start(self): '''单人御魂司机''' # 设定点击疲劳度 mood1 = ut.Mood() mood2 = ut.Mood() mood3 = ut.Mood(3) mood4 = ut.Mood(2) # 战斗主循环 self.yys.wait_game_img('img\\KAI-SHI-ZHAN-DOU.png', self.max_win_time) while self.run: # 司机点击开始战斗,需要锁定御魂阵容 mood4.moodsleep() self.log.writeinfo('Driver: 点击开始战斗按钮') self.click_until('开始战斗按钮', 'img\\ZI-DONG.png', * YuhunPos.kaishizhandou_btn, mood2.get1mood()/1000) self.log.writeinfo('Driver: 已进入战斗') # 已经进入战斗,司机自动点怪 self.click_monster() # 标记己方式神 self.click_team() time.sleep(10) # 检测是否打完 self.check_end() mood2.moodsleep() # 在战斗结算页面 self.yys.mouse_click_bg(ut.firstposition()) self.click_until('结算', 'img/JIN-BI.png', *CommonPos.second_position, mood3.get1mood()/1000) self.click_until('结算', 'img/JIN-BI.png', *CommonPos.second_position, mood3.get1mood()/1000, False) # 等待下一轮 logging.info('Driver: 等待下一轮') start_time = time.time() while time.time() - start_time <= 20 and self.run: if(self.yys.wait_game_img('img\\KAI-SHI-ZHAN-DOU.png', 1, False)): self.log.writeinfo('Driver: 进入队伍') break # 点击默认邀请 if self.yys.find_game_img('img\\ZI-DONG-YAO-QING.png'): self.yys.mouse_click_bg((497, 319)) time.sleep(0.2) self.yys.mouse_click_bg((674, 384)) self.log.writeinfo('Driver: 自动邀请')
def start(self): '''单人御魂乘客''' # 设定点击疲劳度 mood2 = ut.Mood() mood3 = ut.Mood(3) # 战斗主循环 while self.run: # 检测是否进入战斗 self.check_battle() # 在战斗中,标记己方式神 self.mitama_team_click() # 已经进入战斗,乘客自动点怪 self.click_monster() # 检测是否打完 state = self.check_end() mood2.moodsleep() # 在战斗结算页面 self.get_reward(mood3, state) # 等待下一轮 logging.info('Passenger: 等待下一轮') start_time = time.time() while time.time() - start_time <= 20 and self.run: # 检测是否回到队伍中 if (self.yys.wait_game_img('img\\XIE-ZHAN-DUI-WU.png', 1, False)): self.log.writeinfo('Passenger: 进入队伍') break # 检测是否有御魂邀请 yuhun_loc = self.yys.wait_game_img('img\\YU-HUN.png', 0.1, False) if yuhun_loc: # 点击自动接受邀请 if self.yys.find_game_img('img\\ZI-DONG-JIE-SHOU.png'): self.yys.mouse_click_bg((210, yuhun_loc[1])) self.log.writeinfo('Passenger: 自动接受邀请') # 点击普通接受邀请 elif self.yys.find_game_img('img\\JIE-SHOU.png'): self.yys.mouse_click_bg((125, yuhun_loc[1])) self.log.writeinfo('Passenger: 接受邀请') # 检查游戏次数 self.check_times()
def start(self): # 设定点击疲劳度 mood2 = ut.Mood(2) # 战斗主循环 while self.run: # 检测是否在百鬼页面 self.check_ghost() # 点击进入,直到进入鬼王选择页面 self.click_until('进入按钮', 'img\\JIN-RU.png', *GhostPos.jinru_btn, mood2.get1mood() / 1000, False) # 选中鬼王 self.choose_king() # 点击开始,进入砸百鬼页面 self.click_until('开始按钮', 'img\\KAI-SHI.png', *GhostPos.start_btn, mood2.get1mood() / 1000, False) # 开始动画比较久,多等待一会 time.sleep(random.randint(3, 5)) # 砸百鬼 self.fighting(mood2)
def start(self): # 设定点击疲劳度 mood = ut.Mood(3) # 战斗主循环 while self.run: # 检测是否在结界突破页面 self.check_breakthrough() # 成功突破次数 victories = 0 # 循环突破9次,直到满足成功次数或循环结束 for i in range(9): if victories >= 3: self.log.writeinfo('成功突破:' + str(victories) + '次,等待新的一轮') break result = self.fighting(BreakthroughPos.target_position[i], mood) if not result: self.log.writewarning("强制退出脚本") sys.exit(0) if result == 1: victories += 1 self.log.writewarning("当前挑战次数->" + str(i + 1) + ",当前成功突破次数->" + str(victories)) # 刷新页面 self.refresh()
def start(self): # 设定点击疲劳度 mood = ut.Mood(3) # 每次拖拽刷新页面,会产生与目标位置不同的偏移量 offset = 0 # 战斗主循环 while self.run: # 检测是否在结界突破页面 self.check_breakthrough() offset_position = self.offset_move(offset) # 循环突破4次,直到满足成功次数或循环结束 # 为什么只挑战4组呢? 因为最下面四组进攻按钮的位置有可能到上方来了 i = 0 while i < 4: # 突破目标 result = self.fighting(offset_position[i], mood) if not result: self.log.writewarning("强制退出脚本") sys.exit(0) # 只有突破失败才会换下一个目标,成功的话还在这个位置继续突破 if result == 2: self.log.writewarning("目标突破失败,切换下一个") i += 1 self.log.writewarning("任务完成,刷新下一页") offset = self.drag_refresh(offset, mood)
def check_result(self): """ 检测游戏结果 : return 1 战斗失败 2 战斗胜利 -1 超时 """ mode1 = ut.Mood(1) # 检测是否打完 self.log.writeinfo(self.name + '检测是战斗是否结束') start_time = time.time() while time.time() - start_time <= 500 and self.run: maxVal, maxLoc = self.yys.find_multi_img('img/YIN-BI.png', 'img/SHI-BAI.png', 'img/SHENG-LI.png') yingVal, shibaiVal, shengliVal = maxVal # print(maxVal) if shibaiVal > 0.97: self.log.writeinfo(self.name + "战斗结束: 失败") return 1 if yingVal > 0.97: self.log.writeinfo(self.name + "战斗结束: 胜利") return 2 if shengliVal > 0.97: self.click_until('第一次结算', 'img/YIN-BI.png', ut.threeposition(), None, mode1.get1mood() / 1000) # mode1.moodsleep() # self.yys.mouse_click_bg(ut.threeposition()) continue time.sleep(0.2) return -1
def start(self): '''单人御魂乘客''' # 设定点击疲劳度 mood2 = ut.Mood() mood3 = ut.Mood(3) # 战斗主循环 while self.run: # 检测是否进入战斗 self.check_battle() # 已经进入战斗,乘客自动点怪 self.click_monster() # 检测是否打完 self.check_end() mood2.moodsleep() # 在战斗结算页面 self.yys.mouse_click_bg(ut.firstposition()) start_time = time.time() while time.time() - start_time <= 20 and self.run: # 检测是否回到队伍中 if (self.yys.wait_game_img('img\\XIE-ZHAN-DUI-WU.png', mood3.get1mood() / 1000, False)): self.log.writeinfo('Passenger: 进入队伍') break # 点击结算,直到回到主界面 if not (self.yys.find_game_img('img\\MESSAGE.png') or self.yys.find_game_img('img\\JIA-CHENG.png')): self.yys.mouse_click_bg(*CommonPos.second_position) self.log.writeinfo('Passenger: 点击结算') # 检测是否有御魂邀请 yuhun_loc = self.yys.wait_game_img('img\\YU-HUN.png', 0.1, False) if yuhun_loc: # 点击自动接受邀请 if self.yys.find_game_img('img\\ZI-DONG-JIE-SHOU.png'): self.yys.mouse_click_bg((210, yuhun_loc[1])) self.log.writeinfo('Passenger: 自动接受邀请') # 点击普通接受邀请 elif self.yys.find_game_img('img\\JIE-SHOU.png'): self.yys.mouse_click_bg((125, yuhun_loc[1])) self.log.writeinfo('Passenger: 接受邀请')
def start(self): ''' 开始战斗 ''' mood = ut.Mood(3) scene = self.get_scene() if scene == 4: logging.info('Passenger: 已进入探索,就绪') else: logging.warning('Passenger: 请检查是否进入探索内,退出') return while self.run: # 检测当前场景 maxVal_list, maxLoc_list = self.yys.find_multi_img( 'img/DUI.png', 'img/YING-BING.png') # print(maxVal_list) if maxVal_list[0] < 0.8 and maxVal_list[1] > 0.8: # 队长退出,则跟着退出 logging.info('Passenger: 队长已退出,跟随退出') self.switch_to_scene(3) # 等待邀请 js_loc = self.yys.wait_game_img('img/JIE-SHOU.png', self.max_win_time) if js_loc: # 点击接受邀请 if self.yys.find_game_img('img/JIE-SHOU.png'): self.yys.mouse_click_bg( (js_loc[0] + 33, js_loc[1] + 34)) self.log.writeinfo('Passenger: 接受邀请') # 检查游戏次数 self.check_times() elif maxVal_list[0] > 0.8 and maxVal_list[1] < 0.8: # 进入战斗,等待式神准备 self.yys.wait_game_img_knn('img/ZHUN-BEI.png', thread=30) logging.info('Passenger: 式神准备完成') # 检查狗粮经验 self.check_exp_full() # 点击准备,直到进入战斗 self.click_until_knn('准备按钮', 'img/ZI-DONG.png', *TansuoPos.ready_btn, mood.get1mood() / 1000, False, 30) # 检测是否打完 state = self.check_end() mood.moodsleep() # 点击结算 self.get_reward(mood, state) else: # 其他,不做任何操作 time.sleep(0.5)
def start(self): '''单人战斗主循环''' mood1 = ut.Mood() mood2 = ut.Mood() mood3 = ut.Mood(3) while self.run: # 最大任务数小于等于0就不进行下一轮了 if self.max_tasks <= 0: self.log.writewarning("御魂任务结束") break # 在御魂主选单,点击“挑战”按钮, 需要使用“阵容锁定”! self.yys.wait_game_img('img\\TIAO-ZHAN.png', self.max_win_time) mood1.moodsleep() self.click_until('挑战按钮', 'img\\TIAO-ZHAN.png', *YuhunPos.tiaozhan_btn, appear=False) # 检测是否进入战斗 self.check_battle() # 在战斗中,自动点怪 self.click_monster() # 已经进入战斗,乘客自动点式神 if self.mitama_click_partner_left: self.click_until('标记左边式神', 'IMG\\GREEN-JIAN-TOU.png', *CommonPos.left_partner_position, mood3.get1mood() / 1000) if self.mitama_click_partner_right: self.click_until('标记右边式神', 'IMG\\GREEN-JIAN-TOU.png', *CommonPos.right_partner_position, mood3.get1mood() / 1000) # 检测是否打完 self.check_end() mood2.moodsleep() # 在战斗结算页面 self.yys.mouse_click_bg(ut.firstposition()) self.click_until('结算', 'img\\TIAO-ZHAN.png', *CommonPos.second_position, mood3.get1mood() / 1000) self.log.writeinfo("回到御魂选择界面") self.max_tasks -= 1
def start(self): '''单人战斗主循环''' mood1 = ut.Mood() mood2 = ut.Mood() mood3 = ut.Mood(3) if self.run_submode == 0: self.switch_to_scene(6) elif self.run_submode == 1: self.switch_to_scene(7) elif self.run_submode == 2: self.switch_to_scene(8) while self.run: # 在御魂主选单,点击“挑战”按钮, 需要使用“阵容锁定”! self.yys.wait_game_img_knn('img\\TIAO-ZHAN.png', max_time=self.max_win_time, thread=20) mood1.moodsleep() self.click_until_knn('挑战按钮', 'img\\TIAO-ZHAN.png', *YuhunPos.tiaozhan_btn, appear=False, thread=20) # 检测是否进入战斗 self.check_battle() # 在战斗中,标记己方式神 self.mitama_team_click() # 在战斗中,自动点怪 self.click_monster() # 检测是否打完 state = self.check_end() mood2.moodsleep() # 在战斗结算页面 self.get_reward(mood3, state) self.log.writeinfo("回到选择界面") # 检查游戏次数 self.check_times()
def start(self): '''单人战斗主循环''' mood1 = ut.Mood() mood2 = ut.Mood() mood3 = ut.Mood(3) while self.run: # 检测上一步是否结算成功,防止因跳蛋打开一瞬间没有检测到而引发的异常 maxVal, maxLoc = self.yys.find_multi_img('img/SHENG-LI.png', 'img/TIAO-DAN.png', 'img/JIN-BI.png', 'img/JIE-SU.png') if max(maxVal) > 0.9: self.get_reward(mood3, 1) # 在御魂主选单,点击“挑战”按钮, 需要使用“阵容锁定”! self.yys.wait_game_img_knn('img\\TIAO-ZHAN.png', self.max_win_time, thread=20) mood1.moodsleep() self.click_until_knn('挑战按钮', 'img\\TIAO-ZHAN.png', *YuhunPos.tiaozhan_btn, appear=False, thread=20) # 检测是否进入战斗 self.check_battle() # 在战斗中,自动点怪 self.click_monster() # 检测是否打完 state = self.check_end() mood2.moodsleep() # 在战斗结算页面 self.get_reward(mood3, state) logging.info("回到选择界面") # 检查游戏次数 self.check_times()
def start(self): """ 开始执行 """ mood1 = ut.Mood(1) # 进入脚本循环 while self.run: logging.info(self.name + "正在检测当前场景") self.check_quit_game() # 开始检测当前战斗情况 is_start, is_team, is_tansuo, is_juexing, is_yaoqing = self.check_now_scene() print('passenger', is_start, is_team, is_juexing, is_yaoqing) if is_tansuo: self.unlock_team() if is_juexing: # 等待接受邀请 if not self.yys.wait_game_img('img/JIE-SHOU.png', 100, False): continue # 接受邀請 self.click_until('接受探索邀请', 'img/JIE-SHOU.png', *TansuoPos.jie_shou_btn, 0.4, False) if not is_start and not is_team and is_tansuo: # 检查boss if self.yys.find_game_img('img/BOSS.png'): return loc = self.yys.find_game_img('img/TAN-JIANG-LI.png') if loc: # 检查奖励 self.quit_tansuo() else: if self.yys.find_img('img/FIGHT.png'): # 队伍解散 退出副本 self.quit_tansuo() # 退出本次循环 continue if is_start: print('passenger 正在战斗') self.wait_game_end()
def check_quit_game(self): if self.quit_time > 0: if time.time() - self.run_time > self.quit_time: # 切换到庭院 is_home = False while not is_home: maxVal, maxLoc = self.yys.find_img('img/JIA-CHENG.png') print("加成", maxVal) if maxVal > 0.9: is_home = True continue # 检查关闭 if self.yys.mouse_click_img('img/close.png'): time.sleep(0.3) # 检查返回 if self.yys.mouse_click_img('img/back.png'): time.sleep(0.5) # 检查确认 if self.yys.mouse_click_img('img/que-ding.png'): time.sleep(0.3) # 关闭加成 is_jiacheng = True self.click_until('加成', 'img/yu-hun-jia-cheng.png', *CommonPos.jia_cheng_btn, 0.3) while is_jiacheng: pos = self.yys.find_many_game_img('img/on-jia-cheng.png') print(pos) if len(pos) <= 0: is_jiacheng = False else: for item in pos: pos1 = (item[0] + 8, item[1] + 3) pos2 = (item[0] + 60, item[1] + 15) print(pos1, pos2) self.yys.mouse_click_bg(pos1, pos2) mood1 = ut.Mood(1) mood1.moodsleep() self.yys.quit_true_game()
def start(self): # 设定点击疲劳度 mood = ut.Mood(3) # 战斗主循环 while self.run: # 最大任务数小于3就不进行下一轮了 if self.max_tasks < 3: self.log.warning("突破任务结束") break # 检测是否在结界突破页面 self.check_breakthrough() # 秒退一次,为了保持当前突破等级 self.fight_and_quit(BreakthroughPos.target_position[8], mood) # 成功突破次数 victories = 0 # 循环突破9次,直到满足成功次数或循环结束 for i in range(9): if not self.run: break if victories >= 3: self.log.info('成功突破:' + str(victories) + '次,等待新的一轮') break result = self.fighting(BreakthroughPos.target_position[i], mood) if not result: self.log.warning("强制退出脚本") sys.exit(0) if result == 1: victories += 1 self.max_tasks -= 1 self.log.warning("当前挑战次数->" + str(i + 1) + ",当前成功突破次数->" + str(victories)) # 刷新页面 self.refresh()
def start_fight(self, pos): """ 进攻结界 :return pos 挑战失败的位置 """ mood2 = ut.Mood() # 挑战失败的结界 fail_pos = [] # 挑战成功的个数 success_num = 9 - len(pos) is_tiaozhan = True # 开始循环点击 for item in pos: # 开始挑战 pos = item[0] pos_end = item[1] start_time = time.time() # 点击 is_end = False while time.time() - start_time <= 20 and self.run and not is_end: result = self.yys.find_game_img('img/JIN-GONG.png', 0, None, None, 0, 0.94) if result: self.log.writeinfo(self.name + '选择突破对象成功') # 开始进攻 jin_gong_pos = (result[0] + 10, result[1] + 10), (result[0] + 110, result[1] + 50) jin_gong = self.click_until('开始进攻', 'img/ZHUN-BEI.png', *jin_gong_pos, 0.7) if not jin_gong: # 进攻失败,结界突破券不足 self.log.writeinfo(self.name + '结界突破券不足') os.system('pause') return fail_pos self.yys.wait_game_img('img/ZHUN-BEI.png') self.yys.mouse_click_bg(*CommonPos.zhunbei_btn) # 准备 self.click_until_multi('准备', 'img\\ZI-DONG.png', 'img/SHOU-DONG.png', pos=CommonPos.zhunbei_btn[0], pos_end=CommonPos.zhunbei_btn[1], sleep_time=0.8) if self.auto_fight: # 标记式神 self.click_team(2) time.sleep(5) else: self.fight_way() # 检测游戏结果 res = self.check_result() # print(res) if res == -1: # 超时退出游戏 self.yys.quit_game() if res == 1: # 战斗失败 fail_pos.append((pos, pos_end)) if res == 2: success_num += 1 # 对比奖励个数,是否进行继续挑战 max_jingong = 9 fail_num = len(fail_pos) if fail_num > 0 and fail_num <= 3: max_jingong = 6 elif fail_num > 3 and fail_num <= 6: max_jingong = 3 elif fail_num <= 0: max_jingong = 9 else: max_jingong = 0 if success_num >= max_jingong: is_tiaozhan = False print("计算次数", max_jingong, is_tiaozhan) # 手动结算 self.yys.mouse_click_bg(ut.threeposition()) # self.click_until('结算', 'img/JIE-JIE-TU-PO.png', ut.threeposition(), None) # time.sleep(0.5) print("点击过了") # 等待下一轮 if success_num == 3 or success_num == 6 or success_num == 9: self.yys.mouse_click_bg(ut.threeposition()) time.sleep(0.8) self.log.writeinfo(self.name + '回到结界突破页面') is_end = True else: # 点击指定位置并等待下一轮 self.yys.mouse_click_bg(pos, pos_end) self.log.writeinfo(self.name + '点击 选择突破对象') time.sleep(0.6) return fail_pos
def start(self): '''单人御魂司机''' # 设定点击疲劳度 mood1 = ut.Mood() mood2 = ut.Mood() mood3 = ut.Mood(3) # 战斗主循环 self.yys.wait_game_img('img\\KAI-SHI-ZHAN-DOU.png', self.max_win_time) while self.run: # 司机点击开始战斗,需要锁定御魂阵容 mood1.moodsleep() if self.passengerNum == 2: self.log.writeinfo('Driver: 等待1位乘客上车') self.click_until('开始战斗按钮', 'img\\ZI-DONG.png', * YuhunPos.TiaoZhanBtn, mood2.get1mood() / 1000) self.log.writeinfo('Driver: 已进入战斗') elif self.passengerNum == 3: self.log.writeinfo('Driver: 等待2位乘客上车') # if self.firstClickTiaoZhan is True: # print('第一次挑战') # time.sleep(1) # self.firstClickTiaoZhan = False # self.yys.mouse_click_bg(*YuhunPos.TiaoZhanBtn) # else: self.yys.wait_game_img('img\\JIA-CHENG.png') # print('加成按钮已经出现') self.yys.mouse_click_bg(*YuhunPos.TiaoZhanBtn) # self.click_until('开始战斗按钮', 'img\\DUI-YOU-JIA-HAO.png', * # YuhunPos.TiaoZhanBtn, mood2.get1mood() / 1000, appear=False) # print('点击挑战按钮成功') # logging.info('御魂司机的needmark为{}'.format(self.needMark)) if self.needMark is True: # todo 点击大舅妈 logging.info('等待点击大舅妈,坐标{}'.format(self.ShiShenPos)) self.log.writeinfo('Driver: 等待点击式神') # self.click_once_if_appear('点击式神','img\\YI-HUI-MU.png', # *YuhunPos.大舅妈位置,mood2.get1mood() / 1000) self.yys.wait_game_img('img\\YI-HUI-MU.png') self.click_once_if_appear('式神','img\\YI-HUI-MU.png',self.ShiShenPos,None,1,True) # self.click_until('式神', 'img\\ZHUN-BEI.png', # self.ShiShenPos, pos_end=None, step_time=mood2.get1mood() / 1000,appear=False) # 检测是否打完 self.check_end() mood2.moodsleep() # 在战斗结算页面 self.click_until('结算', 'img/JIN-BI.png', *CommonPos.second_position, mood3.get1mood() / 1000) self.click_until('结算', 'img/JIN-BI.png', *CommonPos.second_position, mood3.get1mood() / 1000, False) # 等待下一轮 logging.info('Driver: 等待下一轮') start_time = time.time() while time.time() - start_time <= 20 and self.run: if (self.yys.wait_game_img('img\\KAI-SHI-ZHAN-DOU.png', 1, False)): self.log.writeinfo('Driver: 进入队伍') break # 点击默认邀请 if self.yys.find_game_img('img\\ZI-DONG-YAO-QING.png'): self.yys.mouse_click_bg((497, 319)) time.sleep(0.2) self.yys.mouse_click_bg((674, 384)) self.log.writeinfo('Driver: 自动邀请')
def start(self): ''' 开始战斗 ''' mood = ut.Mood(3) mood1 = ut.Mood(3) scene = self.get_scene() if scene == 4: self.log.info('已进入探索,就绪') else: self.log.warning('请检查是否进入探索内,退出') return while self.run: # 检测当前场景 maxVal_list, _ = self.yys.find_multi_img( 'img/DUI.png', 'img/YING-BING.png') # print(maxVal_list) if maxVal_list[0] < 0.8 and maxVal_list[1] > 0.8: self.start_time = time.time() # 队长退出,则跟着退出 self.log.info('队长已退出,跟随退出') self.switch_to_scene(3) # 等待邀请 js_loc = self.yys.wait_game_img( 'img/JIE-SHOU.png', self.max_win_time) if js_loc: # 点击接受邀请 if self.yys.find_game_img('img/JIE-SHOU.png'): self.click_until('接受邀请', 'img/JIE-SHOU.png', (127, js_loc[1]+34), appear=False) self.log.info('接受邀请') # 检查游戏次数 self.check_times() elif maxVal_list[0] > 0.8 and maxVal_list[1] < 0.8: self.start_time = time.time() # 进入战斗,等待式神准备 self.yys.wait_game_img_knn('img/ZHUN-BEI.png', thread=30) self.log.info('式神准备完成') # 检查狗粮经验 self.check_exp_full() # 点击准备,直到进入战斗 self.click_until_knn('准备按钮', 'img/ZHUN-BEI.png', * TansuoPos.ready_btn, mood1.get1mood()/1000, False, thread=30) # 检测是否打完 state = self.check_end() mood.moodsleep() # 点击结算 self.get_reward(mood, state) else: # 其他,不做任何操作 time.sleep(0.5) if time.time() - self.start_time > self.max_win_time: self.yys.quit_game()
def start(self): ''' 开始战斗 ''' mood1 = ut.Mood(3) mood2 = ut.Mood(3) mood3 = ut.Mood() scene = self.get_scene() if scene == 4: self.log.info('已进入探索,就绪') else: self.log.warning('请检查是否进入探索内,退出') return while self.run: # 检测当前场景 maxVal_list, maxLoc_list = self.yys.find_multi_img( 'img/DUI.png', 'img/YING-BING.png') if maxVal_list[0] < 0.8 and maxVal_list[1] > 0.8: # 队长退出,结束 self.log.warning('队员已退出,脚本结束') self.yys.quit_game() # 开始打怪 i = 0 ok = False while self.run: if i >= 4: break result = self.fight_moster(mood1, mood2) if result == 1: ok = True continue elif result == 2: break else: self.log.info('移动至下一个场景') self.next_scene() i += 1 if not ok: # 没有经验怪,随便打一个 fight_pos = self.yys.find_game_img('img/FIGHT.png') while not fight_pos: self.prev_scene() fight_pos = self.yys.find_game_img('img/FIGHT.png') # 攻击怪 self.yys.mouse_click_bg(fight_pos) self.log.info('已进入战斗') # 等待式神准备 self.yys.wait_game_img_knn('img/ZHUN-BEI.png', thread=30) self.log.info('式神准备完成') # 检查狗粮经验 self.check_exp_full() # 点击准备,直到进入战斗 self.click_until_knn('准备按钮', 'img/ZHUN-BEI.png', *TansuoPos.ready_btn, mood1.get1mood() / 1000, False, 30) # 检查是否打完 state = self.check_end() mood1.moodsleep() # 在战斗结算页面 self.get_reward(mood2, state) # 退出探索 self.log.info('结束本轮探索') # 点击退出探索 self.click_until_multi('退出按钮', 'img/QUE-REN.png', 'img/TAN-SUO.png', 'img/JUE-XING.png', pos=TansuoPos.quit_btn[0], pos_end=TansuoPos.quit_btn[1], step_time=0.5) # 点击确认 self.click_until('确认按钮', 'img/QUE-REN.png', *TansuoPos.confirm_btn, 2, False) # 等待司机退出1s if self.delay: time.sleep(1) # 下一轮自动邀请 self.yys.wait_game_img('img/QUE-DING.png', self.max_win_time) time.sleep(0.5) self.click_until('继续邀请', 'img/QUE-DING.png', *TansuoPos.yaoqing_comfirm, mood3.get1mood() / 1000, False) # 检查游戏次数 self.check_times() # 下一轮自动挑战 self.log.info('Driver: 点击开始战斗按钮') self.click_until('开始战斗按钮', 'img/TANSUO_TIAO_ZHAN.png', *TansuoPos.kaishizhandou_btn, mood3.get1mood() / 1000, False)