def this_zhang_dou_zhong(self, argument, handle):
     if self.huang_flag:
         # 如果要换狗粮
         # 如果没有全部稀有度按钮
         if Game.if_exist("yys/全部稀有度按钮.bmp") != 0:
             if Game.if_exist("yys/N卡选择按钮.bmp") != 0:
                 # 点晴明附近
                 x = int(handle.left + (handle.right - handle.left) / 4)
                 y = int(handle.top + (handle.bottom - handle.top) * 3 / 4)
                 m = Mouse()
                 m.click(x, y)
             else:
                 # 找没满级狗粮和拖上去替换
                 gouliang = Gouliang(self.metrics_x, self.metrics_y, handle)
                 gouliang.find_and_huang(
                     False,
                     bool(1 - self.Beater) and self.BeatMax)
                 self.click_img("yys/战斗中准备按钮.bmp", handle)
                 self.huang_flag = False
         else:
             if Game.if_exist("yys/N卡选择按钮.bmp") != 0:
                 if self.click_img("yys/全部稀有度按钮.bmp", handle) == 0:
                     time.sleep(0.3)
                     self.click_img("yys/N卡选择按钮.bmp", handle)
     else:
         self.click_img("yys/战斗中准备按钮.bmp", handle)
         self.waiting(argument, handle)
     return codedef.NORMAL_END
Exemple #2
0
    def get_scene(self, handle):
        window_img = self.window.jie_tu(handle)
        window_img.save('temp/temp.bmp')
        path = "yys/scene/"
        if Game.if_exist(path + "悬赏封印邀请界面.bmp") == 0:
            return SceneKey.XUAN_SHANG_FENG_YING_YAO_QING

        if Game.if_exist(path + "土曜界面.bmp") == 0:
            return SceneKey.TU_YAO
        if Game.if_exist("yys/batch_feng/个人设置界面.bmp") == 0:
            return SceneKey.GE_REN_SHE_ZHI
        if Game.if_exist("yys/batch_feng/选区界面.bmp") == 0:
            return SceneKey.XUAN_QU
        if Game.if_exist("yys/batch_feng/邮箱登录界面.bmp") == 0:
            return SceneKey.YOU_XIANG_DENG_LU
        if Game.if_exist("yys/batch_feng/选择平台界面.bmp") == 0:
            return SceneKey.XUAN_ZHE_PING_TAI
        if Game.if_exist("yys/batch_feng/游戏公告界面.bmp") == 0:
            return SceneKey.YOU_XI_GONG_GAO
        if Game.if_exist(path + "逢魔之时界面.bmp") == 0:
            return SceneKey.FENG_MO_ZHI_SHI

        if Game.if_exist("yys/卷轴打开.bmp") == 0:
            return SceneKey.TING_YUAN
        if Game.if_exist("yys/卷轴未打开.bmp") == 0:
            return SceneKey.TING_YUAN

        return SceneKey.NUKOWN
Exemple #3
0
 def get_scene(self, handle):
     window_img = self.window.jie_tu(handle)
     window_img.save('temp/temp.bmp')
     path = "yys/scene/"
     if Game.if_exist(path + "召唤界面.bmp") == 0:
         return SceneKey.ZHAO_HUAN
     if Game.if_exist(path + "抽N卡界面.bmp") == 0:
         return SceneKey.CHOU_N_KA
     return SceneKey.NUKOWN
