JS脚本:修改自动好感&刷肉的路径并内置切换队伍

This commit is contained in:
起个名字好难
2025-03-12 02:11:39 +08:00
parent 382651d59a
commit ed6d17f274
9 changed files with 226 additions and 273 deletions

View File

@@ -0,0 +1,48 @@
{
"info": {
"name": "好感-张牙舞爪的恶党-循环(二净甸)",
"type": "collect",
"author": "起个名字好难的喵",
"version": "1.0",
"description": "",
"bgiVersion": "0.42.3"
},
"positions": [
{
"id": 1,
"action": "",
"move_mode": "dash",
"type": "path",
"x": 3614.6240234375,
"y": -521.58154296875,
"action_params": ""
},
{
"id": 2,
"x": 3574.46875,
"y": -501.7119140625,
"type": "path",
"move_mode": "dash",
"action": "fight",
"action_params": ""
},
{
"id": 3,
"x": 3605.1826171875,
"y": -513.31982421875,
"type": "path",
"move_mode": "dash",
"action": "",
"action_params": ""
},
{
"id": 4,
"x": 3614.505859375,
"y": -521.4970703125,
"type": "path",
"move_mode": "dash",
"action": "",
"action_params": ""
}
]
}

View File

@@ -0,0 +1,102 @@
{
"info": {
"name": "好感-张牙舞爪的恶党-循环(二净甸刷肉版)",
"type": "collect",
"author": "起个名字好难的喵",
"version": "1.0",
"description": "",
"bgiVersion": "0.42.3"
},
"positions": [
{
"id": 1,
"x": 3614.62,
"y": -521.58,
"action": "",
"move_mode": "dash",
"action_params": "",
"type": "path"
},
{
"id": 2,
"x": 3578.08,
"y": -500.75,
"action": "fight",
"move_mode": "dash",
"action_params": "",
"type": "path"
},
{
"id": 3,
"x": 3570.703125,
"y": -502.7314453125,
"type": "path",
"move_mode": "walk",
"action": "",
"action_params": ""
},
{
"id": 4,
"x": 3572.1875,
"y": -503.25,
"action": "",
"move_mode": "walk",
"action_params": "",
"type": "path"
},
{
"id": 5,
"x": 3577.8125,
"y": -493.71875,
"action": "",
"move_mode": "walk",
"action_params": "",
"type": "path"
},
{
"id": 6,
"x": 3578.78125,
"y": -503.40625,
"action": "",
"move_mode": "walk",
"action_params": "",
"type": "path"
},
{
"id": 7,
"x": 3572.1748046875,
"y": -494.65478515625,
"action": "",
"move_mode": "walk",
"action_params": "",
"type": "path"
},
{
"id": 8,
"x": 3576.03125,
"y": -503.0625,
"action": "",
"move_mode": "walk",
"action_params": "",
"type": "path"
},
{
"id": 9,
"x": 3605.18,
"y": -513.31,
"action": "",
"move_mode": "dash",
"action_params": "",
"type": "path"
},
{
"id": 10,
"x": 3614.62,
"y": -521.58,
"action": "",
"move_mode": "dash",
"action_params": "",
"type": "path"
}
]
}

View File

@@ -1,113 +0,0 @@
{
"info": {
"name": "好感-张牙舞爪的恶党-循环",
"type": "collect",
"author": "起个名字好难的喵",
"version": "1.0",
"description": "",
"bgiVersion": "0.35.1"
},
"positions": [
{
"id": 1,
"action": "",
"move_mode": "walk",
"type": "path",
"x": 2705.7783203125,
"y": -1623.0771484375,
"action_params": "",
"locked": false
},
{
"id": 2,
"x": 2731.5625,
"y": -1576.40966796875,
"type": "path",
"move_mode": "walk",
"action": "fight",
"action_params": "",
"locked": false
},
{
"id": 1,
"action": "",
"move_mode": "walk",
"type": "path",
"x": 2739.7841796875,
"y": -1571.65234375,
"action_params": ""
},
{
"id": 2,
"x": 2731.3232421875,
"y": -1568.01171875,
"type": "path",
"move_mode": "walk",
"action": "",
"action_params": ""
},
{
"id": 3,
"x": 2733.05078125,
"y": -1577.15283203125,
"type": "path",
"move_mode": "walk",
"action": "",
"action_params": ""
},
{
"id": 4,
"x": 2727.404296875,
"y": -1575.0263671875,
"type": "path",
"move_mode": "walk",
"action": "",
"action_params": ""
},
{
"id": 5,
"x": 2737.90625,
"y": -1571.599609375,
"type": "path",
"move_mode": "walk",
"action": "",
"action_params": ""
},
{
"id": 6,
"x": 2733.5732421875,
"y": -1577.5380859375,
"type": "path",
"move_mode": "walk",
"action": "",
"action_params": ""
},
{
"id": 7,
"x": 2731,
"y": -1575.51220703125,
"type": "path",
"move_mode": "walk",
"action": "",
"action_params": ""
},
{
"id": 8,
"x": 2734.5048828125,
"y": -1570.70458984375,
"type": "path",
"move_mode": "walk",
"action": "",
"action_params": ""
},
{
"id": 5,
"action": "",
"move_mode": "walk",
"type": "path",
"x": 2705.7783203125,
"y": -1623.0771484375,
"action_params": ""
}
]
}

