From fd9e250bc9540fd56848e5ddb9517b9ac7a68dcd Mon Sep 17 00:00:00 2001 From: strawberry <2806566736@.qq.com> Date: Thu, 11 Sep 2025 15:19:50 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E6=8C=87=E5=BC=95/=E4=BB=BB?= =?UTF-8?q?=E5=8A=A1=E6=8F=90=E7=A4=BA=E5=9B=BE=E6=A0=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _server/MotaAction.g4 | 17 +++--- _server/MotaActionParser.js | 11 ++-- _server/table/comment.js | 16 +----- project/events.js | 96 ++++++++------------------------ project/floors/jiaocheng01.js | 4 +- project/functions.js | 2 +- project/plugins.js | 101 +++++++++++++++++++++++----------- project/table/task_comment.js | 10 ++-- 8 files changed, 116 insertions(+), 141 deletions(-) diff --git a/_server/MotaAction.g4 b/_server/MotaAction.g4 index 48cca82..4c0116d 100644 --- a/_server/MotaAction.g4 +++ b/_server/MotaAction.g4 @@ -44,15 +44,17 @@ taskEvent_m : '任务描述' EvalString_Multi? BGNL? Newline '需完成的最低子任务数' Int BGNL? Newline tasksList+ Newline + '任务接取楼层' IdString 'x,y'EvalString'执行楼层(用于任务指引)'EvalString?'提交楼层'IdString 'x,y'EvalString BGNL? Newline '接取任务后事件' BGNL? Newline action+ Newline - '完成奖励' BGNL? Newline action+ + '完成奖励' '奖励道具(仅用于任务绘制,例:itemId1:1,itemId2:3)' EvalString? BGNL? Newline action+ /* taskEvent_m colour : this.tasksColor -default :["任务描述",1] +allFloorIds : ['IdString_0','IdString_1'] +default :["任务描述",1,"MT1","1,1","MT1,MT2","MT1","1,1","yellowKey:1,redGem:3"] EvalString_Multi_0=EvalString_Multi_0?(',"text": "'+EvalString_Multi_0+'"'): ''; -var code = '{"type":"taskEvent"'+EvalString_Multi_0+',"n":'+Int_0+',"info":['+tasksList_0+'\n]'+', "beforeAction": [\n' + action_0 +'], "action": [\n' + action_1 + ']}\n' +var code = '{"type":"taskEvent"'+EvalString_Multi_0+',"n":'+Int_0+',"info":['+tasksList_0+'\n]'+',"setFloor":"'+IdString_0+'","setxy":['+EvalString_0.split(",")+'],"tarFloor":"'+EvalString_1+'","mitFloor":"'+IdString_1+'","mitxy":['+EvalString_2.split(",")+'], "beforeAction": [\n' + action_0 +'],"reward":"'+EvalString_1+'", "action": [\n' + action_1 + ']}\n' return code; */; @@ -2916,16 +2918,15 @@ return code; */; setq_s - : '设置任务目标楼层'IdString?'不填为清空当前任务指引' Newline + : '设置任务追踪'EvalString?'不填为清空当前任务指引' Newline /* setq_s tooltip : setq:设置任务目标楼层(显示在小地图) helpUrl : /_docs/#/instruction default : [""] -allFloorIds : ['IdString_0'] colour : this.soundColor -IdString_0 = IdString_0 ? (', "id": "'+IdString_0+'"') : ''; -var code = '{"type": "setq"'+IdString_0+'},\n'; +EvalString_0 = EvalString_0 ? (', "name": "'+EvalString_0+'"') : ''; +var code = '{"type": "setq"'+EvalString_0+'},\n'; return code; */; @@ -3578,7 +3579,7 @@ tooltip : 选项的选择 helpUrl : /_docs/#/instruction default : ["新手任务","task1,task2"] colour : this.subColor -var condition = ', "condition": "\''+EvalString_0+'\'.split(\',\').some(v=>core.plugin.可接取任务.includes(v))||\''+EvalString_1+'\'.split(\',\').some(v=>core.taskSystem.tasksInfo.find(a => a.name ===v.name))"'; +var condition = ', "condition": "\''+EvalString_0+'\'.split(\',\').some(v=>core.plugin.可接取任务.includes(v))||\''+EvalString_1+'\'.split(\',\').some(v=>core.taskSystem.tasksInfo.find(a => a.name ===v))"'; var collapsed=block.isCollapsed()?', "_collapsed": true':''; var disabled=block.isEnabled()?'':', "_disabled": true'; var code = '{"type":"taskContext","text":"任务","text1": "'+EvalString_0+'","text2":"'+EvalString_1+'"'+condition+collapsed+disabled+', "action": [\n'+action_0+']},\n'; diff --git a/_server/MotaActionParser.js b/_server/MotaActionParser.js index 864ffbf..fa24f77 100644 --- a/_server/MotaActionParser.js +++ b/_server/MotaActionParser.js @@ -18,8 +18,9 @@ MotaActionParser = function () { {"type":"specialBlock","floorId":["MT1"],"specialBlock":"血网伤害","operator":"<","count":1}, {"type":"gosthFloor","floorId":["MT1"],"operator":"<","count":1}, {"type":"arrival","floorId":"MT1"}, - ], "beforeAction": [ - ], "action": [ + ],"setFloor":"MT1","setxy":[1,1],"tarFloor":"MT1,MT2","mitFloor":"MT1","mitxy":[1,2], + "beforeAction": [ + ],"reward":"yellowKey:1,redGem:3","action": [ ]}; var that=this var bulidTaskList = function (obj) { @@ -124,7 +125,7 @@ MotaActionParser = function () { } return res; }; - return MotaActionBlocks['taskEvent_m'].xmlText([obj.text||"",obj.n,bulidTaskList(obj.info),this.insertActionList(obj.beforeAction),this.insertActionList(obj.action)]); + return MotaActionBlocks['taskEvent_m'].xmlText([obj.text||"",obj.n,bulidTaskList(obj.info),obj.setFloor,obj.setxy.join(","),obj.tarFloor,obj.mitFloor,obj.mitxy.join(","),this.insertActionList(obj.beforeAction),obj.reward,this.insertActionList(obj.action)]); case "event": if (!obj) obj = {}; if (typeof obj === typeof "") obj = { data: [obj] }; @@ -739,7 +740,7 @@ MotaActionParser = function () { ]); break; case "setq": - this.next = MotaActionBlocks["setq_s"].xmlText([data.id, this.next]); + this.next = MotaActionBlocks["setq_s"].xmlText([data.name, this.next]); break; case "setcgs": this.next = MotaActionBlocks["setcgs_s"].xmlText([data.img, this.next]); @@ -2751,7 +2752,7 @@ MotaActionParser = function () { case "trymitTask": // 尝试提交第n项任务 this.next = MotaActionBlocks['trymitTask_s'].xmlText([data.index,this.next ]); break; - case "trymitTaskTaskByName": // 尝试提交某一任务 + case "trymitTaskByName": // 尝试提交某一任务 this.next = MotaActionBlocks['trymitTaskByName_s'].xmlText([data.name,this.next ]); break; case "clearTask": // 删除所有任务 diff --git a/_server/table/comment.js b/_server/table/comment.js index 8c11405..81f6b8f 100644 --- a/_server/table/comment.js +++ b/_server/table/comment.js @@ -740,21 +740,7 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = { "_range": "thiseval <= Number.MAX_SAFE_INTEGER && thiseval>=0", "_docs": "宝石血瓶效果", "_data": "每一层的宝石/血瓶效果,即获得宝石和血瓶时框内\"ratio\"的值。" - }, - "setTasks": { - "_leaf": true, - "_type": "textarea", - "_range": "thiseval instanceof Object && !(thiseval instanceof Array)", - "_docs": "任务接取坐标", - "_data": "格式为{新手任务:[1,1],task1:[0,3]}" - }, - "mitTasks": { - "_leaf": true, - "_type": "textarea", - "_range": "thiseval instanceof Object && !(thiseval instanceof Array)", - "_docs": "任务提交坐标", - "_data": "格式为{新手任务:[1,1],task1:[0,3]}" - }, + } } }, "loc": { diff --git a/project/events.js b/project/events.js index 2b7f266..c20a45c 100644 --- a/project/events.js +++ b/project/events.js @@ -12780,82 +12780,22 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = "type": "checkItem", "checkItem": "yellowKey", "operator": ">=", - "count": 0 - }, - { - "type": "checkStatus", - "checkStatus": "atk", - "operator": ">=", - "count": 10 - }, - { - "type": "checkFlag", - "checkFlag": "flag1", - "operator": "=", - "count": "\"value\"" - }, - { - "type": "checkBlock", - "checkBlock": "bat", - "floorId": [ - "MT1", - "MT2" - ], - "operator": "<=", - "count": 0 - }, - { - "type": "kill", - "operator": ">=", - "count": 0 - }, - { - "type": "killLocs", - "loc": [ - [ - 1, - 1 - ] - ], - "floorId": "MT1", - "operator": ">=", - "count": 1 - }, - { - "type": "killSpecial", - "killSpecial": "61", - "floorId": [ - "MT1", - "MT2" - ], - "operator": ">=", - "count": 1 - }, - { - "type": "killAll", - "floorId": [ - "MT1" - ] - }, - { - "type": "specialBlock", - "floorId": [ - "MT1" - ], - "specialBlock": "血网伤害", - "operator": "<", - "count": 1 - }, - { - "type": "gosthFloor", - "floorId": [ - "MT1" - ], - "operator": "<", "count": 1 } ], + "setFloor": "yiqu1", + "setxy": [ + 2, + 7 + ], + "tarFloor": "MT1,MT2", + "mitFloor": "yiqu1", + "mitxy": [ + 8, + 7 + ], "beforeAction": [], + "reward": "yellowKey:1,redGem:3", "action": [] }, "task1": { @@ -12941,7 +12881,19 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = "count": 1 } ], + "setFloor": "MT1", + "setxy": [ + 1, + 1 + ], + "tarFloor": "MT1,MT2", + "mitFloor": "MT1", + "mitxy": [ + 1, + 1 + ], "beforeAction": [], + "reward": "yellowKey:1,redGem:3", "action": [] } } diff --git a/project/floors/jiaocheng01.js b/project/floors/jiaocheng01.js index 28bf577..98b85b0 100644 --- a/project/floors/jiaocheng01.js +++ b/project/floors/jiaocheng01.js @@ -281,7 +281,5 @@ main.floors.jiaocheng01= ], "fg2map": [ -], - "setTasks": {}, - "mitTasks": {} +] } \ No newline at end of file diff --git a/project/functions.js b/project/functions.js index f7bb7ef..0d76e73 100644 --- a/project/functions.js +++ b/project/functions.js @@ -1466,7 +1466,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = } }, "updateStatusBar": function () { - + core.taskSystem.checkAll() // 更新状态栏 core.ui.statusBar.update(); // 更新阻激夹域的伤害值 diff --git a/project/plugins.js b/project/plugins.js index 98a5a5a..675e980 100644 --- a/project/plugins.js +++ b/project/plugins.js @@ -2,6 +2,19 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = { "init": function () { this._afterLoadResources = function () { + core.setTaskFloor = {} + core.mitTaskFloor = {} + core.tarTaskFloor = {} + core.taskReward = {} + for (const [key, value] of Object.entries(core.events.task)) { + if (!core.setTaskFloor[value.setFloor]) core.setTaskFloor[value.setFloor] = {} + core.setTaskFloor[value.setFloor][key] = value.setxy + core.tarTaskFloor[key] = value.tarFloor.split(",") + if (!core.mitTaskFloor[value.mitFloor]) core.mitTaskFloor[value.mitFloor] = {} + core.mitTaskFloor[value.mitFloor][key] = value.mitxy + core.taskReward[key] = Object.fromEntries((value.reward.split(",").map(v => v.split(":"))).map(v => [v[0], parseInt(v[1])])) + } + if (!main.replayChecking) { function loadFont(_fontName, _fontUrl) { // let reg = new RegExp('\\b' + _fontName + '\\b') @@ -356,7 +369,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = } }); core.registerEvent("setq", function (data) { - core.setFlag("任务地点", data.id); + core.setFlag("任务指引", data.name); core.doAction(); }); @@ -3822,7 +3835,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = core.isMoving() ) return; - core.useFly(true); + core.ui._drawViewMaps(); return; } /*const equipBox = makeBox([EQUIP_BLOCK_LEFT_VERTICAL, EQUIP_BLOCK_TOP_VERTICAL], [90 * 3, 130 * 3]) @@ -3840,7 +3853,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = core.isMoving() ) return; - core.useFly(true); + core.ui._drawViewMaps() return; } /* @@ -11914,27 +11927,33 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = "text": "任务描述", "n": 1, "info": [ - { "type": "checkItem", "checkItem": "yellowKey", "operator": ">=", "count": 0 }, - { "type": "checkStatus", "checkStatus": "atk", "operator": ">=", "count": 10 }, + { "type": "checkItem", "checkItem": "yellowKey", "operator": ">=", "count": 0 }, + { "type": "checkStatus", "checkStatus": "atk", "operator": ">=", "count": 10 }, { "type": "checkFlag", "checkFlag": "flag1", "operator": "=", "count": "\"value\"" }, - { "type": "checkBlock", "checkBlock": "bat", "floorId": ["MT1", "MT2"], "operator": "<=", "count": 0 }, - { "type": "kill", "operator": ">=", "count": 0 }, + { "type": "checkBlock", "checkBlock": "bat", "floorId": ["MT1", "MT2"], "operator": "<=", "count": 0 }, + { "type": "kill", "operator": ">=", "count": 0 }, { "type": "killLocs", "loc": [ [1, 1] ], "floorId": "MT1", - "operator": ">=", + "operator": ">=", "count": 1 }, - { "type": "killSpecial", "killSpecial": "61", "floorId": ["MT1", "MT2"], "operator": ">=", "count": 1 }, + { "type": "killSpecial", "killSpecial": "61", "floorId": ["MT1", "MT2"], "operator": ">=", "count": 1 }, { "type": "killAll", "floorId": ["MT1"] }, - { "type": "specialBlock", "floorId": ["MT1"], "specialBlock": "血网伤害", "operator": "<", "count": 1 }, - { "type": "gosthFloor", "floorId": ["MT1"], "operator": "<", "count": 1 }, + { "type": "specialBlock", "floorId": ["MT1"], "specialBlock": "血网伤害", "operator": "<", "count": 1 }, + { "type": "gosthFloor", "floorId": ["MT1"], "operator": "<", "count": 1 }, { "type": "arrival", "floorId": "MT1" }, ], + "setFloor": "MT1", + "setxy": [1, 1], + "tarFloor": "MT1,MT2", + "mitFloor": "MT1", + "mitxy": [1, 1], "beforeAction": [], + "reward": "yellowKey:1,redGem:3", "action": [] }, "taskEvent" @@ -12238,7 +12257,6 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = ], 特效表现: [ MotaActionBlocks["sleep_s"].xmlText(), - MotaActionBlocks["setq_s"].xmlText(), MotaActionBlocks["setcgs_s"].xmlText(), MotaActionBlocks["setmusics_s"].xmlText(), MotaActionBlocks["changebg_s"].xmlText(), @@ -12356,7 +12374,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = "text": "任务", "text1": "新手任务", "text2": "task1,task2", - "condition": "'新手任务'.split(',').some(v=>core.plugin.可接取任务.includes(v))||'task1,task2,'.split(',').some(v=>core.taskSystem.tasksInfo.findIndex(a => a.name ===v.name))", + "condition": "'新手任务'.split(',').some(v=>core.plugin.可接取任务.includes(v))||'task1,task2,'.split(',').some(v=>core.taskSystem.tasksInfo.findIndex(a => a.name ===v))", "beforeAction": [], "action": [ @@ -12365,6 +12383,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = ] }), + MotaActionBlocks["setq_s"].xmlText(), MotaActionBlocks['setTask_s'].xmlText(), MotaActionBlocks['removeTask_s'].xmlText(), MotaActionBlocks['removeTaskByName_s'].xmlText(), @@ -13185,11 +13204,6 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = let ignoreEnemies = (this.ignoreEnemies = []); let allChangeEntries = Object.entries(defaultChange); - - this.setq = function (floorId) { - core.setFlag("任务地点", floorId); - }; - const reset = core.events.resetGame; this.bfs = function () { areas = []; @@ -13463,6 +13477,16 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = sh, scale = defaultValue.scale ) { + let floorS = [] + if (flags.任务指引) { + if (core.plugin.可接取任务.includes(flags.任务指引)) floorS.push(core.events.task[flags.任务指引].setFloor) + else if (core.taskSystem.tasksInfo && core.taskSystem.tasksInfo.find(v => v.name === flags.任务指引)) + if (!core.taskSystem.checkTaskByName(flags.任务指引)) { + floorS = floorS.concat(core.events.task[flags.任务指引].tarFloor.split(",")) + } else { + floorS.push(core.events.task[flags.任务指引].mitFloor) + } + } core.clearMap(ctx, sx, sy, sw + 13, sh + 20); if (core.domStyle.isVertical) { sy += 17; @@ -13517,8 +13541,8 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = min / 2, min / 2 ); - if (core.getFlag("任务地点") && core.getFlag("任务地点") === id) - ctx.drawImage(tesk, fx + min / 4, fy + min / 4, min / 2, min / 2); + if (floorS.includes(id)) ctx.drawImage(tesk, fx + min / 4, fy + min / 4, min / 2, min / 2); + if (id === core.status.floorId) core.drawImage( ctx, @@ -28248,7 +28272,6 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = "任务系统": function () { // 在此增加新插件 //详细的任务信息及要求存放在core.events.task,供TaskSystem使用 - //以下均为任务名构成的数组,在任务接取或提交时转换 this.可接取任务 = ["新手任务"] this.已提交任务 = [] //当前任务及任务状态在TaskSystem内部,无需数组 @@ -28257,11 +28280,12 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = this.tasksInfo = [] } setTask(name) { - let task = core.enents.task[name] + let task = core.events.task[name] if (task && core.plugin.可接取任务.includes(name)) { this.tasksInfo.push({ name, text: task.text, n: task.n, action: task.action, tasks: task.info.map(v => new Task(v)) }) this.tasksInfo[this.tasksInfo.length - 1].complter = this.checkTask(this.tasksInfo.length - 1) if (task.beforeAction.length > 0) core.insertAction(task.beforeAction) + core.plugin.可接取任务 = core.plugin.可接取任务.filter(v => v !== name) } } checkTask(index) { @@ -28269,6 +28293,12 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = if (this.tasksInfo[index].success) return true else return this.tasksInfo[index].tasks.reduce((a, b) => a + Number(b.check()), 0) >= this.tasksInfo[index].n } + checkTaskByName(name) { + const a = this.tasksInfo.find(v => v.name = name) + if (!a) return false + if (a.success) return true + else return a.tasks.reduce((a, b) => a + Number(b.check()), 0) >= a.n + } removeTaskByName(name) { const index = this.tasksInfo.findIndex(v => v.name === name) removeTask(index) @@ -28280,6 +28310,15 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = clearTesk() { this.tasksInfo = [] } + setq(name) { + flags.任务指引 = name + } + setqByIndex(index) { + flags.任务指引 = this.tasksInfo[index].name + } + removeq(name) { + flags.任务指引 = null + } checkAll() { for (let i = 0; i < this.tasksInfo.length; i++) { this.checkTask(i) @@ -28304,7 +28343,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = const index = this.tasksInfo.findIndex(v => v.name === name) if (index < 0 || index > this.tasksInfo.length - 1) return if (this.checkTask(index)) { - if (this.tasksInfo[i].action.length > 0) core.insertAction(this.tasksInfo[i].action) + if (this.tasksInfo[index].action.length > 0) core.insertAction(this.tasksInfo[i].action) core.plugin.已提交任务.push(name) this.removeTask(index) } @@ -29096,10 +29135,11 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = let ctx let alpha = 0 let add = 1 + core.registerAnimationFrame("taskPic", true, (timestemp) => { if (timestemp - time < 50) return time = timestemp - if (!ctx) ctx = core.createCanvas("taskPic", 0, 0, 416, 416, 141) + if (!core.dymCanvas.taskPic) ctx = core.createCanvas("taskPic", 0, 0, 416, 416, 141) let floorId if (core.status.lockControl && core.status.event.id == "viewMaps") { ctx.canvas.style.zIndex = 141 @@ -29109,8 +29149,8 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = floorId = core.status.floorId } if (!floorId) return - let setTasks = core.floors[floorId].setTasks - let mitTasks = core.floors[floorId].mitTasks + let setTasks = core.setTaskFloor[floorId] || [] + let mitTasks = core.mitTaskFloor[floorId] || [] let settask = [] let notask = [] let seccesstask = [] @@ -29124,12 +29164,11 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = task.forEach((v, i) => { if (mitTasks[v.name]) { - if (!settask.some(a => a[0] === setTasks[v.name][0] && a[1] === setTasks[v.name][1])) { - let success = task.checkTask(i) - if (success && !seccesstask.some(a => a[0] === mitTasks[v.name][0] && a[1] === mitTasks[v.name][1])) { + if (!settask.some(a => a[0] === mitTasks[v.name][0] && a[1] === mitTasks[v.name][1])) { + let success = core.taskSystem.checkTask(i) + if (success && !seccesstask.some(a => a[0] === mitTasks[v.name]?.[0] && a[1] === mitTasks[v.name]?.[1])) { seccesstask.push(mitTasks[v.name]) - } - if (!success && !notask.some(a => a[0] === mitTasks[v.name][0] && a[1] === mitTasks[v.name][1])) { + } else if (!success && !notask.some(a => a[0] === mitTasks[v.name][0] && a[1] === mitTasks[v.name][1])) { notask.push(mitTasks[v.name]) } } diff --git a/project/table/task_comment.js b/project/table/task_comment.js index 5b4aae9..7c4dc09 100644 --- a/project/table/task_comment.js +++ b/project/table/task_comment.js @@ -106,12 +106,10 @@ var task_comment = { "operator": "<", "count": 1 } - ],"beforeAction":[], - "action": [ - { - "type": "setmusics" - } - ] + ],"setFloor":"MT1","setxy":[1,1],"tarFloor":"MT1,MT2","mitFloor":"MT1","mitxy":[1,1], + "beforeAction": [ + ],"reward":"yellowKey:1,redGem:3","action": [ + ] }`, "_data": "..." }