mirror of
https://gitee.com/sui-feng-cb/AzurLaneAutoScript1
synced 2026-04-11 05:15:39 +08:00
Opt: Treat too many state transitions as GameStuckError to catch logs
This commit is contained in:
@@ -2,13 +2,12 @@ from random import choice
|
|||||||
|
|
||||||
from module.base.timer import Timer
|
from module.base.timer import Timer
|
||||||
from module.combat.assets import GET_ITEMS_1
|
from module.combat.assets import GET_ITEMS_1
|
||||||
from module.exception import ScriptError
|
from module.exception import GameStuckError, ScriptError
|
||||||
from module.logger import logger
|
from module.logger import logger
|
||||||
from module.ocr.ocr import DigitCounter
|
from module.ocr.ocr import DigitCounter
|
||||||
from module.retire.assets import *
|
from module.retire.assets import *
|
||||||
from module.retire.dock import CARD_GRIDS, Dock
|
from module.retire.dock import CARD_GRIDS, Dock
|
||||||
|
|
||||||
|
|
||||||
VALID_SHIP_TYPES = ['dd', 'ss', 'cl', 'ca', 'bb', 'cv', 'repair', 'others']
|
VALID_SHIP_TYPES = ['dd', 'ss', 'cl', 'ca', 'bb', 'cv', 'repair', 'others']
|
||||||
OCR_DOCK_AMOUNT = DigitCounter(
|
OCR_DOCK_AMOUNT = DigitCounter(
|
||||||
DOCK_AMOUNT, letter=(255, 255, 255), threshold=192)
|
DOCK_AMOUNT, letter=(255, 255, 255), threshold=192)
|
||||||
@@ -225,7 +224,7 @@ class Enhancement(Dock):
|
|||||||
state_list.append(state)
|
state_list.append(state)
|
||||||
if len(state_list) > 30:
|
if len(state_list) > 30:
|
||||||
logger.critical(f'Too many state transitions: {state_list}')
|
logger.critical(f'Too many state transitions: {state_list}')
|
||||||
raise ScriptError('Too many state transitions')
|
raise GameStuckError('Too many state transitions')
|
||||||
|
|
||||||
try:
|
try:
|
||||||
state = locals()[state]()
|
state = locals()[state]()
|
||||||
|
|||||||
Reference in New Issue
Block a user