diff --git a/campaign/event_20250814_cn/sp.py b/campaign/event_20250814_cn/sp.py index 85f3daa74..c5fe53458 100644 --- a/campaign/event_20250814_cn/sp.py +++ b/campaign/event_20250814_cn/sp.py @@ -65,7 +65,9 @@ class Config: STAR_REQUIRE_2 = 0 STAR_REQUIRE_3 = 0 # ===== End of generated config ===== - + MAP_CHAPTER_SWITCH_20241219 = True + # MAP_HAS_MODE_SWITCH = True + STAGE_ENTRANCE = ['half', '20240725'] class Campaign(CampaignBase): MAP = MAP diff --git a/module/campaign/campaign_base.py b/module/campaign/campaign_base.py index 15ebf4783..2cb808b02 100644 --- a/module/campaign/campaign_base.py +++ b/module/campaign/campaign_base.py @@ -1,7 +1,7 @@ from module.base.decorator import Config, cached_property from module.campaign.campaign_ui import CampaignUI from module.combat.auto_search_combat import AutoSearchCombat -from module.exception import CampaignEnd, MapEnemyMoved, ScriptError +from module.exception import CampaignEnd, MapEnemyMoved, ScriptError, SpLimitError from module.logger import logger from module.map.map import Map from module.map.map_base import CampaignMap @@ -122,7 +122,11 @@ class CampaignBase(CampaignUI, Map, AutoSearchCombat): # Enter map self.emotion.check_reduce(self._map_battle) self.ENTRANCE.area = self.ENTRANCE.button - self.enter_map(self.ENTRANCE, mode=self.config.Campaign_Mode) + try: + self.enter_map(self.ENTRANCE, mode=self.config.Campaign_Mode) + except SpLimitError: + logger.warning('Sp limit error') + return True # Map init if not self.map_is_auto_search: diff --git a/module/exception.py b/module/exception.py index c2e7248ba..1d5726cc3 100644 --- a/module/exception.py +++ b/module/exception.py @@ -62,4 +62,8 @@ class RequestHumanTakeover(Exception): # Alas is unable to handle such error, probably because of wrong settings. pass class OtherLogin(Exception): - pass \ No newline at end of file + pass + + +class SpLimitError(Exception): + ... \ No newline at end of file diff --git a/module/map/map_operation.py b/module/map/map_operation.py index 4a9de599a..20384ea5d 100644 --- a/module/map/map_operation.py +++ b/module/map/map_operation.py @@ -1,5 +1,5 @@ from module.base.timer import Timer -from module.exception import CampaignEnd, RequestHumanTakeover, ScriptEnd +from module.exception import CampaignEnd, RequestHumanTakeover, ScriptEnd, SpLimitError from module.handler.fast_forward import FastForwardHandler from module.handler.mystery import MysteryHandler from module.logger import logger @@ -132,13 +132,21 @@ class MapOperation(MysteryHandler, FleetPreparation, Retirement, FastForwardHand logger.critical(f"Failed to enter {button}, too many click on {button}") logger.critical("Possible reason #1: You haven't reached the commander level to unlock this stage.") raise RequestHumanTakeover - if fleet_click > 5: + if fleet_click > 4: logger.critical(f"Failed to enter {button}, too many click on FLEET_PREPARATION") logger.critical("Possible reason #1: " "Your fleets haven't satisfied the stat restrictions of this stage.") logger.critical("Possible reason #2: " "This stage can only be farmed once a day, " "but it's the second time that you are entering") + if button == 'sp': + from module.ocr.ocr import Ocr + self.device.sleep(0.5) + self.device.screenshot() + SP_LIMIT_TIP=Button(area=(464, 307, 815, 337), color=(), button=(464, 307, 815, 337)) + result = Ocr(SP_LIMIT_TIP, lang= 'cnocr').ocr(self.device.image) + if "关卡每日" in result or "挑战次数" in result: + raise SpLimitError raise RequestHumanTakeover # Already in map @@ -406,3 +414,4 @@ class MapOperation(MysteryHandler, FleetPreparation, Retirement, FastForwardHand return False return self.fleet_set(index=2) +