mirror of
https://github.com/LmeSzinc/StarRailCopilot.git
synced 2024-11-15 22:19:18 +00:00
Add: Link task Assignment with daily tasks
This commit is contained in:
parent
b303341297
commit
b5030e0ab1
@ -484,6 +484,20 @@ class AzurLaneConfig(ConfigUpdater, ManualConfig, GeneratedConfig, ConfigWatcher
|
||||
def is_task_enabled(self, task):
|
||||
return bool(self.cross_get(keys=[task, 'Scheduler', 'Enable'], default=False))
|
||||
|
||||
def update_daily_quests(self):
|
||||
"""
|
||||
Raises:
|
||||
TaskEnd: Call task `DailyQuest` and stop current task
|
||||
"""
|
||||
if self.stored.DailyActivity.is_expired():
|
||||
logger.info('Daily activity expired, call task to update')
|
||||
self.task_call('DailyQuest')
|
||||
self.task_stop()
|
||||
if self.stored.DailyQuest.is_expired():
|
||||
logger.info('Daily quests expired, call task to update')
|
||||
self.task_call('DailyQuest')
|
||||
self.task_stop()
|
||||
|
||||
@property
|
||||
def DEVICE_SCREENSHOT_METHOD(self):
|
||||
return self.Emulator_ScreenshotMethod
|
||||
|
@ -3,19 +3,27 @@ from datetime import datetime
|
||||
from module.logger import logger
|
||||
from module.ocr.ocr import Duration
|
||||
from tasks.assignment.assets.assets_assignment_claim import CLAIM
|
||||
from tasks.assignment.assets.assets_assignment_ui import (DISPATCHED,
|
||||
OCR_ASSIGNMENT_TIME)
|
||||
from tasks.assignment.assets.assets_assignment_ui import (
|
||||
DISPATCHED,
|
||||
OCR_ASSIGNMENT_TIME,
|
||||
)
|
||||
from tasks.assignment.claim import AssignmentClaim
|
||||
from tasks.assignment.keywords import *
|
||||
from tasks.assignment.keywords import (
|
||||
AssignmentEntry,
|
||||
KEYWORDS_ASSIGNMENT_GROUP,
|
||||
)
|
||||
from tasks.base.page import page_assignment, page_menu
|
||||
from tasks.daily.keywords import KEYWORDS_DAILY_QUEST
|
||||
from tasks.daily.synthesize import SynthesizeUI
|
||||
|
||||
|
||||
class Assignment(AssignmentClaim, SynthesizeUI):
|
||||
def run(self, assignments: list[AssignmentEntry] = None, duration: int = None):
|
||||
self.config.update_daily_quests()
|
||||
|
||||
if assignments is None:
|
||||
assignments = (
|
||||
getattr(self.config, f'Assignment_Name_{i+1}', None) for i in range(4))
|
||||
getattr(self.config, f'Assignment_Name_{i + 1}', None) for i in range(4))
|
||||
# remove duplicate while keeping order
|
||||
assignments = list(dict.fromkeys(
|
||||
x for x in assignments if x is not None))
|
||||
@ -46,7 +54,12 @@ class Assignment(AssignmentClaim, SynthesizeUI):
|
||||
# Scheduler
|
||||
delay = min(self.dispatched.values())
|
||||
logger.info(f'Delay assignment check to {str(delay)}')
|
||||
self.config.task_delay(target=delay)
|
||||
with self.config.multi_set():
|
||||
quests = self.config.stored.DailyQuest.load_quests()
|
||||
if KEYWORDS_DAILY_QUEST.Go_on_assignment_1_time in quests:
|
||||
logger.info('Achieved daily quest Go_on_assignment_1_time')
|
||||
self.config.task_call('DailyQuest')
|
||||
self.config.task_delay(target=delay)
|
||||
|
||||
def _check_inlist(self, assignments: list[AssignmentEntry], duration: int):
|
||||
"""
|
||||
|
@ -1,6 +1,6 @@
|
||||
import tasks.assignment.keywords.entry as KEYWORDS_ASSIGNMENT_ENTRY
|
||||
import tasks.assignment.keywords.group as KEYWORDS_ASSIGNMENT_GROUP
|
||||
from tasks.assignment.keywords.classes import AssignmentGroup, AssignmentEntry
|
||||
from tasks.assignment.keywords.classes import AssignmentEntry, AssignmentGroup
|
||||
|
||||
KEYWORDS_ASSIGNMENT_GROUP.Character_Materials.entries = (
|
||||
KEYWORDS_ASSIGNMENT_ENTRY.Nine_Billion_Names,
|
||||
@ -22,9 +22,9 @@ KEYWORDS_ASSIGNMENT_GROUP.Synthesis_Materials.entries = (
|
||||
KEYWORDS_ASSIGNMENT_ENTRY.The_Blossom_in_the_Storm,
|
||||
)
|
||||
for group in (
|
||||
KEYWORDS_ASSIGNMENT_GROUP.Character_Materials,
|
||||
KEYWORDS_ASSIGNMENT_GROUP.EXP_Materials_Credits,
|
||||
KEYWORDS_ASSIGNMENT_GROUP.Synthesis_Materials,
|
||||
KEYWORDS_ASSIGNMENT_GROUP.Character_Materials,
|
||||
KEYWORDS_ASSIGNMENT_GROUP.EXP_Materials_Credits,
|
||||
KEYWORDS_ASSIGNMENT_GROUP.Synthesis_Materials,
|
||||
):
|
||||
for entry in group.entries:
|
||||
entry.group = group
|
||||
entry.group = group
|
||||
|
@ -117,16 +117,7 @@ class Dungeon(DungeonUI, DungeonEvent, Combat):
|
||||
support_character=support_character)
|
||||
|
||||
def run(self):
|
||||
# Update daily quests
|
||||
if self.config.stored.DailyActivity.is_expired():
|
||||
logger.info('Daily activity expired, call task to update')
|
||||
self.config.task_call('DailyQuest')
|
||||
self.config.task_stop()
|
||||
if self.config.stored.DailyQuest.is_expired():
|
||||
logger.info('Daily quests expired, call task to update')
|
||||
self.config.task_call('DailyQuest')
|
||||
self.config.task_stop()
|
||||
|
||||
self.config.update_daily_quests()
|
||||
self.called_daily_support = False
|
||||
self.achieved_daily_quest = False
|
||||
self.daily_quests = self.config.stored.DailyQuest.load_quests()
|
||||
|
Loading…
Reference in New Issue
Block a user