js:自动恰咯 (#2058)

仓管恰咯吗
Ciallo~(∠・ω< )⌒☆
This commit is contained in:
mno
2025-10-02 23:16:47 +08:00
committed by GitHub
parent 6758fae4b7
commit b8048456fe
6 changed files with 79 additions and 0 deletions

2
repo/js/Ciallo/README.md Normal file
View File

@@ -0,0 +1,2 @@
啥功能也不实现,纯骚扰好友玩

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.1 KiB

54
repo/js/Ciallo/main.js Normal file
View File

@@ -0,0 +1,54 @@
/*******************************************************
* 完整文件:进入/退出世界循环脚本
* 所有函数均在此文件内,直接覆盖原文件即可运行
*******************************************************/
/* ---------- 匹配模板 ---------- */
const friendRo = RecognitionObject.TemplateMatch(file.ReadImageMatSync("assets/RecognitionObject/friend.png"));
const chatTemplate = file.ReadImageMatSync("assets/RecognitionObject/chat.png");
/* ---------- 主流程 ---------- */
(async function () {
const ciallo = settings.ciallo || "Ciallo(∠・ω< )⌒☆";
await genshin.returnMainUi();
await sleep(1000);
keyPress("VK_ESCAPE");
await sleep(1000);
await findAndClick(friendRo);
//依次点击七个好友并进行对话
for (let i = 0; i < 7; i++) {
const yStart = 119 + i * 124;
const yEnd = 243 + i * 124;
const recognitionObj = RecognitionObject.TemplateMatch(
chatTemplate,
0, // x 起始
yStart, // y 起始
1920, // x 范围(宽度)
yEnd - yStart // y 范围(高度)
);
await sleep(1000);
await findAndClick(recognitionObj);
keyPress("VK_RETURN");
await sleep(1000);
inputText(ciallo);
await sleep(500);
keyPress("VK_RETURN");
await sleep(500);
keyPress("VK_ESCAPE");
}
await genshin.returnMainUi();
})();
/** 通用点击默认最多5次 */
async function findAndClick(target, maxAttempts = 5) {
for (let i = 0; i < maxAttempts; i++) {
const rg = captureGameRegion();
try {
const res = rg.find(target);
if (res.isExist()) { res.click(); return true; }
} finally { rg.dispose(); }
if (i < maxAttempts - 1) await sleep(250);
}
return false;
}

View File

@@ -0,0 +1,15 @@
{
"manifest_version": 1,
"name": "自动恰咯",
"version": "0.0.1",
"tags": [],
"description": "挑战向好友列表前七位发送ciallo让他们感到莫名其妙",
"authors": [
{
"name": "mno",
"links": "https://github.com/Bedrockx"
}
],
"settings_ui": "settings.json",
"main": "main.js"
}

View File

@@ -0,0 +1,8 @@
[
{
"name": "ciallo",
"type": "input-text",
"label": "发送的文本内容",
"default": "Ciallo(∠・ω< )⌒☆"
}
]