예제 #1
0
    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
예제 #2
0
 def make_click(self, serial=SerialController()):
     print(type(serial))
     if hasattr(serial, 'serial'):
         serial = serial.serial
     Move().moveTo(self.x, self.y)
     serial.write(CLICK)
     if self.process == 'dclick':
         serial.write(CLICK)
     delay = Wait(self.delay)
     delay.delay()
예제 #3
0
 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()
예제 #4
0
 def touch_npc(npc):
     title = get_tempalate_roi(npc)
     Navigator.move_to_npc(title, npc)
     Wait(3).delay()
     title, center = get_npc(npc), window.relative_center()
     while not is_near_npc(title, center):
         title, center = get_npc(npc), window.relative_center()
         Wait(1).delay()
     title = get_npc(npc)
     Navigator.click_at_npc(title, npc)
     return title
예제 #5
0
    def key(self, params):
        if type(params) == list:
            print('list key call')
            Key(params[1], pressed=params[0]).combination()

        else:
            Key(params).press()
        Wait(0.4).delay()
예제 #6
0
 def process_flow(self):
     if self.config['spawn']:
         if not self.config['logout']:
             Key('0').press()
             Wait(10).delay()
         Recognizer(self.moon, None).recognize()
         self._go_to_selector()
         Key('U').press()
         Wait(0.5).delay()
         Key('E').press()
         Recognizer(self.moon, None).recognize()
         return
     self._go_to_selector()
     self._detect_chars()
     if self.config['buff']:
         self._go_over_chars(self._buff_flow)
     if self.config['refresh']:
         self._go_over_chars(self._refresh_flow)
         Key('E').press()
예제 #7
0
    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()
예제 #8
0
    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
예제 #9
0
def get_quests(config):
    from utils.serial_controller import SerialController
    from jobs.helpers.circus_handler import CircusHandler
    from processes.wait import Wait
    from jobs.buffer import Buffer
    from utils.config import Config

    Config().initialize_configs(config['navigator'])

    if not SerialController().serial:
        SerialController().run_serial(config['serial']) 

    buff_cfg = Configurator(config['buffer']).from_yaml()
    buff = Buffer(buff_cfg)
    for i in range(8):
        CircusHandler().get_quest()
        Wait(2).delay()
        buff.process_flow()
예제 #10
0
    def round(self, initial, checker, axis='Y'):
        x, y = self.window
        dx, dy = x, y
        self.move.moveTo(x,y)
        self.move.pressRight()
        self._cast_direction(initial, axis)
        check = abs(initial)

        while check is not None:
            speed = math.floor(int(check / 10))
            if speed == 0:
                speed = 1

            for i in range(speed):
                self.move.move(self._apply_direction())
                Wait(OBSERVE_DELAY).delay()
            
            check = checker()
            self._cast_direction(check, axis)
            check = abs(check) if check is not None else None
        self.move.releaseRight()
예제 #11
0
 def _next_char(self):
     Key('D').press()
     Wait(1).delay()
     Key('E').press()
     Recognizer(self.moon, None).recognize()
예제 #12
0
 def _refresh_flow(self, *arg):
     Wait(5).delay()
     self._go_to_selector()
예제 #13
0
 def _buff_flow(self, *arg):
     for buff in arg:
         Key(buff).press()
         Wait(1.5).delay()
     self._go_to_selector()
예제 #14
0
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()