Fix: Assignment keywords extracting

This commit is contained in:
Zebartin 2024-11-15 10:49:37 +08:00
parent 13d8c9100d
commit 8a571f79c9
3 changed files with 5 additions and 3 deletions

View File

@ -556,7 +556,7 @@ class KeywordExtract:
self.load_keywords(['本周任务', '本期任务']) self.load_keywords(['本周任务', '本期任务'])
self.write_keywords(keyword_class='BattlePassMissionTab', self.write_keywords(keyword_class='BattlePassMissionTab',
output_file='./tasks/battle_pass/keywords/mission_tab.py') output_file='./tasks/battle_pass/keywords/mission_tab.py')
# self.generate_assignments() self.generate_assignments()
self.generate_forgotten_hall_stages() self.generate_forgotten_hall_stages()
self.generate_daily_quests() self.generate_daily_quests()
self.generate_battle_pass_quests() self.generate_battle_pass_quests()

View File

@ -59,7 +59,7 @@ def get_assignment_entry_data():
for expedition_namehash, expedition_id in expedition_namehash_to_id.items(): for expedition_namehash, expedition_id in expedition_namehash_to_id.items():
reward_id = expedition_id_to_reward_id[expedition_id] reward_id = expedition_id_to_reward_id[expedition_id]
item_ids = reward_id_to_item_ids[reward_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: if len(item_names) == 1:
item = GenerateKeyword.find_keyword(item_names[0], lang='cn')[1] item = GenerateKeyword.find_keyword(item_names[0], lang='cn')[1]
if item in item_name_remap: if item in item_name_remap:
@ -128,6 +128,7 @@ class GenerateAssignmentEventGroup(GenerateKeyword):
def iter_keywords(self) -> Iterable[dict]: 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]) yield dict(text_id=self.find_keyword('关于波提欧的一切…', lang='cn')[0])
yield dict(text_id=self.find_keyword('游侠谜影', lang='cn')[0])
class GenerateAssignmentEventEntry(GenerateKeyword): class GenerateAssignmentEventEntry(GenerateKeyword):
@ -141,5 +142,5 @@ class GenerateAssignmentEventEntry(GenerateKeyword):
if __name__ == "__main__": if __name__ == "__main__":
from dev_tools.keywords.base import TextMap from dev_tools.keywords.base import TextMap
TextMap.DATA_FOLDER = '../StarRailData' TextMap.DATA_FOLDER = '../DanhengServer-Resources'
GenerateAssignment()() GenerateAssignment()()

View File

@ -68,6 +68,7 @@ def text_to_variable(text):
text = re.sub(r'[(),#"?!&%*]|</?\w+>', '', text) text = re.sub(r'[(),#"?!&%*]|</?\w+>', '', text)
# text = re.sub(r'[#_]?\d+(_times?)?', '', text) # text = re.sub(r'[#_]?\d+(_times?)?', '', text)
text = re.sub(r'<color=#?\w+>', '', text) text = re.sub(r'<color=#?\w+>', '', text)
text = re.sub(r'^\d+', '', text)
text = text.replace('é', 'e') text = text.replace('é', 'e')
return text.strip('_') return text.strip('_')