归档重复脚本

This commit is contained in:
起个名字好难的喵
2026-01-12 21:00:56 +08:00
parent b25fd1408a
commit 13d7c67f05
247 changed files with 1676 additions and 1670 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.2 KiB

View File

@@ -0,0 +1,30 @@
{
"info": {
"name": "ds",
"type": "collect",
"author": "听雨♪",
"version": "1.0",
"description": "",
"bgiVersion": "0.35.1"
},
"positions": [
{
"id": 1,
"action": "",
"move_mode": "walk",
"type": "teleport",
"x": 267.9560546875,
"y": -665.14794921875,
"action_params": ""
},
{
"id": 2,
"x": 257.146484375,
"y": -682.4951171875,
"type": "target",
"move_mode": "walk",
"action": "",
"action_params": ""
}
]
}

View File

@@ -0,0 +1,39 @@
{
"info": {
"name": "卯师父",
"type": "collect",
"author": "听雨♪",
"version": "1.0",
"description": "",
"bgiVersion": "0.35.1"
},
"positions": [
{
"id": 1,
"action": "",
"move_mode": "walk",
"type": "teleport",
"x": 267.9580078125,
"y": -665.1201171875,
"action_params": ""
},
{
"id": 2,
"x": 226.04296875,
"y": -660.0048828125,
"type": "path",
"move_mode": "walk",
"action": "",
"action_params": ""
},
{
"id": 3,
"x": 227.4072265625,
"y": -668.20751953125,
"type": "target",
"move_mode": "walk",
"action": "",
"action_params": ""
}
]
}

View File

@@ -0,0 +1,75 @@
{
"info": {
"name": "哈马维",
"type": "collect",
"author": "听雨♪",
"version": "1.0",
"description": "",
"bgiVersion": "0.35.1"
},
"positions": [
{
"id": 1,
"action": "",
"move_mode": "walk",
"type": "teleport",
"x": 2786.9755859375,
"y": -503.09130859375,
"action_params": ""
},
{
"id": 2,
"x": 2788.0830078125,
"y": -488.28173828125,
"type": "path",
"move_mode": "walk",
"action": "",
"action_params": ""
},
{
"id": 3,
"x": 2771.4755859375,
"y": -476.07421875,
"type": "path",
"move_mode": "walk",
"action": "",
"action_params": ""
},
{
"id": 4,
"x": 2763.0478515625,
"y": -453.83349609375,
"type": "path",
"move_mode": "walk",
"action": "",
"action_params": ""
},
{
"id": 5,
"x": 2760.521484375,
"y": -439.513671875,
"type": "path",
"move_mode": "walk",
"action": "",
"action_params": ""
},
{
"id": 6,
"x": 2778.63671875,
"y": -435.7626953125,
"type": "path",
"move_mode": "walk",
"action": "",
"action_params": ""
},
{
"id": 7,
"x": 2778.24609375,
"y": -430.80810546875,
"type": "target",
"move_mode": "walk",
"action": "",
"action_params": ""
}
]
}

View File

@@ -0,0 +1,121 @@
{
"info": {
"name": "小畑",
"type": "collect",
"author": "听雨♪",
"version": "",
"description": "",
"bgiVersion": "0.35.1"
},
"positions": [
{
"id": 1,
"x": -3812.7041015625,
"y": -2546.6064453125,
"action": "",
"move_mode": "walk",
"action_params": "",
"type": "teleport"
},
{
"id": 2,
"x": -3811.9248046875,
"y": -2567.5771484375,
"action": "",
"move_mode": "walk",
"action_params": "",
"type": "path"
},
{
"id": 3,
"x": -3727.125996598583,
"y": -2570.25,
"action": "",
"move_mode": "walk",
"action_params": "",
"type": "path"
},
{
"id": 4,
"x": -3720.250047457075,
"y": -2569.625
},
{
"id": 5,
"x": -3713.6250949141504,
"y": -2568.5
},
{
"id": 6,
"x": -3706.7501423712256,
"y": -2567.875
},
{
"id": 7,
"x": -3700.625284742451,
"y": -2566.875
},
{
"id": 8,
"x": -3693.2480542599114,
"y": -2564.875
},
{
"id": 9,
"x": -3684.874810171699,
"y": -2562.375
},
{
"id": 10,
"x": -3680.4998576287744,
"y": -2561.25
},
{
"id": 11,
"x": -3677.6251423712256,
"y": -2558.125
},
{
"id": 12,
"x": -3675.5,
"y": -2558.25,
"action": "",
"move_mode": "walk",
"action_params": "",
"type": "path"
},
{
"id": 13,
"x": -3674.124952542925,
"y": -2560.125
},
{
"id": 14,
"x": -3672.624952542925,
"y": -2564,
"action": "",
"move_mode": "walk",
"action_params": "",
"type": "path"
},
{
"id": 15,
"x": -3670.2495728863214,
"y": -2567.75
},
{
"id": 16,
"x": -3666.0014237122596,
"y": -2566
},
{
"id": 17,
"x": -3667.37571185613,
"y": -2561.125,
"action": "",
"move_mode": "walk",
"action_params": "",
"type": "target"
}
]
}

View File

@@ -0,0 +1,39 @@
{
"info": {
"name": "布兰琪",
"type": "collect",
"author": "听雨♪",
"version": "1.0",
"description": "",
"bgiVersion": "0.35.1"
},
"positions": [
{
"id": 1,
"action": "",
"move_mode": "walk",
"type": "teleport",
"x": -867.720703125,
"y": 2281.377685546875,
"action_params": ""
},
{
"id": 2,
"x": -893.705078125,
"y": 2258.10791015625,
"type": "path",
"move_mode": "walk",
"action": "",
"action_params": ""
},
{
"id": 3,
"x": -895.7216796875,
"y": 2264.712890625,
"type": "target",
"move_mode": "walk",
"action": "",
"action_params": ""
}
]
}

View File

@@ -0,0 +1,57 @@
{
"info": {
"name": "布希柯",
"type": "collect",
"author": "听雨♪",
"version": "1.0",
"description": "",
"bgiVersion": "0.35.1"
},
"positions": [
{
"id": 1,
"action": "",
"move_mode": "walk",
"type": "teleport",
"x": 4508.96875,
"y": 3630.584228515625,
"action_params": ""
},
{
"id": 2,
"x": 4514.79296875,
"y": 3605.441650390625,
"type": "path",
"move_mode": "walk",
"action": "",
"action_params": ""
},
{
"id": 3,
"x": 4497.20556640625,
"y": 3586.030029296875,
"type": "path",
"move_mode": "walk",
"action": "",
"action_params": ""
},
{
"id": 4,
"x": 4475.7421875,
"y": 3559.308837890625,
"type": "path",
"move_mode": "walk",
"action": "",
"action_params": ""
},
{
"id": 5,
"x": 4470.52685546875,
"y": 3560.251708984375,
"type": "target",
"move_mode": "walk",
"action": "",
"action_params": ""
}
]
}

View File

@@ -0,0 +1,30 @@
{
"info": {
"name": "布特罗斯",
"type": "collect",
"author": "听雨♪",
"version": "1.0",
"description": "",
"bgiVersion": "0.35.1"
},
"positions": [
{
"id": 1,
"action": "",
"move_mode": "walk",
"type": "teleport",
"x": 2679.8427734375,
"y": -1935.005859375,
"action_params": ""
},
{
"id": 2,
"x": 2659.951171875,
"y": -1928.943359375,
"type": "target",
"move_mode": "walk",
"action": "",
"action_params": ""
}
]
}

View File

@@ -0,0 +1,57 @@
{
"info": {
"name": "布纳马",
"type": "collect",
"authors": [
{
"name": "芝士贝果"
}
],
"version": "1.0",
"description": "",
"map_name": "Teyvat",
"bgi_version": "0.47.3",
"tags": [],
"last_modified_time": 1754489424074,
"enable_monster_loot_split": false,
"map_match_method": ""
},
"positions": [
{
"id": 1,
"action": "",
"move_mode": "walk",
"type": "teleport",
"x": 9060.5419921875,
"y": -1847.5107421875,
"action_params": ""
},
{
"id": 2,
"x": 9089.0361328125,
"y": -1852.42919921875,
"type": "path",
"move_mode": "walk",
"action": "",
"action_params": ""
},
{
"id": 3,
"x": 9088.6552734375,
"y": -1856.89306640625,
"type": "target",
"move_mode": "walk",
"action": "",
"action_params": ""
},
{
"id": 4,
"x": 9089.8935546875,
"y": -1857.2724609375,
"type": "target",
"move_mode": "walk",
"action": "",
"action_params": ""
}
]
}

View File

@@ -0,0 +1,39 @@
{
"info": {
"name": "志村勘兵卫",
"type": "collect",
"author": "听雨♪",
"version": "1.0",
"description": "",
"bgiVersion": "0.35.1"
},
"positions": [
{
"id": 1,
"x": -4402.5703125,
"y": -3053.0234375,
"action": "",
"move_mode": "walk",
"action_params": "",
"type": "teleport"
},
{
"id": 2,
"x": -4418.000213556839,
"y": -3083.5625,
"action": "",
"move_mode": "walk",
"action_params": "",
"type": "path"
},
{
"id": 3,
"x": -4424.500332199528,
"y": -3080.375,
"action": "",
"move_mode": "walk",
"action_params": "",
"type": "target"
}
]
}

View File

@@ -0,0 +1,70 @@
{
"info": {
"name": "须弥城普斯帕咖啡馆代理店长恩忒卡",
"type": "collect",
"author": "吉吉喵",
"version": "",
"description": "咖啡",
"bgi_version": "0.42.3"
},
"positions": [
{
"id": 1,
"x": 2789.4375,
"y": -492.34375,
"action": "",
"move_mode": "walk",
"type": "teleport"
},
{
"id": 2,
"x": 2789.125,
"y": -488.28125,
"action": "",
"move_mode": "walk",
"type": "path"
},
{
"id": 3,
"x": 2772.20703125,
"y": -477.16259765625,
"action": "",
"move_mode": "walk",
"type": "path"
},
{
"id": 4,
"x": 2770.71875,
"y": -465.90625,
"action": "",
"move_mode": "walk",
"action_params": "",
"type": "path"
},
{
"id": 5,
"x": 2765.1025390625,
"y": -459.37548828125,
"action": "",
"move_mode": "walk",
"type": "path"
},
{
"id": 6,
"x": 2745.6875,
"y": -462.09375,
"action": "",
"move_mode": "walk",
"type": "path"
},
{
"id": 7,
"x": 2743.4736328125,
"y": -470.27734375,
"action": "combat_script",
"move_mode": "walk",
"action_params": "wait(0.5),keypress(F),wait(7.5),keydown(W),keypress(SPACE),wait(0.5),keypress(SPACE),wait(0.5),keypress(SPACE),wait(0.5),keypress(SPACE),wait(0.5),keypress(SPACE),wait(0.5),keypress(SPACE),wait(0.5),keypress(SPACE),wait(0.5),keypress(SPACE),wait(0.5),keypress(SPACE),wait(0.5),keypress(SPACE),wait(0.5),keypress(SPACE),wait(0.5),keypress(SPACE),wait(0.5),keypress(SPACE),wait(0.5),keypress(SPACE),wait(0.5),keypress(SPACE),wait(0.5),keypress(SPACE),wait(0.5),keypress(SPACE),wait(0.5),keypress(SPACE),wait(0.5),keypress(SPACE),wait(0.5),keypress(SPACE),wait(0.5),keypress(SPACE),keyup(W)",
"type": "path"
}
]
}

View File

@@ -0,0 +1,39 @@
{
"info": {
"name": "珀姆",
"type": "collect",
"author": "听雨♪",
"version": "1.0",
"description": "",
"bgiVersion": "0.35.1"
},
"positions": [
{
"id": 1,
"action": "",
"move_mode": "walk",
"type": "teleport",
"x": 2786.958984375,
"y": -503.0859375,
"action_params": ""
},
{
"id": 2,
"x": 2809.5712890625,
"y": -514.7138671875,
"type": "path",
"move_mode": "walk",
"action": "",
"action_params": ""
},
{
"id": 3,
"x": 2811.244140625,
"y": -509.603515625,
"type": "target",
"move_mode": "walk",
"action": "",
"action_params": ""
}
]
}

View File

@@ -0,0 +1,102 @@
{
"info": {
"name": "买鱼-1",
"type": "buy",
"author": "听雨♪",
"version": "1.0",
"description": "",
"bgiVersion": "0.35.1"
},
"positions": [
{
"id": 1,
"x": 263.5,
"y": -672.5,
"action": "",
"move_mode": "walk",
"action_params": "",
"type": "teleport"
},
{
"id": 2,
"x": 247.5,
"y": -664.5,
"action": "",
"move_mode": "run",
"action_params": "",
"type": "path"
},
{
"id": 3,
"x": 214.5,
"y": -661.5,
"action": "",
"move_mode": "run",
"action_params": "",
"type": "path"
},
{
"id": 4,
"x": 192.5,
"y": -682,
"action": "",
"move_mode": "run",
"action_params": "",
"type": "path"
},
{
"id": 5,
"x": 162.5,
"y": -681,
"action": "",
"move_mode": "run",
"action_params": "",
"type": "path"
},
{
"id": 6,
"x": 157.5000949141504,
"y": -630.375,
"action": "",
"move_mode": "run",
"action_params": "",
"type": "path"
},
{
"id": 7,
"x": 139.99022999999943,
"y": -608.2969000000003,
"type": "path",
"move_mode": "walk",
"action": "",
"action_params": ""
},
{
"id": 8,
"x": 162.32030999999915,
"y": -592.3183600000002,
"type": "path",
"move_mode": "walk",
"action": "",
"action_params": ""
},
{
"id": 9,
"x": 167.29102000000057,
"y": -599.75684,
"type": "path",
"move_mode": "walk",
"action": "",
"action_params": ""
},
{
"id": 10,
"x": 163.2538999999997,
"y": -603.9433600000002,
"type": "target",
"move_mode": "walk",
"action": "",
"action_params": ""
}
]
}

