feat: add clear method to StoredInt and StoredCounter classes

This commit is contained in:
2026-07-06 22:40:31 +08:00
parent b029d9f732
commit be70c88036
2 changed files with 18 additions and 13 deletions
+12 -13
View File
@@ -497,19 +497,18 @@ 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('DailyActivity expired, call task to update')
self.task_call('DailyQuest')
self.task_stop()
if self.stored.DailyQuest.is_expired():
logger.info('DailyQuest expired, call task to update')
self.task_call('DailyQuest')
self.task_stop()
# def update_daily_quests(self):
# """
# Raises:
# TaskEnd: Call task `DailyQuest` and stop current task
# """
# with self.multi_set():
# if self.stored.DailyActivity.is_expired():
# logger.info('DailyActivity expired')
# self.stored.DailyActivity.clear()
# if self.stored.DailyQuest.is_expired():
# logger.info('DailyQuest expired')
# self.stored.DailyQuest.clear()
@property
def DEVICE_SCREENSHOT_METHOD(self):
+6
View File
@@ -134,6 +134,9 @@ class StoredExpiredAtMonday0400(StoredBase):
class StoredInt(StoredBase):
value = 0
def clear(self):
self.value = 0
class StoredCounter(StoredBase):
value = 0
@@ -148,6 +151,9 @@ class StoredCounter(StoredBase):
self.value = value
self.total = total
def clear(self):
self.value = 0
def to_counter(self) -> str:
return f'{self.value}/{self.total}'