自动好感度
This commit is contained in:
28
repo/js/AutoFriendship/assets/AutoPath/两武士.json
Normal file
28
repo/js/AutoFriendship/assets/AutoPath/两武士.json
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
{
|
||||||
|
"info": {
|
||||||
|
"name": "两武士",
|
||||||
|
"type": "collect",
|
||||||
|
"author": "HZYgrandma",
|
||||||
|
"version": "1.0",
|
||||||
|
"description": "",
|
||||||
|
"bgiVersion": "0.35.1"
|
||||||
|
},
|
||||||
|
"positions": [
|
||||||
|
{
|
||||||
|
"id": 1,
|
||||||
|
"action": "",
|
||||||
|
"move_mode": "walk",
|
||||||
|
"type": "teleport",
|
||||||
|
"x": -2738.38671875,
|
||||||
|
"y": -3414.45703125
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 2,
|
||||||
|
"x": -2739.7236328125,
|
||||||
|
"y": -3400.15625,
|
||||||
|
"type": "path",
|
||||||
|
"move_mode": "walk",
|
||||||
|
"action": ""
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
52
repo/js/AutoFriendship/assets/AutoPath/清理原住民.json
Normal file
52
repo/js/AutoFriendship/assets/AutoPath/清理原住民.json
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
{
|
||||||
|
"info": {
|
||||||
|
"name": "清理原住民",
|
||||||
|
"type": "collect",
|
||||||
|
"author": "HZYgrandma",
|
||||||
|
"version": "1.0",
|
||||||
|
"description": "",
|
||||||
|
"bgiVersion": "0.35.1"
|
||||||
|
},
|
||||||
|
"positions": [
|
||||||
|
{
|
||||||
|
"id": 1,
|
||||||
|
"x": -2740.609375,
|
||||||
|
"y": -3410.6923828125,
|
||||||
|
"action": "",
|
||||||
|
"move_mode": "walk",
|
||||||
|
"type": "teleport"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 2,
|
||||||
|
"x": -2739.4873046875,
|
||||||
|
"y": -3437.853515625,
|
||||||
|
"action": "",
|
||||||
|
"move_mode": "walk",
|
||||||
|
"type": "path"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 3,
|
||||||
|
"x": -2764.4423828125,
|
||||||
|
"y": -3465.810546875,
|
||||||
|
"action": "",
|
||||||
|
"move_mode": "walk",
|
||||||
|
"type": "path"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 4,
|
||||||
|
"x": -2771.2705078125,
|
||||||
|
"y": -3453.2373046875,
|
||||||
|
"action": "fight",
|
||||||
|
"move_mode": "walk",
|
||||||
|
"type": "path"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 5,
|
||||||
|
"x": -2776.25,
|
||||||
|
"y": -3454.6982421875,
|
||||||
|
"action": "",
|
||||||
|
"move_mode": "walk",
|
||||||
|
"type": "path"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
36
repo/js/AutoFriendship/assets/AutoPath/盗宝团.json
Normal file
36
repo/js/AutoFriendship/assets/AutoPath/盗宝团.json
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
{
|
||||||
|
"info": {
|
||||||
|
"name": "盗宝团",
|
||||||
|
"type": "collect",
|
||||||
|
"author": "HZYgrandma",
|
||||||
|
"version": "1.0",
|
||||||
|
"description": "",
|
||||||
|
"bgiVersion": "0.35.1"
|
||||||
|
},
|
||||||
|
"positions": [
|
||||||
|
{
|
||||||
|
"id": 3,
|
||||||
|
"x": -2739.7197265625,
|
||||||
|
"y": -3399.060546875,
|
||||||
|
"type": "path",
|
||||||
|
"move_mode": "walk",
|
||||||
|
"action": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 4,
|
||||||
|
"x": -2738.671875,
|
||||||
|
"y": -3427.38671875,
|
||||||
|
"type": "path",
|
||||||
|
"move_mode": "run",
|
||||||
|
"action": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 5,
|
||||||
|
"x": -2756.6748046875,
|
||||||
|
"y": -3467.6328125,
|
||||||
|
"type": "path",
|
||||||
|
"move_mode": "walk",
|
||||||
|
"action": "fight"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
1
repo/js/AutoFriendship/assets/KeyMouse/重新上线.json
Normal file
1
repo/js/AutoFriendship/assets/KeyMouse/重新上线.json
Normal file
File diff suppressed because one or more lines are too long
108
repo/js/AutoFriendship/main.js
Normal file
108
repo/js/AutoFriendship/main.js
Normal file
@@ -0,0 +1,108 @@
|
|||||||
|
(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 runGameActionsMultipleTimes() {
|
||||||
|
await sleep(1000);
|
||||||
|
keyPress("ESCAPE");
|
||||||
|
await sleep(1000);
|
||||||
|
click(50, 1030);
|
||||||
|
await sleep(1000);
|
||||||
|
click(1000, 750);
|
||||||
|
await sleep(validatedExitDelay * 1000);
|
||||||
|
click(1000, 550);
|
||||||
|
await sleep(validatedLoadingDelay * 1000);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function resetMap() {
|
||||||
|
log.info("重置地图大小...");
|
||||||
|
await sleep(1000);
|
||||||
|
keyPress("M");
|
||||||
|
await sleep(1000);
|
||||||
|
click(1840, 1010);
|
||||||
|
await sleep(1000);
|
||||||
|
click(1450, 460);
|
||||||
|
await sleep(1000);
|
||||||
|
click(1840, 1010);
|
||||||
|
await sleep(1000);
|
||||||
|
click(1450, 140);
|
||||||
|
await sleep(1000);
|
||||||
|
keyPress("M");
|
||||||
|
log.info("重置地图大小完成");
|
||||||
|
}
|
||||||
|
|
||||||
|
async function AutoPath(locationName) {
|
||||||
|
try {
|
||||||
|
let filePath = `assets/AutoPath/${locationName}.json`;
|
||||||
|
await pathingScript.runFile(filePath);
|
||||||
|
} catch (error) {
|
||||||
|
log.error(`执行 ${locationName} 路径时发生错误`);
|
||||||
|
}
|
||||||
|
await sleep(2000);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function AutoFriendshipDev(times) {
|
||||||
|
await resetMap();
|
||||||
|
log.info(`清理原住民...`);
|
||||||
|
await AutoPath('清理原住民');
|
||||||
|
log.info(`自动好感开始...`);
|
||||||
|
for (let i = 0; i < times; i++) {
|
||||||
|
await AutoPath('两武士');
|
||||||
|
await runGameActionsMultipleTimes();
|
||||||
|
log.info(`自动好感当前次数:${i + 1}/${times}`);
|
||||||
|
await AutoPath('盗宝团');
|
||||||
|
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"));
|
||||||
|
|
||||||
|
let exitdelay = Number(settings.exitdelay);
|
||||||
|
let loadingdelay = Number(settings.loadingdelay);
|
||||||
|
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 AutoFriendshipDev(10);
|
||||||
|
// 计算并输出总时长
|
||||||
|
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}`);
|
||||||
|
})();
|
||||||
13
repo/js/AutoFriendship/manifest.json
Normal file
13
repo/js/AutoFriendship/manifest.json
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
"manifest_version": 1,
|
||||||
|
"name": "自动好感度",
|
||||||
|
"version": "1.0",
|
||||||
|
"description": "通过突发事件刷好感度,请配合好感度战斗脚本使用",
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "HZYgrandma & 愚溪",
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"settings_ui": "settings.json",
|
||||||
|
"main": "main.js"
|
||||||
|
}
|
||||||
12
repo/js/AutoFriendship/settings.json
Normal file
12
repo/js/AutoFriendship/settings.json
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"name": "exitdelay",
|
||||||
|
"type": "input-text",
|
||||||
|
"label": "退出延迟(秒)(选填)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "loadingdelay",
|
||||||
|
"type": "input-text",
|
||||||
|
"label": "加载延迟(秒)(选填)"
|
||||||
|
}
|
||||||
|
]
|
||||||
Reference in New Issue
Block a user