Exemplo n.º 1
0
    def __init__(self, name='', emyc=0, hwnd=0):
        '''
        初始化
            :param name='': 打手名称
            : param emyc=0: 点怪设置:0-不点怪
            : param hwnd=0: 指定窗口句柄:0-否;其他-窗口句柄
        '''
        # 初始参数
        self.emyc = emyc
        self.name = name
        self.run = True

        # 读取配置文件
        conf = configparser.ConfigParser()
        conf.read('conf.ini')
        quit_game_enable = conf.getboolean('watchdog', 'watchdog_enable')
        self.max_op_time = conf.getint('watchdog', 'max_op_time')
        self.max_win_time = conf.getint('watchdog', 'max_win_time')

        # 启动日志
        self.log = WriteLog()

        # 绑定窗口
        if hwnd == 0:
            hwnd = win32gui.FindWindow(0, u'阴阳师-网易游戏')
        self.yys = GameControl(hwnd, quit_game_enable)
        self.log.writeinfo(self.name + '绑定窗口成功')
        self.log.writeinfo(self.name + str(hwnd))

        # 激活窗口
        self.yys.activate_window()
        self.log.writeinfo(self.name + '激活窗口成功')
        time.sleep(0.5)
Exemplo n.º 2
0
    def __init__(self, needMark=False):
        """
        初始化
        :param needMark: 是否需要自动标记式神
        """
        # 初始化窗口信息
        get_game_hwnd()
        self.hwndlist = hwndlist

        # 检测窗口信息是否正确
        num = len(self.hwndlist)
        if num == 2:
            logging.info('检测到两个窗口,窗口信息正常')
        else:
            logging.warning('检测到' + str(num) + '个窗口,窗口信息异常!')

        # 初始化司机和打手
        for hwnd in hwndlist:
            yys = GameControl(hwnd)
            if yys.find_game_img('img\\KAI-SHI-ZHAN-DOU.png'):
                self.driver = DriverFighter(hwnd=hwnd, needMark=needMark)
                hwndlist.remove(hwnd)
                logging.info('发现司机')
        self.passenger = FighterPassenger(hwnd=hwndlist[0])
        logging.info('发现乘客')
Exemplo n.º 3
0
    def __init__(self):
        # 初始化窗口信息
        get_game_hwnd()
        self.hwndlist = hwndlist

        # 检测窗口信息是否正确
        num = len(self.hwndlist)
        if num == 2:
            logging.info('检测到两个窗口,窗口信息正常')
        else:
            logging.warning('检测到' + str(num) + '个窗口,窗口信息异常!')

        # 初始化司机和打手
        for hwnd in hwndlist:
            yys = GameControl(hwnd)

            if yys.find_game_img('img/DUI.png',
                                 1, (68, 242), (135, 306),
                                 thread=0.8):
                self.driver = ExploreLeader(hwnd=hwnd, delay=True)
                hwndlist.remove(hwnd)
                logging.info('发现队长')
                break

        self.passenger = ExplorePassenger(hwnd=hwndlist[0])
        logging.info('发现乘客')
Exemplo n.º 4
0
    def __init__(self, needMark=False):
        # 初始化窗口信息
        try:
            get_game_hwnd()
            self.hwndlist = hwndlist
            # 检测窗口信息是否正确
            num = len(self.hwndlist)
            if num == 3:
                logging.info('检测到三个窗口,窗口信息正常')
            else:
                logging.info('检测到' + str(num) + '个窗口,窗口信息异常!脚本停止')
                hwndlist.clear()
                return None

            # 初始化司机和打手
            for hwnd in hwndlist:
                yys = GameControl(hwnd)
                if yys.find_game_img('img\\KAI-SHI-ZHAN-DOU.png'):
                    self.driver = DriverFighter(hwnd=hwnd,
                                                needMark=needMark,
                                                passengerNum=3)
                    hwndlist.remove(hwnd)
                    logging.info('发现司机')
            self.passengerOne = FighterPassenger(hwnd=hwndlist[0])
            self.passengerTwo = FighterPassenger(hwnd=hwndlist[1])
            logging.info('发现两个乘客')
        except IndexError:
            logging.info('游戏窗体检测出现异常')
