归档重复或无用脚本,修改调整时间脚本 (#2662)

This commit is contained in:
躁动的小氨气
2026-01-12 15:27:06 +08:00
committed by GitHub
parent 7623cce2cc
commit 4a530748c7
61 changed files with 442 additions and 389 deletions

View File

@@ -0,0 +1,70 @@
(async function () {
setGameMetrics(1920, 1080, 2); // 设置游戏窗口大小和DPI
//拖动鼠标
async function moveMouseSmoothly(x1, y1, x2, y2) {
const deltaX = x2 - x1;
const deltaY = y2 - y1;
const steps = Math.max(Math.abs(deltaX), Math.abs(deltaY));
const stepX = deltaX / steps;
const stepY = deltaY / steps;
await moveMouseTo(x1, y1);
await leftButtonDown();
for (let i = 1; i <= steps; i++) {
const newX = x1 + stepX * i;
const newY = y1 + stepY * i;
const validX = Math.round(newX);
const validY = Math.round(newY);
await moveMouseTo(validX, validY);
await sleep(10);
}
await leftButtonUp();
}
//设定时间
async function settime(time) {
const centerX = 1441;
const centerY = 501;
const radius = 100;
let angle;
angle = (90 + time * 15) % 360;
angle = angle >= 0 ? angle : 360 + angle;
const angle1 = (angle + 90) % 360;
const angle2 = (angle + 180) % 360;
const angle3 = (angle + 270) % 360;
const radians = angle * (Math.PI / 180);
const radians1 = angle1 * (Math.PI / 180);
const radians2 = angle2 * (Math.PI / 180);
const radians3 = angle3 * (Math.PI / 180);
const x = centerX + radius * Math.cos(radians);
const y = centerY + radius * Math.sin(radians);
const x1 = centerX + radius * Math.cos(radians1);
const y1 = centerY + radius * Math.sin(radians1);
const x2 = centerX + radius * Math.cos(radians2);
const y2 = centerY + radius * Math.sin(radians2);
const x3 = centerX + radius * Math.cos(radians3);
const y3 = centerY + radius * Math.sin(radians3);
// 输出最终的坐标
await sleep(2000);
await moveMouseSmoothly(centerX,centerY, x1,y1);
await sleep(2000);
await moveMouseSmoothly(centerX,centerY, x2,y2);
await sleep(2000);
await moveMouseSmoothly(centerX,centerY, x3,y3);
await sleep(2000);
await moveMouseSmoothly(centerX,centerY, x,y);
}
//设置时间
log.info('设置时间到{xy}点',settings.time);
await keyPress("Escape");
await sleep(1000);
await click(50,700);
await sleep(2000);
await settime(settings.time)
await sleep(3000);
await click(1500,1000);//确认
await sleep(20000);
await keyPress("Escape");
await sleep(2000);
await keyPress("Escape");
await sleep(2000);
})();

View File

@@ -0,0 +1,14 @@
{
"manifest_version": 1,
"name": "调整游戏时间",
"version": "1.0",
"description": "用于调整游戏时间,请在调度器中使用",
"authors": [
{
"name": "愚溪",
"links": "https://github.com/Kupder"
}
],
"settings_ui": "settings.json",
"main": "main.js"
}

View File

@@ -0,0 +1,7 @@
[
{
"name": "time",
"type": "input-text",
"label": "输入时间 [0-24] "
}
]

View File

@@ -1,64 +1,64 @@
(async function () {
// 设置游戏分辨率和DPI缩放
setGameMetrics(1920, 1080, 1);
// 圆心坐标
const centerX = 1441;
const centerY = 501.6;
// 半径
const r1 = 30;
const r2 = 150;
const r3 = 300;
const stepDuration = 50;
function getPosition(r, index) {
let angle = index * Math.PI / 720;
return [Math.round(centerX + r * Math.cos(angle)), Math.round(centerY + r * Math.sin(angle))];
}
async function mouseClick(x, y) {
moveMouseTo(x, y);
await sleep(50);
leftButtonDown();
await sleep(50);
leftButtonUp();
await sleep(stepDuration);
}
async function mouseClickAndMove(x1, y1, x2, y2) {
moveMouseTo(x1, y1);
await sleep(50);
leftButtonDown();
await sleep(50);
moveMouseTo(x2, y2);
await sleep(50);
leftButtonUp();
await sleep(stepDuration);
}
async function setTime(hour, minute) {
const end = (hour + 6) * 60 + minute-20;
const n = 3;
for (let i = - n + 1; i < 1; i++) {
let [x,y] = getPosition(r1, end + i * 1440 / n);
await mouseClick(x, y);
}
let [x1,y1] = getPosition(r2, end + 5);
let [x2, y2] = getPosition(r3, end + 20 + 0.5);
await mouseClickAndMove(x1, y1, x2, y2);
}
const hour = Number(settings.hour);
const minute = Number(settings.minute);
let h = Math.floor(hour+minute/60);
const m = Math.floor(hour*60+minute)-h*60;
h = ((h % 24) + 24) % 24;
log.info(`设置时间到 ${h}${m}`);
await keyPress("Escape");
await sleep(1000);
await click(50,700);
await sleep(2000);
await setTime(h, m);
await sleep(1000);
await click(1500,1000);//确认
await sleep(18000);
await keyPress("Escape");
await sleep(2000);
await keyPress("Escape");
await sleep(2000);
(async function () {
// 设置游戏分辨率和DPI缩放
setGameMetrics(1920, 1080, 1);
// 圆心坐标
const centerX = 1441;
const centerY = 501.6;
// 半径
const r1 = 30;
const r2 = 150;
const r3 = 300;
const stepDuration = 50;
function getPosition(r, index) {
let angle = index * Math.PI / 720;
return [Math.round(centerX + r * Math.cos(angle)), Math.round(centerY + r * Math.sin(angle))];
}
async function mouseClick(x, y) {
moveMouseTo(x, y);
await sleep(50);
leftButtonDown();
await sleep(50);
leftButtonUp();
await sleep(stepDuration);
}
async function mouseClickAndMove(x1, y1, x2, y2) {
moveMouseTo(x1, y1);
await sleep(50);
leftButtonDown();
await sleep(50);
moveMouseTo(x2, y2);
await sleep(50);
leftButtonUp();
await sleep(stepDuration);
}
async function setTime(hour, minute) {
const end = (hour + 6) * 60 + minute-20;
const n = 3;
for (let i = - n + 1; i < 1; i++) {
let [x,y] = getPosition(r1, end + i * 1440 / n);
await mouseClick(x, y);
}
let [x1,y1] = getPosition(r2, end + 5);
let [x2, y2] = getPosition(r3, end + 20 + 0.5);
await mouseClickAndMove(x1, y1, x2, y2);
}
const hour = Number(settings.hour);
const minute = Number(settings.minute);
let h = Math.floor(hour+minute/60);
const m = Math.floor(hour*60+minute)-h*60;
h = ((h % 24) + 24) % 24;
log.info(`设置时间到 ${h}${m}`);
await keyPress("Escape");
await sleep(1000);
await click(50,700);
await sleep(2000);
await setTime(h, m);
await sleep(1000);
await click(1500,1000);//确认
await sleep(18000);
await keyPress("Escape");
await sleep(2000);
await keyPress("Escape");
await sleep(2000);
})();

View File

@@ -1,15 +1,15 @@
{
"manifest_version": 1,
"name": "精确调整游戏时间到分钟",
"version": "1.0",
"bgi_version": "0.36.0",
"description": "用于调整游戏时间,精确到分钟,请在调度器中使用",
"authors": [
{
"name": "Tim",
"links": "https://github.com/Limint"
}
],
"settings_ui": "settings.json",
"main": "main.js"
{
"manifest_version": 1,
"name": "精确调整游戏时间到分钟",
"version": "1.0",
"bgi_version": "0.36.0",
"description": "用于调整游戏时间,精确到分钟,请在调度器中使用",
"authors": [
{
"name": "Tim",
"links": "https://github.com/Limint"
}
],
"settings_ui": "settings.json",
"main": "main.js"
}

View File

@@ -1,97 +1,97 @@
// 自定义 basename 函数
function basename(filePath) {
const lastSlashIndex = filePath.lastIndexOf('\\'); // 或者使用 '/',取决于你的路径分隔符
return filePath.substring(lastSlashIndex + 1);
}
(async function () {
setGameMetrics(1920, 1080, 1); // 设置游戏分辨率
await genshin.returnMainUi();
keyPress("B"); await sleep(1000);
// 定义图标文件夹路径
const iconDir = "assets/icon";
const pictureDir = "assets/Picture";
const iconFilePaths = file.ReadPathSync(iconDir);
const pictureFilePaths = file.ReadPathSync(pictureDir);
const iconRecognitionObjects = [];
for (const filePath of iconFilePaths) {
const mat = file.readImageMatSync(filePath);
if (mat.empty()) {
log.error(`加载图标失败:${filePath}`);
continue;
}
const recognitionObject = RecognitionObject.TemplateMatch(mat, 0, 0, 1920, 1080);
iconRecognitionObjects.push({ name: basename(filePath), ro: recognitionObject });
}
const pictureRegions = [];
for (const filePath of pictureFilePaths) {
const mat = file.readImageMatSync(filePath);
if (mat.empty()) {
log.error(`加载图库失败:${filePath}`);
continue;
}
pictureRegions.push({ name: basename(filePath), region: new ImageRegion(mat, 0, 0) });
}
const foundRegions = [];
for (const picture of pictureRegions) {
for (const icon of iconRecognitionObjects) {
// 在图库中查找图标信息
const foundRegion = picture.region.find(icon.ro);
if (foundRegion.isExist()) {
foundRegions.push({
pictureName: picture.name,
iconName: icon.name,
region: foundRegion
});
}
}
}
for (const foundRegion of foundRegions) {
const ra = captureGameRegion();
const tolerance = 1; // 容错区间
const iconMat = file.ReadImageMatSync(`assets/icon/${foundRegion.iconName}`);
const recognitionObject = RecognitionObject.TemplateMatch(iconMat, foundRegion.region.x-tolerance, foundRegion.region.y-tolerance, foundRegion.region.width+2*tolerance, foundRegion.region.height+2*tolerance);
recognitionObject.threshold = 0.85; // 设置识别阈值为 0.9
const result = ra.find(recognitionObject);
if (result.isExist() && result.x > 0 && result.y > 0) {
// 获取图标的中心坐标并取整
const x = Math.round(foundRegion.region.x + foundRegion.region.width / 2);
const y = Math.round(foundRegion.region.y + foundRegion.region.height / 2);
await click(x, y);
log.info(`点击 ${foundRegion.iconName}成功,位置: (${x}, ${y})`);
await sleep(500); // 等待一段时间
} else {
// 如果未找到图标,打印警告信息
log.info(`未发现背包弹窗:${foundRegion.iconName}`);
}
ra.dispose();
}
const coords = [
[670, 40], [660, 1010], [300, 1020],
// [200, 150, 500], [200, 220, 500],
[200, 300, 500, settings.autoSalvage3 === '否'],
[200, 380, 500, settings.autoSalvage4 === '否'],
[340, 1000], [1720, 1015], [1320, 756],
[1840, 45, 1500], [1840, 45], [1840, 45]
];
for (const coord of coords) {
const [x, y, delay = 1000, condition = true] = coord; // 默认值处理
if (condition) {
click(x, y);
await sleep(delay);
}
}
})();
// 自定义 basename 函数
function basename(filePath) {
const lastSlashIndex = filePath.lastIndexOf('\\'); // 或者使用 '/',取决于你的路径分隔符
return filePath.substring(lastSlashIndex + 1);
}
(async function () {
setGameMetrics(1920, 1080, 1); // 设置游戏分辨率
await genshin.returnMainUi();
keyPress("B"); await sleep(1000);
// 定义图标文件夹路径
const iconDir = "assets/icon";
const pictureDir = "assets/Picture";
const iconFilePaths = file.ReadPathSync(iconDir);
const pictureFilePaths = file.ReadPathSync(pictureDir);
const iconRecognitionObjects = [];
for (const filePath of iconFilePaths) {
const mat = file.readImageMatSync(filePath);
if (mat.empty()) {
log.error(`加载图标失败:${filePath}`);
continue;
}
const recognitionObject = RecognitionObject.TemplateMatch(mat, 0, 0, 1920, 1080);
iconRecognitionObjects.push({ name: basename(filePath), ro: recognitionObject });
}
const pictureRegions = [];
for (const filePath of pictureFilePaths) {
const mat = file.readImageMatSync(filePath);
if (mat.empty()) {
log.error(`加载图库失败:${filePath}`);
continue;
}
pictureRegions.push({ name: basename(filePath), region: new ImageRegion(mat, 0, 0) });
}
const foundRegions = [];
for (const picture of pictureRegions) {
for (const icon of iconRecognitionObjects) {
// 在图库中查找图标信息
const foundRegion = picture.region.find(icon.ro);
if (foundRegion.isExist()) {
foundRegions.push({
pictureName: picture.name,
iconName: icon.name,
region: foundRegion
});
}
}
}
for (const foundRegion of foundRegions) {
const ra = captureGameRegion();
const tolerance = 1; // 容错区间
const iconMat = file.ReadImageMatSync(`assets/icon/${foundRegion.iconName}`);
const recognitionObject = RecognitionObject.TemplateMatch(iconMat, foundRegion.region.x-tolerance, foundRegion.region.y-tolerance, foundRegion.region.width+2*tolerance, foundRegion.region.height+2*tolerance);
recognitionObject.threshold = 0.85; // 设置识别阈值为 0.9
const result = ra.find(recognitionObject);
if (result.isExist() && result.x > 0 && result.y > 0) {
// 获取图标的中心坐标并取整
const x = Math.round(foundRegion.region.x + foundRegion.region.width / 2);
const y = Math.round(foundRegion.region.y + foundRegion.region.height / 2);
await click(x, y);
log.info(`点击 ${foundRegion.iconName}成功,位置: (${x}, ${y})`);
await sleep(500); // 等待一段时间
} else {
// 如果未找到图标,打印警告信息
log.info(`未发现背包弹窗:${foundRegion.iconName}`);
}
ra.dispose();
}
const coords = [
[670, 40], [660, 1010], [300, 1020],
// [200, 150, 500], [200, 220, 500],
[200, 300, 500, settings.autoSalvage3 === '否'],
[200, 380, 500, settings.autoSalvage4 === '否'],
[340, 1000], [1720, 1015], [1320, 756],
[1840, 45, 1500], [1840, 45], [1840, 45]
];
for (const coord of coords) {
const [x, y, delay = 1000, condition = true] = coord; // 默认值处理
if (condition) {
click(x, y);
await sleep(delay);
}
}
})();

View File

@@ -1,14 +1,14 @@
{
"manifest_version": 1,
"name": "选择级别 分解圣遗物 背包过期弹窗版",
"version": "1.0",
"description": "可选是否分解三四级圣遗物,附带打开背包时,自动点击过期物品弹窗",
"authors": [
{
"name": "吉吉喵",
"links": "https://github.com/JJMdzh"
}
],
"settings_ui": "settings.json",
"main": "main.js"
{
"manifest_version": 1,
"name": "选择级别 分解圣遗物 背包过期弹窗版",
"version": "1.0",
"description": "可选是否分解三四级圣遗物,附带打开背包时,自动点击过期物品弹窗",
"authors": [
{
"name": "吉吉喵",
"links": "https://github.com/JJMdzh"
}
],
"settings_ui": "settings.json",
"main": "main.js"
}

View File

@@ -1,12 +1,12 @@
[
{
"name": "hour",
"type": "input-text",
"label": "输入小时0-24"
},
{
"name": "minute",
"type": "input-text",
"label": "输入分钟0-60"
}
[
{
"name": "hour",
"type": "input-text",
"label": "输入小时0-24"
},
{
"name": "minute",
"type": "input-text",
"label": "输入分钟0-60"
}
]

View File

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

View File

Before

Width:  |  Height:  |  Size: 547 B

After

Width:  |  Height:  |  Size: 547 B

View File

Before

Width:  |  Height:  |  Size: 515 B

After

Width:  |  Height:  |  Size: 515 B

View File

Before

Width:  |  Height:  |  Size: 4.8 KiB

After

Width:  |  Height:  |  Size: 4.8 KiB

View File

Before

Width:  |  Height:  |  Size: 5.1 KiB

After

Width:  |  Height:  |  Size: 5.1 KiB

View File

Before

Width:  |  Height:  |  Size: 4.6 KiB

After

Width:  |  Height:  |  Size: 4.6 KiB

View File

Before

Width:  |  Height:  |  Size: 5.0 KiB

After

Width:  |  Height:  |  Size: 5.0 KiB

View File

Before

Width:  |  Height:  |  Size: 5.0 KiB

After

Width:  |  Height:  |  Size: 5.0 KiB

View File

Before

Width:  |  Height:  |  Size: 5.2 KiB

After

Width:  |  Height:  |  Size: 5.2 KiB

View File

Before

Width:  |  Height:  |  Size: 5.3 KiB

After

Width:  |  Height:  |  Size: 5.3 KiB

View File

Before

Width:  |  Height:  |  Size: 4.8 KiB

After

Width:  |  Height:  |  Size: 4.8 KiB

View File

Before

Width:  |  Height:  |  Size: 4.9 KiB

After

Width:  |  Height:  |  Size: 4.9 KiB

View File

Before

Width:  |  Height:  |  Size: 5.2 KiB

After

Width:  |  Height:  |  Size: 5.2 KiB

View File

Before

Width:  |  Height:  |  Size: 5.2 KiB

After

Width:  |  Height:  |  Size: 5.2 KiB

View File

Before

Width:  |  Height:  |  Size: 8.8 KiB

After

Width:  |  Height:  |  Size: 8.8 KiB

View File

Before

Width:  |  Height:  |  Size: 5.1 KiB

After

Width:  |  Height:  |  Size: 5.1 KiB

View File

Before

Width:  |  Height:  |  Size: 5.1 KiB

After

Width:  |  Height:  |  Size: 5.1 KiB

View File

Before

Width:  |  Height:  |  Size: 8.1 KiB

After

Width:  |  Height:  |  Size: 8.1 KiB

View File

Before

Width:  |  Height:  |  Size: 4.8 KiB

After

Width:  |  Height:  |  Size: 4.8 KiB

View File

Before

Width:  |  Height:  |  Size: 5.0 KiB

After

Width:  |  Height:  |  Size: 5.0 KiB

View File

@@ -1,102 +1,102 @@
[
{
"name": "CookingTimes",
"type": "input-text",
"label": "【料理制作】:\n\n烹饪次数默认0即跳过",
},
{
"name": "Cooking",
"type": "input-text",
"label": "输入料理名",
},
{
"name": "PrepCount",
"type": "input-text",
"label": "\n====================\n\n【食材加工】\n\n加工数量(不填默认99)"
},
{
"name": "Processing11",
"type": "checkbox",
"label": "如勾选:面粉,黄油,糖\n上方填入88,66\n则加工面粉88,黄油66,糖88\n-----------------\n\n1小麦=面粉"
},
{
"name": "Processing15",
"type": "checkbox",
"label": "-----------------\n\n1黑麦=黑麦粉"
},
{
"name": "Processing24",
"type": "checkbox",
"label": "-----------------\n\n1牛奶=酸奶油"
},
{
"name": "Processing16",
"type": "checkbox",
"label": "-----------------\n\n1牛奶=奶油"
},
{
"name": "Processing18",
"type": "checkbox",
"label": "-----------------\n\n2牛奶=黄油"
},
{
"name": "Processing27",
"type": "checkbox",
"label": "-----------------\n\n3牛奶=奶酪"
},
{
"name": "Processing21",
"type": "checkbox",
"label": "-----------------\n\n2兽肉+1盐=火腿"
},
{
"name": "Processing31",
"type": "checkbox",
"label": "-----------------\n\n3兽肉=香肠"
},
{
"name": "Processing17",
"type": "checkbox",
"label": "--------------------\n\n3禽肉+1盐=熏禽肉"
},
{
"name": "Processing28",
"type": "checkbox",
"label": "-----------------\n\n4兽肉+2盐=培根"
},
{
"name": "Processing22",
"type": "checkbox",
"label": "-----------------\n\n2甜甜花=糖"
},
{
"name": "Processing23",
"type": "checkbox",
"label": "-----------------\n\n2香辛果=香辛料"
},
{
"name": "Processing26",
"type": "checkbox",
"label": "----------------------------\n\n3日落果+2树莓+1糖=果酱"
},
{
"name": "Processing25",
"type": "checkbox",
"label": "-----------------\n\n4螃蟹=蟹黄"
},
{
"name": "Processing12",
"type": "checkbox",
"label": "--------------------\n\n冷鲜肉 转化成 兽肉"
},
{
"name": "Processing14",
"type": "checkbox",
"label": "-----------------------------\n\n神秘的肉 转化成 肉加工产物"
},
{
"name": "Processing13",
"type": "checkbox",
"label": "--------------------------------\n\n鱼 转化成 鱼肉,排除 红色花鳉"
}
[
{
"name": "CookingTimes",
"type": "input-text",
"label": "【料理制作】:\n\n烹饪次数默认0即跳过",
},
{
"name": "Cooking",
"type": "input-text",
"label": "输入料理名",
},
{
"name": "PrepCount",
"type": "input-text",
"label": "\n====================\n\n【食材加工】\n\n加工数量(不填默认99)"
},
{
"name": "Processing11",
"type": "checkbox",
"label": "如勾选:面粉,黄油,糖\n上方填入88,66\n则加工面粉88,黄油66,糖88\n-----------------\n\n1小麦=面粉"
},
{
"name": "Processing15",
"type": "checkbox",
"label": "-----------------\n\n1黑麦=黑麦粉"
},
{
"name": "Processing24",
"type": "checkbox",
"label": "-----------------\n\n1牛奶=酸奶油"
},
{
"name": "Processing16",
"type": "checkbox",
"label": "-----------------\n\n1牛奶=奶油"
},
{
"name": "Processing18",
"type": "checkbox",
"label": "-----------------\n\n2牛奶=黄油"
},
{
"name": "Processing27",
"type": "checkbox",
"label": "-----------------\n\n3牛奶=奶酪"
},
{
"name": "Processing21",
"type": "checkbox",
"label": "-----------------\n\n2兽肉+1盐=火腿"
},
{
"name": "Processing31",
"type": "checkbox",
"label": "-----------------\n\n3兽肉=香肠"
},
{
"name": "Processing17",
"type": "checkbox",
"label": "--------------------\n\n3禽肉+1盐=熏禽肉"
},
{
"name": "Processing28",
"type": "checkbox",
"label": "-----------------\n\n4兽肉+2盐=培根"
},
{
"name": "Processing22",
"type": "checkbox",
"label": "-----------------\n\n2甜甜花=糖"
},
{
"name": "Processing23",
"type": "checkbox",
"label": "-----------------\n\n2香辛果=香辛料"
},
{
"name": "Processing26",
"type": "checkbox",
"label": "----------------------------\n\n3日落果+2树莓+1糖=果酱"
},
{
"name": "Processing25",
"type": "checkbox",
"label": "-----------------\n\n4螃蟹=蟹黄"
},
{
"name": "Processing12",
"type": "checkbox",
"label": "--------------------\n\n冷鲜肉 转化成 兽肉"
},
{
"name": "Processing14",
"type": "checkbox",
"label": "-----------------------------\n\n神秘的肉 转化成 肉加工产物"
},
{
"name": "Processing13",
"type": "checkbox",
"label": "--------------------------------\n\n鱼 转化成 鱼肉,排除 红色花鳉"
}
]

View File

@@ -58,7 +58,7 @@
"芝士贝果": "https://github.com/cheese-bagel",
"MissDan": "https://github.com/MisDandan23",
"白白喵": "https://github.com/taotao568685",
"躁动的氨气": "https://github.com/zaodonganqi",
"躁动的氨气": "https://github.com/A-Little-AnQi",
"海豹穹穹队": "https: //github.com/OhmyPaoPao",
"李小璐的假奶量": "https://github.com/FZR1314521",
"Annijang": "https://github.com/Annijang",

View File

@@ -2,7 +2,7 @@
"manifest_version": 1,
"name": "加入好友的世界",
"description": "快让我访问!",
"version": "0.0.3",
"version": "0.0.4",
"main": "index.js",
"settings_ui": "settings.json",
"authors": [

View File

@@ -1,70 +1,8 @@
(async function () {
setGameMetrics(1920, 1080, 2); // 设置游戏窗口大小和DPI
//拖动鼠标
async function moveMouseSmoothly(x1, y1, x2, y2) {
const deltaX = x2 - x1;
const deltaY = y2 - y1;
const steps = Math.max(Math.abs(deltaX), Math.abs(deltaY));
const stepX = deltaX / steps;
const stepY = deltaY / steps;
await moveMouseTo(x1, y1);
await leftButtonDown();
for (let i = 1; i <= steps; i++) {
const newX = x1 + stepX * i;
const newY = y1 + stepY * i;
const validX = Math.round(newX);
const validY = Math.round(newY);
await moveMouseTo(validX, validY);
await sleep(10);
}
await leftButtonUp();
}
//设定时间
async function settime(time) {
const centerX = 1441;
const centerY = 501;
const radius = 100;
let angle;
angle = (90 + time * 15) % 360;
angle = angle >= 0 ? angle : 360 + angle;
const angle1 = (angle + 90) % 360;
const angle2 = (angle + 180) % 360;
const angle3 = (angle + 270) % 360;
const radians = angle * (Math.PI / 180);
const radians1 = angle1 * (Math.PI / 180);
const radians2 = angle2 * (Math.PI / 180);
const radians3 = angle3 * (Math.PI / 180);
const x = centerX + radius * Math.cos(radians);
const y = centerY + radius * Math.sin(radians);
const x1 = centerX + radius * Math.cos(radians1);
const y1 = centerY + radius * Math.sin(radians1);
const x2 = centerX + radius * Math.cos(radians2);
const y2 = centerY + radius * Math.sin(radians2);
const x3 = centerX + radius * Math.cos(radians3);
const y3 = centerY + radius * Math.sin(radians3);
// 输出最终的坐标
await sleep(2000);
await moveMouseSmoothly(centerX,centerY, x1,y1);
await sleep(2000);
await moveMouseSmoothly(centerX,centerY, x2,y2);
await sleep(2000);
await moveMouseSmoothly(centerX,centerY, x3,y3);
await sleep(2000);
await moveMouseSmoothly(centerX,centerY, x,y);
}
//设置时间
log.info('设置时间到{xy}点',settings.time);
await keyPress("Escape");
await sleep(1000);
await click(50,700);
await sleep(2000);
await settime(settings.time)
await sleep(3000);
await click(1500,1000);//确认
await sleep(20000);
await keyPress("Escape");
await sleep(2000);
await keyPress("Escape");
await sleep(2000);
(async function () {
const hour = Number(settings.hour || "6");
const minute = Number(settings.minute || "0");
const skip = settings.skip;
setGameMetrics(1920, 1080, 1);
await genshin.returnMainUi();
await genshin.setTime(hour, minute, skip);
})();

View File

@@ -1,14 +1,25 @@
{
"manifest_version": 1,
"name": "调整游戏时间",
"version": "1.0",
"description": "用于调整游戏时间,请在调度器中使用",
"authors": [
{
"name": "愚溪",
"links": "https://github.com/Kupder"
}
],
"settings_ui": "settings.json",
"main": "main.js"
{
"manifest_version": 1,
"name": "调整游戏时间",
"version": "1.0",
"description": "用于调整游戏时间",
"authors": [
{
"name": "Tim",
"links": "https://github.com/Limint"
},
{
"name": "子寻"
},
{
"name": "愚溪",
"links": "https://github.com/Kupder"
},
{
"name": "躁动的氨气",
"links": "https://github.com/A-Little-AnQi"
}
],
"settings_ui": "settings.json",
"main": "main.js"
}

View File

@@ -1,7 +1,20 @@
[
{
"name": "time",
"type": "input-text",
"label": "输入时 [0-24] "
}
[
{
"name": "hour",
"type": "input-text",
"label": "输入时 [0-24] ",
"default": "6"
},
{
"name": "minute",
"type": "input-text",
"label": "输入分钟 [0-59] ",
"default": "0"
},
{
"name": "skip",
"type": "checkbox",
"label": "是否跳过动画",
"default": true
}
]