View File

@@ -0,0 +1,93 @@
{
"info": {
"name": "牢高",
"type": "collect",
"author": "听雨♪",
"version": "1.0",
"description": "",
"bgiVersion": "0.35.1"
},
"positions": [
{
"id": 1,
"x": 263.5,
"y": -672.5,
"action": "",
"move_mode": "walk",
"action_params": "",
"type": "teleport"
},
{
"id": 2,
"x": 247.5,
"y": -664.5,
"action": "",
"move_mode": "run",
"action_params": "",
"type": "path"
},
{
"id": 3,
"x": 214.5,
"y": -661.5,
"action": "",
"move_mode": "run",
"action_params": "",
"type": "path"
},
{
"id": 4,
"x": 192.5,
"y": -682,
"action": "",
"move_mode": "run",
"action_params": "",
"type": "path"
},
{
"id": 5,
"x": 162.5,
"y": -681,
"action": "",
"move_mode": "run",
"action_params": "",
"type": "path"
},
{
"id": 6,
"x": 157.5000949141504,
"y": -630.375,
"action": "",
"move_mode": "run",
"action_params": "",
"type": "path"
},
{
"id": 7,
"x": 139.99022999999943,
"y": -608.2969000000003,
"action": "",
"move_mode": "walk",
"action_params": "",
"type": "path"
},
{
"id": 8,
"x": 162.32030999999915,
"y": -592.3183600000002,
"action": "",
"move_mode": "walk",
"action_params": "",
"type": "path"
},
{
"id": 9,
"x": 158.751953125,
"y": -586.27294921875,
"type": "target",
"move_mode": "walk",
"action": "",
"action_params": ""
}
]
}

View File

@@ -0,0 +1,39 @@
{
"info": {
"name": "莎拉",
"type": "collect",
"author": "听雨♪",
"version": "1.0",
"description": "",
"bgiVersion": "0.35.1"
},
"positions": [
{
"id": 1,
"action": "",
"move_mode": "walk",
"type": "teleport",
"x": -867.7138671875,
"y": 2281.37646484375,
"action_params": ""
},
{
"id": 2,
"x": -891.755859375,
"y": 2255.769775390625,
"type": "path",
"move_mode": "walk",
"action": "",
"action_params": ""
},
{
"id": 3,
"x": -888.6591796875,
"y": 2240.89892578125,
"type": "target",
"move_mode": "walk",
"action": "",
"action_params": ""
}
]
}

View File

@@ -0,0 +1,30 @@
{
"info": {
"name": "葵",
"type": "collect",
"author": "听雨♪",
"version": "1.1",
"description": "",
"bgiVersion": "0.35.1"
},
"positions": [
{
"id": 1,
"x": -4402.5390625,
"y": -3053.0341796875,
"action": "",
"move_mode": "walk",
"action_params": "",
"type": "teleport"
},
{
"id": 2,
"x": -4402.687357628773,
"y": -3072.3125,
"action": "",
"move_mode": "walk",
"action_params": "",
"type": "target"
}
]
}

View File

@@ -0,0 +1,66 @@
{
"info": {
"name": "阿扎莱",
"type": "collect",
"author": "听雨♪",
"version": "1.0",
"description": "",
"bgiVersion": "0.35.1"
},
"positions": [
{
"id": 1,
"action": "",
"move_mode": "walk",
"type": "teleport",
"x": 4096.03125,
"y": -2025.9755859375,
"action_params": ""
},
{
"id": 2,
"x": 4085.078125,
"y": -2018.173828125,
"type": "path",
"move_mode": "walk",
"action": "",
"action_params": ""
},
{
"id": 3,
"x": 4076.845703125,
"y": -1995.6533203125,
"type": "path",
"move_mode": "walk",
"action": "",
"action_params": ""
},
{
"id": 4,
"x": 4100.158203125,
"y": -1986.6904296875,
"type": "path",
"move_mode": "walk",
"action": "",
"action_params": ""
},
{
"id": 5,
"x": 4100.736328125,
"y": -1979.58837890625,
"type": "path",
"move_mode": "walk",
"action": "",
"action_params": ""
},
{
"id": 6,
"x": 4091.5751953125,
"y": -1980.16015625,
"type": "path",
"move_mode": "walk",
"action": "",
"action_params": ""
}
]
}

View File

@@ -0,0 +1,57 @@
{
"info": {
"name": "ale",
"type": "collect",
"author": "听雨♪",
"version": "1.0",
"description": "",
"bgiVersion": "0.35.1"
},
"positions": [
{
"id": 1,
"action": "",
"move_mode": "walk",
"type": "teleport",
"x": 4645.490234375,
"y": 3467.8603515625,
"action_params": ""
},
{
"id": 2,
"x": 4635.865234375,
"y": 3475.1591796875,
"type": "path",
"move_mode": "fly",
"action": "",
"action_params": ""
},
{
"id": 3,
"x": 4639.42724609375,
"y": 3505.39697265625,
"type": "path",
"move_mode": "fly",
"action": "",
"action_params": ""
},
{
"id": 4,
"x": 4622.95654296875,
"y": 3509.7421875,
"type": "path",
"move_mode": "fly",
"action": "stop_flying",
"action_params": ""
},
{
"id": 5,
"x": 4602.0556640625,
"y": 3515.504150390625,
"type": "target",
"move_mode": "walk",
"action": "",
"action_params": ""
}
]
}

View File

