Ejemplo n.º 1
0
    def mianfeishilian(self):
        # 免费十连
        self.lockimg('img/liwu.bmp',
                     elseclick=[(131, 533)],
                     elsedelay=1,
                     at=(891, 413, 930, 452))  # 回首页
        self.lockimg('img/liwu.bmp',
                     ifclick=[(750, 510)],
                     ifdelay=1,
                     at=(891, 413, 930, 452))  # 点进扭蛋界面

        time.sleep(1)
        screen_shot_ = self.d.screenshot(format="opencv")
        if UIMatcher.img_where(screen_shot_,
                               'img/mianfeishilian.jpg'):  # 仅当有免费十连时抽取免费十连
            self.d.click(872, 355)  # 点击十连
            time.sleep(1)
            self.d.click(592, 369)  # 确认

        while True:
            screen_shot_ = self.d.screenshot(format="opencv")
            if UIMatcher.img_where(screen_shot_,
                                   'img/liwu.bmp',
                                   at=(891, 413, 930, 452)):
                break
            self.d.click(900, 40)
            time.sleep(0.5)
            self.d.click(100, 505)
            time.sleep(0.5)
            self.d.click(100, 505)
            time.sleep(1)  # 首页锁定,保证回到首页
Ejemplo n.º 2
0
 def doActivityHard(self):
     # 进入冒险
     time.sleep(2)
     self.d.click(480, 505)
     time.sleep(2)
     while True:
         screen_shot_ = self.d.screenshot(format="opencv")
         if UIMatcher.img_where(screen_shot_, 'img/dixiacheng.jpg'):
             break
     # 点击进入活动
     self.d.click(415, 430)
     time.sleep(3)
     while True:
         screen_shot_ = self.d.screenshot(format="opencv")
         self.d.click(480, 380)
         time.sleep(0.5)
         self.d.click(480, 380)
         if UIMatcher.img_where(screen_shot_, 'img/normal.jpg'):
             self.d.click(880, 80)
         if UIMatcher.img_where(screen_shot_, 'img/hard.jpg'):
             break
     self.shuatuzuobiao(689, 263, self.times)  # 1-5
     self.continueDo9(570, 354)  # 1-4
     self.continueDo9(440, 255)  # 1-3
     self.continueDo9(300, 339)  # 1-2
     self.continueDo9(142, 267)  # 1-1
     self.lockimg('img/liwu.bmp', elseclick=[(131, 533)], elsedelay=1, at=(891, 413, 930, 452))  # 回首页
Ejemplo n.º 3
0
    def mianfeishilian(self):
        # 免费十连
        self.lock_home()
        self.lock_img('img/liwu.bmp',
                      ifclick=[(750, 510)],
                      ifdelay=1,
                      at=(891, 413, 930, 452))  # 点进扭蛋界面

        time.sleep(1)
        screen_shot_ = self.getscreen()
        if UIMatcher.img_where(screen_shot_,
                               'img/mianfeishilian.jpg'):  # 仅当有免费十连时抽取免费十连
            self.click(872, 355)  # 点击十连
            time.sleep(1)
            self.click(592, 369)  # 确认

        while True:
            screen_shot_ = self.getscreen()
            if UIMatcher.img_where(screen_shot_,
                                   'img/liwu.bmp',
                                   at=(891, 413, 930, 452)):
                break
            self.click(900, 40)
            time.sleep(0.5)
            self.click(100, 505)
            time.sleep(0.5)
            self.click(100, 505)
            time.sleep(1)  # 首页锁定,保证回到首页
Ejemplo n.º 4
0
 def duanyazuobiao(self):
     self.tag = 0
     time.sleep(2)
     while True:
         screen_shot_ = self.d.screenshot(format="opencv")
         if UIMatcher.img_where(screen_shot_, 'img/duanyazuobiao.jpg'):
             pcr_log(self.account).write_log(level='info', message='>>>成功识别标记,开始刷图.<<<\r\n')
             break
         if self.tag > 11:  # 超过11次点击则不刷图
             pcr_log(self.account).write_log(level='warning', message='>>>点击超过11次,已错过标记点!刷图任务异常,开启高延迟!<<<\r\n'
                                                                      '提示:请增加duanyazuobiao的延迟时间<<<\r\n')
             if UIMatcher.img_where(screen_shot_, 'img/duanyazuobiao.jpg'):
                 break
             if self.tag > 22:  # 超过11次点击则不刷图
                 pcr_log(self.account).write_log(level='warning', message='>>>已错过标记点,高延迟模式失败,放弃刷图.<<<\r\n'
                                                                          '>>>提示:请增加duanyazuobiao的延迟时间<<<\r\n')
                 break
             else:
                 for _ in range(1):
                     self.click(925, 275)
                     self.tag += 1
                     time.sleep(4)  # 这是高延迟识别时间,模拟器卡顿请加时.
         else:
             for _ in range(1):
                 self.click(27, 272)
                 self.tag += 1
                 time.sleep(2)  # 这是延迟识别时间,模拟器卡顿请加时.
Ejemplo n.º 5
0
    def shuajingyan(self, map):
        """
        刷图刷1-1
        map为主图
        """
        # 进入冒险
        time.sleep(2)
        self.d.click(480, 505)
        time.sleep(2)

        while True:
            screen_shot_ = self.d.screenshot(format="opencv")
            if UIMatcher.img_where(screen_shot_, 'img/dixiacheng.jpg'):
                break
        self.d.click(562, 253)
        time.sleep(2)
        while True:
            screen_shot_ = self.d.screenshot(format="opencv")
            if UIMatcher.img_where(screen_shot_,
                                   'img/normal.jpg',
                                   at=(660, 72, 743, 94)):
                break
        for i in range(map):
            time.sleep(3)
            self.d.click(27, 272)
        self.shuatuzuobiao(106, 279, 160)  # 1-1 刷7次体力为佳

        self.lockimg('img/liwu.bmp',
                     elseclick=[(131, 533)],
                     elsedelay=1,
                     at=(891, 413, 930, 452))  # 回首页
