同步AutoCommission更新 (#3069)

Co-authored-by: DarkFlameMaster <actions@github.com>
This commit is contained in:
DarkFlameMaster
2026-04-05 15:34:43 +08:00
committed by GitHub
parent 3ad0b85bf3
commit d0f848a836
21 changed files with 269 additions and 750 deletions

View File

@@ -1,69 +1,67 @@
{
{
"info": {
"name": "惊喜大礼-1",
"type": "collect",
"author": "星野",
"version": "1.0",
"description": "",
"map_name": "Teyvat",
"authors": [
{
"links": "",
"name": "星野"
}
],
"bgi_version": "0.45.0",
"description": "",
"enable_monster_loot_split": false,
"last_modified_time": 1775357973199,
"map_match_method": "",
"map_name": "Teyvat",
"name": "惊喜大礼-1",
"tags": [],
"last_modified_time": 1753184743150
"type": "collect",
"version": "1.0"
},
"positions": [
{
"action": "",
"id": 1,
"x": -867.1943359375,
"y": 2281.91162109375,
"action": "",
"move_mode": "walk",
"point_ext_params": {
"description": "",
"misidentification": {
"arrival_time": 0,
"handling_mode": "previousDetectedPoint",
"type": [
"unrecognized"
]
}
},
"type": "teleport",
"point_ext_params": {
"misidentification": {
"type": [
"unrecognized"
],
"handling_mode": "previousDetectedPoint",
"arrival_time": 0
},
"description": ""
}
"x": -867.1943359375,
"y": 2281.91162109375
},
{
"action": "",
"id": 2,
"x": -893.73828125,
"y": 2251.868896484375,
"action": "",
"move_mode": "dash",
"type": "path",
"point_ext_params": {
"description": "",
"misidentification": {
"arrival_time": 0,
"handling_mode": "previousDetectedPoint",
"type": [
"unrecognized"
],
"handling_mode": "previousDetectedPoint",
"arrival_time": 0
},
"description": ""
}
]
}
},
"type": "path",
"x": -893.73828125,
"y": 2251.868896484375
},
{
"id": 3,
"x": -904.564453125,
"y": 2247.68798828125,
"action": "",
"action_params": "",
"id": 3,
"move_mode": "walk",
"type": "target",
"point_ext_params": {
"misidentification": {
"type": [
"unrecognized"
],
"handling_mode": "previousDetectedPoint",
"arrival_time": 0
},
"description": ""
}
"x": -903.271484375,
"y": 2249.10498046875
}
]
}

View File

