mirror of
https://github.com/TheFunny/ArisuAutoSweeper
synced 2025-12-16 19:55:12 +00:00
feat(bounty): add error handler choice
This commit is contained in:
parent
bbf3bf7c36
commit
2c19afdf26
@ -70,6 +70,9 @@
|
||||
"Command": "Bounty",
|
||||
"ServerUpdate": "04:00"
|
||||
},
|
||||
"Bounty": {
|
||||
"OnError": "skip"
|
||||
},
|
||||
"Highway": {
|
||||
"Stage": 1,
|
||||
"Count": 2
|
||||
|
||||
@ -283,6 +283,16 @@
|
||||
"display": "hide"
|
||||
}
|
||||
},
|
||||
"Bounty": {
|
||||
"OnError": {
|
||||
"type": "select",
|
||||
"value": "skip",
|
||||
"option": [
|
||||
"stop",
|
||||
"skip"
|
||||
]
|
||||
}
|
||||
},
|
||||
"Highway": {
|
||||
"Stage": {
|
||||
"type": "select",
|
||||
|
||||
@ -81,6 +81,11 @@ Cafe:
|
||||
AutoAdjust: true
|
||||
SecondCafe: true
|
||||
|
||||
Bounty:
|
||||
OnError:
|
||||
value: skip
|
||||
option: [ stop, skip ]
|
||||
|
||||
Highway:
|
||||
Stage:
|
||||
value: 1
|
||||
|
||||
@ -31,6 +31,7 @@ Daily:
|
||||
- Scheduler
|
||||
Bounty:
|
||||
- Scheduler
|
||||
- Bounty
|
||||
- Highway
|
||||
- DesertRailroad
|
||||
- Schoolhouse
|
||||
|
||||
@ -45,6 +45,9 @@ class GeneratedConfig:
|
||||
Cafe_AutoAdjust = True
|
||||
Cafe_SecondCafe = True
|
||||
|
||||
# Group `Bounty`
|
||||
Bounty_OnError = 'skip' # stop, skip
|
||||
|
||||
# Group `Highway`
|
||||
Highway_Stage = 1 # 1, 2, 3, 4, 5, 6, 7, 8, 9
|
||||
Highway_Count = 2
|
||||
|
||||
@ -213,6 +213,18 @@
|
||||
"help": "JP server only\nEnable auto switch to second floor and perform interaction"
|
||||
}
|
||||
},
|
||||
"Bounty": {
|
||||
"_info": {
|
||||
"name": "Bounty Settings",
|
||||
"help": ""
|
||||
},
|
||||
"OnError": {
|
||||
"name": "Error Handling",
|
||||
"help": "Perform the selected action when an error occurs (ticket not enough or any invalid setting)",
|
||||
"stop": "Stop script",
|
||||
"skip": "Skip current task"
|
||||
}
|
||||
},
|
||||
"Highway": {
|
||||
"_info": {
|
||||
"name": "Overpass",
|
||||
|
||||
@ -213,6 +213,18 @@
|
||||
"help": "仅支持日服\n自动切换第二咖啡厅进行互动点击"
|
||||
}
|
||||
},
|
||||
"Bounty": {
|
||||
"_info": {
|
||||
"name": "悬赏通缉设置",
|
||||
"help": ""
|
||||
},
|
||||
"OnError": {
|
||||
"name": "错误处理",
|
||||
"help": "当出现票券不足或设置有误等错误时,执行该操作",
|
||||
"stop": "停止脚本运行",
|
||||
"skip": "跳过当前任务"
|
||||
}
|
||||
},
|
||||
"Highway": {
|
||||
"_info": {
|
||||
"name": "高架公路",
|
||||
|
||||
@ -33,9 +33,16 @@ class Bounty(BountyUI):
|
||||
task = list(self.bounty_info)
|
||||
if not task:
|
||||
logger.warning('Bounty enabled but no task set')
|
||||
self.error_handler()
|
||||
return task
|
||||
|
||||
def error_handler(self):
|
||||
action = self.config.Bounty_OnError
|
||||
if action == 'stop':
|
||||
raise RequestHumanTakeover
|
||||
elif action == 'skip':
|
||||
self.config.task_delay(server_update=True)
|
||||
self.config.task_stop()
|
||||
return task
|
||||
|
||||
@property
|
||||
def is_ticket_enough(self) -> bool:
|
||||
@ -67,7 +74,7 @@ class Bounty(BountyUI):
|
||||
case BountyStatus.SELECT:
|
||||
if not self.is_ticket_enough:
|
||||
logger.warning('Bounty ticket not enough')
|
||||
raise RequestHumanTakeover
|
||||
self.error_handler()
|
||||
if self.select_bounty(*self.current_bounty):
|
||||
return BountyStatus.ENTER
|
||||
case BountyStatus.ENTER:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user