Ejemplo n.º 6
0
 def doActivityHard(self):
     # 进入冒险
     time.sleep(2)
     self.click(480, 505)
     time.sleep(2)
     while True:
         screen_shot_ = self.getscreen()
         if UIMatcher.img_where(screen_shot_, 'img/dixiacheng.jpg'):
             break
     # 点击进入活动
     self.click(415, 430)
     time.sleep(3)
     while True:
         screen_shot_ = self.getscreen()
         self.click(480, 380)
         time.sleep(0.5)
         self.click(480, 380)
         if UIMatcher.img_where(screen_shot_, 'img/zhuxian.jpg'):
             self.click(880, 80)
         if UIMatcher.img_where(screen_shot_, 'img/hard.jpg'):
             break
     self.shuatuzuobiao(689, 263, self.times)  # 1-5
     self.continueDo9(570, 354)  # 1-4
     self.continueDo9(440, 255)  # 1-3
     self.continueDo9(300, 339)  # 1-2
     self.continueDo9(142, 267)  # 1-1
     self.lock_home()
Ejemplo n.º 7
0
 def shuatu12(self):
     # 进入冒险
     self.click(480, 505, pre_delay=2, post_delay=2)
     while True:
         screen_shot_ = self.d.screenshot(format="opencv")
         if UIMatcher.img_where(screen_shot_, 'img/dixiacheng.jpg'):
             break
     self.click(
         562,
         253,
     )
     self.click(701, 83, pre_delay=4, post_delay=2)
     self.duanyazuobiao()
     if self.tag < 22:  # 暂时先按各11次来判定
         for _ in range(5):
             # 以7图为基向右移动5图
             self.click(925, 275, post_delay=3)
         while True:
             screen_shot_ = self.d.screenshot(format="opencv")
             if UIMatcher.img_where(screen_shot_,
                                    'img/normal.jpg',
                                    at=(660, 72, 743, 94)):
                 break
             if UIMatcher.img_where(screen_shot_, 'img/hard.jpg'):
                 self.click(701, 83, pre_delay=0, post_delay=2)
                 break
         self.switch = 0
         self.d.drag(600, 270, 200, 270, 0.1)  # 拖拽到最右
         time.sleep(2)
         self.shuatuzuobiao(760, 255, self.times)  # 12-17
         self.shuatuzuobiao(610, 245, self.times)  # 12-16
         self.shuatuzuobiao(450, 270, self.times)  # 12-15
         self.shuatuzuobiao(565, 415, self.times)  # 12-14
         self.shuatuzuobiao(400, 425, self.times)  # 12-13
         self.shuatuzuobiao(280, 365, self.times)  # 12-12
         self.shuatuzuobiao(265, 245, self.times)  # 12-11
         self.shuatuzuobiao(130, 265, self.times)  # 12-10
         self.d.drag(200, 270, 600, 270, 0.1)  # 拖拽到最左
         time.sleep(2)
         self.shuatuzuobiao(675, 380, self.times)  # 12-9
         self.shuatuzuobiao(550, 440, self.times)  # 12-8
         self.shuatuzuobiao(445, 365, self.times)  # 12-7
         self.shuatuzuobiao(575, 245, self.times)  # 12-6
         self.shuatuzuobiao(435, 250, self.times)  # 12-5
         self.shuatuzuobiao(310, 285, self.times)  # 12-4
         self.shuatuzuobiao(265, 395, self.times)  # 12-3
         self.shuatuzuobiao(155, 315, self.times)  # 12-2
         self.shuatuzuobiao(185, 210, self.times)  # 12-1
         self.lockimg('img/liwu.bmp',
                      elseclick=[(131, 533)],
                      elsedelay=1,
                      at=(891, 413, 930, 452))  # 回首页
     else:
         pcr_log(self.account).write_log(level='error',
                                         message='>>>高延迟模式刷图失败,放弃刷图<<<\r\n')
         self.lockimg('img/liwu.bmp',
                      elseclick=[(131, 533)],
                      elsedelay=1,
                      at=(891, 413, 930, 452))  # 回首页
Ejemplo n.º 8
0
 def shuatu11(self):
     # 进入冒险
     self.click(480, 505, pre_delay=2, post_delay=2)
     while True:
         screen_shot_ = self.d.screenshot(format="opencv")
         if UIMatcher.img_where(screen_shot_, 'img/dixiacheng.jpg'):
             break
     self.click(
         562,
         253,
     )
     self.click(701, 83, pre_delay=4, post_delay=2)
     self.duanyazuobiao()
     if self.tag < 22:  # 暂时先按各11次来判定
         for _ in range(4):
             # 以7图为基向右移动4图
             self.click(925, 275, post_delay=3)
         while True:
             screen_shot_ = self.d.screenshot(format="opencv")
             if UIMatcher.img_where(screen_shot_,
                                    'img/normal.jpg',
                                    at=(660, 72, 743, 94)):
                 break
             if UIMatcher.img_where(screen_shot_, 'img/hard.jpg'):
                 self.click(701, 83, pre_delay=0, post_delay=2)
                 break
         self.switch = 0
         self.d.drag(600, 270, 200, 270, 0.1)  # 拖拽到最右
         time.sleep(2)
         self.shuatuzuobiao(663, 408, self.times)  # 11-17
         self.shuatuzuobiao(542, 338, self.times)  # 11-16
         self.shuatuzuobiao(468, 429, self.times)  # 11-15
         self.shuatuzuobiao(398, 312, self.times)  # 11-14
         self.shuatuzuobiao(302, 428, self.times)  # 11-13
         self.shuatuzuobiao(182, 362, self.times)  # 11-12
         self.shuatuzuobiao(253, 237, self.times)  # 11-11
         self.shuatuzuobiao(107, 247, self.times)  # 11-10
         self.d.drag(200, 270, 600, 270, 0.1)  # 拖拽到最左
         time.sleep(2)
         self.shuatuzuobiao(648, 316, self.times)  # 11-9
         self.shuatuzuobiao(594, 420, self.times)  # 11-8
         self.shuatuzuobiao(400, 432, self.times)  # 11-7
         self.shuatuzuobiao(497, 337, self.times)  # 11-6
         self.shuatuzuobiao(558, 240, self.times)  # 11-5
         self.shuatuzuobiao(424, 242, self.times)  # 11-4
         self.shuatuzuobiao(290, 285, self.times)  # 11-3
         self.shuatuzuobiao(244, 412, self.times)  # 11-2
         self.shuatuzuobiao(161, 325, self.times)  # 11-1
         self.lockimg('img/liwu.bmp',
                      elseclick=[(131, 533)],
                      elsedelay=1,
                      at=(891, 413, 930, 452))  # 回首页
     else:
         pcr_log(self.account).write_log(level='error',
                                         message='>>>高延迟模式刷图失败,放弃刷图<<<\r\n')
         self.lockimg('img/liwu.bmp',
                      elseclick=[(131, 533)],
                      elsedelay=1,
                      at=(891, 413, 930, 452))  # 回首页