@@ -1,76 +1,85 @@
{
{
"info": {
"name": "西风骑士的基础知识-1",
"type": "collect",
"author": "云闲vsv",
"version": "1.0",
"authors": [
{
"links": "",
"name": "云闲vsv"
}
],
"bgi_version": "0.45.0",
"description": "西风骑士的基础知识-1",
"enable_monster_loot_split": false,
"last_modified_time": 1771748162545,
"map_match_method": "",
"map_name": "Teyvat",
"bgi_version": "0.45.0"
"name": "西风骑士的基础知识-1",
"tags": [],
"type": "collect",
"version": "1.0"
},
"positions": [
{
"action": "",
"action_params": "",
"id": 1,
"move_mode": "walk",
"type": "teleport",
"x": -867.7001953125,
"y": 2281.36279296875,
"action": "",
"move_mode": "walk",
"action_params": "",
"type": "teleport"
"y": 2281.36279296875
},
{
"action": "",
"action_params": "",
"id": 2,
"move_mode": "fly",
"type": "path",
"x": -873.7607421875,
"y": 2274.4951171875,
"action": "",
"move_mode": "fly",
"action_params": "",
"type": "path"
"y": 2274.4951171875
},
{
"id": 3,
"x": -877.1376953125,
"y": 2271.03173828125,
"action": "stop_flying",
"action_params": "",
"id": 3,
"move_mode": "fly",
"action_params": "",
"type": "path"
"type": "path",
"x": -877.1376953125,
"y": 2271.03173828125
},
{
"action": "",
"action_params": "",
"id": 4,
"x": -896.2724609375,
"y": 2247.0341796875,
"action": "",
"move_mode": "run",
"type": "path",
"x": -896.2724609375,
"y": 2247.0341796875
},
{
"action": "",
"action_params": "",
"type": "path"
},
{
"id": 5,
"move_mode": "dash",
"type": "path",
"x": -933.8310546875,
"y": 2228.99560546875,
"type": "path",
"move_mode": "dash",
"action": "",
"action_params": ""
"y": 2228.99560546875
},
{
"action": "combat_script",
"action_params": "w(1),wait(2)",
"id": 6,
"x": -951.7802734375,
"y": 2221.7314453125,
"type": "path",
"move_mode": "dash",
"action": "",
"action_params": ""
"type": "path",
"x": -948.5637561967196,
"y": 2222.8125
},
{
"id": 7,
"x": -947.359375,
"y": 2218.5927734375,
"type": "target",
"move_mode": "walk",
"action": "",
"action_params": ""
"action_params": "",
"id": 7,
"move_mode": "walk",
"type": "target",
"x": -947.63671875,
"y": 2218.208984375
}
]
}

View File

@@ -7,7 +7,7 @@
{
"type": "对话",
"note": "执行对话步骤默认跳过10次对话"
"note": "执行对话步骤"
},
{
@@ -18,14 +18,13 @@
{
"type": "对话",
"data": {
"skipCount": 5,
"priorityOptions": [
"Celi dada",
"Muhe ye!",
"Ye dada"
]
},
"note": "执行对话步骤优先选择特定选项并与白名单NPC交互"
"note": "与丘丘人进行交流"
},
{
@@ -35,6 +34,6 @@
},
{
"type": "对话",
"note": "执行对话步骤默认跳过10次对话"
"note": "执行对话步骤"
}
]

View File

@@ -6,16 +6,24 @@
},
{
"type": "对话",
"note": "执行对话步骤默认跳过10次对话"
"data": {
"priorityOptions": ["好的"],
"npcWhiteList": ["马斯克"]
},
"note": "与艾拉·马斯克对话"
},
{
{
"type": "等待返回主界面",
"note": "等待对话完成"
},
{
"type": "地图追踪",
"data": "语言交流-2.json",
"note": "执行第二个地图追踪步骤"
},
{
"type": "对话",
"note": "执行对话步骤默认跳过10次对话"
"note": "执行对话步骤"
},
{
"type": "地图追踪",
@@ -24,7 +32,7 @@
},
{
"type": "对话",
"note": "执行对话步骤默认跳过10次对话"
"note": "执行对话步骤"
},
{
"type": "地图追踪",
@@ -33,7 +41,7 @@
},
{
"type": "对话",
"note": "执行对话步骤默认跳过10次对话"
"note": "执行对话步骤"
}
]

View File

@@ -1,177 +0,0 @@
[
{
"type": "地图追踪",
"data": "紧急修理-1.json",
"note": "执行第一个地图追踪步骤"
},
{
"type": "自动任务",
"data": {
"action": "enable",
"taskType": "AutoSkip"
},
"note": "开启自动剧情"
},
{
"type": "按键",
"data": "F",
"note": "按下F键"
},
{
"type": "等待",
"data": 20
},
{
"type": "按键",
"data": "F",
"note": "按下F键"
},
{
"type": "等待返回主界面",
"note": "等待对话完成"
},
{
"type": "地图追踪",
"data": "紧急修理-2.json",
"note": "执行第二个地图追踪步骤"
},
{
"type": "按键",
"data": "F",
"note": "按下F键"
},
{
"type": "等待",
"data": 20
},
{
"type": "按键",
"data": "F",
"note": "按下F键"
},
{
"type": "地图追踪",
"data": "紧急修理-3.json",
"note": "执行第三个地图追踪步骤"
},
{
"type": "按键",
"data": "F",
"note": "按下F键"
},
{
"type": "等待",
"data": 20
},
{
"type": "按键",
"data": "F",
"note": "按下F键"
},
{
"type": "地图追踪",
"data": "紧急修理-41.json",
"note": "执行第四个地图追踪步骤"
},
{
"type": "按键",
"data": "F",
"note": "按下F键"
},
{
"type": "等待",
"data": 20
},
{
"type": "按键",
"data": "F",
"note": "按下F键"
},
{
"type": "地图追踪",
"data": "紧急修理-42.json",
"note": "执行第四个地图追踪步骤"
},
{
"type": "按键",
"data": "F",
"note": "按下F键"
},
{
"type": "按键",
"data": "F",
"note": "按下F键"
},
{
"type": "等待返回主界面",
"note": "等待对话完成"
},
{
"type": "地图追踪",
"data": "紧急修理-5.json",
"note": "执行第五个地图追踪步骤"
},
{
"type": "按键",
"data": "F",
"note": "按下F键"
},
{
"type": "等待",
"data": 20
},
{
"type": "按键",
"data": "F",
"note": "按下F键"
},
{
"type": "等待返回主界面",
"note": "等待对话完成"
},
{
"type": "地图追踪",
"data": "紧急修理-6.json",
"note": "执行第六个地图追踪步骤"
},
{
"type": "按键",
"data": "F",
"note": "按下F键"
},
{
"type": "等待",
"data": 20
},
{
"type": "按键",
"data": "F",
"note": "按下F键"
},
{
"type": "地图追踪",
"data": "紧急修理-7.json",
"note": "执行第七个地图追踪步骤"
},
{
"type": "按键",
"data": "F",
"note": "按下F键"
},
{
"type": "等待",
"data": 20
},
{
"type": "按键",
"data": "F",
"note": "按下F键"
},
{
"type": "等待返回主界面",
"note": "等待对话完成"
}
]

