diff --git a/assets/cn/campaign/CHAPTER_20241024_AB.png b/assets/cn/campaign/CHAPTER_20241024_AB.png new file mode 100644 index 000000000..eb4c62b01 Binary files /dev/null and b/assets/cn/campaign/CHAPTER_20241024_AB.png differ diff --git a/assets/cn/campaign/CHAPTER_20241024_CD.png b/assets/cn/campaign/CHAPTER_20241024_CD.png new file mode 100644 index 000000000..3ac599b69 Binary files /dev/null and b/assets/cn/campaign/CHAPTER_20241024_CD.png differ diff --git a/assets/cn/campaign/CHAPTER_20241024_EX.png b/assets/cn/campaign/CHAPTER_20241024_EX.png new file mode 100644 index 000000000..ff5bac781 Binary files /dev/null and b/assets/cn/campaign/CHAPTER_20241024_EX.png differ diff --git a/assets/cn/campaign/CHAPTER_20241024_SP.png b/assets/cn/campaign/CHAPTER_20241024_SP.png new file mode 100644 index 000000000..fe0f3f605 Binary files /dev/null and b/assets/cn/campaign/CHAPTER_20241024_SP.png differ diff --git a/campaign/event_20241024_cn/campaign_base.py b/campaign/event_20241024_cn/campaign_base.py index 16375c9f1..64641849e 100644 --- a/campaign/event_20241024_cn/campaign_base.py +++ b/campaign/event_20241024_cn/campaign_base.py @@ -1,13 +1,20 @@ from module.base.utils import color_similarity_2d -from module.campaign.assets import SWITCH_20240725_COMBAT, SWITCH_20240725_STORY +from module.campaign.assets import * from module.campaign.campaign_base import CampaignBase as CampaignBase_ from module.campaign.campaign_ui import ModeSwitch +from module.logger import logger from module.map_detection.grid import Grid from module.template.assets import TEMPLATE_ENEMY_BOSS -MODE_SWITCH_20240912 = ModeSwitch('Mode_switch_20240912', is_selector=True, offset=(30, 30)) -MODE_SWITCH_20240912.add_status('combat', SWITCH_20240725_COMBAT, offset=(444, 4)) -MODE_SWITCH_20240912.add_status('story', SWITCH_20240725_STORY, offset=(444, 4)) +MODE_SWITCH_20240725 = ModeSwitch('Mode_switch_20240725', is_selector=True, offset=(30, 30)) +MODE_SWITCH_20240725.add_status('combat', SWITCH_20240725_COMBAT, offset=(444, 4)) +MODE_SWITCH_20240725.add_status('story', SWITCH_20240725_STORY, offset=(444, 4)) + +CHAPTER_SWITCH_20241024 = ModeSwitch('Chapter_switch_20241024', is_selector=True, offset=(30, 30)) +CHAPTER_SWITCH_20241024.add_status('ab', CHAPTER_20241024_AB) +CHAPTER_SWITCH_20241024.add_status('cd', CHAPTER_20241024_CD) +CHAPTER_SWITCH_20241024.add_status('sp', CHAPTER_20241024_SP) +CHAPTER_SWITCH_20241024.add_status('ex', CHAPTER_20241024_EX) class EventGrid(Grid): @@ -35,17 +42,35 @@ class CampaignBase(CampaignBase_): T1 > T2 > T3 > T4 > T5 > T6 """ ] - def campaign_ensure_mode(self, mode='normal'): + + def campaign_set_chapter(self, name, mode='normal'): """ Args: - mode (str): 'normal', 'hard', 'ex', 'story' - - Returns: - bool: If mode changed. + name (str): Campaign name, such as '7-2', 'd3', 'sp3'. + mode (str): 'normal' or 'hard'. """ - if mode == "story": - MODE_SWITCH_20240912.set('story', main=self) - elif mode in ['normal', 'hard', 'ex']: - # First switch to combat mode and then select Hard or Normal. - MODE_SWITCH_20240912.set('combat', main=self) - # super().campaign_ensure_mode(mode) + chapter, stage = self._campaign_separate_name(name) + logger.info([chapter, stage]) + + if chapter in ['t']: + self.ui_goto_event() + MODE_SWITCH_20240725.set('combat', main=self) + if stage in ['1', '2', '3']: + CHAPTER_SWITCH_20241024.set('ab', main=self) + elif stage in ['4', '5', '6']: + CHAPTER_SWITCH_20241024.set('cd', main=self) + else: + logger.warning(f'Stage {name} is not in CHAPTER_SWITCH_20241024') + self.campaign_ensure_chapter(index=chapter) + elif chapter in ['ex_sp']: + self.ui_goto_event() + MODE_SWITCH_20240725.set('combat', main=self) + CHAPTER_SWITCH_20241024.set('sp', main=self) + self.campaign_ensure_chapter(index=chapter) + elif chapter in ['ex_ex']: + self.ui_goto_event() + MODE_SWITCH_20240725.set('combat', main=self) + CHAPTER_SWITCH_20241024.set('ex', main=self) + self.campaign_ensure_chapter(index=chapter) + else: + logger.warning(f'Unknown campaign chapter: {name}') diff --git a/module/campaign/assets.py b/module/campaign/assets.py index abcf85423..83f4da2fe 100644 --- a/module/campaign/assets.py +++ b/module/campaign/assets.py @@ -4,6 +4,10 @@ from module.base.template import Template # This file was automatically generated by dev_tools/button_extract.py. # Don't modify it manually. +CHAPTER_20241024_AB = Button(area={'cn': (17, 226, 34, 241), 'en': (17, 226, 34, 241), 'jp': (17, 226, 34, 241), 'tw': (17, 226, 34, 241)}, color={'cn': (162, 169, 196), 'en': (162, 169, 196), 'jp': (162, 169, 196), 'tw': (162, 169, 196)}, button={'cn': (17, 226, 34, 241), 'en': (17, 226, 34, 241), 'jp': (17, 226, 34, 241), 'tw': (17, 226, 34, 241)}, file={'cn': './assets/cn/campaign/CHAPTER_20241024_AB.png', 'en': './assets/cn/campaign/CHAPTER_20241024_AB.png', 'jp': './assets/cn/campaign/CHAPTER_20241024_AB.png', 'tw': './assets/cn/campaign/CHAPTER_20241024_AB.png'}) +CHAPTER_20241024_CD = Button(area={'cn': (17, 299, 34, 314), 'en': (17, 299, 34, 314), 'jp': (17, 299, 34, 314), 'tw': (17, 299, 34, 314)}, color={'cn': (168, 176, 204), 'en': (168, 176, 204), 'jp': (168, 176, 204), 'tw': (168, 176, 204)}, button={'cn': (17, 299, 34, 314), 'en': (17, 299, 34, 314), 'jp': (17, 299, 34, 314), 'tw': (17, 299, 34, 314)}, file={'cn': './assets/cn/campaign/CHAPTER_20241024_CD.png', 'en': './assets/cn/campaign/CHAPTER_20241024_CD.png', 'jp': './assets/cn/campaign/CHAPTER_20241024_CD.png', 'tw': './assets/cn/campaign/CHAPTER_20241024_CD.png'}) +CHAPTER_20241024_EX = Button(area={'cn': (17, 446, 34, 461), 'en': (17, 446, 34, 461), 'jp': (17, 446, 34, 461), 'tw': (17, 446, 34, 461)}, color={'cn': (169, 178, 207), 'en': (169, 178, 207), 'jp': (169, 178, 207), 'tw': (169, 178, 207)}, button={'cn': (17, 446, 34, 461), 'en': (17, 446, 34, 461), 'jp': (17, 446, 34, 461), 'tw': (17, 446, 34, 461)}, file={'cn': './assets/cn/campaign/CHAPTER_20241024_EX.png', 'en': './assets/cn/campaign/CHAPTER_20241024_EX.png', 'jp': './assets/cn/campaign/CHAPTER_20241024_EX.png', 'tw': './assets/cn/campaign/CHAPTER_20241024_EX.png'}) +CHAPTER_20241024_SP = Button(area={'cn': (17, 372, 34, 388), 'en': (17, 372, 34, 388), 'jp': (17, 372, 34, 388), 'tw': (17, 372, 34, 388)}, color={'cn': (163, 172, 201), 'en': (163, 172, 201), 'jp': (163, 172, 201), 'tw': (163, 172, 201)}, button={'cn': (17, 372, 34, 388), 'en': (17, 372, 34, 388), 'jp': (17, 372, 34, 388), 'tw': (17, 372, 34, 388)}, file={'cn': './assets/cn/campaign/CHAPTER_20241024_SP.png', 'en': './assets/cn/campaign/CHAPTER_20241024_SP.png', 'jp': './assets/cn/campaign/CHAPTER_20241024_SP.png', 'tw': './assets/cn/campaign/CHAPTER_20241024_SP.png'}) CHAPTER_NEXT = Button(area={'cn': (1216, 362, 1232, 388), 'en': (1216, 362, 1232, 388), 'jp': (1216, 362, 1232, 388), 'tw': (1216, 362, 1232, 388)}, color={'cn': (121, 150, 198), 'en': (121, 150, 198), 'jp': (121, 150, 198), 'tw': (121, 150, 198)}, button={'cn': (1216, 362, 1232, 388), 'en': (1216, 362, 1232, 388), 'jp': (1216, 362, 1232, 388), 'tw': (1216, 362, 1232, 388)}, file={'cn': './assets/cn/campaign/CHAPTER_NEXT.png', 'en': './assets/en/campaign/CHAPTER_NEXT.png', 'jp': './assets/jp/campaign/CHAPTER_NEXT.png', 'tw': './assets/tw/campaign/CHAPTER_NEXT.png'}) CHAPTER_PREV = Button(area={'cn': (42, 360, 58, 387), 'en': (42, 360, 58, 387), 'jp': (42, 360, 58, 387), 'tw': (42, 360, 58, 387)}, color={'cn': (105, 133, 169), 'en': (105, 133, 169), 'jp': (105, 133, 169), 'tw': (105, 133, 169)}, button={'cn': (42, 360, 58, 387), 'en': (42, 360, 58, 387), 'jp': (42, 360, 58, 387), 'tw': (42, 360, 58, 387)}, file={'cn': './assets/cn/campaign/CHAPTER_PREV.png', 'en': './assets/en/campaign/CHAPTER_PREV.png', 'jp': './assets/jp/campaign/CHAPTER_PREV.png', 'tw': './assets/tw/campaign/CHAPTER_PREV.png'}) COMMISSION_NOTICE_AT_CAMPAIGN = Button(area={'cn': (1077, 637, 1083, 643), 'en': (1077, 637, 1083, 643), 'jp': (1077, 637, 1083, 643), 'tw': (1077, 637, 1083, 643)}, color={'cn': (172, 72, 49), 'en': (172, 72, 49), 'jp': (172, 72, 49), 'tw': (172, 72, 49)}, button={'cn': (1077, 637, 1083, 643), 'en': (1077, 637, 1083, 643), 'jp': (1077, 637, 1083, 643), 'tw': (1077, 637, 1083, 643)}, file={'cn': './assets/cn/campaign/COMMISSION_NOTICE_AT_CAMPAIGN.png', 'en': './assets/en/campaign/COMMISSION_NOTICE_AT_CAMPAIGN.png', 'jp': './assets/jp/campaign/COMMISSION_NOTICE_AT_CAMPAIGN.png', 'tw': './assets/tw/campaign/COMMISSION_NOTICE_AT_CAMPAIGN.png'})