Ejemplo n.º 9
0
 def shuatu10(self):
     # 进入冒险
     self.click(480, 505, pre_delay=2, post_delay=2)
     while True:
         screen_shot_ = self.d.screenshot(format="opencv")
         if UIMatcher.img_where(screen_shot_, 'img/dixiacheng.jpg'):
             break
     self.click(
         562,
         253,
     )
     self.click(701, 83, pre_delay=4, post_delay=2)
     self.duanyazuobiao()
     if self.tag < 22:  # 暂时先按各11次来判定
         for _ in range(3):
             # 以7图为基向右移动3图
             self.click(925, 275, post_delay=3)
         while True:
             screen_shot_ = self.d.screenshot(format="opencv")
             if UIMatcher.img_where(screen_shot_,
                                    'img/normal.jpg',
                                    at=(660, 72, 743, 94)):
                 break
             if UIMatcher.img_where(screen_shot_, 'img/hard.jpg'):
                 self.click(701, 83, pre_delay=0, post_delay=2)
                 break
         self.switch = 0
         self.d.drag(600, 270, 200, 270, 0.1)
         time.sleep(2)
         self.shuatuzuobiao(821, 299, self.times)  # 10-17
         self.shuatuzuobiao(703, 328, self.times)  # 10-16
         self.shuatuzuobiao(608, 391, self.times)  # 10-15
         self.shuatuzuobiao(485, 373, self.times)  # 10-14
         self.shuatuzuobiao(372, 281, self.times)  # 10-13
         self.shuatuzuobiao(320, 421, self.times)  # 10-12
         self.shuatuzuobiao(172, 378, self.times)  # 10-11
         self.shuatuzuobiao(251, 235, self.times)  # 10-10
         self.shuatuzuobiao(111, 274, self.times)  # 10-9
         self.d.drag(200, 270, 600, 270, 0.1)  # 拖拽到最左
         time.sleep(2)
         self.shuatuzuobiao(690, 362, self.times)  # 10-8
         self.shuatuzuobiao(594, 429, self.times)  # 10-7
         self.shuatuzuobiao(411, 408, self.times)  # 10-6
         self.shuatuzuobiao(518, 332, self.times)  # 10-5
         self.shuatuzuobiao(603, 238, self.times)  # 10-4
         self.shuatuzuobiao(430, 239, self.times)  # 10-3
         self.shuatuzuobiao(287, 206, self.times)  # 10-2
         self.shuatuzuobiao(146, 197, self.times)  # 10-1
         self.lockimg('img/liwu.bmp',
                      elseclick=[(131, 533)],
                      elsedelay=1,
                      at=(891, 413, 930, 452))  # 回首页
     else:
         pcr_log(self.account).write_log(level='error',
                                         message='>>>高延迟模式刷图失败,放弃刷图<<<\r\n')
         self.lockimg('img/liwu.bmp',
                      elseclick=[(131, 533)],
                      elsedelay=1,
                      at=(891, 413, 930, 452))  # 回首页
Ejemplo n.º 10
0
    def shoushuazuobiao(self, x, y, jiaocheng=0, lockpic='img/normal.jpg', screencut=None):
        """
        不使用挑战券挑战,xy为该图坐标
        jiaocheng=0 只处理简单的下一步和解锁内容
        jiaocheng=1 要处理复杂的教程
        lockpic: 返回时锁定的图
        screencut: 返回时锁定的图的搜索范围
        :return:
        """
        while True:
            screen_shot_ = self.d.screenshot(format="opencv")
            if UIMatcher.img_where(screen_shot_, lockpic, at=screencut):
                break
            self.d.click(1, 138)
            time.sleep(1)
        self.lockimg('img/tiaozhan.jpg', elseclick=[(x, y)], elsedelay=2)
        self.d.click(840, 454)
        time.sleep(0.7)

        while True:
            screen_shot_ = self.d.screenshot(format="opencv")
            if UIMatcher.imgs_where(screen_shot_, ['img/kuaijin.jpg', 'img/kuaijin_1.jpg']) != {}:
                break
            self.d.click(840, 454)  # 点到进入战斗画面
            time.sleep(0.7)
        while True:
            screen_shot_ = self.d.screenshot(format="opencv")
            if self.click_img(screen_shot_, 'img/kuaijin.jpg', at=(891, 478, 936, 517)):
                time.sleep(1)
            if self.click_img(screen_shot_, 'img/auto.jpg', at=(891, 410, 936, 438)):
                time.sleep(1)
            if UIMatcher.img_where(screen_shot_, 'img/wanjiadengji.jpg', at=(233, 168, 340, 194)):
                break
            self.d.click(1, 138)
            time.sleep(0.5)
        if jiaocheng == 1:  # 有复杂的教程,交给教程函数处理
            self.chulijiaocheng()
        else:  # 无复杂的教程,自己处理掉“下一步”
            for _ in range(7):
                self.d.click(832, 506)
                time.sleep(0.2)
            while True:
                time.sleep(2)
                screen_shot_ = self.d.screenshot(format="opencv")
                if UIMatcher.img_where(screen_shot_, lockpic, at=screencut):
                    break
                elif UIMatcher.img_where(screen_shot_, 'img/xiayibu.jpg'):
                    self.d.click(832, 506)
                else:
                    self.d.click(1, 100)
            while True:  # 两次确认回到挑战界面
                self.d.click(1, 100)
                time.sleep(0.5)
                screen_shot_ = self.d.screenshot(format="opencv")
                if UIMatcher.img_where(screen_shot_, lockpic, at=screencut):
                    break