Exemple #4
0
    def test_main(self):
        # 测试函数:截取游戏窗口temp.bmp
        # 再截出N卡的小块,确定准确后的百分比
        handle = Handle()
        game = Game()

        arr12 = [[2, 0], [2, 1], [2, 2], [2, 3], [2, 4], [2, 5], [2, 6],
                 [2, 7], [0, 1], [0, 4], [0, 7], [1, 1], [1, 4], [1, 7]]

        if self.set_yys("1", game, handle) == 0:
            # while 1:
            game.get_scene(handle)  # 产生temp.bmp
            # metrics_x = GetSystemMetrics(0)  # 获取分辨率
            # metrics_y = GetSystemMetrics(1)  # 获取分辨率
            # gou = Gouliang(metrics_x, metrics_y, handle)
            # gou.find_and_huang(False, False)
            # n 卡分块
            print("kais")
            top = 0.25
            left = 0.15
            bottom = codedef.n_bottom
            right = codedef.n_right
            kuang = int(0.1 * (handle.right - handle.left))

            img = Img()
            name = 0
            j = 0
            while j < 4:
                i = 0
                while i < 8:
                    # p = arr12[name]
                    # i = p[1]
                    # j = p[0]
                    point = [
                        int(left *
                            (handle.right - handle.left)) + kuang * (i + 0),
                        int(top * (handle.bottom - handle.top)) + kuang *
                        (j + 0)
                    ]
                    point2 = [
                        int(left *
                            (handle.right - handle.left)) + kuang * (i + 1),
                        int(top * (handle.bottom - handle.top)) + kuang *
                        (j + 1)
                    ]

                    tag_img = img.cut_img_path('temp/temp.bmp', point, point2)

                    img.save("temp/t" + str(name) + ".bmp", tag_img)

                    i += 1
                    name += 1
                    time.sleep(0.2)
                j += 1
Exemple #5
0
 def get_scene(self, handle):
     window_img = self.window.jie_tu(handle)
     window_img.save('temp/temp.bmp')
     path = "yys/scene/"
     if Game.if_exist(path + "百鬼夜行界面.bmp") == 0:
         return SceneKey.BAI_GUI_YE_XING
     if Game.if_exist(path + "百鬼中界面.bmp") == 0:
         return SceneKey.BAI_GUI_ZHONG
     if Game.if_exist(path + "百鬼契约书界面.bmp") == 0:
         return SceneKey.BAI_GUI_QI_YUE_SHU
     if Game.if_exist(path + "百鬼鬼王界面.bmp") == 0:
         return SceneKey.BAI_GUI_GUI_WANG
     return SceneKey.NUKOWN
Exemple #6
0
    def feng_mo_zhi_shi(self, argument, handle):
        # 点完退出
        if self.can_exited:
            if self.click_img("yys/退出探索.bmp", handle) == 0:
                time.sleep(1)
        else:
            # 看奖励按钮位置,没的话退出
            re, x, y = self.window.find_img(handle, "yys/奖励不可拿.bmp", 0.9)
            if re == 0:
                if self.jiang_li_x == 0 and self.jiang_li_y == 0:
                    self.jiang_li_x = x
                    self.jiang_li_y = y
            else:
                self.can_exited = True
                if self.jiang_li_x == 0 and self.jiang_li_y == 0:
                    pass
                else:
                    m = Mouse(self.metrics_x, self.metrics_y)
                    m.click(self.jiang_li_x, self.jiang_li_y)
                    time.sleep(1)
                    self.jiang_li_x = 0
                    self.jiang_li_y = 0
            # 有气泡可以点就点
            if Game.if_exist("yys/可以点.bmp") == 0:
                if self.click_img("yys/现世逢魔按钮.bmp", handle, 0.90) == 0:
                    time.sleep(2)

        return codedef.NORMAL_END
    def this_da_tang_suo(self, argument, handle):
        if self.yao_qing:
            self.yao_qing = False
            self.yao_qing_wait = 0
            self.index_dian_friend = 0

        if self.huang_flag is True:  # 如果要换狗粮
            # 取消固定阵容
            if self.click_img("yys/已固定阵容.bmp", handle) != 0:
                pass
        else:
            # 固定阵容
            if self.click_img("yys/未固定阵容.bmp", handle) != 0:
                pass

        if Game.if_exist("yys/探索奖励.bmp") == 0:
            self.can_exited = True

        if self.can_exited:
            if self.exit_tang_suo(handle) == codedef.EXIT_TANG_SUO:
                self.can_exited = False
                self.go_right_times = 0
                return codedef.EXIT_TANG_SUO

        if self.click_img("yys/确认退出探索按钮.bmp", handle) == 0:
            self.go_right_times = 0
            return codedef.EXIT_TANG_SUO

        return self.da_tang_suo_gui(handle)
