mirror of
https://gitee.com/sui-feng-cb/AzurLaneAutoScript1
synced 2026-05-13 07:40:19 +08:00
Upd: exception OilMaxed to control buy food trial
This commit is contained in:
@@ -12,7 +12,7 @@ from module.commission.project import COMMISSION_FILTER, Commission
|
||||
from module.config.config_generated import GeneratedConfig
|
||||
from module.config.utils import get_server_last_update, get_server_next_update
|
||||
from module.dorm.dorm import RewardDorm
|
||||
from module.exception import GameStuckError
|
||||
from module.exception import GameStuckError, OilMaxed, RequestHumanTakeover
|
||||
from module.handler.info_handler import InfoHandler
|
||||
from module.logger import logger
|
||||
from module.map.map_grids import SelectedGrids
|
||||
@@ -493,7 +493,7 @@ class RewardCommission(UI, InfoHandler):
|
||||
if not self.daily_choose and not self.urgent_choose:
|
||||
logger.info('No commission chose')
|
||||
|
||||
def commission_receive(self, skip_first_screenshot=True):
|
||||
def _commission_receive(self, skip_first_screenshot=True):
|
||||
"""
|
||||
Args:
|
||||
skip_first_screenshot:
|
||||
@@ -559,13 +559,9 @@ class RewardCommission(UI, InfoHandler):
|
||||
# click_timer.reset()
|
||||
continue
|
||||
# handle oil maxed
|
||||
# run once to prevent accidental oil consumption
|
||||
if self.config.SERVER in ['cn']:
|
||||
if self.appear(OIL_MAXED, offset=(20, 20), interval=3):
|
||||
logger.info("Oil maxed, buy food to consume oil")
|
||||
RewardDorm(self.config, self.device).dorm_food_run(amount=10)
|
||||
self.ui_ensure(page_reward)
|
||||
continue
|
||||
raise OilMaxed
|
||||
# Check GET_SHIP at last to handle random white background at page_main
|
||||
for button in [GET_SHIP]:
|
||||
if click_timer.reached() and self.appear(button, interval=1):
|
||||
@@ -583,6 +579,27 @@ class RewardCommission(UI, InfoHandler):
|
||||
|
||||
return reward
|
||||
|
||||
def commission_receive(self):
|
||||
"""
|
||||
Returns:
|
||||
bool: If rewarded.
|
||||
|
||||
Pages:
|
||||
in: page_reward
|
||||
out: page_commission
|
||||
"""
|
||||
for _ in range(3):
|
||||
try:
|
||||
reward = self._commission_receive()
|
||||
return reward
|
||||
except OilMaxed:
|
||||
logger.info("Oil maxed, buy food to consume oil")
|
||||
RewardDorm(self.config, self.device).dorm_food_run(amount=10)
|
||||
self.ui_ensure(page_reward)
|
||||
|
||||
logger.critical(f'Failed to handle oil maxed after 3 trial')
|
||||
raise RequestHumanTakeover
|
||||
|
||||
def run(self):
|
||||
"""
|
||||
Pages:
|
||||
|
||||
Reference in New Issue
Block a user