计算机电源选项自动操作 (#544)
* Create 用于新建空文件夹 * Delete repo/js/计算机/用于新建空文件夹 * Create 用于创建空文件夹 * 计算机电源选项自动操作 计算机的自动关机、注销、休眠等操作(默认注销)。 * Delete repo/js/计算机/用于创建空文件夹 * Update manifest.json * 问题修复 用于修复有物品锻造完成时,无法进行自动锻造的问题。 * 修复
This commit is contained in:
44
repo/js/计算机/main.js
Normal file
44
repo/js/计算机/main.js
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
(async function () {
|
||||||
|
|
||||||
|
// 读取用户设置
|
||||||
|
let PowerOptions = settings.PowerOptions != undefined ? settings.PowerOptions : '';
|
||||||
|
|
||||||
|
//执行计算机操作
|
||||||
|
keyDown("LWIN");
|
||||||
|
keyDown("X");
|
||||||
|
await sleep(50);
|
||||||
|
keyUp("LWIN");
|
||||||
|
keyUp("X");
|
||||||
|
await sleep(3000);
|
||||||
|
keyPress("LSHIFT");
|
||||||
|
await sleep(50);
|
||||||
|
keyPress("LCONTROL");
|
||||||
|
await sleep(50);
|
||||||
|
keyPress("U");
|
||||||
|
await sleep(1000);
|
||||||
|
|
||||||
|
// 根据用户选择进行操作
|
||||||
|
if (PowerOptions == '注销') {
|
||||||
|
log.info(" 将执行 注销 ");
|
||||||
|
keyPress("I");
|
||||||
|
} else if (PowerOptions == '睡眠') {
|
||||||
|
log.info(" 将执行 睡眠 ");
|
||||||
|
keyPress("S");
|
||||||
|
} else if (PowerOptions == '休眠') {
|
||||||
|
log.info(" 将执行 休眠 ");
|
||||||
|
keyPress("H");
|
||||||
|
} else if (PowerOptions == '关机') {
|
||||||
|
log.info(" 将执行 关机 ");
|
||||||
|
keyPress("U");
|
||||||
|
} else if (PowerOptions == '重启') {
|
||||||
|
log.info(" 将执行 重启 ");
|
||||||
|
keyPress("R");
|
||||||
|
} else {
|
||||||
|
// 无指定操作﹐将使用“注销”
|
||||||
|
log.info(" 将执行 注销 ");
|
||||||
|
keyPress("I");
|
||||||
|
}
|
||||||
|
await sleep(50);
|
||||||
|
keyPress("RETURN");
|
||||||
|
|
||||||
|
})();
|
||||||
13
repo/js/计算机/manifest.json
Normal file
13
repo/js/计算机/manifest.json
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
"manifest_version": 1,
|
||||||
|
"name": "计算机自动睡眠、关机等操作",
|
||||||
|
"version": "1.0",
|
||||||
|
"description": "计算机的自动关机、注销、休眠等操作(默认注销)",
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "呱呱z",
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"settings_ui": "settings.json",
|
||||||
|
"main": "main.js"
|
||||||
|
}
|
||||||
14
repo/js/计算机/settings.json
Normal file
14
repo/js/计算机/settings.json
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"name": "PowerOptions", // 变量名,在js内使用 settings.变量名 获取对应的配置值
|
||||||
|
"type": "select", // 类型
|
||||||
|
"label": "选择计算机操作类型(默认:注销)",
|
||||||
|
"options": [
|
||||||
|
"注销",
|
||||||
|
"睡眠",
|
||||||
|
"休眠",
|
||||||
|
"关机",
|
||||||
|
"重启"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
@@ -10,7 +10,7 @@
|
|||||||
///
|
///
|
||||||
// 自动前往铁匠铺
|
// 自动前往铁匠铺
|
||||||
async function autoSmithy(smithyName) {
|
async function autoSmithy(smithyName) {
|
||||||
log.info(`自动前往${smithyName}`);
|
log.info(`自动前往 ${smithyName}`);
|
||||||
try {
|
try {
|
||||||
let filePath = `assets/${smithyName}.json`;
|
let filePath = `assets/${smithyName}.json`;
|
||||||
await pathingScript.runFile(filePath);
|
await pathingScript.runFile(filePath);
|
||||||
@@ -32,21 +32,22 @@
|
|||||||
{log.info("无指定矿石,将使用 水晶块 锻造矿石");}
|
{log.info("无指定矿石,将使用 水晶块 锻造矿石");}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const forgeOre = async function (smithyName) {
|
const forgeOre = async function (smithyName) {
|
||||||
await sleep(1000);
|
await sleep(1000);
|
||||||
keyPress("F"); await sleep(1000); // 开始交互
|
keyPress("F"); await sleep(1000); // 开始交互
|
||||||
await click(960, 600); await sleep(1000); // 跳过第一个对话
|
await click(960, 600); await sleep(1000); // 跳过第一个对话
|
||||||
await click(960, 600); await sleep(1000); // 跳过第一个对话
|
await click(960, 600); await sleep(1000); // 跳过第一个对话
|
||||||
await click(1375, 500); await sleep(1000);
|
await click(1375, 500); await sleep(1000);
|
||||||
await click(960, 600); await sleep(1000); // 跳过第二个对话
|
await click(960, 600); await sleep(1000); // 跳过第二个对话
|
||||||
await click(960, 600); await sleep(1000); // 跳过第二个对话
|
await click(960, 600); await sleep(1000); // 跳过第二个对话
|
||||||
await click(520, 140); await sleep(1000); // 选择锻造队列
|
|
||||||
await click(170, 1010); await sleep(1000); // 领取全部
|
|
||||||
|
|
||||||
log.info("已进入锻造界面,开始锻造");
|
log.info("已进入锻造界面,开始锻造");
|
||||||
// 点击"配方"
|
determineOre();
|
||||||
click(220, 150);
|
await click(520, 140); await sleep(1000); // 选择锻造队列
|
||||||
await sleep(1000);
|
await click(170, 1010); await sleep(1000); // 领取全部
|
||||||
|
await click(960, 900); await sleep(1000); // 确认
|
||||||
|
|
||||||
|
click(220, 150);await sleep(1000);// 点击"配方"
|
||||||
// 根据用户选择的矿石进行锻造
|
// 根据用户选择的矿石进行锻造
|
||||||
if (ore == '水晶块')
|
if (ore == '水晶块')
|
||||||
{click(545, 290);}
|
{click(545, 290);}
|
||||||
@@ -68,17 +69,17 @@
|
|||||||
await sleep(4000);
|
await sleep(4000);
|
||||||
|
|
||||||
|
|
||||||
log.info("锻造结束,退出画面");
|
log.info("锻造结束,退出界面");
|
||||||
// 退出锻造界面
|
// 退出锻造界面
|
||||||
click(1845, 45);
|
click(1845, 45);
|
||||||
await sleep(1000);
|
await sleep(1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
///
|
||||||
// main
|
// main
|
||||||
///
|
///
|
||||||
setGameMetrics(1920, 1080, 1);
|
setGameMetrics(1920, 1080, 1);
|
||||||
await autoSmithy(smithyName);// 设置游戏窗口大小和DPI
|
await autoSmithy(smithyName);// 设置游戏窗口大小和DPI
|
||||||
await forgeOre(smithyName);
|
await forgeOre(smithyName);
|
||||||
determineOre();
|
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
|||||||
Reference in New Issue
Block a user