View File

@@ -1,69 +0,0 @@
{
"info": {
"name": "紧急修理-1",
"type": "collect",
"author": "云闲vsv",
"version": "1.0",
"description": "紧急修理-1",
"map_name": "Teyvat",
"bgi_version": "0.45.0",
"tags": [],
"last_modified_time": 1753249286484
},
"positions": [
{
"id": 1,
"x": -867.5869140625,
"y": 1992.22021484375,
"type": "teleport",
"move_mode": "walk",
"action": "",
"action_params": ""
},
{
"id": 2,
"x": -856.3525390625,
"y": 1985.38427734375,
"type": "path",
"move_mode": "walk",
"action": "",
"action_params": ""
},
{
"id": 3,
"x": -836.9130859375,
"y": 1988.89306640625,
"type": "path",
"move_mode": "dash",
"action": "",
"action_params": ""
},
{
"id": 4,
"x": -826.4658203125,
"y": 1980.59765625,
"type": "path",
"move_mode": "dash",
"action": "fight",
"action_params": ""
},
{
"id": 5,
"x": -828.8779296875,
"y": 1986.576171875,
"type": "path",
"move_mode": "walk",
"action": "",
"action_params": ""
},
{
"id": 6,
"x": -825.0361328125,
"y": 1983.1259765625,
"type": "target",
"move_mode": "walk",
"action": "",
"action_params": ""
}
]
}

View File

@@ -1,51 +0,0 @@
{
"info": {
"name": "紧急修理-2",
"type": "collect",
"author": "云闲vsv",
"version": "1.0",
"description": "紧急修理-2",
"map_name": "Teyvat",
"bgi_version": "0.45.0",
"tags": [],
"last_modified_time": 1753249667555
},
"positions": [
{
"id": 1,
"x": -829.650390625,
"y": 1984.5224609375,
"type": "path",
"move_mode": "walk",
"action": "",
"action_params": ""
},
{
"id": 2,
"x": -832.4111328125,
"y": 1955.6728515625,
"type": "path",
"move_mode": "walk",
"action": "",
"action_params": ""
},
{
"id": 3,
"x": -827.9999457514969,
"y": 1937.249311631982,
"type": "path",
"move_mode": "walk",
"action": "",
"action_params": ""
},
{
"id": 4,
"x": -826.7705078125,
"y": 1931.0078125,
"type": "target",
"move_mode": "walk",
"action": "",
"action_params": ""
}
]
}

View File

