Exemplo n.º 1
0
 def __init__(self):
     self.transform = TransForm()
     self.common = Common()
     self.keyboard = KeyBoard()
     self.screen = Screen()
     self.mouse = Mouse()
     self.walking = Walking()
Exemplo n.º 2
0
 def __init__(self):
     self.transform = TransForm()
     self.common = Common()
     self.keyboard = KeyBoard()
     self.screen = Screen()
     self.mouse = Mouse()
     self.yao = ''
     self.offset = 17 + 15
Exemplo n.º 3
0
class DiGong():
    def __init__(self):
        self.transform = TransForm()
        self.common = Common()
        self.keyboard = KeyBoard()
        self.screen = Screen()
        self.mouse = Mouse()

    def task_start(self,type):
        # 0简单 1困难 2卓越
        self.common.get_focus()
        self.keyboard.press_shortcut_key('alt', '2', times=0.5)
        self.mouse.click_element(540, 388, times=1)
        self.mouse.click_element(616, 463, times=1)
Exemplo n.º 4
0
    def task_start(self, i):
        Screen().cut_screen()
        time.sleep(1.5)
        lijing = Screen().get_location_picture(
            'D:\\dh2\\game\\tianting\\0.png')
        if lijing is not 0:
            Mouse().click_element(184, 396)
        time.sleep(1)
        Common().capation_eat_xiang()
        list = [(108, 239), (163, 240), (46, 256), (100, 255)]
        # 第一只怪
        for j in list:
            Mouse().click_element(j[0], j[1])
            time.sleep(5)
            Screen().find_ele_picture('game\\tianting\\1', 'mouse', 197, 355)
            time.sleep(2)
            for i in range(5):
                if i is 0:
                    Mouse().click_element(370, 385)
                    pyautogui.click()
                else:
                    pyautogui.click()
                    pyautogui.click()
                Common().change_teamer(times=0.5)
            time.sleep(1)
            while True:
                Screen().cut_screen()
                time.sleep(2)
                zidong = Screen().get_location_picture(
                    'D:\\dh2\\game\\tianting\\2.png')
                if zidong is 0 or zidong[0] < 100:
                    break

        Mouse().click_element(212, 350)
        Mouse().click_element(29, 268)

        time.sleep(10)
        while True:
            Screen().cut_screen()
            time.sleep(2)
            lijing = Screen().get_location_picture(
                'D:\\dh2\\game\\tianting\\0.png', 0.9)
            if lijing is not 0:
                # Mouse().click_element(184, 396)
                break
Exemplo n.º 5
0
class ShuiLu():
    def __init__(self):
        self.transform = TransForm()
        self.common = Common()
        self.keyboard = KeyBoard()
        self.screen = Screen()
        self.mouse = Mouse()

    def task_start(self):
        self.screen.find_ele_picture('game\\system\\zidong')
        time.sleep(5)
        for i in range(5):
            self.keyboard.press_key('f7')
            if i is 0:
                self.mouse.click_element(198, 338, times=1)
            else:
                pyautogui.click()
            pyautogui.click()
            self.keyboard.press_shortcut_key('alt', '8')
            self.common.change_teamer(0.3)
Exemplo n.º 6
0
class BiDou():
    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')
            self.mouse.click_element(317, 178, times=0.5)
            self.mouse.click_element(289, 383, times=0.5)

    def task_start(self, team):
        print("任务开始")
        self.common.get_focus()
        for j in range(10):
            for index, i in enumerate(team):
                if j is 0:
                    time.sleep(1)
                    self.keyboard.press_shortcut_key('alt', 'o')
                    self.mouse.click_element(248, 385)
                    time.sleep(1)
                    self.mouse.click_element(578, 420)
                else:
                    # self.mouse.click_element(417,588,right=True)
                    time.sleep(2)
                    self.screen.find_ele_picture('game\\bidou\\begin')
                self.screen.find_ele_picture('game\\system\\zidong',
                                             location_=[578, 420])
                time.sleep(1.5)
                if j is 0:
                    self.operate(i[0])
                    self.operate(i[1])
                    self.operate(i[2])
                self.keyboard.press_shortcut_key('alt', '8')
                time.sleep(1)
                self.common.change_teamer(times=0.5)
Exemplo n.º 7
0
 def task_start(self):
     time.sleep(2)
     KeyBoard().press_shortcut_key('alt', '1')
     time.sleep(1)
     Mouse().click_element(337, 295)
     time.sleep(3)
     Mouse().click_element(262, 269)
     time.sleep(0.5)
     KeyBoard().press_shortcut_key('alt', '1')
     time.sleep(3)
     KeyBoard().press_shortcut_key('alt', '5')
     time.sleep(1.5)
     Screen().cut_screen()
     time.sleep(1.5)
     zhongkui = Screen().get_location_picture(
         'D:\\dh2\\game\\xiaogui\\0.png')
     if zhongkui is not 0:
         Mouse().click_element(zhongkui[0] - 5, zhongkui[1] - 30)
     Mouse().click_element(237, 399)
     time.sleep(0.5)
     Mouse().click_element(237, 399)
     Mouse().click_element(27, 256)
     time.sleep(1)
     if Common().iswalking() is False:
         Mouse().click_element(zhongkui[0] - 5, zhongkui[1] - 30)
         Mouse().click_element(237, 399)
         time.sleep(0.5)
         Mouse().click_element(237, 399)
         Mouse().click_element(27, 256)
         if Common().iswalking() is False:
             Mouse().click_element(zhongkui[0] - 5, zhongkui[1] - 30)
             Mouse().click_element(237, 399)
             time.sleep(0.5)
             Mouse().click_element(237, 399)
             Mouse().click_element(27, 256)
     Common().capation_eat_xiang()
     time.sleep(15)
     Screen().find_ele_picture('game\\xiaogui\\1', 'mouse', 207, 355)
     for i in range(5):
         time.sleep(2)
         KeyBoard().press_shortcut_key('alt', '8')
         Common().change_teamer()
         Mouse().click_element(412, 429)
         if i is 4:
             pass
         else:
             Common().score_for_shifu()
     Screen().find_ele_picture('game\\xiaogui\\2', 'mouse', 780, 537)
     time.sleep(1)
     Screen().cut_screen()
     box_result = Screen().get_location_picture(
         'D:\\dh2\\game\\xiaogui\\3.png', 0.8)
     if box_result is not 0:
         Mouse().click_element(327, 535)
     Common().score_for_shifu()
