mirror of
https://github.com/LmeSzinc/AzurLaneAutoScript.git
synced 2025-01-08 12:07:36 +08:00
fix: merge func TryRestart into HandleError
This commit is contained in:
parent
d82a3742bb
commit
2faaa2b2ad
22
alas.py
22
alas.py
@ -70,21 +70,16 @@ class AzurLaneAutoScript:
|
||||
except ScriptError as e:
|
||||
logger.critical(e)
|
||||
logger.critical('This is likely to be a mistake of developers, but sometimes just random issues')
|
||||
if self.config.Error_TryRestart:
|
||||
self.config.Scheduler_Enable = False
|
||||
self.config.task_call('Restart')
|
||||
self.device.sleep(10)
|
||||
return False
|
||||
else:
|
||||
exit(1)
|
||||
exit(1)
|
||||
except RequestHumanTakeover:
|
||||
logger.critical('Request human takeover')
|
||||
exit(1)
|
||||
except Exception as e:
|
||||
logger.exception(e)
|
||||
self.save_error_log()
|
||||
if self.config.Error_TryRestart:
|
||||
if self.config.Error_HandleError:
|
||||
self.config.Scheduler_Enable = False
|
||||
logger.warning(f'Try restarting, {self.config.Emulator_PackageName} will be restarted in 10 seconds')
|
||||
self.config.task_call('Restart')
|
||||
self.device.sleep(10)
|
||||
return False
|
||||
@ -366,8 +361,15 @@ class AzurLaneAutoScript:
|
||||
"Please read the help text of the options.")
|
||||
logger.critical("Possible reason: There is a problem with this task. "
|
||||
"Please contact developers or try to fix it yourself.")
|
||||
logger.critical('Request human takeover')
|
||||
exit(1)
|
||||
if self.config.Error_HandleError:
|
||||
self.config.Scheduler_Enable = False
|
||||
logger.warning(f'Try restarting, {self.config.Emulator_PackageName} will be restarted in 10 seconds')
|
||||
self.config.task_call('Restart')
|
||||
self.device.sleep(10)
|
||||
return False
|
||||
else:
|
||||
logger.critical('Request human takeover')
|
||||
exit(1)
|
||||
|
||||
if success:
|
||||
del self.__dict__['config']
|
||||
|
@ -10,8 +10,7 @@
|
||||
"Error": {
|
||||
"HandleError": true,
|
||||
"SaveError": true,
|
||||
"ScreenshotLength": 1,
|
||||
"TryRestart": false
|
||||
"ScreenshotLength": 1
|
||||
},
|
||||
"Optimization": {
|
||||
"CombatScreenshotInterval": 1.0,
|
||||
|
@ -50,10 +50,6 @@
|
||||
"ScreenshotLength": {
|
||||
"type": "input",
|
||||
"value": 1
|
||||
},
|
||||
"TryRestart": {
|
||||
"type": "checkbox",
|
||||
"value": false
|
||||
}
|
||||
},
|
||||
"Optimization": {
|
||||
|
@ -29,7 +29,6 @@ Error:
|
||||
HandleError: true
|
||||
SaveError: true
|
||||
ScreenshotLength: 1
|
||||
TryRestart: false
|
||||
Optimization:
|
||||
CombatScreenshotInterval: 1.0
|
||||
TaskHoardingDuration: 0
|
||||
|
@ -28,7 +28,6 @@ class GeneratedConfig:
|
||||
Error_HandleError = True
|
||||
Error_SaveError = True
|
||||
Error_ScreenshotLength = 1
|
||||
Error_TryRestart = False
|
||||
|
||||
# Group `Optimization`
|
||||
Optimization_CombatScreenshotInterval = 1.0
|
||||
|
@ -296,7 +296,7 @@
|
||||
},
|
||||
"HandleError": {
|
||||
"name": "Enable Exception Handling",
|
||||
"help": "Handles select exceptions, will retreat if in battle"
|
||||
"help": "Handles select exceptions, will retreat if in battle\nIn some tasks, will disable the error task and try restarting"
|
||||
},
|
||||
"SaveError": {
|
||||
"name": "Record Exception",
|
||||
@ -305,10 +305,6 @@
|
||||
"ScreenshotLength": {
|
||||
"name": "Record Screenshot(s)",
|
||||
"help": "Number of screenshots saved when exception occurs"
|
||||
},
|
||||
"TryRestart": {
|
||||
"name": "Try Restart",
|
||||
"help": "Handle some exceptions,will disable the error task and try restarting"
|
||||
}
|
||||
},
|
||||
"Optimization": {
|
||||
|
@ -296,7 +296,7 @@
|
||||
},
|
||||
"HandleError": {
|
||||
"name": "启用异常处理",
|
||||
"help": "处理部分异常,运行出错时撤退"
|
||||
"help": "处理部分异常,运行出错时撤退\n部分任务中,会将出错的任务移出列表,并重启游戏"
|
||||
},
|
||||
"SaveError": {
|
||||
"name": "出错时,保存 Log 和截图",
|
||||
@ -305,10 +305,6 @@
|
||||
"ScreenshotLength": {
|
||||
"name": "出错时,保留最后 X 张截图",
|
||||
"help": ""
|
||||
},
|
||||
"TryRestart": {
|
||||
"name": "出错时,尝试重启(未完成)",
|
||||
"help": "处理部分异常,将出错的任务移出列表,并重启游戏"
|
||||
}
|
||||
},
|
||||
"Optimization": {
|
||||
|
@ -296,7 +296,7 @@
|
||||
},
|
||||
"HandleError": {
|
||||
"name": "啟用異常處理",
|
||||
"help": "處理部分異常,執行出錯時撤退"
|
||||
"help": "處理部分異常,執行出錯時撤退\n部分任務中,會將出錯的任務移出列表,並重啟遊戲"
|
||||
},
|
||||
"SaveError": {
|
||||
"name": "出錯時,保存 Log 和截圖",
|
||||
@ -305,10 +305,6 @@
|
||||
"ScreenshotLength": {
|
||||
"name": "出錯時,保留最後 X 張截圖",
|
||||
"help": ""
|
||||
},
|
||||
"TryRestart": {
|
||||
"name": "出錯時,嘗試重啟(未完成)",
|
||||
"help": "處理部分異常,將出錯的任務移出列表,並重啟遊戲"
|
||||
}
|
||||
},
|
||||
"Optimization": {
|
||||
|
Loading…
Reference in New Issue
Block a user