js,食材购买 (#521)
* update repo.json * js,对NPC和材料进行文字、图像识别 * update repo.json --------- Co-authored-by: JJMdzh <205532257+JJMdzh@users.noreply.github.com>
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"time": "20250404133502",
|
"time": "20250404181848",
|
||||||
"url": "https://github.com/babalae/bettergi-scripts-list/archive/refs/heads/main.zip",
|
"url": "https://github.com/babalae/bettergi-scripts-list/archive/refs/heads/main.zip",
|
||||||
"file": "repo.json",
|
"file": "repo.json",
|
||||||
"indexes": [
|
"indexes": [
|
||||||
@@ -31793,10 +31793,10 @@
|
|||||||
{
|
{
|
||||||
"name": "OCR购买食材",
|
"name": "OCR购买食材",
|
||||||
"type": "directory",
|
"type": "directory",
|
||||||
"hash": "4cfa7a41ffc18e0e8d9b5383cb11d1c1c0bdbdd0",
|
"hash": "55c02dfea8069770d63663271a59b5a78b8592db",
|
||||||
"version": "1.20403",
|
"version": "1.20403",
|
||||||
"author": "吉吉喵",
|
"author": "吉吉喵",
|
||||||
"description": "选择购买食材OCR~|~寻路杂货商,更新OCR版,对NPC和材料文字识别,一般食材杂货在蒙德、璃月、稻妻、枫丹杂货商购买,10鱼肉、10螃蟹在卯师傅、珀姆、布特罗斯、阿扎莱和志村勘兵卫购买。至少需要0.44版本bgi,增加对话F图像识别,增加个别字识别容错;增加香辛料,在阿扎莱处购买",
|
"description": "选择购买食材OCR~|~至少需要0.44版本bgi,对NPC和材料进行文字、图像识别。\n一般食材杂货在蒙德、璃月、稻妻、枫丹杂货商购买。\n10鱼肉、10螃蟹在卯师傅、珀姆、布特罗斯、阿扎莱和志村勘兵卫购买。\n咖啡豆在须弥、枫丹咖啡馆购买。\n增加对话F图像识别,增加个别字识别容错;增加香辛料,在阿扎莱处购买",
|
||||||
"tags": []
|
"tags": []
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
BIN
repo/js/OCR购买食材/assets/E_Dialogue.png
Normal file
|
After Width: | Height: | Size: 547 B |
|
Before Width: | Height: | Size: 629 B After Width: | Height: | Size: 515 B |
58
repo/js/OCR购买食材/assets/Pathing/枫丹咖啡厅露泽店主阿鲁埃.json
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
{
|
||||||
|
"info": {
|
||||||
|
"name": "枫丹咖啡厅露泽店主阿鲁埃",
|
||||||
|
"type": "collect",
|
||||||
|
"author": "吉吉喵",
|
||||||
|
"version": "1.0",
|
||||||
|
"description": "咖啡豆",
|
||||||
|
"bgiVersion": "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"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
40
repo/js/OCR购买食材/assets/Pathing/枫丹达莫维百货店主布希柯.json
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
{
|
||||||
|
"info": {
|
||||||
|
"name": "枫丹达莫维百货店主布希柯",
|
||||||
|
"type": "collect",
|
||||||
|
"author": "吉吉喵",
|
||||||
|
"version": "1.0",
|
||||||
|
"description": "杂货",
|
||||||
|
"bgiVersion": "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": ""
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
55
repo/js/OCR购买食材/assets/Pathing/璃月万民堂老板卯师傅-2.json
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
{
|
||||||
|
"info": {
|
||||||
|
"name": "璃月万民堂老板卯师傅",
|
||||||
|
"type": "collect",
|
||||||
|
"author": "吉吉喵",
|
||||||
|
"version": "",
|
||||||
|
"description": "璃月万民堂老板卯师傅备选",
|
||||||
|
"bgiVersion": "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"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
37
repo/js/OCR购买食材/assets/Pathing/璃月万民堂老板卯师傅.json
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
{
|
||||||
|
"info": {
|
||||||
|
"name": "璃月万民堂老板卯师傅",
|
||||||
|
"type": "collect",
|
||||||
|
"author": "吉吉喵",
|
||||||
|
"version": "",
|
||||||
|
"description": "鱼肉+螃蟹",
|
||||||
|
"bgiVersion": "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"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
28
repo/js/OCR购买食材/assets/Pathing/璃月荣发商铺店主东升.json
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
{
|
||||||
|
"info": {
|
||||||
|
"name": "璃月荣发商铺店主东升",
|
||||||
|
"type": "collect",
|
||||||
|
"author": "吉吉喵",
|
||||||
|
"version": "1.0",
|
||||||
|
"description": "杂货",
|
||||||
|
"bgiVersion": "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": ""
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
36
repo/js/OCR购买食材/assets/Pathing/稻妻九十九物店主葵.json
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
{
|
||||||
|
"info": {
|
||||||
|
"name": "稻妻九十九物店主葵",
|
||||||
|
"type": "collect",
|
||||||
|
"author": "吉吉喵",
|
||||||
|
"version": "1.0",
|
||||||
|
"description": "杂货",
|
||||||
|
"bgiVersion": "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": ""
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
44
repo/js/OCR购买食材/assets/Pathing/稻妻志村屋店主志村勘兵卫.json
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
{
|
||||||
|
"info": {
|
||||||
|
"name": "稻妻志村屋店主志村堪兵卫",
|
||||||
|
"type": "collect",
|
||||||
|
"author": "吉吉喵",
|
||||||
|
"version": "1.0",
|
||||||
|
"description": "鱼肉+螃蟹",
|
||||||
|
"bgiVersion": "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": ""
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
36
repo/js/OCR购买食材/assets/Pathing/蒙德百货销售员布兰琪.json
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
{
|
||||||
|
"info": {
|
||||||
|
"name": "蒙德百货销售员布兰琪",
|
||||||
|
"type": "collect",
|
||||||
|
"author": "吉吉喵",
|
||||||
|
"version": "1.0",
|
||||||
|
"description": "杂货",
|
||||||
|
"bgiVersion": "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"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
70
repo/js/OCR购买食材/assets/Pathing/须弥城咖啡馆代理店长恩忒卡.json
Normal file
@@ -0,0 +1,70 @@
|
|||||||
|
{
|
||||||
|
"info": {
|
||||||
|
"name": "须弥城普斯帕咖啡馆代理店长恩忒卡",
|
||||||
|
"type": "collect",
|
||||||
|
"author": "吉吉喵",
|
||||||
|
"version": "",
|
||||||
|
"description": "咖啡",
|
||||||
|
"bgiVersion": "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"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
1
repo/js/OCR购买食材/assets/Pathing/须弥城鱼贩珀姆.json
Normal 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"}]}
|
||||||
28
repo/js/OCR购买食材/assets/Pathing/须弥奥摩斯港鱼贩布特罗斯.json
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
{
|
||||||
|
"info": {
|
||||||
|
"name": "须弥奥摩斯港鱼贩布特罗斯",
|
||||||
|
"type": "collect",
|
||||||
|
"author": "吉吉喵",
|
||||||
|
"version": "",
|
||||||
|
"description": "鱼肉+螃蟹",
|
||||||
|
"bgiVersion": "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"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
1
repo/js/OCR购买食材/assets/Pathing/须弥阿如村商人阿扎莱.json
Normal 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"}]}
|
||||||
BIN
repo/js/OCR购买食材/assets/Picture/AlmondRo.png
Normal file
|
After Width: | Height: | Size: 5.3 KiB |
BIN
repo/js/OCR购买食材/assets/Picture/CabbageRo.png
Normal file
|
After Width: | Height: | Size: 6.5 KiB |
BIN
repo/js/OCR购买食材/assets/Picture/CoffeeRo.png
Normal file
|
After Width: | Height: | Size: 5.7 KiB |
BIN
repo/js/OCR购买食材/assets/Picture/CrabRo.png
Normal file
|
After Width: | Height: | Size: 6.3 KiB |
BIN
repo/js/OCR购买食材/assets/Picture/FengdaRo.png
Normal file
|
After Width: | Height: | Size: 5.5 KiB |
BIN
repo/js/OCR购买食材/assets/Picture/FermentRo.png
Normal file
|
After Width: | Height: | Size: 4.6 KiB |
BIN
repo/js/OCR购买食材/assets/Picture/FishRo.png
Normal file
|
After Width: | Height: | Size: 6.2 KiB |
BIN
repo/js/OCR购买食材/assets/Picture/MilkRo.png
Normal file
|
After Width: | Height: | Size: 5.6 KiB |
BIN
repo/js/OCR购买食材/assets/Picture/OnionRo.png
Normal file
|
After Width: | Height: | Size: 6.0 KiB |
BIN
repo/js/OCR购买食材/assets/Picture/PepperRo.png
Normal file
|
After Width: | Height: | Size: 5.2 KiB |
BIN
repo/js/OCR购买食材/assets/Picture/PotatoRo.png
Normal file
|
After Width: | Height: | Size: 5.6 KiB |
BIN
repo/js/OCR购买食材/assets/Picture/RiceRo.png
Normal file
|
After Width: | Height: | Size: 6.2 KiB |
BIN
repo/js/OCR购买食材/assets/Picture/SaltRo.png
Normal file
|
After Width: | Height: | Size: 4.8 KiB |
BIN
repo/js/OCR购买食材/assets/Picture/ShrimpRo.png
Normal file
|
After Width: | Height: | Size: 5.8 KiB |
BIN
repo/js/OCR购买食材/assets/Picture/SpicesRo.png
Normal file
|
After Width: | Height: | Size: 5.9 KiB |
BIN
repo/js/OCR购买食材/assets/Picture/TofuRo.png
Normal file
|
After Width: | Height: | Size: 5.3 KiB |
BIN
repo/js/OCR购买食材/assets/Picture/TomatoRo.png
Normal file
|
After Width: | Height: | Size: 5.6 KiB |
BIN
repo/js/OCR购买食材/assets/Picture/ToutuRo.png
Normal file
|
After Width: | Height: | Size: 6.5 KiB |
BIN
repo/js/OCR购买食材/assets/Picture/WheatRo.png
Normal file
|
After Width: | Height: | Size: 5.9 KiB |
@@ -1,23 +1,41 @@
|
|||||||
// 定义所有食材及其对应的路径文件和 NPC
|
// 定义所有食材的图像识别对象
|
||||||
const mondstadtGroceryFilePath = `assets/蒙德百货销售员布兰琪.json`;
|
let FengdaRo = RecognitionObject.TemplateMatch(file.ReadImageMatSync("assets/Picture/FengdaRo.png"));
|
||||||
const liyueGroceryFilePath = `assets/璃月荣发商铺店主东升.json`;
|
let SaltRo = RecognitionObject.TemplateMatch(file.ReadImageMatSync("assets/Picture/SaltRo.png"));
|
||||||
const liyueWanminFilePath = `assets/璃月万民堂老板卯师傅.json`;
|
let PepperRo = RecognitionObject.TemplateMatch(file.ReadImageMatSync("assets/Picture/PepperRo.png"));
|
||||||
const groceryFilePath = `assets/稻妻九十九物店主葵.json`;
|
let OnionRo = RecognitionObject.TemplateMatch(file.ReadImageMatSync("assets/Picture/OnionRo.png"));
|
||||||
const charcoalFilePath = `assets/稻妻志村屋店主志村勘兵卫.json`;
|
let MilkRo = RecognitionObject.TemplateMatch(file.ReadImageMatSync("assets/Picture/MilkRo.png"));
|
||||||
const fengdanGroceryFilePath = `assets/枫丹达莫维百货店主布希柯.json`;
|
let TomatoRo = RecognitionObject.TemplateMatch(file.ReadImageMatSync("assets/Picture/TomatoRo.png"));
|
||||||
const cafeLuzheFilePath = `assets/枫丹咖啡厅露泽店主阿鲁埃.json`;
|
let SpicesRo = RecognitionObject.TemplateMatch(file.ReadImageMatSync("assets/Picture/SpicesRo.png"));
|
||||||
const sumiCityFishPath = `assets/须弥城鱼贩珀姆.json`;
|
let CabbageRo = RecognitionObject.TemplateMatch(file.ReadImageMatSync("assets/Picture/CabbageRo.png"));
|
||||||
const omosPortFishPath = `assets/须弥奥摩斯港鱼贩布特罗斯.json`;
|
let PotatoRo = RecognitionObject.TemplateMatch(file.ReadImageMatSync("assets/Picture/PotatoRo.png"));
|
||||||
const azaleVillMerPath = `assets/须弥阿如村商人阿扎莱.json`;
|
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 = [
|
const ingredients = [
|
||||||
"枫达", "盐", "洋葱", "牛奶", "番茄", "香辛料", "卷心菜", "土豆", "小麦", "胡椒","稻米", "豆腐", "杏仁", "鱼肉", "螃蟹", "虾仁", "咖啡豆", "秃秃豆", "发酵果实汁"
|
"枫达", "盐", "胡椒", "洋葱", "牛奶", "番茄", "香辛料", "卷心菜", "土豆", "小麦", "稻米", "豆腐", "杏仁", "鱼肉", "螃蟹", "虾仁", "咖啡豆", "秃秃豆", "发酵果实汁"
|
||||||
];
|
];
|
||||||
|
|
||||||
// 筛选出用户选择的食材及其对应的路径文件和 NPC
|
// 定义所有食材及其对应的路径文件和 NPC
|
||||||
let selectedIngredients = []; // 在函数外部声明一次
|
const mondstadtGroceryFilePath = `assets/Pathing/蒙德百货销售员布兰琪.json`;
|
||||||
let selectedPaths = new Map();
|
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 omosPortFishPath = `assets/Pathing/须弥奥摩斯港鱼贩布特罗斯.json`;
|
||||||
|
const azaleVillMerPath = `assets/Pathing/须弥阿如村商人阿扎莱.json`;
|
||||||
|
|
||||||
const ingredientPaths = {
|
const ingredientPaths = {
|
||||||
"枫达": [fengdanGroceryFilePath, cafeLuzheFilePath],
|
"枫达": [fengdanGroceryFilePath, cafeLuzheFilePath],
|
||||||
@@ -36,10 +54,40 @@ const ingredientPaths = {
|
|||||||
"鱼肉": [liyueWanminFilePath, charcoalFilePath, sumiCityFishPath, omosPortFishPath, azaleVillMerPath],
|
"鱼肉": [liyueWanminFilePath, charcoalFilePath, sumiCityFishPath, omosPortFishPath, azaleVillMerPath],
|
||||||
"螃蟹": [liyueWanminFilePath, charcoalFilePath, sumiCityFishPath, omosPortFishPath],
|
"螃蟹": [liyueWanminFilePath, charcoalFilePath, sumiCityFishPath, omosPortFishPath],
|
||||||
"秃秃豆": [fengdanGroceryFilePath, azaleVillMerPath],
|
"秃秃豆": [fengdanGroceryFilePath, azaleVillMerPath],
|
||||||
"咖啡豆": [cafeLuzheFilePath],
|
"咖啡豆": [sumiCitycafeFilePath, cafeLuzheFilePath],
|
||||||
"香辛料": [azaleVillMerPath],
|
"香辛料": [azaleVillMerPath],
|
||||||
"发酵果实汁": [fengdanGroceryFilePath]
|
"发酵果实汁": [fengdanGroceryFilePath]
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// 定义食材名称和图片文件名的映射表
|
||||||
|
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名,注意名字长度可能超过识图范围
|
// 定义所有NPC名,注意名字长度可能超过识图范围
|
||||||
const npcNames = {
|
const npcNames = {
|
||||||
[mondstadtGroceryFilePath]: ["布兰琪"],
|
[mondstadtGroceryFilePath]: ["布兰琪"],
|
||||||
@@ -50,10 +98,15 @@ const npcNames = {
|
|||||||
[fengdanGroceryFilePath]: ["布希柯"],
|
[fengdanGroceryFilePath]: ["布希柯"],
|
||||||
[cafeLuzheFilePath]: ["阿鲁埃"],
|
[cafeLuzheFilePath]: ["阿鲁埃"],
|
||||||
[sumiCityFishPath]: ["珀姆"],
|
[sumiCityFishPath]: ["珀姆"],
|
||||||
|
[sumiCitycafeFilePath]: ["恩忒卡"],
|
||||||
[omosPortFishPath]: ["布特罗斯"],
|
[omosPortFishPath]: ["布特罗斯"],
|
||||||
[azaleVillMerPath]: ["阿扎莱"]
|
[azaleVillMerPath]: ["阿扎莱"]
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// 筛选出用户选择的食材及其对应的路径文件和 NPC
|
||||||
|
let selectedIngredients = []; // 在函数外部声明一次
|
||||||
|
let selectedPaths = new Map();
|
||||||
|
|
||||||
for (let ingredient of ingredients) {
|
for (let ingredient of ingredients) {
|
||||||
if (settings[ingredient]) {
|
if (settings[ingredient]) {
|
||||||
selectedIngredients.push(ingredient);
|
selectedIngredients.push(ingredient);
|
||||||
@@ -82,12 +135,95 @@ async function simulateKeyOperations(key, duration) {
|
|||||||
await sleep(500); // 释放按键后等待 500 毫秒
|
await sleep(500); // 释放按键后等待 500 毫秒
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 定义一个函数用于购买食材
|
||||||
|
async function purchaseIngredient(ingredient) {
|
||||||
|
log.info(`购买食材: ${ingredient}`);
|
||||||
|
// 模拟购买操作的后续点击
|
||||||
|
await click(1600, 1020); await sleep(1000); // 购买
|
||||||
|
await click(1181, 600); await sleep(200); // 选择100个
|
||||||
|
await click(1320, 780); await sleep(1000); // 最终确认
|
||||||
|
await click(1320, 780); await sleep(1000); // 点击空白
|
||||||
|
}
|
||||||
|
|
||||||
|
// 定义一个通用的图像识别函数
|
||||||
|
function recognizeImage(templatePath, xMin, yMin, width, height) {
|
||||||
|
let template = file.ReadImageMatSync(templatePath);
|
||||||
|
let recognitionObject = RecognitionObject.TemplateMatch(template, xMin, yMin, width, height);
|
||||||
|
let result = captureGameRegion().find(recognitionObject);
|
||||||
|
return result.isExist() ? result : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 定义一个函数用于执行OCR识别
|
||||||
|
async function performOcr(targetText, xRange, yRange, tolerance) {
|
||||||
|
// 调整区域范围以包含容错区间
|
||||||
|
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
|
||||||
|
));
|
||||||
|
|
||||||
|
// 遍历识别结果,检查是否找到目标文本
|
||||||
|
for (let i = 0; i < resList.count; i++) {
|
||||||
|
let res = resList[i];
|
||||||
|
// 后处理:根据替换映射表检查和替换错误识别的字符
|
||||||
|
let correctedText = res.text;
|
||||||
|
for (let [wrongChar, correctChar] of Object.entries(replacementMap)) {
|
||||||
|
correctedText = correctedText.replace(wrongChar, correctChar);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (correctedText.includes(targetText)) {
|
||||||
|
// 如果找到目标文本,直接返回坐标
|
||||||
|
return { success: true, x: res.x, y: res.y, width: res.width, height: res.height };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
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: 950 }, 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.error(`未找到食材 '${ingredient}' 的图片文件`);
|
||||||
|
return recognized;
|
||||||
|
}
|
||||||
|
let imageResult = recognizeImage(imagePath, 120, 90, 95, 865);
|
||||||
|
if (imageResult) {
|
||||||
|
log.info(`通过图像识别找到食材: ${ingredient}`);
|
||||||
|
imageResult.click();
|
||||||
|
await sleep(1000);
|
||||||
|
recognized = true;
|
||||||
|
} else {
|
||||||
|
log.error(`未能识别到食材: ${ingredient}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return recognized;
|
||||||
|
}
|
||||||
|
|
||||||
// 定义一个函数用于识别并点击用户选择的食材
|
// 定义一个函数用于识别并点击用户选择的食材
|
||||||
async function clickSelectedIngredients(selectedIngredients, filePath, npcNames) {
|
async function clickSelectedIngredients(selectedIngredients, filePath, npcNames) {
|
||||||
log.info(`加载路径文件: ${filePath}`);
|
log.info(`加载路径文件: ${filePath}`);
|
||||||
await pathingScript.runFile(filePath);
|
await pathingScript.runFile(filePath);
|
||||||
await sleep(1000);
|
await sleep(1000);
|
||||||
// log.info("路径文件执行完成");
|
|
||||||
|
|
||||||
// 识别并交互 NPC
|
// 识别并交互 NPC
|
||||||
const npcxRange = { min: 1190, max: 1320 }; // npc X轴区间
|
const npcxRange = { min: 1190, max: 1320 }; // npc X轴区间
|
||||||
@@ -97,8 +233,6 @@ async function clickSelectedIngredients(selectedIngredients, filePath, npcNames)
|
|||||||
const tolerance = 12; // 容错区间
|
const tolerance = 12; // 容错区间
|
||||||
const npctolerance = 5; // 容错区间
|
const npctolerance = 5; // 容错区间
|
||||||
|
|
||||||
let npcOcrResult = { success: false }; // 初始化 npcOcrResult
|
|
||||||
|
|
||||||
// 执行点击操作
|
// 执行点击操作
|
||||||
async function performClickOperations(filePath) {
|
async function performClickOperations(filePath) {
|
||||||
if (filePath === liyueGroceryFilePath || filePath === groceryFilePath || filePath === sumiCityFishPath) {
|
if (filePath === liyueGroceryFilePath || filePath === groceryFilePath || filePath === sumiCityFishPath) {
|
||||||
@@ -144,15 +278,13 @@ async function clickSelectedIngredients(selectedIngredients, filePath, npcNames)
|
|||||||
log.error(`尝试 ${f_attempts + 1}:寻找 F 图标`);
|
log.error(`尝试 ${f_attempts + 1}:寻找 F 图标`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// log.info(`F 图标x: ${fRes.x},y: ${fRes.y},width: ${fRes.width},height: ${fRes.height}`);
|
|
||||||
// 获取 F 图标的中心点 Y 坐标
|
// 获取 F 图标的中心点 Y 坐标
|
||||||
let centerYF = fRes.y + fRes.height / 2;
|
let centerYF = fRes.y + fRes.height / 2;
|
||||||
|
|
||||||
// 在 F 图标右侧水平方向上识别 NPC 名称
|
// 在 F 图标右侧水平方向上识别 NPC 名称
|
||||||
let ocrResult = await performOcr(npcName, npcxRange, { min: fRes.y, max: fRes.y + fRes.height }, tolerance);
|
let ocrResult = await performOcr(npcName, npcxRange, { min: fRes.y, max: fRes.y + fRes.height }, tolerance);
|
||||||
// log.info(`NPC 名称x: ${ocrResult.x},y: ${ocrResult.y},width: ${ocrResult.width},height: ${ocrResult.height}`);
|
|
||||||
if (!ocrResult.success) {
|
if (!ocrResult.success) {
|
||||||
log.error(`OCR 识别未找到 NPC: ${npcName}`);
|
log.error(`OCR 识别未找到 NPC: ${npcName},尝试滚动`);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -161,10 +293,9 @@ async function clickSelectedIngredients(selectedIngredients, filePath, npcNames)
|
|||||||
|
|
||||||
// 检查 NPC 名称和 F 图标的中心点 Y 坐标是否在容错范围内
|
// 检查 NPC 名称和 F 图标的中心点 Y 坐标是否在容错范围内
|
||||||
if (Math.abs(centerYnpcName - centerYF) <= npctolerance) {
|
if (Math.abs(centerYnpcName - centerYF) <= npctolerance) {
|
||||||
// log.info(`NPC '${npcName}' 和 F 图标水平对齐,执行交互, NPC: ${centerYnpcName}, F 图标: ${centerYF}`);
|
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
log.info(`NPC '${npcName}' 和 F 图标未水平对齐,尝试滚动, NPC: ${centerYnpcName}, F 图标: ${centerYF}`);
|
log.info(`NPC '${npcName}' 和 F 图标未水平对齐, NPC: ${centerYnpcName}, F 图标: ${centerYF}`);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -205,12 +336,6 @@ async function clickSelectedIngredients(selectedIngredients, filePath, npcNames)
|
|||||||
// 记录已购买的食材
|
// 记录已购买的食材
|
||||||
let purchasedIngredients = new Set();
|
let purchasedIngredients = new Set();
|
||||||
|
|
||||||
// 继续后续操作
|
|
||||||
const ingredientXRange = { min: 210, max: 390 }; // X坐标范围
|
|
||||||
const ingredientYRange = { min: 105, max: 960 }; // Y坐标范围
|
|
||||||
const ingredientTolerance = 10; // 容错区间
|
|
||||||
const clickOffset = 30; // 点击坐标容错
|
|
||||||
|
|
||||||
let allIngredientsFound = false; // 标记是否所有食材都已找到
|
let allIngredientsFound = false; // 标记是否所有食材都已找到
|
||||||
let scrollAttemptsForIngredients = 0;
|
let scrollAttemptsForIngredients = 0;
|
||||||
const maxScrollAttemptsForIngredients = 3; // 最大翻页次数
|
const maxScrollAttemptsForIngredients = 3; // 最大翻页次数
|
||||||
@@ -223,23 +348,16 @@ async function clickSelectedIngredients(selectedIngredients, filePath, npcNames)
|
|||||||
log.info(`跳过已购买的食材: ${ingredient}`);
|
log.info(`跳过已购买的食材: ${ingredient}`);
|
||||||
continue; // 跳过已购买的食材
|
continue; // 跳过已购买的食材
|
||||||
}
|
}
|
||||||
|
// await sleep(1000);
|
||||||
|
|
||||||
let ocrResult = await performOcr(ingredient, ingredientXRange, ingredientYRange, ingredientTolerance);
|
// 尝试识别食材
|
||||||
if (ocrResult.success) {
|
let recognized = await recognizeIngredient(ingredient);
|
||||||
log.info(`识别到 '${ingredient}',坐标: x=${ocrResult.x}, y=${ocrResult.y}`);
|
if (recognized) {
|
||||||
await click(ocrResult.x, ocrResult.y + clickOffset);
|
log.info(`识别到 '${ingredient}',执行购买操作`);
|
||||||
await sleep(1000);
|
await purchaseIngredient(ingredient);
|
||||||
|
|
||||||
// 模拟购买操作的后续点击
|
|
||||||
await click(1600, 1020); await sleep(1000); // 购买
|
|
||||||
await click(1181, 600); await sleep(200); // 选择100个
|
|
||||||
await click(1320, 780); await sleep(1000); // 最终确认
|
|
||||||
await click(1320, 780); await sleep(1000); // 点击空白
|
|
||||||
|
|
||||||
// 记录已购买的食材
|
|
||||||
purchasedIngredients.add(ingredient);
|
purchasedIngredients.add(ingredient);
|
||||||
} else {
|
} else {
|
||||||
log.error(`OCR 识别未找到 '${ingredient}'`);
|
log.error(`未能识别到食材: ${ingredient}`);
|
||||||
allIngredientsFound = false; // 本轮有食材未找到
|
allIngredientsFound = false; // 本轮有食材未找到
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -247,7 +365,7 @@ async function clickSelectedIngredients(selectedIngredients, filePath, npcNames)
|
|||||||
if (!allIngredientsFound) {
|
if (!allIngredientsFound) {
|
||||||
log.info(`在当前页面未找到所有食材,尝试翻页`);
|
log.info(`在当前页面未找到所有食材,尝试翻页`);
|
||||||
await PageScroll(1); // 每轮翻页滑动1次
|
await PageScroll(1); // 每轮翻页滑动1次
|
||||||
await sleep(600);
|
await sleep(1000);
|
||||||
scrollAttemptsForIngredients++;
|
scrollAttemptsForIngredients++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -279,9 +397,6 @@ async function clickSelectedIngredients(selectedIngredients, filePath, npcNames)
|
|||||||
log.error("未能找到正确的 NPC 或未成功交互,跳过该路径");
|
log.error("未能找到正确的 NPC 或未成功交互,跳过该路径");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 自动执行划页操作
|
// 自动执行划页操作
|
||||||
async function PageScroll(scrollCount) {
|
async function PageScroll(scrollCount) {
|
||||||
try {
|
try {
|
||||||
@@ -303,7 +418,6 @@ async function PageScroll(scrollCount) {
|
|||||||
leftButtonDown();
|
leftButtonDown();
|
||||||
|
|
||||||
// 将鼠标移动到目标位置,模拟更自然的拖动操作
|
// 将鼠标移动到目标位置,模拟更自然的拖动操作
|
||||||
// log.info("移动鼠标");
|
|
||||||
const steps = totalDistance / stepDistance; // 分成若干步移动
|
const steps = totalDistance / stepDistance; // 分成若干步移动
|
||||||
|
|
||||||
for (let j = 0; j < steps; j++) {
|
for (let j = 0; j < steps; j++) {
|
||||||
@@ -321,52 +435,6 @@ async function PageScroll(scrollCount) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 定义替换映射表
|
|
||||||
const replacementMap = {
|
|
||||||
"监": "盐",
|
|
||||||
"卵": "卯"
|
|
||||||
};
|
|
||||||
|
|
||||||
// 定义一个函数用于执行OCR识别
|
|
||||||
async function performOcr(targetText, xRange, yRange, tolerance) {
|
|
||||||
// 调整区域范围以包含容错区间
|
|
||||||
let adjustedXMin = xRange.min - tolerance;
|
|
||||||
let adjustedXMax = xRange.max + tolerance;
|
|
||||||
let adjustedYMin = yRange.min - tolerance;
|
|
||||||
let adjustedYMax = yRange.max + tolerance;
|
|
||||||
/*log.info(`
|
|
||||||
adjustedXMin: ${adjustedXMin}
|
|
||||||
adjustedXMax: ${adjustedXMax}
|
|
||||||
adjustedYMin: ${adjustedYMin}
|
|
||||||
adjustedYMax: ${adjustedYMax}
|
|
||||||
`);*/
|
|
||||||
|
|
||||||
// 在捕获的区域内进行OCR识别
|
|
||||||
let ra = captureGameRegion();
|
|
||||||
let resList = ra.findMulti(RecognitionObject.ocr(
|
|
||||||
adjustedXMin, adjustedYMin,
|
|
||||||
adjustedXMax - adjustedXMin, adjustedYMax - adjustedYMin
|
|
||||||
));
|
|
||||||
// log.info(`OCR 识别数量: ${resList.count}`);
|
|
||||||
|
|
||||||
// 遍历识别结果,检查是否找到目标文本
|
|
||||||
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(wrongChar, correctChar);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (correctedText.includes(targetText)) {
|
|
||||||
// 如果找到目标文本,直接返回坐标
|
|
||||||
return { success: true, x: resList[i].x, y: resList[i].y, width: resList[i].width, height: resList[i].height }; // 找到符合条件的文本,返回坐标
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return { success: false }; // 未找到符合条件的文本
|
|
||||||
}
|
|
||||||
|
|
||||||
// 主函数
|
// 主函数
|
||||||
async function AutoPath() {
|
async function AutoPath() {
|
||||||
log.info("开始执行自动寻路任务");
|
log.info("开始执行自动寻路任务");
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
"manifest_version": 1,
|
"manifest_version": 1,
|
||||||
"name": "选择购买食材OCR",
|
"name": "选择购买食材OCR",
|
||||||
"version": "1.20403",
|
"version": "1.20403",
|
||||||
"description": "寻路杂货商,更新OCR版,对NPC和材料文字识别,一般食材杂货在蒙德、璃月、稻妻、枫丹杂货商购买,10鱼肉、10螃蟹在卯师傅、珀姆、布特罗斯、阿扎莱和志村勘兵卫购买。至少需要0.44版本bgi,增加对话F图像识别,增加个别字识别容错;增加香辛料,在阿扎莱处购买",
|
"description": "至少需要0.44版本bgi,对NPC和材料进行文字、图像识别。\n一般食材杂货在蒙德、璃月、稻妻、枫丹杂货商购买。\n10鱼肉、10螃蟹在卯师傅、珀姆、布特罗斯、阿扎莱和志村勘兵卫购买。\n咖啡豆在须弥、枫丹咖啡馆购买。\n增加对话F图像识别,增加个别字识别容错;增加香辛料,在阿扎莱处购买",
|
||||||
"authors": [
|
"authors": [
|
||||||
{
|
{
|
||||||
"name": "吉吉喵"
|
"name": "吉吉喵"
|
||||||
|
|||||||