From 1736d3e6fcfa8d7b59d36eadc9ef4f4eacddceb1 Mon Sep 17 00:00:00 2001 From: LmeSzinc <37934724+LmeSzinc@users.noreply.github.com> Date: Fri, 10 Mar 2023 23:30:28 +0800 Subject: [PATCH] Opt: Raise error if user is using EventABCD before stages unlocked --- module/event/campaign_abcd.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/module/event/campaign_abcd.py b/module/event/campaign_abcd.py index a8a0a5135..a01cdfb1c 100644 --- a/module/event/campaign_abcd.py +++ b/module/event/campaign_abcd.py @@ -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