示例#1
0
    def __init__(self, parent=None):
        super(MyMainWindow, self).__init__(parent)
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)

        self.ui.textEdit.ensureCursorVisible()

        h = GuiLogger()
        h.edit = self.ui.textEdit
        logger = logging.getLogger()
        logger.setLevel(logging.INFO)
        logger.addHandler(h)
示例#2
0
class MyMainWindow(QMainWindow):
    def __init__(self, parent=None):
        super(MyMainWindow, self).__init__(parent)
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)

        self.ui.textEdit.ensureCursorVisible()

        h = GuiLogger()
        h.edit = self.ui.textEdit
        logger = logging.getLogger()
        logger.setLevel(logging.INFO)
        logger.addHandler(h)

    def set_conf(self, conf, section):
        '''
        设置参数至配置文件
        '''
        # 一般参数
        conf.set('watchdog', 'watchdog_enable',
                 str(self.ui.checkBox.isChecked()))
        conf.set('watchdog', 'max_win_time', str(self.ui.lineEdit.text()))
        conf.set('watchdog', 'max_op_time', str(self.ui.lineEdit_2.text()))

        conf.set('others', 'debug_enable', str(self.ui.checkBox_4.isChecked()))

        # 御魂参数
        if section == 0:
            pass

        # 探索参数
        if section == 1:
            # 探索
            conf.set('explore', 'fight_boss_enable',
                     str(self.ui.checkBox_2.isChecked()))
            conf.set('explore', 'slide_shikigami',
                     str(self.ui.checkBox_3.isChecked()))
            conf.set('explore', 'slide_shikigami_progress',
                     str(self.ui.horizontalSlider.value()))
            conf.set('explore', 'zhunbei_delay',
                     str(self.ui.lineEdit_3.text()))

    def get_conf(self, section):
        conf = configparser.ConfigParser()
        # 读取配置文件
        conf.read('conf.ini', encoding="utf-8")

        # 修改配置
        try:
            self.set_conf(conf, section)
        except:
            conf.add_section('watchdog')
            conf.add_section('explore')
            conf.add_section('others')
            self.set_conf(conf, section)

        # 保存配置文件
        with open('conf.ini', 'w') as configfile:
            conf.write(configfile)

    def start_onmyoji(self):
        section = self.ui.tabWidget.currentIndex()

        # 读取主要副本
        self.get_conf(section)

        if section == 0:
            # 御魂
            if self.ui.mitama_single.isChecked():
                # 单刷
                self.fight = SingleFight()

            elif self.ui.mitama_driver.isChecked():
                # 司机
                self.fight = DriverFighter()

            if self.ui.mitama_passenger.isChecked():
                # 乘客
                self.fight = FighterPassenger()

            if self.ui.mitama_dual.isChecked():
                # 双开
                self.fight = DualFighter()

        elif section == 1:
            # 御灵
            self.fight = GoryouFight()

        elif section == 2:
            # 探索
            self.fight = ExploreFight()

        task = threading.Thread(target=self.fight.start)
        task.start()

    def stop_onmyoji(self):
        try:
            self.fight.deactivate()
        except:
            pass
