Пример #1
0
class KuaFuBiDou():
    def __init__(self):
        self.transform = TransForm()
        self.common = Common()
        self.keyboard = KeyBoard()
        self.screen = Screen()
        self.mouse = Mouse()

    def operate(self, type):
        if type is 0:
            self.keyboard.press_shortcut_key('alt', 'a')
        elif type is 1:
            self.keyboard.press_shortcut_key('alt', 'w')
            time.sleep(0.5)
            self.mouse.click_element(317, 178, times=0.5)
            time.sleep(0.5)
            self.mouse.click_element(289, 383, times=0.5)

    def task_start(self, team):
        print("任务开始")
        self.common.get_focus()
        for i in range(6):
            self.mouse.click_element(772, 194, times=0.5)
            self.common.change_teamer(0.5)

        for j in range(15):
            for index, z in enumerate(team):
                if index is 0 or index is 2 or index is 4:
                    self.mouse.click_element(377, 477, times=0.5)
                    self.screen.find_ele_picture('game\\bidou\\begin2')
                    self.mouse.click_element(488, 504, times=0.5)
                self.mouse.click_element(309, 489, times=0.5)
                self.common.change_teamer(0.5)
            for z in range(6):
                if z is 0 or z is 2 or z is 4:
                    result_ = self.screen.find_ele_picture_time(
                        'game\\system\\zidong')
                    if result_ is True:
                        self.keyboard.press_shortcut_key('alt', 'a')
                        self.keyboard.press_shortcut_key('alt', 'a')
                        self.keyboard.press_shortcut_key('alt', '8')
                        self.common.change_teamer(0.5)
                        self.keyboard.press_shortcut_key('alt', 'a')
                        self.keyboard.press_shortcut_key('alt', 'a')
                        self.keyboard.press_shortcut_key('alt', '8')
                        self.common.change_teamer(0.5)
                    else:
                        self.common.change_teamer(0.5)
                        self.common.change_teamer(0.5)
            time.sleep(10)