Ejemplo n.º 11
0
 def shuatu8(self):
     # 进入冒险
     self.click(480, 505, pre_delay=2, post_delay=2)
     while True:
         screen_shot_ = self.d.screenshot(format="opencv")
         if UIMatcher.img_where(screen_shot_, 'img/dixiacheng.jpg'):
             break
     self.click(
         562,
         253,
     )
     self.click(701, 83, pre_delay=4, post_delay=2)
     self.duanyazuobiao()
     if self.tag < 22:  # 暂时先按各11次来判定
         for _ in range(1):
             # 以7图为基向右移动3图
             self.click(925, 275, post_delay=3)
         while True:
             screen_shot_ = self.d.screenshot(format="opencv")
             if UIMatcher.img_where(screen_shot_,
                                    'img/normal.jpg',
                                    at=(660, 72, 743, 94)):
                 break
             if UIMatcher.img_where(screen_shot_, 'img/hard.jpg'):
                 self.click(701, 83, pre_delay=0, post_delay=2)
                 break
         self.switch = 0
         self.d.drag(600, 270, 200, 270, 0.1)
         time.sleep(2)
         self.shuatuzuobiao(584, 260, self.times)  # 8-14
         self.shuatuzuobiao(715, 319, self.times)  # 8-13
         self.shuatuzuobiao(605, 398, self.times)  # 8-12
         self.shuatuzuobiao(478, 374, self.times)  # 8-11
         self.shuatuzuobiao(357, 405, self.times)  # 8-10
         self.shuatuzuobiao(263, 324, self.times)  # 8-9
         self.shuatuzuobiao(130, 352, self.times)  # 8-8
         self.d.drag(200, 270, 600, 270, 0.1)  # 拖拽到最左
         time.sleep(2)
         self.shuatuzuobiao(580, 401, self.times)  # 8-7
         self.shuatuzuobiao(546, 263, self.times)  # 8-6
         self.shuatuzuobiao(457, 334, self.times)  # 8-5
         self.shuatuzuobiao(388, 240, self.times)  # 8-4
         self.shuatuzuobiao(336, 314, self.times)  # 8-3
         self.shuatuzuobiao(230, 371, self.times)  # 8-2
         self.shuatuzuobiao(193, 255, self.times)  # 8-1
         self.lockimg('img/liwu.bmp',
                      elseclick=[(131, 533)],
                      elsedelay=1,
                      at=(891, 413, 930, 452))  # 回首页
     else:
         pcr_log(self.account).write_log(level='error',
                                         message='>>>高延迟模式刷图失败,放弃刷图<<<\r\n')
         self.lockimg('img/liwu.bmp',
                      elseclick=[(131, 533)],
                      elsedelay=1,
                      at=(891, 413, 930, 452))  # 回首页
Ejemplo n.º 12
0
    def do_activity_normal(self, buy_tili=0, activity_name="", mode=0):
        self.lock_home()
        if activity_name == "":
            raise Exception("请指定活动名")

        def enter_activity():
            # 进入冒险
            time.sleep(2)
            self.click(480, 505)
            time.sleep(2)
            while True:
                screen_shot_ = self.getscreen()
                if UIMatcher.img_where(screen_shot_, 'img/dixiacheng.jpg'):
                    break
            # 点击进入活动
            self.click(415, 430)
            time.sleep(3)

        def GetXYTD_activity(activity_name, mode, num):
            if mode == 0:
                D = ACTIVITY_COORD[activity_name]
                DR = D["right"]
                DL = D["left"]
                if num in DR:
                    return DR[num].x, DR[num].y, 1, "right"
                else:
                    return DL[num].x, DL[num].y, 1, "left"
            elif mode == 1:
                D = HARD_COORD[activity_name]
                return D[num].x, D[num].y, 1, None

        enter_activity()
        while True:
            screen_shot_ = self.getscreen()
            self.click(480, 380)
            time.sleep(0.5)
            self.click(480, 380)
            if UIMatcher.img_where(screen_shot_, 'img/home/zhuxian.bmp'):
                self.click(880, 80)
            if UIMatcher.img_where(screen_shot_, 'img/juqing/caidanyuan.bmp'):
                self.chulijiaocheng(turnback=None)
                enter_activity()
            if UIMatcher.img_where(screen_shot_, 'img/normal.jpg'):
                break
        for i in range(1,5):
            result = self.zhandouzuobiao(*GetXYTD_activity(activity_name=activity_name, mode=mode, num=i),
                                         buy_tili=buy_tili, duiwu=-2,
                                         bianzu=-2, juqing_in_fight=1, end_mode=1)
            if result < 3:
                raise Exception("你的练度不适合刷活动图,请提升练度后重试")
        result = self.zhandouzuobiao(*GetXYTD_activity(activity_name=activity_name, mode=mode, num=5),
                                     buy_tili=buy_tili, use_saodang=True, times="all",
                                     juqing_in_fight=1, end_mode=1)
        self.lock_home()