Exemplo n.º 8
0
class DiGong():
    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 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, level):
        self.common.get_focus()
        self.keyboard.press_shortcut_key('alt', '2')
        self.mouse.click_element(539, 386)
        time.sleep(2)
        self.mouse.click_element(618, 463)
        time.sleep(10)
        # 寻找NPC 185,380
        self.screen.find_ele_picture('yitiao\\digong\\begin')
        self.mouse.click_element(185, 380, times=0.5)
        time.sleep(2)
        self.mouse.click_element(547, 146, times=0.5)
        time.sleep(2)
        self.mouse.click_element(204, 378, times=0.5)
        time.sleep(2)
        self.mouse.click_element(64, 242, times=0.5)
        # 点老鼠
        self.screen.find_ele_picture('yitiao\\digong\\1')
        time.sleep(2)
        self.mouse.click_element(64, 242, times=0.5)
        time.sleep(2)
        self.mouse.click_element(202, 363, times=0.5)
        time.sleep(1)
        self.mouse.click_element(197, 345, times=0.5)
        time.sleep(1)
        pyautogui.click()
        # 点击任务栏
        time.sleep(1)
        self.mouse.click_element(44, 269, times=0.5)
        time.sleep(2)
        if level is '0':
            self.mouse.click_element(486, 239, times=0.5)
            self.screen.find_ele_picture('yitiao\\digong\\2_0')
            self.mouse.click_element(179, 327, times=0.5)
        elif level is '1':
            self.mouse.click_element(486, 275, times=0.5)
            self.screen.find_ele_picture('yitiao\\digong\\2_1')
            self.mouse.click_element(179, 350, times=0.5)
        # 组队确认
        self.make_sure()
        time.sleep(2)
        self.screen.find_ele_picture('system\\zidong')
        self.common.find_attack('f7')
        self.keyboard.press_shortcut_key('alt', 'd')
        self.keyboard.press_shortcut_key('alt', '8')
        self.common.change_teamer()
        for i in range(2):
            self.keyboard.press_key('f7')
            pyautogui.click()
            self.keyboard.press_shortcut_key('alt', 'd')
            self.keyboard.press_shortcut_key('alt', '8')
            self.common.change_teamer()
        self.common.get_focus()
        time.sleep(20)
        self.game_over()
        print("任务结束")
Exemplo n.º 9
0
class DianXing():
    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)
            time.sleep(0.5)
            self.mouse.click_element(289, 383)
    def task_start(self):
        jiangxing = 0
        print("任务开始")
        self.common.get_focus()
        time.sleep(1)
        self.mouse.click_element(768, 195)
        time.sleep(1)
        for i in range(8):
            # for x in range(5):
            #     self.mouse.click_element(421, 208, times=1, right=True)
            #     self.common.change_teamer(0.5)
            endtime = time.time() + int(500)
            while time.time() < endtime:
                self.screen.cut_screen()
                time.sleep(2)
                loc_begin = self.screen.get_location_picture("D:\\dh2\\game\\dianxing\\begin2.png",num=0.9)
                if loc_begin is not 0:
                    self.mouse.click_element(432, 516)
                    for j in range(5):
                        self.mouse.click_element(309, 489, times=0.2, right=True)
                        self.mouse.click_element(309, 489, times=0.2)
                        self.common.change_teamer(0.2)
                pos_zidong = self.screen.get_location_picture("D:\\dh2\\game\\dianxing\\1.png",num=0.99)
                pos_caozuo = self.screen.get_location_picture("D:\\dh2\\game\\dianxing\\2.png",num=0.99)
                if pos_zidong is not 0 and pos_caozuo is 0:
                    # 人物
                    flag = 0
                    while True:
                        # self.mouse.click_element(412, 137, times=1, right=True
                        if flag is 0:
                            result = self.common.find_attack(type='f7')
                            self.mouse.click_element(result[0], result[1], times=0.5)
                            self.keyboard.press_shortcut_key('alt', '8')
                            self.common.change_teamer(0.3)
                            for jj in range(4):
                                self.keyboard.press_key('f7')
                                time.sleep(0.3)
                                pyautogui.click()
                                time.sleep(0.3)
                                pyautogui.click()
                                time.sleep(0.3)
                                self.keyboard.press_shortcut_key('alt', '8')
                                self.common.change_teamer(0.3)
                            flag+=1
                        self.screen.cut_screen()
                        time.sleep(1)
                        loc_begin2 = self.screen.get_location_picture("D:\\dh2\\game\\dianxing\\begin.png")
                        time.sleep(0.5)
                        if loc_begin2 is not 0:
                            break

                if pos_caozuo is not 0 and pos_zidong is 0:
                    # 星将
                    while True:
                        # self.mouse.click_element(412, 137, times=1, right=True)
                        self.screen.cut_screen()
                        time.sleep(1)
                        pos_caozuo2= self.screen.get_location_picture("D:\\dh2\\game\\dianxing\\2.png")
                        if pos_caozuo2 is not 0:
                            if jiangxing is 0:
                                for z in range(5):
                                    self.keyboard.press_shortcut_key('alt', 'a')
                                    self.keyboard.press_shortcut_key('alt', 'w')
                                    self.mouse.click_element(314, 179, times=0.2, right=True)

                                    if z is 0:
                                        result = self.common.find_attack(type='other',str='caozuo2')
                                        self.mouse.click_element(result[0], result[1], times=0.2)
                                    else:
                                        self.mouse.click_element(result[0], result[1], times=0.2)
                                    self.common.change_teamer(0.3)
                                    jiangxing+=1
                            else:
                                for z in range(5):
                                    self.keyboard.press_shortcut_key('alt', 'a')
                                    if z is 0:
                                        result = self.common.find_attack(type='other',str='caozuo2')
                                        self.mouse.click_element(result[0], result[1], times=0.2)
                                    else:
                                        pyautogui.click()
                                    self.common.change_teamer(0.3)
                        self.screen.cut_screen()
                        time.sleep(1)
                        loc_begin2 = self.screen.get_location_picture("D:\\dh2\\game\\dianxing\\begin.png")
                        time.sleep(0.5)
                        if loc_begin2 is not 0:
                            break
