From abeb9f054d63c3b27a7f8589bdc15e691f352c53 Mon Sep 17 00:00:00 2001 From: DLmaster361 Date: Fri, 11 Jul 2025 14:48:23 +0800 Subject: [PATCH] =?UTF-8?q?fix(maa):=20=E9=80=82=E9=85=8D=20MAA=20?= =?UTF-8?q?=E5=A4=87=E9=80=89=E5=85=B3=E5=8D=A1=E5=AD=97=E6=AE=B5=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/core/config.py | 188 ++++++++++++++-------- app/core/timer.py | 2 +- app/models/MAA.py | 46 +++--- app/ui/member_manager.py | 241 ++++++++++++++++------------- app/ui/plan_manager.py | 35 +++-- resources/docs/MAA_config_info.txt | 1 + resources/version.json | 10 +- 7 files changed, 315 insertions(+), 208 deletions(-) diff --git a/app/core/config.py b/app/core/config.py index 9338e60..3a341fc 100644 --- a/app/core/config.py +++ b/app/core/config.py @@ -408,7 +408,7 @@ class MaaUserConfig(LQConfig): self.Info_Mode = OptionsConfigItem( "Info", "Mode", "简洁", OptionsValidator(["简洁", "详细"]) ) - self.Info_GameIdMode = ConfigItem("Info", "GameIdMode", "固定") + self.Info_StageMode = ConfigItem("Info", "StageMode", "固定") self.Info_Server = OptionsConfigItem( "Info", "Server", "Official", OptionsValidator(["Official", "Bilibili"]) ) @@ -437,10 +437,11 @@ class MaaUserConfig(LQConfig): "0", OptionsValidator(["0", "6", "5", "4", "3", "2", "1", "-1"]), ) - self.Info_GameId = ConfigItem("Info", "GameId", "-") - self.Info_GameId_1 = ConfigItem("Info", "GameId_1", "-") - self.Info_GameId_2 = ConfigItem("Info", "GameId_2", "-") - self.Info_GameId_Remain = ConfigItem("Info", "GameId_Remain", "-") + self.Info_Stage = ConfigItem("Info", "Stage", "-") + self.Info_Stage_1 = ConfigItem("Info", "Stage_1", "-") + self.Info_Stage_2 = ConfigItem("Info", "Stage_2", "-") + self.Info_Stage_3 = ConfigItem("Info", "Stage_3", "-") + self.Info_Stage_Remain = ConfigItem("Info", "Stage_Remain", "-") self.Info_IfSkland = ConfigItem("Info", "IfSkland", False, BoolValidator()) self.Info_SklandToken = ConfigItem("Info", "SklandToken", "") @@ -499,24 +500,26 @@ class MaaUserConfig(LQConfig): def get_plan_info(self) -> Dict[str, Union[str, int]]: """获取当前的计划下信息""" - if self.get(self.Info_GameIdMode) == "固定": + if self.get(self.Info_StageMode) == "固定": return { "MedicineNumb": self.get(self.Info_MedicineNumb), "SeriesNumb": self.get(self.Info_SeriesNumb), - "GameId": self.get(self.Info_GameId), - "GameId_1": self.get(self.Info_GameId_1), - "GameId_2": self.get(self.Info_GameId_2), - "GameId_Remain": self.get(self.Info_GameId_Remain), + "Stage": self.get(self.Info_Stage), + "Stage_1": self.get(self.Info_Stage_1), + "Stage_2": self.get(self.Info_Stage_2), + "Stage_3": self.get(self.Info_Stage_3), + "Stage_Remain": self.get(self.Info_Stage_Remain), } - elif "计划" in self.get(self.Info_GameIdMode): - plan = Config.plan_dict[self.get(self.Info_GameIdMode)]["Config"] + elif "计划" in self.get(self.Info_StageMode): + plan = Config.plan_dict[self.get(self.Info_StageMode)]["Config"] return { "MedicineNumb": plan.get(plan.get_current_info("MedicineNumb")), "SeriesNumb": plan.get(plan.get_current_info("SeriesNumb")), - "GameId": plan.get(plan.get_current_info("GameId")), - "GameId_1": plan.get(plan.get_current_info("GameId_1")), - "GameId_2": plan.get(plan.get_current_info("GameId_2")), - "GameId_Remain": plan.get(plan.get_current_info("GameId_Remain")), + "Stage": plan.get(plan.get_current_info("Stage")), + "Stage_1": plan.get(plan.get_current_info("Stage_1")), + "Stage_2": plan.get(plan.get_current_info("Stage_2")), + "Stage_3": plan.get(plan.get_current_info("Stage_3")), + "Stage_Remain": plan.get(plan.get_current_info("Stage_Remain")), } @@ -554,24 +557,22 @@ class MaaPlanConfig(LQConfig): "0", OptionsValidator(["0", "6", "5", "4", "3", "2", "1", "-1"]), ) - self.config_item_dict[group]["GameId"] = ConfigItem(group, "GameId", "-") - self.config_item_dict[group]["GameId_1"] = ConfigItem( - group, "GameId_1", "-" - ) - self.config_item_dict[group]["GameId_2"] = ConfigItem( - group, "GameId_2", "-" - ) - self.config_item_dict[group]["GameId_Remain"] = ConfigItem( - group, "GameId_Remain", "-" + self.config_item_dict[group]["Stage"] = ConfigItem(group, "Stage", "-") + self.config_item_dict[group]["Stage_1"] = ConfigItem(group, "Stage_1", "-") + self.config_item_dict[group]["Stage_2"] = ConfigItem(group, "Stage_2", "-") + self.config_item_dict[group]["Stage_3"] = ConfigItem(group, "Stage_3", "-") + self.config_item_dict[group]["Stage_Remain"] = ConfigItem( + group, "Stage_Remain", "-" ) for name in [ "MedicineNumb", "SeriesNumb", - "GameId", - "GameId_1", - "GameId_2", - "GameId_Remain", + "Stage", + "Stage_1", + "Stage_2", + "Stage_3", + "Stage_Remain", ]: setattr(self, f"{group}_{name}", self.config_item_dict[group][name]) @@ -702,9 +703,9 @@ class GeneralSubConfig(LQConfig): class AppConfig(GlobalConfig): - VERSION = "4.4.0.2" + VERSION = "4.4.0.3" - gameid_refreshed = Signal() + stage_refreshed = Signal() PASSWORD_refreshed = Signal() sub_info_changed = Signal() power_sign_changed = Signal() @@ -719,15 +720,13 @@ class AppConfig(GlobalConfig): self.database_path = self.app_path / "data/data.db" self.config_path = self.app_path / "config/config.json" self.key_path = self.app_path / "data/key" - self.gameid_path = self.app_path / "data/gameid.txt" - self.version_path = self.app_path / "resources/version.json" self.main_window = None self.PASSWORD = "" self.running_list = [] self.silence_list = [] self.info_bar_list = [] - self.gameid_dict = { + self.stage_dict = { "ALL": {"value": [], "text": []}, "Monday": {"value": [], "text": []}, "Tuesday": {"value": [], "text": []}, @@ -778,15 +777,12 @@ class AppConfig(GlobalConfig): self.init_logger() self.check_data() - self.get_gameid() + self.get_stage() logger.info("程序初始化完成") def init_logger(self) -> None: """初始化日志记录器""" - if self.args.mode != "cli": - logger.remove(0) - logger.add( sink=self.log_path, level="DEBUG", @@ -810,7 +806,7 @@ class AppConfig(GlobalConfig): logger.info("日志记录器初始化完成") - def get_gameid(self) -> None: + def get_stage(self) -> None: # 从MAA服务器获取活动关卡信息 network = Network.add_task( @@ -820,33 +816,33 @@ class AppConfig(GlobalConfig): network.loop.exec() network_result = Network.get_result(network) if network_result["status_code"] == 200: - gameid_infos: List[Dict[str, Union[str, Dict[str, Union[str, int]]]]] = ( + stage_infos: List[Dict[str, Union[str, Dict[str, Union[str, int]]]]] = ( network_result["response_json"]["Official"]["sideStoryStage"] ) else: logger.warning( f"无法从MAA服务器获取活动关卡信息:{network_result['error_message']}" ) - gameid_infos = [] + stage_infos = [] - ss_gameid_dict = {"value": [], "text": []} + ss_stage_dict = {"value": [], "text": []} - for gameid_info in gameid_infos: + for stage_info in stage_infos: if ( datetime.strptime( - gameid_info["Activity"]["UtcStartTime"], "%Y/%m/%d %H:%M:%S" + stage_info["Activity"]["UtcStartTime"], "%Y/%m/%d %H:%M:%S" ) < datetime.now() < datetime.strptime( - gameid_info["Activity"]["UtcExpireTime"], "%Y/%m/%d %H:%M:%S" + stage_info["Activity"]["UtcExpireTime"], "%Y/%m/%d %H:%M:%S" ) ): - ss_gameid_dict["value"].append(gameid_info["Value"]) - ss_gameid_dict["text"].append(gameid_info["Value"]) + ss_stage_dict["value"].append(stage_info["Value"]) + ss_stage_dict["text"].append(stage_info["Value"]) # 生成每日关卡信息 - gameid_daily_info = [ + stage_daily_info = [ {"value": "-", "text": "当前/上次", "days": [1, 2, 3, 4, 5, 6, 7]}, {"value": "1-7", "text": "1-7", "days": [1, 2, 3, 4, 5, 6, 7]}, {"value": "R8-11", "text": "R8-11", "days": [1, 2, 3, 4, 5, 6, 7]}, @@ -872,20 +868,20 @@ class AppConfig(GlobalConfig): for day in range(0, 8): - today_gameid_dict = {"value": [], "text": []} + today_stage_dict = {"value": [], "text": []} - for gameid_info in gameid_daily_info: + for stage_info in stage_daily_info: - if day in gameid_info["days"] or day == 0: - today_gameid_dict["value"].append(gameid_info["value"]) - today_gameid_dict["text"].append(gameid_info["text"]) + if day in stage_info["days"] or day == 0: + today_stage_dict["value"].append(stage_info["value"]) + today_stage_dict["text"].append(stage_info["text"]) - self.gameid_dict[calendar.day_name[day - 1] if day > 0 else "ALL"] = { - "value": today_gameid_dict["value"] + ss_gameid_dict["value"], - "text": today_gameid_dict["text"] + ss_gameid_dict["text"], + self.stage_dict[calendar.day_name[day - 1] if day > 0 else "ALL"] = { + "value": today_stage_dict["value"] + ss_stage_dict["value"], + "text": today_stage_dict["text"] + ss_stage_dict["text"], } - self.gameid_refreshed.emit() + self.stage_refreshed.emit() def server_date(self) -> date: """获取当前的服务器日期""" @@ -903,7 +899,7 @@ class AppConfig(GlobalConfig): db = sqlite3.connect(self.database_path) cur = db.cursor() cur.execute("CREATE TABLE version(v text)") - cur.execute("INSERT INTO version VALUES(?)", ("v1.6",)) + cur.execute("INSERT INTO version VALUES(?)", ("v1.7",)) db.commit() cur.close() db.close() @@ -914,7 +910,7 @@ class AppConfig(GlobalConfig): cur.execute("SELECT * FROM version WHERE True") version = cur.fetchall() - if version[0][0] != "v1.6": + if version[0][0] != "v1.7": logger.info("数据文件版本更新开始") if_streaming = False # v1.4-->v1.5 @@ -922,10 +918,6 @@ class AppConfig(GlobalConfig): logger.info("数据文件版本更新:v1.4-->v1.5") if_streaming = True - cur.execute("DELETE FROM version WHERE v = ?", ("v1.4",)) - cur.execute("INSERT INTO version VALUES(?)", ("v1.5",)) - db.commit() - member_dict: Dict[str, Dict[str, Union[str, Path]]] = {} if (self.app_path / "config/MaaConfig").exists(): for maa_dir in (self.app_path / "config/MaaConfig").iterdir(): @@ -1044,6 +1036,11 @@ class AppConfig(GlobalConfig): shutil.rmtree(config["Path"] / f"simple") if (config["Path"] / f"beta").exists(): shutil.rmtree(config["Path"] / f"beta") + + cur.execute("DELETE FROM version WHERE v = ?", ("v1.4",)) + cur.execute("INSERT INTO version VALUES(?)", ("v1.5",)) + db.commit() + # v1.5-->v1.6 if version[0][0] == "v1.5" or if_streaming: logger.info("数据文件版本更新:v1.5-->v1.6") @@ -1076,6 +1073,67 @@ class AppConfig(GlobalConfig): winreg.CloseKey(key) except FileNotFoundError: pass + # v1.6-->v1.7 + if version[0][0] == "v1.6" or if_streaming: + logger.info("数据文件版本更新:v1.6-->v1.7") + if_streaming = True + + for MaaConfig in (self.app_path / "config/MaaConfig").iterdir(): + if MaaConfig.is_dir(): + for user in (MaaConfig / "UserData").iterdir(): + if user.is_dir(): + if (user / "config.json").exists(): + with (user / "config.json").open( + encoding="utf-8" + ) as f: + user_config = json.load(f) + user_config["Info"]["Stage"] = user_config["Info"][ + "GameId" + ] + user_config["Info"]["StageMode"] = user_config[ + "Info" + ]["GameIdMode"] + user_config["Info"]["Stage_1"] = user_config[ + "Info" + ]["GameId_1"] + user_config["Info"]["Stage_2"] = user_config[ + "Info" + ]["GameId_2"] + user_config["Info"]["Stage_Remain"] = user_config[ + "Info" + ]["GameId_Remain"] + with (user / "config.json").open( + "w", encoding="utf-8" + ) as f: + json.dump( + user_config, f, ensure_ascii=False, indent=4 + ) + for MaaPlanConfig in (self.app_path / "config/MaaPlanConfig").iterdir(): + if ( + MaaPlanConfig.is_dir() + and (MaaPlanConfig / "config.json").exists() + ): + with (MaaPlanConfig / "config.json").open( + encoding="utf-8" + ) as f: + plan_config = json.load(f) + + for k in self.stage_dict.keys(): + plan_config[k]["Stage"] = plan_config[k]["GameId"] + plan_config[k]["Stage_1"] = plan_config[k]["GameId_1"] + plan_config[k]["Stage_2"] = plan_config[k]["GameId_2"] + plan_config[k]["Stage_Remain"] = plan_config[k][ + "GameId_Remain" + ] + with (MaaPlanConfig / "config.json").open( + "w", encoding="utf-8" + ) as f: + json.dump(plan_config, f, ensure_ascii=False, indent=4) + + cur.execute("DELETE FROM version WHERE v = ?", ("v1.6",)) + cur.execute("INSERT INTO version VALUES(?)", ("v1.7",)) + db.commit() + cur.close() db.close() logger.info("数据文件版本更新完成") @@ -1236,8 +1294,8 @@ class AppConfig(GlobalConfig): for user in member["UserData"].values(): - if user["Config"].get(user["Config"].Info_GameIdMode) == old: - user["Config"].set(user["Config"].Info_GameIdMode, new) + if user["Config"].get(user["Config"].Info_StageMode) == old: + user["Config"].set(user["Config"].Info_StageMode, new) def change_maa_user_info( self, name: str, user_data: Dict[str, Dict[str, Union[str, Path, dict]]] diff --git a/app/core/timer.py b/app/core/timer.py index d91047b..4566d4d 100644 --- a/app/core/timer.py +++ b/app/core/timer.py @@ -53,7 +53,7 @@ class _MainTimer(QObject): def long_timed_task(self): """长时间定期检定任务""" - Config.get_gameid() + Config.get_stage() Config.main_window.setting.show_notice() if Config.get(Config.update_IfAutoUpdate): Config.main_window.setting.check_update() diff --git a/app/models/MAA.py b/app/models/MAA.py index 8d09a06..ac28227 100644 --- a/app/models/MAA.py +++ b/app/models/MAA.py @@ -1450,23 +1450,28 @@ class MaaManager(QObject): user_data["Info"]["MedicineNumb"] ) # 吃理智药数量 data["Configurations"]["Default"]["MainFunction.Stage1"] = ( - user_data["Info"]["GameId"] - if user_data["Info"]["GameId"] != "-" + user_data["Info"]["Stage"] + if user_data["Info"]["Stage"] != "-" else "" ) # 主关卡 data["Configurations"]["Default"]["MainFunction.Stage2"] = ( - user_data["Info"]["GameId_1"] - if user_data["Info"]["GameId_1"] != "-" + user_data["Info"]["Stage_1"] + if user_data["Info"]["Stage_1"] != "-" else "" ) # 备选关卡1 data["Configurations"]["Default"]["MainFunction.Stage3"] = ( - user_data["Info"]["GameId_2"] - if user_data["Info"]["GameId_2"] != "-" + user_data["Info"]["Stage_2"] + if user_data["Info"]["Stage_2"] != "-" else "" ) # 备选关卡2 + data["Configurations"]["Default"]["MainFunction.Stage4"] = ( + user_data["Info"]["Stage_3"] + if user_data["Info"]["Stage_3"] != "-" + else "" + ) # 备选关卡3 data["Configurations"]["Default"]["Fight.RemainingSanityStage"] = ( - user_data["Info"]["GameId_Remain"] - if user_data["Info"]["GameId_Remain"] != "-" + user_data["Info"]["Stage_Remain"] + if user_data["Info"]["Stage_Remain"] != "-" else "" ) # 剩余理智关卡 data["Configurations"]["Default"][ @@ -1486,7 +1491,7 @@ class MaaManager(QObject): data["Configurations"]["Default"][ "Fight.UseRemainingSanityStage" ] = ( - "True" if user_data["Info"]["GameId_Remain"] != "-" else "False" + "True" if user_data["Info"]["Stage_Remain"] != "-" else "False" ) # 使用剩余理智 data["Configurations"]["Default"][ "Fight.UseExpiringMedicine" @@ -1556,23 +1561,28 @@ class MaaManager(QObject): user_data["Info"]["MedicineNumb"] ) # 吃理智药数量 data["Configurations"]["Default"]["MainFunction.Stage1"] = ( - user_data["Info"]["GameId"] - if user_data["Info"]["GameId"] != "-" + user_data["Info"]["Stage"] + if user_data["Info"]["Stage"] != "-" else "" ) # 主关卡 data["Configurations"]["Default"]["MainFunction.Stage2"] = ( - user_data["Info"]["GameId_1"] - if user_data["Info"]["GameId_1"] != "-" + user_data["Info"]["Stage_1"] + if user_data["Info"]["Stage_1"] != "-" else "" ) # 备选关卡1 data["Configurations"]["Default"]["MainFunction.Stage3"] = ( - user_data["Info"]["GameId_2"] - if user_data["Info"]["GameId_2"] != "-" + user_data["Info"]["Stage_2"] + if user_data["Info"]["Stage_2"] != "-" else "" ) # 备选关卡2 + data["Configurations"]["Default"]["MainFunction.Stage4"] = ( + user_data["Info"]["Stage_3"] + if user_data["Info"]["Stage_3"] != "-" + else "" + ) # 备选关卡3 data["Configurations"]["Default"]["Fight.RemainingSanityStage"] = ( - user_data["Info"]["GameId_Remain"] - if user_data["Info"]["GameId_Remain"] != "-" + user_data["Info"]["Stage_Remain"] + if user_data["Info"]["Stage_Remain"] != "-" else "" ) # 剩余理智关卡 data["Configurations"]["Default"][ @@ -1586,7 +1596,7 @@ class MaaManager(QObject): data["Configurations"]["Default"][ "Fight.UseRemainingSanityStage" ] = ( - "True" if user_data["Info"]["GameId_Remain"] != "-" else "False" + "True" if user_data["Info"]["Stage_Remain"] != "-" else "False" ) # 使用剩余理智 # 基建模式 diff --git a/app/ui/member_manager.py b/app/ui/member_manager.py index 30c9b5e..427c255 100644 --- a/app/ui/member_manager.py +++ b/app/ui/member_manager.py @@ -547,14 +547,14 @@ class MemberManager(QWidget): for user_setting in member.user_setting.user_manager.script_list: - user_setting.card_GameIdMode.comboBox.currentIndexChanged.disconnect( - user_setting.switch_gameid_mode + user_setting.card_StageMode.comboBox.currentIndexChanged.disconnect( + user_setting.switch_stage_mode ) - user_setting.card_GameIdMode.reLoadOptions( + user_setting.card_StageMode.reLoadOptions( plan_list[0], plan_list[1] ) - user_setting.card_GameIdMode.comboBox.currentIndexChanged.connect( - user_setting.switch_gameid_mode + user_setting.card_StageMode.comboBox.currentIndexChanged.connect( + user_setting.switch_stage_mode ) self.refresh_plan_info() @@ -578,7 +578,7 @@ class MemberManager(QWidget): member.user_setting.user_manager.user_dashboard.load_info() for user_setting in member.user_setting.user_manager.script_list: - user_setting.switch_gameid_mode() + user_setting.switch_stage_mode() class MemberSettingBox(QWidget): """脚本管理子页面组""" @@ -1217,8 +1217,8 @@ class MemberManager(QWidget): """清空所有子界面""" for sub_interface in self.script_list: - Config.gameid_refreshed.disconnect( - sub_interface.refresh_gameid + Config.stage_refreshed.disconnect( + sub_interface.refresh_stage ) Config.PASSWORD_refreshed.disconnect( sub_interface.refresh_password @@ -1254,7 +1254,7 @@ class MemberManager(QWidget): self.name = name self.dashboard = TableWidget(self) - self.dashboard.setColumnCount(11) + self.dashboard.setColumnCount(12) self.dashboard.setHorizontalHeaderLabels( [ "用户名", @@ -1266,6 +1266,7 @@ class MemberManager(QWidget): "关卡选择", "备选 - 1", "备选 - 2", + "备选 - 3", "剩余理智", "详", ] @@ -1276,14 +1277,14 @@ class MemberManager(QWidget): self.dashboard.horizontalHeader().setSectionResizeMode( col, QHeaderView.ResizeMode.ResizeToContents ) - for col in range(6, 10): + for col in range(6, 11): self.dashboard.horizontalHeader().setSectionResizeMode( col, QHeaderView.ResizeMode.Stretch ) self.dashboard.horizontalHeader().setSectionResizeMode( - 10, QHeaderView.ResizeMode.Fixed + 11, QHeaderView.ResizeMode.Fixed ) - self.dashboard.setColumnWidth(10, 32) + self.dashboard.setColumnWidth(11, 32) self.viewLayout.addWidget(self.dashboard) self.viewLayout.setContentsMargins(3, 0, 3, 3) @@ -1319,7 +1320,7 @@ class MemberManager(QWidget): else "本周剿灭未完成" ) - gameid_info = config.get_plan_info() + stage_info = config.get_plan_info() button = PrimaryToolButton( FluentIcon.CHEVRON_RIGHT, self @@ -1369,74 +1370,86 @@ class MemberManager(QWidget): self.dashboard.setItem( int(name[3:]) - 1, 5, - QTableWidgetItem(str(gameid_info["MedicineNumb"])), + QTableWidgetItem(str(stage_info["MedicineNumb"])), ) self.dashboard.setItem( int(name[3:]) - 1, 6, QTableWidgetItem( - Config.gameid_dict["ALL"]["text"][ - Config.gameid_dict["ALL"]["value"].index( - gameid_info["GameId"] + Config.stage_dict["ALL"]["text"][ + Config.stage_dict["ALL"]["value"].index( + stage_info["Stage"] ) ] - if gameid_info["GameId"] - in Config.gameid_dict["ALL"]["value"] - else gameid_info["GameId"] + if stage_info["Stage"] + in Config.stage_dict["ALL"]["value"] + else stage_info["Stage"] ), ) self.dashboard.setItem( int(name[3:]) - 1, 7, QTableWidgetItem( - Config.gameid_dict["ALL"]["text"][ - Config.gameid_dict["ALL"]["value"].index( - gameid_info["GameId_1"] + Config.stage_dict["ALL"]["text"][ + Config.stage_dict["ALL"]["value"].index( + stage_info["Stage"] ) ] - if gameid_info["GameId_1"] - in Config.gameid_dict["ALL"]["value"] - else gameid_info["GameId_1"] + if stage_info["Stage"] + in Config.stage_dict["ALL"]["value"] + else stage_info["Stage"] ), ) self.dashboard.setItem( int(name[3:]) - 1, 8, QTableWidgetItem( - Config.gameid_dict["ALL"]["text"][ - Config.gameid_dict["ALL"]["value"].index( - gameid_info["GameId_2"] + Config.stage_dict["ALL"]["text"][ + Config.stage_dict["ALL"]["value"].index( + stage_info["Stage_2"] ) ] - if gameid_info["GameId_2"] - in Config.gameid_dict["ALL"]["value"] - else gameid_info["GameId_2"] + if stage_info["Stage_2"] + in Config.stage_dict["ALL"]["value"] + else stage_info["Stage_2"] ), ) self.dashboard.setItem( int(name[3:]) - 1, 9, + QTableWidgetItem( + Config.stage_dict["ALL"]["text"][ + Config.stage_dict["ALL"]["value"].index( + stage_info["Stage_3"] + ) + ] + if stage_info["Stage_3"] + in Config.stage_dict["ALL"]["value"] + else stage_info["Stage_3"] + ), + ) + self.dashboard.setItem( + int(name[3:]) - 1, + 10, QTableWidgetItem( "不使用" - if gameid_info["GameId_Remain"] == "-" + if stage_info["Stage_Remain"] == "-" else ( ( - Config.gameid_dict["ALL"]["text"][ - Config.gameid_dict["ALL"][ + Config.stage_dict["ALL"]["text"][ + Config.stage_dict["ALL"][ "value" - ].index( - gameid_info["GameId_Remain"] - ) + ].index(stage_info["Stage_Remain"]) ] ) - if gameid_info["GameId_Remain"] - in Config.gameid_dict["ALL"]["value"] - else gameid_info["GameId_Remain"] + if stage_info["Stage_Remain"] + in Config.stage_dict["ALL"]["value"] + else stage_info["Stage_Remain"] ) ), ) self.dashboard.setCellWidget( - int(name[3:]) - 1, 10, button + int(name[3:]) - 1, 11, button ) class UserMemberSettingBox(HeaderCardWidget): @@ -1495,17 +1508,6 @@ class MemberManager(QWidget): configItem=self.config.Info_Mode, parent=self, ) - self.card_GameIdMode = NoOptionComboBoxSettingCard( - icon=FluentIcon.DICTIONARY, - title="关卡配置模式", - content="刷理智关卡号的配置模式", - value=plan_list[0], - texts=plan_list[1], - qconfig=self.config, - configItem=self.config.Info_GameIdMode, - parent=self, - ) - self.card_GameIdMode.comboBox.setMinimumWidth(0) self.card_Server = ComboBoxSettingCard( icon=FluentIcon.PROJECTOR, title="服务器", @@ -1602,48 +1604,69 @@ class MemberManager(QWidget): parent=self, ) self.card_SeriesNumb.comboBox.setMinimumWidth(150) - self.card_GameId = EditableComboBoxWithPlanSettingCard( + self.card_StageMode = NoOptionComboBoxSettingCard( + icon=FluentIcon.DICTIONARY, + title="关卡配置模式", + content="刷理智关卡号的配置模式", + value=plan_list[0], + texts=plan_list[1], + qconfig=self.config, + configItem=self.config.Info_StageMode, + parent=self, + ) + self.card_StageMode.comboBox.setMinimumWidth(150) + self.card_Stage = EditableComboBoxWithPlanSettingCard( icon=FluentIcon.GAME, title="关卡选择", content="按下回车以添加自定义关卡号", - value=Config.gameid_dict["ALL"]["value"], - texts=Config.gameid_dict["ALL"]["text"], + value=Config.stage_dict["ALL"]["value"], + texts=Config.stage_dict["ALL"]["text"], qconfig=self.config, - configItem=self.config.Info_GameId, + configItem=self.config.Info_Stage, parent=self, ) - self.card_GameId_1 = EditableComboBoxWithPlanSettingCard( + self.card_Stage_1 = EditableComboBoxWithPlanSettingCard( icon=FluentIcon.GAME, title="备选关卡 - 1", content="按下回车以添加自定义关卡号", - value=Config.gameid_dict["ALL"]["value"], - texts=Config.gameid_dict["ALL"]["text"], + value=Config.stage_dict["ALL"]["value"], + texts=Config.stage_dict["ALL"]["text"], qconfig=self.config, - configItem=self.config.Info_GameId_1, + configItem=self.config.Info_Stage_1, parent=self, ) - self.card_GameId_2 = EditableComboBoxWithPlanSettingCard( + self.card_Stage_2 = EditableComboBoxWithPlanSettingCard( icon=FluentIcon.GAME, title="备选关卡 - 2", content="按下回车以添加自定义关卡号", - value=Config.gameid_dict["ALL"]["value"], - texts=Config.gameid_dict["ALL"]["text"], + value=Config.stage_dict["ALL"]["value"], + texts=Config.stage_dict["ALL"]["text"], qconfig=self.config, - configItem=self.config.Info_GameId_2, + configItem=self.config.Info_Stage_2, parent=self, ) - self.card_GameId_Remain = ( + self.card_Stage_3 = EditableComboBoxWithPlanSettingCard( + icon=FluentIcon.GAME, + title="备选关卡 - 3", + content="按下回车以添加自定义关卡号", + value=Config.stage_dict["ALL"]["value"], + texts=Config.stage_dict["ALL"]["text"], + qconfig=self.config, + configItem=self.config.Info_Stage_3, + parent=self, + ) + self.card_Stage_Remain = ( EditableComboBoxWithPlanSettingCard( icon=FluentIcon.GAME, title="剩余理智关卡", content="按下回车以添加自定义关卡号", - value=Config.gameid_dict["ALL"]["value"], + value=Config.stage_dict["ALL"]["value"], texts=[ "不使用" if _ == "当前/上次" else _ - for _ in Config.gameid_dict["ALL"]["text"] + for _ in Config.stage_dict["ALL"]["text"] ], qconfig=self.config, - configItem=self.config.Info_GameId_Remain, + configItem=self.config.Info_Stage_Remain, parent=self, ) ) @@ -1822,7 +1845,6 @@ class MemberManager(QWidget): h1_layout.addWidget(self.card_Id) h2_layout = QHBoxLayout() h2_layout.addWidget(self.card_Mode) - h2_layout.addWidget(self.card_GameIdMode) h2_layout.addWidget(self.card_Server) h3_layout = QHBoxLayout() h3_layout.addWidget(self.card_Status) @@ -1838,11 +1860,14 @@ class MemberManager(QWidget): h6_layout.addWidget(self.card_MedicineNumb) h6_layout.addWidget(self.card_SeriesNumb) h7_layout = QHBoxLayout() - h7_layout.addWidget(self.card_GameId) - h7_layout.addWidget(self.card_GameId_1) + h7_layout.addWidget(self.card_StageMode) + h7_layout.addWidget(self.card_Stage) h8_layout = QHBoxLayout() - h8_layout.addWidget(self.card_GameId_2) - h8_layout.addWidget(self.card_GameId_Remain) + h8_layout.addWidget(self.card_Stage_1) + h8_layout.addWidget(self.card_Stage_2) + h9_layout = QHBoxLayout() + h9_layout.addWidget(self.card_Stage_3) + h9_layout.addWidget(self.card_Stage_Remain) Layout = QVBoxLayout() Layout.addLayout(h1_layout) @@ -1854,6 +1879,7 @@ class MemberManager(QWidget): Layout.addLayout(h6_layout) Layout.addLayout(h7_layout) Layout.addLayout(h8_layout) + Layout.addLayout(h9_layout) Layout.addWidget(self.card_Skland) Layout.addWidget(self.card_TaskSet) Layout.addWidget(self.card_NotifySet) @@ -1878,14 +1904,14 @@ class MemberManager(QWidget): ) self.card_TaskSet.clicked.connect(self.set_task) self.card_NotifySet.clicked.connect(self.set_notify) - self.card_GameIdMode.comboBox.currentIndexChanged.connect( - self.switch_gameid_mode + self.card_StageMode.comboBox.currentIndexChanged.connect( + self.switch_stage_mode ) - Config.gameid_refreshed.connect(self.refresh_gameid) + Config.stage_refreshed.connect(self.refresh_stage) Config.PASSWORD_refreshed.connect(self.refresh_password) self.switch_mode() - self.switch_gameid_mode() + self.switch_stage_mode() self.switch_infrastructure() def switch_mode(self) -> None: @@ -1904,37 +1930,39 @@ class MemberManager(QWidget): self.card_Annihilation.button.setVisible(True) self.card_Routine.setVisible(True) - def switch_gameid_mode(self) -> None: + def switch_stage_mode(self) -> None: for card, name in zip( [ self.card_MedicineNumb, self.card_SeriesNumb, - self.card_GameId, - self.card_GameId_1, - self.card_GameId_2, - self.card_GameId_Remain, + self.card_Stage, + self.card_Stage_1, + self.card_Stage_2, + self.card_Stage_3, + self.card_Stage_Remain, ], [ "MedicineNumb", "SeriesNumb", - "GameId", - "GameId_1", - "GameId_2", - "GameId_Remain", + "Stage", + "Stage_1", + "Stage_2", + "Stage_3", + "Stage_Remain", ], ): card.switch_mode( - self.config.get(self.config.Info_GameIdMode)[:2] + self.config.get(self.config.Info_StageMode)[:2] ) if ( - self.config.get(self.config.Info_GameIdMode) + self.config.get(self.config.Info_StageMode) != "固定" ): card.change_plan( Config.plan_dict[ - self.config.get(self.config.Info_GameIdMode) + self.config.get(self.config.Info_StageMode) ]["Config"].get_current_info(name) ) @@ -1959,26 +1987,27 @@ class MemberManager(QWidget): "自定义基建配置文件未生效" ) - def refresh_gameid(self): + def refresh_stage(self): - self.card_GameId.reLoadOptions( - Config.gameid_dict["ALL"]["value"], - Config.gameid_dict["ALL"]["text"], + self.card_Stage.reLoadOptions( + Config.stage_dict["ALL"]["value"], + Config.stage_dict["ALL"]["text"], ) - self.card_GameId_1.reLoadOptions( - Config.gameid_dict["ALL"]["value"], - Config.gameid_dict["ALL"]["text"], + self.card_Stage_1.reLoadOptions( + Config.stage_dict["ALL"]["value"], + Config.stage_dict["ALL"]["text"], ) - self.card_GameId_2.reLoadOptions( - Config.gameid_dict["ALL"]["value"], - Config.gameid_dict["ALL"]["text"], + self.card_Stage_2.reLoadOptions( + Config.stage_dict["ALL"]["value"], + Config.stage_dict["ALL"]["text"], ) - self.card_GameId_Remain.reLoadOptions( - Config.gameid_dict["ALL"]["value"], - [ - "不使用" if _ == "当前/上次" else _ - for _ in Config.gameid_dict["ALL"]["text"] - ], + self.card_Stage_3.reLoadOptions( + Config.stage_dict["ALL"]["value"], + Config.stage_dict["ALL"]["text"], + ) + self.card_Stage_Remain.reLoadOptions( + Config.stage_dict["ALL"]["value"], + Config.stage_dict["ALL"]["text"], ) def refresh_password(self): diff --git a/app/ui/plan_manager.py b/app/ui/plan_manager.py index 7ebd9bf..5c6c84d 100644 --- a/app/ui/plan_manager.py +++ b/app/ui/plan_manager.py @@ -324,7 +324,7 @@ class PlanManager(QWidget): """清空所有子界面""" for sub_interface in self.script_list: - Config.gameid_refreshed.disconnect(sub_interface.refresh_gameid) + Config.stage_refreshed.disconnect(sub_interface.refresh_stage) self.stackedWidget.removeWidget(sub_interface) sub_interface.deleteLater() self.script_list.clear() @@ -372,7 +372,7 @@ class PlanManager(QWidget): self.table = TableWidget(self) self.table.setColumnCount(8) - self.table.setRowCount(6) + self.table.setRowCount(7) self.table.setHorizontalHeaderLabels( ["全局", "周一", "周二", "周三", "周四", "周五", "周六", "周日"] ) @@ -383,6 +383,7 @@ class PlanManager(QWidget): "关卡选择", "备选 - 1", "备选 - 2", + "备选 - 3", "剩余理智", ] ) @@ -392,7 +393,7 @@ class PlanManager(QWidget): self.table.horizontalHeader().setSectionResizeMode( col, QHeaderView.ResizeMode.Stretch ) - for row in range(6): + for row in range(7): self.table.verticalHeader().setSectionResizeMode( row, QHeaderView.ResizeMode.ResizeToContents ) @@ -427,21 +428,21 @@ class PlanManager(QWidget): configItem=configItem, parent=self, ) - elif name == "GameId_Remain": + elif name == "Stage_Remain": self.item_dict[group][name] = EditableComboBoxSetting( - value=Config.gameid_dict[group]["value"], + value=Config.stage_dict[group]["value"], texts=[ "不使用" if _ == "当前/上次" else _ - for _ in Config.gameid_dict[group]["text"] + for _ in Config.stage_dict[group]["text"] ], qconfig=self.config, configItem=configItem, parent=self, ) - elif "GameId" in name: + elif "Stage" in name: self.item_dict[group][name] = EditableComboBoxSetting( - value=Config.gameid_dict[group]["value"], - texts=Config.gameid_dict[group]["text"], + value=Config.stage_dict[group]["value"], + texts=Config.stage_dict[group]["text"], qconfig=self.config, configItem=configItem, parent=self, @@ -459,7 +460,7 @@ class PlanManager(QWidget): self.viewLayout.setContentsMargins(3, 0, 3, 3) self.card_Mode.comboBox.currentIndexChanged.connect(self.switch_mode) - Config.gameid_refreshed.connect(self.refresh_gameid) + Config.stage_refreshed.connect(self.refresh_stage) self.switch_mode() @@ -473,25 +474,25 @@ class PlanManager(QWidget): == (self.config.get(self.config.Info_Mode) == "ALL") ) - def refresh_gameid(self): + def refresh_stage(self): for group, name_dict in self.item_dict.items(): for name, setting_item in name_dict.items(): - if name == "GameId_Remain": + if name == "Stage_Remain": setting_item.reLoadOptions( - Config.gameid_dict[group]["value"], + Config.stage_dict[group]["value"], [ "不使用" if _ == "当前/上次" else _ - for _ in Config.gameid_dict[group]["text"] + for _ in Config.stage_dict[group]["text"] ], ) - elif "GameId" in name: + elif "Stage" in name: setting_item.reLoadOptions( - Config.gameid_dict[group]["value"], - Config.gameid_dict[group]["text"], + Config.stage_dict[group]["value"], + Config.stage_dict[group]["text"], ) diff --git a/resources/docs/MAA_config_info.txt b/resources/docs/MAA_config_info.txt index c7e0d9d..8bce40e 100644 --- a/resources/docs/MAA_config_info.txt +++ b/resources/docs/MAA_config_info.txt @@ -24,6 +24,7 @@ "MainFunction.Stage1": "" #主关卡 "MainFunction.Stage2": "" #备选关卡1 "MainFunction.Stage3": "" #备选关卡2 +"MainFunction.Stage4": "" #备选关卡3 "Fight.RemainingSanityStage": "Annihilation" #剩余理智关卡 "MainFunction.Series.Quantity": "1" #连战次数 "Penguin.IsDrGrandet": "True" #博朗台模式 diff --git a/resources/version.json b/resources/version.json index 7d6cd9b..87943f3 100644 --- a/resources/version.json +++ b/resources/version.json @@ -1,6 +1,14 @@ { - "main_version": "4.4.0.2", + "main_version": "4.4.0.3", "version_info": { + "4.4.0.3": { + "修复BUG": [ + "适配 MAA 备选关卡字段修改" + ], + "程序优化": [ + "`GameId`字段改为 `Stage`,与 MAA 保持一致" + ] + }, "4.4.0.2": { "新增功能": [ "进一步适配三月七相关配置项"