@@ -0,0 +1,682 @@
const npcData = {
"Blanche": {
"name": "布兰琪",
"enable": true,
"page": 2,
"time": "night",
"path": "assets/path/布兰琪.json",
"goods": ["盐", "胡椒", "洋葱", "牛奶", "番茄", "卷心菜", "土豆", "小麦"]
},
"DongSheng": {
"name": "东升",
"enable": true,
"page": 2,
"time": "any",
"path": "assets/path/东升.json",
"goods": ["洋葱", "牛奶", "卷心菜", "土豆", "小麦", "稻米", "虾仁", "豆腐", "杏仁", "盐", "胡椒", "番茄"]
},
"ChefMao": {
"name": "香菱爹",
"enable": true,
"page": 5,
"time": "any",
"path": "assets/path/卯师父.json",
"goods": ["鱼肉", "螃蟹"]
},
"UncleSun": {
"name": "奸商老孙",
"enable": true,
"page": 1,
"time": "day",
"path": "assets/path/老孙.json",
"goods": ["鱼肉", "螃蟹", "虾仁"]
},
"UncleGao": {
"name": "奸商老高",
"enable": true,
"page": 1,
"time": "day",
"path": "assets/path/老高.json",
"goods": ["鱼肉"]
},
"Aoi": {
"name": "葵",
"enable": true,
"page": 2,
"time": "any",
"path": "assets/path/葵.json",
"goods": ["洋葱", "牛奶", "卷心菜", "土豆", "小麦", "稻米", "虾仁", "豆腐", "盐", "胡椒", "番茄"]
},
"ShimuraKanbei": {
"name": "志村勘兵卫",
"enable": true,
"page": 4,
"time": "any",
"path": "assets/path/志村勘兵卫.json",
"goods": ["鱼肉", "螃蟹"]
},
"Butrus": {
"name": "布特罗斯",
"enable": true,
"page": 1,
"time": "any",
"path": "assets/path/布特罗斯.json",
"goods": ["鱼肉", "螃蟹", "虾仁"]
},
"Pam": {
"name": "珀姆",
"enable": true,
"page": 1,
"time": "any",
"path": "assets/path/珀姆.json",
"goods": ["鱼肉", "螃蟹", "虾仁"]
},
"Hamawi": {
"name": "哈马维",
"enable": true,
"page": 2,
"time": "any",
"path": "assets/path/哈马维.json",
"goods": ["洋葱", "牛奶", "卷心菜", "土豆", "小麦", "稻米", "虾仁", "豆腐", "盐", "胡椒", "番茄"]
},
"Enteka": {
"name": "恩忒卡",
"enable": true,
"page": 2,
"time": "any",
"path": "assets/path/恩忒卡.json",
"goods": ["咖啡豆"]
}
,
"Azalai": {
"name": "阿扎莱",
"enable": true,
"page": 2,
"time": "night",
"path": "assets/path/阿扎莱.json",
"goods": ["鱼肉", "兽肉", "秃秃豆"]
},
"Boucicaut": {
"name": "布希柯",
"enable": true,
"page": 2,
"time": "any",
"path": "assets/path/布希柯.json",
"goods": ["枫达", "洋葱", "牛奶", "卷心菜", "土豆", "小麦", "秃秃豆", "杏仁", "发酵果实汁", "盐", "胡椒", "番茄"]
},
"Arouet": {
"name": "阿鲁埃",
"enable": true,
"page": 2,
"time": "any",
"path": "assets/path/阿鲁埃.json",
"goods": ["咖啡豆", "枫达"]
},
"Bunama": {
"name": "布纳马",
"enable": true,
"page": 2,
"time": "any",
"path": "assets/path/布纳马.json",
"goods": ["盐", "小麦", "胡椒", "洋葱", "牛奶", "番茄", "卷心菜", "土豆", "秃秃豆"]
}
}
const goodsData = {
"salt": {
"id": "salt",
"name": "盐",
"file": "assets/images/salt.png"
},
"pepper": {
"id": "pepper",
"name": "胡椒",
"file": "assets/images/pepper.png"
},
"onion": {
"id": "onion",
"name": "洋葱",
"file": "assets/images/onion.png"
},
"milk": {
"id": "milk",
"name": "牛奶",
"file": "assets/images/milk.png"
},
"tomato": {
"id": "tomato",
"name": "番茄",
"file": "assets/images/tomato.png"
},
"potato": {
"id": "potato",
"name": "土豆",
"file": "assets/images/potato.png"
},
"wheat": {
"id": "wheat",
"name": "小麦",
"file": "assets/images/wheat.png"
},
"rice": {
"id": "rice",
"name": "稻米",
"file": "assets/images/rice.png"
},
"shrimp": {
"id": "shrimp",
"name": "虾仁",
"file": "assets/images/shrimp.png"
},
"almond": {
"id": "almond",
"name": "杏仁",
"file": "assets/images/almond.png"
},
"cabbage": {
"id": "cabbage",
"name": "卷心菜",
"file": "assets/images/cabbage.png"
},
"tofu": {
"id": "tofu",
"name": "豆腐",
"file": "assets/images/tofu.png"
},
"fish": {
"id": "fish",
"name": "鱼肉",
"file": "assets/images/fish.png"
},
"crab": {
"id": "crab",
"name": "螃蟹",
"file": "assets/images/crab.png"
},
"coffeeBeans": {
"id": "coffeeBeans",
"name": "咖啡豆",
"file": "assets/images/coffeeBeans.png"
},
"glabrousBeans": {
"id": "glabrousBeans",
"name": "秃秃豆",
"file": "assets/images/glabrousBeans.png"
},
"rawMeat": {
"id": "rawMeat",
"name": "兽肉",
"file": "assets/images/rawMeat.png"
},
"fermentedJuice": {
"id": "fermentedJuice",
"name": "发酵果实汁",
"file": "assets/images/fermentedJuice.png"
},
"fonta": {
"id": "fonta",
"name": "枫达",
"file": "assets/images/fonta.png"
}
};
const translationList = {};
const enableGoods = new Set([]);
const othrtRo = {
"buy": {
"name": "购买按钮",
"file": "assets/images/buyBtn.png"
}
}
// 设置游戏时间
async function setTime(hour, minute) {
// 关于setTime
// 原作者: Tim
// 脚本名称: SetTimeMinute - 精确调整游戏时间到分钟
// 脚本版本: 1.0
// Hash: f5c2547dfc286fc643c733d630f775e8fbf12971
// 设置游戏分辨率和DPI缩放
setGameMetrics(1920, 1080, 1);
// 圆心坐标
const centerX = 1441;
const centerY = 501.6;
// 半径
const r1 = 30;
const r2 = 150;
const r3 = 300;
const stepDuration = 50;
function getPosition(r, index) {
let angle = index * Math.PI / 720;
return [Math.round(centerX + r * Math.cos(angle)), Math.round(centerY + r * Math.sin(angle))];
}
async function mouseClick(x, y) {
moveMouseTo(x, y);
await sleep(50);
leftButtonDown();
await sleep(50);
leftButtonUp();
await sleep(stepDuration);
}
async function mouseClickAndMove(x1, y1, x2, y2) {
moveMouseTo(x1, y1);
await sleep(50);
leftButtonDown();
await sleep(50);
moveMouseTo(x2, y2);
await sleep(50);
leftButtonUp();
await sleep(stepDuration);
}
async function setTime(hour, minute) {
const end = (hour + 6) * 60 + minute - 20;
const n = 3;
for (let i = - n + 1; i < 1; i++) {
let [x, y] = getPosition(r1, end + i * 1440 / n);
await mouseClick(x, y);
}
let [x1, y1] = getPosition(r2, end + 5);
let [x2, y2] = getPosition(r3, end + 20 + 0.5);
await mouseClickAndMove(x1, y1, x2, y2);
}
let h = Math.floor(hour + minute / 60);
const m = Math.floor(hour * 60 + minute) - h * 60;
h = ((h % 24) + 24) % 24;
log.info(`设置时间到 ${h}${m}`);
await keyPress("Escape");
await sleep(1000);
await click(50, 700);
await sleep(2000);
await setTime(h, m);
await sleep(1000);
await click(1500, 1000);//确认
await sleep(18000);
await keyPress("Escape");
await sleep(2000);
await keyPress("Escape");
await sleep(2000);
}
// 地图追踪
async function autoPath(locationPath) {
try {
let filePath = locationPath;
await pathingScript.runFile(filePath);
sleep(2000);
return true;
} catch (error) {
log.error(`执行 ${locationName} 路径时发生错误`);
log.error(error.message);
}
return false;
}
// 平滑过渡函数(缓动效果)
function smoothStep(t) {
return t * t * (3 - 2 * t);
}
// 模拟鼠标移动到指定位置(带曲线路径)
async function naturalMove(initX, initY, targetX, targetY, duration, wiggle = 30) {
// 生成控制点(使路径形成曲线)
const controlX = (initX + targetX) / 2 + (Math.random() * wiggle * 2 - wiggle);
const controlY = (initY + targetY) / 2 + (Math.random() * wiggle * 2 - wiggle);
const steps = Math.max(duration / 20, 10); // 计算步数
for (let i = 0; i <= steps; i++) {
const progress = i / steps;
const t = smoothStep(progress); // 使用平滑过渡
// 二次贝塞尔曲线计算
const x = (1 - t) * (1 - t) * initX + 2 * (1 - t) * t * controlX + t * t * targetX;
const y = (1 - t) * (1 - t) * initY + 2 * (1 - t) * t * controlY + t * t * targetY;
moveMouseTo(Math.trunc(x), Math.trunc(y));
// 随机延迟使移动更自然
await sleep(Math.trunc(duration / steps * (0.8 + Math.random() * 0.4)));
}
// 确保最终位置准确
moveMouseTo(targetX, targetY);
}
// 定义一个独立的函数用于在指定区域进行 OCR 识别并输出识别内容
async function recognizeTextInRegion(captureRegion, ocrRegion, timeout = 5000) {
let startTime = Date.now();
let retryCount = 0; // 重试计数
while (Date.now() - startTime < timeout) {
try {
// 在指定区域进行 OCR 识别
let ocrResult = captureRegion.find(RecognitionObject.ocr(ocrRegion.x, ocrRegion.y, ocrRegion.width, ocrRegion.height));
if (ocrResult) {
// 后处理:根据替换映射表检查和替换错误识别的字符
let correctedText = ocrResult.text;
return correctedText; // 返回识别到的内容
} else {
log.warn(`OCR 识别区域未找到内容`);
return null; // 如果 OCR 未识别到内容,返回 null
}
} catch (error) {
retryCount++; // 增加重试计数
log.warn(`OCR 摩拉数识别失败,正在进行第 ${retryCount} 次重试...`);
}
await sleep(500); // 短暂延迟,避免过快循环
}
log.warn(`经过多次尝试,仍然无法在指定区域识别到文字`);
return null; // 如果未识别到文字,返回 null
}
async function getMora(captureRegion) {
let ocrRegionMora = { x: 1606, y: 28, width: 164, height: 40 }; // 设置对应的识别区域
let recognizedText = await recognizeTextInRegion(captureRegion, ocrRegionMora);
log.debug(`成功识别到摩拉数值: ${recognizedText}`);
try {
recognizedText = recognizedText.replace(/[,]/g, ''); // 移除逗号
recognizedText = parseInt(recognizedText, 10); // 转换为整数
return recognizedText;
} catch (error) {
log.warn(`解析摩拉数值时发生错误: ${error.message}`);
}
return null;
}
// 切换下一页商品
async function nextGoodsPage() {
//设置脚本环境的游戏分辨率和DPI缩放
setGameMetrics(3840, 2160, 1.5);
let [initX, initY] = [1500, 1850];
let [targetX, targetY] = [1800, 260];
moveMouseTo(initX, initY);
leftButtonDown();
await naturalMove(initX, initY, targetX, targetY, 300);
// 按住了, 防止弹太远
await sleep(520);
leftButtonUp();
}
// 快速购买
async function qucikBuy() {
//设置脚本环境的游戏分辨率和DPI缩放
setGameMetrics(3840, 2160, 1.5);
let [buyBtnX, buyBtnY] = [3200, 2045];
let [confirmBtnX, confirmBtnY] = [2025, 1570];
let [addNumX, addNumY] = [2060, 1208];
// 等待界面切换
await sleep(200);
// 查找购买按钮
let captureRegion = captureGameRegion();
let buyBtn = captureRegion.Find(othrtRo.buy.ro);
if (buyBtn.isEmpty()) {
return false;
}
// 点击购买按钮
click(buyBtn.x * 2 + buyBtn.width, buyBtn.y * 2 + buyBtn.height);
// 等待购买窗口弹出
await sleep(300);
// 增加数量至最大
leftButtonDown();
await naturalMove(addNumX, addNumY, addNumX + 666, addNumY - 233, 100);
leftButtonUp();
// 点击确认按钮
click(confirmBtnX, confirmBtnY);
// 等待购买完成
await sleep(200);
// 点击空白关闭
click(buyBtnX, buyBtnY);
await sleep(200);
return true;
}
// 跳过对话
async function spikChat(npcName) {
count = 5
await sleep(1000);
if (npcName == "布纳马") {
await sleep(1000);
// 设置游戏分辨率和DPI缩放
setGameMetrics(1920, 1080, 1);
// 交互
for (let i = 0; i < 3; i++) {
keyPress("VK_F");
await sleep(1500);
}
// 点击有什么卖的
let captureRegion = captureGameRegion()
let resList = captureRegion.findMulti(RecognitionObject.ocrThis);
for (let i = 0; i < resList.count; i++) {
if (resList[i].text.includes("有什么卖的")) {
await sleep(500);
click(resList[i].x + 30, resList[i].y + 30); // 点击有什么卖的
await sleep(500);
// 使用完后释放资源
captureRegion.dispose();
}
}
await sleep(1500);
keyPress("VK_F");
await sleep(1500);
} else {
for (let i = 0; i < count; i++) {
keyPress("VK_F");
await sleep(1300);
}
}
await sleep(1000);
}
let initialMora = null;
let maxMora = null;
if (settings._maxMora && settings._maxMora.trim() !== "") {
try {
maxMora = parseInt(settings._maxMora);
if (isNaN(maxMora)) {
throw "最大摩拉数值必须是数字或留空";
}
} catch (error) {
log.warn(`解析最大摩拉数值时发生错误: ${error.message}`);
throw `解析最大摩拉数值时发生错误: ${error.message}`;
}
log.info("设置最大使用摩拉数值: {maxMora}", maxMora);
} else {
log.info("未设置最大使用摩拉数值,购买时不做限制");
}
// 购买逻辑返回true时停止购买
async function buyGoods(npcName) {
// 设置脚本环境的游戏分辨率和DPI缩放
setGameMetrics(3840, 2160, 1.5);
let tempGoods = [...npcData[npcName].enableGoods];
if (maxMora !== null) {
// 需要识别初始摩拉数值
if (initialMora === null) {
log.info("正在识别初始摩拉数值");
let captureRegion = captureGameRegion();
initialMora = await getMora(captureRegion);
if (initialMora === null) {
log.info("无法识别当前摩拉数值,本次购买时不做限制");
} else {
log.info("识别到初始摩拉数值: {initialMora}", initialMora);
}
captureRegion.dispose();
}
}
// 多页购买
for (let i = 0; i < npcData[npcName].page; i++) {
log.info("购买列表: {goods}", [...tempGoods].join(", "));
// 获取一张截图
let captureRegion = captureGameRegion();
// 记录已经购买的物品
let boughtGoods = new Set([]);
// 匹配商品
for (let item of tempGoods) {
let resList = captureRegion.FindMulti(goodsData[item].ro);
for (let res of resList) {
log.info("找到物品: {i} 位置({x},{y},{h},{w})", goodsData[item].name, res.x, res.y, res.width, res.height);
// 移除已购买的物品
boughtGoods.add(item);
// 点击商品
click(res.x * 2 + res.width, res.y * 2 + res.height);
if (await qucikBuy()) {
log.info("购买成功: {item}", goodsData[item].name);
await sleep(500);
// 重新截图
captureRegion = captureGameRegion();
if (maxMora !== null && initialMora !== null) {
// 识别当前摩拉数值
let mora = await getMora(captureRegion);
if (mora === null) {
log.info("无法识别摩拉数值,继续购买下一件商品");
}
let currentSpent = initialMora - mora;
log.info(`当前摩拉已花费: ${currentSpent},剩余预算: ${maxMora - currentSpent}`);
if (currentSpent >= maxMora) {
log.info("已达到最大使用摩拉数值,停止购买");
captureRegion.dispose();
return true;
}
} else {
log.info("未设置最大摩拉数值,继续购买下一件商品");
}
}
else {
log.info("购买失败: {item}, 背包已经满或商品已售罄", goodsData[item].name);
}
}
}
captureRegion.dispose();
// 从已购买物品中移除
tempGoods = tempGoods.filter(item => !boughtGoods.has(item));
// 若不是最后一页且还有未购买的物品
if (tempGoods.length > 0 && i !== npcData[npcName].page - 1) {
log.info("切换到下一页商品");
await nextGoodsPage();
// 最后一次切换界面, 等待UI回弹
if (i === npcData[npcName].page - 2) {
log.info("等待界面回弹");
await sleep(500);
}
}
return false;
}
}
// 初始化NPC商品
async function initNpcData() {
for (let [key, npc] of Object.entries(npcData)) {
// 翻译物品名称
let npcGoods = new Set([]);
Object.entries(npc.goods).forEach(([count, item]) => {
npcGoods.add(translationList[item]);
});
// 筛选已启用的商品
npc.enableGoods = [...enableGoods].filter(item => npcGoods.has(item));
// 如果没有启用的商品, 则不启用该NPC
if (npc.enableGoods.length === 0) {
npc.enable = false;
}
}
}
// 加载识别对象
async function initRo() {
try {
// 加载识别对象
for (let [key, item] of Object.entries(goodsData)) {
// 填充中英文对照表
translationList[item.name] = item.id;
// 判断启动商品、加载识别对象
if (settings[item.id]) {
enableGoods.add(item.id);
item.ro = RecognitionObject.TemplateMatch(file.ReadImageMatSync(item.file));
item.ro.Threshold = 0.75;
item.ro.Use3Channels = true;
}
}
// 加载其他识别对象
for (let [key, item] of Object.entries(othrtRo)) {
item.ro = RecognitionObject.TemplateMatch(file.ReadImageMatSync(item.file));
item.ro.Threshold = 0.85;
}
return true;
}
catch (error) {
log.error("加载识别对象时发生错误: {error}", error.message);
throw error;
}
}
(async function () {
// ==================== 初始化识别对象 ====================
await initRo();
log.info("识别对象初始化完成");
// ==================== 初始化NPC数据 ====================
await initNpcData();
log.info("NPC数据初始化完成");
// ==================== 自动购买 ====================
for (let [key, npc] of Object.entries(npcData)) {
if (npc.enable) {
await genshin.returnMainUi();
log.info("开始购买NPC: {npcName}", npc.name);
// 设置游戏时间
if (npc.time === "night") {
await setTime(20, 0); // 设置为晚上8点
}
else if (npc.time === "day") {
await setTime(8, 0); // 设置为早上8点
}
await autoPath(npc.path);
await spikChat(npc.name);
const needStop = await buyGoods(key);
// 返回主界面
await genshin.returnMainUi();
log.info("完成购买NPC: {npcName}", npc.name);
if (needStop) {
log.info("达到最大使用摩拉数值,停止后续购买");
break;
}
}
else {
log.info("跳过未启用的NPC: {npcName}", npc.name);
}
}
})();

View File

@@ -0,0 +1,22 @@
{
"manifest_version": 1,
"name": "购买NPC食材-图像识别",
"version": "2.0.4",
"description": "原食脚本: 基于图像识别的购买NPC商品, 可选择性购买商品, 按地区顺序购买, 节省大量时间.",
"authors": [
{
"name": "听雨♪",
"links": "https://github.com/TingYu-lulumi"
},
{
"name": "蜜柑魚",
"links": "https://github.com/this-Fish"
}
],
"tags": [
"购买食材",
"图像识别"
],
"settings_ui": "settings.json",
"main": "main.js"
}

View File