示例#3
0
class MyMainWindow(QMainWindow):
    def __init__(self, parent=None):
        super(MyMainWindow, self).__init__(parent)
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)

        self.ui.textEdit.ensureCursorVisible()

        h = GuiLogger()
        h.edit = self.ui.textEdit
        logger = logging.getLogger()
        logger.setLevel(logging.INFO)
        logger.addHandler(h)

    def set_conf(self, conf, section):
        '''
        设置参数至配置文件
        '''
        # 一般参数
        conf.set('watchdog', 'watchdog_enable',
                 str(self.ui.checkBox.isChecked()))
        conf.set('watchdog', 'max_win_time', str(self.ui.lineEdit.text()))
        conf.set('watchdog', 'max_op_time', str(self.ui.lineEdit_2.text()))

        # 御魂参数
        if section == 0 or section == 4:
            # 御魂
            conf.set('mitama', 'mitama_click_partner_left',
                     str(self.ui.mitama_click_partner_left.isChecked()))
            conf.set('mitama', 'mitama_click_partner_right',
                     str(self.ui.mitama_click_partner_right.isChecked()))

        # 探索参数
        if section == 1 or section == 4:
            # 探索
            conf.set('explore', 'fight_boss_enable',
                     str(self.ui.checkBox_2.isChecked()))
            conf.set('explore', 'tupo_enable',
                     str(self.ui.checkBox_4.isChecked()))
            conf.set('explore', 'slide_shikigami',
                     str(self.ui.checkBox_3.isChecked()))
            conf.set('explore', 'slide_shikigami_progress',
                     str(self.ui.horizontalSlider.value()))
            conf.set('explore', 'zhunbei_delay',
                     str(self.ui.lineEdit_3.text()))

        # 百鬼夜行参数
        if section == 2 or section == 4:
            pass

        # 结界突破参数
        if section == 3 or section == 4:
            pass

        # 专项任务参数
        if section == 4:
            conf.set('task', 'tansuo', str(self.ui.lineEdit_4.text()))
            conf.set('task', 'yuhun', str(self.ui.lineEdit_5.text()))
            conf.set('task', 'juexing', str(self.ui.lineEdit_6.text()))
            conf.set('task', 'tupo', str(self.ui.lineEdit_7.text()))

            # 御魂
            conf.set('mitama', 'mitama_click_partner_left', 'True')
            conf.set('mitama', 'mitama_click_partner_right', 'False')

            # 探索
            conf.set('explore', 'fight_boss_enable', 'True')
            conf.set('explore', 'tupo_enable', 'False')

    def get_conf(self, section):
        conf = configparser.ConfigParser()
        # 读取配置文件
        conf.read('conf.ini', encoding="utf-8")

        # 修改配置
        try:
            self.set_conf(conf, section)
        except:
            conf.add_section('watchdog')
            conf.add_section('explore')
            conf.add_section('mitama')
            conf.add_section('task')
            self.set_conf(conf, section)

        # 保存配置文件
        with open('conf.ini', 'w') as configfile:
            conf.write(configfile)

    def start_onmyoji(self):
        section = self.ui.tabWidget.currentIndex()

        # 读取配置
        self.get_conf(section)

        if section == 0:
            # 御魂
            if self.ui.mitama_single.isChecked():
                # 单刷
                self.fight = SingleFight()

            elif self.ui.mitama_driver.isChecked():
                # 司机
                self.fight = DriverFighter()

            elif self.ui.mitama_passenger.isChecked():
                # 乘客
                self.fight = FighterPassenger()

            elif self.ui.mitama_dual.isChecked():
                # 双开
                self.fight = DualFighter()

        elif section == 1:
            # 探索
            self.fight = ExploreFight()

        elif section == 2:
            # 百鬼夜行
            self.fight = Ghost()

        elif section == 3:
            # 结界突破
            if self.ui.individual.isChecked():
                # 个人突破
                self.fight = Breakthrough()

            elif self.ui.shack.isChecked():
                # 个人突破
                self.fight = ShackBreakthrough()

        elif section == 4:
            self.fight = Task()

        task = threading.Thread(target=self.fight.start)
        task.start()

    def stop_onmyoji(self):
        try:
            self.fight.deactivate()
        except:
            pass
