From 8a571f79c9b623701d0a8b18abd93ede7be86344 Mon Sep 17 00:00:00 2001 From: Zebartin <16185081+Zebartin@users.noreply.github.com> Date: Fri, 15 Nov 2024 10:49:37 +0800 Subject: [PATCH] Fix: Assignment keywords extracting --- dev_tools/keyword_extract.py | 2 +- dev_tools/keywords/assignment.py | 5 +++-- dev_tools/keywords/base.py | 1 + 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/dev_tools/keyword_extract.py b/dev_tools/keyword_extract.py index 9da77b2d7..449b37ed9 100644 --- a/dev_tools/keyword_extract.py +++ b/dev_tools/keyword_extract.py @@ -556,7 +556,7 @@ class KeywordExtract: self.load_keywords(['本周任务', '本期任务']) self.write_keywords(keyword_class='BattlePassMissionTab', output_file='./tasks/battle_pass/keywords/mission_tab.py') - # self.generate_assignments() + self.generate_assignments() self.generate_forgotten_hall_stages() self.generate_daily_quests() self.generate_battle_pass_quests() diff --git a/dev_tools/keywords/assignment.py b/dev_tools/keywords/assignment.py index 5dac448dc..d7cdccdb3 100644 --- a/dev_tools/keywords/assignment.py +++ b/dev_tools/keywords/assignment.py @@ -59,7 +59,7 @@ def get_assignment_entry_data(): for expedition_namehash, expedition_id in expedition_namehash_to_id.items(): reward_id = expedition_id_to_reward_id[expedition_id] item_ids = reward_id_to_item_ids[reward_id] - item_names = [item_id_to_namehash[x] for x in item_ids] + item_names = [item_id_to_namehash[x] for x in item_ids if x] if len(item_names) == 1: item = GenerateKeyword.find_keyword(item_names[0], lang='cn')[1] if item in item_name_remap: @@ -128,6 +128,7 @@ class GenerateAssignmentEventGroup(GenerateKeyword): def iter_keywords(self) -> Iterable[dict]: yield dict(text_id=self.find_keyword('空间站特派', lang='cn')[0]) yield dict(text_id=self.find_keyword('关于波提欧的一切…', lang='cn')[0]) + yield dict(text_id=self.find_keyword('游侠谜影', lang='cn')[0]) class GenerateAssignmentEventEntry(GenerateKeyword): @@ -141,5 +142,5 @@ class GenerateAssignmentEventEntry(GenerateKeyword): if __name__ == "__main__": from dev_tools.keywords.base import TextMap - TextMap.DATA_FOLDER = '../StarRailData' + TextMap.DATA_FOLDER = '../DanhengServer-Resources' GenerateAssignment()() diff --git a/dev_tools/keywords/base.py b/dev_tools/keywords/base.py index 0cd904c3e..6fcd397ac 100644 --- a/dev_tools/keywords/base.py +++ b/dev_tools/keywords/base.py @@ -68,6 +68,7 @@ def text_to_variable(text): text = re.sub(r'[(),#"?!&%*]|', '', text) # text = re.sub(r'[#_]?\d+(_times?)?', '', text) text = re.sub(r'', '', text) + text = re.sub(r'^\d+', '', text) text = text.replace('é', 'e') return text.strip('_')