js:战斗好感 (#2785)

* js:战斗好感

战斗结束后释放鼠标防止传送失败

* js:AAA狗粮批发

适配高铁模式
This commit is contained in:
mno
2026-01-26 16:30:05 +08:00
committed by GitHub
parent a2e9f2b389
commit 6db5c95f1e
4 changed files with 45 additions and 37 deletions

View File

@@ -30,7 +30,6 @@ const outDatedRo = RecognitionObject.TemplateMatch(file.ReadImageMatSync("assets
const normalPathA = "assets/ArtifactsPath/普通98点1号线";
const normalPathB = "assets/ArtifactsPath/普通98点2号线";
const normalPathC = "assets/ArtifactsPath/普通C";
const extraPath = "assets/ArtifactsPath/额外";
//初始化变量
@@ -104,22 +103,22 @@ let gameRegion;
}
moraDiff -= await mora();
if (!settings.fastMode) {
//执行普通路线,直到预定激活开始时间
log.info("开始执行普通路线");
await runNormalPath(true);
if (state.cancel) return;
//执行普通路线,直到预定激活开始时间
log.info("开始执行普通路线");
await runNormalPath(true);
if (state.cancel) return;
//执行激活路线
log.info("开始执行激活路线");
await runActivatePath();
if (state.cancel) return;
//执行剩余普通路线
log.info("开始执行剩余普通路线");
await runNormalPath(false);
if (state.cancel) return;
//执行激活路线
log.info("开始执行激活路线");
await runActivatePath();
if (state.cancel) return;
//执行剩余普通路线
log.info("开始执行剩余普通路线");
await runNormalPath(false);
if (state.cancel) return;
}
if (!onlyActivate || state.runningEndingAndExtraRoute != "收尾额外A") {
//执行收尾和额外路线
@@ -872,26 +871,35 @@ async function runEndingAndExtraPath() {
endingPath = state.runningEndingAndExtraRoute === "收尾额外A"
? "assets/ArtifactsPath/联机收尾/优先收尾路线"
: "assets/ArtifactsPath/联机收尾/替补收尾路线";
if (forceAlternate) {
endingPath = state.runningRoute === "A"
? "assets/ArtifactsPath/优先收尾路线"
: "assets/ArtifactsPath/替补收尾路线";
}
}
let extraPath = state.runningEndingAndExtraRoute === "收尾额外A"
? "assets/ArtifactsPath/额外/所有额外"
: "assets/ArtifactsPath/额外/仅12h额外";
endingPath = endingPath + "/执行";
extraPath = extraPath + "/执行";
if (settings.fastMode) {
log.info("启用了急速模式,直接运行高铁路线");
endingPath = state.runningEndingAndExtraRoute === "收尾额外A"
? "assets/ArtifactsPath/高铁/高铁1号线"
: "assets/ArtifactsPath/高铁/高铁2号线";
if (forceAlternate) {
endingPath = state.runningRoute === "A"
? "assets/ArtifactsPath/高铁/高铁1号线"
: "assets/ArtifactsPath/高铁/高铁2号线";
}
extraPath = "";
}
state.activatePickUp = true;
await runPaths(endingPath, artifactPartyName, false, "white");
extraPath = extraPath + "/执行";
await runPaths(extraPath, artifactPartyName, false, "white");
state.activatePickUp = false;
}
async function runPaths(folderFilePath, PartyName, doStop, furinaRequirement = "") {
if (state.cancel) return;
if (folderFilePath === "") {
return;
}
let Paths = await readFolder(folderFilePath, true);
let furinaChecked = false;
for (let i = 0; i < Paths.length; i++) {

View File

@@ -1,7 +1,7 @@
{
"manifest_version": 1,
"name": "AAA狗粮批发",
"version": "1.7.2",
"version": "2.0.0",
"tags": [
"狗粮"
],

View File

@@ -53,7 +53,7 @@ const DEFAULT_FIGHT_TIMEOUT_SECONDS = 120;
})();
function convertToTrueIfNotBoolean(value) {
return typeof value === 'boolean' ? value : true;
return typeof value === 'boolean' ? value : true;
}
// 执行 path 任务
async function AutoPath(locationName) {
@@ -229,6 +229,7 @@ async function executeBattleTasks(fightTimeout, enemyType, cts) {
}
}
}
keyUp("VK_LBUTTON");
}
}
@@ -243,10 +244,10 @@ async function executeSingleFriendshipRound(roundIndex, ocrTimeout, fightTimeout
if (roundIndex === 0) {
initialDetected = await detectTaskTrigger(3, enemyType);
}
if(!initialDetected || roundIndex > 0) {
if (!initialDetected || roundIndex > 0) {
await genshin.relogin();
}
// 启动路径导航任务(异步)
let pathTask = AutoPath(`${enemyType}-战斗点`);
@@ -262,7 +263,7 @@ async function executeSingleFriendshipRound(roundIndex, ocrTimeout, fightTimeout
const cts = new CancellationTokenSource();
const targetCoords = getTargetCoordinates(enemyType);
await waitForTargetPosition(pathTask, targetCoords);
await waitForTargetPosition(pathTask, targetCoords);
await executeBattleTasks(fightTimeout, enemyType, cts);
await pathTask;
@@ -270,7 +271,7 @@ async function executeSingleFriendshipRound(roundIndex, ocrTimeout, fightTimeout
if (enemyType === "鳄鱼") {
await AutoPath('鳄鱼-拾取');
}
if(enemyType === "蕈兽") {
if (enemyType === "蕈兽") {
await AutoPath('蕈兽-对话');
await sleep(50);
keyPress("F");
@@ -382,10 +383,9 @@ function getOcrKeywords(enemyType) {
return ["实验家", "变成", "实验品", "击败", "所有", "魔物"];
}
else if (enemyType === "雷萤术士") {
return ["雷萤", "术士","圆滚滚", "不可食用", "威撼", "攀岩", "消灭", "准备", "打倒", "所有", "魔物","盗宝团","击败","成员","盗亦无道"];
return ["雷萤", "术士", "圆滚滚", "不可食用", "威撼", "攀岩", "消灭", "准备", "打倒", "所有", "魔物", "盗宝团", "击败", "成员", "盗亦无道"];
}
else
{
else {
return ["突发", "任务", "打倒", "消灭", "敌人", "所有"]; // 兜底关键词
}
}
@@ -403,7 +403,7 @@ function getTargetCoordinates(enemyType) {
} else if (enemyType === "蕈兽") {
return { x: 3794.55, y: -350.60 };
} else if (enemyType === "雷萤术士") {
return {x: 883.91, y:656.63};
return { x: 883.91, y: 656.63 };
}
}
@@ -419,7 +419,7 @@ function getTriggerPoint(enemyType) {
} else if (enemyType === "蕈兽") {
return { x: 3749.38, y: -391.91 }; // 蕈兽触发点坐标
} else if (enemyType === "雷萤术士") {
return {x:881.92, y: 616.85}; // 雷萤术士触发点坐标
return { x: 881.92, y: 616.85 }; // 雷萤术士触发点坐标
}
}
@@ -490,9 +490,9 @@ async function waitForBattleResult(timeout = 2 * 60 * 1000, enemyType = "盗宝
cts.cancel(); // 取消任务
return true;
}
if(enemyType=="蕈兽" && text2.includes("维沙瓦")){
if (enemyType == "蕈兽" && text2.includes("维沙瓦")) {
log.info("战斗结果:成功");
cts.cancel();
cts.cancel();
return true;
}
}
@@ -510,7 +510,7 @@ async function waitForBattleResult(timeout = 2 * 60 * 1000, enemyType = "盗宝
return false;
}
}
if(enemyType !== "蕈兽") {
if (enemyType !== "蕈兽") {
// 检查事件关键词
let find = 0;
for (let keyword of eventKeywords) {

View File

@@ -1,7 +1,7 @@
{
"manifest_version": 1,
"name": "战斗好感:自动好感度&卡时间",
"version": "1.4.3",
"version": "1.4.4",
"bgi_version": "0.45.1",
"tags": [
"好感",