JS脚本: 鸡腿好感添加Ocr功能,提高成功率 (#1406)

This commit is contained in:
Iluvenis
2025-07-25 20:02:26 +08:00
committed by GitHub
parent 5f38a7b81e
commit fe2e37c9e4
5 changed files with 32 additions and 31 deletions

View File

@@ -1,23 +1,15 @@
{
"info": {
"name": "从甜甜花到狗盆",
"name": "到狗盆",
"type": "collect",
"author": "花火",
"version": "1.0",
"version": "1.2",
"description": "",
"bgi_version": "0.35.1"
},
"positions": [
{
"id": 1,
"action": "",
"move_mode": "walk",
"type": "path",
"x": -4529.2578125,
"y": -3084.009765625
},
{
"id": 2,
"x": -4500.28125,
"y": -3116.0146484375,
"type": "target",

View File

@@ -1,24 +1,16 @@
{
"info": {
"name": "从狗盆到甜甜花",
"name": "到甜甜花",
"type": "collect",
"author": "花火",
"version": "1.1",
"version": "1.2",
"description": "",
"bgi_version": "0.43.5"
},
"positions": [
{
"id": 1,
"x": -4500.28125,
"y": -3116.0146484375,
"type": "path",
"move_mode": "walk",
"action": ""
},
{
"id": 2,
"action": "exit_and_relogin",
"action": "",
"move_mode": "walk",
"type": "target",
"x": -4529.2578125,

View File

@@ -3,7 +3,7 @@
"name": "到达甜甜花位置",
"type": "collect",
"author": "花火",
"version": "1.1",
"version": "1.2",
"description": "",
"bgi_version": "0.43.5"
},
@@ -46,7 +46,7 @@
"y": -3084.009765625,
"type": "target",
"move_mode": "walk",
"action": "exit_and_relogin"
"action": ""
}
]
}

View File

@@ -25,7 +25,7 @@
await sleep(1000);
click(1010, 760);
await sleep(1000);
} // todo:考虑添加ocr参数确保一定点击到 F
}
async function AutoPath(locationName) {
try {
@@ -37,18 +37,32 @@
await sleep(2000);
}
async function OcrF() {
let capture = await captureGameRegion();
let ocr = await capture.find(RecognitionObject.ocrThis);
if(ocr.text.includes('投喂')){
return true;
}
return false;
}
async function AutoFriendshipDev(times) {
log.info(`导航至甜甜花位置`);
await AutoPath('导航至甜甜花位置');
await genshin.relogin();
log.info(`自动好感开始...`);
const startFirstTime = Date.now();
for (let i = 0; i < times; i++) {
log.info(`自动好感当前次数:${i + 1}/${times}`);
await AutoPath('从甜甜花到狗盆');
await AutoPath('到狗盆');
for(let j = 0; j < 3 && !await OcrF(); j++){
await AutoPath('到狗盆');
}
await Feed();
if( i != times - 1) {
await AutoPath('从狗盆到甜甜花');
await AutoPath('到甜甜花');
await genshin.relogin();
} //最后一次不需要返回到甜甜花
const estimatedCompletion = CalculateEstimatedCompletion(startFirstTime, i + 1, times);
const currentTime = LogTimeTaken(startFirstTime);

View File

@@ -1,13 +1,16 @@
{
"manifest_version": 1,
"name": "鸡腿好感",
"version": "1.1",
"tags": ["好感", "突发事件"],
"bgi_version": "0.43.5",
"description": "通过喂狗突发事件刷好感度使用满员好感度队伍每天上限10次有概率失败可以适当增加次数",
"version": "1.2",
"tags": [
"好感",
"突发事件"
],
"bgi_version": "0.44.0",
"description": "通过喂狗突发事件刷好感度确保队伍满员4个角色都能刷每天上限10次",
"authors": [
{
"name": "花火"
"name": "花火"
},
{
"name": "秋云",