From af69ab3b11ebd2aaa1e1988c415a6718f9344a88 Mon Sep 17 00:00:00 2001 From: EightyDollars Date: Sun, 17 Sep 2023 23:05:46 +0800 Subject: [PATCH 1/4] =?UTF-8?q?fix=EF=BC=9A=E4=BF=AE=E6=94=B9=E9=83=A8?= =?UTF-8?q?=E5=88=86=E5=85=AC=E6=8B=9B=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- arknights_mower/solvers/recruit.py | 102 +++++++++++++++++------------ 1 file changed, 61 insertions(+), 41 deletions(-) diff --git a/arknights_mower/solvers/recruit.py b/arknights_mower/solvers/recruit.py index 6c984d9f4..d644f1dae 100644 --- a/arknights_mower/solvers/recruit.py +++ b/arknights_mower/solvers/recruit.py @@ -48,7 +48,7 @@ def __init__(self, device: Device = None, recog: Recognizer = None) -> None: self.recruit_pos = -1 - def run(self, priority: list[str] = None, email_config={}, maa_config={}): + def run(self, priority: list[str] = None, email_config={}, recruit_config={}): """ :param priority: list[str], 优先考虑的公招干员,默认为高稀有度优先 """ @@ -59,7 +59,7 @@ def run(self, priority: list[str] = None, email_config={}, maa_config={}): self.email_config = email_config # 调整公招参数 - self.add_recruit_param(maa_config) + self.add_recruit_param(recruit_config) logger.info('Start: 公招') # 清空 @@ -89,21 +89,22 @@ def run(self, priority: list[str] = None, email_config={}, maa_config={}): return self.agent_choose, self.result_agent - def add_recruit_param(self, maa_config): - if not maa_config: + def add_recruit_param(self, recruit_config): + if not recruit_config: raise Exception("招募设置为空") - if maa_config['recruitment_time']: + if recruit_config['recruitment_time']: recruitment_time = 460 else: recruitment_time = 540 self.recruit_config = { - "recruit_only_4": maa_config['recruit_only_4'], + "recruit_only_4": recruit_config['recruit_only_4'], "recruitment_time": { "3": recruitment_time, "4": 540 - } + }, + "recruit_robot": recruit_config['recruit_robot'] } def transition(self) -> bool: @@ -183,7 +184,7 @@ def recruit_tags(self) -> bool: logger.info(f'第{self.recruit_pos + 1}个位置上的公招标签:{tags}') # 计算招募标签组合结果 - best, need_choose = self.recruit_cal(tags, self.priority) + best, need_choose = self.recruit_cal(tags) # 刷新标签 if need_choose is False: @@ -360,10 +361,11 @@ def merge_agent_list(self, tags: [str], list_1: list[dict], list_2={}, list_3={} return merge_list, level, isRarity, isRobot - def recruit_cal(self, tags: list[str], auto_robot=False, need_Robot=True) -> (dict, bool): + def recruit_cal(self, tags: list[str]) -> (dict, bool): possible_list = {} has_rarity = False has_robot = False + recruit_robot =self.recruit_config["recruit_robot"] for item in combinations(tags, 1): # 防止出现类似情况 ['重', '装', '干', '员'] @@ -414,47 +416,65 @@ def recruit_cal(self, tags: list[str], auto_robot=False, need_Robot=True) -> (di logger.debug(f"公招可能性:{self.recruit_str(possible_list)}") + rarity_list = { + "level": -1, + "possible": {} + } + normal_list = { + "level": -1, + "possible": {} + } + robot_list = {} for key in list(possible_list.keys()): # 五星六星选择优先级大于支援机械 - if has_rarity: - if possible_list[key]['isRarity'] is False: - del possible_list[key] - continue - elif possible_list[key]['level'] < 6 and "高级资深干员" in tags: - del possible_list[key] + if possible_list[key]["isRarity"]: + if possible_list[key]["level"] > rarity_list["level"]: + rarity_list["level"] = possible_list[key]["level"] + rarity_list["possible"][key] = possible_list[key] + elif possible_list[key]["isRobot"]: + robot_list[key] = possible_list[key] + else: + if possible_list[key]["level"] > normal_list["level"]: + normal_list["level"] = possible_list[key]["level"] + normal_list["possible"][key] = possible_list[key] + + # 筛选稀有tag + if rarity_list["possible"]: + for key in list(rarity_list["possible"].keys()): + if rarity_list["possible"][key]["level"] < rarity_list["level"]: + del rarity_list["possible"][key] continue - # 不要支援机械 - elif need_Robot is False and possible_list[key]['isRobot'] is True: - del possible_list[key] - continue - # 支援机械手动选择 - elif has_robot and need_Robot is True and possible_list[key]['isRobot'] is False: - del possible_list[key] - continue + for i in range(len(rarity_list["possible"][key]["agent"]) - 1, -1, -1): + if rarity_list["possible"][key]["agent"][i]['level'] != rarity_list["possible"][key]["level"]: + rarity_list["possible"][key]["agent"].remove(rarity_list["possible"][key]["agent"][i]) + logger.debug(f"rarity_list:{rarity_list}") + return rarity_list, False + + if robot_list and self.recruit_config["recruit_robot"]: + logger.debug(f"robot_list:{robot_list.popitem()}") + return robot_list, False - '''只保留大概率能出的tag''' - for i in range(len(possible_list[key]["agent"]) - 1, -1, -1): - if possible_list[key]["agent"][i]['level'] != possible_list[key]["level"]: - possible_list[key]["agent"].remove(possible_list[key]["agent"][i]) + # 筛选非稀有tag - # 六星 五星 支援机械手动选择返回全部结果 + logger.debug(normal_list["level"]) + if normal_list["level"] < 4: + return {}, True - # 有支援机械 不需要自动点支援机械 并且需要支援机械的情况下,邮件提醒 - notice_robot = (has_robot and auto_robot == False and need_Robot) - need_choose = True - if notice_robot or has_rarity: - need_choose = False - logger.info(f"稀有tag:{self.recruit_str(possible_list)}") - return possible_list, need_choose + for key in list(normal_list["possible"].keys()): + if normal_list["possible"][key]["level"] < normal_list["level"]: + del normal_list["possible"][key] + continue + for i in range(len(normal_list["possible"][key]["agent"]) - 1, -1, -1): + if normal_list["possible"][key]["agent"][i]['level'] != normal_list["possible"][key]["level"]: + normal_list["possible"][key]["agent"].remove(normal_list["possible"][key]["agent"][i]) best = {} # 4星=需要选择tag返回选择的tag,3星不选 - for key in possible_list: - if possible_list[key]['level'] >= 4: - best[key] = possible_list[key] - break - - return best, need_choose + for key in normal_list["possible"]: + best[key] = normal_list["possible"][key] + break + logger.debug(f"normal_list:{normal_list}") + return best, True def recruit_str(self, recruit_result: dict): if not recruit_result: From 0f6608f7fbe1995b895f62b4d668916bf152b6aa Mon Sep 17 00:00:00 2001 From: EightyDollars Date: Sun, 17 Sep 2023 23:06:50 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=A3=AE=E7=A9=BA?= =?UTF-8?q?=E5=B2=9B=E7=AD=BE=E5=88=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ui/src/components/Recruit.vue | 125 ++++++++++++++++++++++++++++++++++ ui/src/components/SKLand.vue | 49 +++++++++++++ ui/src/pages/Advanced.vue | 1 + ui/src/pages/External.vue | 2 +- ui/src/stores/config.js | 36 +++++++++- 5 files changed, 209 insertions(+), 4 deletions(-) create mode 100644 ui/src/components/Recruit.vue create mode 100644 ui/src/components/SKLand.vue diff --git a/ui/src/components/Recruit.vue b/ui/src/components/Recruit.vue new file mode 100644 index 000000000..20655e7d0 --- /dev/null +++ b/ui/src/components/Recruit.vue @@ -0,0 +1,125 @@ + + + + + diff --git a/ui/src/components/SKLand.vue b/ui/src/components/SKLand.vue new file mode 100644 index 000000000..e582b3e81 --- /dev/null +++ b/ui/src/components/SKLand.vue @@ -0,0 +1,49 @@ + + + + + + + + diff --git a/ui/src/pages/Advanced.vue b/ui/src/pages/Advanced.vue index 9afdd90d9..e0e96a54b 100644 --- a/ui/src/pages/Advanced.vue +++ b/ui/src/pages/Advanced.vue @@ -253,6 +253,7 @@ async function select_simulator_folder() { + diff --git a/ui/src/pages/External.vue b/ui/src/pages/External.vue index 95ce69cae..500d67398 100644 --- a/ui/src/pages/External.vue +++ b/ui/src/pages/External.vue @@ -47,7 +47,7 @@ const rogue_themes = [