diff --git a/repo/js/Auto好感&刷兽肉/assets/AutoPath/好感-张牙舞爪的恶党-循环.json b/repo/js/Auto好感&刷兽肉/assets/AutoPath/好感-张牙舞爪的恶党-循环.json new file mode 100644 index 00000000..0df1f89d --- /dev/null +++ b/repo/js/Auto好感&刷兽肉/assets/AutoPath/好感-张牙舞爪的恶党-循环.json @@ -0,0 +1,113 @@ +{ + "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": "" + } + ] +} \ No newline at end of file diff --git a/repo/js/Auto好感&刷兽肉/assets/AutoPath/好感-张牙舞爪的恶党-触发位置.json b/repo/js/Auto好感&刷兽肉/assets/AutoPath/好感-张牙舞爪的恶党-触发位置.json new file mode 100644 index 00000000..dc72dac1 --- /dev/null +++ b/repo/js/Auto好感&刷兽肉/assets/AutoPath/好感-张牙舞爪的恶党-触发位置.json @@ -0,0 +1,67 @@ +{ + "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": "run", + "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": "" + } + ] +} \ No newline at end of file diff --git a/repo/js/Auto好感&刷兽肉/main.js b/repo/js/Auto好感&刷兽肉/main.js new file mode 100644 index 00000000..410ffa7d --- /dev/null +++ b/repo/js/Auto好感&刷兽肉/main.js @@ -0,0 +1,134 @@ +(async function () { + + const defaultExitDelay = 12; + const defaultLoadingDelay = 15; + + function validateAndSetDefaults(exitDelay, loadingDelay) { + if (isNaN(exitDelay) || exitDelay <= 0) { + log.warn("你没有设置退出延迟,将使用默认值:12秒"); + exitDelay = defaultExitDelay; + } + if (isNaN(loadingDelay) || loadingDelay <= 0) { + log.warn("你没有设置加载延迟,将使用默认值:15秒"); + loadingDelay = defaultLoadingDelay; + } + return { exitDelay, loadingDelay }; + } + + async function ReopenTheGate() { + await sleep(1000); + keyPress("ESCAPE"); + await sleep(1000); + click(50, 1030); + await sleep(1000); + click(1000, 750); + await sleep(validatedExitDelay * 1000); + click(1000, 550); + click(1000, 750); + await sleep(1000); + click(1000, 750); + await sleep(1000); + click(1000, 750); + await sleep(1000); + click(1000, 750); + await sleep(1000); + click(1000, 750); + await sleep(1000); + click(1000, 750); + await sleep(1000); + click(1000, 750); + await sleep(1000); + click(1000, 750); + await sleep(1000); + click(1000, 750); + await sleep(1000); + click(1000, 750); + await sleep(1000); + click(1000, 750); + await sleep(1000); + click(1000, 750); + await sleep(1000); + click(1000, 750); + await sleep(1000); + click(1000, 750); + await sleep(1000); + click(1000, 750); + await sleep(1000); + click(1000, 750); + await sleep(1000); + await sleep(validatedLoadingDelay * 1000); + click(1000, 750); + await sleep(1000); + } + + async function AutoPath(locationName) { + try { + let filePath = `assets/AutoPath/${locationName}.json`; + await pathingScript.runFile(filePath); + } catch (error) { + log.error(`执行 ${locationName} 路径时发生错误`); + log.error(error.message); + } + await sleep(2000); + } + + async function AutoFriendship(times) { + + log.info(`导航至好感-张牙舞爪的恶党-触发位置`); + await AutoPath('好感-张牙舞爪的恶党-触发位置'); + + log.info(`自动好感开始...`); + + await ReopenTheGate(); + for (let i = 0; i < times; i++) { + log.info(`自动好感当前次数:${i + 1}/${times}`); + await AutoPath('好感-张牙舞爪的恶党-循环'); + await ReopenTheGate(); + logTimeTaken(startTime); + } + log.info('自动好感已完成'); + } + + function logTimeTaken(startTime) { + const currentTime = Date.now(); + const totalTimeInSeconds = (currentTime - startTime) / 1000; + const minutes = Math.floor(totalTimeInSeconds / 60); + const seconds = totalTimeInSeconds % 60; + const formattedTime = `${minutes}分${seconds.toFixed(0).padStart(2, '0')}秒`; + 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; + log.info(`计算后的运行次数为: ${times}`); + + const { exitDelay: validatedExitDelay, loadingDelay: validatedLoadingDelay } = validateAndSetDefaults(exitdelay, loadingdelay); + const messages = [ + '请确保队伍满员,并为队伍配置相应的战斗策略', + ]; + for (let message of messages) { + log.info(message); + await sleep(1000); + } + log.info('自动好感开始...'); + log.info(`退出延迟: ${validatedExitDelay}秒, 加载延迟: ${validatedLoadingDelay}秒`); + + //默认10次自动好感 + await AutoFriendship(times); + + // 计算并输出总时长 + const endTime = Date.now(); + const totalTimeInSeconds = (endTime - startTime) / 1000; + const minutes = Math.floor(totalTimeInSeconds / 60); + const seconds = totalTimeInSeconds % 60; + const formattedTime = `${minutes}分${seconds.toFixed(0).padStart(2, '0')}秒`; + log.info(`自动好感运行总时长:${formattedTime}`); +})(); diff --git a/repo/js/Auto好感&刷兽肉/manifest.json b/repo/js/Auto好感&刷兽肉/manifest.json new file mode 100644 index 00000000..4aeb2132 --- /dev/null +++ b/repo/js/Auto好感&刷兽肉/manifest.json @@ -0,0 +1,13 @@ +{ + "manifest_version": 1, + "name": "好感-张牙舞爪的恶党(可用于刷兽肉)", + "version": "1.0", + "description": "通过突发事件:张牙舞爪的恶党刷好兽肉,并顺带获取好感度(超过10次后不再获取),请使用满员好感度队伍,并为全体队伍角色配置相应的战斗策略", + "authors": [ + { + "name": "起个名字好难的喵" + } + ], + "settings_ui": "settings.json", + "main": "main.js" +} \ No newline at end of file diff --git a/repo/js/Auto好感&刷兽肉/settings.json b/repo/js/Auto好感&刷兽肉/settings.json new file mode 100644 index 00000000..ad67ee15 --- /dev/null +++ b/repo/js/Auto好感&刷兽肉/settings.json @@ -0,0 +1,22 @@ +[ + { + "name": "exitdelay", + "type": "input-text", + "label": "退出延迟(秒)(选填)" + }, + { + "name": "loadingdelay", + "type": "input-text", + "label": "加载延迟(秒)(选填)" + }, + { + "name": "UL", + "type": "checkbox", + "label": "是否开启刷兽肉模式" + }, + { + "name": "inputValue", + "type": "input-text", + "label": "刷取个数(默认刷9999个)" + } +] \ No newline at end of file