@@ -1,33 +0,0 @@
{
"info": {
"name": "紧急修理-3",
"type": "collect",
"author": "云闲vsv",
"version": "1.0",
"description": "紧急修理-3",
"map_name": "Teyvat",
"bgi_version": "0.45.0",
"tags": [],
"last_modified_time": 1753249768651
},
"positions": [
{
"id": 1,
"x": -830.6689453125,
"y": 1937.72607421875,
"type": "path",
"move_mode": "walk",
"action": "",
"action_params": ""
},
{
"id": 2,
"x": -834.6298828125,
"y": 1940.248046875,
"type": "target",
"move_mode": "walk",
"action": "",
"action_params": ""
}
]
}

View File

@@ -1,33 +0,0 @@
{
"info": {
"name": "紧急修理-41",
"type": "collect",
"author": "云闲vsv",
"version": "1.0",
"description": "紧急修理-41",
"map_name": "Teyvat",
"bgi_version": "0.45.0",
"tags": [],
"last_modified_time": 1753252647951
},
"positions": [
{
"id": 1,
"x": -843.587890625,
"y": 1947.9501953125,
"action": "",
"move_mode": "walk",
"action_params": "",
"type": "path"
},
{
"id": 2,
"x": -848.833984375,
"y": 1948.328125,
"action": "",
"move_mode": "walk",
"action_params": "",
"type": "target"
}
]
}

View File

@@ -1,42 +0,0 @@
{
"info": {
"name": "紧急修理-42",
"type": "collect",
"author": "云闲vsv",
"version": "1.0",
"description": "紧急修理-42",
"map_name": "Teyvat",
"bgi_version": "0.45.0",
"tags": [],
"last_modified_time": 1753252732943
},
"positions": [
{
"id": 1,
"x": -818.5166015625,
"y": 1977.59521484375,
"action": "",
"move_mode": "walk",
"action_params": "",
"type": "path"
},
{
"id": 2,
"x": -821.294921875,
"y": 1982.263671875,
"action": "",
"move_mode": "walk",
"action_params": "",
"type": "path"
},
{
"id": 3,
"x": -823.4609375,
"y": 1982.63720703125,
"action": "",
"move_mode": "walk",
"action_params": "",
"type": "target"
}
]
}

View File

@@ -1,51 +0,0 @@
{
"info": {
"name": "紧急修理-5",
"type": "collect",
"author": "云闲vsv",
"version": "1.0",
"description": "紧急修理-5",
"map_name": "Teyvat",
"bgi_version": "0.45.0",
"tags": [],
"last_modified_time": 1753250863130
},
"positions": [
{
"id": 1,
"x": -822.8193359375,
"y": 1982.76611328125,
"type": "path",
"move_mode": "walk",
"action": "fight",
"action_params": ""
},
{
"id": 2,
"x": -809.302734375,
"y": 1976.6767578125,
"type": "path",
"move_mode": "walk",
"action": "fight",
"action_params": ""
},
{
"id": 3,
"x": -819.9609375,
"y": 1981.93212890625,
"type": "path",
"move_mode": "walk",
"action": "",
"action_params": ""
},
{
"id": 4,
"x": -822.806640625,
"y": 1982.79443359375,
"type": "target",
"move_mode": "walk",
"action": "",
"action_params": ""
}
]
}

View File

@@ -1,42 +0,0 @@
{
"info": {
"name": "紧急修理-6",
"type": "collect",
"author": "云闲vsv",
"version": "1.0",
"description": "紧急修理-6",
"map_name": "Teyvat",
"bgi_version": "0.45.0",
"tags": [],
"last_modified_time": 1753250982121
},
"positions": [
{
"id": 1,
"x": -783.5947265625,
"y": 1967.576171875,
"type": "path",
"move_mode": "walk",
"action": "",
"action_params": ""
},
{
"id": 2,
"x": -769.1162109375,
"y": 1953.279296875,
"type": "path",
"move_mode": "walk",
"action": "",
"action_params": ""
},
{
"id": 3,
"x": -764.494140625,
"y": 1949.13818359375,
"type": "target",
"move_mode": "walk",
"action": "",
"action_params": ""
}
]
}

View File

