JS脚本:周本2.2更新 (#899)
* 周本2.2更新 * Update repo/js/周本3-公子/main.js Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update repo/js/周本11-火龙/assets/tp.json Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -22,7 +22,7 @@
|
||||
"x": -239.8662109375,
|
||||
"y": 2235.255859375,
|
||||
"type": "path",
|
||||
"move_mode": "walk",
|
||||
"move_mode": "dash",
|
||||
"action": "",
|
||||
"action_params": ""
|
||||
},
|
||||
@@ -31,7 +31,7 @@
|
||||
"x": -243.6318359375,
|
||||
"y": 2219.89599609375,
|
||||
"type": "path",
|
||||
"move_mode": "walk",
|
||||
"move_mode": "dash",
|
||||
"action": "",
|
||||
"action_params": ""
|
||||
},
|
||||
@@ -40,7 +40,7 @@
|
||||
"x": -250.318359375,
|
||||
"y": 2200.3515625,
|
||||
"type": "path",
|
||||
"move_mode": "climb",
|
||||
"move_mode": "fly",
|
||||
"action": "",
|
||||
"action_params": ""
|
||||
},
|
||||
@@ -49,7 +49,7 @@
|
||||
"x": -263.7783203125,
|
||||
"y": 2142.494140625,
|
||||
"type": "path",
|
||||
"move_mode": "walk",
|
||||
"move_mode": "dash",
|
||||
"action": "",
|
||||
"action_params": ""
|
||||
},
|
||||
@@ -58,7 +58,7 @@
|
||||
"x": -266.06640625,
|
||||
"y": 2100.711669921875,
|
||||
"type": "path",
|
||||
"move_mode": "walk",
|
||||
"move_mode": "dash",
|
||||
"action": "",
|
||||
"action_params": ""
|
||||
},
|
||||
@@ -85,7 +85,7 @@
|
||||
"x": -280.3447265625,
|
||||
"y": 1999.419921875,
|
||||
"type": "target",
|
||||
"move_mode": "walk",
|
||||
"move_mode": "dash",
|
||||
"action": "",
|
||||
"action_params": ""
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
"x": -264.44921875,
|
||||
"y": 1991.2685546875,
|
||||
"type": "path",
|
||||
"move_mode": "walk",
|
||||
"move_mode": "dash",
|
||||
"action": "",
|
||||
"action_params": ""
|
||||
},
|
||||
@@ -23,7 +23,7 @@
|
||||
"x": -248.8486328125,
|
||||
"y": 1984.78125,
|
||||
"type": "target",
|
||||
"move_mode": "walk",
|
||||
"move_mode": "dash",
|
||||
"action": "",
|
||||
"action_params": ""
|
||||
}
|
||||
|
||||
@@ -1,7 +1,41 @@
|
||||
(async function () {
|
||||
|
||||
//吃料理
|
||||
async function eatFood() {
|
||||
let foodName = settings.foodName ?? 0;
|
||||
if(foodName){
|
||||
const foodSum = foodName.split('-');
|
||||
log.info("开始吃菜");
|
||||
await sleep(1000);
|
||||
keyPress("B");//打开背包
|
||||
await sleep(2000);
|
||||
click(863, 51);//选择食物
|
||||
await sleep(1000);
|
||||
for(let i = 0; i < foodSum.length; i++){
|
||||
click(170, 1020);//筛选
|
||||
await sleep(1000);
|
||||
click(195, 1020);//重置
|
||||
await sleep(1000);
|
||||
click(110, 110);//输入名字
|
||||
await sleep(1000);
|
||||
inputText(foodSum[i]);
|
||||
await sleep(500);
|
||||
click(490, 1020);//确认筛选
|
||||
await sleep(1000);
|
||||
click(180, 180);//选择第一个食物
|
||||
await sleep(1000);
|
||||
click(1690, 1015);//使用
|
||||
await sleep(1000);
|
||||
}
|
||||
keyPress("ESCAPE");
|
||||
await sleep(1500);
|
||||
}}
|
||||
|
||||
|
||||
|
||||
await pathingScript.runFile("assets/前往狼王.json");
|
||||
await sleep(1000);
|
||||
await eatFood();//嗑药
|
||||
keyPress("F");
|
||||
await sleep(13000);
|
||||
await dispatcher.runTask(new SoloTask("AutoFight"));
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"manifest_version": 1,
|
||||
"name": "王狼自动刷取",
|
||||
"version": "2.0",
|
||||
"version": "2.2",
|
||||
"description": "建议钟离、芙芙和优质后台(精通雷神、草神等),另外看情况更改自动战斗的超时时间",
|
||||
"authors": [
|
||||
{
|
||||
|
||||
7
repo/js/周本1-王狼/settings.json
Normal file
7
repo/js/周本1-王狼/settings.json
Normal file
@@ -0,0 +1,7 @@
|
||||
[
|
||||
{
|
||||
"name": "foodName",
|
||||
"type": "input-text",
|
||||
"label": "请输入料理名称,多食物用法(攻击-药剂-防御)"
|
||||
}
|
||||
]
|
||||
@@ -26,11 +26,86 @@ async function tpEndDetection() {
|
||||
}
|
||||
|
||||
//吃料理
|
||||
async function eatFood(){
|
||||
async function eatFood() {
|
||||
let foodName = settings.foodName ?? 0;
|
||||
if(foodName){
|
||||
const foodSum = foodName.split('-');
|
||||
log.info("开始吃菜");
|
||||
await sleep(1000);
|
||||
await sleep(1000);
|
||||
keyPress("B");//打开背包
|
||||
await sleep(2000);
|
||||
click(863, 51);//选择食物
|
||||
await sleep(1000);
|
||||
for(let i = 0; i < foodSum.length; i++){
|
||||
click(170, 1020);//筛选
|
||||
await sleep(1000);
|
||||
click(195, 1020);//重置
|
||||
await sleep(1000);
|
||||
click(110, 110);//输入名字
|
||||
await sleep(1000);
|
||||
inputText(foodSum[i]);
|
||||
await sleep(500);
|
||||
click(490, 1020);//确认筛选
|
||||
await sleep(1000);
|
||||
click(180, 180);//选择第一个食物
|
||||
await sleep(1000);
|
||||
click(1690, 1015);//使用
|
||||
await sleep(1000);
|
||||
}
|
||||
keyPress("ESCAPE");
|
||||
await sleep(1500);
|
||||
}}
|
||||
//检测角色是否阵亡,并前往吃药复活
|
||||
async function resurgenceDetectionAndEatFood() {
|
||||
const region1 = RecognitionObject.ocr(1170, 780, 75, 35);// 复活料理区域
|
||||
const region2 = RecognitionObject.ocr(545, 360, 800, 45);// 料理冷却区域
|
||||
let recoveryFoodName = settings.recoveryFoodName ?? 0;
|
||||
let resurgenceFoodName = settings.resurgenceFoodName ?? 0;
|
||||
if(resurgenceFoodName && recoveryFoodName){
|
||||
keyPress("1");
|
||||
await sleep(100);
|
||||
keyPress("2");
|
||||
await sleep(100);
|
||||
keyPress("3");
|
||||
await sleep(100);
|
||||
keyPress("4");
|
||||
await sleep(200);
|
||||
let capture = captureGameRegion();
|
||||
let res1 = capture.find(region1);
|
||||
let res2 = capture.find(region2);
|
||||
if (res1.isEmpty()){
|
||||
return;
|
||||
}
|
||||
else if (!res1.isEmpty() && !res2.isEmpty()) {
|
||||
log.info("复活料理处于冷却中");
|
||||
keyPress("ESCAPE");
|
||||
await sleep(1000);
|
||||
await genshin.tp(2297.6201171875,-824.5869140625);//传送到神像回血
|
||||
throw new Error('战斗失败');
|
||||
return;
|
||||
}
|
||||
else if (!res1.isEmpty() && res2.isEmpty()) {
|
||||
log.info("检测到阵亡角色……复活吧!我的爱人!!!");
|
||||
keyPress("ESCAPE");
|
||||
await eatResurgenceFood();//满血复活
|
||||
return;
|
||||
}
|
||||
}}
|
||||
|
||||
//吃料理复活
|
||||
async function eatResurgenceFood() {
|
||||
let recoveryFoodName = settings.recoveryFoodName ?? 0;
|
||||
let resurgenceFoodName = settings.resurgenceFoodName ?? 0;
|
||||
const region = RecognitionObject.ocr(800, 200, 315, 32);// 复活对象检测
|
||||
const clickPositions = [
|
||||
{ x: 760, y: 440 }, // 角色1
|
||||
{ x: 900, y: 440 }, // 角色2
|
||||
{ x: 1040, y: 440 }, // 角色3
|
||||
{ x: 1180, y: 440 } // 角色4
|
||||
];
|
||||
if(resurgenceFoodName && recoveryFoodName){
|
||||
log.info("开始吃菜");
|
||||
await sleep(500);
|
||||
keyPress("B");//打开背包
|
||||
await sleep(2000);
|
||||
click(863, 51);//选择食物
|
||||
@@ -40,8 +115,10 @@ await sleep(1000);
|
||||
click(195, 1020);//重置
|
||||
await sleep(1000);
|
||||
click(110, 110);//输入名字
|
||||
await sleep(200);
|
||||
click(110, 110);
|
||||
await sleep(1000);
|
||||
inputText(`${foodName}`);
|
||||
inputText(`${resurgenceFoodName}`);
|
||||
await sleep(500);
|
||||
click(490, 1020);//确认筛选
|
||||
await sleep(1000);
|
||||
@@ -49,9 +126,49 @@ click(180, 180);//选择第一个食物
|
||||
await sleep(1000);
|
||||
click(1690, 1015);//使用
|
||||
await sleep(1000);
|
||||
keyPress("ESCAPE");
|
||||
await sleep(1500);
|
||||
}}
|
||||
// 使用 for 循环点击每个位置
|
||||
for (let i = 0; i < clickPositions.length; i++) {
|
||||
const position = clickPositions[i];
|
||||
click(position.x, position.y);
|
||||
await sleep(800);
|
||||
click(1200,770);//确认
|
||||
await sleep(800);
|
||||
let capture = captureGameRegion();
|
||||
let res = capture.find(region);
|
||||
if (res.isEmpty()){
|
||||
keyPress("ESCAPE");
|
||||
await sleep(1000);
|
||||
click(170, 1020);//筛选
|
||||
await sleep(1000);
|
||||
click(195, 1020);//重置
|
||||
await sleep(1000);
|
||||
click(110, 110);//输入名字
|
||||
await sleep(1000);
|
||||
inputText(`${recoveryFoodName}`);
|
||||
await sleep(500);
|
||||
click(490, 1020);//确认筛选
|
||||
await sleep(1000);
|
||||
click(180, 180);//选择第一个食物
|
||||
await sleep(1000);
|
||||
click(1690, 1015);//使用
|
||||
await sleep(500);
|
||||
click(position.x, position.y);
|
||||
await sleep(500);
|
||||
click(1200,770);//吃第一个
|
||||
await sleep(500);
|
||||
click(1200,770);//吃第二个
|
||||
await sleep(500);
|
||||
click(1350,290);//退出
|
||||
await sleep(500);
|
||||
keyPress("ESCAPE");
|
||||
await sleep(400);
|
||||
log.info("我又好了,嘿嘿");
|
||||
break;
|
||||
}
|
||||
await sleep(1000);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//征讨之花领奖
|
||||
const autoNavigateToReward = async () => {
|
||||
@@ -120,7 +237,7 @@ const autoNavigateToReward = async () => {
|
||||
keyDown("w");
|
||||
await sleep(500);
|
||||
keyUp("w");
|
||||
await sleep(100); // 等待角色移动稳定
|
||||
await sleep(200); // 等待角色移动稳定
|
||||
}
|
||||
}
|
||||
|
||||
@@ -145,21 +262,17 @@ async function autoFightAndEndDetection() {
|
||||
let hasText3 = !res3.isEmpty() && res3.text.trim().length > 0;
|
||||
// 情况1: 区域1有文字 且 区域2无文字 且 区域3有文字 → 执行AutoFight
|
||||
if (hasText1 && !hasText2 && hasText3) {
|
||||
await resurgenceDetectionAndEatFood();
|
||||
challengeNum++;
|
||||
await sleep(500);//避免切人冷却,导致角色识别失败
|
||||
capture = captureGameRegion();
|
||||
res1 = capture.find(region1);
|
||||
res2 = capture.find(region2);
|
||||
res3 = capture.find(region3);
|
||||
hasText1 = !res1.isEmpty() && res1.text.trim().length > 0;
|
||||
hasText2 = !res2.isEmpty() && res2.text.trim().length > 0;
|
||||
hasText3 = !res3.isEmpty() && res3.text.trim().length > 0;
|
||||
//二次检测避免无法启动战斗
|
||||
if (hasText1 && !hasText2 && hasText3){
|
||||
await sleep(800);//避免切人冷却,导致角色识别失败
|
||||
log.info(`执行第${challengeNum}次战斗`);
|
||||
challengeTime = challengeTime + 205;
|
||||
await dispatcher.runTask(new SoloTask("AutoFight"));
|
||||
}
|
||||
try {
|
||||
await dispatcher.runTask(new SoloTask("AutoFight"));
|
||||
} catch (error) {
|
||||
log.info("启动战斗失败,尝试重新启动");
|
||||
await sleep(500);
|
||||
}
|
||||
}
|
||||
// 情况2: 区域2有文字 且 区域1无文字 且 区域3有文字 → 结束循环
|
||||
else if (hasText2 && !hasText1 && hasText3) {
|
||||
@@ -179,7 +292,12 @@ async function autoFightAndEndDetection() {
|
||||
await sleep(200);
|
||||
keyUp("VK_SHIFT");
|
||||
keyUp("w");
|
||||
await dispatcher.runTask(new SoloTask("AutoFight"));
|
||||
try {
|
||||
await dispatcher.runTask(new SoloTask("AutoFight"));
|
||||
} catch (error) {
|
||||
log.info("启动战斗失败,尝试重新启动");
|
||||
await sleep(500);
|
||||
}
|
||||
}
|
||||
// 情况4: 三个区域均无文字,可能处于转场动画,尝试点击快进
|
||||
else if (!hasText1 && !hasText2 && !hasText3){
|
||||
@@ -225,18 +343,21 @@ await sleep(1000);//切回固定行走位
|
||||
keyDown("w");
|
||||
await sleep(9200);
|
||||
keyUp("w");
|
||||
|
||||
//战斗和领奖
|
||||
|
||||
await autoFightAndEndDetection();//一直战斗直到检测到结束
|
||||
await autoNavigateToReward();//前往地脉之花
|
||||
|
||||
//领奖并退出
|
||||
await autoNavigateToReward();//前往地脉之花
|
||||
await sleep(1000);
|
||||
keyPress("F");//领奖
|
||||
await sleep(1000);
|
||||
click(950, 750);//使用树脂
|
||||
await sleep(6000);
|
||||
click(975, 1000);//退出秘境
|
||||
await sleep(10000);
|
||||
await tpEndDetection();
|
||||
await genshin.tp(2297.6201171875,-824.5869140625);//传送到神像回血
|
||||
await sleep(1000);
|
||||
keyPress("M");//展示剩余体力
|
||||
await sleep(1000);
|
||||
notification.send('挑战完成');
|
||||
|
||||
})();
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"manifest_version": 1,
|
||||
"name": "仆人周本自动刷取",
|
||||
"version": "2.1",
|
||||
"version": "2.2",
|
||||
"description": "需0.44.6及以上版本,兼容所有正常队伍及战斗策略,但还是建议在JS设置中选择合适的防御料理(推荐骇浪派)。脚本需要在调度器设置里开启路径追踪行走配置,选择切换的队伍,打开允许在JsScript中使用,打开战斗配置,选择战斗策略,关闭战斗结束拾取物品和万叶拾取,最后根据战斗脚本一次循环的时间,在战斗超时中填入,比如周本原地版q是14s,看情况可以多加一秒,另外搭配一条龙领奖无树脂脚本使用体验更佳哟。演示视频https://www.bilibili.com/video/BV1cpGCz6EWN/?vd_source=9dfaf88af48ecc0ff95a41f1145af7a2。",
|
||||
"authors": [
|
||||
{
|
||||
|
||||
@@ -2,6 +2,16 @@
|
||||
{
|
||||
"name": "foodName",
|
||||
"type": "input-text",
|
||||
"label": "请输入料理的正确名称 "
|
||||
"label": "请输入料理名称,多食物用法(攻击-药剂-防御)"
|
||||
},
|
||||
]
|
||||
{
|
||||
"name": "resurgenceFoodName",
|
||||
"type": "input-text",
|
||||
"label": "请输入复活料理名称 "
|
||||
},
|
||||
{
|
||||
"name": "recoveryFoodName",
|
||||
"type": "input-text",
|
||||
"label": "请输入回血料理名称 "
|
||||
}
|
||||
]
|
||||
|
||||
@@ -55,6 +55,122 @@ await sleep(1000);
|
||||
keyPress("ESCAPE");
|
||||
await sleep(1500);
|
||||
}}
|
||||
//检测角色是否阵亡,并前往吃药复活
|
||||
async function resurgenceDetectionAndEatFood() {
|
||||
const region1 = RecognitionObject.ocr(1170, 780, 75, 35);// 复活料理区域
|
||||
const region2 = RecognitionObject.ocr(545, 360, 800, 45);// 料理冷却区域
|
||||
let recoveryFoodName = settings.recoveryFoodName ?? 0;
|
||||
let resurgenceFoodName = settings.resurgenceFoodName ?? 0;
|
||||
if(resurgenceFoodName && recoveryFoodName){
|
||||
keyPress("1");
|
||||
await sleep(100);
|
||||
keyPress("2");
|
||||
await sleep(100);
|
||||
keyPress("3");
|
||||
await sleep(100);
|
||||
keyPress("4");
|
||||
await sleep(200);
|
||||
let capture = captureGameRegion();
|
||||
let res1 = capture.find(region1);
|
||||
let res2 = capture.find(region2);
|
||||
if (res1.isEmpty()){
|
||||
return;
|
||||
}
|
||||
else if (!res1.isEmpty() && !res2.isEmpty()) {
|
||||
log.info("复活料理处于冷却中");
|
||||
keyPress("ESCAPE");
|
||||
await sleep(1000);
|
||||
await genshin.tp(2297.6201171875,-824.5869140625);//传送到神像回血
|
||||
throw new Error('战斗失败');
|
||||
return;
|
||||
}
|
||||
else if (!res1.isEmpty() && res2.isEmpty()) {
|
||||
log.info("检测到阵亡角色……复活吧!我的爱人!!!");
|
||||
keyPress("ESCAPE");
|
||||
await eatResurgenceFood();//满血复活
|
||||
return;
|
||||
}
|
||||
}}
|
||||
|
||||
//吃料理复活
|
||||
async function eatResurgenceFood() {
|
||||
let recoveryFoodName = settings.recoveryFoodName ?? 0;
|
||||
let resurgenceFoodName = settings.resurgenceFoodName ?? 0;
|
||||
const region = RecognitionObject.ocr(800, 200, 315, 32);// 复活对象检测
|
||||
const clickPositions = [
|
||||
{ x: 760, y: 440 }, // 角色1
|
||||
{ x: 900, y: 440 }, // 角色2
|
||||
{ x: 1040, y: 440 }, // 角色3
|
||||
{ x: 1180, y: 440 } // 角色4
|
||||
];
|
||||
if(resurgenceFoodName && recoveryFoodName){
|
||||
log.info("开始吃菜");
|
||||
await sleep(500);
|
||||
keyPress("B");//打开背包
|
||||
await sleep(2000);
|
||||
click(863, 51);//选择食物
|
||||
await sleep(1000);
|
||||
click(170, 1020);//筛选
|
||||
await sleep(1000);
|
||||
click(195, 1020);//重置
|
||||
await sleep(1000);
|
||||
click(110, 110);//输入名字
|
||||
await sleep(200);
|
||||
click(110, 110);
|
||||
await sleep(1000);
|
||||
inputText(`${resurgenceFoodName}`);
|
||||
await sleep(500);
|
||||
click(490, 1020);//确认筛选
|
||||
await sleep(1000);
|
||||
click(180, 180);//选择第一个食物
|
||||
await sleep(1000);
|
||||
click(1690, 1015);//使用
|
||||
await sleep(1000);
|
||||
// 使用 for 循环点击每个位置
|
||||
for (let i = 0; i < clickPositions.length; i++) {
|
||||
const position = clickPositions[i];
|
||||
click(position.x, position.y);
|
||||
await sleep(800);
|
||||
click(1200,770);//确认
|
||||
await sleep(800);
|
||||
let capture = captureGameRegion();
|
||||
let res = capture.find(region);
|
||||
if (res.isEmpty()){
|
||||
keyPress("ESCAPE");
|
||||
await sleep(1000);
|
||||
click(170, 1020);//筛选
|
||||
await sleep(1000);
|
||||
click(195, 1020);//重置
|
||||
await sleep(1000);
|
||||
click(110, 110);//输入名字
|
||||
await sleep(1000);
|
||||
inputText(`${recoveryFoodName}`);
|
||||
await sleep(500);
|
||||
click(490, 1020);//确认筛选
|
||||
await sleep(1000);
|
||||
click(180, 180);//选择第一个食物
|
||||
await sleep(1000);
|
||||
click(1690, 1015);//使用
|
||||
await sleep(500);
|
||||
click(position.x, position.y);
|
||||
await sleep(500);
|
||||
click(1200,770);//吃第一个
|
||||
await sleep(500);
|
||||
click(1200,770);//吃第二个
|
||||
await sleep(500);
|
||||
click(1350,290);//退出
|
||||
await sleep(500);
|
||||
keyPress("ESCAPE");
|
||||
await sleep(400);
|
||||
log.info("我又好了,嘿嘿");
|
||||
break;
|
||||
}
|
||||
await sleep(1000);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//征讨之花领奖
|
||||
const autoNavigateToReward = async () => {
|
||||
@@ -123,7 +239,7 @@ const autoNavigateToReward = async () => {
|
||||
keyDown("w");
|
||||
await sleep(500);
|
||||
keyUp("w");
|
||||
await sleep(100); // 等待角色移动稳定
|
||||
await sleep(200); // 等待角色移动稳定
|
||||
}
|
||||
}
|
||||
|
||||
@@ -148,12 +264,17 @@ async function autoFightAndEndDetection() {
|
||||
let hasText3 = !res3.isEmpty() && res3.text.trim().length > 0;
|
||||
// 情况1: 区域1有文字 且 区域2无文字 且 区域3有文字 → 执行AutoFight
|
||||
if (hasText1 && !hasText2 && hasText3) {
|
||||
await resurgenceDetectionAndEatFood();
|
||||
challengeNum++;
|
||||
await sleep(500);//避免切人冷却,导致角色识别失败
|
||||
await sleep(800);//避免切人冷却,导致角色识别失败
|
||||
log.info(`执行第${challengeNum}次战斗`);
|
||||
challengeTime = challengeTime + 205;
|
||||
|
||||
await dispatcher.runTask(new SoloTask("AutoFight"));
|
||||
try {
|
||||
await dispatcher.runTask(new SoloTask("AutoFight"));
|
||||
} catch (error) {
|
||||
log.info("启动战斗失败,尝试重新启动");
|
||||
await sleep(500);
|
||||
}
|
||||
}
|
||||
// 情况2: 区域2有文字 且 区域1无文字 且 区域3有文字 → 结束循环
|
||||
else if (hasText2 && !hasText1 && hasText3) {
|
||||
@@ -205,15 +326,12 @@ await tpEndDetection();
|
||||
await eatFood();//嗑药
|
||||
keyPress("1");
|
||||
await sleep(1000);//切回固定行走位
|
||||
|
||||
//开盾
|
||||
keyDown("s");
|
||||
await sleep(200);
|
||||
keyUp("s");
|
||||
keyDown("e");
|
||||
await sleep(1000);
|
||||
keyDown("e");
|
||||
|
||||
keyDown("w");
|
||||
await sleep(1000);
|
||||
keyDown("VK_SHIFT");
|
||||
@@ -236,19 +354,22 @@ keyUp("w");
|
||||
keyDown("d");
|
||||
await sleep(500);
|
||||
keyUp("d");
|
||||
|
||||
//战斗和领奖
|
||||
await autoFightAndEndDetection();//一直战斗直到检测到结束
|
||||
await autoNavigateToReward();//前往地脉之花
|
||||
|
||||
|
||||
//领奖并退出
|
||||
await autoNavigateToReward();//前往地脉之花
|
||||
await sleep(1000);
|
||||
keyPress("F");//领奖
|
||||
await sleep(1000);
|
||||
click(950, 750);//使用树脂
|
||||
await sleep(6000);
|
||||
click(975, 1000);//退出秘境
|
||||
await sleep(10000);
|
||||
|
||||
|
||||
await tpEndDetection();
|
||||
await genshin.tp(2297.6201171875,-824.5869140625);//传送到神像回血
|
||||
await sleep(1000);
|
||||
keyPress("M");//展示剩余体力
|
||||
await sleep(1000);
|
||||
notification.send('挑战完成');
|
||||
|
||||
})();
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"manifest_version": 1,
|
||||
"name": "源焰之主周本刷取",
|
||||
"version": "2.1",
|
||||
"version": "2.2",
|
||||
"description": "需0.44.6及以上版本,兼容所有正常队伍及战斗策略(队伍中必须有奶妈),但还是建议在JS设置中选择合适的防御料理(生命料理以及火抗药剂,没错侵蚀效果吃火抗,我自己发现的)。脚本需要在调度器设置里开启路径追踪行走配置,选择切换的队伍,打开允许在JsScript中使用,打开战斗配置,选择战斗策略,关闭战斗结束拾取物品和万叶拾取,最后根据战斗脚本一次循环的时间,在战斗超时中填入,比如周本原地版q是14s,另外搭配一条龙领奖无树脂脚本使用体验更佳哟。",
|
||||
"authors": [
|
||||
{
|
||||
|
||||
@@ -2,6 +2,16 @@
|
||||
{
|
||||
"name": "foodName",
|
||||
"type": "input-text",
|
||||
"label": "请输入料理的正确名称,多个食物用法(黄油鸡-耐热-月亮派) "
|
||||
"label": "请输入料理名称,多食物用法(攻击-药剂-防御)"
|
||||
},
|
||||
{
|
||||
"name": "resurgenceFoodName",
|
||||
"type": "input-text",
|
||||
"label": "请输入复活料理名称 "
|
||||
},
|
||||
{
|
||||
"name": "recoveryFoodName",
|
||||
"type": "input-text",
|
||||
"label": "请输入回血料理名称 "
|
||||
}
|
||||
]
|
||||
|
||||
@@ -28,19 +28,96 @@ async function tpEndDetection() {
|
||||
async function eatFood() {
|
||||
let foodName = settings.foodName ?? 0;
|
||||
if(foodName){
|
||||
const foodSum = foodName.split('-');
|
||||
log.info("开始吃菜");
|
||||
await sleep(1000);
|
||||
keyPress("B");//打开背包
|
||||
await sleep(2000);
|
||||
click(863, 51);//选择食物
|
||||
await sleep(1000);
|
||||
for(let i = 0; i < foodSum.length; i++){
|
||||
click(170, 1020);//筛选
|
||||
await sleep(1000);
|
||||
click(195, 1020);//重置
|
||||
await sleep(1000);
|
||||
click(110, 110);//输入名字
|
||||
await sleep(1000);
|
||||
inputText(foodSum[i]);
|
||||
await sleep(500);
|
||||
click(490, 1020);//确认筛选
|
||||
await sleep(1000);
|
||||
click(180, 180);//选择第一个食物
|
||||
await sleep(1000);
|
||||
click(1690, 1015);//使用
|
||||
await sleep(1000);
|
||||
}
|
||||
keyPress("ESCAPE");
|
||||
await sleep(1500);
|
||||
}}
|
||||
//检测角色是否阵亡,并前往吃药复活
|
||||
async function resurgenceDetectionAndEatFood() {
|
||||
const region1 = RecognitionObject.ocr(1170, 780, 75, 35);// 复活料理区域
|
||||
const region2 = RecognitionObject.ocr(545, 360, 800, 45);// 料理冷却区域
|
||||
let recoveryFoodName = settings.recoveryFoodName ?? 0;
|
||||
let resurgenceFoodName = settings.resurgenceFoodName ?? 0;
|
||||
if(resurgenceFoodName && recoveryFoodName){
|
||||
keyPress("1");
|
||||
await sleep(100);
|
||||
keyPress("2");
|
||||
await sleep(100);
|
||||
keyPress("3");
|
||||
await sleep(100);
|
||||
keyPress("4");
|
||||
await sleep(200);
|
||||
let capture = captureGameRegion();
|
||||
let res1 = capture.find(region1);
|
||||
let res2 = capture.find(region2);
|
||||
if (res1.isEmpty()){
|
||||
return;
|
||||
}
|
||||
else if (!res1.isEmpty() && !res2.isEmpty()) {
|
||||
log.info("复活料理处于冷却中");
|
||||
keyPress("ESCAPE");
|
||||
await sleep(1000);
|
||||
await genshin.tp(2297.6201171875,-824.5869140625);//传送到神像回血
|
||||
throw new Error('战斗失败');
|
||||
return;
|
||||
}
|
||||
else if (!res1.isEmpty() && res2.isEmpty()) {
|
||||
log.info("检测到阵亡角色……复活吧!我的爱人!!!");
|
||||
keyPress("ESCAPE");
|
||||
await eatResurgenceFood();//满血复活
|
||||
return;
|
||||
}
|
||||
}}
|
||||
|
||||
//吃料理复活
|
||||
async function eatResurgenceFood() {
|
||||
let recoveryFoodName = settings.recoveryFoodName ?? 0;
|
||||
let resurgenceFoodName = settings.resurgenceFoodName ?? 0;
|
||||
const region = RecognitionObject.ocr(800, 200, 315, 32);// 复活对象检测
|
||||
const clickPositions = [
|
||||
{ x: 760, y: 440 }, // 角色1
|
||||
{ x: 900, y: 440 }, // 角色2
|
||||
{ x: 1040, y: 440 }, // 角色3
|
||||
{ x: 1180, y: 440 } // 角色4
|
||||
];
|
||||
if(resurgenceFoodName && recoveryFoodName){
|
||||
log.info("开始吃菜");
|
||||
await sleep(500);
|
||||
keyPress("B");//打开背包
|
||||
await sleep(2000);
|
||||
click(863, 51);//选择食物
|
||||
await sleep(1000);
|
||||
click(170, 1020);//筛选
|
||||
await sleep(1000);
|
||||
click(195, 1020);//重置
|
||||
await sleep(1000);
|
||||
click(110, 110);//输入名字
|
||||
await sleep(200);
|
||||
click(110, 110);
|
||||
await sleep(1000);
|
||||
inputText(`${foodName}`);
|
||||
inputText(`${resurgenceFoodName}`);
|
||||
await sleep(500);
|
||||
click(490, 1020);//确认筛选
|
||||
await sleep(1000);
|
||||
@@ -48,9 +125,49 @@ click(180, 180);//选择第一个食物
|
||||
await sleep(1000);
|
||||
click(1690, 1015);//使用
|
||||
await sleep(1000);
|
||||
keyPress("ESCAPE");
|
||||
await sleep(1500);
|
||||
}}
|
||||
// 使用 for 循环点击每个位置
|
||||
for (let i = 0; i < clickPositions.length; i++) {
|
||||
const position = clickPositions[i];
|
||||
click(position.x, position.y);
|
||||
await sleep(800);
|
||||
click(1200,770);//确认
|
||||
await sleep(800);
|
||||
let capture = captureGameRegion();
|
||||
let res = capture.find(region);
|
||||
if (res.isEmpty()){
|
||||
keyPress("ESCAPE");
|
||||
await sleep(1000);
|
||||
click(170, 1020);//筛选
|
||||
await sleep(1000);
|
||||
click(195, 1020);//重置
|
||||
await sleep(1000);
|
||||
click(110, 110);//输入名字
|
||||
await sleep(1000);
|
||||
inputText(`${recoveryFoodName}`);
|
||||
await sleep(500);
|
||||
click(490, 1020);//确认筛选
|
||||
await sleep(1000);
|
||||
click(180, 180);//选择第一个食物
|
||||
await sleep(1000);
|
||||
click(1690, 1015);//使用
|
||||
await sleep(500);
|
||||
click(position.x, position.y);
|
||||
await sleep(500);
|
||||
click(1200,770);//吃第一个
|
||||
await sleep(500);
|
||||
click(1200,770);//吃第二个
|
||||
await sleep(500);
|
||||
click(1350,290);//退出
|
||||
await sleep(500);
|
||||
keyPress("ESCAPE");
|
||||
await sleep(400);
|
||||
log.info("我又好了,嘿嘿");
|
||||
break;
|
||||
}
|
||||
await sleep(1000);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//征讨之花领奖
|
||||
const autoNavigateToReward = async () => {
|
||||
@@ -144,21 +261,18 @@ async function autoFightAndEndDetection() {
|
||||
let hasText3 = !res3.isEmpty() && res3.text.trim().length > 0;
|
||||
// 情况1: 区域1有文字 且 区域2无文字 且 区域3有文字 → 执行AutoFight
|
||||
if (hasText1 && !hasText2 && hasText3) {
|
||||
await resurgenceDetectionAndEatFood();
|
||||
challengeNum++;
|
||||
await sleep(500);//避免切人冷却,导致角色识别失败
|
||||
capture = captureGameRegion();
|
||||
res1 = capture.find(region1);
|
||||
res2 = capture.find(region2);
|
||||
res3 = capture.find(region3);
|
||||
hasText1 = !res1.isEmpty() && res1.text.trim().length > 0;
|
||||
hasText2 = !res2.isEmpty() && res2.text.trim().length > 0;
|
||||
hasText3 = !res3.isEmpty() && res3.text.trim().length > 0;
|
||||
//二次检测避免无法启动战斗
|
||||
if (hasText1 && !hasText2 && hasText3){
|
||||
await sleep(800);//避免切人冷却,导致角色识别失败
|
||||
log.info(`执行第${challengeNum}次战斗`);
|
||||
challengeTime = challengeTime + 205;
|
||||
await dispatcher.runTask(new SoloTask("AutoFight"));
|
||||
}}
|
||||
try {
|
||||
await dispatcher.runTask(new SoloTask("AutoFight"));
|
||||
} catch (error) {
|
||||
log.info("启动战斗失败,尝试重新启动");
|
||||
await sleep(500);
|
||||
}
|
||||
}
|
||||
// 情况2: 区域2有文字 且 区域1无文字 且 区域3有文字 → 结束循环
|
||||
else if (hasText2 && !hasText1 && hasText3) {
|
||||
log.info("检测到挑战成功");
|
||||
@@ -168,9 +282,14 @@ async function autoFightAndEndDetection() {
|
||||
else if (!hasText2 && !hasText1 && hasText3) {
|
||||
log.info("检测到BOSS进入二阶段");
|
||||
keyDown("w");
|
||||
await sleep(1200);
|
||||
await sleep(3000);//多前进一段位置,避免无法触发冻结反应
|
||||
keyUp("w");
|
||||
await dispatcher.runTask(new SoloTask("AutoFight"));
|
||||
try {
|
||||
await dispatcher.runTask(new SoloTask("AutoFight"));
|
||||
} catch (error) {
|
||||
log.info("启动战斗失败,尝试重新启动");
|
||||
await sleep(500);
|
||||
}
|
||||
}
|
||||
// 情况4: 三个区域均无文字,可能处于转场动画,尝试点击快进
|
||||
else if (!hasText1 && !hasText2 && !hasText3){
|
||||
@@ -210,17 +329,21 @@ await sleep(1000);//切回固定行走位
|
||||
keyDown("w");
|
||||
await sleep(2000);
|
||||
keyUp("w");
|
||||
|
||||
//战斗和领奖
|
||||
await autoFightAndEndDetection();//一直战斗直到检测到结束
|
||||
await autoNavigateToReward();//前往地脉之花
|
||||
|
||||
//领奖并退出
|
||||
await autoNavigateToReward();//前往地脉之花
|
||||
await sleep(1000);
|
||||
keyPress("F");//领奖
|
||||
await sleep(1000);
|
||||
click(950, 750);//使用树脂
|
||||
await sleep(6000);
|
||||
click(975, 1000);//退出秘境
|
||||
await sleep(10000);
|
||||
await tpEndDetection();
|
||||
await genshin.tp(2297.6201171875,-824.5869140625);//传送到神像回血
|
||||
await sleep(1000);
|
||||
keyPress("M");//展示剩余体力
|
||||
await sleep(1000);
|
||||
notification.send('挑战完成');
|
||||
|
||||
})();
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"manifest_version": 1,
|
||||
"name": "魔女周本刷取",
|
||||
"version": "2.1",
|
||||
"version": "2.2",
|
||||
"description": "需0.44.6及以上版本,兼容所有正常队伍(必须要有冻结反应)及战斗策略,但还是建议在JS设置中选择合适的防御料理(推荐骇浪派)。脚本需要在调度器设置里开启路径追踪行走配置,选择切换的队伍,打开允许在JsScript中使用,打开战斗配置,选择战斗策略,关闭战斗结束拾取物品和万叶拾取,最后根据战斗脚本一次循环的时间,在战斗超时中填入,比如周本队厨神版是14s,另外搭配一条龙领奖无树脂脚本使用体验更佳哟。",
|
||||
"authors": [
|
||||
{
|
||||
|
||||
@@ -2,6 +2,16 @@
|
||||
{
|
||||
"name": "foodName",
|
||||
"type": "input-text",
|
||||
"label": "请输入料理的正确名称 "
|
||||
"label": "请输入料理名称,多食物用法(攻击-药剂-防御)"
|
||||
},
|
||||
]
|
||||
{
|
||||
"name": "resurgenceFoodName",
|
||||
"type": "input-text",
|
||||
"label": "请输入复活料理名称 "
|
||||
},
|
||||
{
|
||||
"name": "recoveryFoodName",
|
||||
"type": "input-text",
|
||||
"label": "请输入回血料理名称 "
|
||||
}
|
||||
]
|
||||
|
||||
@@ -1,5 +1,178 @@
|
||||
|
||||
(async function () {
|
||||
(async function () {//风魔龙
|
||||
|
||||
//征讨之花领奖(无图标前进检测)
|
||||
const autoNavigateToReward = async () => {
|
||||
const rewardTextRo = RecognitionObject.Ocr(1210, 515, 200, 50);//领奖区域检测
|
||||
let advanceNum = 0;
|
||||
while (true) {
|
||||
// 1. 优先检查是否已到达领奖点
|
||||
let captureRegion = captureGameRegion();
|
||||
let rewardTextArea = captureRegion.DeriveCrop(1210, 515, 200, 50);
|
||||
let rewardResult = rewardTextArea.find(RecognitionObject.ocrThis);
|
||||
// 检测到特点文字则结束!!!
|
||||
if (rewardResult.text == "接触征讨之花") {
|
||||
log.info("已到达领奖点,检测到文字: " + rewardResult.text);
|
||||
return;
|
||||
}
|
||||
else if(advanceNum > 10){
|
||||
throw new Error('前进时间超时');
|
||||
}
|
||||
// 前进一小步
|
||||
keyDown("w");
|
||||
await sleep(500);
|
||||
keyUp("w");
|
||||
await sleep(200); // 等待角色移动稳定
|
||||
advanceNum++;
|
||||
}
|
||||
}
|
||||
|
||||
//吃料理
|
||||
async function eatFood() {
|
||||
let foodName = settings.foodName ?? 0;
|
||||
if(foodName){
|
||||
const foodSum = foodName.split('-');
|
||||
log.info("开始吃菜");
|
||||
await sleep(1000);
|
||||
keyPress("B");//打开背包
|
||||
await sleep(2000);
|
||||
click(863, 51);//选择食物
|
||||
await sleep(1000);
|
||||
for(let i = 0; i < foodSum.length; i++){
|
||||
click(170, 1020);//筛选
|
||||
await sleep(1000);
|
||||
click(195, 1020);//重置
|
||||
await sleep(1000);
|
||||
click(110, 110);//输入名字
|
||||
await sleep(1000);
|
||||
inputText(foodSum[i]);
|
||||
await sleep(500);
|
||||
click(490, 1020);//确认筛选
|
||||
await sleep(1000);
|
||||
click(180, 180);//选择第一个食物
|
||||
await sleep(1000);
|
||||
click(1690, 1015);//使用
|
||||
await sleep(1000);
|
||||
}
|
||||
keyPress("ESCAPE");
|
||||
await sleep(1500);
|
||||
}}
|
||||
|
||||
//检测角色是否阵亡,并前往吃药复活
|
||||
async function resurgenceDetectionAndEatFood() {
|
||||
let recoveryFoodName = settings.recoveryFoodName ?? 0;
|
||||
let resurgenceFoodName = settings.resurgenceFoodName ?? 0;
|
||||
if(resurgenceFoodName && recoveryFoodName){
|
||||
const region1 = RecognitionObject.ocr(1170, 780, 75, 35);// 复活料理区域
|
||||
const region2 = RecognitionObject.ocr(545, 360, 800, 45);// 料理冷却区域
|
||||
keyPress("1");
|
||||
await sleep(100);
|
||||
keyPress("2");
|
||||
await sleep(100);
|
||||
keyPress("3");
|
||||
await sleep(100);
|
||||
keyPress("4");
|
||||
await sleep(200);
|
||||
let capture = captureGameRegion();
|
||||
let res1 = capture.find(region1);
|
||||
let res2 = capture.find(region2);
|
||||
if (res1.isEmpty()){
|
||||
return;
|
||||
}
|
||||
else if (!res1.isEmpty() && !res2.isEmpty()) {
|
||||
log.info("复活料理处于冷却中");
|
||||
keyPress("ESCAPE");
|
||||
await sleep(1000);
|
||||
await genshin.tp(2297.6201171875,-824.5869140625);//传送到神像回血
|
||||
throw new Error('战斗失败');
|
||||
return;
|
||||
}
|
||||
else if (!res1.isEmpty() && res2.isEmpty()) {
|
||||
log.info("检测到阵亡角色……复活吧!我的爱人!!!");
|
||||
keyPress("ESCAPE");
|
||||
await eatResurgenceFood();//满血复活
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//吃料理复活
|
||||
async function eatResurgenceFood() {
|
||||
let recoveryFoodName = settings.recoveryFoodName ?? 0;
|
||||
let resurgenceFoodName = settings.resurgenceFoodName ?? 0;
|
||||
const region = RecognitionObject.ocr(800, 200, 315, 32);// 复活对象检测
|
||||
const clickPositions = [
|
||||
{ x: 760, y: 440 }, // 角色1
|
||||
{ x: 900, y: 440 }, // 角色2
|
||||
{ x: 1040, y: 440 }, // 角色3
|
||||
{ x: 1180, y: 440 } // 角色4
|
||||
];
|
||||
if(resurgenceFoodName && recoveryFoodName){
|
||||
log.info("开始吃菜");
|
||||
await sleep(500);
|
||||
keyPress("B");//打开背包
|
||||
await sleep(2000);
|
||||
click(863, 51);//选择食物
|
||||
await sleep(1000);
|
||||
click(170, 1020);//筛选
|
||||
await sleep(1000);
|
||||
click(195, 1020);//重置
|
||||
await sleep(1000);
|
||||
click(110, 110);//输入名字
|
||||
await sleep(200);
|
||||
click(110, 110);
|
||||
await sleep(1000);
|
||||
inputText(`${resurgenceFoodName}`);
|
||||
await sleep(500);
|
||||
click(490, 1020);//确认筛选
|
||||
await sleep(1000);
|
||||
click(180, 180);//选择第一个食物
|
||||
await sleep(1000);
|
||||
click(1690, 1015);//使用
|
||||
await sleep(1000);
|
||||
// 使用 for 循环点击每个位置
|
||||
for (let i = 0; i < clickPositions.length; i++) {
|
||||
const position = clickPositions[i];
|
||||
click(position.x, position.y);
|
||||
await sleep(800);
|
||||
click(1200,770);//确认
|
||||
await sleep(800);
|
||||
let capture = captureGameRegion();
|
||||
let res = capture.find(region);
|
||||
if (res.isEmpty()){
|
||||
keyPress("ESCAPE");
|
||||
await sleep(1000);
|
||||
click(170, 1020);//筛选
|
||||
await sleep(1000);
|
||||
click(195, 1020);//重置
|
||||
await sleep(1000);
|
||||
click(110, 110);//输入名字
|
||||
await sleep(1000);
|
||||
inputText(`${recoveryFoodName}`);
|
||||
await sleep(500);
|
||||
click(490, 1020);//确认筛选
|
||||
await sleep(1000);
|
||||
click(180, 180);//选择第一个食物
|
||||
await sleep(1000);
|
||||
click(1690, 1015);//使用
|
||||
await sleep(500);
|
||||
click(position.x, position.y);
|
||||
await sleep(500);
|
||||
click(1200,770);//吃第一个
|
||||
await sleep(500);
|
||||
click(1200,770);//吃第二个
|
||||
await sleep(500);
|
||||
click(1350,290);//退出
|
||||
await sleep(500);
|
||||
keyPress("ESCAPE");
|
||||
await sleep(400);
|
||||
log.info("我又好了,嘿嘿");
|
||||
break;
|
||||
}
|
||||
await sleep(1000);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//检测传送结束 await tpEndDetection();
|
||||
async function tpEndDetection() {
|
||||
@@ -23,6 +196,7 @@ async function tpEndDetection() {
|
||||
tpTime++;
|
||||
await sleep(100);
|
||||
}
|
||||
|
||||
throw new Error('传送时间超时');
|
||||
}
|
||||
|
||||
@@ -36,8 +210,8 @@ async function autoFightAndEndDetection() {
|
||||
const region3 = RecognitionObject.ocr(1690, 230, 75, 350);//区域三 队伍名称
|
||||
let challengeTime = 0;
|
||||
let challengeNum = 0;
|
||||
//12分钟兜底
|
||||
while (challengeTime < 1200) {
|
||||
//6分钟兜底
|
||||
while (challengeTime < 8000) {
|
||||
// 捕获游戏区域
|
||||
let capture = captureGameRegion();
|
||||
// 检测两个区域的OCR结果
|
||||
@@ -49,10 +223,17 @@ async function autoFightAndEndDetection() {
|
||||
let hasText3 = !res3.isEmpty() && res3.text.trim().length > 0;
|
||||
// 情况1: 区域1有文字 且 区域2无文字 且 区域3有文字 → 执行AutoFight
|
||||
if (hasText1 && !hasText2 && hasText3) {
|
||||
await resurgenceDetectionAndEatFood();
|
||||
await sleep(500);
|
||||
challengeNum++;
|
||||
log.info(`执行第${challengeNum}次战斗`);
|
||||
challengeTime = challengeTime + 40;
|
||||
await dispatcher.runTask(new SoloTask("AutoFight"));
|
||||
challengeTime = challengeTime + 200;
|
||||
try {
|
||||
await dispatcher.runTask(new SoloTask("AutoFight"));
|
||||
} catch (error) {
|
||||
log.info("启动战斗失败,尝试重新启动");
|
||||
await sleep(500);
|
||||
}
|
||||
}
|
||||
// 情况2: 区域2有文字 且 区域1无文字 且 区域3有文字 → 结束循环
|
||||
else if (hasText2 && !hasText1 && hasText3) {
|
||||
@@ -61,12 +242,12 @@ async function autoFightAndEndDetection() {
|
||||
}
|
||||
// 其他情况: 什么都不做
|
||||
challengeTime = challengeTime + 1;
|
||||
// 每次检测间隔500毫秒,避免CPU占用过高
|
||||
await sleep(500);
|
||||
// 每次检测间隔100毫秒,避免CPU占用过高
|
||||
await sleep(100);
|
||||
}
|
||||
}
|
||||
|
||||
//通用:前往副本(副本外)
|
||||
//前往副本(副本外)
|
||||
await sleep(1000);
|
||||
await pathingScript.runFile("assets/recover.json");
|
||||
await sleep(5000);
|
||||
@@ -78,6 +259,8 @@ keyUp("w");
|
||||
keyPress("F");
|
||||
await sleep(9000);
|
||||
click(1725, 1020);//单人挑战
|
||||
await sleep(300);
|
||||
click(1180, 760);//队伍等级偏低、体力不够可能会出弹窗
|
||||
await sleep(2000);
|
||||
click(1725, 1020);//开始挑战
|
||||
await tpEndDetection();
|
||||
@@ -85,28 +268,31 @@ await tpEndDetection();
|
||||
//副本内前往BOSS处
|
||||
keyPress("1");
|
||||
await sleep(1000);//切回1号位
|
||||
await eatFood();//嗑药
|
||||
keyDown("w");
|
||||
await sleep(4000);
|
||||
keyUp("w");
|
||||
await autoFightAndEndDetection();//一直战斗直到检测到结束
|
||||
|
||||
|
||||
log.info(`等待柱子碎裂`);
|
||||
await sleep(28000);//等待柱子碎裂
|
||||
keyPress("1");
|
||||
await sleep(1000);//切回钟离
|
||||
log.info(`开始领奖`);
|
||||
keyDown("w");
|
||||
await sleep(5000);
|
||||
keyUp("w");
|
||||
//领奖并退出
|
||||
keyDown("s");
|
||||
await sleep(1400);
|
||||
await sleep(1000);
|
||||
keyUp("s");
|
||||
keyDown("d");
|
||||
await sleep(400);
|
||||
keyUp("d");
|
||||
await autoNavigateToReward();//前往地脉之花
|
||||
await sleep(1000);
|
||||
keyPress("F");//领奖
|
||||
await sleep(1000);
|
||||
click(950, 750);//使用树脂
|
||||
await sleep(6000);
|
||||
click(975, 1000);//退出秘境
|
||||
await sleep(10000);
|
||||
await tpEndDetection();
|
||||
await genshin.tp(2297.6201171875,-824.5869140625);//传送到神像回血
|
||||
await sleep(1000);
|
||||
keyPress("M");//展示剩余体力
|
||||
await sleep(1000);
|
||||
notification.send('挑战完成');
|
||||
})();
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"manifest_version": 1,
|
||||
"name": "风魔龙自动刷取",
|
||||
"version": "2.1",
|
||||
"version": "2.2",
|
||||
"bgi_version": "0.42.0",
|
||||
"description": "需0.44.6及以上版本,配队刚需芙芙等大范围索敌角色,保证战斗脚本没有任何的转向和移动应该可以正常领取。脚本需要在调度器设置里开启路径追踪行走配置,选择切换的队伍,打开允许在JsScript中使用,打开战斗配置,选择战斗策略,关闭战斗结束拾取物品和万叶拾取,最后根据战斗脚本一次循环的时间,在战斗超时中填入,比如周本原地版q是14s,建议可以比正常单轮时间多个1s,另外搭配一条龙领奖无树脂脚本使用体验更佳哟。演示视频https://www.bilibili.com/video/BV1cpGCz6EWN/?vd_source=9dfaf88af48ecc0ff95a41f1145af7a2。",
|
||||
"authors": [
|
||||
|
||||
17
repo/js/周本2-风魔龙/settings.json
Normal file
17
repo/js/周本2-风魔龙/settings.json
Normal file
@@ -0,0 +1,17 @@
|
||||
[
|
||||
{
|
||||
"name": "foodName",
|
||||
"type": "input-text",
|
||||
"label": "请输入料理名称,多食物用法(攻击-药剂-防御)"
|
||||
},
|
||||
{
|
||||
"name": "resurgenceFoodName",
|
||||
"type": "input-text",
|
||||
"label": "请输入复活料理名称 "
|
||||
},
|
||||
{
|
||||
"name": "recoveryFoodName",
|
||||
"type": "input-text",
|
||||
"label": "请输入回血料理名称 "
|
||||
}
|
||||
]
|
||||
@@ -1,4 +1,4 @@
|
||||
(async function () {
|
||||
(async function () {//公子
|
||||
//检测传送结束 await tpEndDetection();
|
||||
async function tpEndDetection() {
|
||||
const region1 = RecognitionObject.ocr(1690, 230, 75, 350);// 队伍名称区域
|
||||
@@ -34,7 +34,7 @@ async function autoFightAndEndDetection() {
|
||||
let challengeTime = 0;
|
||||
let challengeNum = 0;
|
||||
//12分钟兜底
|
||||
while (challengeTime < 1200) {
|
||||
while (challengeTime < 8000) {
|
||||
// 捕获游戏区域
|
||||
let capture = captureGameRegion();
|
||||
// 检测两个区域的OCR结果
|
||||
@@ -46,26 +46,19 @@ async function autoFightAndEndDetection() {
|
||||
let hasText3 = !res3.isEmpty() && res3.text.trim().length > 0;
|
||||
// 情况1: 区域1有文字 且 区域2无文字 且 区域3有文字 → 执行AutoFight
|
||||
if (hasText1 && !hasText2 && hasText3) {
|
||||
await resurgenceDetectionAndEatFood();
|
||||
keyDown("s");
|
||||
await sleep(1800);
|
||||
keyUp("s");
|
||||
challengeNum++;
|
||||
capture = captureGameRegion();
|
||||
res1 = capture.find(region1);
|
||||
res2 = capture.find(region2);
|
||||
res3 = capture.find(region3);
|
||||
hasText1 = !res1.isEmpty() && res1.text.trim().length > 0;
|
||||
hasText2 = !res2.isEmpty() && res2.text.trim().length > 0;
|
||||
hasText3 = !res3.isEmpty() && res3.text.trim().length > 0;
|
||||
//二次检测避免无法启动战斗
|
||||
if (hasText1 && !hasText2 && hasText3){
|
||||
log.info(`执行第${challengeNum}次战斗`);
|
||||
challengeTime = challengeTime + 205;
|
||||
await dispatcher.runTask(new SoloTask("AutoFight"));
|
||||
}
|
||||
|
||||
|
||||
|
||||
challengeTime = challengeTime + 200;
|
||||
try {
|
||||
await dispatcher.runTask(new SoloTask("AutoFight"));
|
||||
} catch (error) {
|
||||
log.info("启动战斗失败,尝试重新启动");
|
||||
await sleep(500);
|
||||
}
|
||||
}
|
||||
// 情况2: 区域2有文字 且 区域1无文字 且 区域3有文字 → 结束循环
|
||||
else if (hasText2 && !hasText1 && hasText3) {
|
||||
@@ -78,7 +71,12 @@ async function autoFightAndEndDetection() {
|
||||
keyDown("s");
|
||||
await sleep(1000);
|
||||
keyUp("s");
|
||||
await dispatcher.runTask(new SoloTask("AutoFight"));
|
||||
try {
|
||||
await dispatcher.runTask(new SoloTask("AutoFight"));
|
||||
} catch (error) {
|
||||
log.info("启动战斗失败,尝试重新启动");
|
||||
await sleep(500);
|
||||
}
|
||||
}
|
||||
// 其他情况: 可能处于转场动画,尝试点击快进
|
||||
else {
|
||||
@@ -93,7 +91,7 @@ async function autoFightAndEndDetection() {
|
||||
|
||||
challengeTime = challengeTime + 1;
|
||||
// 每次检测间隔500毫秒,避免CPU占用过高
|
||||
await sleep(500);
|
||||
await sleep(100);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -112,14 +110,30 @@ const autoNavigateToReward = async () => {
|
||||
log.info("已到达领奖点,检测到文字: " + rewardResult.text);
|
||||
return;
|
||||
}
|
||||
else if(advanceNum > 15){
|
||||
throw new Error('前进时间超时');
|
||||
else if(advanceNum > 700){
|
||||
await genshin.tp(2297.6201171875,-824.5869140625);//传送到神像回血
|
||||
throw new Error('前进时间超时');
|
||||
}
|
||||
// 前进一小步
|
||||
keyDown("w");
|
||||
await sleep(500);
|
||||
keyUp("w");
|
||||
await sleep(100); // 等待角色移动稳定
|
||||
if((advanceNum%70)<34){
|
||||
keyDown("w");
|
||||
await sleep(500);
|
||||
keyUp("w");
|
||||
await sleep(200); // 等待角色移动稳定
|
||||
}
|
||||
else if((advanceNum%70)>34){
|
||||
keyDown("s");
|
||||
await sleep(500);
|
||||
keyUp("s");
|
||||
await sleep(200); // 等待角色移动稳定
|
||||
}
|
||||
else {
|
||||
keyDown("d");
|
||||
await sleep(500);
|
||||
keyUp("d");
|
||||
|
||||
}
|
||||
advanceNum++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -127,19 +141,92 @@ const autoNavigateToReward = async () => {
|
||||
async function eatFood() {
|
||||
let foodName = settings.foodName ?? 0;
|
||||
if(foodName){
|
||||
const foodSum = foodName.split('-');
|
||||
log.info("开始吃菜");
|
||||
await sleep(1000);
|
||||
keyPress("B");//打开背包
|
||||
await sleep(2000);
|
||||
click(863, 51);//选择食物
|
||||
await sleep(1000);
|
||||
for(let i = 0; i < foodSum.length; i++){
|
||||
click(170, 1020);//筛选
|
||||
await sleep(1000);
|
||||
click(195, 1020);//重置
|
||||
await sleep(1000);
|
||||
click(110, 110);//输入名字
|
||||
await sleep(1000);
|
||||
inputText(foodSum[i]);
|
||||
await sleep(500);
|
||||
click(490, 1020);//确认筛选
|
||||
await sleep(1000);
|
||||
click(180, 180);//选择第一个食物
|
||||
await sleep(1000);
|
||||
click(1690, 1015);//使用
|
||||
await sleep(1000);
|
||||
}
|
||||
keyPress("ESCAPE");
|
||||
await sleep(1500);
|
||||
}}
|
||||
//检测角色是否阵亡,并前往吃药复活
|
||||
async function resurgenceDetectionAndEatFood() {
|
||||
const region1 = RecognitionObject.ocr(1170, 780, 75, 35);// 复活料理区域
|
||||
const region2 = RecognitionObject.ocr(545, 360, 800, 45);// 料理冷却区域
|
||||
keyPress("1");
|
||||
await sleep(100);
|
||||
keyPress("2");
|
||||
await sleep(100);
|
||||
keyPress("3");
|
||||
await sleep(100);
|
||||
keyPress("4");
|
||||
await sleep(200);
|
||||
let capture = captureGameRegion();
|
||||
let res1 = capture.find(region1);
|
||||
let res2 = capture.find(region2);
|
||||
if (res1.isEmpty()){
|
||||
return;
|
||||
}
|
||||
else if (!res1.isEmpty() && !res2.isEmpty()) {
|
||||
log.info("复活料理处于冷却中");
|
||||
keyPress("ESCAPE");
|
||||
await sleep(1000);
|
||||
await genshin.tp(2297.6201171875,-824.5869140625);//传送到神像回血
|
||||
throw new Error('战斗失败');
|
||||
}
|
||||
else if (!res1.isEmpty() && res2.isEmpty()) {
|
||||
log.info("检测到阵亡角色……复活吧!我的爱人!!!");
|
||||
keyPress("ESCAPE");
|
||||
await eatResurgenceFood();//满血复活
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
//吃料理复活
|
||||
async function eatResurgenceFood() {
|
||||
let recoveryFoodName = settings.recoveryFoodName ?? 0;
|
||||
let resurgenceFoodName = settings.resurgenceFoodName ?? 0;
|
||||
const region = RecognitionObject.ocr(800, 200, 315, 32);// 复活对象检测
|
||||
const clickPositions = [
|
||||
{ x: 760, y: 440 }, // 角色1
|
||||
{ x: 900, y: 440 }, // 角色2
|
||||
{ x: 1040, y: 440 }, // 角色3
|
||||
{ x: 1180, y: 440 } // 角色4
|
||||
];
|
||||
if(resurgenceFoodName && recoveryFoodName){
|
||||
log.info("开始吃菜");
|
||||
await sleep(500);
|
||||
keyPress("B");//打开背包
|
||||
await sleep(2000);
|
||||
click(863, 51);//选择食物
|
||||
await sleep(1000);
|
||||
click(170, 1020);//筛选
|
||||
await sleep(1000);
|
||||
click(195, 1020);//重置
|
||||
await sleep(1000);
|
||||
click(110, 110);//输入名字
|
||||
await sleep(200);
|
||||
click(110, 110);
|
||||
await sleep(1000);
|
||||
inputText(`${foodName}`);
|
||||
inputText(`${resurgenceFoodName}`);
|
||||
await sleep(500);
|
||||
click(490, 1020);//确认筛选
|
||||
await sleep(1000);
|
||||
@@ -147,9 +234,49 @@ click(180, 180);//选择第一个食物
|
||||
await sleep(1000);
|
||||
click(1690, 1015);//使用
|
||||
await sleep(1000);
|
||||
keyPress("ESCAPE");
|
||||
await sleep(1500);
|
||||
}}
|
||||
// 使用 for 循环点击每个位置
|
||||
for (let i = 0; i < clickPositions.length; i++) {
|
||||
const position = clickPositions[i];
|
||||
click(position.x, position.y);
|
||||
await sleep(800);
|
||||
click(1200,770);//确认
|
||||
await sleep(800);
|
||||
let capture = captureGameRegion();
|
||||
let res = capture.find(region);
|
||||
if (res.isEmpty()){
|
||||
keyPress("ESCAPE");
|
||||
await sleep(1000);
|
||||
click(170, 1020);//筛选
|
||||
await sleep(1000);
|
||||
click(195, 1020);//重置
|
||||
await sleep(1000);
|
||||
click(110, 110);//输入名字
|
||||
await sleep(1000);
|
||||
inputText(`${recoveryFoodName}`);
|
||||
await sleep(500);
|
||||
click(490, 1020);//确认筛选
|
||||
await sleep(1000);
|
||||
click(180, 180);//选择第一个食物
|
||||
await sleep(1000);
|
||||
click(1690, 1015);//使用
|
||||
await sleep(500);
|
||||
click(position.x, position.y);
|
||||
await sleep(500);
|
||||
click(1200,770);//吃第一个
|
||||
await sleep(500);
|
||||
click(1200,770);//吃第二个
|
||||
await sleep(500);
|
||||
click(1350,290);//退出
|
||||
await sleep(500);
|
||||
keyPress("ESCAPE");
|
||||
await sleep(400);
|
||||
log.info("我又好了,嘿嘿");
|
||||
break;
|
||||
}
|
||||
await sleep(1000);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//通用:前往副本(副本外)
|
||||
@@ -184,14 +311,20 @@ await sleep(1000);//切回钟离
|
||||
keyDown("s");
|
||||
await sleep(2400);//再次校准位置
|
||||
keyUp("s");
|
||||
await autoNavigateToReward();//前往地脉之花
|
||||
|
||||
|
||||
//领奖并退出
|
||||
await autoNavigateToReward();//前往地脉之花
|
||||
await sleep(1000);
|
||||
keyPress("F");//领奖
|
||||
await sleep(1000);
|
||||
click(950, 750);//使用树脂
|
||||
await sleep(6000);
|
||||
click(975, 1000);//退出秘境
|
||||
await sleep(10000);
|
||||
|
||||
await tpEndDetection();
|
||||
await genshin.tp(2297.6201171875,-824.5869140625);//传送到神像回血
|
||||
await sleep(1000);
|
||||
keyPress("M");//展示剩余体力
|
||||
await sleep(1000);
|
||||
notification.send('挑战完成');
|
||||
})();
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"manifest_version": 1,
|
||||
"name": "黄金屋自动刷取",
|
||||
"version": "2.1",
|
||||
"version": "2.2",
|
||||
"description": "需0.44.6及以上版本,兼容大部分正常队伍及战斗策略(禁止大幅度转向和移动技能龙王转圈、纳西达转圈、夜兰e……),但还是建议在JS设置中选择合适的防御料理(推荐骇浪派)。脚本需要在调度器设置里开启路径追踪行走配置,选择切换的队伍,打开允许在JsScript中使用,打开战斗配置,选择战斗策略,关闭战斗结束拾取物品和万叶拾取,最后根据战斗脚本一次循环的时间,在战斗超时中填入,比如周本原地版q是14s,建议可以比正常单轮时间多个1s,另外搭配一条龙领奖无树脂脚本使用体验更佳哟。演示视频https://www.bilibili.com/video/BV1cpGCz6EWN/?vd_source=9dfaf88af48ecc0ff95a41f1145af7a2。",
|
||||
"authors": [
|
||||
{
|
||||
|
||||
@@ -2,6 +2,16 @@
|
||||
{
|
||||
"name": "foodName",
|
||||
"type": "input-text",
|
||||
"label": "请输入料理的正确名称 "
|
||||
"label": "请输入料理名称,多食物用法(攻击-药剂-防御)"
|
||||
},
|
||||
]
|
||||
{
|
||||
"name": "resurgenceFoodName",
|
||||
"type": "input-text",
|
||||
"label": "请输入复活料理名称 "
|
||||
},
|
||||
{
|
||||
"name": "recoveryFoodName",
|
||||
"type": "input-text",
|
||||
"label": "请输入回血料理名称 "
|
||||
}
|
||||
]
|
||||
|
||||
@@ -27,19 +27,96 @@ async function tpEndDetection() {
|
||||
async function eatFood() {
|
||||
let foodName = settings.foodName ?? 0;
|
||||
if(foodName){
|
||||
const foodSum = foodName.split('-');
|
||||
log.info("开始吃菜");
|
||||
await sleep(1000);
|
||||
keyPress("B");//打开背包
|
||||
await sleep(2000);
|
||||
click(863, 51);//选择食物
|
||||
await sleep(1000);
|
||||
for(let i = 0; i < foodSum.length; i++){
|
||||
click(170, 1020);//筛选
|
||||
await sleep(1000);
|
||||
click(195, 1020);//重置
|
||||
await sleep(1000);
|
||||
click(110, 110);//输入名字
|
||||
await sleep(1000);
|
||||
inputText(foodSum[i]);
|
||||
await sleep(500);
|
||||
click(490, 1020);//确认筛选
|
||||
await sleep(1000);
|
||||
click(180, 180);//选择第一个食物
|
||||
await sleep(1000);
|
||||
click(1690, 1015);//使用
|
||||
await sleep(1000);
|
||||
}
|
||||
keyPress("ESCAPE");
|
||||
await sleep(1500);
|
||||
}}
|
||||
//检测角色是否阵亡,并前往吃药复活
|
||||
async function resurgenceDetectionAndEatFood() {
|
||||
const region1 = RecognitionObject.ocr(1170, 780, 75, 35);// 复活料理区域
|
||||
const region2 = RecognitionObject.ocr(545, 360, 800, 45);// 料理冷却区域
|
||||
let recoveryFoodName = settings.recoveryFoodName ?? 0;
|
||||
let resurgenceFoodName = settings.resurgenceFoodName ?? 0;
|
||||
if(resurgenceFoodName && recoveryFoodName){
|
||||
keyPress("1");
|
||||
await sleep(100);
|
||||
keyPress("2");
|
||||
await sleep(100);
|
||||
keyPress("3");
|
||||
await sleep(100);
|
||||
keyPress("4");
|
||||
await sleep(200);
|
||||
let capture = captureGameRegion();
|
||||
let res1 = capture.find(region1);
|
||||
let res2 = capture.find(region2);
|
||||
if (res1.isEmpty()){
|
||||
return;
|
||||
}
|
||||
else if (!res1.isEmpty() && !res2.isEmpty()) {
|
||||
log.info("复活料理处于冷却中");
|
||||
keyPress("ESCAPE");
|
||||
await sleep(1000);
|
||||
await genshin.tp(2297.6201171875,-824.5869140625);//传送到神像回血
|
||||
throw new Error('战斗失败');
|
||||
return;
|
||||
}
|
||||
else if (!res1.isEmpty() && res2.isEmpty()) {
|
||||
log.info("检测到阵亡角色……复活吧!我的爱人!!!");
|
||||
keyPress("ESCAPE");
|
||||
await eatResurgenceFood();//满血复活
|
||||
return;
|
||||
}
|
||||
}}
|
||||
|
||||
//吃料理复活
|
||||
async function eatResurgenceFood() {
|
||||
let recoveryFoodName = settings.recoveryFoodName ?? 0;
|
||||
let resurgenceFoodName = settings.resurgenceFoodName ?? 0;
|
||||
const region = RecognitionObject.ocr(800, 200, 315, 32);// 复活对象检测
|
||||
const clickPositions = [
|
||||
{ x: 760, y: 440 }, // 角色1
|
||||
{ x: 900, y: 440 }, // 角色2
|
||||
{ x: 1040, y: 440 }, // 角色3
|
||||
{ x: 1180, y: 440 } // 角色4
|
||||
];
|
||||
if(resurgenceFoodName && recoveryFoodName){
|
||||
log.info("开始吃菜");
|
||||
await sleep(500);
|
||||
keyPress("B");//打开背包
|
||||
await sleep(2000);
|
||||
click(863, 51);//选择食物
|
||||
await sleep(1000);
|
||||
click(170, 1020);//筛选
|
||||
await sleep(1000);
|
||||
click(195, 1020);//重置
|
||||
await sleep(1000);
|
||||
click(110, 110);//输入名字
|
||||
await sleep(200);
|
||||
click(110, 110);
|
||||
await sleep(1000);
|
||||
inputText(`${foodName}`);
|
||||
inputText(`${resurgenceFoodName}`);
|
||||
await sleep(500);
|
||||
click(490, 1020);//确认筛选
|
||||
await sleep(1000);
|
||||
@@ -47,9 +124,49 @@ click(180, 180);//选择第一个食物
|
||||
await sleep(1000);
|
||||
click(1690, 1015);//使用
|
||||
await sleep(1000);
|
||||
keyPress("ESCAPE");
|
||||
await sleep(1500);
|
||||
}}
|
||||
// 使用 for 循环点击每个位置
|
||||
for (let i = 0; i < clickPositions.length; i++) {
|
||||
const position = clickPositions[i];
|
||||
click(position.x, position.y);
|
||||
await sleep(800);
|
||||
click(1200,770);//确认
|
||||
await sleep(800);
|
||||
let capture = captureGameRegion();
|
||||
let res = capture.find(region);
|
||||
if (res.isEmpty()){
|
||||
keyPress("ESCAPE");
|
||||
await sleep(1000);
|
||||
click(170, 1020);//筛选
|
||||
await sleep(1000);
|
||||
click(195, 1020);//重置
|
||||
await sleep(1000);
|
||||
click(110, 110);//输入名字
|
||||
await sleep(1000);
|
||||
inputText(`${recoveryFoodName}`);
|
||||
await sleep(500);
|
||||
click(490, 1020);//确认筛选
|
||||
await sleep(1000);
|
||||
click(180, 180);//选择第一个食物
|
||||
await sleep(1000);
|
||||
click(1690, 1015);//使用
|
||||
await sleep(500);
|
||||
click(position.x, position.y);
|
||||
await sleep(500);
|
||||
click(1200,770);//吃第一个
|
||||
await sleep(500);
|
||||
click(1200,770);//吃第二个
|
||||
await sleep(500);
|
||||
click(1350,290);//退出
|
||||
await sleep(500);
|
||||
keyPress("ESCAPE");
|
||||
await sleep(400);
|
||||
log.info("我又好了,嘿嘿");
|
||||
break;
|
||||
}
|
||||
await sleep(1000);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//征讨之花领奖
|
||||
const autoNavigateToReward = async () => {
|
||||
@@ -118,7 +235,7 @@ const autoNavigateToReward = async () => {
|
||||
keyDown("w");
|
||||
await sleep(500);
|
||||
keyUp("w");
|
||||
await sleep(100); // 等待角色移动稳定
|
||||
await sleep(200); // 等待角色移动稳定
|
||||
}
|
||||
}
|
||||
|
||||
@@ -143,26 +260,17 @@ async function autoFightAndEndDetection() {
|
||||
let hasText3 = !res3.isEmpty() && res3.text.trim().length > 0;
|
||||
// 情况1: 区域1有文字 且 区域2无文字 且 区域3有文字 → 执行AutoFight
|
||||
if (hasText1 && !hasText2 && hasText3) {
|
||||
await resurgenceDetectionAndEatFood();
|
||||
challengeNum++;
|
||||
await sleep(500);//避免切人冷却,导致角色识别失败
|
||||
log.info(`执行第${challengeNum}次战斗`);
|
||||
capture = captureGameRegion();
|
||||
res1 = capture.find(region1);
|
||||
res2 = capture.find(region2);
|
||||
res3 = capture.find(region3);
|
||||
hasText1 = !res1.isEmpty() && res1.text.trim().length > 0;
|
||||
hasText2 = !res2.isEmpty() && res2.text.trim().length > 0;
|
||||
hasText3 = !res3.isEmpty() && res3.text.trim().length > 0;
|
||||
//二次检测避免无法启动战斗
|
||||
if (hasText1 && !hasText2 && hasText3){
|
||||
log.info(`执行第${challengeNum}次战斗`);
|
||||
await sleep(800);//避免切人冷却,导致角色识别失败
|
||||
challengeTime = challengeTime + 205;
|
||||
await dispatcher.runTask(new SoloTask("AutoFight"));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
log.info(`执行第${challengeNum}次战斗`);
|
||||
try {
|
||||
await dispatcher.runTask(new SoloTask("AutoFight"));
|
||||
} catch (error) {
|
||||
log.info("启动战斗失败,尝试重新启动");
|
||||
await sleep(500);
|
||||
}
|
||||
}
|
||||
// 情况2: 区域2有文字 且 区域1无文字 且 区域3有文字 → 结束循环
|
||||
else if (hasText2 && !hasText1 && hasText3) {
|
||||
@@ -228,17 +336,21 @@ await sleep(1000);
|
||||
keyUp("SHIFT");
|
||||
await sleep(500);
|
||||
keyUp("s");
|
||||
|
||||
//战斗和领奖
|
||||
await autoFightAndEndDetection();//一直战斗直到检测到结束
|
||||
|
||||
|
||||
//领奖并退出
|
||||
await autoNavigateToReward();//前往地脉之花
|
||||
|
||||
|
||||
await sleep(1000);
|
||||
keyPress("F");//领奖
|
||||
await sleep(1000);
|
||||
click(950, 750);//使用树脂
|
||||
await sleep(6000);
|
||||
click(975, 1000);//退出秘境
|
||||
await sleep(10000);
|
||||
await tpEndDetection();
|
||||
await genshin.tp(2297.6201171875,-824.5869140625);//传送到神像回血
|
||||
await sleep(1000);
|
||||
keyPress("M");//展示剩余体力
|
||||
await sleep(1000);
|
||||
notification.send('挑战完成');
|
||||
})();
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"manifest_version": 1,
|
||||
"name": "若陀龙王自动刷取",
|
||||
"version": "2.1",
|
||||
"version": "2.2",
|
||||
"description": "需0.44.6及以上版本,兼容所有正常队伍及战斗策略,但还是建议在JS设置中选择合适的防御料理(推荐骇浪派)。脚本需要在调度器设置里开启路径追踪行走配置,选择切换的队伍,打开允许在JsScript中使用,打开战斗配置,选择战斗策略,关闭战斗结束拾取物品和万叶拾取,最后根据战斗脚本一次循环的时间,在战斗超时中填入,比如周本原地版q是14s,看情况可以多加一秒,另外搭配一条龙领奖无树脂脚本使用体验更佳哟。演示视频https://www.bilibili.com/video/BV1cpGCz6EWN/?vd_source=9dfaf88af48ecc0ff95a41f1145af7a2。",
|
||||
"authors": [
|
||||
{
|
||||
|
||||
@@ -2,6 +2,16 @@
|
||||
{
|
||||
"name": "foodName",
|
||||
"type": "input-text",
|
||||
"label": "请输入料理的正确名称 "
|
||||
"label": "请输入料理名称,多食物用法(攻击-药剂-防御)"
|
||||
},
|
||||
]
|
||||
{
|
||||
"name": "resurgenceFoodName",
|
||||
"type": "input-text",
|
||||
"label": "请输入复活料理名称 "
|
||||
},
|
||||
{
|
||||
"name": "recoveryFoodName",
|
||||
"type": "input-text",
|
||||
"label": "请输入回血料理名称 "
|
||||
}
|
||||
]
|
||||
|
||||
@@ -27,19 +27,96 @@ async function tpEndDetection() {
|
||||
async function eatFood() {
|
||||
let foodName = settings.foodName ?? 0;
|
||||
if(foodName){
|
||||
const foodSum = foodName.split('-');
|
||||
log.info("开始吃菜");
|
||||
await sleep(1000);
|
||||
keyPress("B");//打开背包
|
||||
await sleep(2000);
|
||||
click(863, 51);//选择食物
|
||||
await sleep(1000);
|
||||
for(let i = 0; i < foodSum.length; i++){
|
||||
click(170, 1020);//筛选
|
||||
await sleep(1000);
|
||||
click(195, 1020);//重置
|
||||
await sleep(1000);
|
||||
click(110, 110);//输入名字
|
||||
await sleep(1000);
|
||||
inputText(foodSum[i]);
|
||||
await sleep(500);
|
||||
click(490, 1020);//确认筛选
|
||||
await sleep(1000);
|
||||
click(180, 180);//选择第一个食物
|
||||
await sleep(1000);
|
||||
click(1690, 1015);//使用
|
||||
await sleep(1000);
|
||||
}
|
||||
keyPress("ESCAPE");
|
||||
await sleep(1500);
|
||||
}}
|
||||
//检测角色是否阵亡,并前往吃药复活
|
||||
async function resurgenceDetectionAndEatFood() {
|
||||
const region1 = RecognitionObject.ocr(1170, 780, 75, 35);// 复活料理区域
|
||||
const region2 = RecognitionObject.ocr(545, 360, 800, 45);// 料理冷却区域
|
||||
let recoveryFoodName = settings.recoveryFoodName ?? 0;
|
||||
let resurgenceFoodName = settings.resurgenceFoodName ?? 0;
|
||||
if(resurgenceFoodName && recoveryFoodName){
|
||||
keyPress("1");
|
||||
await sleep(100);
|
||||
keyPress("2");
|
||||
await sleep(100);
|
||||
keyPress("3");
|
||||
await sleep(100);
|
||||
keyPress("4");
|
||||
await sleep(200);
|
||||
let capture = captureGameRegion();
|
||||
let res1 = capture.find(region1);
|
||||
let res2 = capture.find(region2);
|
||||
if (res1.isEmpty()){
|
||||
return;
|
||||
}
|
||||
else if (!res1.isEmpty() && !res2.isEmpty()) {
|
||||
log.info("复活料理处于冷却中");
|
||||
keyPress("ESCAPE");
|
||||
await sleep(1000);
|
||||
await genshin.tp(2297.6201171875,-824.5869140625);//传送到神像回血
|
||||
throw new Error('战斗失败');
|
||||
return;
|
||||
}
|
||||
else if (!res1.isEmpty() && res2.isEmpty()) {
|
||||
log.info("检测到阵亡角色……复活吧!我的爱人!!!");
|
||||
keyPress("ESCAPE");
|
||||
await eatResurgenceFood();//满血复活
|
||||
return;
|
||||
}
|
||||
}}
|
||||
|
||||
//吃料理复活
|
||||
async function eatResurgenceFood() {
|
||||
let recoveryFoodName = settings.recoveryFoodName ?? 0;
|
||||
let resurgenceFoodName = settings.resurgenceFoodName ?? 0;
|
||||
const region = RecognitionObject.ocr(800, 200, 315, 32);// 复活对象检测
|
||||
const clickPositions = [
|
||||
{ x: 760, y: 440 }, // 角色1
|
||||
{ x: 900, y: 440 }, // 角色2
|
||||
{ x: 1040, y: 440 }, // 角色3
|
||||
{ x: 1180, y: 440 } // 角色4
|
||||
];
|
||||
if(resurgenceFoodName && recoveryFoodName){
|
||||
log.info("开始吃菜");
|
||||
await sleep(500);
|
||||
keyPress("B");//打开背包
|
||||
await sleep(2000);
|
||||
click(863, 51);//选择食物
|
||||
await sleep(1000);
|
||||
click(170, 1020);//筛选
|
||||
await sleep(1000);
|
||||
click(195, 1020);//重置
|
||||
await sleep(1000);
|
||||
click(110, 110);//输入名字
|
||||
await sleep(200);
|
||||
click(110, 110);
|
||||
await sleep(1000);
|
||||
inputText(`${foodName}`);
|
||||
inputText(`${resurgenceFoodName}`);
|
||||
await sleep(500);
|
||||
click(490, 1020);//确认筛选
|
||||
await sleep(1000);
|
||||
@@ -47,9 +124,49 @@ click(180, 180);//选择第一个食物
|
||||
await sleep(1000);
|
||||
click(1690, 1015);//使用
|
||||
await sleep(1000);
|
||||
keyPress("ESCAPE");
|
||||
await sleep(1500);
|
||||
}}
|
||||
// 使用 for 循环点击每个位置
|
||||
for (let i = 0; i < clickPositions.length; i++) {
|
||||
const position = clickPositions[i];
|
||||
click(position.x, position.y);
|
||||
await sleep(800);
|
||||
click(1200,770);//确认
|
||||
await sleep(800);
|
||||
let capture = captureGameRegion();
|
||||
let res = capture.find(region);
|
||||
if (res.isEmpty()){
|
||||
keyPress("ESCAPE");
|
||||
await sleep(1000);
|
||||
click(170, 1020);//筛选
|
||||
await sleep(1000);
|
||||
click(195, 1020);//重置
|
||||
await sleep(1000);
|
||||
click(110, 110);//输入名字
|
||||
await sleep(1000);
|
||||
inputText(`${recoveryFoodName}`);
|
||||
await sleep(500);
|
||||
click(490, 1020);//确认筛选
|
||||
await sleep(1000);
|
||||
click(180, 180);//选择第一个食物
|
||||
await sleep(1000);
|
||||
click(1690, 1015);//使用
|
||||
await sleep(500);
|
||||
click(position.x, position.y);
|
||||
await sleep(500);
|
||||
click(1200,770);//吃第一个
|
||||
await sleep(500);
|
||||
click(1200,770);//吃第二个
|
||||
await sleep(500);
|
||||
click(1350,290);//退出
|
||||
await sleep(500);
|
||||
keyPress("ESCAPE");
|
||||
await sleep(400);
|
||||
log.info("我又好了,嘿嘿");
|
||||
break;
|
||||
}
|
||||
await sleep(1000);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//征讨之花领奖(无图标前进检测)
|
||||
const autoNavigateToReward = async () => {
|
||||
@@ -65,14 +182,31 @@ const autoNavigateToReward = async () => {
|
||||
log.info("已到达领奖点,检测到文字: " + rewardResult.text);
|
||||
return;
|
||||
}
|
||||
else if(advanceNum > 20){
|
||||
throw new Error('前进时间超时');
|
||||
else if(advanceNum > 500){
|
||||
await genshin.tp(2297.6201171875,-824.5869140625);//传送到神像回血
|
||||
throw new Error('前进时间超时');
|
||||
|
||||
}
|
||||
// 前进一小步
|
||||
keyDown("w");
|
||||
await sleep(500);
|
||||
keyUp("w");
|
||||
await sleep(100); // 等待角色移动稳定
|
||||
if((advanceNum%50)<24){
|
||||
keyDown("w");
|
||||
await sleep(500);
|
||||
keyUp("w");
|
||||
await sleep(200); // 等待角色移动稳定
|
||||
}
|
||||
else if((advanceNum%50)>24){
|
||||
keyDown("s");
|
||||
await sleep(500);
|
||||
keyUp("s");
|
||||
await sleep(200); // 等待角色移动稳定
|
||||
}
|
||||
else {
|
||||
keyDown("d");
|
||||
await sleep(500);
|
||||
keyUp("d");
|
||||
|
||||
}
|
||||
advanceNum++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -97,23 +231,19 @@ async function autoFightAndEndDetection() {
|
||||
let hasText3 = !res3.isEmpty() && res3.text.trim().length > 0;
|
||||
// 情况1: 区域1有文字 且 区域2无文字 且 区域3有文字 → 执行AutoFight
|
||||
if (hasText1 && !hasText2 && hasText3) {
|
||||
await resurgenceDetectionAndEatFood();
|
||||
challengeNum++;
|
||||
keyDown("s");
|
||||
await sleep(1200);
|
||||
keyUp("s");
|
||||
capture = captureGameRegion();
|
||||
res1 = capture.find(region1);
|
||||
res2 = capture.find(region2);
|
||||
res3 = capture.find(region3);
|
||||
hasText1 = !res1.isEmpty() && res1.text.trim().length > 0;
|
||||
hasText2 = !res2.isEmpty() && res2.text.trim().length > 0;
|
||||
hasText3 = !res3.isEmpty() && res3.text.trim().length > 0;
|
||||
//二次检测避免无法启动战斗
|
||||
if (hasText1 && !hasText2 && hasText3){
|
||||
log.info(`执行第${challengeNum}次战斗`);
|
||||
challengeTime = challengeTime + 205;
|
||||
await dispatcher.runTask(new SoloTask("AutoFight"));
|
||||
}
|
||||
try {
|
||||
await dispatcher.runTask(new SoloTask("AutoFight"));
|
||||
} catch (error) {
|
||||
log.info("启动战斗失败,尝试重新启动");
|
||||
await sleep(500);
|
||||
}
|
||||
}
|
||||
// 情况2: 区域2有文字 且 区域1无文字 且 区域3有文字 → 结束循环
|
||||
else if (hasText2 && !hasText1 && hasText3) {
|
||||
@@ -126,7 +256,12 @@ async function autoFightAndEndDetection() {
|
||||
keyDown("s");
|
||||
await sleep(2500);
|
||||
keyUp("s");
|
||||
await dispatcher.runTask(new SoloTask("AutoFight"));
|
||||
try {
|
||||
await dispatcher.runTask(new SoloTask("AutoFight"));
|
||||
} catch (error) {
|
||||
log.info("启动战斗失败,尝试重新启动");
|
||||
await sleep(500);
|
||||
}
|
||||
}
|
||||
// 情况4: 三个区域均无文字,可能处于转场动画,尝试点击快进
|
||||
else if (!hasText1 && !hasText2 && !hasText3){
|
||||
@@ -178,28 +313,29 @@ await sleep(300);
|
||||
keyUp("SHIFT");
|
||||
await sleep(200);
|
||||
keyUp("s");
|
||||
|
||||
//战斗和领奖
|
||||
await autoFightAndEndDetection();//一直战斗直到检测到结束
|
||||
//走到角落对准身位
|
||||
|
||||
//领奖并退出
|
||||
await sleep(4000);
|
||||
keyDown("s");
|
||||
await sleep(4000);
|
||||
keyUp("s");
|
||||
|
||||
await sleep(4000);
|
||||
keyDown("a");
|
||||
await sleep(300);
|
||||
keyUp("a");
|
||||
await autoNavigateToReward();//前往地脉之花
|
||||
|
||||
await sleep(1000);
|
||||
keyPress("F");//领奖
|
||||
await sleep(1000);
|
||||
click(950, 750);//使用树脂
|
||||
await sleep(6000);
|
||||
click(975, 1000);//退出秘境
|
||||
await sleep(10000);
|
||||
|
||||
await tpEndDetection();
|
||||
await genshin.tp(2297.6201171875,-824.5869140625);//传送到神像回血
|
||||
await sleep(1000);
|
||||
keyPress("M");//展示剩余体力
|
||||
await sleep(1000);
|
||||
notification.send('挑战完成');
|
||||
|
||||
})();
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"manifest_version": 1,
|
||||
"name": "女士周本刷取",
|
||||
"version": "2.1",
|
||||
"version": "2.2",
|
||||
"description": "需0.44.6及以上版本,兼容大部分正常队伍及战斗策略(禁止大幅度转向和移动技能龙王转圈、纳西达转圈、夜兰e……),但还是建议在JS设置中选择合适的防御料理(推荐骇浪派)。脚本需要在调度器设置里开启路径追踪行走配置,选择切换的队伍,打开允许在JsScript中使用,打开战斗配置,选择战斗策略,关闭战斗结束拾取物品和万叶拾取,最后根据战斗脚本一次循环的时间,在战斗超时中填入,比如周本火神原地版是28s,建议可以比正常单轮时间多个1s,另外搭配一条龙领奖无树脂脚本使用体验更佳哟。演示视频https://www.bilibili.com/video/BV1cpGCz6EWN/?vd_source=9dfaf88af48ecc0ff95a41f1145af7a2。",
|
||||
"authors": [
|
||||
{
|
||||
|
||||
@@ -2,7 +2,16 @@
|
||||
{
|
||||
"name": "foodName",
|
||||
"type": "input-text",
|
||||
"label": "请输入增益料理的正确名称 "
|
||||
"label": "请输入料理名称,多食物用法(攻击-药剂-防御)"
|
||||
},
|
||||
|
||||
]
|
||||
{
|
||||
"name": "resurgenceFoodName",
|
||||
"type": "input-text",
|
||||
"label": "请输入复活料理名称 "
|
||||
},
|
||||
{
|
||||
"name": "recoveryFoodName",
|
||||
"type": "input-text",
|
||||
"label": "请输入回血料理名称 "
|
||||
}
|
||||
]
|
||||
|
||||
@@ -23,10 +23,43 @@ async function tpEndDetection() {
|
||||
}
|
||||
throw new Error('传送时间超时');
|
||||
}
|
||||
//吃料理
|
||||
async function eatFood() {
|
||||
let foodName = settings.foodName ?? 0;
|
||||
if(foodName){
|
||||
const foodSum = foodName.split('-');
|
||||
log.info("开始吃菜");
|
||||
await sleep(1000);
|
||||
keyPress("B");//打开背包
|
||||
await sleep(2000);
|
||||
click(863, 51);//选择食物
|
||||
await sleep(1000);
|
||||
for(let i = 0; i < foodSum.length; i++){
|
||||
click(170, 1020);//筛选
|
||||
await sleep(1000);
|
||||
click(195, 1020);//重置
|
||||
await sleep(1000);
|
||||
click(110, 110);//输入名字
|
||||
await sleep(1000);
|
||||
inputText(foodSum[i]);
|
||||
await sleep(500);
|
||||
click(490, 1020);//确认筛选
|
||||
await sleep(1000);
|
||||
click(180, 180);//选择第一个食物
|
||||
await sleep(1000);
|
||||
click(1690, 1015);//使用
|
||||
await sleep(1000);
|
||||
}
|
||||
keyPress("ESCAPE");
|
||||
await sleep(1500);
|
||||
}}
|
||||
//检测角色是否阵亡,并前往吃药复活
|
||||
async function resurgenceDetectionAndEatFood() {
|
||||
const region1 = RecognitionObject.ocr(1170, 780, 75, 35);// 复活料理区域
|
||||
const region2 = RecognitionObject.ocr(545, 360, 800, 45);// 料理冷却区域
|
||||
let recoveryFoodName = settings.recoveryFoodName ?? 0;
|
||||
let resurgenceFoodName = settings.resurgenceFoodName ?? 0;
|
||||
if(resurgenceFoodName && recoveryFoodName){
|
||||
keyPress("1");
|
||||
await sleep(100);
|
||||
keyPress("2");
|
||||
@@ -44,6 +77,9 @@ let res2 = capture.find(region2);
|
||||
else if (!res1.isEmpty() && !res2.isEmpty()) {
|
||||
log.info("复活料理处于冷却中");
|
||||
keyPress("ESCAPE");
|
||||
await sleep(1000);
|
||||
await genshin.tp(2297.6201171875,-824.5869140625);//传送到神像回血
|
||||
throw new Error('战斗失败');
|
||||
return;
|
||||
}
|
||||
else if (!res1.isEmpty() && res2.isEmpty()) {
|
||||
@@ -52,7 +88,7 @@ let res2 = capture.find(region2);
|
||||
await eatResurgenceFood();//满血复活
|
||||
return;
|
||||
}
|
||||
}
|
||||
}}
|
||||
|
||||
//吃料理复活
|
||||
async function eatResurgenceFood() {
|
||||
@@ -132,36 +168,6 @@ for (let i = 0; i < clickPositions.length; i++) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//吃料理
|
||||
async function eatFood() {
|
||||
let foodName = settings.foodName ?? 0;
|
||||
if(foodName){
|
||||
log.info("开始吃菜");
|
||||
await sleep(1000);
|
||||
keyPress("B");//打开背包
|
||||
await sleep(2000);
|
||||
click(863, 51);//选择食物
|
||||
await sleep(1000);
|
||||
click(170, 1020);//筛选
|
||||
await sleep(1000);
|
||||
click(195, 1020);//重置
|
||||
await sleep(1000);
|
||||
click(110, 110);//输入名字
|
||||
await sleep(1000);
|
||||
inputText(`${foodName}`);
|
||||
await sleep(500);
|
||||
click(490, 1020);//确认筛选
|
||||
await sleep(1000);
|
||||
click(180, 180);//选择第一个食物
|
||||
await sleep(1000);
|
||||
click(1690, 1015);//使用
|
||||
await sleep(1000);
|
||||
keyPress("ESCAPE");
|
||||
await sleep(1500);
|
||||
}}
|
||||
|
||||
//征讨之花领奖(无图标前进检测)
|
||||
const autoNavigateToReward = async () => {
|
||||
const rewardTextRo = RecognitionObject.Ocr(1210, 515, 200, 50);//领奖区域检测
|
||||
@@ -176,14 +182,30 @@ const autoNavigateToReward = async () => {
|
||||
log.info("已到达领奖点,检测到文字: " + rewardResult.text);
|
||||
return;
|
||||
}
|
||||
else if(advanceNum > 20){
|
||||
throw new Error('前进时间超时');
|
||||
else if(advanceNum > 700){
|
||||
await genshin.tp(2297.6201171875,-824.5869140625);//传送到神像回血
|
||||
throw new Error('前进时间超时');
|
||||
}
|
||||
// 前进一小步
|
||||
keyDown("w");
|
||||
await sleep(500);
|
||||
keyUp("w");
|
||||
await sleep(100); // 等待角色移动稳定
|
||||
if((advanceNum%70)<34){
|
||||
keyDown("w");
|
||||
await sleep(500);
|
||||
keyUp("w");
|
||||
await sleep(200); // 等待角色移动稳定
|
||||
}
|
||||
else if((advanceNum%70)>34){
|
||||
keyDown("s");
|
||||
await sleep(500);
|
||||
keyUp("s");
|
||||
await sleep(200); // 等待角色移动稳定
|
||||
}
|
||||
else {
|
||||
keyDown("d");
|
||||
await sleep(500);
|
||||
keyUp("d");
|
||||
|
||||
}
|
||||
advanceNum++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -213,19 +235,15 @@ async function autoFightAndEndDetection() {
|
||||
keyDown("s");
|
||||
await sleep(1800);
|
||||
keyUp("s");
|
||||
capture = captureGameRegion();
|
||||
res1 = capture.find(region1);
|
||||
res2 = capture.find(region2);
|
||||
res3 = capture.find(region3);
|
||||
hasText1 = !res1.isEmpty() && res1.text.trim().length > 0;
|
||||
hasText2 = !res2.isEmpty() && res2.text.trim().length > 0;
|
||||
hasText3 = !res3.isEmpty() && res3.text.trim().length > 0;
|
||||
//二次检测避免无法启动战斗
|
||||
if (hasText1 && !hasText2 && hasText3){
|
||||
log.info(`执行第${challengeNum}次战斗`);
|
||||
challengeTime = challengeTime + 205;
|
||||
await dispatcher.runTask(new SoloTask("AutoFight"));
|
||||
}
|
||||
try {
|
||||
await dispatcher.runTask(new SoloTask("AutoFight"));
|
||||
} catch (error) {
|
||||
log.info("启动战斗失败,尝试重新启动");
|
||||
await sleep(500);
|
||||
}
|
||||
|
||||
}
|
||||
// 情况2: 区域2有文字 且 区域1无文字 且 区域3有文字 → 结束循环
|
||||
else if (hasText2 && !hasText1 && hasText3) {
|
||||
@@ -234,19 +252,23 @@ async function autoFightAndEndDetection() {
|
||||
}
|
||||
// 情况3: 区域2无文字区域1无文字区域3有文字 →BOSS二阶段,需要移动触发
|
||||
else if (!hasText2 && !hasText1 && hasText3) {
|
||||
/*
|
||||
log.info("检测到BOSS进入二阶段");
|
||||
keyDown("s");
|
||||
await sleep(2500);
|
||||
keyUp("s");
|
||||
await dispatcher.runTask(new SoloTask("AutoFight"));
|
||||
*/
|
||||
}
|
||||
// 情况4: 三个区域均无文字,可能处于转场动画,尝试点击快进
|
||||
else if (!hasText1 && !hasText2 && !hasText3){
|
||||
/*
|
||||
log.info("进入过场动画尝试快进");
|
||||
await sleep(400);
|
||||
click(1765, 55);
|
||||
await sleep(400);
|
||||
click(1765, 55);
|
||||
*/
|
||||
}
|
||||
|
||||
challengeTime = challengeTime + 1;
|
||||
@@ -279,7 +301,6 @@ await tpEndDetection();
|
||||
await eatFood();//嗑药
|
||||
keyPress("1");
|
||||
await sleep(1000);//切回固定行走位
|
||||
|
||||
keyDown("s");
|
||||
await sleep(300);
|
||||
keyDown("SHIFT");
|
||||
@@ -287,22 +308,25 @@ await sleep(300);
|
||||
keyUp("SHIFT");
|
||||
await sleep(500);
|
||||
keyUp("s");
|
||||
|
||||
//战斗和领奖
|
||||
await autoFightAndEndDetection();//一直战斗直到检测到结束
|
||||
//走到角落对准身位
|
||||
|
||||
//领奖并退出
|
||||
keyDown("s");
|
||||
await sleep(4000);
|
||||
keyUp("s");
|
||||
await autoNavigateToReward();//前往地脉之花
|
||||
|
||||
await sleep(1000);
|
||||
keyPress("F");//领奖
|
||||
await sleep(1000);
|
||||
click(950, 750);//使用树脂
|
||||
await sleep(6000);
|
||||
click(975, 1000);//退出秘境
|
||||
await sleep(10000);
|
||||
await tpEndDetection();
|
||||
await genshin.tp(2297.6201171875,-824.5869140625);//传送到神像回血
|
||||
await sleep(1000);
|
||||
keyPress("M");//展示剩余体力
|
||||
await sleep(1000);
|
||||
notification.send('挑战完成');
|
||||
|
||||
|
||||
})();
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"manifest_version": 1,
|
||||
"name": "雷神周本刷取",
|
||||
"version": "2.1",
|
||||
"version": "2.2",
|
||||
"description": "需0.44.6及以上版本,兼容所有正常队伍及战斗策略(禁止大幅度转向和移动技能龙王转圈、纳西达转圈、夜兰e……),但还是建议在JS设置中选择合适的防御料理(推荐骇浪派),另外最重要的是,没有六命老芭,请一定要选择使用复活料理和恢复料理。脚本需要在调度器设置里开启路径追踪行走配置,选择切换的队伍,打开允许在JsScript中使用,打开战斗配置,选择战斗策略,关闭战斗结束拾取物品和万叶拾取,最后根据战斗脚本一次循环的时间,在战斗超时中填入,比如周本原地版q是14s,建议可以比正常单轮时间多个1s,另外搭配一条龙领奖无树脂脚本使用体验更佳哟。演示视频https://www.bilibili.com/video/BV1cpGCz6EWN/?vd_source=9dfaf88af48ecc0ff95a41f1145af7a2。",
|
||||
"authors": [
|
||||
{
|
||||
|
||||
@@ -2,16 +2,16 @@
|
||||
{
|
||||
"name": "foodName",
|
||||
"type": "input-text",
|
||||
"label": "请输入增益料理的正确名称 "
|
||||
"label": "请输入料理名称,多食物用法(攻击-药剂-防御)"
|
||||
},
|
||||
{
|
||||
"name": "resurgenceFoodName",
|
||||
"type": "input-text",
|
||||
"label": "请输入复活料理的正确名称 "
|
||||
"label": "请输入复活料理名称 "
|
||||
},
|
||||
{
|
||||
"name": "recoveryFoodName",
|
||||
"type": "input-text",
|
||||
"label": "请输入回血料理的正确名称 "
|
||||
"label": "请输入回血料理名称 "
|
||||
}
|
||||
]
|
||||
]
|
||||
|
||||
@@ -23,10 +23,44 @@ async function tpEndDetection() {
|
||||
}
|
||||
throw new Error('传送时间超时');
|
||||
}
|
||||
|
||||
//吃料理
|
||||
async function eatFood() {
|
||||
let foodName = settings.foodName ?? 0;
|
||||
if(foodName){
|
||||
const foodSum = foodName.split('-');
|
||||
log.info("开始吃菜");
|
||||
await sleep(1000);
|
||||
keyPress("B");//打开背包
|
||||
await sleep(2000);
|
||||
click(863, 51);//选择食物
|
||||
await sleep(1000);
|
||||
for(let i = 0; i < foodSum.length; i++){
|
||||
click(170, 1020);//筛选
|
||||
await sleep(1000);
|
||||
click(195, 1020);//重置
|
||||
await sleep(1000);
|
||||
click(110, 110);//输入名字
|
||||
await sleep(1000);
|
||||
inputText(foodSum[i]);
|
||||
await sleep(500);
|
||||
click(490, 1020);//确认筛选
|
||||
await sleep(1000);
|
||||
click(180, 180);//选择第一个食物
|
||||
await sleep(1000);
|
||||
click(1690, 1015);//使用
|
||||
await sleep(1000);
|
||||
}
|
||||
keyPress("ESCAPE");
|
||||
await sleep(1500);
|
||||
}}
|
||||
//检测角色是否阵亡,并前往吃药复活
|
||||
async function resurgenceDetectionAndEatFood() {
|
||||
const region1 = RecognitionObject.ocr(1170, 780, 75, 35);// 复活料理区域
|
||||
const region2 = RecognitionObject.ocr(545, 360, 800, 45);// 料理冷却区域
|
||||
let recoveryFoodName = settings.recoveryFoodName ?? 0;
|
||||
let resurgenceFoodName = settings.resurgenceFoodName ?? 0;
|
||||
if(resurgenceFoodName && recoveryFoodName){
|
||||
keyPress("1");
|
||||
await sleep(100);
|
||||
keyPress("2");
|
||||
@@ -44,6 +78,9 @@ let res2 = capture.find(region2);
|
||||
else if (!res1.isEmpty() && !res2.isEmpty()) {
|
||||
log.info("复活料理处于冷却中");
|
||||
keyPress("ESCAPE");
|
||||
await sleep(1000);
|
||||
await genshin.tp(2297.6201171875,-824.5869140625);//传送到神像回血
|
||||
throw new Error('战斗失败');
|
||||
return;
|
||||
}
|
||||
else if (!res1.isEmpty() && res2.isEmpty()) {
|
||||
@@ -52,7 +89,7 @@ let res2 = capture.find(region2);
|
||||
await eatResurgenceFood();//满血复活
|
||||
return;
|
||||
}
|
||||
}
|
||||
}}
|
||||
|
||||
//吃料理复活
|
||||
async function eatResurgenceFood() {
|
||||
@@ -133,35 +170,6 @@ for (let i = 0; i < clickPositions.length; i++) {
|
||||
}
|
||||
|
||||
|
||||
|
||||
//吃料理
|
||||
async function eatFood() {
|
||||
let foodName = settings.foodName ?? 0;
|
||||
if(foodName){
|
||||
log.info("开始吃菜");
|
||||
await sleep(1000);
|
||||
keyPress("B");//打开背包
|
||||
await sleep(2000);
|
||||
click(863, 51);//选择食物
|
||||
await sleep(1000);
|
||||
click(170, 1020);//筛选
|
||||
await sleep(1000);
|
||||
click(195, 1020);//重置
|
||||
await sleep(1000);
|
||||
click(110, 110);//输入名字
|
||||
await sleep(1000);
|
||||
inputText(`${foodName}`);
|
||||
await sleep(500);
|
||||
click(490, 1020);//确认筛选
|
||||
await sleep(1000);
|
||||
click(180, 180);//选择第一个食物
|
||||
await sleep(1000);
|
||||
click(1690, 1015);//使用
|
||||
await sleep(1000);
|
||||
keyPress("ESCAPE");
|
||||
await sleep(1500);
|
||||
}}
|
||||
|
||||
//征讨之花领奖(无图标前进检测)
|
||||
const autoNavigateToReward = async () => {
|
||||
const rewardTextRo = RecognitionObject.Ocr(1210, 515, 200, 50);//领奖区域检测
|
||||
@@ -211,22 +219,16 @@ async function autoFightAndEndDetection() {
|
||||
await resurgenceDetectionAndEatFood();
|
||||
challengeNum++;
|
||||
keyDown("s");
|
||||
await sleep(1800);
|
||||
await sleep(1500);
|
||||
keyUp("s");
|
||||
await sleep(500);//避免切人冷却,导致角色识别失败
|
||||
capture = captureGameRegion();
|
||||
res1 = capture.find(region1);
|
||||
res2 = capture.find(region2);
|
||||
res3 = capture.find(region3);
|
||||
hasText1 = !res1.isEmpty() && res1.text.trim().length > 0;
|
||||
hasText2 = !res2.isEmpty() && res2.text.trim().length > 0;
|
||||
hasText3 = !res3.isEmpty() && res3.text.trim().length > 0;
|
||||
//二次检测避免无法启动战斗
|
||||
if (hasText1 && !hasText2 && hasText3){
|
||||
log.info(`执行第${challengeNum}次战斗`);
|
||||
challengeTime = challengeTime + 205;
|
||||
await dispatcher.runTask(new SoloTask("AutoFight"));
|
||||
}
|
||||
challengeTime = challengeTime + 200;
|
||||
try {
|
||||
await dispatcher.runTask(new SoloTask("AutoFight"));
|
||||
} catch (error) {
|
||||
log.info("启动战斗失败,尝试重新启动");
|
||||
await sleep(500);
|
||||
}
|
||||
}
|
||||
// 情况2: 区域2有文字 且 区域1无文字 且 区域3有文字 → 结束循环
|
||||
else if (hasText2 && !hasText1 && hasText3) {
|
||||
@@ -239,7 +241,12 @@ async function autoFightAndEndDetection() {
|
||||
keyDown("s");
|
||||
await sleep(2500);
|
||||
keyUp("s");
|
||||
await dispatcher.runTask(new SoloTask("AutoFight"));
|
||||
try {
|
||||
await dispatcher.runTask(new SoloTask("AutoFight"));
|
||||
} catch (error) {
|
||||
log.info("启动战斗失败,尝试重新启动");
|
||||
await sleep(500);
|
||||
}
|
||||
}
|
||||
// 情况4: 三个区域均无文字,可能处于转场动画,尝试点击快进
|
||||
else if (!hasText1 && !hasText2 && !hasText3){
|
||||
@@ -249,7 +256,6 @@ async function autoFightAndEndDetection() {
|
||||
await sleep(400);
|
||||
click(1765, 55);
|
||||
}
|
||||
|
||||
challengeTime = challengeTime + 1;
|
||||
// 每次检测间隔100毫秒,避免CPU占用过高
|
||||
await sleep(100);
|
||||
@@ -257,14 +263,14 @@ async function autoFightAndEndDetection() {
|
||||
}
|
||||
|
||||
|
||||
//通用:前往副本(副本外)
|
||||
//前往副本(副本外)
|
||||
await sleep(1000);
|
||||
await pathingScript.runFile("assets/recover.json");
|
||||
await sleep(5000);
|
||||
await pathingScript.runFile("assets/tp.json");
|
||||
await sleep(1000);
|
||||
keyDown("w");
|
||||
await sleep(2000);
|
||||
await sleep(1000);
|
||||
keyUp("w");
|
||||
await sleep(1000);
|
||||
keyPress("F");
|
||||
@@ -291,24 +297,25 @@ await sleep(300);
|
||||
keyUp("SHIFT");
|
||||
await sleep(200);
|
||||
keyUp("s");
|
||||
|
||||
//战斗和领奖
|
||||
await autoFightAndEndDetection();//一直战斗直到检测到结束
|
||||
//走到角落对准身位
|
||||
|
||||
|
||||
//领奖并退出
|
||||
keyDown("s");
|
||||
await sleep(10000);
|
||||
keyUp("s");
|
||||
await autoNavigateToReward();//前往地脉之花
|
||||
|
||||
await sleep(1000);
|
||||
keyPress("F");//领奖
|
||||
await sleep(1000);
|
||||
click(950, 750);//使用树脂
|
||||
await sleep(6000);
|
||||
click(975, 1000);//退出秘境
|
||||
await sleep(10000);
|
||||
|
||||
|
||||
|
||||
await tpEndDetection();
|
||||
await genshin.tp(2297.6201171875,-824.5869140625);//传送到神像回血
|
||||
await sleep(1000);
|
||||
keyPress("M");//展示剩余体力
|
||||
await sleep(1000);
|
||||
notification.send('挑战完成');
|
||||
|
||||
})();
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"manifest_version": 1,
|
||||
"name": "散兵周本刷取",
|
||||
"version": "2.1",
|
||||
"version": "2.2",
|
||||
"description": "需0.44.6及以上版本,兼容所有正常队伍及战斗策略(禁止大幅度转向和移动技能龙王转圈、纳西达转圈、夜兰e……),但还是建议在JS设置中选择合适的防御料理(推荐骇浪派),另外最重要的是,没有六命老芭,请一定要选择使用复活料理和恢复料理。脚本需要在调度器设置里开启路径追踪行走配置,选择切换的队伍,打开允许在JsScript中使用,打开战斗配置,选择战斗策略,关闭战斗结束拾取物品和万叶拾取,最后根据战斗脚本一次循环的时间,在战斗超时中填入,比如周本原地版q是14s,建议可以比正常单轮时间多个1s,另外搭配一条龙领奖无树脂脚本使用体验更佳哟。演示视频https://www.bilibili.com/video/BV1cpGCz6EWN/?vd_source=9dfaf88af48ecc0ff95a41f1145af7a2。",
|
||||
"authors": [
|
||||
{
|
||||
|
||||
@@ -2,16 +2,16 @@
|
||||
{
|
||||
"name": "foodName",
|
||||
"type": "input-text",
|
||||
"label": "请输入增益料理的正确名称 "
|
||||
"label": "请输入料理名称,多食物用法(攻击-药剂-防御)"
|
||||
},
|
||||
{
|
||||
"name": "resurgenceFoodName",
|
||||
"type": "input-text",
|
||||
"label": "请输入复活料理的正确名称 "
|
||||
"label": "请输入复活料理名称 "
|
||||
},
|
||||
{
|
||||
"name": "recoveryFoodName",
|
||||
"type": "input-text",
|
||||
"label": "请输入回血料理的正确名称 "
|
||||
"label": "请输入回血料理名称 "
|
||||
}
|
||||
]
|
||||
]
|
||||
|
||||
@@ -27,19 +27,96 @@ async function tpEndDetection() {
|
||||
async function eatFood() {
|
||||
let foodName = settings.foodName ?? 0;
|
||||
if(foodName){
|
||||
const foodSum = foodName.split('-');
|
||||
log.info("开始吃菜");
|
||||
await sleep(1000);
|
||||
keyPress("B");//打开背包
|
||||
await sleep(2000);
|
||||
click(863, 51);//选择食物
|
||||
await sleep(1000);
|
||||
for(let i = 0; i < foodSum.length; i++){
|
||||
click(170, 1020);//筛选
|
||||
await sleep(1000);
|
||||
click(195, 1020);//重置
|
||||
await sleep(1000);
|
||||
click(110, 110);//输入名字
|
||||
await sleep(1000);
|
||||
inputText(foodSum[i]);
|
||||
await sleep(500);
|
||||
click(490, 1020);//确认筛选
|
||||
await sleep(1000);
|
||||
click(180, 180);//选择第一个食物
|
||||
await sleep(1000);
|
||||
click(1690, 1015);//使用
|
||||
await sleep(1000);
|
||||
}
|
||||
keyPress("ESCAPE");
|
||||
await sleep(1500);
|
||||
}}
|
||||
//检测角色是否阵亡,并前往吃药复活
|
||||
async function resurgenceDetectionAndEatFood() {
|
||||
const region1 = RecognitionObject.ocr(1170, 780, 75, 35);// 复活料理区域
|
||||
const region2 = RecognitionObject.ocr(545, 360, 800, 45);// 料理冷却区域
|
||||
let recoveryFoodName = settings.recoveryFoodName ?? 0;
|
||||
let resurgenceFoodName = settings.resurgenceFoodName ?? 0;
|
||||
if(resurgenceFoodName && recoveryFoodName){
|
||||
keyPress("1");
|
||||
await sleep(100);
|
||||
keyPress("2");
|
||||
await sleep(100);
|
||||
keyPress("3");
|
||||
await sleep(100);
|
||||
keyPress("4");
|
||||
await sleep(200);
|
||||
let capture = captureGameRegion();
|
||||
let res1 = capture.find(region1);
|
||||
let res2 = capture.find(region2);
|
||||
if (res1.isEmpty()){
|
||||
return;
|
||||
}
|
||||
else if (!res1.isEmpty() && !res2.isEmpty()) {
|
||||
log.info("复活料理处于冷却中");
|
||||
keyPress("ESCAPE");
|
||||
await sleep(1000);
|
||||
await genshin.tp(2297.6201171875,-824.5869140625);//传送到神像回血
|
||||
throw new Error('战斗失败');
|
||||
return;
|
||||
}
|
||||
else if (!res1.isEmpty() && res2.isEmpty()) {
|
||||
log.info("检测到阵亡角色……复活吧!我的爱人!!!");
|
||||
keyPress("ESCAPE");
|
||||
await eatResurgenceFood();//满血复活
|
||||
return;
|
||||
}
|
||||
}}
|
||||
|
||||
//吃料理复活
|
||||
async function eatResurgenceFood() {
|
||||
let recoveryFoodName = settings.recoveryFoodName ?? 0;
|
||||
let resurgenceFoodName = settings.resurgenceFoodName ?? 0;
|
||||
const region = RecognitionObject.ocr(800, 200, 315, 32);// 复活对象检测
|
||||
const clickPositions = [
|
||||
{ x: 760, y: 440 }, // 角色1
|
||||
{ x: 900, y: 440 }, // 角色2
|
||||
{ x: 1040, y: 440 }, // 角色3
|
||||
{ x: 1180, y: 440 } // 角色4
|
||||
];
|
||||
if(resurgenceFoodName && recoveryFoodName){
|
||||
log.info("开始吃菜");
|
||||
await sleep(500);
|
||||
keyPress("B");//打开背包
|
||||
await sleep(2000);
|
||||
click(863, 51);//选择食物
|
||||
await sleep(1000);
|
||||
click(170, 1020);//筛选
|
||||
await sleep(1000);
|
||||
click(195, 1020);//重置
|
||||
await sleep(1000);
|
||||
click(110, 110);//输入名字
|
||||
await sleep(200);
|
||||
click(110, 110);
|
||||
await sleep(1000);
|
||||
inputText(`${foodName}`);
|
||||
inputText(`${resurgenceFoodName}`);
|
||||
await sleep(500);
|
||||
click(490, 1020);//确认筛选
|
||||
await sleep(1000);
|
||||
@@ -47,9 +124,49 @@ click(180, 180);//选择第一个食物
|
||||
await sleep(1000);
|
||||
click(1690, 1015);//使用
|
||||
await sleep(1000);
|
||||
keyPress("ESCAPE");
|
||||
await sleep(1500);
|
||||
}}
|
||||
// 使用 for 循环点击每个位置
|
||||
for (let i = 0; i < clickPositions.length; i++) {
|
||||
const position = clickPositions[i];
|
||||
click(position.x, position.y);
|
||||
await sleep(800);
|
||||
click(1200,770);//确认
|
||||
await sleep(800);
|
||||
let capture = captureGameRegion();
|
||||
let res = capture.find(region);
|
||||
if (res.isEmpty()){
|
||||
keyPress("ESCAPE");
|
||||
await sleep(1000);
|
||||
click(170, 1020);//筛选
|
||||
await sleep(1000);
|
||||
click(195, 1020);//重置
|
||||
await sleep(1000);
|
||||
click(110, 110);//输入名字
|
||||
await sleep(1000);
|
||||
inputText(`${recoveryFoodName}`);
|
||||
await sleep(500);
|
||||
click(490, 1020);//确认筛选
|
||||
await sleep(1000);
|
||||
click(180, 180);//选择第一个食物
|
||||
await sleep(1000);
|
||||
click(1690, 1015);//使用
|
||||
await sleep(500);
|
||||
click(position.x, position.y);
|
||||
await sleep(500);
|
||||
click(1200,770);//吃第一个
|
||||
await sleep(500);
|
||||
click(1200,770);//吃第二个
|
||||
await sleep(500);
|
||||
click(1350,290);//退出
|
||||
await sleep(500);
|
||||
keyPress("ESCAPE");
|
||||
await sleep(400);
|
||||
log.info("我又好了,嘿嘿");
|
||||
break;
|
||||
}
|
||||
await sleep(1000);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//征讨之花领奖
|
||||
const autoNavigateToReward = async () => {
|
||||
@@ -118,7 +235,7 @@ const autoNavigateToReward = async () => {
|
||||
keyDown("w");
|
||||
await sleep(500);
|
||||
keyUp("w");
|
||||
await sleep(100); // 等待角色移动稳定
|
||||
await sleep(200); // 等待角色移动稳定
|
||||
}
|
||||
}
|
||||
|
||||
@@ -143,21 +260,17 @@ async function autoFightAndEndDetection() {
|
||||
let hasText3 = !res3.isEmpty() && res3.text.trim().length > 0;
|
||||
// 情况1: 区域1有文字 且 区域2无文字 且 区域3有文字 → 执行AutoFight
|
||||
if (hasText1 && !hasText2 && hasText3) {
|
||||
await resurgenceDetectionAndEatFood();
|
||||
challengeNum++;
|
||||
await sleep(500);//避免切人冷却,导致角色识别失败
|
||||
capture = captureGameRegion();
|
||||
res1 = capture.find(region1);
|
||||
res2 = capture.find(region2);
|
||||
res3 = capture.find(region3);
|
||||
hasText1 = !res1.isEmpty() && res1.text.trim().length > 0;
|
||||
hasText2 = !res2.isEmpty() && res2.text.trim().length > 0;
|
||||
hasText3 = !res3.isEmpty() && res3.text.trim().length > 0;
|
||||
//二次检测避免无法启动战斗
|
||||
if (hasText1 && !hasText2 && hasText3){
|
||||
await sleep(800);//避免切人冷却,导致角色识别失败
|
||||
log.info(`执行第${challengeNum}次战斗`);
|
||||
challengeTime = challengeTime + 205;
|
||||
await dispatcher.runTask(new SoloTask("AutoFight"));
|
||||
}
|
||||
try {
|
||||
await dispatcher.runTask(new SoloTask("AutoFight"));
|
||||
} catch (error) {
|
||||
log.info("启动战斗失败,尝试重新启动");
|
||||
await sleep(500);
|
||||
}
|
||||
}
|
||||
// 情况2: 区域2有文字 且 区域1无文字 且 区域3有文字 → 结束循环
|
||||
else if (hasText2 && !hasText1 && hasText3) {
|
||||
@@ -167,7 +280,12 @@ async function autoFightAndEndDetection() {
|
||||
// 情况3: 区域2无文字区域1无文字区域3有文字 →BOSS二阶段,需要移动触发
|
||||
else if (!hasText2 && !hasText1 && hasText3) {
|
||||
log.info("检测到BOSS进入二阶段");
|
||||
await dispatcher.runTask(new SoloTask("AutoFight"));
|
||||
try {
|
||||
await dispatcher.runTask(new SoloTask("AutoFight"));
|
||||
} catch (error) {
|
||||
log.info("启动战斗失败,尝试重新启动");
|
||||
await sleep(500);
|
||||
}
|
||||
}
|
||||
// 情况4: 三个区域均无文字,可能处于转场动画,尝试点击快进
|
||||
else if (!hasText1 && !hasText2 && !hasText3){
|
||||
@@ -225,18 +343,22 @@ keyUp("w");
|
||||
keyDown("d");
|
||||
await sleep(3500);
|
||||
keyUp("d");
|
||||
|
||||
//战斗和领奖
|
||||
await autoFightAndEndDetection();//一直战斗直到检测到结束
|
||||
await autoNavigateToReward();//前往地脉之花
|
||||
|
||||
//领奖并退出
|
||||
await autoNavigateToReward();//前往地脉之花
|
||||
await sleep(1000);
|
||||
keyPress("F");//领奖
|
||||
await sleep(1000);
|
||||
click(950, 750);//使用树脂
|
||||
await sleep(6000);
|
||||
click(975, 1000);//退出秘境
|
||||
await sleep(10000);
|
||||
await tpEndDetection();
|
||||
await genshin.tp(2297.6201171875,-824.5869140625);//传送到神像回血
|
||||
await sleep(1000);
|
||||
keyPress("M");//展示剩余体力
|
||||
await sleep(1000);
|
||||
notification.send('挑战完成');
|
||||
|
||||
|
||||
})();
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"manifest_version": 1,
|
||||
"name": "阿佩普周本刷取",
|
||||
"version": "2.1",
|
||||
"version": "2.2",
|
||||
"description": "需0.44.6及以上版本,兼容所有正常队伍及战斗策略,但还是建议在JS设置中选择合适的防御料理(推荐骇浪派)。脚本需要在调度器设置里开启路径追踪行走配置,选择切换的队伍,打开允许在JsScript中使用,打开战斗配置,选择战斗策略,关闭战斗结束拾取物品和万叶拾取,最后根据战斗脚本一次循环的时间,在战斗超时中填入,比如周本火神原地版是28s,建议可以比正常单轮时间多个1s,另外搭配一条龙领奖无树脂脚本使用体验更佳哟。演示视频https://www.bilibili.com/video/BV1cpGCz6EWN/?vd_source=9dfaf88af48ecc0ff95a41f1145af7a2。",
|
||||
"authors": [
|
||||
{
|
||||
|
||||
@@ -2,6 +2,16 @@
|
||||
{
|
||||
"name": "foodName",
|
||||
"type": "input-text",
|
||||
"label": "请输入料理的正确名称 "
|
||||
"label": "请输入料理名称,多食物用法(攻击-药剂-防御)"
|
||||
},
|
||||
]
|
||||
{
|
||||
"name": "resurgenceFoodName",
|
||||
"type": "input-text",
|
||||
"label": "请输入复活料理名称 "
|
||||
},
|
||||
{
|
||||
"name": "recoveryFoodName",
|
||||
"type": "input-text",
|
||||
"label": "请输入回血料理名称 "
|
||||
}
|
||||
]
|
||||
|
||||
@@ -27,19 +27,96 @@ async function tpEndDetection() {
|
||||
async function eatFood() {
|
||||
let foodName = settings.foodName ?? 0;
|
||||
if(foodName){
|
||||
const foodSum = foodName.split('-');
|
||||
log.info("开始吃菜");
|
||||
await sleep(1000);
|
||||
keyPress("B");//打开背包
|
||||
await sleep(2000);
|
||||
click(863, 51);//选择食物
|
||||
await sleep(1000);
|
||||
for(let i = 0; i < foodSum.length; i++){
|
||||
click(170, 1020);//筛选
|
||||
await sleep(1000);
|
||||
click(195, 1020);//重置
|
||||
await sleep(1000);
|
||||
click(110, 110);//输入名字
|
||||
await sleep(1000);
|
||||
inputText(foodSum[i]);
|
||||
await sleep(500);
|
||||
click(490, 1020);//确认筛选
|
||||
await sleep(1000);
|
||||
click(180, 180);//选择第一个食物
|
||||
await sleep(1000);
|
||||
click(1690, 1015);//使用
|
||||
await sleep(1000);
|
||||
}
|
||||
keyPress("ESCAPE");
|
||||
await sleep(1500);
|
||||
}}
|
||||
//检测角色是否阵亡,并前往吃药复活
|
||||
async function resurgenceDetectionAndEatFood() {
|
||||
const region1 = RecognitionObject.ocr(1170, 780, 75, 35);// 复活料理区域
|
||||
const region2 = RecognitionObject.ocr(545, 360, 800, 45);// 料理冷却区域
|
||||
let recoveryFoodName = settings.recoveryFoodName ?? 0;
|
||||
let resurgenceFoodName = settings.resurgenceFoodName ?? 0;
|
||||
if(resurgenceFoodName && recoveryFoodName){
|
||||
keyPress("1");
|
||||
await sleep(100);
|
||||
keyPress("2");
|
||||
await sleep(100);
|
||||
keyPress("3");
|
||||
await sleep(100);
|
||||
keyPress("4");
|
||||
await sleep(200);
|
||||
let capture = captureGameRegion();
|
||||
let res1 = capture.find(region1);
|
||||
let res2 = capture.find(region2);
|
||||
if (res1.isEmpty()){
|
||||
return;
|
||||
}
|
||||
else if (!res1.isEmpty() && !res2.isEmpty()) {
|
||||
log.info("复活料理处于冷却中");
|
||||
keyPress("ESCAPE");
|
||||
await sleep(1000);
|
||||
await genshin.tp(2297.6201171875,-824.5869140625);//传送到神像回血
|
||||
throw new Error('战斗失败');
|
||||
return;
|
||||
}
|
||||
else if (!res1.isEmpty() && res2.isEmpty()) {
|
||||
log.info("检测到阵亡角色……复活吧!我的爱人!!!");
|
||||
keyPress("ESCAPE");
|
||||
await eatResurgenceFood();//满血复活
|
||||
return;
|
||||
}
|
||||
}}
|
||||
|
||||
//吃料理复活
|
||||
async function eatResurgenceFood() {
|
||||
let recoveryFoodName = settings.recoveryFoodName ?? 0;
|
||||
let resurgenceFoodName = settings.resurgenceFoodName ?? 0;
|
||||
const region = RecognitionObject.ocr(800, 200, 315, 32);// 复活对象检测
|
||||
const clickPositions = [
|
||||
{ x: 760, y: 440 }, // 角色1
|
||||
{ x: 900, y: 440 }, // 角色2
|
||||
{ x: 1040, y: 440 }, // 角色3
|
||||
{ x: 1180, y: 440 } // 角色4
|
||||
];
|
||||
if(resurgenceFoodName && recoveryFoodName){
|
||||
log.info("开始吃菜");
|
||||
await sleep(500);
|
||||
keyPress("B");//打开背包
|
||||
await sleep(2000);
|
||||
click(863, 51);//选择食物
|
||||
await sleep(1000);
|
||||
click(170, 1020);//筛选
|
||||
await sleep(1000);
|
||||
click(195, 1020);//重置
|
||||
await sleep(1000);
|
||||
click(110, 110);//输入名字
|
||||
await sleep(200);
|
||||
click(110, 110);
|
||||
await sleep(1000);
|
||||
inputText(`${foodName}`);
|
||||
inputText(`${resurgenceFoodName}`);
|
||||
await sleep(500);
|
||||
click(490, 1020);//确认筛选
|
||||
await sleep(1000);
|
||||
@@ -47,9 +124,49 @@ click(180, 180);//选择第一个食物
|
||||
await sleep(1000);
|
||||
click(1690, 1015);//使用
|
||||
await sleep(1000);
|
||||
keyPress("ESCAPE");
|
||||
await sleep(1500);
|
||||
}}
|
||||
// 使用 for 循环点击每个位置
|
||||
for (let i = 0; i < clickPositions.length; i++) {
|
||||
const position = clickPositions[i];
|
||||
click(position.x, position.y);
|
||||
await sleep(800);
|
||||
click(1200,770);//确认
|
||||
await sleep(800);
|
||||
let capture = captureGameRegion();
|
||||
let res = capture.find(region);
|
||||
if (res.isEmpty()){
|
||||
keyPress("ESCAPE");
|
||||
await sleep(1000);
|
||||
click(170, 1020);//筛选
|
||||
await sleep(1000);
|
||||
click(195, 1020);//重置
|
||||
await sleep(1000);
|
||||
click(110, 110);//输入名字
|
||||
await sleep(1000);
|
||||
inputText(`${recoveryFoodName}`);
|
||||
await sleep(500);
|
||||
click(490, 1020);//确认筛选
|
||||
await sleep(1000);
|
||||
click(180, 180);//选择第一个食物
|
||||
await sleep(1000);
|
||||
click(1690, 1015);//使用
|
||||
await sleep(500);
|
||||
click(position.x, position.y);
|
||||
await sleep(500);
|
||||
click(1200,770);//吃第一个
|
||||
await sleep(500);
|
||||
click(1200,770);//吃第二个
|
||||
await sleep(500);
|
||||
click(1350,290);//退出
|
||||
await sleep(500);
|
||||
keyPress("ESCAPE");
|
||||
await sleep(400);
|
||||
log.info("我又好了,嘿嘿");
|
||||
break;
|
||||
}
|
||||
await sleep(1000);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//征讨之花领奖
|
||||
const autoNavigateToReward = async () => {
|
||||
@@ -118,7 +235,7 @@ const autoNavigateToReward = async () => {
|
||||
keyDown("w");
|
||||
await sleep(500);
|
||||
keyUp("w");
|
||||
await sleep(100); // 等待角色移动稳定
|
||||
await sleep(200); // 等待角色移动稳定
|
||||
}
|
||||
}
|
||||
|
||||
@@ -143,21 +260,17 @@ async function autoFightAndEndDetection() {
|
||||
let hasText3 = !res3.isEmpty() && res3.text.trim().length > 0;
|
||||
// 情况1: 区域1有文字 且 区域2无文字 且 区域3有文字 → 执行AutoFight
|
||||
if (hasText1 && !hasText2 && hasText3) {
|
||||
await resurgenceDetectionAndEatFood();
|
||||
challengeNum++;
|
||||
await sleep(500);//避免切人冷却,导致角色识别失败
|
||||
capture = captureGameRegion();
|
||||
res1 = capture.find(region1);
|
||||
res2 = capture.find(region2);
|
||||
res3 = capture.find(region3);
|
||||
hasText1 = !res1.isEmpty() && res1.text.trim().length > 0;
|
||||
hasText2 = !res2.isEmpty() && res2.text.trim().length > 0;
|
||||
hasText3 = !res3.isEmpty() && res3.text.trim().length > 0;
|
||||
//二次检测避免无法启动战斗
|
||||
if (hasText1 && !hasText2 && hasText3){
|
||||
await sleep(800);//避免切人冷却,导致角色识别失败
|
||||
log.info(`执行第${challengeNum}次战斗`);
|
||||
challengeTime = challengeTime + 205;
|
||||
await dispatcher.runTask(new SoloTask("AutoFight"));
|
||||
}
|
||||
try {
|
||||
await dispatcher.runTask(new SoloTask("AutoFight"));
|
||||
} catch (error) {
|
||||
log.info("启动战斗失败,尝试重新启动");
|
||||
await sleep(500);
|
||||
}
|
||||
}
|
||||
// 情况2: 区域2有文字 且 区域1无文字 且 区域3有文字 → 结束循环
|
||||
else if (hasText2 && !hasText1 && hasText3) {
|
||||
@@ -166,16 +279,25 @@ async function autoFightAndEndDetection() {
|
||||
}
|
||||
// 情况3: 区域2无文字区域1无文字区域3有文字 →BOSS二阶段,需要移动触发
|
||||
else if (!hasText2 && !hasText1 && hasText3) {
|
||||
/*
|
||||
log.info("检测到BOSS进入二阶段");
|
||||
await dispatcher.runTask(new SoloTask("AutoFight"));
|
||||
try {
|
||||
await dispatcher.runTask(new SoloTask("AutoFight"));
|
||||
} catch (error) {
|
||||
log.info("启动战斗失败,尝试重新启动");
|
||||
await sleep(500);
|
||||
}
|
||||
*/
|
||||
}
|
||||
// 情况4: 三个区域均无文字,可能处于转场动画,尝试点击快进
|
||||
else if (!hasText1 && !hasText2 && !hasText3){
|
||||
/*
|
||||
log.info("进入过场动画尝试快进");
|
||||
await sleep(400);
|
||||
click(1765, 55);
|
||||
await sleep(400);
|
||||
click(1765, 55);
|
||||
*/
|
||||
}
|
||||
|
||||
challengeTime = challengeTime + 1;
|
||||
@@ -208,17 +330,21 @@ await tpEndDetection();
|
||||
await eatFood();//嗑药
|
||||
keyPress("1");
|
||||
await sleep(1000);//切回固定行走位
|
||||
|
||||
//战斗和领奖
|
||||
await autoFightAndEndDetection();//一直战斗直到检测到结束
|
||||
await autoNavigateToReward();//前往地脉之花
|
||||
|
||||
//领奖并退出
|
||||
await autoNavigateToReward();//前往地脉之花
|
||||
await sleep(1000);
|
||||
keyPress("F");//领奖
|
||||
await sleep(1000);
|
||||
click(950, 750);//使用树脂
|
||||
await sleep(6000);
|
||||
click(975, 1000);//退出秘境
|
||||
await sleep(10000);
|
||||
await tpEndDetection();
|
||||
await genshin.tp(2297.6201171875,-824.5869140625);//传送到神像回血
|
||||
await sleep(1000);
|
||||
keyPress("M");//展示剩余体力
|
||||
await sleep(1000);
|
||||
notification.send('挑战完成');
|
||||
|
||||
})();
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"manifest_version": 1,
|
||||
"name": "鲸鱼周本刷取",
|
||||
"version": "2.1",
|
||||
"version": "2.2",
|
||||
"description": "需0.44.6及以上版本,兼容所有正常队伍及战斗策略,但还是建议在JS设置中选择合适的防御料理(推荐骇浪派)。脚本需要在调度器设置里开启路径追踪行走配置,选择切换的队伍,打开允许在JsScript中使用,打开战斗配置,选择战斗策略,关闭战斗结束拾取物品和万叶拾取,最后根据战斗脚本一次循环的时间,在战斗超时中填入,比如周本原地版q是14s,建议可以比正常单轮时间多个1s,另外搭配一条龙领奖无树脂脚本使用体验更佳哟。演示视频https://www.bilibili.com/video/BV1cpGCz6EWN/?vd_source=9dfaf88af48ecc0ff95a41f1145af7a2。",
|
||||
"authors": [
|
||||
{
|
||||
|
||||
@@ -2,6 +2,16 @@
|
||||
{
|
||||
"name": "foodName",
|
||||
"type": "input-text",
|
||||
"label": "请输入料理的正确名称 "
|
||||
"label": "请输入料理名称,多食物用法(攻击-药剂-防御)"
|
||||
},
|
||||
]
|
||||
{
|
||||
"name": "resurgenceFoodName",
|
||||
"type": "input-text",
|
||||
"label": "请输入复活料理名称 "
|
||||
},
|
||||
{
|
||||
"name": "recoveryFoodName",
|
||||
"type": "input-text",
|
||||
"label": "请输入回血料理名称 "
|
||||
}
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user