diff --git a/repo/js/AutoMonday/README.md b/repo/js/AutoMonday/README.md index 5530fa16e..e328edc45 100644 --- a/repo/js/AutoMonday/README.md +++ b/repo/js/AutoMonday/README.md @@ -22,31 +22,26 @@ 1. 将脚本添加至调度器。 2. 右键点击脚本以修改 JS 自定义配置。 3. 点击运行即可 -4. 推荐和狗粮之类每天必跑的脚本放在一起使用 ## 注意事项 -1. 根本逻辑:脚本会自动识别地图左上角是否有晶蝶诱捕完成的标识,如果有,就会先去找电气水晶进行质变和爱可菲做菜,最后再收取晶核。最后收取晶核是为了保证诱捕装置最晚刷新,确保诱捕完成时质变仪也准备好了。所以在决定使用本脚本后,最好不要在手动使用其中任何一项 -2. 先决条件:**晶蝶诱捕装置一定要放置!!!脚本每天都需要运行!!!** -3. 诱捕位置:默认在枫丹合成台旁边的巷子口(详见[诱捕位置](./assets/诱捕.png)), - 1. 最好在诱捕完成后把脚本跑一遍,或者直接把assets中名为“晶蝶诱捕装置”的js复制在路径追踪里跑一遍,路径的终点就是诱捕装置的放置点。 - 2. 对位置不满意的话你也可以自己录制一个路径放进assets里,需要注意名字必须叫“晶蝶诱捕装置” -4. 冷却一致:晶蝶诱捕装置的冷却时间和质变仪cd要一致,如果不一致的话在脚本会自动调整一致。注意:在决定使用脚本之后最好不要在再手动使用其中任何一项 -5. 队伍需求:选择了拥有爱可菲后必须填写队伍,队伍名需要具有一定长度和辨识度避免识别失败 -6. 质变材料:默认使用薄荷,如果需要用其他材料请把assets里的图片替换掉。替换要注意要替换的材料在背包里和被替换的材料在一个目录,例如拿铁块可以换白铁块、水晶块等,星蕈可以换苹果、泡泡桔等 - - - -## 作者留言 -欢迎使用该脚本,毕竟使用的过程也是帮作者发现bug的过程~ -那么当你在使用时发现有bug存在,请反馈到频道并艾特作者! - - -## 致谢 -1. 本脚本是由茶包老师的多个脚本“魔改”而来,作者不生产脚本,只是脚本的裁缝工(这条非常重要!) -2. 感谢茶包大佬,本脚本的框架、逻辑、以及部分代码都是从这位大佬的代码中获取的,甚至创作灵感也是(茶包老师还是太全面了~) +1. 脚本目前阶段以完成任务为主,某些任务例如做菜、锻造等的个性化程度较低。~~这不是压根没有吗~~ 以做菜和锻造等为目标的用户请移步仓库使用专项脚本(后续会逐渐完善) +2. cd记录文件有逻辑变动,之前使用过此脚本的用户请手动删除record文件夹,避免无用数据长期留存 ~~其实不删也没事,多一行少一行的,不过最好还是删了呗~~ +3. 爱可菲和质变仪由于逻辑的高度相似,二者写进了一个函数里,cd以质变仪为准。人话就是想运行爱可菲做菜就得用质变仪,质变仪没刷爱可菲也没办法用(历史遗留问题,后续会逐渐完善。 ~~是谁总喜欢动逻辑我不说~~ ) +4. 质变材料:默认使用薄荷,如果需要用其他材料请把assets里的图片替换掉。替换要注意要替换的材料在背包里和被替换的材料在一个目录并且名字要相同,例如拿铁块可以换白铁块、水晶块等,星蕈可以换苹果、泡泡桔等 +5. 晶蝶诱捕装置:脚本会自动识别地图左上角是否有晶蝶诱捕完成的标识,如果有,才会收取晶核。需要注意的是诱捕装置需要放在枫丹合成台旁边的巷子口(详见[诱捕位置](./assets/诱捕.png)), 实在找不到位置的话可以把assets中名为“晶蝶诱捕装置”的js复制在路径追踪里跑一遍,路径的终点就是诱捕装置的放置点,或者对位置不满意的话也可以自己录制一个路径放进assets里,需要注意名字必须叫“晶蝶诱捕装置”。 +6. 首领和秘境任务需要配置战斗策略,首领是爆炎树急冻树,秘境是太山谷牛头人和讨债人 +7. 四方网和兑换券等任务请开图 --------------------------------------------------------------------------------------------------------------------------------- ## 更新日志 +### 1.2(2025.10.06) +1. 添加了自动纪行周常-秘境挑战的功能 +2. 添加了自动纪行周常-每周做菜的功能 +3. 添加了自动纪行周常-每周锻造的功能 +4. 添加了自动纪行周常-首领挑战的功能 +5. 添加了自动购买四方八方之网的功能 +6. 添加了自动购买(提交)投资券的功能 +7. 重写了脚本逻辑,不再依赖晶蝶诱捕装置为触发条件 ### 1.1(2025.09.24) 1. 修复了爱可菲在做菜过程中偶现的被电死的bug(做菜做到一半人没了?别担心,后续不会再有这种情况了!!!) 2. 完善了拦截背包过期物品的功能,不用每次打开背包之后再重复点击了! diff --git a/repo/js/AutoMonday/assets/RecognitionObject/锻造水晶块.png b/repo/js/AutoMonday/assets/RecognitionObject/锻造水晶块.png new file mode 100644 index 000000000..a6b6068b5 Binary files /dev/null and b/repo/js/AutoMonday/assets/RecognitionObject/锻造水晶块.png differ diff --git a/repo/js/AutoMonday/assets/RecognitionObject/锻造紫晶块.png b/repo/js/AutoMonday/assets/RecognitionObject/锻造紫晶块.png new file mode 100644 index 000000000..7689681ce Binary files /dev/null and b/repo/js/AutoMonday/assets/RecognitionObject/锻造紫晶块.png differ diff --git a/repo/js/AutoMonday/assets/RecognitionObject/锻造萃凝晶.png b/repo/js/AutoMonday/assets/RecognitionObject/锻造萃凝晶.png new file mode 100644 index 000000000..e19253668 Binary files /dev/null and b/repo/js/AutoMonday/assets/RecognitionObject/锻造萃凝晶.png differ diff --git a/repo/js/AutoMonday/assets/四方八方之网.json b/repo/js/AutoMonday/assets/四方八方之网.json new file mode 100644 index 000000000..29b29e617 --- /dev/null +++ b/repo/js/AutoMonday/assets/四方八方之网.json @@ -0,0 +1,76 @@ +{ + "config": { + "realtime_triggers": { + "AutoPick": true + } + }, + "farming_info": { + "allow_farming_count": false, + "duration_seconds": 0, + "elite_details": "", + "elite_mob_count": 0, + "normal_mob_count": 0, + "primary_target": "", + "total_mora": 0 + }, + "info": { + "authors": [ + { + "links": "https://github.com/jiangziyanowo", + "name": "江紫烟owo" + } + ], + "bgi_version": "0.45.0", + "description": "设计师若紫,购买四方八方之网", + "enable_monster_loot_split": false, + "items": [], + "last_modified_time": 1759502044257, + "map_match_method": "", + "map_name": "Teyvat", + "name": "四方八方之网", + "order": 0, + "tags": [], + "type": "collect", + "version": "1.0" + }, + "positions": [ + { + "action": "", + "id": 1, + "move_mode": "walk", + "point_ext_params": { + "description": "", + "enable_monster_loot_split": false, + "misidentification": { + "arrival_time": 0, + "handling_mode": "previousDetectedPoint", + "type": [ + "unrecognized" + ] + } + }, + "type": "teleport", + "x": -4231.943359375, + "y": -3001.84765625 + }, + { + "action": "", + "id": 2, + "move_mode": "run", + "point_ext_params": { + "description": "", + "enable_monster_loot_split": false, + "misidentification": { + "arrival_time": 0, + "handling_mode": "previousDetectedPoint", + "type": [ + "unrecognized" + ] + } + }, + "type": "target", + "x": -4242.96875, + "y": -2999.5625 + } + ] +} \ No newline at end of file diff --git a/repo/js/AutoMonday/assets/急冻树.json b/repo/js/AutoMonday/assets/急冻树.json new file mode 100644 index 000000000..8323745aa --- /dev/null +++ b/repo/js/AutoMonday/assets/急冻树.json @@ -0,0 +1,173 @@ +{ + "config": { + "realtime_triggers": { + "AutoPick": true + } + }, + "farming_info": { + "allow_farming_count": false, + "duration_seconds": 0, + "elite_details": "", + "elite_mob_count": 0, + "normal_mob_count": 0, + "primary_target": "", + "total_mora": 0 + }, + "info": { + "authors": [ + { + "links": "https://github.com/jiangziyanowo", + "name": "江紫烟owo" + } + ], + "bgi_version": "0.45.0", + "description": "急冻树", + "enable_monster_loot_split": false, + "items": [], + "last_modified_time": 1759408849965, + "map_match_method": "", + "map_name": "Teyvat", + "name": "急冻树", + "order": 0, + "tags": [], + "type": "collect", + "version": "1.0" + }, + "positions": [ + { + "action": "", + "id": 1, + "move_mode": "walk", + "point_ext_params": { + "description": "", + "enable_monster_loot_split": false, + "misidentification": { + "arrival_time": 0, + "handling_mode": "previousDetectedPoint", + "type": [ + "unrecognized" + ] + } + }, + "type": "teleport", + "x": -1641.603515625, + "y": 2158.08447265625 + }, + { + "action": "", + "id": 2, + "move_mode": "dash", + "point_ext_params": { + "description": "", + "enable_monster_loot_split": false, + "misidentification": { + "arrival_time": 0, + "handling_mode": "previousDetectedPoint", + "type": [ + "unrecognized" + ] + } + }, + "type": "path", + "x": -1637.072265625, + "y": 2132.359130859375 + }, + { + "action": "", + "id": 3, + "move_mode": "dash", + "point_ext_params": { + "description": "", + "enable_monster_loot_split": false, + "misidentification": { + "arrival_time": 0, + "handling_mode": "previousDetectedPoint", + "type": [ + "unrecognized" + ] + } + }, + "type": "path", + "x": -1631.140625, + "y": 2113.337890625 + }, + { + "action": "", + "id": 4, + "move_mode": "dash", + "point_ext_params": { + "description": "", + "enable_monster_loot_split": false, + "misidentification": { + "arrival_time": 0, + "handling_mode": "previousDetectedPoint", + "type": [ + "unrecognized" + ] + } + }, + "type": "path", + "x": -1643.59375, + "y": 2107.6484375 + }, + { + "action": "", + "id": 5, + "move_mode": "fly", + "point_ext_params": { + "description": "", + "enable_monster_loot_split": false, + "misidentification": { + "arrival_time": 0, + "handling_mode": "previousDetectedPoint", + "type": [ + "unrecognized" + ] + } + }, + "type": "path", + "x": -1663.01171875, + "y": 2109.18603515625 + }, + { + "action": "stop_flying", + "action_params": "500", + "id": 6, + "move_mode": "fly", + "point_ext_params": { + "description": "", + "enable_monster_loot_split": false, + "misidentification": { + "arrival_time": 0, + "handling_mode": "previousDetectedPoint", + "type": [ + "unrecognized" + ] + } + }, + "type": "path", + "x": -1663.744140625, + "y": 2109.3154296875 + }, + { + "action": "fight", + "action_params": "", + "id": 7, + "move_mode": "dash", + "point_ext_params": { + "description": "", + "enable_monster_loot_split": false, + "misidentification": { + "arrival_time": 0, + "handling_mode": "previousDetectedPoint", + "type": [ + "unrecognized" + ] + } + }, + "type": "target", + "x": -1672.767578125, + "y": 2098.68310546875 + } + ] +} \ No newline at end of file diff --git a/repo/js/AutoMonday/assets/投资券.json b/repo/js/AutoMonday/assets/投资券.json new file mode 100644 index 000000000..a51e337bb --- /dev/null +++ b/repo/js/AutoMonday/assets/投资券.json @@ -0,0 +1,221 @@ +{ + "config": { + "realtime_triggers": { + "AutoPick": true + } + }, + "farming_info": { + "allow_farming_count": false, + "duration_seconds": 0, + "elite_details": "", + "elite_mob_count": 0, + "normal_mob_count": 0, + "primary_target": "", + "total_mora": 0 + }, + "info": { + "authors": [ + { + "links": "https://github.com/jiangziyanowo", + "name": "江紫烟owo" + } + ], + "bgi_version": "0.45.0", + "description": "", + "enable_monster_loot_split": false, + "items": [], + "last_modified_time": 1759685222872, + "map_match_method": "", + "map_name": "Teyvat", + "name": "投资券", + "order": 0, + "tags": [], + "type": "collect", + "version": "1.0" + }, + "positions": [ + { + "action": "", + "id": 1, + "move_mode": "dash", + "point_ext_params": { + "description": "", + "enable_monster_loot_split": false, + "misidentification": { + "arrival_time": 0, + "handling_mode": "previousDetectedPoint", + "type": [ + "unrecognized" + ] + } + }, + "type": "teleport", + "x": 9458.0341796875, + "y": 1660.6640625 + }, + { + "action": "", + "id": 2, + "move_mode": "dash", + "point_ext_params": { + "description": "", + "enable_monster_loot_split": false, + "misidentification": { + "arrival_time": 0, + "handling_mode": "previousDetectedPoint", + "type": [ + "unrecognized" + ] + } + }, + "type": "path", + "x": 9439.078125, + "y": 1659.75927734375 + }, + { + "action": "", + "id": 3, + "move_mode": "dash", + "point_ext_params": { + "description": "", + "enable_monster_loot_split": false, + "misidentification": { + "arrival_time": 0, + "handling_mode": "previousDetectedPoint", + "type": [ + "unrecognized" + ] + } + }, + "type": "path", + "x": 9412.0537109375, + "y": 1661.5185546875 + }, + { + "action": "", + "id": 4, + "locked": false, + "move_mode": "walk", + "point_ext_params": { + "description": "", + "enable_monster_loot_split": false, + "misidentification": { + "arrival_time": 0, + "handling_mode": "previousDetectedPoint", + "type": [ + "unrecognized" + ] + } + }, + "type": "path", + "x": 9399.3916015625, + "y": 1651.9775390625 + }, + { + "action": "combat_script", + "action_params": "wait(1),keypress(F)", + "id": 5, + "move_mode": "walk", + "point_ext_params": { + "description": "", + "enable_monster_loot_split": false, + "misidentification": { + "arrival_time": 0, + "handling_mode": "previousDetectedPoint", + "type": [ + "unrecognized" + ] + } + }, + "type": "path", + "x": 9397.8310546875, + "y": 1643.77587890625 + }, + { + "action": "combat_script", + "action_params": "wait(5)", + "id": 6, + "move_mode": "walk", + "point_ext_params": { + "description": "", + "enable_monster_loot_split": false, + "misidentification": { + "arrival_time": 0, + "handling_mode": "previousDetectedPoint", + "type": [ + "unrecognized" + ] + } + }, + "type": "path", + "x": 9399.3916015625, + "y": 1651.9775390625 + }, + { + "action": "combat_script", + "action_params": "wait(1),keypress(F),wait(7)", + "id": 7, + "move_mode": "walk", + "point_ext_params": { + "description": "", + "enable_monster_loot_split": false, + "misidentification": { + "arrival_time": 0, + "handling_mode": "previousDetectedPoint", + "type": [ + "unrecognized" + ] + } + }, + "type": "path", + "x": 9394.96875, + "y": 1647.779296875 + }, + { + "action": "", + "id": 8, + "move_mode": "dash", + "point_ext_params": { + "description": "", + "enable_monster_loot_split": false, + "misidentification": { + "arrival_time": 0, + "handling_mode": "previousDetectedPoint", + "type": [ + "unrecognized" + ] + } + }, + "type": "path", + "x": 9385.9833984375, + "y": 1649.30615234375 + }, + { + "action": "", + "id": 9, + "move_mode": "dash", + "type": "path", + "x": 9389.75, + "y": 1662.125 + }, + { + "action": "", + "id": 10, + "move_mode": "dash", + "point_ext_params": { + "description": "", + "enable_monster_loot_split": false, + "misidentification": { + "arrival_time": 0, + "handling_mode": "previousDetectedPoint", + "type": [ + "unrecognized" + ] + } + }, + "type": "path", + "x": 9393.4921875, + "y": 1671.015625 + } + ] +} \ No newline at end of file diff --git a/repo/js/AutoMonday/assets/每周做菜.json b/repo/js/AutoMonday/assets/每周做菜.json new file mode 100644 index 000000000..52850589b --- /dev/null +++ b/repo/js/AutoMonday/assets/每周做菜.json @@ -0,0 +1,115 @@ +{ + "config": { + "realtime_triggers": { + "AutoPick": true + } + }, + "farming_info": { + "allow_farming_count": false, + "duration_seconds": 0, + "elite_details": "", + "elite_mob_count": 0, + "normal_mob_count": 0, + "primary_target": "", + "total_mora": 0 + }, + "info": { + "authors": [ + { + "links": "https://github.com/jiangziyanowo", + "name": "江紫烟owo" + } + ], + "bgi_version": "0.45.0", + "description": "蒙德做菜炉子", + "enable_monster_loot_split": false, + "items": [], + "last_modified_time": 1758891203475, + "map_match_method": "", + "map_name": "Teyvat", + "name": "每周做菜", + "order": 0, + "tags": [], + "type": "collect", + "version": "1.0" + }, + "positions": [ + { + "action": "", + "id": 1, + "move_mode": "run", + "point_ext_params": { + "description": "", + "enable_monster_loot_split": false, + "misidentification": { + "arrival_time": 0, + "handling_mode": "previousDetectedPoint", + "type": [ + "unrecognized" + ] + } + }, + "type": "teleport", + "x": -874.724609375, + "y": 2276.950439453125 + }, + { + "action": "", + "id": 2, + "move_mode": "run", + "point_ext_params": { + "description": "", + "enable_monster_loot_split": false, + "misidentification": { + "arrival_time": 0, + "handling_mode": "previousDetectedPoint", + "type": [ + "unrecognized" + ] + } + }, + "type": "path", + "x": -881.150390625, + "y": 2268.43115234375 + }, + { + "action": "", + "id": 3, + "move_mode": "run", + "point_ext_params": { + "description": "", + "enable_monster_loot_split": false, + "misidentification": { + "arrival_time": 0, + "handling_mode": "previousDetectedPoint", + "type": [ + "unrecognized" + ] + } + }, + "type": "path", + "x": -887.611328125, + "y": 2256.250244140625 + }, + { + "action": "", + "action_params": "", + "id": 4, + "move_mode": "run", + "point_ext_params": { + "description": "", + "enable_monster_loot_split": false, + "misidentification": { + "arrival_time": 0, + "handling_mode": "previousDetectedPoint", + "type": [ + "unrecognized" + ] + } + }, + "type": "target", + "x": -883.83203125, + "y": 2242.46826171875 + } + ] +} \ No newline at end of file diff --git a/repo/js/AutoMonday/assets/爆炎树.json b/repo/js/AutoMonday/assets/爆炎树.json new file mode 100644 index 000000000..8e9c7c1e3 --- /dev/null +++ b/repo/js/AutoMonday/assets/爆炎树.json @@ -0,0 +1,218 @@ +{ + "config": { + "realtime_triggers": { + "AutoPick": true + } + }, + "farming_info": { + "allow_farming_count": false, + "duration_seconds": 0, + "elite_details": "", + "elite_mob_count": 0, + "normal_mob_count": 0, + "primary_target": "", + "total_mora": 0 + }, + "info": { + "authors": [ + { + "links": "https://github.com/jiangziyanowo", + "name": "江紫烟owo" + } + ], + "bgi_version": "0.45.0", + "description": "爆炎树", + "enable_monster_loot_split": false, + "items": [], + "last_modified_time": 1759468355690, + "map_match_method": "", + "map_name": "Teyvat", + "name": "爆炎树", + "order": 0, + "tags": [], + "type": "collect", + "version": "1.0" + }, + "positions": [ + { + "action": "", + "id": 1, + "move_mode": "walk", + "point_ext_params": { + "description": "", + "enable_monster_loot_split": false, + "misidentification": { + "arrival_time": 0, + "handling_mode": "previousDetectedPoint", + "type": [ + "unrecognized" + ] + } + }, + "type": "teleport", + "x": 837.783203125, + "y": 235.43994140625 + }, + { + "action": "", + "id": 2, + "move_mode": "dash", + "point_ext_params": { + "description": "", + "enable_monster_loot_split": false, + "misidentification": { + "arrival_time": 0, + "handling_mode": "previousDetectedPoint", + "type": [ + "unrecognized" + ] + } + }, + "type": "path", + "x": 867.9873046875, + "y": 243.50244140625 + }, + { + "action": "", + "id": 3, + "move_mode": "dash", + "point_ext_params": { + "description": "", + "enable_monster_loot_split": false, + "misidentification": { + "arrival_time": 0, + "handling_mode": "previousDetectedPoint", + "type": [ + "unrecognized" + ] + } + }, + "type": "path", + "x": 880.9384765625, + "y": 245.7353515625 + }, + { + "action": "", + "id": 4, + "move_mode": "fly", + "point_ext_params": { + "description": "", + "enable_monster_loot_split": false, + "misidentification": { + "arrival_time": 0, + "handling_mode": "previousDetectedPoint", + "type": [ + "unrecognized" + ] + } + }, + "type": "path", + "x": 896.1376953125, + "y": 239.607421875 + }, + { + "action": "stop_flying", + "action_params": "500", + "id": 5, + "move_mode": "fly", + "point_ext_params": { + "description": "", + "enable_monster_loot_split": false, + "misidentification": { + "arrival_time": 0, + "handling_mode": "previousDetectedPoint", + "type": [ + "unrecognized" + ] + } + }, + "type": "path", + "x": 896.4462890625, + "y": 239.505859375 + }, + { + "action": "", + "id": 6, + "move_mode": "dash", + "point_ext_params": { + "description": "", + "enable_monster_loot_split": false, + "misidentification": { + "arrival_time": 0, + "handling_mode": "previousDetectedPoint", + "type": [ + "unrecognized" + ] + } + }, + "type": "path", + "x": 936.232421875, + "y": 240.513671875 + }, + { + "id": 7, + "move_mode": "dash", + "type": "path", + "x": 952.75, + "y": 229.5 + }, + { + "action": "", + "id": 8, + "move_mode": "dash", + "point_ext_params": { + "description": "", + "enable_monster_loot_split": false, + "misidentification": { + "arrival_time": 0, + "handling_mode": "previousDetectedPoint", + "type": [ + "unrecognized" + ] + } + }, + "type": "path", + "x": 957.9921875, + "y": 207.2734375 + }, + { + "action": "", + "id": 9, + "move_mode": "dash", + "point_ext_params": { + "description": "", + "enable_monster_loot_split": false, + "misidentification": { + "arrival_time": 0, + "handling_mode": "previousDetectedPoint", + "type": [ + "unrecognized" + ] + } + }, + "type": "path", + "x": 955.5869140625, + "y": 173.9677734375 + }, + { + "action": "fight", + "action_params": "", + "id": 10, + "move_mode": "dash", + "point_ext_params": { + "description": "", + "enable_monster_loot_split": false, + "misidentification": { + "arrival_time": 0, + "handling_mode": "previousDetectedPoint", + "type": [ + "unrecognized" + ] + } + }, + "type": "target", + "x": 954.091796875, + "y": 153.11865234375 + } + ] +} \ No newline at end of file diff --git a/repo/js/AutoMonday/assets/瓦格纳.json b/repo/js/AutoMonday/assets/瓦格纳.json new file mode 100644 index 000000000..f6c34b35e --- /dev/null +++ b/repo/js/AutoMonday/assets/瓦格纳.json @@ -0,0 +1,48 @@ +{ + "info": { + "name": "蒙德铁匠铺", + "type": "collect", + "author": "寒露", + "version": "1.0", + "description": "", + "bgi_version": "0.42.3" + }, + "positions": [ + { + "id": 1, + "action": "", + "move_mode": "walk", + "type": "teleport", + "x": -875.2568359375, + "y": 2277.54150390625, + "action_params": "" + }, + { + "id": 2, + "x": -891.330078125, + "y": 2257.5595703125, + "type": "path", + "move_mode": "walk", + "action": "", + "action_params": "" + }, + { + "id": 3, + "x": -921.8359375, + "y": 2232.016845703125, + "type": "path", + "move_mode": "walk", + "action": "", + "action_params": "" + }, + { + "id": 4, + "x": -922.5673828125, + "y": 2215.397216796875, + "type": "target", + "move_mode": "walk", + "action": "", + "action_params": "" + } + ] +} diff --git a/repo/js/AutoMonday/main.js b/repo/js/AutoMonday/main.js index 24f979d68..237043bb7 100644 --- a/repo/js/AutoMonday/main.js +++ b/repo/js/AutoMonday/main.js @@ -1,50 +1,145 @@ (async function () { /** * 封装函数,执行图片识别及点击操作(测试中,未封装完成,后续会优化逻辑) - * - * @param filePath 图片路径,默认为"空参数" - * @param timeout 超时时间,单位为秒,默认为10秒 - * @param afterBehavior 点击模式,0为关闭点击,1为开启点击,2为开启F键点击,默认为0 - * @param debugmodel 调试代码模式,0为关闭调试模式,1为开启调试模式,默认为0 - * @param xa 识别区域的x轴偏移量,默认为0 - * @param ya 识别区域的y轴偏移量,默认为0 - * @param wa 识别区域的宽度,默认为1920 - * @param ha 识别区域的高度,默认为1080 - * @returns 返回识别结果,包括图片的x轴坐标、y轴坐标、宽度、高度及是否找到图片 + * @param {string} imagefilePath - 模板图片路径 + * @param {number} timeout - 超时时间(秒) + * @param {number} afterBehavior - 识别后行为(0:无,1:点击,2:按F键) + * @param {number} debugmodel - 调试模式(0:关闭,1:详细日志) + * @param {number} xa - 识别区域X坐标 + * @param {number} ya - 识别区域Y坐标 + * @param {number} wa - 识别区域宽度 + * @param {number} ha - 识别区域高度 + * @param {boolean} clickCenter - 是否点击目标中心 + * @param {number} clickOffsetX - 点击位置X轴偏移量 + * @param {number} clickOffsetY - 点击位置Y轴偏移量 + * @param {number} tt - 匹配阈值(0-1) */ - async function imageRecognition(filePath = "空参数", timeout = 10, afterBehavior = 0, debugmodel = 0, xa = 0, ya = 0, wa = 1920, ha = 1080) { - const startTime = new Date(); - const Imagidentify = RecognitionObject.TemplateMatch(file.ReadImageMatSync(filePath)); - for (let ii = 0; ii < 10; ii++) { - captureRegion = captureGameRegion(); // 获取一张截图 - res = captureRegion.DeriveCrop(xa, ya, wa, ha).Find(Imagidentify); - if (res.isEmpty()) { - if (debugmodel === 1 & xa === 0 & ya === 0) { log.info("识别图片中") }; - } else { - if (afterBehavior === 1) { log.info("点击模式:开"); await sleep(1000); click(res.x, res.y); } else { if (debugmodel === 1 & xa === 0 & ya === 0) { log.info("点击模式:关") } } - if (afterBehavior === 2) { log.info("F模式:开"); await sleep(1000); keyPress("F"); } else { if (debugmodel === 1 & xa === 0 & ya === 0) { log.info("F模式:关") } } - if (debugmodel === 1 & xa === 0 & ya === 0) { log.info("全图代码位置:({x},{y},{h},{w})", res.x - 10, res.y - 10, res.width + 10, res.Height + 10); } else { log.info("识别到图片"); } - return result = { x: res.x, y: res.y, w: res.width, h: res.Height, found: true } - } - const NowTime = new Date(); - if ((NowTime - startTime) > timeout * 1000) { if (debugmodel === 1 & xa === 0 & ya === 0) { log.info(`${timeout}秒超时退出,未找到图片`); } return result = { found: false }; } else { ii = 8 } - await sleep(200); + async function imageRecognitionEnhanced( + imagefilePath = "空参数", + timeout = 10, + afterBehavior = 0, + debugmodel = 0, + xa = 0, + ya = 0, + wa = 1920, + ha = 1080, + clickCenter = false, // 新增:是否点击中心 + clickOffsetX = 0, // 新增:X轴偏移量 + clickOffsetY = 0, // 新增:Y轴偏移量 + tt = 0.8 + ) { + // 参数验证 + if (xa + wa > 1920 || ya + ha > 1080) { + log.info("图片区域超出屏幕范围"); + return { found: false, error: "区域超出屏幕范围" }; } - await sleep(1200); + + const startTime = Date.now(); + let captureRegion = null; + let result = { found: false }; + + try { + // 读取模板图像 + const templateImage = file.ReadImageMatSync(imagefilePath); + if (!templateImage) { + throw new Error("无法读取模板图像"); + } + + const Imagidentify = RecognitionObject.TemplateMatch(templateImage, true); + if (tt !== 0.8) { + Imagidentify.Threshold = tt; + Imagidentify.InitTemplate(); + } + + // 循环尝试识别 + for (let attempt = 0; attempt < 10; attempt++) { + if (Date.now() - startTime > timeout * 1000) { + if (debugmodel === 1) { + log.info(`${timeout}秒超时退出,未找到图片`); + } + break; + } + + captureRegion = captureGameRegion(); + if (!captureRegion) { + await sleep(200); + continue; + } + + try { + const croppedRegion = captureRegion.DeriveCrop(xa, ya, wa, ha); + const res = croppedRegion.Find(Imagidentify); + + if (res.isEmpty()) { + if (debugmodel === 1) { + log.info("识别图片中..."); + } + } else { + // 计算基准点击位置(目标的左上角) + let clickX = res.x + xa; + let clickY = res.y + ya; + + // 如果要求点击中心,计算中心点坐标 + if (clickCenter) { + clickX += Math.floor(res.width / 2); + clickY += Math.floor(res.height / 2); + } + + // 应用自定义偏移量 + clickX += clickOffsetX; + clickY += clickOffsetY; + + if (debugmodel === 1) { + log.info("计算后点击位置:({x},{y})", clickX, clickY); + } + + // 执行识别后行为 + if (afterBehavior === 1) { + await sleep(1000); + click(clickX, clickY); + } else if (afterBehavior === 2) { + await sleep(1000); + keyPress("F"); + } + + result = { + x: clickX, + y: clickY, + w: res.width, + h: res.height, + found: true + }; + break; + } + } finally { + if (captureRegion) { + captureRegion.dispose(); + captureRegion = null; + } + } + + await sleep(200); + } + } catch (error) { + log.info(`图像识别错误: ${error.message}`); + result.error = error.message; + } + + return result; } /** - * 文字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 包含识别结果的对象,包括识别的文字、坐标和是否找到的结果 - */ + * 文字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 @@ -66,10 +161,9 @@ 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 (debugmodel === 1 & x === 0 & y === 0) { log.info("全图代码位置:({x},{y},{h},{w})", res.x - 10, res.y - 10, res.width + 10, res.Height + 10); } + if (afterBehavior === 1) { await sleep(1000); click(res.x, res.y); } else { if (debugmodel === 1 & x === 0 & y === 0) { log.info("点击模式:关") } } + if (afterBehavior === 2) { 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) { @@ -149,7 +243,7 @@ await textOCR("小道具", 3, 0, 0, 126, 17, 99, 53); if (!result.found) { throw new Error("未打开'小道具'页面,请确保背包已正确打开并切换到小道具标签页"); }//确认在小道具界面 await sleep(500); - await imageRecognition(ZHIBIANYI, 1, 1, 0);//识别质变仪图片 + await imageRecognitionEnhanced(ZHIBIANYI, 1, 1, 0);//识别质变仪图片 if (!result.found) { await genshin.returnMainUi(); log.warn("'质变仪CD中'或'未找到质变仪!'"); @@ -171,7 +265,7 @@ await sleep(1000); let Fmeun = await textOCR("参量质变仪", 2, 2, 3, 1205, 508, 140, 53);//单条F检测 await keyPress("F"); - let CHAx = await imageRecognition(CHA, 3, 0, 0, 1766, 3, 140, 90); + let CHAx = await imageRecognitionEnhanced(CHA, 3, 0, 0, 1766, 3, 140, 90); if (!Fmeun.found && !CHAx.found) { return false; } //检测是否到达材料页面 @@ -206,7 +300,7 @@ const maxRetries = 20; // 最大重试次数 let retries = 0; // 当前重试次数 while (retries < maxRetries) { - await imageRecognition(BH, 1, 0, 0); + await imageRecognitionEnhanced(BH, 1, 0, 0); if (result.found) { await leftButtonUp(); await sleep(500); @@ -269,7 +363,7 @@ } } - // 背包过期物品识别,需要在背包界面,并且是1920x1080分辨率下使用 + // 背包过期物品识别 async function handleExpiredItems() { const ifGuoqi = await textOCR("物品过期", 5, 0, 0, 870, 280, 170, 40); if (ifGuoqi.found) { @@ -288,6 +382,27 @@ return sevenDaysLater.toISOString(); } + // 返回当前时间的下周一四点的时间戳 + function getNextMonday4AMISO() { + const now = new Date(); + + // 获取当前是星期几 + const currentDay = now.getDay(); + + // 计算距离下周一还有几天 + let daysUntilMonday = 1 - currentDay; + if (daysUntilMonday <= 0) { + daysUntilMonday += 7; + } + + // 创建下周一4点的日期对象 + const nextMonday4AM = new Date(now); + nextMonday4AM.setDate(now.getDate() + daysUntilMonday); + nextMonday4AM.setHours(4, 0, 0, 0); + + return nextMonday4AM.toISOString(); + } + // 检查文件是否存在 async function checkFileExists(filePath) { try { @@ -378,88 +493,103 @@ return null; } - //main/====================================================================================== + // 自动战斗函数 + async function autoFight(timeout) { + const cts = new CancellationTokenSource(); + dispatcher.runTask(new SoloTask("AutoFight"), cts); - // 人机验证 - if (!settings.ifCheck) { log.error("请阅读readme文件并做好相关设置后再运行此脚本!"); return; } + const startTime = Date.now(); + let fightResult = false; - //初始化配置 - var actiontime = 180;//最大等待时间,单位秒 - var TEAM; - var Material = settings.Material; - var BH = `assets/RecognitionObject/${Material}.png`; - var ZHIBIANYI = typeof settings.ZHIBIANY === 'string' && settings.ZHIBIANYI.trim() !== '' ? settings.ZHIBIANYI : "assets/RecognitionObject/zhibian.png"; - var CHA = "assets/RecognitionObject/cha.png" - - const ifAkf = settings.ifAkf; - - // 创建材质到ITEM的映射表 - // 养成道具=1,食物=2,材料=3 - const materialToItemMap = { - "牛角": 1, - "苹果": 2, "日落果": 2, "泡泡桔": 2, - "白铁块": 3, "水晶块": 3, "薄荷": 3, "菜": 3, - "鸡腿": 3, "蘑菇": 3, "鸟蛋": 3, "兽肉": 3, "甜甜花": 3 - }; - - // 直接通过映射获取ITEM值(未匹配时默认0) - ITEM = materialToItemMap[Material] || 0; - - const routeName = "下次刷新时间"; - const username = await getCurrentUsername(); - const cdRecordPath = `record/${username}_cd.txt`;// 修改CD记录文件路径,包含用户名 - - //检查用户是否配置队伍 - if (ifAkf && settings.TEAMname === undefined) { - log.error("您选择了拥有爱可菲,请在配置页面填写包含爱可菲的队伍名称!!!"); - return;// 没选就报错后停止 - } else { - TEAM = settings.TEAMname; - } - - - //设置分辨率和缩放 - setGameMetrics(1920, 1080, 1); - await genshin.returnMainUi(); - - // 读取CD记录 - const cdRecords = await readCDRecords(); - let updatedRecords = { ...cdRecords }; - - // 检查CD - if (!isRouteAvailable(routeName, cdRecords)) { - log.info("CD未刷新,跳过本次执行"); - return; - } - - // 打开地图 - keyPress("M"); - await sleep(1000); - - // 判断是否诱捕完成 - await textOCR("诱捕装置", 3, 0, 0, 0, 0, 360, 500); - - if (!result.found) { - log.warn("诱捕未完成,不执行后续操作"); - await genshin.returnMainUi(); - return; - } else { - //开始任务 - try { - await switchPartyIfNeeded(TEAM); //切换到指定队伍 - await AutoPath("全自动质变仪"); - - const deployed = await deployTransformer();//部署质变仪 - if (!deployed) { - log.error("质变仪未找到或在cd中"); - } else { - await insertMaterial();//放入材料并开始质变流程 + while (Date.now() - startTime < timeout) { + if (recognizeFightText(captureGameRegion())) { + fightResult = true; + break; } + await sleep(1000); + } - await waitTransformer(deployed)//等待质变完成 - log.info("任务执行完成!!!"); + cts.cancel(); + return fightResult; + } + // 战斗文本识别函数 + function recognizeFightText(captureRegion) { + try { + const result = captureRegion.find(ocrRo2); + const text = result.text; + const keywords = ["挑战成功", "达成", "挑战达成"]; + for (const keyword of keywords) { + if (text.includes(keyword)) { + return true; + } + } + return false; + } catch (error) { + log.error("OCR识别出错: {0}", error); + return false; + } + } + + // 自动秘境 + async function fuben() { + await genshin.tp(1167.9833984375, 662.7353515625);// 太山府 + + await sleep(1500); + keyPress("F"); + + await textOCR("单人挑战", 8, 1, 1, 1615, 990, 220, 50);// 等待“单人挑战”出现 + await sleep(10); + await textOCR("开始挑战", 8, 1, 1, 1615, 990, 220, 50);// 等待“开始挑战”出现 + await sleep(10); + await textOCR("地脉异常", 10, 1, 1, 840, 405, 180, 55);// 等待“地脉异常”出现 + + await sleep(1000); + + for (let attempt = 0; attempt < 10; attempt++) { + success = await textOCR("启动", 0.5, 0, 3, 1210, 500, 85, 85); + if (success.found) { + keyPress("F"); + break; + } else { + keyDown("W"); + await sleep(2500); + keyUp("W"); + } + } + + if (!success.found) { + log.warn("未找到秘境启动按钮!"); + return false; + } + } + + // 晶蝶诱捕装置 + async function Jingdie() { + // 读取CD记录 + const cdRecords = await readCDRecords(); + let updatedRecords = { ...cdRecords }; + + const routeName = "晶蝶诱捕装置"; + + // 检查CD + if (!isRouteAvailable(routeName, cdRecords)) { + log.info(routeName + "CD未刷新,跳过本次执行"); + return; + } + + keyPress("M"); + await sleep(1000); + + // 判断是否诱捕完成 + await textOCR("诱捕装置", 3, 0, 0, 0, 0, 360, 500); + + if (!result.found) { + log.warn("诱捕未完成,不执行后续操作"); + await genshin.returnMainUi(); + return; + } else { //执行晶蝶诱捕装置代码 await AutoPath("晶蝶诱捕装置"); //进行交互 @@ -483,11 +613,485 @@ // 更新CD记录(设置为七天后) updatedRecords[routeName] = getSevenDaysLater(); await writeCDRecords(updatedRecords); - } catch (error) { - log.error(`执行过程中发生错误:${error.message}`); - } finally { - await genshin.returnMainUi(); } + + } + + // 质变仪和爱可菲 + async function autoZhibian() { + // 读取CD记录 + const cdRecords = await readCDRecords(); + let updatedRecords = { ...cdRecords }; + + const routeName = "质变仪&爱可菲"; + + // 检查CD + if (!isRouteAvailable(routeName, cdRecords)) { + log.info(routeName + "CD未刷新,跳过本次执行"); + return; + } + + // 检查质变仪cd是否已刷新 + await sleep(500); + await keyPress("B"); + await sleep(1000); + + await handleExpiredItems(); //处理过期物品 + + await sleep(1000); + await click(1067, 57);//点开背包,可做图像识别优化 + + await textOCR("小道具", 3, 0, 0, 126, 17, 99, 53); if (!result.found) { throw new Error("未打开'小道具'页面,请确保背包已正确打开并切换到小道具标签页"); }//确认在小道具界面 + await sleep(500); + const res1 = await imageRecognitionEnhanced(ZHIBIANYI, 1, 1, 0);//识别质变仪图片 + if (res1.found) { + await genshin.returnMainUi(); + log.info("质变仪CD已刷新!"); + } else { + log.warn("'质变仪CD中'或'未找到质变仪!'"); + await genshin.returnMainUi(); + return; + } + + await switchPartyIfNeeded(TEAM); //切换到指定队伍 + await AutoPath("全自动质变仪"); + + const deployed = await deployTransformer();//部署质变仪 + if (!deployed) { + log.error("质变仪未找到或在cd中"); + } else { + await insertMaterial();//放入材料并开始质变流程 + } + + await waitTransformer(deployed)//等待质变完成 + log.info("任务执行完成!!!"); + + // 更新CD记录(设置为七天后) + updatedRecords[routeName] = getSevenDaysLater(); + await writeCDRecords(updatedRecords); + } + + // 每周做菜 + async function Cooking() { + // 读取CD记录 + const cdRecords = await readCDRecords(); + let updatedRecords = { ...cdRecords }; + + const routeName = "每周做菜"; + + // 检查CD + if (!isRouteAvailable(routeName, cdRecords)) { + log.info(routeName + "CD未刷新,跳过本次执行"); + return; + } + + log.info("正在执行本周烹饪任务……"); + await AutoPath("每周做菜"); + await sleep(10); + keyDown("VK_MENU"); + await textOCR("烹饪", 5, 1, 0, 1150, 460, 155, 155); + await sleep(800); + keyUp("VK_MENU"); + await sleep(1000); + + click(145, 1015);// 筛选 + await sleep(800); + + click(195, 1015);// 重置 + await sleep(800); + await textOCR(Category, 5, 1, 0, 95, 235, 135, 55); + await sleep(800); + click(500, 1020);// 确认筛选 + await sleep(800); + + const res = await textOCR(food, 10, 1, 0, 116, 116, 1165, 880); + if (!res) { + throw new Error("未识别到料理!") + } + + await sleep(1000); + click(1700, 1020);// 制作 + await sleep(1000); + + await textOCR("自动烹饪", 5, 1, 0, 725, 1000, 130, 45); + await sleep(800); + click(960, 460); + inputText("20"); + await sleep(800); + click(1190, 755); + await sleep(2500); // 等待烹饪完成 + + await genshin.returnMainUi(); + log.info("本周烹饪任务已完成!"); + + // 更新CD记录 + updatedRecords[routeName] = getNextMonday4AMISO(); + await writeCDRecords(updatedRecords); + } + + // 每周锻造 + async function duanZao() { + // 读取CD记录 + const cdRecords = await readCDRecords(); + let updatedRecords = { ...cdRecords }; + + const routeName = "每周锻造"; + + // 检查CD + if (!isRouteAvailable(routeName, cdRecords)) { + log.info(routeName + "CD未刷新,跳过本次执行"); + return; + } + + log.info("正在执行本周锻造任务……"); + await AutoPath("瓦格纳"); + keyDown("VK_MENU"); + await textOCR("瓦格纳", 5, 1, 0, 1150, 460, 155, 155); + await sleep(800); + keyUp("VK_MENU"); + + click(960, 540);// 对话 + await sleep(1000); + + await textOCR("委托锻造", 5, 1, 0, 1150, 400, 300, 300); + await sleep(1500); + + click(960, 540);// 对话 + await sleep(1500); + + click(560, 150);// 点击锻造任务界面,先领取一次 + await sleep(1500); + + click(180, 1015);// 全部领取 + await sleep(1500); + + click(980, 900);// 确认按钮 + await sleep(1500); + + click(220, 145);// 点击配方 + await sleep(1500); + + click(360, 1015);// 筛选按钮 + await sleep(1500); + await textOCR("武器升级材料", 5, 1, 0, 30, 170, 410, 60); + await sleep(1500); + + await imageRecognitionEnhanced(mineralFile, 10, 1, 0, 40, 210, 720, 770) + await sleep(1500); + + for (i = 0; i < 4; i++) { + click(1760, 1015);// 开始锻造 + await sleep(800); + } + + await genshin.returnMainUi(); + log.info("本周锻造任务已完成!"); + + // 更新CD记录 + updatedRecords[routeName] = getNextMonday4AMISO(); + await writeCDRecords(updatedRecords); + } + + // 每周首领 + async function hitBoss() { + // 读取CD记录 + const cdRecords = await readCDRecords(); + let updatedRecords = { ...cdRecords }; + + const routeName = "每周首领"; + + // 检查CD + if (!isRouteAvailable(routeName, cdRecords)) { + log.info(routeName + "CD未刷新,跳过本次执行"); + return; + } + + log.info("正在执行本周首领击败任务……"); + + await genshin.tpToStatueOfTheSeven();// 先去神像确保状态和队伍切换 + await switchPartyIfNeeded(BossPartyName); + await sleep(5000); + + for (i = 1; i <= 10; i++) { + if (i % 2 == 0) { await AutoPath("爆炎树"); } + else if (i % 2 != 0) { await AutoPath("急冻树"); } + await sleep(10); + log.info("第" + i + "次首领已击败!") + } + + log.info("本周首领击败任务已完成!"); + + // 更新CD记录 + updatedRecords[routeName] = getNextMonday4AMISO(); + await writeCDRecords(updatedRecords); + } + + // 每周秘境 + async function AutoDomain() { + // 读取CD记录 + const cdRecords = await readCDRecords(); + let updatedRecords = { ...cdRecords }; + + const routeName = "每周秘境"; + + // 检查CD + if (!isRouteAvailable(routeName, cdRecords)) { + log.info(routeName + "CD未刷新,跳过本次执行"); + return; + } + + log.info("正在执行本周秘境任务……"); + + await genshin.tpToStatueOfTheSeven();// 先去神像确保状态和队伍切换 + await switchPartyIfNeeded(BossPartyName); + await sleep(5000); + + while (mijingCount <= 10) { + log.info(`正在进行第${mijingCount}次秘境挑战`); + await fuben(); + // 开始自动战斗 + log.info("开始自动战斗"); + const fightResult = await autoFight(120000); // 120秒战斗超时 + + if (fightResult) { + log.info(`战斗成功!当前完成 ${mijingCount} 次`); + } else { + log.error("战斗失败,终止脚本"); + throw new Error("自动秘境战斗失败"); + } + await sleep(1500); + mijingCount++; + } + log.info("本周秘境任务已完成!"); + + // 更新CD记录 + updatedRecords[routeName] = getNextMonday4AMISO(); + await writeCDRecords(updatedRecords); + + await genshin.tpToStatueOfTheSeven();// 回一次神像 + await sleep(5000); + } + + // 购买四方八方之网 + async function buyNet() { + // 读取CD记录 + const cdRecords = await readCDRecords(); + let updatedRecords = { ...cdRecords }; + + const routeName = "购买四方网"; + + // 检查CD + if (!isRouteAvailable(routeName, cdRecords)) { + log.info(routeName + "CD未刷新,跳过本次执行"); + return; + } + + log.info("正在执行本周四方网购买任务……"); + + await AutoPath("四方八方之网"); + await sleep(800); + + keyPress("F"); + await sleep(1300); + + click(960, 540);// 对话 + await sleep(1000); + + await textOCR("购买", 3, 1, 0, 1320, 630, 130, 60);// 对话:购买四方八方之网 + await sleep(1000); + + click(1670, 1015); + await sleep(800); + + for (i = 0; i < 7; i++) {// 拉满拉满,TMD全部拉满 + click(1290, 600); + await sleep(150); + } + + click(1175, 780);// 点击购买 + await sleep(100); + await genshin.returnMainUi(); + + log.info("本周四方网购买任务已完成!"); + + // 更新CD记录 + updatedRecords[routeName] = getNextMonday4AMISO(); + await writeCDRecords(updatedRecords); + } + + // 购买投资券 + async function buyTzq() { + // 读取CD记录 + const cdRecords = await readCDRecords(); + let updatedRecords = { ...cdRecords }; + + const routeName = "投资券"; + + // 检查CD + if (!isRouteAvailable(routeName, cdRecords)) { + log.info(routeName + "CD未刷新,跳过本次执行"); + return; + } + + log.info("正在提交本周投资券……"); + + await AutoPath("投资券"); + + await sleep(800); + keyPress("F"); + await sleep(800); + click(960, 540); + await sleep(2000); + + await textOCR("我要结算投资回报", 3, 1, 0, 1325, 550, 250, 55); + + await sleep(800); + click(960, 540); + + const notHave = await textOCR("没有投资券", 3, 0, 0, 830, 925, 160, 50); + if (notHave.found) { + click(960, 540); + await sleep(1500); + + click(960, 540); + await sleep(1500); + + click(960, 540); + await sleep(1500); + + await sleep(2000); + + click(1700, 1000); + await sleep(1000); + + for (i = 0; i < 8; i++) { + click(1295, 600); + await sleep(100); + } + click(1180, 780); + await sleep(1000); + + await genshin.returnMainUi(); + + await sleep(800); + keyPress("F"); + await sleep(800); + click(960, 540); + await sleep(1500); + + await textOCR("我要结算", 3, 1, 0, 1325, 500, 250, 80); + + await sleep(800); + click(960, 540); + } + keyPress("F"); + await sleep(500); + + click(110, 185); + await sleep(500); + click(1235, 815); + await sleep(500); + click(1620, 1020); + await sleep(500); + + click(1620, 1020); + + log.info("本周投资券已提交!"); + + // 更新CD记录 + updatedRecords[routeName] = getNextMonday4AMISO(); + await writeCDRecords(updatedRecords); + } + + + //main/====================================================================================== + + // 人机验证 + if (!settings.ifCheck) { log.error("请阅读readme文件并做好相关设置后再运行此脚本!"); return; } + + //初始化配置 + var TEAM; + var Material = settings.Material; + const actiontime = 180;//最大等待时间,单位秒 + const BH = `assets/RecognitionObject/${Material}.png`; + const ZHIBIANYI = typeof settings.ZHIBIANY === 'string' && settings.ZHIBIANYI.trim() !== '' ? settings.ZHIBIANYI : "assets/RecognitionObject/zhibian.png"; + const CHA = "assets/RecognitionObject/cha.png" + const ifAkf = settings.ifAkf; + const ifCooking = settings.ifCooking; + const ifduanZao = settings.ifduanZao; + const ifShouling = settings.ifShouling; + const ifMijing = settings.ifMijing; + const ifbuyNet = settings.ifbuyNet; + const ifbuyTzq = settings.ifbuyTzq; + const ifZBY = settings.ifZBY; + const ifYB = settings.ifYB; + const food = settings.food; // 烹饪次数 + const Category = settings.Category;// 食物种类 + const mineral = settings.mineral;// 矿石种类 + const mineralFile = `assets/RecognitionObject/${mineral}.png`// 矿石模板路径 + const BossPartyName = settings.BossPartyName;// 战斗队伍 + let mijingCount = 1;// 自动秘境计数 + // OCR对象用于检测战斗文本 + const ocrRo2 = RecognitionObject.Ocr(0, 0, genshin.width, genshin.height); + + // 创建材质到ITEM的映射表 + // 养成道具=1,食物=2,材料=3 + const materialToItemMap = { + "牛角": 1, + "苹果": 2, "日落果": 2, "泡泡桔": 2, + "白铁块": 3, "水晶块": 3, "薄荷": 3, "菜": 3, + "鸡腿": 3, "蘑菇": 3, "鸟蛋": 3, "兽肉": 3, "甜甜花": 3 + }; + + // 直接通过映射获取ITEM值(未匹配时默认0) + ITEM = materialToItemMap[Material] || 0; + + //检查用户是否配置队伍 + if (ifAkf && settings.TEAMname === undefined) { + log.error("您选择了拥有爱可菲,请在配置页面填写包含爱可菲的队伍名称!!!"); + return;// 没选就报错后停止 + } else { + TEAM = settings.TEAMname; + } + + const username = await getCurrentUsername(); + const cdRecordPath = `record/${username}_cd.txt`;// 修改CD记录文件路径,包含用户名 + + //设置分辨率和缩放 + setGameMetrics(1920, 1080, 1); + await genshin.returnMainUi(); + + + try { + if (ifZBY) { await autoZhibian(); }// 质变仪 + await sleep(10); + + if (ifYB) { await Jingdie(); }// 晶蝶诱捕装置 + await sleep(10); + + if (ifCooking) { await Cooking(); }// 做菜 + await sleep(10); + + if (ifduanZao) { await duanZao(); }// 锻造 + await sleep(10); + + if (ifShouling) { await hitBoss(); }// 首领 + await sleep(10); + + if (ifMijing) { await AutoDomain(); }// 秘境 + await sleep(10); + + if (ifbuyNet) { await buyNet(); }// 购买四方八方之网 + await sleep(10); + + if (ifbuyTzq) { await buyTzq(); }// 购买投资券 + await sleep(10); + } catch (error) { + log.error(`执行过程中发生错误:${error.message}`); + } finally { + await genshin.returnMainUi(); + } + //main/====================================================================================== })(); diff --git a/repo/js/AutoMonday/manifest.json b/repo/js/AutoMonday/manifest.json index ffc89cd3a..a97ba108e 100644 --- a/repo/js/AutoMonday/manifest.json +++ b/repo/js/AutoMonday/manifest.json @@ -1,14 +1,15 @@ { "manifest_version": 1, "name": "全自动周一", - "version": "1.1", + "version": "1.2", "tags": [ + "周常", + "纪行", "爱可菲", "质变仪", - "晶蝶诱捕装置", - "周常" + "晶蝶诱捕装置" ], - "description": "基于电气水晶与晶蝶诱捕装置的自动周常:包含晶蝶诱捕、爱可菲和参变仪,请注意说明文件,建议放进每天都跑的配置组,详情见readme", + "description": "全自动周常:包含纪行、晶蝶诱捕、爱可菲和参变仪等,详情见readme", "authors": [ { diff --git a/repo/js/AutoMonday/settings.json b/repo/js/AutoMonday/settings.json index 30d0fb5e1..51f3e1026 100644 --- a/repo/js/AutoMonday/settings.json +++ b/repo/js/AutoMonday/settings.json @@ -2,14 +2,17 @@ { "name": "ifCheck", "type": "checkbox", - "label": "我已认真阅读readme文件及注意事项,并做好了相关设置", - "default": "false" + "label": "我已认真阅读readme文件及注意事项,并做好了相关设置" + }, + { + "name": "ifZBY", + "type": "checkbox", + "label": "是否执行质变仪&爱可菲任务" }, { "name": "ifAkf", "type": "checkbox", - "label": "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n\n是否拥有爱可菲", - "default": "false" + "label": "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n\n是否拥有爱可菲" }, { "name": "TEAMname", @@ -36,5 +39,74 @@ "甜甜花" ], "default": "薄荷" + }, + { + "name": "ifYB", + "type": "checkbox", + "label": "是否执行晶蝶诱捕装置任务" + }, + { + "name": "ifCooking", + "type": "checkbox", + "label": "是否执行每周做菜任务" + }, + { + "name": "food", + "type": "input-text", + "label": "要制作的食物\n需要制作20个,请确保材料足够!", + "default": "提瓦特煎蛋" + }, + { + "name": "Category", + "type": "select", + "label": "食物的类别", + "options": [ + "恢复类料理", + "攻击类料理", + "冒险类料理", + "防御类料理" + ], + "default": "恢复类料理" + }, + { + "name": "ifduanZao", + "type": "checkbox", + "label": "是否执行每周锻造任务" + }, + { + "name": "mineral", + "type": "select", + "label": "要锻造的矿石\n需要锻造20次,请确保材料足够!", + "options": [ + "锻造水晶块", + "锻造紫晶块", + "锻造萃凝晶" + ], + "default": "锻造水晶块" + }, + { + "name": "BossPartyName", + "type": "input-text", + "label": "进行战斗的队伍" + }, + { + "name": "ifShouling", + "type": "checkbox", + "label": "是否执行每周首领击败任务" + }, + { + "name": "ifMijing", + "type": "checkbox", + "label": "是否执行每周秘境挑战任务" + }, + { + "name": "ifbuyNet", + "type": "checkbox", + "label": "是否购买四方八方之网" + }, + { + "name": "ifbuyTzq", + "type": "checkbox", + "label": "是否购买(提交)投资券" } ] \ No newline at end of file