Skip to content

Commit aafa2ff

Browse files
committed
Merge branch 'dev' into ocr/update-v5
2 parents bfc1bfc + 2e11baf commit aafa2ff

18 files changed

Lines changed: 295 additions & 106 deletions

File tree

.github/cliff.toml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,16 @@ body = """
6262

6363
# 尾部
6464
footer = """
65+
{%- macro remote_url() -%}
66+
https://github.com/{{ remote.github.owner }}/{{ remote.github.repo }}
67+
{%- endmacro -%}
68+
6569
## 国内下载源
6670
67-
* [已有 Mirror酱 CDK?前往 Mirror酱 高速下载](https://mirrorchyan.com/zh/projects?rid=MaaNTE)
68-
* [夸克网盘](https://pan.quark.cn/s/b690fe93838b?pwd=PtXy) 提取码: PtXy
69-
* [百度网盘](https://pan.baidu.com/s/11QMC-aYfjfq52yco_UAwfg?pwd=tkmu) 提取码: tkmu
71+
- [已有 Mirror酱 CDK?前往 Mirror酱 高速下载](https://mirrorchyan.com/zh/projects?rid=MaaNTE)
72+
- [迅雷云盘](https://pan.xunlei.com/s/VOtxqaDh_27smle-2mzDrZywA1?pwd=jx7c) 提取码: jx7c
73+
- [夸克网盘](https://pan.quark.cn/s/4b70d06b913c?pwd=irqh) 提取码: irqh
74+
- [百度网盘](https://pan.baidu.com/s/11QMC-aYfjfq52yco_UAwfg?pwd=tkmu) 提取码: tkmu
7075
"""
7176

7277
[git]

agent/custom/action/AutoFish/auto_fish_withoutCV.py

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ def run(
2020
self, context: Context, argv: CustomAction.RunArg
2121
) -> CustomAction.RunResult:
2222
deadzone = 15 # 光标与绿条中心的距离在 deadzone(像素)以内时不操作,避免过度频繁地轻微调整导致的抖动
23-
max_try_item = 5 # 识别不完整(绿条或光标未命中)的最大尝试次数,超过后放弃本次钓鱼,重新抛竿(执行 FishHook)
2423
factor = 1.5 # 控条时长的调整因子,实际时长 = 基础时长 * factor,基础时长 = (光标与绿条中心的像素偏移 / CURSOR_PX_PER_SEC) * 1000ms,增加 factor 可以适当补偿识别误差和按键响应延迟
2524
cap_ms = (
2625
1500 # 控条时长的上限(毫秒),避免因识别到较大偏移时按键过久,导致过度补偿
@@ -32,7 +31,6 @@ def run(
3231
try:
3332
params = json.loads(argv.custom_action_param)
3433
deadzone = params.get("deadzone", deadzone)
35-
max_try_item = params.get("max_try", max_try_item)
3634
factor = params.get("factor", factor)
3735
cap_ms = params.get("cap_ms", cap_ms)
3836
floor_ms = params.get("floor_ms", floor_ms)
@@ -48,7 +46,7 @@ def run(
4846
green_bar = context.run_recognition("FishGreenBar", image)
4947
cursor = context.run_recognition("FishCursor", image)
5048

51-
if not (
49+
while not (
5250
green_bar
5351
and green_bar.hit
5452
and green_bar.box
@@ -58,21 +56,26 @@ def run(
5856
and cursor.box
5957
is not None # 这个是为了消除pylance的warning,实际运行时不应该有None的情况
6058
):
61-
# 绿条/光标未命中时检查是否已弹出结算画面
59+
time.sleep(0.5)
60+
image = context.tasker.controller.post_screencap().wait().get()
61+
6262
click_blank = context.run_recognition("SceneClickBlankToExit", image)
6363
if click_blank and click_blank.hit:
6464
PrintT(context, "autofish.fish_caught")
65+
logger.debug("识别到钓上鱼, 钓鱼退出")
6566
return CustomAction.RunResult(success=True)
6667

67-
max_try_item -= 1
68-
logger.debug(
69-
f"识别不完整(绿条或光标未命中),剩余尝试次数: {max_try_item}"
70-
)
71-
72-
if max_try_item <= 0:
73-
logger.debug("尝试次数用尽,控条失败")
68+
fish_escape = context.run_recognition("FishEscape", image)
69+
if fish_escape and fish_escape.hit:
70+
PrintT(context, "autofish.fish_escape")
71+
logger.debug("识别到鱼溜走,钓鱼退出")
72+
return CustomAction.RunResult(success=True)
73+
fish_on_gaming = context.run_recognition("FishSceneOnFishGame", image)
74+
if fish_on_gaming and fish_on_gaming.hit:
75+
Print(
76+
context, "钓鱼异常结束(可能是鱼溜走),继续钓鱼"
77+
) # 通常不会执行这一步
7478
return CustomAction.RunResult(success=True)
75-
# 看来就是通过识别失败几次直接通用适配成功/失败的情况的,不用管,根本没有去识别有没有钓到
7679
continue
7780

7881
green_bar_x, green_bar_y, green_bar_w, green_bar_h = green_bar.box
@@ -113,5 +116,5 @@ def run(
113116
},
114117
)
115118

116-
logger.debug("任务结束(success=True)")
119+
logger.debug("任务中止")
117120
return CustomAction.RunResult(success=True)

agent/custom/action/pinkpaw/pinkpaw_core2.py

Lines changed: 33 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,7 @@ def run(
521521
ah.delay(3000)
522522
ah.key_up("W")
523523
# 躲第一道激光
524-
ah.delay(1400)
524+
ah.delay(1500)
525525
ah.key_down("W")
526526
ah.delay(2500)
527527
ah.key_up("W")
@@ -568,7 +568,7 @@ def run(
568568
ah.delay(500)
569569
current_ctrl = ah.ctx.tasker.controller
570570
current_ctrl.post_key_down(32).wait()
571-
ah.delay(200)
571+
ah.delay(100)
572572
current_ctrl.post_key_up(32).wait()
573573
ah.delay(200)
574574
current_ctrl.post_key_down(32).wait()
@@ -586,10 +586,10 @@ def run(
586586
ah.key_up("W")
587587
ah.delay(200)
588588
ah.key_down("D")
589-
ah.delay(1500)
589+
ah.delay(1600)
590590
current_ctrl = ah.ctx.tasker.controller
591591
current_ctrl.post_key_down(32).wait()
592-
ah.delay(200)
592+
ah.delay(100)
593593
current_ctrl.post_key_up(32).wait()
594594
ah.delay(200)
595595
current_ctrl.post_key_down(32).wait()
@@ -683,7 +683,7 @@ def run(
683683
ah.key_up("W")
684684
ah.delay(100)
685685
ah.key_down("D")
686-
ah.delay(1000)
686+
ah.delay(1100)
687687
ah.key_up("D")
688688
ah.delay(100)
689689

@@ -700,7 +700,7 @@ def run(
700700

701701
# 偷左前边展柜藏品
702702
ah.key_down("D")
703-
ah.delay(1500)
703+
ah.delay(1400)
704704
ah.key_up("D")
705705
ah.delay(100)
706706

@@ -723,7 +723,7 @@ def run(
723723
ah.key_down("W")
724724
for _ in range(12):
725725
ah.click_key("F")
726-
ah.delay(200)
726+
ah.delay(190)
727727
ah.key_up("W")
728728
ah.delay(100)
729729

@@ -743,8 +743,12 @@ def run(
743743
ah.key_up("W")
744744
ah.delay(100)
745745
# 准备穿激光
746+
ah.key_down("A")
747+
ah.delay(1000)
748+
ah.key_up("A")
749+
ah.delay(200)
746750
ah.key_down("D")
747-
ah.delay(2600)
751+
ah.delay(3100)
748752
ah.key_up("D")
749753
ah.delay(100)
750754

@@ -760,9 +764,9 @@ def run(
760764
ah.delay(100)
761765

762766
ah.key_down("D")
763-
ah.delay(1100)
767+
ah.delay(900)
764768
ah.key_up("D")
765-
ah.delay(1700)
769+
ah.delay(1800)
766770
# 穿过第一道激光
767771
ah.key_down("D")
768772
ah.delay(500)
@@ -789,7 +793,7 @@ def run(
789793
ah.key_down("S")
790794
ah.delay(500)
791795
ah.key_up("S")
792-
ah.delay(1800)
796+
ah.delay(1700)
793797

794798
# 穿过第二道竖激光和第三道和第四道激光
795799
ah.key_down("D")
@@ -820,7 +824,7 @@ def run(
820824
# 开始吃右前边展柜藏品
821825

822826
ah.key_down("D")
823-
ah.delay(600)
827+
ah.delay(700)
824828
ah.key_up("D")
825829
for _ in range(3):
826830
ah.click_key("F")
@@ -833,7 +837,7 @@ def run(
833837
ah.key_down("S")
834838
for _ in range(12):
835839
ah.click_key("F")
836-
ah.delay(200)
840+
ah.delay(190)
837841
ah.key_up("S")
838842
ah.delay(100)
839843

@@ -844,7 +848,7 @@ def run(
844848
ah.click_key("F")
845849
ah.delay(200)
846850
ah.key_down("A")
847-
ah.delay(600)
851+
ah.delay(700)
848852
ah.key_up("A")
849853
ah.delay(100)
850854

@@ -862,7 +866,7 @@ def run(
862866
ah.delay(100)
863867

864868
ah.key_down("D")
865-
ah.delay(1300)
869+
ah.delay(1400)
866870
ah.key_up("D")
867871
ah.delay(100)
868872
ah.key_down("W")
@@ -886,23 +890,27 @@ def run(
886890
ah.key_up("W")
887891

888892
ah.key_down("D")
889-
ah.delay(5900)
893+
ah.delay(7000)
890894
ah.key_up("D")
891895
ah.delay(100)
896+
ah.key_down("A")
897+
ah.delay(300)
898+
ah.key_up("A")
899+
ah.delay(100)
892900
# 开始吃二楼右边
893901
for _ in range(3):
894902
ah.click_key("F")
895903
ah.delay(200)
896904

897905
ah.key_down("S")
898-
ah.delay(1900)
906+
ah.delay(1950)
899907
ah.key_up("S")
900908
for _ in range(10):
901909
ah.click_key("F")
902910
ah.delay(200)
903911

904912
ah.key_down("S")
905-
ah.delay(2750)
913+
ah.delay(2700)
906914
ah.key_up("S")
907915
ah.delay(100)
908916

@@ -919,7 +927,7 @@ def run(
919927
ah.key_down("S")
920928
ah.delay(150)
921929
ah.key_up("S")
922-
ah.delay(250)
930+
ah.delay(230)
923931
ah.key_up("D")
924932
ah.delay(100)
925933
# 吃激光藏品房门口下面的藏品
@@ -993,24 +1001,24 @@ def run(
9931001
ah.delay(200)
9941002

9951003
ah.key_down("W")
996-
for _ in range(6):
1004+
for _ in range(8):
9971005
ah.click_key("F")
9981006
ah.delay(200)
9991007
current_ctrl = ah.ctx.tasker.controller
10001008
current_ctrl.post_key_down(2).wait() # 按下右键
10011009
ah.delay(200)
10021010
current_ctrl.post_key_up(2).wait()
1003-
ah.delay(1000)
1011+
ah.delay(400)
10041012
current_ctrl.post_key_down(2).wait() # 按下右键
10051013
ah.delay(200)
10061014
current_ctrl.post_key_up(2).wait()
1007-
ah.delay(3400)
1015+
ah.delay(3450)
10081016
ah.key_up("W")
10091017
ah.delay(100)
10101018
ah.key_down("S")
10111019
ah.delay(200)
10121020
ah.key_up("S")
1013-
ah.delay(100)
1021+
ah.delay(50)
10141022
ah.key_down("A")
10151023
ah.delay(500)
10161024
current_ctrl = ah.ctx.tasker.controller
@@ -1034,7 +1042,7 @@ def run(
10341042
ah.click_key("F")
10351043
ah.delay(200)
10361044
current_ctrl.post_key_down(32).wait()
1037-
ah.delay(200)
1045+
ah.delay(100)
10381046
current_ctrl.post_key_up(32).wait()
10391047
ah.delay(200)
10401048
current_ctrl.post_key_down(32).wait()
@@ -1130,7 +1138,7 @@ def run(
11301138
ah.delay(2000)
11311139
ah.key_up("D")
11321140
ah.key_down("S")
1133-
ah.delay(3100)
1141+
ah.delay(3200)
11341142
ah.key_up("S")
11351143

11361144
ah.key_down("D")
-1.59 KB
Binary file not shown.
-5.23 KB
Binary file not shown.

assets/resource/base/pipeline/Fish/FishNew.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,6 @@
7676
"factor": 1.4
7777
},
7878
"pre_delay": 0,
79-
"post_wait_freezes": {
80-
"time": 1000,
81-
"timeout": 6000
82-
},
8379
"next": [
8480
"[Anchor]FishNewRestart",
8581
"[JumpBack]SceneClickBlankToExit"

assets/resource/base/pipeline/Fish/FishStatus.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,17 @@
5757
}
5858
}
5959
},
60+
"FishEscape": {
61+
"desc": "鱼逃走",
62+
"recognition": "OCR",
63+
"expected": [
64+
"鱼儿溜走了",
65+
"The fish got away!"
66+
],
67+
"pre_delay": 0,
68+
"post_delay": 0,
69+
"rate_limit": 0
70+
},
6071
"FishTest": {
6172
"post_delay": 0,
6273
"pre_delay": 0,

assets/resource/base/pipeline/Rhythm/RhythmScene.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@
2424
"type": "OCR",
2525
"param": {
2626
"roi": [
27-
537,
28-
499,
29-
195,
30-
113
27+
603,
28+
508,
29+
70,
30+
45
3131
],
3232
"expected": [
3333
"得分",

assets/resource/base/pipeline/Tetris/Tetris.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@
1313
"[JumpBack]TetrisHandleLoading",
1414
"[JumpBack]TetrisDismissResult",
1515
"[JumpBack]TetrisCheckVitality",
16-
"[JumpBack]TetrisHandleGameActive",
17-
"[JumpBack]TetrisHandleGameIdle",
18-
"[JumpBack]TetrisHandleMatching",
19-
"[JumpBack]TetrisHandlePrepareTwo",
20-
"[JumpBack]TetrisHandlePrepareTwoReturn",
21-
"[JumpBack]TetrisHandlePrepareOne",
2216
"[JumpBack]TetrisHandleWorldWithPrompt",
2317
"[JumpBack]TetrisHandleExit",
2418
"[JumpBack]TetrisHandleWorldNoPrompt",
19+
"[JumpBack]TetrisHandlePrepareOne",
20+
"[JumpBack]TetrisHandlePrepareTwo",
21+
"[JumpBack]TetrisHandlePrepareTwoReturn",
22+
"[JumpBack]TetrisHandleMatching",
23+
"[JumpBack]TetrisHandleGameActive",
24+
"[JumpBack]TetrisHandleGameIdle",
2525
"TetrisExitWithError"
2626
]
2727
},
@@ -64,7 +64,7 @@
6464
"desc": "泯除方块 - 检测到游戏空闲(等待方块出现)",
6565
"recognition": "And",
6666
"all_of": [
67-
"TetrisSceneGameIdle"
67+
"TetrisGamingNext"
6868
],
6969
"pre_delay": 500,
7070
"next": [

0 commit comments

Comments
 (0)