View File

@@ -1,66 +0,0 @@
{
"info": {
"name": "好感-张牙舞爪的恶党-神像",
"type": "collect",
"author": "起个名字好难的喵",
"version": "1.0",
"description": "",
"bgiVersion": "0.35.1"
},
"positions": [
{
"id": 1,
"action": "",
"move_mode": "walk",
"type": "teleport",
"x": 2567.5400390625,
"y": -1424.11767578125,
"action_params": ""
},
{
"id": 2,
"x": 2565.2373046875,
"y": -1418.88720703125,
"type": "path",
"move_mode": "walk",
"action": "combat_script",
"action_params": "wait(5)"
},
{
"id": 3,
"x": 2613.8125,
"y": -1503.6513671875,
"type": "path",
"move_mode": "fly",
"action": "",
"action_params": ""
},
{
"id": 4,
"x": 2653.1630859375,
"y": -1552.5888671875,
"type": "path",
"move_mode": "fly",
"action": "",
"action_params": ""
},
{
"id": 5,
"x": 2699.2822265625,
"y": -1616.28515625,
"type": "path",
"move_mode": "fly",
"action": "stop_flying",
"action_params": ""
},
{
"id": 6,
"x": 2705.837890625,
"y": -1622.46826171875,
"type": "path",
"move_mode": "walk",
"action": "fight",
"action_params": ""
}
]
}

View File

@@ -0,0 +1,30 @@
{
"info": {
"name": "好感-张牙舞爪的恶党-触发位置(二净甸)",
"type": "collect",
"author": "起个名字好难的喵",
"version": "1.0",
"description": "",
"bgiVersion": "0.42.3"
},
"positions": [
{
"id": 1,
"action": "",
"move_mode": "walk",
"type": "teleport",
"x": 3705.5322265625,
"y": -497.45068359375,
"action_params": ""
},
{
"id": 2,
"x": 3615.4814453125,
"y": -521.2724609375,
"type": "path",
"move_mode": "fly",
"action": "combat_script",
"action_params": "wait(0.5),keypress(VK_SPACE),wait(2.5),click"
}
]
}

View File

@@ -1,67 +0,0 @@
{
"info": {
"name": "好感-张牙舞爪的恶党-1",
"type": "collect",
"author": "起个名字好难的喵",
"version": "1.0",
"description": "",
"bgiVersion": "0.35.1"
},
"positions": [
{
"id": 1,
"action": "",
"move_mode": "walk",
"type": "teleport",
"x": 2806.4853515625,
"y": -1790.42626953125,
"action_params": ""
},
{
"id": 2,
"x": 2812.5595703125,
"y": -1740.89013671875,
"type": "path",
"move_mode": "run",
"action": "",
"action_params": ""
},
{
"id": 3,
"x": 2794.3583984375,
"y": -1707.4033203125,
"type": "path",
"move_mode": "walk",
"action": "",
"action_params": ""
},
{
"id": 4,
"x": 2746.61328125,
"y": -1601.3955078125,
"type": "path",
"move_mode": "fly",
"action": "stop_flying",
"action_params": "",
"locked": false
},
{
"id": 5,
"x": 2746.61328125,
"y": -1601.3955078125,
"type": "path",
"move_mode": "walk",
"action": "fight",
"action_params": ""
},
{
"id": 6,
"x": 2705.7783203125,
"y": -1623.0771484375,
"type": "path",
"move_mode": "walk",
"action": "fight",
"action_params": ""
}
]
}

View File