Exemplo n.º 5
0
    def __init__(self, name='', emyc=0, hwnd=0):
        '''
        初始化
            :param name='': 打手名称
            : param emyc=0: 点怪设置:0-不点怪
            : param hwnd=0: 指定窗口句柄:0-否;其他-窗口句柄
        '''
        # 初始参数
        self.emyc = emyc
        self.name = name
        self.run = True

        # 读取配置文件
        conf = configparser.ConfigParser()
        conf.read('conf.ini')
        self.client = conf.getint('DEFAULT', 'client')
        quit_game_enable = conf.getboolean('watchdog', 'watchdog_enable')
        self.max_op_time = conf.getint('watchdog', 'max_op_time')
        self.max_win_time = conf.getint('watchdog', 'max_win_time')
        self.mitama_team_mark = conf.getint('mitama', 'mitama_team_mark')
        self.max_times = conf.getint('DEFAULT', 'max_times')
        self.end_operation = conf.getint('DEFAULT', 'end_operation')
        self.run_times = 0

        # 启动日志
        self.log = WriteLog()

        # 绑定窗口
        if hwnd == 0:
            if self.client == 0:
                hwnd = win32gui.FindWindow(0, u'阴阳师-网易游戏')
            elif self.client == 1:
                hwnd = win32gui.FindWindow(0, u'阴阳师 - MuMu模拟器')
                # TansuoPos.InitPosWithClient__()
                # YuhunPos.InitPosWithClient__()
        self.yys = GameControl(hwnd, quit_game_enable)
        self.log.writeinfo(self.name + '绑定窗口成功')
        self.log.writeinfo(self.name + str(hwnd))

        # 激活窗口
        self.yys.activate_window()
        self.log.writeinfo(self.name + '激活窗口成功')
        time.sleep(0.5)

        # 绑定场景

        # 自检
        debug_enable = conf.getboolean('others', 'debug_enable')
        if debug_enable:
            task = threading.Thread(target=self.yys.debug)
            task.start()
Exemplo n.º 6
0
    def __init__(self, name='', emyc=0):
        # 初始参数
        self.emyc = emyc
        self.name = name

        # 启动日志
        self.log = WriteLog()

        # 绑定窗口
        self.yys = GameControl(u'阴阳师-网易游戏')
        self.log.writeinfo(self.name + 'Registration successful')

        # 激活窗口
        self.yys.activate_window()
        self.log.writeinfo(self.name + 'Activation successful')
        ut.mysleep(500)
Exemplo n.º 7
0
    def __init__(self, name='', emyc=0, hwnd=0):
        '''
        初始化
            :param name='': 打手名称
            : param emyc=0: 点怪设置:0-不点怪
            : param hwnd=0: 指定窗口句柄:0-否;其他-窗口句柄
        '''
        # 初始参数
        self.emyc = emyc
        self.name = name
        self.run = True
        self.run_time = time.time()

        # 读取配置文件
        conf = configparser.ConfigParser()
        conf.read('conf.ini')
        quit_game_enable = conf.getboolean('watchdog', 'watchdog_enable')
        self.max_op_time = conf.getint('watchdog', 'max_op_time')
        self.max_win_time = conf.getint('watchdog', 'max_win_time')
        self.quit_time = conf.getint('watchdog', 'quit_time')

        self.team = conf.getboolean('others', 'team')
        self.team_id = conf.getint('others', 'team_id')
        self.monster = conf.getboolean('others', 'monster')

        # 启动日志
        self.log = WriteLog()

        # 绑定窗口
        if hwnd == 0:
            hwnd = win32gui.FindWindow(0, u'阴阳师-网易游戏')
        self.yys = GameControl(hwnd, quit_game_enable)
        self.log.writeinfo(self.name + '绑定窗口成功')
        self.log.writeinfo(self.name + str(hwnd))

        # 激活窗口
        self.yys.activate_window()
        self.log.writeinfo(self.name + '激活窗口成功')
        time.sleep(0.5)

        # 自检
        debug_enable = conf.getboolean('others', 'debug_enable')
        if debug_enable:
            task = threading.Thread(target=self.yys.debug)
            task.start()