Exemplo n.º 10
0
class WuHuan():
    def __init__(self):
        self.transform = TransForm()
        self.common = Common()
        self.keyboard = KeyBoard()
        self.screen = Screen()
        self.mouse = Mouse()

    def classify(self):
        self.screen.cut_screen()
        time.sleep(1)
        jieshou = self.screen.get_location_picture(
            "D:\\dh2\\game\\wuhuan\\2.png", num=0.8)
        if jieshou is not 0:
            return 'jieshou', jieshou
        jieshou2 = self.screen.get_location_picture(
            "D:\\dh2\\game\\wuhuan\\3.png", num=0.8)
        if jieshou2 is not 0:
            return 'jieshou2', jieshou2
        guidui = self.screen.get_location_picture(
            "D:\\dh2\\game\\wuhuan\\5.png", num=0.8)
        if guidui is not 0:
            return 'guidui', [177, 345]
        return 'wu,0'

    def task_start(self):
        self.common.get_focus()
        index = 0
        while True:
            try:
                self.screen.cut_screen()
                time.sleep(1.7)
                location = self.screen.get_location_picture(
                    "D:\\dh2\\game\\wuhuan\\1.png", num=0.996)
                print(location)
                if location is not 0:
                    self.mouse.click_element(location[0], location[1])
                    result = self.classify()
                    if result[0] is 'jieshou':
                        self.mouse.click_element(result[1][0], result[1][1])
                        pyautogui.moveTo(166, 366, 1, pyautogui.easeInQuad)
                        self.mouse.click_element(374, 384, times=1)
                        pyautogui.click()
                        pyautogui.click()
                    elif result[0] is 'jieshou2':
                        self.mouse.click_element(result[1][0], result[1][1])
                        pyautogui.moveTo(166, 366, 1, pyautogui.easeInQuad)
                        # 判断归队
                        self.screen.cut_screen()
                        time.sleep(1)
                        guidui = self.screen.get_location_picture(
                            "D:\\dh2\\game\\wuhuan\\4.png", num=0.7)
                        if guidui is not 0:
                            self.mouse.click_element(guidui[0], guidui[1])
                            time.sleep(1)
                            self.screen.cut_screen()
                            time.sleep(1)
                            guidui2 = self.screenget_location_picture(
                                "D:\\dh2\\game\\wuhuan\\5.png", num=0.9)
                            if guidui2 is not 0:
                                self.mouse.click_element(177, 345)
                        self.mouse.click_element(374, 384, times=1)
                        pyautogui.click()
                        pyautogui.click()
                    elif result[0] is 'guidui':
                        self.mouse.click_element(177, 345)
                        self.mouse.click_element(374, 384, times=1)
                        pyautogui.click()
                        pyautogui.click()
                else:
                    result = self.classify()
                    if result[0] is 'jieshou':
                        self.mouse.click_element(result[1][0], result[1][1])
                        pyautogui.moveTo(166, 366, 1, pyautogui.easeInQuad)
                        self.mouse.click_element(374, 384, times=1)
                        pyautogui.click()
                        pyautogui.click()
                    elif result[0] is 'jieshou2':
                        self.mouse.click_element(result[1][0], result[1][1])
                        pyautogui.moveTo(166, 366, 1, pyautogui.easeInQuad)
                        # 判断归队
                        self.screen.cut_screen()
                        time.sleep(1)
                        guidui = self.screen.get_location_picture(
                            "D:\\dh2\\game\\wuhuan\\4.png", num=0.7)
                        if guidui is not 0:
                            self.mouse.click_element(guidui[0], guidui[1])
                        guidui2 = self.screenget_location_picture(
                            "D:\\dh2\\game\\wuhuan\\5.png", num=0.8)
                        if guidui2 is not 0:
                            self.mouse.click_element(177, 345)
                        self.mouse.click_element(374, 384, times=1)
                        pyautogui.click()
                        pyautogui.click()
                    elif result[0] is 'guidui':
                        self.mouse.click_element(177, 345)
                        self.mouse.click_element(374, 384, times=1)
                        pyautogui.click()
                        pyautogui.click()
                    else:
                        index += 1
                    if index > 100:
                        index = 0
                    if not index % 15:
                        self.common.change_teamer()
            except:
                pass
