// DarkPlasma_FixEquip 1.0.2 // Copyright (c) 2020 DarkPlasma // This software is released under the MIT license. // http://opensource.org/licenses/mit-license.php /** * 2021/07/05 1.0.2 MZ 1.3.2に対応 * 2021/06/22 1.0.1 サブフォルダからの読み込みに対応 * 2020/10/30 1.0.0 公開 */ /*: @target MZ @url https://github.com/elleonard/DarkPlasma-MZ-Plugins/tree/release @plugindesc Realize fixed equipment mode @author DarkPlasma @license MIT @help English Help Translator: munokura This is an unofficial English translation of the plugin help, created to support global RPG Maker users. Feedback is welcome to improve translation quality (see: https://github.com/munokura/DarkPlasma-MZ-Plugins ). Original plugin by DarkPlasma. Please check the latest official version at: https://github.com/elleonard/DarkPlasma-MZ-Plugins/tree/release ----- Version: 1.0.2 Implements a fixed equipment mode. Register a pair of a switch and a list of equipment types in the plugin parameters. When a registered switch is turned ON, the corresponding equipment type cannot be changed. @param fixEquips @text Fixed equipment settings @desc Set a pair of switch and equipment type list. @type struct[] @default [] */ /*:ja @plugindesc 装備固定モードを実現する @author DarkPlasma @license MIT @target MZ @url https://github.com/elleonard/DarkPlasma-MZ-Plugins/tree/release @param fixEquips @desc スイッチと装備タイプ一覧の組を設定します。 @text 固定装備設定 @type struct[] @default [] @help version: 1.0.2 装備固定モードを実現します。 プラグインパラメータにスイッチと装備タイプ一覧の組を登録し、 登録したスイッチをONにすると、対応する装備タイプが変更できなくなります。 */ (() => { 'use strict'; const pluginName = document.currentScript.src.replace(/^.*\/(.*).js$/, function () { return arguments[1]; }); const pluginParametersOf = (pluginName) => PluginManager.parameters(pluginName); const pluginParameters = pluginParametersOf(pluginName); const settings = { fixEquips: JSON.parse(pluginParameters.fixEquips || '[]').map((e) => { return ((parameter) => { const parsed = JSON.parse(parameter); return { switchId: Number(parsed.switchId || 0), equipTypes: JSON.parse(parsed.equipTypes || '[]').map((e) => { return Number(e || 0); }), }; })(e || '{}'); }), }; const _Game_Actor_isEquipChangeOk = Game_Actor.prototype.isEquipChangeOk; Game_Actor.prototype.isEquipChangeOk = function (slotId) { return _Game_Actor_isEquipChangeOk.call(this, slotId) && !this.isEquipTypeFixed(this.equipSlots()[slotId]); }; Game_Actor.prototype.isEquipTypeFixed = function (etypeId) { return settings.fixEquips .filter((fixEquip) => fixEquip.switchId > 0 && $gameSwitches.value(fixEquip.switchId)) .some((fixEquip) => fixEquip.equipTypes.includes(etypeId)); }; })();