Ejemplo n.º 13
0
 def shuatu7(self):
     # 进入冒险
     self.click(480, 505, pre_delay=2, post_delay=2)
     while True:
         screen_shot_ = self.d.screenshot(format="opencv")
         if UIMatcher.img_where(screen_shot_, 'img/dixiacheng.jpg'):
             break
     self.d.click(562, 253)
     time.sleep(3)
     self.d.click(701, 83)
     time.sleep(2)
     self.duanyazuobiao()
     if self.tag < 22:  # 暂时先按各11次来判定
         while True:
             screen_shot_ = self.d.screenshot(format="opencv")
             if UIMatcher.img_where(screen_shot_,
                                    'img/normal.jpg',
                                    at=(660, 72, 743, 94)):
                 break
             if UIMatcher.img_where(screen_shot_, 'img/hard.jpg'):
                 self.d.click(701, 83)
                 break
         self.switch = 0
         self.d.drag(600, 270, 200, 270, 0.1)  # 拖拽到最右
         time.sleep(2)
         self.shuatuzuobiao(760, 240, self.times)  # 7-14
         self.shuatuzuobiao(630, 257, self.times)  # 7-13
         self.shuatuzuobiao(755, 350, self.times)  # 7-12
         self.shuatuzuobiao(664, 410, self.times)  # 7-11
         self.shuatuzuobiao(544, 400, self.times)  # 7-10
         self.shuatuzuobiao(505, 300, self.times)  # 7-9
         self.shuatuzuobiao(410, 240, self.times)  # 7-8
         self.d.drag(200, 270, 600, 270, 0.1)  # 拖拽到最左
         time.sleep(2)
         self.shuatuzuobiao(625, 230, self.times)  # 7-7
         self.shuatuzuobiao(680, 365, self.times)  # 7-6
         self.shuatuzuobiao(585, 425, self.times)  # 7-5
         self.shuatuzuobiao(500, 330, self.times)  # 7-4
         self.shuatuzuobiao(450, 240, self.times)  # 7-3
         self.shuatuzuobiao(353, 285, self.times)  # 7-2
         self.shuatuzuobiao(275, 200, self.times)  # 7-1
         self.lockimg('img/liwu.bmp',
                      elseclick=[(131, 533)],
                      elsedelay=1,
                      at=(891, 413, 930, 452))  # 回首页
     else:
         pcr_log(self.account).write_log(level='error',
                                         message='>>>高延迟模式刷图失败,放弃刷图<<<\r\n')
         self.lockimg('img/liwu.bmp',
                      elseclick=[(131, 533)],
                      elsedelay=1,
                      at=(891, 413, 930, 452))  # 回首页
Ejemplo n.º 14
0
 def change_acc(self):  # 切换账号
     self.d.click(871, 513)  # 主菜单
     while True:  # 锁定帮助
         screen_shot_ = self.d.screenshot(format="opencv")
         if UIMatcher.img_where(screen_shot_, 'img/bangzhu.bmp'):
             break
     self.d.click(165, 411)  # 退出账号
     while True:  # 锁定帮助
         screen_shot_ = self.d.screenshot(format="opencv")
         if UIMatcher.img_where(screen_shot_, 'img/ok.bmp'):
             break
     self.d.click(591, 369)  # ok
     time.sleep(1)
Ejemplo n.º 15
0
    async def juqingtiaoguo(self):
        # 异步跳过教程 By:CyiceK
        # 测试
        global th_sw
        global screenshot
        while th_sw == 0:
            cpu_occupy = psutil.cpu_percent(interval=5, percpu=False)
            if cpu_occupy >= 80:
                # print('ka')
                time.sleep(0.8)
            try:
                # await asyncio.sleep(10)
                # time.sleep(10)
                # 过快可能会卡
                if UIMatcher.img_where(screenshot,
                                       'img/caidan_yuan.jpg',
                                       at=(860, 0, 960, 100)):
                    self.d.click(917, 39)  # 菜单
                    time.sleep(1)
                    self.d.click(807, 44)  # 跳过
                    time.sleep(1)
                    self.d.click(589, 367)  # 跳过ok
                    time.sleep(5)
                if UIMatcher.img_where(screenshot,
                                       'img/kekeluo.bmp',
                                       at=(181, 388, 384, 451)):
                    # 防妈骑脸
                    self.d.click(1, 1)
                    time.sleep(3)
                    self.d.click(1, 1)
                if UIMatcher.img_where(screenshot,
                                       'img/dxc_tb_1.bmp',
                                       at=(0, 390, 147, 537)):
                    self.lockimg('img/liwu.bmp',
                                 elseclick=[(131, 533)],
                                 elsedelay=1)  # 回首页
                if UIMatcher.img_where(screenshot,
                                       'img/dxc_tb_2.bmp',
                                       at=(580, 320, 649, 468)):
                    time.sleep(4)
                    self.d.click(610, 431)
                    self.lockimg('img/liwu.bmp',
                                 elseclick=[(131, 533)],
                                 elsedelay=1)  # 回首页

            except Exception as e:
                pcr_log(self.account).write_log(
                    level='error', message='异步线程终止并检测出异常{}'.format(e))
                th_sw = 1
                # sys.exit()
                break
Ejemplo n.º 16
0
 def enterJJC(self, x, y):
     self.d.click(480, 505)
     time.sleep(2)
     while True:
         screen_shot_ = self.d.screenshot(format="opencv")
         if UIMatcher.img_where(screen_shot_, 'img/dixiacheng.jpg'):
             break
     self.d.click(x, y)
     time.sleep(2)
     while True:
         screen_shot_ = self.d.screenshot(format="opencv")
         self.d.click(36, 77)
         if UIMatcher.img_where(screen_shot_, 'img/list.jpg'):
             break
Ejemplo n.º 17
0
 def init_home(self):
     while True:
         screen_shot_ = self.d.screenshot(format="opencv")
         if UIMatcher.img_where(screen_shot_,
                                'img/liwu.bmp',
                                at=(891, 413, 930, 452)):
             break
         if UIMatcher.img_where(screen_shot_,
                                'img/niudan_jiasu.jpg',
                                at=(700, 0, 960, 100)):
             self.d.click(893, 39)  # 跳过
             time.sleep(0.5)
             continue
         if UIMatcher.img_where(screen_shot_,
                                'img/jingsaikaishi.bmp',
                                at=(755, 471, 922, 512)):
             self.d.click(786, 308)  # 选角色
             time.sleep(0.2)
             self.d.click(842, 491)  # 开始
             time.sleep(0.5)
             continue
         self.d.click(1, 1)
         self.d.click(330, 270)
         # 跳过特别庆典
     self.lockimg('img/liwu.bmp',
                  elseclick=[(1, 1)],
                  elsedelay=0.2,
                  at=(891, 413, 930, 452))  # 首页锁定
     time.sleep(0.5)
     # 这里防一波第二天可可萝跳脸教程
     screen_shot_ = self.d.screenshot(format="opencv")
     num_of_white, _, _ = UIMatcher.find_gaoliang(screen_shot_)
     if num_of_white < 50000:
         self.lockimg('img/renwu_1.bmp',
                      elseclick=[(837, 433)],
                      elsedelay=1)
         self.lockimg('img/liwu.bmp',
                      elseclick=[(90, 514)],
                      elsedelay=0.2,
                      at=(891, 413, 930, 452))
         return
     if UIMatcher.img_where(screen_shot_, 'img/kekeluo.bmp'):
         self.lockimg('img/renwu_1.bmp',
                      elseclick=[(837, 433)],
                      elsedelay=1)
         self.lockimg('img/liwu.bmp',
                      elseclick=[(90, 514)],
                      elsedelay=0.2,
                      at=(891, 413, 930, 452))