@@ -0,0 +1,122 @@
[
{
"name": "salt",
"type": "checkbox",
"label": "盐",
"default": true
},
{
"name": "pepper",
"type": "checkbox",
"label": "胡椒",
"default": true
},
{
"name": "onion",
"type": "checkbox",
"label": "洋葱",
"default": true
},
{
"name": "milk",
"type": "checkbox",
"label": "牛奶",
"default": true
},
{
"name": "tomato",
"type": "checkbox",
"label": "番茄",
"default": true
},
{
"name": "potato",
"type": "checkbox",
"label": "土豆",
"default": true
},
{
"name": "wheat",
"type": "checkbox",
"label": "小麦",
"default": true
},
{
"name": "rice",
"type": "checkbox",
"label": "稻米",
"default": true
},
{
"name": "shrimp",
"type": "checkbox",
"label": "虾仁",
"default": true
},
{
"name": "almond",
"type": "checkbox",
"label": "杏仁",
"default": true
},
{
"name": "cabbage",
"type": "checkbox",
"label": "卷心菜",
"default": true
},
{
"name": "tofu",
"type": "checkbox",
"label": "豆腐",
"default": true
},
{
"name": "fish",
"type": "checkbox",
"label": "鱼肉",
"default": true
},
{
"name": "crab",
"type": "checkbox",
"label": "螃蟹",
"default": true
},
{
"name": "coffeeBeans",
"type": "checkbox",
"label": "咖啡豆",
"default": true
},
{
"name": "glabrousBeans",
"type": "checkbox",
"label": "秃秃豆",
"default": true
},
{
"name": "rawMeat",
"type": "checkbox",
"label": "兽肉",
"default": true
},
{
"name": "fermentedJuice",
"type": "checkbox",
"label": "发酵果实汁",
"default": true
},
{
"name": "fonta",
"type": "checkbox",
"label": "苏乐达(枫达)",
"default": true
},
{
"name": "_maxMora",
"type": "input-text",
"label": "最大使用摩拉(留空不限制)",
"default": ""
}
]

View File

@@ -0,0 +1,51 @@
# 爱可菲厨艺机关
## 项目简介
本脚本用于自动操作爱可菲厨艺机关,通过芭芭拉的攻击动作为机关充能,实现自动获取料理的功能。脚本支持周期性执行,可根据需要设置为每周一执行或每天执行。
## 作者信息
- **作者**LCB-茶包
- **联系方式**QQ 119996800
## 使用说明
### 必要配置
1. **队伍设置**(必填):使用前请在配置中设置要切换的队伍,否则脚本会自动结束任务
2. **队伍编排**:请确保切换的队伍中:
- 3号位爱可菲
- 4号位芭芭拉
### 执行模式
- **周一执行**(推荐):选择"是",脚本会自动判断是否为星期一从而执行
- 爱可菲厨艺机关每周限制10个料理周一更新CD
- 直接加入调度器即可自动运行
- **每天执行**:选择"每天执行"为每次都执行
- **禁用模式**:选择"否"为禁用脚本
### 功能特性
- **自动检测**脚本会自动判断是否获得10个料理后自动退出
- **时间控制**一般60秒完成最大超时默认100秒可自定义配置
- **多账号支持**支持UID禁用模式可设置不执行的UID
- 格式:用 `/` 分隔多个UID`12345/99999`
- 适用于多个账号但部分账号没有爱可菲的情况
## 技术原理
脚本通过芭芭拉的攻击动作为爱可菲厨艺机关充能,实现自动化料理制作过程。
## 注意事项
- 脚本可能存在误差,建议在测试环境中先行验证
- 执行时间受网络环境和设备性能影响
## 反馈与支持
如遇到错误或问题,请联系:
- QQ119996800
## 更新日志
### v1.3 (2025-05-12)
- 更改UID识别方法适配原神UI改变
- 修改超时默认时间
### v1.2 (2025-05-10)
- 首次发布版本

View File

@@ -0,0 +1,184 @@
(async function () {
//初始化配置======================================================================================
var actiontime = settings.actiontime != undefined && ~~settings.actiontime > 0 ? ~~settings.actiontime : 150;
var TEAM
var AKF = settings.AKF !== undefined ? (
settings.AKF === "是" ? 1 :
settings.AKF === "否" ? 0 :
settings.AKF === "每天执行" ? 2
: 0 ) : 0; // 如果settings.AKF完全未定义也赋予AKF为0
/**
* 文字OCR识别封装函数测试中未封装完成后续会优化逻辑
* @param text 要识别的文字,默认为"空参数"
* @param timeout 超时时间单位为秒默认为10秒
* @param afterBehavior 点击模式0表示不点击1表示点击识别到文字的位置2表示输出模式默认为0
* @param debugmodel 调试代码0表示输入判断模式1表示输出位置信息2表示输出判断模式默认为0
* @param x OCR识别区域的起始X坐标默认为0
* @param y OCR识别区域的起始Y坐标默认为0
* @param w OCR识别区域的宽度默认为1920
* @param h OCR识别区域的高度默认为1080
* @returns 包含识别结果的对象,包括识别的文字、坐标和是否找到的结果
*/
async function textOCR(text="空参数",timeout=10,afterBehavior=0,debugmodel=0,x=0,y=0,w=1920,h=1080) {
const startTime = new Date();
var Outcheak = 0
for (var ii = 0; ii < 10; ii++)
{
// 获取一张截图
var captureRegion = captureGameRegion();
var res1
var res2
var conuntcottimecot=1;
var conuntcottimecomp=1;
// 对整个区域进行 OCR
var resList = captureRegion.findMulti(RecognitionObject.ocr(x,y,w,h));
captureRegion.dispose();
//log.info("OCR 全区域识别结果数量 {len}", resList.count);
if (resList.count !== 0) {
for (let i = 0; i < resList.count; i++)
{ // 遍历的是 C# 的 List 对象,所以要用 count而不是 length
let res = resList[i];
res1=res.text
conuntcottimecomp++;
if (res.text.includes(text) && debugmodel ==3 ) {return result = { text: res.text, x: res.x, y: res.y, found: true };}
if (res.text.includes(text) && debugmodel !==2 ) {
conuntcottimecot ++;
log.info(`${res1}”找到`);
if (debugmodel===1 & x===0 & y===0){log.info("全图代码位置:({x},{y},{h},{w})", res.x-10, res.y-10, res.width+10, res.Height+10);}else{log.info("文本OCR完成'{text}'", res.text);}
if (afterBehavior===1){log.info("点击模式:开");await sleep(1000);click(res.x, res.y);}else{if (debugmodel===1 & x===0 & y===0){log.info("点击模式:关")}}
if (afterBehavior===2){log.info("F模式:开");await sleep(100);keyPress("F");}else{if (debugmodel===1 & x===0 & y===0){log.info("F模式:关");}}
if (conuntcottimecot>=conuntcottimecomp/2){return result = { text: res.text, x: res.x, y: res.y, found: true };}else{return result = { found: false};}
}
if (debugmodel ===2 ){
if (res1 === res2){conuntcottimecot ++;res2=res1;}
//log.info("输出模式:全图代码位置:({x},{y},{h},{w},{string})", res.x-10, res.y-10, res.width+10, res.Height+10, res.text);
if (Outcheak===1){ if (conuntcottimecot>=conuntcottimecomp/2){return result = { text: res.text, x: res.x, y: res.y, found: true };}else{return result = { found: false};}}
}}}
const NowTime = new Date();
if ((NowTime - startTime)>timeout*1000){if (debugmodel===2){ if (resList.count === 0){return result = {found: false};} else{Outcheak=1;ii=2;} } else {Outcheak=0;if (debugmodel===1 & x===0 & y===0){log.info(`${timeout}秒超时退出,"${text}"未找到`)};return result = {found: false };}}
else{ii=2;if (debugmodel===1 & x===0 & y===0){log.info(`"${text}"识别中……`); } }
await sleep(100);
}
}
/**======================================================================================
* 执行质变仪的部署动作未找到质变仪时返回false结束找到质变仪时返回true
*/
async function deployTransformer(){
await genshin.SwitchParty(TEAM); //切换到指定队伍必须进行配置4号位放芭芭拉
await sleep(1000);
await keyPress("3");
await sleep(1200);
await keyDown("e");
await sleep(1000);
await keyUp("e");
await sleep(1000);
return true;
}
/**======================================================================================
* 执行芭芭拉攻击指令,并等待质变仪完成提示出现。 若超时则强制结束流程。
*/
async function executeAttack(){
await sleep(1000);
await keyPress("4");
await sleep(1200);
await middleButtonClick();
await sleep(1000);
log.info(`攻击动作开始,${actiontime}秒后超时退出一般120秒左右完成`)
var startTime = new Date();
await sleep(500);
var NowTime = new Date();
//芭芭拉攻击指令,等待质变仪完成提示出现,若超时则强制结束流程。
var getshu = 0;
var lastIncrementTime = 0; // 上次增加getshu的时间
const intervalTime = 3000; // 3秒的时间间隔单位为毫秒
while ((NowTime - startTime)<actiontime*1000){
const result = await textOCR("获得", 0.2, 0, 3, 159, 494, 75, 44);
if (result.found) {
const currentTime = new Date().getTime();
if (currentTime - lastIncrementTime >= intervalTime) {
getshu++;
lastIncrementTime = currentTime;
log.warn(`获得料理数量: ${getshu}`);
if (getshu >= 10) {
log.warn("获得料理数量已达10结束流程");
await genshin.returnMainUi(); // 提前退出循环
return true;
}
}
}
leftButtonClick();
await sleep(50);
NowTime = new Date();
}
await genshin.returnMainUi();
throw new Error(`${actiontime}秒攻击动作超时,结束流程!`);
}
let nowuidString = settings.nowuid ? settings.nowuid : "";
// UID获取存在概率不成功慎用请更换背景纯色的名片提高OCR成功率
let uidNumbers = nowuidString.match(/\d+/g);
if (nowuidString) {
log.debug(`DEBUG:${uidNumbers}`);//调试LOG
await genshin.returnMainUi();
await keyPress("VK_ESCAPE");
await sleep(500);
if (uidNumbers && uidNumbers.length > 0) {
// 使用 for...of 循环遍历 uidNumbers 数组
for (let number of uidNumbers) {
var UIDnow = number;
log.debug(`DEBUG:${UIDnow}`);
let UIDD = await textOCR(UIDnow, 1, 0, 0, 112,177, 190, 39);
if (UIDD.found) {
await genshin.returnMainUi();
throw new Error(`UID "${UIDnow}" 已被禁用,停止刷取!`);
}
}
}
}else{log.warn("未配置禁用UID继续进行");}
//main/======================================================================================
await genshin.returnMainUi();
//检查用户是否配置队伍============================================
if (settings.TEAMname === undefined) {
throw new Error("必填请在配置页面填写队伍名称3号为爱可菲4号位芭芭拉"); // 没选就报错后停止
}else{TEAM = settings.TEAMname}
//爱可菲厨艺机关
try {
var AKFevry = 0;
if (AKF == 2){AKF = 1;AKFevry = 1;}
if (AKF == 1){
const today = new Date();
// 判断是否为周一getDay()返回0-61代表周一
if (today.getDay() == 1 || AKFevry == 1) {
log.info("执行爱可菲烹饪任务");
if ((await deployTransformer())) {//部署厨艺机关
log.info("厨艺机关部署成功!");
}
if ((await executeAttack())) {//芭芭拉攻击指令流程
log.info("爱可菲烹饪任务执行完成,结束!!");
}
}else{
log.info("不执行爱可菲烹饪任务");
}
}else{
log.info("爱可菲烹饪任务禁用");
}
} catch (error) {
log.error(`执行过程中发生错误:${error.message}`);
} finally {
await genshin.returnMainUi();
}
//main/**======================================================================================
})();

View File

@@ -0,0 +1,18 @@
{
"manifest_version": 1,
"name": "爱可菲自动化",
"version": "1.4",
"bgi_version": "0.44.0",
"description": "爱可菲厨艺机关自动化请注意说明文件如有BUG请联系作者QQ:119996800",
"tags": [
"爱可菲"
],
"authors": [
{
"name": "LCB-茶包",
"links": "https://github.com/kaedelcb"
}
],
"settings_ui": "settings.json",
"main": "main.js"
}

View File

@@ -0,0 +1,30 @@
[
{
"name": "TEAMname",
"type": "input-text",
"label": "必填队伍名称3号为爱可菲4号位芭芭拉"
},
{
"name": "AKF",
"type": "select",
"label": "选题,默认每天执行,可选是:周一执行,否为不执行",
"options": [
"是",
"否",
"每天执行"
]
},
{
"name": "actiontime",
"type": "input-text",
"label": "选填爱可菲厨艺机关超时默认150秒",
"default": "150"
},
{
"name": "nowuid",
"type": "input-text",
"label": "慎用,禁止特定执行脚本,用 / 隔开如12345/99999"
}
]

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 547 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 515 B

View File

@@ -0,0 +1,44 @@
{
"info": {
"authors": [],
"bgi_version": "0.50.0",
"description": "",
"enable_monster_loot_split": false,
"last_modified_time": 1757733962848,
"map_match_method": "",
"map_name": "Teyvat",
"name": "挪德卡莱杂货铺采若",
"tags": [],
"type": "collect",
"version": "1.0"
},
"positions": [
{
"action": "",
"action_params": "",
"id": 1,
"move_mode": "walk",
"type": "teleport",
"x": 9458.03515625,
"y": 1660.6650390625
},
{
"action": "",
"action_params": "",
"id": 2,
"move_mode": "dash",
"type": "path",
"x": 9453.361328125,
"y": 1639.97607421875
},
{
"action": "",
"action_params": "",
"id": 3,
"move_mode": "walk",
"type": "target",
"x": 9449.888671875,
"y": 1637.666015625
}
]
}

