From bb65e2471c284f5fc18d6ba77e98282001304fbb Mon Sep 17 00:00:00 2001 From: bdf1 Date: Wed, 4 Jan 2023 03:33:58 +1300 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=E4=BA=86=E8=87=AA?= =?UTF-8?q?=E5=8A=A8=E6=89=93=E6=80=AA=E5=92=8C=E6=9B=B4=E5=A4=9A=E4=BB=BF?= =?UTF-8?q?RM=E9=80=89=E6=8B=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- project/functions.js | 10 +- project/plugins.js | 456 ++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 454 insertions(+), 12 deletions(-) diff --git a/project/functions.js b/project/functions.js index 5845e12..8250304 100644 --- a/project/functions.js +++ b/project/functions.js @@ -331,7 +331,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = hint += ',' + core.getStatusLabel('money') + '+' + money; // hint += ",金币+" + money; if (core.flags.statusBarItems.indexOf('enableExp') >= 0) hint += ',' + core.getStatusLabel('exp') + '+' + exp; // hint += ",经验+" + exp; - core.drawTip(hint, enemy.id); + if (!core.getFlag("isNoTip")) core.drawTip(hint, enemy.id); // 中毒 if (core.enemys.hasSpecial(special, 12)) { @@ -847,7 +847,9 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = core.load(true); break; case 69: // E:上 //打开光标 - if ((core.flags.flyNearStair && !core.nearStair())) + if (!core.hasItem('fly')) + core.drawTip("你没有" + core.material.items['fly'].name, 'fly'); + else if ((core.flags.flyNearStair && !core.nearStair())) core.drawTip("必须在楼梯口才能使用" + core.material.items['fly'].name, 'fly'); else if (!core.canUseItem('fly')) core.drawTip("不知道为什么," + core.material.items['fly'].name + "在此层失效了!", 'fly'); @@ -868,7 +870,9 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = core.openToolbox(true); break; case 81: // Q:下 //打开装备栏 - if ((core.flags.flyNearStair && !core.nearStair())) + if (!core.hasItem('fly')) + core.drawTip("你没有" + core.material.items['fly'].name, 'fly'); + else if ((core.flags.flyNearStair && !core.nearStair())) core.drawTip("必须在楼梯口才能使用" + core.material.items['fly'].name, 'fly'); else if (!core.canUseItem('fly')) core.drawTip("不知道为什么," + core.material.items['fly'].name + "在此层失效了!", 'fly'); diff --git a/project/plugins.js b/project/plugins.js index d0a46f2..83310e2 100644 --- a/project/plugins.js +++ b/project/plugins.js @@ -511,7 +511,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = core.ui._drawSettings = function () { core.status.event.id = 'settings'; this.drawChoices(null, [ - "系统设置", "虚拟键盘", "浏览地图", "存档笔记", "同步存档", "游戏信息", "返回标题", "返回游戏", "数值显示: " + (core.getFlag("itemDetail") ? "[ON]" : "[OFF]"), "RM楼传: " + (core.getFlag("isRmFly") ? "[ON]" : "[OFF]") + "系统设置", "虚拟键盘", "浏览地图", "存档笔记", "同步存档", "游戏信息", "返回标题", "返回游戏", "爽塔相关", "RM相关" ]); } core.actions._clickSettings = function (x, y) { @@ -558,20 +558,45 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = core.ui.closePanel(); break; case 8: + core.status.event.selection = 0; core.playSound('确定'); + core.ui._drawShuangta(); + /*core.playSound('确定'); core.setFlag("itemDetail", !core.getFlag("itemDetail")); core.getItemDetail(); - core.ui.closePanel(); + core.ui.closePanel();*/ break; case 9: + core.status.event.selection = 0; core.playSound('确定'); + core.ui._drawRM(); + /*core.playSound('确定'); core.setFlag("isRmFly", !core.getFlag("isRmFly")); - core.ui.closePanel(); + core.ui.closePanel();*/ break; } } return; } + core.ui._drawShuangta = function () { + core.status.event.id = 'shuangta'; + this.drawChoices(null, [ + "数值显示: " + (core.getFlag("itemDetail") ? "[ON]" : "[OFF]"), + "自动拾取: " + (core.getFlag("__autoGetItem__") ? "[ON]" : "[OFF]"), + "自动清怪: " + (core.getFlag("__autoBattle__") ? "[ON]" : "[OFF]"), "返回主菜单" + ]); + } + core.ui._drawRM = function () { + core.status.event.id = 'rm'; + this.drawChoices(null, [ + "RM楼传: " + (core.getFlag("isRmFly") ? "[ON]" : "[OFF]"), + "显伤靠右: " + (core.getFlag("isDamageRight") ? "[ON]" : "[OFF]"), + "零伤白色: " + (core.getFlag("isZeroWhite") ? "[ON]" : "[OFF]"), + "道具打怪不提示: " + (core.getFlag("isNoTip") ? "[ON]" : "[OFF]"), + "手册显示普通: " + (core.getFlag("isCommon") ? "[ON]" : "[OFF]"), + "返回主菜单" + ]); + } ////// 获得某个物品 ////// core.events.getItem = function (id, num, x, y, isGentleClick, callback) { if (num == null) num = 1; @@ -581,7 +606,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = var text = '获得 ' + core.material.items[id].name; if (num > 1) text += "x" + num; if (itemCls === 'items' && num == 1) text += core.items.getItemEffectTip(id); - //core.drawTip(text, id); + if (!core.getFlag("isNoTip")) core.drawTip(text, id); // --- 首次获得道具的提示 if (!core.hasFlag("__itemHint__")) core.setFlag("__itemHint__", []); @@ -623,7 +648,13 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = else if (damage < core.status.hero.hp * 2 / 3) color = '#FF9933'; else if (damage < core.status.hero.hp) color = '#FF9933'; else color = '#FF2222'; - + if (!core.getFlag('isZeroWhite')) { + if (damage <= 0) color = '#11FF11'; + else if (damage < core.status.hero.hp / 3) color = '#FFFFFF'; + else if (damage < core.status.hero.hp * 2 / 3) color = '#FFFF00'; + else if (damage < core.status.hero.hp) color = '#FF9933'; + else color = '#FF2222'; + } damage = core.formatBigNumber(damage, true); if (core.enemys.hasSpecial(enemy, 19)) damage += "+"; @@ -645,6 +676,411 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = core.createCanvas('bookBg', 0, 0, 480, 480, 138); ///创建一个动态画布用于绘制手册bg core.drawWindowSkin('winskin.png', 'bookBg', 0, 0, core._PX_, core._PY_); } + core.actions._sys_keyDown_lockControl = function (keyCode) { + if (!core.status.lockControl) return false; + // Ctrl跳过对话 + if (keyCode == 17) { + this.keyDownCtrl(); + return true; + } + switch (core.status.event.id) { + case 'action': + this._keyDownAction(keyCode); + break; + case 'book': + this._keyDownBook(keyCode); + break; + case 'fly': + this._keyDownFly(keyCode); + break; + case 'viewMaps': + this._keyDownViewMaps(keyCode); + break; + case 'equipbox': + this._keyDownEquipbox(keyCode); + break; + case 'toolbox': + this._keyDownToolbox(keyCode); + break; + case 'save': + case 'load': + case 'replayLoad': + case 'replayRemain': + case 'replaySince': + this._keyDownSL(keyCode); + break; + case 'selectShop': + case 'switchs': + case 'switchs-sounds': + case 'switchs-display': + case 'switchs-action': + case 'notes': + case 'settings': + case 'syncSave': + case 'syncSelect': + case 'localSaveSelect': + case 'storageRemove': + case 'replay': + case 'gameInfo': + case 'shuangta': + case 'rm': + this._keyDownChoices(keyCode); + break; + case 'cursor': + this._keyDownCursor(keyCode); + break; + } + return true; + } + core.actions._sys_keyUp_lockControl = function (keyCode, altKey) { + if (!core.status.lockControl) return false; + + var ok = function () { + return keyCode == 27 || keyCode == 88 || keyCode == 13 || keyCode == 32 || keyCode == 67; + } + + core.status.holdingKeys = []; + switch (core.status.event.id) { + case 'text': + ok() && core.drawText(); + break; + case 'confirmBox': + this._keyUpConfirmBox(keyCode); + break; + case 'action': + this._keyUpAction(keyCode); + break; + case 'about': + ok() && core.closePanel(); + break; + case 'help': + ok() && core.closePanel(); + break; + case 'book': + this._keyUpBook(keyCode); + break; + case 'book-detail': + ok() && this._clickBookDetail(); + break; + case 'fly': + this._keyUpFly(keyCode); + break; + case 'viewMaps': + this._keyUpViewMaps(keyCode); + break; + case 'selectShop': + this._keyUpQuickShop(keyCode); + break; + case 'toolbox': + this._keyUpToolbox(keyCode); + break; + case 'equipbox': + this._keyUpEquipbox(keyCode, altKey); + break; + case 'save': + case 'load': + case 'replayLoad': + case 'replayRemain': + case 'replaySince': + this._keyUpSL(keyCode); + break; + case 'keyBoard': + ok() && core.closePanel(); + break; + case 'switchs': + this._keyUpSwitchs(keyCode); + break; + case 'switchs-sounds': + this._keyUpSwitchs_sounds(keyCode); + break; + case 'switchs-display': + this._keyUpSwitchs_display(keyCode); + break; + case 'switchs-action': + this._keyUpSwitchs_action(keyCode); + break; + case 'settings': + this._keyUpSettings(keyCode); + break; + case 'notes': + this._keyUpNotes(keyCode); + break; + case 'syncSave': + this._keyUpSyncSave(keyCode); + break; + case 'syncSelect': + this._keyUpSyncSelect(keyCode); + break; + case 'localSaveSelect': + this._keyUpLocalSaveSelect(keyCode); + break; + case 'storageRemove': + this._keyUpStorageRemove(keyCode); + break; + case 'cursor': + this._keyUpCursor(keyCode); + break; + case 'replay': + this._keyUpReplay(keyCode); + break; + case 'gameInfo': + this._keyUpGameInfo(keyCode); + break; + case 'shuangta': + this._keyUpShuangta(keyCode); + break; + case 'rm': + this._keyUpRM(keyCode); + break; + case 'centerFly': + this._keyUpCenterFly(keyCode); + break; + } + return true; + } + core.actions._sys_ondown_lockControl = function (x, y, px, py) { + if (core.status.played && !core.status.lockControl) return false; + + switch (core.status.event.id) { + case 'centerFly': + this._clickCenterFly(x, y, px, py); + break; + case 'book': + this._clickBook(x, y, px, py); + break; + case 'book-detail': + this._clickBookDetail(x, y, px, py); + break; + case 'fly': + this._clickFly(x, y, px, py); + break; + case 'viewMaps': + this._clickViewMaps(x, y, px, py); + break; + case 'switchs': + this._clickSwitchs(x, y, px, py); + break; + case 'switchs-sounds': + this._clickSwitchs_sounds(x, y, px, py); + break; + case 'switchs-display': + this._clickSwitchs_display(x, y, px, py); + break; + case 'switchs-action': + this._clickSwitchs_action(x, y, px, py); + break; + case 'settings': + this._clickSettings(x, y, px, py); + break; + case 'selectShop': + this._clickQuickShop(x, y, px, py); + break; + case 'equipbox': + this._clickEquipbox(x, y, px, py); + break; + case 'toolbox': + this._clickToolbox(x, y, px, py); + break; + case 'save': + case 'load': + case 'replayLoad': + case 'replayRemain': + case 'replaySince': + this._clickSL(x, y, px, py); + break; + case 'confirmBox': + this._clickConfirmBox(x, y, px, py); + break; + case 'keyBoard': + this._clickKeyBoard(x, y, px, py); + break; + case 'action': + this._clickAction(x, y, px, py); + break; + case 'text': + core.drawText(); + break; + case 'notes': + this._clickNotes(x, y, px, py); + break; + case 'syncSave': + this._clickSyncSave(x, y, px, py); + break; + case 'syncSelect': + this._clickSyncSelect(x, y, px, py); + break; + case 'localSaveSelect': + this._clickLocalSaveSelect(x, y, px, py); + break; + case 'storageRemove': + this._clickStorageRemove(x, y, px, py); + break; + case 'cursor': + this._clickCursor(x, y, px, py); + break; + case 'replay': + this._clickReplay(x, y, px, py); + break; + case 'gameInfo': + this._clickGameInfo(x, y, px, py); + break; + case 'shuangta': + this._clickShuangta(x, y, px, py); + break; + case 'RM': + this._clickRM(x, y, px, py); + break; + case 'about': + case 'help': + core.ui.closePanel(); + break; + } + + // --- 长按判定 + if (core.timeout.onDownTimeout == null) { + core.timeout.onDownTimeout = setTimeout(function () { + if (core.interval.onDownInterval == null) { + core.interval.onDownInterval = setInterval(function () { + if (!core.actions.longClick(x, y, px, py)) { + clearInterval(core.interval.onDownInterval); + core.interval.onDownInterval = null; + } + }, 40) + } + }, 500); + } + return true; + } + core.actions._sys_onmove_choices = function (x, y, px, py) { + if (!core.status.lockControl) return false; + + switch (core.status.event.id) { + case 'action': + if (core.status.event.data.type == 'choices') { + this._onMoveChoices(x, y); + return true; + } + if (core.status.event.data.type == 'confirm') { + this._onMoveConfirmBox(x, y, px, py); + return true; + } + break; + case 'selectShop': + case 'switchs': + case 'switchs-sounds': + case 'switchs-display': + case 'switchs-action': + case 'notes': + case 'settings': + case 'syncSave': + case 'syncSelect': + case 'localSaveSelect': + case 'storageRemove': + case 'replay': + case 'gameInfo': + case 'shuangta': + case 'rm': + this._onMoveChoices(x, y); + return true; + case 'confirmBox': + this._onMoveConfirmBox(x, y, px, py); + return true; + default: + break; + } + return false; + } + core.actions._keyUpShuangta = function (keycode) { + if (keycode == 27 || keycode == 88) { + core.status.event.selection = 8; + core.playSound('取消'); + return core.ui._drawSettings(); + } + this._selectChoices(core.status.event.ui.choices.length, keycode, this._clickShuangta); + } + core.actions._clickShuangta = function (x, y) { + if (this._out(x)) return; + var choices = core.status.event.ui.choices; + + var topIndex = this._getChoicesTopIndex(choices.length); + + if (y >= topIndex && y < topIndex + choices.length) { + var selection = y - topIndex; + core.status.event.selection = selection; + switch (selection) { + case 0: + core.setFlag("itemDetail", !core.getFlag("itemDetail")); + core.ui._drawShuangta(); + break; + case 1: + core.setFlag("__autoGetItem__", !core.getFlag("__autoGetItem__")); + core.ui._drawShuangta(); + break; + case 2: + core.setFlag("__autoBattle__", !core.getFlag("__autoBattle__")); + core.ui._drawShuangta(); + break; + case 3: + core.status.event.selection = 8; + core.playSound('取消'); + core.ui._drawSettings(); + break; + } + } + } + core.actions._keyUpRM = function (keycode) { + if (keycode == 27 || keycode == 88) { + core.status.event.selection = 9; + core.playSound('取消'); + return core.ui._drawSettings(); + } + this._selectChoices(core.status.event.ui.choices.length, keycode, this._clickRM); + } + core.actions._clickRM = function (x, y) { + if (this._out(x)) return; + var choices = core.status.event.ui.choices; + + var topIndex = this._getChoicesTopIndex(choices.length); + + if (y >= topIndex && y < topIndex + choices.length) { + var selection = y - topIndex; + core.status.event.selection = selection; + switch (selection) { + case 0: + core.setFlag("isRmFly", !core.getFlag("isRmFly")); + core.ui._drawRM(); + break; + case 1: + core.setFlag("isDamageRight", !core.getFlag("isDamageRight")); + core.updateStatusBar(); + core.ui._drawRM(); + break; + case 2: + core.setFlag("isZeroWhite", !core.getFlag("isZeroWhite")); + core.updateStatusBar(); + core.ui._drawRM(); + break; + case 3: + core.setFlag("isNoTip", !core.getFlag("isNoTip")); + core.ui._drawRM(); + break; + case 4: + core.setFlag("isCommon", !core.getFlag("isCommon")); + core.ui._drawRM(); + break; + case 5: + core.status.event.selection = 9; + core.playSound('取消'); + core.ui._drawSettings(); + break; + } + } + } + core.actions.registerAction('keyDown', '_sys_keyDown_lockControl', core.actions._sys_keyDown_lockControl, 50); + core.actions.registerAction('keyUp', '_sys_keyUp_lockControl', core.actions._sys_keyUp_lockControl, 50); + core.actions.registerAction('ondown', '_sys_ondown_lockControl', core.actions._sys_ondown_lockControl, 30); + core.actions.registerAction('onmove', '_sys_onmove_choices', core.actions._sys_onmove_choices, 30); + @@ -690,7 +1126,9 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = top + 28, '#ffffff', this._buildFont(enemy.name.length >= 5 ? 18 : 20, false), width); /////修改怪物名字颜色,取消加粗 switch (enemy.specialText.length) { case 1: - core.fillText('ui', enemy.specialText[0][0] + ' ' + enemy.specialText[0][1], left + width / 2, ////单属性两个字中间空一格 + core.fillText('ui', ((!core.getFlag('isCommon') || (2 != enemy.specialText[0].length)) + ? enemy.specialText[0] : enemy.specialText[0][0] + ' ' + enemy.specialText[0][1]), + left + width / 2, ////单属性两个字中间空一格 top + 50, core.arrayToRGBA((enemy.specialColor || [])[0] || '#FF6A6A'), this._buildFont(20, false), width); ////调大怪物字号,取消加粗 break; @@ -2957,7 +3395,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = // *** 下一句话可以更改你想要的显示字体 core.setFont(ctx, "bold 11px Arial"); // *** - core.setTextAlign(ctx, "right"); + core.setTextAlign(ctx, core.getFlag("isDamageRight") ? "right" : "left"); core.status.damage.data.forEach(function (one) { var px = one.px, py = one.py; @@ -2967,7 +3405,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = if (px < -32 * 2 || px > core.__PX__ + 32 || py < -32 || py > core.__PY__ + 32) return; } - core.fillBoldText(ctx, one.text, px + 32, py, one.color); + core.fillBoldText(ctx, one.text, px + (core.getFlag("isDamageRight") ? 32 : 0), py, one.color); }); core.setTextAlign(ctx, 'center'); core.status.damage.extraData.forEach(function (one) { @@ -3360,7 +3798,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = } } if (special === 0) { - text.push('普通'); ///////无特殊属性时增加“普通”属性显示 + if (core.getFlag('isCommon')) text.push('普通'); ///////无特殊属性时增加“普通”属性显示 } return text; }