mirror of
https://github.com/TheFunny/ArisuAutoSweeper
synced 2026-10-17 16:42:20 +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):
|
def is_task_enabled(self, task):
|
||||||
return bool(self.cross_get(keys=[task, 'Scheduler', 'Enable'], default=False))
|
return bool(self.cross_get(keys=[task, 'Scheduler', 'Enable'], default=False))
|
||||||
|
|
||||||
def update_daily_quests(self):
|
# def update_daily_quests(self):
|
||||||
"""
|
# """
|
||||||
Raises:
|
# Raises:
|
||||||
TaskEnd: Call task `DailyQuest` and stop current task
|
# TaskEnd: Call task `DailyQuest` and stop current task
|
||||||
"""
|
# """
|
||||||
if self.stored.DailyActivity.is_expired():
|
# with self.multi_set():
|
||||||
logger.info('DailyActivity expired, call task to update')
|
# if self.stored.DailyActivity.is_expired():
|
||||||
self.task_call('DailyQuest')
|
# logger.info('DailyActivity expired')
|
||||||
self.task_stop()
|
# self.stored.DailyActivity.clear()
|
||||||
if self.stored.DailyQuest.is_expired():
|
# if self.stored.DailyQuest.is_expired():
|
||||||
logger.info('DailyQuest expired, call task to update')
|
# logger.info('DailyQuest expired')
|
||||||
self.task_call('DailyQuest')
|
# self.stored.DailyQuest.clear()
|
||||||
self.task_stop()
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def DEVICE_SCREENSHOT_METHOD(self):
|
def DEVICE_SCREENSHOT_METHOD(self):
|
||||||
|
|||||||
@@ -134,6 +134,9 @@ class StoredExpiredAtMonday0400(StoredBase):
|
|||||||
class StoredInt(StoredBase):
|
class StoredInt(StoredBase):
|
||||||
value = 0
|
value = 0
|
||||||
|
|
||||||
|
def clear(self):
|
||||||
|
self.value = 0
|
||||||
|
|
||||||
|
|
||||||
class StoredCounter(StoredBase):
|
class StoredCounter(StoredBase):
|
||||||
value = 0
|
value = 0
|
||||||
@@ -148,6 +151,9 @@ class StoredCounter(StoredBase):
|
|||||||
self.value = value
|
self.value = value
|
||||||
self.total = total
|
self.total = total
|
||||||
|
|
||||||
|
def clear(self):
|
||||||
|
self.value = 0
|
||||||
|
|
||||||
def to_counter(self) -> str:
|
def to_counter(self) -> str:
|
||||||
return f'{self.value}/{self.total}'
|
return f'{self.value}/{self.total}'
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user