Пример #2
0
class DaYanTa():
    def __init__(self):
        self.transform = TransForm()
        self.common = Common()
        self.keyboard = KeyBoard()
        self.screen = Screen()
        self.mouse = Mouse()

    def make_sure(self):
        self.common.get_focus()
        for i in range(3):
            self.mouse.click_element(311, 490)
            self.common.change_teamer()
        self.common.get_focus()

    def make_sure_wuyi(self):
        for i in range(3):
            self.mouse.click_element(183, 347)
            self.common.change_teamer()
        self.common.get_focus()

    def game_over(self):
        endtime = time.time() + int(300)
        while time.time() < endtime:
            time.sleep(1)
            self.screen.cut_screen()
            time.sleep(1)
            result_ = self.screen.get_location_picture(
                "D:\\dh2\\game\\system\\zidong.png", num=0.8)
            if result_ is 0:
                return True
        return False

    def operate(self):
        result_ = self.screen.find_ele_picture_time('game\\system\\zidong')
        if result_ is True:
            for i in range(3):
                self.keyboard.press_shortcut_key('alt', '8')
                if i is not 2:
                    self.common.change_teamer()
        self.common.get_focus()

    def start_task(self):
        self.common.get_focus()
        self.keyboard.press_shortcut_key('alt', '1')
        self.mouse.click_element(202, 254)
        time.sleep(10)
        # 寻找NPC 185,380
        self.screen.find_ele_picture('yitiao\\dayanta\\begin')
        self.mouse.click_element(177, 349, times=0.5)
        time.sleep(2)
        self.make_sure()
        time.sleep(5)
        # 第一个
        self.mouse.click_element(30, 257, times=0.5)
        self.screen.find_ele_picture('yitiao\\dayanta\\1', 'mouse', 180, 361)
        self.mouse.click_element(91, 240, times=0.5)
        self.screen.find_ele_picture('yitiao\\dayanta\\1_2', 'mouse', 169, 339)
        self.operate()
        self.game_over()
        self.mouse.click_element(30, 257, times=0.5)
        self.screen.find_ele_picture('yitiao\\dayanta\\1_3', 'mouse', 175, 344)
        time.sleep(3)
        # 第二个
        self.mouse.click_element(30, 257, times=0.5)
        self.screen.find_ele_picture('yitiao\\dayanta\\2', 'mouse', 180, 361)
        time.sleep(1)
        pyautogui.click()
        self.mouse.click_element(78, 240, times=0.5)
        time.sleep(60)
        res = self.screen.get_locations_picture(
            "D:\\dh2\\yitiao\\dayanta\\2_1.png", 0.7)
        self.mouse.click_element(res[0]['result'][0], res[0]['result'][1])
        time.sleep(1)
        self.mouse.click_element(91, 241, times=0.5)
        time.sleep(1)
        self.mouse.click_element(173, 327, times=0.5)
        self.operate()
        self.game_over()
        self.mouse.click_element(30, 257, times=0.5)
        self.screen.find_ele_picture('yitiao\\dayanta\\2_2', 'mouse', 183, 325)
        time.sleep(3)
        # 第三个
        self.mouse.click_element(30, 257, times=0.5)
        self.screen.find_ele_picture('yitiao\\dayanta\\3', 'mouse', 180, 413)
        self.mouse.click_element(91, 240, times=0.5)
        self.operate()
        self.game_over()
        self.mouse.click_element(30, 257, times=0.5)
        self.screen.find_ele_picture('yitiao\\dayanta\\3_1', 'mouse', 175, 344)
        time.sleep(3)
        # 第四个
        self.mouse.click_element(30, 257, times=0.5)
        self.screen.find_ele_picture('yitiao\\dayanta\\4', 'mouse', 180, 361)
        time.sleep(1)
        pyautogui.click()
        while True:
            time.sleep(4)
            self.mouse.click_element(41, 240, times=0.5)
            time.sleep(1)
            self.screen.cut_screen()
            time.sleep(1)
            location = self.screen.get_locations_picture(
                "D:\\dh2\\yitiao\\dayanta\\4_1.png", 0.9)
            if len(location) is not 0:
                self.mouse.click_element(178, 365, times=0.5)
                break
        self.make_sure()
        self.operate()
        self.game_over()
        while True:
            time.sleep(4)
            self.mouse.click_element(33, 255, times=0.5)
            time.sleep(1)
            self.screen.cut_screen()
            time.sleep(1)
            location = self.screen.get_locations_picture(
                "D:\\dh2\\yitiao\\dayanta\\4_2.png", 0.7)
            if len(location) is not 0:
                self.mouse.click_element(183, 343, times=0.5)
                break
        time.sleep(3)
        # 第五个
        self.mouse.click_element(30, 257, times=0.5)
        self.screen.find_ele_picture('yitiao\\dayanta\\5', 'mouse', 180, 344)
        time.sleep(1)
        pyautogui.click()
        while True:
            time.sleep(4)
            self.mouse.click_element(150, 240, times=0.5)
            time.sleep(1)
            self.screen.cut_screen()
            time.sleep(1)
            location = self.screen.get_locations_picture(
                "D:\\dh2\\yitiao\\dayanta\\5_1.png", 0.7)
            if len(location) is not 0:
                self.mouse.click_element(178, 365, times=0.5)
                break
        self.make_sure()
        self.operate()
        self.game_over()
        while True:
            time.sleep(4)
            self.mouse.click_element(33, 255, times=0.5)
            time.sleep(1)
            self.screen.cut_screen()
            time.sleep(1)
            location = self.screen.get_locations_picture(
                "D:\\dh2\\yitiao\\dayanta\\5_2.png", 0.7)
            if len(location) is not 0:
                self.mouse.click_element(190, 365, times=0.5)
                break
        time.sleep(3)
        # 第六个
        self.mouse.click_element(30, 257, times=0.5)
        self.screen.find_ele_picture('yitiao\\dayanta\\6', 'mouse', 180, 381)
        time.sleep(1)
        pyautogui.click()
        self.mouse.click_element(41, 240, times=0.5)
        self.screen.find_ele_picture('yitiao\\dayanta\\6_1', 'mouse', 182, 353)
        self.make_sure()
        self.operate()
        self.game_over()
        self.mouse.click_element(30, 257, times=0.5)
        self.screen.find_ele_picture('yitiao\\dayanta\\6_2', 'mouse', 175, 344)
        time.sleep(3)
        # 第七个
        self.mouse.click_element(156, 240, times=0.5)
        self.screen.find_ele_picture('yitiao\\dayanta\\7', 'mouse', 180, 345)
        time.sleep(1)
        self.mouse.click_element(54, 240, times=0.5)
        time.sleep(1)
        self.mouse.click_element(461, 292, times=0.5)
        self.screen.find_ele_picture('yitiao\\dayanta\\7_1', 'mouse', 182, 329)
        self.operate()
        self.game_over()
        self.mouse.click_element(85, 243, times=0.5)
        self.screen.find_ele_picture('yitiao\\dayanta\\7_2', 'mouse', 192, 330)
        self.keyboard.press_shortcut_key('alt', 'q')
        time.sleep(3)
