Ejemplo n.º 1
0
 def select_player():
     # 选人
     start = time()
     while 1:
         if time() - start > 60:
             raise OvertimeError("select_player1")
         sleep(2)
         point = mathc_img(get_img(), "ADDGIRL", 0.8)
         point = remove_same(point)
         if point:
             click(point[0])
             break
     # 确定
     start = time()
     while 1:
         if time() - start > 60:
             raise OvertimeError("select_player2")
         point = mathc_img(get_img(), "YES", 0.8)
         point = remove_same(point)
         if point:
             click(point[0])
             break
     sleep(2)
     click(75, 186)
     up_swipe()
Ejemplo n.º 2
0
 def receive_done_sub(get_img=get_img):
     """收远征完成"""
     sleep(1)
     for num in range(0, 3):
         # 找完成的远征
         point = mathc_img(get_img(), "DONE", 0.9)
         point = remove_same(point)
         # 找到可以收的远征
         if point:
             game_log.info("RECEIVE")
             click(point[0])
             point = []
             sleep(1)
             # 找MARCHDONE
             start = time()
             while 1:
                 if time() - start > 60:
                     raise OvertimeError("receive1")
                 point = mathc_img(get_img(), "MARCHDONE", 0.9)
                 if point:
                     point = []
                     break
                 sleep(STEP * 2)
             # 在回到远征界面前一直点
             start = time()
             while 1:
                 if time() - start > 60:
                     raise OvertimeError("receive2")
                 if marchfind():
                     break
                 click(792, 818)
                 sleep(2)
         # 没远征可收
         else:
             return
Ejemplo n.º 3
0
def waterfind():
    "出水判定"
    point = mathc_img(get_img(), "WATER", 0.9)
    if point:
        return True
    else:
        return False
Ejemplo n.º 4
0
def skill_room():
    """道场续书"""
    # 设施有红点吗
    if not mainpage_buildingfind():
        return
    click(800, 800, 3)
    # 道场有红点吗
    if not mainpage_building_skill_room_point():
        click(792, 772)
        return
    click(1316, 464)
    start = time()
    num = 0
    while 1:
        sleep(5)
        if time() - start > 60:
            break
            raise OvertimeError("skill_room")
        # 道场技能150
        point = mathc_img(get_img(), "EXP", 0.8)
        point = remove_same(point)
        if point:
            for p in point:
                if p[0] > 800:
                    point.remove(p)
            # print(point)
            click(int(point[1][0]), int(point[1][1] + 50), 1)  # 银书
            click(1322, 764, 1)
            click(992, 632, 1)
            num += 1
            continue
        #  道场确定
        point = mathc_img(get_img(), "SKILLPOINT", 0.9)
        if point:
            point = remove_same(point)
            click(point[0])
            continue
        if num == 3:
            break
    exit_to_main()
Ejemplo n.º 5
0
def search(y0, y1, x0, x1, mode_img):
    """通用图像对比

    Args:
        y0,y1,x0,x1 (int): 对比区域四角坐标
        mode_img(np.ndarray): 图像
        value (float): 相似度

    Returns:
        (bool): [符合返回真,不符合返回假]
    """
    cut_img = cut_image(y0, y1, x0, x1, get_img())
    return compare_image(cut_img, mode_img)
Ejemplo n.º 6
0
 def selection(stage):
     if isinstance(stage, int):
         if stage == 1:
             click(1105, 231)  # 选关1
         elif stage == 2:
             click(1105, 426)  # 选关2
         elif stage == 3:
             click(1105, 612)  # 选关3
     else:
         point = mathc_img(get_img(), stage, 0.9)
         if point:
             click(point[0])
         else:
             self.before_fight()
             self.select_stage(self, number)
Ejemplo n.º 7
0
    def initialize(cls, get_img=get_img):
        """初始化

        需要处在远征界面
        """
        def cut(img):
            """切出每个远征的小图"""
            # 找到所以基准点
            point = mathc_img(img, "LV", 0.7)
            point = remove_same(point)
            # 图片切片
            piclist = []
            for num in range(0, len(point)):
                y0 = point[num][1] - 34
                y1 = point[num][1] + 186
                x0 = point[num][0] - 296
                x1 = point[num][0] + 907
                piclist.append(cut_image(y0, y1, x0, x1, img))
            return piclist

        # 普通远征
        click(73, 179)
        up_swipe()
        sleep(1)
        piclist = cut(get_img())
        piclist.pop()
        down_swipe()

        sleep(1)
        pic2list = cut(get_img())
        pic2list.pop(0)
        piclist = piclist + pic2list
        sleep(1)
        march_list = []
        for number in range(0, 5):
            march_list.append(cls(piclist[number], number))
        # 特殊远征
        click(73, 329)
        sleep(1)
        up_swipe()
        sleep(1)
        piclist = cut(get_img())
        if piclist:
            # 限时远征少于3个,一次搞定
            if len(piclist) <= 3:
                for number in range(0, len(piclist)):
                    march_list.append(cls(piclist[number], number + 5))
            # 限时远征多于3个
            else:
                # 限时远征个数判断
                n = number_find()
                piclist.pop()
                down_swipe()
                sleep(1)
                pic2list = cut(get_img())
                if n == 5:
                    pic2list.pop(0)
                if n == 4:
                    pic2list.pop(0)
                    pic2list.pop(0)
                piclist = piclist + pic2list
                for number in range(0, len(piclist)):
                    march_list.append(cls(piclist[number], number + 5))
        return march_list[0:9]
Ejemplo n.º 8
0
            # 做远征
            self.send(march_list, modelist)
            game_log.info("march done")
            exit_to_main()
            click(1472, 717)
            sleep(3)
        except OvertimeError as err:
            game_log.error(err.type)
            self.start()


if __name__ == "__main__":
    Sub.start()
    while 1:
        # 道场技能150
        point = mathc_img(get_img(), "EXP", 0.8)
        point = remove_same(point)
        if point:
            for p in point:
                if p[0] > 800:
                    point.remove(p)
            print(point)
            x = int(point[1][0])
            y = int(point[1][1] + 30)
            click(x, y, 2)  # 银书
            click(1322, 764, 1)
            click(992, 632, 1)
            sleep(3)
            continue
        #  道场确定
        point = mathc_img(get_img(), "SKILLPOINT", 0.9)