View File

@@ -0,0 +1,58 @@
{
"info": {
"name": "枫丹咖啡厅露泽店主阿鲁埃",
"type": "collect",
"author": "吉吉喵",
"version": "1.0",
"description": "咖啡豆",
"bgi_version": "0.42.3"
},
"positions": [
{
"id": 1,
"x": 4649.4873046875,
"y": 3467.8935546875,
"action": "",
"move_mode": "walk",
"action_params": "",
"type": "teleport"
},
{
"id": 2,
"x": 4627.564453125,
"y": 3470.357421875,
"action": "",
"move_mode": "walk",
"action_params": "",
"type": "path"
},
{
"id": 3,
"x": 4604.40869140625,
"y": 3510.25,
"action": "stop_flying",
"move_mode": "fly",
"action_params": "",
"type": "path"
},
{
"id": 4,
"x": 4600.888671875,
"y": 3514.0810546875,
"action": "",
"move_mode": "walk",
"action_params": "",
"type": "target",
"locked": false
},
{
"id": 5,
"x": 4599.888671875,
"y": 3516.081054687501,
"action": "",
"move_mode": "walk",
"action_params": "",
"type": "orientation"
}
]
}

View File

@@ -0,0 +1,40 @@
{
"info": {
"name": "枫丹达莫维百货店主布希柯",
"type": "collect",
"author": "吉吉喵",
"version": "1.0",
"description": "杂货",
"bgi_version": "0.35.1"
},
"positions": [
{
"id": 1,
"action": "",
"move_mode": "walk",
"type": "teleport",
"x": 4514.18,
"y": 3630.4,
"action_params": "",
"locked": false
},
{
"id": 2,
"x": 4514.2802734375,
"y": 3604.35498046875,
"type": "path",
"move_mode": "fly",
"action": "stop_flying",
"action_params": ""
},
{
"id": 3,
"x": 4470.1357421875,
"y": 3562.072265625,
"type": "path",
"move_mode": "fly",
"action": "",
"action_params": ""
}
]
}

View File

@@ -0,0 +1,55 @@
{
"info": {
"name": "璃月万民堂老板卯师傅",
"type": "collect",
"author": "吉吉喵",
"version": "",
"description": "璃月万民堂老板卯师傅备选",
"bgi_version": "0.42.3"
},
"positions": [
{
"id": 1,
"x": 267.9150390625,
"y": -665.1591796875,
"action": "",
"move_mode": "walk",
"type": "teleport",
"locked": false
},
{
"id": 2,
"x": 232.9345703125,
"y": -663.775390625,
"action": "",
"move_mode": "walk",
"type": "path"
},
{
"id": 3,
"x": 231.1435546875,
"y": -671.79248046875,
"action": "",
"move_mode": "walk",
"type": "target",
"locked": false
},
{
"id": 4,
"x": 226.2607421875,
"y": -672.33740234375,
"action": "",
"move_mode": "walk",
"type": "target",
"locked": false
},
{
"id": 5,
"x": 227.591796875,
"y": -671.0654296875,
"action": "",
"move_mode": "walk",
"type": "target"
}
]
}

View File

@@ -0,0 +1,37 @@
{
"info": {
"name": "璃月万民堂老板卯师傅",
"type": "collect",
"author": "吉吉喵",
"version": "",
"description": "鱼肉+螃蟹",
"bgi_version": "0.42.3"
},
"positions": [
{
"id": 1,
"x": 267.9150390625,
"y": -665.1591796875,
"action": "",
"move_mode": "walk",
"type": "teleport",
"locked": false
},
{
"id": 2,
"x": 228.953125,
"y": -663.4853515625,
"action": "",
"move_mode": "walk",
"type": "path"
},
{
"id": 3,
"x": 227.083984375,
"y": -668.10791015625,
"action": "",
"move_mode": "walk",
"type": "target"
}
]
}

View File

@@ -0,0 +1,28 @@
{
"info": {
"name": "璃月荣发商铺店主东升",
"type": "collect",
"author": "吉吉喵",
"version": "1.0",
"description": "杂货",
"bgi_version": "0.42.0"
},
"positions": [
{
"id": 1,
"action": "force_tp",
"move_mode": "walk",
"type": "teleport",
"x": 267.92,
"y": -665.01
},
{
"id": 2,
"x": 256.9208984375,
"y": -682.560546875,
"type": "path",
"move_mode": "walk",
"action": ""
}
]
}

View File

@@ -0,0 +1,36 @@
{
"info": {
"name": "稻妻九十九物店主葵",
"type": "collect",
"author": "吉吉喵",
"version": "1.0",
"description": "杂货",
"bgi_version": "0.42.0"
},
"positions": [
{
"id": 1,
"action": "force_tp",
"move_mode": "walk",
"type": "teleport",
"x": -4402.56,
"y": -3052.88
},
{
"id": 2,
"x": -4409.03125,
"y": -3067.2666015625,
"type": "path",
"move_mode": "walk",
"action": ""
},
{
"id": 3,
"x": -4403.646484375,
"y": -3072.0263671875,
"type": "path",
"move_mode": "walk",
"action": ""
}
]
}

View File

@@ -0,0 +1,44 @@
{
"info": {
"name": "稻妻志村屋店主志村堪兵卫",
"type": "collect",
"author": "吉吉喵",
"version": "1.0",
"description": "鱼肉+螃蟹",
"bgi_version": "0.42.0"
},
"positions": [
{
"id": 1,
"action": "force_tp",
"move_mode": "walk",
"type": "teleport",
"x": -4402.56,
"y": -3052.88
},
{
"id": 2,
"x": -4409.03125,
"y": -3067.2666015625,
"type": "path",
"move_mode": "walk",
"action": ""
},
{
"id": 3,
"x": -4421.849609375,
"y": -3084.564453125,
"type": "path",
"move_mode": "walk",
"action": ""
},
{
"id": 4,
"x": -4425.07421875,
"y": -3082.072265625,
"type": "target",
"move_mode": "walk",
"action": ""
}
]
}

View File

@@ -0,0 +1,57 @@
{
"info": {
"name": "纳塔杂货铺布纳马",
"type": "collect",
"authors": [
{
"name": "芝士贝果"
}
],
"version": "1.0",
"description": "",
"map_name": "Teyvat",
"bgi_version": "0.47.3",
"tags": [],
"last_modified_time": 1754489424074,
"enable_monster_loot_split": false,
"map_match_method": ""
},
"positions": [
{
"id": 1,
"action": "",
"move_mode": "walk",
"type": "teleport",
"x": 9060.5419921875,
"y": -1847.5107421875,
"action_params": ""
},
{
"id": 2,
"x": 9089.0361328125,
"y": -1852.42919921875,
"type": "path",
"move_mode": "walk",
"action": "",
"action_params": ""
},
{
"id": 3,
"x": 9088.6552734375,
"y": -1856.89306640625,
"type": "target",
"move_mode": "walk",
"action": "",
"action_params": ""
},
{
"id": 4,
"x": 9089.8935546875,
"y": -1857.2724609375,
"type": "target",
"move_mode": "walk",
"action": "",
"action_params": ""
}
]
}

View File

@@ -0,0 +1,36 @@
{
"info": {
"name": "蒙德百货销售员布兰琪",
"type": "collect",
"author": "吉吉喵",
"version": "1.0",
"description": "杂货",
"bgi_version": "0.42.3"
},
"positions": [
{
"id": 1,
"x": -867.693359375,
"y": 2281.393310546875,
"action": "",
"move_mode": "walk",
"type": "teleport"
},
{
"id": 2,
"x": -886.5966796875,
"y": 2259.00244140625,
"action": "",
"move_mode": "walk",
"type": "path"
},
{
"id": 3,
"x": -894.9638671875,
"y": 2264.875244140625,
"action": "",
"move_mode": "walk",
"type": "target"
}
]
}

View File

@@ -0,0 +1,70 @@
{
"info": {
"name": "须弥城普斯帕咖啡馆代理店长恩忒卡",
"type": "collect",
"author": "吉吉喵",
"version": "",
"description": "咖啡",
"bgi_version": "0.42.3"
},
"positions": [
{
"id": 1,
"x": 2789.4375,
"y": -492.34375,
"action": "",
"move_mode": "walk",
"type": "teleport"
},
{
"id": 2,
"x": 2789.125,
"y": -488.28125,
"action": "",
"move_mode": "walk",
"type": "path"
},
{
"id": 3,
"x": 2772.20703125,
"y": -477.16259765625,
"action": "",
"move_mode": "walk",
"type": "path"
},
{
"id": 4,
"x": 2770.71875,
"y": -465.90625,
"action": "",
"move_mode": "walk",
"action_params": "",
"type": "path"
},
{
"id": 5,
"x": 2765.1025390625,
"y": -459.37548828125,
"action": "",
"move_mode": "walk",
"type": "path"
},
{
"id": 6,
"x": 2745.6875,
"y": -462.09375,
"action": "",
"move_mode": "walk",
"type": "path"
},
{
"id": 7,
"x": 2743.4736328125,
"y": -470.27734375,
"action": "combat_script",
"move_mode": "walk",
"action_params": "wait(0.5),keypress(F),wait(6),keydown(W),keypress(SPACE),wait(0.5),keypress(SPACE),wait(0.5),keypress(SPACE),wait(0.5),keypress(SPACE),wait(0.5),keypress(SPACE),wait(0.5),keypress(SPACE),wait(0.5),keypress(SPACE),wait(0.5),keypress(SPACE),wait(0.5),keypress(SPACE),wait(0.5),keypress(SPACE),wait(0.5),keypress(SPACE),wait(0.5),keypress(SPACE),wait(0.5),keypress(SPACE),wait(0.5),keypress(SPACE),wait(0.5),keypress(SPACE),wait(0.5),keypress(SPACE),wait(0.5),keypress(SPACE),wait(0.5),keypress(SPACE),wait(0.5),keypress(SPACE),wait(0.5),keypress(SPACE),wait(0.5),keypress(SPACE),keyup(W)",
"type": "path"
}
]
}

View File

@@ -0,0 +1 @@
{"info":{"name":"","type":""},"positions":[{"x":2788.5654296875,"y":-506.36279296875,"type":"teleport","move_mode":"walk"},{"x":2792.4580078125,"y":-519.3681640625,"type":"path","move_mode":"walk"},{"x":2799.9716796875,"y":-520.26806640625,"type":"path","move_mode":"walk"},{"x":2810.134765625,"y":-511.20947265625,"type":"path","move_mode":"walk"}]}

View File

@@ -0,0 +1,28 @@
{
"info": {
"name": "须弥奥摩斯港鱼贩布特罗斯",
"type": "collect",
"author": "吉吉喵",
"version": "",
"description": "鱼肉+螃蟹",
"bgi_version": "0.42.3"
},
"positions": [
{
"id": 1,
"x": 2679.8427734375,
"y": -1935.0341796875,
"action": "",
"move_mode": "walk",
"type": "teleport"
},
{
"id": 2,
"x": 2658.712890625,
"y": -1930.0478515625,
"action": "",
"move_mode": "walk",
"type": "target"
}
]
}

View File

@@ -0,0 +1,60 @@
{
"info": {
"name": "须弥杂货铺哈马维",
"type": "collect",
"author": "芝士贝果",
"version": "1.0",
"description": "",
"map_name": "Teyvat",
"bgi_version": "0.45.0",
"tags": [],
"last_modified_time": 1753610573272
},
"positions": [
{
"id": 1,
"action": "",
"move_mode": "walk",
"type": "teleport",
"x": 2787.0009765625,
"y": -503.10791015625,
"action_params": ""
},
{
"id": 2,
"x": 2786.90234375,
"y": -486.3369140625,
"type": "path",
"move_mode": "walk",
"action": "",
"action_params": ""
},
{
"id": 3,
"x": 2769.814453125,
"y": -476.9345703125,
"type": "path",
"move_mode": "walk",
"action": "",
"action_params": ""
},
{
"id": 4,
"x": 2765.4072265625,
"y": -446.25,
"type": "path",
"move_mode": "walk",
"action": "",
"action_params": ""
},
{
"id": 5,
"x": 2778.7431640625,
"y": -430.505859375,
"type": "target",
"move_mode": "walk",
"action": "",
"action_params": ""
}
]
}

View File

@@ -0,0 +1 @@
{"info":{"name":"","type":""},"positions":[{"x":4095.98828125,"y":-2025.9638671875,"type":"teleport","move_mode":"walk"},{"x":4099.64013671875,"y":-2010.21337890625,"type":"path","move_mode":"walk"},{"x":4095.404296875,"y":-1997.890625,"type":"path","move_mode":"walk"},{"x":4099.6630859375,"y":-1978.88427734375,"type":"path","move_mode":"walk"},{"x":4091.326171875,"y":-1980.173828125,"type":"path","move_mode":"walk"}]}

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

View File

