mirror of
https://github.com/TheFunny/ArisuAutoSweeper
synced 2026-10-10 13:32:26 +00:00
feat: add clear method to StoredInt and StoredCounter classes
This commit is contained in:
+12
-13
@@ -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):
|
||||
|
||||
@@ -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}'
|
||||
|
||||
|
||||
Reference in New Issue
Block a user