diff --git a/_server/table/comment.js b/_server/table/comment.js index 1a63a47f..b490ae87 100644 --- a/_server/table/comment.js +++ b/_server/table/comment.js @@ -107,13 +107,13 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = { "_docs": "能否使用或装备", "_data": "当前能否使用或装备该道具,仅对cls不为items有效。null表示始终不可使用但可装备" }, - "noBatchUse": { + "canBatchUse": { "_leaf": true, "_type": "textarea", "_string": true, "_lint": true, - "_docs": "不可批量使用", - "_data": "该道具是否不允许批量使用,true表示不可批量使用" + "_docs": "可批量使用", + "_data": "该道具是否允许批量使用,仅对cls为tools或constants有效,true表示可批量使用。建议同时勾选[回放不绘制道具栏]" } } }, diff --git a/project/floors/MT0.js b/project/floors/MT0.js index 616223e7..088ced9e 100644 --- a/project/floors/MT0.js +++ b/project/floors/MT0.js @@ -25,7 +25,18 @@ main.floors.MT0= [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] ], - "firstArrive": [], + "firstArrive": [ + { + "type": "setValue", + "name": "item:wand", + "value": "99" + }, + { + "type": "setValue", + "name": "item:silverCoin", + "value": "99" + } + ], "parallelDo": "", "events": { "6,8": [ diff --git a/project/items.js b/project/items.js index 3261c6fe..dbfc02d2 100644 --- a/project/items.js +++ b/project/items.js @@ -357,8 +357,7 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a = "text": "可以查看当前楼层各怪物属性", "hideInToolbox": true, "useItemEffect": "core.ui.drawBook(0);", - "canUseItemEffect": "true", - "noBatchUse": "true" + "canUseItemEffect": "true" }, "fly": { "cls": "constants", @@ -367,8 +366,7 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a = "hideInReplay": true, "hideInToolbox": true, "useItemEffect": "core.ui.drawFly(core.floorIds.indexOf(core.status.floorId));", - "canUseItemEffect": "(function () {\n\tif (core.flags.flyNearStair && !core.nearStair()) return false;\n\treturn core.status.maps[core.status.floorId].canFlyFrom;\n})();", - "noBatchUse": "true" + "canUseItemEffect": "(function () {\n\tif (core.flags.flyNearStair && !core.nearStair()) return false;\n\treturn core.status.maps[core.status.floorId].canFlyFrom;\n})();" }, "coin": { "cls": "constants", @@ -442,8 +440,7 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a = "name": "中心对称飞行器", "text": "可以飞向当前楼层中心对称的位置", "useItemEffect": "core.playSound('centerFly.mp3');\ncore.clearMap('hero');\ncore.setHeroLoc('x', core.bigmap.width - 1 - core.getHeroLoc('x'));\ncore.setHeroLoc('y', core.bigmap.height - 1 - core.getHeroLoc('y'));\ncore.drawHero();\ncore.drawTip(core.material.items[itemId].name + '使用成功');", - "canUseItemEffect": "(function () {\n\tvar toX = core.bigmap.width - 1 - core.getHeroLoc('x'),\n\t\ttoY = core.bigmap.height - 1 - core.getHeroLoc('y');\n\tvar id = core.getBlockId(toX, toY);\n\treturn id == null;\n})();", - "noBatchUse": "true" + "canUseItemEffect": "(function () {\n\tvar toX = core.bigmap.width - 1 - core.getHeroLoc('x'),\n\t\ttoY = core.bigmap.height - 1 - core.getHeroLoc('y');\n\tvar id = core.getBlockId(toX, toY);\n\treturn id == null;\n})();" }, "upFly": { "cls": "tools", @@ -507,8 +504,12 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a = "canUseItemEffect": "(function () {\n\tvar nx = core.nextX(2),\n\t\tny = core.nextY(2);\n\treturn nx >= 0 && nx < core.bigmap.width && ny >= 0 && ny < core.bigmap.height && core.getBlockId(nx, ny) == null;\n})();" }, "wand": { - "cls": "items", - "name": "新物品" + "cls": "tools", + "name": "生命魔杖", + "canBatchUse": "true", + "text": "使用后回复100体力。", + "canUseItemEffect": "true", + "useItemEffect": "core.addStatus('hp', 100);" }, "pack": { "cls": "items", @@ -533,7 +534,8 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a = "operator": "+=", "value": "1" } - ] + ], + "canBatchUse": "true" }, "orb": { "cls": "items", @@ -550,8 +552,7 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a = "name": "设置", "canUseItemEffect": "true", "text": "可以调节设置开关。", - "useItemEffect": "core.plugin.openSetting();", - "noBatchUse": "true" + "useItemEffect": "core.plugin.openSetting();" }, "redWand": { "cls": "items", diff --git a/project/plugins.js b/project/plugins.js index d4587e27..970574b5 100644 --- a/project/plugins.js +++ b/project/plugins.js @@ -2971,10 +2971,6 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = function batchUse(item, count) { try { const itemCount = core.itemCount(item); - if (eval(core.material.items[item].noBatchUse)) { - core.drawFailTip('该道具不能被批量使用!'); - return; - } if (count > itemCount) count = itemCount; core.closePanel(); for (let i = 0; i < count; i++) { @@ -2982,12 +2978,21 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = else return; } } catch (e) { - console.log(e); + console.error(e); core.drawFailTip('批量使用时出现未知错误!'); } } function drawToolbox_setBatchUseBtn(ctx, x, y, r, h, style, lineWidth) { + try { + const selectedItem = getSelectedItem(); + let canBatchUse = eval(core.material.items[selectedItem]?.canBatchUse); + if (!canBatchUse) return; + } + catch (error) { + console.error(error); + return; + } core.setTextAlign(ctx, "left"); core.setTextBaseline(ctx, "top"); var fontSize = h - 4; @@ -2999,10 +3004,10 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = core.fillText(ctx, text, x + r, y + lineWidth / 2 + 2, style, font); var todo = function () { - core.utils.myprompt('输入要使用该物品的次数(0~99)。 请勿对不适合重复使用的物品这么做。', null, (value) => { + core.utils.myprompt('输入要使用该物品的次数(0~99)。', null, (value) => { value = parseInt(value); - var id = getSelectedItem(); + const id = getSelectedItem(); if (Number.isNaN(value) || value < 0 || value > 99) { core.drawFailTip('输入不合法!'); @@ -3138,7 +3143,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = info.select = {}; info.select.id = id; core.setIndexAndSelect('index'); - core.refreshBox(); + refreshBox(); } this.clickOneEquipbox = function (id, type) { @@ -3150,7 +3155,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = type: type, action: "unload" } - return core.refreshBox(); + return refreshBox(); } this.useSelectItemInBox = function () { @@ -3221,7 +3226,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = info.index = 1; setPageItems(info.page); core.setIndexAndSelect("select"); - core.refreshBox(); + refreshBox(); } this.addItemListboxIndex = function (num) { @@ -3233,7 +3238,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = if (info.index <= 0) info.index = 1; if (info.index > maxItem) info.index = maxItem; core.setIndexAndSelect("select"); - core.refreshBox(); + refreshBox(); } this.addEquipboxType = function (num) { @@ -3250,7 +3255,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = var m = Math.abs(info.select.type); if (info.select.type < 0) info.select.type = max - m; core.setIndexAndSelect("select") - core.refreshBox(); + refreshBox(); return; } } @@ -3310,7 +3315,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = if (info.index == 1) { info.select.type = core.status.globalAttribute.equipName.length - 1; core.setIndexAndSelect(); - return core.refreshBox(); + return refreshBox(); } if (info.index) return core.addItemListboxIndex(-1); return core.addEquipboxType(-1 * info.equips); @@ -3387,7 +3392,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = core.status.thisEventClickArea = []; } - this.refreshBox = function () { + function refreshBox() { if (!core.status.event.id) return; if (core.status.event.id == "toolbox") core.drawToolbox(); else core.drawEquipbox();