diff --git a/_server/config.json b/_server/config.json index 3ea46aa1..9c9888dc 100644 --- a/_server/config.json +++ b/_server/config.json @@ -1 +1 @@ -{"lastUsed":[],"foldPerCol":50,"folded":false,"editorLastFloorId":"sample1","disableBlocklyReplace":false,"shortcut":{"48":0,"49":0,"50":0,"51":0,"52":0,"53":0,"54":0,"55":0,"56":0,"57":0}} \ No newline at end of file +{"lastUsed":[],"foldPerCol":50,"folded":false,"editorLastFloorId":"sample0","disableBlocklyReplace":false,"shortcut":{"48":0,"49":0,"50":0,"51":0,"52":0,"53":0,"54":0,"55":0,"56":0,"57":0}} \ No newline at end of file diff --git a/_server/table/comment.js b/_server/table/comment.js index 63e2c958..4adf42c0 100644 --- a/_server/table/comment.js +++ b/_server/table/comment.js @@ -19,14 +19,13 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = { "_type": "select", "_select": { "values": [ - "keys", "items", "constants", "tools", "equips" ] }, - "_data": "只能取keys(钥匙) items(宝石、血瓶) constants(永久物品) tools(消耗道具) equips(装备)" + "_data": "只能取items(宝石、血瓶) constants(永久物品) tools(消耗道具) equips(装备)" }, "name": { "_leaf": true, @@ -40,6 +39,11 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = { "_string": true, "_data": "道具在道具栏中显示的描述" }, + "hideInToolbox": { + "_leaf": true, + "_type": "checkbox", + "_data": "是否不显示在道具栏中" + }, "equip": { "_leaf": true, "_type": "textarea", @@ -48,7 +52,7 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = { "hideInReplay": { "_leaf": true, "_type": "checkbox", - "_data": "是否回放时绘制道具栏。\n如果此项为true,则在回放录像时使用本道具将不会绘制道具栏页面,而是直接使用。\n此项建议在会频繁连续多次使用的道具开启(如开启技能,或者《镜子》那样的镜像切换等等)" + "_data": "是否回放时不绘制道具栏。\n如果此项为true,则在回放录像时使用本道具将不会绘制道具栏页面,而是直接使用。\n此项建议在会频繁连续多次使用的道具开启(如开启技能,或者《镜子》那样的镜像切换等等)" } } }, diff --git a/_server/table/data.comment.js b/_server/table/data.comment.js index 0b8db66d..e0eaf5d4 100644 --- a/_server/table/data.comment.js +++ b/_server/table/data.comment.js @@ -243,12 +243,6 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = { "items": { "_type": "object", "_data": { - "keys": { - "_leaf": true, - "_type": "textarea", - "_range": "thiseval instanceof Object && !(thiseval instanceof Array)", - "_data": "初始三种钥匙个数" - }, "constants": { "_leaf": true, "_type": "textarea", @@ -488,6 +482,11 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = { "_type": "checkbox", "_data": "是否在状态栏显示三色钥匙数量" }, + "enableGreenKey": { + "_leaf": true, + "_type": "checkbox", + "_data": "是否在状态栏显示绿钥匙" + }, "enablePZF": { "_leaf": true, "_type": "checkbox", diff --git a/editor-mobile.html b/editor-mobile.html index 0a280e33..c97cf6b2 100644 --- a/editor-mobile.html +++ b/editor-mobile.html @@ -487,6 +487,7 @@ +
diff --git a/editor.html b/editor.html index b1808e64..b1cbd95f 100644 --- a/editor.html +++ b/editor.html @@ -469,6 +469,7 @@ +
diff --git a/index.html b/index.html index e68366cd..3e6f7c43 100644 --- a/index.html +++ b/index.html @@ -127,6 +127,7 @@ +
diff --git a/libs/actions.js b/libs/actions.js index e6d9e297..1236773d 100644 --- a/libs/actions.js +++ b/libs/actions.js @@ -1362,6 +1362,11 @@ actions.prototype._keyUpQuickShop = function (keycode) { ////// 工具栏界面时的点击操作 ////// actions.prototype._clickToolbox = function (x, y) { + var tools = Object.keys(core.status.hero.items.tools) + .filter(function (id) { return !core.material.items[id].hideInToolbox; }).sort(); + var constants = Object.keys(core.status.hero.items.constants) + .filter(function (id) { return !core.material.items[id].hideInToolbox; }).sort(); + // 装备栏 if (x >= this.LAST - 2 && y == 0) { core.ui.closePanel(); @@ -1391,11 +1396,11 @@ actions.prototype._clickToolbox = function (x, y) { } // 下一页 if (x == this.HSIZE+2 || x == this.HSIZE+3) { - if (y == this.LAST - 5 && toolsPage < Math.ceil(Object.keys(core.status.hero.items.tools).length / this.LAST)) { + if (y == this.LAST - 5 && toolsPage < Math.ceil(tools.length / this.LAST)) { core.status.event.data.toolsPage++; core.ui.drawToolbox(core.status.event.selection); } - if (y == this.LAST && constantsPage < Math.ceil(Object.keys(core.status.hero.items.constants).length / this.LAST)) { + if (y == this.LAST && constantsPage < Math.ceil(constants.length / this.LAST)) { core.status.event.data.constantsPage++; core.ui.drawToolbox(core.status.event.selection); } @@ -1413,15 +1418,20 @@ actions.prototype._clickToolbox = function (x, y) { ////// 选择工具栏界面中某个Index后的操作 ////// actions.prototype._clickToolboxIndex = function (index) { + var tools = Object.keys(core.status.hero.items.tools) + .filter(function (id) { return !core.material.items[id].hideInToolbox; }).sort(); + var constants = Object.keys(core.status.hero.items.constants) + .filter(function (id) { return !core.material.items[id].hideInToolbox; }).sort(); + var items = null; var select; if (index < this.LAST) { select = index + this.LAST * (core.status.event.data.toolsPage - 1); - items = Object.keys(core.status.hero.items.tools).sort(); + items = tools; } else { select = index % this.LAST + this.LAST * (core.status.event.data.constantsPage - 1); - items = Object.keys(core.status.hero.items.constants).sort(); + items = constants; } if (items == null) return; if (select >= items.length) return; @@ -1441,8 +1451,10 @@ actions.prototype._keyDownToolbox = function (keycode) { var last_index = this.LAST - 1; - var tools = Object.keys(core.status.hero.items.tools).sort(); - var constants = Object.keys(core.status.hero.items.constants).sort(); + var tools = Object.keys(core.status.hero.items.tools) + .filter(function (id) { return !core.material.items[id].hideInToolbox; }).sort(); + var constants = Object.keys(core.status.hero.items.constants) + .filter(function (id) { return !core.material.items[id].hideInToolbox; }).sort(); var index = core.status.event.selection; var toolsPage = core.status.event.data.toolsPage; var constantsPage = core.status.event.data.constantsPage; diff --git a/libs/control.js b/libs/control.js index a4c57856..b6a2f0e5 100644 --- a/libs/control.js +++ b/libs/control.js @@ -1439,8 +1439,10 @@ control.prototype._replayAction_item = function (action) { core.useItem(itemId, false, core.replay); return true; } - var tools = Object.keys(core.status.hero.items.tools).sort(); - var constants = Object.keys(core.status.hero.items.constants).sort(); + var tools = Object.keys(core.status.hero.items.tools) + .filter(function (id) { return !core.material.items[id].hideInToolbox; }).sort(); + var constants = Object.keys(core.status.hero.items.constants) + .filter(function (id) { return !core.material.items[id].hideInToolbox; }).sort(); var index, per = core.__SIZE__-1; if ((index=tools.indexOf(itemId))>=0) { core.status.event.data = {"toolsPage": Math.floor(index/per)+1, "constantsPage":1}; @@ -2828,6 +2830,14 @@ control.prototype._resize_status = function (obj) { for (var i = 0; i < core.dom.statusTexts.length; ++i) { core.dom.statusTexts[i].style.color = obj.globalAttribute.statusBarColor; } + // keys + if (core.flags.enableGreenKey) { + core.dom.keyCol.style.fontSize = '0.75em'; + core.statusBar.greenKey.style.display = ''; + } else { + core.dom.keyCol.style.fontSize = ''; + core.statusBar.greenKey.style.display = 'none'; + } } control.prototype._resize_toolBar = function (obj) { diff --git a/libs/events.js b/libs/events.js index 5747a213..9498a3e0 100644 --- a/libs/events.js +++ b/libs/events.js @@ -503,7 +503,7 @@ events.prototype.getItem = function (id, num, x, y, callback) { } catch (e) {} if (!core.status.event.id || core.status.event.id=='action') { core.insertAction("\t["+core.material.items[id].name+","+id+"]" + hint + "\n" - + (itemCls == 'keys' || id == 'greenKey' || id == 'steelKey' ? "(钥匙类道具,遇到对应的门时自动打开)" + + (id.endsWith('Key') ? "(钥匙类道具,遇到对应的门时自动打开)" : itemCls == 'tools' ? "(消耗类道具,请按T在道具栏使用)" : itemCls == 'constants' ? "(永久类道具,请按T在道具栏使用)" : itemCls == 'equips' ? "(装备类道具,请按Q在装备栏进行装备)" : "")); diff --git a/libs/items.js b/libs/items.js index a6604ebf..46121db2 100644 --- a/libs/items.js +++ b/libs/items.js @@ -202,8 +202,7 @@ items.prototype.setItem = function (itemId, itemNum) { core.status.hero.items[itemCls][itemId] = itemNum; if (core.status.hero.items[itemCls][itemId] <= 0) { - if (itemCls != 'keys') delete core.status.hero.items[itemCls][itemId]; - else core.status.hero.items[itemCls][itemId] = 0; + delete core.status.hero.items[itemCls][itemId]; } core.updateStatusBar(); } @@ -219,8 +218,7 @@ items.prototype.addItem = function (itemId, itemNum) { } core.status.hero.items[itemCls][itemId] += itemNum; if (core.status.hero.items[itemCls][itemId] <= 0) { - if (itemCls != 'keys') delete core.status.hero.items[itemCls][itemId]; - else core.status.hero.items[itemCls][itemId] = 0; + delete core.status.hero.items[itemCls][itemId]; } // 永久道具只能有一个 if (itemCls == 'constants' && core.status.hero.items[itemCls][itemId] > 1) @@ -235,8 +233,7 @@ items.prototype.removeItem = function (itemId, itemNum) { var itemCls = core.material.items[itemId].cls; core.status.hero.items[itemCls][itemId] -= itemNum; if (core.status.hero.items[itemCls][itemId] <= 0) { - if (itemCls != 'keys') delete core.status.hero.items[itemCls][itemId]; - else core.status.hero.items[itemCls][itemId] = 0; + delete core.status.hero.items[itemCls][itemId]; } core.updateStatusBar(); return true; diff --git a/libs/ui.js b/libs/ui.js index 60b2bc5f..cd8549ee 100644 --- a/libs/ui.js +++ b/libs/ui.js @@ -2171,8 +2171,10 @@ ui.prototype._drawToolbox_getInfo = function (index) { if (!core.status.event.data || core.status.event.data.toolsPage == null) core.status.event.data = {"toolsPage":1, "constantsPage":1, "selectId":null} // 获取物品列表 - var tools = Object.keys(core.status.hero.items.tools).sort(); - var constants = Object.keys(core.status.hero.items.constants).sort(); + var tools = Object.keys(core.status.hero.items.tools) + .filter(function (id) { return !core.material.items[id].hideInToolbox; }).sort(); + var constants = Object.keys(core.status.hero.items.constants) + .filter(function (id) { return !core.material.items[id].hideInToolbox; }).sort(); // 处理页数 var toolsPage = core.status.event.data.toolsPage; var constantsPage = core.status.event.data.constantsPage; @@ -2675,7 +2677,7 @@ ui.prototype._drawStatistics_buildObj = function () { else cls[e] = core.material.items[e].cls; cnt[e] = 0; }) - var order = ["doors", "keys", "items", "tools", "constants", "equips"]; + var order = ["doors", "items", "tools", "constants", "equips"]; ids.sort(function (a, b) { var c1 = order.indexOf(cls[a]), c2 = order.indexOf(cls[b]); if (c1==c2) return ori.indexOf(a)-ori.indexOf(b); diff --git a/libs/utils.js b/libs/utils.js index 41a14530..32714495 100644 --- a/libs/utils.js +++ b/libs/utils.js @@ -63,6 +63,7 @@ utils.prototype._init = function () { ////// 将文字中的${和}(表达式)进行替换 ////// utils.prototype.replaceText = function (text, prefix, need, times) { + if (typeof text != 'string') return text; return text.replace(/\${(.*?)}/g, function (word, value) { return core.calValue(value, prefix, need, times); }); diff --git a/main.js b/main.js index 68103b90..a7da4598 100644 --- a/main.js +++ b/main.js @@ -174,6 +174,7 @@ function main() { 'yellowKey': document.getElementById("yellowKey"), 'blueKey': document.getElementById("blueKey"), 'redKey': document.getElementById("redKey"), + 'greenKey': document.getElementById("greenKey"), 'poison': document.getElementById('poison'), 'weak':document.getElementById('weak'), 'curse': document.getElementById('curse'), diff --git a/project/data.js b/project/data.js index 2a5fdb4b..975ca42f 100644 --- a/project/data.js +++ b/project/data.js @@ -94,11 +94,6 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d = "experience": 0, "equipment": [], "items": { - "keys": { - "yellowKey": 0, - "blueKey": 0, - "redKey": 0 - }, "constants": {}, "tools": {}, "equips": {} @@ -429,6 +424,7 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d = "enableLevelUp": false, "levelUpLeftMode": false, "enableKeys": true, + "enableGreenKey": false, "enablePZF": false, "enableDebuff": false, "enableSkill": false, diff --git a/project/functions.js b/project/functions.js index 53f48d2f..a97db65a 100644 --- a/project/functions.js +++ b/project/functions.js @@ -1066,7 +1066,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = } else core.setStatusBarInnerHTML('up', ""); // 钥匙 - var keys = ['yellowKey', 'blueKey', 'redKey']; + var keys = ['yellowKey', 'blueKey', 'redKey', 'greenKey']; keys.forEach(function (key) { core.setStatusBarInnerHTML(key, core.setTwoDigits(core.itemCount(key))); }); diff --git a/project/items.js b/project/items.js index 68c5ec33..645815c5 100644 --- a/project/items.js +++ b/project/items.js @@ -2,19 +2,22 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a = { "items": { "yellowKey": { - "cls": "keys", + "cls": "tools", "name": "黄钥匙", - "text": "可以打开一扇黄门" + "text": "可以打开一扇黄门", + "hideInToolbox": true }, "blueKey": { - "cls": "keys", + "cls": "tools", "name": "蓝钥匙", - "text": "可以打开一扇蓝门" + "text": "可以打开一扇蓝门", + "hideInToolbox": true }, "redKey": { - "cls": "keys", + "cls": "tools", "name": "红钥匙", - "text": "可以打开一扇红门" + "text": "可以打开一扇红门", + "hideInToolbox": true }, "redJewel": { "cls": "items", @@ -182,13 +185,15 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a = "book": { "cls": "constants", "name": "怪物手册", - "text": "可以查看当前楼层各怪物属性" + "text": "可以查看当前楼层各怪物属性", + "hideInToolbox": true }, "fly": { "cls": "constants", "name": "楼层传送器", "text": "可以自由往来去过的楼层", - "hideInReplay": true + "hideInReplay": true, + "hideInToolbox": true }, "coin": { "cls": "constants", diff --git a/styles.css b/styles.css index 9fe80446..255fd81b 100644 --- a/styles.css +++ b/styles.css @@ -219,6 +219,7 @@ } #statusBar span{ font: bold italic 1.1em Verdana; + display: inline; } #statusBar p { display: inline-block;