Ejemplo n.º 18
0
    def hanghui(self):
        """
        行会自动捐赠装备
        """
        self.find_img('img/liwu.bmp',
                      elseclick=[(131, 533)],
                      elsedelay=1,
                      at=(891, 413, 930, 452))  # 回首页
        time.sleep(1)
        # self.d.click(693, 436)
        self.find_img('img/hanghui.bmp', elseclick=[(693, 436)],
                      elsedelay=1)  # 锁定进入行会
        time.sleep(1)
        while True:  # 6-17修改:减少opencv使用量提高稳定性
            screen_shot_ = self.d.screenshot(format="opencv")
            if UIMatcher.img_where(screen_shot_, 'img/zhiyuansheding.bmp'):
                time.sleep(3)  # 加载行会聊天界面会有延迟
                for _ in range(2):
                    time.sleep(2)
                    screen_shot = self.d.screenshot(format="opencv")
                    if UIMatcher.img_where(screen_shot,
                                           'img/juanzengqingqiu.jpg'):
                        self.click(367, 39, post_delay=2)  # 点击定位捐赠按钮
                        screen_shot = self.d.screenshot(format="opencv")
                        self.guochang(screen_shot, ['img/juanzeng.jpg'],
                                      suiji=0)
                        self.click(644, 385, pre_delay=1,
                                   post_delay=3)  # 点击max
                        screen_shot = self.d.screenshot(format="opencv")
                        self.guochang(screen_shot, ['img/ok.bmp'], suiji=0)
                        self.click(560, 369, pre_delay=2, post_delay=1)
                while True:
                    self.click(1, 1, post_delay=1)
                    screen_shot = self.d.screenshot(format="opencv")
                    if UIMatcher.img_where(screen_shot,
                                           'img/zhiyuansheding.bmp'):
                        break
                break
            time.sleep(2)
            # 处理多开捐赠失败的情况
            screen_shot = self.d.screenshot(format="opencv")
            self.guochang(screen_shot, ['img/ok.bmp'], suiji=0)
            self.click(1, 1, post_delay=1)  # 处理被点赞的情况

        self.click(100, 505, post_delay=1)  # 回到首页
        self.find_img('img/liwu.bmp',
                      elseclick=[(131, 533), (1, 1)],
                      elsedelay=1,
                      at=(891, 413, 930, 452))  # 回首页
Ejemplo n.º 19
0
 def PartIN(self: Automator):
     # 进入冒险
     time.sleep(2)
     self.d.click(480, 505)
     time.sleep(2)
     while True:
         screen_shot_ = self.d.screenshot(format="opencv")
         if UIMatcher.img_where(screen_shot_, 'img/dixiacheng.jpg'):
             break
     self.d.click(562, 253)
     time.sleep(2)
     while True:
         screen_shot_ = self.d.screenshot(format="opencv")
         if UIMatcher.img_where(screen_shot_, 'img/normal.jpg'):
             break
Ejemplo n.º 20
0
 def is_exists(self,
               img,
               threshold=0.84,
               at=None,
               screen=None,
               is_black=False,
               black_threshold=1500,
               method=cv2.TM_CCOEFF_NORMED):
     """
     判断一个图片是否存在。
     :param black_threshold: 判断暗点的阈值
     :param is_black: 是否判断为暗色图片(多用于检测点击按钮后颜色变暗)灰色返回Ture,默认需要配合at,否则自行调整阈值
     :param method:
     :param img:
         一个字符串,表示图片的地址;或者为PCRelement类型。
         当img为PCRelement时,如果at参数为None,则会使用img.at。
     :param threshold: 判定阈值
     :param at: 搜素范围
     :param screen: 若设置为None,则重新截图;否则使用screen为截图
     :return: 是否存在
     """
     if screen is None:
         screen = self.getscreen()
     img, at = self._get_img_at(img, at)
     return UIMatcher.img_where(screen, img, threshold, at, method,
                                is_black, black_threshold) is not False
Ejemplo n.º 21
0
 def buyExp(self):
     # 进入商店
     count = 0
     self.d.click(616, 434)
     while True:
         self.d.click(82, 84)
         screen_shot_ = self.d.screenshot(format="opencv")
         if UIMatcher.img_where(screen_shot_, 'img/exp.jpg'):
             break
         count += 1
         time.sleep(1)
         if count > 4:
             break
     if count <= 4:
         self.d.click(386, 148)
         self.d.click(556, 148)
         self.d.click(729, 148)
         self.d.click(897, 148)
         self.d.click(795, 437)
         time.sleep(1)
         self.d.click(596, 478)
         time.sleep(1)
     self.lockimg('img/liwu.bmp',
                  elseclick=[(131, 533)],
                  elsedelay=1,
                  at=(891, 413, 930, 452))  # 回首页
Ejemplo n.º 22
0
    def doPJJC(self):
        self.enterJJC(821, 410)
        # 选择第一位进入对战
        self.d.click(604, 162)
        time.sleep(1)
        # 点击队伍2
        self.d.click(822, 456)
        time.sleep(1)
        # 点击队伍3
        self.d.click(822, 456)
        time.sleep(1)
        # 点击战斗开始
        self.d.click(822, 456)
        time.sleep(1)
        # 确保战斗开始
        self.d.click(822, 456)

        while True:
            screen_shot_ = self.d.screenshot(format="opencv")
            if UIMatcher.img_where(screen_shot_, 'img/xiayibu.jpg'):
                self.d.click(803, 506)
                break
        time.sleep(1)
        self.lockimg('img/liwu.bmp',
                     elseclick=[(131, 533)],
                     elsedelay=1,
                     at=(891, 413, 930, 452))  # 回首页
