JS脚本:自动领取成就奖励 (#530)

* update repo.json

* JS脚本:自动领取成就奖励

* update repo.json

---------

Co-authored-by: 5117600049 <199024421+5117600049@users.noreply.github.com>
This commit is contained in:
5117600049
2025-04-07 01:39:48 +08:00
committed by GitHub
parent 554e94e1b8
commit 04a1f2ca26
4 changed files with 94 additions and 1 deletions

View File

@@ -1,5 +1,5 @@
{
"time": "20250406221610",
"time": "20250406222259",
"url": "https://github.com/babalae/bettergi-scripts-list/archive/refs/heads/main.zip",
"file": "repo.json",
"indexes": [
@@ -32330,6 +32330,15 @@
"description": "购买食材杂货~|~寻路杂货商枫丹有咖啡豆、秃秃豆璃月有豆腐、杏仁稻妻有豆腐顺路有点鱼蟹这几个路线短快。用法放入BetterGI中User中JsScript文件夹内。已屏蔽纳塔杂货商解开选项即恢复。在纳塔杂货商购买时移动速度不宜过快在纳塔杂货商购买时如撞到npc将无法正常寻路。",
"tags": []
},
{
"name": "自动领取成就奖励(OCR)",
"type": "directory",
"hash": "fea6e1a58fffcd6e9468bcf94a72e8385491fad9",
"version": "1.0",
"author": "柒叶子",
"description": "自动领取成就奖励~|~所以米桑什么时候实装一键领取?",
"tags": []
},
{
"name": "芙芙挂机暗杀流",
"type": "directory",

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

View File

@@ -0,0 +1,70 @@
const receiveRo = RecognitionObject.TemplateMatch(file.ReadImageMatSync("assets/receive.png"));
(async function () {
const topLeft = {x: 192, y: 281}; // 左上角坐标
const bottomRight = {x: 1738, y: 984}; // 右下角坐标
const rows = 3; // 行数
const cols = 7; // 列数
const topLeft1 = {x: 190, y: 870}; // 左上角坐标
const bottomRight1 = {x: 1735, y: 870}; // 右下角坐标
const rows1 = 1; // 行数
const cols1 = 7; // 列数
let sum = 1;
let sum1= 0;
//用于点击多个点位
async function autoClick(
topLeft, // 左上角点位 {x, y}
bottomRight, // 右下角点位 {x, y}
rows, // 行数
cols // 列数
) {
// 计算每个点之间的水平和垂直间距
let stepX = cols > 1 ? (bottomRight.x - topLeft.x) / (cols - 1) : 0; // 处理单列情况
let stepY = rows > 1 ? (bottomRight.y - topLeft.y) / (rows - 1) : 0; // 处理单行情况
// 从左到右,从上到下依次点击
for (let row = 0; row < rows; row++) {
for (let col = 0; col < cols; col++) {
// 计算当前点的坐标并四舍五入
let x = Math.round(topLeft.x + col * stepX);
let y = Math.round(topLeft.y + row * stepY);
// 执行点击
click(x, y);
await sleep(1000);
log.info(`${sum}次识别`);
sum++;
let receive = captureGameRegion().find(receiveRo);
await sleep(1000);
while(receive.isExist()){
receive.click();
await sleep(500);
sum1++;
log.info(`成功识别${sum1}`);
click(400,1010);//点击空白处
await sleep(500);
receive = captureGameRegion().find(receiveRo);
}
click(400,1010);//如果是本行最后一个成就会自动翻页
await sleep(500);
keyPress("ESCAPE");
// 等待1秒
await sleep(1000);
}
}
}
//主流程
await genshin.returnMainUi();
await sleep(1000);
keyPress("ESCAPE");
await sleep(1000);
click(670 ,420 );//点击成就
await sleep(2000);
await autoClick(topLeft, bottomRight, rows, cols);
for (let i = 0; i < 6; i++) {
await autoClick(topLeft1, bottomRight1, rows1, cols1);
}
})();

View File

@@ -0,0 +1,14 @@
{
"manifest_version": 1,
"name": "自动领取成就奖励",
"version": "1.0",
"description": "所以米桑什么时候实装一键领取?",
"authors": [
{
"name": "柒叶子",
"link": "https://github.com/511760049"
}
],
"settings_ui": "settings.json",
"main": "main.js"
}