Opt: Improves event filter and stage load

This commit is contained in:
bookbug666 2022-07-28 01:04:42 +08:00
parent 1a16e31138
commit 6c1e3d3aba
2 changed files with 10 additions and 10 deletions

View File

@ -227,19 +227,19 @@ class AzurLaneAutoScript:
def event_a(self):
from module.event.campaign_abcd import CampaignABCD
CampaignABCD(config=self.config, device=self.device).run(DailyEventABCD=self.config.EventA_StageFilter, LastStageABCD=self.config.EventA_LastStage)
CampaignABCD(config=self.config, device=self.device).run()
def event_b(self):
from module.event.campaign_abcd import CampaignABCD
CampaignABCD(config=self.config, device=self.device).run(DailyEventABCD=self.config.EventB_StageFilter, LastStageABCD=self.config.EventB_LastStage)
CampaignABCD(config=self.config, device=self.device).run()
def event_c(self):
from module.event.campaign_abcd import CampaignABCD
CampaignABCD(config=self.config, device=self.device).run(DailyEventABCD=self.config.EventC_StageFilter, LastStageABCD=self.config.EventC_LastStage)
CampaignABCD(config=self.config, device=self.device).run()
def event_d(self):
from module.event.campaign_abcd import CampaignABCD
CampaignABCD(config=self.config, device=self.device).run(DailyEventABCD=self.config.EventD_StageFilter, LastStageABCD=self.config.EventD_LastStage)
CampaignABCD(config=self.config, device=self.device).run()
def event_sp(self):
from module.event.campaign_sp import CampaignSP

View File

@ -12,8 +12,8 @@ class CampaignABCD(EventBase):
stages = [EventStage(file) for file in os.listdir(f'./campaign/{self.config.Campaign_Event}')]
stages = self.convert_stages(stages)
logger.attr('Stage', [str(stage) for stage in stages])
logger.attr('StageFilter', kwargs.get("DailyEventABCD"))
STAGE_FILTER.load(kwargs.get("DailyEventABCD"))
logger.attr('StageFilter', self.config.EventDaily_StageFilter)
STAGE_FILTER.load(self.config.EventDaily_StageFilter)
self.convert_stages(STAGE_FILTER)
stages = [str(stage) for stage in STAGE_FILTER.apply(stages)]
logger.attr('Filter sort', ' > '.join(stages))
@ -24,12 +24,12 @@ class CampaignABCD(EventBase):
self.config.task_stop()
# Start from last stage
logger.info(f'LastStage {kwargs["last_stage"]}, recorded at {self.config.Scheduler_NextRun}')
logger.info(f'LastStage {self.config.EventDaily_LastStage}, recorded at {self.config.Scheduler_NextRun}')
if get_server_last_update(self.config.Scheduler_ServerUpdate) >= self.config.Scheduler_NextRun:
logger.info('LastStage outdated, reset')
kwargs["last_stage"] = 0
self.config.EventDaily_LastStage = 0
else:
last = str(kwargs["last_stage"]).lower()
last = str(self.config.EventDaily_LastStage).lower()
last = self.convert_stages(last)
if last in stages:
stages = stages[stages.index(last) + 1:]
@ -47,7 +47,7 @@ class CampaignABCD(EventBase):
pass
if self.run_count > 0:
with self.config.multi_set():
kwargs["last_stage"] = stage
self.config.EventDaily_LastStage = stage
self.config.task_delay(minute=0)
else:
self.config.task_stop()