@@ -1,42 +0,0 @@
{
"info": {
"name": "紧急修理-7",
"type": "collect",
"author": "云闲vsv",
"version": "1.0",
"description": "紧急修理-7",
"map_name": "Teyvat",
"bgi_version": "0.45.0",
"tags": [],
"last_modified_time": 1753251290977
},
"positions": [
{
"id": 1,
"x": -815.8671875,
"y": 1978.14013671875,
"type": "path",
"move_mode": "walk",
"action": "",
"action_params": ""
},
{
"id": 2,
"x": -818.4169921875,
"y": 1981.43310546875,
"type": "path",
"move_mode": "walk",
"action": "",
"action_params": ""
},
{
"id": 3,
"x": -823.0791015625,
"y": 1982.77685546875,
"type": "target",
"move_mode": "walk",
"action": "",
"action_params": ""
}
]
}

View File

@@ -6,16 +6,24 @@
},
{
"type": "对话",
"note": "执行对话步骤默认跳过10次对话"
"data": {
"priorityOptions": ["好的"],
"npcWhiteList": ["马斯克"]
},
"note": "与艾拉·马斯克对话"
},
{
{
"type": "等待返回主界面",
"note": "等待对话完成"
},
{
"type": "地图追踪",
"data": "语言交流-2.json",
"note": "执行第二个地图追踪步骤"
},
{
"type": "对话",
"note": "执行对话步骤默认跳过10次对话"
"note": "执行对话步骤"
},
{
"type": "地图追踪",
@@ -24,7 +32,7 @@
},
{
"type": "对话",
"note": "执行对话步骤默认跳过10次对话"
"note": "执行对话步骤"
},
{
"type": "地图追踪",
@@ -33,7 +41,7 @@
},
{
"type": "对话",
"note": "执行对话步骤默认跳过10次对话"
"note": "执行对话步骤"
}
]

View File

@@ -5,9 +5,16 @@
"note": "执行第一个地图追踪步骤"
},
{
"type": "按键",
"data": "F",
"note": "按下F键"
"type": "对话",
"data": {
"priorityOptions": ["好的"],
"npcWhiteList": ["马斯克"]
},
"note": "与艾拉·马斯克对话"
},
{
"type": "等待返回主界面",
"note": "等待对话完成"
},
{
"type": "地图追踪",
@@ -15,9 +22,15 @@
"note": "执行第二个地图追踪步骤"
},
{
"type": "按键",
"data": "F",
"note": "按下F键"
"type": "对话",
"data": {
"npcWhiteList": ["马斯克"]
},
"note": "与艾拉·马斯克对话"
},
{
"type": "等待返回主界面",
"note": "等待对话完成"
},
{
"type": "地图追踪",
@@ -35,8 +48,10 @@
"note": "执行第四个地图追踪步骤"
},
{
"type": "按键",
"data": "F",
"note": "按下F键"
"type": "对话",
"data": {
"npcWhiteList": ["马斯克"]
},
"note": "与艾拉·马斯克对话"
}
]

View File

@@ -6,11 +6,15 @@
},
{
"type": "对话",
"note": "执行对话步骤默认跳过10次对话"
"data": {
"priorityOptions": ["好的"],
"npcWhiteList": ["怀尔德"]
},
"note": "与怀尔德对话"
},
{
"type": "等待",
"data": 20
"type": "等待返回主界面",
"note": "等待对话完成"
},
{
"type": "地址检测",
@@ -25,14 +29,17 @@
"type": "地址检测",
"data": [
-472,
1949
1718
],
"note": "目的地址与检测地址超过15的情况",
"run": "东南方向位置.json"
},
{
"type": "对话",
"note": "执行对话步骤默认跳过10次对话"
"data": {
"npcWhiteList": ["怀尔德"]
},
"note": "与怀尔德对话"
},
{
"type": "自动任务",

View File

@@ -6,11 +6,15 @@
},
{
"type": "对话",
"note": "执行对话步骤默认跳过10次对话"
"data": {
"priorityOptions": ["好的"],
"npcWhiteList": ["怀尔德"]
},
"note": "与怀尔德对话"
},
{
"type": "等待",
"data": 20
"type": "等待返回主界面",
"note": "等待对话完成"
},
{
"type": "地址检测",
@@ -44,7 +48,9 @@
},
{
"type": "对话",
"note": "执行对话步骤默认跳过10次对话"
"data": {
"npcWhiteList": ["怀尔德"]
},
"note": "与怀尔德对话"
}
]

View File