Exemplo n.º 11
0
class BangPai:
    def __init__(self):
        self.transform = TransForm()
        self.common = Common()
        self.keyboard = KeyBoard()
        self.screen = Screen()
        self.mouse = Mouse()
        self.walking = Walking()

    def bangpai_task(self):
        self.screen.cut_screen()
        time.sleep(2)
        endtime = time.time() + int(30)
        while time.time() < endtime:
            for i in range(1, 11):
                file_name = "D:\\dh2\\game\\bangpai\\" + str(i) + ".png"
                result = self.screen.get_location_picture(file_name, 0.8)
                if result != 0:
                    if i == 1:
                        print("除草")
                        self.keyboard.press_shortcut_key('alt', 'q')
                        self.mouse.click_element(223, 329)
                        for j in range(5):
                            self.mouse.click_element_right(10, 582)
                            time.sleep(1)
                            self.mouse.click_element(787, 539)
                        self.return_bangpai_npc()
                        return 'success'
                    elif i == 2:
                        print("武官")
                        self.keyboard.press_shortcut_key('alt', 'q')
                        self.mouse.click_element(223, 329)
                        time.sleep(1)
                        self.mouse.click_element(459, 266)
                        time.sleep(1)
                        self.mouse.click_element(181, 347)
                        time.sleep(1)
                        self.mouse.click_element(164, 344)
                        time.sleep(2)
                        pyautogui.click()
                        time.sleep(25)
                        pyautogui.moveTo(393, 557, 1, pyautogui.easeInQuad)
                        # self.keyboard.press_shortcut_key('alt', 'q')
                        self.screen.cut_screen()
                        time.sleep(2)
                        loca = self.screen.get_location_picture(
                            "D:\\dh2\\game\\bangpai\\0_3.png", 0.9)
                        print(loca)
                        if loca is 0:
                            self.mouse.click_element(193, 367)
                        else:
                            self.mouse.click_element(loca[0] - 120,
                                                     loca[1] + 73)
                        self.mouse.click_element(420, 239)
                        return 'failed'
                    elif i == 3:
                        print("订酒")
                        self.keyboard.press_shortcut_key('alt', 'q')
                        time.sleep(1)
                        self.mouse.click_element(459, 266)
                        time.sleep(1)
                        self.mouse.click_element(181, 347)
                        time.sleep(1)
                        self.mouse.click_element(164, 344)
                        time.sleep(2)
                        pyautogui.click()
                        time.sleep(25)
                        pyautogui.moveTo(393, 557, 1, pyautogui.easeInQuad)
                        # self.keyboard.press_shortcut_key('alt', 'q')
                        self.screen.cut_screen()
                        time.sleep(2)
                        loca = self.screen.get_location_picture(
                            "D:\\dh2\\game\\bangpai\\0_3.png", 0.9)
                        print(loca)
                        if loca is 0:
                            self.mouse.click_element(193, 367)
                        else:
                            self.mouse.click_element(loca[0] - 120,
                                                     loca[1] + 73)
                        self.mouse.click_element(420, 239)
                        return 'failed'
                    elif i == 4:
                        print("药")
                        self.keyboard.press_shortcut_key('alt', 'q')
                        self.mouse.click_element(223, 329)
                        self.mouse.click_element(461, 269)
                        self.mouse.click_element(201, 328)
                        time.sleep(3)
                        pyautogui.click()
                        # self.keyboard.press_shortcut_key('alt', 'q')
                        pyautogui.moveTo(393, 557, 1, pyautogui.easeInQuad)
                        time.sleep(1)
                        self.screen.cut_screen()
                        time.sleep(2)
                        loca = self.screen.get_location_picture(
                            "D:\\dh2\\game\\bangpai\\0_3.png", 0.9)
                        print(loca)
                        if loca is 0:
                            self.mouse.click_element(193, 367)
                        else:
                            self.mouse.click_element(loca[0] - 120,
                                                     loca[1] + 73)
                        self.mouse.click_element(420, 239)
                        return 'success'
                        # time.sleep(1)
                        # self.mouse.click_element(461, 288)
                    elif i == 5:
                        print("无名侠女")
                        self.mouse.click_element(500, 240)
                        self.keyboard.press_shortcut_key('alt', 'q')
                        time.sleep(5)
                        self.screen.find_ele_picture('game\\system\\zidong',
                                                     'keyboard', 'alt', '8')
                        self.screen.find_ele_picture('game\\bangpai\\5_2',
                                                     'mouse', 182, 335)
                        self.return_bangpai_npc()
                        return 'success'
                    elif i == 6:
                        print("回答问题")
                        self.mouse.click_element(445, 240)
                        self.keyboard.press_shortcut_key('alt', 'q')
                        self.mouse.click_element(185, 327)
                        while True:
                            self.mouse.click_element(159, 329)
                            time.sleep(1)
                            self.screen.cut_screen()
                            time.sleep(2.5)
                            result_answer = self.screen.get_location_picture(
                                "D:\\dh2\\game\\bangpai\\6_1.png", 0.8)
                            if result_answer == 0:
                                break
                        self.return_bangpai_npc()
                        return 'success'
                    elif i == 7:
                        print("帮派宣传")
                        self.mouse.click_element(410, 240)
                        self.keyboard.press_shortcut_key('alt', 'q')
                        time.sleep(10)
                        endtime2 = time.time() + int(90)
                        while time.time() < endtime2:
                            if self.walking.iswalking() is 0:
                                self.mouse.click_element(784, 540)
                                break
                        self.mouse.click_element(784, 540)
                        self.return_bangpai_npc()
                        return 'success'
                    elif i == 8:
                        print("作乱妖怪")
                        self.mouse.click_element(440, 240)
                        self.keyboard.press_shortcut_key('alt', 'q')
                        self.screen.find_ele_picture('game\\system\\zidong',
                                                     'keyboard', 'alt', '8')
                        self.screen.find_ele_picture('game\\bangpai\\8_1',
                                                     'mouse', 182, 345)
                        self.return_bangpai_npc()
                        return 'success'
                    elif i == 9:
                        print("收银票")
                        self.keyboard.press_shortcut_key('alt', 'q')
                        self.mouse.click_element(223, 329)
                        time.sleep(1)
                        self.mouse.click_element(459, 266)
                        time.sleep(1)
                        self.mouse.click_element(181, 347)
                        time.sleep(1)
                        self.mouse.click_element(164, 344)
                        time.sleep(2)
                        pyautogui.click()
                        time.sleep(25)
                        pyautogui.moveTo(393, 557, 1, pyautogui.easeInQuad)
                        # self.keyboard.press_shortcut_key('alt', 'q')
                        self.screen.cut_screen()
                        time.sleep(2)
                        loca = self.screen.get_location_picture(
                            "D:\\dh2\\game\\bangpai\\0_3.png", 0.9)
                        print(loca)
                        if loca is 0:
                            self.mouse.click_element(193, 367)
                        else:
                            self.mouse.click_element(loca[0] - 120,
                                                     loca[1] + 73)
                        self.mouse.click_element(420, 239)
                        return 'failed'
                    elif i == 10:
                        return 'success'
            return 'pass'

    def find_bangpai_task(self):
        num = 0
        for j in range(15):
            if num > 9:
                break
            try:
                if j == 0:
                    self.keyboard.press_shortcut_key('alt', '2')
                    time.sleep(1)
                    self.mouse.click_element(507, 419)
                    time.sleep(1)
                    self.mouse.click_element(310, 381)
                    self.screen.find_ele_picture('game\\bangpai\\0_', 'mouse',
                                                 220, 328)
                    time.sleep(2)
                    self.mouse.click_element(220, 328)
                    self.keyboard.press_shortcut_key('alt', '1')
                    time.sleep(1)
                    self.mouse.click_element(500, 313)
                    self.mouse.click_element(500, 313)

                # 领取任务
                self.screen.find_ele_picture('game\\bangpai\\0', 'mouse', 223,
                                             329)
                time.sleep(2)
                # pyautogui.click()
                self.keyboard.press_shortcut_key('alt', 'q')
                time.sleep(2)
                result = self.bangpai_task()
                print(result)
                if result is 'success' or result is 'pass':
                    num += 1
            except:
                pass

    def return_bangpai_npc(self):
        self.keyboard.press_shortcut_key('alt', 'q')
        self.mouse.click_element(517, 239)
        self.keyboard.press_shortcut_key('alt', 'q')
        time.sleep(5)
        self.screen.find_ele_picture('game\\bangpai\\0_1', 'mouse', 193, 327)
        time.sleep(1)
        pyautogui.click()
        time.sleep(3)
        pyautogui.moveTo(392, 239, 1, pyautogui.easeInQuad)
        # self.keyboard.press_shortcut_key('alt', 'q')
        self.screen.cut_screen()
        time.sleep(2)
        loca = self.screen.get_location_picture(
            "D:\\dh2\\game\\bangpai\\0_3.png", 0.9)
        print(loca)
        if loca is 0:
            self.mouse.click_element(193, 367)
        else:
            self.mouse.click_element(loca[0] - 120, loca[1] + 73)
        self.mouse.click_element(420, 239)
        # self.keyboard.press_shortcut_key('alt', '1')
        # self.keyboard.press_shortcut_key('alt', 'q')

    def bangpai_start(self):
        self.common.get_focus()
        for i in range(5):
            # self.common.capation_eat_xiang()
            self.find_bangpai_task()
            self.common.change_teamer()
