feat: 蕈兽好感
This commit is contained in:
40
repo/js/AutoFriendshipFight/assets/AutoPath/蕈兽-准备.json
Normal file
40
repo/js/AutoFriendshipFight/assets/AutoPath/蕈兽-准备.json
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
{
|
||||||
|
"info": {
|
||||||
|
"name": "蕈兽-准备",
|
||||||
|
"type": "collect",
|
||||||
|
"author": "寒烟",
|
||||||
|
"version": "1.0",
|
||||||
|
"description": "",
|
||||||
|
"map_name": "Teyvat",
|
||||||
|
"bgi_version": "0.45.0"
|
||||||
|
},
|
||||||
|
"positions": [
|
||||||
|
{
|
||||||
|
"id": 1,
|
||||||
|
"x": 3705.44,
|
||||||
|
"y": -497.53,
|
||||||
|
"action": "",
|
||||||
|
"move_mode": "walk",
|
||||||
|
"action_params": "",
|
||||||
|
"type": "teleport"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 2,
|
||||||
|
"x": 3739.62,
|
||||||
|
"y": -466.75,
|
||||||
|
"action": "",
|
||||||
|
"move_mode": "dash",
|
||||||
|
"action_params": "",
|
||||||
|
"type": "path"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 3,
|
||||||
|
"x": 3788.61,
|
||||||
|
"y": -390.8,
|
||||||
|
"action": "stop_flying",
|
||||||
|
"move_mode": "fly",
|
||||||
|
"action_params": "100",
|
||||||
|
"type": "path"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
22
repo/js/AutoFriendshipFight/assets/AutoPath/蕈兽-对话.json
Normal file
22
repo/js/AutoFriendshipFight/assets/AutoPath/蕈兽-对话.json
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
{
|
||||||
|
"info": {
|
||||||
|
"name": "蕈兽-对话",
|
||||||
|
"type": "collect",
|
||||||
|
"author": "寒烟",
|
||||||
|
"version": "1.0",
|
||||||
|
"description": "",
|
||||||
|
"map_name": "Teyvat",
|
||||||
|
"bgi_version": "0.45.0"
|
||||||
|
},
|
||||||
|
"positions": [
|
||||||
|
{
|
||||||
|
"id": 1,
|
||||||
|
"x": 3797.06,
|
||||||
|
"y": -343.96,
|
||||||
|
"type": "target",
|
||||||
|
"move_mode": "walk",
|
||||||
|
"action": "",
|
||||||
|
"action_params": ""
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
40
repo/js/AutoFriendshipFight/assets/AutoPath/蕈兽-战斗点.json
Normal file
40
repo/js/AutoFriendshipFight/assets/AutoPath/蕈兽-战斗点.json
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
{
|
||||||
|
"info": {
|
||||||
|
"name": "蕈兽-战斗点",
|
||||||
|
"type": "collect",
|
||||||
|
"author": "寒烟",
|
||||||
|
"version": "1.0",
|
||||||
|
"description": "",
|
||||||
|
"map_name": "Teyvat",
|
||||||
|
"bgi_version": "0.45.0"
|
||||||
|
},
|
||||||
|
"positions": [
|
||||||
|
{
|
||||||
|
"id": 1,
|
||||||
|
"action": "",
|
||||||
|
"move_mode": "dash",
|
||||||
|
"type": "path",
|
||||||
|
"x": 3759.96,
|
||||||
|
"y": -395.62,
|
||||||
|
"action_params": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 2,
|
||||||
|
"x": 3774.26,
|
||||||
|
"y": -379.18,
|
||||||
|
"type": "path",
|
||||||
|
"move_mode": "dash",
|
||||||
|
"action": "",
|
||||||
|
"action_params": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 3,
|
||||||
|
"x": 3794.55,
|
||||||
|
"y": -350.6,
|
||||||
|
"type": "path",
|
||||||
|
"move_mode": "walk",
|
||||||
|
"action": "",
|
||||||
|
"action_params": ""
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
22
repo/js/AutoFriendshipFight/assets/AutoPath/蕈兽-触发点.json
Normal file
22
repo/js/AutoFriendshipFight/assets/AutoPath/蕈兽-触发点.json
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
{
|
||||||
|
"info": {
|
||||||
|
"name": "蕈兽-触发点",
|
||||||
|
"type": "collect",
|
||||||
|
"author": "寒烟",
|
||||||
|
"version": "1.0",
|
||||||
|
"description": "",
|
||||||
|
"map_name": "Teyvat",
|
||||||
|
"bgi_version": "0.45.0"
|
||||||
|
},
|
||||||
|
"positions": [
|
||||||
|
{
|
||||||
|
"id": 1,
|
||||||
|
"x": 3749.38,
|
||||||
|
"y": -391.91,
|
||||||
|
"type": "target",
|
||||||
|
"move_mode": "dash",
|
||||||
|
"action": "",
|
||||||
|
"action_params": ""
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -5,13 +5,14 @@
|
|||||||
"author": "秋云",
|
"author": "秋云",
|
||||||
"version": "1.0",
|
"version": "1.0",
|
||||||
"description": "",
|
"description": "",
|
||||||
"bgiVersion": "0.42.3"
|
"bgiVersion": "0.42.3",
|
||||||
|
"bgi_version": "0.42.0"
|
||||||
},
|
},
|
||||||
"positions": [
|
"positions": [
|
||||||
{
|
{
|
||||||
"id": 1,
|
"id": 1,
|
||||||
"x": 3576.7568359375,
|
"x": 3576.76,
|
||||||
"y": -495.845703125,
|
"y": -495.85,
|
||||||
"type": "path",
|
"type": "path",
|
||||||
"move_mode": "walk",
|
"move_mode": "walk",
|
||||||
"action": "",
|
"action": "",
|
||||||
@@ -19,8 +20,8 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": 2,
|
"id": 2,
|
||||||
"x": 3572.375,
|
"x": 3572.38,
|
||||||
"y": -502.4375,
|
"y": -502.44,
|
||||||
"action": "",
|
"action": "",
|
||||||
"move_mode": "walk",
|
"move_mode": "walk",
|
||||||
"action_params": "",
|
"action_params": "",
|
||||||
|
|||||||
@@ -30,6 +30,10 @@ const DEFAULT_FIGHT_TIMEOUT_SECONDS = 120;
|
|||||||
log.info(`导航到鳄鱼触发点...`);
|
log.info(`导航到鳄鱼触发点...`);
|
||||||
await AutoPath('鳄鱼-准备');
|
await AutoPath('鳄鱼-准备');
|
||||||
}
|
}
|
||||||
|
if (enemyType === "蕈兽") {
|
||||||
|
log.info(`导航到蕈兽触发点...`);
|
||||||
|
await AutoPath('蕈兽-准备');
|
||||||
|
}
|
||||||
// 验证超时设置
|
// 验证超时设置
|
||||||
const ocrTimeout = validateTimeoutSetting(settings.ocrTimeout, DEFAULT_OCR_TIMEOUT_SECONDS, "OCR");
|
const ocrTimeout = validateTimeoutSetting(settings.ocrTimeout, DEFAULT_OCR_TIMEOUT_SECONDS, "OCR");
|
||||||
const fightTimeout = validateTimeoutSetting(settings.fightTimeout, DEFAULT_FIGHT_TIMEOUT_SECONDS, "战斗");
|
const fightTimeout = validateTimeoutSetting(settings.fightTimeout, DEFAULT_FIGHT_TIMEOUT_SECONDS, "战斗");
|
||||||
@@ -255,6 +259,16 @@ async function executeSingleFriendshipRound(roundIndex, ocrTimeout, fightTimeout
|
|||||||
if (enemyType === "鳄鱼") {
|
if (enemyType === "鳄鱼") {
|
||||||
await AutoPath('鳄鱼-拾取');
|
await AutoPath('鳄鱼-拾取');
|
||||||
}
|
}
|
||||||
|
if(enemyType === "蕈兽") {
|
||||||
|
await AutoPath('蕈兽-对话');
|
||||||
|
await sleep(50);
|
||||||
|
keyPress("F");
|
||||||
|
await sleep(50);
|
||||||
|
keyPress("F");
|
||||||
|
await sleep(500);
|
||||||
|
await genshin.chooseTalkOption("下次");
|
||||||
|
await sleep(500);
|
||||||
|
}
|
||||||
|
|
||||||
// 返回 true 表示成功完成这一轮
|
// 返回 true 表示成功完成这一轮
|
||||||
return true;
|
return true;
|
||||||
@@ -353,7 +367,11 @@ function getOcrKeywords(enemyType) {
|
|||||||
else if (enemyType === "鳄鱼") {
|
else if (enemyType === "鳄鱼") {
|
||||||
return ["张牙", "舞爪", "恶党", "鳄鱼", "打倒", "所有", "鳄鱼"];
|
return ["张牙", "舞爪", "恶党", "鳄鱼", "打倒", "所有", "鳄鱼"];
|
||||||
}
|
}
|
||||||
else {
|
else if (enemyType === "蕈兽") {
|
||||||
|
return ["实验家", "变成", "实验品", "击败", "所有", "魔物"];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
return ["突发", "任务", "打倒", "消灭", "敌人", "所有"]; // 兜底关键词
|
return ["突发", "任务", "打倒", "消灭", "敌人", "所有"]; // 兜底关键词
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -368,6 +386,8 @@ function getTargetCoordinates(enemyType) {
|
|||||||
} else if (enemyType === "鳄鱼") {
|
} else if (enemyType === "鳄鱼") {
|
||||||
// 鳄鱼战斗点坐标
|
// 鳄鱼战斗点坐标
|
||||||
return { x: 3578.08, y: -500.75 };
|
return { x: 3578.08, y: -500.75 };
|
||||||
|
} else if (enemyType === "蕈兽") {
|
||||||
|
return { x: 3794.55, y: -350.60 };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -380,6 +400,8 @@ function getTriggerPoint(enemyType) {
|
|||||||
}
|
}
|
||||||
else if (enemyType === "鳄鱼") {
|
else if (enemyType === "鳄鱼") {
|
||||||
return { x: 3614.63, y: -521.60 }; // 鳄鱼触发点坐标
|
return { x: 3614.63, y: -521.60 }; // 鳄鱼触发点坐标
|
||||||
|
} else if (enemyType === "蕈兽") {
|
||||||
|
return { x: 3749.38, y: -391.91 }; // 蕈兽触发点坐标
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -436,8 +458,9 @@ async function waitForBattleResult(timeout = 2 * 60 * 1000, enemyType = "盗宝
|
|||||||
while (Date.now() - fightStartTime < timeout) {
|
while (Date.now() - fightStartTime < timeout) {
|
||||||
try {
|
try {
|
||||||
// 简化OCR检测,只使用一个try-catch块
|
// 简化OCR检测,只使用一个try-catch块
|
||||||
let result = captureGameRegion().find(RecognitionObject.ocr(850, 150, 200, 80));
|
let capture = captureGameRegion();
|
||||||
let result2 = captureGameRegion().find(RecognitionObject.ocr(0, 200, 300, 300));
|
let result = capture.find(RecognitionObject.ocr(850, 150, 200, 80));
|
||||||
|
let result2 = capture.find(RecognitionObject.ocr(0, 200, 300, 300));
|
||||||
let text = result.text;
|
let text = result.text;
|
||||||
let text2 = result2.text;
|
let text2 = result2.text;
|
||||||
|
|
||||||
@@ -449,6 +472,11 @@ async function waitForBattleResult(timeout = 2 * 60 * 1000, enemyType = "盗宝
|
|||||||
cts.cancel(); // 取消任务
|
cts.cancel(); // 取消任务
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
if(enemyType=="蕈兽" && text2.includes("维沙瓦")){
|
||||||
|
log.info("战斗结果:成功");
|
||||||
|
cts.cancel();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 检查失败关键词
|
// 检查失败关键词
|
||||||
@@ -464,36 +492,37 @@ async function waitForBattleResult(timeout = 2 * 60 * 1000, enemyType = "盗宝
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(enemyType !== "蕈兽") {
|
||||||
// 检查事件关键词
|
// 检查事件关键词
|
||||||
let find = 0;
|
let find = 0;
|
||||||
for (let keyword of eventKeywords) {
|
for (let keyword of eventKeywords) {
|
||||||
if (text2.includes(keyword)) {
|
if (text2.includes(keyword)) {
|
||||||
find++;
|
find++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (find === 0) {
|
if (find === 0) {
|
||||||
notFind++;
|
notFind++;
|
||||||
log.info("未检测到任务触发关键词:{0} 次", notFind);
|
log.info("未检测到任务触发关键词:{0} 次", notFind);
|
||||||
} else {
|
} else {
|
||||||
notFind = 0;
|
notFind = 0;
|
||||||
}
|
|
||||||
|
|
||||||
if (notFind > 10) {
|
|
||||||
log.warn("不在任务触发区域,战斗失败");
|
|
||||||
cts.cancel(); // 取消任务
|
|
||||||
if (enemyType === "愚人众") {
|
|
||||||
log.warn("回到愚人众准备点");
|
|
||||||
await AutoPath('愚人众-准备');
|
|
||||||
}
|
}
|
||||||
if (enemyType === "鳄鱼") {
|
|
||||||
log.warn("回到鳄鱼准备点");
|
|
||||||
await AutoPath('鳄鱼-准备');
|
|
||||||
await sleep(5000);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
|
|
||||||
|
if (notFind > 10) {
|
||||||
|
log.warn("不在任务触发区域,战斗失败");
|
||||||
|
cts.cancel(); // 取消任务
|
||||||
|
if (enemyType === "愚人众") {
|
||||||
|
log.warn("回到愚人众准备点");
|
||||||
|
await AutoPath('愚人众-准备');
|
||||||
|
}
|
||||||
|
if (enemyType === "鳄鱼") {
|
||||||
|
log.warn("回到鳄鱼准备点");
|
||||||
|
await AutoPath('鳄鱼-准备');
|
||||||
|
await sleep(5000);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"manifest_version": 1,
|
"manifest_version": 1,
|
||||||
"name": "战斗好感:自动好感度&卡时间",
|
"name": "战斗好感:自动好感度&卡时间",
|
||||||
"version": "1.4",
|
"version": "1.4.1",
|
||||||
"bgi_version": "0.45.1",
|
"bgi_version": "0.45.1",
|
||||||
"tags": [
|
"tags": [
|
||||||
"好感",
|
"好感",
|
||||||
|
|||||||
@@ -6,7 +6,8 @@
|
|||||||
"options": [
|
"options": [
|
||||||
"盗宝团",
|
"盗宝团",
|
||||||
"愚人众",
|
"愚人众",
|
||||||
"鳄鱼"
|
"鳄鱼",
|
||||||
|
"蕈兽"
|
||||||
],
|
],
|
||||||
"default": "盗宝团"
|
"default": "盗宝团"
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user