Exemple #8
0
 def set_windows(self, yys):
     if yys == "" or yys == " ":
         self.add_log("阴阳师 参数不对\r\n")
         return codedef.ERROR_END
     game = Game()
     yys1 = Handle()
     self.set_yys(yys, game, yys1)
     return codedef.NORMAL_END
Exemple #9
0
    def this_main(self, argument, handle):

        if Game.if_exist("yys/轮回秘境.bmp") == 0:
            return codedef.SCENCE_REPEAT_END
        elif Game.if_exist("yys/红蛋.bmp") == 0:
            return codedef.SCENCE_REPEAT_END
        elif Game.if_exist("yys/蓝蛋.bmp") == 0:
            return codedef.SCENCE_REPEAT_END
        elif Game.if_exist("yys/黑蛋.bmp") == 0:
            return codedef.SCENCE_REPEAT_END
        elif Game.if_exist("yys/白蛋.bmp") == 0:
            return codedef.SCENCE_REPEAT_END
        elif self.click_img("yys/确认升星按钮.bmp", handle, 0.98) == 0:
            time.sleep(1)
        elif self.click_img("yys/继续升星按钮.bmp", handle, 0.98) == 0:
            time.sleep(1)

        return codedef.NORMAL_END
Exemple #10
0
 def deng_lu(self, argument, handle):
     if self.click_img("yys/batch_feng/下拉按钮.bmp", handle, 0.90) == 0:
         time.sleep(0.2)
         return codedef.NORMAL_END
     else:
         if Game.if_exist("yys/batch_feng/收回按钮.bmp") == 0:
             time.sleep(0.2)
             if self.mod == 0:
                 # re, x, y = self.window.find_img(handle, "yys/batch_feng/扫码登录.bmp", 0.9)
                 # if re == 0:
                 #     mouse = Mouse()
                 #     mouse.click(x, y - 40)
                 #     time.sleep(2)
                 #     if self.click_img("yys/batch_feng/登录按钮.bmp", handle, 0.90) == 0:
                 #         time.sleep(1)
                 # else:
                 re, x, y = self.window.find_img(handle,
                                                 "yys/batch_feng/叉叉按钮.bmp",
                                                 0.9)
                 if re == 0:
                     i = 5
                     while i > 0:
                         i += 1
                         src_x = x + 22
                         xisu = 0.565
                         src_y = handle.top + int(
                             (handle.bottom - handle.top) * xisu)
                         tar_x = src_x
                         tar_y = src_y + 150
                         # mouse = Mouse()
                         # mouse.mouse_to(src_x, src_y)
                         self.tuo(src_x, src_y, tar_x, tar_y)
                         time.sleep(0.2)
                         return codedef.ERROR_END
                     re, x, y = self.window.find_img(
                         handle, "yys/batch_feng/叉叉按钮.bmp", 0.9)
                     if re == 0:
                         mouse = Mouse()
                         mouse.click(x - 40, y)
                         time.sleep(2)
                         if self.click_img("yys/batch_feng/登录按钮.bmp",
                                           handle, 0.90) == 0:
                             time.sleep(1)
             else:
                 src_x = int((handle.left + handle.right) / 2)
                 src_y = handle.top + int(
                     (handle.bottom - handle.top) * 2 / 3)
                 m = Mouse(self.metrics_x, self.metrics_y)
                 m.click(src_x, src_y)
                 time.sleep(1)
                 if self.click_img("yys/batch_feng/登录按钮.bmp", handle,
                                   0.90) == 0:
                     time.sleep(1)
     return codedef.NORMAL_END
 def do_work(self, argument, handle):
     if self.judge_scenes(argument, handle) == codedef.SCENCE_REPEAT_END:
         if Game.if_exist("yys/进攻结界按钮.bmp") == 0:
             self.fight_end(argument, handle)
             return codedef.TANG_GO_RIGHT
         return codedef.SCENCE_REPEAT_END
     switcher = {
         SceneKey.TANG_SUO_ZHONG: self.this_da_tang_suo,
         SceneKey.SHOU_DAO_YAO_QING: self.shou_dao_yao_qing,
         SceneKey.ZHANG_DOU_SHENG_LI: self.fight_win,
         SceneKey.ZHANG_DOU_ZHONG: self.this_zhang_dou_zhong,
         SceneKey.JIE_JIE_TU_PO: self.exit_jie_jie
     }
     func = switcher.get(argument, self.father)(argument, handle)
     return func
    def this_tang_suo(self, argument, handle):
        # 4 管 1-6 ;10 管 7-12;
        # 选28章
        if self.click_img("yys/" + self.Chapter + ".bmp", handle) != 0:
            m = Mouse(self.metrics_x, self.metrics_y)
            dx = 0
            dy = -1 * int(0.5 * (handle.top - handle.bottom))

            imax = 6
            index = 0
            while index < imax:
                x1 = int(handle.left + 0.85 * (handle.right - handle.left))
                y1 = int(handle.top + 0.35 * (handle.bottom - handle.top))
                m.absolute(x1, y1, dx, dy)
                time.sleep(1.5)
                window_img = self.window.jie_tu(handle)
                window_img.save('temp/temp.bmp')
                if Game.if_exist("yys/第一章.bmp", 0.95) == 0:
                    break
                index += 1

            index = 0
            imax = 12
            dy = int(-1 * dy / 3)
            while index < imax:
                window_img = self.window.jie_tu(handle)
                window_img.save('temp/temp.bmp')
                if self.click_img("yys/" + self.Chapter + ".bmp", handle) == 0:
                    break

                x1 = int(handle.left + 0.85 * (handle.right - handle.left))
                y1 = int(handle.top + 0.8 * (handle.bottom - handle.top))
                m.absolute(x1, y1, dx, dy)
                time.sleep(1.5)

                index += 1

            time.sleep(1.5)
        else:
            time.sleep(3)
        return codedef.NORMAL_END
    def this_da_tang_suo(self, argument, handle):
        if self.huang_flag is True:  # 如果要换狗粮
            # 取消固定阵容
            if self.click_img("yys/已固定阵容.bmp", handle) != 0:
                pass
        else:
            # 固定阵容
            if self.click_img("yys/未固定阵容.bmp", handle) != 0:
                pass

        if Game.if_exist("yys/探索奖励.bmp") == 0:
            self.can_exited = True

        if self.can_exited:
            if self.exit_tang_suo(handle) == codedef.EXIT_TANG_SUO:
                self.can_exited = False
                return codedef.NORMAL_END

        if self.click_img("yys/确认退出探索按钮.bmp", handle) == 0:
            return codedef.NORMAL_END

        return codedef.ZAI_TANG_SUO