@@ -0,0 +1,58 @@
{
"info": {
"name": "咖啡厅露泽店主阿鲁埃",
"type": "collect",
"author": "吉吉喵",
"version": "1.0",
"description": "",
"bgi_version": "0.42.3"
},
"positions": [
{
"id": 1,
"x": 4649.4873046875,
"y": 3467.8935546875,
"action": "",
"move_mode": "walk",
"action_params": "",
"type": "teleport"
},
{
"id": 2,
"x": 4627.564453125,
"y": 3470.357421875,
"action": "",
"move_mode": "walk",
"action_params": "",
"type": "path"
},
{
"id": 3,
"x": 4604.40869140625,
"y": 3510.25,
"action": "stop_flying",
"move_mode": "fly",
"action_params": "",
"type": "path"
},
{
"id": 4,
"x": 4600.888671875,
"y": 3514.0810546875,
"action": "",
"move_mode": "walk",
"action_params": "",
"type": "target",
"locked": false
},
{
"id": 5,
"x": 4599.888671875,
"y": 3516.081054687501,
"action": "",
"move_mode": "walk",
"action_params": "",
"type": "orientation"
}
]
}

View File

@@ -0,0 +1,58 @@
{
"info": {
"name": "枫丹咖啡厅露泽店主阿鲁埃",
"type": "collect",
"author": "吉吉喵",
"version": "1.0",
"description": "咖啡豆",
"bgi_version": "0.42.3"
},
"positions": [
{
"id": 1,
"x": 4649.4873046875,
"y": 3467.8935546875,
"action": "",
"move_mode": "walk",
"action_params": "",
"type": "teleport"
},
{
"id": 2,
"x": 4627.564453125,
"y": 3470.357421875,
"action": "",
"move_mode": "walk",
"action_params": "",
"type": "path"
},
{
"id": 3,
"x": 4604.40869140625,
"y": 3510.25,
"action": "stop_flying",
"move_mode": "fly",
"action_params": "",
"type": "path"
},
{
"id": 4,
"x": 4600.888671875,
"y": 3514.0810546875,
"action": "",
"move_mode": "walk",
"action_params": "",
"type": "target",
"locked": false
},
{
"id": 5,
"x": 4599.888671875,
"y": 3516.081054687501,
"action": "",
"move_mode": "walk",
"action_params": "",
"type": "orientation"
}
]
}

View File

@@ -0,0 +1,40 @@
{
"info": {
"name": "达莫维百货店主布希柯",
"type": "collect",
"author": "吉吉喵",
"version": "1.0",
"description": "达莫维百货 店主布希柯",
"bgi_version": "0.35.1"
},
"positions": [
{
"id": 1,
"action": "",
"move_mode": "walk",
"type": "teleport",
"x": 4514.18,
"y": 3630.4,
"action_params": "",
"locked": false
},
{
"id": 2,
"x": 4514.2802734375,
"y": 3604.35498046875,
"type": "path",
"move_mode": "fly",
"action": "stop_flying",
"action_params": ""
},
{
"id": 3,
"x": 4470.1357421875,
"y": 3562.072265625,
"type": "path",
"move_mode": "fly",
"action": "",
"action_params": ""
}
]
}

View File

@@ -0,0 +1,40 @@
{
"info": {
"name": "枫丹达莫维百货店主布希柯",
"type": "collect",
"author": "吉吉喵",
"version": "1.0",
"description": "杂货",
"bgi_version": "0.35.1"
},
"positions": [
{
"id": 1,
"action": "",
"move_mode": "walk",
"type": "teleport",
"x": 4514.18,
"y": 3630.4,
"action_params": "",
"locked": false
},
{
"id": 2,
"x": 4514.2802734375,
"y": 3604.35498046875,
"type": "path",
"move_mode": "fly",
"action": "stop_flying",
"action_params": ""
},
{
"id": 3,
"x": 4470.1357421875,
"y": 3562.072265625,
"type": "path",
"move_mode": "fly",
"action": "",
"action_params": ""
}
]
}

View File

@@ -0,0 +1,3 @@
{"macroEvents":[{"type":6,"mouseX":0,"mouseY":-120,"time":0},
{"type":6,"mouseX":0,"mouseY":0,"time":100}],
"info":{"name":"","description":"","x":0,"y":0,"width":1920,"height":1080,"recordDpi":1}}

View File

@@ -0,0 +1,55 @@
{
"info": {
"name": "璃月万民堂老板卯师傅",
"type": "collect",
"author": "吉吉喵",
"version": "",
"description": "璃月万民堂老板卯师傅备选",
"bgi_version": "0.42.3"
},
"positions": [
{
"id": 1,
"x": 267.9150390625,
"y": -665.1591796875,
"action": "",
"move_mode": "walk",
"type": "teleport",
"locked": false
},
{
"id": 2,
"x": 232.9345703125,
"y": -663.775390625,
"action": "",
"move_mode": "walk",
"type": "path"
},
{
"id": 3,
"x": 231.1435546875,
"y": -671.79248046875,
"action": "",
"move_mode": "walk",
"type": "target",
"locked": false
},
{
"id": 4,
"x": 226.2607421875,
"y": -672.33740234375,
"action": "",
"move_mode": "walk",
"type": "target",
"locked": false
},
{
"id": 5,
"x": 227.591796875,
"y": -671.0654296875,
"action": "",
"move_mode": "walk",
"type": "target"
}
]
}

View File

@@ -0,0 +1,37 @@
{
"info": {
"name": "璃月万民堂老板卯师傅",
"type": "collect",
"author": "吉吉喵",
"version": "",
"description": "璃月万民堂老板卯师傅",
"bgi_version": "0.42.3"
},
"positions": [
{
"id": 1,
"x": 267.9150390625,
"y": -665.1591796875,
"action": "",
"move_mode": "walk",
"type": "teleport",
"locked": false
},
{
"id": 2,
"x": 228.953125,
"y": -663.4853515625,
"action": "",
"move_mode": "walk",
"type": "path"
},
{
"id": 3,
"x": 227.083984375,
"y": -668.10791015625,
"action": "",
"move_mode": "walk",
"type": "target"
}
]
}

View File

@@ -0,0 +1,37 @@
{
"info": {
"name": "璃月万民堂老板卯师傅",
"type": "collect",
"author": "吉吉喵",
"version": "",
"description": "鱼肉+螃蟹",
"bgi_version": "0.42.3"
},
"positions": [
{
"id": 1,
"x": 267.9150390625,
"y": -665.1591796875,
"action": "",
"move_mode": "walk",
"type": "teleport",
"locked": false
},
{
"id": 2,
"x": 228.953125,
"y": -663.4853515625,
"action": "",
"move_mode": "walk",
"type": "path"
},
{
"id": 3,
"x": 227.083984375,
"y": -668.10791015625,
"action": "",
"move_mode": "walk",
"type": "target"
}
]
}

View File

@@ -0,0 +1,28 @@
{
"info": {
"name": "璃月杂货商东升",
"type": "collect",
"author": "吉吉喵",
"version": "1.0",
"description": "购买杂货",
"bgi_version": "0.42.0"
},
"positions": [
{
"id": 1,
"action": "force_tp",
"move_mode": "walk",
"type": "teleport",
"x": 267.92,
"y": -665.01
},
{
"id": 2,
"x": 257.6142578125,
"y": -681.96826171875,
"type": "path",
"move_mode": "walk",
"action": ""
}
]
}

View File

@@ -0,0 +1,28 @@
{
"info": {
"name": "璃月荣发商铺店主东升",
"type": "collect",
"author": "吉吉喵",
"version": "1.0",
"description": "杂货",
"bgi_version": "0.42.0"
},
"positions": [
{
"id": 1,
"action": "force_tp",
"move_mode": "walk",
"type": "teleport",
"x": 267.92,
"y": -665.01
},
{
"id": 2,
"x": 256.9208984375,
"y": -682.560546875,
"type": "path",
"move_mode": "walk",
"action": ""
}
]
}

View File

@@ -0,0 +1,36 @@
{
"info": {
"name": "稻妻九十九物店主葵",
"type": "collect",
"author": "吉吉喵",
"version": "1.0",
"description": "杂货",
"bgi_version": "0.42.0"
},
"positions": [
{
"id": 1,
"action": "force_tp",
"move_mode": "walk",
"type": "teleport",
"x": -4402.56,
"y": -3052.88
},
{
"id": 2,
"x": -4409.03125,
"y": -3067.2666015625,
"type": "path",
"move_mode": "walk",
"action": ""
},
{
"id": 3,
"x": -4403.646484375,
"y": -3072.0263671875,
"type": "path",
"move_mode": "walk",
"action": ""
}
]
}

View File

@@ -0,0 +1,44 @@
{
"info": {
"name": "稻妻志村屋店主志村堪兵卫",
"type": "collect",
"author": "吉吉喵",
"version": "1.0",
"description": "鱼肉+螃蟹",
"bgi_version": "0.42.0"
},
"positions": [
{
"id": 1,
"action": "force_tp",
"move_mode": "walk",
"type": "teleport",
"x": -4402.56,
"y": -3052.88
},
{
"id": 2,
"x": -4409.03125,
"y": -3067.2666015625,
"type": "path",
"move_mode": "walk",
"action": ""
},
{
"id": 3,
"x": -4421.849609375,
"y": -3084.564453125,
"type": "path",
"move_mode": "walk",
"action": ""
},
{
"id": 4,
"x": -4425.07421875,
"y": -3082.072265625,
"type": "target",
"move_mode": "walk",
"action": ""
}
]
}

View File

@@ -0,0 +1,36 @@
{
"info": {
"name": "蒙德杂货商布兰琪",
"type": "collect",
"author": "吉吉喵",
"version": "1.0",
"description": "蒙德杂货商布兰琪",
"bgi_version": "0.42.3"
},
"positions": [
{
"id": 1,
"x": -867.693359375,
"y": 2281.393310546875,
"action": "",
"move_mode": "walk",
"type": "teleport"
},
{
"id": 2,
"x": -886.5966796875,
"y": 2259.00244140625,
"action": "",
"move_mode": "walk",
"type": "path"
},
{
"id": 3,
"x": -894.9638671875,
"y": 2264.875244140625,
"action": "",
"move_mode": "walk",
"type": "target"
}
]
}

View File

@@ -0,0 +1,36 @@
{
"info": {
"name": "蒙德百货销售员布兰琪",
"type": "collect",
"author": "吉吉喵",
"version": "1.0",
"description": "杂货",
"bgi_version": "0.42.3"
},
"positions": [
{
"id": 1,
"x": -867.693359375,
"y": 2281.393310546875,
"action": "",
"move_mode": "walk",
"type": "teleport"
},
{
"id": 2,
"x": -886.5966796875,
"y": 2259.00244140625,
"action": "",
"move_mode": "walk",
"type": "path"
},
{
"id": 3,
"x": -894.9638671875,
"y": 2264.875244140625,
"action": "",
"move_mode": "walk",
"type": "target"
}
]
}

View File

@@ -0,0 +1 @@
{"info":{"name":"","type":""},"positions":[{"x":2788.5654296875,"y":-506.36279296875,"type":"teleport","move_mode":"walk"},{"x":2792.4580078125,"y":-519.3681640625,"type":"path","move_mode":"walk"},{"x":2799.9716796875,"y":-520.26806640625,"type":"path","move_mode":"walk"},{"x":2810.134765625,"y":-511.20947265625,"type":"path","move_mode":"walk"}]}

View File

@@ -0,0 +1,28 @@
{
"info": {
"name": "须弥奥摩斯港鱼贩布特罗斯",
"type": "collect",
"author": "吉吉喵",
"version": "",
"description": "鱼肉+螃蟹",
"bgi_version": "0.42.3"
},
"positions": [
{
"id": 1,
"x": 2679.8427734375,
"y": -1935.0341796875,
"action": "",
"move_mode": "walk",
"type": "teleport"
},
{
"id": 2,
"x": 2658.712890625,
"y": -1930.0478515625,
"action": "",
"move_mode": "walk",
"type": "target"
}
]
}

View File

@@ -0,0 +1 @@
{"info":{"name":"","type":""},"positions":[{"x":4095.98828125,"y":-2025.9638671875,"type":"teleport","move_mode":"walk"},{"x":4099.64013671875,"y":-2010.21337890625,"type":"path","move_mode":"walk"},{"x":4095.404296875,"y":-1997.890625,"type":"path","move_mode":"walk"},{"x":4099.6630859375,"y":-1978.88427734375,"type":"path","move_mode":"walk"},{"x":4091.326171875,"y":-1980.173828125,"type":"path","move_mode":"walk"}]}

View File