Ejemplo n.º 23
0
    def dixiachengYunhai(self):  # 地下城 云海 (第一个)
        self.click(480, 505)
        time.sleep(1)
        while True:
            screen_shot_ = self.getscreen()
            if UIMatcher.img_where(screen_shot_, 'img/dixiacheng.jpg'):
                break
            self.click(480, 505)
            time.sleep(1)
        self.click(900, 138)
        time.sleep(3)

        screen_shot_ = self.getscreen()
        if UIMatcher.img_where(
                screen_shot_, 'img/dixiacheng_used.jpg'):  # 避免某些农场号刚买回来已经进了地下城
            self.lock_img('img/liwu.bmp', elseclick=[(131, 533)],
                          elsedelay=1)  # 回首页
        else:
            # 下面这段因为调试而注释了,实际使用时要加上
            while True:
                screen_shot_ = self.getscreen()
                if UIMatcher.img_where(screen_shot_,
                                       'img/chetui.jpg'):  # 避免某些农场号刚买回来已经进了地下城
                    break
                if UIMatcher.img_where(screen_shot_, 'img/yunhai.bmp'):
                    self.click(130, 259)  # 云海
                    time.sleep(1)
                    while True:
                        screen_shot_ = self.getscreen()
                        if UIMatcher.img_where(screen_shot_, 'img/ok.bmp'):
                            break
                    self.click(592, 369)  # 点击ok
                    time.sleep(1)
                    break
            # 刷地下城
            self.dixiachengzuobiao(666, 340, 0, 1)  # 1层
            self.dixiachengzuobiao(477, 296, 0)  # 2层
            self.dixiachengzuobiao(311, 306, 0)  # 3层
            self.dixiachengzuobiao(532, 301, 0)  # 4层
            self.dixiachengzuobiao(428, 315, 0)  # 5层
            self.dixiachengzuobiao(600, 313, 0)  # 6层
            self.dixiachengzuobiao(447, 275, 0)  # 7层

            # 完成战斗后
            self.lock_img('img/liwu.bmp', elseclick=[(131, 533)],
                          elsedelay=1)  # 回首页
Ejemplo n.º 24
0
    def find_img(self,
                 img,
                 at=None,
                 alldelay=0.5,
                 ifclick=None,
                 ifbefore=0.5,
                 ifdelay=1,
                 elseclick=None,
                 elsedelay=0.5,
                 retry=0):
        """
        前身:_lock_img

        匹配图片并点击指定坐标

            Parameters:
                img (str): 要匹配的图片目录
                at (:tuple: `(int: 左上x, int: 左上y, int: 右下x, int: 右下y)`): 查找范围
                ifbefore (float): 识别成功后延迟点击时间
                ifclick (:list: ``): 在识别到图片时要点击的坐标,列表,列表元素为坐标如(1,1)
                ifdelay: 上述点击后延迟的时间
                elseclick: 在找不到图片时要点击的坐标,列表,列表元素为坐标如(1,1)
                elsedelay: 上述点击后延迟的时间
                retry: elseclick最多点击次数, `0为无限次`

            Returns:
                success (bool): 是否在retry次内点击成功
        """
        # 2020-07-12 Add: 增加了ifclick,elseclick参数对Tuple的兼容性
        # 2020-07-14 Add: added retry
        if elseclick is None:
            elseclick = []
        if ifclick is None:
            ifclick = []
        if type(ifclick) is tuple:
            ifclick = [ifclick]
        if type(elseclick) is tuple:
            elseclick = [elseclick]

        inf_attempt = True if retry == 0 else False
        attempt = 0
        while inf_attempt or attempt < retry:
            self._move_check()
            screen_shot = self.getscreen()
            if UIMatcher.img_where(screen_shot, img, at=at):
                # 成功匹配图片
                for clicks in ifclick:
                    self.click(clicks[0],
                               clicks[1],
                               pre_delay=ifbefore,
                               post_delay=ifdelay)
                break

            for clicks in elseclick:
                self.click(clicks[0], clicks[1], post_delay=elsedelay)
            time.sleep(alldelay)
            attempt += 1
        return True if inf_attempt or attempt < retry else False
Ejemplo n.º 25
0
    def mianfeishilian(self):
        # 免费十连
        # 2020/9/20 CyiceK进行了稳定性修复
        self.lock_home()
        # self.lock_img(MAIN_BTN["liwu"], ifclick=MAIN_BTN["niudan"])
        # 点进扭蛋界面

        self.click_btn(MAIN_BTN["niudan"], until_disappear=MAIN_BTN["liwu"])
        while True:
            # 跳过抽奖提示
            time.sleep(4)
            screen_shot_ = self.getscreen()
            if UIMatcher.img_where(screen_shot_, 'img/niudan_sheding.jpg'):
                self.guochang(screen_shot_, ['img/niudan_sheding.jpg'],
                              suiji=0)
                break
            else:
                time.sleep(1)
                self.click(473, 436)  # 手动点击
                time.sleep(2)
                break

        screen_shot_ = self.getscreen()
        if self.is_exists(screen=screen_shot_,
                          img=NIUDAN_BTN["mianfeishilian"]):  # 仅当有免费十连时抽取免费十连
            self.click_btn(NIUDAN_BTN["niudan_shilian"],
                           until_appear=NIUDAN_BTN["putong_quxiao"])
            self.click_btn(NIUDAN_BTN["putong_ok"],
                           until_disappear=NIUDAN_BTN["putong_ok"])
            time.sleep(1.5)
            self.lock_img(JIAYUAN_BTN["zhuye"], elseclick=[(900, 40)])
            # self.click(872, 355)  # 点击十连
            # time.sleep(1)
            # self.click(592, 369)  # 确认

        while True:
            screen_shot_ = self.getscreen()
            if UIMatcher.img_where(screen_shot_,
                                   'img/liwu.bmp',
                                   at=(891, 413, 930, 452)):
                break
            # if self.is_exists(screen=screen_shot_, img=JIAYUAN_BTN["zhuye"]):
            #   self.click(131, 533)
            # 首页锁定,保证回到首页
            self.lock_home()