Exemplo n.º 12
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)
Exemplo n.º 13
0
                time.sleep(0.5)
                Mouse().click_element(237, 399)
                Mouse().click_element(27, 256)
        Common().capation_eat_xiang()
        time.sleep(15)
        Screen().find_ele_picture('game\\xiaogui\\1', 'mouse', 207, 355)
        for i in range(5):
            time.sleep(2)
            KeyBoard().press_shortcut_key('alt', '8')
            Common().change_teamer()
            Mouse().click_element(412, 429)
            if i is 4:
                pass
            else:
                Common().score_for_shifu()
        Screen().find_ele_picture('game\\xiaogui\\2', 'mouse', 780, 537)
        time.sleep(1)
        Screen().cut_screen()
        box_result = Screen().get_location_picture(
            'D:\\dh2\\game\\xiaogui\\3.png', 0.8)
        if box_result is not 0:
            Mouse().click_element(327, 535)
        Common().score_for_shifu()


if __name__ == '__main__':
    Common().get_focus()
    for i in range(200):
        print("第 " + str(i + 1) + " 次 ")
        XiaoGui().task_start()
Exemplo n.º 14
0
class JieFang:
    def __init__(self):
        self.transform = TransForm()
        self.common = Common()
        self.keyboard = KeyBoard()
        self.screen = Screen()
        self.mouse = Mouse()

    def find_flowers(self):
        # 拜访他人获得鲜花
        for i in range(1):
            flower = 0
            if i == 0:
                self.common.get_focus()
            #     else:
            #         self.common.change_teamer()
            #     self.screen.find_ele_picture('game\\jiefang\\0', handle=True, k1='alt', k2='f')
            #     # 打开好友列表查看组队信息
            #     time.sleep(0.5)
            #     self.screen.cut_screen()
            #     result = self.screen.find_color_ele(679, 291)
            #     if result != None:
            #         self.mouse.click_element(result[0], result[1])
            #     self.mouse.click_element_right(730, 315, 1)
            #     self.mouse.click_element(303, 505)
            #     self.mouse.click_element_right(388, 530, 1)
            #     self.mouse.click_element(777, 549)
            #     self.keyboard.press_shortcut_key('alt', 'f')

            # 点击领取街坊任务(花)
            self.mouse.click_element(757, 181)
            self.mouse.click_element(408, 354)
            self.mouse.click_element(182, 346)
            time.sleep(1)
            # for y_ in range(14):

            self.mouse.click_element(92, 227)
            for y in range(30):
                if y < 13:
                    self.mouse.click_element(240, 235 + 20 * y)
                if y > 13:
                    self.mouse.mouse_scroll(-10)
                    time.sleep(0.5)
                    self.mouse.click_element(240, 235 + 20 * 12)
                list = [[543, 307], [481, 334], [422, 366],
                        [480, 396], [541, 427], [597, 395],
                        [657, 362], [598, 332]]
                list_flower = [[556, 267], [483, 294], [426, 328],
                               [488, 365], [545, 398], [602, 360],
                               [672, 329], [617, 295]]
                time.sleep(1)
                self.screen.cut_screen()
                time.sleep(1)
                for index, j in enumerate(list_flower):
                    index = index
                    result = self.screen.find_color_ele(j[0], j[1], 30, 15, 190, 210, 10, 40, 0, 20)
                    if result != None:
                        self.mouse.click_element(list[index][0], list[index][1])
                        self.mouse.click_element(167, 327)
                        for w in range(4):
                            self.mouse.click_element_right(219, 250, 1)
                            time.sleep(5)
                            self.screen.cut_screen()
                            # a = sceen.find_color_ele(426, 328, 10, 10)
                            result = self.screen.template_image("D:\\dh2\\game\\jiefang\\1.PNG")
                            result_ = self.screen.template_image("D:\\dh2\\game\\jiefang\\1_1.PNG")
                            if len(result_)>0:
                                list_ = []
                                lists = []
                                for c in result_:
                                    list_.append(c[0] + 1)
                                for c in result:
                                    if c[0] in list_:
                                        str_ = c[0], c[1]
                                        lists.append(str_)
                                for c in lists:
                                    self.mouse.click_element(c[0], c[1])
                                    self.mouse.click_element(169, 359)
                                    time.sleep(3)
                        self.mouse.click_element(760, 184)
                        self.mouse.click_element(408, 350)
                        self.mouse.click_element(182, 327)


    def jiefang_task(self):
        # 清除任务栏信息
        # for i in range(10):
        #     self.mouse.click_element(356,224)
        self.screen.cut_screen_location(width=200, height=300, x=150, y=190)
        result = self.screen.get_location_picture("D:\\dh2\\game\\system\\task\\0.png", 0.7, cut_zone=True)
        self.mouse.click_element(result[0]+150, result[1]+190)
