Zebartin 2023-06-21 22:08:57 +08:00
parent 0e4ce13b9e
commit 47578306cb
6 changed files with 13 additions and 21 deletions

View File

@ -223,11 +223,11 @@
"Assignment": { "Assignment": {
"_info": { "_info": {
"name": "Assignment Settings", "name": "Assignment Settings",
"help": "" "help": "Claim rewards and dispatch, handling specified assignments first\nIf the assignment limit is not reached after that, others will be dispatched according to preset priority (EXP Materials/Credits → Character Materials → Synthesis Materials)"
}, },
"Filter": { "Filter": {
"name": "Assignment Priority", "name": "Assignment Priority",
"help": "Example: Nameless Land Nameless People > Akashic Records > The Invisible Hand > Root Out the Turpitude" "help": "Make sure there are no typos\nExample: Nameless Land Nameless People > Akashic Records > The Invisible Hand > Root Out the Turpitude"
}, },
"Duration": { "Duration": {
"name": "Assignment Duration", "name": "Assignment Duration",

View File

@ -223,7 +223,7 @@
"Assignment": { "Assignment": {
"_info": { "_info": {
"name": "委托设置", "name": "委托设置",
"help": "" "help": "领取奖励并派遣,优先处理指定委托\n若处理指定委托之后未达到上限则按经验材料 → 角色专属素材 → 合成材料的顺序来派遣委托"
}, },
"Filter": { "Filter": {
"name": "委托优先级", "name": "委托优先级",

View File

@ -223,7 +223,7 @@
"Assignment": { "Assignment": {
"_info": { "_info": {
"name": "委託設置", "name": "委託設置",
"help": "" "help": "領取獎勵並派遣,優先處理指定委託\n若處理指定委託之後未達到上限則按經驗材料 → 角色專屬素材 → 合成材料的順序來派遣委託"
}, },
"Filter": { "Filter": {
"name": "委託優先級", "name": "委託優先級",

View File

@ -263,22 +263,11 @@ class DigitCounter(Ocr):
class Duration(Ocr): class Duration(Ocr):
@cached_property @cached_property
def timedelta_regex(self): def timedelta_regex(self):
hour_regex = { regex_str = {
'ch': '小时', 'ch': r'\D*((?P<hours>\d{1,2})小时)?((?P<minutes>\d{1,2})分钟)?((?P<seconds>\d{1,2})秒})?',
'en': 'h\s*' 'en': r'\D*((?P<hours>\d{1,2})h\s*)?((?P<minutes>\d{1,2})m\s*)?((?P<seconds>\d{1,2})s)?'
}[self.lang] }[self.lang]
minute_regex = { return re.compile(regex_str)
'ch': '分钟',
'en': 'm\s*'
}[self.lang]
second_regex = {
'ch': '',
'en': 's'
}[self.lang]
ret = rf'\D*((?P<hours>\d{{1,2}}){hour_regex})?'
ret += rf'((?P<minutes>\d{{1,2}}){minute_regex})?'
ret += rf'((?P<seconds>\d{{1,2}}){second_regex})?'
return re.compile(ret)
def format_result(self, result: str) -> timedelta: def format_result(self, result: str) -> timedelta:
""" """

View File

@ -28,7 +28,7 @@ class DraggableList:
keyword_class, keyword_class,
ocr_class, ocr_class,
search_button: ButtonWrapper, search_button: ButtonWrapper,
active_color: tuple[int, int, int] active_color: tuple[int, int, int] = (190, 175, 124)
): ):
""" """
Args: Args:

View File

@ -61,8 +61,11 @@ class AssignmentOcr(Ocr):
matched = self.ocr_regex.fullmatch(result) matched = self.ocr_regex.fullmatch(result)
if matched is None: if matched is None:
return result return result
keyword_lang = self.lang
if self.lang == 'ch':
keyword_lang = 'cn'
matched = getattr(KEYWORDS_ASSIGNMENT_ENTRY, matched.lastgroup) matched = getattr(KEYWORDS_ASSIGNMENT_ENTRY, matched.lastgroup)
matched = getattr(matched, self.lang) matched = getattr(matched, keyword_lang)
logger.attr(name=f'{self.name} after_process', logger.attr(name=f'{self.name} after_process',
text=f'{result} -> {matched}') text=f'{result} -> {matched}')
return matched return matched