Skip to content

Commit

Permalink
refactor: 自动深眠 (MaaXYZ#246)
Browse files Browse the repository at this point in the history
重构部分代码,增强深眠运行稳定性。
主要是为战斗失败后添加奖励领取(上半成功但下半失败)以及完善深眠片段上下半的判断逻辑。
  • Loading branch information
Windsland52 authored Nov 17, 2024
1 parent 1838283 commit b5389cb
Show file tree
Hide file tree
Showing 4 changed files with 158 additions and 17 deletions.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
175 changes: 158 additions & 17 deletions assets/resource/base/pipeline/limbo.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@
"doc": "深眠任务开始",
"next": [
"LimboEnd",
"LimboStageFlag",
"LimboStageRightest"
],
"interrupt": [
"LimboEntry",
"ObtainedAwards",
"ArtificialSleepwalkingCloseAwards",
"ArtificialSleepwalkingAwards",
"EnterTheShow",
"ClickBlank",
"ArtificialSleepwalking",
"ReturnMain"
]
Expand Down Expand Up @@ -40,15 +41,21 @@
],
"action": "Click"
},
"ArtificialSleepwalkingCloseAwards": {
"recognition": "TemplateMatch",
"template": "Limbo/ArtificialSleepwalkingCloseAwards.png",
"ClickBlank": {
"doc": "点击空白关闭",
"recognition": "OCR",
"expected": [
"点击",
"空白",
"关闭"
],
"roi": [
511,
578,
248,
142
569,
660,
121,
27
],
"only_rec": true,
"action": "Click"
},
"LimboEntry": {
Expand Down Expand Up @@ -106,8 +113,44 @@
"LimboStageFlag"
]
},
"LimboStageFlag_AfterFailed": {
"doc": "判断当前位于深眠片段(After Failed)",
"recognition": "OCR",
"expected": "本层酬劳",
"roi": [
146,
676,
67,
21
],
"only_rec": true,
"action": "Click",
"next": [
"LimboStarsMainFlag_AfterFailed",
"LimboStageFlag_AfterFailed"
]
},
"LimboStarsMainFlag": {
"doc": "判断当前位于深眠试验酬劳界面,后续进行上下半判断",
"doc": "判断当前位于深眠试验酬劳界面,查看是否有奖励未领取",
"recognition": "OCR",
"expected": "深眠试验",
"roi": [
161,
96,
163,
43
],
"only_rec": true,
"next": [
"LimboStarsMainNoAwards"
],
"interrupt": [
"LimboStarsMainAwards",
"ObtainedAwards"
]
},
"LimboStarsMainFlag_AfterFailed": {
"doc": "判断当前位于深眠试验酬劳界面(After Failed)",
"recognition": "OCR",
"expected": "深眠试验",
"roi": [
Expand All @@ -117,13 +160,97 @@
43
],
"only_rec": true,
"next": [
"LimboStarsMainNoAwards_AfterFailed"
],
"interrupt": [
"LimboStarsMainAwards",
"ObtainedAwards"
]
},
"LimboStarsMainNoAwards": {
"doc": "深眠试验酬劳界面,没有奖励未领取",
"recognition": "OCR",
"expected": [
"已领取",
"未达成"
],
"roi": [
1007,
204,
70,
28
],
"only_rec": true,
"next": [
"LimboStageFlag_up",
"LimboStageFlag_down",
"LimboStageFlag_failed",
"LimboStageFlag"
"LimboStageFlag_failed"
]
},
"LimboStarsMainNoAwards_AfterFailed": {
"doc": "深眠试验酬劳界面,没有奖励未领取(After Failed)",
"recognition": "OCR",
"expected": [
"已领取",
"未达成"
],
"roi": [
1007,
204,
70,
28
],
"only_rec": true,
"target": [
681,
707,
85,
43
],
"action": "Click",
"next": [
"LimboMain",
"LimboStarsMainNoAwards_AfterFailed"
]
},
"LimboStarsMainAwards": {
"doc": "深眠试验酬劳界面,点击全部领取/领取",
"recognition": "TemplateMatch",
"template": [
"Limbo/ObtainedAllAwards.png",
"Limbo/ObtainedAwards.png"
],
"roi": [
941,
132,
205,
176
],
"action": "Click",
"next": [
"LimboStarsMainNoAwardsFlag",
"LimboStarsMainAwards"
],
"interrupt": [
"ObtainedAwards"
]
},
"LimboStarsMainNoAwardsFlag": {
"doc": "判断当前位于深眠试验酬劳界面,奖励已领取完毕",
"recognition": "OCR",
"expected": [
"已领取",
"未达成"
],
"roi": [
1007,
204,
70,
28
],
"only_rec": true
},
"LimboStageFlag_up": {
"doc": "判断当前位于深眠片段上半部分",
"recognition": "OCR",
Expand All @@ -148,9 +275,10 @@
]
},
"LimboStageFlag_down": {
"doc": "判断当前位于深眠片段下半部分",
"doc": "判断当前位于深眠片段下半部分,未开始战斗/已完成战斗",
"_doc": "虽有上下半共3星的情况,考虑到一般情况下不会进入上下已通过(且未满星)深眠片段再运行m9a,而在外该深眠片段上下半通过便会解锁新的深眠,执行时不会进入该深眠,故此时识别的3星可视为上半3星,即下半战斗未开始状态",
"recognition": "OCR",
"expected": "3/6",
"expected": "[36]/6",
"roi": [
1028,
101,
Expand All @@ -173,9 +301,11 @@
},
"LimboStageFlag_failed": {
"doc": "判断当前位于深眠片段上半部分未满星,结束任务",
"_doc": "经测试,上下半各一星时,会解锁下一深眠",
"__doc": "参考LimboStageFlag_down _doc,虽已确定不会出现检测到[45]/6的情况,但为了以防万一,还是决定加上该情况的识别",
"todo_doc": "后续可在这里添加重打当前深眠片段的操作",
"recognition": "OCR",
"expected": "[1-2]/6",
"expected": "[1245]/6",
"roi": [
1028,
101,
Expand All @@ -189,7 +319,11 @@
85,
43
],
"action": "Click"
"action": "Click",
"next": [
"LimboMain",
"LimboStageFlag_failed"
]
},
"LimboStageLightest_1": {
"doc": "最靓的位置,要多点几次",
Expand Down Expand Up @@ -313,7 +447,11 @@
78
],
"only_rec": true,
"action": "Click"
"action": "Click",
"next": [
"LimboStageFlag_AfterFailed",
"LimboFailed"
]
},
"LimboVictory_1": {
"doc": "深眠战斗成功_1",
Expand Down Expand Up @@ -518,7 +656,10 @@
},
"LimboObtainedAwards_1": {
"recognition": "TemplateMatch",
"template": "Limbo/LimboObtainedAwards.png",
"template": [
"Limbo/ObtainedAllAwards.png",
"Limbo/ObtainedAwards.png"
],
"roi": [
941,
132,
Expand Down

0 comments on commit b5389cb

Please sign in to comment.