Exemplo n.º 15
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)
Exemplo n.º 16
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)
Exemplo n.º 17
0
class ShiMen():
    def __init__(self):
        self.transform = TransForm()
        self.common = Common()
        self.keyboard = KeyBoard()
        self.screen = Screen()
        self.mouse = Mouse()
        self.yao = ''
        self.offset = 17 + 15

    def position(self, type):
        if type is 'ren':
            return 596, 508, 168, 345
        elif type is 'mo':
            return 587, 498, 168, 362
        elif type is 'gui':
            return 585, 486, 163, 398
        elif type is 'xian':
            return 595, 520, 168, 345

    def npc_position(self, type):
        if type is 'ren':
            return 659, 300, 404, 381
        elif type is 'mo':
            return 528, 257, 458, 359
        elif type is 'gui':
            return 726, 299, 538, 298
        elif type is 'xian':
            return 222, 190, 445, 318

    def npc_start(self):
        self.keyboard.press_shortcut_key('alt', 'q')
        time.sleep(1)
        self.mouse.click_element(198, 386)
        time.sleep(1)
        self.mouse.click_element(420, 240)
        time.sleep(1)
        self.screen.find_ele_picture('game\\shimen\\1', 'mouse', 193, 361)
        self.keyboard.press_shortcut_key('alt', 'q')
        time.sleep(1)
        self.keyboard.press_shortcut_key('alt', 'q')

    def later(self, zu, offset_, x, y):
        pyautogui.moveTo(420, 527, 1, pyautogui.easeInQuad)
        time.sleep(2)
        self.screen.cut_screen()
        time.sleep(1)
        icon_ = self.screen.get_location_picture(
            "D:\\dh2\\game\\shimen\\1.png")
        time.sleep(1)
        self.mouse.click_element(icon_[0], icon_[1] - self.offset)
        time.sleep(1)
        self.mouse.click_element(x, y)
        time.sleep(1)
        self.screen.find_ele_picture('game\\shimen\\' + zu, 'mouse', 195,
                                     offset_)
        time.sleep(1)
        self.keyboard.press_shortcut_key('alt', 'q')
        time.sleep(1)
        self.keyboard.press_shortcut_key('alt', 'q')
        pyautogui.moveTo(420, 527, 1, pyautogui.easeInQuad)
        time.sleep(2)
        self.screen.cut_screen()
        time.sleep(1)
        icon_ = self.screen.get_location_picture(
            "D:\\dh2\\game\\shimen\\1.png")
        time.sleep(1)
        self.mouse.click_element(icon_[0], icon_[1] - self.offset)
        time.sleep(1)
        self.mouse.click_element(420, 240)
        time.sleep(1)
        self.screen.find_ele_picture('game\\shimen\\' + zu, 'mouse', 195,
                                     offset_)
        time.sleep(1)
        self.keyboard.press_shortcut_key('alt', 'q')
        time.sleep(1)
        self.keyboard.press_shortcut_key('alt', 'q')

    def classify(self, zu, index, offset):
        if index is 0:
            begin = 361
        else:
            begin = 345
        self.screen.cut_screen()
        time.sleep(1.5)
        # self.screen.cut_screen_location(267, 136, 373, 209)
        for i in range(2, 11):
            if zu is 'ren' or zu is 'xian':
                offset_ = 360
            elif zu is 'mo':
                offset_ = 365
            else:
                offset_ = 345
            file_name = "D:\\dh2\\game\\shimen\\" + str(i) + ".png"
            result = self.screen.get_location_picture(file_name, 0.7)
            if result != 0:
                if i == 2:
                    print("风水混元丹")
                    x = 404
                    y = 237
                    if zu is 'gui':
                        haha = 345
                    else:
                        haha = 363
                    time.sleep(1)
                    self.mouse.click_element(386, 257)
                    time.sleep(1)
                    self.mouse.click_element(195, haha)
                    time.sleep(1)
                    self.mouse.click_element(195, haha)
                    time.sleep(1)
                    self.mouse.click_element(195, haha)
                    time.sleep(1)
                    self.keyboard.press_shortcut_key('alt', 'q')
                    time.sleep(1)
                    self.keyboard.press_shortcut_key('alt', '1')
                    time.sleep(1)
                    self.keyboard.press_shortcut_key('alt', 'q')
                    pyautogui.moveTo(420, 527, 1, pyautogui.easeInQuad)
                    time.sleep(2)
                    self.screen.cut_screen()
                    time.sleep(1)
                    icon_ = self.screen.get_location_picture(
                        "D:\\dh2\\game\\shimen\\1.png")
                    time.sleep(1)
                    self.mouse.click_element(icon_[0], icon_[1] - 20)
                    time.sleep(1)
                    self.mouse.click_element(x, y)
                    time.sleep(1)
                    self.screen.find_ele_picture('game\\shimen\\' + zu,
                                                 'mouse', 195, offset_)
                    time.sleep(1)
                    self.keyboard.press_shortcut_key('alt', 'q')
                    time.sleep(1)
                    self.keyboard.press_shortcut_key('alt', 'q')
                    if index is 0:
                        self.yao = 'yao'
                    break
                elif i == 3:
                    print("顶天柱")
                    x = 545
                    y = 239
                    self.mouse.click_element(434, 237)
                    time.sleep(1)
                    self.screen.find_ele_picture('game\\shimen\\3_1', 'mouse',
                                                 184, 329)
                    time.sleep(1)
                    self.keyboard.press_shortcut_key('alt', 'q')
                    time.sleep(1)
                    self.keyboard.press_shortcut_key('alt', 'q')
                    self.later(zu, offset_, x, y)
                    break
                elif i == 4:
                    print("密探")
                    x = 416
                    y = 257
                    self.mouse.click_element(593, 239)
                    time.sleep(1)
                    self.screen.find_ele_picture('game\\shimen\\4_1',
                                                 'keyboard', 'alt', '8')
                    while True:
                        time.sleep(5)
                        self.screen.cut_screen()
                        location = self.screen.get_location_picture(
                            "D:\\dh2\\game\\system\\zidong.png", 0.8)
                        if location is 0:
                            break
                    self.keyboard.press_shortcut_key('alt', 'q')
                    time.sleep(1)
                    self.keyboard.press_shortcut_key('alt', 'q')
                    self.later(zu, offset_, x, y)
                    break
                elif i == 5:
                    print("陈夫人")
                    x = 545
                    y = 239
                    self.mouse.click_element(434, 240)
                    self.screen.find_ele_picture('game\\shimen\\5_1', 'mouse',
                                                 184, 329)
                    time.sleep(1)
                    self.keyboard.press_shortcut_key('alt', 'q')
                    time.sleep(1)
                    self.keyboard.press_shortcut_key('alt', 'q')
                    self.later(zu, offset_, x, y)
                    break
                elif i == 6:
                    print("大香玉")
                    x = 545
                    y = 239
                    self.mouse.click_element(434, 240)
                    self.screen.find_ele_picture('game\\shimen\\6_1', 'mouse',
                                                 184, 329)
                    time.sleep(1)
                    self.keyboard.press_shortcut_key('alt', 'q')
                    time.sleep(1)
                    self.keyboard.press_shortcut_key('alt', 'q')
                    self.later(zu, offset_, x, y)
                    break
                elif i == 7:
                    print("风姑娘")
                    x = 545
                    y = 239
                    self.mouse.click_element(434, 240)
                    self.screen.find_ele_picture('game\\shimen\\7_1', 'mouse',
                                                 184, 329)
                    time.sleep(1)
                    self.keyboard.press_shortcut_key('alt', 'q')
                    time.sleep(1)
                    self.keyboard.press_shortcut_key('alt', 'q')
                    self.later(zu, offset_, x, y)
                    break
                elif i == 8:
                    print("何小姐")
                    x = 545
                    y = 239
                    self.mouse.click_element(434, 240)
                    self.screen.find_ele_picture('game\\shimen\\8_1', 'mouse',
                                                 184, 329)
                    time.sleep(1)
                    self.keyboard.press_shortcut_key('alt', 'q')
                    time.sleep(1)
                    self.keyboard.press_shortcut_key('alt', 'q')
                    self.later(zu, offset_, x, y)
                    break
                elif i == 9:
                    print("胡巧儿")
                    x = 545
                    y = 239
                    self.mouse.click_element(434, 240)
                    self.screen.find_ele_picture('game\\shimen\\9_1', 'mouse',
                                                 184, 329)
                    time.sleep(1)
                    self.keyboard.press_shortcut_key('alt', 'q')
                    time.sleep(1)
                    self.keyboard.press_shortcut_key('alt', 'q')
                    self.later(zu, offset_, x, y)
                    break
                elif i == 10:
                    print("切磋")
                    x = 514
                    y = 240
                    self.mouse.click_element(388, 256)
                    self.screen.find_ele_picture('game\\shimen\\10_1', 'mouse',
                                                 207, 329)
                    time.sleep(2)
                    self.keyboard.press_shortcut_key('alt', '8')
                    while True:
                        time.sleep(5)
                        self.screen.cut_screen()
                        location = self.screen.get_location_picture(
                            "D:\\dh2\\game\\system\\zidong.png", 0.8)
                        if location is 0:
                            break
                    self.keyboard.press_shortcut_key('alt', 'q')
                    time.sleep(1)
                    self.keyboard.press_shortcut_key('alt', 'q')
                    self.later(zu, offset_, x, y)
                    break
                elif i == 11:
                    print("小香玉")
                    x = 545
                    y = 239
                    self.mouse.click_element(434, 240)
                    self.screen.find_ele_picture('game\\shimen\\11_1', 'mouse',
                                                 184, 329)
                    time.sleep(1)
                    self.keyboard.press_shortcut_key('alt', 'q')
                    time.sleep(1)
                    self.keyboard.press_shortcut_key('alt', 'q')
                    self.later(zu, offset_, x, y)
                    break
                elif i == 12:
                    print("黄火牛")
                    x = 545
                    y = 239
                    self.mouse.click_element(434, 240)
                    self.screen.find_ele_picture('game\\shimen\\12_1', 'mouse',
                                                 184, 329)
                    time.sleep(1)
                    self.keyboard.press_shortcut_key('alt', 'q')
                    time.sleep(1)
                    self.keyboard.press_shortcut_key('alt', 'q')
                    self.later(zu, offset_, x, y)
                    break

    def task_start(self, list):
        print("任务开始")
        self.common.get_focus()
        for i in list:
            if i is 'gui':
                aaa = 345
            else:
                aaa = 360
            self.yao = ''
            self.keyboard.press_shortcut_key('alt', '2')
            time.sleep(1)
            self.mouse.click_element(505, 415)
            time.sleep(1)
            positon_ = self.position(i)
            self.mouse.click_element(positon_[0], positon_[1])
            self.screen.find_ele_picture('game\\shimen\\0', 'mouse',
                                         positon_[2], positon_[3])
            time.sleep(2)
            positon2_ = self.npc_position(i)
            self.keyboard.press_shortcut_key('alt', '5')
            self.mouse.click_element(positon2_[0], positon2_[1], right=True)
            time.sleep(2.5)
            self.keyboard.press_shortcut_key('alt', '5')
            time.sleep(5)
            self.mouse.click_element(positon2_[2], positon2_[3])
            time.sleep(1)
            self.screen.find_ele_picture('game\\shimen\\' + i, 'mouse', 193,
                                         aaa)
            time.sleep(1.5)
            pyautogui.click()
            # 取消任务
            self.mouse.click_element(positon2_[2], positon2_[3])
            time.sleep(1)
            self.screen.find_ele_picture('game\\shimen\\' + i, 'mouse', 200,
                                         aaa + 20)
            time.sleep(1)
            self.mouse.click_element(168, 332)
            time.sleep(25)
            # 再次领取
            self.mouse.click_element(positon2_[2], positon2_[3])
            time.sleep(1)
            self.screen.find_ele_picture('game\\shimen\\' + i, 'mouse', 193,
                                         aaa)
            time.sleep(1)
            self.keyboard.press_shortcut_key('alt', 'q')
            pyautogui.moveTo(420, 527, 1, pyautogui.easeInQuad)
            time.sleep(2)
            self.screen.cut_screen()
            time.sleep(1)
            icon = self.screen.get_location_picture(
                "D:\\dh2\\game\\shimen\\1.png")
            time.sleep(1)
            self.mouse.click_element(icon[0], icon[1] - self.offset)
            time.sleep(1)
            for j in range(10):
                print("第" + str(j + 1) + "次")
                # if j is 1 and self.yao is 'yao':
                #     # self.mouse.click_element(505, 415)
                #     # time.sleep(1)
                #     self.mouse.click_element(405, 240)
                #     time.sleep(1)
                if i is 'ren' or i is 'xian':
                    offset_1 = 360
                elif i is 'mo':
                    offset_1 = 365
                else:
                    offset_1 = 345
                self.classify(i, j, offset_1)
                if j is 9:
                    self.keyboard.press_shortcut_key('alt', 'q')
            self.common.change_teamer()


