diff --git a/repo/js/Ciallo/README.md b/repo/js/Ciallo/README.md new file mode 100644 index 000000000..43f3ee3cf --- /dev/null +++ b/repo/js/Ciallo/README.md @@ -0,0 +1,2 @@ +啥功能也不实现,纯骚扰好友玩 + diff --git a/repo/js/Ciallo/assets/RecognitionObject/chat.png b/repo/js/Ciallo/assets/RecognitionObject/chat.png new file mode 100644 index 000000000..767d1014c Binary files /dev/null and b/repo/js/Ciallo/assets/RecognitionObject/chat.png differ diff --git a/repo/js/Ciallo/assets/RecognitionObject/friend.png b/repo/js/Ciallo/assets/RecognitionObject/friend.png new file mode 100644 index 000000000..f41ea6345 Binary files /dev/null and b/repo/js/Ciallo/assets/RecognitionObject/friend.png differ diff --git a/repo/js/Ciallo/main.js b/repo/js/Ciallo/main.js new file mode 100644 index 000000000..54d0ad6b2 --- /dev/null +++ b/repo/js/Ciallo/main.js @@ -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; +} \ No newline at end of file diff --git a/repo/js/Ciallo/manifest.json b/repo/js/Ciallo/manifest.json new file mode 100644 index 000000000..08733b516 --- /dev/null +++ b/repo/js/Ciallo/manifest.json @@ -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" +} \ No newline at end of file diff --git a/repo/js/Ciallo/settings.json b/repo/js/Ciallo/settings.json new file mode 100644 index 000000000..4ba61b3e1 --- /dev/null +++ b/repo/js/Ciallo/settings.json @@ -0,0 +1,8 @@ +[ + { + "name": "ciallo", + "type": "input-text", + "label": "发送的文本内容", + "default": "Ciallo~(∠・ω< )⌒☆" + } +] \ No newline at end of file