Ejemplo n.º 26
0
    def mianfeiniudan(self):
        # 免费扭蛋
        self.lockimg('img/liwu.bmp',
                     elseclick=[(131, 533)],
                     elsedelay=1,
                     at=(891, 413, 930, 452))  # 回首页
        self.lockimg('img/liwu.bmp',
                     ifclick=[(750, 510)],
                     ifdelay=1,
                     at=(891, 413, 930, 452))  # 点进扭蛋界面
        while True:
            # 跳过抽奖提示
            time.sleep(4)
            screen_shot_ = self.d.screenshot(format="opencv")
            if UIMatcher.img_where(screen_shot_, 'img/niudan_sheding.jpg'):
                self.guochang(screen_shot_, ['img/niudan_sheding.jpg'],
                              suiji=0)
                break
            else:
                time.sleep(1)
                self.d.click(473, 436)  # 手动点击
                time.sleep(2)
                break

        while True:
            screen_shot_ = self.d.screenshot(format="opencv")
            if UIMatcher.img_where(screen_shot_, 'img/niudanputong.jpg'):
                self.guochang(screen_shot_, ['img/niudanputong.jpg'], suiji=0)
                time.sleep(1)
                self.d.click(722, 351)  # 点进扭蛋
                time.sleep(1)
                self.d.click(584, 384)
                break
            else:
                time.sleep(1)
                self.d.click(876, 75)  # 手动点击
                time.sleep(1)
                self.d.click(722, 351)  # 点进扭蛋
                time.sleep(1)
                self.d.click(584, 384)
                break
        self.lockimg('img/liwu.bmp',
                     elseclick=[(131, 533)],
                     elsedelay=1,
                     at=(891, 413, 930, 452))  # 回首页
Ejemplo n.º 27
0
 def enterHardMap(self):
     # 进入冒险
     time.sleep(2)
     self.d.click(480, 505)
     time.sleep(2)
     while True:
         screen_shot_ = self.d.screenshot(format="opencv")
         if UIMatcher.img_where(screen_shot_, 'img/dixiacheng.jpg'):
             break
     # 点击进入主线关卡
     self.d.click(562, 253)
     time.sleep(2)
     while True:
         screen_shot_ = self.d.screenshot(format="opencv")
         if UIMatcher.img_where(screen_shot_, 'img/normal.jpg'):
             self.d.click(880, 80)
         if UIMatcher.img_where(screen_shot_, 'img/hard.jpg'):
             break
Ejemplo n.º 28
0
 def enter_activity():
     # 进入冒险
     time.sleep(2)
     self.click(480, 505)
     time.sleep(2)
     while True:
         screen_shot_ = self.getscreen()
         if UIMatcher.img_where(screen_shot_, 'img/dixiacheng.jpg'):
             break
     # 点击进入活动
     self.click(415, 430)
     time.sleep(3)
Ejemplo n.º 29
0
    def dixiachengDuanya(self):  # 地下城 断崖(第三个)
        self.click(480, 505)
        time.sleep(1)
        while True:
            screen_shot_ = self.getscreen()
            if UIMatcher.img_where(screen_shot_, 'img/dixiacheng.jpg'):
                break
            self.click(480, 505)
            time.sleep(1)
        self.click(900, 138)
        time.sleep(3)
        screen_shot_ = self.getscreen()
        if UIMatcher.img_where(
                screen_shot_, 'img/dixiacheng_used.jpg'):  # 避免某些农场号刚买回来已经进了地下城
            self.lock_img('img/liwu.bmp', elseclick=[(131, 533)],
                          elsedelay=1)  # 回首页
        else:
            # 下面这段因为调试而注释了,实际使用时要加上
            while True:
                screen_shot_ = self.getscreen()
                if UIMatcher.img_where(screen_shot_,
                                       'img/chetui.jpg'):  # 避免某些农场号刚买回来已经进了地下城
                    break
                if UIMatcher.img_where(screen_shot_, 'img/yunhai.bmp'):
                    self.click(712, 267)  # 断崖
                    time.sleep(1)
                    while True:
                        screen_shot_ = self.getscreen()
                        if UIMatcher.img_where(screen_shot_, 'img/ok.bmp'):
                            break
                    self.click(592, 369)  # 点击ok
                    time.sleep(1)
                    break
            # 刷地下城
            self.dixiachengzuobiao(642, 371, 0, 1)  # 1层
            self.dixiachengzuobiao(368, 276, 0, 2)  # 2层
            self.dixiachengzuobiao(627, 263, 0)  # 3层
            self.dixiachengzuobiao(427, 274, 0)  # 4层
            self.dixiachengzuobiao(199, 275, 0)  # 5层
            self.dixiachengzuobiao(495, 288, 0)  # 6层
            self.dixiachengzuobiao(736, 291, 0)  # 7层
            self.dixiachengzuobiao(460, 269, 0)  # 8层
            self.dixiachengzuobiao(243, 274, 0)  # 9层
            self.dixiachengzuobiao(654, 321, 0, 1)  # 10层

            # 点击撤退
            if self.is_dixiacheng_end == 1:
                screen_shot_ = self.getscreen()
                if UIMatcher.img_where(
                        screen_shot_,
                        'img/10.jpg'):  # 地下城10层失败重试1次,使低练度号能2刀通关boss
                    self.is_dixiacheng_end = 0
                    self.dixiachengzuobiao(654, 321, 0)  # 10层
                self.click(780, 430)
                time.sleep(1)
                self.click(576, 364)

        # 完成战斗后
        self.lock_home()
Ejemplo n.º 30
0
 def goHardMap(self):
     # 进入冒险
     time.sleep(2)
     self.d.click(480, 505)
     time.sleep(2)
     while True:
         screen_shot_ = self.d.screenshot(format="opencv")
         if UIMatcher.img_where(screen_shot_, 'img/dixiacheng.jpg'):
             break
     # 点击进入主线关卡
     self.click(562, 253)
     self.click(828, 85, pre_delay=3, post_delay=2)
     for _ in range(11):  # 设置大于当前进图数,让脚本能回归到1-1即可.
         # n图左移到1-1图
         self.click(27, 272, pre_delay=2)
     while True:
         screen_shot_ = self.d.screenshot(format="opencv")
         if UIMatcher.img_where(screen_shot_, 'img/normal.jpg'):
             self.click(828, 85)
         else:
             UIMatcher.img_where(screen_shot_, 'img/hard.jpg')
             break