Fix: ensure not at war archives campaign in ui_goto_event (#4237)

This commit is contained in:
Air111 2024-09-29 12:09:42 +08:00 committed by GitHub
parent fc555128a2
commit 3ad070d6f1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 22 additions and 17 deletions

View File

@ -7,6 +7,7 @@ from module.config.utils import DEFAULT_TIME
from module.logger import logger
from module.ui.assets import CAMPAIGN_MENU_NO_EVENT
from module.ui.page import page_event, page_campaign_menu, page_sp, page_coalition
from module.war_archives.assets import WAR_ARCHIVES_CAMPAIGN_CHECK
class CampaignEvent(CampaignStatus):
@ -137,26 +138,32 @@ class CampaignEvent(CampaignStatus):
def ui_goto_event(self):
# Already in page_event, skip event_check.
if self.ui_get_current_page() == page_event:
logger.info('Already at page_event')
return True
else:
self.ui_goto(page_campaign_menu)
# Check event availability
if self.is_event_entrance_available():
self.ui_goto(page_event)
if self.appear(WAR_ARCHIVES_CAMPAIGN_CHECK, offset=(20, 20)):
logger.info('At war archives')
self.ui_goto_main()
else:
logger.info('Already at page_event')
return True
self.ui_goto(page_campaign_menu)
# Check event availability
if self.is_event_entrance_available():
self.ui_goto(page_event)
return True
def ui_goto_sp(self):
# Already in page_event, skip event_check.
if self.ui_get_current_page() == page_sp:
logger.info('Already at page_sp')
return True
else:
self.ui_goto(page_campaign_menu)
# Check event availability
if self.is_event_entrance_available():
self.ui_goto(page_sp)
if self.appear(WAR_ARCHIVES_CAMPAIGN_CHECK, offset=(20, 20)):
logger.info('At war archives')
self.ui_goto_main()
else:
logger.info('Already at page_sp')
return True
self.ui_goto(page_campaign_menu)
# Check event availability
if self.is_event_entrance_available():
self.ui_goto(page_sp)
return True
def ui_goto_coalition(self):
# Already in page_event, skip event_check.

View File

@ -31,7 +31,5 @@ class CampaignWarArchives(CampaignRun, CampaignBase):
return False
def run(self, name=None, folder='campaign_main', mode='normal', total=0):
backup = self.config.temporary(USE_DATA_KEY=True)
self.config.override(USE_DATA_KEY=True)
super().run(name, folder, mode, total)
backup.recover()
self.ui_goto_main() # Go to main, as remaining in page can throw off Event task