# if __name__ == '__main__':
#     # list = ['mo','mo','gui']
#     list = ['gui']
#
#     ShiMen().task_start(list)
# for i in range(10):
#     ShiMen().classify('xian',0,365)
# Screen().cut_screen_location(267, 136, 373, 209)
Exemplo n.º 18
0
class HouZi:
    def __init__(self):
        self.transform = TransForm()
        self.common = Common()
        self.keyboard = KeyBoard()
        self.screen = Screen()
        self.mouse = Mouse()

    def houzi_task(self, place):
        self.common.get_focus()
        # self.keyboard.press_shortcut_key('alt', '2', times=0.5)
        # self.mouse.click_element(320, 411, times=0.5)
        # self.mouse.click_element(540, 425, times=0.5)
        # self.keyboard.press_shortcut_key('alt', '2', times=0.5)
        # self.common.iswalking()
        num = 0
        while num < 30:
            if num % 5:
                for j in range(5):
                    if j is 0:
                        self.mouse.click_element(697, 131, times=0.5)
                    else:
                        pyautogui.click()
                    self.common.change_teamer()
            for i in place:
                # 打开地图
                self.keyboard.press_shortcut_key('alt', '1', times=0.5)
                self.mouse.click_element(i[0], i[1], times=0.5)
                self.keyboard.press_shortcut_key('alt', '1', times=0.5)
                while True:
                    walking = self.common.iswalking()
                    if walking is False:
                        break
                while True:
                    result = self.task_start()
                    if result is 'success':
                        # self.keyboard.press_shortcut_key('alt', '2', times=0.5)
                        # self.mouse.click_element(499, 419, times=0.5)
                        # self.mouse.click_element(466, 211, times=0.5)
                        num += 1
                    else:
                        print("找不到")
                        break

    def task_start(self):
        while True:
            self.screen.cut_screen_location(820, 650, 0, 0)
            time.sleep(0.5)
            result = Screen().find_color_ele(400,
                                             400,
                                             350,
                                             250,
                                             r1=250,
                                             r2=260,
                                             g1=250,
                                             g2=260,
                                             b1=0,
                                             b2=10,
                                             cut_zone=True)
            if result is not None:
                self.mouse.click_element(result[0] - 10,
                                         result[1] - 25,
                                         times=0.5)
                self.screen.cut_screen()
                time.sleep(0.5)
                loc = self.screen.get_location_picture("D:\\dh2\\houzi\\2.png",
                                                       num=0.7)
                if loc is not 0:
                    self.mouse.click_element(178, 345, times=0.5)
                    time.sleep(10)
                    while True:
                        self.screen.cut_screen()
                        time.sleep(1.5)
                        pos_zidong = self.screen.get_location_picture(
                            "D:\\dh2\\game\\system\\zidong.png")
                        if pos_zidong is None:
                            break
                return 'success'
            else:
                return 'failed'