@@ -1,15 +1,15 @@
(async function () {
const defaultExitDelay = 12;
const defaultLoadingDelay = 15;
const defaultLoadingDelay = 10;
function validateAndSetDefaults(exitDelay, loadingDelay) {
if (isNaN(exitDelay) || exitDelay <= 0) {
log.warn("你没有设置退出延迟将使用默认值12秒");
exitDelay = defaultExitDelay;
}
if (isNaN(loadingDelay) || loadingDelay <= 0) {
log.warn("你没有设置加载延迟将使用默认值15秒");
if (isNaN(loadingDelay) || loadingDelay < 0) {
log.warn("你没有设置加载延迟将使用默认值10秒");
loadingDelay = defaultLoadingDelay;
}
return { exitDelay, loadingDelay };
@@ -72,26 +72,25 @@
await sleep(2000);
}
async function AutoFriendship(times,statue_times) {
log.info(`导航至好感-张牙舞爪的恶党-触发位置`);
await AutoPath('好感-张牙舞爪的恶党-触发位置');
async function AutoFriendship(times, statue_times, GetMeatMode) {
log.info(`导航至好感-张牙舞爪的恶党-触发位置(二净甸)`);
await AutoPath(`好感-张牙舞爪的恶党-触发位置(二净甸)`);
log.info(`自动好感开始...`);
for (let i = 0; i < times; i++) {
// 每运行 5 次 '好感-张牙舞爪的恶党-循环' 后运行 '好感-张牙舞爪的恶党-神像'
if ((i + 1) % statue_times === 0) {
await AutoPath('好感-张牙舞爪的恶党-神像');
await genshin.tp(2297.60, -824.45);
await AutoPath(`好感-张牙舞爪的恶党-触发位置(二净甸)`);
await ReopenTheGate();
log.info(`当前次数:${i + 1}/${times}`);
logTimeTaken(startTime);
await AutoPath('好感-张牙舞爪的恶党-循环');
await AutoPath(`好感-张牙舞爪的恶党-循环${GetMeatMode ? '(二净甸刷肉版)' : '(二净甸)'}`);
} else {
await ReopenTheGate();
log.info(`当前次数:${i + 1}/${times}`);
logTimeTaken(startTime);
await AutoPath('好感-张牙舞爪的恶党-循环');
await AutoPath(`好感-张牙舞爪的恶党-循环${GetMeatMode ? '(二净甸刷肉版)' : '(二净甸)'}`);
}
log.info(`已完成次数:${i + 1}/${times}`);
logTimeTaken(startTime);
@@ -108,21 +107,22 @@
log.info(`当前运行总时长:${formattedTime}`);
}
// 启用自动拾取的实时任务
const startTime = Date.now();
dispatcher.addTimer(new RealtimeTimer("AutoPick"));
setGameMetrics(1920, 1080, 1); // 设置游戏窗口大小和DPI
let exitdelay = Number(settings.exitdelay);
let loadingdelay = Number(settings.loadingdelay);
let UL = settings.UL ? settings.UL : false;
let inputValue = settings.inputValue ? settings.inputValue : 9999;
let times = UL ? (isNaN(inputValue) ? 1667 : Math.ceil(inputValue / 6)) : 10;
// 肉相关
let GetMeatMode = settings.GetMeatMode ? settings.GetMeatMode : false;
let inputValue = settings.inputValue ? settings.inputValue : 300;
let times = GetMeatMode ? (isNaN(inputValue) ? 50 : Math.ceil(inputValue / 6)) : 10;
// 神像相关
let gostatue = settings.gostatue ? settings.gostatue : false;
let statue = settings.statue ? settings.statue : 5;
let statue_times = gostatue ? (isNaN(statue) ? 5 : statue) : 0;
// 启用自动拾取的实时任务,并配置成启用急速拾取模式
dispatcher.addTimer(new RealtimeTimer("AutoPick", { "forceInteraction": true }));
const startTime = Date.now();
setGameMetrics(1920, 1080, 1); // 设置游戏窗口大小和DPI
const { exitDelay: validatedExitDelay, loadingDelay: validatedLoadingDelay } = validateAndSetDefaults(exitdelay, loadingdelay);
const messages = [
'请确保队伍满员,并为队伍配置相应的战斗策略',
@@ -136,8 +136,22 @@
}
log.info('自动好感开始...');
if (!!settings.partyName) {
try {
await genshin.tp(2297.60, -824.45);
await sleep(3000);
log.info("正在尝试切换至" + settings.partyName);
await genshin.switchParty(settings.partyName);
} catch {
log.warn("队伍切换失败,可能处于联机模式或其他不可切换状态");
await genshin.returnMainUi();
}
} else {
await genshin.returnMainUi();
}
//默认10次自动好感
await AutoFriendship(times,statue_times);
await AutoFriendship(times,statue_times,GetMeatMode);
// 计算并输出总时长
const endTime = Date.now();

View File

@@ -1,7 +1,7 @@
{
"manifest_version": 1,
"name": "好感-张牙舞爪的恶党(可用于刷兽肉)",
"version": "1.0",
"version": "1.1",
"description": "通过突发事件:张牙舞爪的恶党刷好兽肉并顺带获取好感度超过10次后不再获取请使用满员好感度队伍并为全体队伍角色配置相应的战斗策略",
"authors": [
{

View File

@@ -10,14 +10,19 @@
"label": "加载延迟(秒)(选填)"
},
{
"name": "UL",
"name": "partyName",
"type": "input-text",
"label": "(选填)需要切换的队伍名称"
},
{
"name": "GetMeatMode",
"type": "checkbox",
"label": "开启刷兽肉模式"
"label": "开启刷兽肉模式(勾选才拾取散落的兽肉)"
},
{
"name": "inputValue",
"type": "input-text",
"label": "刷取个数(选填,默认为9999"
"label": "刷取个数(选填,默认为300"
},
{
"name": "gostatue",
@@ -27,6 +32,6 @@
{
"name": "statue",
"type": "input-text",
"label": "返回神像周期选填默认为5"
"label": "返回神像周期选填默认为5次/周期"
}
]