示例#4
0
class MyMainWindow(QMainWindow):
    def __init__(self, parent=None):
        super(MyMainWindow, self).__init__(parent)
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)

        self.ui.textEdit.ensureCursorVisible()

        h = GuiLogger()
        h.edit = self.ui.textEdit
        logger = logging.getLogger()
        logger.setLevel(logging.INFO)
        logger.addHandler(h)

    def set_conf(self, conf, section):
        '''
        设置参数至配置文件
        '''
        # 一般参数
        conf.set('watchdog', 'watchdog_enable',
                 str(self.ui.checkBox.isChecked()))
        conf.set('watchdog', 'max_win_time', str(self.ui.lineEdit.text()))
        conf.set('watchdog', 'max_op_time', str(self.ui.lineEdit_2.text()))

        conf.set('others', 'debug_enable', str(self.ui.checkBox_4.isChecked()))
        conf.set('others', 'team', str(self.ui.checkBox_5.isChecked()))
        conf.set('others', 'team_id', str(self.ui.comboBox_1.currentIndex() + 1))
        conf.set('others', 'monster', str(self.ui.checkBox_6.isChecked()))


        # 御魂参数
        if section == 0:
            pass

        # 探索参数
        if section == 2:
            pass
            # 探索
            level = 0
            if self.ui.explore_ka_1.isChecked():
                level = 2
            elif self.ui.explore_ka_3.isChecked():
                level = 3
            elif self.ui.explore_ka_2.isChecked():
                level = 1
            conf.set('explore', 'level', str(level))
            conf.set('explore', 'driver_gouliang_1', str(self.ui.checkBox_driver_gouliang1.isChecked()))
            conf.set('explore', 'driver_gouliang_2', str(self.ui.checkBox_driver_gouliang2.isChecked()))
            conf.set('explore', 'driver_passenger_1', str(self.ui.checkBox_passenger_gouliang1.isChecked()))
            conf.set('explore', 'driver_passenger_2', str(self.ui.checkBox_passenger_gouliang2.isChecked()))
            conf.set('explore', 'driver_passenger_3', str(self.ui.checkBox_passenger_gouliang3.isChecked()))

        if section == 3:
            # 结界突破
            conf.set('tu', 'auto', str(self.ui.tu_auto.isChecked()))
            conf.set('tu', 'shoudong', str(self.ui.tu_shoudong.isChecked()))


    def get_conf(self, section):
        conf = configparser.ConfigParser()
        # 读取配置文件
        conf.read('conf.ini', encoding="utf-8")

        # 修改配置
        try:
            self.set_conf(conf, section)
        except Exception as e:
            print(e)
            conf.add_section('watchdog')
            conf.add_section('explore')
            conf.add_section('others')
            conf.add_section('tu')
            self.set_conf(conf, section)

        # 保存配置文件
        with open('conf.ini', 'w') as configfile:
            conf.write(configfile)

    def start_onmyoji(self):
        section = self.ui.tabWidget.currentIndex()

        # 读取主要副本
        self.get_conf(section)

        if section == 0:
            # 御魂
            if self.ui.mitama_single.isChecked():
                # 单刷
                self.fight = SingleFight()

            elif self.ui.mitama_driver.isChecked():
                # 司机
                self.fight = DriverFighter()

            if self.ui.mitama_passenger.isChecked():
                # 乘客
                self.fight = FighterPassenger()

            if self.ui.mitama_dual.isChecked():
                # 双开
                self.fight = DualFighter()
        elif section == 1:
            # 御灵
            self.fight = GoryouFight()
        elif section == 2:
            # 探索
            if self.ui.explore_single.isChecked():
                # 单刷
                logging.info("未开发")
            elif self.ui.explore_driver.isChecked():
                # 司机
                self.fight = DriverExplore()
            elif self.ui.explore_passenger.isChecked():
                # 乘客
                self.fight = PassengerExplore()
            elif self.ui.explore_dual.isChecked():
                # 双开
                self.fight = DualExplore()
        elif section == 3:
            # 突破
            self.fight = Boundary()

        task = threading.Thread(target=self.fight.start)
        task.start()

    def stop_onmyoji(self):
        try:
            self.fight.deactivate()
        except:
            pass