Exemplo n.º 19
0
class GuiWang():
    def __init__(self):
        self.transform = TransForm()
        self.common = Common()
        self.keyboard = KeyBoard()
        self.screen = Screen()
        self.mouse = Mouse()

    def task_start(self):
        print("任务开始")
        self.common.get_focus()
        for j in range(3):
            self.mouse.click_element(675, 366, 1, True)
            time.sleep(2.5)
        self.keyboard.press_shortcut_key('alt', '5')
        time.sleep(10)
        # 领取任务
        while True:
            print("领取任务")
            self.mouse.click_element(392, 350)
            time.sleep(1)
            self.screen.cut_screen()
            result = self.screen.get_locations_picture(
                "D:\\dh2\\game\\guiwang\\0.png", 0.9)
            if result is not 0:
                self.mouse.click_element(225, 383)
                time.sleep(0.5)
                self.mouse.click_element(180, 353)
                time.sleep(0.5)
                self.mouse.click_element(180, 353)
                result_king = self.is_ghostKing()
                if result_king is True:
                    self.mouse.click_element(392, 350)
                    time.sleep(1)
                    self.screen.cut_screen()
                    result = self.screen.get_locations_picture(
                        "D:\\dh2\\game\\guiwang\\0.png", 0.9)
                    if result is not 0:
                        self.mouse.click_element(268, 330)
                        time.sleep(1)
                        self.mouse.click_element(268, 330)
                else:
                    break
        # 返回长安 开始寻路
        print("返回长安")
        while True:
            self.mouse.click_element(392, 350)
            time.sleep(1)
            self.screen.cut_screen()
            result = self.screen.get_locations_picture(
                "D:\\dh2\\game\\guiwang\\0.png", 0.75)
            if result is not 0:
                self.mouse.click_element(268, 365)
                time.sleep(2)
                self.mouse.click_element(29, 255)
                break

        self.common.capation_eat_xiang()
        # 找到NPC,开始战斗
        print("找NPC")
        time.sleep(10)
        self.screen.find_ele_picture('game\\guiwang\\1', 'mouse', 210, 340)
        for index in range(5):
            time.sleep(2)
            self.keyboard.press_shortcut_key('alt', '8')
            self.common.change_teamer()
            self.mouse.click_element(412, 429)
        time.sleep(10)
        self.screen.find_ele_picture('game\\guiwang\\2_', 'mouse', 172, 340)
        time.sleep(1)
        self.screen.cut_screen()
        time.sleep(1)
        ress = self.screen.get_locations_picture(
            "D:\\dh2\\game\\guiwang\\2_.png", 0.7)
        self.mouse.click_element(ress[0]['result'][0], ress[0]['result'][1])
        time.sleep(1)
        self.mouse.click_element(784, 539)
        time.sleep(1)
        print("回家 判断")
        self.return_home()
        time.sleep(1)
        Screen().cut_screen()
        box_result = Screen().get_location_picture(
            'D:\\dh2\\game\\xiaogui\\3.png', 0.8)
        if box_result is not 0:
            Mouse().click_element(327, 535)

    def is_ghostKing(self):
        self.screen.cut_screen_by_PIL(20, 265, 50, 300,
                                      "D:\\dh2\\system\\1.PNG")
        result = self.screen.find_color_ele(10, 10, 8, 8, 255, 255, 0, 0, 0, 0,
                                            True)
        if result is not None:
            return True
        else:
            return False

    def return_home(self):
        time.sleep(1)
        self.screen.cut_screen()
        result = self.screen.get_locations_picture(
            "D:\\dh2\\game\\guiwang\\3.png", 0.7)
        print(result)
        if len(result) is not 0:
            self.mouse.click_element(757, 455, 1, True)
            time.sleep(1.5)
            self.mouse.click_element(757, 455, 1, True)
            self.mouse.click_element(569, 450)
            self.mouse.click_element(178, 347)
Exemplo n.º 20
0
class TianTi():
    def __init__(self):
        self.transform = TransForm()
        self.common = Common()
        self.keyboard = KeyBoard()
        self.screen = Screen()
        self.mouse = Mouse()
    def chong_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)
            time.sleep(0.5)
            self.mouse.click_element(289, 383)

    def task_start(self):
        print("任务开始")
        self.common.get_focus()
        time.sleep(1)
        # 切换宝宝
        for i in range(5):
            self.common.change_dog(2)
            time.sleep(1)
            self.common.change_teamer(times=0.3)
        time.sleep(1)
        self.mouse.click_element(757, 553)
        time.sleep(1)
        self.mouse.click_element(161, 327)
        time.sleep(3)
        # 开始点击天梯
        self.mouse.click_element(770, 193)
        time.sleep(1)
        for i in range(10):
            for z in range(5):
                self.mouse.click_element(422, 144,right=True)
                time.sleep(1)
                self.common.change_teamer(times=0.3)
            if i is not 0:
                time.sleep(3)
            self.screen.find_ele_picture('game\\tianti\\begin')
            self.mouse.click_element(470, 444)
            for z in range(5):
                if z is 0:
                    self.mouse.click_element(312, 490)
                else:
                    pyautogui.click()
                time.sleep(1)
                self.common.change_teamer(times=0.3)
            # flag = 0
            self.screen.find_ele_picture('system\\zidong')
            self.common.find_attack('f7')
            pyautogui.click()
            self.keyboard.press_shortcut_key('alt', '8',times=0.3)
            self.common.change_teamer(times=0.3)
            for i in range(4):
                self.keyboard.press_key('f7')
                pyautogui.click()
                pyautogui.rightClick()
                pyautogui.click()
                self.keyboard.press_shortcut_key('alt', '8',times=0.3)
                self.common.change_teamer(times=0.3)
            self.common.get_focus()
            self.common.game_over()