mirror of
https://github.com/babalae/bettergi-scripts-list.git
synced 2026-03-30 05:49:51 +08:00
feat(core): 添加实时任务处理功能
- 实现了 realTimeMissions 函数用于处理实时任务 - 支持自动对话、自动战斗、自动拾取三种实时任务类型 - 添加了 real_time_missions 配置选项到设置界面 - 集成实时任务调度器替代原有的固定任务执行方式 - 支持通用任务和非通用任务的差异化处理 - 更新了任务执行流程以使用新的实时任务机制
This commit is contained in:
@@ -93,6 +93,31 @@ const timeType = Object.freeze({
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* 实时任务处理函数
|
||||
* @param {boolean} is_common - 是否为通用任务标志
|
||||
* @returns {void} 无返回值
|
||||
*/
|
||||
async function realTimeMissions(is_common = true) {
|
||||
let real_time_missions = settings.real_time_missions // 从设置中获取实时任务列表
|
||||
if (!is_common) { // 处理非通用任务
|
||||
if (real_time_missions.includes("自动战斗")) {
|
||||
// await dispatcher.runAutoFightTask(new AutoFightParam());
|
||||
await dispatcher.runTask(new SoloTask("AutoFight")); // 执行自动战斗任务
|
||||
}
|
||||
return // 非通用任务处理完毕后直接返回
|
||||
}
|
||||
// 处理通用任务
|
||||
if (real_time_missions.includes("自动对话")) {
|
||||
dispatcher.addTrigger(new RealtimeTimer("AutoSkip")); // 添加自动对话触发器
|
||||
}
|
||||
if (real_time_missions.includes("自动拾取")) {
|
||||
// 启用自动拾取的实时任务
|
||||
dispatcher.addTrigger(new RealtimeTimer("AutoPick")); // 添加自动拾取触发器
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
async function init() {
|
||||
let settingsConfig = await initSettings();
|
||||
let utils = [
|
||||
@@ -466,7 +491,8 @@ async function init() {
|
||||
log.debug(`[RUN]{0}[RUN]`, JSON.stringify([...list]))
|
||||
}
|
||||
// 启用自动拾取的实时任务,并配置成启用急速拾取模式
|
||||
dispatcher.addTrigger(new RealtimeTimer("AutoPick", {"forceInteraction": true}));
|
||||
// dispatcher.addTrigger(new RealtimeTimer("AutoPick"));
|
||||
await realTimeMissions()
|
||||
}
|
||||
return true
|
||||
}
|
||||
@@ -1051,7 +1077,8 @@ async function runPath(path) {
|
||||
await pathingScript.runFile(path)
|
||||
if (team.fight) {
|
||||
//启用战斗
|
||||
await dispatcher.runAutoFightTask(new AutoFightParam());
|
||||
// await dispatcher.runAutoFightTask(new AutoFightParam());
|
||||
await realTimeMissions(false)
|
||||
}
|
||||
log.debug("路径执行完成: {path}", path)
|
||||
RecordPath.paths.add({timestamp: Date.now(), path: path})
|
||||
|
||||
@@ -46,9 +46,16 @@
|
||||
},
|
||||
{
|
||||
"name": "http_api",
|
||||
"type": "input-text",
|
||||
"label": "[默认CD算法api]\ncron解析Http地址\n[请部署bettergi-scripts-tools可支持]",
|
||||
"default": "http://<ip:port>/bgi/cron/next-timestamp"
|
||||
"type": "input-text",
|
||||
"label": "[默认CD算法api]\ncron解析Http地址\n[请部署bettergi-scripts-tools可支持]",
|
||||
"default": "http://<ip:port>/bgi/cron/next-timestamp"
|
||||
},
|
||||
{
|
||||
"name": "real_time_missions",
|
||||
"type": "multi-checkbox",
|
||||
"label": "实时任务",
|
||||
"options": ["自动对话","自动战斗","自动拾取"],
|
||||
"default": ["自动拾取"]
|
||||
},
|
||||
{
|
||||
"type": "separator"
|
||||
|
||||
Reference in New Issue
Block a user