Esempio n. 1
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('发现乘客')
Esempio n. 2
0
class ExploreDual():
    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('发现乘客')

    def start(self):

        task1 = threading.Thread(target=self.driver.start)
        task2 = threading.Thread(target=self.passenger.start)
        task1.start()
        task2.start()

        task1.join()
        task2.join()

    def deactivate(self):
        self.hwndlist = []
        self.driver.deactivate()
        self.passenger.deactivate()
Esempio n. 3
0
def init():
    conf = configparser.ConfigParser()
    # 读取配置文件
    conf.read('conf.ini', encoding="utf-8")

    # 设置缩放
    # Query DPI Awareness (Windows 10 and 8)
    awareness = ctypes.c_int()
    errorCode = ctypes.windll.shcore.GetProcessDpiAwareness(
        0, ctypes.byref(awareness))

    # Set DPI Awareness  (Windows 10 and 8)
    client = conf.getint('DEFAULT', 'client')
    if client == 0:
        errorCode = ctypes.windll.shcore.SetProcessDpiAwareness(0)
    else:
        errorCode = ctypes.windll.shcore.SetProcessDpiAwareness(1)

    # 读取主要副本
    section = conf.getint('DEFAULT', 'run_section')

    if section == 0:
        # 御魂
        mode = conf.getint('DEFAULT', 'run_mode')
        if mode == 0:
            # 单刷
            fight = SingleFight()

        elif mode == 1:
            # 司机
            fight = DriverFighter()

        elif mode == 2:
            # 乘客
            fight = FighterPassenger()

        elif mode == 3:
            # 双开
            fight = DualFighter()

    elif section == 1:
        # 御灵
        fight = GoryouFight()

    elif section == 2:
        # 探索
        mode = conf.getint('explore', 'explore_mode')
        if mode == 0:
            # 单刷
            fight = ExploreFight()
        elif mode == 1:
            # 单人队长
            fight = ExploreLeader()
        elif mode == 2:
            # 单人队员
            fight = ExplorePassenger()
        elif mode == 3:
            # 双开
            fight = ExploreDual()

    fight.start()