Exemple #14
0
    def get_scene(self, handle):
        window_img = self.window.jie_tu(handle)
        window_img.save('temp/temp.bmp')
        path = "yys/scene/"
        if Game.if_exist(path + "悬赏封印邀请界面.bmp") == 0:
            return SceneKey.XUAN_SHANG_FENG_YING_YAO_QING
        if Game.if_exist(path + "战斗奖励界面.bmp") == 0:
            return SceneKey.ZHANG_DOU_JIANG_LI
        if Game.if_exist(path + "战斗胜利界面.bmp") == 0:
            return SceneKey.ZHANG_DOU_SHENG_LI
        if Game.if_exist(path + "战斗失败界面.bmp") == 0:
            return SceneKey.ZHANG_DOU_SHI_BAI


        if Game.if_exist("yys/日轮之城/轮回秘境界面.bmp") == 0:
            return SceneKey.LUN_HUI_MI_JING

        if Game.if_exist("yys/日轮之城/打怪开始界面.bmp") == 0:
            return SceneKey.DA_GUAI_KAI_SHI

        if Game.if_exist("yys/日轮之城/选资源界面.bmp") == 0:
            return SceneKey.XUAN_ZI_YUAN

        return SceneKey.NUKOWN
Exemple #15
0
 def father(self, argument, handle):
     return Game.do_work(self, argument, handle)
Exemple #16
0
 def judge_scenes(self, argument, handle):
     return Game.judge_scenes(self, argument, handle)
Exemple #17
0
 def father(self, argument, handle):
     Game.do_work(self, argument, handle)
     return codedef.NORMAL_END