Opt: Raise error if user is using EventABCD before stages unlocked

This commit is contained in:
LmeSzinc 2023-03-10 23:30:28 +08:00
parent cb1d4f24d3
commit 1736d3e6fc

View File

@ -3,6 +3,7 @@ import os
from module.config.config import TaskEnd
from module.config.utils import get_server_last_update
from module.event.base import STAGE_FILTER, EventBase, EventStage
from module.exception import ScriptEnd, RequestHumanTakeover
from module.logger import logger
@ -45,6 +46,18 @@ class CampaignABCD(EventBase):
except TaskEnd:
# Catch task switch
pass
except ScriptEnd as e:
# Raise from CampaignUI.ensure_campaign_ui()
if str(e) == 'Campaign name error':
task = self.config.task.command
logger.critical(
f'Cannot find stage "{stage}". '
f'Task "{task}" is for 3X daily PT, if you have not unlock {stage}, '
f'you should use task "Event" to unlock it instead of using task "{task}"')
raise RequestHumanTakeover
else:
raise
if self.run_count > 0:
with self.config.multi_set():
self.config.EventDaily_LastStage = stage