@@ -1,49 +1,58 @@
{
{
"info": {
"name": "餐品订单-1",
"type": "collect",
"author": "小鹰划船不用桨",
"version": "1.0",
"authors": [
{
"links": "",
"name": "小鹰划船不用桨"
}
],
"bgi_version": "0.45.0",
"description": "寻路",
"enable_monster_loot_split": false,
"last_modified_time": 1771747226066,
"map_match_method": "",
"map_name": "Teyvat",
"bgi_version": "0.45.0"
"name": "餐品订单-1",
"tags": [],
"type": "collect",
"version": "1.0"
},
"positions": [
{
"action": "",
"action_params": "",
"id": 1,
"x": -867.693359375,
"y": 2281.361572265625,
"action": "",
"move_mode": "walk",
"action_params": "",
"type": "teleport"
"type": "teleport",
"x": -867.693359375,
"y": 2281.361572265625
},
{
"action": "",
"action_params": "",
"id": 2,
"move_mode": "dash",
"type": "path",
"x": -880.0439453125,
"y": 2268.28662109375,
"action": "",
"move_mode": "dash",
"action_params": "",
"type": "path"
"y": 2268.28662109375
},
{
"action": "",
"action_params": "",
"id": 3,
"x": -889.107421875,
"y": 2246.7099609375,
"action": "",
"move_mode": "dash",
"action_params": "",
"type": "path"
"type": "path",
"x": -888.0629187322411,
"y": 2247
},
{
"id": 4,
"x": -888.232421875,
"y": 2241.43359375,
"action": "",
"move_mode": "dash",
"action_params": "",
"type": "path"
"id": 4,
"move_mode": "walk",
"type": "target",
"x": -887.58984375,
"y": 2241.4951171875
}
]
}

View File

@@ -164,16 +164,20 @@ var CommissionData = {
var commissionsData;
if (shouldUpdateExisting && existingData) {
// 只更新location为已完成的状态
// 只更新location为已完成的状态或原location为未知地点的委托
for (var i = 0; i < existingData.commissions.length; i++) {
const existingCommission = existingData.commissions[i];
const newCommission = commissionsTable.find(c => c.name === existingCommission.name);
if (newCommission && newCommission.location === "已完成") {
existingCommission.location = "已完成";
existingCommission.type = newCommission.type;
existingCommission.supported = newCommission.supported;
// 保留其他原有字段
if (newCommission) {
if (existingCommission.location === "未知地点") {
// 原地点为未知:更新所有字段
existingCommission.location = newCommission.location;
existingCommission.type = newCommission.type;
existingCommission.supported = newCommission.supported;
existingCommission.country = newCommission.country;
existingCommission.CommissionPosition = newCommission.CommissionPosition;
}
}
}

View File

@@ -4,10 +4,10 @@ function levenshteinDistance(str1, str2) {
const m = str1.length;
const n = str2.length;
const dp = Array(m + 1).fill(null).map(() => Array(n + 1).fill(0));
for (let i = 0; i <= m; i++) dp[i][0] = i;
for (let j = 0; j <= n; j++) dp[0][j] = j;
for (let i = 1; i <= m; i++) {
for (let j = 1; j <= n; j++) {
const cost = str1[i - 1] === str2[j - 1] ? 0 : 1;
@@ -18,34 +18,34 @@ function levenshteinDistance(str1, str2) {
);
}
}
return dp[m][n];
}
// 获取最接近的匹配项(带阈值)
function getClosestMatch(target, candidates, threshold = Constants.MATCH_THRESHOLD.DEFAULT) {
if (!candidates || candidates.length === 0) return null;
let closest = candidates[0];
let minDistance = levenshteinDistance(target, closest);
let maxSimilarity = calculateSimilarity(target, closest);
for (let i = 1; i < candidates.length; i++) {
const distance = levenshteinDistance(target, candidates[i]);
const similarity = calculateSimilarity(target, candidates[i]);
if (similarity > maxSimilarity) {
maxSimilarity = similarity;
minDistance = distance;
closest = candidates[i];
}
}
// 检查相似度是否达到阈值
if (maxSimilarity < threshold) {
return null;
}
return closest;
}
@@ -62,31 +62,31 @@ var CommissionStandardizer = {
fight: {},
talk: {}
},
// 初始化标准化列表
initialize: function() {
initialize: function () {
log.info("初始化委托标准化列表...");
try {
// 初始化战斗委托标准化列表
this.standardizationLists.fight = this.buildFightStandardizationList();
// 初始化对话委托标准化列表
this.standardizationLists.talk = this.buildTalkStandardizationList();
log.info("委托标准化列表初始化完成");
log.debug("战斗委托标准化列表: {count} 个委托", Object.keys(this.standardizationLists.fight).length);
log.debug("对话委托标准化列表: {count} 个委托", Object.keys(this.standardizationLists.talk).length);
log.debug("standardizationLists的值:{x}",JSON.stringify(this.standardizationLists))
log.debug("standardizationLists的值:{x}", JSON.stringify(this.standardizationLists))
} catch (error) {
log.error("初始化标准化列表时出错: {error}", error.message);
}
},
// 构建战斗委托标准化列表
buildFightStandardizationList: function() {
buildFightStandardizationList: function () {
const fightList = {};
try {
// 读取assets目录下除process外的所有文件夹
const assetsPath = "assets";
@@ -102,10 +102,10 @@ var CommissionStandardizer = {
// 从完整路径中提取文件夹名称
const folderName = folderPath.replace(assetsPath + "/", "").replace(assetsPath + "\\", "");
const files = Array.from(file.readPathSync(folderPath));
// 过滤出json文件
const jsonFiles = files.filter(file => file.endsWith(".json"));
// 提取文件名(不包含路径和.json后缀并去除-1 -2等数字后缀
const cleanFileNames = jsonFiles.map(filePath => {
// 从完整路径中提取文件名
@@ -113,72 +113,72 @@ var CommissionStandardizer = {
// 去除-1 -2等数字后缀和.json后缀
return fileName.replace(/-(\d+)?\.json$/, "");
});
fightList[folderName] = cleanFileNames;
}
} catch (error) {
log.error("构建战斗委托标准化列表时出错: {error}", error.message);
}
return fightList;
},
// 构建对话委托标准化列表
buildTalkStandardizationList: function() {
buildTalkStandardizationList: function () {
const talkList = {};
try {
// 读取assets/process目录下的所有文件夹
const processPath = "assets/process";
const items = Array.from(file.readPathSync(processPath));
// 过滤出文件夹
const folders = items.filter(item => {
return file.isFolder(item);
});
// 遍历每个对话委托文件夹
for (const folderPath of folders) {
// 从完整路径中提取文件夹名称
const folderName = folderPath.split("/").pop().split("\\").pop();
const subItems = Array.from(file.readPathSync(folderPath));
// 过滤出子文件夹
const subFolders = subItems.filter(subItem => {
return file.isFolder(subItem);
});
// 从完整路径中提取子文件夹名称
const cleanSubFolders = subFolders.map(subFolderPath => {
// 从完整路径中提取最后一级文件夹名称
return subFolderPath.split("/").pop().split("\\").pop();
});
talkList[folderName] = cleanSubFolders;
}
} catch (error) {
log.error("构建对话委托标准化列表时出错: {error}", error.message);
}
return talkList;
},
// 标准化委托名称
standardizeCommissionName: function(rawName) {
standardizeCommissionName: function (rawName) {
// 从所有标准化列表中查找最接近的名称
const allNames = [
...Object.keys(this.standardizationLists.fight),
...Object.keys(this.standardizationLists.talk)
];
return getClosestMatch(rawName, allNames, Constants.MATCH_THRESHOLD.COMISSIONS_NAME);
},
// 标准化委托地点
standardizeCommissionLocation: function(commissionName, rawLocation) {
standardizeCommissionLocation: function (commissionName, rawLocation) {
// 根据委托类型选择对应的标准化列表
let candidates = [];
if (this.standardizationLists.fight[commissionName]) {
// 战斗委托
candidates = this.standardizationLists.fight[commissionName];
@@ -186,15 +186,15 @@ var CommissionStandardizer = {
// 对话委托
candidates = this.standardizationLists.talk[commissionName];
}
if (candidates.length === 0) {
log.warn("没有找到委托 {name} 的标准化地点列表", commissionName);
return rawLocation;
}
// 获取最接近的地点
const closestLocation = getClosestMatch(rawLocation, candidates, Constants.MATCH_THRESHOLD.LOCATION);
if (closestLocation) {
log.info("标准化地点: {raw} -> {standard}", rawLocation, closestLocation);
return closestLocation;
@@ -207,7 +207,7 @@ var CommissionStandardizer = {
var CommissionRecognition = {
// 识别委托地点
recognizeCommissionLocation: async function() {
recognizeCommissionLocation: async function () {
try {
log.info(
"识别委托地点 ({x}, {y}) ({width}, {height})...",
@@ -232,7 +232,7 @@ var CommissionRecognition = {
},
// 检测是否进入委托详情界面
checkDetailPageEntered: async function() {
checkDetailPageEntered: async function () {
try {
// 尝试3次OCR识别
for (var i = 0; i < 3; i++) {
@@ -275,7 +275,7 @@ var CommissionRecognition = {
},
// 识别委托列表 - 进行4个单独识别
recognizeCommissions: async function(supportedCommissions) {
recognizeCommissions: async function (supportedCommissions) {
try {
log.info("开始执行委托识别");
@@ -319,11 +319,9 @@ var CommissionRecognition = {
// 标准化委托名称
var standardizedName = CommissionStandardizer.standardizeCommissionName(text);
if (standardizedName && standardizedName !== text) {
log.info('委托名称标准化: "{raw}" -> "{standard}"', text, standardizedName);
log.info('委托名称标准化: {raw} -> {standard}', text, standardizedName);
text = standardizedName;
} else {
log.debug('委托名称相似度未达阈值,保持原名称: "{raw}"', text);
}
}
// 检查委托类型
var isFightCommission = supportedCommissions.fight.includes(text);
@@ -332,8 +330,8 @@ var CommissionRecognition = {
var commissionType = isFightCommission
? Constants.COMMISSION_TYPE.FIGHT
: isTalkCommission
? Constants.COMMISSION_TYPE.TALK
: "";
? Constants.COMMISSION_TYPE.TALK
: "";
allCommissions.push({
id: regionIndex + 1,
@@ -422,14 +420,14 @@ var CommissionRecognition = {
log.info("委托国家: {status}", detailStatus);
commission.country = detailStatus;
var location = await CommissionRecognition.recognizeCommissionLocation();
// 标准化委托地点
var standardizedLocation = CommissionStandardizer.standardizeCommissionLocation(commission.name, location);
if (standardizedLocation && standardizedLocation !== location) {
log.info('委托地点标准化: "{raw}" -> "{standard}"', location, standardizedLocation);
location = standardizedLocation;
}
commission.location = location;
log.info(
"委托 {name} 的地点: {location}",
@@ -526,9 +524,7 @@ var CommissionRecognition = {
if (standardizedName && standardizedName !== text) {
log.info('委托名称标准化: "{raw}" -> "{standard}"', text, standardizedName);
text = standardizedName;
} else {
log.info('委托名称相似度未达阈值,保持原名称: "{raw}"', text);
}
}
// 检查委托类型
var isFightCommission = supportedCommissions.fight.includes(text);
@@ -537,8 +533,8 @@ var CommissionRecognition = {
var commissionType = isFightCommission
? Constants.COMMISSION_TYPE.FIGHT
: isTalkCommission
? Constants.COMMISSION_TYPE.TALK
: "";
? Constants.COMMISSION_TYPE.TALK
: "";
fourthCommission = {
id: 4,
@@ -618,14 +614,14 @@ var CommissionRecognition = {
// 识别委托地点
var location = await CommissionRecognition.recognizeCommissionLocation();
// 标准化委托地点
var standardizedLocation = CommissionStandardizer.standardizeCommissionLocation(fourthCommission.name, location);
if (standardizedLocation && standardizedLocation !== location) {
log.info('委托地点标准化: "{raw}" -> "{standard}"', location, standardizedLocation);
location = standardizedLocation;
}
fourthCommission.location = location;
log.info(
"委托 {name} 的地点: {location}",

View File

@@ -1,7 +1,7 @@
{
"manifest_version": 1,
"name": "(对话+成就)全自动蒙德地区每日委托",
"version": "0.98.16",
"version": "0.98.17",
"tags": [
"委托",
"对话",