Пример #3
0
class GuZhu():
    def __init__(self):
        self.transform = TransForm()
        self.common = Common()
        self.keyboard = KeyBoard()
        self.screen = Screen()
        self.mouse = Mouse()
    def make_sure(self):
        self.common.get_focus()
        for i in range(3):
            self.mouse.click_element(311, 490)
            self.common.change_teamer()
        self.common.get_focus()
    def make_sure_wuyi(self):
        for i in range(3):
            self.mouse.click_element(183, 347)
            self.common.change_teamer()
        self.common.get_focus()
    def game_over(self):
        endtime = time.time() + int(300)
        while time.time() < endtime:
            time.sleep(1)
            self.screen.cut_screen()
            time.sleep(1)
            result_ = self.screen.get_location_picture("D:\\dh2\\game\\system\\zidong.png",num=0.8)
            if result_ is 0:
                return True
        return False
    def operate(self):
        result_ = self.screen.find_ele_picture_time('game\\system\\zidong')
        if result_ is True:
            for i in range(3):
                self.keyboard.press_shortcut_key('alt', '8')
                if i is not 2:
                    self.common.change_teamer()
        self.common.get_focus()

    def start_task(self):
        self.common.get_focus()
        self.keyboard.press_shortcut_key('alt', '2')
        self.mouse.click_element(502, 419)
        time.sleep(2)
        self.mouse.click_element(587, 362)
        time.sleep(10)
        # 寻找NPC 185,380
        self.screen.find_ele_picture('yitiao\\guzhu\\begin')
        self.mouse.click_element(182, 328, times=0.5)
        time.sleep(2)
        self.make_sure()
        time.sleep(10)
        # 宠物医生
        self.mouse.click_element(245, 275, times=0.5)
        self.make_sure_wuyi()
        time.sleep(2)
        # 第一个
        self.mouse.click_element(93, 241, times=0.5)
        self.screen.find_ele_picture('yitiao\\guzhu\\1','mouse',169,329)
        self.operate()
        self.game_over()
        time.sleep(2)
        # 第二个
        self.mouse.click_element(93, 241, times=0.5)
        self.screen.find_ele_picture('yitiao\\guzhu\\2','mouse',169,329)
        self.operate()
        self.game_over()
        time.sleep(2)
        # 第三个
        self.mouse.click_element(93, 241, times=0.5)
        self.screen.find_ele_picture('yitiao\\guzhu\\3','mouse',169,329)
        self.operate()
        self.game_over()
        time.sleep(2)
        # 第四个
        self.mouse.click_element(93, 241, times=0.5)
        self.screen.find_ele_picture('yitiao\\guzhu\\4','mouse',169,329)
        self.operate()
        self.game_over()
        time.sleep(2)
        # 第五个
        self.mouse.click_element(93, 241, times=0.5)
        self.screen.find_ele_picture('yitiao\\guzhu\\5','mouse',169,329)
        self.operate()
        self.game_over()
        time.sleep(2)
        # 第六个
        self.mouse.click_element(93, 241, times=0.5)
        self.screen.find_ele_picture('yitiao\\guzhu\\6','mouse',175,347)
        self.make_sure()
        time.sleep(2)
        self.keyboard.press_shortcut_key('alt', '1')
        # 第七个
        self.mouse.click_element(93, 241, times=0.5)
        self.screen.find_ele_picture('yitiao\\guzhu\\7','mouse',188,328)
        # self.make_sure()
        self.operate()
        self.game_over()
        time.sleep(2)
        # 第八个
        self.mouse.click_element(93, 241, times=0.5)
        self.screen.find_ele_picture('yitiao\\guzhu\\8','mouse',188,328)
        # self.make_sure()
        self.operate()
        self.game_over()
        time.sleep(15)