コード例 #1
0
ファイル: Major.py プロジェクト: doubijudian/FGO-One
 def get_battle(self):
     for battle_scene in self.battle_scenes:
         if analyze(self.screenshot, battle_scene, self.threshold) == 1:
             split()
             combat = Battle()
             combat.get_cards()
             break
コード例 #2
0
ファイル: Major.py プロジェクト: doubijudian/FGO-One
 def get_loading(self):
     for loading_scene in self.loading_scenes:
         if analyze(self.screenshot, loading_scene, self.threshold) == 1:
             loading_interface = Loading()
             loading_interface.scene = screenshot_path
             loading_interface.mark = self.loading_scenes.index(
                 loading_scene)
             loading_interface.have_fun()
コード例 #3
0
ファイル: Major.py プロジェクト: doubijudian/FGO-One
 def get_support(self):
     if analyze(self.screenshot, self.support_scene, self.threshold) == 1:
         support_interface = Support()
         support_interface.scene = screenshot_path
         support_interface.select_support()
         out = "[SUPPORT] Position: " + str(support_interface.crd)
         print(out)
         output_log(out)
コード例 #4
0
    def get_button(self):
        position = get_filtered(self.sh, self.scene, 0.9)
        self.btn_crd[0] = position[0][0]
        self.btn_crd[1] = position[0][1]
        basic_tap(self.btn_crd[0], self.btn_crd[1])

        if analyze(self.sh, cv2.imread("./assets/scene/win2.png", 0),
                   0.9) == 1:
            self.end = "end"
コード例 #5
0
ファイル: battle.py プロジェクト: airbirdx/fgo-auto-run
def curr_round():
    sh = cv2.imread(screenshot_path, 0)
    for i in range(3):
        tmp = cv2.imread(round_path + f'/round{i+1}.png', 0)
        thd = 0.85
        if analyze(sh, tmp, thd):
            wt_tmp_ini('battle', 'round', i + 1)
            return i + 1

    # 两次校验,防止某些图,一种方法不能采集成功
    for i in range(3):
        tmp = cv2.imread(round_path + f'/twice/round{i + 1}.png', 0)
        thd = 0.85
        if analyze(sh, tmp, thd):
            wt_tmp_ini('battle', 'round', i + 1)
            return i + 1

    return -1
コード例 #6
0
 def get_basic(self):
     for basic_scene in self.basic_scenes:
         if analyze(self.screenshot, basic_scene, self.threshold) == 1:
             basic_interface = Basic()
             basic_interface.scene = basic_scene
             basic_interface.sh = self.screenshot
             basic_interface.get_button()
             out = "[BASIC] Buttons: " + str(basic_interface.btn_crd)
             print(out)
             output_log(out)
             return basic_interface.end
コード例 #7
0
ファイル: similar.py プロジェクト: airbirdx/fgo-auto-run
def similar_image2(file1, file2):
    im1 = cv2.imread(file1, 0)
    im2 = cv2.imread(file2, 0)

    w, h = im2.shape[::-1]
    n = 5
    area = im2[h // n:h // n * (n - 1),
               w // n:w // n * (n - 1)]  # 裁剪坐标为[y0:y1, x0:x1]

    thd = 0.9
    if analyze(im1, area, thd):
        return True
    else:
        return False
コード例 #8
0
ファイル: Major.py プロジェクト: doubijudian/FGO-One
 def get_basic(self):
     for basic_scene in self.basic_scenes:
         x, y = basic_scene.shape[0:2]
         xx, yy = self.screenshot.shape[0:2]
         factor = min(1., 1. * xx / x, 1. * yy / y)
         resized_scene = cv2.resize(basic_scene, int(x * factor),
                                    int(y * factor))
         if analyze(self.screenshot, resized_scene, self.threshold) == 1:
             basic_interface = Basic()
             basic_interface.scene = basic_scene
             basic_interface.sh = self.screenshot
             basic_interface.get_button()
             out = "[BASIC] Buttons: " + str(basic_interface.btn_crd)
             print(out)
             output_log(out)
             return basic_interface.end
コード例 #9
0
def current_scene():
    """
    判断当前处于哪种场景
    :return:
    """
    scenes = png_lst(scenes_path)
    sh = cv2.imread(screenshot_path, 0)
    for file in scenes:
        tmp = cv2.imread(scenes_path + f'/{file}', 0)
        thd = 0.85
        if analyze(sh, tmp, thd):
            name, extension = os.path.splitext(file)
            sys_log('「 CURRENT SCENE 」', name)
            return name
    dbg_log('「 CURRENT SCENE 」 %s' % 'N/A')
    return 'none'
コード例 #10
0
ファイル: ats.py プロジェクト: airbirdx/fgo-auto-run
def picture_tap(pic, thd=None):
    '''
    点击截图中图片部分
    :param pic:
    :param thd:
    :return:
    '''
    if thd is None:
        thd = 0.85
    sh = cv2.imread(screenshot_path, 0)
    tmp = cv2.imread(pic, 0)

    if analyze(sh, tmp, thd):
        ps = position(sh, tmp, thd)
        w, h = tmp.shape[::-1]
        px = ps[0][0]
        py = ps[0][1]
        tap(px, py, int(0.3 * min(w, h)))  # +/- -> 0.6
        return True
    else:
        return False
コード例 #11
0
ファイル: Major.py プロジェクト: doubijudian/FGO-One
 def get_finish(self):
     for finish_scene in self.finish_scenes:
         if analyze(self.screenshot, finish_scene, self.threshold) == 1:
             finish_interface = Finish()
             finish_interface.scene = screenshot_path
             finish_interface.pass_finish()