def get_flow(self): item = Click(self.cell[0], self.cell[1], process='dclick') cX = (self.config['cube']['x'] - 1) * self.config['delta'] + self.config['points']['start'][0] cY = (self.config['cube']['y'] - 1) * self.config['delta'] + self.config['points']['start'][1] cube = Click(cX, cY, process='dclick') return [item, cube] + self.submit_enhance()
def _go_to_selector(self): mode = self._setup_buff_mode() if mode: wx, wy = Window().center() Wait(0.5).delay() Click(wx, wy).make_click() dx, dy = self.config['markers']['confirm_logout_point'] dx, dy = wx + int(dx), wy + int(dy) Wait(1).delay() Click(dx, dy).make_click() return Recognizer(self.selector, None).recognize()
def __set_points(self, points): self.clear_fix = Click(points['clear'][0], points['clear'][1], process='dclick') self.enhance_point = Click(points['enhance'][0], points['enhance'][1], process='dclick', delay=2) self.break_point = Click(points['break'][0], points['break'][1], process='dclick')
def get_flow(self): return [ Click(self.cells[0][0], self.cells[0][1], process='dclick'), # self.__select_count(5), # Click(676, 403), self.__select_count(2), self.__select_count(8), self.__select_count(0), Click(self.config['dial_ok'][0], self.config['dial_ok'][1]), Click(self.cells[1][0], self.cells[1][1], process='dclick'), self.__select_count(7), self.__select_count(0), Click(self.config['dial_ok'][0], self.config['dial_ok'][1]), Click(self.config['enhance'][0], self.config['enhance'][1], delay=1) ]
def go_to_dungeon(self, party): if party: d = Detector(config.OkButton.path, Window()).detect() x, y, w, h = d x, y = Window().relative((x, y)) Rect((x, y, w, h)).click().make_click() Click(x, y).make_click() Navigator.touch_npc(config.DungeonNpc) Wait(1).delay() HandleNpc().select_menu(config.CircusDungeonMenu) Wait(1).delay() x, y, w, h = config.StarIcon.roi x, y = Window().relative((x, y)) Wait(1).delay() Detector(config.StarIcon.menu, Window()).detect() Rect((x, y, w, h)).click().make_click() npc = get_npc(config.CircusNpc) Navigator.click_at_npc(npc, config.CircusNpc) Wait(1).delay() npc_menu = HandleNpc().select_menu(config.CircusNpcMenu, quality='threshold') if not npc_menu: return None Wait(1).delay() npc_menu = HandleNpc().select_menu(config.FirstCircus) return npc_menu
def process(self): command = 0 for e in self.instructions: command += 1 print('[' + str(command) + '] ', e.process) if type(e) == Click: e.make_click(self.serial) if type(e) == Recognizer: if e.process == 'center_on': center = e.center_of() center_click = Click(center['x'], center['y']) center_click.make_click(self.serial) if e.process == 'recognize': e.recognize() if type(e) == Wait: e.delay() if self.serial is not None: self.serial.close()
def _get_object(self, cfg): process = cfg['process'] if process == 'recognize': return Recognizer(cfg['img'], cfg['region'], wait=cfg['freq']) if process == 'center_on': return Recognizer(cfg['img'], cfg['region'], wait=cfg['freq'], process=cfg['process']) if process == 'click': return Click(cfg['x'], cfg['y'], delay=cfg['delay'])
def select_menu(self, config, quality='minmax'): Wait(DELAY).delay() e = Extruder(screenshot(Window().rect)) template = cv2.imread(config.path) menu = e.match_by_template(template, roi=config.roi, method=quality) if not menu: return None point = Rect(menu).center() x, y = Window().relative(point) Click(x, y).make_click() return x, y
def process(self): command = 0 for e in self.instructions: command += 1 print('[' + str(command) + '] ', e.process) if type(e) == Click: e.make_click(self.serial) if type(e) == Recognizer: if e.process == 'center_on': center = e.center_of() center_click = Click(center['x'], center['y']) center_click.make_click(self.serial) if e.process == 'find': self.storage[str(e.properties['name'])] = e.find() if e.process == 'recognize': e.recognize() if type(e) == Wait: e.delay() if type(e) == NestedProcessor: self.serial.close() e.handle() if self.serial is not None: self.serial.close()
def get_quest(self): obs = Observer(observe_angle, observe_height) obs.observe() Navigator.touch_npc(config.CharTitleConfig) HandleNpc().select_menu(config.QuestMenu) Wait(0.3).delay() HandleNpc().select_menu(config.AcceptQuest) Wait(0.3).delay() Navigator.turn_around() Wait(0.3).delay() center = Rect(config.StartPointConfig.roi).center() x, y = self.window.relative(center) Click(x, y).make_click() Wait(3).delay()
from processes.process import Process from utils.configurator import Configurator from processes.click import Click from processes.wait import Wait from processes.key import Key import pyautogui as ui config = Configurator('config.yml').from_yaml() serial = Process(config['serial']).run_serial() for i in range(0, 6): count = Click(536, 450, process='dclick') count.make_click(serial) Wait(0.5).delay() on = Click(464, 451, process='dclick') on.make_click(serial) Wait(0.5).delay() one = Key('1') one.press(serial) Wait(0.5).delay() enter = Key('E') enter.press(serial) Wait(0.5).delay() make = Click(352, 492) make.make_click(serial) Wait(1).delay()
def move_to_npc(npc_roi, npc=None): npc_x, npc_y = circus_npc_point(npc_roi) wx, wy = Window().position() Click(wx + npc_x + npc.nav_x_shift, wy + npc_y + npc.nav_y_shift, process='dclick').make_click()
def click_at_npc(npc_roi, npc): npc_x, npc_y = circus_npc_point(npc_roi) wx, wy = Window().position() Click(wx + npc_x + npc.click_x_shift, wy + npc_y + npc.click_y_shift, process='dclick').make_click()
def _get_click(self, _x, _y): values = self.get_matrix() _x -= 1 _y -= 1 return Click(values[_y][_x][0], values[_y][_x][1], process='dclick')
def click(self): x, y, w, h = self.rect return Click(x+w/2, y+h/2, process='dclick')
def go_to_start(): start = get_tempalate_roi(config.StartPointConfig) x, y = window.relative(start_point(start)) Click(x, y).make_click() return start
def __select_count(self, digit): point = self.__combination_digit_grid(digit) return Click(point[0], point[1])