示例#5
0
class MyMainWindow(QMainWindow):
    def __init__(self, parent = None):
        super(MyMainWindow, self).__init__(parent)
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)

        self.ui.textEdit.ensureCursorVisible()
        
        h = GuiLogger()
        h.edit = self.ui.textEdit
        logger = logging.getLogger()
        logger.setLevel(logging.INFO)
        logger.addHandler(h)

    def set_conf(self, conf):
        '''
        设置参数至配置文件
        '''
        conf.set('watchdog', 'watchdog_enable',
                 str(self.ui.checkBox.isChecked()))
        conf.set('watchdog', 'max_win_time', str(self.ui.lineEdit.text()))
        conf.set('watchdog', 'max_op_time', str(self.ui.lineEdit_2.text()))
        conf.set('explore', 'fight_boss_enable',
                 str(self.ui.checkBox_2.isChecked()))
    
    def get_conf(self):
        conf = configparser.ConfigParser()
        # 读取配置文件
        conf.read('conf.ini')

        # 修改配置
        try:
            self.set_conf(conf)
        except:
            conf.add_section('watchdog')
            conf.add_section('explore')
            self.set_conf(conf)

        # 保存配置文件
        with open('conf.ini', 'w') as configfile:
                conf.write(configfile)

    def start_onmyoji(self):
        # 读取配置
        self.get_conf()

        section = self.ui.tabWidget.currentIndex()
        if section == 0:
            # 御魂
            if mode == 0:
                # 单刷
                fight = SingleFight()
    
            if mode == 2:
                # 司机
                fight = DriverFighter()
    
            if mode == 3:
                # 乘客
                fight = FighterPassenger()
        
        elif section == 1:
            # 探索
            fight = ExploreFight()

        self.task = threading.Thread(target = fight.start)
        self.task.start()

    def set_mood1(self):
        global mode
        mode = 0

    def set_mood2(self):
        global mode
        mode = 2

    def set_mood3(self):
        global mode
        mode = 3

    def stop_onmyoji(self):
        logging.info('Quitting!')
        os._exit(0)
示例#6
0
文件: ui.py 项目: nanght/onmyoji_bot
 def __init__(self, parent=None):
     super(MyMainWindow, self).__init__(parent)
     self.ui = Ui_MainWindow()
     self.ui.setupUi(self)
     self.conf = configparser.ConfigParser()
示例#7
0
文件: ui.py 项目: nanght/onmyoji_bot
class MyMainWindow(QMainWindow):
    def __init__(self, parent=None):
        super(MyMainWindow, self).__init__(parent)
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)
        self.conf = configparser.ConfigParser()

    def set_conf(self):
        '''
        设置参数至配置文件
        '''
        # 运行参数
        section = self.ui.tabWidget.currentIndex()
        self.conf.set('DEFAULT', 'run_section', str(section))

        # 一般参数
        self.conf.set('watchdog', 'watchdog_enable',
                      str(self.ui.checkBox.isChecked()))
        self.conf.set('watchdog', 'max_win_time', str(self.ui.lineEdit.text()))
        self.conf.set('watchdog', 'max_op_time',
                      str(self.ui.lineEdit_2.text()))

        self.conf.set('others', 'debug_enable',
                      str(self.ui.checkBox_4.isChecked()))

        # 御魂参数
        if self.ui.mitama_single.isChecked():
            # 单刷
            self.conf.set('DEFAULT', 'run_mode', '0')

        elif self.ui.mitama_driver.isChecked():
            # 司机
            self.conf.set('DEFAULT', 'run_mode', '1')

        elif self.ui.mitama_passenger.isChecked():
            # 乘客
            self.conf.set('DEFAULT', 'run_mode', '2')

        elif self.ui.mitama_dual.isChecked():
            # 双开
            self.conf.set('DEFAULT', 'run_mode', '3')

        # 探索参数
        self.conf.set('explore', 'fight_boss_enable',
                      str(self.ui.checkBox_2.isChecked()))
        self.conf.set('explore', 'slide_shikigami',
                      str(self.ui.checkBox_3.isChecked()))
        self.conf.set('explore', 'slide_shikigami_progress',
                      str(self.ui.horizontalSlider.value()))
        self.conf.set('explore', 'zhunbei_delay',
                      str(self.ui.lineEdit_3.text()))

    def get_conf(self):
        # 添加配置
        try:
            self.conf.add_section('watchdog')
            self.conf.add_section('explore')
            self.conf.add_section('others')
        except:
            pass

        # 修改配置
        self.set_conf()

        # 保存配置文件
        with open('conf.ini', 'w') as configfile:
            self.conf.write(configfile)

    def start_onmyoji(self):
        # 读取主要副本
        self.get_conf()

        subprocess.Popen("cmd.exe /c start onmyoji.exe")
        #os.system("onmyoji.exe")

    def stop_onmyoji(self):
        os._exit(0)