feat:新版道具栏 批量使用功能
This commit is contained in:
parent
6f9bfbbb27
commit
425f3d74c9
@ -107,13 +107,13 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
|
|||||||
"_docs": "能否使用或装备",
|
"_docs": "能否使用或装备",
|
||||||
"_data": "当前能否使用或装备该道具,仅对cls不为items有效。null表示始终不可使用但可装备"
|
"_data": "当前能否使用或装备该道具,仅对cls不为items有效。null表示始终不可使用但可装备"
|
||||||
},
|
},
|
||||||
"noBatchUse": {
|
"canBatchUse": {
|
||||||
"_leaf": true,
|
"_leaf": true,
|
||||||
"_type": "textarea",
|
"_type": "textarea",
|
||||||
"_string": true,
|
"_string": true,
|
||||||
"_lint": true,
|
"_lint": true,
|
||||||
"_docs": "不可批量使用",
|
"_docs": "可批量使用",
|
||||||
"_data": "该道具是否不允许批量使用,true表示不可批量使用"
|
"_data": "该道具是否允许批量使用,仅对cls为tools或constants有效,true表示可批量使用。建议同时勾选[回放不绘制道具栏]"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@ -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],
|
||||||
[ 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": "",
|
"parallelDo": "",
|
||||||
"events": {
|
"events": {
|
||||||
"6,8": [
|
"6,8": [
|
||||||
|
|||||||
@ -357,8 +357,7 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
|
|||||||
"text": "可以查看当前楼层各怪物属性",
|
"text": "可以查看当前楼层各怪物属性",
|
||||||
"hideInToolbox": true,
|
"hideInToolbox": true,
|
||||||
"useItemEffect": "core.ui.drawBook(0);",
|
"useItemEffect": "core.ui.drawBook(0);",
|
||||||
"canUseItemEffect": "true",
|
"canUseItemEffect": "true"
|
||||||
"noBatchUse": "true"
|
|
||||||
},
|
},
|
||||||
"fly": {
|
"fly": {
|
||||||
"cls": "constants",
|
"cls": "constants",
|
||||||
@ -367,8 +366,7 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
|
|||||||
"hideInReplay": true,
|
"hideInReplay": true,
|
||||||
"hideInToolbox": true,
|
"hideInToolbox": true,
|
||||||
"useItemEffect": "core.ui.drawFly(core.floorIds.indexOf(core.status.floorId));",
|
"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})();",
|
"canUseItemEffect": "(function () {\n\tif (core.flags.flyNearStair && !core.nearStair()) return false;\n\treturn core.status.maps[core.status.floorId].canFlyFrom;\n})();"
|
||||||
"noBatchUse": "true"
|
|
||||||
},
|
},
|
||||||
"coin": {
|
"coin": {
|
||||||
"cls": "constants",
|
"cls": "constants",
|
||||||
@ -442,8 +440,7 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
|
|||||||
"name": "中心对称飞行器",
|
"name": "中心对称飞行器",
|
||||||
"text": "可以飞向当前楼层中心对称的位置",
|
"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 + '使用成功');",
|
"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})();",
|
"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"
|
|
||||||
},
|
},
|
||||||
"upFly": {
|
"upFly": {
|
||||||
"cls": "tools",
|
"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})();"
|
"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": {
|
"wand": {
|
||||||
"cls": "items",
|
"cls": "tools",
|
||||||
"name": "新物品"
|
"name": "生命魔杖",
|
||||||
|
"canBatchUse": "true",
|
||||||
|
"text": "使用后回复100体力。",
|
||||||
|
"canUseItemEffect": "true",
|
||||||
|
"useItemEffect": "core.addStatus('hp', 100);"
|
||||||
},
|
},
|
||||||
"pack": {
|
"pack": {
|
||||||
"cls": "items",
|
"cls": "items",
|
||||||
@ -533,7 +534,8 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
|
|||||||
"operator": "+=",
|
"operator": "+=",
|
||||||
"value": "1"
|
"value": "1"
|
||||||
}
|
}
|
||||||
]
|
],
|
||||||
|
"canBatchUse": "true"
|
||||||
},
|
},
|
||||||
"orb": {
|
"orb": {
|
||||||
"cls": "items",
|
"cls": "items",
|
||||||
@ -550,8 +552,7 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
|
|||||||
"name": "设置",
|
"name": "设置",
|
||||||
"canUseItemEffect": "true",
|
"canUseItemEffect": "true",
|
||||||
"text": "可以调节设置开关。",
|
"text": "可以调节设置开关。",
|
||||||
"useItemEffect": "core.plugin.openSetting();",
|
"useItemEffect": "core.plugin.openSetting();"
|
||||||
"noBatchUse": "true"
|
|
||||||
},
|
},
|
||||||
"redWand": {
|
"redWand": {
|
||||||
"cls": "items",
|
"cls": "items",
|
||||||
|
|||||||
@ -2971,10 +2971,6 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
|||||||
function batchUse(item, count) {
|
function batchUse(item, count) {
|
||||||
try {
|
try {
|
||||||
const itemCount = core.itemCount(item);
|
const itemCount = core.itemCount(item);
|
||||||
if (eval(core.material.items[item].noBatchUse)) {
|
|
||||||
core.drawFailTip('该道具不能被批量使用!');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (count > itemCount) count = itemCount;
|
if (count > itemCount) count = itemCount;
|
||||||
core.closePanel();
|
core.closePanel();
|
||||||
for (let i = 0; i < count; i++) {
|
for (let i = 0; i < count; i++) {
|
||||||
@ -2982,12 +2978,21 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
|||||||
else return;
|
else return;
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log(e);
|
console.error(e);
|
||||||
core.drawFailTip('批量使用时出现未知错误!');
|
core.drawFailTip('批量使用时出现未知错误!');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function drawToolbox_setBatchUseBtn(ctx, x, y, r, h, style, lineWidth) {
|
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.setTextAlign(ctx, "left");
|
||||||
core.setTextBaseline(ctx, "top");
|
core.setTextBaseline(ctx, "top");
|
||||||
var fontSize = h - 4;
|
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);
|
core.fillText(ctx, text, x + r, y + lineWidth / 2 + 2, style, font);
|
||||||
|
|
||||||
var todo = function () {
|
var todo = function () {
|
||||||
core.utils.myprompt('输入要使用该物品的次数(0~99)。 请勿对不适合重复使用的物品这么做。', null, (value) => {
|
core.utils.myprompt('输入要使用该物品的次数(0~99)。', null, (value) => {
|
||||||
|
|
||||||
value = parseInt(value);
|
value = parseInt(value);
|
||||||
var id = getSelectedItem();
|
const id = getSelectedItem();
|
||||||
|
|
||||||
if (Number.isNaN(value) || value < 0 || value > 99) {
|
if (Number.isNaN(value) || value < 0 || value > 99) {
|
||||||
core.drawFailTip('输入不合法!');
|
core.drawFailTip('输入不合法!');
|
||||||
@ -3138,7 +3143,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
|||||||
info.select = {};
|
info.select = {};
|
||||||
info.select.id = id;
|
info.select.id = id;
|
||||||
core.setIndexAndSelect('index');
|
core.setIndexAndSelect('index');
|
||||||
core.refreshBox();
|
refreshBox();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.clickOneEquipbox = function (id, type) {
|
this.clickOneEquipbox = function (id, type) {
|
||||||
@ -3150,7 +3155,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
|||||||
type: type,
|
type: type,
|
||||||
action: "unload"
|
action: "unload"
|
||||||
}
|
}
|
||||||
return core.refreshBox();
|
return refreshBox();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.useSelectItemInBox = function () {
|
this.useSelectItemInBox = function () {
|
||||||
@ -3221,7 +3226,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
|||||||
info.index = 1;
|
info.index = 1;
|
||||||
setPageItems(info.page);
|
setPageItems(info.page);
|
||||||
core.setIndexAndSelect("select");
|
core.setIndexAndSelect("select");
|
||||||
core.refreshBox();
|
refreshBox();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.addItemListboxIndex = function (num) {
|
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 <= 0) info.index = 1;
|
||||||
if (info.index > maxItem) info.index = maxItem;
|
if (info.index > maxItem) info.index = maxItem;
|
||||||
core.setIndexAndSelect("select");
|
core.setIndexAndSelect("select");
|
||||||
core.refreshBox();
|
refreshBox();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.addEquipboxType = function (num) {
|
this.addEquipboxType = function (num) {
|
||||||
@ -3250,7 +3255,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
|||||||
var m = Math.abs(info.select.type);
|
var m = Math.abs(info.select.type);
|
||||||
if (info.select.type < 0) info.select.type = max - m;
|
if (info.select.type < 0) info.select.type = max - m;
|
||||||
core.setIndexAndSelect("select")
|
core.setIndexAndSelect("select")
|
||||||
core.refreshBox();
|
refreshBox();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3310,7 +3315,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
|||||||
if (info.index == 1) {
|
if (info.index == 1) {
|
||||||
info.select.type = core.status.globalAttribute.equipName.length - 1;
|
info.select.type = core.status.globalAttribute.equipName.length - 1;
|
||||||
core.setIndexAndSelect();
|
core.setIndexAndSelect();
|
||||||
return core.refreshBox();
|
return refreshBox();
|
||||||
}
|
}
|
||||||
if (info.index) return core.addItemListboxIndex(-1);
|
if (info.index) return core.addItemListboxIndex(-1);
|
||||||
return core.addEquipboxType(-1 * info.equips);
|
return core.addEquipboxType(-1 * info.equips);
|
||||||
@ -3387,7 +3392,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
|||||||
core.status.thisEventClickArea = [];
|
core.status.thisEventClickArea = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
this.refreshBox = function () {
|
function refreshBox() {
|
||||||
if (!core.status.event.id) return;
|
if (!core.status.event.id) return;
|
||||||
if (core.status.event.id == "toolbox") core.drawToolbox();
|
if (core.status.event.id == "toolbox") core.drawToolbox();
|
||||||
else core.drawEquipbox();
|
else core.drawEquipbox();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user