Exemplo n.º 8
0
    def __init__(self):

        # 初始化窗口信息
        self.hwndlist = GameWindow.get_game_hwnd()

        # 检测窗口信息是否正确
        num = len(self.hwndlist)
        if num == 2:
            logging.info('检测到两个窗口,窗口信息正常')
        else:
            logging.warning('检测到' + str(num) + '个窗口,窗口信息异常!')
        hwndlist = self.hwndlist
        # 初始化司机和打手
        for hwnd in hwndlist:
            yys = GameControl(hwnd)
            if yys.find_multi_game_img('img/JI-XU.png', 'img/YAO-QING.png'):
                self.driver = DriverExplore(hwnd=hwnd)
                hwndlist.remove(hwnd)
                logging.info('发现司机')

        self.passenger = PassengerExplore(hwnd=hwndlist[0])
        logging.info('发现乘客')
Exemplo n.º 9
0
    def __init__(self, name='', emyc=0):
        # 初始参数
        self.emyc = emyc
        self.name = name

        # 读取配置文件
        conf = configparser.ConfigParser()
        conf.read('conf.ini')
        quit_game_enable = conf.getboolean('watchdog', 'watchdog_enable')
        self.max_op_time = conf.getint('watchdog', 'max_op_time')
        self.max_win_time = conf.getint('watchdog', 'max_win_time')

        # 启动日志
        self.log = WriteLog()

        # 绑定窗口
        self.yys = GameControl(u'阴阳师-网易游戏', quit_game_enable)
        self.log.writeinfo(self.name + 'Registration successful')

        # 激活窗口
        self.yys.activate_window()
        self.log.writeinfo(self.name + 'Activation successful')
        time.sleep(0.5)
Exemplo n.º 10
0
Arquivo: fighter.py Projeto: YZcxy/yys
    def __init__(self, name='', emyc=0, hwnd=0, activate=True):
        '''
        初始化
            :param name='': 打手名称
            : param emyc=0: 点怪设置:0-不点怪
            : param hwnd=0: 指定窗口句柄:0-否;其他-窗口句柄
            : param activate=True: 是否激活窗口,支线任务不需要激活
        '''
        # 初始参数
        self.emyc = emyc
        self.name = name
        self.run = True

        # 读取配置文件
        conf = configparser.ConfigParser()
        conf.read('conf.ini')
        quit_game_enable = conf.getboolean('watchdog', 'watchdog_enable')
        self.max_op_time = conf.getint('watchdog', 'max_op_time')
        self.max_win_time = conf.getint('watchdog', 'max_win_time')

        # 启动日志
        self.log = WriteLog()

        # 绑定窗口
        if hwnd == 0:
            hwnd = win32gui.FindWindow('Win32Window0', u'阴阳师-网易游戏')
            # hwnd = win32gui.FindWindow('Qt5QWindowIcon', '夜神模拟器')
            # hwnd = win32gui.FindWindowEx(hwnd, 0, 'Qt5QWindowIcon', 'ScreenBoardClassWindow')
        self.yys = GameControl(hwnd, quit_game_enable)
        self.log.writeinfo(self.name + '绑定窗口成功')
        self.log.writeinfo(self.name + str(hwnd))

        if activate:
            # 激活窗口
            self.yys.activate_window()
            self.log.writeinfo(self.name + '激活窗口成功')
        time.sleep(0.5)