JS脚本:使用脆弱树脂图像识别改造 (#636)
This commit is contained in:
BIN
repo/js/使用脆弱树脂/Assets/RecognitionObject/ConfirmButton.png
Normal file
BIN
repo/js/使用脆弱树脂/Assets/RecognitionObject/ConfirmButton.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.8 KiB |
BIN
repo/js/使用脆弱树脂/Assets/RecognitionObject/FragileResin.png
Normal file
BIN
repo/js/使用脆弱树脂/Assets/RecognitionObject/FragileResin.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 11 KiB |
BIN
repo/js/使用脆弱树脂/Assets/RecognitionObject/PlusButton.png
Normal file
BIN
repo/js/使用脆弱树脂/Assets/RecognitionObject/PlusButton.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1005 B |
BIN
repo/js/使用脆弱树脂/Assets/RecognitionObject/QuickUsePlusButton.png
Normal file
BIN
repo/js/使用脆弱树脂/Assets/RecognitionObject/QuickUsePlusButton.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.5 KiB |
@@ -1,30 +1,37 @@
|
||||
const PlusButtonRo = RecognitionObject.TemplateMatch(file.ReadImageMatSync("Assets/RecognitionObject/PlusButton.png"), 1000, 0, 300, 100);
|
||||
const FragileResinRo = RecognitionObject.TemplateMatch(file.ReadImageMatSync("Assets/RecognitionObject/FragileResin.png"), 800, 400, 200, 200);
|
||||
const ConfirmButtonRo = RecognitionObject.TemplateMatch(file.ReadImageMatSync("Assets/RecognitionObject/ConfirmButton.png"), 900, 700, 200, 200);
|
||||
const QuickUsePlusButtonRo = RecognitionObject.TemplateMatch(file.ReadImageMatSync("Assets/RecognitionObject/QuickUsePlusButton.png"), 1200, 600, 200, 100);
|
||||
|
||||
/**
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
|
||||
(async function () {
|
||||
const defaultTime = 1
|
||||
|
||||
setGameMetrics(3840, 2160, 1.5); // 设置游戏窗口大小和DPI
|
||||
|
||||
await genshin.returnMainUi();
|
||||
keyPress("M");//打开地图
|
||||
await sleep(1200);
|
||||
click(2475, 95);// 点击添加体力
|
||||
captureGameRegion().find(PlusButtonRo).click();// 点击添加体力
|
||||
await sleep(600);
|
||||
click(1660, 950)// 选择脆弱树脂
|
||||
captureGameRegion().find(FragileResinRo).click();// 选择脆弱树脂
|
||||
await sleep(600);
|
||||
click(2350, 1550);// 点击使用
|
||||
captureGameRegion().find(ConfirmButtonRo).click();// 点击使用
|
||||
await sleep(600);
|
||||
|
||||
if (isNaN(settings.times || settings.times <= 0)) {
|
||||
times = defaultTime
|
||||
let QuickUsePlusButton = captureGameRegion().find(QuickUsePlusButtonRo);
|
||||
if (isNaN(settings.times || settings.numberPerUse <= 0)) {
|
||||
number = 1
|
||||
}else{
|
||||
for (let i = 1; i < settings.times; ++i) {
|
||||
click(2585, 1295);// 点击使用数量
|
||||
await sleep(600);
|
||||
for (let i = 1; i < settings.numberPerUse; ++i) {
|
||||
QuickUsePlusButton.click();// 点击使用数量
|
||||
await sleep(300);
|
||||
}
|
||||
}
|
||||
|
||||
click(2350, 1550);// 点击使用
|
||||
captureGameRegion().find(ConfirmButtonRo).click();// 点击使用
|
||||
await sleep(600);
|
||||
click(1920, 1500);// 点击空白处
|
||||
await sleep(600);
|
||||
keyPress("VK_ESCAPE");//关闭地图
|
||||
click(960, 1000);// 点击空白处
|
||||
await genshin.returnMainUi();
|
||||
|
||||
})();
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
{
|
||||
"manifest_version": 1,
|
||||
"name": "使用脆弱树脂",
|
||||
"version": "1.0",
|
||||
"bgi_version": "0.37.1",
|
||||
"name": "使用脆弱树脂(图像识别)",
|
||||
"version": "1.1",
|
||||
"bgi_version": "0.44.6",
|
||||
"description": "",
|
||||
"authors": [
|
||||
{
|
||||
"name": "起个名字好难",
|
||||
"link": "https://mualani.fun"
|
||||
"name": "起个名字好难的喵",
|
||||
"link": "https://github.com/MisakaAldrich"
|
||||
}
|
||||
],
|
||||
"settings_ui": "settings.json",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[
|
||||
{
|
||||
"name": "times",
|
||||
"name": "numberPerUse",
|
||||
"type": "input-text",
|
||||
"label": "每次使用个数"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user