diff --git a/repo/js/AutoCommission/assets/process/餐品订单/蒙德城/process.json b/repo/js/AutoCommission/assets/process/餐品订单/蒙德城/process.json index 2601f2955..fa899c6dd 100644 --- a/repo/js/AutoCommission/assets/process/餐品订单/蒙德城/process.json +++ b/repo/js/AutoCommission/assets/process/餐品订单/蒙德城/process.json @@ -1,49 +1,32 @@ [ { - "type": "地图追踪", - "data": "餐品订单-1.json", - "note": "执行第一个地图追踪步骤" - }, - { - "type": "对话", - "data": { - "skipCount": 5, - "priorityOptions": [ - "餐品外送订单", - "好吧" - ], - "npcWhiteList": [ - "莎拉" - ] - }, - "note": "执行对话步骤,优先选择特定选项并与白名单NPC交互" - }, - { - "type": "关闭商店界面", - "note": "关闭商店界面(如果现在在商店页面)" + "type": "委托描述检测", + "data": "与莎拉对话", + "note": "尝试接取委托任务", + "run": "接取任务.json" }, { "type": "委托描述检测", "data": "取得制作好的餐品", - "note": "分支名字正确的情况", + "note": "取得制作好的餐品", "run": "取餐.json" }, { "type": "委托描述检测", "data": "询问帕拉德", - "note": "分支名字正确的情况", + "note": "询问帕拉德", "run": "询问帕拉德.json" }, { "type": "委托描述检测", "data": "运送餐品给活跃的欧琳", - "note": "分支名字正确的情况", + "note": "运送餐品给活跃的欧琳", "run": "找到活跃的欧琳.json" }, { "type": "地图追踪", "data": "餐品订单-1.json", - "note": "执行第四个地图追踪步骤" + "note": "寻路莎拉-交付餐费" }, { "type": "对话", @@ -58,9 +41,5 @@ ] }, "note": "执行对话步骤,优先选择特定选项并与白名单NPC交互" - }, - { - "type": "关闭商店界面", - "note": "关闭商店界面(如果现在在商店页面)" } ] \ No newline at end of file diff --git a/repo/js/AutoCommission/assets/process/餐品订单/蒙德城/接取任务.json b/repo/js/AutoCommission/assets/process/餐品订单/蒙德城/接取任务.json new file mode 100644 index 000000000..150150db8 --- /dev/null +++ b/repo/js/AutoCommission/assets/process/餐品订单/蒙德城/接取任务.json @@ -0,0 +1,21 @@ +[ + { + "type": "地图追踪", + "data": "餐品订单-1.json", + "note": "寻路到莎拉" + }, + { + "type": "对话", + "data": { + "skipCount": 5, + "priorityOptions": [ + "餐品外送订单", + "好吧" + ], + "npcWhiteList": [ + "莎拉" + ] + }, + "note": "与莎拉对话接取任务" + } +] \ No newline at end of file diff --git a/repo/js/AutoCommission/constants.js b/repo/js/AutoCommission/constants.js index 2036698fd..941d1f672 100644 --- a/repo/js/AutoCommission/constants.js +++ b/repo/js/AutoCommission/constants.js @@ -1,8 +1,8 @@ // 原神每日委托自动执行脚本 - 常量定义模块 var Constants = { // 版本和编译信息 - VERSION: "0.98.7", - BUILD_TIME: "2025.09.29", + VERSION: "0.98.8", + BUILD_TIME: "2025.10.04", // 文件路径常量 SUPPORT_LIST_PATH: "name.json", @@ -15,7 +15,9 @@ var Constants = { // 图像识别相关常量 COMPLETED_IMAGE_PATH: "Data/RecognitionObject/Completed.png", UNCOMPLETED_IMAGE_PATH: "Data/RecognitionObject/UnCompleted.png", - + TALK_EXIT_IMAGE_PATH:"/Data/RecognitionObject/TalkExit.png", + TALK_ICON_IMAGE_PATH:"/Data/RecognitionObject/TalkIcon.png", + // 基础配置常量 MIN_TEXT_LENGTH: 3, // 最小文本长度 MAX_COMMISSION_RETRY_COUNT: 1, // 默认重试机制,超过则跳过该委托 diff --git a/repo/js/AutoCommission/lib/dialog-processor.js b/repo/js/AutoCommission/lib/dialog-processor.js index 319541fd1..575c8a4c4 100644 --- a/repo/js/AutoCommission/lib/dialog-processor.js +++ b/repo/js/AutoCommission/lib/dialog-processor.js @@ -191,9 +191,48 @@ var DialogProcessor = { } // 如果没有找到优先选项,则使用默认跳过 - if (!foundPriorityOption) { - keyPress("F"); - await sleep(100); + if (!foundPriorityOption && !isInMainUI()) { + let exitList = await Utils.easyTemplateMatch( + Constants.TALK_EXIT_IMAGE_PATH, + dialogRegion, + (useMask = true) + ); + let iconList = await Utils.easyTemplateMatch( + Constants.TALK_ICON_IMAGE_PATH, + dialogRegion + ); + let clickXY = null; + //正常应该只识别到一个退出选项,如果识别到多个,则去点击气泡对话选项 + if (exitList.count === 1) { + log.info("发现一个退出对话选项"); + clickXY = [exitList[0].x, exitList[0].y]; + + //点击最下边的气泡选项 + } else if (iconList.count > 0) { + log.info( + `发现{count}个气泡对话选项,点击最后一个`, + iconList.count + ); + iconList = [...iconList]; + iconList.sort((a, b) => b.y - a.y); + clickXY = [iconList[0].x, iconList[0].y]; + } else { + log.warn("指定类型的对话选项不符合数量条件,不进行操作"); + log.warn( + `退出图标:{exit}个,气泡图标:{icon}个`, + exitList.count, + iconList.count + ); + } + + //点击对话选项 + if (clickXY) { + keyDown("VK_MENU"); + await sleep(300); + click(...clickXY); + leftButtonClick(); + keyUp("VK_MENU"); + } } } }