修正上次,提交了错误的版本的问题
This commit is contained in:
@@ -1,9 +1,38 @@
|
|||||||
w(async function () {
|
(async function () {
|
||||||
setGameMetrics(1920, 1080, 2);
|
setGameMetrics(1920, 1080, 1.5);
|
||||||
|
|
||||||
|
const defaultExitDelay = 10000;
|
||||||
|
const defaultLoadingDelay = 13000;
|
||||||
|
|
||||||
|
// 将字符串转换为数字
|
||||||
|
let exitdelay = Number(settings.exitdelay);
|
||||||
|
let loadingdelay = Number(settings.loadingdelay);
|
||||||
|
|
||||||
|
// 检查参数是否有效,并设置缺省值
|
||||||
|
function validateAndSetDefaults(exitdelay, loadingdelay) {
|
||||||
|
if (isNaN(exitdelay) || exitdelay <= 0) {
|
||||||
|
log.warn("你没有设置退出延迟,将使用默认值");
|
||||||
|
exitdelay = defaultExitDelay;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isNaN(loadingdelay) || loadingdelay <= 0) {
|
||||||
|
log.warn("你没有设置加载延迟,将使用默认值");
|
||||||
|
loadingdelay = defaultLoadingDelay;
|
||||||
|
}
|
||||||
|
return { exitdelay, loadingdelay };
|
||||||
|
}
|
||||||
|
|
||||||
|
// 调用验证和设置缺省值函数
|
||||||
|
const { exitdelay: validatedExitDelay, loadingdelay: validatedLoadingDelay } = validateAndSetDefaults(exitdelay, loadingdelay);
|
||||||
|
|
||||||
|
// 继续执行程序逻辑
|
||||||
|
log.info(`退出延迟: ${validatedExitDelay}, 加载延迟: ${validatedLoadingDelay}`);
|
||||||
|
log.info("垂香木,悬铃木,桃椰子木,炬木,白栗栎木,燃爆木因路线问题无法获取");
|
||||||
|
log.info("开始运行脚本");
|
||||||
|
|
||||||
|
|
||||||
async function performGameActions() {
|
async function performGameActions() {
|
||||||
// 负责砍树的,退出重进,按Z
|
// 负责砍树的,退出重进,按Z
|
||||||
|
|
||||||
await sleep(1000);//等待一秒
|
await sleep(1000);//等待一秒
|
||||||
keyPress("ESCAPE");//按下esc
|
keyPress("ESCAPE");//按下esc
|
||||||
await sleep(1000);
|
await sleep(1000);
|
||||||
@@ -12,10 +41,10 @@ w(async function () {
|
|||||||
click(1000, 750);//点击确认
|
click(1000, 750);//点击确认
|
||||||
await sleep(validatedExitDelay); //退出延迟
|
await sleep(validatedExitDelay); //退出延迟
|
||||||
click(1000, 550);//进入游戏
|
click(1000, 550);//进入游戏
|
||||||
await sleep(13000);//加载延迟
|
await sleep(validatedLoadingDelay);//加载延迟
|
||||||
keyDown("z");
|
keyPress("z");
|
||||||
await sleep(300);
|
// await sleep(300);
|
||||||
keyUp("z");
|
// keyUp("z");
|
||||||
}
|
}
|
||||||
async function runGameActionsMultipleTimes(times,locationName) {
|
async function runGameActionsMultipleTimes(times,locationName) {
|
||||||
// 负责循环调用performGameActions,实现循环砍树
|
// 负责循环调用performGameActions,实现循环砍树
|
||||||
@@ -28,7 +57,7 @@ w(async function () {
|
|||||||
//传入路径以及循环次数
|
//传入路径以及循环次数
|
||||||
let filePath = `assets/AutoPath/${locationName}.json`;
|
let filePath = `assets/AutoPath/${locationName}.json`;
|
||||||
await pathingScript.runFile(filePath);
|
await pathingScript.runFile(filePath);
|
||||||
await sleep(5000)
|
await sleep(3000)
|
||||||
await runGameActionsMultipleTimes(time,locationName)
|
await runGameActionsMultipleTimes(time,locationName)
|
||||||
}
|
}
|
||||||
async function KeyMouse(locationName, sec, x, y,time) {
|
async function KeyMouse(locationName, sec, x, y,time) {
|
||||||
@@ -41,30 +70,63 @@ w(async function () {
|
|||||||
let filePath = `assets/KeyMouse/${locationName}.json`;
|
let filePath = `assets/KeyMouse/${locationName}.json`;
|
||||||
await keyMouseScript.runFile(filePath);
|
await keyMouseScript.runFile(filePath);
|
||||||
await sleep(sec * 1000); // 将秒转换为毫秒
|
await sleep(sec * 1000); // 将秒转换为毫秒
|
||||||
|
await sleep(3000)
|
||||||
|
await runGameActionsMultipleTimes(time)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
await AutoPath('香柏木27个', 75)
|
||||||
|
await AutoPath('御伽木9个(孔雀木6个)', 334)
|
||||||
|
await AutoPath('萃华木6个(垂香木3个)', 334)
|
||||||
|
await AutoPath('松木24个', 84)
|
||||||
|
await AutoPath('业果木15个(辉木15个)', 134)
|
||||||
|
await AutoPath('刺葵木6个', 334)
|
||||||
|
await AutoPath('却砂木12个', 167)
|
||||||
|
await AutoPath('杉木12个', 167)
|
||||||
|
await AutoPath('枫木9个', 223)
|
||||||
|
await AutoPath('柽木15个', 134)
|
||||||
|
await AutoPath('桦木15个', 134)
|
||||||
|
await AutoPath('梦见木12个', 167)
|
||||||
|
await AutoPath('椴木9个(悬铃木9个)', 223)
|
||||||
|
await AutoPath('灰灰楼木6个', 334)
|
||||||
|
await AutoPath('白梣木15个', 134)
|
||||||
|
await AutoPath('竹节30个', 67)
|
||||||
|
await AutoPath('证悟木15个(业果木6个)', 134)
|
||||||
|
// await AutoPath('燃爆木15个', 134)//>>
|
||||||
|
// await AutoPath('燃爆木6个(白栗栎木6个)', 1)//路线异常
|
||||||
|
// await AutoPath('垂香木15个', 1)//路线异常
|
||||||
|
// await AutoPath('悬铃木18个', 1)//路线异常
|
||||||
|
// await KeyMouse('炬木15个',3, 8359.7548828125, -2868.03515625,1)//?
|
||||||
|
// await KeyMouse('桃椰子木12个',5,8353.4921875,-2853.8505859375,1)//?
|
||||||
|
|
||||||
|
let endTime = settings.selectValue
|
||||||
|
|
||||||
|
theEnd(endTime)
|
||||||
|
async function theEnd(endTime){
|
||||||
|
if (endTime === '退出账号'){
|
||||||
|
await sleep(1000);//等待一秒
|
||||||
|
keyPress("ESCAPE");//按下esc
|
||||||
|
await sleep(1000);
|
||||||
|
click(50, 1030);//点击退出
|
||||||
|
await sleep(1000);
|
||||||
|
click(1000, 750);//点击确认
|
||||||
|
log.info('退出账号')
|
||||||
|
}else if (endTime === '关闭游戏'){
|
||||||
|
log.info('关闭游戏')
|
||||||
|
keyDown("MENU");
|
||||||
|
keyDown("F4");
|
||||||
|
await sleep(50);
|
||||||
|
keyUp("MENU");
|
||||||
|
keyUp("F4");
|
||||||
|
await sleep(1500);
|
||||||
|
}else if (endTime === '无操作'){
|
||||||
|
// 对,这里什么也没有
|
||||||
|
} else {
|
||||||
|
log.info('未选择结束后操作,默认无操作')
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
await AutoPath('松木_蒙德_24个', 84)
|
|
||||||
await AutoPath('业果木15个(辉木15个)', 134)
|
|
||||||
await AutoPath('刺葵木6个', 334)
|
|
||||||
await AutoPath('却砂木12个', 167)
|
|
||||||
await AutoPath('垂香木15个', 134)
|
|
||||||
await AutoPath('御伽木9个(孔雀木6个)', 334)
|
|
||||||
await AutoPath('悬铃木18个', 112)
|
|
||||||
await AutoPath('杉木_蒙德_12个', 167)
|
|
||||||
await AutoPath('枫木9个', 223)
|
|
||||||
await AutoPath('柽木15个', 134)
|
|
||||||
await AutoPath('桦木_蒙德_15个', 134)
|
|
||||||
await AutoPath('梦见木12个', 167)
|
|
||||||
await AutoPath('椴木9个(悬铃木9个)', 223)
|
|
||||||
await AutoPath('灰灰楼木6个', 334)
|
|
||||||
// await AutoPath('燃爆木15个', 0)
|
|
||||||
await AutoPath('燃爆木6个(白栗栎木6个)', 334)
|
|
||||||
await AutoPath('白梣木15个', 134)
|
|
||||||
await AutoPath('竹节30个', 67)
|
|
||||||
await AutoPath('萃华木6个(垂香木3个)', 334)
|
|
||||||
await AutoPath('证悟木15个(业果木6个)', 134)
|
|
||||||
await AutoPath('香柏木27个', 75)
|
|
||||||
await KeyMouse('炬木15个',3, 8359.7548828125, -2868.03515625)
|
|
||||||
// await keyDown('',5,8353.4921875,-2853.8505859375)
|
|
||||||
|
|
||||||
|
|
||||||
})();
|
})();
|
||||||
@@ -2,11 +2,7 @@
|
|||||||
"manifest_version": 1,
|
"manifest_version": 1,
|
||||||
"name": "自动伐木-全树种收集计划",
|
"name": "自动伐木-全树种收集计划",
|
||||||
"version": "1.0",
|
"version": "1.0",
|
||||||
<<<<<<< HEAD
|
|
||||||
"description": "小道具自动伐木,单个树种满后,前往下一个树种,垂香木,悬铃木,桃椰子木,炬木,白栗栎木,燃爆木因路线问题无法获取",
|
|
||||||
=======
|
|
||||||
"description": "小道具自动伐木,单个树种满后,前往下一个树种,垂香木,悬铃木,桃椰子木,炬木,白栗栎木,燃爆木因路线问题无法获取.所有树种默认刷满2000",
|
"description": "小道具自动伐木,单个树种满后,前往下一个树种,垂香木,悬铃木,桃椰子木,炬木,白栗栎木,燃爆木因路线问题无法获取.所有树种默认刷满2000",
|
||||||
>>>>>>> 4ef6622093dc64b25aee0b3568adf04e46285fd7
|
|
||||||
"authors": [
|
"authors": [
|
||||||
{
|
{
|
||||||
"name": "½"
|
"name": "½"
|
||||||
|
|||||||
@@ -19,12 +19,8 @@
|
|||||||
"type": "input-text",
|
"type": "input-text",
|
||||||
"label": "加载延迟"
|
"label": "加载延迟"
|
||||||
}
|
}
|
||||||
<<<<<<< HEAD
|
|
||||||
// { //等待作者更新多选框
|
// { //等待作者更新多选框
|
||||||
//
|
//
|
||||||
=======
|
|
||||||
// {
|
|
||||||
>>>>>>> 4ef6622093dc64b25aee0b3568adf04e46285fd7
|
|
||||||
// "name": "checkValue", // 变量名,在js内使用 settings.变量名 获取对应的配置值
|
// "name": "checkValue", // 变量名,在js内使用 settings.变量名 获取对应的配置值
|
||||||
// "type": "checkbox", // 类型
|
// "type": "checkbox", // 类型
|
||||||
// "label": "全选" // 显示标签
|
// "label": "全选" // 显示标签
|
||||||
|
|||||||
Reference in New Issue
Block a user