@@ -0,0 +1,601 @@
// 定义所有食材的图像识别对象
let FengdaRo = RecognitionObject.TemplateMatch(file.ReadImageMatSync("assets/Picture/FengdaRo.png"));
let SaltRo = RecognitionObject.TemplateMatch(file.ReadImageMatSync("assets/Picture/SaltRo.png"));
let PepperRo = RecognitionObject.TemplateMatch(file.ReadImageMatSync("assets/Picture/PepperRo.png"));
let OnionRo = RecognitionObject.TemplateMatch(file.ReadImageMatSync("assets/Picture/OnionRo.png"));
let MilkRo = RecognitionObject.TemplateMatch(file.ReadImageMatSync("assets/Picture/MilkRo.png"));
let TomatoRo = RecognitionObject.TemplateMatch(file.ReadImageMatSync("assets/Picture/TomatoRo.png"));
let SpicesRo = RecognitionObject.TemplateMatch(file.ReadImageMatSync("assets/Picture/SpicesRo.png"));
let CabbageRo = RecognitionObject.TemplateMatch(file.ReadImageMatSync("assets/Picture/CabbageRo.png"));
let PotatoRo = RecognitionObject.TemplateMatch(file.ReadImageMatSync("assets/Picture/PotatoRo.png"));
let WheatRo = RecognitionObject.TemplateMatch(file.ReadImageMatSync("assets/Picture/WheatRo.png"));
let RiceRo = RecognitionObject.TemplateMatch(file.ReadImageMatSync("assets/Picture/RiceRo.png"));
let TofuRo = RecognitionObject.TemplateMatch(file.ReadImageMatSync("assets/Picture/TofuRo.png"));
let AlmondRo = RecognitionObject.TemplateMatch(file.ReadImageMatSync("assets/Picture/AlmondRo.png"));
let FishRo = RecognitionObject.TemplateMatch(file.ReadImageMatSync("assets/Picture/FishRo.png"));
let CrabRo = RecognitionObject.TemplateMatch(file.ReadImageMatSync("assets/Picture/CrabRo.png"));
let ShrimpRo = RecognitionObject.TemplateMatch(file.ReadImageMatSync("assets/Picture/ShrimpRo.png"));
let CoffeeRo = RecognitionObject.TemplateMatch(file.ReadImageMatSync("assets/Picture/CoffeeRo.png"));
let ToutuRo = RecognitionObject.TemplateMatch(file.ReadImageMatSync("assets/Picture/ToutuRo.png"));
let FermentRo = RecognitionObject.TemplateMatch(file.ReadImageMatSync("assets/Picture/FermentRo.png"));
// 定义所有可能的食材,注意料理名字长度可能超过识图范围
const ingredients = [
"枫达", "盐", "胡椒", "洋葱", "牛奶", "番茄", "香辛料", "卷心菜", "土豆", "小麦", "稻米", "豆腐", "杏仁", "鱼肉", "螃蟹", "虾仁", "咖啡豆", "秃秃豆", "发酵果实汁", "黑麦"
];
// 定义所有食材及其对应的路径文件和 NPC
const mondstadtGroceryFilePath = `assets/Pathing/蒙德百货销售员布兰琪.json`;
const liyueGroceryFilePath = `assets/Pathing/璃月荣发商铺店主东升.json`;
const liyueWanminFilePath = `assets/Pathing/璃月万民堂老板卯师傅.json`;
const groceryFilePath = `assets/Pathing/稻妻九十九物店主葵.json`;
const charcoalFilePath = `assets/Pathing/稻妻志村屋店主志村勘兵卫.json`;
const fengdanGroceryFilePath = `assets/Pathing/枫丹达莫维百货店主布希柯.json`;
const cafeLuzheFilePath = `assets/Pathing/枫丹咖啡厅露泽店主阿鲁埃.json`;
const sumiCitycafeFilePath = `assets/Pathing/须弥城咖啡馆代理店长恩忒卡.json`;
const sumiCityFishPath = `assets/Pathing/须弥城鱼贩珀姆.json`;
const sumiGroceryFilePath = `assets/Pathing/须弥杂货铺哈马维.json`;
const omosPortFishPath = `assets/Pathing/须弥奥摩斯港鱼贩布特罗斯.json`;
const azaleVillMerPath = `assets/Pathing/须弥阿如村商人阿扎莱.json`;
const natlanGroceryFilePath = `assets/Pathing/纳塔杂货铺布纳马.json`;
const nodKraiGroceryFilePath = `assets/Pathing/挪德卡莱杂货铺采若.json`;
const ingredientPaths = {
"枫达": [fengdanGroceryFilePath, cafeLuzheFilePath],
"盐": [mondstadtGroceryFilePath, liyueGroceryFilePath, groceryFilePath, sumiGroceryFilePath, fengdanGroceryFilePath, natlanGroceryFilePath, nodKraiGroceryFilePath],
"洋葱": [mondstadtGroceryFilePath, liyueGroceryFilePath, groceryFilePath, sumiGroceryFilePath, fengdanGroceryFilePath, natlanGroceryFilePath, nodKraiGroceryFilePath],
"牛奶": [mondstadtGroceryFilePath, liyueGroceryFilePath, groceryFilePath, sumiGroceryFilePath, fengdanGroceryFilePath, natlanGroceryFilePath, nodKraiGroceryFilePath],
"番茄": [mondstadtGroceryFilePath, liyueGroceryFilePath, groceryFilePath, sumiGroceryFilePath, fengdanGroceryFilePath, natlanGroceryFilePath, nodKraiGroceryFilePath],
"卷心菜": [mondstadtGroceryFilePath, liyueGroceryFilePath, groceryFilePath, sumiGroceryFilePath, fengdanGroceryFilePath, natlanGroceryFilePath, nodKraiGroceryFilePath],
"土豆": [mondstadtGroceryFilePath, liyueGroceryFilePath, groceryFilePath, sumiGroceryFilePath, fengdanGroceryFilePath, natlanGroceryFilePath, nodKraiGroceryFilePath],
"小麦": [mondstadtGroceryFilePath, liyueGroceryFilePath, groceryFilePath, sumiGroceryFilePath, fengdanGroceryFilePath, natlanGroceryFilePath, nodKraiGroceryFilePath],
"胡椒": [mondstadtGroceryFilePath, liyueGroceryFilePath, groceryFilePath, sumiGroceryFilePath, fengdanGroceryFilePath, natlanGroceryFilePath, nodKraiGroceryFilePath],
"稻米": [liyueGroceryFilePath, groceryFilePath, sumiGroceryFilePath],//
"虾仁": [liyueGroceryFilePath, groceryFilePath, sumiGroceryFilePath, sumiCityFishPath, omosPortFishPath],
"豆腐": [liyueGroceryFilePath, groceryFilePath, sumiGroceryFilePath],
"杏仁": [liyueGroceryFilePath, fengdanGroceryFilePath],
"鱼肉": [liyueWanminFilePath, charcoalFilePath, sumiCityFishPath, omosPortFishPath, azaleVillMerPath],
"螃蟹": [liyueWanminFilePath, charcoalFilePath, sumiCityFishPath, omosPortFishPath],
"秃秃豆": [fengdanGroceryFilePath, azaleVillMerPath, natlanGroceryFilePath],
"咖啡豆": [sumiCitycafeFilePath, cafeLuzheFilePath],
"香辛料": [azaleVillMerPath],
"发酵果实汁": [fengdanGroceryFilePath],
"黑麦": [nodKraiGroceryFilePath],
};
// 定义食材名称和图片文件名的映射表
const ingredientImageMap = {
"枫达": "FengdaRo.png",
"盐": "SaltRo.png",
"洋葱": "OnionRo.png",
"牛奶": "MilkRo.png",
"番茄": "TomatoRo.png",
"卷心菜": "CabbageRo.png",
"土豆": "PotatoRo.png",
"小麦": "WheatRo.png",
"胡椒": "PepperRo.png",
"稻米": "RiceRo.png",
"虾仁": "ShrimpRo.png",
"豆腐": "TofuRo.png",
"杏仁": "AlmondRo.png",
"鱼肉": "FishRo.png",
"螃蟹": "CrabRo.png",
"秃秃豆": "ToutuRo.png",
"咖啡豆": "CoffeeRo.png",
"香辛料": "SpicesRo.png",
"发酵果实汁": "FermentRo.png",
// 可以继续添加更多食材的映射
};
// 定义替换映射表
const replacementMap = {
"监": "盐",
"卵": "卯"
};
// 定义所有NPC名注意名字长度可能超过识图范围
const npcNames = {
[mondstadtGroceryFilePath]: ["布兰琪"],
[liyueGroceryFilePath]: ["东升"],
[liyueWanminFilePath]: ["卯师傅", "师傅"],// ["卯师傅", "卵师傅"]
[groceryFilePath]: ["葵"],
[charcoalFilePath]: ["志村勘"],
[fengdanGroceryFilePath]: ["布希柯"],
[cafeLuzheFilePath]: ["阿鲁埃"],
[sumiCityFishPath]: ["珀姆"],
[sumiCitycafeFilePath]: ["恩忒卡"],
[omosPortFishPath]: ["布特罗斯"],
[azaleVillMerPath]: ["阿扎莱"],
[sumiGroceryFilePath]: ["哈马维"],
[natlanGroceryFilePath]: ["布纳马"],
[nodKraiGroceryFilePath]: ["采若"],
};
// 筛选出用户选择的食材及其对应的路径文件和 NPC
let selectedIngredients = []; // 在函数外部声明一次
let selectedPaths = new Map();
for (let ingredient of ingredients) {
if (settings[ingredient]) {
selectedIngredients.push(ingredient);
ingredientPaths[ingredient].forEach(path => {
if (!selectedPaths.has(path)) {
selectedPaths.set(path, []);
}
selectedPaths.get(path).push(ingredient);
});
}
}
if (selectedIngredients.length === 0) {
log.error("未选择任何食材,退出任务");
throw new Error("未选择任何食材,任务终止"); // 抛出异常以终止任务
}
// 汇总即将购买的食材信息
let purchaseSummary = selectedIngredients.join(", ");
log.info(`即将购买: ${purchaseSummary}`);
// 定义一个函数用于模拟按键操作
async function simulateKeyOperations(key, duration) {
keyDown(key);
await sleep(duration);
keyUp(key);
await sleep(500); // 释放按键后等待 500 毫秒
}
// 定义一个函数用于购买食材
async function purchaseIngredient(ingredient) {
log.info(`购买食材: ${ingredient}`);
// 在购买前进行识别
let ComfirmRoResult1 = await recognizeImage("assets/Comfirm.png", 1585, 1005, 31, 31, 2000);
if (ComfirmRoResult1) {
// 模拟购买操作的后续点击
await click(1600, 1020);
await sleep(1000); // 购买
} else {
log.warn(`食材: ${ingredient}已售罄或背包已满`);
return; // 退出操作
}
// 在点击选择100个之前进行识别
let ComfirmRoResult2 = await recognizeImage("assets/Comfirm.png", 995, 766, 31, 31, 2000);
if (ComfirmRoResult2) {
log.info("选择100个的");
await click(1181, 600);
await sleep(200); // 选择100个
} else {
log.warn("尝试重新点击购买");
await click(1600, 1020);
await sleep(1000); // 购买
return; // 退出操作
}
await click(1320, 780);
await sleep(1000); // 最终确认
await click(1320, 780);
await sleep(1000); // 点击空白
}
// 定义一个通用的图像识别函数
function recognizeImage(templatePath, xMin, yMin, width, height, timeout = 2000) {
let startTime = Date.now();
while (Date.now() - startTime < timeout) {
try {
let template = file.ReadImageMatSync(templatePath);
let recognitionObject = RecognitionObject.TemplateMatch(template, xMin, yMin, width, height);
let ra = captureGameRegion();
let result = ra.find(recognitionObject);
template.dispose();
ra.dispose();
if (result.isExist()) {
return { success: true, x: result.x, y: result.y, width: result.width, height: result.height };
}
} catch (error) {
log.error(`识别图像时发生异常: ${error.message}`);
return null;
}
}
log.warn("图像识别超时");
return null;
}
// 定义一个函数用于执行OCR识别
function performOcr(targetText, xRange, yRange, tolerance, timeout = 2000) {
let startTime = Date.now();
while (Date.now() - startTime < timeout) {
try {
// 调整区域范围以包含容错区间
let adjustedXMin = xRange.min - tolerance;
let adjustedXMax = xRange.max + tolerance;
let adjustedYMin = yRange.min - tolerance;
let adjustedYMax = yRange.max + tolerance;
// 在捕获的区域内进行OCR识别
let ra = captureGameRegion();
let resList = ra.findMulti(RecognitionObject.ocr(
adjustedXMin, adjustedYMin,
adjustedXMax - adjustedXMin, adjustedYMax - adjustedYMin
));
ra.dispose();
// 遍历识别结果,检查是否找到目标文本
for (let i = 0; i < resList.count; i++) {
let res = resList[i];
// log.info("0CR结果-"+ res.text);
// 后处理:根据替换映射表检查和替换错误识别的字符
let correctedText = res.text;
for (let [wrongChar, correctChar] of Object.entries(replacementMap)) {
correctedText = correctedText.replace(new RegExp(wrongChar, 'g'), correctChar);
}
if (correctedText.includes(targetText)) {
// 如果找到目标文本,直接返回坐标
return { success: true, x: res.x, y: res.y, width: res.width, height: res.height };
}
}
} catch (error) {
log.error(`识别文字时发生异常: ${error.message}`);
return { success: false };
}
}
log.warn("OCR识别超时");
return { success: false };
}
// 定义一个函数用于识别食材
async function recognizeIngredient(ingredient) {
let recognized = false;
const clickOffset = 30; // 点击坐标偏移
// 尝试 OCR 识别
let ocrResult = await performOcr(ingredient, { min: 210, max: 390 }, { min: 105, max: 920 }, 10);
if (ocrResult.success) {
log.info(`通过 OCR 识别找到食材: ${ingredient}`);
// log.info(`坐标: x=${ocrResult.x}, y=${ocrResult.y}`);
await click(ocrResult.x, ocrResult.y + clickOffset);
await sleep(1000);
recognized = true;
} else {
// OCR 识别失败,尝试图像识别
let imagePath = `assets/Picture/${ingredientImageMap[ingredient]}`;
if (!imagePath) {
log.warn(`未找到食材 '${ingredient}' 的图片文件`);
return recognized;
}
let imageResult = recognizeImage(imagePath, 120, 90, 95, 865, 1000);
if (imageResult) {
log.info(`通过图像识别找到食材: ${ingredient}`);
// log.debug(`imageResult: ${JSON.stringify(imageResult)}`);
let x = Math.round(imageResult.x);
let y = Math.round(imageResult.y);
await click(x, y);await sleep(1000);
recognized = true;
} else {
log.warn(`未能识别到食材: ${ingredient}`);
}
}
return recognized;
}
// 定义一个函数用于识别并点击用户选择的食材
async function clickSelectedIngredients(selectedIngredients, filePath, npcNames) {
log.info(`加载路径文件: ${filePath}`);
await pathingScript.runFile(filePath);
await sleep(1000);
// 识别并交互 NPC
const npcxRange = { min: 1190, max: 1320 }; // npc X轴区间
const FxRange = { min: 1050, max: 1150 }; // F X轴坐标
const FyRange = { min: 400, max: 800 }; // F Y轴坐标
let fDialogueRo = RecognitionObject.TemplateMatch(file.ReadImageMatSync("assets/F_Dialogue.png"), FxRange.min, FyRange.min, FxRange.max - FxRange.min, FyRange.max - FyRange.min);
const tolerance = 12; // 容错区间
const npctolerance = 5; // 容错区间
// 执行点击操作
async function performClickOperations(filePath) {
if (filePath === liyueGroceryFilePath || filePath === groceryFilePath || filePath === sumiCityFishPath) {
log.info("执行璃月稻妻杂货商等的点击操作");
await click(1300, 650); await sleep(500); // 双击增加低帧点击成功率
await click(1300, 650); await sleep(500);
await click(1300, 650); await sleep(1000);
await click(1320, 780); await sleep(1000);
} else if (filePath === sumiGroceryFilePath) {
log.info("执行须弥杂货商等的点击操作");
await click(1300, 660); await sleep(1000);
await click(1300, 660); await sleep(1000);
await click(1300, 660); await sleep(1000);
await click(1300, 660); await sleep(1000);
} else if (filePath === natlanGroceryFilePath) {
log.info("执行纳塔杂货商等的点击操作");
await click(1300, 580); await sleep(1000);
await click(1300, 580); await sleep(1000);
await click(1300, 580); await sleep(1000);
await click(1300, 580); await sleep(1000);
} else if (filePath === nodKraiGroceryFilePath) {
log.info("执行挪德卡莱杂货商等的点击操作");
await click(1300, 430); await sleep(1000);
await click(1300, 430); await sleep(1000);
await click(1300, 430); await sleep(1000);
} else {
log.info("执行其他路径文件的点击操作");
await click(1300, 580); await sleep(500);
await click(1300, 580); await sleep(500);
await click(1300, 580); await sleep(1000);
await click(1320, 780); await sleep(1000);
}
}
// 检查 F 图标和右边水平对齐的文字
async function checkNpcAndFAlignment(npcName, fDialogueRo) {
let ra = captureGameRegion();
let fRes = ra.find(fDialogueRo);
ra.dispose();
if (!fRes.isExist()) {
let f_attempts = null; // 初始化尝试次数
while (f_attempts < 5) { // 最多尝试 4 次
f_attempts++;
log.info(`当前尝试次数:${f_attempts}`);
if (f_attempts <= 3) {
// 第 1-3 次尝试
await simulateKeyOperations("S", 200); // 后退 200 毫秒
await sleep(200);
await simulateKeyOperations("W", 400); // 前进 400 毫秒
await sleep(500);
} else if (f_attempts === 4) {
// 第 4 次尝试
log.info("重新加载路径文件");
await pathingScript.runFile(filePath);
await sleep(500);
} else {
// 第 5 次尝试,尝试次数已达上限
log.warn("尝试次数已达上限");
break; // 找到后退出循环
}
// 检查是否找到 F 图标
ra = captureGameRegion();
fRes = ra.find(fDialogueRo); // 重新查找 F 图标
ra.dispose();
if (fRes.isExist()) {
log.info("找到 F 图标");
break; // 找到后退出循环
}
log.warn(`尝试 ${f_attempts}:寻找 F 图标`);
}
// 如果尝试次数用完仍未找到 F 图标,返回 false
if (!fRes.isExist()) {
log.warn("经过多次尝试后仍未找到 F 图标");
return false;
}
}
// 获取 F 图标的中心点 Y 坐标
let centerYF = fRes.y + fRes.height / 2;
// 在 F 图标右侧水平方向上识别 NPC 名称
let ocrResult = await performOcr(npcName, npcxRange, { min: fRes.y, max: fRes.y + fRes.height }, tolerance);
if (!ocrResult.success) {
log.warn(`OCR 识别未找到 NPC: ${npcName},尝试滚动`);
return false;
}
// 获取 NPC 名称的中心点 Y 坐标
let centerYnpcName = ocrResult.y + ocrResult.height / 2;
// 检查 NPC 名称和 F 图标的中心点 Y 坐标是否在容错范围内
if (Math.abs(centerYnpcName - centerYF) <= npctolerance) {
return true;
} else {
log.info(`NPC '${npcName}' 和 F 图标未水平对齐NPC: ${centerYnpcName}, F 图标: ${centerYF}`);
return false;
}
}
// 新增变量用于记录滚轮操作次数
let scrollAttempts = 0;
const maxScrollAttempts = 5; // 最大滚轮操作次数限制
for (const npcName of npcNames) {
log.info(`尝试识别 NPC: ${npcName}`);
let isAligned = await checkNpcAndFAlignment(npcName, fDialogueRo);
while (!isAligned && scrollAttempts < maxScrollAttempts) {
// 如果未水平对齐,执行滚轮操作
await keyMouseScript.runFile(`assets/滚轮下翻.json`);
await sleep(1000);
// 检查是否超过最大滚轮操作次数
scrollAttempts++;
if (scrollAttempts >= maxScrollAttempts) {
log.error(`滚轮操作次数已达上限 ${maxScrollAttempts} 次,退出循环`);
break; // 超过最大滚轮操作次数,终止循环
}
// 重新检查 F 图标和 NPC 名称是否对齐
let ra = captureGameRegion();
let fRes = ra.find(fDialogueRo);
ra.dispose();
if (!fRes.isExist()) {
log.warn("未找到 F 图标");
continue; // 如果未找到 F 图标,继续下一次循环
}
// 获取 F 图标的中心点 Y 坐标
let centerYF = fRes.y + fRes.height / 2;
// 在 F 图标右侧水平方向上识别 NPC 名称
let ocrResult = await performOcr(npcName, npcxRange, { min: fRes.y, max: fRes.y + fRes.height }, tolerance);
if (!ocrResult.success) {
log.warn(`OCR 识别未找到 NPC: ${npcName}`);
continue; // 如果未找到 NPC 名称,继续下一次循环
}
// 获取 NPC 名称的中心点 Y 坐标
let centerYnpcName = ocrResult.y + ocrResult.height / 2;
// 检查 NPC 名称和 F 图标的中心点 Y 坐标是否在容错范围内
if (Math.abs(centerYnpcName - centerYF) <= npctolerance) {
isAligned = true;
log.info(`NPC '${npcName}' 和 F 图标水平对齐NPC: ${centerYnpcName}, F 图标: ${centerYF}`);
} else {
log.info(`NPC '${npcName}' 和 F 图标未水平对齐NPC: ${centerYnpcName}, F 图标: ${centerYF}`);
}
}
// 如果水平对齐,执行交互操作
if (isAligned) {
keyPress("F");
await sleep(2500);
// 首次执行点击操作
await performClickOperations(filePath);
let ComfirmRoResult = null;
let C_maxAttempts = 2; // 最大尝试次数
let C_attempts = 0; // 当前尝试次数
while (!ComfirmRoResult && C_attempts < C_maxAttempts) {
// 调用 recognizeImage 检测 ComfirmRo
ComfirmRoResult = await recognizeImage("assets/Comfirm.png", 1585, 1005, 31, 31, 2000);
if (ComfirmRoResult) {
log.info("识别到购买按钮,执行食材选择");
break; // 如果识别到,退出循环
} else {
log.warn("未识别到购买按钮,尝试重新识别");
}
await sleep(500); // 等待一段时间后再次检测
// 如果未识别到 ComfirmRo再次执行点击操作
await performClickOperations(filePath);
C_attempts++; // 增加尝试次数
}
if (!ComfirmRoResult) {
log.warn("未在规定时间内完成对话");
return; // 退出函数
}
// 只有在成功对齐并交互后,才执行后续的食材购买操作
// 记录已购买的食材
let purchasedIngredients = new Set();
let allIngredientsFound = false; // 标记是否所有食材都已找到
let scrollAttemptsForIngredients = 0;
const maxScrollAttemptsForIngredients = 3; // 最大翻页次数
while (!allIngredientsFound && scrollAttemptsForIngredients < maxScrollAttemptsForIngredients) {
allIngredientsFound = true; // 假设本轮所有食材都已找到,若后续发现未找到则修改为 false
for (const ingredient of selectedIngredients) {
if (purchasedIngredients.has(ingredient)) {
log.info(`跳过已购买的食材: ${ingredient}`);
continue; // 跳过已购买的食材
}
// await sleep(1000);
// 尝试识别食材
let recognized = await recognizeIngredient(ingredient);
if (recognized) {
log.info(`识别到 '${ingredient}',执行购买操作`);
await purchaseIngredient(ingredient);
purchasedIngredients.add(ingredient);
} else {
// log.error(`未能识别到食材: ${ingredient}`);
allIngredientsFound = false; // 本轮有食材未找到
}
}
if (!allIngredientsFound) {
log.info(`在当前页面未找到所有食材,尝试翻页`);
await PageScroll(1); // 每轮翻页滑动1次
await sleep(1000);
scrollAttemptsForIngredients++;
}
}
if (!allIngredientsFound) {
log.error(`在所有页面中未找到所有食材,跳过该路径`);
}
// 最后点击退出按钮
log.info("点击退出按钮...");
await click(1845, 45); // 退出
await sleep(2000);
// 如果成功购买了所有食材,记录成功信息
if (allIngredientsFound) {
log.info("该处所需食材已完成购买!");
} else {
log.error("未能购买所有食材,部分食材可能未找到或未成功购买。");
}
return; // 结束函数,后续逻辑不再执行
} else {
// 如果未水平对齐且超过最大滚轮操作次数,记录错误信息并跳过该 NPC
log.error(`未能找到正确的 NPC '${npcName}' 或未成功交互,跳过该 NPC`);
}
}
// 如果没有找到任何 NPC 或未成功交互,则记录错误信息并退出
log.error("未能找到正确的 NPC 或未成功交互,跳过该路径");
}
// 自动执行划页操作
async function PageScroll(scrollCount) {
try {
const clickX = 1200; // 假设点击的起始坐标
const clickY = 900;
const totalDistance = 500; // 假设每次滑动的总距离
const stepDistance = 15; // 每步移动的距离
for (let i = 0; i < scrollCount; ++i) {
log.info(`开始第 ${i + 1} 次滑动`);
// 如果点击坐标为 (0, 0),则跳过点击
if (clickX !== 0 || clickY !== 0) {
moveMouseTo(clickX, clickY); // 移动到指定坐标
await sleep(100);
}
// 按住鼠标左键
leftButtonDown();
// 将鼠标移动到目标位置,模拟更自然的拖动操作
const steps = totalDistance / stepDistance; // 分成若干步移动
for (let j = 0; j < steps; j++) {
moveMouseBy(0, -stepDistance); // 每次移动 stepDistance 像素
await sleep(10); // 每次移动后延迟10毫秒
}
// 释放鼠标左键
await sleep(700);
leftButtonUp();
await sleep(100);
}
} catch (error) {
log.error(`执行滑动操作时发生错误:${error.message}`);
}
}
// 主函数
async function AutoPath() {
log.info("开始执行自动寻路任务");
// 加载路径文件和 NPC 名称
for (let [path, ingredients] of selectedPaths) {
let npcName = npcNames[path];
await clickSelectedIngredients(ingredients, path, npcName);
}
}
// 执行主函数
(async function () {
setGameMetrics(1920, 1080, 1);
await genshin.returnMainUi();
await AutoPath();
})();

View File

@@ -0,0 +1,19 @@
{
"manifest_version": 1,
"name": "选择购买食材OCR",
"version": "1.4",
"description": "至少需要0.48版本bgi对NPC和材料进行文字、图像识别。\n一般食材杂货在蒙德、璃月、稻妻、枫丹杂货商购买。\n10鱼肉、10螃蟹在卯师傅、珀姆、布特罗斯、阿扎莱和志村勘兵卫购买。\n咖啡豆在须弥、枫丹咖啡馆购买。\n增加对话F图像识别增加个别字识别容错增加香辛料在阿扎莱处购买。\nv1.30513修复循环套叠优化F未识别后的尝试方案。",
"authors": [
{
"name": "吉吉喵",
"links": "https://github.com/JJMdzh"
}
],
"tags": [
"购买食材",
"OCR",
"图像识别"
],
"settings_ui": "settings.json",
"main": "main.js"
}

Some files were not shown because too many files have changed in this diff Show More