code
stringlengths
0
56.1M
repo_name
stringclasses
515 values
path
stringlengths
2
147
language
stringclasses
447 values
license
stringclasses
7 values
size
int64
0
56.8M
// // 汎用ポップアップコア ver1.05 // // ------------------------------------------------------ // Copyright (c) 2016 Yana // Released under the MIT license // http://opensource.org/licenses/mit-license.php // ------------------------------------------------------ // // author Yana // var Imported = Imported || {}; Imported['CommonPopupCore'] = 1.05; /*: * @plugindesc ver1.05/汎用的なポップアップの仕組みを提供するためのベースプラグインです。 * @author Yana * * @param Text Back Color * @desc ポップアップの背景カラーです。 * rgba(red,green,blue,alpha)で設定してください。 * @default rgba(0,0,0,0.6) * * @param Text Back FileName * @desc ポップアップの背景画像名です。 * %dがインデックスに変換されます。 * @default popup_back%d * * @help プラグインコマンド * CommonPopup add param1 param2 param3 ・・・ * * 必要なパラメータのみを指定できます。 * 例:プレイヤーの上にテストと240フレームポップアップさせる * CommonPopup add text:テスト count:240 eventId:-1 * * パラメータ詳細: * text:表示テキスト * eventId:表示するイベントのID * count:表示時間 * delay:表示遅延 * moveX:目標地点X(相対座標) * moveY:目標地点Y(相対座標) * sx:表示位置補正X * sy:表示位置補正Y * pattern:表示パターン 0がフェード、-1が横ストレッチ、-2が縦ストレッチ * back:-1:透明背景,0:背景カラーで塗りつぶし,1以上:画像インデックス * bx:内容の表示位置補正X * by:内容の表示位置補正Y * extend:表示タイミングの調整用配列で指定。 例:extend:[20,50] 20フレーム掛けて出現し、50フレーム目から消え始める。 * fixed:画面に固定するか? true/falseで指定。 * anchorX: * anchorY: * slideCount:新しいポップアップが発生した際、上にスライドさせる速度。 * * ------------------------------------------------------ * 利用規約 * ------------------------------------------------------ * 当プラグインはMITライセンスで公開されています。 * 使用に制限はありません。商用、アダルト、いずれにも使用できます。 * 二次配布も制限はしませんが、サポートは行いません。 * 著作表示は任意です。行わなくても利用できます。 * 要するに、特に規約はありません。 * バグ報告や使用方法等のお問合せはネ実ツクールスレ、または、Twitterにお願いします。 * https://twitter.com/yanatsuki_ * 素材利用は自己責任でお願いします。 * ------------------------------------------------------ * このプラグインは、汎用的なポップアップの仕組みを提供するプラグインです。 * このプラグイン単体ではプラグインコマンドを追加する以外の機能はありません。 * 追加機能として、 * ・\I[x]で描画されるアイコンのサイズが文字サイズに追従する。 * ・文字サイズ変更の制御文字、\FS[x]が追加される。 * の2点が追加されます。 * ------------------------------------------------------ * 更新履歴: * ver1.05:170525 * ポップアップ発生時にSEを再生する機能を追加。 * ver1.04 * YEP_MessageCoreとの競合回避処理を追加。 * 動作パターンに縦ストレッチと横ストレッチを追加。 * ポップアップ用のプラグインパラメータが正常に動作していなかったバグを修正。 * ver1.03: * backのパラメータにpicturesフォルダのファイル名を指定できるように変更。 * ver1.02: * スライドに上から下に動作するようにする機能を追加。 * ver1.01: * containerが作成されていない状態で、ポップアップが登録される可能性のあるバグを修正しました。 * ver1.00: * 公開 */ function Sprite_Popup() { this.initialize.apply(this, arguments); }; function CommonPopupManager() { throw new Error('This is a static class'); }; (function () { var parameters = PluginManager.parameters('CommonPopupCore'); var commonPopupTextBackColor = String(parameters['Text Back Color'] || 'rgba(0, 0, 0, 0.6)'); var commonPopupTextBackFileName = String(parameters['Text Back FileName'] || 'popup_back%d'); var _cPU_GInterpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand; Game_Interpreter.prototype.pluginCommand = function (command, args) { _cPU_GInterpreter_pluginCommand.call(this, command, args); if (command === 'CommonPopup' || command === 'ポップアップ') { switch (args[0]) { case 'add': case '表示': this.addPopup(args); break; case 'clear': case '消去': CommonPopupManager.clearPopup(); break; } } }; Array.prototype.setNullPos = function (object) { for (var i = 0; i < this.length; i++) { if (this[i] === null || this[i] === undefined) { this[i] = object; return i; } } this.push(object); }; Array.prototype.compact = function () { var result = []; for (var i = 0; i < this.length; i++) { if (this[i] !== null && this[i] !== undefined) { result.push(this[i]); } } return result; }; CommonPopupManager.initTempSprites = function () { this._tempCommonSprites = new Array(50); this._setedPopups = []; this._readyPopup = []; }; CommonPopupManager.window = function () { if (this._window) { return this._window } this._window = new Window_Base(0, 0, Graphics.boxWidth, Graphics.boxHeight); return this._window; }; CommonPopupManager.testBitmap = function () { if (this._testBitmap) { return this._testBitmap } this._testBitmap = new Bitmap(1, 1); return this._testBitmap; }; Sprite_Popup.prototype = Object.create(Sprite.prototype); Sprite_Popup.prototype.constructor = Sprite_Popup; Sprite_Popup.prototype.initialize = function (index) { Sprite.prototype.initialize.call(this); this._index = index; this._count = 0; this._enable = false; this.update(); }; Sprite_Popup.prototype.setMembers = function (arg) { this._count = arg.count; this._arg = arg; this.anchor.x = arg.anchorX; this.anchor.y = arg.anchorY; this.x = arg.x; this.y = arg.y; this.z = 6; this.visible = true; this._enable = true; this.createBitmap(); if (arg.slideCount) { CommonPopupManager._setedPopups.push([this._index, this.height, this._arg.slideCount]); } }; Sprite_Popup.prototype.createBitmap = function () { if (this._arg.bitmap) { this.bitmap = this._arg.bitmap; } else { CommonPopupManager.window().resetFontSettings(); var text = this._arg.text; var width = CommonPopupManager.window().textWidth(text); var height = CommonPopupManager.window().contents.fontSize + 8; var sh = 8; if (this._arg.back === 0) { sh = 2 } CommonPopupManager.window().createContents(); this.bitmap = new Bitmap(width + 24, height + sh); this.drawBackRect(width + 24, height + sh); CommonPopupManager.window().drawTextEx(this._arg.text, 12, 4); this.bitmap.blt(CommonPopupManager.window().contents, 0, 0, width + 24, height + sh, this._arg.bx, this._arg.by + 2); } }; Sprite_Popup.prototype.drawBackRect = function (width, height) { switch (this._arg.back) { case 0: var color1 = commonPopupTextBackColor; var color2 = 'rgba(0,0,0,0)'; var dSize = width / 4; this.bitmap.gradientFillRect(0, 0, dSize, height, color2, color1); this.bitmap.fillRect(dSize, 0, dSize * 2, height, color1); this.bitmap.gradientFillRect(dSize * 3, 0, dSize, height, color1, color2); break; case -1: break; default: var bitmap = CommonPopupManager.makeBitmap(this._arg); var w = this._bitmap.width; var h = this._bitmap.height; if (typeof this._arg.back === 'string') { w = bitmap.width > this._bitmap.width ? bitmap.width : w; h = bitmap.height > this._bitmap.height ? bitmap.height : h; if (w > this._bitmap.width || h > this._bitmap.height) { this.bitmap = new Bitmap(w, h); } } this.bitmap.blt(bitmap, 0, 0, bitmap.width, bitmap.height, 0, 0, w, h); bitmap.clear(); bitmap = null; } }; Sprite_Popup.prototype.update = function () { Sprite.prototype.update.call(this); if (CommonPopupManager._tempCommonSprites[this._index] && !this._enable) { if (CommonPopupManager._tempCommonSprites[this._index].delay === 0) { this.setMembers(CommonPopupManager._tempCommonSprites[this._index]); if (this._arg && this._arg.se.name) AudioManager.playSe(this._arg.se); } else { CommonPopupManager._tempCommonSprites[this._index].delay--; } } if (this._count > 0) { this._count--; if (!this._arg) { this.terminate; return; } switch (this._arg.pattern) { case 0: case '0': case 'Normal': this.updateSlide(); break; case -1: case '-1': case 'Stretch': this.updateTurn(); break; case -2: case '-2': case 'GrowUp': this.updateGrowUp(); break; default: this.updateAnime(); } if (this._count === 0) { this.terminate() } } if (this._arg && this._arg.slideCount) { this.updateMoveSlide() } }; Sprite_Popup.prototype.updateMoveSlide = function () { if (CommonPopupManager._setedPopups) { var array = CommonPopupManager._setedPopups.clone().reverse(); var n = 0; for (var i = 0; i < array.length; i++) { if (this._index === array[i][0]) { if (this._arg.slideAction === 'Down') { this.y = this.y + n; } else { this.y = this.y - n; } } var sprite = CommonPopupManager._tempCommonSprites[array[i][0]]; if (sprite.pattern === -2 || sprite.pattern === 'GrowUp') { n += (array[i][1] * sprite.rate); } else { n += (array[i][1] * ((this._arg.slideCount - array[i][2]) / this._arg.slideCount)); } } for (var i = 0; i < CommonPopupManager._setedPopups.length; i++) { CommonPopupManager._setedPopups[i][2]--; if (CommonPopupManager._setedPopups[i][2] < 0) { CommonPopupManager._setedPopups[i][2] = 0 } } array = null; } }; Sprite_Popup.prototype.updateSlide = function () { var originalWait = this._arg.count; var cnt = originalWait - this._count; this.opacity = 255; var act = [originalWait / 4, (originalWait * 3) / 4]; if (this._arg.extend !== '') { act = this._arg.extend } var oa = Math.max(originalWait - act[1], 1); var n1 = Math.max(originalWait / oa, 0.1); var up = (this._arg.moveY / (originalWait / n1)); var slide = (this._arg.moveX / (originalWait / n1)); var opTime1 = originalWait / 3.0; var moveX = 0; var moveY = 0; if (act[2]) { opTime1 = originalWait - act[2] } var opTime2 = originalWait / 3.0; if (act[3]) { opTime2 = act[3] } if (this._count >= act[1]) { this.opacity = Math.floor(255 * (cnt / opTime1)); moveY = Math.floor(up * cnt); moveX = Math.floor(slide * cnt); } else if (this._count < act[0]) { this.opacity = Math.floor(255 * (this._count / opTime2)); moveY = Math.floor((originalWait / n1) * up); moveX = Math.floor((originalWait / n1) * slide); } else { moveY = Math.floor((originalWait / n1) * up); moveX = Math.floor((originalWait / n1) * slide); } this._times = cnt; this.setPosition(moveX, moveY); }; Sprite_Popup.prototype.updateTurn = function () { var originalWait = this._arg.count; var cnt = originalWait - this._count; var act = [originalWait * 0.25, originalWait * 0.75]; if (this._arg.extend) act = this._arg.extend; if (this._count === 0) this.scale.x = 0; var oa = Math.max(originalWait - act[1], 1); var n1 = Math.max(originalWait / oa, 0.1); var up = (this._arg.moveY / (originalWait / n1)); var slide = (this._arg.moveX / (originalWait / n1)); var moveX = 0; var moveY = 0; if (this._count >= act[1]) { var rate = cnt / (originalWait - act[1]); this.scale.x = rate; moveY = Math.floor(up * cnt); moveX = Math.floor(slide * cnt); } else if (this._count < act[0]) { var rate = this._count / act[0]; this.scale.x = rate; moveY = Math.floor((originalWait / n1) * up); moveX = Math.floor((originalWait / n1) * slide); } else { moveY = Math.floor((originalWait / n1) * up); moveX = Math.floor((originalWait / n1) * slide); } this._times = cnt; this.setPosition(moveX, moveY); }; Sprite_Popup.prototype.updateGrowUp = function () { var originalWait = this._arg.count; var cnt = originalWait - this._count; var act = [originalWait * 0.25, originalWait * 0.75]; if (this._arg.extend) act = this._arg.extend; if (this._count === 0) this.scale.y = 0; var oa = Math.max(originalWait - act[1], 1); var n1 = Math.max(originalWait / oa, 0.1); var up = (this._arg.moveY / (originalWait / n1)); var slide = (this._arg.moveX / (originalWait / n1)); var moveX = 0; var moveY = 0; if (this._count >= act[1]) { var rate = cnt / (originalWait - act[1]); this.scale.y = rate; moveY = Math.floor(up * cnt); moveX = Math.floor(slide * cnt); this._arg.rate = rate; } else if (this._count < act[0]) { var rate = this._count / act[0]; this.scale.y = rate; moveY = Math.floor((originalWait / n1) * up); moveX = Math.floor((originalWait / n1) * slide); this._arg.rate = rate; } else { moveY = Math.floor((originalWait / n1) * up); moveX = Math.floor((originalWait / n1) * slide); } this._times = cnt; this.setPosition(moveX, moveY); }; Sprite_Popup.prototype.setPosition = function (x, y) { this.x = this._arg.x + x + this._arg.sx; this.y = this._arg.y + y + this._arg.sy; if (this._arg.battler) { if ($gameParty.inBattle()) { this.x += this._arg.battler.x; this.y += this._arg.battler.y; } else { this.x += this._arg.battler._realX * $gameMap.tileWidth(); this.y += this._arg.battler._realY * $gameMap.tileHeight(); } } var xx = this.x; var yy = this.y; if (this._arg.fixed) { var dx = $gameMap._displayX; var dy = $gameMap._displayY; xx = this.x - dx * $gameMap.tileWidth(); yy = this.y - dy * $gameMap.tileHeight(); if (xx < 0 || yy < 0) { if (xx < 0 && $gameMap.isLoopHorizontal()) dx -= $dataMap.width; if (yy < 0 && $gameMap.isLoopVertical()) dy -= $dataMap.height; xx = this.x - dx * $gameMap.tileWidth(); yy = this.y - dy * $gameMap.tileHeight(); } } this.x = xx; this.y = yy; }; Sprite_Popup.prototype.updateAnime = function () { var anime = $dataAnimations[Number(this._arg.pattern)]; var frameId = Math.floor((anime.frames.length * (this._arg.count - this._count)) / this._arg.count); if (frameId !== anime.frames.length) { var array = anime.frames[frameId][0]; var x = array[1]; var y = array[2]; this.x = this._arg.x + x + this._arg.sx; this.y = this._arg.y + y + this._arg.sy; this.scale = new Point(array[3] / 100, array[3] / 100); this.rotation = array[4]; this.opacity = array[6]; this.blendMode = array[7]; } }; Sprite_Popup.prototype.terminate = function () { this.bitmap = null; this.visible = false; this._enable = false; this._count = 0; this._arg = null; if (CommonPopupManager._tempCommonSprites[this._index]) { CommonPopupManager._tempCommonSprites[this._index].terminate = true; } if (CommonPopupManager._setedPopups) { for (var i = 0; i < CommonPopupManager._setedPopups.length; i++) { if (CommonPopupManager._setedPopups[i][0] === this._index) { delete CommonPopupManager._setedPopups[i]; } } CommonPopupManager._setedPopups = CommonPopupManager._setedPopups.compact(); } }; Game_Interpreter.prototype.addPopup = function (argParam) { var eventId = 0; for (var i = 0; i < argParam.length; i++) { if (argParam[i].match(/^eventId:(.+)/g)) { eventId = Number(RegExp.$1); break; } } var character = this.character(eventId); var arg = CommonPopupManager.setPopup(argParam, character); if (arg.back > 0 || typeof arg.back === 'string') { CommonPopupManager.bltCheck(CommonPopupManager.makeBitmap(arg)); CommonPopupManager._readyPopup.push(arg); } else { CommonPopupManager._tempCommonSprites.setNullPos(arg); } }; CommonPopupManager.setPopup = function (argParam, character) { var arg = { x: null, y: null, text: '', // 表示テキスト eventId: -1, // 表示するイベントのID count: 60, // 表示時間 delay: 0, // 表示遅延 moveX: 0, // 目標地点X(相対座標) moveY: -48, // 目標地点Y(相対座標) sx: 0, // 表示位置補正X sy: 0, // 表示位置補正Y pattern: 0, // 表示パターン back: -1, // 背景に使う画像インデックス bx: 0, // 内容の表示位置補正X by: 0, // 内容の表示位置補正Y extend: '', // fixed: true, // anchorX: 0.5, anchorY: 0.5, battler: null, se: { name: '', volume: 90, pitch: 100, pan: 0 } }; var array = ['x', 'y', 'text', 'eventId', 'count', 'delay', 'moveX', 'moveY', 'sx', 'sy', 'pattern', 'back', 'bx', 'by', 'extend', 'fixed', 'anchorX', 'anchorY', 'slideCount']; for (var i = 0; i < argParam.length; i++) { if (i > 0) { for (var j = 0; j < array.length; j++) { var r = new RegExp('^(' + array[j] + ')' + ':(.+)'); if (argParam[i].match(r)) { var code = RegExp.$1; var value = RegExp.$2; if (code === 'text' || code === 'extend') { arg[code] = value; } else if (code === 'fixed') { arg[code] = value === 'true'; } else if (code === 'back') { arg[code] = (Number(value) !== NaN) ? value : Number(value); } else { arg[code] = Number(value); } } } } } if (arg.x === null) { if (character) { var screenX = $gameParty.inBattle() ? 0 : character.screenX(); var displayX = $gameParty.inBattle() ? 0 : $gameMap._displayX * 48; arg.x = screenX + displayX; } else { arg.x = 0; } } if (arg.y === null) { if (character) { var screenY = $gameParty.inBattle() ? 0 : character.screenY(); var displayY = $gameParty.inBattle() ? 0 : $gameMap._displayY * 48; arg.y = screenY + displayY; } else { arg.y = 0; } } if (arg.extend) { arg.extend = eval(arg.extend); } arg.terminate = false; return arg; }; CommonPopupManager.setPopUpdate = function () { if (this._readyPopup) { for (var i = 0; i < this._readyPopup.length; i++) { if (this._readyPopup[i]) { var arg = this._readyPopup[i]; if (ImageManager.isReady()) { this.startPopup(arg); delete this._readyPopup[i]; this._readyPopup.compact(); return; } else { this.bltCheck(this.makeBitmap(arg)); } } } } }; CommonPopupManager.makeBitmap = function (arg) { if (typeof arg.back === 'number') { var fileName = commonPopupTextBackFileName; fileName = fileName.replace(/%d/g, arg.back); return ImageManager.loadSystem(fileName); } else { var fileName = arg.back; return ImageManager.loadPicture(fileName); } }; CommonPopupManager.bltCheck = function (bitmap) { this.testBitmap().blt(bitmap, 0, 0, bitmap.width, bitmap.height, 0, 0); //this.testBitmap().clear(); //bitmap.clear(); bitmap = null; }; CommonPopupManager.startPopup = function (arg) { CommonPopupManager._tempCommonSprites.setNullPos(arg); }; CommonPopupManager.clearPopup = function (tag) { if (!CommonPopupManager._tempCommonSprites) { CommonPopupManager.initTempSprites(); } for (var i = 0; i < CommonPopupManager._tempCommonSprites.length; i++) { if (CommonPopupManager._tempCommonSprites[i]) { if (!tag || tag === CommonPopupManager._tempCommonSprites[i].tag) { CommonPopupManager._tempCommonSprites[i].delay = 0; CommonPopupManager._tempCommonSprites[i].count = 1; var sprite = CommonPopupManager._tempCommonSprites[i].sprite; if (sprite) sprite._count = 1; } } } }; var _cPU_SsBase_initialize = Spriteset_Base.prototype.initialize; Spriteset_Base.prototype.initialize = function () { _cPU_SsBase_initialize.call(this); this.createSpritePopup(); }; var _cPU_SsBase_update = Spriteset_Base.prototype.update; Spriteset_Base.prototype.update = function () { _cPU_SsBase_update.call(this); if (this._popupContainer === undefined) { return } if (CommonPopupManager._tempCommonSprites) { for (var i = 0; i < CommonPopupManager._tempCommonSprites.length; i++) { if (CommonPopupManager._tempCommonSprites[i]) { if (CommonPopupManager._tempCommonSprites[i].terminate) { var sprite = CommonPopupManager._tempCommonSprites[i].sprite; this._popupContainer.removeChild(sprite); delete CommonPopupManager._tempCommonSprites[i] } else if (!CommonPopupManager._tempCommonSprites[i].sprite) { var sprite = new Sprite_Popup(i); this._popupContainer.addChild(sprite); CommonPopupManager._tempCommonSprites[i].sprite = sprite; } } } } }; var _cPU_SBase_update = Scene_Base.prototype.update; Scene_Base.prototype.update = function () { _cPU_SBase_update.call(this); if (CommonPopupManager) { CommonPopupManager.setPopUpdate() }; }; Spriteset_Base.prototype.createSpritePopup = function () { var width = Graphics.boxWidth; var height = Graphics.boxHeight; var x = (Graphics.width - width) / 2; var y = (Graphics.height - height) / 2; this._popupContainer = new Sprite(); this._popupContainer.setFrame(x, y, width, height); this.addChild(this._popupContainer); }; var _cPU_SBase_terminate = Scene_Base.prototype.terminate; Scene_Base.prototype.terminate = function () { _cPU_SBase_terminate.call(this); this.terminatePopup(); }; Scene_Base.prototype.terminatePopup = function () { if (!CommonPopupManager._tempCommonSprites) { CommonPopupManager.initTempSprites(); } for (var i = 0; i < CommonPopupManager._tempCommonSprites.length; i++) { if (CommonPopupManager._tempCommonSprites[i]) { var sprite = CommonPopupManager._tempCommonSprites[i].sprite; if (sprite) sprite.terminate(); delete CommonPopupManager._tempCommonSprites[i]; } } CommonPopupManager._setedPopupss = []; CommonPopupManager._readyPopup = []; }; var _cPU_SMap_launchBattle = Scene_Map.prototype.launchBattle; Scene_Map.prototype.launchBattle = function () { _cPU_SMap_launchBattle.call(this); this.terminatePopup(); }; // 再定義 文字サイズに合わせてアイコンのサイズを調整する Window_Base.prototype.drawIcon = function (iconIndex, x, y) { var bitmap = ImageManager.loadSystem('IconSet'); var pw = Window_Base._iconWidth; var ph = Window_Base._iconHeight; var sx = iconIndex % 16 * pw; var sy = Math.floor(iconIndex / 16) * ph; var n = Math.floor((this.contents.fontSize / this.standardFontSize()) * Window_Base._iconWidth); var nn = (32 - n) / 2; this.contents.blt(bitmap, sx, sy, pw, ph, x, y, n, n); }; // 再定義 processDrawIconをストレッチされた文字サイズに合わせたズレに調整する Window_Base.prototype.processDrawIcon = function (iconIndex, textState) { this.drawIcon(iconIndex, textState.x + 2, textState.y + 2); var n = Math.floor((this.contents.fontSize / this.standardFontSize()) * Window_Base._iconWidth); textState.x += n + 4; }; if (!Imported.YEP_MessageCore) { // \FS[FontSize]の制御文字を追加する部分です。 var _cPU_Window_Base_processEscapeCharacter = Window_Base.prototype.processEscapeCharacter; Window_Base.prototype.processEscapeCharacter = function (code, textState) { if (code === 'FS') { var param = this.obtainEscapeParam(textState); if (param != '') { this.makeFontSize(param) } } else { _cPU_Window_Base_processEscapeCharacter.call(this, code, textState); } }; } Window_Base.prototype.makeFontSize = function (fontSize) { this.contents.fontSize = fontSize; }; })();
dazed/translations
www/js/plugins/CommonPopupCore.js
JavaScript
unknown
29,033
/*: * @plugindesc Plugin used to set basic parameters. * @author RM CoreScript team * * @help This plugin does not provide plugin commands. * * @param cacheLimit * @desc For setting the upper limit of image memory cache. (MPix) * @default 10 * * @param screenWidth * @desc For setting the screen width. * @default 816 * * @param screenHeight * @desc For setting the screen height. * @default 624 * * @param changeWindowWidthTo * @desc If set, change window width to this value * * @param changeWindowHeightTo * @desc If set, change window height to this value * * @param renderingMode * @desc Rendering mode (canvas/webgl/auto) * @default auto * * @param alwaysDash * @desc To set initial value as to whether the player always dashes. (on/off) * @default off */ /*:ja * @plugindesc 基本的なパラメーターを設定するプラグインです。 * @author RM CoreScript team * * @help このプラグインにはプラグインコマンドはありません。 * * @param cacheLimit * @desc 画像のメモリへのキャッシュの上限値 (MPix) * @default 10 * * @param screenWidth * @desc 画面サイズの幅 * @default 816 * * @param screenHeight * @desc 画面サイズの高さ * @default 624 * * @param changeWindowWidthTo * @desc 値が設定された場合、ウインドウの幅を指定した値に変更 * * @param changeWindowHeightTo * @desc 値が設定された場合、ウインドウの高さを指定した値に変更 * * @param renderingMode * @desc レンダリングモード (canvas/webgl/auto) * @default auto * * @param alwaysDash * @desc プレイヤーが常時ダッシュするかどうかの初期値 (on/off) * @default off */ (function () { function toNumber(str, def) { return isNaN(str) ? def : +(str || def); } var parameters = PluginManager.parameters('Community_Basic'); var cacheLimit = toNumber(parameters['cacheLimit'], 10); var screenWidth = toNumber(parameters['screenWidth'], 816); var screenHeight = toNumber(parameters['screenHeight'], 624); var renderingMode = parameters['renderingMode'].toLowerCase(); var alwaysDash = parameters['alwaysDash'].toLowerCase() === 'on'; var windowWidthTo = toNumber(parameters['changeWindowWidthTo'], 0); var windowHeightTo = toNumber(parameters['changeWindowHeightTo'], 0); var windowWidth; var windowHeight; if (windowWidthTo) { windowWidth = windowWidthTo; } else if (screenWidth !== SceneManager._screenWidth) { windowWidth = screenWidth; } if (windowHeightTo) { windowHeight = windowHeightTo; } else if (screenHeight !== SceneManager._screenHeight) { windowHeight = screenHeight; } ImageCache.limit = cacheLimit * 1000 * 1000; SceneManager._screenWidth = screenWidth; SceneManager._screenHeight = screenHeight; SceneManager._boxWidth = screenWidth; SceneManager._boxHeight = screenHeight; SceneManager.preferableRendererType = function () { if (Utils.isOptionValid('canvas')) { return 'canvas'; } else if (Utils.isOptionValid('webgl')) { return 'webgl'; } else if (renderingMode === 'canvas') { return 'canvas'; } else if (renderingMode === 'webgl') { return 'webgl'; } else { return 'auto'; } }; var _ConfigManager_applyData = ConfigManager.applyData; ConfigManager.applyData = function (config) { _ConfigManager_applyData.apply(this, arguments); if (config['alwaysDash'] === undefined) { this.alwaysDash = alwaysDash; } }; var _SceneManager_initNwjs = SceneManager.initNwjs; SceneManager.initNwjs = function () { _SceneManager_initNwjs.apply(this, arguments); if (Utils.isNwjs() && windowWidth && windowHeight) { var dw = windowWidth - window.innerWidth; var dh = windowHeight - window.innerHeight; window.moveBy(-dw / 2, -dh / 2); window.resizeBy(dw, dh); } }; })();
dazed/translations
www/js/plugins/Community_Basic.js
JavaScript
unknown
4,119
//============================================================================= // CustomizeConfigDefault.js // ---------------------------------------------------------------------------- // Copyright (c) 2015 Triacontane // This plugin is released under the MIT License. // http://opensource.org/licenses/mit-license.php // ---------------------------------------------------------------------------- // Version // 1.1.0 2016/08/01 項目自体を非表示にする機能を追加しました。 // 1.0.3 2016/06/22 多言語対応 // 1.0.2 2016/01/17 競合対策 // 1.0.1 2015/11/01 既存コードの再定義方法を修正(内容に変化なし) // 1.0.0 2015/11/01 初版 // ---------------------------------------------------------------------------- // [Blog] : http://triacontane.blogspot.jp/ // [Twitter]: https://twitter.com/triacontane/ // [GitHub] : https://github.com/triacontane/ //============================================================================= /*: * @plugindesc Setting default value for Options * @author triacontane * * @param AlwaysDash * @desc Always dash(ON/OFF) * @default OFF * * @param CommandRemember * @desc Command remember(ON/OFF) * @default OFF * * @param BgmVolume * @desc BGM Volume(0-100) * @default 100 * * @param BgsVolume * @desc BGS Volume(0-100) * @default 100 * * @param MeVolume * @desc ME Volume(0-100) * @default 100 * * @param SeVolume * @desc SE Volume(0-100) * @default 100 * * @param EraseAlwaysDash * @desc Erase AlwaysDash Option(ON/OFF) * @default OFF * * @param EraseCommandRemember * @desc Erase CommandRemember Option(ON/OFF) * @default OFF * * @param EraseBgmVolume * @desc Erase BgmVolume Option(ON/OFF) * @default OFF * * @param EraseBgsVolume * @desc Erase BgsVolume Option(ON/OFF) * @default OFF * * @param EraseMeVolume * @desc Erase MeVolume Option(ON/OFF) * @default OFF * * @param EraseSeVolume * @desc Erase SeVolume Option(ON/OFF) * @default OFF * * @help Setting default value for Options. * * This plugin is released under the MIT License. */ /*:ja * @plugindesc オプションデフォルト値設定プラグイン * @author トリアコンタン * * @param 常時ダッシュ * @desc 常にダッシュする。(Shiftキーを押している場合のみ歩行)(ON/OFF) * @default OFF * * @param コマンド記憶 * @desc 選択したコマンドを記憶する。(ON/OFF) * @default OFF * * @param BGM音量 * @desc BGMの音量。0-100 * @default 100 * * @param BGS音量 * @desc BGSの音量。0-100 * @default 100 * * @param ME音量 * @desc MEの音量。0-100 * @default 100 * * @param SE音量 * @desc SEの音量。0-100 * @default 100 * * @param 常時ダッシュ消去 * @desc 常時ダッシュの項目を非表示にする。(ON/OFF) * @default OFF * * @param コマンド記憶消去 * @desc コマンド記憶の項目を非表示にする。(ON/OFF) * @default OFF * * @param BGM音量消去 * @desc BGM音量の項目を非表示にする。(ON/OFF) * @default OFF * * @param BGS音量消去 * @desc BGS音量の項目を非表示にする。(ON/OFF) * @default OFF * * @param ME音量消去 * @desc ME音量の項目を非表示にする。(ON/OFF) * @default OFF * * @param SE音量消去 * @desc SE音量の項目を非表示にする。(ON/OFF) * @default OFF * * @help オプション画面で設定可能な項目のデフォルト値を指定した値に変更します。 * 例えば、初回から常時ダッシュをONにしておけば * プレイヤーが設定を変更する手間を省くことができます。 * この処理はconfig.rpgsaveが未作成の場合にのみ実行されます。 * * また、項目そのものを消去することもできます。 * 例えば、戦闘がないゲームでは「コマンド記憶」等は不要なので消去できます。 * * このプラグインにはプラグインコマンドはありません。 * * 利用規約: * 作者に無断で改変、再配布が可能で、利用形態(商用、18禁利用等) * についても制限はありません。 * このプラグインはもうあなたのものです。 */ (function () { 'use strict'; var pluginName = 'CustomizeConfigDefault'; var getParamNumber = function (paramNames, min, max) { var value = getParamOther(paramNames); if (arguments.length < 2) min = -Infinity; if (arguments.length < 3) max = Infinity; return (parseInt(value, 10) || 0).clamp(min, max); }; var getParamBoolean = function (paramNames) { var value = getParamOther(paramNames); return (value || '').toUpperCase() === 'ON'; }; var getParamOther = function (paramNames) { if (!Array.isArray(paramNames)) paramNames = [paramNames]; for (var i = 0; i < paramNames.length; i++) { var name = PluginManager.parameters(pluginName)[paramNames[i]]; if (name) return name; } return null; }; //============================================================================= // パラメータの取得と整形 //============================================================================= var paramAlwaysDash = getParamBoolean(['AlwaysDash', '常時ダッシュ']); var paramCommandRemember = getParamBoolean(['CommandRemember', 'コマンド記憶']); var paramBgmVolume = getParamNumber(['BgmVolume', 'BGM音量'], 0, 100); var paramBgsVolume = getParamNumber(['BgsVolume', 'BGS音量'], 0, 100); var paramMeVolume = getParamNumber(['MeVolume', 'ME音量'], 0, 100); var paramSeVolume = getParamNumber(['SeVolume', 'SE音量'], 0, 100); var paramEraseAlwaysDash = getParamBoolean(['EraseAlwaysDash', '常時ダッシュ消去']); var paramEraseCommandRemember = getParamBoolean(['EraseCommandRemember', 'コマンド記憶消去']); var paramEraseBgmVolume = getParamBoolean(['EraseBgmVolume', 'BGM音量消去']); var paramEraseBgsVolume = getParamBoolean(['EraseBgsVolume', 'BGS音量消去']); var paramEraseMeVolume = getParamBoolean(['EraseMeVolume', 'ME音量消去']); var paramEraseSeVolume = getParamBoolean(['EraseSeVolume', 'SE音量消去']); //============================================================================= // ConfigManager // それぞれの項目に初期値を与えます。 //============================================================================= var _ConfigManagerApplyData = ConfigManager.applyData; ConfigManager.applyData = function (config) { _ConfigManagerApplyData.apply(this, arguments); if (config.alwaysDash == null) this.alwaysDash = paramAlwaysDash; if (config.commandRemember == null) this.commandRemember = paramCommandRemember; if (config.bgmVolume == null) this.bgmVolume = paramBgmVolume; if (config.bgsVolume == null) this.bgsVolume = paramBgsVolume; if (config.meVolume == null) this.meVolume = paramMeVolume; if (config.seVolume == null) this.seVolume = paramSeVolume; }; //============================================================================= // Window_Options // パラメータを空白にした項目を除去します。 //============================================================================= var _Window_Options_makeCommandList = Window_Options.prototype.makeCommandList; Window_Options.prototype.makeCommandList = function () { _Window_Options_makeCommandList.apply(this, arguments); if (paramEraseAlwaysDash) this.eraseOption('alwaysDash'); if (paramEraseCommandRemember) this.eraseOption('commandRemember'); if (paramEraseBgmVolume) this.eraseOption('bgmVolume'); if (paramEraseBgsVolume) this.eraseOption('bgsVolume'); if (paramEraseMeVolume) this.eraseOption('meVolume'); if (paramEraseSeVolume) this.eraseOption('seVolume'); }; Window_Options.prototype.eraseOption = function (symbol) { for (var i = 0; i < this._list.length; i++) { if (this._list[i].symbol === symbol) { this._list.splice(i, 1); break; } } }; })();
dazed/translations
www/js/plugins/CustomizeConfigDefault.js
JavaScript
unknown
8,294
//============================================================================= // CustomizeConfigItem.js // ---------------------------------------------------------------------------- // (C) 2015 Triacontane // This software is released under the MIT License. // http://opensource.org/licenses/mit-license.php // ---------------------------------------------------------------------------- // Version // 2.4.0 2023/02/16 スクリプトで現在の設定値を取得できるよう修正 // 2.3.0 2021/12/21 項目に余白を設定できる機能を追加 // 2.2.1 2021/08/05 セーブがある状態で隠し項目を追加した時に上手く動作しない問題を修正(by柊菜緒さま) // 2.2.0 2021/03/09 スクリプトが指定されているときに項目決定すると決定SEを演奏するよう修正 // 2.1.2 2020/10/13 Mano_InputConfig.jsと併用したとき、項目を末尾以外に追加すると表示不整合が発生する競合を修正 // 2.1.0 2017/12/15 追加項目のデフォルト項目を含めた並び順を自由に設定できる機能を追加 // 項目名称を日本語化 // 2.0.1 2017/10/15 2.0.0の修正によりスイッチ項目を有効にしたときにゲーム開始するとエラーになる問題を修正 // 2.0.0 2017/09/10 ツクールの型指定機能に対応し、各オプション項目を任意の数だけ追加できる機能を追加 // 1.2.3 2017/06/08 1.2.2の修正により起動できなくなっていた問題を修正 // 1.2.2 2017/05/27 競合の可能性のある記述(Objectクラスへのプロパティ追加)をリファクタリング // 1.2.1 2016/12/08 1.2.0の機能追加以降、デフォルト項目で決定ボタンを押すとエラーになっていた現象を修正 // 1.2.0 2016/12/02 各項目で決定ボタンを押したときに実行されるスクリプトを設定できる機能を追加 // 1.1.1 2016/08/14 スイッチ項目、音量項目の初期値が無効になっていた問題を修正 // 1.1.0 2016/04/29 項目をクリックしたときに項目値が循環するよう修正 // 1.0.0 2016/01/17 初版 // ---------------------------------------------------------------------------- // [Blog] : http://triacontane.blogspot.jp/ // [Twitter]: https://twitter.com/triacontane/ // [GitHub] : https://github.com/triacontane/ //============================================================================= /*: * @plugindesc オプション任意項目作成プラグイン * @author トリアコンタン * * @param 数値項目 * @desc 追加する数値項目のオプション項目情報です。 * @default * @type struct<NumberData>[] * * @param 文字項目 * @desc 追加する文字項目のオプション項目情報です。 * @default * @type struct<StringData>[] * * @param スイッチ項目 * @desc 追加するスイッチ項目のオプション項目情報です。 * @default * @type struct<BooleanData>[] * * @param 音量項目 * @desc 追加する音量項目のオプション項目情報です。 * @default * @type struct<VolumeData>[] * * @help オプション画面に任意の項目を追加します。 * 項目の種類は、以下の四種類があります。 * 不要な項目は値を空に設定してください。 * * ・スイッチ項目: * ON/OFFを選択する項目です。指定した番号のスイッチと値が同期されます。 * オプションから値を設定すれば、それがスイッチに反映され、 * スイッチを変更すれば、オプションの値に反映されます。 * さらに、値はセーブデータ間で共有されます。 * 隠しフラグを設定すると、オプション画面に表示されなくなります。 * ゲームを進めないと出現しない項目などに利用できます。 * 隠しフラグはプラグインコマンドから解除できます。 * * スクリプトは上級者向け項目です。対象にカーソルを合わせて決定ボタンを * 押下すると指定したJavaScriptを実行できます。 * 主に専用の設定画面などの遷移に使用します。 * * ・数値項目: * 数値を選択する項目です。指定した番号の変数と値が同期されます。 * スイッチ項目で指定した内容に加えて、 * 最小値と最大値および一回の入力で変化する値を指定します。 * * ・音量項目: * 音量を選択する項目です。BGMボリュームなどと同じ仕様で * キャラクターごとのボイス音量等に使ってください。 * * ・文字項目: * 文字を選択する項目です。指定した文字の配列から項目を選択します。 * 選択した文字のインデックス(開始位置は0)が変数に設定されます。 * 初期値に設定する値もインデックスです。 * * プラグインコマンド詳細 * イベントコマンド「プラグインコマンド」から実行。 * (パラメータの間は半角スペースで区切る) * * CC_UNLOCK or * オプション任意項目の隠し解除 [項目名] *  指定した項目の隠しフラグを解除します。 * 使用例:CC_UNLOCK 数値項目1 * * 利用規約: * 作者に無断で改変、再配布が可能で、利用形態(商用、18禁利用等) * についても制限はありません。 * このプラグインはもうあなたのものです。 */ /*~struct~NumberData: * @param Name * @text 項目名称 * @desc 項目の名称です。 * @default 数値項目1 * * @param DefaultValue * @text 初期値 * @desc 項目の初期値です。 * @default 0 * @type number * * @param VariableID * @text 変数番号 * @desc 項目の設定内容が格納される変数番号です。 * @default 0 * @type variable * * @param HiddenFlag * @text 隠しフラグ * @desc 項目がデフォルトで隠されるようになります。プラグインコマンドの実行で表示されます。 * @default false * @type boolean * * @param Script * @text スクリプト * @desc 項目を決定したときに実行されるスクリプトです。 * @default * * @param NumberMin * @text 最小値 * @desc 項目の最小値です。 * @default 0 * @type number * * @param NumberMax * @text 最大値 * @desc 項目の最大値です。 * @default 100 * @type number * * @param NumberStep * @text 変化値 * @desc 項目を操作したときの数値の変化量です。 * @default 20 * @type number * * @param AddPosition * @text 追加位置 * @desc 項目を追加する位置です。指定した項目の上に追加されます。 * @default * @type select * @option 末尾に追加 * @value * @option 常時ダッシュ * @value alwaysDash * @option コマンド記憶 * @value commandRemember * @option BGM 音量 * @value bgmVolume * @option BGS 音量 * @value bgsVolume * @option ME 音量 * @value meVolume * @option SE 音量 * @value seVolume * * @param PaddingTop * @text 余白 * @desc 項目の上の余白ピクセル数です。項目の間隔を開けたいときに指定します。 * @default 0 * @type number */ /*~struct~BooleanData: * @param Name * @text 項目名称 * @desc 項目の名称です。 * @default スイッチ項目1 * * @param DefaultValue * @text 初期値 * @desc 項目の初期値です。 * @default false * @type boolean * * @param SwitchID * @text スイッチ番号 * @desc 項目の設定内容が格納されるスイッチ番号です。 * @default 0 * @type switch * * @param HiddenFlag * @text 隠しフラグ * @desc 項目がデフォルトで隠されるようになります。プラグインコマンドの実行で表示されます。 * @default false * @type boolean * * @param Script * @text スクリプト * @desc 項目を決定したときに実行されるスクリプトです。 * @default * * @param AddPosition * @text 追加位置 * @desc 項目を追加する位置です。指定した項目の上に追加されます。 * @default * @type select * @option 末尾に追加 * @value * @option 常時ダッシュ * @value alwaysDash * @option コマンド記憶 * @value commandRemember * @option BGM 音量 * @value bgmVolume * @option BGS 音量 * @value bgsVolume * @option ME 音量 * @value meVolume * @option SE 音量 * @value seVolume * * @param PaddingTop * @text 余白 * @desc 項目の上の余白ピクセル数です。項目の間隔を開けたいときに指定します。 * @default 0 * @type number */ /*~struct~StringData: * @param Name * @text 項目名称 * @desc 項目の名称です。 * @default 文字列項目1 * * @param DefaultValue * @text 初期値 * @desc 項目の初期値です。インデックスの数値を指定します。 * @default 0 * @type number * * @param VariableID * @text 変数番号 * @desc 項目の設定内容が格納される変数番号です。 * @default 0 * @type variable * * @param HiddenFlag * @text 隠しフラグ * @desc 項目がデフォルトで隠されるようになります。プラグインコマンドの実行で表示されます。 * @default false * @type boolean * * @param Script * @text スクリプト * @desc 項目を決定したときに実行されるスクリプトです。 * @default * * @param StringItems * @text 内容の配列 * @desc 項目の設定内容の配列です。 * @default * @type string[] * * @param AddPosition * @text 追加位置 * @desc 項目を追加する位置です。指定した項目の上に追加されます。 * @default * @type select * @option 末尾に追加 * @value * @option 常時ダッシュ * @value alwaysDash * @option コマンド記憶 * @value commandRemember * @option BGM 音量 * @value bgmVolume * @option BGS 音量 * @value bgsVolume * @option ME 音量 * @value meVolume * @option SE 音量 * @value seVolume * * @param PaddingTop * @text 余白 * @desc 項目の上の余白ピクセル数です。項目の間隔を開けたいときに指定します。 * @default 0 * @type number */ /*~struct~VolumeData: * @param Name * @text 項目名称 * @desc 項目の名称です。 * @default 音量項目1 * * @param DefaultValue * @text 初期値 * @desc 項目の初期値です。 * @default 0 * @type number * * @param VariableID * @text 変数番号 * @desc 項目の設定内容が格納される変数番号です。 * @default 0 * @type variable * * @param HiddenFlag * @text 隠しフラグ * @desc 項目がデフォルトで隠されるようになります。プラグインコマンドの実行で表示されます。 * @default false * @type boolean * * @param Script * @text スクリプト * @desc 項目を決定したときに実行されるスクリプトです。変数[value]で現在の選択値が参照できます。 * @default * * @param AddPosition * @text 追加位置 * @desc 項目を追加する位置です。指定した項目の上に追加されます。 * @default * @type select * @option 末尾に追加 * @value * @option 常時ダッシュ * @value alwaysDash * @option コマンド記憶 * @value commandRemember * @option BGM 音量 * @value bgmVolume * @option BGS 音量 * @value bgsVolume * @option ME 音量 * @value meVolume * @option SE 音量 * @value seVolume * * @param PaddingTop * @text 余白 * @desc 項目の上の余白ピクセル数です。項目の間隔を開けたいときに指定します。 * @default 0 * @type number */ (function () { 'use strict'; var pluginName = 'CustomizeConfigItem'; var getParamString = function (paramNames) { var value = getParamOther(paramNames); return value == null ? '' : value; }; var getParamOther = function (paramNames) { if (!Array.isArray(paramNames)) paramNames = [paramNames]; for (var i = 0; i < paramNames.length; i++) { var name = PluginManager.parameters(pluginName)[paramNames[i]]; if (name) return name; } return null; }; var getParamArrayJson = function (paramNames, defaultValue) { var value = getParamString(paramNames) || null; try { value = JSON.parse(value); if (value === null) { value = defaultValue; } else { value = value.map(function (valueData) { return JSON.parse(valueData); }); } } catch (e) { alert(`!!!Plugin param is wrong.!!!\nPlugin:${pluginName}.js\nName:[${paramNames}]\nValue:${value}`); value = defaultValue; } return value; }; var getCommandName = function (command) { return (command || '').toUpperCase(); }; var getArgNumber = function (arg, min, max) { if (arguments.length < 2) min = -Infinity; if (arguments.length < 3) max = Infinity; return (parseInt(arg) || 0).clamp(min, max); }; var getArgBoolean = function (arg) { return (arg || '').toUpperCase() === 'TRUE'; }; var getArgJson = function (arg, defaultValue) { try { arg = JSON.parse(arg || null); if (arg === null) { arg = defaultValue; } } catch (e) { alert(`!!!Plugin param is wrong.!!!\nPlugin:${pluginName}.js\nValue:${arg}`); arg = defaultValue; } return arg; }; var iterate = function (that, handler) { Object.keys(that).forEach(function (key, index) { handler.call(that, key, that[key], index); }); }; //============================================================================= // パラメータの取得と整形 //============================================================================= var param = {}; param.numberOptions = getParamArrayJson(['NumberOptions', '数値項目'], []); param.stringOptions = getParamArrayJson(['StringOptions', '文字項目'], []); param.switchOptions = getParamArrayJson(['SwitchOptions', 'スイッチ項目'], []); param.volumeOptions = getParamArrayJson(['VolumeOptions', '音量項目'], []); var localOptionWindowIndex = 0; //============================================================================= // Game_Interpreter // プラグインコマンドを追加定義します。 //============================================================================= var _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand; Game_Interpreter.prototype.pluginCommand = function (command, args) { _Game_Interpreter_pluginCommand.call(this, command, args); this.pluginCommandCustomizeConfigItem(command, args); }; Game_Interpreter.prototype.pluginCommandCustomizeConfigItem = function (command, args) { switch (getCommandName(command)) { case 'CC_UNLOCK': case 'オプション任意項目の隠し解除': ConfigManager.customParamUnlock(args[0]); break; } }; //============================================================================= // ConfigManager // 追加項目の設定値や初期値を管理します。 //============================================================================= ConfigManager.customParams = null; ConfigManager.hiddenInfo = {}; ConfigManager._symbolNumber = 'Number'; ConfigManager._symbolBoolean = 'Boolean'; ConfigManager._symbolString = 'String'; ConfigManager._symbolVolume = 'Volume'; ConfigManager.getCustomParams = function () { if (this.customParams) { return this.customParams; } this.customParams = {}; param.numberOptions.forEach(function (optionItem, index) { this.makeNumberOption(optionItem, index); }, this); param.stringOptions.forEach(function (optionItem, index) { this.makeStringOption(optionItem, index); }, this); param.switchOptions.forEach(function (optionItem, index) { this.makeSwitchOption(optionItem, index); }, this); param.volumeOptions.forEach(function (optionItem, index) { this.makeVolumeOption(optionItem, index); }, this); return this.customParams; }; ConfigManager.makeNumberOption = function (optionItem, index) { var data = this.makeCommonOption(optionItem, index, this._symbolNumber); data.min = getArgNumber(optionItem.NumberMin); data.max = getArgNumber(optionItem.NumberMax); data.offset = getArgNumber(optionItem.NumberStep); this.pushOptionData(data); }; ConfigManager.makeStringOption = function (optionItem, index) { var data = this.makeCommonOption(optionItem, index, this._symbolString); data.values = getArgJson(optionItem.StringItems, ['no item']); data.min = 0; data.max = data.values.length - 1; this.pushOptionData(data); }; ConfigManager.makeSwitchOption = function (optionItem, index) { var data = this.makeCommonOption(optionItem, index, this._symbolBoolean); data.initValue = getArgBoolean(optionItem.DefaultValue); data.variable = getArgNumber(optionItem.SwitchID); this.pushOptionData(data); }; ConfigManager.makeVolumeOption = function (optionItem, index) { var data = this.makeCommonOption(optionItem, index, this._symbolVolume); this.pushOptionData(data); }; ConfigManager.makeCommonOption = function (optionItem, index, type) { var data = {}; data.symbol = `${type}${index + 1}`; data.name = optionItem.Name; data.hidden = getArgBoolean(optionItem.HiddenFlag); data.script = optionItem.Script; data.initValue = getArgNumber(optionItem.DefaultValue); data.variable = getArgNumber(optionItem.VariableID, 0); data.addPotion = optionItem.AddPosition; data.padding = getArgNumber(optionItem.PaddingTop); return data; }; ConfigManager.pushOptionData = function (data) { this.customParams[data.symbol] = data; }; var _ConfigManager_makeData = ConfigManager.makeData; ConfigManager.makeData = function () { var config = _ConfigManager_makeData.apply(this, arguments); config.hiddenInfo = {}; iterate(this.getCustomParams(), function (symbol) { config[symbol] = this[symbol]; config.hiddenInfo[symbol] = this.hiddenInfo[symbol]; }.bind(this)); return config; }; var _ConfigManager_applyData = ConfigManager.applyData; ConfigManager.applyData = function (config) { _ConfigManager_applyData.apply(this, arguments); iterate(this.getCustomParams(), function (symbol, item) { if (symbol.contains(this._symbolBoolean)) { this[symbol] = this.readFlagCustom(config, symbol, item); } else if (symbol.contains(this._symbolVolume)) { this[symbol] = this.readVolumeCustom(config, symbol, item); } else { this[symbol] = this.readOther(config, symbol, item); } if (config.hiddenInfo) { this.hiddenInfo[symbol] = (typeof config.hiddenInfo[symbol] === 'boolean' ? config.hiddenInfo[symbol] : item.hidden); } else { this.hiddenInfo[symbol] = item.hidden; } }.bind(this)); }; ConfigManager.customParamUnlock = function (name) { iterate(this.getCustomParams(), function (symbol, item) { if (item.name === name) this.hiddenInfo[symbol] = false; }.bind(this)); this.save(); }; ConfigManager.readOther = function (config, name, item) { var value = config[name]; if (value !== undefined) { return Number(value).clamp(item.min, item.max); } else { return item.initValue; } }; ConfigManager.readFlagCustom = function (config, name, item) { if (config[name] !== undefined) { return this.readFlag(config, name); } else { return item.initValue; } }; ConfigManager.readVolumeCustom = function (config, name, item) { if (config[name] !== undefined) { return this.readVolume(config, name); } else { return item.initValue; } }; ConfigManager.exportCustomParams = function () { if (!$gameVariables || !$gameSwitches) return; iterate(this.getCustomParams(), function (symbol, item) { if (item.variable > 0) { if (symbol.contains(this._symbolBoolean)) { $gameSwitches.setValue(item.variable, !!this[symbol]); } else { $gameVariables.setValue(item.variable, this[symbol]); } } }.bind(this)); }; ConfigManager.importCustomParams = function () { if (!$gameVariables || !$gameSwitches) return; iterate(this.getCustomParams(), function (symbol, item) { if (item.variable > 0) { if (symbol.contains(this._symbolBoolean)) { this[symbol] = $gameSwitches.value(item.variable); } else if (symbol.contains(this._symbolVolume)) { this[symbol] = $gameVariables.value(item.variable).clamp(0, 100); } else { this[symbol] = $gameVariables.value(item.variable).clamp(item.min, item.max); } } }.bind(this)); }; var _ConfigManager_save = ConfigManager.save; ConfigManager.save = function () { _ConfigManager_save.apply(this, arguments); this.exportCustomParams(); }; //============================================================================= // Game_Map // リフレッシュ時にオプション値を同期します。 //============================================================================= var _Game_Map_refresh = Game_Map.prototype.refresh; Game_Map.prototype.refresh = function () { _Game_Map_refresh.apply(this, arguments); ConfigManager.importCustomParams(); }; //============================================================================= // DataManager // セーブ時とロード時にオプション値を同期します。 //============================================================================= var _DataManager_setupNewGame = DataManager.setupNewGame; DataManager.setupNewGame = function () { _DataManager_setupNewGame.apply(this, arguments); ConfigManager.exportCustomParams(); }; var _DataManager_loadGameWithoutRescue = DataManager.loadGameWithoutRescue; DataManager.loadGameWithoutRescue = function (savefileId) { var result = _DataManager_loadGameWithoutRescue.apply(this, arguments); ConfigManager.exportCustomParams(); return result; }; //============================================================================= // Window_Options // 追加項目を描画します。 //============================================================================= var _Window_Options_initialize = Window_Options.prototype.initialize; Window_Options.prototype.initialize = function () { this._customParams = ConfigManager.getCustomParams(); _Window_Options_initialize.apply(this, arguments); this.select(localOptionWindowIndex); localOptionWindowIndex = 0; }; var _Window_Options_itemRect = Window_Options.prototype.itemRect; Window_Options.prototype.itemRect = function (index) { var rect = _Window_Options_itemRect.apply(this, arguments); rect.y += this.findAdditionalHeight(index); return rect; }; Window_Options.prototype.findAdditionalHeight = function (index) { return this._list.reduce(function (prev, item, itemIndex) { return prev + (itemIndex <= index && item.ext ? item.ext : 0); }, 0); }; var _Window_Options_makeCommandList = Window_Options.prototype.makeCommandList; Window_Options.prototype.makeCommandList = function () { _Window_Options_makeCommandList.apply(this, arguments); this.addCustomOptions(); }; Window_Options.prototype.addCustomOptions = function () { iterate(this._customParams, function (key, item) { if (!ConfigManager.hiddenInfo[key]) { this.addCommand(item.name, key, undefined, item.padding); if (item.addPotion) { this.shiftCustomOptions(item.addPotion); } } }.bind(this)); }; Window_Options.prototype.shiftCustomOptions = function (addPotion) { var targetCommand = this._list.filter(function (command) { return command.symbol === addPotion; })[0]; if (!targetCommand) { return; } var targetIndex = this._list.indexOf(targetCommand); var newCommand = this._list.pop(); this.addIndexForManoInputConfig(targetIndex); this._list.splice(targetIndex, 0, newCommand); }; Window_Options.prototype.addIndexForManoInputConfig = function (index) { if (this._gamepadOptionIndex > index) { this._gamepadOptionIndex += 1; } if (this._keyboardConfigIndex > index) { this._keyboardConfigIndex += 1; } }; var _Window_Options_statusText = Window_Options.prototype.statusText; Window_Options.prototype.statusText = function (index) { var result = _Window_Options_statusText.apply(this, arguments); var symbol = this.commandSymbol(index); var value = this.getConfigValue(symbol); if (this.isNumberSymbol(symbol)) { result = this.numberStatusText(value); } else if (this.isStringSymbol(symbol)) { result = this.stringStatusText(value, symbol); } return result; }; Window_Options.prototype.isNumberSymbol = function (symbol) { return symbol.contains(ConfigManager._symbolNumber); }; Window_Options.prototype.isStringSymbol = function (symbol) { return symbol.contains(ConfigManager._symbolString); }; Window_Options.prototype.isCustomSymbol = function (symbol) { return !!this._customParams[symbol]; }; Window_Options.prototype.numberStatusText = function (value) { return value; }; Window_Options.prototype.stringStatusText = function (value, symbol) { return this._customParams[symbol].values[value]; }; var _Window_Options_processOk = Window_Options.prototype.processOk; Window_Options.prototype.processOk = function () { if (!this._shiftValue(1, true)) _Window_Options_processOk.apply(this, arguments); this.execScript(); }; var _Window_Options_cursorRight = Window_Options.prototype.cursorRight; Window_Options.prototype.cursorRight = function (wrap) { if (!this._shiftValue(1, false)) _Window_Options_cursorRight.apply(this, arguments); this.execScript(); }; var _Window_Options_cursorLeft = Window_Options.prototype.cursorLeft; Window_Options.prototype.cursorLeft = function (wrap) { if (!this._shiftValue(-1, false)) _Window_Options_cursorLeft.apply(this, arguments); this.execScript(); }; Window_Options.prototype._shiftValue = function (sign, loopFlg) { var symbol = this.commandSymbol(this.index()); var value = this.getConfigValue(symbol); if (this.isNumberSymbol(symbol)) { value += this.numberOffset(symbol) * sign; this.changeValue(symbol, this._clampValue(value, symbol, loopFlg)); return true; } if (this.isStringSymbol(symbol)) { value += sign; this.changeValue(symbol, this._clampValue(value, symbol, loopFlg)); return true; } return false; }; Window_Options.prototype.execScript = function () { var symbol = this.commandSymbol(this.index()); if (!this.isCustomSymbol(symbol)) return; var script = this._customParams[symbol].script; var value = this.getConfigValue(symbol); if (script) { eval(script); SoundManager.playOk(); } localOptionWindowIndex = this.index(); }; Window_Options.prototype._clampValue = function (value, symbol, loopFlg) { var maxValue = this._customParams[symbol].max; var minValue = this._customParams[symbol].min; if (loopFlg) { if (value > maxValue) value = minValue; if (value < minValue) value = maxValue; } return value.clamp(this._customParams[symbol].min, this._customParams[symbol].max); }; Window_Options.prototype.numberOffset = function (symbol) { var value = this._customParams[symbol].offset; if (Input.isPressed('shift')) value *= 10; return value; }; Window_Options.prototype.windowHeight = function () { var height = this.fittingHeight(Math.min(this.numVisibleRows(), 14)); return height + this.findAdditionalHeight(this.maxItems()); }; })();
dazed/translations
www/js/plugins/CustomizeConfigItem.js
JavaScript
unknown
29,684
//============================================================================= // CustomizeMaxSaveFile.js // ---------------------------------------------------------------------------- // Copyright (c) 2015 Triacontane // This software is released under the MIT License. // http://opensource.org/licenses/mit-license.php // ---------------------------------------------------------------------------- // Version // 1.1.1 2017/02/25 セーブファイル数により大きな値を設定できるよう上限を開放 // 1.1.0 2016/11/03 オートセーブなど最大数以上のIDに対してセーブするプラグインとの競合に対応 // 1.0.0 2016/03/19 初版 // ---------------------------------------------------------------------------- // [Blog] : http://triacontane.blogspot.jp/ // [Twitter]: https://twitter.com/triacontane/ // [GitHub] : https://github.com/triacontane/ //============================================================================= /*: * @plugindesc Customize max save file number * @author triacontane * * @param SaveFileNumber * @desc max save file number(1...100) * @default 20 * * @help Customize max save file number * * No plugin command * * This plugin is released under the MIT License. */ /*:ja * @plugindesc 最大セーブファイル数変更プラグイン * @author トリアコンタン * * @param セーブファイル数 * @desc 最大セーブファイル数です。 * @default 20 * * @help 最大セーブファイル数をパラメータで指定した値に変更します。 * * このプラグインにはプラグインコマンドはありません。 * * 利用規約: * 作者に無断で改変、再配布が可能で、利用形態(商用、18禁利用等) * についても制限はありません。 * このプラグインはもうあなたのものです。 */ (function () { 'use strict'; var pluginName = 'CustomizeMaxSaveFile'; var getParamNumber = function (paramNames, min, max) { var value = getParamOther(paramNames); if (arguments.length < 2) min = -Infinity; if (arguments.length < 3) max = Infinity; return (parseInt(value, 10) || 0).clamp(min, max); }; var getParamOther = function (paramNames) { if (!Array.isArray(paramNames)) paramNames = [paramNames]; for (var i = 0; i < paramNames.length; i++) { var name = PluginManager.parameters(pluginName)[paramNames[i]]; if (name) return name; } return null; }; var paramSaveFileNumber = getParamNumber(['SaveFileNumber', 'セーブファイル数'], 0); //============================================================================= // DataManager // セーブファイルの数をカスタマイズします。 //============================================================================= var _DataManager_loadGlobalInfo = DataManager.loadGlobalInfo; DataManager.loadGlobalInfo = function () { if (!this._globalInfo) { this._globalInfo = _DataManager_loadGlobalInfo.apply(this, arguments); } return this._globalInfo; }; var _DataManager_saveGlobalInfo = DataManager.saveGlobalInfo; DataManager.saveGlobalInfo = function (info) { _DataManager_saveGlobalInfo.apply(this, arguments); this._globalInfo = null; }; var _DataManager_maxSavefiles = DataManager.maxSavefiles; DataManager.maxSavefiles = function () { return paramSaveFileNumber ? paramSaveFileNumber : _DataManager_maxSavefiles.apply(this, arguments); }; var _DataManager_isThisGameFile = DataManager.isThisGameFile; DataManager.isThisGameFile = function (savefileId) { if (savefileId > this.maxSavefiles()) { return false; } else { return _DataManager_isThisGameFile.apply(this, arguments); } }; })();
dazed/translations
www/js/plugins/CustomizeMaxSaveFile.js
JavaScript
unknown
3,932
//============================================================================= // 🏤drowsepost Plugins - Map Camera Controller // DP_MapZoom.js // Version: 0.87 // // Copyright (c) 2016 - 2019 canotun // Released under the MIT license. // http://opensource.org/licenses/mit-license.php //============================================================================= var Imported = Imported || {}; Imported.DP_MapZoom = true; var drowsepost = drowsepost || {}; //============================================================================= /*: * @plugindesc Control the magnification of the map scene. * @author drowsepost * * @param Base Scale * @desc Set the basic magnification ratio.(Start up) * Default: 1 (0 or more) * @default 1 * * @param Encount Effect * @desc Corrected code of encounter effect * Default: true (ON: true / OFF: false) * @default true * @type boolean * * @param Camera Controll * @desc camera control during magnification processing * Default: true (ON: true / OFF: false / Minimum: minimum) * @default true * @type select * @option ON * @value true * @option OFF * @value false * @option Minimum * @value minimum * * @param Weather Patch * @desc Change weather sprite generation range * Default: true (ON: true / OFF: false) * @default true * @type boolean * * @param Picture Size Fixation * @desc Exclude pictures from map zooming process * Default: ALL (ALL: true / OFF: false / $ / screen_ / fix_) * @default true * @type select * @option OFF * @value false * @option ALL * @value true * @option $ * @value $ * @option screen_ * @value screen_ * @option fix_ * @value fix_ * * @param Old Focus * @desc Use trackless focus similar to the old version. * Default: false (ON: true / OFF: false) * @default false * @type boolean * * @param Easing Function * @desc animation Easing function. * args: t (0.00~1.00) return: Number (0.00~1.00) Default: t * @default t * @type string * * @help * ============================================================================ * About * ============================================================================ * It controls the enlargement ratio of the map scene by * reflecting the calculation of the enlargement ratio * to various coordinate processing. * (sorry... english support is immature. by drowsepost) * * ============================================================================ * Knowing issue * ============================================================================ * If the enlargement ratio is too small in a huge map, * processing will be dropped in the canvas mode, * and the map missing problem will occur in the webgl mode. * This is the limit of the PIXI library and the solution is under investigation * * ============================================================================ * How To Use * ============================================================================ * * ◆ plugin command: * dpZoom {zoom ratio} {animate frames} {event id or "this" or "player"} * rename: mapSetZoom * * e.g.: * dpZoom 0.8 360 this * -> zoom out to 0.8x , animate 360 frames, centering to event of called * * dpZoom 1 * -> zoom to 1x(reset), Immediate * * dpZoom 3 60 1 * -> zoom to 3x , animate 60 frames, centering to Event id:001 * * dpFocus {event id or "this" or "player"} {animate frames} * Place the specified event in the center of the screen without changing * the enlargement ratio of the screen. * The camera follows the movement of the event * * ◆ map meta: * if you need setting to Default Magnification on the map, * fill in the following in the "Note" field * * <zoomScale: {zoom ratio}> * Specify the enlargement ratio to be the basis for each map * * e.g.: * <zoomScale:0.5> * -> zoom out to 0.5x , Immediate * * if you need setting to Default Camera target on the map, * fill in the following in the "Note" field * * <camTarget: {event id or "player"}> * Events can be in the center of the screen. * The screen follows the movement of the event. * * e.g.: * <camTarget: 3> * -> set center of the screen Event ID "3" * * ============================================================================ * Technical information * ============================================================================ * If "screenX" or "screenY" used by another plugin is misaligned, * multiply "screenX" or "screenY" by "$gameScreen.zoomScale()". * * This plugin controls "$gameScreen" * * This plugin use savedata * "$gameMap._dp_scale", "$gameMap._dp_pan", "$gameMap._dp_target" * */ /*:ja * @plugindesc マップの拡大率を制御します。 * @author drowsepost * * @param Base Scale * @desc 基本の拡大率を設定します。(0以上) * Default: 1 * @default 1 * * @param Encount Effect * @desc エンカウントエフェクトに拡大率を反映 * Default: true (ON: true / OFF: false) * @default true * @type boolean * * @param Camera Controll * @desc 拡大処理中のセンタリング制御をこのプラグインが行う * Default: true (ON: true / OFF: false / 最小: minimum) * @default true * @type select * @option ON * @value true * @option OFF * @value false * @option Minimum * @value minimum * * @param Weather Patch * @desc 天候スプライトの生成範囲を広げる修正を適用します。 * Default: true (ON: true / OFF: false) * @default true * @type boolean * * @param Picture Size Fixation * @desc ピクチャをマップの拡大処理から除外します * Default: ALL (ALL: true / OFF: false / $ / screen_ / fix_) * @default true * @type select * @option OFF * @value false * @option ALL * @value true * @option $ * @value $ * @option screen_ * @value screen_ * @option fix_ * @value fix_ * * @param Old Focus * @desc 古いバージョンの追跡なしのフォーカスを使用します。 * Default: false (ON: true / OFF: false) * @default false * @type boolean * * @param Easing Function * @desc アニメーションのイージング式。 * 引数 t (0.00~1.00) 戻り値 数値(0.00~1.00) Default: t * @default t * @type string * * @help * ============================================================================ * About * ============================================================================ * 各種座標処理に拡大率の計算を反映し * マップシーンの拡大率を制御します。 * また、指定したイベントをカメラが追うように指定します。 * 標準のフォーカス対象は先頭のプレイヤーとなります。 * * ============================================================================ * Knowing issue * ============================================================================ * 巨大なマップにおいて拡大率をあまりに小さくすると * canvasモードで処理落ち、webglモードでマップ欠けの問題が発生します。 * これはPIXIライブラリの限界であり、解決方法は調査中です * * ============================================================================ * How To Use * ============================================================================ * ◆ マップメモ欄 * * <zoomScale:0.5> * などと記述すると、マップごとに基準になる拡大率を指定することが出来ます。 * * <camTarget: 3> * 等と記述すると、イベントID n番のイベントが画面中央になった状態にできます。 * フォーカスはイベントの移動に画面が追従します。 * * ◆ プラグインコマンド * * (1)ズーム機能 * dpZoom {倍率} {変更にかけるフレーム数} {対象イベントID / this / player} * 指定したイベントにフォーカスを合わせつつ画面の拡大率を変更できます。 * 第3引数に何も指定しない場合、画面中央に向かって拡大します。 * * 例: * プラグインコマンドにおいて対象イベントの部分に * 「this」もしくは「このイベント」と指定すると、 * イベント実行中のオブジェクトを指定します。 * dpZoom 2 360 this * たとえば上記はそのイベントが中心になるように6秒かけて2倍の拡大率に変化します。 * <非推奨> mapSetZoom は利用できますが、非推奨とします。 * * (2)フォーカス機能 * dpFocus {対象イベントID / this / player} {変更にかけるフレーム数} * 画面の拡大率を変更せずに指定したイベントにフォーカスを合わせます。 * * ============================================================================ * Settings * ============================================================================ * Base Scale * ゲーム開始時の拡大倍率を指定します。 * 倍率には0以上を指定してください。 * * Encount Effect * エンカウントエフェクトを置き換えるかどうかを指定します。 * オリジナルのエフェクトで置き換えている場合はこちらをfalseにしてください。 * しかしその場合、画面の拡大率をそれぞれ反映できるように調整する必要があります。 * * Camera Controll * falseの場合はイベントを指定した拡大を含む拡大中のカメラ制御は動作しません。 * 別プラグインでカメラ制御を行う場合にご利用ください。 * * Weather Patch * trueの場合、天候スプライトの生成範囲に関する修正を行い、 * 拡大率変更後も天候スプライトをまんべんなく分布させます * 別プラグインで天候演出の制御を行っている場合等はfalseにしてください。 * * Picture Size Fixation * trueの場合、ピクチャを拡大処理から除外します。 * * Old Focus * trueの場合、古いDP_MapZoom.jsと同様のフォーカス処理を行います。 * このフォーカス処理は対象イベントまでの座標のずれを基準にしているため、 * イベントの移動を追尾しません。 * * Easing Function * ズーム時のイージングを主に0から1の間で戻す式を設定できます。 * 引数 t にズームの進捗が0から1で入ります。JavaScript。 * * ============================================================================ * Technical information * ============================================================================ * 現在の画面の拡大率は$gameScreen.zoomScale()で取得できます。 * これはプラグインの利用に関わらず元から存在する関数です。 * 他のプラグインで利用する「screenX」や「screenY」がずれる場合は、 * 「screenX」や「screenY」にそれぞれ$gameScreen.zoomScale()を掛けて下さい。 * * このプラグインは$gameScreenを制御します。 * * 指定された拡大率設定は$gameMap._dp_scaleが保持します。 * シーン離脱時のスクロール量は$gameMap._dp_panが保持します。 * マップのフォーカスイベントは$gameMap._dp_targetが保持します。 * */ (function () { "use strict"; var user_map_marginright = 0; var user_map_marginbottom = 0; var parameters = PluginManager.parameters('DP_MapZoom'); var user_scale = Number(parameters['Base Scale'] || 1); var user_fix_encount = Boolean(parameters['Encount Effect'] === 'true' || false); var user_use_camera = Boolean(parameters['Camera Controll'] === 'true' || false); var user_use_camera_transfer = Boolean(parameters['Camera Controll'] === 'minimum' || false); var user_fix_weather = Boolean(parameters['Weather Patch'] === 'true' || false); var user_fix_picture = parameters['Picture Size Fixation']; var user_use_oldfocus = Boolean(parameters['Old Focus'] === 'true' || false); var user_easing_function = parameters['Easing Function']; /* Main Functions ============================================================================= 実際の拡大処理 */ var camera = {}; /* dp_renderSize タイル拡大率を保持および仮想的なレンダリング範囲を算出します。 */ var dp_renderSize = { _scale: undefined, width: undefined, height: undefined, /** * 拡大率からレンダリングするべきオブジェクトのサイズを設定します。 * @param {number} scale */ onChange: (function (_scale) { if (!('_scene' in SceneManager)) return; if (!('_spriteset' in SceneManager._scene)) return; var scale = _scale || this._scale; var spriteset = SceneManager._scene._spriteset; //マップサイズ変更 spriteset._tilemap.width = Math.ceil(Graphics.width / scale) + spriteset._tilemap._margin * 2; spriteset._tilemap.height = Math.ceil(Graphics.height / scale) + spriteset._tilemap._margin * 2; //パララックスサイズ変更 spriteset._parallax.move(0, 0, Math.round(Graphics.width / scale), Math.round(Graphics.height / scale)); // Foreground.js対応 if (spriteset._foreground && spriteset._foreground instanceof TilingSprite) { spriteset._foreground.move(0, 0, Math.round(Graphics.width / scale), Math.round(Graphics.height / scale)); } spriteset._tilemap.refresh(); spriteset._tilemap._needsRepaint = true; spriteset._tilemap.updateTransform(); }), /** * scaleをリセットします */ reset: (function () { this.scale = 1; }) }; Object.defineProperty(dp_renderSize, 'scale', { get: function () { return this._scale; }, set: function (val) { if (val != this._scale) { this._scale = Number(val); this.width = Math.ceil(Graphics.boxWidth / this._scale); this.height = Math.ceil(Graphics.boxHeight / this._scale); this.onChange(); } } }); /** * ズームすべき座標を算出 * @return {object} Point */ var dp_getZoomPos = function () { return new Point( camera.target.screenX(), camera.target.screenY() - ($gameMap.tileHeight() / 2) ); }; /** * マップのレンダリング原点と表示位置のずれを取得します。 * @return {object} Point */ var dp_getVisiblePos = function () { var scale = $gameScreen.zoomScale(); return new Point( Math.round($gameScreen.zoomX() * (scale - dp_renderSize.scale)), Math.round($gameScreen.zoomY() * (scale - dp_renderSize.scale)) ); }; /** * フォーカスされているキャラクターから画面の中心がどれだけずれているか取得します * @return {object} Point */ var dp_getpan = function () { var centerPosX = (($gameMap.screenTileX() - 1) / 2); var centerPosY = (($gameMap.screenTileY() - 1) / 2); var pan_x = ($gameMap.displayX() + centerPosX) - camera.target._realX; var pan_y = ($gameMap.displayY() + centerPosY) - camera.target._realY; return new Point( ($gameMap.screenTileX() >= $dataMap.width) ? 0 : pan_x, ($gameMap.screenTileY() >= $dataMap.height) ? 0 : pan_y ); }; /** * 画面の拡大率を設定します。 * @param {number} scale */ var dp_setZoom = function (scale) { dp_renderSize.scale = scale; $gameMap._dp_scale = scale; $gameScreen.setZoom(0, 0, scale); camera.center(); }; /** * 指定されたイベントIDをイベントインスタンスにして返却 * @param {any} event イベントIDもしくはイベントオブジェクトもしくはプレイヤー * @return {object} Game_CharacterBase */ var dp_getEvent = function (event) { var _target; if (typeof event === 'object') { if ('_eventId' in event) _target = $gameMap.event(event._eventId); } if (typeof event === 'number') { _target = $gameMap.event(event); } if (!(_target instanceof Game_CharacterBase)) { _target = $gamePlayer; } return _target; }; /** * カメラターゲットから目標イベントまでのマップ上のズレ(x,y)を取得 * @param {any} event イベントIDもしくはイベントオブジェクトもしくはプレイヤー * @return {object} Point */ var dp_targetPan = function (event) { var _target = dp_getEvent(event); return new Point( _target._realX - camera.target._realX, _target._realY - camera.target._realY ); }; /** * 文字列をイージング用関数として評価した関数を返します * @param {String|Function} txt_func * @return {Function} イージング用関数、引数は float t */ var dp_txtToEasing = (function (txt_func) { var basic_func = (function (t) { return t; }); if (typeof txt_func === 'function') return txt_func; if (typeof txt_func !== 'string') return basic_func; if (txt_func == '') return basic_func; try { return new Function('t', 'return ' + txt_func + ';'); } catch (e) { console.error('DP_MapZoom: Easing Function', e, txt_func); } return basic_func; }); /** * 線形補完 * @param {Number} p 入力進捗率 * @param {Number} from 開始数値 * @param {Number} to 目標数値 * @return {Number} 結果進捗率 */ var dp_lerp = (function (p, from, to) { return from + (to - from) * p; }); /* Camera Object =================================================================================== */ /** * カメラのアニメーションを制御するオブジェクト */ camera.animation = (function () { //private var _active = false; var _count, _duration, _easing; var _start_pan, _start_scale, _end_pan, _end_scale; //public var r = { /** * アニメーションのスタート * @param {Number} scale 目標とする拡大率 * @param {Point} pos 目標とする座標のズレ * @param {Number} dulation 変化にかけるフレーム */ start: (function (scale, pos, duration) { var is_zoomout = ($gameScreen.zoomScale() > scale) ? true : false; _count = 0; _duration = duration || 0; _end_scale = scale || $gameScreen.zoomScale(); _end_pan = pos || new Point(); _start_pan = dp_getpan(); _start_scale = $gameScreen.zoomScale(); if (is_zoomout) { dp_renderSize.scale = scale; camera.center(_start_pan.x, _start_pan.y); } _active = true; }), /** * アニメーションのアップデート * camera.animation.update */ update: (function () { if (!_active) return; var p = _count / _duration; _count++; if (p > 1) { r.end(); return; } if (_count % 2 === 0) return; var ease = _easing(p); var x = dp_lerp(ease, _start_pan.x, _end_pan.x); var y = dp_lerp(ease, _start_pan.y, _end_pan.y); var z = dp_lerp(ease, _start_scale, _end_scale); $gameScreen.setZoom(0, 0, z); camera.center(x, y); }), /** * アニメーションの終了 */ end: (function () { if (!_active) return; _active = false; $gameMap._dp_pan = _end_pan; dp_setZoom(_end_scale); }) }; Object.defineProperty(r, 'easing', { get: function () { return _easing; }, set: function (val) { _easing = dp_txtToEasing(val); } }); r.easing = user_easing_function; return r; }()); /** * カメラのズームを開始する関数 * @param {number} ratio 拡大率 * @param {number} duration 変化にかけるフレーム * @param {any} target フォーカスするイベントIDもしくはゲームイベントオブジェクト */ camera.zoom = function (ratio, duration, target) { if ((typeof ratio !== 'number') || (ratio < 0)) { ratio = dp_renderSize.scale; } var target_pan = dp_getpan(); if (typeof target !== 'undefined') { if (user_use_oldfocus) { target_pan = dp_targetPan(target); } else { camera.target = target; target_pan = new Point(); } } if (duration > 0) { camera.animation.start(ratio, target_pan, duration); } else { $gameMap._dp_pan = target_pan; dp_setZoom(ratio); } }; /** * フォーカスしたターゲットをカメラ中央に配置 * @param {number} panX 画面をずらすマスの数。横。 * @param {number} panY 画面をずらすマスの数。縦。 * @param {boolean} force_center カメラ制御無効でも実行 */ camera.center = function (panX, panY, force_center) { if ((!user_use_camera) && (!force_center)) return; var px = Number(panX || $gameMap._dp_pan.x); var py = Number(panY || $gameMap._dp_pan.y); camera.target.center(camera.target._realX + px, camera.target._realY + py); }; /** * カメラがフォーカスする対象 * @param {any} event イベントIDもしくはゲームイベントもしくはプレイヤー * @return {object} ゲームイベントもしくはプレイヤー */ Object.defineProperty(camera, 'target', { get: function () { if ($gameMap._dp_target === 0) return $gamePlayer; return $gameMap.event($gameMap._dp_target); }, set: function (event) { var _target = dp_getEvent(event); $gameMap._dp_target = 0; if (typeof _target === 'object') { if ('_eventId' in _target) $gameMap._dp_target = _target._eventId; } } }); //公開 drowsepost.camera = camera; drowsepost.rendersize = dp_renderSize; /* Command Entry =================================================================================== @param {array} args スペース区切りで指定したプラグインコマンドの引数(array<string>) */ drowsepost.fn = drowsepost.fn || {}; /** * 拡大率を変更せずにフォーカス変更 * {target} {frame} */ var _p_dpfocus = ('dpFocus' in drowsepost.fn) ? drowsepost.fn.dpFocus : (function () { }); drowsepost.fn.dpFocus = (function (_a) { _p_dpfocus.call(this, _a); var _s = this; var _target; if (_a.length < 1) _a.push('player'); if ((_a[0] === 'this') || (_a[0] === 'このイベント')) _target = _s; else if ((_a[0] === 'player') || (_a[0] === 'プレイヤー')) _target = $gamePlayer; else _target = parseInt(_a[0]); camera.zoom(dp_renderSize.scale, parseInt(_a[1]), _target); }); /** * 画面拡大率を変更 * 第三引数にターゲット指定でフォーカスも変更 * {zoom} {frame} {target} */ var _p_dpzoom = ('dpZoom' in drowsepost.fn) ? drowsepost.fn.dpZoom : (function () { }); drowsepost.fn.mapSetZoom = drowsepost.fn.dpZoom = (function (_a) { _p_dpzoom.call(this, _a); var _s = this; var _target; if (_a.length > 2) { if ((_a[2] === 'this') || (_a[2] === 'このイベント')) _target = _s; else if ((_a[2] === 'player') || (_a[2] === 'プレイヤー')) _target = $gamePlayer; else _target = parseInt(_a[2]); } camera.zoom(parseFloat(_a[0]), parseInt(_a[1]), _target); }); /* Game_Interpreter =================================================================================== コマンドパーサーの追加 */ (function () { //@override var _parent_pluginCommand = Game_Interpreter.prototype.pluginCommand; Game_Interpreter.prototype.pluginCommand = function (command, args) { _parent_pluginCommand.call(this, command, args); if ('DP_Basics' in Imported) return; if (!(command in drowsepost.fn)) return; if (typeof drowsepost.fn[command] === 'function') { drowsepost.fn[command].call(this, args); } }; }()); /* Game Map ============================================================================= 拡大率($gameScreen.zoomScale())の反映 */ (function () { //@override var _parent_initialize = Game_Map.prototype.initialize; Game_Map.prototype.initialize = function () { _parent_initialize.call(this); //保存用変数エントリー this._dp_scale = user_scale; this._dp_pan = new Point(); this._dp_target = 0; }; //@override Game_Map.prototype.screenTileX = function () { return (Graphics.width - user_map_marginright) / (this.tileWidth() * $gameScreen.zoomScale()); }; //@override Game_Map.prototype.screenTileY = function () { return (Graphics.height - user_map_marginbottom) / (this.tileHeight() * $gameScreen.zoomScale()); }; //@override Game_Map.prototype.canvasToMapX = function (x) { var tileWidth = this.tileWidth() * $gameScreen.zoomScale(); var originX = this._displayX * tileWidth; var mapX = Math.floor((originX + x) / tileWidth); return this.roundX(mapX); }; //@override Game_Map.prototype.canvasToMapY = function (y) { var tileHeight = this.tileHeight() * $gameScreen.zoomScale(); var originY = this._displayY * tileHeight; var mapY = Math.floor((originY + y) / tileHeight); return this.roundY(mapY); }; }()); /* Game Character ============================================================================= Game Characterに注視する場合の処理を追加 */ (function () { Game_Character.prototype.centerX = function () { return ($gameMap.screenTileX() - 1) / 2.0; }; Game_Character.prototype.centerY = function () { return ($gameMap.screenTileY() - 1) / 2.0; }; Game_Character.prototype.center = function (x, y) { return $gameMap.setDisplayPos(x - this.centerX(), y - this.centerY()); }; Game_Character.prototype.updateScroll = function (lastScrolledX, lastScrolledY) { var x1 = lastScrolledX; var y1 = lastScrolledY; var x2 = this.scrolledX(); var y2 = this.scrolledY(); if (y2 > y1 && y2 > this.centerY()) { $gameMap.scrollDown(y2 - y1); } if (x2 < x1 && x2 < this.centerX()) { $gameMap.scrollLeft(x1 - x2); } if (x2 > x1 && x2 > this.centerX()) { $gameMap.scrollRight(x2 - x1); } if (y2 < y1 && y2 < this.centerY()) { $gameMap.scrollUp(y1 - y2); } }; }()); /* Game Player ============================================================================= 拡大率の反映 */ (function () { //@override Game_Player.prototype.centerX = function () { return ($gameMap.screenTileX() - 1) / 2.0; }; //@override Game_Player.prototype.centerY = function () { return ($gameMap.screenTileY() - 1) / 2.0; }; //@override var _parent_updateScroll = Game_Player.prototype.updateScroll; Game_Player.prototype.updateScroll = function (lastScrolledX, lastScrolledY) { if (typeof $gameMap !== 'object') return; if ($gameMap._dp_target !== 0) return; _parent_updateScroll.call(this, lastScrolledX, lastScrolledY); }; }()); /* Game Event ============================================================================= Game Eventに注視する場合の処理を追加 */ (function () { //@override var _parent_update = Game_Event.prototype.update; Game_Event.prototype.update = function () { var lastScrolledX = this.scrolledX(); var lastScrolledY = this.scrolledY(); _parent_update.call(this); this.updateScroll(lastScrolledX, lastScrolledY); }; Game_Event.prototype.updateScroll = function (lastScrolledX, lastScrolledY) { if (typeof $gameMap !== 'object') return; if ($gameMap._dp_target !== this._eventId) return; Game_Character.prototype.updateScroll.call(this, lastScrolledX, lastScrolledY); }; }()); /* Weather ============================================================================= 描画反映変更機能の追加 */ (function () { //天候スプライトの生成範囲をGraphic基準ではなく実際の描画範囲に合わせる if (!user_fix_weather) return; //@override var _parent_rebornSprite = Weather.prototype._rebornSprite; Weather.prototype._rebornSprite = function (sprite) { _parent_rebornSprite.call(this, sprite); sprite.ax = Math.randomInt(dp_renderSize.width + 100) - 50 + this.origin.x; sprite.ay = Math.randomInt(dp_renderSize.height + 200) - 100 + this.origin.y; sprite.opacity = 160 + Math.randomInt(60); }; }()); /* Sprite_Picture ============================================================================= ピクチャdot by dot配置機能の追加 */ (function () { //ピクチャの配置と拡大率を、スクリーンの拡大率で打ち消す if (!user_fix_picture) return; if (user_fix_picture === 'false') return; //@override var _parent_loadBitmap = Sprite_Picture.prototype.loadBitmap; Sprite_Picture.prototype.loadBitmap = function () { _parent_loadBitmap.call(this); if (user_fix_picture === 'true') { this._dp_fix = true; } else if (!this._pictureName.indexOf(user_fix_picture)) { this._dp_fix = true; } else { this._dp_fix = false; } }; //@override var _parent_updateScale = Sprite_Picture.prototype.updateScale; Sprite_Picture.prototype.updateScale = function () { _parent_updateScale.call(this); if (!this._dp_fix) return; var picture = this.picture(); this.scale.x = (1 / $gameScreen.zoomScale()) * (picture.scaleX() / 100); this.scale.y = (1 / $gameScreen.zoomScale()) * (picture.scaleY() / 100); }; //@override var _parent_updatePosition = Sprite_Picture.prototype.updatePosition; Sprite_Picture.prototype.updatePosition = function () { _parent_updatePosition.call(this); if (!this._dp_fix) return; var picture = this.picture(); var map_s = dp_getVisiblePos(); this.x = (picture.x() + map_s.x) * (1 / $gameScreen.zoomScale()); this.y = (picture.y() + map_s.y) * (1 / $gameScreen.zoomScale()); }; }()); /* Sprite_Timer ============================================================================= タイマーの配置とサイズを調整 */ (function () { //@override var _parent_updatePosition = Sprite_Timer.prototype.updatePosition; Sprite_Timer.prototype.updatePosition = function () { _parent_updatePosition.call(this); var _zoom = (1 / $gameScreen.zoomScale()); this.x = this.x * _zoom; this.y = this.y * _zoom; this.scale.x = _zoom; this.scale.y = _zoom; }; }()); /* Spriteset_Base ============================================================================= 拡大座標の調整 */ (function () { //@override var _parent_updatePosition = Spriteset_Base.prototype.updatePosition; Spriteset_Base.prototype.updatePosition = function () { _parent_updatePosition.call(this); var map_s = dp_getVisiblePos(); this.x = map_s.x * -1; this.y = map_s.y * -1; this.x += Math.round($gameScreen.shake()); }; }()); /* Scene_Map ============================================================================= 拡大率の引継ぎ */ (function () { /* マップシーンの開始 */ //@override var _parent_start = Scene_Map.prototype.start; Scene_Map.prototype.start = function () { _parent_start.call(this); //移動後処理 if (this._transfer) { //マップ設定情報で拡大率変更 //イベントエディタからのテスト実行では$gameMap.metaが定義されない。 $gameMap._dp_scale = ('meta' in $dataMap) ? Number($dataMap.meta.zoomScale || $gameMap._dp_scale) : $gameMap._dp_scale; //カメラターゲット //イベントエディタからのテスト実行では$gameMap.metaが定義されない。 $gameMap._dp_target = ('meta' in $dataMap) ? Number($dataMap.meta.camTarget || 0) : 0; //パン $gameMap._dp_pan = new Point(); } //標準レンダリングサイズにリセット dp_renderSize.reset(); //カメラターゲット設定 camera.target = $gameMap._dp_target; //マップシーン開始時に拡大率変更をフック。 dp_setZoom($gameMap._dp_scale); //画面中心を強制設定する if ((!user_use_camera) && user_use_camera_transfer) camera.center(null, null, true); }; /* マップシーンの終了 */ //@override var _parent_terminate = Scene_Map.prototype.terminate; Scene_Map.prototype.terminate = function () { //マップシーン終了時に拡大率情報を保存。 camera.animation.end(); var zoomPos = dp_getZoomPos(); $gameScreen.setZoom(zoomPos.x, zoomPos.y, dp_renderSize.scale); $gameMap._dp_pan = dp_getpan(); _parent_terminate.call(this); }; /* エンカウントエフェクト */ if (!user_fix_encount) return; //@override Scene_Map.prototype.updateEncounterEffect = function () { if (this._encounterEffectDuration > 0) { this._encounterEffectDuration--; var speed = this.encounterEffectSpeed(); var n = speed - this._encounterEffectDuration; var p = n / speed; var q = ((p - 1) * 20 * p + 5) * p + 1; var zoomPos = dp_getZoomPos(); if (n === 2) { $gameScreen.setZoom(zoomPos.x, zoomPos.y, dp_renderSize.scale); this.snapForBattleBackground(); this.startFlashForEncounter(speed / 2); } $gameScreen.setZoom(zoomPos.x, zoomPos.y, (q * dp_renderSize.scale)); if (n === Math.floor(speed / 6)) { this.startFlashForEncounter(speed / 2); } if (n === Math.floor(speed / 2)) { BattleManager.playBattleBgm(); this.startFadeOut(this.fadeSpeed()); } } }; //エンカウントエフェクトここまで }()); /* Tilemap ============================================================================= Canvasモード時の軽量化、拡大率の反映 */ (function () { //@override var _Tilemap_createLayers = Tilemap.prototype._createLayers; Tilemap.prototype._createLayers = function () { if (this._lowerLayer instanceof Sprite) { this._lowerLayer.destroy(); } if (this._upperLayer instanceof Sprite) { this._upperLayer.destroy(); } _Tilemap_createLayers.call(this); }; }()); /* Game_Screen ============================================================================= アニメーション処理のフック */ (function () { //@override var _parent_update = Game_Screen.prototype.update; Game_Screen.prototype.update = function () { _parent_update.call(this); camera.animation.update(); }; //@override var _parent_initialize = Game_Screen.prototype.initialize; Game_Screen.prototype.initialize = function () { _parent_initialize.call(this); dp_renderSize.reset(); }; }()); }());
dazed/translations
www/js/plugins/DP_MapZoom.js
JavaScript
unknown
38,365
//============================================================================= // DTextPicture.js // ---------------------------------------------------------------------------- // (C) 2015 Triacontane // This software is released under the MIT License. // http://opensource.org/licenses/mit-license.php // ---------------------------------------------------------------------------- // Version // 1.19.0 2020/04/09 フレームウィンドウに余白を指定できる機能を追加 // 1.18.0 2020/04/05 制御文字\v[n, m]で埋められる文字をパラメータから指定できる機能を追加 // 1.17.0 2020/02/07 背景ウィンドウのスキンを変更できる機能を追加し、ウィンドウビルダーに対応 // 1.16.0 2020/02/01 複数行表示した場合の行間を指定できる機能を追加 // 1.15.1 2019/12/29 YEP_PluginCmdSwVar.jsと併用したとき、変数のリアルタイム変換が効かなくなる競合を修正 // 1.15.0 2019/10/21 カーソルのアクティブ状態を変更できるコマンドを追加 // アイテム表示の制御文字でアイコン表示可否を変更できる設定を追加 // 1.14.0 2019/01/13 背景ウィンドウにカーソル表示できる機能を追加 // 1.13.0 2018/11/25 背景色のグラデーションを設定できる機能を追加 // 1.12.0 2018/11/08 背景ウィンドウの透明度と文字列ピクチャの透明度を連動させるよう仕様変更 // 1.11.1 2018/10/20 プラグイン等でGame_Variables.prototype.setValueを呼んだとき、変数の添え字に文字列型の数値を渡した場合も変数のリアルタイム表示が効くよう修正 // 1.11.0 2018/10/13 公式プラグイン「TextDecoration.js」の設定を動的文字列に適用できる機能を追加 // 1.10.1 2018/05/30 アウトラインカラー取得で0およびその他の文字列を指定したときに正しく色が設定されない問題を修正(by奏ねこまさん) // 1.10.0 2017/02/12 アウトラインカラーをウィンドウカラー番号から指定できる機能を追加 // 1.9.0 2017/08/20 ウィンドウつきピクチャが重なったときにウィンドウがピクチャの下に表示される問題を修正 // 1.8.6 2017/06/28 フォント変更機能のヘルプが抜けていたので追加 // 1.8.5 2017/06/12 変数がマイナス値のときのゼロ埋め表示が正しく表示されない問題を修正 // 1.8.4 2017/05/10 プラグインを未適用のデータを読み込んだとき、最初の一回のみ動的文字列ピクチャが作成されない問題を修正 // 1.8.3 2017/04/19 自動翻訳プラグインに一部対応 // 1.8.2 2017/04/05 ピクチャの消去時にエラーが発生していた問題を修正 // 1.8.1 2017/03/30 拡大率と原点に対応していなかった問題を修正 // 1.8.0 2017/03/30 背景にウィンドウを表示できる機能を追加 // 1.7.1 2017/03/20 1.7.0で末尾がイタリック体の場合に、傾き部分が見切れてしまう問題を修正 // 1.7.0 2017/03/20 動的文字列を太字とイタリックにできる機能を追加 // 複数行表示かつ制御文字でアイコンを指定した場合に高さが余分に計算されてしまう問題の修正 // 1.6.2 2016/12/13 動的ピクチャに対して、ピクチャの表示とピクチャの色調変更を同フレームで行うと画像が消える問題の修正 // 1.6.1 2016/11/03 一通りの競合対策 // 1.6.0 2016/11/03 インストールされているフォントをピクチャのフォントとして利用できる機能を追加 // 1.5.1 2016/10/27 1.5.0でアウトラインカラーを指定するとエラーになっていた現象を修正 // 1.5.0 2016/10/23 制御文字で表示した変数の内容をリアルタイム更新できる機能を追加 // 1.4.2 2016/07/02 スクリプトからダイレクトで実行した場合も制御文字が反映されるよう修正(ただし余分にエスケープする必要あり) // 1.4.1 2016/06/29 制御文字「\{」で文字サイズを大きくした際、元のサイズに戻さないと正しいサイズで表示されない問題を修正 // 1.4.0 2016/06/28 D_TEXT実行後に画像を指定してピクチャを表示した場合は画像を優先表示するよう仕様変更 // 1.3.1 2016/06/07 描画文字が半角英数字のみかつフォントを未指定の場合に文字が描画されない不具合を修正 // 1.3.0 2016/06/03 制御文字\oc[c] \ow[n]に対応 // 1.2.2 2016/03/28 データベース情報を簡単に出力する制御文字を追加 // 1.2.1 2016/01/29 コマンド「D_TEXT_SETTING」の実装が「D_TEST_SETTING」になっていたので修正(笑) // 1.2.0 2016/01/27 複数行表示に対応 // 文字列の揃えと背景色を設定する機能を追加 // 変数をゼロ埋めして表示する機能を追加 // 1.1.3 2015/12/10 戦闘画面でもピクチャを使用できるよう修正 // 描画後にデバッグ画面等を開いて変数を修正した場合、再描画で変更が反映されてしまう問題を修正 // 1.1.2 2015/11/07 描画文字列に半角スペースが含まれていた場合も問題なく実行できるよう修正 // 1.1.0 2015/11/07 制御文字\C[n] \I[n] \{ \} に対応(\$と表示スピード制御系以外全部) // 1.0.1 2015/11/07 RPGツクールMV(日本語版)に合わせてコメントの表記を変更 // 1.0.0 2015/11/06 初版 // ---------------------------------------------------------------------------- // [Blog] : https://triacontane.blogspot.jp/ // [Twitter]: https://twitter.com/triacontane/ // [GitHub] : https://github.com/triacontane/ //============================================================================= /*: * @plugindesc 動的文字列ピクチャ生成プラグイン * @author トリアコンタン * * @param itemIconSwitchId * @text アイテムアイコンスイッチID * @desc 指定した番号のスイッチがONのとき\ITEM[n]でアイコンが表示されます。指定しない場合、常に表示されます。 * @default 0 * @type switch * * @param lineSpacingVariableId * @text 行間補正変数ID * @desc 複数行表示の際の行間に、指定した変数の値の分だけ補正が掛かります。大きすぎる値を設定すると見切れる場合があります。 * @default 0 * @type variable * * @param frameWindowSkin * @text フレームウィンドウスキン * @desc フレームウィンドウのスキンファイル名です。ウィンドウビルダーを使っている場合は、指定する必要があります。 * @default * @require 1 * @dir img/system/ * @type file * * @param frameWindowPadding * @text フレームウィンドウ余白 * @desc フレームウィンドウの余白です。 * @default 18 * @type number * * @param padCharacter * @text 埋め文字 * @desc 数値描画時、指定桁数に満たないときに埋められる文字です。半角で1文字だけ指定してください。 * @default 0 * * @help 指定した文字列でピクチャを動的に生成するコマンドを提供します。 * 文字列には各種制御文字(\v[n]等)も使用可能で、制御文字で表示した変数の値が * 変更されたときにリアルタイムでピクチャの内容を更新できます。 * * 以下の手順で表示します。 * 1 : プラグインコマンド[D_TEXT]で描画したい文字列と引数を指定(下記の例参照) * 2 : プラグインコマンド[D_TEXT_SETTING]で背景色や揃えを指定(任意) * 3 : イベントコマンド「ピクチャの表示」で「画像」を未選択に指定。 * ※ 1の時点ではピクチャは表示されないので必ずセットで呼び出してください。 * ※ ピクチャ表示前にD_TEXTを複数回実行すると、複数行表示できます。 * * ※ ver1.4.0より、[D_TEXT]実行後に「ピクチャの表示」で「画像」を指定した場合は * 動的文字列ピクチャ生成を保留として通常通り「画像」ピクチャが表示される * ように挙動が変更になりました。 * * プラグインコマンド詳細 * イベントコマンド「プラグインコマンド」から実行。 * (引数の間は半角スペースで区切る) * * D_TEXT [描画文字列] [文字サイズ] : 動的文字列ピクチャ生成の準備 * 例:D_TEXT テスト文字列 32 * * 表示後は通常のピクチャと同様に移動や回転、消去ができます。 * また、変数やアクターの表示など制御文字にも対応しています。 * * D_TEXT_SETTING ALIGN [揃え] : 揃え(左揃え、中央揃え、右揃え)の設定 * 0:左揃え 1:中央揃え 2:右揃え * * 例:D_TEXT_SETTING ALIGN 0 * D_TEXT_SETTING ALIGN CENTER * * ※ 揃えの設定は複数行を指定したときに最も横幅の大きい行に合わせられます。 *   よって単一行しか描画しないときは、この設定は機能しません。 * * D_TEXT_SETTING BG_COLOR [背景色] : 背景色の設定(CSSの色指定と同様の書式) * * 例:D_TEXT_SETTING BG_COLOR black * D_TEXT_SETTING BG_COLOR #336699 * D_TEXT_SETTING BG_COLOR rgba(255,255,255,0.5) * * 背景色のグラデーションをピクセル数で指定できます。 * D_TEXT_SETTING BG_GRADATION_RIGHT [ピクセル数] * D_TEXT_SETTING BG_GRADATION_LEFT [ピクセル数] * * 例:D_TEXT_SETTING BG_GRADATION_RIGHT 50 *   D_TEXT_SETTING BG_GRADATION_LEFT 50 * * D_TEXT_SETTING REAL_TIME ON : 制御文字で表示した変数のリアルタイム表示 * * 例:D_TEXT_SETTING REAL_TIME ON * * リアルタイム表示を有効にしておくと、ピクチャの表示後に変数の値が変化したとき * 自動でピクチャの内容も更新されます。 * * D_TEXT_SETTING WINDOW ON : 背景にウィンドウを表示する * 例:D_TEXT_SETTING WINDOW ON * * D_TEXT_SETTING FONT [フォント名] : 描画で使用するフォントを指定した名称に変更 * 例:D_TEXT_SETTING FONT MS P明朝 * * これらの設定はD_TEXTと同様、ピクチャを表示する前に行ってください。 * * 対応制御文字一覧(イベントコマンド「文章の表示」と同一です) * \V[n] * \N[n] * \P[n] * \G * \C[n] * \I[n] * \{ * \} * * 専用制御文字 * \V[n,m](m桁分のパラメータで指定した文字で埋めた変数の値) * \item[n] n 番のアイテム情報(アイコン+名称) * \weapon[n] n 番の武器情報(アイコン+名称) * \armor[n] n 番の防具情報(アイコン+名称) * \skill[n] n 番のスキル情報(アイコン+名称) * \state[n] n 番のステート情報(アイコン+名称) * \oc[c] アウトラインカラーを「c」に設定(※1) * \ow[n] アウトライン幅を「n」に設定(例:\ow[5]) * \f[b] フォントの太字化 * \f[i] フォントのイタリック化 * \f[n] フォントの太字とイタリックを通常に戻す * * ※1 アウトラインカラーの指定方法 * \oc[red] 色名で指定 * \oc[rgb(0,255,0)] カラーコードで指定 * \oc[2] 文字色番号\c[n]と同様のもので指定 * * 背景にウィンドウを表示しているときにカーソルを表示します。 * このコマンドは動的文字列ピクチャを表示後に実行してください。 * D_TEXT_WINDOW_CURSOR 1 ON # ピクチャ[1]にウィンドウカーソルを表示 * D_TEXT_WINDOW_CURSOR 2 OFF # ピクチャ[2]にウィンドウカーソルを消去 * * カーソルのアクティブ状態を変更するコマンドは以下の通りです。 * D_TEXT_WINDOW_CURSOR_ACTIVE 2 ON # ピクチャ[1]のカーソルをアクティブ * D_TEXT_WINDOW_CURSOR_ACTIVE 1 OFF # ピクチャ[1]のカーソルをストップ * * カーソル矩形の座標を指定する場合は以下の通りです。 * D_TEXT_WINDOW_CURSOR 1 ON 0 0 100 100 # ピクチャ[1]に[0,0,100,100]のサイズの * # ウィンドウカーソルを表示 * * 利用規約: * 作者に無断で改変、再配布が可能で、利用形態(商用、18禁利用等) * についても制限はありません。 * このプラグインはもうあなたのものです。 */ (function () { 'use strict'; var getCommandName = function (command) { return (command || '').toUpperCase(); }; var getArgNumber = function (arg, min, max) { if (arguments.length < 2) min = -Infinity; if (arguments.length < 3) max = Infinity; return (parseInt(convertEscapeCharacters(arg.toString())) || 0).clamp(min, max); }; var getArgString = function (arg, upperFlg) { arg = convertEscapeCharacters(arg); return upperFlg ? arg.toUpperCase() : arg; }; var getArgBoolean = function (arg) { return (arg || '').toUpperCase() === 'ON'; }; var connectArgs = function (args, startIndex, endIndex) { if (arguments.length < 2) startIndex = 0; if (arguments.length < 3) endIndex = args.length; var text = ''; for (var i = startIndex; i < endIndex; i++) { text += args[i]; if (i < endIndex - 1) text += ' '; } return text; }; var convertEscapeCharacters = function (text) { if (text === undefined || text === null) text = ''; var window = SceneManager.getHiddenWindow(); return window ? window.convertEscapeCharacters(text) : text; }; var getUsingVariables = function (text) { var usingVariables = []; text = text.replace(/\\/g, '\x1b'); text = text.replace(/\x1b\x1b/g, '\\'); text = text.replace(/\x1bV\[(\d+),\s*(\d+)]/gi, function () { var number = parseInt(arguments[1], 10); usingVariables.push(number); return $gameVariables.value(number); }.bind(this)); text = text.replace(/\x1bV\[(\d+)]/gi, function () { var number = parseInt(arguments[1], 10); usingVariables.push(number); return $gameVariables.value(number); }.bind(this)); text = text.replace(/\x1bV\[(\d+)]/gi, function () { var number = parseInt(arguments[1], 10); usingVariables.push(number); return $gameVariables.value(number); }.bind(this)); return usingVariables; }; /** * Create plugin parameter. param[paramName] ex. param.commandPrefix * @param pluginName plugin name(EncounterSwitchConditions) * @returns {Object} Created parameter */ var createPluginParameter = function (pluginName) { var paramReplacer = function (key, value) { if (value === 'null') { return value; } if (value[0] === '"' && value[value.length - 1] === '"') { return value; } try { return JSON.parse(value); } catch (e) { return value; } }; var parameter = JSON.parse(JSON.stringify(PluginManager.parameters(pluginName), paramReplacer)); PluginManager.setParameters(pluginName, parameter); return parameter; }; var textDecParam = createPluginParameter('TextDecoration'); var param = createPluginParameter('DTextPicture'); //============================================================================= // Game_Interpreter // プラグインコマンド[D_TEXT]を追加定義します。 //============================================================================= var _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand; Game_Interpreter.prototype.pluginCommand = function (command, args) { _Game_Interpreter_pluginCommand.apply(this, arguments); this.pluginCommandDTextPicture(command, args); }; // Resolve conflict for YEP_PluginCmdSwVar.js var _Game_Interpreter_processPluginCommandSwitchVariables = Game_Interpreter.prototype.processPluginCommandSwitchVariables; Game_Interpreter.prototype.processPluginCommandSwitchVariables = function () { if (this._params[0].toUpperCase().indexOf('D_TEXT') >= 0) { return; } _Game_Interpreter_processPluginCommandSwitchVariables.apply(this, arguments); }; Game_Interpreter.textAlignMapper = { LEFT: 0, CENTER: 1, RIGHT: 2, 左: 0, 中央: 1, 右: 2 }; Game_Interpreter.prototype.pluginCommandDTextPicture = function (command, args) { switch (getCommandName(command)) { case 'D_TEXT': if (isNaN(args[args.length - 1]) || args.length === 1) args.push($gameScreen.dTextSize || 28); var fontSize = getArgNumber(args.pop()); $gameScreen.setDTextPicture(connectArgs(args), fontSize); break; case 'D_TEXT_SETTING': switch (getCommandName(args[0])) { case 'ALIGN': $gameScreen.dTextAlign = isNaN(args[1]) ? Game_Interpreter.textAlignMapper[getArgString(args[1], true)] : getArgNumber(args[1], 0, 2); break; case 'BG_COLOR': $gameScreen.dTextBackColor = getArgString(connectArgs(args, 1)); break; case 'BG_GRADATION_LEFT': $gameScreen.dTextGradationLeft = getArgNumber(args[1], 0); break; case 'BG_GRADATION_RIGHT': $gameScreen.dTextGradationRight = getArgNumber(args[1], 0); break; case 'FONT': args.shift(); $gameScreen.setDtextFont(getArgString(connectArgs(args))); break; case 'REAL_TIME': $gameScreen.dTextRealTime = getArgBoolean(args[1]); break; case 'WINDOW': $gameScreen.dWindowFrame = getArgBoolean(args[1]); break; } break; case 'D_TEXT_WINDOW_CURSOR': var windowRect = null; if (getArgBoolean(args[1])) { windowRect = { x: getArgNumber(args[3] || '', 0), y: getArgNumber(args[4] || '', 0), width: getArgNumber(args[5] || '', 0), height: getArgNumber(args[6] || '', 0) }; } $gameScreen.setDTextWindowCursor(getArgNumber(args[0], 0), windowRect); break; case 'D_TEXT_WINDOW_CURSOR_ACTIVE': $gameScreen.setDTextWindowCursorActive(getArgNumber(args[0], 0), getArgBoolean(args[1])); break; } }; //============================================================================= // Game_Variables // 値を変更した変数の履歴を取得します。 //============================================================================= var _Game_Variables_setValue = Game_Variables.prototype.setValue; Game_Variables.prototype.setValue = function (variableId, value) { variableId = parseInt(variableId); if (this.value(variableId) !== value) { this._changedVariables = this.getChangedVariables(); if (!this._changedVariables.contains(variableId)) { this._changedVariables.push(variableId); } } _Game_Variables_setValue.apply(this, arguments); }; Game_Variables.prototype.getChangedVariables = function () { return this._changedVariables || []; }; Game_Variables.prototype.clearChangedVariables = function () { return this._changedVariables = []; }; //============================================================================= // Game_Screen // 動的ピクチャ用のプロパティを追加定義します。 //============================================================================= var _Game_Screen_clear = Game_Screen.prototype.clear; Game_Screen.prototype.clear = function () { _Game_Screen_clear.call(this); this.clearDTextPicture(); }; Game_Screen.prototype.clearDTextPicture = function () { this.dTextValue = null; this.dTextOriginal = null; this.dTextRealTime = null; this.dTextSize = 0; this.dTextAlign = 0; this.dTextBackColor = null; this.dTextFont = null; this.dUsingVariables = null; this.dWindowFrame = null; this.dTextGradationRight = 0; this.dTextGradationLeft = 0; }; Game_Screen.prototype.setDTextPicture = function (value, size) { if (typeof TranslationManager !== 'undefined') { TranslationManager.translateIfNeed(value, function (translatedText) { value = translatedText; }); } this.dUsingVariables = (this.dUsingVariables || []).concat(getUsingVariables(value)); this.dTextValue = (this.dTextValue || '') + getArgString(value, false) + '\n'; this.dTextOriginal = (this.dTextOriginal || '') + value + '\n'; this.dTextSize = size; }; Game_Screen.prototype.setDTextWindowCursor = function (pictureId, rect) { var picture = this.picture(pictureId); if (picture) { picture.setWindowCursor(rect); picture.setWindowCursorActive(true); } }; Game_Screen.prototype.setDTextWindowCursorActive = function (pictureId, value) { var picture = this.picture(pictureId); if (picture) { picture.setWindowCursorActive(value); } }; Game_Screen.prototype.getDTextPictureInfo = function () { return { value: this.dTextValue, size: this.dTextSize || 0, align: this.dTextAlign || 0, color: this.dTextBackColor, font: this.dTextFont, usingVariables: this.dUsingVariables, realTime: this.dTextRealTime, originalValue: this.dTextOriginal, windowFrame: this.dWindowFrame, gradationLeft: this.dTextGradationLeft, gradationRight: this.dTextGradationRight, }; }; Game_Screen.prototype.isSettingDText = function () { return !!this.dTextValue; }; Game_Screen.prototype.setDtextFont = function (name) { this.dTextFont = name; }; var _Game_Screen_updatePictures = Game_Screen.prototype.updatePictures; Game_Screen.prototype.updatePictures = function () { _Game_Screen_updatePictures.apply(this, arguments); $gameVariables.clearChangedVariables(); }; //============================================================================= // Game_Picture // 動的ピクチャ用のプロパティを追加定義し、表示処理を動的ピクチャ対応に変更します。 //============================================================================= var _Game_Picture_initBasic = Game_Picture.prototype.initBasic; Game_Picture.prototype.initBasic = function () { _Game_Picture_initBasic.call(this); this.dTextValue = null; this.dTextInfo = null; }; var _Game_Picture_show = Game_Picture.prototype.show; Game_Picture.prototype.show = function (name, origin, x, y, scaleX, scaleY, opacity, blendMode) { if ($gameScreen.isSettingDText() && !name) { arguments[0] = Date.now().toString(); this.dTextInfo = $gameScreen.getDTextPictureInfo(); $gameScreen.clearDTextPicture(); } else { this.dTextInfo = null; } _Game_Picture_show.apply(this, arguments); }; var _Game_Picture_update = Game_Picture.prototype.update; Game_Picture.prototype.update = function () { _Game_Picture_update.apply(this, arguments); if (this.dTextInfo && this.dTextInfo.realTime) { this.updateDTextVariable(); } }; Game_Picture.prototype.updateDTextVariable = function () { $gameVariables.getChangedVariables().forEach(function (variableId) { if (this.dTextInfo.usingVariables.contains(variableId)) { this._name = Date.now().toString(); this.dTextInfo.value = getArgString(this.dTextInfo.originalValue, false); } }, this); }; Game_Picture.prototype.setWindowCursor = function (rect) { this._windowCursor = rect; }; Game_Picture.prototype.getWindowCursor = function () { return this._windowCursor; }; Game_Picture.prototype.setWindowCursorActive = function (value) { this._windowCursorActive = value; }; Game_Picture.prototype.getWindowCursorActive = function () { return this._windowCursorActive; }; //============================================================================= // SceneManager // 文字描画用の隠しウィンドウを取得します。 //============================================================================= SceneManager.getHiddenWindow = function () { if (!this._hiddenWindow) { this._hiddenWindow = new Window_Hidden(1, 1, 1, 1); } return this._hiddenWindow; }; SceneManager.getSpriteset = function () { return this._scene._spriteset; }; //============================================================================= // Window_Base // 文字列変換処理に追加制御文字を設定します。 //============================================================================= var _Window_Base_convertEscapeCharacters = Window_Base.prototype.convertEscapeCharacters; Window_Base.prototype.convertEscapeCharacters = function (text) { text = _Window_Base_convertEscapeCharacters.call(this, text); text = text.replace(/\x1bV\[(\d+),\s*(\d+)]/gi, function () { return this.getVariablePadCharacter($gameVariables.value(parseInt(arguments[1], 10)), arguments[2]); }.bind(this)); text = text.replace(/\x1bITEM\[(\d+)]/gi, function () { var item = $dataItems[getArgNumber(arguments[1], 1, $dataItems.length)]; return this.getItemInfoText(item); }.bind(this)); text = text.replace(/\x1bWEAPON\[(\d+)]/gi, function () { var item = $dataWeapons[getArgNumber(arguments[1], 1, $dataWeapons.length)]; return this.getItemInfoText(item); }.bind(this)); text = text.replace(/\x1bARMOR\[(\d+)]/gi, function () { var item = $dataArmors[getArgNumber(arguments[1], 1, $dataArmors.length)]; return this.getItemInfoText(item); }.bind(this)); text = text.replace(/\x1bSKILL\[(\d+)]/gi, function () { var item = $dataSkills[getArgNumber(arguments[1], 1, $dataSkills.length)]; return this.getItemInfoText(item); }.bind(this)); text = text.replace(/\x1bSTATE\[(\d+)]/gi, function () { var item = $dataStates[getArgNumber(arguments[1], 1, $dataStates.length)]; return this.getItemInfoText(item); }.bind(this)); return text; }; Window_Base.prototype.getItemInfoText = function (item) { if (!item) { return ''; } return (this.isValidDTextIconSwitch() ? '\x1bi[' + item.iconIndex + ']' : '') + item.name; }; Window_Base.prototype.isValidDTextIconSwitch = function () { return !param.itemIconSwitchId || $gameSwitches.value(param.itemIconSwitchId); }; Window_Base.prototype.getVariablePadCharacter = function (value, digit) { var numText = String(Math.abs(value)); var pad = String(param.padCharacter) || '0'; while (numText.length < digit) { numText = pad + numText; } return (value < 0 ? '-' : '') + numText; }; //============================================================================= // Sprite_Picture // 画像の動的生成を追加定義します。 //============================================================================= var _Sprite_Picture_update = Sprite_Picture.prototype.update; Sprite_Picture.prototype.update = function () { _Sprite_Picture_update.apply(this, arguments); if (this._frameWindow) { this.updateFrameWindow(); } }; Sprite_Picture.prototype.updateFrameWindow = function () { var padding = this._frameWindow.standardPadding(); this._frameWindow.x = this.x - (this.anchor.x * this.width * this.scale.x) - padding; this._frameWindow.y = this.y - (this.anchor.y * this.height * this.scale.y) - padding; this._frameWindow.opacity = this.opacity; if (!this.visible) { this.removeFrameWindow(); return; } if (!this._addFrameWindow) { this.addFrameWindow(); } if (Graphics.frameCount % 2 === 0) { this.adjustScaleFrameWindow(); } this.updateFrameWindowCursor(); }; Sprite_Picture.prototype.updateFrameWindowCursor = function () { var picture = this.picture(); if (!picture) { return; } var rect = picture.getWindowCursor(); if (rect) { var width = rect.width || this._frameWindow.contentsWidth(); var height = rect.width || this._frameWindow.contentsHeight(); this._frameWindow.setCursorRect(0, 0, width, height); this._frameWindow.active = picture.getWindowCursorActive(); } else { this._frameWindow.setCursorRect(0, 0, 0, 0); } }; Sprite_Picture.prototype.adjustScaleFrameWindow = function () { var padding = this._frameWindow.standardPadding(); var newFrameWidth = Math.floor(this.width * this.scale.x + padding * 2); var newFrameHeight = Math.floor(this.height * this.scale.x + padding * 2); if (this._frameWindow.width !== newFrameWidth || this._frameWindow.height !== newFrameHeight) { this._frameWindow.move(this._frameWindow.x, this._frameWindow.y, newFrameWidth, newFrameHeight); } }; Sprite_Picture.prototype.addFrameWindow = function () { var parent = this.parent; if (parent) { var index = parent.getChildIndex(this); parent.addChildAt(this._frameWindow, index); this._addFrameWindow = true; } }; Sprite_Picture.prototype.removeFrameWindow = function () { var parent = this.parent; if (parent) { parent.removeChild(this._frameWindow); this._frameWindow = null; this._addFrameWindow = false; } }; var _Sprite_Picture_loadBitmap = Sprite_Picture.prototype.loadBitmap; Sprite_Picture.prototype.loadBitmap = function () { this.dTextInfo = this.picture().dTextInfo; if (this.dTextInfo) { this.makeDynamicBitmap(); } else { _Sprite_Picture_loadBitmap.apply(this, arguments); } }; Sprite_Picture.prototype.makeDynamicBitmap = function () { this.textWidths = []; this.hiddenWindow = SceneManager.getHiddenWindow(); this.hiddenWindow.resetFontSettings(this.dTextInfo); var bitmapVirtual = new Bitmap_Virtual(); this._processText(bitmapVirtual); this.hiddenWindow.resetFontSettings(this.dTextInfo); this.bitmap = new Bitmap(bitmapVirtual.width, bitmapVirtual.height); this.applyTextDecoration(); this.bitmap.fontFace = this.hiddenWindow.contents.fontFace; if (this.dTextInfo.color) { this.bitmap.fillAll(this.dTextInfo.color); var h = this.bitmap.height; var w = this.bitmap.width; var gradationLeft = this.dTextInfo.gradationLeft; if (gradationLeft > 0) { this.bitmap.clearRect(0, 0, gradationLeft, h); this.bitmap.gradientFillRect(0, 0, gradationLeft, h, 'rgba(0, 0, 0, 0)', this.dTextInfo.color, false); } var gradationRight = this.dTextInfo.gradationRight; if (gradationRight > 0) { this.bitmap.clearRect(w - gradationRight, 0, gradationRight, h); this.bitmap.gradientFillRect(w - gradationRight, 0, gradationRight, h, this.dTextInfo.color, 'rgba(0, 0, 0, 0)', false); } } this._processText(this.bitmap); this._colorTone = [0, 0, 0, 0]; if (this._frameWindow) { this.removeFrameWindow(); } if (this.dTextInfo.windowFrame) { var scaleX = this.picture().scaleX() / 100; var scaleY = this.picture().scaleY() / 100; this.makeFrameWindow(bitmapVirtual.width * scaleX, bitmapVirtual.height * scaleY); } this.hiddenWindow = null; }; Sprite_Picture.prototype.applyTextDecoration = function () { if (textDecParam.Mode >= 0) { this.bitmap.outlineColor = 'rgba(%1,%2,%3,%4)'.format(textDecParam.Red, textDecParam.Green, textDecParam.Blue, textDecParam.Alpha / 255); this.bitmap.decorationMode = textDecParam.Mode; } }; Sprite_Picture.prototype.makeFrameWindow = function (width, height) { var padding = this.hiddenWindow.standardPadding(); this._frameWindow = new Window_BackFrame(0, 0, width + padding * 2, height + padding * 2); if (param.frameWindowSkin) { this._frameWindow.windowskin = ImageManager.loadSystem(param.frameWindowSkin); } }; Sprite_Picture.prototype._processText = function (bitmap) { var textState = { index: 0, x: 0, y: 0, text: this.dTextInfo.value, left: 0, line: -1, height: 0 }; this._processNewLine(textState, bitmap); textState.height = this.hiddenWindow.calcTextHeight(textState, false); textState.index = 0; while (textState.text[textState.index]) { this._processCharacter(textState, bitmap); } }; Sprite_Picture.prototype._processCharacter = function (textState, bitmap) { if (textState.text[textState.index] === '\x1b') { var code = this.hiddenWindow.obtainEscapeCode(textState); switch (code) { case 'C': bitmap.textColor = this.hiddenWindow.textColor(this.hiddenWindow.obtainEscapeParam(textState)); break; case 'I': this._processDrawIcon(this.hiddenWindow.obtainEscapeParam(textState), textState, bitmap); break; case '{': this.hiddenWindow.makeFontBigger(); break; case '}': this.hiddenWindow.makeFontSmaller(); break; case 'F': switch (this.hiddenWindow.obtainEscapeParamString(textState).toUpperCase()) { case 'I': bitmap.fontItalic = true; break; case 'B': bitmap.fontBoldFotDtext = true; break; case '/': case 'N': bitmap.fontItalic = false; bitmap.fontBoldFotDtext = false; break; } break; case 'OC': var colorCode = this.hiddenWindow.obtainEscapeParamString(textState); var colorIndex = Number(colorCode); if (!isNaN(colorIndex)) { bitmap.outlineColor = this.hiddenWindow.textColor(colorIndex); } else { bitmap.outlineColor = colorCode; } break; case 'OW': bitmap.outlineWidth = this.hiddenWindow.obtainEscapeParam(textState); break; } } else if (textState.text[textState.index] === '\n') { this._processNewLine(textState, bitmap); } else { var c = textState.text[textState.index++]; var w = this.hiddenWindow.textWidth(c); bitmap.fontSize = this.hiddenWindow.contents.fontSize; bitmap.drawText(c, textState.x, textState.y, w * 2, textState.height, 'left'); textState.x += w; } }; Sprite_Picture.prototype._processNewLine = function (textState, bitmap) { if (bitmap instanceof Bitmap_Virtual) this.textWidths[textState.line] = textState.x; this.hiddenWindow.processNewLine(textState); textState.line++; if (bitmap instanceof Bitmap) textState.x = (bitmap.width - this.textWidths[textState.line]) / 2 * this.dTextInfo.align; }; Sprite_Picture.prototype._processDrawIcon = function (iconIndex, textState, bitmap) { var iconBitmap = ImageManager.loadSystem('IconSet'); var pw = Window_Base._iconWidth; var ph = Window_Base._iconHeight; var sx = iconIndex % 16 * pw; var sy = Math.floor(iconIndex / 16) * ph; bitmap.blt(iconBitmap, sx, sy, pw, ph, textState.x + 2, textState.y + (textState.height - ph) / 2); textState.x += Window_Base._iconWidth + 4; }; //============================================================================= // Bitmap_Virtual // サイズを計算するための仮想ビットマップクラス //============================================================================= function Bitmap_Virtual() { this.initialize.apply(this, arguments); } Bitmap_Virtual.prototype.initialize = function () { this.window = SceneManager.getHiddenWindow(); this.width = 0; this.height = 0; }; Bitmap_Virtual.prototype.drawText = function (text, x, y) { var baseWidth = this.window.textWidth(text); var fontSize = this.window.contents.fontSize; if (this.fontItalic) { baseWidth += Math.floor(fontSize / 6); } if (this.fontBoldFotDtext) { baseWidth += 2; } this.width = Math.max(x + baseWidth, this.width); this.height = Math.max(y + fontSize + 8, this.height); }; Bitmap_Virtual.prototype.blt = function (source, sx, sy, sw, sh, dx, dy, dw, dh) { this.width = Math.max(dx + (dw || sw), this.width); this.height = Math.max(dy + (dh || sh), this.height); }; //============================================================================= // Window_BackFrame // バックフレームウィンドウ //============================================================================= function Window_BackFrame() { this.initialize.apply(this, arguments); } Window_BackFrame.prototype.backOpacity = null; Window_BackFrame.prototype = Object.create(Window_Base.prototype); Window_BackFrame.prototype.constructor = Window_BackFrame; Window_BackFrame.prototype.standardPadding = function () { return param.frameWindowPadding; }; //============================================================================= // Window_Hidden // 文字描画用の隠しウィンドウ //============================================================================= function Window_Hidden() { this.initialize.apply(this, arguments); } Window_Hidden.prototype.backOpacity = null; Window_Hidden.prototype = Object.create(Window_Base.prototype); Window_Hidden.prototype.constructor = Window_Hidden; Window_Hidden.prototype._createAllParts = function () { this._windowBackSprite = {}; this._windowSpriteContainer = {}; this._windowContentsSprite = new Sprite(); this.addChild(this._windowContentsSprite); }; Window_Hidden.prototype._refreshAllParts = function () { }; Window_Hidden.prototype._refreshBack = function () { }; Window_Hidden.prototype._refreshFrame = function () { }; Window_Hidden.prototype._refreshCursor = function () { }; Window_Hidden.prototype._refreshArrows = function () { }; Window_Hidden.prototype._refreshPauseSign = function () { }; Window_Hidden.prototype.updateTransform = function () { }; Window_Hidden.prototype.resetFontSettings = function (dTextInfo) { if (dTextInfo) { var customFont = dTextInfo.font ? dTextInfo.font + ',' : ''; this.contents.fontFace = customFont + this.standardFontFace(); this.contents.fontSize = dTextInfo.size || this.standardFontSize(); } else { Window_Base.prototype.resetFontSettings.apply(this, arguments); } }; Window_Hidden.prototype.obtainEscapeParamString = function (textState) { var arr = /^\[.+?]/.exec(textState.text.slice(textState.index)); if (arr) { textState.index += arr[0].length; return arr[0].substring(1, arr[0].length - 1); } else { return ''; } }; var _Window_Hidden_calcTextHeight = Window_Hidden.prototype.calcTextHeight; Window_Hidden.prototype.calcTextHeight = function (textState, all) { var result = _Window_Hidden_calcTextHeight.apply(this, arguments); if (param.lineSpacingVariableId) { result += $gameVariables.value(param.lineSpacingVariableId); } return result; }; //============================================================================= // Bitmap // 太字対応 //============================================================================= var _Bitmap__makeFontNameText = Bitmap.prototype._makeFontNameText; Bitmap.prototype._makeFontNameText = function () { return (this.fontBoldFotDtext ? 'bold ' : '') + _Bitmap__makeFontNameText.apply(this, arguments); }; })();
dazed/translations
www/js/plugins/DTextPicture.js
JavaScript
unknown
42,827
// DarkPlasma_SkipCommandPersonal // Copyright (c) 2020 DarkPlasma // This software is released under the MIT license. // http://opensource.org/licenses/mit-license.php /** * 2020/03/10 1.1.0 パーティメンバーが一人の場合のみ有効にするパラメータを追加 * メニューや戦闘におけるアイテム/スキルの使用対象選択をスキップする機能を追加 * 2020/03/09 1.0.0 公開 */ /*: * @plugindesc キャラクター選択をスキップするプラグイン * @author DarkPlasma * @license MIT * * @param Enable Only When Solo Party * @desc パーティメンバーが一人の場合のみ有効にする * @text ソロ時のみ有効 * @type boolean * @default true * * @param Skip Select Item And Skill Target In Menu * @desc メニューでのアイテム/スキルの使用対象選択をスキップする * @text メニューアイテム対象選択省略 * @type boolean * @default true * * @param Skip Select Item And SKill Target For Friend In Battle * @desc 戦闘での味方に対するアイテム/スキルの使用対象選択をスキップする * @text 戦闘時アイテム対象選択省略 * @type boolean * @default true * * @help * このプラグインを導入すると、メニュー画面などでのキャラクター選択をスキップし、 * 強制的に先頭のキャラクターを選択します。 * * プラグインパラメータの設定により、 * アイテムやスキルの使用対象選択をスキップできます。 */ (function () { 'use strict'; const pluginName = document.currentScript.src.replace(/^.*\/(.*).js$/, function () { return arguments[1]; }); const pluginParameters = PluginManager.parameters(pluginName); const settings = { enableOnlyWhenSolo: String(pluginParameters['Enable Only When Solo Party'] || "true") === 'true', skipSelectTargetInMenu: String(pluginParameters['Skip Select Item And Skill Target In Menu'] || "true") === 'true', skipSelectTargetInBattle: String(pluginParameters['Skip Select Item And SKill Target For Friend In Battle']) === 'true', }; Game_Party.prototype.isSoloParty = function () { return this.members().length === 1; }; Scene_Menu.prototype.skipCommandPersonal = function () { return !settings.enableOnlyWhenSolo || $gameParty.isSoloParty(); }; const _Scene_Menu_commandPersonal = Scene_Menu.prototype.commandPersonal; Scene_Menu.prototype.commandPersonal = function () { if (this.skipCommandPersonal()) { $gameParty.setTargetActor($gameParty.leader()); this.onPersonalOk(); } else { _Scene_Menu_commandPersonal.call(this); } }; Scene_ItemBase.prototype.skipSelectTarget = function () { return settings.skipSelectTargetInMenu && (!settings.enableOnlyWhenSolo || $gameParty.isSoloParty()); }; const _Scene_ItemBase_determineItem = Scene_ItemBase.prototype.determineItem; Scene_ItemBase.prototype.determineItem = function () { if (this.skipSelectTarget()) { let action = new Game_Action(this.user()); action.setItemObject(this.item()); if (action.isForFriend()) { this._actorWindow.select(0); this.onActorOk(); this.activateItemWindow(); } else { _Scene_ItemBase_determineItem.call(this); } } else { _Scene_ItemBase_determineItem.call(this); } }; Scene_Battle.prototype.skipSelectTarget = function () { return settings.skipSelectTargetInBattle && (!settings.enableOnlyWhenSolo || $gameParty.isSoloParty()); }; const _Scene_Battle_selectActorSelection = Scene_Battle.prototype.selectActorSelection; Scene_Battle.prototype.selectActorSelection = function () { if (this.skipSelectTarget()) { this._actorWindow.select(0); this.onActorOk(); } else { _Scene_Battle_selectActorSelection.call(this); } }; })();
dazed/translations
www/js/plugins/DarkPlasma_SkipCommandPersonal.js
JavaScript
unknown
3,896
// DarkPlasma_TextLog // Copyright (c) 2017 DarkPlasma // This software is released under the MIT license. // http://opensource.org/licenses/mit-license.php /** * 2020/08/09 1.10.1 NobleMushroom.js と併用した際に、場所移動後にウィンドウが表示され続ける不具合を修正 * 2020/08/07 1.10.0 テキストログウィンドウ拡張用インターフェースを公開 * 2020/08/05 1.9.1 MPP_ChoiceEx.js との競合を解消 * 2020/06/23 1.9.0 プラグインコマンドでログを追加する機能を追加 * 外部向けログ追加インターフェース公開 * 2020/06/23 1.8.3 DarkPlasma_WordWrapForJapanese.js 等と併用しないとエラーになる不具合を修正 * 2020/06/03 1.8.2 NobleMushroom.js と併用した際に、セーブ・ロード画面でログを開ける不具合を修正 * 1.8.1 NobleMushroom.js と併用した際に、ポーズメニューでフリーズする不具合を修正 * タイトルに戻ってニューゲーム/ロードした際に、直前のデータのログを引き継ぐ不具合を修正 * 2020/05/30 1.8.0 ログから戻った際に最後のメッセージを再表示しない設定を追加 * スクロールテキストをログに含める設定を追加 * 選択肢をログに含める設定を追加 * 高さ計算ロジックを整理 * 2020/05/09 1.7.3 ログ表示/スクロール処理を軽量化 * 1.7.2 ログ保存イベント数を超えるとログが壊れる不具合を修正 * 2020/05/08 1.7.1 軽微なリファクタ * 1.7.0 名前ウィンドウの名前をログに含める設定を追加 * 2020/03/09 1.6.4 プラグインが無効の状態で読み込まれていても有効と判定される不具合を修正 * 2020/01/28 1.6.3 文章を表示しないイベントに自動区切り線を入れないよう修正 * 2020/01/27 1.6.2 決定キーでログウィンドウを閉じられるよう修正 * ログ開閉キーにpagedownキーを設定できるよう修正 * 1.6.1 ログ表示時の順序が逆になる不具合を修正 * DarkPlasma_WordWrapForJapanese(1.0.3以降)に対応 * 1.6.0 ログウィンドウを開くボタンでログウィンドウを閉じられるよう修正 * メッセージ同士の間隔やテキストログの行間の設定項目を追加 * DarkPlasma_NameWindowに対応できていなかった不具合を修正 * 記録できるイベントログ数を無制限に変更 * 記録できるイベント数、メッセージ数の設定を追加 * イベントごとにログを区切る機能を追加 * 2020/01/23 1.5.3 選択肢が開いている最中にログウィンドウを開いて戻ろうとするとエラーで落ちる不具合を修正 * 2020/01/18 1.5.2 DarkPlasma_NameWindowに対応 * version 1.5.1 * - 冗長な変数名を修正 * - パラメータの型を明示 * version 1.5.0 * - マウスドラッグやスワイプでログウィンドウをスクロールする機能のおためし版を実装 * version 1.4.0 * - ログウィンドウがスクロール可能な場合にスクロール可能アイコンを表示する機能を実装 * version 1.3.0 * - ログが空の場合にメニューからログウィンドウを開こうとするとフリーズする不具合を修正 * - 空のログウィンドウ表示可否フラグを実装 * version 1.2.1 * - 選択肢でログに空文字列が記録される不具合を修正 * - ログが空でもメニューやプラグインコマンドから開けた不具合を修正 * version 1.2.0 * - プラグインコマンドからテキストログを開く機能を実装 * - スイッチによるログ表示可能フラグON/OFF機能を実装 * version 1.1.0 * - スイッチによるログ記録のON/OFF機能を実装 * - テキストログを開くボタンの変更機能を実装 * - マウススクロールでもログのスクロールできる機能を実装 * - マウス右クリックでもログを閉じることができる機能を実装 * - マップ移動時にエラーで落ちる不具合を修正 * - YEP_MainMenuManager.js に対応 * version 1.0.3 * - 並列イベント終了時にログをリセットしないよう修正 * - ブザーフラグが正しく動作していなかった不具合を修正 * version 1.0.2 * - バトルイベント終了時、コモンイベント終了時にログをリセットしないよう修正 * - 長いイベントのログが正常にスクロールできていない不具合を修正 * version 1.0.1 * - デフォルトには存在しないメソッドを使用していた不具合を修正 */ /*: * @plugindesc イベントのテキストログを表示する * @author DarkPlasma * @license MIT * * @target MV * @url https://github.com/elleonard/RPGtkoolMV-Plugins * * @param Max View Count * @desc 1画面に表示する最大のメッセージ数 * @text 1画面のメッセージ数上限 * @default 16 * @type number * * @param Overflow Buzzer * @desc テキストログの端より先にスクロールしようとした時、ブザーを鳴らすかどうか * @text 限界以上スクロール時ブザー * @default false * @type boolean * * @param Disable Logging Switch * @desc 該当スイッチがONの間はログを残さない。0なら常にログを残す * @text ログ記録無効スイッチ * @default 0 * @type number * * @param Open Log Key * @desc テキストログウィンドウを開閉するためのボタン * @text ログウィンドウボタン * @default pageup * @type select * @option pageup * @option pagedown * @option shift * @option control * @option tab * * @param Disable Show Log Switch * @desc 該当スイッチがONの間はログを開かない。0なら常にログを開ける * @text ログウィンドウ無効スイッチ * @defalt 0 * @type number * * @param Show Log Window Without Text * @desc ログに表示すべきテキストがない場合でもログウィンドウを開く * @text 白紙ログでも開く * @default true * @type boolean * * @param Line Spacing * @desc ログ表示時の行間 * @text ログの行間 * @default 0 * @type number * * @param Message Spacing * @desc ログ表示時のメッセージ間隔(イベントコマンド単位でひとかたまり) * @text メッセージの間隔 * @default 0 * @type number * * @param Log Event Count * @desc 直近何件のイベントのログを記録するか(0以下で無限) * @text ログ記録イベント数 * @default 0 * @type number * * @param Log Event Message Count * @desc 直近何メッセージのログを記録するか(0以下で無限) * @text ログ記録メッセージ数 * @default 0 * @type number * * @param Event Log Splitter * @desc イベントとイベントの間に挟むための区切り線 * @text イベントログ区切り線 * @default ------------------------------------------------------- * @type string * * @param Auto Event Split * @desc イベントとイベントのログの間に区切り線を自動でいれるか * @text 自動イベント区切り線 * @default true * @type boolean * * @param Include Name In Log * @desc 名前ウィンドウの名前をログに含めるかどうか * @text 名前をログに含む * @default true * @type boolean * * @param Include Scroll Text In Log * @desc スクロールテキストをログに含めるかどうか * @text スクロールテキストをログに含む * @default false * @type boolean * * @param Include Choice In Log * @desc 選んだ選択肢をログに含めるかどうか * @text 選んだ選択肢をログに含む * @default true * @type boolean * * @param Choice Format * @desc ログに表示する選択肢のフォーマット。{choice} は選んだ選択肢に変換される * @text 選択肢フォーマット * @default 選択肢:{choice} * @type string * * @param Choice Color * @desc ログに表示する選択肢の色。色番号で指定できる他、適切なプラグインで拡張すれば#つきカラーコードで指定可能 * @text 選択肢カラー * @default 17 * * @param Include Choice Cancel In Log * @desc 選択肢をキャンセルした際のログを含めるかどうか。選択肢をログに含むが真の場合のみ有効 * @text キャンセルをログに含む * @default true * @type boolean * * @param Choice Cancel Text In Log * @desc 選択肢をキャンセルした際にログに記録する内容。キャンセルをログに含むが真の場合のみ有効 * @text キャンセルログ * @default キャンセル * @type string * * @param Smooth Back From Log * @desc ログシーンから戻った際にテキストを再度表示し直さない(ヘルプに要注意事項) * @text テキスト再表示なし * @default true * @type boolean * * @help * イベントのテキストログを表示します * * イベント会話中またはマップ上で pageup キー(L2ボタン)でログを表示します * イベント会話中はそのイベントの直前までのログを表示します * ログは上下キーでスクロールすることができます * キャンセルキーやログ開閉キーでログから抜け、イベントやマップに戻ります * * 注意: テキスト再表示なしを真にしている場合、 * Scene_Map.prototype.createMessageWindow 及び * Scene_Map.prototype.createScrollTextWindow の処理を上書きします。 * これらの関数に処理を加えているプラグインとは競合する恐れがありますので、 * それらよりも下にこのプラグインを追加してください * この設定が偽になっている場合、 * イベントに戻る際、最後のメッセージをもう一度最初から流します * * YEP_MessageCore.jsに対応しています * ツクール公式から配布されているv1.02は古いので * 必ず本家から最新を落として利用するようにしてください * * YEP_MainMenuManager.jsに対応しています * 適切に設定すればステータスメニューからログを開くことができます * 設定例: * Show: true * Enabled: this.isTextLogEnabled() * Main Bind: this.commandTextLog.bind(this) * * プラグインコマンド showTextLog から開くことも可能です * * プラグインコマンド insertLogSplitter を使用することで、 * イベントログに区切り線を追加できます * 自動イベント区切り線 設定をONにしておくことで、 * イベントごとに自動で区切り線を挿入させることもできます * * プラグインコマンド insertTextLog XXXX を使用することで、 * イベントログに任意のログを追加できます * * 操作方法(デフォルト) * pageupキー(L2ボタン) : ログを表示する * 上下キー/マウススクロール : ログをスクロールする * キャンセルキー/右クリック : ログから抜ける * * マウスドラッグやスワイプでもログをスクロールできますが、 * 環境差異に関して未検証なのでおためし版です * しばらく使われて問題が報告されなければ正式版とします * * 外部向けインターフェース * $gameSystem.insertTextLog(text): ログに文字列 text を追加します * * 拡張プラグインを書くことで、テキストログウィンドウの * エスケープ文字の挙動を定義できます * 詳細は https://github.com/elleonard/RPGtkoolMV-Plugins/blob/master/plugins/DarkPlasma_TextLogExtensionExample.js */ (function () { 'use strict'; const pluginName = 'DarkPlasma_TextLog'; const pluginParameters = PluginManager.parameters(pluginName); const maxViewCount = Number(pluginParameters['Max View Count']); const overflowBuzzer = String(pluginParameters['Overflow Buzzer']) === 'true'; const disableLoggingSwitch = Number(pluginParameters['Disable Logging Switch']); const openLogKey = String(pluginParameters['Open Log Key']); const disableShowLogSwitch = Number(pluginParameters['Disable Show Log Switch']); const showLogWindowWithoutText = String(pluginParameters['Show Log Window Without Text']) !== 'false'; const settings = { lineSpacing: Number(pluginParameters['Line Spacing'] || 8), messageSpacing: Number(pluginParameters['Message Spacing'] || 0), logEventCount: Number(pluginParameters['Log Event Count'] || 0), logMessageCount: Number(pluginParameters['Log Event Message Count'] || 0), eventLogSplitter: String(pluginParameters['Event Log Splitter'] || '-------------------------------'), autoEventLogSplit: String(pluginParameters['Auto Event Split'] || 'true') === 'true', includeName: String(pluginParameters['Include Name In Log'] || 'true') === 'true', includeScrollText: String(pluginParameters['Include Scroll Text In Log']) === 'true', includeChoice: String(pluginParameters['Include Choice In Log']) === 'true', choiceFormat: String(pluginParameters['Choice Format']), choiceColor: String(pluginParameters['Choice Color']).startsWith("#") ? String(pluginParameters['Choice Color']) : Number(pluginParameters['Choice Color']), includeChoiceCancel: String(pluginParameters['Include Choice Cancel In Log'] || 'true') === 'true', choiceCancelText: String(pluginParameters['Choice Cancel Text In Log'] || 'キャンセル'), smoothBackFromLog: String(pluginParameters['Smooth Back From Log'] || 'true') === 'true', }; /** * プラグインがロードされているかどうか * @param {string} name プラグインの名前 * @return {boolean} */ PluginManager.isLoadedPlugin = function (name) { return $plugins.some(plugin => plugin.name === name && plugin.status); }; class EventTextLog { constructor() { this.initialize(); } initialize() { this._messages = []; } /** * @return {LogMessage[]} */ get messages() { return this._messages; } /** * @return {number} */ get messageLength() { return this._messages.length; } /** * ログを追加する * @param {string} text テキスト */ addMessageLog(text) { this._messages.push(new LogMessage(text)); if (settings.logMessageCount > 0 && this._messages.length > settings.logMessageCount) { this._messages.splice(0, this._messages.length - settings.logMessageCount); } } } /** * ログメッセージ */ class LogMessage { /** * @param {string} text テキスト */ constructor(text) { this._text = text; this._height = 0; this._offsetY = 0; } /** * @return {string} */ get text() { return this._text; } /** * ログウィンドウに表示する際の高さを記録する * (再計算の処理が重いため、一度だけ計算する) * @param {number} height 表示高さ */ setHeight(height) { this._height = height; } get height() { return this._height; } /** * 表示開始Y座標を調整したいとき用 * @param {number} offsetY Yオフセット */ setOffsetY(offsetY) { this._offsetY = offsetY; } get offsetY() { return this._offsetY; } } /** * @type {EventTextLog} */ let currentEventLog = new EventTextLog(); /** * @type {EventTextLog[]} */ let pastEventLog = []; // ログ表示用シーン class Scene_TextLog extends Scene_Base { constructor() { super(); this.initialize.apply(this, arguments); } create() { super.create(); this.createBackground(); this.createWindowLayer(); this.createTextLogWindow(); } start() { super.start(); this._textLogWindow.refresh(); } createBackground() { this._backgroundSprite = new Sprite(); this._backgroundSprite.bitmap = SceneManager.backgroundBitmap(); this.addChild(this._backgroundSprite); } createTextLogWindow() { this._textLogWindow = new Window_TextLog(); this._textLogWindow.setHandler('cancel', this.popScene.bind(this)); this.addWindow(this._textLogWindow); } } // ログ表示用ウィンドウ class Window_TextLog extends Window_Base { constructor() { super(); this.initialize.apply(this, arguments); } initialize() { super.initialize(0, 0, Graphics.boxWidth, Graphics.boxHeight); /** * @type {LogMessage[]} */ this._viewTexts = []; if (pastEventLog.length > 0) { this._viewTexts = pastEventLog.map(pastLog => pastLog.messages).reverse() .reduce((accumlator, currentValue) => currentValue.concat(accumlator)); } if (currentEventLog.messageLength > 0) { this._viewTexts = this._viewTexts.concat(currentEventLog.messages); } // 表示行数制限 if (settings.logMessageCount > 0 && this._viewTexts.length > settings.logMessageCount) { this._viewTexts.splice(0, this._viewTexts.length - settings.logMessageCount); } this._cursor = this.calcDefaultCursor(); this._handlers = {}; this._maxViewCount = maxViewCount; } /** * @return {number} */ cursor() { return this._cursor; } /** * ハンドラを登録する * @param {string} symbol シンボル * @param {Function} method メソッド */ setHandler(symbol, method) { this._handlers[symbol] = method; } /** * 指定したシンボルでハンドラが登録されているか * @param {string} symbol シンボル */ isHandled(symbol) { return !!this._handlers[symbol]; } /** * 指定したシンボルのハンドラを呼び出す * @param {string} symbol シンボル */ callHandler(symbol) { if (this.isHandled(symbol)) { this._handlers[symbol](); } } /** * @return {boolean} */ isCursorMovable() { return true; } cursorDown() { if (!this.isCursorMax()) { this._cursor++; } } /** * これ以上下にスクロールできない状態かどうかを計算する * @return {boolean} */ isCursorMax() { const size = this._viewTexts.length; let height = 0; for (let i = this.cursor(); i < size; i++) { const text = this._viewTexts[i].text; const textHeight = this._viewTexts[i].height; height += textHeight === 0 ? this.calcMessageHeight(text) : textHeight; if (height > Graphics.boxHeight - this.lineHeight()) { return false; } } return true; } cursorUp() { if (this.cursor() > 0) { this._cursor--; } } processCursorMove() { if (this.isCursorMovable()) { const lastCursor = this.cursor(); let moved = false; if (Input.isRepeated('down') || TouchInput.wheelY > 0 || TouchInput.isDownMoved()) { this.cursorDown(); moved = true; } if (Input.isRepeated('up') || TouchInput.wheelY < 0 || TouchInput.isUpMoved()) { this.cursorUp(); moved = true; } if (overflowBuzzer && moved && lastCursor === this.cursor()) { SoundManager.playBuzzer(); } this._needRefresh = lastCursor !== this.cursor(); } } processCancel() { this.callHandler('cancel'); SoundManager.playCancel(); } processHandling() { if (this.isCancelEnabled() && this.isCancelTriggered()) { this.processCancel(); } } /** * @return {boolean} */ isCancelEnabled() { return this.isHandled('cancel'); } /** * @return {boolean} */ isCancelTriggered() { return Input.isRepeated('cancel') || Input.isTriggered('ok') || Input.isTriggered(openLogKey) || TouchInput.isCancelled(); } update() { super.update(); this.updateArrows(); this.processCursorMove(); this.processHandling(); /** * refresh処理は重いので、必要なケースのみ行う */ if (this._needRefresh) { this.refresh(); } } updateArrows() { this.upArrowVisible = this.cursor() > 0; this.downArrowVisible = !this.isCursorMax(); } refresh() { this.contents.clear(); this.drawTextLog(); } drawTextLog() { let height = 0; for (let i = this.cursor(); i < this.cursor() + this._maxViewCount; i++) { if (i < this._viewTexts.length) { const text = this._viewTexts[i].text; const textHeight = this._viewTexts[i].height; const offsetY = this._viewTexts[i].offsetY; this.drawTextEx(text, 0, height + offsetY); if (textHeight === 0) { this._viewTexts[i].setHeight(this.calcMessageHeight(text)); } height += this._viewTexts[i].height; if (height > Graphics.boxHeight) { break; } } } } /** * デフォルトのスクロール位置を計算する * @return {number} */ calcDefaultCursor() { var height = 0; var size = this._viewTexts.length; for (var i = 0; i < size; i++) { const text = this._viewTexts[size - 1 - i].text; this._viewTexts[size - 1 - i].setHeight(this.calcMessageHeight(text)); const textHeight = this._viewTexts[size - 1 - i].height; height += textHeight; if (height > Graphics.boxHeight - this.lineHeight()) { return (i > 0) ? size - i : size - 1; } } return 0; } /** * @return {number} */ lineHeight() { return this.contents.fontSize + settings.lineSpacing; } /** * メッセージの表示高さを計算する * @param {string} text テキスト * @return {number} */ calcMessageHeight(text) { this._calcMode = true; let height = 0; const lines = text.split('\n'); lines.forEach(line => { this._lineNumber = 1; this.drawTextEx(line, 0, 0); height += (this._textHeight + settings.lineSpacing) * this._lineNumber; }); this._calcMode = false; return height + settings.messageSpacing; } /** * テキストを描画し、その幅を返す * @param {string} text テキスト * @param {number} x X座標 * @param {number} y Y座標 * @return {number} */ drawTextEx(text, x, y) { if (this._calcMode) { /** * 計算モード時には描画しない */ let drawFunction = this.contents.drawText; this.contents.drawText = function () { }; const value = super.drawTextEx(text, x, y); this.contents.drawText = drawFunction; return value; } else { return super.drawTextEx(text, x, y); } } /** * テキストの高さを計算する * @param {MV.textState} textState テキストの状態 * @param {boolean} all 全文を対象とするか * @return {number} */ calcTextHeight(textState, all) { /** * 計算モード用 */ this._textHeight = super.calcTextHeight(textState, all); return this._textHeight; } /** * 改行する * @param {MV.textState} textState テキストの状態 */ processNewLine(textState) { super.processNewLine(textState); if (this._calcMode) { this._lineNumber++; } } } window[Window_TextLog.name] = Window_TextLog; /** * テキストログを追加する * @param {string} text ログに追加する文字列 */ function addTextLog(text) { currentEventLog.addMessageLog(text); }; /** * 現在のイベントのログを過去のイベントのログに移動する */ function moveToPrevLog() { // 文章を表示しないイベントは無視する if (currentEventLog.messageLength === 0) { return; } if (settings.autoEventLogSplit) { addTextLog(settings.eventLogSplitter, []); } pastEventLog.push(currentEventLog); if (settings.logEventCount > 0 && pastEventLog.length > settings.logEventCount) { pastEventLog.splice(0, pastEventLog.length - settings.logEventCount); } initializeCurrentEventLog(); }; /** * 現在のイベントのログを初期化する */ function initializeCurrentEventLog() { currentEventLog = new EventTextLog(); }; /** * 過去のイベントのログを初期化する */ function initializePastEventLog() { pastEventLog = []; } /**テキストログを表示できるかどうか * A ログが1行以上ある * B 空のログウィンドウを表示するフラグがtrue * C スイッチで禁止されていない * (A || B) && C * @return {boolean} */ function isTextLogEnabled() { return (showLogWindowWithoutText || (currentEventLog.messageLength > 0 || pastEventLog.length > 0)) && (disableShowLogSwitch === 0 || !$gameSwitches.value(disableShowLogSwitch)); }; /** * Scene_Mapのメッセージウィンドウを退避しておくクラス */ class EvacuatedMessageWindows { /** * @param {Window_Message} messageWindow メッセージウィンドウ * @param {Window_ScrollText} scrollTextWindow スクロールテキストウィンドウ * @param {Window_PauseMenu} pauseWindow ポーズメニューウィンドウ(NobleMushroom.js 用) */ constructor(messageWindow, scrollTextWindow, pauseWindow) { this._messageWindow = messageWindow; this._scrollTextWindow = scrollTextWindow; this._pauseWindow = pauseWindow; } /** * @return {Window_Message} */ get messageWindow() { return this._messageWindow; } /** * @return {Window_ScrollText} */ get scrollTextWindow() { return this._scrollTextWindow; } /** * @return {Window_PauseMenu} */ get pauseWindow() { return this._pauseWindow; } } /** * @type {EvacuatedMessageWindows} */ let evacuatedMessageWindow = null; // Scene_Mapの拡張 const _Scene_Map_start = Scene_Map.prototype.start; Scene_Map.prototype.start = function () { _Scene_Map_start.call(this); // 呼び出し中フラグの初期化 this.textLogCalling = false; }; const _Scene_Map_update = Scene_Map.prototype.update; Scene_Map.prototype.update = function () { // isSceneChangeOK時はイベント中も含まれるため、特殊な条件で許可する if (this.isActive() && !SceneManager.isSceneChanging()) { this.updateCallTextLog(); } _Scene_Map_update.call(this); }; const _Scene_Map_createMessageWindow = Scene_Map.prototype.createMessageWindow; Scene_Map.prototype.createMessageWindow = function () { /** * ログシーンからスムーズに戻るために、処理を上書きして * Windowインスタンスを新しく作らないようにする */ if (settings.smoothBackFromLog && evacuatedMessageWindow) { this._messageWindow = evacuatedMessageWindow.messageWindow; this.addWindow(this._messageWindow); this._messageWindow.subWindows().forEach(function (window) { this.addWindow(window); }, this); } else { _Scene_Map_createMessageWindow.call(this); } }; const _Scene_Map_createScrollTextWindow = Scene_Map.prototype.createScrollTextWindow; Scene_Map.prototype.createScrollTextWindow = function () { /** * ログシーンからスムーズに戻るために、処理を上書きして * Windowインスタンスを新しく作らないようにする */ if (settings.smoothBackFromLog && evacuatedMessageWindow) { this._scrollTextWindow = evacuatedMessageWindow.scrollTextWindow; this.addWindow(this._scrollTextWindow); } else { _Scene_Map_createScrollTextWindow.call(this); } }; if (PluginManager.isLoadedPlugin('NobleMushroom')) { /** * ハンドラを更新する */ Scene_Map.prototype.refreshPauseWindowHandlers = function () { this._pauseWindow.setHandler(Scene_Map.symbolSave, this.callSave.bind(this)); this._pauseWindow.setHandler(Scene_Map.symbolLoad, this.callLoad.bind(this)); this._pauseWindow.setHandler('quickSave', this.callQuickSave.bind(this)); this._pauseWindow.setHandler('quickLoad', this.callQuickLoad.bind(this)); this._pauseWindow.setHandler('toTitle', this.callToTitle.bind(this)); this._pauseWindow.setHandler('cancel', this.offPause.bind(this)); }; /** * NobleMushroom.js のほうが上に読み込まれている場合 */ if (Scene_Map.prototype.createPauseWindow) { const _Scene_Map_createPauseWindow = Scene_Map.prototype.createPauseWindow; Scene_Map.prototype.createPauseWindow = function () { /** * ログシーンからスムーズに戻るために、処理を上書きして * Windowインスタンスを新しく作らないようにする */ if (settings.smoothBackFromLog && evacuatedMessageWindow) { this._pauseWindow = evacuatedMessageWindow.pauseWindow; this.refreshPauseWindowHandlers(); this.addWindow(this._pauseWindow); } else { _Scene_Map_createPauseWindow.call(this); } }; } else { const _Scene_Map_onMapLoaded = Scene_Map.prototype.onMapLoaded; Scene_Map.prototype.onMapLoaded = function () { _Scene_Map_onMapLoaded.call(this); if (settings.smoothBackFromLog && evacuatedMessageWindow) { this._windowLayer.removeChild(this._pauseWindow); this._pauseWindow = evacuatedMessageWindow.pauseWindow; this.refreshPauseWindowHandlers(); this.addWindow(this._pauseWindow); } }; } } Scene_Map.prototype.updateCallTextLog = function () { if (this.isTextLogEnabled()) { if (this.isTextLogCalled()) { this.textLogCalling = true; } if (this.textLogCalling && !$gamePlayer.isMoving()) { this.callTextLog(); } } else { this.textLogCalling = false; } }; /** * どういうタイミングでバックログを開いても良いか * A マップを移動中(メニューを開ける間) * B イベント中かつ、メッセージウィンドウが開いている * C 表示すべきログが1行以上ある * D ログ表示禁止スイッチがOFF * E NobleMushroom.js でセーブ・ロード画面を開いていない * (A || B) && C && D && E */ Scene_Map.prototype.isTextLogEnabled = function () { return ($gameSystem.isMenuEnabled() || $gameMap.isEventRunning() && !this._messageWindow.isClosed()) && isTextLogEnabled() && !this.isFileListWindowActive(); }; /** * NobleMushroom.js でセーブ・ロード画面を開いているかどうか * @return {boolean} */ Scene_Map.prototype.isFileListWindowActive = function () { return this._fileListWindow && this._fileListWindow.isOpenAndActive(); }; Scene_Map.prototype.isTextLogCalled = function () { return Input.isTriggered(openLogKey); }; Scene_Map.prototype.callTextLog = function () { evacuatedMessageWindow = new EvacuatedMessageWindows( this._messageWindow, this._scrollTextWindow, this._pauseWindow ); SoundManager.playCursor(); SceneManager.push(Scene_TextLog); $gameTemp.clearDestination(); }; /** * Window_ScrollText */ const _Window_ScrollText_terminateMessage = Window_ScrollText.prototype.terminateMessage; Window_ScrollText.prototype.terminateMessage = function () { if (settings.includeScrollText && (disableLoggingSwitch === 0 || !$gameSwitches.value(disableLoggingSwitch)) && $gameMessage.hasText()) { let message = { text: "" }; message.text += this.convertEscapeCharacters($gameMessage.allText()); addTextLog(message.text); } _Window_ScrollText_terminateMessage.call(this); }; // Window_Messageの拡張 // メッセージ表示時にログに追加する const _Window_Message_terminateMessage = Window_Message.prototype.terminateMessage; Window_Message.prototype.terminateMessage = function () { if ((disableLoggingSwitch === 0 || !$gameSwitches.value(disableLoggingSwitch)) && $gameMessage.hasText()) { let message = { text: "" }; // YEP_MessageCore.js or DarkPlasma_NameWindow.js のネーム表示ウィンドウに対応 if (this.hasNameWindow() && this._nameWindow.active && settings.includeName) { const nameColor = this.nameColorInLog(this._nameWindow._text); message.text += `\x1bC[${nameColor}]${this._nameWindow._text}\n\x1bC[0]`; } message.text += this.convertEscapeCharacters($gameMessage.allText()); addTextLog(message.text); if ($gameMessage.isChoice()) { this._choiceWindow.addToLog(); } } _Window_Message_terminateMessage.call(this); }; // YEP_MessageCore.js や DarkPlasma_NameWindow のネーム表示ウィンドウを使用しているかどうか Window_Message.prototype.hasNameWindow = function () { return this._nameWindow && (typeof Window_NameBox !== 'undefined' || PluginManager.isLoadedPlugin('DarkPlasma_NameWindow')); }; Window_Message.prototype.nameColorInLog = function (name) { if (PluginManager.isLoadedPlugin('DarkPlasma_NameWindow')) { return this.colorByName(name); } if (Yanfly && Yanfly.Param && Yanfly.Param.MSGNameBoxColor) { return Yanfly.Param.MSGNameBoxColor; } return 0; }; const _Window_ChoiceList_windowWidth = Window_ChoiceList.prototype.windowWidth; Window_ChoiceList.prototype.windowWidth = function () { // 再開時に選択肢が開いているとエラーになる不具合対策 if (!this._windowContentsSprite) { return 96; } return _Window_ChoiceList_windowWidth.call(this); }; /** * 選択した内容をログに記録する */ Window_ChoiceList.prototype.addToLog = function () { const chosenIndex = $gameMessage.chosenIndex(); if (settings.includeChoice && (disableLoggingSwitch === 0 || !$gameSwitches.value(disableLoggingSwitch)) && $gameMessage.hasText()) { let text = ""; // MPP_ChoiceEx.js は choiceCancelType を-1ではなく選択肢配列のサイズにする。 // 競合回避のため、 choiceCancelType を -1 に限定しない判定を行う。 if (chosenIndex === $gameMessage.choiceCancelType() && (chosenIndex < 0 || $gameMessage.choices().length <= chosenIndex)) { if (!settings.includeChoiceCancel) { return; } text = settings.choiceCancelText; } else { text = $gameMessage.choices()[chosenIndex]; } let message = { text: settings.choiceFormat.replace(/{choice}/gi, `\x1bC[${settings.choiceColor}]${text}\x1bC[0]`) }; addTextLog(message.text); } }; const _Game_Message_clear = Game_Message.prototype.clear; Game_Message.prototype.clear = function () { _Game_Message_clear.call(this); this._chosenIndex = null; }; const _Game_Message_onChoice = Game_Message.prototype.onChoice; Game_Message.prototype.onChoice = function (index) { _Game_Message_onChoice.call(this, index); this._chosenIndex = index; }; /** * 選択肢で選んだ番号を返す * @return {number|null} */ Game_Message.prototype.chosenIndex = function () { return this._chosenIndex; }; const _Game_Player_reserveTransfer = Game_Player.prototype.reserveTransfer; Game_Player.prototype.reserveTransfer = function (mapId, x, y, d, fadeType) { _Game_Player_reserveTransfer.call(this, mapId, x, y, d, fadeType); /** * 場所移動時に退避したメッセージウィンドウを初期化する * そうしないと、ログウィンドウから戻ったものと判定され、場所移動後にメッセージウィンドウが表示されっぱなしになるケースがある */ evacuatedMessageWindow = null; }; const _Game_System_initialize = Game_System.prototype.initialize; Game_System.prototype.initialize = function () { _Game_System_initialize.call(this); initializeCurrentEventLog(); initializePastEventLog(); evacuatedMessageWindow = null; }; const _Game_System_onAfterLoad = Game_System.prototype.onAfterLoad; Game_System.prototype.onAfterLoad = function () { _Game_System_onAfterLoad.call(this); initializeCurrentEventLog(); initializePastEventLog(); evacuatedMessageWindow = null; }; /** * ログにテキストを記録する * @param {string} text ログに記録したいテキスト */ Game_System.prototype.insertTextLog = function (text) { addTextLog(text); }; /** * イベント終了時にそのイベントのログを直前のイベントのログとして保持する */ const _Game_Interpreter_terminate = Game_Interpreter.prototype.terminate; Game_Interpreter.prototype.terminate = function () { // 以下の場合はリセットしない // - バトルイベント終了時 // - コモンイベント終了時 // - 並列イベント終了時 if (!this.isCommonOrBattleEvent() && !this.isParallelEvent()) { moveToPrevLog(); /** * イベント終了時に退避しておいたメッセージウィンドウも破棄する */ evacuatedMessageWindow = null; } _Game_Interpreter_terminate.call(this); }; // コモンイベントは以下の条件を満たす // A イベント中にcommand117で実行されるコモンイベント(depth > 0) // B IDなし(eventId === 0) // A || B // ただし、バトルイベントもeventIdが0のため、厳密にその二者を区別はできない Game_Interpreter.prototype.isCommonOrBattleEvent = function () { return this._depth > 0 || this._eventId === 0; }; // 並列実行イベントかどうか // コモンイベントは判定不能のため、isCommonOrBattleEventに任せる Game_Interpreter.prototype.isParallelEvent = function () { return this._eventId !== 0 && this.isOnCurrentMap() && $gameMap.event(this._eventId).isTriggerIn([4]); }; const _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand; Game_Interpreter.prototype.pluginCommand = function (command, args) { _Game_Interpreter_pluginCommand.call(this, command, args); switch ((command || '')) { case 'showTextLog': if (isTextLogEnabled()) { SceneManager.push(Scene_TextLog); } break; case 'insertLogSplitter': addTextLog(settings.eventLogSplitter, []); break; case 'insertTextLog': addTextLog(args[0]); break; } } // Scene_Menu拡張 // YEP_MainMenuManager.jsでコマンド指定する際に実行する Scene_Menu.prototype.commandTextLog = function () { SceneManager.push(Scene_TextLog); }; // Window_MenuCommand拡張 Window_MenuCommand.prototype.isTextLogEnabled = function () { return isTextLogEnabled(); }; // TouchInput拡張 マウスドラッグ/スワイプ対応 const _TouchInput_clear = TouchInput.clear; TouchInput.clear = function () { _TouchInput_clear.call(this); this._deltaX = 0; this._deltaY = 0; }; const _TouchInput_update = TouchInput.update; TouchInput.update = function () { _TouchInput_update.call(this); if (!this.isPressed()) { this._deltaX = 0; this._deltaY = 0; } }; const _TouchInput_onMove = TouchInput._onMove; TouchInput._onMove = function (x, y) { if (this._x !== 0) { this._deltaX = x - this._x; } if (this._y !== 0) { this._deltaY = y - this._y; } _TouchInput_onMove.call(this, x, y); }; // 上下にドラッグ、スワイプしているかどうか // 推し続けた時間の剰余を取ってタイミングを調整しているが // 環境による差異については未検証 TouchInput.isUpMoved = function () { return this._deltaY < 0 && this._pressedTime % 10 === 0; }; TouchInput.isDownMoved = function () { return this._deltaY > 0 && this._pressedTime % 10 === 0; }; })();
dazed/translations
www/js/plugins/DarkPlasma_TextLog.js
JavaScript
unknown
41,286
//============================================================================= // EnemyBook.js //============================================================================= /*: * @plugindesc Displays detailed statuses of enemies. * @author Yoji Ojima * * @param Unknown Data * @desc The index name for an unknown enemy. * @default ?????? * * @help * * Plugin Command: * EnemyBook open # Open the enemy book screen * EnemyBook add 3 # Add enemy #3 to the enemy book * EnemyBook remove 4 # Remove enemy #4 from the enemy book * EnemyBook complete # Complete the enemy book * EnemyBook clear # Clear the enemy book * * Enemy Note: * <desc1:foobar> # Description text in the enemy book, line 1 * <desc2:blahblah> # Description text in the enemy book, line 2 * <book:no> # This enemy does not appear in the enemy book */ /*:ja * @plugindesc モンスター図鑑です。敵キャラの詳細なステータスを表示します。 * @author Yoji Ojima * * @param Unknown Data * @desc 未確認の敵キャラの索引名です。 * @default ?????? * * @help * * プラグインコマンド: * EnemyBook open # 図鑑画面を開く * EnemyBook add 3 # 敵キャラ3番を図鑑に追加 * EnemyBook remove 4 # 敵キャラ4番を図鑑から削除 * EnemyBook complete # 図鑑を完成させる * EnemyBook clear # 図鑑をクリアする * * 敵キャラのメモ: * <desc1:なんとか> # 説明1行目 * <desc2:かんとか> # 説明2行目 * <book:no> # 図鑑に載せない場合 */ (function () { var parameters = PluginManager.parameters('EnemyBook'); var unknownData = String(parameters['Unknown Data'] || '??????'); var _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand; Game_Interpreter.prototype.pluginCommand = function (command, args) { _Game_Interpreter_pluginCommand.call(this, command, args); if (command === 'EnemyBook') { switch (args[0]) { case 'open': SceneManager.push(Scene_EnemyBook); break; case 'add': $gameSystem.addToEnemyBook(Number(args[1])); break; case 'remove': $gameSystem.removeFromEnemyBook(Number(args[1])); break; case 'complete': $gameSystem.completeEnemyBook(); break; case 'clear': $gameSystem.clearEnemyBook(); break; } } }; Game_System.prototype.addToEnemyBook = function (enemyId) { if (!this._enemyBookFlags) { this.clearEnemyBook(); } this._enemyBookFlags[enemyId] = true; }; Game_System.prototype.removeFromEnemyBook = function (enemyId) { if (this._enemyBookFlags) { this._enemyBookFlags[enemyId] = false; } }; Game_System.prototype.completeEnemyBook = function () { this.clearEnemyBook(); for (var i = 1; i < $dataEnemies.length; i++) { this._enemyBookFlags[i] = true; } }; Game_System.prototype.clearEnemyBook = function () { this._enemyBookFlags = []; }; Game_System.prototype.isInEnemyBook = function (enemy) { if (this._enemyBookFlags && enemy) { return !!this._enemyBookFlags[enemy.id]; } else { return false; } }; var _Game_Troop_setup = Game_Troop.prototype.setup; Game_Troop.prototype.setup = function (troopId) { _Game_Troop_setup.call(this, troopId); this.members().forEach(function (enemy) { if (enemy.isAppeared()) { $gameSystem.addToEnemyBook(enemy.enemyId()); } }, this); }; var _Game_Enemy_appear = Game_Enemy.prototype.appear; Game_Enemy.prototype.appear = function () { _Game_Enemy_appear.call(this); $gameSystem.addToEnemyBook(this._enemyId); }; var _Game_Enemy_transform = Game_Enemy.prototype.transform; Game_Enemy.prototype.transform = function (enemyId) { _Game_Enemy_transform.call(this, enemyId); $gameSystem.addToEnemyBook(enemyId); }; function Scene_EnemyBook() { this.initialize.apply(this, arguments); } Scene_EnemyBook.prototype = Object.create(Scene_MenuBase.prototype); Scene_EnemyBook.prototype.constructor = Scene_EnemyBook; Scene_EnemyBook.prototype.initialize = function () { Scene_MenuBase.prototype.initialize.call(this); }; Scene_EnemyBook.prototype.create = function () { Scene_MenuBase.prototype.create.call(this); this._indexWindow = new Window_EnemyBookIndex(0, 0); this._indexWindow.setHandler('cancel', this.popScene.bind(this)); var wy = this._indexWindow.height; var ww = Graphics.boxWidth; var wh = Graphics.boxHeight - wy; this._statusWindow = new Window_EnemyBookStatus(0, wy, ww, wh); this.addWindow(this._indexWindow); this.addWindow(this._statusWindow); this._indexWindow.setStatusWindow(this._statusWindow); }; function Window_EnemyBookIndex() { this.initialize.apply(this, arguments); } Window_EnemyBookIndex.prototype = Object.create(Window_Selectable.prototype); Window_EnemyBookIndex.prototype.constructor = Window_EnemyBookIndex; Window_EnemyBookIndex.lastTopRow = 0; Window_EnemyBookIndex.lastIndex = 0; Window_EnemyBookIndex.prototype.initialize = function (x, y) { var width = Graphics.boxWidth; var height = this.fittingHeight(6); Window_Selectable.prototype.initialize.call(this, x, y, width, height); this.refresh(); this.setTopRow(Window_EnemyBookIndex.lastTopRow); this.select(Window_EnemyBookIndex.lastIndex); this.activate(); }; Window_EnemyBookIndex.prototype.maxCols = function () { return 3; }; Window_EnemyBookIndex.prototype.maxItems = function () { return this._list ? this._list.length : 0; }; Window_EnemyBookIndex.prototype.setStatusWindow = function (statusWindow) { this._statusWindow = statusWindow; this.updateStatus(); }; Window_EnemyBookIndex.prototype.update = function () { Window_Selectable.prototype.update.call(this); this.updateStatus(); }; Window_EnemyBookIndex.prototype.updateStatus = function () { if (this._statusWindow) { var enemy = this._list[this.index()]; this._statusWindow.setEnemy(enemy); } }; Window_EnemyBookIndex.prototype.refresh = function () { this._list = []; for (var i = 1; i < $dataEnemies.length; i++) { var enemy = $dataEnemies[i]; if (enemy.name && enemy.meta.book !== 'no') { this._list.push(enemy); } } this.createContents(); this.drawAllItems(); }; Window_EnemyBookIndex.prototype.drawItem = function (index) { var enemy = this._list[index]; var rect = this.itemRectForText(index); var name; if ($gameSystem.isInEnemyBook(enemy)) { name = enemy.name; } else { name = unknownData; } this.drawText(name, rect.x, rect.y, rect.width); }; Window_EnemyBookIndex.prototype.processCancel = function () { Window_Selectable.prototype.processCancel.call(this); Window_EnemyBookIndex.lastTopRow = this.topRow(); Window_EnemyBookIndex.lastIndex = this.index(); }; function Window_EnemyBookStatus() { this.initialize.apply(this, arguments); } Window_EnemyBookStatus.prototype = Object.create(Window_Base.prototype); Window_EnemyBookStatus.prototype.constructor = Window_EnemyBookStatus; Window_EnemyBookStatus.prototype.initialize = function (x, y, width, height) { Window_Base.prototype.initialize.call(this, x, y, width, height); this._enemy = null; this._enemySprite = new Sprite(); this._enemySprite.anchor.x = 0.5; this._enemySprite.anchor.y = 0.5; this._enemySprite.x = width / 2 - 20; this._enemySprite.y = height / 2; this.addChildToBack(this._enemySprite); this.refresh(); }; Window_EnemyBookStatus.prototype.setEnemy = function (enemy) { if (this._enemy !== enemy) { this._enemy = enemy; this.refresh(); } }; Window_EnemyBookStatus.prototype.update = function () { Window_Base.prototype.update.call(this); if (this._enemySprite.bitmap) { var bitmapHeight = this._enemySprite.bitmap.height; var contentsHeight = this.contents.height; var scale = 1; if (bitmapHeight > contentsHeight) { scale = contentsHeight / bitmapHeight; } this._enemySprite.scale.x = scale; this._enemySprite.scale.y = scale; } }; Window_EnemyBookStatus.prototype.refresh = function () { var enemy = this._enemy; var x = 0; var y = 0; var lineHeight = this.lineHeight(); this.contents.clear(); if (!enemy || !$gameSystem.isInEnemyBook(enemy)) { this._enemySprite.bitmap = null; return; } var name = enemy.battlerName; var hue = enemy.battlerHue; var bitmap; if ($gameSystem.isSideView()) { bitmap = ImageManager.loadSvEnemy(name, hue); } else { bitmap = ImageManager.loadEnemy(name, hue); } this._enemySprite.bitmap = bitmap; this.resetTextColor(); this.drawText(enemy.name, x, y); x = this.textPadding(); y = lineHeight + this.textPadding(); for (var i = 0; i < 8; i++) { this.changeTextColor(this.systemColor()); this.drawText(TextManager.param(i), x, y, 160); this.resetTextColor(); this.drawText(enemy.params[i], x + 160, y, 60, 'right'); y += lineHeight; } var rewardsWidth = 280; x = this.contents.width - rewardsWidth; y = lineHeight + this.textPadding(); this.resetTextColor(); this.drawText(enemy.exp, x, y); x += this.textWidth(enemy.exp) + 6; this.changeTextColor(this.systemColor()); this.drawText(TextManager.expA, x, y); x += this.textWidth(TextManager.expA + ' '); this.resetTextColor(); this.drawText(enemy.gold, x, y); x += this.textWidth(enemy.gold) + 6; this.changeTextColor(this.systemColor()); this.drawText(TextManager.currencyUnit, x, y); x = this.contents.width - rewardsWidth; y += lineHeight; for (var j = 0; j < enemy.dropItems.length; j++) { var di = enemy.dropItems[j]; if (di.kind > 0) { var item = Game_Enemy.prototype.itemObject(di.kind, di.dataId); this.drawItemName(item, x, y, rewardsWidth); y += lineHeight; } } var descWidth = 480; x = this.contents.width - descWidth; y = this.textPadding() + lineHeight * 7; this.drawTextEx(enemy.meta.desc1, x, y + lineHeight * 0, descWidth); this.drawTextEx(enemy.meta.desc2, x, y + lineHeight * 1, descWidth); }; })();
dazed/translations
www/js/plugins/EnemyBook.js
JavaScript
unknown
11,692
//============================================================================= // イベント接触判定カスタマイズ Ver1.00 /*: @plugindesc イベント接触判定カスタマイズプラグイン @author 摘草 http:re-wind.org/ @help 通常、イベント起動条件が「プレイヤーから接触」「イベントから接触」となっている イベントは決定キーで隣のマスからも起動できてしまいますが、 それを無効化するプラグインです。 ゲーム中から変数t_ev_trigを操作することで設定の随時変更も恐らく可能(未確認)。 ファイル名を変更すると正常に動作しません。ファイル名を変える場合は 「EVtrig_Custum」部分を任意のファイル名に書き換えてください。 パラメータの値を変更することで下記のように動作します。 ↓パラメータの値 0:プレイヤーから接触&イベントから接触の両方無効 1:イベントから接触のみ無効 2:プレイヤーから接触のみ無効 3:無効化しない @param t_ev_trig @desc 0:プレイヤーから接触&イベントから接触 1:イベントから接触のみ 2:プレイヤーから接触のみ 3:無効化しない(デフォルト) @default 0 */ //============================================================================= (function () { var parameters = PluginManager.parameters('EVtrig_Custum'); var t_ev_trig = String(parameters['t_ev_trig']); var t_ev_trig_type = String(parameters['t_ev_trig_type']); //分岐 if (t_ev_trig == 0) { t_ev_trig_type = '[0]'; } else if (t_ev_trig == 1) { t_ev_trig_type = '[0,1]'; } else if (t_ev_trig == 2) { t_ev_trig_type = '[0,2]'; } else if (t_ev_trig == 3) { t_ev_trig_type = '[0,1,2]'; } //分岐ここまで Game_Player.prototype.triggerButtonAction = function () { if (Input.isTriggered('ok')) { if (this.getOnOffVehicle()) { return true; } this.checkEventTriggerHere([0]); if ($gameMap.setupStartingEvent()) { return true; } this.checkEventTriggerThere(t_ev_trig_type); if ($gameMap.setupStartingEvent()) { return true; } } return false; }; })();
dazed/translations
www/js/plugins/Evtrig_Custum.js
JavaScript
unknown
2,412
/*============================================================================= ExtraGauge.js ---------------------------------------------------------------------------- (C)2020 Triacontane This software is released under the MIT License. http://opensource.org/licenses/mit-license.php ---------------------------------------------------------------------------- Version 1.0.3 2020/09/16 ゲージ表示後に一度シーンを切り替えてからマップ移動するとゲージピクチャが消えてしまう問題を修正 1.0.2 2020/09/12 ヘルプのスクリプトの誤記を修正 1.0,1 2020/08/30 非表示のときは画像を更新しないよう修正 1.0.0 2020/08/29 初版 ---------------------------------------------------------------------------- [Blog] : https://triacontane.blogspot.jp/ [Twitter]: https://twitter.com/triacontane/ [GitHub] : https://github.com/triacontane/ =============================================================================*/ /*: * @plugindesc 汎用ゲージ追加プラグイン * @target MZ * @url https://github.com/triacontane/RPGMakerMV/tree/mz_master/ExtraGauge.js * @base PluginCommonBase * @author トリアコンタン * * @param GaugeList * @text ゲージリスト * @desc 各画面に追加するゲージのリストです。 * @default [] * @type struct<Gauge>[] * * @help ExtraGauge.js * * 各画面に追加で任意のゲージを好きなだけ表示できます。 * 現在値や最大値を変数、スクリプトから指定すれば、あとは値の変動に応じて * 自動的にゲージが増減します。 * * ゲージは、マップ画面と戦闘画面ではピクチャの上かつウィンドウの下に、 * それ以外の画面ではウィンドウの上に表示されます。 * * このプラグインの利用にはベースプラグイン『PluginCommonBase.js』が必要です。 * 『PluginCommonBase.js』は、RPGツクールMZのインストールフォルダ配下の * 以下のフォルダに格納されています。 * dlc/BasicResources/plugins/official * * 利用規約: * 作者に無断で改変、再配布が可能で、利用形態(商用、18禁利用等) * についても制限はありません。 * このプラグインはもうあなたのものです。 */ /*~struct~Gauge: * * @param SceneName * @text 対象シーン * @desc 追加対象のシーンです。オリジナルのシーンを対象にする場合はシーンクラス名を直接記入します。 * @type select * @default Scene_Title * @option タイトル * @value Scene_Title * @option マップ * @value Scene_Map * @option ゲームオーバー * @value Scene_Gameover * @option バトル * @value Scene_Battle * @option メインメニュー * @value Scene_Menu * @option アイテム * @value Scene_Item * @option スキル * @value Scene_Skill * @option 装備 * @value Scene_Equip * @option ステータス * @value Scene_Status * @option オプション * @value Scene_Options * @option セーブ * @value Scene_Save * @option ロード * @value Scene_Load * @option ゲーム終了 * @value Scene_End * @option ショップ * @value Scene_Shop * @option 名前入力 * @value Scene_Name * @option デバッグ * @value Scene_Debug * * @param Id * @text 識別子 * @desc ゲージの識別子です。特に使用されませんが、分かりやすい名称を設定すると管理がしやすくなります。 * @default gauge01 * * @param SwitchId * @text 表示スイッチID * @desc 指定したスイッチがONの場合のみ画面に表示されます。0を指定すると常に表示されます。 * @default 0 * @type switch * * @param OpacityVariable * @text 不透明度変数ID * @desc 不透明度を取得する変数番号です。0を指定すると常に不透明度255で表示されます。 * @default 0 * @type variable * * @param Layout * @text レイアウト * @desc ゲージの表示座標と幅、高さです。スクリプトを使用する場合、変数witch, heightでUIエリアの幅と高さを取得できます。 * @type struct<Layout> * @default {"x":"width / 2","y":"30","width":"width * 0.8","height":"36","GaugeX":"0","GaugeHeight":"0","Vertical":"false"} * * @param CurrentMethod * @text 現在値取得方法 * @desc ゲージの現在値を取得する方法です。変数、スクリプトのいずれかを設定します。 * @default {"VariableId":"1","Script":"","FixedValue":""} * @type struct<Method> * * @param MaxMethod * @text 最大値取得方法 * @desc ゲージの最大値を取得する方法です。変数、スクリプト、固定値のいずれかを設定します。 * @default {"VariableId":"0","Script":"","FixedValue":"100"} * @type struct<Method> * * @param Detail * @text 詳細設定 * @desc ゲージの配置や色などの細かい設定です。 * @type struct<Detail> * @default * * @param LowerPicture * @text 下ピクチャ * @desc ゲージの下に表示されるピクチャです。ゲージの中心と画像の中心が合わせて表示されます。 * @default * @type struct<Picture> * * @param UpperPicture * @text 上ピクチャ * @desc ゲージの上に表示されるピクチャです。ゲージの中心と画像の中心が合わせて表示されます。 * @default * @type struct<Picture> * * @param Battler * @text バトラー情報 * @desc ゲージの主体となるバトラー情報の参照方法を指定します。現在値、最大値をスクリプトで決める場合のみ使用します。 * @default * @type struct<Battler> */ /*~struct~Layout: * * @param x * @text X座標 * @desc X座標です。原点は中央です。数値以外を指定した場合はスクリプトとして評価します。 * @default width / 2 * * @param y * @text Y座標 * @desc Y座標です。原点は中央です。数値以外を指定した場合はスクリプトとして評価します。 * @default 30 * * @param width * @text 横幅 * @desc 横幅です。数値以外を指定した場合はスクリプトとして評価します。 * @default width * 0.8 * * @param height * @text 高さ * @desc 高さです。数値以外を指定した場合はスクリプトとして評価します。 * @default 36 * * @param GaugeX * @text ゲージX座標 * @desc ゲージのX座標です。ラベルが長い文字の場合は変更してください。 * @default 0 * * @param GaugeHeight * @text ゲージ高さ * @desc ゲージの高さです。0を指定すると全体の高さに合わせられます。 * @default 0 * * @param Vertical * @text 縦ゲージ * @desc 有効にすると縦方向ゲージになります。ラベルなども縦方向になるので注意してください。 * @default false * @type boolean */ /*~struct~Picture: * * @param FileName * @text ファイル名 * @desc ピクチャのファイル名です。 * @default * @type file * @dir img/pictures * * @param OffsetX * @text X座標補正値 * @desc X座標の補正値です。 * @default 0 * @type number * @min -9999 * * @param OffsetY * @text Y座標補正値 * @desc Y座標の補正値です。 * @default 0 * @type number * @min -9999 */ /*~struct~Method: * * @param VariableId * @text 取得変数ID * @desc ゲージの値を取得する変数番号です。スクリプトより優先して参照されます。 * @default 0 * @type variable * * @param Script * @text 取得スクリプト * @desc ゲージの値を取得するスクリプトです。固定値より優先して参照されます。 * @default * @type combo * @option battler.hp; // HP * @option battler.mhp; // 最大HP * @option battler.mp; // MP * @option battler.mmp; // 最大MP * @option battler.tp; // TP * @option battler.maxTp(); // 最大MP * @option meta.value; // メモ欄[value]の値 * * @param FixedValue * @text 固定値 * @desc ゲージの値を固定値で設定します。現在値に固定値を指定することは推奨しません。 * @default * @type number * @min 1 */ /*~struct~Detail: * * @param RisingSmoothness * @text 上昇中のなめらかさ * @desc 大きい数を指定するとゲージがゆっくりと上昇します。 * @default 1 * @type number * @min 1 * * @param FallingSmoothness * @text 下降中のなめらかさ * @desc 大きい数を指定するとゲージがゆっくりと下降します。 * @default 1 * @type number * @min 1 * * @param GaugeColorPreset * @text ゲージ色のプリセット * @desc ゲージ色をプリセットから簡易指定します。詳細指定があればそちらが優先されます。 * @default hp * @type select * @option * @option hp * @option mp * @option tp * @option time * * @param GaugeColorLeft * @text ゲージ色(左) * @desc 左側のゲージ色です。テキストカラー番号かCSS色指定(rgba(0, 0, 0, 0))を指定します。 * @default 0 * * @param GaugeColorRight * @text ゲージ色(右) * @desc 右側のゲージ色です。テキストカラー番号かCSS色指定(rgba(0, 0, 0, 0))を指定します。 * @default 0 * * @param BackColor * @text ゲージ背景色 * @desc ゲージ背景色です。テキストカラー番号かCSS色指定(rgba(0, 0, 0, 0))を指定します。 * @default 0 * * @param Label * @text ラベル * @desc ゲージの左に表示されるラベル文字列です。 * @default * * @param LabelFont * @text ラベルフォント * @desc ラベルを表示するときのフォント情報です。未指定の場合はゲージのデフォルト値が使用されます。 * @default * @type struct<Font> * * @param DrawValue * @text 現在値を描画する * @desc ゲージの右側に現在値を描画します。 * @default true * @type boolean * * @param ValueFont * @text 現在値フォント * @desc 現在値を表示するときのフォント情報です。未指定の場合はゲージのデフォルト値が使用されます。 * @default * @type struct<Font> * * @param FlashIfFull * @text 満タン時にフラッシュ * @desc ゲージの現在値が最大値以上になるとゲージをフラッシュさせます。 * @default false * @type boolean */ /*~struct~Font: * * @param Face * @text フォント名 * @desc フォント名です。woffファイルを指定してください。 * @default * @type file * @dir fonts * * @param Size * @text フォントサイズ * @desc フォントサイズです。 * @default 0 * @type number * * @param Color * @text テキストカラー * @desc テキストカラーです。テキストカラー番号かCSS色指定(rgba(0, 0, 0, 0))を指定します。 * @default 0 * @type number * * @param OutlineColor * @text アウトラインカラー * @desc アウトラインカラーです。テキストカラー番号かCSS色指定(rgba(0, 0, 0, 0))を指定します。 * @default 0 * @type number * * @param OutlineWidth * @text アウトライン横幅 * @desc アウトラインの横幅です。 * @default 0 * @type number */ /*~struct~Battler: * * @param Type * @text バトラー種別 * @desc ゲージの主体となるバトラーの取得方法です。 * @default * @type select * @option アクターID * @value ActorId * @option パーティの並び順 * @value PartyIndex * @option 敵キャラID * @value EnemyId * @option 敵グループの並び順(戦闘画面で有効) * @value TroopIndex * @option メニュー画面で選択したアクター(メニュー詳細画面で有効) * @value MenuActor * * @param ActorId * @text アクターID * @desc 種別選択で『アクターID』を選択したときのアクターIDです。 * @default 0 * @type actor * * @param EnemyId * @text 敵キャラID * @desc 種別選択で『敵キャラID』を選択したときの敵キャラIDです。 * @default 0 * @type enemy * * @param Index * @text 並び順 * @desc 種別選択で『パーティの並び順』『敵グループの並び順』を選択したときの並び順です。先頭は[0]です。 * @default 0 * @type number */ (() => { 'use strict'; const script = document.currentScript; const param = PluginManagerEx.createParameter(script); if (!param.GaugeList) { param.GaugeList = []; } const _Scene_Base_create = Scene_Base.prototype.create; Scene_Base.prototype.create = function () { _Scene_Base_create.apply(this, arguments); if (!(this instanceof Scene_Map)) { this.createExtraGauges(); } }; const _Scene_Map_create = Scene_Map.prototype.create; Scene_Map.prototype.create = function () { _Scene_Map_create.apply(this, arguments); this.createExtraGauges(); }; Scene_Base.prototype.createExtraGauges = function () { this._extraGauges = this.findExtraGaugeList().map(data => { return new Sprite_ExtraGaugeContainer(data, data.Detail || {}, data.Layout || {}); }); }; const _Scene_Base_createWindowLayer = Scene_Base.prototype.createWindowLayer; Scene_Base.prototype.createWindowLayer = function () { if (this instanceof Scene_Message) { this.addExtraGauge(); } _Scene_Base_createWindowLayer.apply(this, arguments); }; const _Scene_Base_start = Scene_Base.prototype.start; Scene_Base.prototype.start = function () { _Scene_Base_start.apply(this, arguments); this.addExtraGauge(); }; Scene_Base.prototype.addExtraGauge = function () { if (this._extraGaugesAdd) { return; } this._extraGauges.forEach(extraGauge => { this.addChild(extraGauge); }); this._extraGaugesAdd = true; }; Scene_Base.prototype.findExtraGaugeList = function () { const currentSceneName = PluginManagerEx.findClassName(this); return (param.GaugeList || []).filter(function (data) { return data.SceneName === currentSceneName; }, this); }; const _Sprite_Gauge_initialize = Sprite_Gauge.prototype.initialize; Sprite_Gauge.prototype.initialize = function (data, detail, layout) { if (data) { this._data = data; this._detail = detail; this._layout = layout; } _Sprite_Gauge_initialize.apply(this, arguments); }; /** * Sprite_ExtraGaugeContainer * 追加ゲージとピクチャを含むコンテナです。 */ class Sprite_ExtraGaugeContainer extends Sprite { constructor(data, detail, layout) { super(); this._data = data; this._detail = detail; this._layout = layout; this.create(); } create() { this._gauge = new Sprite_ExtraGauge(this._data, this._detail, this._layout); this._lower = this.createPicture(this._data.LowerPicture); this.addChild(this._gauge); this._upper = this.createPicture(this._data.UpperPicture); this.setupPosition(); this.update(); } setupPosition() { this.x = this._gauge.findLayoutValue(this._layout.x); this.y = this._gauge.findLayoutValue(this._layout.y); } update() { super.update(); this.updateVisibly(); this.updateOpacity(); } updateVisibly() { this.visible = this.isVisible(); } updateOpacity() { if (this._detail.OpacityVariable) { this.opacity = $gameVariables.value(this._detail.OpacityVariable); } } isVisible() { return !this._data.SwitchId || $gameSwitches.value(this._data.SwitchId); } createPicture(pictureData) { if (!pictureData || !pictureData.FileName) { return null; } const sprite = new Sprite(); sprite.anchor.x = 0.5; sprite.anchor.y = 0.5; sprite.bitmap = ImageManager.loadPicture(pictureData.FileName); sprite.x = pictureData.OffsetX || 0; sprite.y = pictureData.OffsetY || 0; this.addChild(sprite); return sprite; } } /** * Sprite_ExtraGauge * 追加ゲージを扱うクラスです。 */ class Sprite_ExtraGauge extends Sprite_Gauge { constructor(data, detail, layout) { super(data, detail, layout); this.setup(this.findBattler(), this._detail.GaugeColorPreset); this.setupPosition(); } findBattler() { const battlerData = this._data.Battler; if (!battlerData) { return $gameParty.menuActor(); } const methodName = `findBattler${battlerData.Type}`; if (this[methodName]) { return this[methodName](battlerData); } else { return $gameParty.menuActor(); } } findBattlerActorId(battlerData) { return $gameActors.actor(battlerData.ActorId); } findBattlerPartyIndex(battlerData) { return $gameParty.members()[battlerData.Index]; } findBattlerEnemyId(battlerData) { return new Game_Enemy(battlerData.EnemyId, 0, 0); } findBattlerTroopIndex(battlerData) { return $gameTroop.members()[battlerData.Index]; } updateBitmap() { const visible = this.parent ? this.parent.visible : false; if (visible) { if (!this._prevVisible) { this._value = this._targetValue; this._maxValue = this._targetMaxValue; } super.updateBitmap(); } this._prevVisible = visible; } updateFlashing() { if (!this._detail.FlashIfFull) { return; } if (this.isFull()) { this._flashingCount++; if (this._flashingCount % 20 < 10) { this.setBlendColor(this.flashingColor1()); } else { this.setBlendColor(this.flashingColor2()); } } else { this.setBlendColor([0, 0, 0, 0]); } } flashingColor1() { return [255, 255, 255, 96]; } flashingColor2() { return [255, 255, 255, 64]; } isFull() { return this._value >= this._maxValue; } setupPosition() { this.anchor.x = 0.5; this.anchor.y = 0.5; if (this._layout.Vertical) { this.rotation = (270 * Math.PI) / 180; } } bitmapWidth() { return this.findLayoutValue(this._layout.width) || super.bitmapWidth(); } bitmapHeight() { return this.findLayoutValue(this._layout.height) || super.bitmapHeight(); } gaugeHeight() { return this.findLayoutValue(this._layout.GaugeHeight) || this.bitmapHeight(); } gaugeX() { return this.findLayoutValue(this._layout.GaugeX) || 0; } findLayoutValue(value) { if (isNaN(value)) { try { const width = $dataSystem.advanced.uiAreaWidth; const height = $dataSystem.advanced.uiAreaHeight; return eval(value); } catch (e) { console.error(e); return 0; } } else { return value; } } currentValue() { return this.findValue(this._data.CurrentMethod); } currentMaxValue() { return Math.max(this.findValue(this._data.MaxMethod), 1) } findValue(method) { if (!method) { return 0; } else if (method.VariableId) { return $gameVariables.value(method.VariableId) } else if (method.Script) { const battler = this._battler; const meta = battler.isActor() ? battler.actor().meta : battler.enemy().meta; try { return eval(method.Script); } catch (e) { console.error(e); return 0; } } else { return method.FixedValue; } } label() { return this._detail.Label || ''; } labelColor() { return this.findColor(this.findLabelFont().Color, super.labelColor()); } labelOutlineColor() { return this.findColor(this.findLabelFont().OutlineColor, super.labelOutlineColor()); } labelOutlineWidth() { return this.findLabelFont().OutlineWidth || super.labelOutlineWidth(); } labelFontFace() { return this.findLabelFont().Face || super.labelFontFace(); } labelFontSize() { return this.findLabelFont().Size || super.labelFontSize(); } findLabelFont() { return this._detail.LabelFont || {}; } valueColor() { return this.findColor(this.findValueFont().Color, super.valueColor()); } valueOutlineColor() { return this.findColor(this.findValueFont().OutlineColor, super.valueOutlineColor()); } valueOutlineWidth() { return this.findValueFont().OutlineWidth || super.valueOutlineWidth(); } valueFontFace() { return this.findValueFont().Face || super.valueFontFace(); } valueFontSize() { return this.findValueFont().Size || super.valueFontSize(); } findValueFont() { return this._detail.ValueFont || {}; } gaugeBackColor() { return this.findColor(this._detail.BackColor, super.gaugeBackColor()); } gaugeColor1() { return this.findColor(this._detail.GaugeColorLeft, super.gaugeColor1()); } gaugeColor2() { return this.findColor(this._detail.GaugeColorRight, super.gaugeColor2()); } isValid() { return true; } smoothness() { if (this._value <= this._targetValue) { return this._detail.RisingSmoothness || 1; } else { return this._detail.FallingSmoothness || 1; } } drawValue() { if (this._detail.DrawValue) { super.drawValue(); } } findColor(code, defaultColor = null) { if (!code) { return defaultColor ? defaultColor : ColorManager.normalColor(); } else if (isNaN(code)) { return code; } else { return ColorManager.textColor(code); } } } })();
dazed/translations
www/js/plugins/ExtraGauge.js
JavaScript
unknown
23,435
//============================================================================= // 任意のメッセージを画面上にポップアップ表示するプラグイン // FTKR_PopupSpriteMessage.js // プラグインNo : 63 // 作成者 : フトコロ // 作成日 : 2018/01/05 // 最終更新日 : 2018/08/11 // バージョン : v1.2.5 //============================================================================= //============================================================================= // BattleEffectPopup.js //ベースにしたプラグイン // ---------------------------------------------------------------------------- // Copyright (c) 2015 Triacontane // This software is released under the MIT License. // http://opensource.org/licenses/mit-license.php //============================================================================= var Imported = Imported || {}; Imported.FTKR_PSM = true; var FTKR = FTKR || {}; FTKR.PSM = FTKR.PSM || {}; //============================================================================= /*: * @plugindesc v1.2.5 任意のメッセージを画面上にポップアップ表示するプラグイン * @author フトコロ * * @param Max Popup Messages * @desc 画面上に表示可能な文字列の数 * @default 10 * * @param Popup Message Status * @desc ポップアップ表示する際の設定 * 複数のパターンを設定し、プラグインコマンドで呼び出し可能 * @type struct<popup>[] * @default ["{\"fontFace\":\"\",\"fontSize\":\"28\",\"color\":\"[\\\"0\\\",\\\"0\\\",\\\"0\\\",\\\"0\\\"]\",\"italic\":\"false\",\"outlineColor\":\"15\",\"popupHeight\":\"40\",\"duration\":\"90\"}"] * * @param Repop Message After Menu * @desc メニュー開閉後にポップアップを再度表示させるか * @type boolean * @on 表示させる * @off 表示させない * @default false * * @help *----------------------------------------------------------------------------- * 概要 *----------------------------------------------------------------------------- * 画面の任意の位置に、任意の文字列をポップアップさせるプラグインです。 * マップ画面、バトル画面のどちらでも表示可能です。 * * ポップアップ時に文字列を1文字ずつ時間をずらしながら表示させることもできます。 * * * ポップアップ表示させた文字列は、以下の操作を行うことができます。 * 1.移動(画面外から移動や、画面外に移動も可) * 2.角度変更と回転 * 3.色調と透明度の変化 * 4.削除 * * * このプラグインは、トリアコンタンさんのBattleEffectPopup.js(v1.7.1)を * ベースにしています。 * * *----------------------------------------------------------------------------- * 設定方法 *----------------------------------------------------------------------------- * 1.「プラグインマネージャー(プラグイン管理)」に、本プラグインを追加して * ください。 * * *----------------------------------------------------------------------------- * 使い方 *----------------------------------------------------------------------------- * 1.プラグインパラメータPopup Message Statusに、ポップアップさせる時の * 設定を指定してください。 * * * 2.以下のプラグインコマンドでポップアップを表示します。 * ※[]は実際の入力に使用しません * * PSM_ポップアップ表示 [ポップアップID] [ポップアップ設定ID] [X座標] [Y座標] [表示時間] [文字列] [オプション] * PSM_SHOW_POPUP [popupId] [statusId] [x] [y] [duration] [text] [options] * * ポップアップID(popupId) * :1 から、プラグインパラメータMax Popup Messagesで設定した * 値の任意の数字を指定します。\v[n]で変数を指定することも可能です。 * この値を変えることで、同時に複数の文字列を表示できます。 * * ポップアップ設定ID(statusId) * :プラグインパラメータPopup Message Statusで設定した内容を呼び出します。 * 設定時の[リスト番号-1]の値を指定してください。 * \v[n]で変数を指定することも可能です。 * * X座標、Y座標 * :ポップアップを表示する場合の、画面上の座標を指定します。 *  \v[n]で変数を指定することも可能です。 *  デフォルトでは文字列の左上が原点ですが、オプション(options)部に *  -c と記載することで文字列の中心を原点にできます。 * * 表示時間(duration) * :ポップアップを表示している時間を指定します。 * ここで指定した時間が経過すると、自動的に表示が消えます。 * \v[n]で変数を指定することも可能です。 * -1 を指定すると、ポップアップが時間経過で消えません。 * この場合は、別途プラグインコマンドで消去を行ってください。 * * 文字列(text) * :ポップアップする内容を指定します。 * 半角スペースは使用できません。 * 半角スペースを入れたい場合は \_ (アンダーバー)と入力してください。 * また、以下の制御文字が使用可能です。 * \v[n] \N[n] \P[n] \G * * オプション(options) * :末尾に以下の文字列を入力することもできます。(順不同) *  オプションの文字列同士は半角スペースを空けてください。 * * -c : 指定する座標が文字列の中心になります。 * 入力しない場合は、文字列左上座標になります。 * * -s : 表示が完了するまでウェイトが掛かります。 * 表示時間を-1に設定した場合は無効です。 * * * なお、以下のコマンドでポップアップ設定IDを使用せずに、直接パラメータを指定できます。 * * PSM_ポップアップ表示B [ポップアップID] [X座標] [Y座標] [表示時間] [文字列] [フォント] [フォントサイズ] [文字色] [イタリック] [縁色] [バウンド高さ] [時間間隔] [透明度] [オプション] * PSM_SHOW_POPUP_B [popupId] [x] [y] [duration] [text] [fontFace] [fontSize] [color] [italic] [outlineColor] [popupHeight] [offsetWait] [opacity] [options] * * フォント(fontFace)以降のパラメータの意味は、プラグインパラメータと同じです。 * 以下のパラメータの入力方式に気をつけてください。 * * フォント(fontFace) * :指定しない場合は、-1 と記入してください。 * * 文字色(color) * :赤,青,緑,グレー の形式で入力してください。 *  それぞれの値は 0 ~ 255 の範囲です。半角スペースは禁止です。 *  例)255,0,0,100 * * イタリック(italic) * :true または false と記入してください。 *  true でイタリック表示です。 * * 縁色(outlineColor) * :縁取りなしにする場合は、-1 と記入してください。 * * * 2.以下のプラグインコマンドでポップアップを移動させます。 * ※[]は実際の入力に使用しません * * PSM_ポップアップ移動 [ポップアップID] [X座標] [Y座標] [移動時間] [オプション] * PSM_MOVE_POPUP [popupId] [x] [y] [duration] [options] * * ポップアップID(popupId) * :移動したいポップアップIDを指定します。 *  \v[n]で変数を指定することも可能です。 * * X座標、Y座標 * :ポップアップの移動先の、画面上の座標を指定します。 *  \v[n]で変数を指定することも可能です。 * * 表示時間(duration) * :ポップアップを移動させる時間を指定します。 * \v[n]で変数を指定することも可能です。 * 0 を指定すると即座に移動します。 * * オプション(options) * :末尾に以下の文字列を入力することもできます。 * * -s : 移動が完了するまでウェイトが掛かります。 * * * 3.以下のプラグインコマンドでポップアップを回転させます。 * ※[]は実際の入力に使用しません * * PSM_ポップアップ回転 [ポップアップID] [角度] [回転] * PSM_ROTATE_POPUP [popupId] [angle] [rotate] * * ポップアップID(popupId) * :回転したいポップアップIDを指定します。 *  \v[n]で変数を指定することも可能です。 * * 角度(angle) * :ポップアップを回転させる角度の増減値を指定します。(0 ~ 359) * \v[n]で変数を指定することも可能です。 * ポップアップの左上を原点に、正の値で時計周り側に回転します。 * * 回転(rotate) * :ポップアップを回転させるかどうかを指定します。 * ture で、指定した角度分回転し続けます。 * false で、指定した角度に変化させます。 * * * 4.以下のプラグインコマンドでポップアップの色調と透明度を変化させます。 * ※[]は実際の入力に使用しません * * PSM_ポップアップ色調変更 [ポップアップID] [色調] [透明度] [変化時間] [オプション] * PSM_CHANGECOLOR_POPUP [popupId] [tone] [opacity] [duration] [options] * * ポップアップID(popupId) * :移動したいポップアップIDを指定します。 *  \v[n]で変数を指定することも可能です。 * * 色調(tone) * :ポップアップの色調を指定します。 *  赤,青,緑,グレー の形式で入力してください。 *  それぞれの値は 0 ~ 255 の範囲です。半角スペースは禁止です。 *  例)255,0,0,100 *  -1 と入力すると、色調を変更しません。 * * 透明度(opacity) * :ポップアップの透明度を指定します。 *  \v[n]で変数を指定することも可能です。 *  -1 と入力すると、透明度を変更しません。 * * 変化時間(duration) * :ポップアップの色調と透明度を変化させる時間を指定します。 * \v[n]で変数を指定することも可能です。 * 0 を指定すると即座に変化します。 * * オプション(options) * :末尾に以下の文字列を入力することもできます。 * * -s : 変化が完了するまでウェイトが掛かります。 * * * 4.以下のプラグインコマンドでポップアップを消去します。 * ※[]は実際の入力に使用しません * * PSM_ポップアップ消去 [ポップアップID] [消去時間] [オプション] * PSM_ERASE_POPUP [popupId] [duration] [options] * * ポップアップID(popupId) * :消去したいポップアップIDを指定します。 * \v[n]で変数を指定することも可能です。 * * 消去時間(duration) * :ポップアップを消去する時間を指定します。 * ここで指定した時間が経過すると、自動的に表示が消えます。 * \v[n]で変数を指定することも可能です。 * 指定しない場合、または 0 を指定すると即座に消えます。 * * オプション(options) * :末尾に以下の文字列を入力することもできます。 * * -s : 消去が完了するまでウェイトが掛かります。 * * *----------------------------------------------------------------------------- * メニュー開閉とポップアップ表示について *----------------------------------------------------------------------------- * ポップアップ表示中にメニューを開閉すると、ポップアップ表示は消去されます。 * * プラグインパラメータ<Repop Message After Menu>を「表示する」に * 設定することで、メニュー開閉後に再表示させることができます。 * * * なお、メニュー開閉後の再表示の仕様は以下の通りです。 * * 1.ポップアップのバウンドと、1文字ずつ表示する機能は無効。(即座に表示) * 2.ポップアップの移動中にメニューを開閉すると、移動動作をキャンセルし *   移動後の場所に再表示します。 * 3.ポップアップの回転中にメニューを開閉すると、初期状態から再回転します。 *   角度を変えた場合は、その角度を維持します。 * * *----------------------------------------------------------------------------- * ウェイトコマンドの設定時間とポップアップ操作コマンドの実行時間について *----------------------------------------------------------------------------- * ポップアップ操作(移動、回転、色調変更)では、各操作の実行時間(duration)を * 0 に設定した場合でも極短時間(1ウェイト分)ですが処理が行われます。 * * そのため、操作コマンドの後にウェイトコマンドを入れる場合は * 最低でも、実行時間+1 のウェイトに設定してください。 * * * なお、各操作の実行処理が完了する前に、次の操作を実行した場合は * 前の処理を即座に終了させた上で、次の操作を実行します。 * * 例) * A地点に表示したポップアップ文字列を、B地点に移動させるコマンドを実行中に * (AとB地点の途中で)、C地点に移動させるコマンドを実行した場合は、 * 即座にBに移動させた上で、BからC地点に移動させます。 * * *----------------------------------------------------------------------------- * 本プラグインのライセンスについて(License) *----------------------------------------------------------------------------- * 本プラグインはMITライセンスのもとで公開しています。 * This plugin is released under the MIT License. * * Copyright (c) 2018 Futokoro * http://opensource.org/licenses/mit-license.php * * * プラグイン公開元 * https://github.com/futokoro/RPGMaker/blob/master/README.md * * *----------------------------------------------------------------------------- * 変更来歴 *----------------------------------------------------------------------------- * * v1.2.5 - 2018/08/11 : 不具合修正 * 1. プラグイン適用前のセーブデータからゲームを実行したときのエラー回避処理を追加。 * * v1.2.4 - 2018/03/10 : 不具合修正、機能追加 * 1. ポップアップの移動実行中に、別地点への移動コマンドを実行すると * 前の移動がキャンセルされて初期位置から移動してしまう不具合を修正。 * 2. ポップアップの操作実行時間とウェイト時間に関する注意をヘルプに追加。 * 3. ポップアップ表示コマンドに、文字列の中心座標を設定できる機能を追加。 * 4. ポップアップ動作が完了するまで、イベント処理にウェイトを掛ける機能を追加。 * * v1.2.3 - 2018/03/03 : 不具合修正 * 1. メニュー開閉時に色調と透明度が元に戻ってしまう不具合を修正。 * * v1.2.2 - 2018/03/03 : 不具合修正、機能追加 * 1. 文字の縁取りの色指定方法が間違っていたため修正。プラグインパラメータの * 初期値変更。 * 2. ポップアップの色調と透明度を変更するコマンドを追加。 * 3. ポップアップ表示のパラメータを直接設定するコマンドを追加。 * * v1.2.1 - 2018/02/28 : ヘルプ修正 * 1. ポップアップ表示のプラグインコマンドの説明で、ポップアップ設定IDの記述に * 誤記があったものを修正。 * * v1.2.0 - 2018/02/25 : 機能追加 * 1. メニュー開閉後にポップアップを再表示させる機能を追加。 * * v1.1.1 - 2018/02/24 : 不具合修正 * 1. $gamePartyの初期化処理が間違っていた不具合を修正。 * * v1.1.0 - 2018/01/06 : 機能追加 * 1. ポップアップを時間経過で消さない機能と、消去するコマンドを追加 * 2. ポップアップを移動および回転させるコマンドを追加 * * v1.0.0 - 2018/01/05 : 初版作成 * *----------------------------------------------------------------------------- */ //============================================================================= /*~struct~popup: * @param fontFace * @desc 使用するフォントを記述 * 空欄の場合はMVデフォルトフォントを使用 * @default * * @param fontSize * @desc フォントサイズ * @type number * @default 28 * * @param color * @desc 文字列の色を指定、各リスト番号の値の意味は以下 * 1:赤, 2:緑 ,3:青 ,4:グレー (0~255の範囲で指定) * @type number[] * @default ["0","0","0","0"] * * @param italic * @desc イタリック体で表示するか * @type boolean * @on 有効 * @off 無効 * @default false * * @param outlineColor * @desc 文字を縁取り表示する場合にカラー番号を指定(0~31) * 空欄は縁取りなし * @default 15 * * @param popupHeight * @desc ポップアップ時にバウンドさせる高さ * @type number * @min 0 * @default 40 * * @param offsetWait * @desc 文字を一文字ずつ表示させる場合の時間間隔 * 0 の場合は、同時に表示 * @type number * @min 0 * @default 0 * * @param opacity * @desc 文字の透明度 * @default 255 * @min 0 * @max 255 */ (function () { var paramParse = function (obj) { return JSON.parse(JSON.stringify(obj, paramReplace)); }; var paramReplace = function (key, value) { try { return JSON.parse(value || null); } catch (e) { return value; } }; var convertEscapeCharacters = function (text) { if (text == null) text = ''; var window = SceneManager._scene._windowLayer.children[0]; return window ? window.convertEscapeCharacters(text) : text; }; var textColor = function (colorId) { if (colorId == null || isNaN(colorId)) return colorId; var window = SceneManager._scene._windowLayer.children[0]; return window && Number(colorId) >= 0 ? window.textColor(colorId) : ''; }; var convertTextWidth = function (text) { var tw = 0; var window = SceneManager._scene._windowLayer.children[0]; if (!window) return tw; var conv = window.convertEscapeCharacters(text); var reg = /i\[(\d+)\]/i while (reg.test(conv)) { conv = (conv.toUpperCase()).replace(reg, ''); tw += Window_Base._iconWidth + 4; } if (/c\[(\d+)\]/i.test(conv)) { conv = (conv.toUpperCase()).replace(/c\[(\d+)\]/ig, ''); } if (conv.match(/lw\[(\d+),?([^\]]+)\]/i)) { tw += RegExp.$1; conv = (conv.toUpperCase()).replace(/lw\[(\d+),?([^\]]+)\]/ig, ''); } tw += window.textWidth(conv); return tw; }; var setArgStr = function (arg) { return convertEscapeCharacters(arg); }; var setArgNum = function (arg) { try { return Number(eval(setArgStr(arg))); } catch (e) { return 0; } }; //配列の要素を、すべて数値に変換する。 Array.prototype.num = function () { return this.map(function (elm) { return Number(elm); }); } //============================================================================= // プラグイン パラメータ //============================================================================= var parameters = PluginManager.parameters('FTKR_PopupSpriteMessage'); FTKR.PSM = { maxPopupMessages: paramParse(parameters['Max Popup Messages'] || 0), popupStatus: paramParse(parameters['Popup Message Status']), repop: paramParse(parameters['Repop Message After Menu']), }; //============================================================================= // Game_Interpreter //============================================================================= var _PSM_Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand; Game_Interpreter.prototype.pluginCommand = function (command, args) { _PSM_Game_Interpreter_pluginCommand.call(this, command, args); if (!command.match(/PSM_(.+)/i)) return; command = (RegExp.$1 + '').toUpperCase(); switch (command) { case 'ポップアップ表示': case 'SHOW_POPUP': this.setupPopupMessage(args); break; case 'ポップアップ表示B': case 'SHOW_POPUP_B': this.setupPopupMessage_B(args); break; case 'ポップアップ移動': case 'MOVE_POPUP': this.setupMoveMessage(args); break; case 'ポップアップ回転': case 'ROTATE_POPUP': this.setupRotateMessage(args); break; case 'ポップアップ消去': case 'ERASE_POPUP': $gameParty.requestErasePopupMessage(setArgNum(args[0]), setArgNum(args[1])); var option = this.setupPopupMessageOptions(args, 2); break; case 'ポップアップ色調変更': case 'CHANGECOLOR_POPUP': this.setupChangeColorMessage(args); break; } }; Game_Interpreter.prototype.setupPopupMessageOptions = function (args, i) { var option = {}; for (var m = i; m < args.length; m++) { switch (args[m]) { case '-c': option.align = true; break; case '-s': this.setPSMWaitMode(); break; } } return option; }; Game_Interpreter.prototype.setupPopupMessage = function (args) { var status = FTKR.PSM.popupStatus[Number(args[1])]; var option = this.setupPopupMessageOptions(args, 6); $gameParty.setPopupMessage( setArgNum(args[0]), setArgNum(args[2]), setArgNum(args[3]), setArgNum(args[4]), status.offsetWait, args[5], status.color, 0, status.italic, status.fontSize, status.outlineColor, status.popupHeight, status.fontFace, status.opacity, !!option.align ); }; Game_Interpreter.prototype.setupPopupMessage_B = function (args) { var font = args[5] == -1 ? '' : args[5]; var option = this.setupPopupMessageOptions(args, 13); var color = /,/g.test(args[7]) ? args[7].split(',').num() : [0, 0, 0, 0]; $gameParty.setPopupMessage( setArgNum(args[0]), setArgNum(args[1]), setArgNum(args[2]), setArgNum(args[3]), setArgNum(args[11]), args[4], color, 0, Boolean(args[8]), setArgNum(args[6]), args[9], setArgNum(args[10]), font, setArgNum(args[12]), !!option.align ); }; Game_Interpreter.prototype.setupMoveMessage = function (args) { var option = this.setupPopupMessageOptions(args, 4); $gameParty.movePopupMessage( setArgNum(args[0]), setArgNum(args[1]), setArgNum(args[2]), setArgNum(args[3]) ); }; Game_Interpreter.prototype.setupRotateMessage = function (args) { $gameParty.rotatePopupMessage( setArgNum(args[0]), setArgNum(args[1]), Boolean(setArgNum(args[2])) ); }; Game_Interpreter.prototype.setupChangeColorMessage = function (args) { var option = this.setupPopupMessageOptions(args, 4); $gameParty.changeColorMessage( setArgNum(args[0]), args[1], setArgNum(args[2]), setArgNum(args[3]) ); }; Game_Interpreter.prototype.setPSMWaitMode = function () { this._waitMode = 'popupSpriteText'; }; var _PSM_Game_Interpreter_updateWaitMode = Game_Interpreter.prototype.updateWaitMode; Game_Interpreter.prototype.updateWaitMode = function () { var waiting = false; switch (this._waitMode) { case 'popupSpriteText': waiting = $gameParty.isPsmBusy(); break; } if (waiting) return waiting; return _PSM_Game_Interpreter_updateWaitMode.call(this); }; //============================================================================= // Game_Party // メッセージスプライトを設定する //============================================================================= var _PSM_Game_Party_initialize = Game_Party.prototype.initialize; Game_Party.prototype.initialize = function () { _PSM_Game_Party_initialize.call(this); this._psmMessage = []; }; Game_Party.prototype.maxPopupMessages = function () { return FTKR.PSM.maxPopupMessages;// 画面に表示可能な文字列の最大数 }; Game_Party.prototype.psmMessages = function () { if (!this._psmMessage) this._psmMessage = []; return this._psmMessage; }; Game_Party.prototype.psmMessage = function (messageId) { return this.psmMessages()[messageId]; }; Game_Party.prototype.clearPsmMessage = function (messageId) { if (this.psmMessage(messageId)) { for (var key in this.psmMessage(messageId)) { delete this.psmMessage(messageId)[key]; }; this._psmMessage[messageId] = null; } }; Game_Party.prototype.setPopupMessage = function (messageId, x1, y1, duration, offsetCount, text, flashColor, flashDuration, italic, fontSize, outlineColor, popupHeight, fontFace, opacity, align) { if (messageId > 0 && messageId <= this.maxPopupMessages()) { this.psmMessage(messageId); this._psmMessage[messageId] = { x: x1, y: y1, duration: duration, text: convertEscapeCharacters(text), flashColor: flashColor, flashDuration: flashDuration, popup: true, offsetCount: offsetCount, italic: italic, fontSize: fontSize, outlineColor: outlineColor, popupHeight: popupHeight, fontFace: fontFace, opacity: opacity, align: align, }; return true; } return false; }; Game_Party.prototype.clearPopupMessage = function (messageId) { if (!this.psmMessage(messageId)) return; this.psmMessage(messageId).popup = false; }; Game_Party.prototype.clearMoveMessage = function (messageId) { if (!this.psmMessage(messageId)) return; this.psmMessage(messageId).move = false; }; Game_Party.prototype.clearRotateMessage = function (messageId) { if (!this.psmMessage(messageId)) return; this.psmMessage(messageId).rotate = false; } Game_Party.prototype.requestErasePopupMessage = function (messageId, duration) { if (!this.psmMessage(messageId)) return; this.psmMessage(messageId).erase = true; this.psmMessage(messageId).eraseDuration = duration; }; Game_Party.prototype.clearErasePopupMessage = function (messageId) { if (!this.psmMessage(messageId)) return; this.psmMessage(messageId).erase = false; this.psmMessage(messageId).eraseDuration = 0; }; Game_Party.prototype.clearChangeColorMessage = function (messageId) { if (!this.psmMessage(messageId)) return; this.psmMessage(messageId).changeColor = false; }; Game_Party.prototype.isPopupMessage = function (messageId) { return this.psmMessage(messageId) && this.psmMessage(messageId).popup; }; Game_Party.prototype.isMoveMessage = function (messageId) { return this.psmMessage(messageId) && this.psmMessage(messageId).move; }; Game_Party.prototype.isChangeColorMessage = function (messageId) { return this.psmMessage(messageId) && this.psmMessage(messageId).changeColor; }; Game_Party.prototype.isErasePopupMessage = function (messageId) { return this.psmMessage(messageId) && this.psmMessage(messageId).erase; }; Game_Party.prototype.eraseDuration = function (messageId) { return this.psmMessage(messageId) && this.psmMessage(messageId).eraseDuration || 0 }; Game_Party.prototype.isPsmBusy = function () { return this.psmMessages().some(function (message) { return !!message && (message.duration > 0 || message.moveDuration >= 0 || message.colorDuration >= 0); }); }; Game_Party.prototype.movePopupMessage = function (messageId, x2, y2, duration) { var message = this.psmMessage(messageId); if (message) { if (message.duration) { this.stopUpdateMessage(messageId); } message.dx = x2; message.dy = y2; message.moveDuration = duration; message.move = true; } }; Game_Party.prototype.rotatePopupMessage = function (messageId, speed, rotate) { var message = this.psmMessage(messageId); if (message) { if (message.duration) { this.stopUpdateMessage(messageId); } message.rotateSpeed = speed; message.rotate = rotate; } }; Game_Party.prototype.changeColorMessage = function (messageId, color, opacity, duration) { var message = this.psmMessage(messageId); if (message) { if (message.duration) { this.stopUpdateMessage(messageId); } message.dopacity = opacity; message.dcolor = /,/g.test(color) ? color.split(',').num() : ''; message.colorDuration = duration; message.changeColor = true; } }; Game_Party.prototype.stopUpdateMessage = function (messageId) { var message = this.psmMessage(messageId); if (message) { message.offsetCount = 0; if (message.dx) message.x = message.dx; if (message.dy) message.y = message.dy; if (message.dopacity >= 0) { message.opacity = message.dopacity; } if (message.dcolor instanceof Array) message.flashColor = message.dcolor.clone(); } }; //============================================================================= // Window_Base // 半角スペース用の制御文字を追加 //============================================================================= var _PSM_Window_Base_convertEscapeCharacters = Window_Base.prototype.convertEscapeCharacters; Window_Base.prototype.convertEscapeCharacters = function (text) { text = _PSM_Window_Base_convertEscapeCharacters.call(this, text); text = text.replace(/\x1b_/gi, ' '); return text; }; var _PSM_Scene_Map_start = Scene_Map.prototype.start; Scene_Map.prototype.start = function () { _PSM_Scene_Map_start.call(this); this.repopPsmMessages(); }; Scene_Map.prototype.repopPsmMessages = function () { if (FTKR.PSM.repop) { $gameParty.psmMessages().forEach(function (message, i) { if (message && message.duration) { $gameParty.stopUpdateMessage(i); var sprite = this._spriteset._ftPopupMessages[i]; sprite.setup(message); sprite.setupSprite(sprite._text); } }, this); } }; //============================================================================= // Spriteset_Base // メッセージスプライトを作成 //============================================================================= var _PSM_Spriteset_Base_createUpperLayer = Spriteset_Base.prototype.createUpperLayer; Spriteset_Base.prototype.createUpperLayer = function () { _PSM_Spriteset_Base_createUpperLayer.call(this); this.createPopupMessages(); }; Spriteset_Base.prototype.createPopupMessages = function () { var width = Graphics.boxWidth; var height = Graphics.boxHeight; var x = (Graphics.width - width) / 2; var y = (Graphics.height - height) / 2; this._messageContainer = new Sprite(); this._messageContainer.setFrame(x, y, width, height); this._ftPopupMessages = []; for (var i = 1; i <= this.maxPopupMessages(); i++) { this._ftPopupMessages[i] = new Sprite_FtPopupMessage(i); this._messageContainer.addChild(this._ftPopupMessages[i]); } this.addChild(this._messageContainer); }; Spriteset_Base.prototype.maxPopupMessages = function () { return $gameParty.maxPopupMessages(); }; //============================================================================= // Sprite_FtPopupMessage // メッセージを表示するスプライト //============================================================================= function Sprite_FtPopupMessage() { this.initialize.apply(this, arguments); } Sprite_FtPopupMessage.prototype = Object.create(Sprite_Damage.prototype); Sprite_FtPopupMessage.prototype.constructor = Sprite_FtPopupMessage; Sprite_FtPopupMessage.prototype.initialize = function (messageId) { Sprite_Damage.prototype.initialize.call(this); this._messageId = messageId; this._messageSprites = []; this._index = 0; this._offsetCount = -1; this._moveDuration = -1; this._colorDuration = -1; this._angle = 0; this._duration = 0; this._isKeepPopup = false; }; Sprite_FtPopupMessage.prototype.setup = function (message) { if (this._messageSprites.length) { this._messageSprites.forEach(function (sprite) { this.removeChild(sprite); }, this); } this._text = message.text; this._fontSize = message.fontSize; this._fontFace = message.fontFace; this._outlineColor = textColor(message.outlineColor); this._italic = message.italic; this._offsetCount = message.offsetCount; this._popupHeight = message.popupHeight || 0; message.popupHeight = 0; this._index = 0; this._count = 0; this._align = message.align; this._textWidth = this.getTextWidth(); this._textHeight = this.setupDynamicText().height; var x = message.x; var y = message.y; this.move(this.textX(message.x), this.textY(message.y));// スプライトの原点 if (message.flashColor) { this.setupFlashEffect(message.flashColor, message.flashDuration); } this._duration = message.duration; this.opacity = !isNaN(message.opacity) ? Number(message.opacity) : 255; }; Sprite_FtPopupMessage.prototype.getTextWidth = function () { return this.setupDynamicText().measureTextWidth(this._text); }; Sprite_FtPopupMessage.prototype.textX = function (x) { return this._align ? x - this._textWidth / 2 : x; }; Sprite_FtPopupMessage.prototype.textY = function (y) { return this._align ? y - this._textHeight / 2 : y; }; Sprite_FtPopupMessage.prototype.setupSprite = function (text) { var bitmap = this.setupDynamicText(text); var sprite = this.createChildSprite(bitmap); sprite.dy = 0; sprite.dw = bitmap.measureTextWidth(text); return sprite; }; Sprite_FtPopupMessage.prototype.setupDynamicText = function (text) { var size = this._fontSize; var width = text ? (this._italic ? size * 1.5 : size) * text.length : size + 8; var bitmap = new Bitmap(width, size + 8);// 文字の描画領域サイズ bitmap.fontSize = size;// フォントサイズ if (this._fontFace) { bitmap.fontFace = this._fontFace + ',' + bitmap.fontFace; } if (this._italic) { bitmap.fontItalic = true;// イタリック体で表示 } if (this._outlineColor) { bitmap.outlineWidth = Math.floor(bitmap.fontSize / 6);// 文字の縁取り太さ bitmap.outlineColor = this._outlineColor;// 文字の縁取り色 } if (text) bitmap.drawText(text, 0, 0, bitmap.width, bitmap.height, 'center'); return bitmap; }; Sprite_FtPopupMessage.prototype.createChildSprite = function (bitmap) { var sprite = new Sprite(); sprite.bitmap = bitmap || this._damageBitmap; sprite.anchor.x = 0;// 原点に対する文字の表示位置 sprite.anchor.y = 0;// 原点に対する文字の表示位置 sprite.y = -this._popupHeight; // はねる高さ sprite.ry = sprite.y; return sprite; }; Sprite_FtPopupMessage.prototype.setupFlashEffect = function (flashColor, duration) { this._flashColor = flashColor.clone(); this._flashDuration = duration; }; Sprite_FtPopupMessage.prototype.update = function () { Sprite.prototype.update.call(this); this.updateBitmap(); this.updateDuration(); this.updatePosition(); this.updateFlash(); this.updateOpacity(); }; Sprite_FtPopupMessage.prototype.updateBitmap = function () { if ($gameParty.isPopupMessage(this._messageId)) { var message = this.message(); this.setup(message); $gameParty.clearPopupMessage(this._messageId); } if (this._text) { if (this._offsetCount > 0) { if (this._count == 0) { var i = this._index; var sprite = this.setupSprite(this._text[i]); sprite.x = i > 0 ? this._messageSprites[i - 1].x + sprite.dw : 0; this._messageSprites[i] = sprite; this.addChild(this._messageSprites[i]); this._count = this.message().offsetCount; this._index++; } else if (this._count > 0) { this._count--; } if (this._index >= this._text.length) this._text = ''; } else if (this._offsetCount == 0) { for (var i = 0; i < this._text.length; i++) { var sprite = this.setupSprite(this._text[i]); sprite.x = i > 0 ? this._messageSprites[i - 1].x + sprite.dw : 0; this._messageSprites[i] = sprite; this.addChild(this._messageSprites[i]); this._count = this.message().offsetCount; } this._text = ''; } else { this._messageSprites[0] = this.setupSprite(this._text); this.addChild(this._messageSprites[0]); this._text = ''; } } }; Sprite_FtPopupMessage.prototype.message = function () { return $gameParty.psmMessage(this._messageId); }; Sprite_FtPopupMessage.prototype.updatePosition = function () { if ($gameParty.isMoveMessage(this._messageId)) { var message = this.message(); this._moveDuration = message.moveDuration; $gameParty.clearMoveMessage(this._messageId); } if (this._moveDuration > 0) { this._moveDuration--; var message = this.message(); if (this.message()) this.message().moveDuration = this._moveDuration; this.x = this.textX(Math.floor(message.x + (message.dx - message.x) * (1 - this._moveDuration / message.moveDuration))); this.y = this.textY(Math.floor(message.y + (message.dy - message.y) * (1 - this._moveDuration / message.moveDuration))); } else if (this._moveDuration == 0) { this._moveDuration--; var message = this.message(); if (this.message()) this.message().moveDuration = this._moveDuration; this.x = this.textX(message.dx); message.x = message.dx; this.y = this.textY(message.dy); message.y = message.dy; } if (this.message() && this.message().rotate) { this._angle += this.message().rotateSpeed / 2; } else if (this.message() && !this.message().rotate && this.message().rotateSpeed) { this._angle = this.message().rotateSpeed / 2; } this.rotation = this._angle * Math.PI / 180; }; Sprite_FtPopupMessage.prototype.updateDuration = function () { if (this._duration == -1 && $gameParty.isErasePopupMessage(this._messageId)) { this._duration = $gameParty.eraseDuration(this._messageId); $gameParty.clearErasePopupMessage(this._messageId); } if (this._duration == -1) { for (var i = 0; i < this.children.length; i++) { this.updateChild(this.children[i]); } } else if (this._duration > 0) { this._duration--; if (this.message()) this.message().duration = this._duration; for (var i = 0; i < this.children.length; i++) { this.updateChild(this.children[i]); } } if (this._duration == 0 && this._messageSprites.length) { this._messageSprites.forEach(function (sprite) { this.removeChild(sprite); }, this); this._moveDuration = -1; this._angle = 0; $gameParty.clearPsmMessage(this._messageId); this._messageSprites = []; } }; Sprite_FtPopupMessage.prototype.updateColor = function () { var message = this.message(); if (!Array.isArray(message.dcolor)) return; this._flashColor = [ this.setNextColor(0, message), this.setNextColor(1, message), this.setNextColor(2, message), this.setNextColor(3, message), ]; message.flashColor = this._flashColor.clone(); }; Sprite_FtPopupMessage.prototype.setNextColor = function (index, message) { return Math.floor(this._colorA[index] + (message.dcolor[index] - this._colorA[index]) * (1 - this._colorDuration / message.colorDuration)); }; Sprite_FtPopupMessage.prototype.updateOpacity = function () { if ($gameParty.isChangeColorMessage(this._messageId)) { var message = this.message(); this._colorDuration = message.colorDuration; this._colorA = this._flashColor.clone(); $gameParty.clearChangeColorMessage(this._messageId); } if (this._colorDuration > 0) { this._colorDuration--; var message = this.message(); if (this.message()) this.message().colorDuration = this._colorDuration; this.updateColor(); if (message.dopacity >= 0) this.opacity = Math.floor(message.opacity + (message.dopacity - message.opacity) * (1 - this._colorDuration / message.colorDuration)); } else if (this._colorDuration == 0) { this._colorDuration--; var message = this.message(); if (this.message()) this.message().colorDuration = this._colorDuration; if (message.dopacity >= 0) { this.opacity = message.dopacity; message.opacity = message.dopacity; } if (message.dcolor instanceof Array) { this._flashColor = message.dcolor.clone(); message.flashColor = message.dcolor.clone(); } } if (this._duration >= 0 && this._duration < 10) { this.opacity = 255 * this._duration / 10; } }; }());//EOF
dazed/translations
www/js/plugins/FTKR_PopupSpriteMessage.js
JavaScript
unknown
45,052
//============================================================================= // FixImageLoading.js // ---------------------------------------------------------------------------- // Copyright (c) 2015-2017 Triacontane // This software is released under the MIT License. // http://opensource.org/licenses/mit-license.php // ---------------------------------------------------------------------------- // Version // 2.0.1 2019/04/06 MoviePicture.jsとの競合を修正 // 2.0.0 2017/06/09 本体ver1.5.0に合わせて再作成 // 1.1.1 2016/11/20 ロード完了時にframeが更新されない不具合を修正 // ロード中にframeが変更された場合に、ロード完了まで反映を遅らせる仕様を追加 // 1.1.0 2016/11/16 liply_GC.jsとの競合を解消 by 奏 ねこま様 // 1.0.0 2016/05/02 初版 // ---------------------------------------------------------------------------- // [Blog] : http://triacontane.blogspot.jp/ // [Twitter]: https://twitter.com/triacontane/ // [GitHub] : https://github.com/triacontane/ //============================================================================= /*:ja * @plugindesc 画像ロード時のチラつき防止プラグイン * @target MZ @url https://github.com/triacontane/RPGMakerMV/tree/mz_master @author トリアコンタン * * @help キャッシュしていない画像を表示したときに * 一瞬発生するチラつきを防止します。 * 画像のロードが完了するまで以前に表示していた画像を残します。 * * 逆に画像を消したいときは明示的にピクチャの消去等を行ってから * 表示してください。 * * このプラグインにはプラグインコマンドはありません。 * * 利用規約: * 作者に無断で改変、再配布が可能で、利用形態(商用、18禁利用等) * についても制限はありません。 * このプラグインはもうあなたのものです。 */ (function () { 'use strict'; var _Sprite__renderCanvas = Sprite.prototype._renderCanvas; Sprite.prototype._renderCanvas = function (renderer) { _Sprite__renderCanvas.apply(this, arguments); if (this.isExistLoadingBitmap()) { this._renderCanvas_PIXI(renderer); } }; var _Sprite__renderWebGL = Sprite.prototype._renderWebGL; Sprite.prototype._renderWebGL = function (renderer) { _Sprite__renderWebGL.apply(this, arguments); if (this.isExistLoadingBitmap()) { if (this._isPicture) { this._speedUpCustomBlendModes(renderer); renderer.setObjectRenderer(renderer.plugins.picture); if (!this.isVideoPicture || !this.isVideoPicture()) { renderer.plugins.picture.render(this); } } else { renderer.setObjectRenderer(renderer.plugins.sprite); renderer.plugins.sprite.render(this); } } }; Sprite.prototype.isExistLoadingBitmap = function () { return this.bitmap && !this.bitmap.isReady(); }; })();
dazed/translations
www/js/plugins/FixImageLoading.js
JavaScript
unknown
3,137
/*:ja * @plugindesc (v.1.0) アクター/職業/レベル/スクリプトで特徴を追加指定できます。 * * @author Galv - galvs-scripts.com * * @param Display Trait On Level * @text レベルアップ表示 * @type boolean * @on 表示 * @off 非表示 * @desc デフォルトのレベルアップメッセージに特徴取得を表示 * 表示:true / 非表示:false * @default true * * @param Trait Gained Text * @text 獲得特徴テキスト * @desc レベルアップで特徴を獲得する前に表示されるテキスト * @default 獲得特徴: * * * @help * 翻訳:ムノクラ * https://fungamemake.com/ * https://twitter.com/munokura/ * * 元プラグイン: * https://galvs-scripts.com/2017/01/05/mv-dynamic-traits/ * * Galv's Dynamic Traits * --------------------------------------------------------------------------- * このプラグインを使用すると、 * ゲーム中にアクターに新しい特徴を手動で追加したり、 * アクターと職業を設定して、アクターがレベルアップした時、 * 新しい特徴を付与したりできます。 * アクターと職業には、特定のレベルに到達した時、 * 取得する特徴を制御するメモタグがあり、 * 必要に応じて、レベルアップメッセージに取得した特徴の通知を追加できます。 * * 特徴レベルアップテキストをより詳細にカスタマイズすることは可能ですが、 * プラグインファイルを編集して行う必要があり、 * それがどのように機能するかを理解するにはJavaScriptの理解が必要です。 * Galvにこれを教えるように頼まないでください。 * * --------------------------------------------------------------------------- * アクター、職業のメモタグ * --------------------------------------------------------------------------- * レベルで獲得した特徴 * ---------------------- * アクターと職業には、 * 指定された各レベルアップで獲得される特徴のリストを指定するために、 * 次のメモタグでタグ付けできます。 * それぞれが|で区切られたlvl、code、id、val特徴を * いくつでも入れられます。 * * <traits:lvl,code,id,val|lvl,code,id,val|lvl,code,id,val> * * lvlは、コードで取得される特徴のレベルです。 * idおよびvalの設定は、以下の表で確認できます。 * * 特徴 CODE ID VAL * ---------------- ---- ----------- ------------- * 属性有効度 11 属性ID %数 * 弱体有効度 12 通常能力値ID* %数 * ステート有効度 13 ステートID %数 * ステート無効化 14 ステートID なし * * 通常能力値 21 通常能力値ID* %数 * 追加能力値 22 追加能力値ID* %数 * 特殊能力値 23 特殊能力値ID* %数 * * 攻撃時属性 31 属性ID なし * 攻撃時ステート 32 属性ID %数 * 攻撃速度補正 33 整数 なし * 攻撃追加回数 34 0 整数 * * スキルタイプ追加 41 スキルタイプID なし * スキルタイプ封印 42 スキルタイプID なし * スキル追加 43 スキルID なし * スキル封印 44 スキルID なし * * 武器タイプ装備 51 武器タイプID なし * 防具タイプ装備 52 防具タイプID なし * 装備固定 53 装備ID なし * 装備封印 54 装備ID なし * スロットタイプ 55 0:通常 / 1:二刀流 なし * * 行動回数追加 61 0 %数 * 特殊フラグ 62 フラグID* なし * 消滅エフェクト 63 消滅ID* なし * パーティ能力 64 パーティ能力ID* なし * --------------------------------------------------------------------------- * 注意点 * 通常、データベースで確認できる値のIDは1から始まります。 * 上記の*がある場合、リストの最初のIDは1ではなく0です。 * * VALがなしの場合、メモタグ/スクリプトのvalに0を入力してください。 * * アクターに複数のレベルに同じ特徴コードを設定している場合、 * 最高レベルの特徴を使用します。 * 職業に複数のレベルに同じ特徴コードを設定している場合、 * 最高レベルの特徴を使用します。 * * アクターと職業が同じ特徴コードを設定している場合、 * アクターは両方の特徴を実行しますが、 * それぞれの特徴の中で最高のもののみを使用します。 * --------------------------------------------------------------------------- * * --------------------------------------------------------------------------- * スクリプトコール * --------------------------------------------------------------------------- * アクターは、スクリプトコールと使って手動で特徴を追加できます。 * スクリプトコールを使用して、 * これらの追加された特徴をアクターから再び削除することもできます。 * ただし、レベル/データベースからアクター/アイテム/ステート等から * 追加された特徴を削除することはできません。 * * この手法を使用して特徴を追加すると、 * 過去に同じコードの手法によって追加された特徴が置き換えられます。 * したがって、これらの手動で追加された特徴のアクターには、 * 各特徴の1つのみが残ります。 * * Galv.DTRAITS.addTrait(actorId,code,id,value); * * Galv.DTRAITS.removeTrait(actorId,code); * * --------------------------------------------------------------------------- */
dazed/translations
www/js/plugins/Galv_DynamicTraits.js
JavaScript
unknown
6,146
//============================================================================= // GeneralTrigger.js // ---------------------------------------------------------------------------- // Copyright (c) 2015 Triacontane // This software is released under the MIT License. // http://opensource.org/licenses/mit-license.php // ---------------------------------------------------------------------------- // Version // 1.1.0 2016/07/06 レベルアップ時、レベルダウン時のトリガーを追加 // 1.0.2 2016/06/22 最強装備を選択した場合にエラーが発生する問題を修正 // 1.0.1 2016/06/17 ロードが失敗するバグを修正 // 1.0.0 2016/06/14 初版 // ---------------------------------------------------------------------------- // [Blog] : http://triacontane.blogspot.jp/ // [Twitter]: https://twitter.com/triacontane/ // [GitHub] : https://github.com/triacontane/ //============================================================================= /*: * @plugindesc トリガープラグイン * @author トリアコンタン * * @param ニューゲーム * @desc ニューゲーム時にONになるスイッチ番号 * @default 0 * * @param コンティニュー * @desc コンティニュー時にONになるスイッチ番号 * @default 0 * * @param オプション画面 * @desc オプション画面を出た時にONになるスイッチ番号。ただしタイトル画面の場合は無効です。 * @default 0 * * @param メニュー画面 * @desc メニュー画面を出た時にONになるスイッチ番号 * @default 0 * * @param セーブ画面 * @desc セーブ画面を出た時にONになるスイッチ番号 * @default 0 * * @param 戦闘画面 * @desc 戦闘画面を出た時にONになるスイッチ番号 * @default 0 * * @param ショップ画面 * @desc ショップ画面を出た時にONになるスイッチ番号 * @default 0 * * @param 別マップ移動 * @desc 別マップ移動時にONになるスイッチ番号 * @default 0 * * @param アイテム増減 * @desc アイテム増減時にONになるスイッチ番号 * @default 0 * * @param 武器増減 * @desc 武器増減時にONになるスイッチ番号 * @default 0 * * @param 防具増減 * @desc 防具増減時にONになるスイッチ番号 * @default 0 * * @param アイテムID * @desc アイテム、武器、防具入手時に格納されるアイテムIDを格納する変数番号 * @default 0 * * @param アイテム個数 * @desc アイテム、武器、防具入手時に格納されるアイテム増減数を格納する変数番号 * @default 0 * * @param メンバー加入 * @desc メンバー加入時にONになるスイッチ番号 * @default 0 * * @param メンバー離脱 * @desc メンバー離脱時にONになるスイッチ番号 * @default 0 * * @param レベルアップ * @desc レベルアップ時にONになるスイッチ番号 * @default 0 * * @param レベルダウン * @desc レベルダウン時にONになるスイッチ番号 * @default 0 * * @param アクターID * @desc 加入・離脱、レベルアップ、レベルダウンしたアクターIDを格納する変数番号 * @default 0 * * @param マップ画面でのみ有効 * @desc アイテムの増減やレベルアップについて、マップ画面でのみスイッチをONにします。(ON/OFF) * @default OFF * * @help ゲーム中、様々な局面でスイッチをONにします。 * 主に並列処理、自動実行のコモンイベントと組み合わせて使用します。 * 以下のタイミングでスイッチをONにできます。 * * ・ニューゲーム * ・コンティニュー * ・メニュー画面を閉じたとき * ・オプション画面を閉じたとき * ・セーブ画面を閉じたとき * ・ショップ画面を閉じたとき * ・別マップに移動したとき * ・アイテムを入手したとき * ・メンバーが加入、離脱したとき * ・レベルが増減したとき * * また、トリガーの種類によっては、スイッチがONになると同時に変数に * 所定の値が代入されます。 * * 例えば、アイテム入手のトリガーがONになったときに指定された変数に * アイテムIDが格納されます。 * 専用の入手インフォメーション等が作成できます。 * * このプラグインにはプラグインコマンドはありません。 * * 利用規約: * 作者に無断で改変、再配布が可能で、利用形態(商用、18禁利用等) * についても制限はありません。 * このプラグインはもうあなたのものです。 */ (function () { 'use strict'; var pluginName = 'GeneralTrigger'; var getParamOther = function (paramNames) { if (!Array.isArray(paramNames)) paramNames = [paramNames]; for (var i = 0; i < paramNames.length; i++) { var name = PluginManager.parameters(pluginName)[paramNames[i]]; if (name) return name; } return null; }; var getParamNumber = function (paramNames, min, max) { var value = getParamOther(paramNames); if (arguments.length < 2) min = -Infinity; if (arguments.length < 3) max = Infinity; return (parseInt(value, 10) || 0).clamp(min, max); }; var getParamBoolean = function (paramNames) { var value = getParamOther(paramNames); return (value || '').toUpperCase() === 'ON'; }; //============================================================================= // パラメータの取得と整形 //============================================================================= var paramNewGame = getParamNumber(['NewGame', 'ニューゲーム']); var paramContinue = getParamNumber(['Continue', 'コンティニュー']); var paramOptions = getParamNumber(['Options', 'オプション画面']); var paramSave = getParamNumber(['Save', 'セーブ画面']); var paramMenu = getParamNumber(['Menu', 'メニュー画面']); var paramBattle = getParamNumber(['Battle', '戦闘画面']); var paramShop = getParamNumber(['Shop', 'ショップ画面']); var paramMoveMap = getParamNumber(['MoveMap', '別マップ移動']); var paramGainItem = getParamNumber(['GainItem', 'アイテム増減']); var paramGainWeapon = getParamNumber(['GainWeapon', '武器増減']); var paramGainArmor = getParamNumber(['GainArmor', '防具増減']); var paramItemId = getParamNumber(['ItemId', 'アイテムID']); var paramItemAmount = getParamNumber(['ItemAmount', 'アイテム個数']); var paramAddMember = getParamNumber(['AddMember', 'メンバー加入']); var paramRemoveMember = getParamNumber(['RemoveMember', 'メンバー離脱']); var paramLevelUp = getParamNumber(['LevelUp', 'レベルアップ']); var paramLevelDown = getParamNumber(['LevelDown', 'レベルダウン']); var paramActorId = getParamNumber(['ActorId', 'アクターID']); var paramValidOnlyMap = getParamBoolean(['ValidOnlyMap', 'マップ画面でのみ有効']); //============================================================================= // SceneManager // トリガースイッチを設定処理を追加定義します。 //============================================================================= var _SceneManager_pop = SceneManager.pop; SceneManager.pop = function () { if (this._stack.length > 0) { this._scene.setPopTrigger(); } _SceneManager_pop.apply(this, arguments); }; SceneManager.setTriggerSwitch = function (switchNumber) { if ($gameSwitches && switchNumber > 0) { $gameSwitches.setValue(switchNumber, true); } }; SceneManager.setTriggerVariable = function (variableNumber, value) { if ($gameVariables && variableNumber > 0) { $gameVariables.setValue(variableNumber, value); } }; SceneManager.isTriggerValid = function () { return !paramValidOnlyMap || this._scene instanceof Scene_Map; }; //============================================================================= // DataManager // ニューゲーム、コンティニューのトリガースイッチを設定します。 //============================================================================= var _DataManager_setupNewGame = DataManager.setupNewGame; DataManager.setupNewGame = function () { _DataManager_setupNewGame.apply(this, arguments); SceneManager.setTriggerSwitch(paramNewGame); }; var _DataManager_loadGame = DataManager.loadGame; DataManager.loadGame = function (saveFileId) { var result = _DataManager_loadGame.apply(this, arguments); SceneManager.setTriggerSwitch(paramContinue); return result; }; //============================================================================= // Game_Player // 場所移動時にトリガースイッチを設定します。 //============================================================================= var _Game_Player_reserveTransfer = Game_Player.prototype.reserveTransfer; Game_Player.prototype.reserveTransfer = function (mapId, x, y, d, fadeType) { _Game_Player_reserveTransfer.apply(this, arguments); SceneManager.setTriggerSwitch(paramMoveMap); }; var _Game_Party_addActor = Game_Party.prototype.addActor; Game_Party.prototype.addActor = function (actorId) { var length = this._actors.length; _Game_Party_addActor.apply(this, arguments); if (length !== this._actors.length && SceneManager.isTriggerValid()) { SceneManager.setTriggerSwitch(paramAddMember); SceneManager.setTriggerVariable(paramActorId, actorId); } }; var _Game_Party_removeActor = Game_Party.prototype.removeActor; Game_Party.prototype.removeActor = function (actorId) { var length = this._actors.length; _Game_Party_removeActor.apply(this, arguments); if (length !== this._actors.length && SceneManager.isTriggerValid()) { SceneManager.setTriggerSwitch(paramRemoveMember); SceneManager.setTriggerVariable(paramActorId, actorId); } }; var _Game_Party_gainItem = Game_Party.prototype.gainItem; Game_Party.prototype.gainItem = function (item, amount, includeEquip) { _Game_Party_gainItem.apply(this, arguments); if (!item || !SceneManager.isTriggerValid()) return; switch (this.itemContainer(item)) { case this._items: SceneManager.setTriggerSwitch(paramGainItem); break; case this._weapons: SceneManager.setTriggerSwitch(paramGainWeapon); break; case this._armors: SceneManager.setTriggerSwitch(paramGainArmor); break; } SceneManager.setTriggerVariable(paramItemId, item.id); SceneManager.setTriggerVariable(paramItemAmount, amount); }; var _Game_Actor_levelUp = Game_Actor.prototype.levelUp; Game_Actor.prototype.levelUp = function () { _Game_Actor_levelUp.apply(this, arguments); if (SceneManager.isTriggerValid()) { SceneManager.setTriggerSwitch(paramLevelUp); SceneManager.setTriggerVariable(paramActorId, this.actorId()); } }; var _Game_Actor_levelDown = Game_Actor.prototype.levelDown; Game_Actor.prototype.levelDown = function () { _Game_Actor_levelDown.apply(this, arguments); if (SceneManager.isTriggerValid()) { SceneManager.setTriggerSwitch(paramLevelDown); SceneManager.setTriggerVariable(paramActorId, this.actorId()); } }; //============================================================================= // Scene_Base // 各クラス用のトリガースイッチを設定します。 //============================================================================= Scene_Base.prototype.setPopTrigger = function () { }; Scene_Options.prototype.setPopTrigger = function () { SceneManager.setTriggerSwitch(paramOptions); }; Scene_Menu.prototype.setPopTrigger = function () { SceneManager.setTriggerSwitch(paramMenu); }; Scene_Save.prototype.setPopTrigger = function () { SceneManager.setTriggerSwitch(paramSave); }; Scene_Shop.prototype.setPopTrigger = function () { SceneManager.setTriggerSwitch(paramShop); }; Scene_Battle.prototype.setPopTrigger = function () { SceneManager.setTriggerSwitch(paramBattle); }; })();
dazed/translations
www/js/plugins/GeneralTrigger.js
JavaScript
unknown
12,824
// // 入手インフォメーション ver1.15 // // ------------------------------------------------------ // Copyright (c) 2016 Yana // Released under the MIT license // http://opensource.org/licenses/mit-license.php // ------------------------------------------------------ // // author Yana // var Imported = Imported || {}; Imported['GetInformation'] = 1.15; if (!Imported.CommonPopupCore) { console.error('CommonPopupCoreを導入してください。') } /*: * @plugindesc ver1.15/アイテムの入手などにスライドアニメするインフォメーションを追加するプラグインです。 * @author Yana * * @param Info Disable Switch Id * @desc 入手インフォメーションを無効化するためのスイッチのIDです。 * このスイッチがONの時、インフォメーションが無効化されます。 * @default 10 * * @param Use Battle Info * @desc 入手インフォメーションを戦闘中に使用するかの設定です。 * true/falseで設定してください。 * @default true * * @param Use Rewards Info * @desc 戦利品を入手インフォメーションで表示するかの設定です。 * true/falseで設定してください。 * @default true * * @param Info Pattern * @desc 入手インフォメーションの動作パターンです。 * Normal:普通 GrowUp:にょき Stretch:うにょーん * @default GrowUp * * @param Info Font Size * @desc 入手インフォメーションの文字サイズです。 * @default 20 * * @param Info Count * @desc 入手インフォメーションの表示時間です。 * @default 120 * * @param Info Delay * @desc 入手インフォメーションのディレイです。 * 連続で設定された時、この数値の表示ディレイがかかります。 * @default 20 * * @param Info MoveWait * @desc 入手インフォメーションが完全に表示された状態の時間です。 * @default 100 * * @param Info MoveFade * @desc 入手インフォメーションのフェードの時間です。 * @default 10 * * @param Info Position * @desc 入手インフォメーションの表示位置です。 * Upを指定すると、画面上部になります。 * @default * * @param Info Slide Action * @desc 入手インフォメーションのスライド方向です。 * Downを指定すると、上から下になります。 * @default * * @param Info Sup X * @desc 入手インフォメーションの表示位置補正X座標です。 * @default 0 * * @param Info Sup Y * @desc 入手インフォメーションの表示位置補正Y座標です。 * @default 0 * * @param Info Width * @desc 入手インフォメーションの横幅です。 * @default 816 * * @param Gold Icon Index * @desc 所持金のアイコンとして使用するアイコンのインデックスです。 * @default 314 * * @param Actor Icon Start Index * @desc アクターのアイコンとして使用するアイコンの最初のインデックスです。 * @default 320 * * @param Reward Popup Delay * @desc 戦利品表示時に表示開始までにかけるディレイの数値です。 * @default 0 * * @param Battle Show List * @desc 戦闘中に表示するインフォメーションのリストです。item,gold, * exp,skill,params,level,abp,classLevelで指定してください。 * @default item,gold,exp,skill,params,level,abp,classLevel * * @param Get Gold Text * @desc 所持金の増加で表示されるテキストです。。 * _icon:上記で設定したアイコンインデックス _num:金額 * @default 「\I[_icon]_num\C[14]\G\C[0]」 を\C[24]手に入れた! * * @param Lost Gold Text * @desc 所持金の減少で表示されるテキストです。 * _icon:上記で設定したアイコンインデックス _num:金額 * @default 「\I[_icon]_num\C[14]\G\C[0]」 を\C[2]失った・・・ * * @param Get Item Text * @desc アイテムの増加で表示されるテキストです。 * _icon:アイコン _name:名前 _desc1:解説1行目 _desc2:解説2行目 * @default 「\I[_icon]_name」 を\C[24]手に入れた!\n\C[6]_desc1 * * @param Lost Item Text * @desc アイテムの減少で表示されるテキストです。 * _icon:アイコン _name:名前 _desc1:解説1行目 _desc2:解説2行目 * @default 「\I[_icon]_name」 を\C[2]失った・・・\n\C[6]_desc1 * * @param Get Item Text Num * @desc アイテム増加。2個以上。_icon:アイコン * _name:名前 _num:個数 _desc1:解説1行目 _desc2:解説2行目 * @default 「\I[_icon]_name」 を\C[14]_num個\C[24]手に入れた!\n\C[6]_desc1 * * @param Lost Item Text Num * @desc アイテム減少。2個以上。_icon:アイコン * _name:名前 _num:個数 _desc1:解説1行目 _desc2:解説2行目 * @default 「\I[_icon]_name」を\C[14]_num個\C[2]失った・・・\n\C[6]_desc1 * * @param Get Skill Text * @desc スキルの習得で表示されるテキストです。_actor:アクター名 * _icon:アイコン _name:名前 _desc1:解説1行目 _desc2:解説2行目 * @default _actorは「\I[_icon]_name」 を\C[24]覚えた!\n\C[6]_desc1 * * @param Lost Skill Text * @desc スキルの忘却で表示されるテキストです。_actor:アクター名 * _icon:アイコン _name:名前 _desc1:解説1行目 _desc2:解説2行目 * @default _actorは「\I[_icon]_name」を \C[2]忘れてしまった・・・\n\C[6]_desc1 * * @param Exp Up Text * @desc 経験値の増加で表示されるテキストです。 * _actor:アクター名 _name:経験値の名前 _num:経験値  * @default _actorは\C[14]_numポイント\C[0]の\C[4]_name\C[0]を\C[24]得た! * * @param Exp Down Text * @desc 経験値の減少で表示されるテキストです。 * _actor:アクター名 _name:経験値の名前 _num:経験値 * @default _actorは\C[14]_numポイント\C[0]の\C[4]_name\C[0]を\C[2]失った・・・ * * @param Lv Up Text * @desc レベルの増加で表示されるテキストです。 * _actor:アクター名 _name:レベルの名前 _num:上がったレベル * @default _actorは\C[4]_name\C[0]が\C[14]_numポイント\C[24]上がった! * * @param Lv Down Text * @desc レベルの減少で表示されるテキストです。 * _actor:アクター名 _name:レベルの名前 _num:下がったレベル * @default _actorは\C[4]_name\C[0]が\C[14]_numポイント\C[2]下がった・・・ * * @param Param Up Text * @desc 能力値の増加で表示されるテキストです。 * _actor:アクター名 _name:能力値の名前 _num:上がったレベル * @default _actorは\C[4]_name\C[0]が\C[14]_numポイント\C[24]上がった! * * @param Param Down Text * @desc 能力値の減少で表示されるテキストです。 * _actor:アクター名 _name:能力値の名前 _num:下がったレベル * @default _actorは\C[4]_name\C[0]が\C[14]_numポイント\C[2]下がった・・・ * * @param Abp Up Text * @desc クラス経験値の増加で表示されるテキストです。 * _actor:アクター名 _name:経験値の名前 _num:経験値  * @default _actorは\C[14]_numポイント\C[0]の\C[4]_name\C[0]を\C[24]得た! * * @param Abp Down Text * @desc クラス経験値の減少で表示されるテキストです。 * _actor:アクター名 _name:経験値の名前 _num:経験値 * @default _actorは\C[14]_numポイント\C[0]の\C[4]_name\C[0]を\C[2]失った・・・ * * @param Class Lv Up Text * @desc クラスレベルの増加で表示されるテキストです。 _class:クラス名 * _actor:アクター名 _name:レベルの名前 _num:上がったレベル * @default _actorは\C[4]_classの_name\C[0]が\C[14]_numポイント\C[24]上がった! * * @param Class Lv Down Text * @desc クラスレベルの減少で表示されるテキストです。 _class:クラス名 * _actor:アクター名 _name:レベルの名前 _num:下がったレベル * @default _actorは\C[4]_classの_name\C[0]が\C[14]_numポイント\C[2]下がった・・・ * * @param Formation Lv Up Text * @desc 陣形レベルの増加で表示されるテキストです。 * _name:陣形の名前 _num:上がったレベル * @default \C[4]_nameの熟練度\C[0]が\C[14]_numポイント\C[24]上がった! * * @param Formation Lv Max Text * @desc 陣形をマスターした時に表示されるテキストです。 * _name:陣形の名前 * @default \C[4]_name\C[0]を\C[14]マスターした! * * @help------------------------------------------------------ * プラグインコマンド * ------------------------------------------------------ * ShowInfo 表示したいテキスト * インフォ表示 表示したいテキスト * * ※スペースは必ず半角で入力してください。 * ------------------------------------------------------ * このプラグインには「汎用ポップアップベース」のプラグインが必要です。 * 汎用ポップアップベースより下に配置してください。 * また、それぞれの表示テキストに何も記載しない場合、そのインフォメーションを無効化できます。 * ------------------------------------------------------ * 使い方 * ------------------------------------------------------ * 導入するだけで動作します。 * 詳細な設定は、プラグインパラメータを参照してください。 * * 170524 * それぞれのテキストの最初に追加することで、ポップアップ発生時にSEを追加する専用制御文字を追加しました。 * _SE[名前[,音量,ピッチ,位相]] * ※音量、ピッチ、位相は省略可能です。省略した場合、音量=90,ピッチ=100,位相=0として扱われます。 * 例:レベルアップのポップアップ時にSkill3のSEを鳴らす。 * _SE[Skill3]_actorは\C[4]_name\C[0]が\C[14]_numポイント\C[24]上がった! * ------------------------------------------------------ * 利用規約 * ------------------------------------------------------ * 当プラグインはMITライセンスで公開されています。 * 使用に制限はありません。商用、アダルト、いずれにも使用できます。 * 二次配布も制限はしませんが、サポートは行いません。 * 著作表示は任意です。行わなくても利用できます。 * 要するに、特に規約はありません。 * バグ報告や使用方法等のお問合せはネ実ツクールスレ、または、Twitterにお願いします。 * https://twitter.com/yanatsuki_ * 素材利用は自己責任でお願いします。 * ------------------------------------------------------ * 更新履歴: * ver1.15:170525 * 戦闘中にメッセージウィンドウが下以外の場合、ポップアップの位置がずれるバグを修正しました。 * ポップアップ時にSEを再生する制御文字を追加しました。 * 動作パターンをGrowUpに指定して、表示位置を上にした場合の動作を修正しました。 * ver1.14:170216 * アクター名の変換が正常に動作していなかったバグを修正しました。 * ver1.131:170104 * 特定の状況でエラーが発生することのあるバグを修正しました。 * ver1.13: * 戦闘中のポップアップ位置を調整しました。 * 戦闘終了時の戦利品表示にディレイをかける設定を追加しました。 * 陣形レベルが上がった時にポップアップを表示する機能を追加しました。 * ver1.12: * 利用規約をMITライセンスに変更しました。 * 一度も仲間になっていないアクターに対してポップアップを表示すると、無限ループに陥るバグを修正しました。 * ver1.11: * 動作パターンの設定を追加しました。 * プラグインパラメータを追加しました。 * ver1.10: * 処理内容を少し変更しました。 * ヘルプを追加・修正しました。 * 任意のテキストを表示するプラグインコマンドを追加しました。 * ver1.09: * スキルを忘れさせた際のポップアップが表示されないバグを修正しました。 * レベルアップ時やクラスレベルアップ時のスキル習得の表示位置を調整しました。 * ver1.08: * 戦闘中の表示をexpとabpを無効化すると、経験値やABPが入らないバグを修正しました。 * ver1.07: * インフォメーションを無効化する機能が正常に機能していなかったバグを修正しました。 * 戦闘時に表示するインフォメーションを設定するBattle Show Listの設定項目を追加しました。 * ver1.06: * 戦闘中のポップアップの位置が正常でなかったバグを修正しました。 * var1.05: * 表示位置を補正するためのプラグインパラメータを追加しました。 * 上から下へ動作する設定を追加しました。 * var1.04: * 任意のテキストを渡せるように修正しました。 * ver1.03: * ABPとクラスレベルのポップアップ処理を追加しました。 * ver1.02: * レベルアップ処理でポップアップ表示が逆になっていたバグを修正しました。 * ver1.01: * valueが0の状態でもポップアップしていたバグを修正しました。 * YEP_CoreEngineとの競合回避処理を追加しました。 * ver1.00: * 公開 */ (function () { var parameters = PluginManager.parameters('GetInformation'); var infoDisableSwitchId = Number(parameters['Info Disable Switch Id'] || 10); var getGoldText = String(parameters['Get Gold Text']); var lostGoldText = String(parameters['Lost Gold Text']); var getInfoText = String(parameters['Get Item Text']); var lostInfoText = String(parameters['Lost Item Text']); var getInfoTextNum = String(parameters['Get Item Text Num']); var lostInfoTextNum = String(parameters['Lost Item Text Num']); var getInfoSkillText = String(parameters['Get Skill Text']); var lostInfoSkillText = String(parameters['Lost Skill Text']); var ExpUpText = String(parameters['Exp Up Text']); var ExpDownText = String(parameters['Exp Down Text']); var lvUpText = String(parameters['Lv Up Text']); var lvDownText = String(parameters['Lv Down Text']); var ParamUpText = String(parameters['Param Up Text']); var ParamDownText = String(parameters['Param Down Text']); var infoFontSize = Number(parameters['Info Font Size'] || 20); var infoCount = Number(parameters['Info Count'] || 120); var infoDelay = Number(parameters['Info Delay'] || 20); var infoMoveWait = Number(parameters['Info MoveWait'] || 100); var infoMoveFade = Number(parameters['Info MoveFade'] || 20); var goldIconIndex = Number(parameters['Gold Icon Index'] || 314); var actorIconStartIndex = Number(parameters['Actor Icon Start Index']); var useBattleInfo = String(parameters['Use Battle Info'] || 'true') === 'true'; var useRewardsInfo = String(parameters['Use Rewards Info'] || 'true') === 'true'; var infoSlideCount = 60; var infoPosition = String(parameters['Info Position'] || ''); var infoSlideAction = String(parameters['Info Slide Action'] || ''); var infoSupX = Number(parameters['Info Sup X'] || 0); var infoSupY = Number(parameters['Info Sup Y'] || 0); var infoPattern = parameters['Info Pattern'] || 'Normal'; var infoWidth = parameters['Info Width'] || 816; var rewardPopupDelay = Number(parameters['Reward Popup Delay']); var abpUpText = String(parameters['Abp Up Text']); var abpDownText = String(parameters['Abp Down Text']); var clvUpText = String(parameters['Class Lv Up Text']); var clvDownText = String(parameters['Class Lv Down Text']); var fLvUpText = String(parameters['Formation Lv Up Text']); var fLvMaxText = String(parameters['Formation Lv Max Text']); var battleShowList = String(parameters['Battle Show List']).split(','); var _gInfo_GInterpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand; Game_Interpreter.prototype.pluginCommand = function (command, args) { _gInfo_GInterpreter_pluginCommand.call(this, command, args); if (command === 'ShowInfo' || command === 'インフォ表示') { CommonPopupManager.showInfo({}, args[0], null); } }; CommonPopupManager.popEnable = function () { var useBattle = $gameParty.inBattle() ? useBattleInfo : true; return !$gameSwitches.value(infoDisableSwitchId) && useBattle; }; // Change Gold var _gInfo_GInterpreter_command125 = Game_Interpreter.prototype.command125; Game_Interpreter.prototype.command125 = function () { CommonPopupManager._popEnable = CommonPopupManager.popEnable(); var result = _gInfo_GInterpreter_command125.call(this); CommonPopupManager._popEnable = false; return result; }; // Change Item var _gInfo_GInterpreter_command126 = Game_Interpreter.prototype.command126; Game_Interpreter.prototype.command126 = function () { CommonPopupManager._popEnable = CommonPopupManager.popEnable(); var result = _gInfo_GInterpreter_command126.call(this); CommonPopupManager._popEnable = false; return result; }; // Change Weapon var _gInfo_GInterpreter_command127 = Game_Interpreter.prototype.command127; Game_Interpreter.prototype.command127 = function () { CommonPopupManager._popEnable = CommonPopupManager.popEnable(); var result = _gInfo_GInterpreter_command127.call(this); CommonPopupManager._popEnable = false; return result; }; // Change Armor var _gInfo_GInterpreter_command128 = Game_Interpreter.prototype.command128; Game_Interpreter.prototype.command128 = function () { CommonPopupManager._popEnable = CommonPopupManager.popEnable(); var result = _gInfo_GInterpreter_command128.call(this); CommonPopupManager._popEnable = false; return result; }; // Change EXP var _gInfo_GInterpreter_command315 = Game_Interpreter.prototype.command315; Game_Interpreter.prototype.command315 = function () { CommonPopupManager._popEnable = CommonPopupManager.popEnable(); var result = _gInfo_GInterpreter_command315.call(this); CommonPopupManager._popEnable = false; return result; }; // Change Level var _gInfo_GInterpreter_command316 = Game_Interpreter.prototype.command316; Game_Interpreter.prototype.command316 = function () { CommonPopupManager._popEnable = CommonPopupManager.popEnable(); var result = _gInfo_GInterpreter_command316.call(this); CommonPopupManager._popEnable = false; return result; }; // Change Parameter var _gInfo_GInterpreter_command317 = Game_Interpreter.prototype.command317; Game_Interpreter.prototype.command317 = function () { CommonPopupManager._popEnable = CommonPopupManager.popEnable(); var result = _gInfo_GInterpreter_command317.call(this); CommonPopupManager._popEnable = false; return result; }; // Change Skill var _gInfo_GInterpreter_command318 = Game_Interpreter.prototype.command318; Game_Interpreter.prototype.command318 = function () { CommonPopupManager._popEnable = CommonPopupManager.popEnable(); var result = _gInfo_GInterpreter_command318.call(this); CommonPopupManager._popEnable = false; return result; }; Game_Actor.prototype.addParam = function (paramId, value) { Game_BattlerBase.prototype.addParam.call(this, paramId, value); if (CommonPopupManager._popEnable) { if ($gameParty.inBattle() && !battleShowList.contains('params')) { return } CommonPopupManager.showInfo({ 'name': TextManager.param(paramId), 'value': value > 0 }, value, 'param', this.actorId()); } }; var _gInfo_GParty_gainGold = Game_Party.prototype.gainGold; Game_Party.prototype.gainGold = function (amount) { _gInfo_GParty_gainGold.call(this, amount); if (CommonPopupManager._popEnable) { if ($gameParty.inBattle() && !battleShowList.contains('gold')) { return } var hash = { 'name': '', 'iconIndex': goldIconIndex, 'description': '', 'value': Math.abs(amount) }; CommonPopupManager.showInfo(hash, amount, 'gold'); } }; var _gInfo_GParty_gainItem = Game_Party.prototype.gainItem; Game_Party.prototype.gainItem = function (item, amount, includeEquip) { var result = _gInfo_GParty_gainItem.call(this, item, amount, includeEquip); if (CommonPopupManager._popEnable) { if (this.inBattle() && !battleShowList.contains('item')) { return } CommonPopupManager.showInfo(item, amount, 'item'); } if (Imported.YEP_CoreEngine) return result; }; var _gInfo_GActor_learnSkill = Game_Actor.prototype.learnSkill; Game_Actor.prototype.learnSkill = function (skillId) { var isLearn = this.isLearnedSkill(skillId); _gInfo_GActor_learnSkill.call(this, skillId); if (CommonPopupManager._popEnable && !isLearn) { if ($gameParty.inBattle() && !battleShowList.contains('skill')) { return } CommonPopupManager.showInfo($dataSkills[skillId], 1, 'skill', this.actorId()); } }; var _gInfo_GActor_forgetSkill = Game_Actor.prototype.forgetSkill; Game_Actor.prototype.forgetSkill = function (skillId) { var isLearn = this.isLearnedSkill(skillId); _gInfo_GActor_forgetSkill.call(this, skillId); if (CommonPopupManager._popEnable && isLearn) { if ($gameParty.inBattle() && !battleShowList.contains('skill')) { return } CommonPopupManager.showInfo($dataSkills[skillId], 2, 'skill', this.actorId()); } }; var _gInfo_GActor_changeExp = Game_Actor.prototype.changeExp; Game_Actor.prototype.changeExp = function (exp, show) { var tExp = exp - this.currentExp(); var plevel = this.level; var pSkills = this._skills.clone(); if (CommonPopupManager._popEnable) { if (!$gameParty.inBattle() || battleShowList.contains('exp')) { CommonPopupManager.showInfo({ 'name': TextManager.exp, 'value': tExp > 0 }, tExp, 'exp', this.actorId()); } } var tempEnable = CommonPopupManager._popEnable; CommonPopupManager._popEnable = false; _gInfo_GActor_changeExp.call(this, exp, show); CommonPopupManager._popEnable = tempEnable; if ((this.level - plevel) !== 0) { var upLevel = this.level - plevel; if (CommonPopupManager._popEnable) { if ($gameParty.inBattle() && !battleShowList.contains('level')) { return } CommonPopupManager.showInfo({ 'name': TextManager.level, 'value': upLevel > 0 }, upLevel, 'level', this.actorId()); } } if (CommonPopupManager._popEnable) { this._skills.forEach(function (skillId) { if (!pSkills.contains(skillId)) { CommonPopupManager.showInfo($dataSkills[skillId], 1, 'skill', this.actorId()); } }.bind(this)); } }; var _gInfo_GActor_changeLevel = Game_Actor.prototype.changeLevel; Game_Actor.prototype.changeLevel = function (level, show) { var upLevel = level - this.level; var tempEnable = CommonPopupManager._popEnable; var pSkills = this._skills.clone(); CommonPopupManager._popEnable = false; _gInfo_GActor_changeLevel.call(this, level, show); CommonPopupManager._popEnable = tempEnable; if (CommonPopupManager._popEnable) { if ($gameParty.inBattle() && !battleShowList.contains('level')) { return } CommonPopupManager.showInfo({ 'name': TextManager.level, 'value': upLevel > 0 }, upLevel, 'level', this.actorId()); this._skills.forEach(function (skillId) { if (!pSkills.contains(skillId)) { CommonPopupManager.showInfo($dataSkills[skillId], 1, 'skill', this.actorId()); } }.bind(this)); } }; if (Imported['VXandAceHybridClass']) { // Change Class Level var _gInfo_GInterpreter_changeClassLevel = Game_Interpreter.prototype.changeClassLevel; Game_Interpreter.prototype.changeClassLevel = function (actorId, level, show) { CommonPopupManager._popEnable = CommonPopupManager.popEnable(); _gInfo_GInterpreter_changeClassLevel.call(this, actorId, level, show); CommonPopupManager._popEnable = false; }; // Change Abp var _gInfo_GInterpreter_changeAbp = Game_Interpreter.prototype.changeAbp; Game_Interpreter.prototype.changeAbp = function (actorId, abp, show) { CommonPopupManager._popEnable = CommonPopupManager.popEnable(); var result = _gInfo_GInterpreter_changeAbp.call(this, actorId, abp, show); CommonPopupManager._popEnable = false; return result; }; var _gInfo_GActor_changeAbp = Game_Actor.prototype.changeAbp; Game_Actor.prototype.changeAbp = function (abp, show) { var tAbp = abp - this.currentAbp(); var plevel = this.currentClassLevel(); var pSkills = this._skills.clone(); if (CommonPopupManager._popEnable) { if (!$gameParty.inBattle() || battleShowList.contains('abp')) { CommonPopupManager.showInfo({ 'name': TextManager.abp, 'value': tAbp > 0 }, tAbp, 'abp', this.actorId()); } } var tempEnable = CommonPopupManager._popEnable; CommonPopupManager._popEnable = false; _gInfo_GActor_changeAbp.call(this, abp, show); CommonPopupManager._popEnable = tempEnable; if ((this.currentClassLevel() - plevel) !== 0) { var upLevel = this.currentClassLevel() - plevel; if (CommonPopupManager._popEnable) { if ($gameParty.inBattle() && !battleShowList.contains('classLevel')) { return } CommonPopupManager.showInfo({ 'name': TextManager.classLevel, 'value': upLevel > 0 }, upLevel, 'classLevel', this.actorId(), this.currentClass().name); } } if (CommonPopupManager._popEnable) { this._skills.forEach(function (skillId) { if (!pSkills.contains(skillId)) { CommonPopupManager.showInfo($dataSkills[skillId], 1, 'skill', this.actorId()); } }.bind(this)); } }; var _gInfo_GActor_changeClassLevel = Game_Actor.prototype.changeClassLevel; Game_Actor.prototype.changeClassLevel = function (level, show) { var upLevel = level - this.currentClassLevel(); var tempEnable = CommonPopupManager._popEnable; var pSkills = this._skills.clone(); CommonPopupManager._popEnable = false; _gInfo_GActor_changeClassLevel.call(this, level, show); CommonPopupManager._popEnable = tempEnable; if (CommonPopupManager._popEnable) { if ($gameParty.inBattle() && !battleShowList.contains('classLevel')) { return } CommonPopupManager.showInfo({ 'name': TextManager.classLevel, 'value': upLevel > 0 }, upLevel, 'classLevel', this.actorId(), this.currentClass().name); this._skills.forEach(function (skillId) { if (!pSkills.contains(skillId)) { CommonPopupManager.showInfo($dataSkills[skillId], 1, 'skill', this.actorId()); } }.bind(this)); } }; } var __BManager_displayRewards = BattleManager.displayRewards; BattleManager.displayRewards = function () { __BManager_displayRewards.call(this); if (Imported['BattleFormation']) { $gameTemp._popupDelay = rewardPopupDelay; var upLevel = this._upBfLevel; var item = $gameParty.battleFormation(); if (CommonPopupManager.popEnable() && item) { if ($gameParty.inBattle() && !battleShowList.contains('formationLevel')) return; if ($gameParty.isMaxBfLevel(item.id)) { CommonPopupManager.showInfo({ 'name': item.name, 'iconIndex': item.iconIndex, 'value': 'max' }, upLevel, 'formationLevel', null, null); } else { CommonPopupManager.showInfo({ 'name': item.name, 'iconIndex': item.iconIndex, 'value': upLevel > 0 }, upLevel, 'formationLevel', null, null); } } $gameTemp._popupDelay = 0; } }; CommonPopupManager.showInfo = function (object, value, type, actor, c) { var text1 = null; if (value === 0) { return } var se = { name: '', volume: 90, pitch: 100, pan: 0 }; switch (type) { case 'gold': text1 = getGoldText; if (value < 0) { text1 = lostGoldText } break; case 'item': text1 = getInfoText; if (value > 1) { text1 = getInfoTextNum } else if (value === -1) { text1 = lostInfoText } else if (value < -1) { text1 = lostInfoTextNum } break; case 'exp': text1 = object.value ? ExpUpText : ExpDownText; break; case 'level': text1 = object.value ? lvUpText : lvDownText; break; case 'abp': text1 = object.value ? abpUpText : abpDownText; break; case 'classLevel': text1 = object.value ? clvUpText : clvDownText; break; case 'param': text1 = object.value ? ParamUpText : ParamDownText; break; case 'skill': text1 = value === 1 ? getInfoSkillText : lostInfoSkillText; break; case 'formationLevel': text1 = object.value === 'max' ? fLvMaxText : fLvUpText; break; default: text1 = value; } if (text1 === '') return; if (text1 === 'null') return; text1 = text1.replace(/^_se\[(.+?)\]/i, function () { var tx = arguments[1].split(','); se.name = tx[0]; if (tx[1]) se.volume = parseInt(tx[1], 10); if (tx[2]) se.pitch = parseInt(tx[2], 10); if (tx[3]) se.pan = parseInt(tx[3], 10); return ''; }.bind(this)); var descs = object.description ? object.description.split(/\n/) : []; if (actor) { actor = $gameActors.actor(actor); text1 = text1.replace(/_actor/g, actor.name()); text1 = text1.replace(/_aicon/g, actor.actorId() + actorIconStartIndex - 1); } if (c) { text1 = text1.replace(/_class/g, c) } text1 = text1.replace(/_name/g, object.name); text1 = text1.replace(/_icon/g, object.iconIndex); text1 = text1.replace(/_num/g, Math.abs(value)); text1 = descs[0] ? text1.replace(/_desc1/g, descs[0]) : text1.replace(/_desc1/g, ''); text1 = descs[1] ? text1.replace(/_desc2/g, descs[1]) : text1.replace(/_desc2/g, ''); var texts = text1.split(/\n|\\n/); for (var i = 0; i < texts.length; i++) { var text = texts[i].replace(/\\C\[\d+\]/g, ''); if (text === '') { delete texts[i] } } texts = texts.compact(); var oneHeight = (infoFontSize + 8) var height = oneHeight * texts.length; var bitmap = new Bitmap(Graphics.boxWidth, height); bitmap.fillRect(0, 0, infoWidth / 2, bitmap.height, 'rgba(0,0,0,0.5)'); bitmap.gradientFillRect(infoWidth / 2, 0, infoWidth / 2, bitmap.height, 'rgba(0,0,0,0.5)', 'rgba(0,0,0,0)'); this.window().contents = bitmap; this.window().drawTextEx('\\FS[' + infoFontSize + ']', 0, 0); for (var i = 0; i < texts.length; i++) { var text = '\\FS[' + infoFontSize + ']' + texts[i] this.window().drawTextEx(text, 8, i * oneHeight); } var arg = this.setPopup([]); arg.bitmap = bitmap; arg.se = se; if (infoPattern === 'GrowUp') { arg.x = 0 + infoSupX;//Graphics.boxWidth * -1 + infoSupX; arg.y = Graphics.boxHeight;// - height; arg.moveX = 0;//Graphics.boxWidth; arg.anchorX = 0; arg.anchorY = 1.0; arg.pattern = -2; if (infoSlideAction === 'Down') arg.anchorY = 0; } else if (infoPattern === 'Stretch') { arg.x = 0 + infoSupX; arg.y = Graphics.boxHeight - height; arg.moveX = 0; arg.anchorX = 0; arg.anchorY = 0; arg.pattern = -1; } else { arg.x = Graphics.boxWidth * -1 + infoSupX; arg.y = Graphics.boxHeight - height; arg.moveX = Graphics.boxWidth; arg.anchorX = 0; arg.anchorY = 0; } if (infoPosition === 'Up') { arg.y = 0; if (infoPattern === 'GrowUp' && infoSlideAction !== 'Down') arg.y = height; } arg.y += infoSupY; if ($gameParty.inBattle() && (SceneManager._scene._messageWindow && SceneManager._scene._messageWindow.active)) { if (SceneManager._scene._messageWindow._positionType === 2) { var my = SceneManager._scene._messageWindow.y; arg.y = Math.min(arg.y, my - height + height * arg.anchorY); } } if ((SceneManager._scene._statusWindow && SceneManager._scene._statusWindow.isOpen())) { var sy = SceneManager._scene._statusWindow.y; arg.y = Math.min(arg.y, sy - height + height * arg.anchorY); } arg.moveY = 0; arg.count = infoCount; arg.fixed = false; arg.extend = [infoMoveFade, infoMoveWait]; arg.slideCount = infoSlideCount; arg.delay = 0; arg.slideAction = infoSlideAction; if (!CommonPopupManager._tempCommonSprites) CommonPopupManager._tempCommonSprites = []; var array = CommonPopupManager._tempCommonSprites.compact(); var ld = CommonPopupManager._lastIndex; if (ld !== undefined && ld >= 0 && array[ld]) { array.sort(function (a, b) { return a.delay > b.delay ? -1 : 1 }); arg.delay = array[0].delay + infoDelay; } if ($gameTemp._popupDelay && arg.delay === 0) arg.delay += $gameTemp._popupDelay; CommonPopupManager._lastIndex = this._tempCommonSprites.setNullPos(arg); }; var _gInfo_BManager_gainRewards = BattleManager.gainRewards; BattleManager.gainRewards = function () { CommonPopupManager._popEnable = CommonPopupManager.popEnable() && useRewardsInfo; $gameTemp._popupDelay = rewardPopupDelay; _gInfo_BManager_gainRewards.call(this); CommonPopupManager._popEnable = false; $gameTemp._popupDelay = 0; }; })();
dazed/translations
www/js/plugins/GetInformation.js
JavaScript
unknown
36,440
//============================================================================= // GraphicalDesignMode.js // ---------------------------------------------------------------------------- // (C)2016 Triacontane // This software is released under the MIT License. // http://opensource.org/licenses/mit-license.php // ---------------------------------------------------------------------------- // Version // 2.10.8 2020/06/21 ウィンドウ高さが項目の高さを下回った場合に項目が描画されない場合がある問題を修正 // 2.10.7 2020/04/29 バトルログウィンドウの位置変更ができない問題を修正 // 2.10.6 2020/03/21 SceneCustomMenu.jsに合わせた微修正 // 2.10.5 2020/02/06 プラグインで追加した一部のウィンドウでデザインモード解除時に位置変更が反映されない問題を修正 // 2.10.4 2020/01/27 プラグインで追加した一部のウィンドウの位置変更が反映されない競合を修正 // 2.10.3 2019/11/02 デザインモード設定時はクリックでメッセージウィンドウを送れないよう修正 // 2.10.2 2019/02/27 初期状態でスクロールされているウィンドウの行高さを変更した場合に、スクロールの初期表示がずれる現象を修正 // 2.10.1 2018/11/06 BattleFormation.jsとの競合を解消 // 2.10.0 2018/08/18 メッセージウィンドウおよびサブウィンドウを本プラグインから触れないようにする設定を追加 // 2.9.1 2018/07/10 コアスクリプト1.6.1以降で装備スロットウィンドウを動かした状態で装備画面を起動するとエラーになる問題を修正 // 2.9.0 2018/06/27 ウィンドウが閉じている最中にGDM_LOCK_MESSAGE_WINDOWが実行されたとき、閉じ終わるまで実行を待機するよう修正 // 2.8.2 2018/05/20 YEP_BattleEngineCore.jsとの併用時、デザインモードで一部ウィンドウで透明状態の切り替えが機能しない競合を解消 // 2.8.1 2018/01/30 最新のNW.jsで動作するよう修正 // 2.8.0 2017/07/26 コンソールからの関数実行で直前に編集したウィンドウの位置を変更できる機能を追加 // 2.7.0 2017/04/11 2.6.0の修正で追加ウィンドウの位置変更が正常に動作しない問題を修正 // 選択肢ウィンドウについて位置変更を一時的に無効化するプラグインコマンドを追加 // 2.6.0 2017/04/07 追加したピクチャやウィンドウについて任意のスイッチがONのときのみ表示できる機能を追加 // 2.5.0 2017/03/11 ウィンドウを非表示にできる機能を追加 // 2.4.0 2017/01/09 カスタムウィンドウに表示する内容に揃えを指定できる機能を追加しました。 // 2.3.1 2016/11/30 RPGアツマールで画面がNowLoadingから進まなくなる場合がある問題を修正しました。 // 2.3.0 2016/11/25 メッセージウィンドウの背景の表示可否を固定にできる機能を追加しました。 // 2.2.1 2016/11/12 Macの場合、Ctrlキーの代わりにoptionキーを使用するようヘルプを追記 // 2.2.0 2016/11/03 ウィンドウごとに使用するフォントを設定できる機能を追加 // 2.1.0 2016/09/28 アイコンサイズをフォントサイズに合わせて自動で拡縮できる機能を追加 // 操作対象のウィンドウにフォーカスしたときに枠の色を変えて明示する機能を追加 // 数値項目のプロパティを設定する際にJavaScript計算式を適用できる機能を追加 // 2.0.0 2016/08/22 本体v1.3.0によりウィンドウ透過の実装が変更されたので対応 // 1.1.3 2016/08/05 本体v1.3.0にて表示される警告を抑制 // 1.1.2 2016/07/20 一部のウィンドウでプロパティロード後にコンテンツが再作成されない問題を修正 // 1.1.1 2016/07/17 余白とフォントサイズの変更が、画面切り替え後に元に戻ってしまう問題を修正 // 1.1.0 2016/07/11 メッセージウィンドウのみ位置変更を一時的に無効化するプラグインコマンドを追加 // 1.0.2 2016/04/02 liply_memoryleak_patch.jsとの競合を解消 // 1.0.1 2016/03/28 一部のウィンドウのプロパティを変更しようとするとエラーが発生する現象の修正 // 1.0.0 2016/03/13 初版 // 0.9.0 2016/03/05 ベータ版 // ---------------------------------------------------------------------------- // [Blog] : https://triacontane.blogspot.jp/ // [Twitter]: https://twitter.com/triacontane/ // [GitHub] : https://github.com/triacontane/ //============================================================================= /*: * @plugindesc GUI画面デザインプラグイン * パラメータを変更したら「プロジェクトの保存」(Ctrl+S) * @author トリアコンタン * * @param デザインモード * @desc デザインモードでゲームを起動します。(ON/OFF) * モード中はドラッグ&ドロップで位置を調整できます。 * @default true * @type boolean * * @param 自動保存 * @desc 位置を変更したときに自動で変更を保存します。(ON/OFF) * 通常は、Ctrl+Sで保存します。 * @default false * @type boolean * * @param モバイル版作成 * @desc モバイル版のウィンドウ配置を別に作成します。(ON/OFF) * モバイル版とPC版とでウィンドウ配置を変えたい場合のみONにしてください。 * @default false * @type boolean * * @param モバイル偽装 * @desc モバイル実行を偽装します。(ON/OFF) * モバイル版のウィンドウ作成やテスト時にONにしてください。 * @default false * @type boolean * * @param ウィンドウ透過 * @desc ウィンドウが重なったときに透過表示します。(ON/OFF) * 他のプラグインで同様機能を実現している場合はOFF。 * @default false * @type boolean * * @param グリッドサイズ * @desc ウィンドウ調整中に指定サイズでグリッドを表示します。 * 0を指定すると非表示になります。 * @default 48 * @type number * * @param パディング * @desc ウィンドウ余白のデフォルト値です。入力した場合、適用されます。デフォルト:18 * @default 0 * @type number * * @param フォントサイズ * @desc ウィンドウフォントサイズのデフォルト値です。入力した場合、適用されます。デフォルト:28 * @default 0 * @type number * * @param 行の高さ * @desc ウィンドウの行高のデフォルト値です。入力した場合、適用されます。デフォルト:36 * @default 0 * @type number * * @param 背景透明度 * @desc ウィンドウの背景透明度デフォルト値です。入力した場合、適用されます。デフォルト:192 * @default 0 * @type number * * @param アイコンサイズ調整 * @desc フォントサイズが変更された場合にアイコンのサイズを自動で調整します。 * @default false * @type boolean * * @param 背景表示可否固定 * @desc メッセージウィンドウ等でイベント命令ごとに指定する背景の表示設定を無視して、プラグインの設定値で固定します。 * @default false * @type boolean * * @param 右クリックで消去 * @desc デザインモードで右クリックしたときにウィンドウ全体を非表示にします。(OFFの場合は枠のみ消去) * @default false * @type boolean * * @param メッセージウィンドウを無視 * @desc メッセージ、選択肢、数値入力ウィンドウを本プラグインで触れないようにします。変更した位置はリセットされません。 * @default false * @type boolean * * @help メニュー画面や戦闘画面など各画面のウィンドウや画像の表示位置を * ドラッグ&ドロップで微調整して画面の外観をグラフィカルに設計できます。 * 横幅、高さ、余白、背景画像なども画面上で変更できます。 * * デフォルトの画面のほかプラグインによって追加された画面についても * 位置のカスタマイズが可能です。 * (ただし、相手の実装に依存するので動作保証はできません) * * 以下の手順で実行してください。 * * 1. パラメータ「デザインモード」を「ON」にする。 * - デフォルトで「ON」になっています。 * * 2. テストプレー、戦闘テスト、イベントテストを開始する。 * * 3. マウスでオブジェクトを掴んで好きな場所に配置する。 * - マウスによる通常のウィンドウ操作は無効になります。 * - 他のウィンドウや画面端に自動でスナップします。(Shiftで無効化) * - Ctrlを押していると、グリッドにスナップします。(Macの場合はoptionキー) * - Ctrl+Zで直前の変更を元に戻します。 * - Ctrl+Shift+Enterで現在のシーンの変更を全て初期化します。 * - ウィンドウ内で右クリックすると、枠の透明/不透明を切り替えます。 * パラメータを変更している場合は、ウィンドウ全体の表示/非表示を切り替えます。 * 一度非表示にすると、画面全体をリセットしない限り再表示できません。 * - ウィンドウ内で数字キー(※)を押下すると、各プロパティを変更できます。 * - コンソールに「changePos(x, y);」(x:X座標、y:Y座標)と打ち込むと * 直前に編集したウィンドウ位置を変更できます。 * * 4. Ctrl+Sでカスタマイズした位置を保存する。 * * 5. 通常のテストプレー時は「デザインモード」を「OFF」にする。 * * ※数字とプロパティの対応(テンキーでない方の数字キーです) * * 1. ウィンドウの横幅(※1) * 2. ウィンドウの高さ(直接指定)(※1) * 3. ウィンドウの余白(※2) * 4. ウィンドウのフォントサイズ(※2) * 5. ウィンドウの1行のあたりの高さ(※2) * 6. ウィンドウの背景透明度(※2) * 7. ウィンドウの行数(※2) * 8. ウィンドウの背景画像ファイル名 * 9. ウィンドウのフォント名(※3) * * ※1 JS計算式を適用できます。計算式は入力したその場で1回だけ評価されます。 * ※2 JS計算式を適用できます。計算式は保存され、画面表示のたびに再評価されます。 * 分からない場合、今まで通り数値を設定すれば問題ありません。 * ※3 フォントをロードする必要があります。「フォントロードプラグイン」をお使いください。 * 入手先:raw.githubusercontent.com/triacontane/RPGMakerMV/master/FontLoad.js * ※4 Macの場合、Ctrlキーはoptionキーで代用してください。(commandキーでは反応しません) * * また、任意のピクチャやウィンドウを追加表示することができます。 * 詳細はソースコードの「ユーザ書き換え領域」を参照してください。 * 追加表示したものも、ドラッグ&ドロップで位置を調整できます。 * * ウィンドウに表示する内容は、以下の制御文字で揃えを変更することができます。 * \\AL[left] # 左揃え(未記入の場合も左揃えになります) * \\AL[0] # 同上 * \\AL[center] # 中央揃え * \\AL[1] # 同上 * \\AL[right] # 右揃え * \\AL[2] # 同上 * * セーブした内容は「data/ContainerProperties.json」に保存されます。 * JSONエディタ等で編集することも可能です。 * * さらに、モバイル端末用に異なるウィンドウ配置を定義することもできます。 * モバイル用の配置情報は「data/ContainerPropertiesMobile.json」に保存されます。 * * モバイル偽装のオプションを有効にすると、モバイル端末での実行をPC上で * 再現できます。モバイル実行を再現すると音声や動画ファイルの使用形式が * 変化したり、音声ファイルの再生が行われなくなったりする可能性があります。 * * 本プラグインで位置を変更したウィンドウは、以後位置を変更することができなくなります。 * よって、ゲーム中に動的に位置が変更されるウィンドウに対して本プラグインで * 位置を固定すると正常に表示されなくなる場合があります。 * * そういったケースを含め、表示がおかしくなった場合は * 一旦、Ctrl+Shift+Enterを実行して画面中の全てのウィンドウを初期化することを勧めます。 * * 要注意! 追加したピクチャは、デプロイメント時に * 未使用ファイルとして除外される可能性があります。 * その場合、削除されたファイルを入れ直す等の対応が必要です。 * * 注意! * 他のプラグインの使用状況によってウィンドウの位置やサイズが * 正しく保存されない場合があります。 * * プラグインコマンド詳細 * イベントコマンド「プラグインコマンド」から実行。 * (パラメータの間は半角スペースで区切る) * * GDM解除_メッセージウィンドウ * GDM_UNLOCK_MESSAGE_WINDOW * メッセージウィンドウの位置変更を一時的に解除します。 * プラグインで変更した座標が無効になり * イベント「メッセージ表示」で指定したウィンドウ位置が有効になります。 * * GDM固定_メッセージウィンドウ * GDM_LOCK_MESSAGE_WINDOW * メッセージウィンドウの位置変更を再度、有効にします。 * プラグインで変更した座標が有効になり * イベント「メッセージ表示」で指定したウィンドウ位置は無視されます。 * * GDM解除_選択肢ウィンドウ * GDM_UNLOCK_CHOICE_WINDOW * 選択肢ウィンドウの位置変更を一時的に解除します。 * プラグインで変更した座標が無効になり * イベント「選択肢の表示」で指定したウィンドウ位置が有効になります。 * * GDM固定_選択肢ウィンドウ * GDM_LOCK_CHOICE_WINDOW * メッセージウィンドウの位置変更を再度、有効にします。 * プラグインで変更した座標が有効になり * イベント「選択肢の表示」で指定したウィンドウ位置は無視されます。 * * 利用規約: * 作者に無断で改変、再配布が可能で、利用形態(商用、18禁利用等) * についても制限はありません。 * このプラグインはもうあなたのものです。 */ var $dataContainerProperties = null; (function () { 'use strict'; //============================================================================= // ユーザ書き換え領域 - 開始 - // pictures : 各画面で表示するピクチャ情報 // windows : 各画面で表示するウィンドウ情報 // (ここで指定したファイル名は、デプロイメント時に //  未使用ファイルとして除外される可能性があります) // ※コピー&ペーストしやすくするために最後の項目にもカンマを付与しています。 //============================================================================= var settings = { /* タイトル画面の追加情報 */ Scene_Title: { /* pictures:シーンに追加表示する画像です。無条件で表示されます。 */ pictures: [ /* file:「img/pictures/」以下のファイルを拡張子なしで指定します switchId: 表示条件となるスイッチIDです*/ { file: '', switchId: 0 }, ], /* windows:シーンに追加表示するウィンドウです。*/ windows: [ /* lines:表示内容の配列です。 制御文字が利用できます。「\\i[n]」と「\」をひとつ多く指定してください。*/ /* switchId:出現条件となるスイッチIDです */ /* 位置を調整後に新しいウィンドウを追加する場合は、必ず「配列の末尾に追加」してください */ { lines: [], switchId: 0 }, ], }, /* メインメニュー画面の追加情報 */ Scene_Menu: { pictures: [ { file: '', switchId: 0 }, ], windows: [ { lines: [], switchId: 0 }, ], }, /* 戦闘画面の追加情報 */ Scene_Battle: { pictures: [ { file: '', switchId: 0 }, ], windows: [ { lines: [], switchId: 0 }, ], }, /* アイテムメニュー画面の追加情報 */ Scene_Item: { pictures: [ { file: '', switchId: 0 }, ], windows: [ { lines: [], switchId: 0 }, ], }, /* スキルメニュー画面の追加情報 */ Scene_Skill: { pictures: [ { file: '', switchId: 0 }, ], windows: [ { lines: [], switchId: 0 }, ], }, /* 装備メニュー画面の追加情報 */ Scene_Equip: { pictures: [ { file: '', switchId: 0 }, ], windows: [ { lines: [], switchId: 0 }, ], }, /* ステータスメニュー画面の追加情報 */ Scene_Status: { pictures: [ { file: '', switchId: 0 }, ], windows: [ { lines: [], switchId: 0 }, ], }, /* オプション画面の追加情報 */ Scene_Options: { pictures: [ { file: '', switchId: 0 }, ], windows: [ { lines: [], switchId: 0 }, ], }, /* セーブ画面の追加情報 */ Scene_Save: { pictures: [ { file: '', switchId: 0 }, ], windows: [ { lines: [], switchId: 0 }, ], }, /* ロード画面の追加情報 */ Scene_Load: { pictures: [ { file: '', switchId: 0 }, ], windows: [ { lines: [], switchId: 0 }, ], }, /* ショップ画面の追加情報 */ Scene_Shop: { pictures: [ { file: '', switchId: 0 }, ], windows: [ { lines: [], switchId: 0 }, ], }, /* 名前入力画面の追加情報 */ Scene_Name: { pictures: [ { file: '', switchId: 0 }, ], windows: [ { lines: [], switchId: 0 }, ], }, /* ゲームオーバー画面の追加情報 */ Scene_Gameover: { pictures: [ { file: '', switchId: 0 }, ], windows: [ { lines: [], switchId: 0 }, ], }, }; //============================================================================= // ユーザ書き換え領域 - 終了 - //============================================================================= var pluginName = 'GraphicalDesignMode'; var metaTagPrefix = 'GDM'; if (!Utils.RPGMAKER_VERSION || Utils.RPGMAKER_VERSION.match(/^1\.2./)) { alert('!!!このプラグインは本体バージョン1.3系以降でないと使用できません。!!!'); return; } var getParamNumber = function (paramNames, min, max) { var value = getParamOther(paramNames); if (value == null) return null; if (arguments.length < 2) min = -Infinity; if (arguments.length < 3) max = Infinity; return (parseInt(value, 10) || 0).clamp(min, max); }; var getParamBoolean = function (paramNames) { var value = getParamOther(paramNames); return value.toUpperCase() === 'ON' || value.toUpperCase() === 'TRUE'; }; var getParamOther = function (paramNames) { if (!Array.isArray(paramNames)) paramNames = [paramNames]; for (var i = 0; i < paramNames.length; i++) { var name = PluginManager.parameters(pluginName)[paramNames[i]]; if (name) return name; } return null; }; var getArgString = function (arg, upperFlg) { arg = convertEscapeCharacters(arg); return upperFlg ? arg.toUpperCase() : arg; }; var getArgEval = function (arg, min, max) { if (arguments.length < 2) min = -Infinity; if (arguments.length < 3) max = Infinity; return (eval(convertEscapeCharacters(arg)) || 0).clamp(min, max); }; var convertEscapeCharacters = function (text) { if (text == null) text = ''; var window = SceneManager._scene._windowLayer.children[0]; return window ? window.convertEscapeCharacters(text) : text; }; var checkTypeFunction = function (value) { return checkType(value, 'Function'); }; var checkType = function (value, typeName) { return Object.prototype.toString.call(value).slice(8, -1) === typeName; }; var getClassName = function (object) { var define = object.constructor.toString(); if (define.match(/^class/)) { return define.replace(/class\s+(.*?)\s+[\s\S]*/m, '$1'); } return define.replace(/function\s+(.*)\s*\([\s\S]*/m, '$1'); }; var getCommandName = function (command) { return (command || '').toUpperCase(); }; var paramDesignMode = getParamBoolean(['DesignMode', 'デザインモード']); var paramThroughWindow = getParamBoolean(['ThroughWindow', 'ウィンドウ透過']); var paramAutoSave = getParamBoolean(['AutoSave', '自動保存']); var paramGridSize = getParamNumber(['GridSize', 'グリッドサイズ'], 0) || 0; var paramPadding = getParamNumber(['Padding', 'パディング']); var paramFontSize = getParamNumber(['FontSize', 'フォントサイズ']); var paramLineHeight = getParamNumber(['LineHeight', '行の高さ']); var paramBackOpacity = getParamNumber(['LineHeight', '背景透明度']); var paramMobileMake = getParamBoolean(['MobileMake', 'モバイル版作成']); var paramFakeMobile = getParamBoolean(['FakeMobile', 'モバイル偽装']); var paramIconSizeScale = getParamBoolean(['IconSizeScale', 'アイコンサイズ調整']); var paramBackgroundFixed = getParamBoolean(['BackgroundFixed', '背景表示可否固定']); var paramRightClickHide = getParamBoolean(['RightClickHide', '右クリックで消去']); var paramIgnoreMesWindow = getParamBoolean(['IgnoreMesWindow', 'メッセージウィンドウを無視']); //============================================================================= // Utils // デザインモード判定を追加します。 //============================================================================= Utils.isDesignMode = function () { return (this.isOptionValid('test') || this.isOptionValid('btest') || this.isOptionValid('etest')) && this.isNwjs() && paramDesignMode; }; //============================================================================= // デザインモードの場合のみ実装する //============================================================================= if (Utils.isDesignMode()) { //============================================================================= // グローバル関数 //============================================================================= window.changePos = function (x, y) { SceneManager.setLastWindowPosition(x, y); }; //============================================================================= // Input // コピーと上書き保存用のボタンを追加定義します。 //============================================================================= Input.keyMapper[67] = 'copy'; Input.keyMapper[83] = 'save'; for (var i = 49; i < 58; i++) { Input.keyMapper[i] = 'num' + (i - 48); } var _Input__wrapNwjsAlert = Input._wrapNwjsAlert; Input._wrapNwjsAlert = function () { _Input__wrapNwjsAlert.apply(this, arguments); var _prompt = window.prompt; window.prompt = function () { var gui = require('nw.gui'); var win = gui.Window.get(); var result = _prompt.apply(this, arguments); win.focus(); Input.clear(); return result; }; }; var _Input_isRepeated = Input.isRepeated; Input.isRepeated = function (keyName) { if (keyName === 'ok' && this.isPressed('control')) { return false; } return _Input_isRepeated.apply(this, arguments); }; //============================================================================= // TouchInput // ポインタ位置を常に記憶します。 //============================================================================= TouchInput._onMouseMove = function (event) { var x = Graphics.pageToCanvasX(event.pageX); var y = Graphics.pageToCanvasY(event.pageY); this._onMove(x, y); }; //============================================================================= // SceneManager // ウィンドウポジションをjson形式で保存する処理を追加定義します。 //============================================================================= SceneManager.controlNumber = 0; var _SceneManager_initialize = SceneManager.initialize; SceneManager.initialize = function () { _SceneManager_initialize.call(this); this.lastWindowX = null; this.lastWindowY = null; this._lastWindow = null; this._windowPositionChanged = false; this.infoWindow = ''; this.infoExtend = ''; this._copyCount = 0; this._infoHelp = 'デザインモードで起動しています。 '; this._documentTitle = ''; this._changeStack = []; this.showDevToolsForGdm(); }; SceneManager.setLastWindow = function (windowObject) { this._lastWindow = windowObject; }; SceneManager.setLastWindowPosition = function (x, y) { if (!this._lastWindow) { this.setInfoExtend('直前に触れたオブジェクトが存在しないため、この操作は無効です。', 0); return; } this._lastWindow.position.x = x; this._lastWindow.position.y = y; this._windowPositionChanged = true; }; SceneManager.isWindowPositionChanged = function (windowObject) { if (this._windowPositionChanged && windowObject === this._lastWindow) { this._windowPositionChanged = false; return true; } return false; }; SceneManager.showDevToolsForGdm = function () { var nwWin = require('nw.gui').Window.get(); if (nwWin.isDevToolsOpen) { if (!nwWin.isDevToolsOpen()) { var devTool = nwWin.showDevTools(); devTool.moveTo(0, 0); devTool.resizeTo(window.screenX + window.outerWidth, window.screenY + window.outerHeight); nwWin.focus(); } } else { nwWin.showDevTools(); } this.outputStartLog(); }; SceneManager.outputStartLog = function () { var logValue = [ '☆☆☆ようこそ、デザインモードで起動しました。☆☆☆\n', 'デザインモードでは、オブジェクトの配置やプロパティを自由に設定して実際のゲーム画面上から画面設計できます。\n', '--------------------操 作 方 法----------------------------------------------------------------------\n', 'ドラッグ&ドロップ : ウィンドウや画像を掴んで好きな場所に再配置します。\n', 'Ctrl+マウス : ウィンドウや画像がグリッドにスナップします。(Macの場合はoptionキー)\n', 'Shift+マウス : ウィンドウや画像がオブジェクトや画面端にスナップしなくなります。\n', 'コンソールに「changePos(x, y);」(x:X座標、y:Y座標)と打ち込むと直前に編集したウィンドウ位置を変更できます。\n', 'Ctrl+S : 全ての変更を保存します。\n', 'Ctrl+C : 直前に操作した座標をクリップボードにコピーします。\n', 'Ctrl+Z : 直前に行った操作を元に戻します。\n', 'Ctrl+Shift+Enter : 表示している画面の配置を全てリセットしてロードし直します。\n', '右クリック : ウィンドウの枠(もしくはウィンドウ全体)の表示/非表示を切り替えます。\n', '数字キー : ウィンドウの範囲内で押下すると、以下のとおり対応するプロパティを変更できます。\n', ' 1. ウィンドウの横幅(※1)\n', ' 2. ウィンドウの高さ(直接指定)(※1)\n', ' 3. ウィンドウの余白(※2)\n', ' 4. ウィンドウのフォントサイズ(※2)\n', ' 5. ウィンドウの1行のあたりの高さ(※2)\n', ' 6. ウィンドウの背景透明度(※2)\n', ' 7. ウィンドウの行数(※2)\n', ' 8. ウィンドウの背景画像ファイル名\n', ' 9. ウィンドウのフォント名(※3)\n', '※1 JS計算式を適用できます。計算式は入力したその場で1回だけ評価されます。\n', '※2 JS計算式を適用できます。計算式は保存され、画面表示のたびに再評価されます。\n', '分からない場合、今まで通り数値を設定すれば問題ありません。\n', '※3 あらかじめフォントをロードする必要があります。「フォントロードプラグイン」をお使いください。\n', '入手先:raw.githubusercontent.com/triacontane/RPGMakerMV/master/FontLoad.js\n', '※4 Macの場合、Ctrlキーはoptionキーで代用してください。(commandキーでは反応しません)\n', '-----------------------------------------------------------------------------------------------------\n', '以下の操作ログが表示されます。\n' ]; console.log.apply(console, logValue); }; var _SceneManager_onSceneCreate = SceneManager.onSceneCreate; SceneManager.onSceneCreate = function () { _SceneManager_onSceneCreate.apply(this, arguments); this._changeStack = []; }; SceneManager.pushChangeStack = function (child) { var index = child.parent.getChildIndex(child); var info = { parent: child.parent, index: index }; child.saveProperty(info); this._changeStack.push(info); }; SceneManager.popChangeStack = function () { var info = this._changeStack.pop(); if (info) { var child = info.parent.children[info.index]; if (child) { child.loadProperty(info); child.saveContainerInfo(); return true; } } return false; }; var _SceneManager_update = SceneManager.updateMain; SceneManager.updateMain = function () { _SceneManager_update.apply(this, arguments); this.updateDragInfo(); }; SceneManager.updateDragInfo = function () { if (Input.isPressed('control') && Input.isTriggered('copy')) { SoundManager.playOk(); if (this.lastWindowX == null || this.lastWindowY == null) return; var clipboard = require('nw.gui').Clipboard.get(); var copyValue = ''; if (this._copyCount % 2 === 0) { copyValue = this.lastWindowX.toString(); this.setInfoExtend('X座標[' + copyValue + ']をクリップボードにコピーしました。', 0); } else { copyValue = this.lastWindowY.toString(); this.setInfoExtend('Y座標[' + copyValue + ']をクリップボードにコピーしました。', 0); } clipboard.set(copyValue, 'text'); this._copyCount++; } if (Input.isPressed('control') && Input.isTriggered('save')) { SoundManager.playSave(); DataManager.saveDataFileWp(); this.setInfoExtend('すべての変更を保存しました。', 0); } if (Input.isPressed('control') && Input.isTriggered('ok')) { if (this.popChangeStack()) { SoundManager.playCancel(); this.setInfoExtend('左記の番号の操作を元に戻しました。', -1); if (paramAutoSave) DataManager.saveDataFileWp(); } } if (Input.isPressed('control') && Input.isPressed('shift') && Input.isPressed('ok')) { $dataContainerProperties[this.getSceneName()] = {}; DataManager.saveDataFileWp(); location.reload(); } var docTitle = this._infoHelp + this.infoWindow + this.infoExtend; document.title = docTitle; this._documentTitle = docTitle; }; SceneManager.setInfoExtend = function (value, add) { this.controlNumber += add; this.infoExtend = ' ' + value; console.log(add ? this.controlNumber + (add < 0 ? 1 : 0) + ' : ' + value : value); if (paramAutoSave && add !== 0) { console.log('自動保存により変更が保存されました。'); } }; //============================================================================= // DataManager // ウィンドウポジションをjson形式で保存する処理を追加定義します。 //============================================================================= DataManager.saveDataFileWp = function () { StorageManager.saveToLocalDataFile(this._databaseFileCp.src, window[this._databaseFileCp.name]); }; //============================================================================= // StorageManager // ウィンドウポジションをjson形式で保存する処理を追加定義します。 //============================================================================= StorageManager.saveToLocalDataFile = function (fileName, json) { var data = JSON.stringify(json); var fs = require('fs'); var dirPath = this.localDataFileDirectoryPath(); var filePath = dirPath + fileName; if (!fs.existsSync(dirPath)) { fs.mkdirSync(dirPath); } fs.writeFileSync(filePath, data); }; StorageManager.localDataFileDirectoryPath = function () { var path = require('path'); var base = path.dirname(process.mainModule.filename); return path.join(base, 'data/'); }; //============================================================================= // Scene_Base // ウィンドウをドラッグ&ドロップします。 //============================================================================= var _Scene_Base_update = Scene_Base.prototype.update; Scene_Base.prototype.update = function () { _Scene_Base_update.apply(this, arguments); if (this._windowLayer) { this.updateDrag(); } this.shiftGridToLast(); }; Scene_Base.prototype.shiftGridToLast = function () { if (this._gridSprite && this.children[this.children.length - 1] !== this._gridSprite) { this.addChild(this._gridSprite); } }; Scene_Base.prototype.updateDrag = function () { this._windowLayer.isFrameChanged = false; var result = this._windowLayer.children.clone().reverse().some(function (container) { return checkTypeFunction(container.processDesign) && container.processDesign(); }, this); if (result) return; this.children.clone().reverse().some(function (container) { return checkTypeFunction(container.processDesign) && container.processDesign(); }, this); }; var _Scene_Base_createWindowLayer = Scene_Base.prototype.createWindowLayer; Scene_Base.prototype.createWindowLayer = function () { if (!(this instanceof Scene_Boot) && !(this instanceof Scene_Map)) this.createGridSprite(); _Scene_Base_createWindowLayer.apply(this, arguments); }; Scene_Base.prototype.createGridSprite = function () { var size = paramGridSize; if (size === 0) return; var width = Graphics.boxWidth; var height = Graphics.boxHeight; this._gridSprite = new Sprite(); this._gridSprite.setFrame(0, 0, width, height); var bitmap = new Bitmap(width, height); for (var x = 0; x < width; x += size) { bitmap.fillRect(x, 0, 1, height, 'rgba(255,255,255,1.0)'); } for (var y = 0; y < height; y += size) { bitmap.fillRect(0, y, width, 1, 'rgba(255,255,255,1.0)'); } this._gridSprite.bitmap = bitmap; this._gridSprite.moveDisable = true; this.addChild(this._gridSprite); }; //============================================================================= // PIXI.Container およびそのサブクラス // コンテナをドラッグ&ドロップします。 //============================================================================= var _PIXI_DisplayObjectContainer_initialize = PIXI.Container.prototype.initialize; PIXI.Container.prototype.initialize = function (x, y, width, height) { _PIXI_DisplayObjectContainer_initialize.apply(this, arguments); this._holding = false; this._dx = 0; this._dy = 0; this.moveDisable = false; this._positionLock = false; }; PIXI.Container.prototype.processDesign = function () { var result = false; if (!this.moveDisable) { if (this.processPosition()) { var info = 'X:[' + this.x + '] Y:[' + this.y + ']'; SceneManager.lastWindowX = this.x; SceneManager.lastWindowY = this.y; SceneManager.infoWindow = info; SceneManager.infoCopy = ''; if (!this._holding) SceneManager.setInfoExtend('位置を変更しました。' + info, 1); result = true; } if (this.processOpacity()) { SceneManager.setInfoExtend('背景の表示/非表示を変更しました。', 1); result = true; } if (this.processInput()) { SceneManager.setInfoExtend(this._propLabel + 'の値を' + this._propValue + 'に変更しました。', 1); result = true; } this.processFrameChange(); } return result; }; if (paramIgnoreMesWindow) { Window_Message.prototype.processDesign = function () { }; Window_NumberInput.prototype.processDesign = function () { }; Window_ChoiceList.prototype.processDesign = function () { }; } PIXI.Container.prototype.processPosition = function () { if (SceneManager.isWindowPositionChanged(this)) { return true; } if (this.isTouchEvent(TouchInput.isTriggered) || (this._holding && TouchInput.isPressed())) { if (!this._holding) this.hold(); var x = TouchInput.x - this._dx; var y = TouchInput.y - this._dy; if (Input.isPressed('control')) { var size = paramGridSize; if (size !== 0) { x += (x % size > size / 2 ? size - x % size : -(x % size)); y += (y % size > size / 2 ? size - y % size : -(y % size)); } } else if (!Input.isPressed('shift') && !this.isAnchorChanged()) { x = this.updateSnapX(x); y = this.updateSnapY(y); } this.position.x = x; this.position.y = y; this._positionLock = true; return true; } else if (this._holding) { this.release(); return true; } return false; }; PIXI.Container.prototype.processFrameChange = function () { }; Window_Base.prototype.processFrameChange = function () { if (this._holding || !TouchInput.isMoved()) return; if (this.isPreparedEvent() && !this.parent.isFrameChanged) { this._windowFrameSprite.setBlendColor([255, 128, 0, 192]); this.parent.isFrameChanged = true; SceneManager.setLastWindow(this); } else { this._windowFrameSprite.setBlendColor([0, 0, 0, 0]); } }; PIXI.Container.prototype.processOpacity = function () { }; Window_Base.prototype.processOpacity = function () { if (this.isTouchEvent(TouchInput.isCancelled)) { SoundManager.playMiss(); SceneManager.pushChangeStack(this); if (paramRightClickHide) { this.visible = !this.visible; } else { this.opacity = (this.opacity === 255 ? 0 : 255); } this.saveContainerInfo(); return true; } return false; }; PIXI.Container.prototype.processInput = function () { }; Window_Base.prototype.processInput = function () { if (this.isPreparedEvent()) { var params = [ ['num1', '横幅', 'width', 1, 2000, null], ['num2', '高さ', 'height', 1, 2000, null], ['num3', 'パディング', '_customPadding', 1, 100, this.updatePadding.bind(this), true], ['num4', 'フォントサイズ', '_customFontSize', 1, 100, this.resetFontSettings.bind(this), true], ['num5', '行の高さ', '_customLineHeight', 1, 2000, this.setFittingHeight.bind(this), true], ['num6', '背景の透明度', '_customBackOpacity', 0, 255, this.updateBackOpacity.bind(this), true], ['num7', '行数', '_customLineNumber', 0, 999, this.setFittingHeight.bind(this), true], ['num8', '背景画像のファイル名', '_customBackFileName', null, null, this.createBackSprite.bind(this), true], ['num9', 'フォント名', '_customFontFace', null, null, this.resetFontSettings.bind(this), true] ]; return params.some(function (param) { return this.processSetProperty.apply(this, param); }.bind(this)); } return false; }; Window_Base.prototype.setFittingHeight = function () { if (this._customLineNumber) this.height = this.fittingHeight(this._customLineNumber); }; Window_Base.prototype.processSetProperty = function (keyCode, propLabel, propName, min, max, callBack, stringFlg) { if (this[propName] === undefined) return null; if (Input.isTriggered(keyCode)) { var result = window.prompt(propLabel + 'を入力してください。', this[propName].toString()); if (result || (stringFlg && result === '')) { this._windowFrameSprite.setBlendColor([0, 0, 0, 0]); SceneManager.pushChangeStack(this); this[propName] = stringFlg ? getArgString(result) : getArgEval(result, min, max); if (callBack) callBack(); this.reDrawContents(); SoundManager.playMagicEvasion(); this.saveContainerInfo(); this._propLabel = propLabel; this._propValue = this[propName]; return true; } } return null; }; Window_Base.prototype.reDrawContents = function () { this.createContents(); this.refresh(); }; Window_Selectable.prototype.reDrawContents = function () { Window_Base.prototype.reDrawContents.apply(this, arguments); this.updateCursor(); }; PIXI.Container.prototype.isAnchorChanged = function () { return false; }; Sprite.prototype.isAnchorChanged = function () { return this.anchor.x !== 0 || this.anchor.y !== 0; }; PIXI.Container.prototype.hold = function () { this._holding = true; this._dx = TouchInput.x - this.x; this._dy = TouchInput.y - this.y; SceneManager.pushChangeStack(this); }; Window_Base.prototype.hold = function () { PIXI.Container.prototype.hold.call(this); this._windowBackSprite.setBlendColor([255, 255, 255, 192]); this._windowContentsSprite.setBlendColor([255, 128, 0, 192]); }; Sprite.prototype.hold = function () { PIXI.Container.prototype.hold.call(this); this.setBlendColor([255, 255, 255, 192]); }; PIXI.Container.prototype.release = function () { this._holding = false; this.saveContainerInfo(); }; Window_Base.prototype.release = function () { PIXI.Container.prototype.release.call(this); this._windowBackSprite.setBlendColor([0, 0, 0, 0]); this._windowContentsSprite.setBlendColor([0, 0, 0, 0]); }; Sprite.prototype.release = function () { PIXI.Container.prototype.release.call(this); this.setBlendColor([0, 0, 0, 0]); }; PIXI.Container.prototype.updateSnapX = function (x) { var minDistanceL = 16, minIndexL = -1, minDistanceR = 16, minIndexR = -1; var children = this.parent.children, endX = x + this.width; for (var i = 0, n = children.length; i < n; i++) { var child = children[i]; if (child !== this && this.isSameInstance(child) && child.isTouchable() && child.isOverlapY(this)) { var distanceL = Math.abs(x - child.endX); if (minDistanceL > distanceL) { minDistanceL = distanceL; minIndexL = i; } var distanceR = Math.abs(endX - child.x); if (minDistanceR > distanceR) { minDistanceR = distanceR; minIndexR = i; } } } if (minDistanceL > Math.abs(x)) return 0; if (minDistanceR > Math.abs(Graphics.boxWidth - endX)) return Graphics.boxWidth - this.width; if (minDistanceR > minDistanceL) { return minIndexL === -1 ? x : children[minIndexL].endX; } else { return minIndexR === -1 ? x : children[minIndexR].x - this.width; } }; PIXI.Container.prototype.updateSnapY = function (y) { var minDistanceU = 16, minIndexU = -1, minDistanceD = 16, minIndexD = -1; var children = this.parent.children, endY = y + this.height; for (var i = 0, n = children.length; i < n; i++) { var child = children[i]; if (child !== this && this.isSameInstance(child) && child.isTouchable() && child.isOverlapX(this)) { var distanceU = Math.abs(y - child.endY); if (minDistanceU > distanceU) { minDistanceU = distanceU; minIndexU = i; } var distanceD = Math.abs(endY - child.y); if (minDistanceD > distanceD) { minDistanceD = distanceD; minIndexD = i; } } } if (minDistanceU > Math.abs(y)) return 0; if (minDistanceD > Math.abs(Graphics.boxHeight - endY)) return Graphics.boxHeight - this.height; if (minDistanceD > minDistanceU) { return minIndexU === -1 ? y : children[minIndexU].endY; } else { return minIndexD === -1 ? y : children[minIndexD].y - this.height; } }; PIXI.Container.prototype.isSameInstance = function () { return false; }; Window_Base.prototype.isSameInstance = function (objectContainer) { return objectContainer instanceof Window_Base; }; Sprite.prototype.isSameInstance = function (objectContainer) { return objectContainer instanceof Sprite; }; PIXI.Container.prototype.isTouchPosInRect = function () { var tx = TouchInput.x; var ty = TouchInput.y; return (tx >= this.x && tx <= this.endX && ty >= this.y && ty <= this.endY); }; Sprite.prototype.isTouchPosInRect = function () { if (this.isTransparent()) return false; var dx = TouchInput.x - this.x; var dy = TouchInput.y - this.y; var sin = Math.sin(-this.rotation); var cos = Math.cos(-this.rotation); var rx = this.x + Math.floor(dx * cos + dy * -sin); var ry = this.y + Math.floor(dx * sin + dy * cos); return (rx >= this.minX() && rx <= this.maxX() && ry >= this.minY() && ry <= this.maxY()); }; Sprite.prototype.isTransparent = function () { var dx = TouchInput.x - this.x; var dy = TouchInput.y - this.y; var sin = Math.sin(-this.rotation); var cos = Math.cos(-this.rotation); var bx = Math.floor(dx * cos + dy * -sin) / this.scale.x + this.anchor.x * this.width; var by = Math.floor(dx * sin + dy * cos) / this.scale.y + this.anchor.y * this.height; return this.bitmap.getAlphaPixel(bx, by) === 0; }; Sprite.prototype.screenWidth = function () { return (this.width || 0) * this.scale.x; }; Sprite.prototype.screenHeight = function () { return (this.height || 0) * this.scale.y; }; Sprite.prototype.screenX = function () { return (this.x || 0) - this.anchor.x * this.screenWidth(); }; Sprite.prototype.screenY = function () { return (this.y || 0) - this.anchor.y * this.screenHeight(); }; Sprite.prototype.minX = function () { return Math.min(this.screenX(), this.screenX() + this.screenWidth()); }; Sprite.prototype.minY = function () { return Math.min(this.screenY(), this.screenY() + this.screenHeight()); }; Sprite.prototype.maxX = function () { return Math.max(this.screenX(), this.screenX() + this.screenWidth()); }; Sprite.prototype.maxY = function () { return Math.max(this.screenY(), this.screenY() + this.screenHeight()); }; PIXI.Container.prototype.isTouchable = function () { return false; }; Window_Base.prototype.isTouchable = function () { return (this.opacity > 0 || this.contentsOpacity > 0) && this.visible && this.isOpen(); }; Window_BattleLog.prototype.isTouchable = function () { return Window_Base.prototype.isTouchable.call(this) && this._lines.length > 0; }; Sprite.prototype.isTouchable = function () { return this.visible && this.bitmap != null && this.scale.x !== 0 && this.scale.y !== 0; }; PIXI.Container.prototype.isTouchEvent = function (triggerFunc) { return this.isTouchable() && triggerFunc.call(TouchInput) && this.isTouchPosInRect(); }; PIXI.Container.prototype.isPreparedEvent = function () { return this.isTouchable() && this.isTouchPosInRect(); }; PIXI.Container.prototype.isRangeX = function (x) { return this.x <= x && this.endX >= x; }; PIXI.Container.prototype.isRangeY = function (y) { return this.y <= y && this.endY >= y; }; PIXI.Container.prototype.isOverlapX = function (win) { return this.isRangeX(win.x) || this.isRangeX(win.endX) || win.isRangeX(this.x) || win.isRangeX(this.endX); }; PIXI.Container.prototype.isOverlapY = function (win) { return this.isRangeY(win.y) || this.isRangeY(win.endY) || win.isRangeY(this.y) || win.isRangeY(this.endY); }; Object.defineProperty(PIXI.Container.prototype, 'endX', { get: function () { return this.x + this.width; }, set: function (value) { this.x = value - this.width; }, configurable: true }); Object.defineProperty(PIXI.Container.prototype, 'endY', { get: function () { return this.y + this.height; }, set: function (value) { this.y = value - this.height; }, configurable: true }); //============================================================================= // Window_Selectable // 通常のタッチ操作を無効化します。 //============================================================================= Window_Selectable.prototype.processTouch = function () { }; Window_BattleActor.prototype.processTouch = function () { }; Window_BattleEnemy.prototype.processTouch = function () { }; var _Window_Message_isTriggered = Window_Message.prototype.isTriggered; Window_Message.prototype.isTriggered = function () { if (TouchInput.isRepeated()) { return false; } else { return _Window_Message_isTriggered.apply(this, arguments); } }; } //============================================================================= // ウィンドウを透過して重なり合ったときの表示を自然にします。 //============================================================================= if (paramThroughWindow && !WindowLayer.throughWindow) { WindowLayer.throughWindow = true; //============================================================================= // WindowLayer // ウィンドウのマスク処理を除去します。 //============================================================================= WindowLayer.prototype._maskWindow = function (window) { }; WindowLayer.prototype._canvasClearWindowRect = function (renderSession, window) { }; } if (paramFakeMobile) { Utils.isMobileDevice = function () { return true; }; } //============================================================================= // Game_Interpreter // プラグインコマンドを追加定義します。 //============================================================================= var _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand; Game_Interpreter.prototype.pluginCommand = function (command, args) { _Game_Interpreter_pluginCommand.apply(this, arguments); if (!command.match(new RegExp('^' + metaTagPrefix))) return; this.pluginCommandGraphicalDesignMode(command.replace(metaTagPrefix, ''), args); }; Game_Interpreter.prototype.pluginCommandGraphicalDesignMode = function (command) { switch (getCommandName(command)) { case '解除_メッセージウィンドウ': case '_UNLOCK_MESSAGE_WINDOW': SceneManager._scene._messageWindow.unlockPosition(); break; case '固定_メッセージウィンドウ': case '_LOCK_MESSAGE_WINDOW': var win = SceneManager._scene._messageWindow; if (win.isClosing()) { win.setCloseListener(win.lockPosition) } else { win.lockPosition(); } break; case '解除_選択肢ウィンドウ': case '_UNLOCK_CHOICE_WINDOW': SceneManager._scene._messageWindow._choiceWindow.unlockPosition(); break; case '固定_選択肢ウィンドウ': case '_LOCK_CHOICE_WINDOW': var win = SceneManager._scene._messageWindow._choiceWindow; if (win.isClosing()) { win.setCloseListener(win.lockPosition) } else { win.lockPosition(); } break; } }; //============================================================================= // DataManager // ContainerProperties.jsonの読み込み処理を追記します。 //============================================================================= DataManager._databaseFileCp = { name: '$dataContainerProperties', src: 'ContainerProperties.json' }; if (paramMobileMake && Utils.isMobileDevice()) { DataManager._databaseFileCp.src = 'ContainerPropertiesMobile.json'; } var _DataManager_loadDatabase = DataManager.loadDatabase; DataManager.loadDatabase = function () { _DataManager_loadDatabase.apply(this, arguments); var errorMessage = this._databaseFileCp.src + 'が見付かりませんでした。'; this.loadDataFileAllowError(this._databaseFileCp.name, this._databaseFileCp.src, errorMessage); }; DataManager.loadDataFileAllowError = function (name, src, errorMessage) { var xhr = new XMLHttpRequest(); var url = 'data/' + src; xhr.open('GET', url); xhr.overrideMimeType('application/json'); xhr.onload = function () { if (xhr.status < 400) { window[name] = JSON.parse(xhr.responseText); DataManager.onLoad(window[name]); } else { DataManager.onDataFileNotFound(name, errorMessage); } }; xhr.onerror = function () { DataManager.onDataFileNotFound(name, errorMessage); }; window[name] = null; xhr.send(); }; DataManager.onDataFileNotFound = function (name, errorMessage) { window[name] = {}; console.warn(errorMessage); }; var _DataManager_isDatabaseLoaded = DataManager.isDatabaseLoaded; DataManager.isDatabaseLoaded = function () { return _DataManager_isDatabaseLoaded.apply(this, arguments) && window[this._databaseFileCp.name]; }; //============================================================================= // SceneManager // 現在のシーン名を返します。 //============================================================================= SceneManager.getSceneName = function () { return getClassName(this._scene); }; var _SceneManager_updateScene = SceneManager.updateScene; SceneManager.updateScene = function () { _SceneManager_updateScene.apply(this, arguments); if (this._scene) { this._scene.updateCustomContainer(); } }; //============================================================================= // Scene_Base // ウィンドウ追加時に位置をロードします。 //============================================================================= var _Scene_Base_addWindow = Scene_Base.prototype.addWindow; Scene_Base.prototype.addWindow = function (child) { _Scene_Base_addWindow.apply(this, arguments); child.loadContainerInfo(); }; var _Scene_Base_addChild = Scene_Base.prototype.addChild; Scene_Base.prototype.addChild = function (child) { _Scene_Base_addChild.apply(this, arguments); child.loadContainerInfo(); }; var _Scene_Base_createWindowLayer2 = Scene_Base.prototype.createWindowLayer; Scene_Base.prototype.createWindowLayer = function () { this.createCustomPicture(); _Scene_Base_createWindowLayer2.apply(this, arguments); this.createCustomWindow(); }; Scene_Base.prototype.createCustomPicture = function () { var setting = settings[getClassName(this)]; if (setting) { var pictures = setting.pictures; this._customPictures = []; if (pictures) { pictures.forEach(function (picture) { if (!picture.file) return; var sprite = new Sprite(); sprite.bitmap = ImageManager.loadPicture(picture.file, 0); this._customPictures.push(sprite); this.addChild(sprite); sprite.switchId = picture.switchId || 0; }.bind(this)); } } }; Scene_Base.prototype.createCustomWindow = function () { var setting = settings[getClassName(this)]; if (setting) { var windows = setting.windows; this._customWindows = []; if (windows) { windows.forEach(function (windowItem) { if (!windowItem.lines || windowItem.lines.length < 1) return; var win = new Window_Custom(windowItem.lines); this._customWindows.push(win); win.switchId = windowItem.switchId || 0; }.bind(this)); } this.updateCustomWindowVisible(); } }; Scene_Base.prototype.updateCustomContainer = function () { if (this._customPictures) { this.updateCustomPicture(); } if (this._customWindows) { this.updateCustomWindow(); } }; Scene_Base.prototype.updateCustomPicture = function () { this._customPictures.forEach(function (picture) { if (picture.switchId > 0) { picture.visible = $gameSwitches.value(picture.switchId); } }); }; Scene_Base.prototype.updateCustomWindow = function () { this.updateCustomWindowVisible(); if (!this._windowAdd) { this._customWindows.forEach(function (windowItem) { this.addWindow(windowItem); }, this); this._windowAdd = true; } }; Scene_Base.prototype.updateCustomWindowVisible = function () { this._customWindows.forEach(function (windowItem) { if (windowItem.switchId > 0) { if ($gameSwitches.value(windowItem.switchId)) { windowItem.show(); } else { windowItem.hide(); } } }, this); }; //============================================================================= // PIXI.Container // 表示位置のセーブとロードを行います。 //============================================================================= Object.defineProperty(PIXI.Container.prototype, 'x', { get: function () { return this.position.x; }, set: function (value) { if (this._positionLock) return; this.position.x = value; } }); Object.defineProperty(PIXI.Container.prototype, 'y', { get: function () { return this.position.y; }, set: function (value) { if (this._positionLock) return; this.position.y = value; } }); PIXI.Container.prototype.loadContainerInfo = function () { var sceneName = SceneManager.getSceneName(); var parentName = getClassName(this.parent); var sceneInfo = $dataContainerProperties[sceneName]; if (sceneInfo) { var containerInfo = sceneInfo[parentName]; var key = [this.parent.getChildIndex(this), getClassName(this)]; if (containerInfo && containerInfo[key]) { this._positionLock = true; this.loadProperty(containerInfo[key]); } } }; PIXI.Container.prototype.unlockPosition = function () { this._positionLock = false; this._customPositionX = this.position.x; this._customPositionY = this.position.y; }; PIXI.Container.prototype.lockPosition = function () { this._positionLock = true; if (this._customPositionX) { this.position.x = this._customPositionX; } if (this._customPositionY) { this.position.y = this._customPositionY; } }; PIXI.Container.prototype.loadProperty = function (containerInfo) { this.position.x = containerInfo.x; this.position.y = containerInfo.y; }; Window_Base.prototype.loadProperty = function (containerInfo) { PIXI.Container.prototype.loadProperty.apply(this, arguments); this.width = containerInfo.width; this.height = containerInfo.height; this.opacity = containerInfo.opacity; this.visible = this.visible && !containerInfo.hidden; this._customFontSize = containerInfo._customFontSize; this._customPadding = containerInfo._customPadding; this._customLineHeight = containerInfo._customLineHeight; this._customBackOpacity = containerInfo._customBackOpacity; this._customBackFileName = containerInfo._customBackFileName; this._customFontFace = containerInfo._customFontFace; this.updatePadding(); this.resetFontSettings(); this.updateBackOpacity(); this.createContents(); this.refresh(); this.createBackSprite(); }; Window_Base.prototype.refresh = function () { }; Window_Selectable.prototype.loadProperty = function (containerInfo) { var row; if (this._scrollY !== 0) { row = this.topRow(); } Window_Base.prototype.loadProperty.apply(this, arguments); this.updateCursor(); if (row) { this.setTopRow(row); } }; PIXI.Container.prototype.saveContainerInfo = function () { var sceneName = SceneManager.getSceneName(); var parentName = getClassName(this.parent); if (!$dataContainerProperties[sceneName]) $dataContainerProperties[sceneName] = {}; var sceneInfo = $dataContainerProperties[sceneName]; if (!sceneInfo[parentName]) sceneInfo[parentName] = {}; var containerInfo = sceneInfo[parentName]; var key = [this.parent.getChildIndex(this), getClassName(this)]; if (!containerInfo[key]) containerInfo[key] = {}; this.saveProperty(containerInfo[key]); if (paramAutoSave) { DataManager.saveDataFileWp(); } }; PIXI.Container.prototype.saveProperty = function (containerInfo) { containerInfo.x = this.x; containerInfo.y = this.y; }; Window_Base.prototype.saveProperty = function (containerInfo) { PIXI.Container.prototype.saveProperty.apply(this, arguments); containerInfo.width = this.width; containerInfo.height = this.height; containerInfo.opacity = this.opacity; containerInfo.hidden = !this.visible; containerInfo._customFontSize = this._customFontSize; containerInfo._customPadding = this._customPadding; containerInfo._customLineHeight = this._customLineHeight; containerInfo._customBackOpacity = this._customBackOpacity; containerInfo._customBackFileName = this._customBackFileName; containerInfo._customFontFace = this._customFontFace; }; //============================================================================= // Window_Base // プロパティの値をカスタマイズします。 //============================================================================= var _Window_Base_initialize = Window_Base.prototype.initialize; Window_Base.prototype.initialize = function (x, y, width, height) { _Window_Base_initialize.apply(this, arguments); this._customFontSize = this.standardFontSize(); this._customPadding = this.standardPadding(); this._customLineHeight = this.lineHeight(); this._customLineNumber = 0; this._customBackOpacity = this.standardBackOpacity(); this._customBackSprite = null; this._customBackFileName = ''; this._customFontFace = ''; }; Window_Base.prototype.createBackSprite = function () { if (this._customBackFileName) { if (!this._customBackSprite) { this._customBackSprite = new Sprite(); this.addChildToBack(this._customBackSprite); } this._customBackSprite.bitmap = ImageManager.loadPicture(this._customBackFileName, 0); } else if (this._customBackSprite) { this.removeChild(this._customBackSprite); this._customBackSprite = null; } if (Utils.isDesignMode() && this._customBackSprite && this._customBackSprite.bitmap) { var bitmap = this._customBackSprite.bitmap; bitmap._image.onerror = function () { this._customBackFileName = ''; this._customBackSprite.bitmap._isLoading = false; this._customBackSprite.bitmap = null; this._customBackSprite = null; SceneManager.popChangeStack(); SceneManager.setInfoExtend('ファイルが見付からなかったので、左記の番号の変更を戻しました。', -1); }.bind(this); } }; var _Window_Selectable_initialize = Window_Selectable.prototype.initialize; Window_Selectable.prototype.initialize = function (x, y, width, height) { _Window_Selectable_initialize.apply(this, arguments); // Resolve conflict for BattleFormation.js this._customLineNumber = this.maxRows ? this.maxRows() : 0; }; var _Window_Selectable_maxPageRows = Window_Selectable.prototype.maxPageRows; Window_Selectable.prototype.maxPageRows = function () { return _Window_Selectable_maxPageRows.apply(this, arguments) || 1; }; var _Window_Base_standardFontFace = Window_Base.prototype.standardFontFace; Window_Base.prototype.standardFontFace = function () { return this._customFontFace ? this._customFontFace : _Window_Base_standardFontFace.apply(this, arguments); }; var _Window_Base_standardFontSize = Window_Base.prototype.standardFontSize; Window_Base.prototype.standardFontSize = function () { return this._customFontSize ? eval(this._customFontSize) : paramFontSize ? paramFontSize : _Window_Base_standardFontSize.apply(this, arguments); }; var _Window_Base_standardPadding = Window_Base.prototype.standardPadding; Window_Base.prototype.standardPadding = function () { return this._customPadding ? eval(this._customPadding) : paramPadding ? paramPadding : _Window_Base_standardPadding.apply(this, arguments); }; var _Window_Base_lineHeight = Window_Base.prototype.lineHeight; Window_Base.prototype.lineHeight = function () { return this._customLineHeight ? eval(this._customLineHeight) : paramLineHeight ? paramLineHeight : _Window_Base_lineHeight.apply(this, arguments); }; var _Window_Base_standardBackOpacity = Window_Base.prototype.standardBackOpacity; Window_Base.prototype.standardBackOpacity = function () { return this._customBackOpacity ? eval(this._customBackOpacity) : paramBackOpacity ? paramBackOpacity : _Window_Base_standardBackOpacity.apply(this, arguments); }; Window_Base._iconSrcWidth = Window_Base._iconWidth; Window_Base._iconSrcHeight = Window_Base._iconHeight; Window_Base.prototype.getIconScale = function () { var defaultFontSize = _Window_Base_standardFontSize.apply(this, arguments); var fontSize = this.contents.fontSize; return paramIconSizeScale && defaultFontSize !== fontSize ? fontSize / defaultFontSize : null; }; Window_Base.prototype.changeIconSize = function () { var iconScale = this.getIconScale(); if (iconScale) { Window_Base._iconWidth *= iconScale; Window_Base._iconHeight *= iconScale; } }; Window_Base.prototype.restoreIconSize = function () { var iconScale = this.getIconScale(); if (iconScale) { Window_Base._iconWidth = Window_Base._iconSrcWidth; Window_Base._iconHeight = Window_Base._iconSrcHeight; } }; var _Window_Base_drawActorIcons = Window_Base.prototype.drawActorIcons; Window_Base.prototype.drawActorIcons = function (actor, x, y, width) { this.changeIconSize(); _Window_Base_drawActorIcons.apply(this, arguments); this.restoreIconSize(); }; var _Window_Base_drawItemName = Window_Base.prototype.drawItemName; Window_Base.prototype.drawItemName = function (item, x, y, width) { this.changeIconSize(); _Window_Base_drawItemName.apply(this, arguments); this.restoreIconSize(); }; var _Window_Base_processDrawIcon = Window_Base.prototype.processDrawIcon; Window_Base.prototype.processDrawIcon = function (iconIndex, textState) { this.changeIconSize(); _Window_Base_processDrawIcon.apply(this, arguments); this.restoreIconSize(); }; var _Window_Base_drawIcon = Window_Base.prototype.drawIcon; Window_Base.prototype.drawIcon = function (iconIndex, x, y) { var iconScale = this.getIconScale(); if (iconScale) { var bitmap = ImageManager.loadSystem('IconSet'); var pw = Window_Base._iconSrcWidth; var ph = Window_Base._iconSrcHeight; var sx = iconIndex % 16 * pw; var sy = Math.floor(iconIndex / 16) * ph; var dw = Math.floor(pw * iconScale); var dh = Math.floor(ph * iconScale); var dx = x; var dy = y + (this.lineHeight() - dh) / 2 - 2; this.contents.blt(bitmap, sx, sy, pw, ph, dx, dy, dw, dh); } else { _Window_Base_drawIcon.apply(this, arguments); } }; var _Window_Base_setBackgroundType = Window_Base.prototype.setBackgroundType; Window_Base.prototype.setBackgroundType = function (type) { if (!paramBackgroundFixed) { _Window_Base_setBackgroundType.apply(this, arguments); } }; var _Window_Base_updateClose = Window_Base.prototype.updateClose; Window_Base.prototype.updateClose = function () { var prevClose = this.isClosing(); _Window_Base_updateClose.apply(this, arguments); if (this._callBack && prevClose && !this.isClosing()) { this._callBack(); this._callBack = null; } }; Window_Base.prototype.setCloseListener = function (callBack) { this._callBack = callBack; }; // for RPG MV 1.6.1 var _Window_EquipItem_refresh = Window_EquipItem.prototype.refresh; Window_EquipItem.prototype.refresh = function () { if (!this._actor) { return; } _Window_EquipItem_refresh.apply(this, arguments); }; /** * Window_Custom * 任意配置可能なウィンドウです。 * @constructor */ function Window_Custom() { this.initialize.apply(this, arguments); } Window_Custom._textAligns = { 'left': 0, '0': 0, 'center': 1, '1': 1, 'right': 2, '2': 2 }; Window_Custom.prototype = Object.create(Window_Selectable.prototype); Window_Custom.prototype.constructor = Window_Custom; Window_Custom.prototype.initialize = function (lines) { this._lines = lines || []; Window_Selectable.prototype.initialize.call(this, 0, 0, 320, this.fittingHeight(this._lines.length)); this.refresh(); }; Window_Custom.prototype.refresh = function () { this.createContents(); Window_Selectable.prototype.refresh.apply(this, arguments); }; Window_Custom.prototype.drawItem = function (index) { var rect = this.itemRectForText(index); var text = this._lines[index]; this.resetTextColor(); text = this.changeTextAlign(text); if (this._textAlign > 0) { rect.x = this.getTextAlignStartX(text); } this.drawTextEx(text, rect.x, rect.y); }; Window_Custom.prototype.getTextAlignStartX = function (text) { var width = this.drawTextEx(text, this.contentsWidth(), 0); if (this._textAlign === 1) { return this.contentsWidth() / 2 - width / 2; } else { return this.contentsWidth() - width; } }; Window_Custom.prototype.maxItems = function () { return this._lines.length; }; Window_Custom.prototype.changeTextAlign = function (text) { this._textAlign = 0; text = text.replace(/\\al\[(.*)]/gi, function () { this._textAlign = Window_Custom._textAligns[arguments[1].toLowerCase()] || 0; return ''; }.bind(this)); return text; }; })();
dazed/translations
www/js/plugins/GraphicalDesignMode.js
JavaScript
unknown
80,341
/*:ja * @plugindesc 放置していると画面がフリーズするのを修正 * @author kido * * @help * このコアスクリプトの修正を取り込みます * https://github.com/rpgtkoolmv/corescript/pull/191 * */ (function () { var _render = Graphics.render; Graphics.render = function (stage) { if (this._skipCount < 0) { this._skipCount = 0; } _render.call(this, stage); }; })();
dazed/translations
www/js/plugins/GraphicsRenderFix.js
JavaScript
unknown
428
//============================================================================= // InputForm.js // PUBLIC DOMAIN // ---------------------------------------------------------------------------- // 2017/09/03 iOSで「決定」ボタンを押せないバグを修正&裏のゲーム画面のクリックを無効に // 2018/12/06 入力欄の大きさを画面サイズに追従&iPhoneで画面がズレるバグ修正&文字サイズ設定&初期値設定 //============================================================================= /*: * @plugindesc フォーム作って文字入力(修正版) * @author 111, くらむぼん * * * @help InputForm x=350;y=200;v=11;max=5; * みたいな感じで。この例だとx350,y200の位置に表示、結果を11番の変数に保存。 * 最大文字数は5(maxは省略すれば無制限にもできる) * * 時間切れなどを作りたい時は、if_s=3;を付けると * ”スイッチ3がONになった場合”に強制終了できます * 並列イベントの中で、スイッチ3をONにするイベントを作りましょう * (ハマリポイント1)なおこの際、強制終了した瞬間の * テキストが結果の変数にしっかり保存されていることに注意。 * * index.htmlと同じ場所にcssフォルダを作ってそこに111_InputForm.cssを入れること。 * このファイルをいじって文字の大きさや、ウィンドウのデザイン・幅とかも変えられる * いじり方がわからなかったら「css 書き方」などで検索だ! * * 入力が終わるまで次のイベントコマンドは読み込みません * (ハマリポイント2)次のイベントコマンドの読み込みまでは * 少し間があるため結果の変数を他の並列処理で上書きしないよう注意。 * * * 機能追加: * Inputform (中略)btn_x=100;btn_y=100; * という書き方で、「決定」ボタンの位置を細かく調整できるようにしました。 * 値はテキストボックスからの相対位置で、デフォルトはbtn_x=0;btn_y=50;です。 * * (2018/12/06追加) * 入力欄や決定ボタンの縮尺が画面の縮尺に合わせて伸び縮みするようになりました。 * * Inputform (中略)font_size=30; * で入力欄・決定ボタンの文字の大きさを変更できます。 * font_sizeを指定しなければfont_size=24になります。 * * Inputform (中略)placeholder=文章; * で「文章」の内容を最初から入力欄に表示しておくことができます。 * デフォルトネームを設定しておく場合などにご利用ください。 * なお、placeholder=$;と指定すると変数vに入っている内容が表示されます。 * * ライセンス: * このプラグインの利用法に制限はありません。お好きなようにどうぞ。 */ (function () { function stopPropagation(event) { event.stopPropagation(); } // css追加 (function () { var css = document.createElement('link'); css.rel = "stylesheet"; css.type = 'text/css'; css.href = './css/111_InputForm.css'; var b_top = document.getElementsByTagName('head')[0]; b_top.appendChild(css); })(); // キー入力不可にする為に Input.form_mode = false; var _Input_onKeyDown = Input._onKeyDown; Input._onKeyDown = function (event) { if (Input.form_mode) return; _Input_onKeyDown.call(this, event) }; var _Input_onKeyUp = Input._onKeyUp; Input._onKeyUp = function (event) { if (Input.form_mode) return; _Input_onKeyUp.call(this, event) }; // 入力終わるまで次のイベントコマンド読み込まない var _Game_Interpreter_updateWaitMode = Game_Interpreter.prototype.updateWaitMode; Game_Interpreter.prototype.updateWaitMode = function () { if (this._waitMode == 'input_form') return true; return _Game_Interpreter_updateWaitMode.call(this); } HTMLElement.prototype.postionAdjust = function (screen_postion, target_postion, unitFontSize) { this.style.left = screen_postion[0] + target_postion[0] * Graphics._realScale + "px"; this.style.top = screen_postion[1] + target_postion[1] * Graphics._realScale + "px"; this.style.fontSize = unitFontSize * Graphics._realScale + "px"; this.style.maxWidth = 'calc(100% - ' + this.style.left + ')'; this.style.maxHeight = 'calc(100% - ' + this.style.top + ')'; }; // 引数のx=350;y=200;みたいなのを可能にする var argHash = function (text, arg_names) { var _args = new Array(arg_names.length); var ary = text.split(";"); ary.forEach(function (str) { var s_ary = str.split("="); var prop = s_ary[0].toLowerCase(); var value = s_ary[1]; _args[arg_names.indexOf(prop)] = value; }); return _args; } //============================================================================= // Game_Interpreter - register plugin commands //============================================================================= var _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand; Game_Interpreter.prototype.pluginCommand = function (command, args) { _Game_Interpreter_pluginCommand.call(this, command, args); if (command === 'InputForm') { console.log(args) var _ary = argHash(args[0], ["x", "y", "v", "max", "if_s", "btn_x", "btn_y", "font_size", "placeholder"]); var target_x = +_ary[0]; var target_y = +_ary[1]; var variables_id = +_ary[2]; var max_count = _ary[3] || null; var if_switch_id = 50; var button_x = +_ary[5] || 0; var button_y = _ary[6] === '' || isNaN(_ary[6]) ? 50 : +_ary[6]; var unitFontSize = _ary[7] === '' || isNaN(_ary[7]) ? 24 : +_ary[7]; var placeholder = _ary[8].replace(/__/g, ' '); var interpreter = this; var gui = { input: null, submit: null, is_pc: true, init: function () { this.is_pc = Utils.isNwjs(); this.create(); this.input.focus(); this.screenAdjust(); }, create: function () { // 入力フォーム this.input = document.createElement('input'); this.input.setAttribute('id', '_111_input'); if (max_count) this.input.setAttribute('maxlength', max_count); if (placeholder === '$') { placeholder = $gameVariables.value(variables_id); } this.input.setAttribute('value', placeholder || ''); document.body.appendChild(this.input); // 送信ボタン this.submit = document.createElement('input'); this.submit.setAttribute('type', 'submit'); this.submit.setAttribute('id', '_111_submit'); let label1 = '決定'; let label2 = 'キャンセル'; switch ($gameVariables.value(1999)) { case 1: case 2: label1 = 'OK'; label2 = 'CANCEL'; break; } this.submit.setAttribute('value', label1); document.body.appendChild(this.submit); // Cancel Button (キャンセルボタン) this._cancel = document.createElement('input'); this._cancel.setAttribute('type', 'submit'); this._cancel.setAttribute('id', '_111_submit'); this._cancel.setAttribute('value', label2); document.body.appendChild(this._cancel); }, success: function () { $gameVariables.setValue(variables_id, this.input.value); this.end(); }, cancel: function () { $gameVariables.setValue(variables_id, placeholder); this.end(); }, start: function () { interpreter.setWaitMode('input_form'); Input.clear(); Input.form_mode = true; // SceneManager._scene.stop(); }, end: function () { this.input.remove(); // document.body.removeChild(this.input); this.submit.remove(); this._cancel.remove(); window.removeEventListener("resize", resizeEvent, false); interpreter.setWaitMode(''); Input.form_mode = false; clearInterval(_event); // SceneManager._scene.start(); }, screenAdjust: function () { // canvasの左上を基準にした位置に合わせる var screen_x, screen_y; var _canvas = document.querySelector('#UpperCanvas'); var rect = _canvas.getBoundingClientRect(); screen_x = rect.left; screen_y = rect.top; this.input.postionAdjust([screen_x, screen_y], [target_x, target_y], unitFontSize); this.submit.postionAdjust([screen_x, screen_y], [target_x + button_x, target_y + button_y], unitFontSize); this._cancel.postionAdjust([screen_x, screen_y], [target_x + button_x + 100, target_y + button_y], unitFontSize); } } // console.log(gui) gui.init(); // 送信するイベントgui.input.onkeydown = function(e){ gui.input.addEventListener("keydown", function (e) { if (e.keyCode === 13) { // 決定キーで送信 Input.clear(); gui.success(); // 親へのイベント伝播を止める(documentのkeydownが反応しないように) e.stopPropagation(); } if (e.keyCode === 27) { Input.clear(); gui.cancel(); // 親へのイベント伝播を止める(documentのkeydownが反応しないように) e.stopPropagation(); } }); gui.input.addEventListener("mousedown", stopPropagation); // 裏のゲーム画面のクリック暴発を防ぐ gui.input.addEventListener("touchstart", stopPropagation); // iOSでclickイベント取れない対策 gui.submit.addEventListener("mousedown", stopPropagation); // 裏のゲーム画面のクリック暴発を防ぐ gui.submit.addEventListener("touchstart", stopPropagation); // iOSでclickイベント取れない対策 gui.submit.addEventListener("click", function () { // 送信ボタンクリック gui.success(); return false; }); gui._cancel.addEventListener("mousedown", stopPropagation); // 裏のゲーム画面のクリック暴発を防ぐ gui._cancel.addEventListener("touchstart", stopPropagation); // iOSでclickイベント取れない対策 gui._cancel.addEventListener("click", function () { // 送信ボタンクリック gui.cancel(); return false; }); // キャンセルするイベント if (if_switch_id) { var _event = setInterval(function () { if ($gameSwitches.value(if_switch_id)) { // clearInterval(_event); gui.cancel(); } }, 1); } // webではウィンドー大きさ変わる度に%求め直すイベントもいる //if(! gui.is_pc){ var resizeEvent = gui.screenAdjust.bind(gui); window.addEventListener("resize", resizeEvent, false); //} // gui.start(); } }; })();
dazed/translations
www/js/plugins/InputForm.js
JavaScript
unknown
12,622
//============================================================================= // ItemBook.js //============================================================================= /*: * @plugindesc Displays detailed statuses of items. * @author Yoji Ojima * * @param Unknown Data * @desc The index name for an unknown item. * @default ?????? * * @param Price Text * @desc The text for "Price". * @default Price * * @param Equip Text * @desc The text for "Equip". * @default Equip * * @param Type Text * @desc The text for "Type". * @default Type * * @help * * Plugin Command: * ItemBook open # Open the item book screen * ItemBook add weapon 3 # Add weapon #3 to the item book * ItemBook add armor 4 # Add armor #4 to the item book * ItemBook remove armor 5 # Remove armor #5 from the item book * ItemBook remove item 6 # Remove item #6 from the item book * ItemBook complete # Complete the item book * ItemBook clear # Clear the item book * * Item (Weapon, Armor) Note: * <book:no> # This item does not appear in the item book */ /*:ja * @plugindesc アイテム図鑑です。アイテムの詳細なステータスを表示します。 * @author Yoji Ojima * * @param Unknown Data * @desc 未確認のアイテムの索引名です。 * @default ?????? * * @param Price Text * @desc 「価格」の文字列です。 * @default 価格 * * @param Equip Text * @desc 「装備」の文字列です。 * @default 装備 * * @param Type Text * @desc 「タイプ」の文字列です。 * @default タイプ * * @help * * プラグインコマンド: * ItemBook open # 図鑑画面を開く * ItemBook add weapon 3 # 武器3番を図鑑に追加 * ItemBook add armor 4 # 防具4番を図鑑に追加 * ItemBook remove armor 5 # 防具5番を図鑑から削除 * ItemBook remove item 6 # アイテム6番を図鑑から削除 * ItemBook complete # 図鑑を完成させる * ItemBook clear # 図鑑をクリアする * * アイテム(武器、防具)のメモ: * <book:no> # 図鑑に載せない場合 */ (function () { var parameters = PluginManager.parameters('ItemBook'); var unknownData = String(parameters['Unknown Data'] || '??????'); var priceText = String(parameters['Price Text'] || 'Price'); var equipText = String(parameters['Equip Text'] || 'Equip'); var typeText = String(parameters['Type Text'] || 'Type'); var _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand; Game_Interpreter.prototype.pluginCommand = function (command, args) { _Game_Interpreter_pluginCommand.call(this, command, args); if (command === 'ItemBook') { switch (args[0]) { case 'open': SceneManager.push(Scene_ItemBook); break; case 'add': $gameSystem.addToItemBook(args[1], Number(args[2])); break; case 'remove': $gameSystem.removeFromItemBook(args[1], Number(args[2])); break; case 'complete': $gameSystem.completeItemBook(); break; case 'clear': $gameSystem.clearItemBook(); break; } } }; Game_System.prototype.addToItemBook = function (type, dataId) { if (!this._ItemBookFlags) { this.clearItemBook(); } var typeIndex = this.itemBookTypeToIndex(type); if (typeIndex >= 0) { this._ItemBookFlags[typeIndex][dataId] = true; } }; Game_System.prototype.removeFromItemBook = function (type, dataId) { if (this._ItemBookFlags) { var typeIndex = this.itemBookTypeToIndex(type); if (typeIndex >= 0) { this._ItemBookFlags[typeIndex][dataId] = false; } } }; Game_System.prototype.itemBookTypeToIndex = function (type) { switch (type) { case 'item': return 0; case 'weapon': return 1; case 'armor': return 2; default: return -1; } }; Game_System.prototype.completeItemBook = function () { var i; this.clearItemBook(); for (i = 1; i < $dataItems.length; i++) { this._ItemBookFlags[0][i] = true; } for (i = 1; i < $dataWeapons.length; i++) { this._ItemBookFlags[1][i] = true; } for (i = 1; i < $dataArmors.length; i++) { this._ItemBookFlags[2][i] = true; } }; Game_System.prototype.clearItemBook = function () { this._ItemBookFlags = [[], [], []]; }; Game_System.prototype.isInItemBook = function (item) { if (this._ItemBookFlags && item) { var typeIndex = -1; if (DataManager.isItem(item)) { typeIndex = 0; } else if (DataManager.isWeapon(item)) { typeIndex = 1; } else if (DataManager.isArmor(item)) { typeIndex = 2; } if (typeIndex >= 0) { return !!this._ItemBookFlags[typeIndex][item.id]; } else { return false; } } else { return false; } }; var _Game_Party_gainItem = Game_Party.prototype.gainItem; Game_Party.prototype.gainItem = function (item, amount, includeEquip) { _Game_Party_gainItem.call(this, item, amount, includeEquip); if (item && amount > 0) { var type; if (DataManager.isItem(item)) { type = 'item'; } else if (DataManager.isWeapon(item)) { type = 'weapon'; } else if (DataManager.isArmor(item)) { type = 'armor'; } $gameSystem.addToItemBook(type, item.id); } }; function Scene_ItemBook() { this.initialize.apply(this, arguments); } Scene_ItemBook.prototype = Object.create(Scene_MenuBase.prototype); Scene_ItemBook.prototype.constructor = Scene_ItemBook; Scene_ItemBook.prototype.initialize = function () { Scene_MenuBase.prototype.initialize.call(this); }; Scene_ItemBook.prototype.create = function () { Scene_MenuBase.prototype.create.call(this); this._indexWindow = new Window_ItemBookIndex(0, 0); this._indexWindow.setHandler('cancel', this.popScene.bind(this)); var wy = this._indexWindow.height; var ww = Graphics.boxWidth; var wh = Graphics.boxHeight - wy; this._statusWindow = new Window_ItemBookStatus(0, wy, ww, wh); this.addWindow(this._indexWindow); this.addWindow(this._statusWindow); this._indexWindow.setStatusWindow(this._statusWindow); }; function Window_ItemBookIndex() { this.initialize.apply(this, arguments); } Window_ItemBookIndex.prototype = Object.create(Window_Selectable.prototype); Window_ItemBookIndex.prototype.constructor = Window_ItemBookIndex; Window_ItemBookIndex.lastTopRow = 0; Window_ItemBookIndex.lastIndex = 0; Window_ItemBookIndex.prototype.initialize = function (x, y) { var width = Graphics.boxWidth; var height = this.fittingHeight(6); Window_Selectable.prototype.initialize.call(this, x, y, width, height); this.refresh(); this.setTopRow(Window_ItemBookIndex.lastTopRow); this.select(Window_ItemBookIndex.lastIndex); this.activate(); }; Window_ItemBookIndex.prototype.maxCols = function () { return 3; }; Window_ItemBookIndex.prototype.maxItems = function () { return this._list ? this._list.length : 0; }; Window_ItemBookIndex.prototype.setStatusWindow = function (statusWindow) { this._statusWindow = statusWindow; this.updateStatus(); }; Window_ItemBookIndex.prototype.update = function () { Window_Selectable.prototype.update.call(this); this.updateStatus(); }; Window_ItemBookIndex.prototype.updateStatus = function () { if (this._statusWindow) { var item = this._list[this.index()]; this._statusWindow.setItem(item); } }; Window_ItemBookIndex.prototype.refresh = function () { var i, item; this._list = []; for (i = 1; i < $dataItems.length; i++) { item = $dataItems[i]; if (item.name && item.itypeId === 1 && item.meta.book !== 'no') { this._list.push(item); } } for (i = 1; i < $dataWeapons.length; i++) { item = $dataWeapons[i]; if (item.name && item.meta.book !== 'no') { this._list.push(item); } } for (i = 1; i < $dataArmors.length; i++) { item = $dataArmors[i]; if (item.name && item.meta.book !== 'no') { this._list.push(item); } } this.createContents(); this.drawAllItems(); }; Window_ItemBookIndex.prototype.drawItem = function (index) { var item = this._list[index]; var rect = this.itemRect(index); var width = rect.width - this.textPadding(); if ($gameSystem.isInItemBook(item)) { this.drawItemName(item, rect.x, rect.y, width); } else { var iw = Window_Base._iconWidth + 4; this.drawText(unknownData, rect.x + iw, rect.y, width - iw); } }; Window_ItemBookIndex.prototype.processCancel = function () { Window_Selectable.prototype.processCancel.call(this); Window_ItemBookIndex.lastTopRow = this.topRow(); Window_ItemBookIndex.lastIndex = this.index(); }; function Window_ItemBookStatus() { this.initialize.apply(this, arguments); } Window_ItemBookStatus.prototype = Object.create(Window_Base.prototype); Window_ItemBookStatus.prototype.constructor = Window_ItemBookStatus; Window_ItemBookStatus.prototype.initialize = function (x, y, width, height) { Window_Base.prototype.initialize.call(this, x, y, width, height); }; Window_ItemBookStatus.prototype.setItem = function (item) { if (this._item !== item) { this._item = item; this.refresh(); } }; Window_ItemBookStatus.prototype.refresh = function () { var item = this._item; var x = 0; var y = 0; var lineHeight = this.lineHeight(); this.contents.clear(); if (!item || !$gameSystem.isInItemBook(item)) { return; } this.drawItemName(item, x, y); x = this.textPadding(); y = lineHeight + this.textPadding(); var price = item.price > 0 ? item.price : '-'; this.changeTextColor(this.systemColor()); this.drawText(priceText, x, y, 120); this.resetTextColor(); this.drawText(price, x + 120, y, 120, 'right'); y += lineHeight; if (DataManager.isWeapon(item) || DataManager.isArmor(item)) { var etype = $dataSystem.equipTypes[item.etypeId]; this.changeTextColor(this.systemColor()); this.drawText(equipText, x, y, 120); this.resetTextColor(); this.drawText(etype, x + 120, y, 120, 'right'); y += lineHeight; var type; if (DataManager.isWeapon(item)) { type = $dataSystem.weaponTypes[item.wtypeId]; } else { type = $dataSystem.armorTypes[item.atypeId]; } this.changeTextColor(this.systemColor()); this.drawText(typeText, x, y, 120); this.resetTextColor(); this.drawText(type, x + 120, y, 120, 'right'); x = this.textPadding() + 300; y = lineHeight + this.textPadding(); for (var i = 2; i < 8; i++) { this.changeTextColor(this.systemColor()); this.drawText(TextManager.param(i), x, y, 160); this.resetTextColor(); this.drawText(item.params[i], x + 160, y, 60, 'right'); y += lineHeight; } } x = 0; y = this.textPadding() * 2 + lineHeight * 7; this.drawTextEx(item.description, x, y); }; })();
dazed/translations
www/js/plugins/ItemBook.js
JavaScript
unknown
12,656
//=================================================================== //ItemTrigger.js //アイテム使用でイベント実行プラグイン //=================================================================== //Copyright (c) 2017 蔦森くいな //Released under the MIT license. //http://opensource.org/licenses/mit-license.php //------------------------------------------------------------------- //blog : http://paradre.com/ //Twitter: https://twitter.com/Kuina_T //=================================================================== //<更新情報> // ver1.0.0 2017/06/30 初版 //=================================================================== /*: * @plugindesc メニュー画面からアイテムを使用して目の前のイベントを実行できます。 * @author 蔦森くいな * * @help プラグイン管理画面からパラメータ「ItemId_Variable」に変数番号を設定すると、 * メニュー画面からアイテムを使用した時、指定した番号の変数に * 使用アイテムのIDを代入してから目の前のイベントを実行します。 * * アイテム使用をトリガーに設定したいイベントの実行内容には、 * プラグインで指定した変数を使った「条件分岐」を設定しておいて下さい。 * 特定のアイテムを使った時だけ特定の処理を実行するイベントが作成できます。 * * 例)指定した変数の値が「3」の時のみ実行する条件分岐を設定したイベントは、 *   ID「3」のアイテムを目の前で使った時のみ条件分岐の内容を実行します。 * * なお、1つのページのイベント内容の中に複数の条件分岐を設定する事で * 「アイテム1を使った時」「アイテム2を使った時」「話しかけられた時」など * それぞれの開始トリガーごとに実行内容を分ける事ができます。 * * また、データベースのアイテム使用効果にコモンイベントを設定している場合、 * アイテム使用対象となるイベントが存在しなければそのコモンイベントを実行し * 使用対象となるイベントが存在すればコモンイベントをキャンセルします。 * これにより、対象イベントが存在しない状況でアイテムを使用した時に * 「アイテムを使用したが何も起こらなかった」的な表現が実現できます。 * * * ※このプラグインは対象イベントのプライオリティと *  タイルセットのカウンター設定に対応しています。 *  通常の「決定ボタン」トリガーと同様の感覚でアイテム使用トリガーが発動します。 * * ※このプラグインで指定した変数はイベント終了時に自動的に値がリセットされます。 *  使用アイテムの判定以外の用途に利用する事は推奨されません。 * * @param ItemId_Variable * @desc 使用されたアイテムIDを受け取る変数の番号 * @default 0 * * 利用規約: * このプラグインは商用・非商用を問わず無料でご利用いただけます。 * どのようなゲームに使っても、どのように加工していただいても構いません。 * MIT Licenseにつき著作権表示とライセンスURLは残しておいて下さい。 */ (function () { 'use strict'; var pd_IT_useVariableId = Number(PluginManager.parameters("ItemTrigger")["ItemId_Variable"]); var pd_IT_Scene_ItemBase_checkCommonEvent = Scene_ItemBase.prototype.checkCommonEvent; Scene_ItemBase.prototype.checkCommonEvent = function () { if (pd_IT_useVariableId != 0) { if (!this.pd_IT_checkUseItemEvent($gamePlayer._x, $gamePlayer._y, false)) { var x = $gameMap.roundXWithDirection($gamePlayer._x, $gamePlayer._direction); var y = $gameMap.roundYWithDirection($gamePlayer._y, $gamePlayer._direction); if (!this.pd_IT_checkUseItemEvent(x, y, true) && $gameMap.isCounter(x, y)) { var x2 = $gameMap.roundXWithDirection(x, $gamePlayer._direction); var y2 = $gameMap.roundYWithDirection(y, $gamePlayer._direction); this.pd_IT_checkUseItemEvent(x2, y2, true) } } } pd_IT_Scene_ItemBase_checkCommonEvent.call(this); }; Scene_ItemBase.prototype.pd_IT_checkUseItemEvent = function (x, y, normal) { if (pd_IT_useVariableId != 0) { var useItemId = this._itemWindow.item().id; var frontEvents = $gameMap.eventsXy(x, y); if (frontEvents.length >= 1) { frontEvents.forEach(function (event) { if (event.isNormalPriority() === normal && !event._erased) { var eventList = $dataMap.events[event._eventId].pages[event._pageIndex].list; for (var i = 0; i < eventList.length; i++) { if (eventList[i].code === 111 && eventList[i].parameters[0] === 1) { if (eventList[i].parameters[1] === pd_IT_useVariableId) { var variableValue; if (eventList[i].parameters[2] === 0) { variableValue = eventList[i].parameters[3]; } else { variableValue = $gameVariables.value(eventList[i].parameters[3]); } if (variableValue === useItemId) { if ($gameTemp.isCommonEventReserved()) { $gameTemp.clearCommonEvent(); } $gameVariables.setValue(pd_IT_useVariableId, useItemId); event.start(); SceneManager.goto(Scene_Map); return true; } } } } } }); } } return false; }; var pd_IT_Game_Map_isEventRunning = Game_Map.prototype.isEventRunning; Game_Map.prototype.isEventRunning = function () { if (pd_IT_Game_Map_isEventRunning.call(this)) { return true; } else { if (pd_IT_useVariableId != 0 && $gameVariables.value(pd_IT_useVariableId) != 0) { $gameVariables.setValue(pd_IT_useVariableId, 0); } return false; } }; })();
dazed/translations
www/js/plugins/ItemTrigger.js
JavaScript
unknown
6,867
//============================================================================= // KMS_AreaEvent.js // Last update: 2019/01/01 //============================================================================= /*: * @plugindesc * [v0.1.0] Expand the trigger area for events on map. * * @author Kameo (Kamesoft) * * @help * ## Set trigger area * * Add <AreaEvent:WxH> to the comment command which placed top * of the event page, the trigger area is expanded to WxH tiles. * Example: <AreaEvent:3x2> * */ /*:ja * @plugindesc * [v0.1.0] マップイベントが起動する範囲を拡張する機能を追加します。 * * @author かめお (Kamesoft) * * @help * ## イベント起動範囲の設定 * * イベントページ先頭に置いた「注釈」に <AreaEvent:WxH> と記述すると、 * イベント位置を左上として横幅 W、縦幅 H のタイルでイベントが起動する * ようになります。 * 例: <AreaEvent:3x2> * */ var KMS = KMS || {}; (function () { 'use strict'; // 定数 var Const = { debug: false, // デバッグモード pluginCode: 'AreaEvent' // プラグインコード }; var PluginName = 'KMS_' + Const.pluginCode; KMS.imported = KMS.imported || {}; KMS.imported[Const.pluginCode] = true; var AreaEvent = {}; // 正規表現 AreaEvent.regex = { area: /<(?:エリアイベント|AreaEvent)\s*[:\s]\s*(\d+)\s*x\s*(\d+)>/i }; // エリア定義の原点 AreaEvent.origin = { topLeft: 7, topCenter: 8, topRight: 9, middleLeft: 4, middleCenter: 5, middleRight: 6, bottomLeft: 1, bottomCenter: 2, bottomRight: 3 }; // デバッグログ var debuglog; if (Const.debug) { debuglog = function () { console.log(arguments); }; } else { debuglog = function () { }; } // Integer の半分 function halfInt(value) { return Math.floor(value / 2); } // 位置をエリアイベントの設定に合わせて補正 function convertPositionForAreaEvent(x, y, area) { var width = area.width - 1; var height = area.height - 1; switch (area.origin) { case AreaEvent.origin.topLeft: return { x: x, y: y }; case AreaEvent.origin.topCenter: return { x: x - halfInt(width), y: y }; case AreaEvent.origin.topRight: return { x: x - width, y: y }; case AreaEvent.origin.middleLeft: return { x: x, y: y - halfInt(height) }; case AreaEvent.origin.middleCenter: return { x: x - halfInt(width), y: y - halfInt(height) }; case AreaEvent.origin.middleRight: return { x: x - width, y: y - halfInt(height) }; case AreaEvent.origin.bottomLeft: return { x: x, y: y - height }; case AreaEvent.origin.bottomCenter: return { x: x - halfInt(width), y: y - height }; case AreaEvent.origin.bottomRight: return { x: x - width, y: y - height }; default: console.assert('Invalid area origin'); } } //----------------------------------------------------------------------------- // Game_Event var _Game_Event_setupPage = Game_Event.prototype.setupPage; Game_Event.prototype.setupPage = function () { _Game_Event_setupPage.call(this); this.setupAreaEventAttribute(); }; /** * エリアイベント用属性の設定 */ Game_Event.prototype.setupAreaEventAttribute = function () { // 初期値はサイズ 1x1 this._areaEventAttribute = { width: 1, height: 1, origin: AreaEvent.origin.topLeft }; var isComment = function (command) { return command && (command.code === 108 || command.code === 408); }; // 注釈以外に達するまで解析 var page = this.page(); if (!page) { return; } var commands = page.list; var index = 0; var command = commands[index++]; while (isComment(command)) { var comment = command.parameters[0]; var match = AreaEvent.regex.area.exec(comment); if (match) { this._areaEventAttribute.width = Math.max(Number(match[1]), 1); this._areaEventAttribute.height = Math.max(Number(match[2]), 1); debuglog(this._areaEventAttribute); break; } command = commands[index++]; } }; /** * イベントのトリガー位置とサイズを取得 (他プラグイン用) * * @return {object} イベントのトリガー位置とサイズを格納したオブジェクト */ Game_Event.prototype.getEventTriggerArea = function () { var area = this._areaEventAttribute; var pos = convertPositionForAreaEvent(this._x, this._y, area); return { x: pos.x, y: pos.y, width: area.width, height: area.height, origin: area.origin }; }; Game_Event.prototype.pos = function (x, y) { var area = this._areaEventAttribute; var pos = convertPositionForAreaEvent(x, y, area); return pos.x >= this._x && pos.x < this._x + area.width && pos.y >= this._y && pos.y < this._y + area.height; }; })();
dazed/translations
www/js/plugins/KMS_AreaEvent.js
JavaScript
unknown
5,544
//============================================================================= // KMS_MapActiveMessage.js // Last update: 2019/08/31 //============================================================================= /*: * @plugindesc * [v0.2.0] Show messages automatically for events on map. * * @author Kameo (Kamesoft) * * @param Balloon offset Y * @default 20 * @desc Vertical position offset for balloons by pixel. * * @param Balloon margin * @default -8 * @desc Adjust frame size of balloons by pixel. * * @param Default range * @default 4 * @desc Default distance for displaying message by tile unit. * * @param Display duration * @default 300 * @desc Display frame count. * * @param Max message count * @default 10 * @desc Max number of active messages. * * @param Message skin * @default ActiveMessageSkin * @require 1 * @dir img/system/ * @type file * @desc Message skin for active message. Load from img/system. * * * @help * * ## Plugin command * * MapActiveMessage enable # Enable active message * MapActiveMessage disable # Display active message * MapActiveMessage show 10 # Show message of the event whose ID is 10 * MapActiveMessage show # Show messages of all events * */ /*:ja * @plugindesc * [v0.2.0] プレイヤーが近付いたときに、自動的にメッセージを表示するイベントを作成します。 * * @author かめお (Kamesoft) * * @param Balloon offset Y * @default 20 * @desc 吹き出しの縦方向の位置をピクセル単位で調整します。 * * @param Balloon margin * @default -8 * @desc 吹き出しの枠サイズをピクセル単位で調整します。 * * @param Default range * @default 4 * @desc メッセージを表示する距離をタイル単位で指定します。 * * @param Display duration * @default 300 * @desc メッセージ表示時間をフレーム単位で指定します。 * * @param Max message count * @default 10 * @desc 表示できるメッセージの最大数です。 * * @param Message skin * @default ActiveMessageSkin * @require 1 * @dir img/system/ * @type file * @desc メッセージの表示に使用するスキン画像です。 img/system から読み込みます。 * * * @help * * ■ プラグインコマンド * * MapActiveMessage enable # アクティブメッセージを有効にします。 * MapActiveMessage disable # アクティブメッセージを無効にします。 * MapActiveMessage show 10 # イベント ID:10 のメッセージを表示します。 * MapActiveMessage show # 全イベントのメッセージを表示します。 * */ var KMS = KMS || {}; (function () { 'use strict'; // 定数 var Const = { debug: false, // デバッグモード pluginCode: 'MapActiveMessage', // プラグインコード regex: { activeMessage: /<(?:アクティブメッセージ|ActiveMessage)\s*[:\s]\s*([^>]+)>/i, displayRange: /<(?:アクティブメッセージ距離|ActiveMessageRange)\s*[:\s]\s*(\d+)>/i, displayDuration: /<(?:アクティブメッセージ表示時間|ActiveMessageDuration)\s*[:\s]\s*(\d+)>/i, beginMessage: /<(?:アクティブメッセージ開始|BeginActiveMessage)>/i, // * 未使用 endMessage: /<(?:アクティブメッセージ終了|EndActiveMessage)>/i // * 未使用 }, balloonFrameInfo: { margin: 4, size: 24, lineLength: 48, srcSize: 96 }, balloonVertexSize: { width: 24, height: 48 }, // 吹き出しの表示位置 balloonPosition: { below: 0, above: 1 } }; var PluginName = 'KMS_' + Const.pluginCode; KMS.imported = KMS.imported || {}; KMS.imported[Const.pluginCode] = true; function isNullOrUndefined(value) { return value === null || value === undefined; } // デフォルト値つきで文字列から int を解析 function parseIntWithDefault(param, defaultValue) { var value = parseInt(param); return isNaN(value) ? defaultValue : value; } var pluginParams = PluginManager.parameters(PluginName); var Params = {}; Params.messageSkin = pluginParams['Message skin'] || 'ActiveMessageSkin'; Params.messageCountMax = Math.max(parseIntWithDefault(pluginParams['Max message count'], 8), 1); Params.balloonOffsetY = parseIntWithDefault(pluginParams['Balloon offset Y'], 20); Params.balloonMargin = parseIntWithDefault(pluginParams['Balloon margin'], -8); Params.defaultRange = Math.max(parseIntWithDefault(pluginParams['Default range'], 4), 1); Params.displayDuration = Math.max(parseIntWithDefault(pluginParams['Display duration'], 300), 1); Params.fadeFrameCount = Math.max(parseIntWithDefault(pluginParams['Fade frame count'], 8), 1); Params.fontSize = Math.max(parseIntWithDefault(pluginParams['Font size'], 18), 1); // デバッグログ var debuglog; if (Const.debug) { debuglog = function () { console.log(arguments); }; } else { debuglog = function () { }; } var _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand; Game_Interpreter.prototype.pluginCommand = function (command, args) { _Game_Interpreter_pluginCommand.call(this, command, args); if (command !== Const.pluginCode) { return; } switch (args[0]) { case 'enable': // 有効化 $gameSystem.setMapActiveMessageEnabled(true); break; case 'disable': // 無効化 $gameSystem.setMapActiveMessageEnabled(false); break; case 'show': // 強制表示 (eventId) // eventId 省略時 (undefined) は全イベントが対象 $gameMap.forceDisplayActiveMessage(parseInt(args[1])); break; default: // 不明なコマンド console.error('[%s %s] Unknown command.', Const.pluginCode, args[0]); break; } }; // タイリング描画 function tileBlt(dstImage, srcImage, sx, sy, sw, sh, dx, dy, dw, dh) { for (var offY = 0; offY < dh; offY += sh) { for (var offX = 0; offX < dw; offX += sw) { var tempSh = Math.min(sh, dh - offY); var tempSw = Math.min(sw, dw - offX); dstImage.blt( srcImage, sx, sy, tempSw, tempSh, dx + offX, dy + offY, tempSw, tempSh ); } } } //----------------------------------------------------------------------------- // Game_Temp var _Game_Temp_initialize = Game_Temp.prototype.initialize; Game_Temp.prototype.initialize = function () { _Game_Temp_initialize.call(this); this.clearMapActiveMessage(); }; /** * アクティブメッセージの登録 */ Game_Temp.prototype.pushMapActiveMessage = function (text, targetEvent, isForced) { var message = { text: text, event: targetEvent, isForced: !!isForced }; this._mapActiveMessages.push(message); }; /** * アクティブメッセージのクリア */ Game_Temp.prototype.clearMapActiveMessage = function () { this._mapActiveMessages = []; }; /** * 次のアクティブメッセージを取得 */ Game_Temp.prototype.popNextMapActiveMessage = function () { return this._mapActiveMessages.shift(); }; /** * アクティブメッセージが登録されているか */ Game_Temp.prototype.isMapActiveMessageReady = function () { return this._mapActiveMessages.length > 0; }; //----------------------------------------------------------------------------- // Game_System /** * アクティブメッセージの有効状態を取得 */ Game_System.prototype.isMapActiveMessageEnabled = function () { return !isNullOrUndefined(this._mapActiveMessageEnabled) ? this._mapActiveMessageEnabled : true; }; /** * アクティブメッセージの有効状態を設定 */ Game_System.prototype.setMapActiveMessageEnabled = function (enabled) { this._mapActiveMessageEnabled = !!enabled; }; //----------------------------------------------------------------------------- // Game_Map var _Game_Map_setup = Game_Map.prototype.setup; Game_Map.prototype.setup = function (mapId) { _Game_Map_setup.call(this, mapId); this.initializeActiveMessage(); }; /** * アクティブメッセージの初期化 */ Game_Map.prototype.initializeActiveMessage = function () { // 最初は全イベントの表示済みフラグを解除 this.clearActiveMessageShownFlags(); }; /** * アクティブメッセージの表示済みフラグを解除 */ Game_Map.prototype.clearActiveMessageShownFlags = function () { this.events().forEach(function (event) { event.setMapActiveMessageShown(false); }); this.requestUpdateActiveMessage(); }; /** * アクティブメッセージの更新要求 */ Game_Map.prototype.requestUpdateActiveMessage = function () { this._needsUpdateActiveMessage = true; }; var _Game_Map_update = Game_Map.prototype.update; Game_Map.prototype.update = function (sceneActive) { _Game_Map_update.call(this, sceneActive); this.updateDisplayActiveMessage(); }; /** * アクティブメッセージの表示判定 */ Game_Map.prototype.updateDisplayActiveMessage = function () { if (!this._needsUpdateActiveMessage) { return; } this._needsUpdateActiveMessage = false; // アクティブメッセージの登録 var events = $gamePlayer.findAvailableMapActiveMessageEvents(); events.forEach(function (event) { $gameTemp.pushMapActiveMessage(event.getMapActiveMessage(), event); }); }; /** * アクティブメッセージの強制表示 */ Game_Map.prototype.forceDisplayActiveMessage = function (eventId) { var invoker = function (event) { $gameTemp.pushMapActiveMessage(event.getMapActiveMessage(), event, true); }; if (isNullOrUndefined(eventId) || isNaN(eventId)) { // 全表示 this.events().forEach(invoker); } else { // イベント ID 指定 this.events().filter(function (event) { return event.eventId() === eventId; }).forEach(invoker); } }; var _Game_Map_refresh = Game_Map.prototype.refresh; Game_Map.prototype.refresh = function () { _Game_Map_refresh.call(this); this.requestUpdateActiveMessage(); }; //----------------------------------------------------------------------------- // Game_CharacterBase var _Game_CharacterBase = Game_CharacterBase.prototype.setDirection; Game_CharacterBase.prototype.setDirection = function (d) { _Game_CharacterBase.call(this, d); // 移動時には方向指定があるはずなので、ここでメッセージの更新要求を出す if (!isNullOrUndefined($gameMap)) { $gameMap.requestUpdateActiveMessage(); } }; //----------------------------------------------------------------------------- // Game_Player /** * アクティブメッセージを表示可能なイベントを探す */ Game_Player.prototype.findAvailableMapActiveMessageEvents = function () { if (!this.canMove()) { return []; } // 指定距離内でメッセージ未表示のイベントを列挙 var candidateEvents = $gameMap.events().filter(function (event) { return event.hasMapActiveMessage() && !event.isMapActiveMessageShown() && this.calcDistanceForMapActiveMessage(event) <= event.getMapActiveMessageRange(); }, this); // 表示済みフラグの解除判定 $gameMap.events().forEach(function (event) { var distance = this.calcDistanceForMapActiveMessage(event); if (event.isMapActiveMessageShown()) { // メッセージ表示距離から出ていれば表示済みフラグ解除 if (distance > event.getMapActiveMessageRange()) { event.setMapActiveMessageShown(false); } } }, this); return candidateEvents; }; Game_Player.prototype.calcDistanceForMapActiveMessage = function (event) { var diffX = this.x - event.x; var diffY = this.y - event.y; return Math.sqrt(diffX * diffX + diffY * diffY); }; //----------------------------------------------------------------------------- // Game_Event var _Game_Event_setupPage = Game_Event.prototype.setupPage; Game_Event.prototype.setupPage = function () { _Game_Event_setupPage.call(this); this.setupMapActiveMessage(); }; /** * 現在のページ番号を取得 */ Game_Event.prototype.pageIndex = function () { return this._pageIndex; }; /** * アクティブメッセージを構築 */ Game_Event.prototype.setupMapActiveMessage = function () { this._mapActiveMessage = null; this._mapActiveMessageRange = Params.defaultRange; this._mapActiveMessageDuration = Params.displayDuration; this._isMapActiveMessageShown = false; // 注釈以外に達するまで解析 var page = this.page(); if (isNullOrUndefined(page)) { return; } var isComment = function (command) { return command && (command.code === 108 || command.code === 408); }; // 複数行対応のために注釈を結合 var index = 0; var command = page.list[index]; var comment = ''; while (isComment(command)) { if (comment.length > 0) { comment += '\n'; } comment += command.parameters[0]; command = page.list[++index]; } // メッセージ定義を解析 var messageMatch = Const.regex.activeMessage.exec(comment); if (!isNullOrUndefined(messageMatch)) { this._mapActiveMessage = messageMatch[1]; } // メッセージ距離を解析 var rangeMatch = Const.regex.displayRange.exec(comment); if (!isNullOrUndefined(rangeMatch)) { this._mapActiveMessageRange = Math.max(parseIntWithDefault(rangeMatch[1], Params.defaultRange), 1); } // メッセージ表示時間を解析 var durationMatch = Const.regex.displayDuration.exec(comment); if (!isNullOrUndefined(durationMatch)) { this._mapActiveMessageDuration = parseIntWithDefault(durationMatch[1], Params.displayDuration); } }; /** * アクティブメッセージを取得 * * @return {String} メッセージ */ Game_Event.prototype.getMapActiveMessage = function () { return this._mapActiveMessage; }; /** * アクティブメッセージが存在するか * * @return {Boolean} true if exists */ Game_Event.prototype.hasMapActiveMessage = function () { return !isNullOrUndefined(this._mapActiveMessage); }; /** * アクティブメッセージを表示可能な範囲 * * @return {Number} タイル単位の表示範囲半径 */ Game_Event.prototype.getMapActiveMessageRange = function () { return this._mapActiveMessageRange; }; /** * アクティブメッセージを表示するフレーム数 * * @return {Number} 自動消去するまでのフレーム数 */ Game_Event.prototype.getMapActiveMessageDuration = function () { return this._mapActiveMessageDuration; }; /** * アクティブメッセージを表示済みか * * @return {Boolean} true if shown */ Game_Event.prototype.isMapActiveMessageShown = function () { return this._isMapActiveMessageShown; }; /** * アクティブメッセージ表示済みかどうかを設定 * * @param {Boolean} shown 設定する値 */ Game_Event.prototype.setMapActiveMessageShown = function (shown) { this._isMapActiveMessageShown = !!shown; }; //----------------------------------------------------------------------------- // Sprite_MapActiveMessageBalloon // // アクティブメッセージの吹き出し用スプライト function Sprite_MapActiveMessageBalloon() { this.initialize.apply(this, arguments); } Sprite_MapActiveMessageBalloon.prototype = Object.create(Sprite_Base.prototype); Sprite_MapActiveMessageBalloon.prototype.constructor = Sprite_MapActiveMessageBalloon; Sprite_MapActiveMessageBalloon.prototype.initialize = function () { Sprite_Base.prototype.initialize.call(this); this.anchor.y = 0.5; this.initMembers(); }; Sprite_MapActiveMessageBalloon.prototype.initMembers = function () { this._owner = null; }; /** * オーナーウィンドウの設定 */ Sprite_MapActiveMessageBalloon.prototype.setOwner = function (owner) { this._owner = owner; }; /** * 位置をオーナーウィンドウに合わせる */ Sprite_MapActiveMessageBalloon.prototype.followOwner = function () { this.y = this._owner.height / 2; }; /** * サイズをオーナーウィンドウに合わせる */ Sprite_MapActiveMessageBalloon.prototype.fitToOwner = function () { if (isNullOrUndefined(this._owner)) { return; } var frameSize = Const.balloonFrameInfo.size; var vertexHeight = Const.balloonVertexSize.height; var heightOffset = (vertexHeight - frameSize) * 2; // Bitmap のサイズ調整 var bitmapWidth = this._owner.width; var bitmapHeight = this._owner.height + heightOffset; if (isNullOrUndefined(this.bitmap) || (this.width != bitmapWidth || this.height != bitmapHeight)) { this.bitmap = new Bitmap(bitmapWidth, bitmapHeight); } else { this.bitmap.clear(); } if (Const.debug) { this.bitmap.fillRect(0, 0, bitmapWidth, bitmapHeight, 'rgba(160, 255, 160, 0.5)'); } }; /** * 吹き出しの再描画 */ Sprite_MapActiveMessageBalloon.prototype.refresh = function () { if (isNullOrUndefined(this._owner)) { return; } // サイズの調整 this.fitToOwner(); // 吹き出しの描画 var frameSize = Const.balloonFrameInfo.size; var vertexHeight = Const.balloonVertexSize.height; var offsetX = -Params.balloonMargin; var offsetY = vertexHeight - frameSize - Params.balloonMargin; this.drawBalloon( offsetX, offsetY, this.width - offsetX * 2, this.height - offsetY * 2 ); }; /** * 吹き出しを描画 */ Sprite_MapActiveMessageBalloon.prototype.drawBalloon = function (x, y, width, height) { if (isNullOrUndefined(this._owner)) { return; } this.drawBalloonBackground(x, y, width, height); this.drawBalloonFrame(x, y, width, height); }; /** * 吹き出しの背景を描画 */ Sprite_MapActiveMessageBalloon.prototype.drawBalloonBackground = function (x, y, width, height) { var srcImage = this._owner.getWindowSkin(); var frame = Const.balloonFrameInfo; var prevOpacity = this.bitmap.paintOpacity; this.bitmap.paintOpacity = this._owner.backOpacity; // 背景下層 this.bitmap.blt( srcImage, 0, 0, frame.srcSize, frame.srcSize, x + frame.margin, y + frame.margin, width - frame.margin * 2, height - frame.margin * 2 ); // 背景上層 tileBlt( this.bitmap, srcImage, 0, frame.srcSize, frame.srcSize, frame.srcSize, x + frame.margin, y + frame.margin, width - frame.margin * 2, height - frame.margin * 2 ); this.bitmap.paintOpacity = prevOpacity; }; /** * 吹き出しの枠を描画 */ Sprite_MapActiveMessageBalloon.prototype.drawBalloonFrame = function (x, y, width, height) { var srcImage = this._owner.getWindowSkin(); var vertexOffset = this._owner.getBalloonVertexX(); var balloonPos = this._owner.getBalloonPosition(); var frame = Const.balloonFrameInfo; var vertexSize = Const.balloonVertexSize; // 吹き出しの頂点は枠内に収める vertexOffset = Math.min( Math.max(vertexOffset, 0), width - (frame.size * 2 + vertexSize.width) ); // 縦枠 + コーナーを描画 function drawFrameV(sx, dx, dy) { this.bitmap.blt( srcImage, sx, 0, frame.size, frame.size, dx, dy, frame.size, frame.size ); this.bitmap.blt( srcImage, sx, frame.size, frame.size, frame.lineLength, dx, dy + frame.size, frame.size, height - frame.size * 2 ); this.bitmap.blt( srcImage, sx, frame.size + frame.lineLength, frame.size, frame.size, dx, dy + height - frame.size, frame.size, frame.size ); } // 横枠と頂点を描画 function drawFrameH(sy, dx, dy, showVertex) { var baseSx = frame.srcSize + frame.size; var frameWidth = width - frame.size * 2; var leftWidth = showVertex ? vertexOffset : frameWidth; // 枠線の左側 (頂点がない場合は全体) this.bitmap.blt( srcImage, baseSx, sy, frame.lineLength, frame.size, dx, dy, leftWidth, frame.size ); if (!showVertex) { // 頂点を描画しない return; } // sy > 0 なら下枠、sy === 0 なら上枠のはず var newDx = dx + leftWidth; var newDy = dy + (sy > 0 ? 0 : -(vertexSize.height - frame.size)); // 頂点 var vertexSx = frame.srcSize + (sy > 0 ? 0 : vertexSize.width); this.bitmap.blt( srcImage, vertexSx, frame.srcSize, vertexSize.width, vertexSize.height, newDx, newDy, vertexSize.width, vertexSize.height ); if (Const.debug) { this.bitmap.fillRect(newDx, newDy, vertexSize.width, vertexSize.height, 'rgba(255, 160, 160, 0.5)'); } // 枠線の右側 var rightWidth = frameWidth - (leftWidth + vertexSize.width); if (rightWidth > 0) { newDx += vertexSize.width; this.bitmap.blt( srcImage, baseSx, sy, frame.lineLength, frame.size, newDx, dy, rightWidth, frame.size ); } } // 左枠 drawFrameV.call(this, frame.srcSize, x, y); // 右枠 drawFrameV.call(this, frame.srcSize + frame.size + frame.lineLength, x + width - frame.size, y); // 上枠 + 頂点 drawFrameH.call( this, 0, x + frame.size, y, balloonPos === Const.balloonPosition.below ); // 下枠 + 頂点 drawFrameH.call( this, frame.size + frame.lineLength, x + frame.size, y + height - frame.size, balloonPos === Const.balloonPosition.above ); }; //----------------------------------------------------------------------------- // Sprite_Character /** * 同一のイベントか判定 */ Sprite_Character.prototype.isSameEvent = function (event) { if (isNullOrUndefined(this._character) || isNullOrUndefined(event) || !(this._character instanceof Game_Event)) { return false; } return this._character.eventId() === event.eventId(); }; //----------------------------------------------------------------------------- // Spriteset_Map /** * 指定されたイベントに対応するキャラクタースプライトを取得 */ Spriteset_Map.prototype.findCharacterSpriteByEvent = function (event) { var sameSprites = this._characterSprites.filter(function (sprite) { return sprite.isSameEvent(event); }); if (sameSprites.length > 0) { return sameSprites[0]; } else { return null; } }; //----------------------------------------------------------------------------- // Window_MapActiveMessage // // マップ上でアクティブメッセージを表示するウィンドウ // (スプライトでも良いが、メッセージ周りはウィンドウの方が扱いやすい) function Window_MapActiveMessage() { this.initialize.apply(this, arguments); } Window_MapActiveMessage.prototype = Object.create(Window_Base.prototype); Window_MapActiveMessage.prototype.constructor = Window_MapActiveMessage; // メッセージの一時描画バッファ Window_MapActiveMessage.tempMessageBuffer = null; /** * アクティブメッセージ用スキンの事前読み込み */ Window_MapActiveMessage.preloadWindowskin = function () { ImageManager.loadSystem(Params.messageSkin); }; Window_MapActiveMessage.prototype.initialize = function () { // コンテンツサイズは内容に応じて可変なので、ウィンドウサイズは仮 Window_Base.prototype.initialize.call(this, 0, 0, 64, 64); if (isNullOrUndefined(Window_MapActiveMessage.tempMessageBuffer)) { Window_MapActiveMessage.tempMessageBuffer = new Bitmap(Graphics.boxWidth, Graphics.boxHeight / 2); } this._balloonSprite = null; this.opacity = 0; this.contentsOpacity = 0; this.initMembers(); }; Window_MapActiveMessage.prototype.standardFontSize = function () { return Params.fontSize; }; Window_MapActiveMessage.prototype.loadWindowskin = function () { // デフォルトのスキンの代わりに、アクティブメッセージ用のスキンを読み込む this._windowskin = ImageManager.loadSystem(Params.messageSkin); }; /** * ウィンドウスキンを取得 */ Window_MapActiveMessage.prototype.getWindowSkin = function () { return this._windowskin; }; Window_MapActiveMessage.prototype.initMembers = function () { this._textState = null; this._event = null; this._characterSprite = null; this._targetPageIndex = 0; this._duration = 0; this._isForceDisplay = false; this._balloonPosition = Const.balloonPosition.above; }; Window_MapActiveMessage.prototype.show = function () { Window_Base.prototype.show.call(this); if (!isNullOrUndefined(this._balloonSprite)) { this._balloonSprite.show(); } }; Window_MapActiveMessage.prototype.hide = function () { this._duration = 0; Window_Base.prototype.hide.call(this); if (!isNullOrUndefined(this._balloonSprite)) { this._balloonSprite.hide(); } }; /** * フェードアウト */ Window_MapActiveMessage.prototype.fadeOut = function () { if (this.isFadingOut()) { return; } if (this.isFadingIn()) { // フェードイン中は同じ不透明度からフェードアウトする this._duration = this._initialDisplayDuration - this._duration; } else { this._duration = Params.fadeFrameCount; } }; Window_MapActiveMessage.prototype.numVisibleRows = function () { return 4; }; /** * 吹き出しスプライトの設定 */ Window_MapActiveMessage.prototype.setBalloonSprite = function (sprite) { sprite.setOwner(this); this._balloonSprite = sprite; // ウィンドウの裏に表示 this.addChildAt(sprite, 0); }; /** * イベントに対する吹き出しの表示位置を取得 */ Window_MapActiveMessage.prototype.getBalloonPosition = function () { return this._balloonPosition; }; /** * メッセージ表示中か */ Window_MapActiveMessage.prototype.isDisplaying = function () { return this._duration > 0; }; /** * 強制表示されたか */ Window_MapActiveMessage.prototype.isForced = function () { return this._isForceDisplay; }; /** * フェードイン中か */ Window_MapActiveMessage.prototype.isFadingIn = function () { return this._duration >= this._initialDisplayDuration - Params.fadeFrameCount; }; /** * フェードアウト中か */ Window_MapActiveMessage.prototype.isFadingOut = function () { return this._duration < Params.fadeFrameCount; }; /** * 表示中のイベントと同一イベントか */ Window_MapActiveMessage.prototype.isSameEvent = function (event) { if (isNullOrUndefined(this._event)) { return false; } // ページ番号まで同じ場合に同一と見なす if (this._event.eventId() === event.eventId() && this._targetPageIndex === event.pageIndex()) { return true; } return false; }; /** * イベントが画面内にあるか判定 */ Window_MapActiveMessage.prototype.isEventInScreen = function () { if (isNullOrUndefined(this._event)) { return false; } var x = this._event.screenX(); var y = this._event.screenY(); return x >= 0 && y >= 0 && x <= Graphics.boxWidth && y <= Graphics.boxHeight; }; /** * メッセージの表示開始 * * @param {String} text '\n' 区切りのメッセージ * @param {Game_Event} event 表示対象のイベント * @param {Sprite_Character} sprite 表示対象のキャラクタースプライト * @param {boolean} isForce 表示時間満了まで強制表示 */ Window_MapActiveMessage.prototype.display = function (text, event, sprite, isForce) { // 表示のキャンセル function rollback() { this.initMembers(); this.hide(); } if (isNullOrUndefined(text) || isNullOrUndefined(event)) { rollback.call(this); return; } this._event = event; this._characterSprite = sprite; if (!this.isEventInScreen()) { rollback.call(this); return; } // 表示パラメータの設定 this._textState = { index: 0, text: this.convertEscapeCharacters(text) }; this._allTextWidth = 0; this._targetPageIndex = event.pageIndex(); this._initialDisplayDuration = event.getMapActiveMessageDuration(); this._duration = this._initialDisplayDuration; this._isForceDisplay = !!isForce; this.newPage(this._textState); this.updatePosition(); this.updateOpacity(); this.refreshBalloon(); this.show(); // 多重表示抑止のため、表示済みフラグを立てる event.setMapActiveMessageShown(true); }; /** * 新しいページの表示 */ Window_MapActiveMessage.prototype.newPage = function (textState) { // コンテンツを一時領域に書く this.contents = Window_MapActiveMessage.tempMessageBuffer; this.contents.clear(); this.resetFontSettings(); textState.x = this.newLineX(); textState.y = 0; textState.left = this.newLineX(); textState.height = this.calcTextHeight(textState, false); this._allTextHeight = this.calcTextHeight(textState, true); this.updateMessage(); // コンテンツを一時領域から正式に反映 this.createContents(); this.contents.blt( Window_MapActiveMessage.tempMessageBuffer, 0, 0, this._allTextWidth, this._allTextHeight, 0, 0, this._allTextWidth, this._allTextHeight ); }; /** * メッセージの表示位置を設定 */ Window_MapActiveMessage.prototype.updatePosition = function () { if (isNullOrUndefined(this._event)) { return; } // 画面外に出る場合は消去 if (!this.isEventInScreen()) { this.hide(); return; } // 吹き出しの枠ぶんのマージン var margin = Const.balloonFrameInfo.size; var balloonOffsetY = Const.balloonVertexSize.height - Params.balloonOffsetY - margin; var heightOffset = this.height + (!isNullOrUndefined(this._characterSprite) ? this._characterSprite.patternHeight() : $gameMap.tileHeight()); // デフォルトの位置は上 var x = this._event.screenX() - this.width / 2; var y = this._event.screenY() - (heightOffset + balloonOffsetY); this._balloonPosition = Const.balloonPosition.above; // 画面左右にははみ出させない x = Math.min(Math.max(x, margin), Graphics.boxWidth - this.width - margin); // 画面上側にはみ出る場合は下に表示 if (y < margin) { y = this._event.screenY() + balloonOffsetY; this._balloonPosition = Const.balloonPosition.below; } // 画面下側にはみ出る場合は上に表示 if (y + this.height > Graphics.boxHeight - margin) { y -= heightOffset + balloonOffsetY; this._balloonPosition = Const.balloonPosition.above; } this.x = x; this.y = y; if (!isNullOrUndefined(this._balloonSprite)) { // 吹き出しの頂点表示を考慮した位置に移動 this._balloonSprite.followOwner(); } }; /** * ウィンドウのサイズを更新 */ Window_MapActiveMessage.prototype.updateWindowSize = function () { var offset = this.standardPadding() * 2; this.width = this._allTextWidth + offset; this.height = this._allTextHeight + offset; }; /** * 不透明度の更新 */ Window_MapActiveMessage.prototype.updateOpacity = function () { var opacity = 255; if (this.isFadingIn()) { // フェードイン opacity = 255 * (this._initialDisplayDuration - this._duration) / Params.fadeFrameCount; } else if (this.isFadingOut()) { // フェードアウト opacity = 255 * this._duration / Params.fadeFrameCount; } this.contentsOpacity = opacity; if (!isNullOrUndefined(this._balloonSprite)) { this._balloonSprite.opacity = opacity; } }; /** * 吹き出しの再描画 */ Window_MapActiveMessage.prototype.refreshBalloon = function () { if (!isNullOrUndefined(this._balloonSprite)) { this._balloonSprite.refresh(); } }; /** * プレイヤーとの距離を確認 */ Window_MapActiveMessage.prototype.checkPlayerDistance = function () { // 強制表示 or 消去中は距離判定しない if (this.isForced() || this._duration <= Params.fadeFrameCount) { return; } // 表示範囲外に出た場合は消す var distance = $gamePlayer.calcDistanceForMapActiveMessage(this._event); if (distance > this._event.getMapActiveMessageRange()) { this.fadeOut(); } }; Window_MapActiveMessage.prototype.update = function () { Window_Base.prototype.update.call(this); if (!isNullOrUndefined(this._balloonSprite)) { this._balloonSprite.update(); } if (!this.isDisplaying()) { return; } this._duration--; this.updateOpacity(); this.updatePosition(); this.checkPlayerDistance(); // 表示が終了したら初期化 if (!this.isDisplaying()) { debuglog('[MapActiveMessage] Finished to display'); this.initMembers(); } }; /** * メッセージの更新 */ Window_MapActiveMessage.prototype.updateMessage = function () { if (isNullOrUndefined(this._textState)) { return false; } while (!this.isEndOfText(this._textState)) { this.processCharacter(this._textState); this._allTextWidth = Math.max(this._allTextWidth, this._textState.x); } this.updateWindowSize(); return true; }; /** * 吹き出しの頂点位置を取得 */ Window_MapActiveMessage.prototype.getBalloonVertexX = function () { if (isNullOrUndefined(this._event)) { return 0; } return this._event.screenX() - this.x - Const.balloonFrameInfo.size - Const.balloonVertexSize.width / 2 + Params.balloonMargin; }; /** * 改行時の描画先 X 座標 */ Window_MapActiveMessage.prototype.newLineX = function () { return 0; }; /** * 改行の処理 */ Window_MapActiveMessage.prototype.processNewLine = function (textState) { this._allTextWidth = Math.max(this._allTextWidth, textState.x); Window_Base.prototype.processNewLine.call(this, textState); }; /** * 改ページの処理 */ Window_MapActiveMessage.prototype.processNewPage = function (textState) { Window_Base.prototype.processNewPage.call(this, textState); if (textState.text[textState.index] === '\n') { textState.index++; } textState.y = this.contents.height; }; /** * テキスト終端か */ Window_MapActiveMessage.prototype.isEndOfText = function (textState) { return textState.index >= textState.text.length; }; /** * 改ページが必要か */ Window_MapActiveMessage.prototype.needsNewPage = function (textState) { return !this.isEndOfText(textState) && textState.y + textState.height > this.contents.height; }; //----------------------------------------------------------------------------- // Scene_Map var _Scene_Map_createAllWindows = Scene_Map.prototype.createAllWindows; Scene_Map.prototype.createAllWindows = function () { _Scene_Map_createAllWindows.call(this); this.createActiveMessageWindow(); }; /** * アクティブメッセージウィンドウの作成 */ Scene_Map.prototype.createActiveMessageWindow = function () { if (!isNullOrUndefined(this._activeMessageWindowLayer)) { return; } var width = Graphics.boxWidth; var height = Graphics.boxHeight; var x = (Graphics.width - width) / 2; var y = (Graphics.height - height) / 2; this._activeMessageWindowLayer = new WindowLayer(); this._activeMessageWindowLayer.move(x, y, width, height); this.addChild(this._activeMessageWindowLayer); Window_MapActiveMessage.preloadWindowskin(); }; var _Scene_Map_update = Scene_Map.prototype.update; Scene_Map.prototype.update = function () { _Scene_Map_update.call(this); this.updateActiveMessageDisplay(); }; var _Scene_Map_stop = Scene_Map.prototype.stop; Scene_Map.prototype.stop = function () { _Scene_Map_stop.call(this); $gameTemp.clearMapActiveMessage(); }; var _Scene_Map_terminate = Scene_Map.prototype.terminate; Scene_Map.prototype.terminate = function () { _Scene_Map_terminate.call(this); this.destroyActiveMessageWindows(); }; /** * アクティブメッセージウィンドウの破棄 */ Scene_Map.prototype.destroyActiveMessageWindows = function () { this._activeMessageWindowLayer.removeChildren(); this.removeChild(this._activeMessageWindowLayer); this._activeMessageWindowLayer = null; }; /** * アクティブメッセージの表示を更新 */ Scene_Map.prototype.updateActiveMessageDisplay = function () { if (!$gameSystem.isMapActiveMessageEnabled() || $gameMap.isEventRunning()) { // メッセージを表示できないときは非表示にしつつ各種フラグを解除 $gameTemp.clearMapActiveMessage(); $gameMap.clearActiveMessageShownFlags(); this._activeMessageWindowLayer.children.forEach(function (child) { child.fadeOut(); }); return; } // 表示が完了したものを削除 this._activeMessageWindowLayer.children.filter(function (child) { return !child.isDisplaying(); }).forEach(function (item) { this._activeMessageWindowLayer.removeChild(item); }, this); // 要求されているメッセージを表示できるだけ表示 while ($gameTemp.isMapActiveMessageReady()) { if (!this.displayActiveMessage()) { break; } } }; /** * 指定されたイベントのアクティブメッセージが表示されているか判定 */ Scene_Map.prototype.isActiveMessageDisplayed = function (event) { var layer = this._activeMessageWindowLayer; for (var i = 0; i < layer.children.length; i++) { var window = layer.children[i]; if (window.isDisplaying() && window.isSameEvent(event)) { return true; } } return false; }; /** * アクティブメッセージの表示 */ Scene_Map.prototype.displayActiveMessage = function () { var layer = this._activeMessageWindowLayer; // 最大数に達していたら表示を諦める // (children には吹き出しも含まれるので / 2) if (layer.children.length / 2 >= Params.messageCountMax) { return false; } // 予約されているメッセージを表示 var message = $gameTemp.popNextMapActiveMessage(); while (!isNullOrUndefined(message)) { // まだ表示していないもののみ表示 if (!this.isActiveMessageDisplayed(message.event)) { var character = this._spriteset.findCharacterSpriteByEvent(message.event); var balloon = new Sprite_MapActiveMessageBalloon(); var window = new Window_MapActiveMessage(); window.setBalloonSprite(balloon); window.display( message.text, message.event, character, message.isForced); layer.addChild(window); } message = $gameTemp.popNextMapActiveMessage(); } return true; }; var _Scene_Map_snapForBattleBackground = Scene_Map.prototype.snapForBattleBackground; Scene_Map.prototype.snapForBattleBackground = function () { // アクティブメッセージはキャプチャしない var layer = this._activeMessageWindowLayer; if (!isNullOrUndefined(layer)) { layer.visible = false; } _Scene_Map_snapForBattleBackground.call(this); if (!isNullOrUndefined(layer)) { layer.visible = true; } }; })();
dazed/translations
www/js/plugins/KMS_MapActiveMessage.js
JavaScript
unknown
44,903
//============================================================================= // LoadComSim.js //============================================================================= /*:ja * @plugindesc ver1.00 メニューコマンドにロードを追加します。 * @author まっつUP * * @param loadtext * @desc コマンド「ロード」のコマンド名です。 * @default ロード * * @help * * RPGで笑顔を・・・ * * このヘルプとパラメータの説明をよくお読みになってからお使いください。 * * コマンド「ロード」はイベントテスト中またはセーブデータがないときは選択不能になります。 * * このプラグインを利用する場合は * readmeなどに「まっつUP」の名を入れてください。 * また、素材のみの販売はダメです。 * 上記以外の規約等はございません。 * もちろんツクールMVで使用する前提です。 * 何か不具合ありましたら気軽にどうぞ。 * * 免責事項: * このプラグインを利用したことによるいかなる損害も制作者は一切の責任を負いません。 * */ (function () { var parameters = PluginManager.parameters('LoadComSim'); var LCSloadtext = String(parameters['loadtext'] || 'ロード'); var _Scene_Menu_createCommandWindow = Scene_Menu.prototype.createCommandWindow; Scene_Menu.prototype.createCommandWindow = function () { _Scene_Menu_createCommandWindow.call(this); this._commandWindow.setHandler('load', this.commandLoad.bind(this)); }; Scene_Menu.prototype.commandLoad = function () { //新規 SceneManager.push(Scene_Load); }; var _Window_MenuCommand_addSaveCommand = Window_MenuCommand.prototype.addSaveCommand; Window_MenuCommand.prototype.addSaveCommand = function () { _Window_MenuCommand_addSaveCommand.call(this); var enabled = this.isLoadEnabled(); this.addCommand(LCSloadtext, 'load', enabled); }; Window_MenuCommand.prototype.isLoadEnabled = function () { //新規 if (DataManager.isEventTest()) return false; //この行はイベントテスト中かどうか判定しています。 return DataManager.isAnySavefileExists(); }; })();
dazed/translations
www/js/plugins/LoadComSim.js
JavaScript
unknown
2,315
//============================================================================= // Lunatlazur_ActorNameWindow.js // ---------------------------------------------------------------------------- // Copyright (c) 2018 Taku Aoi // This plugin is released under the zlib License. // http://zlib.net/zlib_license.html // ---------------------------------------------------------------------------- // Version // 1.0.0 2018/04/01 // ---------------------------------------------------------------------------- // [Web] : https://lunatlazur.com/ // [Twitter]: https://twitter.com/lunatlazur/ // [GitHub] : https://github.com/Lunatlazur/ //============================================================================= /*: * @plugindesc Show actor name window * @author Taku Aoi * @help This plugin shows speaker's name window. * * Input the character name with \N<Character name> format * to display the speaker's name window. * * The same font as the message window is used for this window. */ /*:ja * @plugindesc 名前ウィンドウ表示プラグイン * @author あおいたく * @help このプラグインは名前ウィンドウを表示できるようにします。 * * \N<キャラクター名> 形式でメッセージ内にキャラクターの名前を記述することで * メッセージウィンドウの上部に名前ウィンドウを表示するようになります。 * * 名前ウィンドウのフォントはメッセージウィンドウのものが使われます。 * * @param テキストカラー * @desc 名前を表示するテキストの色番号を指定します。 * @default 1 * @type number * */ var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); (function () { var pluginName = 'Lunatlazur_ActorNameWindow'; function getValue(params) { var names = []; for (var _i = 1; _i < arguments.length; _i++) { names[_i - 1] = arguments[_i]; } var found = null; names.forEach(function (name) { if (!!params[name]) { found = params[name]; } }); return found; } function asNumber(params) { var names = []; for (var _i = 1; _i < arguments.length; _i++) { names[_i - 1] = arguments[_i]; } return parseInt(getValue.apply(void 0, [params].concat(names)), 10); } var parameters = PluginManager.parameters(pluginName); var params = { textColor: asNumber(parameters, 'テキストカラー'), }; var Window_ActorName = /** @class */ (function (_super) { __extends(Window_ActorName, _super); function Window_ActorName(_) { var _this = _super.call(this) || this; _this.initialize.apply(_this, arguments); return _this; } Window_ActorName.prototype.initialize = function (parentWindow) { this._parentWindow = parentWindow; _super.prototype.initialize.call(this, 0, 0, 240, this.windowHeight()); this._padding = 4; this._text = ''; this._openness = 0; this.deactivate(); this.hide(); }; Window_ActorName.prototype.standardFontFace = function () { if (this._parentWindow) { return this._parentWindow.standardFontFace(); } else { return _super.prototype.standardFontFace.call(this); } }; Window_ActorName.prototype.windowWidth = function () { this.resetFontSettings(); return Math.ceil(this.textWidth(this._text) + this.padding * 2 + this.standardPadding() * 4); }; Window_ActorName.prototype.windowHeight = function () { return this.lineHeight() + this.padding * 2; }; Window_ActorName.prototype.contentsWidth = function () { return this.width - this.padding * 2; }; Window_ActorName.prototype.contentsHeight = function () { return this.lineHeight(); }; Window_ActorName.prototype.update = function () { _super.prototype.update.call(this); if (this.active || this.isClosed() || this.isClosing()) { return; } if (this._parentWindow.isClosing()) { this._openness = this._parentWindow.openness; } this.close(); }; Window_ActorName.prototype.setText = function (text) { this._text = text; this.refresh(); }; Window_ActorName.prototype.refresh = function () { this.width = this.windowWidth(); this.createContents(); this.contents.clear(); this.resetFontSettings(); this.changeTextColor(this.textColor(params.textColor)); this.drawText(this._text, this.standardPadding() * 2, 0, this.contents.width); }; Window_ActorName.prototype.updatePlacement = function () { if (this._parentWindow.y === 0) { this.y = this._parentWindow.y + this._parentWindow.windowHeight(); } else { this.y = this._parentWindow.y - this.windowHeight(); } }; Window_ActorName.prototype.updateBackground = function () { this.setBackgroundType(this._parentWindow._background); }; Window_ActorName.prototype.processActorName = function (text) { var _this = this; return text.replace(/\x1bN\<(.*?)\>/gi, function (whole) { var args = []; for (var _i = 1; _i < arguments.length; _i++) { args[_i - 1] = arguments[_i]; } _this.setText(args[0]); _this.show(); _this.open(); _this.activate(); return ''; }); }; return Window_ActorName; }(Window_Base)); var Window_Message_createSubWindows = Window_Message.prototype.createSubWindows; Window_Message.prototype.createSubWindows = function () { Window_Message_createSubWindows.call(this); this._nameWindow = new Window_ActorName(this); }; var Window_Message_subWindows = Window_Message.prototype.subWindows; Window_Message.prototype.subWindows = function () { return Window_Message_subWindows.call(this).concat([this._nameWindow]); }; var Window_Message_startMessage = Window_Message.prototype.startMessage; Window_Message.prototype.startMessage = function () { this._nameWindow.deactivate(); Window_Message_startMessage.call(this); }; var Window_Message_terminateMessage = Window_Message.prototype.terminateMessage; Window_Message.prototype.terminateMessage = function () { this._nameWindow.deactivate(); Window_Message_terminateMessage.call(this); }; Window_Message.prototype.convertEscapeCharacters = function (text) { text = Window_Base.prototype.convertEscapeCharacters.call(this, text); text = this._nameWindow.processActorName(text); return text; }; var Window_Message_updatePlacement = Window_Message.prototype.updatePlacement; Window_Message.prototype.updatePlacement = function () { Window_Message_updatePlacement.call(this); if (this._nameWindow.active) { this._nameWindow.updatePlacement(); } }; var Window_Message_updateBackground = Window_Message.prototype.updateBackground; Window_Message.prototype.updateBackground = function () { Window_Message_updateBackground.call(this); if (this._nameWindow.active) { this._nameWindow.updateBackground(); } }; })();
dazed/translations
www/js/plugins/Lunatlazur_ActorNameWindow.js
JavaScript
unknown
8,245
//=============================================================================== // MKR_MapItemSlot.js //=============================================================================== // (c) 2016 マンカインド // This software is released under the MIT License. // http://opensource.org/licenses/mit-license.php // ------------------------------------------------------------------------------ // Version // 1.2.11 2020/09/13・特定状況でスロット選択を行うとエラーになっていた問題を修正 // ・スロットのアイテムを装備時、 // スロットからアイテムが消えてしまう問題を修正 // // 1.2.10 2020/06/16・マップ画面以外でアイテムを0個にしたとき、 // スロットからアイテムが消去されない問題を修正 // // 1.2.9 2020/01/02 ・アイテムスロット画面から装備済みアイテムのスロットを // 装備不可アイテムに変更しマップ画面に戻ると // エラーとなっていた問題を修正。 // ・ゲーム開始時、パーティに誰もいない状態だと // エラーとなっていた問題を修正 // // 1.2.8 2019/10/22 ・スロット位置が左端以外だった場合に // スロットのタッチ操作が正しく動作していなかった問題を修正。 // ・プラグインコマンドによるスロット選択を行った時、 // エラーとなる場合があった問題を修正。 // ・スクリプトコマンドでアイテムスロットメニューを表示させる // 機能を追加。 // ・アイテム使用以外でアイテムの個数が0になったとき、 // スロットからアイテムを削除する処理が動作していなかった // 問題を修正。 // // 1.2.7 2019/06/02 ・前バージョンの修正が不十分だったため再修正。 // // 1.2.6 2019/06/01 ・特定状況でアイテムスロットの表示がチラつく問題を修正。 // // 1.2.5 2019/05/01 ・ヘルプを更新。 // ・指定スロット番号にセットされたアイテムの // タイプ、IDを取得する関数を追加。 // ・スロットアイコン上に描画される文字のフォントサイズを // 指定可能に。 // // 1.2.4 2019/03/07 ・プラグイン新規導入時に // パラメータの設定が行えなかったため修正。 // // 1.2.3 2019/03/06 ・プラグインコマンドによるスキル使用が // 行えなかった問題を修正。 // // 1.2.2 2019/03/04 ・アイテムを使用するためのタッチ操作探知範囲を画面全体か // スロット上のどちらかに変更できるようにした。 // ・アイテムスロットにスキル(回復系のみ)を登録可能にした。 // // 1.2.1 2018/11/23 ・アイテムスロットに登録されたアイテムを // 判別可能にする関数を追加 // // 1.2.0 2018/10/19 ・アイテムスロットに登録されたアイテムの // 所持数を非表示にするプラグインパラメータを追加 // // 1.1.9 2018/09/24 ・アイテムスロットに防具を登録できるようにした。 // ・防具に関するプラグインパラメータを追加。 // ・防具の扱いに関してプラグインヘルプを修正。 // ・アイテムスロットメニュー上で、アイテムスロットウィンドウの // 背景をマップ上アイテムスロット背景と同じにできる // プラグインパラメータを追加。 // ・アイテムスロットメニューのアイテムウィンドウで、 // カテゴリウィンドウに寄らないアイテム分類を行える // プラグインパラメータを追加 // // 1.1.8 2018/08/25 ・アイテムスロットの初回非表示機能が使えなかった問題を修正。 // // 1.1.7 2018/07/06 ・一部プラグインとの競合を解決。 // // 1.1.6 2018/01/19 ・アイテムスロットへの武器登録を無効にしたとき、 // メニューから戻ると装備武器が外れてしまう問題を修正。 // ・アイテムスロットメニューに背景画像を指定しない場合、 // 背景にマップ画面を表示するように変更。 // // 1.1.5 2018/01/09 ・イベント中にアイテムが使用可能だったのを修正。 // ・イベント発生時、アイテムスロットをフェードアウトさせ // イベント完了後にフェードインさせるように修正。 // // 1.1.4 2017/10/12 ・アイテムスロットに背景設定時、 // ウィンドウ枠が消去されていなかったため修正。 // // 1.1.3 2017/10/11 ・一部プラグインとの競合問題を修正。 // ・メニューアイテムスロット画面の不透明度指定により他画面の // ウィンドウに影響が出ていた問題を修正。 // ・プラグインパラメーターの指定方法を変更。 // ・一部プラグインパラメータのデフォルト値を変更。 // ・アイテムスロットの拡大表示に対応。 // ・アイテムスロットの余白を設定可能に。 // ・アイテムスロットウィンドウ及び画面について背景画像を // 設定できるように修正。 // ・スロットからアイテムを使用後、$gameParty.lastItem()で // 最後に使用したアイテムを取得できるように。 // ・アイテムスロット画面呼び出し用のプラグインコマンドを追加。 // // 1.1.2 2017/08/30 ・余計なコードを削除。 // // 1.1.1 2017/08/30 ・プラグインパラメーターの指定方法を変更。 // ・プラグインヘルプを修正。 // // 1.1.0 2017/08/30 ・一部プラグインとの競合問題を修正。 // ・ウィンドウ不透明度を指定可能に。 // ・スロット選択カーソルを非表示にする機能を追加。 // ・アイテムを自動的にスロットに追加する機能を無効化可能に。 // ・アイテム選択、アイテム使用のキーアサインを変更可能に。 // ・プラグインパラメーターの指定方法を変更。 // // 1.0.0 2017/08/15 初版公開。 // ------------------------------------------------------------------------------ // [Twitter] https://twitter.com/mankind_games/ // [GitHub] https://github.com/mankindGames/ // [Blog] http://mankind-games.blogspot.jp/ //=============================================================================== /*: * @plugindesc (v1.2.11) マップアイテムスロットプラグイン * @author マンカインド * * @help = マップアイテムスロットプラグイン = * MKR_MapItemSlot.js * * マップ画面上に表示したアイテムスロットからアイテムの使用/装備を * することができるようになります。 * * アイテムスロットの選択は * ・キーボードの1~9,0キー(デフォルト設定) * ・ゲーム画面上でマウスホイール操作 * ・画面上のアイテムアイコン部分をクリック(デフォルト無効) * で可能です。 * * スロット数を10としたとき、スロット番号は以下のようになります。 * (デフォルトでキーボードの数字キーに対応しています。 * 0キーはスロット番号10として扱います) * アイテムスロット:[1] [2] [3] [4] [5] [6] [7] [8] [9] [10] * キーボードキー : 1 2 3 4 5 6 7 8 9 0 * * * 選択したスロットにアイテム(道具/スキル)が登録されていた場合、 * 画面上をマウスで左クリック、または指定したキーを押すことで * 選択されたアイテムを使用することができます。 * (範囲が[味方単体]、[使用者]の場合は先頭のアクターに使用。 * [味方全体]の場合はパーティ全体に効果を発揮します) * * アイテムの使用をマウス(タッチ)、またはキーボード、どちらの方法で * 行うかは選択可能です。 * * なお、アイテム使用方法にマウスクリック(画面タッチ)を選択した場合、 * プラグインパラメータでクリック(タッチ)範囲をゲーム画面全体か、 * スロット上に限定するかを設定することができます。 * (デフォルトは画面全体) * * クリック(タッチ)範囲をゲーム画面全体にした場合、 * マップ上を移動するためにクリック(タッチ)操作を * 使うことはできなくなります。 * * クリック(タッチ)範囲をアイテムスロット部分にした場合、 * アイテムを使用するためには画面上のアイテムスロット部分を * 左クリックする必要があります。 * (アイテムスロット以外をクリックした場合、 * マップ上のプレイヤーキャラが移動します) * * * 同じアイテムを複数個所持している場合、 * その個数がスロット右下に数字として表示されます。 * (プラグインパラメータで非表示に設定可能) * * アイテム個数が0になったとき、 * アイテムスロットからそのアイテムを削除するか、 * グレーアウトさせた状態で残しておくかはプラグインパラメータから設定可能です。 * * * 選択したスロットに装備が登録されていた場合、 * 装備可能なものであれば選択と同時にパーティ先頭のアクターに装備されます。 * なお、選択カーソルが装備の登録されたスロットから外れると * アクターの装備も外れます。 * * 装備中アイテム(=カーソルが装備の登録されているスロット上にある)の場合、 * スロット左上に E と表示されます。 * * プラグインパラメータ[武器登録可否]がONのとき、 * メニューの装備画面から先頭アクターの武器変更をすることができなくなります。 * (アイテムスロットの選択によって武器の変更を行ってください) * * プラグインパラメータ[防具登録可否]がONのとき、 * メニューの装備画面から先頭アクターの防具変更をすることができなくなります。 * (アイテムスロットの選択によって防具の変更を行ってください) * * * アイテムスロットは先頭から、 * 既に所持しているアイテム、または入手したアイテムが自動的に * 登録されていきます。 * (スロットが空いている場合のみ。ゲーム開始時にアイテムを装備済みの場合は * そのアイテムがスロットの先頭に登録されます) * プラグインパラメータ:[アイテム自動使用機能]をOFFにすることで * この機能を無効にすることができます。 * * メニュー画面の項目[アイテムスロット]からスロットに * 登録するアイテムを変更可能です。 * * [登録]はアイテムスロットにアイテムを登録します。 * マップ画面で選択されているスロットに * 装備アイテムを登録した場合は自動的に装備されます。 * * [削除]は選択したスロットを空にします。 * 装備していたアイテムをアイテムスロットから削除した場合、 * アクターからその装備が外れます。 * * * アイテムスロット画面のカテゴリ表示について: * プラグインパラメータ[カテゴリー表示]にて、 * アイテムスロットメニュー画面上に表示されるカテゴリウィンドウの扱いを * 変更することができます。 * (アイテムカテゴリウィンドウは、アイテムと武器、といった * 2種類以上のアイテムをアイテムスロットへ登録する設定となっているときに * 表示されます) * * ・カテゴリを表示する * カテゴリウィンドウからアイテムのカテゴリを選択することで、 * 選択したカテゴリに沿ったアイテムがアイテムリストに表示されます。 * デフォルトの設定です。 * * ・カテゴリを表示しない * カテゴリウィンドウを非表示にして、アイテムリスト上でアイテムを * カテゴリごとに分類し表示します。 * 並び順はプラグインパラメータ[アイテムリストソート設定]から * 設定することができます。 * * * プラグインパラメータによる動作について: * アイテムスロットに対する操作はプラグインパラメータにより変更できます。 * * ・マウス使用モード.アイテム使用(Mouse_Mode.Use_Enable) * マウスクリック(画面タッチ)でアイテムの使用が可能になります。 * * ・マウス使用モード.スロット選択(Mouse_Mode.Select_Enable) * マウスホイールでスロットの選択が可能になります。 * * ・マウス使用モード.アイテム使用方法(Mouse_Mode.Use_Enable) * アイテム使用のためのクリック範囲を画面全体とするか、 * アイテムスロット部分に限定するかを設定できます。 * (タッチ操作でのゲームプレイを想定) * * ・キーボード使用モード.アイテム使用(Keyboard_Mode.Use_Enable) * キーボードでアイテムの使用が可能になります。 * * ・キーボード使用モード.スロット選択(Keyboard_Mode.Select_Enable) * キーボードでスロットの選択が可能になります。 * * ・イベント実行中の動作.スロットの表示(Event_Mode.Slot_Enable) * イベント実行中、スロットの表示/非表示を設定できます。 * * ・イベント実行中の動作.アイテム使用(Event_Mode.Use_Enable) * イベント実行中、スロットアイテムの使用可/不可を設定できます。 * * ・イベント実行中の動作.スロット選択(Event_Mode.Select_Enable) * イベント実行中、スロット選択の可/不可を設定できます。 * * 以下のプラグインパラメータによりアイテムスロットの挙動が変化します。 * * ・アイテム登録モード(Slot_Add_Mode) * ONの場合、入手したアイテムは自動的にスロットへと登録されます。 * 自動で登録させたくない場合はOFFにするか、後述するメモ欄の設定を * 行ってください。 * * ・アイテム使用モード(Item_Use_Mode) * ONの場合、アイテムが登録されたスロットにカーソルが移動すると、 * 自動的にそのアイテムが使用されます。 * スマートフォンなど、タッチ操作でのゲームプレイが前提の場合は * ONにすることを推奨します。 * * ・武器登録可否(Slot_Set_Weapon) * ONの場合、スロットに武器が登録可能になります。 * また、装備画面から武器の変更が行えなくなります。 * アイテムのみ登録させたい、武器は自由に変更したい場合は * OFFにしてください。 * * ・防具登録可否(Slot_Set_Armor) * ONの場合、スロットに防具が登録可能になります。 * また、装備画面から防具の変更が行えなくなります。 * アイテムのみ登録させたい、防具は自由に変更したい場合は * OFFにしてください。 * * ・スキル登録可否(Slot_Set_Skill) * ONの場合、スロットにスキルが登録可能になります。 * 登録できるスキルは回復系のものに限られます。 * * ・アイテム削除モード(Item_Remove_Mode) * ONの場合、スロットにセットされたアイテムの個数が0個になると * スロットからアイテムが自動的に削除されます。 * OFFにすると、アイテムは個数0の状態でグレー表示になります。 * アイテム個数が0のため、使用することはできません。 * * ・スロット不透明度調整 * イベント実行中にスロットがフェードアウト * イベント終了後にスロットがフェードイン * 等するときに、1フレーム中に操作するスロットの不透明度を指定します。 * ここで指定した数値分、 * 不透明度を減らしながらフェードアウト * 不透明度を増やしながらフェードイン * するようになります。 * * * スロットサイズ倍率について: * プラグインパラメータ[スロットサイズ倍率]からスロットの大きさを * 変更することができます。(1.0倍~2.0倍まで) * * サイズ倍率と最大スロット数によってはスロットが画面外へと * 飛び出してしまう可能性があります。 * (例えばスロット10個でサイズを2.0倍にすると、 * デフォルトのゲーム画面の横サイズである816pxより大きくなってしまいます) * * 自動的にゲーム画面内に収まるよう超過サイズを調整する機能はありませんので、 * ゲーム画面内に収まるよう設定の考慮をお願いします。 * * * 武器・アイテム・スキルメモ欄: * <itemslot:noadd> * ・このメモを設定された武器、アイテム、スキルはアイテムスロットへの登録が * できなくなります。 * * * プラグインコマンド: * itemslot hide * ・アイテムスロットを非表示にします。 * * itemslot show * ・アイテムスロットを表示します。パラメータ:Slot_Visibleが * OFFの場合、このコマンドを使い任意のタイミングでアイテムスロットを * 表示させる必要があります。 * * itemslot set [スロット番号] [アイテムタイプ] [アイテムID] [装備フラグ] * ・指定したアイテムスロットに指定したアイテムを登録します。 * * ・[スロット番号]は1~スロット最大数までの番号を指定します。 * 自動的に空きスロットを探してアイテムを登録したい場合は 0 を * 指定します。(空きスロットが存在しない場合は登録されません) * * ・[アイテムタイプ]は登録したいアイテムの種類を指定します。 * (item / weapon / armor のいずれか) * データベース【アイテム】のアイテムを登録したい場合は item を、 * データベース【武器】のアイテムを登録したい場合は weapon を * データベース【防具】のアイテムを登録したい場合は armor を * データベース【スキル】のアイテムを登録したい場合は skill を * 指定してください。 * * ・[アイテムID]はアイテムのIDを指定します。 * 例えば、初期登録されている【ポーション】はID:1となります。 * 初期登録されている【弓】はID:4となります。 * * ・[装備フラグ]は、登録した武器を * すぐに装備(カーソル選択)させる場合に true を指定します。 * アイテムを登録する場合は true を設定しても意味はありません。 * * itemslot remove [スロット番号] * ・指定した[スロット番号]のスロットに登録されているアイテムを * スロットから削除します。 * * ・[スロット番号]は1~スロット最大数までの番号を指定します。 * * ・スロットからは削除されますが、 * 所持アイテムを失うわけではありません。 * * ・装備中の武器をスロットから削除した場合、 * アクターから装備が外れますのでご注意ください、 * * itemslot clear * ・アイテムスロットに登録されているアイテムを全て削除します。 * * itemslot menu [方式番号] * ・メニュー項目[アイテムスロット]の表示方式を変更します。 * 番号と方式の対応は以下のとおりです。 * (パーティに誰も居ない場合、項目はメニューに表示されますが * 選択不能状態となります) * 0 : メニューに追加しない * 1 : メニューに追加し選択有効状態 * 2 : メニューに追加するが選択不能状態 * * itemslot use [スロット番号] * ・指定したスロットに登録されているアイテム、スキルを使用します。 * * ・[スロット番号]は1~スロット最大数までの番号を指定します。 * * ・指定したスロットに装備品、 * または使用条件を満たさないアイテム、スキルが * 登録されている場合は使用することができません。 * * itemslot select [スロット番号 / left / right] * ・アイテムスロットの選択カーソルを移動します。 * * ・スロット番号を数値で指定した場合、カーソルは指定した番号の * スロットへと移動します。 * * ・leftを指定した場合、カーソルは一つ左に移動します。 * カーソルがスロット先頭を選択していた場合は末端に移動します。 * * ・rightを指定した場合、カーソルは一つ右に移動します。 * カーソルがスロット末端を選択していた場合は先頭に移動します。 * * itemslot edit * ・アイテムスロット編集画面を開きます。 * * * スクリプトコマンド: * $gameParty.getItemSlotFreeNumber(); * ・アイテムが登録されていない(=空いている)スロット番号を返します。 * 空いているスロットが存在しない場合は-1を返します。 * [例] * ~変数1番に空きスロット番号を代入する~ * ◆変数の操作:#0001 空きスロット = $gameParty.getItemSlotFreeNumber(); * * $gameParty.isItemSlotItem([スロット番号], [アイテムID]); * ・指定したスロット番号(1~)に登録されたアイテムが、 * 指定したアイテムID(1~)である場合にtrueを返します。 * [例] * ◆条件分岐:スクリプト:$gameParty.isItemSlotItem(1, 10); * ~スロット1番にID10のアイテムが * 登録されているときの処理~ * :分岐終了 * * $gameParty.isItemSlotWeapon([スロット番号], [武器ID]); * ・指定したスロット番号(1~)に登録された武器が、 * 指定した武器ID(1~)である場合にtrueを返します。 * [例] * ◆条件分岐:スクリプト:$gameParty.isItemSlotWeapon(2, 7); * ~スロット2番にID7の武器が * 登録されているときの処理~ * :分岐終了 * * $gameParty.isItemSlotArmor([スロット番号], [防具ID]); * ・指定したスロット番号(1~)に登録された防具が、 * 指定した防具ID(1~)である場合にtrueを返します。 * [例] * ◆条件分岐:スクリプト:$gameParty.isItemSlotItem(3, 23); * ~スロット3番にID23の防具が * 登録されているときの処理~ * :分岐終了 * * $gameParty.isItemSlotSkill([スロット番号], [スキルID]); * ・指定したスロット番号(1~)に登録されたスキルが、 * 指定したスキルID(1~)である場合にtrueを返します。 * [例] * ◆条件分岐:スクリプト:$gameParty.isItemSlotItem(4, 7); * ~スロット1番にID7のスキルが * 登録されているときの処理~ * :分岐終了 * * $gameParty.getItemSlotLastIndex(); * ・現在選択されているスロットインデックスを取得します。 * (インデックス = スロット番号を-1した値) * [例] * ◆条件分岐:スクリプト:$gameParty.getItemSlotLastIndex() == 0 * ~スロット1番が選択されているときの処理~ * :分岐終了 * ◆条件分岐:スクリプト:$gameParty.getItemSlotLastIndex() == 1 * ~スロット2番が選択されているときの処理~ * :分岐終了 * * $gameParty.getItemSlotId([スロット番号]); * ・指定したスロット番号(1~)に登録された * アイテム(武器/防具/スキルを含む)のIDを取得します。 * * $gameParty.getItemSlotType([スロット番号]); * ・指定したスロット番号(1~)に登録された * アイテム(武器/防具/スキルを含む)の種類文字列を返します。 * 返ってくる文字列は以下のいずれかです。 * 値 : 意味 * "item" セットされているのはアイテムです * "weapon" セットされているのは武器です * "armor" セットされているのは防具です * "skill" セットされているのはスキルです * null (空文字) 何もセットされていない。またはスロット番号が不正です * * $gameParty.openItemSlotMenu(); * ・アイテムスロットメニューを開きます。 * * * 補足: * ・このプラグインに関するメモ欄の設定、プラグインコマンド/パラメーター、 * 制御文字は大文字/小文字を区別していません。 * * ・プラグインパラメーターの説明に、[初期値]と書かれているものは * プラグインコマンドで個別に設定変更が可能です。 * 変更した場合、[初期値]より変更後の設定が * 優先されますのでご注意ください。 * * ・プラグインパラメータの説明に、[制御文字可]と書かれているものは * 設定値に制御文字を使用可能です。 * (例えば、変数を表示する\v[n]や、文章の改行を行う\nなどです) * * ・変数を設定した場合、そのパラメータの利用時に変数の値を * 参照するため、パラメータの設定をゲーム中に変更できます。 * * * 利用規約: * ・作者に無断で本プラグインの改変、再配布が可能です。 * (ただしヘッダーの著作権表示部分は残してください。) * * ・利用形態(フリーゲーム、商用ゲーム、R-18作品等)に制限はありません。 * ご自由にお使いください。 * * ・本プラグインを使用したことにより発生した問題について作者は一切の責任を * 負いません。 * * ・要望などがある場合、本プラグインのバージョンアップを行う * 可能性がありますが、 * バージョンアップにより本プラグインの仕様が変更される可能性があります。 * ご了承ください。 * * ============================================================================== * * @param Slot_Number * @text 最大スロット数 * @desc アイテムスロットの最大数を指定してください。(1~10までの数字。デフォルト:10) * @type number * @min 1 * @max 10 * @default 10 * * @param Slot_Set_Weapon * @text 武器登録可否 * @desc アイテムスロットに武器を登録可能にするか選択します。(デフォルト:登録する) * @type boolean * @on 登録する * @off 登録しない * @default true * * @param Slot_Set_Armor * @text 防具登録可否 * @desc アイテムスロットに防具を登録可能にするか選択します。(デフォルト:登録しない) * @type boolean * @on 登録する * @off 登録しない * @default false * * @param Slot_Set_Skill * @text スキル登録可否 * @desc アイテムスロットにスキルを登録可能にするか選択します。(デフォルト:登録しない) * @type boolean * @on 登録する * @off 登録しない * @default false * * @param Item_Count_Visible * @text アイテム個数の表示 * @desc アイテムスロットに登録されたアイテムの個数を表示するか選択します。(デフォルト:表示する) * @type boolean * @on 表示する * @off 表示しない * @default true * * @param Mouse_Mode * @text マウスモード * @desc マウスでのアイテムスロット操作設定 * @type struct<MouseMode> * @default {"Use_Enable":"true","Select_Enable":"true","Display_Click":"1"} * * @param Keyboard_Mode * @text キーボードモード * @desc キーボードでのアイテムスロット操作設定 * @type struct<Mode> * @default {"Use_Enable":"true","Select_Enable":"true"} * * * @param map_setting * @text スロット(マップ)設定 * @default ==================================== * * @param Slot_Visible * @text アイテムスロットの表示 * @desc [初期値] アイテムスロットを初期状態で表示するか選択します。(デフォルト:表示) * @type boolean * @default true * @on 表示 * @off 非表示 * @parent map_setting * * @param Slot_Opacity_Offset * @text スロット不透明度調整 * @desc アイテムスロットのフェードイン/アウト時、1フレーム中に変更するウィンドウ不透明度を整数で指定します。(デフォルト:16) * @type number * @min 1 * @max 255 * @default 16 * @parent map_setting * * @param Slot_Background * @text アイテムスロットの背景 * @desc アイテムスロットの背景画像を指定します。(デフォルト設定での必要画像サイズ:横384px,高さ60px) * @type file * @require 1 * @dir img/pictures * @parent map_setting * * @param Slot_X * @text アイテムスロットX座標 * @desc アイテムスロットを画面描画するためのX座標を指定してください。(数字/left/center/rightのいずれか。デフォルト:center) * @type combo * @option left * @option center * @option right * @default center * @parent map_setting * * @param Slot_Y * @text アイテムスロットY座標 * @desc アイテムスロットを画面描画するためのY座標を指定してください。(数字/top/center/bottomのいずれか。デフォルト:bottom) * @type combo * @option top * @option center * @option bottom * @default bottom * @parent map_setting * * @param Map_Slot_Window * @text ウィンドウ設定(マップ) * @desc マップ画面のスロットウィンドウに関する設定です。(デフォルト:1.0 / 12 / 6 / 20) * @type struct<SlotWindow> * @default {"Size_Rate":"1.5","Padding":"12","Spacing":"0","Font_Size":"20"} * @parent map_setting * * @param Slot_Add_Mode * @text スロット登録モード * @desc 入手したアイテムを自動的にアイテムスロットに登録するか選択します。(デフォルト:登録する) * @type boolean * @on 登録する * @off 登録しない * @default true * @parent map_setting * * @param Item_Use_Mode * @text アイテム使用モード * @desc アイテムの登録されたスロットにカーソルを移動後、自動的にそのアイテムを使用するか選択します。(デフォルト:使用しない) * @type boolean * @on 使用する * @off 使用しない * @default false * @parent map_setting * * @param Item_Remove_Mode * @text アイテム消去モード * @desc スロットに登録されたアイテムが0個になったとき、スロットからそのアイテムを消去するか選択します。(デフォルト:削除する) * @type boolean * @on 削除する * @off 削除しない * @default true * @parent map_setting * * @param Slot_Cursor_Visible * @text カーソルの表示 * @desc アイテムスロットの選択カーソルを表示するか選択します。(デフォルト:表示する) * @type boolean * @on 表示する * @off 表示しない * @default true * @parent map_setting * * @param Map_Slot_Opacity * @text 不透明度(マップ) * @desc マップ画面に表示されたアイテムスロットの不透明度を数値で指定します。0で完全に透明になります。(デフォルト:255) * @type number * @max 255 * @min 0 * @default 255 * @parent map_setting * * @param Event_Mode * @text イベント実行中の動作 * @desc マップ上でイベント実行中、アイテムスロットの動作を設定します。 * @type struct<EventMode> * @default {"Slot_Enable":"false","Use_Enable":"false","Select_Enable":"false"} * @parent map_setting * * @param Use_Buzzer * @text アイテム使用不可ブザー * @desc スロットにセットされたアイテムが使用不可の場合にブザーを鳴らすか設定します。(デフォルト:鳴らす) * @type boolean * @on 鳴らす * @off 鳴らさない * @default true * @parent map_setting * * * @param key_config * @text キーコンフィグ * @default ==================================== * * @param Item_Use_Key * @text アイテム使用キー * @desc スロットに登録されたアイテムを使用するためのキーを指定してください。(デフォルト:Control) ※括弧内はキー名 * @type struct<Key> * @default {"Key":"control"} * @parent key_config * * @param Slot_1_Key * @text スロット1選択キー * @desc アイテムスロット1番を選択するキーを指定してください。(デフォルト:1) ※括弧内はキー名 * @type struct<Key> * @default {"Key":"1"} * @parent key_config * * @param Slot_2_Key * @text スロット2選択キー * @desc アイテムスロット2番を選択するキーを指定してください。(デフォルト:2) ※括弧内はキー名 * @type struct<Key> * @default {"Key":"2"} * @parent key_config * * @param Slot_3_Key * @text スロット3選択キー * @desc アイテムスロット3番を選択するキーを指定してください。(デフォルト:3) ※括弧内はキー名 * @type struct<Key> * @default {"Key":"3"} * @parent key_config * * @param Slot_4_Key * @text スロット4選択キー * @desc アイテムスロット4番を選択するキーを指定してください。(デフォルト:4) ※括弧内はキー名 * @type struct<Key> * @default {"Key":"4"} * @parent key_config * * @param Slot_5_Key * @text スロット5選択キー * @desc アイテムスロット5番を選択するキーを指定してください。(デフォルト:5) ※括弧内はキー名 * @type struct<Key> * @default {"Key":"5"} * @parent key_config * * @param Slot_6_Key * @text スロット6選択キー * @desc アイテムスロット6番を選択するキーを指定してください。(デフォルト:6) ※括弧内はキー名 * @type struct<Key> * @default {"Key":"6"} * @parent key_config * * @param Slot_7_Key * @text スロット7選択キー * @desc アイテムスロット7番を選択するキーを指定してください。(デフォルト:7) ※括弧内はキー名 * @type struct<Key> * @default {"Key":"7"} * @parent key_config * * @param Slot_8_Key * @text スロット8選択キー * @desc アイテムスロット8番を選択するキーを指定してください。(デフォルト:8) ※括弧内はキー名 * @type struct<Key> * @default {"Key":"8"} * @parent key_config * * @param Slot_9_Key * @text スロット9選択キー * @desc アイテムスロット9番を選択するキーを指定してください。(デフォルト:9) ※括弧内はキー名 * @type struct<Key> * @default {"Key":"9"} * @parent key_config * * @param Slot_10_Key * @text スロット10選択キー * @desc アイテムスロット10番を選択するキーを指定してください。(デフォルト:0) ※括弧内はキー名 * @type struct<Key> * @default {"Key":"0"} * @parent key_config * * * @param menu_setting * @text スロット(メニュー)設定 * @default ==================================== * * @param Menu_Slot_Mode * @text メニュー表示モード * @desc [初期値]アイテムスロット画面コマンドをメニューに追加する方式を指定してください。(デフォルト:コマンド有効状態で追加) * @type select * @option 追加しない * @value 0 * @option コマンド有効状態で追加 * @value 1 * @option コマンド無効状態で追加 * @value 2 * @default 1 * @parent menu_setting * * @param Menu_Background * @text スロットメニューの背景 * @desc スロットメニュー画面の背景画像を指定します。(デフォルトのゲーム画面サイズ:横816px,高さ624px) * @type file * @require 1 * @dir img/pictures * @parent menu_setting * * @param Map_Background_Enable * @text マップスロット背景切替 * @desc メニュー画面のアイテムスロット背景に、マップ上で表示している背景画像を表示するか指定します。(デフォルト:表示しない) * @type boolean * @on 表示する * @off 表示しない * @default false * @parent menu_setting * * @param Menu_Slot_Window * @text ウィンドウ設定(メニュー) * @desc アイテムスロット画面のスロットウィンドウに関する設定です。(デフォルト:1.3 / 12 / 6 / 20) * @type struct<SlotWindow> * @default {"Size_Rate":"1.5","Padding":"12","Spacing":"0","Font_Size":"20"} * @parent menu_setting * * @param Menu_Slot_Name * @text スロットコマンド名 * @desc メニューに追加する、アイテムスロット画面へ飛ぶためのコマンド名を指定してください。(デフォルト:アイテムスロット) * @type text * @default アイテムスロット * @parent menu_setting * * @param Slot_Set_Name * @text スロット登録コマンド名 * @desc アイテムスロット画面で、アイテムをスロットへ登録するためのコマンド名を指定してください。(デフォルト:登録) * @type text * @default 登録 * @parent menu_setting * * @param Slot_Remove_Name * @text スロット削除コマンド名 * @desc アイテムスロット画面で、スロットに登録されたアイテムをクリアするためのコマンド名を指定してください。(デフォルト:削除) * @type text * @default 解除 * @parent menu_setting * * @param Slot_Set_Desc * @text スロット登録説明文 * @desc [制御文字可]アイテムスロット画面で、スロットにアイテムを登録する際の説明文を指定してください。 * @type note * @default "アイテムを登録したいスロットを選択し、\n登録するアイテムを選択してください。" * @parent menu_setting * * @param Slot_Remove_Desc * @text スロット削除説明文 * @desc [制御文字可]アイテムスロット画面で、スロットに登録されたアイテムを解除するスロットを選択する際の説明文を指定してください。 * @type note * @default "アイテムの登録を解除するスロットを選択してください。" * @parent menu_setting * * @param Menu_Slot_Opacity * @text 不透明度(メニュー) * @desc アイテムスロット画面のウィンドウの不透明度を数値で指定します。0で完全に透明になります。(デフォルト:255) * @type number * @max 255 * @min 0 * @default 255 * @parent menu_setting * * @param Category_Enable * @text カテゴリ表示 * @desc スロット画面のカテゴリを表示せず、リスト内でアイテムの並び変えを行う場合変更します。(デフォルト:カテゴリを表示する) * @type boolean * @on カテゴリを表示する * @off カテゴリを表示しない * @default true * @parent menu_setting * * @param Item_Sort * @text アイテムリストソート設定 * @desc スロット画面でカテゴリを表示しない場合のアイテムリスト並び順を設定します。(デフォルト:item,weapon,armor,skill) * @type select[] * @option アイテム * @value item * @option 武器 * @value weapon * @option 防具 * @value armor * @option スキル * @value skill * @default ["item","weapon","armor","skill"] * @parent menu_setting * */ /*~struct~Key: * * @param Key * @text キーコンフィグ * @desc キーを指定してください。※括弧内はキー名など補足 * @type select * @option なし * @value null * @option ダッシュ(Shift) * @value shift * @option Control(Ctrl/Alt/Command/Option) * @value control * @option A * @option B * @option C * @option D * @option E * @option F * @option G * @option H * @option I * @option J * @option K * @option L * @option N * @option M * @option O * @option P * @option R * @option S * @option T * @option U * @option V * @option Y * @option 1 * @option 2 * @option 3 * @option 4 * @option 5 * @option 6 * @option 7 * @option 8 * @option 9 * @option 0 * */ /*~struct~Mode: * * @param Use_Enable * @text アイテム使用 * @desc このモードでスロットに登録されたアイテムの使用が可能か選択します。(デフォルト:使用可能) * @type boolean * @on 使用可能 * @off 使用不可 * * @param Select_Enable * @text スロット選択 * @desc このモードでスロットの選択が可能か選択します。(デフォルト:選択可能) * @type boolean * @on 選択可能 * @off 選択不可 * */ /*~struct~MouseMode: * * @param Use_Enable * @text アイテム使用 * @desc このモードでスロットに登録されたアイテムの使用が可能か選択します。(デフォルト:使用可能) * @type boolean * @on 使用可能 * @off 使用不可 * * @param Select_Enable * @text スロット選択 * @desc このモードでスロットの選択が可能か選択します。(デフォルト:選択可能) * @type boolean * @on 選択可能 * @off 選択不可 * * @param Display_Click * @text クリック(タッチ)範囲 * @desc アイテムを使用するためのクリック(タッチ)範囲を画面全体とするか、スロット部分にするか選択します。(デフォルト:画面全体) * @type select * @option 画面全体 * @value 1 * @option アイテムスロット部分 * @value 0 * */ /*~struct~EventMode: * * @param Slot_Enable * @text スロットの表示 * @desc イベント実行中、スロットを表示したままにするか非表示にするかを選択します。(デフォルト:非表示) * @type boolean * @on 表示 * @off 非表示 * * @param Use_Enable * @text アイテム使用 * @desc イベント実行中にスロットが表示されているとき、スロットアイテムの使用が可能か選択します。(デフォルト:使用不可) * @type boolean * @on 使用可能 * @off 使用不可 * * @param Select_Enable * @text スロット選択 * @desc イベント実行中にスロットが表示されているとき、スロットを選択可能か選択します。(デフォルト:選択不可) * @type boolean * @on 選択可能 * @off 選択不可 * */ /*~struct~SlotWindow: * * @param Size_Rate * @text スロットサイズ倍率 * @desc スロットサイズ倍率を指定してください。サイズは1.0で100%(1倍)、2.0で200%(2倍)となります。(1.0~2.0までの数字) * @type number * @decimals 1 * @min 1.0 * @max 2.0 * * @param Padding * @text ウィンドウ内余白 * @desc スロットウィンドウとスロットアイコン間の余白を調整します。(7以上の数字) * @type number * @min 7 * * @param Spacing * @text アイコン間隔 * @desc スロットアイコンの配置間隔を調整します。(0以上の数字) * @type number * @min 0 * * @param Font_Size * @text フォントサイズ * @desc スロットアイコンに描画する文字(所持数,装備状態)の大きさを指定します。(デフォルト:20) * @type number * @min 6 * * */ var Imported = Imported || {}; Imported.MKR_MapItemSlot = true; (function () { 'use strict'; const PN = "MKR_MapItemSlot"; const CheckParam = function (type, name, value, def, min, max, options) { if (min == undefined || min == null) { min = -Infinity; } if (max == undefined || max == null) { max = Infinity; } if (value == null) { value = ""; } else { value = String(value); } value = value.replace(/\\/g, '\x1b'); value = value.replace(/\x1b\x1b/g, '\\'); switch (type) { case "bool": if (value == "") { value = (def) ? "true" : "false"; } value = value.toUpperCase() === "ON" || value.toUpperCase() === "TRUE" || value.toUpperCase() === "1"; break; case "num": if (value == "") { value = (isFinite(def)) ? parseInt(def, 10) : 0; } else { value = (isFinite(value)) ? parseInt(value, 10) : (isFinite(def)) ? parseInt(def, 10) : 0; value = value.clamp(min, max); } break; case "float": if (value == "") { value = (isFinite(def)) ? parseFloat(def) : 0.0; } else { value = (isFinite(value)) ? parseFloat(value) : (isFinite(def)) ? parseFloat(def) : 0.0; value = value.clamp(min, max); } break; case "string": value = value.replace(/^\"/, ""); value = value.replace(/\"$/, ""); if (value != null && options && options.contains("lower")) { value = value.toLowerCase(); } if (value != null && options && options.contains("upper")) { value = value.toUpperCase(); } break; default: throw new Error("[CheckParam] " + name + "のタイプが不正です: " + type); break; } return [value, type, def, min, max]; }; const GetMeta = function (meta, name, sep) { let value, values, i, count; value = ""; values = []; name = name.toLowerCase().trim(); Object.keys(meta).forEach(function (key) { if (key.toLowerCase().trim() == name) { value = meta[key].trim(); return false; } }); if (sep !== undefined && sep != "" && value != "") { values = value.split(sep); count = values.length; values = values.map(function (elem) { return elem.trim(); }); return values; } return value; }; const paramParse = function (obj) { return JSON.parse(JSON.stringify(obj, paramReplace)); }; const paramReplace = function (key, value) { try { return JSON.parse(value || null); } catch (e) { return value; } }; const makeItemSortList = function (sortList) { let list; list = sortList.filter(function (elem, i, self) { return self.indexOf(elem) === i; }); return list ? list : ["item", "weapon", "armor", "skill"]; }; const Parameters = paramParse(PluginManager.parameters(PN)); let Params = {}; Params = { "SlotVisible": CheckParam("bool", "Slot_Visible", Parameters["Slot_Visible"], true), "SlotOpacityOffset": CheckParam("num", "Slot_Opacity_Offset", Parameters["Slot_Opacity_Offset"], 16, 1, 255), "SlotBackground": CheckParam("string", "Slot_Background", Parameters["Slot_Background"], ""), "SlotNumber": CheckParam("num", "Slot_Number", Parameters["Slot_Number"], 10, 1, 10), "SlotX": CheckParam("string", "Slot_X", Parameters["Slot_X"], "center"), "SlotY": CheckParam("string", "Slot_Y", Parameters["Slot_Y"], "bottom"), "SlotSetW": CheckParam("bool", "Slot_Set_Weapon", Parameters["Slot_Set_Weapon"], true), "SlotSetA": CheckParam("bool", "Slot_Set_Armor", Parameters["Slot_Set_Armor"], true), "SlotSetS": CheckParam("bool", "Slot_Set_Skill", Parameters["Slot_Set_Skill"], false), "SlotCursorVisible": CheckParam("bool", "Slot_Cursor_Visible", Parameters["Slot_Cursor_Visible"], true), "MapSlotOpacity": CheckParam("num", "Map_Slot_Opacity", Parameters["Map_Slot_Opacity"], 255, 0, 255), "SlotAddMode": CheckParam("bool", "Slot_Add_Mode", Parameters["Slot_Add_Mode"], true), "ItemRemoveMode": CheckParam("bool", "Item_Remove_Mode", Parameters["Item_Remove_Mode"], true), "ItemUseMode": CheckParam("bool", "Item_Use_Mode", Parameters["Item_Use_Mode"], false), "ItemCountVisible": CheckParam("bool", "Item_Count_Visible", Parameters["Item_Count_Visible"], true), "MenuSlotMode": CheckParam("num", "Menu_Slot_Mode", Parameters["Menu_Slot_Mode"], "コマンド有効状態で追加"), "MenuBackground": CheckParam("string", "Menu_Background", Parameters["Menu_Background"], ""), "MapBackgroundEnable": CheckParam("bool", "Map_Background_Enable", Parameters["Map_Background_Enable"], false), "MenuSlotName": CheckParam("string", "Menu_Slot_Name", Parameters["Menu_Slot_Name"], "アイテムスロット"), "SlotSetName": CheckParam("string", "Slot_Set_Name", Parameters["Slot_Set_Name"], "登録"), // "SlotChangeName" : CheckParam("string", "Slot_Change_Name", Parameters["Slot_Change_Name"], "入れ替え"), "SlotRemoveName": CheckParam("string", "Slot_Remove_Name", Parameters["Slot_Remove_Name"], "削除"), "SlotSetDesc": CheckParam("string", "Slot_Set_Desc", Parameters["Slot_Set_Desc"], "アイテムを登録したいスロットを選択し、\n登録するアイテムを選択してください。"), "SlotChangeDesc": CheckParam("string", "Slot_Change_Desc", Parameters["Slot_Change_Desc"], "移動元のスロットを選択し、\n交換先のスロットを選択してください。"), "SlotRemoveDesc": CheckParam("string", "Slot_Remove_Desc", Parameters["Slot_Remove_Desc"], "アイテムの登録を解除するスロットを選択してください。"), "MenuSlotOpacity": CheckParam("num", "Menu_Slot_Opacity", Parameters["Menu_Slot_Opacity"], 255, 0, 255), "CategoryEnable": CheckParam("bool", "Category_Enable", Parameters["Category_Enable"], true), "ItemSortList": makeItemSortList(Parameters["Item_Sort"]), "MapSlotWindow": { "SizeRate": CheckParam("float", "Map_Slot_Window.Size_Rate", Parameters["Map_Slot_Window"]["Size_Rate"], 1.0, 1.0, 2.0), "Padding": CheckParam("num", "Map_Slot_Window.Padding", Parameters["Map_Slot_Window"]["Padding"], 12, 7), "Spacing": CheckParam("num", "Map_Slot_Window.Spacing", Parameters["Map_Slot_Window"]["Spacing"], 6, 0), "FontSize": CheckParam("num", "Map_Slot_Window.Font_Size", Parameters["Map_Slot_Window"]["Font_Size"], 20, 6), }, "MenuSlotWindow": { "SizeRate": CheckParam("float", "Menu_Slot_Window.Size_Rate", Parameters["Menu_Slot_Window"]["Size_Rate"], 1.0, 1.0, 2.0), "Padding": CheckParam("num", "Menu_Slot_Window.Padding", Parameters["Menu_Slot_Window"]["Padding"], 12, 7), "Spacing": CheckParam("num", "Menu_Slot_Window.Spacing", Parameters["Menu_Slot_Window"]["Spacing"], 6, 0), "FontSize": CheckParam("num", "Menu_Slot_Window.Font_Size", Parameters["Map_Slot_Window"]["Font_Size"], 20, 6), }, "KeyConfig": { "ItemUseKey": CheckParam("string", "Item_Use_Key", Parameters["Item_Use_Key"]["Key"], "control", null, null, ["lower"]), "Slot1Key": CheckParam("string", "Slot_1_Key", Parameters["Slot_1_Key"]["Key"], "1", null, null, ["lower"]), "Slot2Key": CheckParam("string", "Slot_2_Key", Parameters["Slot_2_Key"]["Key"], "2", null, null, ["lower"]), "Slot3Key": CheckParam("string", "Slot_3_Key", Parameters["Slot_3_Key"]["Key"], "3", null, null, ["lower"]), "Slot4Key": CheckParam("string", "Slot_4_Key", Parameters["Slot_4_Key"]["Key"], "4", null, null, ["lower"]), "Slot5Key": CheckParam("string", "Slot_5_Key", Parameters["Slot_5_Key"]["Key"], "5", null, null, ["lower"]), "Slot6Key": CheckParam("string", "Slot_6_Key", Parameters["Slot_6_Key"]["Key"], "6", null, null, ["lower"]), "Slot7Key": CheckParam("string", "Slot_7_Key", Parameters["Slot_7_Key"]["Key"], "7", null, null, ["lower"]), "Slot8Key": CheckParam("string", "Slot_8_Key", Parameters["Slot_8_Key"]["Key"], "8", null, null, ["lower"]), "Slot9Key": CheckParam("string", "Slot_9_Key", Parameters["Slot_9_Key"]["Key"], "9", null, null, ["lower"]), "Slot10Key": CheckParam("string", "Slot_10_Key", Parameters["Slot_10_Key"]["Key"], "0", null, null, ["lower"]), }, "KeyboardMode": { "UseEnable": CheckParam("bool", "KeyboardMode.Use_Enable", Parameters["Keyboard_Mode"]["Use_Enable"], true), "SelectEnable": CheckParam("bool", "KeyboardMode.Select_Enable", Parameters["Keyboard_Mode"]["Select_Enable"], true), }, "MouseMode": { "UseEnable": CheckParam("bool", "MouseMode.Use_Enable", Parameters["Mouse_Mode"]["Use_Enable"], true), "SelectEnable": CheckParam("bool", "MouseMode.Select_Enable", Parameters["Mouse_Mode"]["Select_Enable"], true), "DisplayClick": CheckParam("num", "MouseMode.Display_Click", Parameters["Mouse_Mode"]["Display_Click"], 1), }, "EventMode": { "SlotEnable": CheckParam("bool", "EventMode.Slot_Enable", Parameters["Event_Mode"]["Slot_Enable"], false), "UseEnable": CheckParam("bool", "EventMode.Use_Enable", Parameters["Event_Mode"]["Use_Enable"], false), "SelectEnable": CheckParam("bool", "EventMode.Select_Enable", Parameters["Event_Mode"]["Select_Enable"], false), }, "UseBuzzer": CheckParam("bool", "Use_Buzzer", Parameters["Use_Buzzer"], true), }; const ITEM = "item"; const WEAPON = "weapon"; const ARMOR = "armor"; const SKILL = "skill"; const SKILLRANGE = [7, 8, 11]; //========================================================================= // Input // ・キー判定処理を再定義します。 // //========================================================================= const _Input_onKeyDown = Input._onKeyDown; Input._onKeyDown = function (event) { _Input_onKeyDown.call(this, event); let name; name = codeToName(event); if (!Input.keyMapper[event.keyCode]) { if (name) { this._currentState[name] = true; } } }; const _Input_onKeyUp = Input._onKeyUp; Input._onKeyUp = function (event) { _Input_onKeyUp.call(this, event); let name; name = codeToName(event); if (!Input.keyMapper[event.keyCode]) { if (name) { this._currentState[name] = false; } } }; //========================================================================= // Window // ・指定座標がWindow内か判定するメソッドを定義します。 // //========================================================================= Window_Base.prototype.contains = function (x, y) { if (this.x <= x && this.width + this.x >= x && this.y <= y && this.height + this.y >= y) { return true; } return false; }; Window_Base.prototype.contentsContains = function (x, y) { let padding; padding = this.standardPadding(); if (this.x + padding <= x && this.width + this.x - padding >= x && this.y + padding <= y && this.height + this.y - padding >= y) { return true; } return false; }; //========================================================================= // Game_Interpreter // ・アイテムスロットを操作するプラグインコマンドを定義します。 // //========================================================================= const _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand; Game_Interpreter.prototype.pluginCommand = function (command, args) { _Game_Interpreter_pluginCommand.call(this, command, args); let index, id, type, item, equip, i, cnt, itemSlot, actor, scene; index = -1; id = 0; type = null; item = null; equip = false; itemSlot = []; actor = $gameParty.leader(); scene = SceneManager._scene; if (command.toLowerCase() === "itemslot") { switch (args[0].toLowerCase()) { case "show": $gameParty.setItemSlotVisible(true); break; case "hide": $gameParty.setItemSlotVisible(false); break; case "edit": SceneManager.push(Scene_ItemSlot); break; case "set": if (args[1] != null && isFinite(args[1])) { index = parseInt(args[1], 10) - 1; } if (args[2]) { switch (true) { case (args[2].toLowerCase() == WEAPON && Params.SlotSetW[0]): case (args[2].toLowerCase() == ARMOR && Params.SlotSetA[0]): case (args[2].toLowerCase() == ITEM): case (args[2].toLowerCase() == SKILL && Params.SlotSetS[0]): type = args[2].toLowerCase(); } } if (args[3] != null && isFinite(args[3])) { id = parseInt(args[3], 10); } if (args[4]) { equip = args[4].toLowerCase() === "true" ? true : false; if (type == ITEM || type == SKILL) { equip = false; } } if (index < -1 || index >= Params.SlotNumber[0] || !type || id < 1) { break; } item = DataManager.getItemByIdType(id, type); if (type == WEAPON && !actor.isEquipWtypeOk(item.wtypeId)) { equip = false; } if (type == ARMOR && !actor.isEquipAtypeOk(item.atypeId)) { equip = false; } if (item && $gameParty.hasItemType(item)) { $gameParty.setItemSlot(index, item, equip); // if(!equip) { // スロットセット時にアイテムを増やす必要はあるか? // $gameParty.gainItem(item, 1, false); // } } break; case "remove": if (args[1] != null && isFinite(args[1])) { index = parseInt(args[1], 10) - 1; } if (index >= 0) { // アイテムスロットのアイテム削除判定 $gameParty.removeItemSlot(index); if (scene && scene.constructor == Scene_Map) { scene._mapItemSlotWindow.redrawItem(index); } } break; case "clear": itemSlot = $gameParty.getItemSlot(-1); cnt = itemSlot.length; for (i = 0; i < cnt; i++) { // アイテムスロットのアイテム削除判定 $gameParty.removeItemSlot(i); if (scene && scene.constructor == Scene_Map) { scene._mapItemSlotWindow.redrawItem(i); } } break; case "menu": $gameParty.setMenuSlotStatus(args[1]); break; case "use": if (args[1] != null && isFinite(args[1])) { index = parseInt(args[1], 10) - 1; } if (index >= 0) { itemSlot = $gameParty.getItemSlot(index); if (itemSlot && (itemSlot.type == ITEM || itemSlot.type == SKILL)) { item = DataManager.getItemByIdType(itemSlot.id, itemSlot.type); $gameParty.useItemSlot(item); // アイテムスロットのアイテム削除判定 if (item && itemSlot.type == ITEM && Params.ItemRemoveMode[0] && $gameParty.numItems(item) <= 0) { $gameParty.removeItemSlot(index); if (scene && scene.constructor == Scene_Map) { scene._mapItemSlotWindow.redrawItem(index); } } } } break; case "select": if (args[1] != "") { if (slotToIndex(args[1].toLowerCase()) != -1) { if (scene && scene.constructor == Scene_Map) { index = slotToIndex(args[1].toLowerCase()); // scene._mapItemSlotWindow.select(index); $gameParty.setItemSlotForceIndex(index); } } } break; } } }; //========================================================================= // Game_Party // ・アイテムスロットの内容を定義します。 // //========================================================================= const _Game_Party_initialize = Game_Party.prototype.initialize; Game_Party.prototype.initialize = function () { _Game_Party_initialize.call(this); this.initItemSlot(); }; Game_Party.prototype.initItemSlot = function () { let i, j, items, cnt, actor; i = 0; j = 0; if (this._itemSlot == undefined || this._itemSlot == null) { this._itemSlot = []; items = this.allItems(); cnt = Params.SlotNumber[0]; // アクターがアイテムを装備済みの場合、先にスロットに登録する。 if ($gameParty && Params.SlotAddMode[0]) { actor = $gameParty.leader(); if (actor && actor.weapons().length > 0) { actor.weapons().forEach(function (item) { this.setItemSlot(i, item); i++; }, this); } if (actor && actor.armors().length > 0) { actor.armors().forEach(function (item) { this.setItemSlot(i, item); i++; }, this); } } for (; i < cnt; i++) { if (items && items[j] && Params.SlotAddMode[0]) { this.setItemSlot(i, items[j]); j++; } else { this._itemSlot[i] = null; } } } this._itemSlotLastIndex = -1; this._itemSlotSetIndex = -1; this._itemSlotVisible = Params.SlotVisible[0]; if (this._menuSlotStatus == undefined || this._menuSlotStatus == null) { this._menuSlotStatus = Params.MenuSlotMode[0]; } this._slotEquipItem = null; }; Game_Party.prototype.updateItemSlot = function () { let i, cnt; if (this._itemSlot != undefined && this._itemSlot != null) { cnt = Params.SlotNumber[0]; for (i = this._itemSlot.length; i < cnt; i++) { this._itemSlot[i] = null; } } }; const _Game_Party_gainItem = Game_Party.prototype.gainItem; Game_Party.prototype.gainItem = function (item, amount, includeEquip) { let type, index, i, cnt, container, actor, meta, itemSlot, scene; meta = ""; if (item && item.meta) { meta = GetMeta(item.meta, "itemslot"); } if (Params.SlotAddMode[0] && meta.toLowerCase() != "noadd") { container = this.itemContainer(item); if (container && this.hasItemType(item) && this.getSlotEquipItem() != item) { cnt = this._itemSlot.length; type = DataManager.getItemType(item); index = this.getItemSlotNumber(type, item.id); if (index == -1 && SceneManager._scene.constructor !== Scene_ItemSlot) { this.setItemSlot(index, item); } } } _Game_Party_gainItem.apply(this, arguments); // アイテムスロットのアイテム削除判定 if (Params.ItemRemoveMode[0] && item && amount < 0) { type = DataManager.getItemType(item); index = $gameParty.getItemSlotNumber(type, item.id); if (index > -1) { itemSlot = $gameParty.getItemSlot(index); // item = win.item(); if (itemSlot) { actor = $gameParty.leader(); // if ((itemSlot.type == ITEM && $gameParty.numItems(item) <= 0) || ((itemSlot.type == WEAPON || itemSlot.type == ARMOR) && !actor.isEquipped(item))) { // if(itemSlot.type == ITEM && $gameParty.numItems(item) <= 0) { if ($gameParty.numItems(item) <= 0) { $gameParty.removeItemSlot(index); // win.redrawCurrentItem(); scene = SceneManager._scene; if (scene && scene.constructor == Scene_Map) { scene._mapItemSlotWindow.redrawItem(index); } } } } } }; Game_Party.prototype.setItemSlot = function (index, item, equip) { let equipFlg, actor, win, cnt, i; if (equip == undefined || equip == null) { equip = false; } if (index == -1) { index = this.getItemSlotFreeNumber() - 1; } // アイテムが登録済みの場合は新たに登録させない if (DataManager.isItem(item) && this.getItemSlotNumber(ITEM, item.id) >= 0) { index = -1; } else if (DataManager.isWeapon(item) && this.getItemSlotNumber(WEAPON, item.id) >= 0) { index = -1; } else if (DataManager.isArmor(item) && this.getItemSlotNumber(ARMOR, item.id) >= 0) { index = -1; } else if (DataManager.isSkill(item) && this.getItemSlotNumber(SKILL, item.id) >= 0) { index = -1; } actor = $gameParty.leader(); if (item && index >= 0 && index < Params.SlotNumber[0]) { if (DataManager.isItem(item)) { this._itemSlot[index] = {}; this._itemSlot[index].id = item.id; this._itemSlot[index].type = ITEM; } else if (DataManager.isSkill(item)) { this._itemSlot[index] = {}; this._itemSlot[index].id = item.id; this._itemSlot[index].type = SKILL; } else if (actor) { if ((Params.SlotSetW[0] && DataManager.isWeapon(item) && actor.isEquipWtypeOk(item.wtypeId)) || (Params.SlotSetA[0] && DataManager.isArmor(item) && actor.isEquipAtypeOk(item.atypeId))) { equipFlg = actor.isEquipped(item); this._itemSlot[index] = {}; this._itemSlot[index].id = item.id; this._itemSlot[index].type = DataManager.isWeapon(item) ? WEAPON : ARMOR; this._itemSlot[index].etypeId = item.etypeId; this._itemSlot[index].equip = equipFlg; if (equip) { $gameParty.setItemSlotLastIndex(index); this._itemSlot[index].equip = true; actor.changeEquipById(item.etypeId, item.id); } } } } }; Game_Party.prototype.removeItemSlot = function (index) { let cnt, item; cnt = this._itemSlot.length; if (index >= 0 && index < cnt) { if (this._itemSlot[index] && this._itemSlot[index].type == WEAPON) { item = $dataWeapons[this._itemSlot[index].id]; this.leader().changeEquipById(item.etypeId, 0); } else if (this._itemSlot[index] && this._itemSlot[index].type == ARMOR) { item = $dataArmors[this._itemSlot[index].id]; this.leader().changeEquipById(item.etypeId, 0); } else { this._itemSlot[index] = null; } } }; Game_Party.prototype.clearItemSlot = function () { let cnt; cnt = this._itemSlot.length; for (i = 0; i < cnt; i++) { this._itemSlot[i] = null; } }; Game_Party.prototype.swapItemSlot = function (index1, index2) { let temp; temp = this._itemSlot[index1]; this._itemSlot[index1] = this._itemSlot[index2]; this._itemSlot[index2] = temp; }; Game_Party.prototype.hasItemType = function (item) { let type; type = DataManager.getItemType(item); if (type == WEAPON && !Params.SlotSetW[0]) { return false; } else if (type == ARMOR && !Params.SlotSetA[0]) { return false; } else if (type == SKILL && !Params.SlotSetS[0]) { return false; } return true; }; Game_Party.prototype.setEquipStatus = function (index, equip) { let equipFlg, actor, itemSlot; itemSlot = this.getItemSlot(index); if (itemSlot && (itemSlot.type == WEAPON || itemSlot.type == ARMOR)) { this._itemSlot[index].equip = equip; } }; Game_Party.prototype.getItemSlot = function (index) { if (this._itemSlot && isFinite(index)) { if (index == -1) { return this._itemSlot; } else if (index >= 0 && index < this._itemSlot.length) { return this._itemSlot[index]; } } return null; }; Game_Party.prototype.getItemSlotId = function (slotId) { let itemSlot, index; if (!isFinite(slotId)) { return 0; } index = parseInt(slotId, 10) - 1; if (index < 0) { return 0; } itemSlot = this.getItemSlot(index); if (itemSlot) { return itemSlot.id; } return 0; }; Game_Party.prototype.getItemSlotType = function (slotId) { let itemSlot, index; if (!isFinite(slotId)) { return null; } index = parseInt(slotId, 10) - 1; if (index < 0) { return null; } itemSlot = this.getItemSlot(index); if (itemSlot) { return itemSlot.type; } return null; }; Game_Party.prototype.getItemSlotNumber = function (type, id) { let cnt, i, ret, itemSlot; cnt = this._itemSlot.length; ret = -1; for (i = 0; i < cnt; i++) { itemSlot = this._itemSlot[i]; if (itemSlot) { if (itemSlot.type == type && itemSlot.id == id) { ret = i; break; } } } return ret; }; Game_Party.prototype.getItemSlotFreeNumber = function () { let cnt, i, ret; cnt = this._itemSlot.length; ret = -1; cnt = this._itemSlot.length; for (i = 0; i < cnt; i++) { if (this._itemSlot[i] == null) { ret = i; break; } } return ++ret; }; Game_Party.prototype.getItemSlotLastIndex = function () { return this._itemSlotLastIndex; }; Game_Party.prototype.setItemSlotLastIndex = function (index) { this._itemSlotLastIndex = index; }; Game_Party.prototype.getItemSlotForceIndex = function () { return this._itemSlotForceIndex; }; Game_Party.prototype.setItemSlotForceIndex = function (index) { this._itemSlotForceIndex = index; }; Game_Party.prototype.isItemSlotHide = function () { return !this._itemSlotVisible; }; Game_Party.prototype.setItemSlotVisible = function (visible) { this._itemSlotVisible = visible; }; Game_Party.prototype.getMenuSlotStatus = function () { return this._menuSlotStatus; }; Game_Party.prototype.setMenuSlotStatus = function (status) { if (status != null && isFinite(status)) { status = parseInt(status, 10); if (status >= 0 && status <= 2) { this._menuSlotStatus = status; } } }; Game_Party.prototype.getSlotEquipItem = function () { return this._slotEquipItem; }; Game_Party.prototype.setSlotEquipItem = function (item) { if (item) { if (DataManager.getItemType(item) == WEAPON || DataManager.getItemType(item) == ARMOR) { this._slotEquipItem = item; } else { this._slotEquipItem = null; } } }; Game_Party.prototype.useItemSlot = function (item) { let actor, action, i; actor = this.leader(); if (actor && item && actor.canUse(item) && (item.scope === 0 || this.isItemEffectsValid(item))) { $gameParty.setLastItem(item); actor.useItem(item); action = new Game_Action(actor); action.setItemObject(item); this.itemTargetActors(item).forEach(function (target) { for (i = 0; i < action.numRepeats(); i++) { action.apply(target); } }, this); $gamePlayer.requestAnimation(item.animationId); action.applyGlobal(); // this._mapItemSlotWindow.redrawCurrentItem(); return true; } else if (item && (DataManager.getItemType(item) == ITEM || DataManager.getItemType(item) == SKILL) && Params.UseBuzzer[0]) { SoundManager.playBuzzer(); } return false; }; Game_Party.prototype.isItemEffectsValid = function (item) { let actor, action; actor = $gameParty.leader(); action = new Game_Action(actor); action.setItemObject(item); return this.itemTargetActors(item).some(function (target) { return action.testApply(target); }, this); }; Game_Party.prototype.itemTargetActors = function (item) { let actor, action; actor = $gameParty.leader(); action = new Game_Action(actor); action.setItemObject(item); if (!action.isForFriend()) { return []; } else if (action.isForAll()) { return $gameParty.members(); } else { return [actor]; } }; Game_Party.prototype.isItemSlotType = function (index, itemId, type) { let slot; if (!this._itemSlot) { return false; } slot = this._itemSlot[index]; if (!slot || slot.id != itemId || slot.type != type) { return false; } return true; }; Game_Party.prototype.isItemSlotItem = function (slotId, id) { let index; if (!isFinite(slotId) || !isFinite(id)) { return false; } index = parseInt(slotId, 10) - 1; id = parseInt(id, 10); if (index < 0 || id < 1) { return false; } return this.isItemSlotType(index, id, ITEM); }; Game_Party.prototype.isItemSlotWeapon = function (slotId, id) { let index; if (!isFinite(slotId) || !isFinite(id)) { return false; } index = parseInt(slotId, 10) - 1; id = parseInt(id, 10); if (index < 0 || id < 1) { return false; } return this.isItemSlotType(index, id, WEAPON); }; Game_Party.prototype.isItemSlotArmor = function (slotId, id) { let index; if (!isFinite(slotId) || !isFinite(id)) { return false; } index = parseInt(slotId, 10) - 1; id = parseInt(id, 10); if (index < 0 || id < 1) { return false; } return this.isItemSlotType(index, id, ARMOR); }; Game_Party.prototype.isItemSlotSkill = function (slotId, id) { let index; if (!isFinite(slotId) || !isFinite(id)) { return false; } index = parseInt(slotId, 10) - 1; id = parseInt(id, 10); if (index < 0 || id < 1) { return false; } return this.isItemSlotType(index, id, SKILL); }; Game_Party.prototype.openItemSlotMenu = function () { SceneManager.push(Scene_ItemSlot); }; //========================================================================= // Game_Actor // ・リーダーアクターの武器変更処理を再定義します。 // ・アクターが使用可能な回復スキルを返す処理を定義します。 // //========================================================================= const _Game_Actor_isEquipChangeOk = Game_Actor.prototype.isEquipChangeOk; Game_Actor.prototype.isEquipChangeOk = function (slotId) { let ret = _Game_Actor_isEquipChangeOk.call(this, slotId); if (Params.SlotSetW[0] && this == $gameParty.leader() && slotId == 0 && ret) { ret = false; } if (Params.SlotSetA[0] && this == $gameParty.leader() && slotId > 0 && ret) { ret = false; } return ret; }; const _Game_Actor_changeEquip = Game_Actor.prototype.changeEquip; Game_Actor.prototype.changeEquip = function (slotId, item) { let index, type; if (this == $gameParty.leader() && ((Params.SlotSetW[0] && DataManager.isWeapon(item)) || (Params.SlotSetA[0] && DataManager.isArmor(item)))) { type = DataManager.isWeapon(item) ? WEAPON : ARMOR; index = $gameParty.getItemSlotNumber(type, item.id); if (index == -1) { index = $gameParty.getItemSlotFreeNumber() - 1; if (index >= 0) { $gameParty.setItemSlotForceIndex(index); _Game_Actor_changeEquip.apply(this, arguments); } } else { $gameParty.setItemSlotForceIndex(index); _Game_Actor_changeEquip.apply(this, arguments); } } else { _Game_Actor_changeEquip.apply(this, arguments); } }; Game_Actor.prototype.recoverySkills = function () { return this.skills().filter(function (skill) { return skill && skill.damage.type == 3 && SKILLRANGE.contains(skill.scope) && this.isSkillStypeOk(skill) && this.skillTpCost(skill) == 0; }, this); }; Game_Actor.prototype.isSkillStypeOk = function (skill) { let stypeId; stypeId = skill.stypeId; if ($gameParty.leader().addedSkillTypes().contains(stypeId)) { return true; } else { return false; } }; //========================================================================= // Game_Temp // ・パーティ先頭アクターのmp変動をチェックするための処理を定義します。 // //========================================================================= const _Game_Temp_initialize = Game_Temp.prototype.initialize; Game_Temp.prototype.initialize = function () { _Game_Temp_initialize.call(this); this.mkrAddMember(); }; Game_Temp.prototype.mkrAddMember = function () { this._leaderMp = 0; }; Game_Temp.prototype.setLeaderMp = function (mp) { this._leaderMp = mp; }; Game_Temp.prototype.leaderMp = function () { return this._leaderMp; }; //========================================================================= // Window_ItemSlotBase // ・アイテムスロットウィンドウを定義します。 // //========================================================================= function Window_ItemSlotBase() { this.initialize.apply(this, arguments); } Window_ItemSlotBase.prototype = Object.create(Window_Selectable.prototype); Window_ItemSlotBase.prototype.constructor = Window_ItemSlotBase; Window_ItemSlotBase.prototype.initialize = function (x, y, kind) { x = this.stringToPoint(x, "x"); y = this.stringToPoint(y, "y"); Window_Selectable.prototype.initialize.call(this, x, y, this.windowWidth(), this.windowHeight()); this._type = []; this._num = []; this._kind = kind; this._lastIndex = $gameParty.getItemSlotLastIndex(); // GALV_GursorImage.jsへの対応 if (Imported.Galv_CursorImage) { this.removeChild(this._galvCursor); } this.refresh(); this.show(); }; // Window_ItemSlotBase.prototype.standardPadding = function() { // return 12; // }; // Window_ItemSlotBase.prototype.spacing = function() { // return 0; // }; Window_ItemSlotBase.prototype.maxCols = function () { return Params.SlotNumber[0]; }; Window_ItemSlotBase.prototype.maxItems = function () { return Params.SlotNumber[0]; }; Window_ItemSlotBase.prototype.windowWidth = function () { // return this.maxCols() * (this.lineHeight() + this.standardPadding() * 2); return this.maxCols() * this.lineHeight() + this.standardPadding() * 2; }; Window_ItemSlotBase.prototype.windowHeight = function () { return this.fittingHeight(1); }; Window_ItemSlotBase.prototype.itemHeight = function () { let val = this.contentsHeight(); val = val > this.contentsWidth() ? this.contentsWidth() : val; return val; }; Window_ItemSlotBase.prototype.lastIndex = function () { return this._lastIndex; }; Window_ItemSlotBase.prototype.item = function (index) { let itemSlot; if (index == undefined || index == null || index < 0) { index = this.index(); } itemSlot = $gameParty.getItemSlot(index); if (itemSlot) { if (itemSlot.type == ITEM) { return $dataItems[itemSlot.id]; } else if (itemSlot.type == WEAPON) { return $dataWeapons[itemSlot.id]; } else if (itemSlot.type == ARMOR) { return $dataArmors[itemSlot.id]; } else if (itemSlot.type == SKILL) { return $dataSkills[itemSlot.id]; } } return null; }; Window_ItemSlotBase.prototype.update = function () { Window_Selectable.prototype.update.call(this); }; Window_ItemSlotBase.prototype.checkRedraw = function (index) { let itemSlot, item, equipFlg, actor; itemSlot = $gameParty.getItemSlot(index); actor = $gameParty.leader(); if (itemSlot) { item = this.item(index); if (item) { if (itemSlot.type == SKILL && this.needsSkillRedraw(item)) { return true; } else { if (this._type[index] != itemSlot.type || this._num[index] != $gameParty.numItems(item)) { return true; } } // if(itemSlot.type == WEAPON || itemSlot.type == ARMOR) { // if(itemSlot.equip != actor.isEquipped(item)) { // return true; // } // } } } return false; }; Window_ItemSlotBase.prototype.drawItem = function (index) { Window_Selectable.prototype.drawItem.call(this, index); this.drawItemEx(index); }; Window_ItemSlotBase.prototype.drawItemEx = function (index) { let item, rect, num, type, id, itemSlot, equipFlg, actor, fontSize, x, y, sizeRate; itemSlot = $gameParty.getItemSlot(index); actor = $gameParty.leader(); sizeRate = this._kind ? Params.MapSlotWindow.SizeRate[0] : Params.MenuSlotWindow.SizeRate[0]; if (itemSlot) { type = itemSlot.type; id = itemSlot.id; item = this.item(index); if (item) { rect = this.itemRect(index); if (type == SKILL) { num = 0; } else { num = $gameParty.numItems(item); } if ((type == WEAPON || type == ARMOR) && actor.isEquipped(item)) { this.changePaintOpacity(true); } else if (type == SKILL) { this.changePaintOpacity(actor.canPaySkillCost(item)); } else { this.changePaintOpacity(num > 0); } x = rect.x + rect.width / 2 - Window_Base._iconWidth * sizeRate / 2; y = rect.y + rect.height / 2 - Window_Base._iconHeight * sizeRate / 2; this.drawIconEx(item.iconIndex, x, y, sizeRate); if (type == ITEM && Params.ItemCountVisible[0]) { fontSize = this.contents.fontSize; this.contents.fontSize = Params.MapSlotWindow.FontSize[0]; this.contents.drawText("" + num, rect.x, rect.height - 20, rect.width - 2, 24, 'right'); this.contents.fontSize = fontSize; this._type[index] = ITEM; } else if (type == WEAPON) { equipFlg = actor.isEquipped(item); if (equipFlg) { fontSize = this.contents.fontSize; this.contents.fontSize = Params.MapSlotWindow.FontSize[0]; this.contents.drawText("E", rect.x, rect.y, rect.width - 2, 24, 'right'); this.contents.fontSize = fontSize; } this._type[index] = WEAPON; } else if (type == ARMOR) { equipFlg = actor.isEquipped(item); if (equipFlg) { fontSize = this.contents.fontSize; this.contents.fontSize = Params.MapSlotWindow.FontSize[0]; this.contents.drawText("E", rect.x, rect.y, rect.width - 2, 24, 'right'); this.contents.fontSize = fontSize; } this._type[index] = ARMOR; } else if (type == SKILL) { this._type[index] = SKILL; } this._num[index] = num; } else { this._type[index] = ""; this._num[index] = 0; } } }; Window_ItemSlotBase.prototype.drawIconEx = function (iconIndex, x, y, sizeRate) { let bitmap, pw, ph, sx, sy, dw, dh; if (sizeRate == "" || sizeRate <= 1) { sizeRate = 1.0; } bitmap = ImageManager.loadSystem('IconSet'); pw = Window_Base._iconWidth; ph = Window_Base._iconHeight; sx = iconIndex % 16 * pw; sy = Math.floor(iconIndex / 16) * ph; dw = pw * sizeRate; dh = ph * sizeRate; this.contents.blt(bitmap, sx, sy, pw, ph, x, y, dw, dh); }; Window_ItemSlotBase.prototype.stringToPoint = function (text, type) { let val = 0; if (isFinite(text)) { val = parseInt(text, 10); } else { switch (text.toLowerCase()) { case "right": if (type == "x") { val = Graphics.boxWidth - this.windowWidth(); } break; case "left": if (type == "x") { val = 0; } break; case "top": if (type == "y") { val = 0; } break; case "bottom": if (type == "y") { val = Graphics.boxHeight - this.windowHeight(); } break; case "center": if (type == "x") { val = Graphics.boxWidth / 2 - this.windowWidth() / 2; } else if (type == "y") { val = Graphics.boxHeight / 2 - this.windowHeight() / 2; } break; } } return val; }; Window_ItemSlotBase.prototype.select = function (index) { if (index < Params.SlotNumber[0]) { Window_Selectable.prototype.select.call(this, index); } }; Window_ItemSlotBase.prototype.selectLast = function () { if (this._lastIndex <= -1) { this.select(0); } else { this.select(this._lastIndex); } }; Window_ItemSlotBase.prototype.getTouchToIndex = function () { let x, y, width, height, touchX, touchY, padding, spacing, i, rect, beforeRect; x = this.x; y = this.y; width = this.width; height = this.height; touchX = TouchInput.x; touchY = TouchInput.y; padding = this.standardPadding(); spacing = this.spacing(); // クリック位置がウィンドウ余白部分か判定 if (touchX <= x + padding || touchX >= x + width - padding || touchY <= y + padding || touchY >= y + height - padding) { return -1; } // クリック位置判定 for (i = 0; i < Params.SlotNumber[0]; i++) { rect = this.itemRect(i); if (touchX >= x + rect.x + padding && touchX <= x + rect.x + rect.width + padding) { return i; } continue; } return -1; }; Window_ItemSlotBase.prototype.needsSkillRedraw = function (item) { let actor; actor = $gameParty.leader(); if (!actor) { return false; } if (actor.mp != $gameTemp.leaderMp()) { $gameTemp.setLeaderMp(actor.mp); return true; } return false; }; //========================================================================= // Window_MapItemSlot // ・マップ画面のアイテムスロットウィンドウを定義します。 // //========================================================================= function Window_MapItemSlot() { this.initialize.apply(this, arguments); } Window_MapItemSlot.prototype = Object.create(Window_ItemSlotBase.prototype); Window_MapItemSlot.prototype.constructor = Window_MapItemSlot; Window_MapItemSlot.prototype.initialize = function (x, y, kind) { Window_ItemSlotBase.prototype.initialize.call(this, x, y, kind); this._opacityOffset = 0; this._showing = false; this._hiding = false; if (!$gameParty.isItemSlotHide()) { this.selectLast(); } }; Window_MapItemSlot.prototype.standardPadding = function () { return Params.MapSlotWindow.Padding[0]; }; Window_MapItemSlot.prototype.spacing = function () { return Params.MapSlotWindow.Spacing[0]; }; Window_MapItemSlot.prototype.windowWidth = function () { let val, windowWidth, sizeRate, spacing; windowWidth = Window_ItemSlotBase.prototype.windowWidth.call(this); sizeRate = Params.MapSlotWindow.SizeRate[0]; spacing = this.spacing() * (this.maxCols() - 1); val = windowWidth * sizeRate + spacing; // val = Graphics.boxWidth < val ? Graphics.boxWidth : val; return val; }; Window_MapItemSlot.prototype.windowHeight = function () { let val; val = Window_ItemSlotBase.prototype.windowHeight.call(this) * Params.MapSlotWindow.SizeRate[0]; // val = Graphics.boxHeight < val ? Graphics.boxHeight : val; return val; }; Window_MapItemSlot.prototype.update = function () { Window_ItemSlotBase.prototype.update.call(this); let index; index = Graphics.frameCount % Params.SlotNumber[0]; // 再描画判定 if (this.checkRedraw(index)) { this.redrawItem(index); } this._lastIndex = this.index(); if (this._showing) { this.updateFadeIn(); } else if (this._hiding) { this.updateFadeOut(); } }; Window_MapItemSlot.prototype.updateFadeIn = function () { this.opacity += this._opacityOffset; this.contentsOpacity += this._opacityOffset; if (this.opacity >= Params.MapSlotOpacity[0] || this.contentsOpacity >= Params.MapSlotOpacity[0]) { this.opacity = Params.MapSlotOpacity[0]; this.contentsOpacity = Params.MapSlotOpacity[0]; this._showing = false; } }; Window_MapItemSlot.prototype.updateFadeOut = function () { this.opacity -= this._opacityOffset; this.contentsOpacity -= this._opacityOffset; if (this.opacity <= 0 || this.contentsOpacity <= 0) { this.opacity = 0; this.contentsOpacity = 0; this._hiding = false; } }; Window_MapItemSlot.prototype.drawItem = function (index) { Window_ItemSlotBase.prototype.drawItem.call(this, index); let item, type, itemSlot, equipFlg, actor; itemSlot = $gameParty.getItemSlot(index); actor = $gameParty.leader(); if (!itemSlot) { return; } // 装備状態を変更 type = itemSlot.type; item = this.item(index); if (item && (type == WEAPON || type == ARMOR)) { equipFlg = actor.isEquipped(item); if (itemSlot.equip != equipFlg) { $gameParty.setEquipStatus(index, equipFlg); } } }; Window_MapItemSlot.prototype.isCursorVisible = function () { if (Params.SlotCursorVisible[0]) { return Window_Selectable.prototype.isCursorVisible.call(this); } else { return false; } }; Window_MapItemSlot.prototype.fadeIn = function () { this._opacityOffset = Params.SlotOpacityOffset[0]; this._showing = true; this._hiding = false; }; Window_MapItemSlot.prototype.fadeOut = function () { this._opacityOffset = Params.SlotOpacityOffset[0]; this._hiding = true; this._showing = false; }; Window_MapItemSlot.prototype.isShowing = function () { return this._showing; }; Window_MapItemSlot.prototype.isHiding = function () { return this._hiding; }; Window_MapItemSlot.prototype.isHide = function () { return this.opacity <= 0; }; Window_MapItemSlot.prototype.isShow = function () { return this.opacity > 0; }; //========================================================================= // Window_ItemSlotHelp // ・アイテムスロット画面のヘルプウィンドウを再定義します。 // //========================================================================= function Window_ItemSlotHelp() { this.initialize.apply(this, arguments); } Window_ItemSlotHelp.prototype = Object.create(Window_Help.prototype); Window_ItemSlotHelp.prototype.constructor = Window_ItemSlotHelp; Window_ItemSlotHelp.prototype.initialize = function (numLines) { Window_Help.prototype.initialize.call(this, numLines); // this.height += this.fittingHeight(0); }; Window_ItemSlotHelp.prototype.setItem = function (item) { this.setText(item ? item.name + "\n" + item.description : ''); }; //========================================================================= // Window_SlotCommand // ・アイテムスロット画面のスロットコマンドウィンドウを定義します。 // //========================================================================= function Window_SlotCommand() { this.initialize.apply(this, arguments); } Window_SlotCommand.prototype = Object.create(Window_Command.prototype); Window_SlotCommand.prototype.constructor = Window_SlotCommand; Window_SlotCommand.prototype.initialize = function (x, y) { Window_Command.prototype.initialize.call(this, x, y); this.selectLast(); }; Window_SlotCommand._lastCommandSymbol = null; Window_SlotCommand.initCommandPosition = function () { this._lastCommandSymbol = null; }; Window_SlotCommand.prototype.windowWidth = function () { return 240; }; Window_SlotCommand.prototype.numVisibleRows = function () { return this.maxItems(); }; Window_SlotCommand.prototype.makeCommandList = function () { this.addCommand(Params.SlotSetName[0], "slotset"); // this.addCommand(Params.SlotChangeName[0], "slotchange"); this.addCommand(Params.SlotRemoveName[0], "slotremove"); }; Window_SlotCommand.prototype.processOk = function () { Window_SlotCommand._lastCommandSymbol = this.currentSymbol(); Window_Command.prototype.processOk.call(this); }; Window_SlotCommand.prototype.updateHelp = function () { switch (this.currentSymbol()) { case "slotset": this._helpWindow.setText(Params.SlotSetDesc[0]); break; case "slotchange": this._helpWindow.setText(Params.SlotChangeDesc[0]); break; case "slotremove": this._helpWindow.setText(Params.SlotRemoveDesc[0]); break; } }; Window_SlotCommand.prototype.selectLast = function () { this.selectSymbol(Window_SlotCommand._lastCommandSymbol); }; //========================================================================= // Window_ItemSlot // ・アイテムスロット画面のアイテムスロットウィンドウを定義します。 // //========================================================================= function Window_ItemSlot() { this.initialize.apply(this, arguments); } Window_ItemSlot.prototype = Object.create(Window_ItemSlotBase.prototype); Window_ItemSlot.prototype.constructor = Window_ItemSlot; Window_ItemSlot.prototype.initialize = function (x, y, w, h, kind) { let x2, y2; x2 = x + w / 2 - this.windowWidth() / 2; y2 = y; Window_ItemSlotBase.prototype.initialize.call(this, x2, y2, kind); this._slotType = null; this._swapTemp = -1; this.resetLastIndex(); }; Window_ItemSlot.prototype.standardPadding = function () { return Params.MenuSlotWindow.Padding[0]; }; Window_ItemSlot.prototype.spacing = function () { return Params.MenuSlotWindow.Spacing[0]; }; Window_ItemSlot.prototype.windowWidth = function () { let val, windowWidth, sizeRate, spacing; windowWidth = Window_ItemSlotBase.prototype.windowWidth.call(this); sizeRate = Params.MenuSlotWindow.SizeRate[0]; spacing = this.spacing() * (this.maxCols() - 1); val = windowWidth * sizeRate + spacing; // val = Graphics.boxWidth < val ? Graphics.boxWidth : val; return val; }; Window_ItemSlot.prototype.windowHeight = function () { let val; val = Window_ItemSlotBase.prototype.windowHeight.call(this) * Params.MenuSlotWindow.SizeRate[0]; // val = Graphics.boxHeight < val ? Graphics.boxHeight : val; return val; }; Window_ItemSlot.prototype.update = function () { Window_ItemSlotBase.prototype.update.call(this); let index; index = Graphics.frameCount % Params.SlotNumber[0]; // 再描画判定 if (this.checkRedraw(index)) { this.redrawItem(index); } // this._lastIndex = this.index(); }; Window_ItemSlot.prototype.isCurrentItemEnabled = function () { let ret, item, actor; item = this.item(); actor = $gameParty.leader(); ret = true; if (item) { // if(DataManager.isWeapon(item) || DataManager.isArmor(item)) { // ret = !actor.isEquipped(item); // } } else { if (!this._slotType || this._slotType == "slotremove") { ret = false; } } return ret; }; Window_ItemSlot.prototype.updateHelp = function () { this.setHelpWindowItem(this.item()); }; Window_ItemSlot.prototype.processOk = function () { if (this.isCurrentItemEnabled() && !this.hasLastIndex()) { this._lastIndex = this.index(); } Window_ItemSlotBase.prototype.processOk.call(this); }; Window_ItemSlot.prototype.setSlotType = function (type) { this._slotType = type; }; Window_ItemSlot.prototype.hasLastIndex = function () { return this._lastIndex != -1; }; Window_ItemSlot.prototype.resetLastIndex = function () { this._lastIndex = -1; }; //========================================================================= // Window_ItemSlotCategory // ・アイテムスロット画面のカテゴリウィンドウを定義します。 // //========================================================================= function Window_ItemSlotCategory() { this.initialize.apply(this, arguments); } Window_ItemSlotCategory.prototype = Object.create(Window_ItemCategory.prototype); Window_ItemSlotCategory.prototype.constructor = Window_ItemSlotCategory; Window_ItemSlotCategory.prototype.initialize = function (width) { this._windowWidth = width; Window_ItemCategory.prototype.initialize.call(this); this.deselect(); this.deactivate(); }; Window_ItemSlotCategory.prototype.windowWidth = function () { return this._windowWidth; }; Window_ItemSlotCategory.prototype.maxCols = function () { let count; count = 1; if (Params.SlotSetW[0]) { count++; } if (Params.SlotSetA[0]) { count++; } if (Params.SlotSetS[0]) { count++; } return count; // if (Params.SlotSetW[0] && Params.SlotSetA[0]) { // return 3; // } else if (Params.SlotSetW[0] || Params.SlotSetA[0]) { // return 2; // } // return 1; }; Window_ItemSlotCategory.prototype.makeCommandList = function () { this.addCommand(TextManager.item, 'item'); if (Params.SlotSetW[0]) { this.addCommand(TextManager.weapon, 'weapon'); } if (Params.SlotSetA[0]) { this.addCommand(TextManager.armor, 'armor'); } if (Params.SlotSetS[0]) { this.addCommand(TextManager.skill, 'skill'); } }; //========================================================================= // Window_ItemSlotList // ・アイテムスロット画面のアイテムリストウィンドウを定義します。 // //========================================================================= function Window_ItemSlotList() { this.initialize.apply(this, arguments); } Window_ItemSlotList.prototype = Object.create(Window_ItemList.prototype); Window_ItemSlotList.prototype.constructor = Window_ItemSlotList; Window_ItemSlotList.prototype.initialize = function (x, y, width, height) { Window_ItemList.prototype.initialize.call(this, x, y, width, height); this._actor = $gameParty.leader(); }; Window_ItemSlotList.prototype.includes = function (item) { let ret, meta; ret = true; meta = ""; if (!item) { return false; } if (item && item.meta) { meta = GetMeta(item.meta, "itemslot"); } if (meta.toLowerCase() == "noadd") { return false; } if (!Params.CategoryEnable[0]) { return true; } switch (this._category) { case 'item': ret = DataManager.isItem(item) && item.itypeId === 1; break; case 'weapon': ret = DataManager.isWeapon(item); break; case 'armor': ret = DataManager.isArmor(item); break; case 'skill': ret = DataManager.isSkill(item);; break; default: ret = false; break; } return ret; }; Window_ItemSlotList.prototype.isEnabled = function (item) { let ret, type, actor; actor = $gameParty.leader(); ret = false; if (item && $gameParty.hasItemType(item)) { type = DataManager.getItemType(item); // ret = $gameParty.getItemSlotNumber(type, item.id) == -1 ? true : false; ret = $gameParty.getItemSlotNumber(type, item.id) == -1; if (type == WEAPON && !actor.isEquipWtypeOk(item.wtypeId)) { ret = false; } if (type == ARMOR && !actor.isEquipAtypeOk(item.atypeId)) { ret = false; } } return ret; // return $gameParty.canUse(item); }; Window_ItemSlotList.prototype.isCurrentItemEnabled = function () { return this.isEnabled(this.item()); // let ret, item, type; // item = this.item(); // ret = false; // if(item && $gameParty.hasItemType(item)) { // type = DataManager.getItemType(item); // ret = $gameParty.getItemSlotNumber(type, item.id) == -1 ? true : false; // } // return ret; }; Window_ItemSlotList.prototype.makeItemList = function () { let itemData, weaponData, armorData, skillData, actor; actor = $gameParty.leader(); skillData = []; if (actor) { skillData = actor.recoverySkills(); } if ((!Params.SlotSetW[0] && !Params.SlotSetA[0] && !Params.SlotSetS[0]) || Params.CategoryEnable[0]) { Window_ItemList.prototype.makeItemList.call(this); if (this._category == SKILL) { this._data = this._data.concat(skillData); } return; } this._data = []; itemData = $gameParty.items().filter(function (item) { return this.includes(item); }, this); weaponData = $gameParty.weapons().filter(function (item) { return this.includes(item); }, this); armorData = $gameParty.armors().filter(function (item) { return this.includes(item); }, this); Params.ItemSortList.forEach(function (category) { switch (category) { case ITEM: this._data = this._data.concat(itemData); break; case WEAPON: this._data = this._data.concat(weaponData); break; case ARMOR: this._data = this._data.concat(armorData); break; case SKILL: this._data = this._data.concat(skillData); break; } }, this); if (this.includes(null)) { this._data.push(null); } }; Window_ItemSlotList.prototype.drawItem = function (index) { let item; item = this._data[index]; if (item) { if (DataManager.isSkill(item)) { var numberWidth = this.numberWidth(); var rect = this.itemRect(index); rect.width -= this.textPadding(); this.changePaintOpacity(this.isEnabled(item)); this.drawItemName(item, rect.x, rect.y, rect.width - numberWidth); this.drawSkillCost(item, rect.x, rect.y, rect.width); this.changePaintOpacity(1); } else { Window_ItemList.prototype.drawItem.call(this, index); } } }; Window_ItemSlotList.prototype.drawSkillCost = Window_SkillList.prototype.drawSkillCost; //========================================================================= // Window_MenuCommand // ・メニュー画面にアイテムスロットコマンドを定義します。 // //========================================================================= const _Window_MenuCommand_addOriginalCommands = Window_MenuCommand.prototype.addOriginalCommands; Window_MenuCommand.prototype.addOriginalCommands = function () { _Window_MenuCommand_addOriginalCommands.call(this); let status; status = $gameParty.getMenuSlotStatus(); if (status == 1) { this.addCommand(Params.MenuSlotName[0], 'itemslot', $gameParty.exists()); } else if (status == 2) { this.addCommand(Params.MenuSlotName[0], 'itemslot', false); } }; //========================================================================= // Scene_Map // ・マップ画面にアイテムスロットを定義します。 // //========================================================================= const _Scene_Map_createDisplayObjects = Scene_Map.prototype.createDisplayObjects; Scene_Map.prototype.createDisplayObjects = function () { _Scene_Map_createDisplayObjects.call(this); this.createMapItemSlotWindow(); }; Scene_Map.prototype.createMapItemSlotWindow = function () { let kind; kind = 1; // マップ用は1 this._mapItemSlotWindow = new Window_MapItemSlot(Params.SlotX[0], Params.SlotY[0], kind); this._mapItemSlotWindow.setHandler("ok", this.onItemSlotOk.bind(this)); this._mapItemSlotWindow.opacity = Params.MapSlotOpacity[0]; this._mapItemSlotWindow.contentsOpacity = Params.MapSlotOpacity[0]; if (Params.SlotBackground[0] != "") { this._mapItemSlotWindow._windowSpriteContainer.removeChild(this._mapItemSlotWindow._windowBackSprite); this._mapItemSlotWindow._windowSpriteContainer.removeChild(this._mapItemSlotWindow._windowFrameSprite); this._mapItemSlotWindow._windowBackSprite = new Sprite(); this._mapItemSlotWindow._windowBackSprite.bitmap = ImageManager.loadPicture(Params.SlotBackground[0]); this._mapItemSlotWindow._windowSpriteContainer.addChild(this._mapItemSlotWindow._windowBackSprite); } this.addChild(this._mapItemSlotWindow); // if (this._mapItemSlotWindow.lastIndex() <= -1 && !Params.SlotVisible[0]) { if ($gameParty.isItemSlotHide()) { $gameParty.setItemSlotVisible(false); this._mapItemSlotWindow.opacity = 0; this._mapItemSlotWindow.contentsOpacity = 0; this._mapItemSlotWindow.selectLast(); } }; const _Scene_Map_update = Scene_Map.prototype.update; Scene_Map.prototype.update = function () { _Scene_Map_update.call(this); this.updateItemSlot(); }; Scene_Map.prototype.updateItemSlot = function () { let index, itemSlot, actor, lastIndex, item, action, win; actor = $gameParty.leader(); win = this._mapItemSlotWindow; index = win.index(); lastIndex = win.lastIndex(); // 表示判定 if (isEnableEventToSlot() && !$gameParty.isItemSlotHide()) { if ((win.isHide() || win.isHiding()) && !win.isShowing()) { win.fadeIn(); } } else { if (win.isShow() && !win.isHiding() && !SceneManager._scene.isBusy()) { win.fadeOut(); } } if ($gameParty.isItemSlotHide() || win.isHide()) { return; } if (index < 0) { win.selectLast(); } // アイテムスロット選択 updateSlotSelect(win, index, true); index = win.index(); // アイテム使用 // if (isEnableEventToUse() && // (isEnableMouseToUse(win) || isEnableKeyboardToUse())) { // win.callHandler("ok"); // } if (isEnableEventToUse()) { if (isEnableMouseToUse(win) && win.contentsContains(TouchInput.x, TouchInput.y)) { win.callHandler("ok"); } else if (isEnableKeyboardToUse()) { win.callHandler("ok"); } } if (!actor) { return; } // 装備アイテム itemSlot = $gameParty.getItemSlot(lastIndex); if (itemSlot && ((Params.SlotSetW[0] && itemSlot.type == WEAPON) || (Params.SlotSetA[0] && itemSlot.type == ARMOR))) { // lastIndex の装備を先に外すこと if (lastIndex != index) { item = win.item(lastIndex); if (actor.isEquipped(item)) { actor.changeEquipById(item.etypeId, 0); win.redrawItem(lastIndex); } } } itemSlot = $gameParty.getItemSlot(index); if (itemSlot && ((Params.SlotSetW[0] && itemSlot.type == WEAPON) || (Params.SlotSetA[0] && itemSlot.type == ARMOR))) { item = win.item(); if (!actor.isEquipped(item)) { actor.changeEquipById(item.etypeId, item.id); $gameParty.setSlotEquipItem(item); win.redrawCurrentItem(); } } if ((itemSlot == null || itemSlot.type == ITEM) && ((Params.SlotSetW[0] && actor.weapons().length > 0) || (Params.SlotSetA[0] && actor.armors().length > 0))) { // 装備アイテム以外のスロット選択時に装備を確実に外す item = win.item(lastIndex); if (item) { actor.changeEquipById(item.etypeId, 0); } } // アイテムスロットのアイテム削除判定 if (Params.ItemRemoveMode[0]) { itemSlot = $gameParty.getItemSlot(index); item = win.item(); if (itemSlot) { if ((itemSlot.type == ITEM && $gameParty.numItems(item) <= 0) || ((itemSlot.type == WEAPON || itemSlot.type == ARMOR) && !actor.isEquipped(item))) { $gameParty.removeItemSlot(index); win.redrawCurrentItem(); } } } $gameParty.setItemSlotLastIndex(index); }; Scene_Map.prototype.onItemSlotOk = function () { let item; item = this._mapItemSlotWindow.item(); if ($gameParty.useItemSlot(item)) { this._mapItemSlotWindow.redrawCurrentItem(); } }; const _Scene_Map_isMapTouchOk = Scene_Map.prototype.isMapTouchOk; Scene_Map.prototype.isMapTouchOk = function () { let win; win = this._mapItemSlotWindow; if (isEnableMouseToUse(win)) { return false; } return _Scene_Map_isMapTouchOk.call(this); }; const _Scene_Map_terminate = Scene_Map.prototype.terminate; Scene_Map.prototype.terminate = function () { if (!SceneManager.isNextScene(Scene_Battle)) { this._mapItemSlotWindow.hide(); // $gameParty.setItemSlotVisible(false); } _Scene_Map_terminate.call(this); }; //========================================================================= // Scene_ItemSlot // ・メニューから遷移するアイテムスロット画面を定義します。 // //========================================================================= function Scene_ItemSlot() { this.initialize.apply(this, arguments); } Scene_ItemSlot.prototype = Object.create(Scene_ItemBase.prototype); Scene_ItemSlot.prototype.constructor = Scene_ItemSlot; Scene_ItemSlot.prototype.initialize = function () { Scene_ItemBase.prototype.initialize.call(this); }; Scene_ItemSlot.prototype.create = function () { Scene_ItemBase.prototype.create.call(this); this.createHelpWindow(); this.createCommandWindow(); this.createItemSlotWindow(); this.createCategoryWindow(); this.createItemWindow(); }; Scene_ItemSlot.prototype.createBackground = function () { let background; background = Params.MenuBackground[0]; if (background) { this._backgroundSprite = new Sprite(); this._backgroundSprite.bitmap = ImageManager.loadPicture(background); this.addChild(this._backgroundSprite); return; } else { Scene_ItemBase.prototype.createBackground.call(this); } }; Scene_ItemSlot.prototype.createHelpWindow = function () { this._helpWindow = new Window_ItemSlotHelp(); this._helpWindow.opacity = Params.MenuSlotOpacity[0]; this.addWindow(this._helpWindow); }; Scene_ItemSlot.prototype.createCommandWindow = function () { this._commandWindow = new Window_SlotCommand(0, this._helpWindow.height); this._commandWindow.setHandler("slotset", this.commandItemSlot.bind(this)); // this._commandWindow.setHandler("slotchange", this.commandItemSlot.bind(this)); this._commandWindow.setHandler("slotremove", this.commandItemSlot.bind(this)); this._commandWindow.setHandler("cancel", this.popScene.bind(this)); this._commandWindow.opacity = Params.MenuSlotOpacity[0]; this._commandWindow.setHelpWindow(this._helpWindow); this.addWindow(this._commandWindow); }; Scene_ItemSlot.prototype.createItemSlotWindow = function () { let x, y, w, h, kind; x = this._commandWindow.width; y = this._commandWindow.y; w = Graphics.boxWidth - x; h = this._commandWindow.height; kind = 0; // スロットシーン用は0 this._itemSlotWindow = new Window_ItemSlot(x, y, w, y, kind); this._itemSlotWindow.setHelpWindow(this._helpWindow); this._itemSlotWindow.setHandler('ok', this.onItemSlotOk.bind(this)); this._itemSlotWindow.setHandler('cancel', this.onItemSlotCancel.bind(this)); this._itemSlotWindow.opacity = Params.MenuSlotOpacity[0]; if (Params.MapBackgroundEnable[0] && Params.SlotBackground[0] != "") { this._itemSlotWindow._windowSpriteContainer.removeChild(this._itemSlotWindow._windowBackSprite); this._itemSlotWindow._windowSpriteContainer.removeChild(this._itemSlotWindow._windowFrameSprite); this._itemSlotWindow._windowBackSprite = new Sprite(); this._itemSlotWindow._windowBackSprite.bitmap = ImageManager.loadPicture(Params.SlotBackground[0]); this._itemSlotWindow._windowSpriteContainer.addChild(this._itemSlotWindow._windowBackSprite); } this.addWindow(this._itemSlotWindow); }; Scene_ItemSlot.prototype.createCategoryWindow = function () { let width; width = Graphics.boxWidth - this._commandWindow.width; this._categoryWindow = new Window_ItemSlotCategory(width); this._categoryWindow.x = this._commandWindow.width; // this._categoryWindow.y = this._commandWindow.y + this._commandWindow.height - this._categoryWindow.height; this._categoryWindow.y = this._itemSlotWindow.y + this._itemSlotWindow.height; this._categoryWindow.hide(); this._categoryWindow.setHandler('ok', this.onCategoryOk.bind(this)); this._categoryWindow.setHandler('cancel', this.onCategoryCancel.bind(this)); this._categoryWindow.opacity = Params.MenuSlotOpacity[0]; this.addWindow(this._categoryWindow); }; Scene_ItemSlot.prototype.createItemWindow = function () { let wy, wh; wy = this._categoryWindow.y + this._categoryWindow.height; wh = Graphics.boxHeight - wy; this._itemWindow = new Window_ItemSlotList(0, wy, Graphics.boxWidth, wh); this._itemWindow.hide(); this._itemWindow.setHelpWindow(this._helpWindow); this._itemWindow.setHandler('ok', this.onItemOk.bind(this)); this._itemWindow.setHandler('cancel', this.onItemCancel.bind(this)); this._itemWindow.opacity = Params.MenuSlotOpacity[0]; this.addWindow(this._itemWindow); this._categoryWindow.setItemWindow(this._itemWindow); }; Scene_ItemSlot.prototype.commandItemSlot = function () { let symbol; symbol = this._commandWindow.currentSymbol(); this._itemSlotWindow.setSlotType(symbol); this._itemSlotWindow.activate(); this._itemSlotWindow.selectLast(); }; Scene_ItemSlot.prototype.onItemSlotOk = function () { let index, lastIndex; lastIndex = this._itemSlotWindow.lastIndex(); index = this._itemSlotWindow.index(); switch (this._commandWindow.currentSymbol()) { case "slotset": if (Params.SlotSetW[0] || Params.SlotSetA[0] || Params.SlotSetS[0]) { if (!Params.CategoryEnable[0]) { this._categoryWindow.select(0); this._itemWindow.activate(); this._itemWindow.select(0); this._itemWindow.show(); this._itemWindow.refresh(); this._itemSlotWindow.deactivate(); break; } this._categoryWindow.show(); this._categoryWindow.activate(); this._categoryWindow.select(0); this._itemWindow.deselect(); } else { this._categoryWindow.select(0); this._itemWindow.activate(); this._itemWindow.selectLast(); } this._itemWindow.show(); this._itemWindow.refresh(); this._itemSlotWindow.deactivate(); break; case "slotchange": if (this._itemSlotWindow.hasLastIndex() && index != lastIndex) { $gameParty.swapItemSlot(lastIndex, index); this._itemSlotWindow.resetLastIndex(); this._itemSlotWindow.refresh(); } this._itemSlotWindow.activate(); break; case "slotremove": $gameParty.removeItemSlot(this._itemSlotWindow.index()); this._itemSlotWindow.refresh(); this._itemSlotWindow.activate(); break; } }; Scene_ItemSlot.prototype.onItemSlotCancel = function () { this._itemSlotWindow.resetLastIndex(); this._itemSlotWindow.deselect(); this._commandWindow.activate(); this._commandWindow.callUpdateHelp(); this._itemSlotWindow.setSlotType(null); }; Scene_ItemSlot.prototype.onCategoryOk = function () { this._itemWindow.activate(); this._itemWindow.selectLast(); }; Scene_ItemSlot.prototype.onCategoryCancel = function () { this._categoryWindow.deselect(); this._categoryWindow.hide(); this._itemWindow.hide(); this._itemSlotWindow.activate(); // this._itemSlotWindow.selectLast(); }; Scene_ItemSlot.prototype.onItemOk = function () { let item, equipItem, actor; item = this.item(); actor = $gameParty.leader(); // setslot専用 // $gameParty.setLastItem(this.item()); $gameParty.setSlotEquipItem(this._itemSlotWindow.item()); equipItem = $gameParty.getSlotEquipItem(); if (equipItem) { actor.changeEquipById(equipItem.etypeId, 0); } $gameParty.setItemSlot(this._itemSlotWindow.index(), this.item()); $gameParty.setSlotEquipItem(this.item()); this._itemSlotWindow.refresh(); this._itemWindow.activate(); this._itemWindow.refresh(); // this.determineItem(); }; Scene_ItemSlot.prototype.onItemCancel = function () { this._itemWindow.deselect(); this._itemWindow.deactivate(); if ((Params.SlotSetW[0] || Params.SlotSetA[0] || Params.SlotSetS[0]) && Params.CategoryEnable[0]) { this._categoryWindow.activate(); } else { this._itemSlotWindow.activate(); } this._helpWindow.setItem(this._itemSlotWindow.item()); }; Scene_ItemSlot.prototype.update = function () { Scene_ItemBase.prototype.update.call(this); this.updateItemSlot(); }; Scene_ItemSlot.prototype.updateItemSlot = function () { let pressKey, index, win, itemSlot, item, actor, lastIndex; win = this._itemSlotWindow; index = win.index(); actor = $gameParty.leader(); // アイテムスロット選択 updateSlotSelect(win, index, false); index = win.index(); // 装備アイテム lastIndex = $gameParty.getItemSlotLastIndex(); itemSlot = $gameParty.getItemSlot(lastIndex); item = win.item(lastIndex); if (itemSlot) { if (itemSlot.type == WEAPON) { if (!actor.isEquipped(item)) { actor.changeEquipById(item.etypeId, item.id); win.redrawItem($gameParty.getItemSlotLastIndex()); } } else if (actor.weapons().length > 0) { // actor.changeEquipById(1, 0); // win.redrawItem($gameParty.getItemSlotLastIndex()); } if (itemSlot.type == ARMOR) { if (!actor.isEquipped(item)) { actor.changeEquipById(item.etypeId, item.id); win.redrawItem($gameParty.getItemSlotLastIndex()); } } else if (actor.armors().length > 0) { // actor.changeEquipById(1, 0); // win.redrawItem($gameParty.getItemSlotLastIndex()); } } }; //========================================================================= // Scene_Menu // ・メニュー画面にアイテムスロットコマンドを定義します。 // //========================================================================= const _Scene_Menu_createCommandWindow = Scene_Menu.prototype.createCommandWindow; Scene_Menu.prototype.createCommandWindow = function () { _Scene_Menu_createCommandWindow.call(this); this._commandWindow.setHandler('itemslot', this.commandItemSlot.bind(this)); }; Scene_Menu.prototype.commandItemSlot = function () { SceneManager.push(Scene_ItemSlot); }; //========================================================================= // DataManager // ・プラグイン導入前のセーブデータをロードしたとき用の処理を定義します。 // ・アイテム用関数を定義します。 // //========================================================================= const _DataManager_extractSaveContents = DataManager.extractSaveContents; DataManager.extractSaveContents = function (contents) { _DataManager_extractSaveContents.call(this, contents); // 処理を追記 if ($gameParty.getItemSlot(-1) == undefined || $gameParty.getItemSlot(-1) == null) { $gameParty.initItemSlot(); } else if ($gameParty.getItemSlot(-1).length != Params.SlotNumber[0]) { $gameParty.updateItemSlot(); } }; DataManager.getItemType = function (item) { if (this.isItem(item)) { return ITEM; } else if (this.isWeapon(item)) { return WEAPON; } else if (this.isArmor(item)) { return ARMOR; } else if (this.isSkill(item)) { return SKILL; } return null; }; DataManager.getItemByIdType = function (id, type) { if (!type) { return null; } if (!id || !isFinite(id)) { return null; } id = parseInt(id, 10); type = type.toLowerCase(); if (id < 1) { return null; } if (type == ITEM && $dataItems.length > id) { return $dataItems[id]; } else if (type == WEAPON && $dataWeapons.length > id) { return $dataWeapons[id]; } else if (type == ARMOR && $dataArmors.length > id) { return $dataArmors[id]; } else if (type == SKILL && $dataSkills.length > id) { return $dataSkills[id]; } return null; }; //========================================================================= // Utility // ・汎用的な処理を定義します。 // //========================================================================= // キーイベントのkeyCodeからキー名を取得 function codeToName(event) { let name, key; name = null; if (event.key != undefined && event.key != null) { name = event.key; } else if (event.keyIdentifier != undefined && event.keyIdentifier != null) { key = event.keyIdentifier; if (/^U\+/.test(key)) { key = parseInt(key.substr(2), 16); } if (isFinite(key)) { if (key >= 112 && key <= 123) { name = 'f' + (key - 111);// ファンクションキー } else if (key >= 96 && key <= 105) { name = 'num' + (key - 96); // 0 ~ 9 (テンキー) } else if (key >= 65 && key <= 90) { name = String.fromCharCode(key); // A ~ Z キー } else if (key >= 48 && key <= 57) { name = (key - 48).toString(); // 0 ~ 9 キー } else { switch (key) { case 32: name = "space"; break; } } } else { name = key; } } if (name) { name = name.toLowerCase(); } return name; } // スロット番号の指定をindexに変換する function slotToIndex(slot) { let ret; ret = -1; if (slot == "left") { ret = $gameParty.getItemSlotLastIndex() - 1; ret = ret < 0 ? Params.SlotNumber[0] - 1 : ret; } else if (slot == "right") { ret = $gameParty.getItemSlotLastIndex() + 1; ret = ret >= Params.SlotNumber[0] ? 0 : ret; } else if (slot != null && isFinite(slot)) { ret = parseInt(slot, 10); if (ret > Params.SlotNumber[0] || ret < 1) { ret = -1; } else { ret--; } } return ret; } // スロット使用キーを取得する function getUseKey() { let keys; keys = Params.KeyConfig; // return keys.ItemUseKey[0].toLowerCase(); return keys.ItemUseKey[0]; } // スロットウィンドウselect function updateSlotSelect(win, index, useFlg) { let item, pushFlg, keys, touchIndex; pushFlg = false; keys = Params.KeyConfig; // アイテムスロット選択 // 強制選択 if ($gameParty.getItemSlotForceIndex() >= 0) { win.select($gameParty.getItemSlotForceIndex()); $gameParty.setItemSlotForceIndex(-1); pushFlg = true; } // キーボード if (isEnableEventToSelect() && isEnableKeyboardToSelect()) { if (Input.isTriggered(keys.Slot1Key[0]) && slotToIndex(1) != -1) { win.select(slotToIndex(1)); pushFlg = true; } if (Input.isTriggered(keys.Slot2Key[0]) && slotToIndex(2) != -1) { win.select(slotToIndex(2)); pushFlg = true; } if (Input.isTriggered(keys.Slot3Key[0]) && slotToIndex(3) != -1) { win.select(slotToIndex(3)); pushFlg = true; } if (Input.isTriggered(keys.Slot4Key[0]) && slotToIndex(4) != -1) { win.select(slotToIndex(4)); pushFlg = true; } if (Input.isTriggered(keys.Slot5Key[0]) && slotToIndex(5) != -1) { win.select(slotToIndex(5)); pushFlg = true; } if (Input.isTriggered(keys.Slot6Key[0]) && slotToIndex(6) != -1) { win.select(slotToIndex(6)); pushFlg = true; } if (Input.isTriggered(keys.Slot7Key[0]) && slotToIndex(7) != -1) { win.select(slotToIndex(7)); pushFlg = true; } if (Input.isTriggered(keys.Slot8Key[0]) && slotToIndex(8) != -1) { win.select(slotToIndex(8)); pushFlg = true; } if (Input.isTriggered(keys.Slot9Key[0]) && slotToIndex(9) != -1) { win.select(slotToIndex(9)); pushFlg = true; } if (Input.isTriggered(keys.Slot10Key[0]) && slotToIndex(10) != -1) { win.select(slotToIndex(10)); pushFlg = true; } } // マウスクリック/画面タッチ if (isEnableMouseToUse(win)) { touchIndex = win.getTouchToIndex(); if (touchIndex >= 0 && touchIndex < Params.SlotNumber[0]) { win.select(touchIndex); pushFlg = true; } } // アイテム自動使用 if (isEnableEventToUse() && useFlg && pushFlg && Params.ItemUseMode[0]) { pushFlg = false; item = win.item(); $gameParty.useItemSlot(item); } // マウスホイール if (isEnableEventToSelect() && isEnableMouseToSelect()) { if (TouchInput.wheelY > 0) { if (index <= 0) { win.select(Params.SlotNumber[0] - 1); } else { win.select(index - 1); } } else if (TouchInput.wheelY < 0) { if (index >= Params.SlotNumber[0] - 1) { win.select(0); } else { win.select(index + 1); } } // if(TouchInput.wheelY > 0) { // if(index >= Params.SlotNumber[0] - 1) { // win.select(0); // } else { // win.select(index + 1); // } // } else if(TouchInput.wheelY < 0) { // if(index <= 0) { // win.select(Params.SlotNumber[0] - 1); // } else { // win.select(index - 1); // } // } } } function isEnableMouseToUse(win) { let mouseMode, touchX, touchY; mouseMode = Params.MouseMode; touchX = TouchInput.x; touchY = TouchInput.y; if (!isEnableTouchToSelect()) { return (mouseMode.UseEnable[0] && TouchInput.isTriggered()) ? true : false; } if (TouchInput.isTriggered() && win.contains(touchX, touchY)) { return true; } return false; } function isEnableMouseToSelect() { let mouseMode; mouseMode = Params.MouseMode; return mouseMode.SelectEnable[0] ? true : false; } function isEnableTouchToSelect() { let mouseMode; mouseMode = Params.MouseMode; return mouseMode.DisplayClick[0] === 1 ? false : true; } function isEnableKeyboardToUse() { let keyboardMode, paramKey; keyboardMode = Params.KeyboardMode; paramKey = getUseKey(); return (keyboardMode.UseEnable[0] && paramKey && Input.isTriggered(paramKey)) ? true : false; } function isEnableKeyboardToSelect() { let keyboardMode; keyboardMode = Params.KeyboardMode; return keyboardMode.SelectEnable[0] ? true : false; } function isEnableEventToSlot() { let eventMode; eventMode = Params.EventMode; return $gameMap.isEventRunning() ? eventMode.SlotEnable[0] ? true : false : true; // return eventMode.SlotEnable[0]; } function isEnableEventToUse() { let eventMode; eventMode = Params.EventMode; return $gameMap.isEventRunning() ? eventMode.UseEnable[0] ? true : false : true; } function isEnableEventToSelect() { let eventMode; eventMode = Params.EventMode; return $gameMap.isEventRunning() ? eventMode.SelectEnable[0] ? true : false : true; } })();
dazed/translations
www/js/plugins/MKR_MapItemSlot.js
JavaScript
unknown
140,799
//============================================================================= // MKR_MapScrollFix.js //============================================================================= // Copyright (c) 2016 マンカインド // This software is released under the MIT License. // http://opensource.org/licenses/mit-license.php // ---------------------------------------------------------------------------- // Version // 1.1.0 2019/07/28 DP_MapZoomプラグインとの競合を修正 // // 1.0.4 2019/07/15 画面固定時、画面のスクロールを // タイル単位で行わないようにできる設定を追加 // // 1.0.3 2017/10/24 画面固定時、ジャンプ移動で画面外へ移動できていた // 問題を修正。 // // 1.0.2 2017/10/20 一部プラグインとの競合に対応。 // // 1.0.1 2017/10/04 スクロール固定時、画面外への離脱と画面内への侵入を // 制限できるようにした。 // // 1.0.0 2016/10/24 初版公開。 // ---------------------------------------------------------------------------- // [Twitter] https://twitter.com/mankind_games/ // [GitHub] https://github.com/mankindGames/ // [Blog] http://mankind-games.blogspot.jp/ //============================================================================= /*: * * @plugindesc (v1.1.0) マップスクロール固定プラグイン * @author マンカインド * * @help = MKR_MapScrollFix.js = * 指定されたスイッチがオンの間、 * プレイヤーの移動によるマップスクロールを固定します。 * * プラグインパラメータ(以下、パラメータ)でスクロールを禁止するための * スイッチ番号を指定します。 * ゲーム中にそのスイッチがオンになると画面スクロールが固定されます。 * * * パラメータ[画面外への離脱/画面内への侵入]により、 * イベントが固定された画面から外への離脱、画面内への侵入が可能か設定できます。 * (プレイヤー/イベントがすり抜けONの場合、この設定は無視されます) * * * スクロール固定はタイル(48px四方)単位で行われます。 * そのため、解像度変更などでマップ画面の更新がタイル単位で行われなくなった場合、 * 画面表示がタイル単位になるようスクロールされてから固定が行われます。 * * パラメータ[画面固定方法]で「緩和する」を設定することで、 * タイル単位ではなくその場で画面が固定されます。 * ただし、キャラクター移動はタイル単位となっているため、 * 画面固定の結果、画面内に収まっていないタイルは画面外と判定されます。 * * * プラグイン:DP_MapZoom.js(以下、MapZoomプラグイン)併用時、 * プラグイン管理画面で本プラグインをMapZoomプラグインより下に登録し * 本プラグインのプラグインパラメータ[MapZoom併用]を「有効にする」と * 設定してください。 * * * プラグインコマンド: * ありません。 * * * スクリプトコマンド: * ありません。 * * * 補足: * ・このプラグインに関するメモ欄の設定、プラグインコマンド/パラメーター、 * 制御文字は大文字/小文字を区別していません。 * * * 利用規約: * ・作者に無断で本プラグインの改変、再配布が可能です。 * (ただしヘッダーの著作権表示部分は残してください。) * * ・利用形態(フリーゲーム、商用ゲーム、R-18作品等)に制限はありません。 * ご自由にお使いください。 * * ・本プラグインを使用したことにより発生した問題について作者は一切の責任を * 負いません。 * * ・要望などがある場合、本プラグインのバージョンアップを行う * 可能性がありますが、 * バージョンアップにより本プラグインの仕様が変更される可能性があります。 * ご了承ください。 * * * @param Default_Scroll_Fix_Sw * @text スクロール固定スイッチ * @desc 画面スクロールを固定するスイッチの番号を指定します。 * @type switch * @default 10 * * @param Is_Display_Out * @text 画面外への離脱 * @desc 画面スクロール固定時、イベントが画面外へと移動可能か選択します。 * @type boolean * @on 移動可能 * @off 移動不可 * @default true * * @param Is_Display_In * @text 画面内への侵入 * @desc 画面スクロール固定時、画面外にいるイベントが画面内へと移動可能か選択します。 * @type boolean * @on 移動可能 * @off 移動不可 * @default true * * @param Scroll_Fix_Type * @text 画面固定方法 * @type select * @option 厳格に行う * @value 1 * @option 緩和する * @value 0 * @default 1 * @desc ゲーム画面内にマップタイルが収まる(=画面解像度がタイル1マスのサイズ、48の倍数である)場合は[厳格に行う]を選択します。 * * @param Enable_MapZoom * @text MapZoom併用 * @desc DP_MapZoom.jsプラグイン併用時、「有効する」に設定してください * @type boolean * @on 有効にする * @off 無効にする * @default false * */ var Imported = Imported || {}; Imported.MKR_MapScrollFix = true; (function () { 'use strict'; const PN = "MKR_MapScrollFix"; const CheckParam = function (type, name, value, def, min, max, options) { if (min == undefined || min == null) { min = -Infinity; } if (max == undefined || max == null) { max = Infinity; } if (value == null) { value = ""; } else { value = String(value); } switch (type) { case "bool": if (value == "") { value = (def) ? true : false; } value = value.toUpperCase() === "ON" || value.toUpperCase() === "TRUE" || value.toUpperCase() === "1"; break; case "num": value = (isFinite(value)) ? parseInt(value, 10) : (isFinite(def)) ? parseInt(def, 10) : 0; value = value.clamp(min, max); break; default: throw new Error("[CheckParam] " + name + "のタイプが不正です: " + type); break; } return [value, type, def, min, max]; }; const paramParse = function (obj) { return JSON.parse(JSON.stringify(obj, paramReplace)); } const paramReplace = function (key, value) { try { return JSON.parse(value || null); } catch (e) { return value; } }; const Parameters = paramParse(PluginManager.parameters(PN)); let Params = {}; Params = { "ScrollFixSw": CheckParam("num", "Default_Scroll_Fix_Sw", Parameters["Default_Scroll_Fix_Sw"], 10, 0), "ScrollFixType": CheckParam("num", "Scroll_Fix_Type", Parameters["Scroll_Fix_Type"], 1), "IsDisplayOut": CheckParam("bool", "Is_Display_Out", Parameters["Is_Display_Out"], true), "IsDisplayIn": CheckParam("bool", "Is_Display_In", Parameters["Is_Display_In"], true), "EnableMapZoom": CheckParam("bool", "Enable_MapZoom", Parameters["Enable_MapZoom"], false), }; //========================================================================= // Game_Player // ・プレイヤー移動による画面のスクロールを再定義します。 // //========================================================================= var _Game_Player_updateScroll = Game_Player.prototype.updateScroll; Game_Player.prototype.updateScroll = function (lastScrolledX, lastScrolledY) { if (!$gameSwitches.value(Params.ScrollFixSw[0])) { _Game_Player_updateScroll.apply(this, arguments); return; } if (Params.ScrollFixType[0] != 1) { return; } if ($gameMap.displayX() != Math.round($gameMap.displayX())) { $gameMap._displayX = Math.round($gameMap.displayX()); } if ($gameMap.displayY() != Math.round($gameMap.displayY())) { $gameMap._displayY = Math.round($gameMap.displayY()); } }; //========================================================================= // Game_Map // ・マップスクロール処理を再定義します。 // //========================================================================= const _Game_Map_scrollDown = Game_Map.prototype.scrollDown; Game_Map.prototype.scrollDown = function (distance) { if (Params.EnableMapZoom[0] && $gameSwitches.value(Params.ScrollFixSw[0])) { return; } _Game_Map_scrollDown.call(this, distance); }; const _Game_Map_scrollLeft = Game_Map.prototype.scrollLeft; Game_Map.prototype.scrollLeft = function (distance) { if (Params.EnableMapZoom[0] && $gameSwitches.value(Params.ScrollFixSw[0])) { return; } _Game_Map_scrollLeft.call(this, distance); }; const _Game_Map_scrollRight = Game_Map.prototype.scrollRight; Game_Map.prototype.scrollRight = function (distance) { if (Params.EnableMapZoom[0] && $gameSwitches.value(Params.ScrollFixSw[0])) { return; } _Game_Map_scrollRight.call(this, distance); }; const _Game_Map_scrollUp = Game_Map.prototype.scrollUp; Game_Map.prototype.scrollUp = function (distance) { if (Params.EnableMapZoom[0] && $gameSwitches.value(Params.ScrollFixSw[0])) { return; } _Game_Map_scrollUp.call(this, distance); }; //========================================================================= // Game_CharacterBase // ・画面外への移動可能判定を定義します // //========================================================================= var _Game_CharacterBase_isMapPassable = Game_CharacterBase.prototype.isMapPassable; Game_CharacterBase.prototype.isMapPassable = function (x, y, d) { let isPass, x2, y2; isPass = _Game_CharacterBase_isMapPassable.apply(this, arguments); if (!this.isThrough() && $gameSwitches.value(Params.ScrollFixSw[0])) { if (isPass && !Params.IsDisplayOut[0]) { isPass = this.isDisplayOutPassible(x, y, d); } if (isPass && !Params.IsDisplayIn[0]) { isPass = this.isDisplayInPassible(x, y, d); } } return isPass; }; Game_CharacterBase.prototype.isDisplayOutPassible = function (x, y, d) { let x2, y2, dx, rdx, dy, rdy, realX, realY; dx = $gameMap.displayX(); rdx = dx + $gameMap.screenTileX() - 1; dy = $gameMap.displayY(); rdy = dy + $gameMap.screenTileY() - 1; x2 = $gameMap.roundXWithDirection(x, d); y2 = $gameMap.roundYWithDirection(y, d); realX = this._realX; realY = this._realY; // switch(true) { // case x == dx && x2 < dx: // case x == rdx && x2 > rdx: // case y == dy && y2 < dy: // case y == rdy && y2 > rdy: // case realX == dx && x2 < dx: // case realX == rdx && x2 > rdx: // case realY == dy && y2 < dy: // case realY == rdy && y2 > rdy: // return false; // } if (d == 8 || d == 2) { switch (true) { case y == Math.floor(dy) && y2 < dy: case y == Math.ceil(dy) && y2 < dy: case y == Math.floor(rdy) && y2 > rdy: case y == Math.ceil(rdy) && y2 > rdy: case realY == Math.floor(dy) && y2 < dy: case realY == Math.ceil(dy) && y2 < dy: case realY == Math.floor(rdy) && y2 > rdy: case realY == Math.ceil(rdy) && y2 > rdy: return false; } } else if (d == 6 || d == 4) { switch (true) { case x == Math.floor(dx) && x2 < dx: case x == Math.ceil(dx) && x2 < dx: case x == Math.floor(rdx) && x2 > rdx: case x == Math.ceil(rdx) && x2 > rdx: case realX == Math.floor(dx) && x2 < dx: case realX == Math.ceil(dx) && x2 < dx: case realX == Math.floor(rdx) && x2 > rdx: case realX == Math.ceil(rdx) && x2 > rdx: return false; } } return true; }; Game_CharacterBase.prototype.isDisplayInPassible = function (x, y, d) { let x2, y2, dx, rdx, dy, rdy, realX, realY; dx = $gameMap.displayX(); rdx = dx + $gameMap.screenTileX(); dx--; dy = $gameMap.displayY(); rdy = dy + $gameMap.screenTileY(); dy--; x2 = $gameMap.roundXWithDirection(x, d); y2 = $gameMap.roundYWithDirection(y, d); realX = this._realX; realY = this._realY; // switch(true) { // case x == dx && x2 > dx: // case x == rdx && x2 < rdx: // case y == dy && y2 > dy: // case y == rdy && y2 < rdy: // case realX == dx && x2 > dx: // case realX == rdx && x2 < rdx: // case realY == dy && y2 > dy: // case realY == rdy && y2 < rdy: // return false; // } if (d == 8 || d == 2) { switch (true) { case y == Math.floor(dy) && y2 > dy: case y == Math.ceil(dy) && y2 > dy: case y == Math.floor(rdy) && y2 < rdy: case y == Math.ceil(rdy) && y2 < rdy: case realY == Math.floor(dy) && y2 > dy: case realY == Math.ceil(dy) && y2 > dy: case realY == Math.floor(rdy) && y2 < rdy: case realY == Math.ceil(rdy) && y2 < rdy: return false; } } else if (d == 6 || d == 4) { switch (true) { case x == Math.floor(dx) && x2 < dx: case x == Math.ceil(dx) && x2 < dx: case x == Math.floor(rdx) && x2 > rdx: case x == Math.ceil(rdx) && x2 > rdx: case realX == Math.floor(dx) && x2 > dx: case realX == Math.ceil(dx) && x2 > dx: case realX == Math.floor(rdx) && x2 < rdx: case realX == Math.ceil(rdx) && x2 < rdx: return false; } } return true; }; const _Game_CharacterBase_updateJump = Game_CharacterBase.prototype.updateJump; Game_CharacterBase.prototype.updateJump = function () { _Game_CharacterBase_updateJump.call(this); let maxDisplayX, maxDisplayY; maxDisplayX = $gameMap.displayX() + $gameMap.screenTileX() - 1; maxDisplayY = $gameMap.displayY() + $gameMap.screenTileY() - 1; if (!this.isThrough() && $gameSwitches.value(Params.ScrollFixSw[0])) { if (this._realX > maxDisplayX) { this._realX = maxDisplayX; this._x = maxDisplayX; } else if (this._realX <= $gameMap.displayX()) { this._realX = $gameMap.displayX(); this._x = $gameMap.displayX(); } if (this._realY >= maxDisplayY) { this._realY = maxDisplayY; this._y = maxDisplayY; } else if (this._realY <= $gameMap.displayY()) { this._realY = $gameMap.displayY(); this._y = $gameMap.displayY(); } } }; })();
dazed/translations
www/js/plugins/MKR_MapScrollFix.js
JavaScript
unknown
16,006
//============================================================================== // MKR_PlayerMoveForbid.js //============================================================================== // Copyright (c) 2016-2017 マンカインド // This software is released under the MIT License. // http://opensource.org/licenses/mit-license.php // ----------------------------------------------------------------------------- // Version // 1.0.5 2017/12/10 移動禁止の間、決定キーを動作させるかのフラグを追加 // // 1.0.4 2017/08/27 プラグインパラメータの指定方法を変更 // // 1.0.3 2017/05/24 メニュー開閉フラグが正常に動作していなかったため修正 // // 1.0.2 2017/02/19 移動禁止の間、メニュー開閉を行えるかのフラグを追加 // // 1.0.1 2016/09/04 未使用のコードを削除しファイル容量を小さくした。 // デフォルト値の設定が不適切だったので修正。 // // 1.0.0 2016/09/04 初版公開。 // ----------------------------------------------------------------------------- // [Twitter] https://twitter.com/mankind_games/ // [GitHub] https://github.com/mankindGames/ // [Blog] http://mankind-games.blogspot.jp/ //============================================================================== /*: * * @plugindesc (v1.0.5) プレイヤー移動禁止プラグイン * @author マンカインド * * @help 指定された番号のスイッチがONの間、 * プレイヤー操作によるキャラの移動を禁止します。 * * プラグインパラメーター[移動禁止スイッチ]にスイッチ番号を指定します。 * 指定された番号のスイッチがONになっている間、 * プレイヤー操作によるキャラの移動ができなくなります。 * ([移動ルートの設定]コマンドなどで移動させることは可能です) * * [メニュー開閉制御]により、[移動禁止スイッチ]がONになっている間の * メニュー開閉を制御できます。 * * [決定キー制御]により、[移動禁止スイッチ]がONになっている間の * 決定キー/タッチ操作による動作(主にイベントの起動)を制御できます。 * * * プラグインコマンド: * ありません。 * * * スクリプトコマンド: * ありません。 * * * 利用規約: * ・作者に無断で本プラグインの改変、再配布が可能です。 * (ただしヘッダーの著作権表示部分は残してください。) * * ・利用形態(フリーゲーム、商用ゲーム、R-18作品等)に制限はありません。 * ご自由にお使いください。 * * ・本プラグインを使用したことにより発生した問題について作者は一切の責任を * 負いません。 * * ・要望などがある場合、本プラグインのバージョンアップを行う * 可能性がありますが、 * バージョンアップにより本プラグインの仕様が変更される可能性があります。 * ご了承ください。 * * * @param Default_Move_Flag * @text 移動禁止スイッチ * @desc ONの間、プレイヤーの移動を禁止するスイッチ番号を指定します。(デフォルト:10) * @type switch * @default 10 * * @param Default_Menu_Flag * @text メニュー開閉制御 * @desc プレイヤーの移動を禁止している間、メニューの開閉を許可するかどうかを設定します。(デフォルト:許可する) * @type boolean * @on 許可する * @off 許可しない * @default true * * @param Enter Flag * @text 決定キー制御 * @desc プレイヤーの移動を禁止している間、決定キー/タッチ操作による動作を許可するかどうかを設定します。(デフォルト:許可する) * @type boolean * @on 許可する * @off 許可しない * @default true * */ (function () { 'use strict'; const PN = "MKR_PlayerMoveForbid"; const CheckParam = function (type, param, def, min, max) { let Parameters, regExp, value; Parameters = PluginManager.parameters(PN); if (arguments.length < 4) { min = -Infinity; max = Infinity; } if (arguments.length < 5) { max = Infinity; } if (param in Parameters) { value = String(Parameters[param]); } else { throw new Error("[CheckParam] プラグインパラメーターがありません: " + param); } switch (type) { case "bool": if (value == "") { value = (def) ? true : false; } value = value.toUpperCase() === "ON" || value.toUpperCase() === "TRUE" || value.toUpperCase() === "1"; break; case "switch": if (value == "") { value = (def != "") ? def : value; } if (!value.match(/^(\d+)$/i)) { throw new Error("[CheckParam] " + param + "の値がスイッチではありません: " + param + " : " + value); } break; default: throw new Error("[CheckParam] " + param + "のタイプが不正です: " + type); break; } return [value, type, def, min, max, param]; } const Params = { "MoveSwitch": CheckParam("switch", "Default_Move_Flag", "10"), "MenuFlg": CheckParam("bool", "Default_Menu_Flag", true), "EnterFlg": CheckParam("bool", "Enter Flag", true), }; //========================================================================= // Game_System // ・メニュー開閉許可処理を再定義します。 // //========================================================================= const _Game_System_isMenuEnabled = Game_System.prototype.isMenuEnabled; Game_System.prototype.isMenuEnabled = function () { return _Game_System_isMenuEnabled.call(this) && ($gameSwitches.value(Params.MoveSwitch[0]) ? Params.MenuFlg[0] == true : true); }; //========================================================================= // Game_Player // ・プレイヤーの移動処理を再定義します。 // //========================================================================= const _Game_Player_executeMove = Game_Player.prototype.executeMove; Game_Player.prototype.executeMove = function (direction) { if (!$gameSwitches.value(Params.MoveSwitch[0])) { _Game_Player_executeMove.call(this, direction); } }; const _Game_Player_triggerButtonAction = Game_Player.prototype.triggerButtonAction; Game_Player.prototype.triggerButtonAction = function () { if ($gameSwitches.value(Params.MoveSwitch[0]) && !Params.EnterFlg[0]) { } else { _Game_Player_triggerButtonAction.call(this); } return false; }; const _Game_Player_triggerTouchAction = Game_Player.prototype.triggerTouchAction; Game_Player.prototype.triggerTouchAction = function () { if ($gameSwitches.value(Params.MoveSwitch[0]) && !Params.EnterFlg[0]) { } else { _Game_Player_triggerTouchAction.call(this); } return false; }; })();
dazed/translations
www/js/plugins/MKR_PlayerMoveForbid.js
JavaScript
unknown
7,449
//============================================================================= // MKR_PlayerSensor.js //============================================================================= // Copyright (c) 2016 マンカインド // This software is released under the MIT License. // http://opensource.org/licenses/mit-license.php // ---------------------------------------------------------------------------- // Version // 2.5.1 2020/02/27 ・パラメータ[視界範囲描画]がOFFのとき、 // 視界描画用spriteの更新を行わないように修正 // // 2.5.0 2020/01/20 ・プレイヤー追跡時、追跡者がフォロワーを // すり抜けるようになるプラグインパラメータを追加 // // 2.4.1 2020/01/20 ・プラグインパラメータ[視界範囲の色]のタイプを変更 // ・プラグインパラメータ[フキダシ表示]のタイプを変更 // // 2.4.0 2019/11/02 ・プラグインパラメータ[視界範囲描画]のスイッチ指定が // 正しく機能しないようになっていたため修正 // // 2.3.9 2019/06/02 ・探索処理停止条件を緩和。 // // 2.3.8 2019/06/02 ・前バージョンの修正が不十分だったので再修正。 // // 2.3.7 2019/06/02 ・イベント画像が設定されていないとき、 // 探索処理を行わないよう修正。 // // 2.3.6 2019/04/06 ・プレイヤー追跡時、プレイヤーが通行可能なイベントを // 探索者も通行可能にするプラグインパラメータを追加。 // ・マップ移動時、追跡症スイッチを自動的にOFFにしてくれる // プラグインパラメ―タを追加。 // // 2.3.5 2018/10/27 ・視界をイベントの下に描画するプラグインパラメータを追加。 // ・探索停止時にプレイヤー発見状態をクリアするように修正。 // ・プレイヤー発見状態の場合に、 // 強制ロストさせるコマンドを追加。 // ・全てのイベントを探索開始状態にするコマンドを追加 // ・探索状態のイベントを一時消去したときに // 探索が続けられていた問題を修正。 // // 2.3.4 2017/12/30 ・一部メモ欄のオプション指定方法でスイッチ/変数指定対応が // 不完全だったため修正。 // ・プレイヤーをロストした場合にONにできる(セルフ)スイッチの // 設定を追加。 // ・マップイベント動作中にも探索を続行できる // メモ欄オプションを追加。 // ・プラグインヘルプを一部更新 // // 2.3.3 2017/12/10 ・一部探索が正常に動作していなかったため修正。 // スイッチの切り替えが正常に動作していなかったため修正。 // // 2.3.2 2017/10/23 ・一部プラグインと併用した場合の問題を修正。 // ・プレイヤー発見時、探索者の頭上に // 任意のフキダシアイコンを表示可能に。 // ・プレイヤー発見時、任意のコモンイベントを実行可能に。 // ・プレイヤー発見時、任意のSEを再生可能に。 // ・プレイヤーロスト時、探索者の頭上に // 任意のフキダシアイコンを表示可能に。 // ・プレイヤーロスト時、任意のコモンイベントを実行可能に。 // ・プレイヤーロスト時、任意のSEを再生可能に。 // ・プラグインパラメータの指定方法を変更。 // // 2.3.1 2017/09/23 ・ver2.3.0にて、探索者が存在しないシーンで // エラーとなる問題を修正 // // 2.3.0 2017/09/21 ・一部プラグインと併用した場合の問題を修正。 // // 2.2.9 2017/08/08 ・プラグインヘルプを修正。 // ・探索者が存在しないマップでプラグインコマンドを実行すると // エラーが発生する場合があったため修正。 // // 2.2.8 2017/07/22 ・一部プラグインとの競合問題を解決。 // ・プラグインパラメーターの指定方法を変更。 // // 2.2.7 2016/01/03 ・探索者がプレイヤー発見時に条件を満たすイベントページに // 設定された画像の向きにより、 // 探索者がプレイヤーの方を向いていない // 状態で有効になったイベントが実行されていた問題を修正。 // // 2.2.6 2016/11/12 ・メモ欄にEvとRgを一緒に指定した場合、Rgが正常に機能しない // 問題を修正。 // // 2.2.5 2016/11/12 ・探索者の視界範囲がマップ上イベントオブジェクトの影響を // 受けるかどうか設定可能に。 // ・探索者の視界範囲がマップ上リージョンタイルの影響を // 受けるかどうか設定可能に。 // // 2.2.4 2016/10/10 ・マップ描画時に自動的にプラグインコマンド[PSS start]を // 実行させるためのプラグインパラメーターを追加。 // // 2.2.3 2016/10/09 ・同じマップに、同じスイッチをONにする探索者が複数存在した // 場合、イベントIDの一番大きな探索者でしかスイッチをOnに // できなかった問題を修正。 // // 2.2.2 2016/09/09 ・メモ欄の視界範囲マス数に変数を指定した場合に、 // 正常に機能していなかった問題を修正。 // ・メモ欄に設定した(スイッチの使用可能な)オプションが // 正常に機能していなかった問題を修正。 // ・メモ欄のオプション値にセルフスイッチを指定した場合に // 正常に機能していなかった問題を修正。 // // 2.2.1 2016/08/23 ・プラグインパラメーター/メモ欄に変数/スイッチを // 指定した場合、正しく値を取得できていなかった問題を修正。 // // 2.2.0 2016/08/21 ・探索者の視界範囲を変数で指定する場合の記述方法を変更。 // 変更前 : 変更後 // <PsensorL:&5> : <PsensorL:\v[5]> // 意味 : 視界範囲のマス数に変数5番の数値を使用する。 // ・メモ欄に指定するオプション文字列を変更。 // 変更前 : 変更後 : 意味 // S : Sw : 視界範囲内外で操作するスイッチ。 // B : Bo : 両サイドを視界範囲とするか。 // R : Rv : 視界範囲を描画するか。 // T : Td : 視界範囲の生成に地形を考慮するか。 // D : Di : 視界範囲の方向を指定する。 // ・メモ欄の設定に変数、スイッチを使えるように。 // ・プラグインパラメーターの設定にスイッチを使用可能に。 // // 2.1.0 2016/07/24 ・視覚範囲の種類として、ひし形、四角形を追加。 // (ただし、地形考慮には非対応) // ・探索者の視界範囲外に移動した場合に、 // 設定されたスイッチの状態をONからOFFへ切り替えるように // 仕様を変更。 // ・探索者のセルフスイッチをOFFにできるコマンドを追加。 // ・探索方向を固定化できるDオプションを追加。 // ・Bオプションの不具合を修正。 // ・イベントページが切り替わると、センサーの状態が // メモ欄の値で上書きされていた不具合を修正。 // ・プラグインの名前を変更。 // // 1.0.0 2016/07/11 ・初版公開 // ---------------------------------------------------------------------------- // [Twitter] https://twitter.com/mankind_games/ // [GitHub] https://github.com/mankindGames/ // [Blog] http://mankind-games.blogspot.jp/ //============================================================================= /*: * * @plugindesc (v2.5.1) プレイヤー探索プラグイン * @author マンカインド * * @help = プレイヤー探索プラグイン = * MKR_PlayerSensor.js * * 対象イベント(以下、探索者)の視界の範囲を描画し、 * 範囲内にプレイヤーが存在した場合、 * その探索者は発見状態となり指定されたスイッチをONにします。 * (スイッチがONの間、探索者は話しかけられた方向に振り向かないようになります) * * プレイヤーが視界範囲マス外に出た場合、 * ロスト状態となりONになったスイッチがOFFになります。 * (設定により状態移行までの時間が調整できます) * * ※ トリガー[自動実行]によるイベント動作中の場合、ゲーム動作負荷を考慮して * 探索処理は停止します。 * (イベントメモ欄で設定変更が可能です) * * * 簡単な使い方説明: * 探索者にしたいイベントのメモ欄を設定し、 * 探索者がいるマップでプラグインコマンド PSS start を実行すると、 * そのマップにいる全ての探索者が探索を開始します。 * (探索一時無効状態になっている探索者を除く) * * 探索者がいるマップでプラグインコマンド PSS force_start を実行すると、 * そのマップにいる全ての探索者が探索を開始します。 * (探索一時無効状態になっている探索者も探索を開始します) * 探索者のイベント内でプラグインコマンド PSS t_start を実行すると、 * その探索者が探索を開始します。 * (探索一時無効状態となっている探索者に対しても探索を開始させます。) * * 探索者のイベント内でプラグインコマンド PSS t_stop を実行すると、 * その探索者が探索を停止します。 * (プレイヤーを未発見として状態が更新されます。) * * 探索者がいるマップでプラグインコマンド PSS stop を実行すると、 * そのマップにいる全探索者が探索を停止します。 * (プレイヤーを未発見として状態が更新されます。) * * * メモ欄_基本設定(Xは正の整数): * <PsensorL:X> * ・探索者の前方Xマスを探索します。 * * <PsensorF:X> * ・探索者を頂点として前方にXマス、 * 左右にXマス進んだ地点の点をそれぞれ結んで形成される * 三角形の図形の範囲内を探索します。 * * <PsensorD:X> * ・探索者から上下左右にXマス進んだ点を結んで形成される、 * ひし形の図形の範囲内を探索します。 * * ・この形状の場合、地形の通行可能状態を無視します。 * (常にTdオプションが1の状態となります。) * * <PsensorS:X> * ・探索者から上下にXマス、 * 左右にXマス進んだ地点の点をそれぞれ結んで形成される * 四角形の図形の範囲内を探索します。 * * ・この形状の場合、地形の通行可能状態を無視します。 * (常にTdオプションが1の状態となります) * * <PsensorL:\V[n]> * ・視界範囲マス数を指定する部分には、 * 変数を表す制御文字である \V[n] が使用可能です。 * 変数番号N番の変数に格納されている値を * 範囲値として使用します。 * (変数の変更はリアルタイムに反映されます) * * <!PsensorL:X> * ・探索者の前方Xマスが範囲ですが、 * 先頭に ! を付けると探索一時無効状態となります。 * * ・この状態の場合、後述するプラグインコマンド:PSS start実行時点では * 探索が開始されず、 * プラグインコマンド:PSS t_start か * スクリプトコマンド:$gameSystem.onSensor(eventId) で * 個別に探索を開始させる必要があります。 * * * メモ欄_オプション(各オプションはスペースで区切る): * ・各オプションはスペースで区切ること。 * ・指定しない場合は初期値の設定が適用されます。 * * Sw[数字またはA~D] * ・探索者がプレイヤーを発見した際に * ONにするスイッチ番号またはセルフスイッチを * 探索者毎に指定します。 * * ・プレイヤーをロストした際にONになるスイッチは、 * プレイヤーを発見したときに自動的にOFFになります。 * * 例) * Sw10 : スイッチ番号10番のスイッチをONにします。 * SwC : 探索者のセルフスイッチCをONにします。 * * Bo[0~1の数字、または\S[n]] * ・探索者の両隣を探索範囲としない(0)/する(1)。 * 1 の場合、探索者の左右マスが探索範囲となります。 * * ・\S[n]はスイッチの状態を取得する制御文字です。 * Nには数値かA~Dのアルファベットが入ります。(A~Dはセルフスイッチです) * スイッチNの状態がON = 1を指定したことと同じです。 * * Rv[0~1の数字、または\S[n]] * ・探索者の視界範囲を描画しない(0)/する(1)。 * 0 の場合、探索者の視界範囲が画面に描画されません。 * (視覚的に見えなくなるだけで探索は行われます) * * ・\S[n]はスイッチの状態を取得する制御文字です。 * Nには数値かA~Dのアルファベットが入ります。(A~Dはセルフスイッチです) * スイッチNの状態がON = 1を指定したことと同じです。 * * Td[0または1、または\S[n]] * ・視界範囲の算出に視界範囲内の地形/イベントに対する * 通行可能状態を考慮しない(0)/する(1)。 * 1 の場合、視界範囲内に通行不可マスがあると視界範囲が変化します。 * * ・地形の通行可能状態を考慮する場合、 * 通行不可マスが視界範囲の対象にならず、 * 探索者から見て通行不可マスがあることによって * 死角になるマスも視覚範囲の対象になりません。 * * ・\S[n]はスイッチの状態を取得する制御文字です。 * Nには数値かA~Dのアルファベットが入ります。(A~Dはセルフスイッチです) * スイッチNの状態がON = 1を指定したことと同じです。 * * Di[U,R,L,Dどれか1文字] * ・探索者の向きを考慮せず、探索方向を固定します。 * Uは上、Rは右、Lは左、Dは下を表します。 * * Ev[0または1、または\S[n]] * ・探索者の視界範囲がマップ上の通行不可能なイベント * (プライオリティが「通常キャラと同じ」)の * 影響を受ける(1)/受けない(0)。 * 1 の場合、視界範囲内に通行不可能なマップイベントがあると * 視界範囲が変化します。 * * ・[タイルセット B]以降のタイルをイベントの画像として指定し * イベントのプライオリティが「通常キャラの下」の場合、 * タイルセットの通行可能設定が視界範囲に影響し、 * タイルセットの設定が通行不可の場合、視界範囲外となります。 * * ・視界範囲内の通行可能状態を考慮しない設定になっている場合、 * この設定は無視されます。 * * Rg[リージョン番号、または\V[n]] * ・指定した場合探索者の視界範囲がマップ上のリージョンタイルの * 影響を受けます。 * 例えば 1 を指定すると、リージョン番号1番のタイルが置かれたマスが * 壁扱いとなり、視界範囲外となります。 * * ・視界範囲内の通行可能状態を考慮しない設定になっている場合、 * この設定は無視されます。 * * Fb[フキダシ番号、または\V[n]] * ・指定した場合、探索者がプレイヤーを発見したときに * 探索者の頭上にフキダシが表示されます。 * * Fc[コモンイベント番号、または\V[n]] * ・指定した場合、探索者がプレイヤーを発見したときに * 指定したコモンイベントを実行します。 * * Fd[遅延フレーム数、または\V[n]] * ・指定した場合、探索者がプレイヤーを発見するまでの時間が * フレーム数分遅れます。 * * Lb[フキダシ番号、または\V[n]] * ・指定した場合、探索者がプレイヤーをロストしたときに * 探索者の頭上にフキダシが表示されます。 * * Lc[コモンイベント番号、または\V[n]] * ・指定した場合、探索者がプレイヤーをロストしたときに * 指定したコモンイベントを実行します。 * * Ld[遅延フレーム数、または\V[n]] * ・指定した場合、探索者がプレイヤーをロストするまでの時間が * フレーム数分遅れます。 * * Am[0または1、または\S[n]] * ・自動実行によるイベントが動作中、このオプションを設定された探索者の * 探索処理を続行する(1)/続行しない(0) * デフォルトは0です。 * * ・探索を続行する場合、自動実行イベントが動作中の場合でも * 視界範囲にプレイヤーが居るかどうかの判定が行われます。 * (対象の探索者が探索開始状態になっている場合に限ります) * * ・このオプションを1に設定された探索者は、探索開始状態の間 * 常に探索を続けるためゲーム動作負荷が上がります。 * 設定は慎重にお願いいたします。 * * Lsw[数字またはA~D] * ・探索者がプレイヤーをロストした際に * ONにするスイッチ番号またはセルフスイッチを * 探索者毎に指定します。 * * ・プレイヤーを発見した際にONになるスイッチは、 * プレイヤーをロストしたときに自動的にOFFになります。 * * 例) * Lsw11 : スイッチ番号11番のスイッチをONにします。 * LswB : 探索者のセルフスイッチBをONにします。 * * * メモ欄の設定例: * <PsensorL:7> * ・探索者の前方7マスの範囲を探索します。 * * <PsensorF:3> * ・探索者を頂点に、前方3マス左右に3マス進んだ地点を * 結んでできる三角形の図形の範囲内を探索します。 * * <PsensorL:\V[100]> * ・探索者の前方[変数番号100番]マスの範囲を探索します。 * * <PsensorL:4 SwC> * ・探索者の前方4マスの範囲を探索します。 * プレイヤー発見時に探索者のセルフスイッチCをONにします。 * * <PsensorF:5 Bo1> * ・探索者を頂点に、前方3マス左右に3マスの点を * 結んでできる三角形の図形の範囲内を探索します。 * * ・さらに探索者の両隣を探索範囲とします。 * * <PsensorL:10 Rv0> * ・探索者の前方10マスの範囲を探索しますが、 * 視界範囲の描画をしません。 * * <PsensorL:10 Rv\s[20]> * ・探索者の前方10マスの範囲を探索します。 * * ・スイッチ20番の状態がOFFの場合は * 視界範囲の描画をしません。 * * <PsensorL:10 Td0> * ・探索者の前方10マスの範囲を探索しますが、 * 視界範囲内の通行可能マス状態を考慮しません。 * * <PsensorL:10 Td\s[A]> * ・探索者の前方10マスの範囲を探索します。 * * ・セルフスイッチAの状態がOFFの場合は * 視界範囲内の通行可能マス状態を考慮しません。 * * <PsensorF:&2 Bo0 Sw1> * ・探索者を頂点に、前方[変数番号2番]マス * 左右に[変数番号2番]マス進んだ地点の点を結んでできる * 三角形の図形の範囲内を探索しますが、 * 探索者の両隣を範囲としません。 * * ・プレイヤー発見時にスイッチ番号1番のスイッチをONにします。 * * <PsensorL:7 DiR> * ・探索者の右隣7マスの範囲を探索します。 * * <PsensorF:7 DiU> * ・探索者を頂点に、上3マス左右に3マスの点を * 結んでできる三角形の図形の範囲内を探索します。 * * <PsensorL:10 Ev1 Rg10> * ・探索者の前方10マスの範囲を探索しますが、 * 視界範囲内のマップイベントの存在を考慮します。 * さらにリージョン番号10番のタイルを壁として認識します。 * * * プラグインコマンド: * PSS start * ・コマンドを実行したマップ上に存在する全ての探索者が * 探索開始処理になります。 * (探索一時無効状態の探索者は対象外です) * * PSS force_start * ・コマンドを実行したマップ上に存在する全ての探索者が * 探索開始処理になります。 * (探索一時無効状態の探索者も対象となります) * * PSS stop * ・コマンドを実行したマップ上に存在する全ての探索者が * 探索停止処理状態になります。 * (プレイヤーを未発見として状態が更新されます。) * * PSS reset X Y ... * ・コマンドを実行したマップ上に存在する全ての探索者を対象に、 * プラグインパラメーター[発見後操作スイッチ]で * 指定した(セルフ)スイッチ、 * またはSwオプションで指定した(セルフ)スイッチの * どちらかをOFFにします。(Swオプションの設定が優先されます) * * ・また、resetの後に指定した(セルフ)スイッチも * 同様にOFFにします。まとめてOFFにしたい場合に指定してください。 * (X,Y はセルフスイッチ/スイッチ番号。 * スペース区切りで記載してください) * * PSS lost * ・コマンドを実行したマップ上に存在するプレイヤー発見状態の探索者を * ロスト状態へ強制移行させます。 * (ロストするまでの時間は[プレイヤーロスト時設定]に従います) * * PSS t_start * ・このコマンドを実行した探索者を * 探索開始状態にします。 * * ・実際に探索を行わせるためには事前にPSS startコマンドの * 実行が必要です。 * * PSS t_stop * ・このコマンドを実行した探索者を探索停止状態にします。 * (プレイヤーを未発見として状態が更新されます。) * * PSS t_reset X Y ... * ・このコマンドを実行した探索者を対象に、 * プラグインパラメーター[発見後操作スイッチ]で * 指定した(セルフ)スイッチ、 * またはメモ欄のSwオプションで指定した(セルフ)スイッチの * どちらかをOFFにします。(メモ欄の設定が優先されます) * * ・"X", "Y" は(セルフ)スイッチを表し、ここに記載した(セルフ)スイッチも * 同様にOFFにします。まとめてOFFにしたい場合に指定してください。 * (セルフスイッチ/スイッチ番号はスペース区切りで記載してください) * * PSS t_lost * ・このコマンドを実行したプレイヤー発見状態の探索者を * ロスト状態へ強制移行させます。 * (ロストするまでの時間は[プレイヤーロスト時設定]に従います) * * PSS t_move X * ・このコマンドを実行した時点のプレイヤー位置に隣接する位置まで、 * このコマンドを実行したイベントを移動させます。 * * ・Xは移動速度。1~6まで対応し、 * 未指定の場合はイベントに設定されている速度を使用します。 * * ・プラグインパラメーター[通行不可タイル考慮]がOFFまたは * メモ欄のTdオプションが0の場合は * 正しく移動できない可能性があります。 * (イベントのすり抜けを有効にすることで移動可能です) * * * スクリプトコマンド: * $gameSystem.getEventSensorStatus(eventId) * ・指定したイベントIDを持つ探索者に対して探索状態を取得します。 * [戻り値] | [意味] * -1 | 探索一時無効状態 * 0 | 探索停止状態 * 1 | 探索実行状態 * * $gameSystem.onSensor(eventId) * ・指定したイベントIDを持つ探索者を探索開始状態にします。 * 探索停止/一時無効状態の探索者に対し探索を再開させる場合に使用します。 * * ・探索を開始させるためには事前にPSS start(PSS force_start)コマンドの * 実行が必要です。 * * $gameSystem.offSensor(eventId) * ・指定したイベントIDを持つ探索者を探索停止状態にします。 * (プレイヤーを未発見として状態が更新されます。) * * $gameSystem.neutralSensor(eventId, ["X","Y",...]) * ・現在のマップに存在する、指定したイベントIDを持つ探索者に対し、 * [発見後操作スイッチ]で指定した(セルフ)スイッチか、 * またはSwオプションで指定したセルフスイッチの * どちらかをOFFにします。(メモ欄の設定が優先されます) * * ・"X", "Y" は(セルフ)スイッチを表し、ここに記載した(セルフ)スイッチも * 同様にOFFにします。まとめてOFFにしたい場合に指定してください。 * (カンマ区切りで指定してください) * * $gameSystem.isFoundPlayer() * ・現在のマップで、プレイヤーが探索者に発見されている場合にtrueを返します。 * (それ以外ならfalse) * * $gameSystem.allForceLost() * ・現在のマップに存在する、プレイヤー発見状態の探索者を * ロスト状態へ強制移行させます。 * (ロストするまでの時間は[プレイヤーロスト時設定]に従います) * * $gameSystem.forceLost(eventId) * ・指定したイベントIDを持つ探索者がプレイヤー発見状態である場合、 * ロスト状態へ強制移行させます。 * (ロストするまでの時間は[プレイヤーロスト時設定]に従います) * * * 補足: * ・このプラグインに関するメモ欄の設定、プラグインコマンド、 * は大文字/小文字を区別していません。 * * ・プラグインパラメーターの説明に、[初期値]と書かれているものは * メモ欄にて個別設定が可能です。 * 設定した場合、[初期値]よりメモ欄の設定が * 優先されますのでご注意ください。 * * ・プラグインパラメーターの説明に、[変数可]と書かれているものは * 設定値に変数を表す制御文字である\V[n]を使用可能です。 * 変数を設定した場合、そのパラメーターの利用時に変数の値を * 参照するため、パラメーターの設定をゲーム中に変更できます。 * * ・プラグインパラメーターの説明に、[スイッチ可]と書かれているものは * 設定値にスイッチを表す制御文字の\S[n]を使用可能です。(Nは数値) * 指定したスイッチがONの場合はプラグインパラメーターに * ONまたは1,trueを指定したことと同じとなります。 * スイッチを設定した場合、そのパラメーターの利用時にスイッチの値を * 参照するため、パラメーターの設定をゲーム中に変更できます。 * * * 利用規約: * ・作者に無断で本プラグインの改変、再配布が可能です。 * (ただしヘッダーの著作権表示部分は残してください。) * * ・利用形態(フリーゲーム、商用ゲーム、R-18作品等)に制限はありません。 * ご自由にお使いください。 * * ・本プラグインを使用したことにより発生した問題について作者は一切の責任を * 負いません。 * * ・要望などがある場合、本プラグインのバージョンアップを行う * 可能性がありますが、 * バージョンアップにより本プラグインの仕様が変更される可能性があります。 * ご了承ください。 * * @param 探索設定 * @default ==================================== * * @param Sensor_Switch * @text 発見後操作スイッチ * @desc [初期値] プレイヤー発見時にONにするスイッチ番号またはセルフスイッチを指定。(ロスト後操作スイッチはOFFになります) * @type combo * @option A * @option B * @option C * @option D * @default D * @parent 探索設定 * * @param Lost_Sensor_Switch * @text ロスト後操作スイッチ * @desc [初期値] プレイヤーロスト時にONにするスイッチ番号またはセルフスイッチを指定。(発見後操作スイッチはOFFになります) * @type combo * @option A * @option B * @option C * @option D * @default * @parent 探索設定 * * @param Both_Sensor * @text 両隣の視界 * @desc [初期値:スイッチ可] 探索者の両隣を探索範囲とする場合はON、しない場合はOFFを指定してください。 * @type combo * @option ON * @option OFF * @default OFF * @parent 探索設定 * * @param Terrain_Decision * @text 通行不可タイル考慮 * @desc [初期値:スイッチ可] 視界範囲に通行不可タイルの存在を考慮させる場合はON、しない場合はOFFを指定してください。 * @type combo * @option ON * @option OFF * @default ON * @parent 探索設定 * * @param Auto_Sensor * @text 探索自動開始 * @desc マップ描画時に探索処理を自動的に開始する設定です。デフォルト:開始しない * @type boolean * @on 開始する * @off 開始しない * @default false * @parent 探索設定 * * @param Event_Decision * @text 他イベント考慮 * @desc [初期値:スイッチ可] 視界範囲にマップイベントの存在を考慮させる場合はON、しない場合はOFFを指定してください。 * @type combo * @option ON * @option OFF * @default OFF * @parent 探索設定 * * @param Region_Decision * @text リージョン設定 * @desc [初期値:変数可] 視界範囲外(壁扱い)とするリージョン番号を指定してください。 * @type string[] * @default [] * @parent 探索設定 * * @param Real_Range_X * @text 探索範囲X拡張 * @desc 探索範囲を指定した数値分、横に拡張します(視界描画はマス単位)。プレイヤーがピクセル単位で移動する場合に有効です。(デフォルト:0) * @type number * @decimals 3 * @max 0.999 * @min 0.000 * @default 0.000 * @parent 探索設定 * * @param Real_Range_Y * @text 探索範囲Y拡張 * @desc 探索範囲を指定した数値分、縦に拡張します(視界描画はマス単位)。プレイヤーがピクセル単位で移動する場合に有効です。(デフォルト:0) * @type number * @decimals 3 * @max 0.999 * @min 0.000 * @default 0.000 * @parent 探索設定 * * @param 視界設定 * @default ==================================== * * @param Range_Visible * @text 視界範囲描画 * @desc [初期値:スイッチ可] 探索者の視界範囲を描画する場合はON、しない場合はOFFを指定してください。 * @type combo * @option ON * @option OFF * @default ON * @parent 視界設定 * * @param Range_Color * @text 視界範囲の色 * @desc 視界範囲を描画する際の色を選択してください。デフォルト:白 * @type select * @option 白 * @value white * @option 赤 * @value red * @option 青 * @value blue * @option 黄 * @value yellow * @default white * @parent 視界設定 * * @param Range_Opacity * @text 視界範囲の不透明度 * @desc 視界範囲を描画する際の不透明度を数字で指定してください。デフォルト:80(0-255) * @type number * @min 0 * @max 255 * @default 80 * @parent 視界設定 * * @param Range_Position * @text 視界範囲位置 * @desc 探索者の視界範囲を表示する位置を選択します。デフォルト:1(イベントの上に表示する) * @type select * @option イベントの上に表示する * @value 1 * @option イベントの下に表示する * @value 2 * @default 1 * @parent 視界設定 * * @param Player_Found * @text プレイヤー発見時設定 * @desc 探索者がプレイヤーを発見した時の設定です。 * @type struct<Alert> * @default {"Ballon":"0","Se":"{\"Name\":\"\",\"Volume\":\"90\",\"Pitch\":\"100\",\"Pan\":\"0\"}","Common_Event":"0","Delay":"0"} * * @param Player_Lost * @text プレイヤーロスト時設定 * @desc 探索者がプレイヤーをロストした時の設定です。 * @type struct<Alert> * @default {"Ballon":"0","Se":"{\"Name\":\"\",\"Volume\":\"90\",\"Pitch\":\"100\",\"Pan\":\"0\"}","Common_Event":"0","Delay":"0"} * * @param マップ設定 * @default ==================================== * * @param Tracking_Priority * @text 追跡優先度 * @desc プレイヤー発見状態のイベントが他イベントの上または下を通行可能にするか設定します。(デフォルト:通行不可) * @type boolean * @on 通行可能 * @off 通行不可 * @default false * @parent マップ設定 * * @param Follower_Through * @text フォロワー無視 * @desc プレイヤー発見状態のイベントがプレイヤーのフォロワー(隊列)をすり抜けるか設定します。(デフォルト:すり抜け不可) * @type boolean * @on すり抜け可 * @off すり抜け不可 * @default false * @parent マップ設定 * * @param Location_Reset * @text マップ移動時リセット * @desc 場所移動コマンド使用時、元のマップに配置された探索者の追跡状態をリセットするか設定します。(デフォルト:リセットしない) * @type boolean * @on リセットする * @off リセットしない * @default false * @parent マップ設定 * */ /*~struct~Alert: * * @param Ballon * @text [初期値] フキダシ表示 * @desc 探索者にフキダシを表示させる場合はアイコン番号を指定します。デフォルト:表示しない * @type select * @option 表示しない * @value 0 * @option びっくり * @value 1 * @option はてな * @value 2 * @option 音符 * @value 3 * @option ハート * @value 4 * @option 怒り * @value 5 * @option 汗 * @value 6 * @option くしゃくしゃ * @value 7 * @option 沈黙 * @value 8 * @option 電球 * @value 9 * @option Zzz * @value 10 * @option ユーザー定義1 * @value 11 * @option ユーザー定義2 * @value 12 * @option ユーザー定義3 * @value 13 * @option ユーザー定義4 * @value 14 * @option ユーザー定義5 * @value 15 * @default 0 * * @param Se * @text SE設定 * @desc Seに関する設定です。 * @type struct<Se> * * @param Common_Event * @text [初期値] コモン実行 * @desc コモンイベントを実行させる場合は指定します。デフォルト:0(なし) * @type common_event * @default 0 * * @param Delay * @text [初期値] 状態移行遅延 * @desc プレイヤー発見/ロスト状態に移行するタイミングを指定したフレーム分遅らせます(60フレーム=1秒)。デフォルト:0 * @type number * @min 0 * @default 0 * */ /*~struct~Se: * * @param Name * @text ファイル名 * @desc 再生するファイルを指定します。デフォルト:空(再生しない) * @type file * @require 1 * @dir audio/se * * @param Volume * @text 再生時音量 * @desc ファイルを再生するときの音量を指定します(0から100までの数値)。デフォルト:90 * @type number * @max 100 * @min 0 * @default 90 * * @param Pitch * @text 再生時ピッチ * @desc ファイルを再生するときのピッチを指定します(50から150までの数値)。デフォルト:100 * @type number * @max 150 * @min 50 * @default 100 * * @param Pan * @text 再生時位相 * @desc ファイルを再生するときの位相を指定します(-100から100までの数値)。デフォルト:0 * @type number * @max 100 * @min -100 * @default 0 * */ (function () { 'use strict'; const PN = "MKR_PlayerSensor"; const CheckParam = function (type, name, value, def, min, max, options) { let regExp; if (min == undefined || min == null) { min = -Infinity; } if (max == undefined || max == null) { max = Infinity; } if (value == null) { value = ""; } else { value = String(value); } regExp = /^\x1bV\[\d+\]|\x1bS\[\d+\]$/i; value = value.replace(/\\/g, '\x1b'); value = value.replace(/\x1b\x1b/g, '\\'); if (!regExp.test(value)) { switch (type) { case "bool": if (value == "") { value = (def) ? true : false; } else { value = value.toUpperCase() === "ON" || value.toUpperCase() === "TRUE" || value.toUpperCase() === "1"; } break; case "num": if (value == "") { value = (isFinite(def)) ? parseInt(def, 10) : 0; } else { value = (isFinite(value)) ? parseInt(value, 10) : (isFinite(def)) ? parseInt(def, 10) : 0; value = value.clamp(min, max); } break; case "float": if (value == "") { value = (isFinite(def)) ? parseFloat(def) : 0; } else { value = (isFinite(value)) ? parseFloat(value) : (isFinite(def)) ? parseFloat(def) : 0; value = value.clamp(min, max); } break; case "string": if (value == "") { value = (def != "") ? def : value; } break; case "switch": if (value == "") { value = (def != "") ? def : value; } if (name == "Lost_Sensor_Switch" && (value == null || value == undefined)) { value = ""; } if (name != "Lost_Sensor_Switch" && !value.match(/^([A-D]|\d+)$/i)) { throw new Error('Plugin parameter value is not switch : ' + name + ' : ' + value); } break; default: throw new Error("[CheckParam] " + name + "のタイプが不正です: " + type); break; } } return [value, type, def, min, max]; }; const CEC = function (params) { let text, value, type, def, min, max; text = String(params[0]); text = text.replace(/\\/g, '\x1b'); text = text.replace(/\x1b\x1b/g, '\\'); type = params[1]; def = params[2]; min = params[3]; max = params[4]; text = convertEscapeCharacters(text); switch (type) { case "bool": if (text == "") { value = (def) ? true : false; } else { value = text === true || text.toUpperCase() === "ON" || text.toUpperCase() === "TRUE" || text.toUpperCase() === "1"; } break; case "num": value = (isFinite(text)) ? parseInt(text, 10) : (isFinite(def)) ? parseInt(def, 10) : 0; value = value.clamp(min, max); break; case "float": value = (isFinite(text)) ? parseFloat(text) : (isFinite(def)) ? parseFloat(def) : 0; value = value.clamp(min, max); break; case "string": if (text == "") { value = (def != "") ? def : value; } else { value = text; } break; case "switch": if (value == "") { value = (def != "") ? def : value; } if (!value.match(/^([A-D]|\d+)$/)) { throw new Error('Plugin parameter value is not switch : ' + param + ' : ' + value); } break; default: throw new Error('[CEC] Plugin parameter type is illegal: ' + type); break; } return value; }; const convertEscapeCharacters = function (text) { let windowChild; if (typeof text == "string") { if (SceneManager._scene && SceneManager._scene._windowLayer) { windowChild = SceneManager._scene._windowLayer.children[0]; text = windowChild ? windowChild.convertEscapeCharacters(text) : text; } else { text = ConvVb(text); } } return text; }; const ConvVb = function (text) { let num, regExp; regExp = /^\x1bV\[(\d+)\]$/i; if (typeof text == "string") { text = text.replace(/\\/g, '\x1b'); text = text.replace(/\x1b\x1b/g, '\\'); text = text.replace(regExp, function () { num = parseInt(arguments[1]); return $gameVariables.value(num); }.bind(this)); text = text.replace(regExp, function () { num = parseInt(arguments[1]); return $gameVariables.value(num); }.bind(this)); } return text; }; const ConvSw = function (text, target) { let num, key, regExp; regExp = /^\x1bV\[\d+\]$|^\x1bS\[\d+\]$/i; if (typeof text == "string") { text = text.replace(/\\/g, '\x1b'); text = text.replace(/\x1b\x1b/g, '\\'); text = text.replace(/\x1bS\[(\d+)\]/i, function () { num = parseInt(arguments[1]); return $gameSwitches.value(num); }.bind(this)); text = text.replace(/\x1bS\[([A-D])\]/i, function () { if (target) { key = [target._mapId, target._eventId, arguments[1].toUpperCase()]; return $gameSelfSwitches.value(key); } return false; }.bind(this)); if (text === true || text.toLowerCase() === "true" || text == "1") { text = 1; } else { text = 0; } } return text; }; const paramParse = function (obj) { return JSON.parse(JSON.stringify(obj, paramReplace)); }; const paramReplace = function (key, value) { try { return JSON.parse(value || null); } catch (e) { return value; } }; const Parameters = paramParse(PluginManager.parameters(PN)); let DIR_UP, DIR_DOWN, DIR_RIGHT, DIR_LEFT, DefSensorSwitch, DefBothSensor, DefRangeVisible, DefTerrainDecision, DefRangeColor, DefRangeOpacity, DefAutoSensor, DefEventDecision, DefRegionDecisions, DefRealRangeX, DefRealRangeY, DefLostSensorSwitch, DefFoundBallon, DefFoundCommon, DefFoundDelay, DefFoundSe, DefLostBallon, DefLostCommon, DefLostDelay, DefLostSe, DefRangePosition, DefTrackingPriority, DefFollowerThrough, DefLocationReset; DefSensorSwitch = CheckParam("switch", "Sensor_Switch", Parameters["Sensor_Switch"], "D"); DefLostSensorSwitch = CheckParam("switch", "Lost_Sensor_Switch", Parameters["Lost_Sensor_Switch"]); DefBothSensor = CheckParam("bool", "Both_Sensor", Parameters["Both_Sensor"], false); DefRangeVisible = CheckParam("bool", "Range_Visible", Parameters["Range_Visible"], true); DefTerrainDecision = CheckParam("bool", "Terrain_Decision", Parameters["Terrain_Decision"], false); DefRangeColor = CheckParam("string", "Range_Color", Parameters["Range_Color"], "white"); DefRangeOpacity = CheckParam("num", "Range_Opacity", Parameters["Range_Opacity"], 80, 0, 255); DefRangePosition = CheckParam("num", "Range_Position", Parameters["Range_Position"], 1); DefAutoSensor = CheckParam("bool", "Auto_Sensor", Parameters["Auto_Sensor"], false); DefEventDecision = CheckParam("bool", "Event_Decision", Parameters["Event_Decision"], false); DefRegionDecisions = []; Parameters["Region_Decision"].forEach(function (region) { DefRegionDecisions.push(CheckParam("string", "Region_Decision", region, 0)); }); DefRealRangeX = CheckParam("float", "Real_Range_X", Parameters["Real_Range_X"], 0.000, 0.000, 0.999); DefRealRangeY = CheckParam("float", "Real_Range_Y", Parameters["Real_Range_Y"], 0.000, 0.000, 0.999); DefFoundBallon = CheckParam("num", "Player_Found.Ballon", Parameters["Player_Found"]["Ballon"], 0, 0); DefFoundCommon = CheckParam("num", "Player_Found.Common_Event", Parameters["Player_Found"]["Common_Event"], 0, 0); DefFoundDelay = CheckParam("num", "Player_Found.Delay", Parameters["Player_Found"]["Delay"], 0, 0); DefFoundSe = { "name": CheckParam("string", "Player_Found.Se.Name", Parameters["Player_Found"]["Se"]["Name"], "")[0], "volume": CheckParam("num", "Player_Found.Se.Volume", Parameters["Player_Found"]["Se"]["Volume"], 90, 0, 100)[0], "pitch": CheckParam("num", "Player_Found.Se.Pitch", Parameters["Player_Found"]["Se"]["Pitch"], 100, 50, 150)[0], "pan": CheckParam("num", "Player_Found.Se.Pan", Parameters["Player_Found"]["Se"]["Pan"], 0, -100, 100)[0], } DefLostBallon = CheckParam("num", "Player_Lost.Ballon", Parameters["Player_Lost"]["Ballon"], 0, 0); DefLostCommon = CheckParam("num", "Player_Lost.Common_Event", Parameters["Player_Lost"]["Common_Event"], 0, 0); DefLostDelay = CheckParam("num", "Player_Lost.Delay", Parameters["Player_Lost"]["Delay"], 0, 0); DefLostSe = { "name": CheckParam("string", "Player_Lost.Se.Name", Parameters["Player_Lost"]["Se"]["Name"], "")[0], "volume": CheckParam("num", "Player_Lost.Se.Volume", Parameters["Player_Lost"]["Se"]["Volume"], 90, 0, 100)[0], "pitch": CheckParam("num", "Player_Lost.Se.Pitch", Parameters["Player_Lost"]["Se"]["Pitch"], 100, 50, 150)[0], "pan": CheckParam("num", "Player_Lost.Se.Pan", Parameters["Player_Lost"]["Se"]["Pan"], 0, -100, 100)[0], } DefTrackingPriority = CheckParam("bool", "Tracking_Priority", Parameters["Tracking_Priority"], false); DefFollowerThrough = CheckParam("bool", "Follower_Through", Parameters["Follower_Through"], false); DefLocationReset = CheckParam("bool", "Location_Reset", Parameters["Location_Reset"], false); DIR_UP = 8; DIR_DOWN = 2; DIR_RIGHT = 6; DIR_LEFT = 4; //========================================================================= // Game_Interpreter // ・プレイヤー探索制御プラグインコマンド // ・イベントをプレイヤー近くまで移動させるコマンド // を定義 //========================================================================= const _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand; Game_Interpreter.prototype.pluginCommand = function (command, args) { _Game_Interpreter_pluginCommand.call(this, command, args); if (command.toLowerCase() === "pss") { switch (args[0].toLowerCase()) { case "start":// 探索開始 $gameSystem.startSensor(); break; case "force_start":// 全て探索開始 $gameSystem.startSensor(1); break; case "stop":// 探索停止 $gameSystem.stopSensor(); break; case "reset":// 全探索者のセルフスイッチ初期化 $gameSystem.resetSensor(args); break; case "lost":// 発見状態の探索者を強制ロスト状態に移行させる $gameSystem.allForceLost(); break; case "t_start":// 対象探索者を探索開始状態にする $gameSystem.onSensor(this.eventId()); break; case "t_stop":// 対象探索者を探索停止状態にする $gameSystem.offSensor(this.eventId()); break; case "t_reset":// 対象探索者のセルフスイッチ初期化 $gameSystem.neutralSensor(this.eventId(), args); break; case "t_move":// 対象探索者をプレイヤーの位置付近まで移動 this.moveNearPlayer(args[1]); break; case "t_lost":// 対象探索者を強制ロスト状態に移行させる $gameSystem.forceLost(this.eventId()); break; } } }; Game_Interpreter.prototype.moveNearPlayer = function (speed) { let event, oldSpeed, newSpeed, list, sx, sy, i, direction; event = $gameMap.event(this._eventId); oldSpeed = event.moveSpeed(); newSpeed = oldSpeed; sx = Math.abs(event.deltaXFrom($gamePlayer.x)); sy = Math.abs(event.deltaYFrom($gamePlayer.y)); list = []; if (event) { // 移動スピード設定 if (speed && isFinite(speed) && speed > 0) { newSpeed = parseInt(speed, 10); } // 移動ルート設定 list.push({ "code": 29, "parameters": [newSpeed] }, { "code": 25 }) for (i = 1; i < sx + sy; i++) { list.push({ "code": 10 }); } list.push({ "code": 25 }, { "code": 29, "parameters": [oldSpeed] }, { "code": 0 }); // 移動開始 this.setWaitMode('route'); event.forceMoveRoute({ "list": list, "repeat": false, "skippable": true, "wait": true }); } }; Game_Interpreter.prototype.setupReservedCommonEventEx = function (eventId) { if ($gameTemp.isCommonEventReserved()) { this.setup($gameTemp.reservedCommonEvent().list, eventId); $gameTemp.clearCommonEvent(); return true; } else { return false; } }; //========================================================================= // Game_System // プレイヤー探索制御を定義 //========================================================================= const _Game_System_initialize = Game_System.prototype.initialize; Game_System.prototype.initialize = function () { _Game_System_initialize.call(this); this._sensorStart = false this._switchStatuses = {}; }; Game_System.prototype.startSensor = function (type) { if (!type) { type = 0; } this.setSensorStart(true); this.setSensorStatusAll(1, type); this.setViewRangeStatusAll(2); }; Game_System.prototype.stopSensor = function () { this.setSensorStart(false); this.setSensorStatusAll(0); this.setViewRangeStatusAll(0); }; Game_System.prototype.resetSensor = function (args) { $gameMap.events().forEach(function (event) { if (event.getSensorType() != null) { $gameSystem.neutralSensor(event.eventId(), args) } }, this); }; Game_System.prototype.onSensor = function (eventId) { let event = $gameMap.event(eventId); if (event && event.getSensorType() != null) { event.setSensorStatus(1); } }; Game_System.prototype.offSensor = function (eventId) { let event = $gameMap.event(eventId); if (event && event.getSensorType() != null) { event.setSensorStatus(0); event.setFoundStatus(0); } }; Game_System.prototype.neutralSensor = function (eventId, args) { let mapId, event, sw, switches, sensorSwitch; mapId = $gameMap.mapId(); event = $gameMap.event(eventId); switches = []; if (args && args.length >= 2) { switches = args.slice(1); } sensorSwitch = DefSensorSwitch[0]; if (event) { if (event.getSensorType() != null) { sw = (event.getSensorSwitch() != null) ? event.getSensorSwitch() : sensorSwitch; switches.push(sw); switches.forEach(function (sw) { if (isFinite(sw)) { $gameSwitches.setValue(sw, false); } else if (sw.match(/[a-dA-D]/)) { $gameSelfSwitches.setValue([mapId, eventId, sw.toUpperCase()], false); } }, this) } } }; Game_System.prototype.isSensorStart = function () { return this._sensorStart; }; Game_System.prototype.setSensorStart = function (sensorStart) { this._sensorStart = sensorStart || false; }; Game_System.prototype.getSensorStart = function () { return this._sensorStart; }; Game_System.prototype.setSensorStatusAll = function (status, type) { if (!type) { type = 0; } if (type) { $gameMap.events().forEach(function (event) { if (event.getSensorType() != null) { event.setSensorStatus(status); event.setFoundStatus(0); } }, this); return; } $gameMap.events().forEach(function (event) { if (event.getSensorType() != null && event.getSensorStatus() != -1) { event.setSensorStatus(status); event.setFoundStatus(0); } }, this); } Game_System.prototype.setViewRangeStatusAll = function (status) { $gameMap.events().forEach(function (event) { if (event.getSensorType() != null) event.setViewRangeStatus(status); }, this); } Game_System.prototype.getEventSensorStatus = function (eventId) { let event; if (eventId && isFinite(eventId) && $gameMap.event(eventId)) { event = $gameMap.event(eventId); return event.getSensorStatus(); } else { return null; } }; Game_System.prototype.getSwitchStatuses = function () { return this._switchStatuses; }; Game_System.prototype.setSwitchStatuses = function (sw, eventId) { if (this._switchStatuses[sw]) { if (this._switchStatuses[sw] instanceof Array && this._switchStatuses[sw].length > 0) { if (!this._switchStatuses[sw].contains(eventId)) { this._switchStatuses[sw].push(eventId); } } else { this._switchStatuses[sw] = [eventId]; } } else { this._switchStatuses[sw] = [eventId]; } }; Game_System.prototype.isSwitchStatuses = function (sw, eventId) { if (!sw || !isFinite(sw)) { return false; } if (this._switchStatuses[sw]) { if (eventId == null) { return true; } else { if (this._switchStatuses[sw] instanceof Array && this._switchStatuses[sw].length > 0) { if (this._switchStatuses[sw].contains(eventId)) { return true; } } } } return false; }; Game_System.prototype.removeSwitchStatuses = function (sw, eventId) { if (this._switchStatuses[sw]) { if (!eventId) { delete this._switchStatuses[sw]; } else { if (this._switchStatuses[sw] instanceof Array && this._switchStatuses[sw].length > 0) { if (this._switchStatuses[sw].contains(eventId)) { this._switchStatuses[sw].some(function (v, i) { if (v == eventId) { this._switchStatuses[sw].splice(i, 1); } }, this); } } if (this._switchStatuses[sw].length == 0) { delete this._switchStatuses[sw]; } } } }; Game_System.prototype.isFoundPlayer = function () { if (!this.isSensorStart()) return false; return $gameMap.events().some(function (event) { // return event.getSensorStatus() == 1 && event.getFoundStatus() == 1; return event.isSensorFound(); }); }; Game_System.prototype.allForceLost = function () { if (!this.isSensorStart()) return false; $gameMap.events().filter(function (event) { return event.getFoundStatus() == 1; }).forEach(function (event) { event.setForceLost(1); }); }; Game_System.prototype.forceLost = function (eventId) { let event; if (!this.isSensorStart()) return false; if (!eventId || !isFinite(eventId) || !$gameMap.event(eventId)) { return; } event = $gameMap.event(eventId); if (event.getFoundStatus() != 1) return false; event.setForceLost(1); }; //========================================================================= // Game_Player // 場所移動を行った際に追跡状態をリセットする処理を定義します。 // //========================================================================= const _Game_Player_reserveTransfer = Game_Player.prototype.reserveTransfer; Game_Player.prototype.reserveTransfer = function (mapId, x, y, d, fadeType) { if (DefLocationReset[0] && !$gameParty.inBattle() && !$gameMessage.isBusy()) { $gameSystem.resetSensor(); } _Game_Player_reserveTransfer.apply(this, arguments); }; //========================================================================= // Game_CharacterBase // プレイヤー探索制御用メンバーを追加定義し、 // センサー状態を変更する処理を再定義します。 // // センサー状態: // -2 = センサー初期化前 // -1 = 探索一時停止 // 0 = 探索停止 // 1 = 探索中 // 視界描画状態: // 0 = 描画停止 // 1 = 描画更新 // 2 = 描画新規 // 発見状態: // 0 = 未発見 // 1 = 発見済み // 強制ロスト: // 0 = 無効 // 1 = 設定反映ロスト // 2 = 即ロスト //========================================================================= const _Game_CharacterBaseInitMembers = Game_CharacterBase.prototype.initMembers; Game_CharacterBase.prototype.initMembers = function () { _Game_CharacterBaseInitMembers.call(this); let foundBallon, foundCommon, foundSe, foundDelay, lostBallon, lostCommon, lostSe, lostDelay; foundBallon = DefFoundBallon[0]; foundCommon = DefFoundCommon[0]; foundSe = DefFoundSe; foundDelay = DefFoundDelay[0]; lostBallon = DefLostBallon[0]; lostCommon = DefLostCommon[0]; lostSe = DefLostSe; lostDelay = DefLostDelay[0]; this._foundStatus = 0; this._sensorStatus = -2; this._sensorType = null; this._sensorRange = 0; this._sensorRangeC = 0; this._bothSensorR = false; this._bothSensorL = false; this._viewRangeStatus = 0; this._coordinate = []; this._sensorSwitch = null; this._lostSensorSwitch = null; this._sideSensor = -1; this._rangeVisible = -1; this._terrainDecision = -1; this._directionFixed = -1; this._eventDecision = -1; this._regionDecision = ""; this._createRange = false; this._foundBallon = foundBallon; this._foundCommon = foundCommon; this._foundSe = foundSe; this._foundMaxDelay = foundDelay; this._foundDelay = this._foundMaxDelay; this._lostBallon = lostBallon; this._lostCommon = lostCommon; this._lostSe = lostSe; this._lostMaxDelay = lostDelay; this._lostDelay = this._lostMaxDelay; this._activeMode = 0; this._forceLost = 0; }; const _Game_CharacterBaseMoveStraight = Game_CharacterBase.prototype.moveStraight; Game_CharacterBase.prototype.moveStraight = function (d) { let status = (this.direction() == d) ? 1 : 2; _Game_CharacterBaseMoveStraight.call(this, d); if (this.isMovementSucceeded() && d && this.getSensorStatus() == 1) { this.setViewRangeStatus(status); } }; const _Game_CharacterBaseMoveDiagonally = Game_CharacterBase.prototype.moveDiagonally; Game_CharacterBase.prototype.moveDiagonally = function (horz, vert) { _Game_CharacterBaseMoveDiagonally.call(this, horz, vert); if (this.isMovementSucceeded() && this.getSensorStatus() == 1) { this.setViewRangeStatus(2); } }; const _Game_CharacterBaseSetDirection = Game_CharacterBase.prototype.setDirection; Game_CharacterBase.prototype.setDirection = function (d) { let status = (this.direction() == d) ? 1 : 2; if (!this.isDirectionFixed() && d && this.getSensorStatus() == 1) { this.setViewRangeStatus(status); } _Game_CharacterBaseSetDirection.call(this, d); } Game_CharacterBase.prototype.startViewRange = function () { this.setViewRangeStatus(1); }; Game_CharacterBase.prototype.setSensorStatus = function (sensorStatus) { this._sensorStatus = sensorStatus; }; Game_CharacterBase.prototype.getSensorStatus = function () { return this._sensorStatus; }; Game_CharacterBase.prototype.setFoundStatus = function (foundStatus) { this._foundStatus = foundStatus; }; Game_CharacterBase.prototype.getFoundStatus = function () { return this._foundStatus; }; Game_CharacterBase.prototype.setSensorType = function (sensorType) { this._sensorType = sensorType; }; Game_CharacterBase.prototype.getSensorType = function () { return this._sensorType; }; Game_CharacterBase.prototype.setSensorRange = function (sensorRange) { this._sensorRange = sensorRange; }; Game_CharacterBase.prototype.getSensorRange = function () { let value; value = parseInt(ConvVb(this._sensorRange), 10); return this.getSensorType() == "df" ? value % 2 ? 2 : value : value; }; Game_CharacterBase.prototype.setSensorRangeC = function (sensorRangeC) { this._sensorRangeC = sensorRangeC; }; Game_CharacterBase.prototype.getSensorRangeC = function () { let value; value = parseInt(ConvVb(this._sensorRangeC), 10); return this.getSensorType() == "df" ? value % 2 ? 2 : value : value; }; Game_CharacterBase.prototype.setViewRangeStatus = function (viewRangeStatus) { this._viewRangeStatus = viewRangeStatus; }; Game_CharacterBase.prototype.getViewRangeStatus = function () { return this._viewRangeStatus; }; Game_CharacterBase.prototype.setCoordinate = function (x, y, status) { this._coordinate.push([x, y, status, -1]); }; Game_CharacterBase.prototype.getCoordinate = function () { return this._coordinate; }; Game_CharacterBase.prototype.clearCoordinate = function () { this._coordinate = []; }; Game_CharacterBase.prototype.setBothSensorRight = function (bothSensor) { this._bothSensorR = bothSensor; }; Game_CharacterBase.prototype.getBothSensorRight = function () { return this._bothSensorR; }; Game_CharacterBase.prototype.setBothSensorLeft = function (bothSensor) { this._bothSensorL = bothSensor; }; Game_CharacterBase.prototype.getBothSensorLeft = function () { return this._bothSensorL; }; Game_CharacterBase.prototype.setBothSensor = function (bothSensor) { this._sideSensor = bothSensor; }; Game_CharacterBase.prototype.getBothSensor = function () { return parseInt(ConvSw(this._sideSensor, this), 10); }; Game_CharacterBase.prototype.setSensorSwitch = function (sensorSwitch) { if (isFinite(sensorSwitch)) { this._sensorSwitch = parseInt(sensorSwitch, 10); } else if (sensorSwitch.toLowerCase().match(/[a-d]/)) { this._sensorSwitch = sensorSwitch.toUpperCase(); } }; Game_CharacterBase.prototype.getSensorSwitch = function () { return this._sensorSwitch; }; Game_CharacterBase.prototype.setLostSensorSwitch = function (sensorSwitch) { if (isFinite(sensorSwitch)) { this._lostSensorSwitch = parseInt(sensorSwitch, 10); } else if (sensorSwitch.toLowerCase().match(/[a-d]/)) { this._lostSensorSwitch = sensorSwitch.toUpperCase(); } }; Game_CharacterBase.prototype.getLostSensorSwitch = function () { return this._lostSensorSwitch; }; Game_CharacterBase.prototype.setRangeVisible = function (rangeVisible) { this._rangeVisible = rangeVisible; }; Game_CharacterBase.prototype.getRangeVisible = function () { return parseInt(ConvSw(this._rangeVisible, this), 10); }; Game_CharacterBase.prototype.setTerrainDecision = function (terrainDecision) { this._terrainDecision = terrainDecision; }; Game_CharacterBase.prototype.getTerrainDecision = function () { return parseInt(ConvSw(this._terrainDecision, this), 10); }; Game_CharacterBase.prototype.setEventDecision = function (eventDecision) { this._eventDecision = eventDecision; }; Game_CharacterBase.prototype.getEventDecision = function () { return parseInt(ConvSw(this._eventDecision, this), 10); }; Game_CharacterBase.prototype.setRegionDecision = function (regionDecision) { this._regionDecision = String(regionDecision); }; Game_CharacterBase.prototype.getRegionDecision = function () { return parseInt(ConvVb(this._regionDecision), 10); }; Game_CharacterBase.prototype.setDirectionFixed = function (directionFixed) { let direction; switch (directionFixed) { case "u": direction = DIR_UP; break; case "r": direction = DIR_RIGHT; break; case "l": direction = DIR_LEFT; break; case "d": direction = DIR_DOWN; break; default: direction = -1; } this._directionFixed = parseInt(direction, 10); }; Game_CharacterBase.prototype.getDirectionFixed = function () { return this._directionFixed; }; Game_CharacterBase.prototype.isMapPassableEx = function (x, y, d) { let x2, y2, d2, passableFlag, events, eventDecision, regionDecisions; x2 = $gameMap.roundXWithDirection(x, d); y2 = $gameMap.roundYWithDirection(y, d); d2 = this.reverseDir(d); eventDecision = CEC(DefEventDecision); regionDecisions = getRegionIds(DefRegionDecisions, this.getRegionDecision()); passableFlag = true; if ($gameMap.isPassable(x, y, d) && $gameMap.isPassable(x2, y2, d2)) { if (this.getEventDecision() == 1 || (this.getEventDecision() == -1 && eventDecision)) { events = $gameMap.eventsXyNt(x2, y2); passableFlag = !events.some(function (event) { return event.isNormalPriority(); }); } if (regionDecisions.length > 0 && passableFlag == true) { passableFlag = !regionDecisions.contains("" + $gameMap.regionId(x2, y2)); } } else { passableFlag = false; } return passableFlag; }; Game_CharacterBase.prototype.isCreateRange = function () { return this._createRange; }; Game_CharacterBase.prototype.enableCreateRange = function () { this._createRange = true; }; Game_CharacterBase.prototype.setFoundBallon = function (ballon) { this._foundBallon = ballon; }; Game_CharacterBase.prototype.getFoundBallon = function () { return parseInt(ConvVb(this._foundBallon), 10); }; Game_CharacterBase.prototype.setFoundCommon = function (common) { this._foundCommon = common; }; Game_CharacterBase.prototype.getFoundCommon = function () { return parseInt(ConvVb(this._foundCommon), 10); }; Game_CharacterBase.prototype.setFoundDelay = function (delay) { this._foundDelay = parseInt(ConvVb(delay), 10); }; Game_CharacterBase.prototype.getFoundDelay = function () { return this._foundDelay; }; Game_CharacterBase.prototype.resetFoundDelay = function () { this._foundDelay = this.getFoundMaxDelay(); }; Game_CharacterBase.prototype.setFoundMaxDelay = function (delay) { this._foundMaxDelay = delay; }; Game_CharacterBase.prototype.getFoundMaxDelay = function () { return parseInt(ConvVb(this._foundMaxDelay), 10); }; Game_CharacterBase.prototype.setLostBallon = function (ballon) { this._lostBallon = ballon; }; Game_CharacterBase.prototype.getLostBallon = function () { return parseInt(ConvVb(this._lostBallon), 10); }; Game_CharacterBase.prototype.setLostCommon = function (common) { this._lostCommon = common; }; Game_CharacterBase.prototype.getLostCommon = function () { return parseInt(ConvVb(this._lostCommon), 10); }; Game_CharacterBase.prototype.setLostDelay = function (delay) { this._lostDelay = parseInt(ConvVb(delay), 10); }; Game_CharacterBase.prototype.getLostDelay = function () { return this._lostDelay; }; Game_CharacterBase.prototype.resetLostDelay = function () { this._lostDelay = this.getLostMaxDelay(); }; Game_CharacterBase.prototype.setLostMaxDelay = function (delay) { this._lostMaxDelay = delay; }; Game_CharacterBase.prototype.getLostMaxDelay = function () { return parseInt(ConvVb(this._lostMaxDelay), 10); }; Game_CharacterBase.prototype.setActiveMode = function (mode) { this._activeMode = mode; }; Game_CharacterBase.prototype.getActiveMode = function () { return parseInt(ConvSw(this._activeMode, this), 10);; }; Game_CharacterBase.prototype.setForceLost = function (forceLost) { this._forceLost = forceLost; }; Game_CharacterBase.prototype.getForceLost = function () { return this._forceLost; }; Game_CharacterBase.prototype.isSensorFound = function () { return this.getSensorStatus() == 1 && this.getFoundStatus() == 1; }; //========================================================================= // Game_Map // 探索開始処理の自動実行を定義します。 //========================================================================= if (DefAutoSensor[0]) { const _Game_Map_setupEvents = Game_Map.prototype.setupEvents; Game_Map.prototype.setupEvents = function () { _Game_Map_setupEvents.call(this); $gameSystem.startSensor(); }; } //========================================================================= // Game_Event // プレイヤーとの距離を測り // 指定範囲内にプレイヤーがいる場合に指定されたスイッチをONにします。 //========================================================================= const _Game_EventSetupPageSettings = Game_Event.prototype.setupPageSettings; Game_Event.prototype.setupPageSettings = function () { _Game_EventSetupPageSettings.call(this); if (this.getSensorStatus() == -2) { this.setupSensor(); } // if($gameSystem.isFoundPlayer() == this.eventId()) { // this.turnTowardPlayer(); // } }; Game_Event.prototype.setupSensor = function () { let event, pattern, match, note, cnt, i, n, m, options, op, value; event = this.event(); pattern = /<(.?)(?:psensor)(l|f|s|d)?(?:\:)(\\v\[\d+\]|\d+)([ 0-9a-z\[\]\\]*)?>/i if (event.note) { note = event.note.toLowerCase(); note = note.split(/ (?=<)/); cnt = note.length; for (i = 0; i < cnt; i++) { n = note[i].trim(); if (n.match(pattern)) { match = n.match(pattern); if (match[1] && match[1] == "!") { // 探索一時無効 this.setSensorStatus(-1); } switch (match[2]) { // 探索種別 case "l": case "f": case "s": case "d": this.setSensorType(match[2]); break; default: continue; break; } if (match[3]) { // 探索対象マス数 value = String(match[3]); value = value.replace(/\\/g, '\x1b'); value = value.replace(/\x1b\x1b/g, '\\'); if (this.getSensorType() == "df" && isFinite(value) && (value <= 1 || (value % 2))) { value = 2; } this.setSensorRange(value); this.setSensorRangeC(value); } if (match[4]) { // オプション options = match[4].trim().split(" "); options.forEach(function (op) { op = op.replace(/\\/g, '\x1b'); op = op.replace(/\x1b\x1b/g, '\\'); if (op.match(/^sw([a-d]|\d+)$/)) { // スイッチ指定 m = op.match(/^sw([a-d]|\d+)$/); this.setSensorSwitch(m[1]); } else if (op.match(/^lsw([a-d]|\d+)$/)) { // ロストスイッチ指定 m = op.match(/^lsw([a-d]|\d+)$/); this.setLostSensorSwitch(m[1]); } else if (op.match(/^bo([0-1]|\x1bs\[(\d+|[a-d])\])$/)) { // 両隣探索指定 m = op.match(/^bo([0-1]|\x1bs\[(\d+|[a-d])\])$/); this.setBothSensor(m[1]); } else if (op.match(/^rv([0-1]|\x1bs\[(\d+|[a-d])\])$/)) { // 描画指定 m = op.match(/^rv([0-1]|\x1bs\[(\d+|[a-d])\])$/); this.setRangeVisible(m[1]); } else if (op.match(/^td([0-1]|\x1bs\[(\d+|[a-d])\])$/)) { // 地形考慮指定 m = op.match(/^td([0-1]|\x1bs\[(\d+|[a-d])\])$/); this.setTerrainDecision(m[1]); } else if (op.match(/^di([urld])$/)) { // 探索方向固定 m = op.match(/^di([urld])$/); this.setDirectionFixed(m[1]); } else if (op.match(/^ev([0-1]|\x1bs\[(\d+|[a-d])\])$/)) { // イベント考慮指定 m = op.match(/^ev([0-1]|\x1bs\[(\d+|[a-d])\])$/); this.setEventDecision(m[1]); } else if (op.match(/^rg(\d+|\x1bv\[(\d+)\])$/)) { // リージョン考慮指定 m = op.match(/^rg(\d+|\x1bv\[(\d+)\])$/); this.setRegionDecision(m[1]); } else if (op.match(/^fb(\d+|\x1bv\[(\d+)\])$/)) { // 発見フキダシ指定 m = op.match(/^fb(\d+|\x1bv\[(\d+)\])$/); this.setFoundBallon(m[1]); } else if (op.match(/^fc(\d+|\x1bv\[(\d+)\])$/)) { // 発見コモン指定 m = op.match(/^fc(\d+|\x1bv\[(\d+)\])$/); this.setFoundCommon(m[1]); } else if (op.match(/^fd(\d+|\x1bv\[(\d+)\])$/)) { // 発見遅延指定 m = op.match(/^fd(\d+|\x1bv\[(\d+)\])$/); this.setFoundMaxDelay(m[1]); this.setFoundDelay(m[1]); } else if (op.match(/^lb(\d+|\x1bv\[(\d+)\])$/)) { // ロストフキダシ指定 m = op.match(/^lb(\d+|\x1bv\[(\d+)\])$/); this.setLostBallon(m[1]); } else if (op.match(/^lc(\d+|\x1bv\[(\d+)\])$/)) { // ロストコモン指定 m = op.match(/^lc(\d+|\x1bv\[(\d+)\])$/); this.setLostCommon(m[1]); } else if (op.match(/^ld(\d+|\x1bv\[(\d+)\])$/)) { // ロスト遅延指定 m = op.match(/^ld(\d+|\x1bv\[(\d+)\])$/); this.setLostMaxDelay(m[1]); this.setLostDelay(m[1]); } else if (op.match(/^am([0-1]|\x1bs\[(\d+|[a-d])\])$/)) { // 探索続行指定 m = op.match(/^am([0-1]|\x1bs\[(\d+|[a-d])\])$/); this.setActiveMode(m[1]); } }, this); } } } } }; const _Game_EventUpdate = Game_Event.prototype.update; Game_Event.prototype.update = function () { _Game_EventUpdate.call(this); // if(!this._erased && $gameSystem.isSensorStart()) { if (!this.isInvisible() && $gameSystem.isSensorStart()) { this.sensorUpdate(); } }; Game_Event.prototype.sensorUpdate = function () { // 探索中のイベントであること // マップイベント実行中でないこと or 探索続行オプションが付与されている if (this.getSensorStatus() == 1 && (!this.isStarting() || this.getActiveMode() == 1)) { // プレイヤーを発見して、かつ強制ロストが無効 if (this.isFoundPlayer() && this.getForceLost() == 0) { if (this.getFoundStatus() == 0) { this.foundPlayer(); } if (this.getLostDelay() < this.getLostMaxDelay()) this.resetLostDelay(); // プレイヤー発見状態または、強制ロストが有効 } else if (this.getFoundStatus() == 1 || this.getForceLost() > 0) { this.lostPlayer(); if (this.getFoundDelay() < this.getFoundMaxDelay()) { this.resetFoundDelay(); this.setForceLost(0); } } else { if (this.getFoundDelay() < this.getFoundMaxDelay()) { this.resetFoundDelay(); this.setForceLost(0); } } } // // 探索中のイベントであること // if(this.getSensorStatus() == 1){ // // マップイベント実行中でないこと or 探索続行オプションが付与されている // if(!this.isStarting() || this.getActiveMode() == 1) { // if(this.isFoundPlayer()) { // if(this.getFoundStatus() == 0) { // this.foundPlayer(); // } // if(this.getLostDelay() < this.getLostMaxDelay()) this.resetLostDelay(); // } else if(this.getFoundStatus() == 1) { // this.lostPlayer(); // if(this.getFoundDelay() < this.getFoundMaxDelay()) this.resetFoundDelay(); // } else { // if(this.getFoundDelay() < this.getFoundMaxDelay()) this.resetFoundDelay(); // } // } // } }; Game_Event.prototype.foundPlayer = function () { let mapId, eventId, sw, key, sensorSwitch, delay, lostSensorSwitch; delay = this.getFoundDelay(); if (delay <= 0) { sensorSwitch = DefSensorSwitch[0]; lostSensorSwitch = DefLostSensorSwitch[0]; mapId = $gameMap.mapId(); eventId = this.eventId(); this.setFoundStatus(1); this.resetFoundDelay(); this.resetLostDelay(); // 発見後スイッチON sw = (this.getSensorSwitch() != null) ? this.getSensorSwitch() : sensorSwitch; if (isFinite(sw)) { if (!$gameSwitches.value(sw)) { $gameSwitches.setValue(sw, true); } // $gameSystem.setSwitchStatuses(sw, eventId); } else if (sw.match(/[a-dA-D]/)) { key = [mapId, eventId, sw.toUpperCase()]; if (!$gameSelfSwitches.value(key)) { $gameSelfSwitches.setValue(key, true); } } // ロスト後スイッチOFF sw = (this.getLostSensorSwitch() != null) ? this.getLostSensorSwitch() : lostSensorSwitch; if (sw != "") { if (isFinite(sw)) { if ($gameSwitches.value(sw)) { $gameSwitches.setValue(sw, false); } } else if (sw.match(/[a-dA-D]/)) { key = [mapId, eventId, sw.toUpperCase()]; if ($gameSelfSwitches.value(key)) { $gameSelfSwitches.setValue(key, false); } } } if (this._foundSe.name != "") { AudioManager.playSe(this._foundSe); } if (this._foundBallon > 0) { this.requestBalloon(this._foundBallon); } if (this._foundCommon > 0) { $gameTemp.reserveCommonEvent(this._foundCommon); if ($gameMap._interpreter) { $gameMap._interpreter.setupReservedCommonEventEx(this.eventId()); } } } else { this.setFoundDelay(--delay); // console.log("foundDelay:"+this.getFoundDelay()); } }; Game_Event.prototype.lostPlayer = function () { let mapId, eventId, sw, key, sensorSwitch, delay, lostSensorSwitch; delay = this.getLostDelay(); if (delay <= 0) { sensorSwitch = DefSensorSwitch[0]; lostSensorSwitch = DefLostSensorSwitch[0]; mapId = $gameMap.mapId(); eventId = this.eventId(); this.setForceLost(0); this.setFoundStatus(0); this.resetLostDelay(); this.resetFoundDelay(); // 発見後スイッチOFF sw = (this.getSensorSwitch() != null) ? this.getSensorSwitch() : sensorSwitch; if (isFinite(sw)) { // if($gameSwitches.value(sw) && !$gameSystem.isSwitchStatuses(sw)) { if ($gameSwitches.value(sw)) { $gameSwitches.setValue(sw, false); } // $gameSystem.removeSwitchStatuses(sw, eventId); } else if (sw.match(/[a-dA-D]/)) { key = [mapId, eventId, sw.toUpperCase()]; if ($gameSelfSwitches.value(key)) { $gameSelfSwitches.setValue(key, false); } } // ロスト後スイッチON sw = (this.getLostSensorSwitch() != null) ? this.getLostSensorSwitch() : lostSensorSwitch; if (sw != "") { if (isFinite(sw)) { if (!$gameSwitches.value(sw)) { $gameSwitches.setValue(sw, true); } } else if (sw.match(/[a-dA-D]/)) { key = [mapId, eventId, sw.toUpperCase()]; if (!$gameSelfSwitches.value(key)) { $gameSelfSwitches.setValue(key, true); } } } if (this._lostSe.name != "") { AudioManager.playSe(this._lostSe); } if (this._lostBallon > 0) { this.requestBalloon(this._lostBallon); } if (this._lostCommon > 0) { $gameTemp.reserveCommonEvent(this._lostCommon); if ($gameMap._interpreter) { $gameMap._interpreter.setupReservedCommonEventEx(this.eventId()); } } } else { this.setLostDelay(--delay); // console.log("lostDelay:"+this.getLostDelay()); } }; Game_Event.prototype.isFoundPlayer = function () { let result = false; switch (this.getSensorType()) { case "l": // 直線の探索 result = this.sensorLine(); break; case "f": // 扇範囲の探索 result = this.sensorFan(); break; case "s": // 四角範囲の探索 result = this.sensorSquare(); break; case "d": // 菱形範囲の探索 result = this.sensorDiamond(); break; } // if(result) { // $gameSystem.setFoundPlayer(this.eventId()); // } return result; }; // 直線の探索 Game_Event.prototype.sensorLine = function () { let sensorRange, sensorRangeC, strDir, diagoDir, dir, dirFixed, ex, ey, i, coordinates, px, py, cnt, realX, realY; sensorRange = this.getSensorRange(); dirFixed = this.getDirectionFixed(); dir = (dirFixed == -1) ? this.direction() : dirFixed; px = $gamePlayer._realX; py = $gamePlayer._realY; ex = this._realX; ey = this._realY; realX = DefRealRangeX[0]; realY = DefRealRangeY[0]; // currentRange初期化 //this.setSensorRangeC(sensorRange); sensorRangeC = sensorRange; // coordinate初期化 this.clearCoordinate(); switch (dir) { case 8:// 上向き(y<0) strDir = DIR_UP; diagoDir = DIR_RIGHT; // 正面範囲確定 this.rangeSearch(strDir, 0, 0, 0, -1, sensorRange); // 隣接マス探索 if (this.isSideSearch(diagoDir, this.reverseDir(diagoDir), -1, 0)) return true; // プレイヤー範囲探索 coordinates = this.getCoordinate(); cnt = coordinates.length; if (cnt == 1) { i = 0; if (coordinates[i][0] == 0 && coordinates[i][1] == 0) { } else { if (px >= ex + coordinates[i][0] - realX && px <= ex + coordinates[i][0] + realX && py >= ey - Math.abs(coordinates[i][1]) - realY && py <= ey + Math.abs(coordinates[i][0])) { return true; } } } break; case 6:// 右向き(x>0) strDir = DIR_RIGHT; diagoDir = DIR_DOWN; // 正面範囲確定 this.rangeSearch(strDir, 0, 0, 1, 0, sensorRange); // 隣接マス探索 if (this.isSideSearch(diagoDir, this.reverseDir(diagoDir), 0, -1)) return true; // プレイヤー範囲探索 coordinates = this.getCoordinate(); cnt = coordinates.length; if (cnt == 1) { i = 0; if (coordinates[i][0] == 0 && coordinates[i][1] == 0) { } else { if (py >= ey + coordinates[i][1] - realY && py <= ey + coordinates[i][1] + realY && px >= ex + Math.abs(coordinates[i][1]) - realX && px <= ex + coordinates[i][0] + realX) { return true; } } } break; case 4:// 左向き(x<0) strDir = DIR_LEFT; diagoDir = DIR_UP; // 正面範囲確定 this.rangeSearch(strDir, 0, 0, -1, 0, sensorRange); // 隣接マス探索 if (this.isSideSearch(diagoDir, this.reverseDir(diagoDir), 0, 1)) return true; // プレイヤー範囲探索 coordinates = this.getCoordinate(); cnt = coordinates.length; if (cnt == 1) { i = 0; if (coordinates[i][0] == 0 && coordinates[i][1] == 0) { } else { if (py <= ey + coordinates[i][1] + realY && py >= ey + coordinates[i][1] - realY && px <= ex + Math.abs(coordinates[i][1]) + realX && px >= ex + coordinates[i][0] - realX) { return true; } } } break; case 2:// 下向き(y>0) strDir = DIR_DOWN; diagoDir = DIR_LEFT; // 正面範囲確定 this.rangeSearch(strDir, 0, 0, 0, 1, sensorRange); // 隣接マス探索 if (this.isSideSearch(diagoDir, this.reverseDir(diagoDir), 1, 0)) return true; // プレイヤー範囲探索 coordinates = this.getCoordinate(); cnt = coordinates.length; if (cnt == 1) { i = 0; if (coordinates[i][0] == 0 && coordinates[i][1] == 0) { } else { if (px >= ex + coordinates[i][0] - realX && px <= ex + coordinates[i][0] + realX && py >= ey + Math.abs(coordinates[i][0]) && py <= ey + coordinates[i][1] + realY) { return true; } } } break; } return false; }; // 扇範囲の探索 Game_Event.prototype.sensorFan = function () { let sensorRange, sensorRangeC, dir, dirFixed, sx, sy, ex, ey, px, py, noPass, noPassTemp, i, j, coordinates, sign, strDir, diagoDir, cnt, terrainDecision, realX, realY, rex, rey; sensorRange = this.getSensorRange(); dirFixed = this.getDirectionFixed(); dir = (dirFixed == -1) ? this.direction() : dirFixed; px = $gamePlayer._realX; py = $gamePlayer._realY; sx = this.deltaXFrom($gamePlayer.x); sy = this.deltaYFrom($gamePlayer.y); ex = this.x; ey = this.y; rex = this._realX; rey = this._realY; noPass = 0; terrainDecision = CEC(DefTerrainDecision); realX = DefRealRangeX[0]; realY = DefRealRangeY[0]; // currentRange初期化 this.setSensorRangeC(sensorRange); sensorRangeC = sensorRange; // coordinate初期化 this.clearCoordinate(); switch (dir) { case DIR_UP:// 上向き(y<0) sign = 1; strDir = DIR_UP; diagoDir = DIR_RIGHT; // 正面範囲確定 noPass = this.rangeSearch(strDir, 0, 0, 0, -1, sensorRange); if (noPass != sensorRange) noPass++; // 切り替え用 this.setCoordinate(0, 0, "C"); noPassTemp = noPass; // 斜め直線上の範囲確定 for (i = 1; i < 3; i++) { for (j = 0; j <= sensorRange; j++) { if (j > 0) { noPassTemp = this.rangeSearch(strDir, j * sign, -j, 0, -1, noPassTemp); if (j != noPassTemp) { noPassTemp++; } else { noPassTemp = noPassTemp + j; } } if (this.getTerrainDecision() == 1 || (this.getTerrainDecision() == -1 && terrainDecision)) { if (!this.isMapPassableEx(ex + j * sign, ey - j, diagoDir) || !this.isMapPassableEx(ex + j * sign, ey - j, strDir) || !this.isMapPassableEx(ex + j * sign, ey - j - 1, diagoDir) || !this.isMapPassableEx(ex + (j + 1) * sign, ey - j, strDir)) { break; } } } // 配列の要素数合わせ this.addCoordinate(sensorRange * i + 1 + i); if (i == 1) { // 切り替え用 this.setCoordinate(0, 0, "C"); noPassTemp = noPass; sign = signChange(sign); diagoDir = this.reverseDir(diagoDir); } } // 隣接マス探索 if (this.isSideSearch(this.reverseDir(diagoDir), diagoDir, -1, 0)) return true; // プレイヤー範囲探索 coordinates = this.getCoordinate(); cnt = coordinates.length; for (i = 0; i < cnt; i++) { if (coordinates[i][2] == "Add") { continue; } else if (coordinates[i][2] == "C") { continue; } else if (coordinates[i][0] == 0 && coordinates[i][1] == 0) { continue; } if (px <= rex + coordinates[i][0] + realX && px >= rex + coordinates[i][0] - realX && py <= rey - Math.abs(coordinates[i][0]) + realY && py >= rey + coordinates[i][1] - realY) { return true; } } break; case DIR_RIGHT:// 右向き(x>0) sign = 1; strDir = DIR_RIGHT; diagoDir = DIR_DOWN; // 正面範囲確定 noPass = this.rangeSearch(strDir, 0, 0, 1, 0, sensorRange); if (noPass != sensorRange) noPass++; // 切り替え用 this.setCoordinate(0, 0, "C"); noPassTemp = noPass; // 斜め直線上の範囲確定 for (i = 1; i < 3; i++) { for (j = 0; j <= sensorRange; j++) { if (j > 0) { noPassTemp = this.rangeSearch(strDir, j, j * sign, 1, 0, noPassTemp); if (j != noPassTemp) { noPassTemp++; } else { noPassTemp = noPassTemp + j; } } if (this.getTerrainDecision() == 1 || (this.getTerrainDecision() == -1 && terrainDecision)) { if (!this.isMapPassableEx(ex + j, ey + j * sign, diagoDir) || !this.isMapPassableEx(ex + j, ey + j * sign, strDir) || !this.isMapPassableEx(ex + j + 1, ey + j * sign, diagoDir) || !this.isMapPassableEx(ex + j, ey + (j + 1) * sign, strDir)) { break; } } } // 配列の要素数合わせ this.addCoordinate(sensorRange * i + 1 + i); if (i == 1) { // 切り替え用 this.setCoordinate(0, 0, "C"); noPassTemp = noPass; sign = signChange(sign); diagoDir = this.reverseDir(diagoDir); } } // 隣接マス探索 if (this.isSideSearch(this.reverseDir(diagoDir), diagoDir, 0, -1)) return true; // プレイヤー範囲探索 coordinates = this.getCoordinate(); cnt = coordinates.length; for (i = 0; i < cnt; i++) { if (coordinates[i][2] == "Add") { continue; } else if (coordinates[i][2] == "C") { continue; } else if (coordinates[i][0] == 0 && coordinates[i][1] == 0) { continue; } if (py >= rey + coordinates[i][1] - realY && py <= rey + coordinates[i][1] + realY && px >= rex + Math.abs(coordinates[i][1]) - realX && px <= rex + coordinates[i][0] + realX) { return true; } } break; case DIR_LEFT:// 左向き(x<0) sign = -1; strDir = DIR_LEFT; diagoDir = DIR_UP; // 正面範囲確定 noPass = this.rangeSearch(strDir, 0, 0, -1, 0, sensorRange); if (noPass != sensorRange) noPass++; // 切り替え用 this.setCoordinate(0, 0, "C"); noPassTemp = noPass; // 斜め直線上の範囲確定 for (i = 1; i < 3; i++) { for (j = 0; j <= sensorRange; j++) { if (j > 0) { noPassTemp = this.rangeSearch(strDir, -j, j * sign, -1, 0, noPassTemp); if (j != noPassTemp) { noPassTemp++; } else { noPassTemp = noPassTemp + j; } } if (this.getTerrainDecision() == 1 || (this.getTerrainDecision() == -1 && terrainDecision)) { if (!this.isMapPassableEx(ex - j, ey + j * sign, diagoDir) || !this.isMapPassableEx(ex - j, ey + j * sign, strDir) || !this.isMapPassableEx(ex - j - 1, ey + j * sign, diagoDir) || !this.isMapPassableEx(ex - j, ey + (j + 1) * sign, strDir)) { break; } } } // 配列の要素数合わせ this.addCoordinate(sensorRange * i + 1 + i); if (i == 1) { // 切り替え用 this.setCoordinate(0, 0, "C"); noPassTemp = noPass; sign = signChange(sign); diagoDir = this.reverseDir(diagoDir); } } // 隣接マス探索 if (this.isSideSearch(this.reverseDir(diagoDir), diagoDir, 0, 1)) return true; // プレイヤー範囲探索 coordinates = this.getCoordinate(); cnt = coordinates.length; for (i = 0; i < cnt; i++) { if (coordinates[i][2] == "Add") { continue; } else if (coordinates[i][2] == "C") { continue; } else if (coordinates[i][0] == 0 && coordinates[i][1] == 0) { continue; } if (py <= rey + coordinates[i][1] + realY && py >= rey + coordinates[i][1] - realY && px <= rex - Math.abs(coordinates[i][1]) + realX && px >= rex + coordinates[i][0] - realX) { return true; } } break; case DIR_DOWN:// 下向き(y>0) sign = -1; strDir = DIR_DOWN; diagoDir = DIR_LEFT; // 正面範囲確定 noPass = this.rangeSearch(strDir, 0, 0, 0, 1, sensorRange); if (noPass != sensorRange) noPass++; // 切り替え用 this.setCoordinate(0, 0, "C"); noPassTemp = noPass; // 斜め直線上の範囲確定 for (i = 1; i < 3; i++) { for (j = 0; j <= sensorRange; j++) { if (j > 0) { noPassTemp = this.rangeSearch(strDir, j * sign, j, 0, 1, noPassTemp); if (j != noPassTemp) { noPassTemp++; } else { noPassTemp = noPassTemp + j; } } if (this.getTerrainDecision() == 1 || (this.getTerrainDecision() == -1 && terrainDecision)) { if (!this.isMapPassableEx(ex + j * sign, ey + j, diagoDir) || !this.isMapPassableEx(ex + j * sign, ey + j, strDir) || !this.isMapPassableEx(ex + j * sign, ey + j + 1, diagoDir) || !this.isMapPassableEx(ex + (j + 1) * sign, ey + j, strDir)) { break; } } } // 配列の要素数合わせ this.addCoordinate(sensorRange * i + 1 + i); if (i == 1) { // 切り替え用 this.setCoordinate(0, 0, "C"); noPassTemp = noPass; sign = signChange(sign); diagoDir = this.reverseDir(diagoDir); } } // 隣接マス探索 if (this.isSideSearch(this.reverseDir(diagoDir), diagoDir, 1, 0)) return true; // プレイヤー範囲探索 coordinates = this.getCoordinate(); cnt = coordinates.length; for (i = 0; i < cnt; i++) { if (coordinates[i][2] == "Add") { continue; } else if (coordinates[i][2] == "C") { continue; } else if (coordinates[i][0] == 0 && coordinates[i][1] == 0) { continue; } if (px >= rex + coordinates[i][0] - realX && px <= rex + coordinates[i][0] + realX && py >= rey + Math.abs(coordinates[i][0]) - realY && py <= rey + coordinates[i][1] + realY) { return true; } } break; } return false; }; // 菱形範囲の探索(地形考慮完全無視) Game_Event.prototype.sensorDiamond = function () { let sensorRange, sx, sy, realX, realY; sensorRange = this.getSensorRange(); sx = this.deltaXFrom($gamePlayer._realX); sy = this.deltaYFrom($gamePlayer._realY); realX = DefRealRangeX[0]; realY = DefRealRangeY[0]; // currentRange初期化 this.setSensorRangeC(sensorRange); // coordinate初期化 this.clearCoordinate(); // coordinateセット this.setCoordinate(0, -sensorRange, DIR_RIGHT); this.setCoordinate(sensorRange, 0, DIR_DOWN); this.setCoordinate(0, sensorRange, DIR_LEFT); this.setCoordinate(-sensorRange, 0, DIR_UP); // プレイヤー範囲探索 if (Math.abs(sx) + Math.abs(sy) <= sensorRange + Math.max(realX, realY)) { return true; } } // 四角範囲の探索(地形考慮完全無視) Game_Event.prototype.sensorSquare = function () { let sensorRange, sx, sy, realX, realY; sensorRange = this.getSensorRange(); sx = this.deltaXFrom($gamePlayer._realX); sy = this.deltaYFrom($gamePlayer._realY); realX = DefRealRangeX[0]; realY = DefRealRangeY[0]; // currentRange初期化 this.setSensorRangeC(sensorRange); // coordinate初期化 this.clearCoordinate(); // プレイヤー範囲探索 if (Math.abs(sx) <= sensorRange + realX && Math.abs(sy) <= sensorRange + realY) { return true; } } Game_Event.prototype.isSideSearch = function (directionR, directionL, vx, vy) { let sx, sy, ex, ey, bothSensor, terrainDecision, realX, realY; sx = this.deltaXFrom($gamePlayer._realX); sy = this.deltaYFrom($gamePlayer._realY); ex = this.x; ey = this.y; bothSensor = CEC(DefBothSensor); terrainDecision = CEC(DefTerrainDecision); realX = DefRealRangeX[0]; realY = DefRealRangeY[0]; if (this.getBothSensor() == -1 && bothSensor) { if (this.getTerrainDecision() == 1 || (this.getTerrainDecision() == -1 && terrainDecision)) { this.setBothSensorRight(this.isMapPassableEx(ex, ey, directionR)); this.setBothSensorLeft(this.isMapPassableEx(ex, ey, directionL)); } else { this.setBothSensorRight(true); this.setBothSensorLeft(true); } } else if (this.getBothSensor() == 1) { if (this.getTerrainDecision() == 1 || (this.getTerrainDecision() == -1 && terrainDecision)) { this.setBothSensorRight(this.isMapPassableEx(ex, ey, directionR)); this.setBothSensorLeft(this.isMapPassableEx(ex, ey, directionL)); } else { this.setBothSensorRight(true); this.setBothSensorLeft(true); } } else { this.setBothSensorRight(false); this.setBothSensorLeft(false); } if (this.getBothSensorRight() && sx >= vx - realX && sx <= vx + realX && sy >= vy - realY && sy <= vy + realY) { return true; } vx = (vx == 0) ? vx : -vx; vy = (vy == 0) ? vy : -vy; if (this.getBothSensorLeft() && sx >= vx - realX && sx <= vx + realX && sy >= vy - realY && sy <= vy + realY) { return true; } return false; }; Game_Event.prototype.rangeSearch = function (strDir, rx, ry, signX, signY, noPass) { let sensorRange, ex, ey, cx, cy, sx, sy, j, obstacle, cnt, status, noPassDir, terrainDecision; sensorRange = this.getSensorRange(); cnt = sensorRange - Math.abs(rx); ex = this.x; ey = this.y; obstacle = -1; status = "Last"; noPassDir = (signX != 0) ? ry : rx; terrainDecision = CEC(DefTerrainDecision); // 正面探索 for (j = 0; j <= cnt; j++) { cx = rx + j * signX; cy = ry + j * signY; if (this.getTerrainDecision() == 1 || (this.getTerrainDecision() == -1 && terrainDecision)) { if (!this.isMapPassableEx(ex + cx, ey + cy, strDir) && j < sensorRange) { obstacle = j + Math.abs(rx); status = "Line"; break; } if (j + Math.abs(noPassDir) >= noPass && noPass < sensorRange) { status = "Nopass"; break; } } } // 座標セット sx = this.deltaXFrom(ex + cx); if (sx != 0) sx *= -1; sy = this.deltaYFrom(ey + cy); if (sy != 0) sy *= -1; this.setCoordinate(sx, sy, status); return (obstacle < 0) ? noPass : obstacle; }; const _GameEvent_lock = Game_Event.prototype.lock; Game_Event.prototype.lock = function () { if (this.getSensorStatus() != 1) { _GameEvent_lock.call(this); } else { // 話しかけられた場合振り向かない(探索者が探索中に限る) if (!this._locked) { this._prelockDirection = this.direction(); // this.turnTowardPlayer(); this._locked = true; } } }; Game_Event.prototype.addCoordinate = function (length) { // 左右の配列要素数を指定数に合わせる let coordinates, cnt, j; coordinates = this.getCoordinate(); cnt = coordinates.length; for (j = cnt; j < length; j++) { this.setCoordinate(0, 0, "Add"); } }; const _Game_Event_erase = Game_Event.prototype.erase; Game_Event.prototype.erase = function () { this.setSensorStatus(0); this.setFoundStatus(0); this.setViewRangeStatus(0); _Game_Event_erase.call(this); }; const _Game_Event_isCollidedWithEvents = Game_Event.prototype.isCollidedWithEvents; Game_Event.prototype.isCollidedWithEvents = function (x, y) { if (this.isSensorFound() && DefTrackingPriority[0]) { return Game_CharacterBase.prototype.isCollidedWithEvents.apply(this, arguments); } else { return _Game_Event_isCollidedWithEvents.apply(this, arguments); } }; Game_Event.prototype.isInvisible = function () { return this._erased || this.characterName() == ""; } const _Game_Event_isCollidedWithPlayerCharacters = Game_Event.prototype.isCollidedWithPlayerCharacters; Game_Event.prototype.isCollidedWithPlayerCharacters = function (x, y) { if (!this.isSensorFound() || !DefFollowerThrough[0]) { return _Game_Event_isCollidedWithPlayerCharacters.call(this, x, y); } return this.isNormalPriority() && !$gamePlayer.isThrough() && $gamePlayer.pos(x, y); }; //========================================================================= // Game_Followers // フォロワーを返す処理を追加定義します。 //========================================================================= // Game_Followers.prototype.member = function() { // return this._data; // }; //========================================================================= // Spriteset_Map // 探索者の視界範囲を表す図形を描画させる処理を追加定義します。 //========================================================================= const _Spriteset_Map_createLowerLayer = Spriteset_Map.prototype.createLowerLayer; Spriteset_Map.prototype.createLowerLayer = function () { _Spriteset_Map_createLowerLayer.call(this); this.createViewRange(); } Spriteset_Map.prototype.createViewRange = function () { this._viewRangeSprites = []; $gameMap.events().forEach(function (event) { if (event._sensorType) { this._viewRangeSprites.push(new Sprite_ViewRange(event)); event.enableCreateRange(); } }, this); for (let i = 0; i < this._viewRangeSprites.length; i++) { this._tilemap.addChild(this._viewRangeSprites[i]); } }; const _Spriteset_Map_update = Spriteset_Map.prototype.update; Spriteset_Map.prototype.update = function () { _Spriteset_Map_update.call(this); if (this._viewRangeSprites && ConvSw(DefRangeVisible[0])) { this.updateViewRange(); } }; Spriteset_Map.prototype.updateViewRange = function () { let cnt; cnt = this._viewRangeSprites.length - 1; cnt = cnt >= 0 ? cnt : 0; $gameMap.events().filter(function (event) { return !event.isCreateRange(); }).forEach(function (event) { if (event._sensorType) { this._viewRangeSprites.push(new Sprite_ViewRange(event)); event.enableCreateRange(); } }, this); for (; cnt < this._viewRangeSprites.length; cnt++) { this._tilemap.addChild(this._viewRangeSprites[cnt]); } }; //========================================================================= // Sprite_ViewRange // 探索者の視界範囲を表す図形を描画させる処理を定義します。 //========================================================================= function Sprite_ViewRange() { this.initialize.apply(this, arguments); } Sprite_ViewRange.prototype = Object.create(Sprite.prototype); Sprite_ViewRange.prototype.constructor = Sprite_ViewRange; Sprite_ViewRange.prototype.initialize = function (character) { Sprite.prototype.initialize.call(this); this.initMembers(); this.setCharacter(character); this._frameCount = 0; this.z = DefRangePosition[0] == 1 ? 6 : 2; }; Sprite_ViewRange.prototype.initMembers = function () { this._character = null; this._coordinates = null; }; Sprite_ViewRange.prototype.setCharacter = function (character) { this._character = character; }; Sprite_ViewRange.prototype.update = function () { let sensorStatus, rangeStatus, rangeVisible, defVisible; Sprite.prototype.update.call(this); sensorStatus = this._character.getSensorStatus(); rangeStatus = this._character.getViewRangeStatus(); rangeVisible = this._character.getRangeVisible(); defVisible = ConvSw(DefRangeVisible[0]); if (this._character && this._character._erased) { this.parent.removeChild(this); } if (this._character && !this._character._erased && sensorStatus == 1 && (rangeVisible == 1 || (rangeVisible == -1 && defVisible))) { this.updatePosition(); if (this.bitmap) { if (rangeStatus == 1) { // 描画更新 if (this._coordinate.length == 0) { this._coordinate = this._character.getCoordinate(); } this.updateBitmap(); } else if (rangeStatus == 2) { // 描画新規 this._coordinate = this._character.getCoordinate(); this.createBitmap(); } } else { // 描画新規 this._coordinate = this._character.getCoordinate(); this.createBitmap(); } this.visible = true; } else { this.visible = false; } }; Sprite_ViewRange.prototype.createBitmap = function () { let direction, dirFixed, sensorRange, sensorRangeC, sensorType, tileWidth, tileHeight, width, height, coordinates, sideSensorR, sideSensorL, bs, bias, color, opacity, bothSensor; direction = this._character.direction(); dirFixed = this._character.getDirectionFixed(); direction = (dirFixed == -1) ? direction : dirFixed; bothSensor = CEC(DefBothSensor); coordinates = this._coordinate; sensorType = this._character.getSensorType(); sensorRangeC = this._character.getSensorRangeC(); sensorRange = this._character.getSensorRange(); tileWidth = $gameMap.tileWidth(); tileHeight = $gameMap.tileHeight(); sideSensorR = this._character.getBothSensorRight(); sideSensorL = this._character.getBothSensorLeft(); bias = (bothSensor) ? 3 : (this._character.getBothSensor() > 0) ? 3 : 1; color = DefRangeColor[0]; opacity = DefRangeOpacity[0]; switch (sensorType) { case "l": if (direction == DIR_UP) { width = tileWidth * bias; height = tileHeight * sensorRange + tileHeight; this.anchor.x = 0.5; this.anchor.y = 1; } else if (direction == DIR_RIGHT) { width = tileWidth * sensorRange + tileWidth; height = tileHeight * bias; this.anchor.x = 0; this.anchor.y = 0.5; } else if (direction == DIR_LEFT) { width = tileWidth * sensorRange + tileWidth; height = tileHeight * bias; this.anchor.x = 1; this.anchor.y = 0.5; } else if (direction == DIR_DOWN) { width = tileWidth * bias; height = tileHeight * sensorRange + tileHeight; this.anchor.x = 0.5; this.anchor.y = 0; } this.bitmap = new Bitmap(width, height); this.bitmap.fillViewRangeLine(color, this._character); break; case "f": if (direction == DIR_UP) { width = tileWidth * sensorRange * 2 + tileWidth; height = tileHeight * sensorRange + tileHeight; this.anchor.x = 0.5; this.anchor.y = 1; } else if (direction == DIR_RIGHT) { width = tileWidth * sensorRange + tileWidth; height = tileHeight * sensorRange * 2 + tileHeight; this.anchor.x = 0; this.anchor.y = 0.5; } else if (direction == DIR_LEFT) { width = tileWidth * sensorRange + tileWidth; height = tileHeight * sensorRange * 2 + tileHeight; this.anchor.x = 1; this.anchor.y = 0.5; } else if (direction == DIR_DOWN) { width = tileWidth * sensorRange * 2 + tileWidth; height = tileHeight * sensorRange + tileHeight; this.anchor.x = 0.5; this.anchor.y = 0; } this.bitmap = new Bitmap(width, height); if (sensorType == "f") { this.bitmap.fillViewRangeFan(color, this._character); } else { this.bitmap.fillViewRangeFrontDiamond(color, this._character); } break; case "d": width = tileWidth * sensorRange * 2 + tileWidth; height = tileHeight * sensorRange * 2 + tileHeight; this.anchor.x = 0.5; this.anchor.y = 0.55; this.bitmap = new Bitmap(width, height); this.bitmap.fillViewRangeDiamond(color, this._character); break; case "s": width = tileWidth * sensorRange * 2 + tileWidth; height = tileHeight * sensorRange * 2 + tileHeight; this.anchor.x = 0.5; this.anchor.y = 0.55; this.bitmap = new Bitmap(width, height); this.bitmap.fillAll(color); break; } this.opacity = opacity; this.blendMode = Graphics.BLEND_ADD; this.visible = true; this._character.setViewRangeStatus(1); }; Sprite_ViewRange.prototype.updateBitmap = function () { let direction, dirFixed, sensorRange, sensorRangeC, sensorType, tileWidth, tileHeight, width, height, i, cnt, tmpCoordinate, coordinate, bias, color, opacity, bothSensor; direction = this._character.direction(); dirFixed = this._character.getDirectionFixed(); direction = (dirFixed == -1) ? direction : dirFixed; bothSensor = CEC(DefBothSensor); sensorType = this._character.getSensorType(); sensorRangeC = this._character.getSensorRangeC(); sensorRange = this._character.getSensorRange(); tileWidth = $gameMap.tileWidth(); tileHeight = $gameMap.tileHeight(); tmpCoordinate = this._coordinate; coordinate = this._character.getCoordinate(); cnt = (tmpCoordinate.length < coordinate.length) ? tmpCoordinate.length : coordinate.length; bias = (bothSensor) ? 3 : (this._character.getBothSensor() > 0) ? 3 : 1; color = DefRangeColor[0]; opacity = DefRangeOpacity[0]; for (i = 0; i < cnt; i++) { if (coordinate[i][0] != tmpCoordinate[i][0] || coordinate[i][1] != tmpCoordinate[i][1]) { if (tmpCoordinate[i][3] == -1) { tmpCoordinate[i][3] = $gameMap.tileWidth(); } else if (tmpCoordinate[i][3] != 0) { tmpCoordinate[i][3]--; } } else { coordinate[i][3] = 0; } } switch (sensorType) { case "l": if (direction == DIR_UP) { width = tileWidth * bias; height = tileHeight * sensorRange + tileWidth; this.anchor.x = 0.5; this.anchor.y = 1; } else if (direction == DIR_RIGHT) { width = tileWidth * sensorRange + tileWidth; height = tileHeight * bias; this.anchor.x = 0; this.anchor.y = 0.5; } else if (direction == DIR_LEFT) { width = tileWidth * sensorRange + tileWidth; height = tileHeight * bias; this.anchor.x = 1; this.anchor.y = 0.5; } else if (direction == DIR_DOWN) { width = tileWidth * bias; height = tileHeight * sensorRange + tileHeight; this.anchor.x = 0.5; this.anchor.y = 0; } if (this.bitmap.width != width || this.bitmap.height != height) { this.bitmap.clear(); this.bitmap = new Bitmap(width, height); } this.bitmap.fillViewRangeLine(color, this._character); break; case "f": if (direction == DIR_UP) { width = tileWidth * sensorRange * 2 + tileWidth; height = tileHeight * sensorRange + tileWidth; this.anchor.x = 0.5; this.anchor.y = 1; } else if (direction == DIR_RIGHT) { width = tileWidth * sensorRange + tileWidth; height = tileHeight * sensorRange * 2 + tileHeight; this.anchor.x = 0; this.anchor.y = 0.5; } else if (direction == DIR_LEFT) { width = tileWidth * sensorRange + tileWidth; height = tileHeight * sensorRange * 2 + tileHeight; this.anchor.x = 1; this.anchor.y = 0.5; } else if (direction == DIR_DOWN) { width = tileWidth * sensorRange * 2 + tileWidth; height = tileHeight * sensorRange + tileHeight; this.anchor.x = 0.5; this.anchor.y = 0; } if (this.bitmap.width != width || this.bitmap.height != height) { this.bitmap.clear(); this.bitmap = new Bitmap(width, height); } if (sensorType == "f") { this.bitmap.fillViewRangeFan(color, this._character); } else { this.bitmap.fillViewRangeFrontDiamond(color, this._character); } break; case "d": width = tileWidth * sensorRange * 2 + tileWidth; height = tileHeight * sensorRange * 2 + tileHeight; this.anchor.x = 0.5; this.anchor.y = 0.55; if (this.bitmap.width != width || this.bitmap.height != height) { this.bitmap.clear(); this.bitmap = new Bitmap(width, height); } this.bitmap.fillViewRangeDiamond(color, this._character); break; case "s": width = tileWidth * sensorRange * 2 + tileWidth; height = tileHeight * sensorRange * 2 + tileHeight; this.anchor.x = 0.5; this.anchor.y = 0.55; if (this.bitmap.width != width || this.bitmap.height != height) { this.bitmap.clear(); this.bitmap = new Bitmap(width, height); } this.bitmap.fillAll(color); break; } this.opacity = opacity; this.blendMode = Graphics.BLEND_ADD; this.visible = true; }; Sprite_ViewRange.prototype.updatePosition = function () { let direction, dirFixed, sensorRangeC, sensorType, cx, cy, tileWidth, tileHeight, bias; direction = this._character.direction(); dirFixed = this._character.getDirectionFixed(); direction = (dirFixed == -1) ? direction : dirFixed; sensorType = this._character.getSensorType(); sensorRangeC = this._character.getSensorRangeC(); tileWidth = $gameMap.tileWidth(); tileHeight = $gameMap.tileHeight(); cx = this._character.screenX(); cy = this._character.screenY(); bias = 6;// 位置微調整 this.x = cx; this.y = cy; switch (sensorType) { case "l": if (direction == DIR_UP) { this.y = cy + bias; } else if (direction == DIR_RIGHT) { this.x = cx + tileWidth / 2 - tileWidth; this.y = cy - tileHeight / 2 + bias; } else if (direction == DIR_LEFT) { this.x = cx + tileWidth / 2; this.y = cy - tileHeight / 2 + bias; } else if (direction == DIR_DOWN) { this.y = cy - tileHeight + bias; } break; case "f": if (direction == DIR_UP) { this.y = cy + bias; } else if (direction == DIR_RIGHT) { this.x = cx + tileWidth / 2 - tileWidth; this.y = cy - tileHeight / 2 + bias; } else if (direction == DIR_LEFT) { this.x = cx + tileWidth / 2; this.y = cy - tileHeight / 2 + bias; } else if (direction == DIR_DOWN) { this.y = cy - tileHeight + bias; } break; case "df": if (direction == DIR_UP) { this.y = cy + bias; } else if (direction == DIR_RIGHT) { this.x = cx + tileWidth / 2 - tileWidth; this.y = cy - tileHeight / 2 + bias; } else if (direction == DIR_LEFT) { this.x = cx + tileWidth / 2; this.y = cy - tileHeight / 2 + bias; } else if (direction == DIR_DOWN) { this.y = cy - tileHeight + bias; } break; } }; //========================================================================= // Bitmap // 探索者の視界範囲を表す図形を描画させる処理を追加定義します。 //========================================================================= Bitmap.prototype.fillViewRangeLine = function (color, character) { let context, width, height, tileWidth, tileHeight, j, cx, cy, cnt, num, distanceX, distanceY, direction, dirFixed, coordinates, sideSensorR, sideSensorL; context = this._context; direction = character.direction(); dirFixed = character.getDirectionFixed(); direction = (dirFixed == -1) ? direction : dirFixed; width = this.width; height = this.height; tileWidth = $gameMap.tileWidth(); tileHeight = $gameMap.tileHeight(); coordinates = character.getCoordinate(); cnt = coordinates.length; sideSensorR = character.getBothSensorRight(); sideSensorL = character.getBothSensorLeft(); j = 0; this.clear(); context.save(); context.fillStyle = color; context.beginPath(); if (direction == DIR_UP) { if (coordinates && cnt == 1) { num = 1; cx = width / 2 + tileWidth / 2; cy = height - tileHeight; distanceX = cx - tileWidth; distanceY = cy - Math.abs(coordinates[j][num]) * tileHeight; this.mkrSideDrawLine(context, cx, cy, [sideSensorR, 1, 1, sideSensorL, -1, 1]); this.mkrDrawLine(context, cx, cy, distanceX, distanceY); } } else if (direction == DIR_RIGHT) { if (coordinates && cnt == 1) { num = 0; cx = tileWidth; cy = height / 2 + tileHeight / 2; distanceX = cx + Math.abs(coordinates[j][num]) * tileWidth; distanceY = cy - tileHeight; this.mkrSideDrawLine(context, cx, cy, [sideSensorR, -1, 1, sideSensorL, -1, -1]); this.mkrDrawLine(context, cx, cy, distanceX, distanceY); } } else if (direction == DIR_LEFT) { if (coordinates && cnt == 1) { num = 0; cx = width - tileWidth; cy = height / 2 - tileHeight / 2; distanceX = cx - Math.abs(coordinates[j][num]) * tileWidth; distanceY = cy + tileHeight; this.mkrSideDrawLine(context, cx, cy, [sideSensorR, 1, -1, sideSensorL, 1, 1]); this.mkrDrawLine(context, cx, cy, distanceX, distanceY); } } else if (direction == DIR_DOWN) { if (coordinates && cnt == 1) { num = 1; cx = width / 2 - tileWidth / 2; cy = tileHeight; distanceX = cx + tileWidth; distanceY = cy + Math.abs(coordinates[j][num]) * tileHeight; this.mkrSideDrawLine(context, cx, cy, [sideSensorR, -1, -1, sideSensorL, 1, -1]); this.mkrDrawLine(context, cx, cy, distanceX, distanceY); } } context.fill(); context.restore(); this._setDirty(); }; Bitmap.prototype.fillViewRangeFan = function (color, character) { let context, width, height, tileWidth, tileHeight, cx, cy, coordinates, direction, dirFixed, sideSensorR, sideSensorL, i, j, cnt, num, distanceX, distanceY, sign; context = this._context; width = this.width; height = this.height; tileWidth = $gameMap.tileWidth(); tileHeight = $gameMap.tileHeight(); coordinates = character.getCoordinate(); cnt = coordinates.length; direction = character.direction(); dirFixed = character.getDirectionFixed(); direction = (dirFixed == -1) ? direction : dirFixed; sideSensorR = character.getBothSensorRight(); sideSensorL = character.getBothSensorLeft(); this.clear(); context.save(); context.fillStyle = color; context.beginPath(); if (direction == DIR_UP) { if (coordinates && cnt > 0) { sign = 1; num = 1; cx = width / 2 + tileWidth / 2; cy = height - tileHeight; distanceX = cx - tileWidth; distanceY = height - tileHeight - Math.abs(coordinates[0][num]) * tileHeight; this.mkrSideDrawLine(context, cx, cy, [sideSensorR, 1, 1, sideSensorL, -1, 1]); this.mkrDrawLine(context, cx, cy, distanceX, distanceY); for (i = 1, j = 2; j < cnt; i++, j++) { if (coordinates[j][2] == "Add") { continue; } else if (coordinates[j][2] == "C") { sign = signChange(sign); i = 1; j++; } else if (coordinates[j][0] == 0 && coordinates[j][1] == 0) { continue; } cx = width / 2 + tileWidth / 2 * sign + tileWidth * i * sign; cy = height - tileHeight * i; distanceX = cx + tileWidth * signChange(sign); distanceY = height - tileHeight - Math.abs(coordinates[j][num]) * tileHeight; this.mkrDrawLine(context, cx, cy, distanceX, distanceY); } } } else if (direction == DIR_RIGHT) { if (coordinates && cnt > 0) { sign = 1; num = 0; cx = tileWidth; cy = height / 2 + tileHeight / 2; distanceX = tileWidth + Math.abs(coordinates[0][num]) * tileWidth; distanceY = cy - tileHeight; this.mkrSideDrawLine(context, cx, cy, [sideSensorR, -1, 1, sideSensorL, -1, -1]); this.mkrDrawLine(context, cx, cy, distanceX, distanceY); for (i = 1, j = 2; j < cnt; i++, j++) { if (coordinates[j][2] == "Add") { continue; } else if (coordinates[j][2] == "C") { sign = signChange(sign); i = 1; j++; } else if (coordinates[j][0] == 0 && coordinates[j][1] == 0) { continue; } cx = tileHeight * i; cy = height / 2 + tileHeight / 2 * sign + tileHeight * i * sign; distanceX = tileWidth + Math.abs(coordinates[j][num]) * tileWidth; distanceY = cy + tileHeight * signChange(sign); this.mkrDrawLine(context, cx, cy, distanceX, distanceY); } } } else if (direction == DIR_LEFT) { if (coordinates && cnt > 0) { sign = -1; num = 0; cx = width - tileWidth; cy = height / 2 - tileHeight / 2; distanceX = width - tileWidth - Math.abs(coordinates[0][num]) * tileWidth; distanceY = cy + tileHeight; this.mkrSideDrawLine(context, cx, cy, [sideSensorR, 1, -1, sideSensorL, 1, 1]); this.mkrDrawLine(context, cx, cy, distanceX, distanceY); for (i = 1, j = 2; j < cnt; i++, j++) { if (coordinates[j][2] == "Add") { continue; } else if (coordinates[j][2] == "C") { sign = signChange(sign); i = 1; j++; } else if (coordinates[j][0] == 0 && coordinates[j][1] == 0) { continue; } cx = width - tileHeight * i; cy = height / 2 + tileHeight / 2 * sign + tileHeight * i * sign; distanceX = width - tileWidth - Math.abs(coordinates[j][num]) * tileWidth; distanceY = cy + tileHeight * signChange(sign); this.mkrDrawLine(context, cx, cy, distanceX, distanceY); } } } else if (direction == DIR_DOWN) { if (coordinates && cnt > 0) { sign = -1; num = 1; cx = width / 2 - tileWidth / 2; cy = tileHeight; distanceX = cx + tileWidth; distanceY = tileHeight + Math.abs(coordinates[0][num]) * tileHeight; this.mkrSideDrawLine(context, cx, cy, [sideSensorR, -1, -1, sideSensorL, 1, -1]); this.mkrDrawLine(context, cx, cy, distanceX, distanceY); for (i = 1, j = 2; j < cnt; i++, j++) { if (coordinates[j][2] == "Add") { continue; } else if (coordinates[j][2] == "C") { sign = signChange(sign); i = 1; j++; } else if (coordinates[j][0] == 0 && coordinates[j][1] == 0) { continue; } cx = width / 2 + tileWidth / 2 * sign + tileWidth * i * sign; cy = tileHeight * i; distanceX = cx + tileWidth * signChange(sign); distanceY = tileHeight + Math.abs(coordinates[j][num]) * tileHeight; this.mkrDrawLine(context, cx, cy, distanceX, distanceY); } } } context.fill(); context.restore(); this._setDirty(); }; Bitmap.prototype.fillViewRangeDiamond = function (color, character) { let context, width, height, tileWidth, tileHeight, cx, cy, coordinates, rx, ry, dir, dx, dy, ndx, ndy, i, j, cnt, num, distanceX, distanceY, sign; context = this._context; width = this.width; height = this.height; tileWidth = $gameMap.tileWidth(); tileHeight = $gameMap.tileHeight(); coordinates = character.getCoordinate(); cnt = coordinates.length; this.clear(); context.save(); context.fillStyle = color; context.beginPath(); if (coordinates && cnt > 0) { sign = 1; num = 1; cx = width / 2 - tileWidth / 2; cy = 0; rx = cx; ry = cy; context.moveTo(cx, cy); for (i = 0; i < cnt; i++) { dx = coordinates[i][0]; dy = coordinates[i][1]; ndx = (i < cnt - 1) ? coordinates[i + 1][0] : coordinates[0][0]; ndy = (i < cnt - 1) ? coordinates[i + 1][1] : coordinates[0][1]; dir = coordinates[i][2]; switch (dir) { case DIR_UP: ry -= tileHeight; break; case DIR_RIGHT: rx += tileWidth; break; case DIR_DOWN: ry += tileHeight; break; case DIR_LEFT: rx -= tileWidth; break; } context.lineTo(rx, ry); while (dx != ndx || dy != ndy) { switch (dir) { case DIR_UP: case DIR_DOWN: if (dx < ndx) { rx += tileWidth; dx++; } else if (dx > ndx) { rx -= tileWidth; dx--; } context.lineTo(rx, ry); if (dy < ndy) { ry += tileHeight; dy++; } else if (dy > ndy) { ry -= tileHeight; dy--; } context.lineTo(rx, ry); break; case DIR_RIGHT: case DIR_LEFT: if (dy < ndy) { ry += tileHeight; dy++; } else if (dy > ndy) { ry -= tileHeight; dy--; } context.lineTo(rx, ry); if (dx < ndx) { rx += tileWidth; dx++; } else if (dx > ndx) { rx -= tileWidth; dx--; } context.lineTo(rx, ry); break; } } } } context.fill(); context.restore(); this._setDirty(); }; Bitmap.prototype.mkrDrawLine = function (context, cx, cy, distanceX, distanceY) { let width, height, tileWidth, tileHeight, lx, ly; width = this.width; height = this.height; tileWidth = $gameMap.tileWidth(); tileHeight = $gameMap.tileHeight(); lx = distanceX; ly = distanceY; context.moveTo(cx, cy); context.lineTo(lx, cy); context.lineTo(lx, ly); context.lineTo(cx, ly); //context.lineTo(cx, cy); }; Bitmap.prototype.mkrSideDrawLine = function (context, cx, cy, sideSensors) { let tileWidth, tileHeight, rx, ry, signX, signY, signX2, signY2; tileWidth = $gameMap.tileWidth(); tileHeight = $gameMap.tileHeight(); signX = sideSensors[1]; signY = sideSensors[2]; signX2 = sideSensors[4]; signY2 = sideSensors[5]; if (sideSensors[0]) { rx = cx; ry = cy; context.moveTo(rx, ry); context.lineTo(rx + tileWidth * signX, ry); context.lineTo(rx + tileWidth * signX, ry + tileHeight * signY); context.lineTo(rx, ry + tileHeight * signY); context.lineTo(rx, ry); } if (sideSensors[3]) { rx = cx + ((signX != signX2) ? tileWidth * signX2 : 0); ry = cy + ((signY != signY2) ? tileHeight * signY2 : 0); context.moveTo(rx, ry); context.lineTo(rx + tileWidth * signX2, ry); context.lineTo(rx + tileWidth * signX2, ry + tileHeight * signY2); context.lineTo(rx, ry + tileHeight * signY2); context.lineTo(rx, ry); } }; //========================================================================= // ユーティリティ // 汎用的な処理を定義します。 //========================================================================= function signChange(sign) { return sign * -1; } function getRegionIds() { let ArrayRegionId, results, i, argCount, ary; ArrayRegionId = []; if (arguments && arguments.length > 0) { argCount = arguments.length; for (i = 0; i < argCount; i++) { if (Array.isArray(arguments[i]) && arguments[i].length > 0) { ArrayRegionId.push(CEC(arguments[i][0])); } else if (typeof arguments[i] == "string") { ary = arguments[i].split("_").filter(function (val) { return val != "" && val != "0"; }).map(function (val) { return parseInt(ConvVb(val), 10); }); Array.prototype.push.apply(ArrayRegionId, ary); } else if (isFinite(arguments[i])) { ArrayRegionId.push(parseInt(arguments[i], 10)); } } } return ArrayRegionId.filter(function (val, i, self) { return self.indexOf(val) === i && val > 0; }); } })();
dazed/translations
www/js/plugins/MKR_PlayerSensor.js
JavaScript
unknown
148,382
//=========================================================================== // MPI_ModestyPicture.js //=========================================================================== /*: * @plugindesc プレイヤーと重なったピクチャを半透明表示にします。 * @author 奏ねこま(おとぶき ねこま) * * @param 半透明にするピクチャ番号 * @desc プレイヤーと重なったときに半透明にするピクチャの番号を指定してください。カンマ区切りで複数指定できます。 * @default * * @param 重なり判定-A * @desc 重なり判定-Aを有効にする場合は true を、無効にする場合は false を指定してください。 * @default true * * @param 重なり判定-B * @desc 重なり判定-Bを有効にする場合は true を、無効にする場合は false を指定してください。 * @default true * * @param 重なり判定-C * @desc 重なり判定-Cを有効にする場合は true を、無効にする場合は false を指定してください。 * @default true * * @param 判定周期 * @desc 重なり判定を何フレーム毎に行うかを指定してください。 * @default 4 * * @param 不透明度 * @desc プレイヤーと重なったときの不透明度を指定してください。[0-255] * @default 64 * * @param 変化量 * @desc 半透明になる際の不透明度の変化量を指定してください。値が大きいほど早く半透明になります。 * @default 16 * * @help * [ 概要 ] ... * 指定した番号のピクチャがプレイヤーと重なったとき、半透明表示にします。 * * [ 重なり判定 ] ... * 重なり判定ーA:プレイヤー画像の四隅の座標を判定します。 * 重なり判定ーB:プレイヤー画像の上下左右の座標を判定します。 * 重なり判定ーC:プレイヤー画像の中心の座標を判定します。 * * ■重なり判定ーA ■重なり判定-B ■重なり判定-C * ●○○○○○● ○○○●○○○ ○○○○○○○ * ○○○○○○○ ○○○○○○○ ○○○○○○○ * ○○○○○○○ ●○○○○○● ○○○●○○○ * ○○○○○○○ ○○○○○○○ ○○○○○○○ * ●○○○○○● ○○○●○○○ ○○○○○○○ * * [ プラグインコマンド ] ... * プラグインコマンドはありません。 * * [ 利用規約 ] ................................................................ * ・本プラグインの利用は、RPGツクールMV/RPGMakerMVの正規ユーザーに限られます。 * ・商用、非商用、有償、無償、一般向け、成人向けを問わず、利用可能です。 * ・利用の際、連絡や報告は必要ありません。また、製作者名の記載等も不要です。 * ・プラグインを導入した作品に同梱する形以外での再配布、転載はご遠慮ください。 * ・不具合対応以外のサポートやリクエストは、基本的に受け付けておりません。 * ・本プラグインにより生じたいかなる問題についても、一切の責任を負いかねます。 * [ 改訂履歴 ] ................................................................ * Version 1.01 2017/01/20 処理の軽量化 * 重なり判定条件をプラグインパラメータ化 * 茂み属性のタイル上で半透明にならない問題を修正 * Version 1.00 2017/01/11 First edition. * -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- * Web Site: http://makonet.sakura.ne.jp/rpg_tkool/ * Twitter : https://twitter.com/koma_neko * Copylight (c) 2017 Nekoma Otobuki */ var Imported = Imported || {}; Imported.MPI_ModestyPicture = true; var Makonet = Makonet || {}; Makonet.MPC = {}; (function () { 'use strict'; var MPD = Makonet.MPC; MPD.product = 'MPI_ModestyPicture'; MPD.parameters = PluginManager.parameters(MPD.product); MPD.picture = MPD.parameters['半透明にするピクチャ番号'].trim().split(/ *, */).map(function (value) { return +value }); MPD.check1 = MPD.parameters['重なり判定-A'].trim().toLowerCase() === 'true'; MPD.check2 = MPD.parameters['重なり判定-B'].trim().toLowerCase() === 'true'; MPD.check3 = MPD.parameters['重なり判定-C'].trim().toLowerCase() === 'true'; MPD.cycle = +MPD.parameters['判定周期']; MPD.opacity = +MPD.parameters['不透明度']; MPD.step = +MPD.parameters['変化量']; var _ = MPD.product; //============================================================================== // Game_Player //============================================================================== Object.defineProperty(Game_Player.prototype, _, { get: function () { return this[`$${_}`] = this[`$${_}`] || { left: 0, top: 0, right: 0, bottom: 0 }; }, set: function (value) { this[`$${_}`] = value; }, configurable: true }); //============================================================================== // Sprite_Character //============================================================================== (function (o, p) { var f = o[p]; o[p] = function () { f.apply(this, arguments); if (this._character === $gamePlayer) { var gp = $gamePlayer[_]; gp.left = parseInt(this.x - this.anchor.x * this.patternWidth()); gp.top = parseInt(this.y - this.anchor.y * this.patternHeight()); gp.right = gp.left + this.patternWidth(); gp.bottom = gp.top + this.patternHeight(); } }; }(Sprite_Character.prototype, 'updateCharacterFrame')); //============================================================================== // Sprite_Picture //============================================================================== Object.defineProperty(Sprite_Picture.prototype, _, { get: function () { return this[`$${_}`] = this[`$${_}`] || { modesty: false, opacity: 255, overlap: false }; }, set: function (value) { this[`$${_}`] = value; }, configurable: true }); (function (o, p) { var f = o[p]; o[p] = function (pictureId) { f.apply(this, arguments); this[_].modesty = (MPD.picture.indexOf(pictureId) >= 0); }; }(Sprite_Picture.prototype, 'initialize')); (function (o, p) { var f = o[p]; o[p] = function () { f.apply(this, arguments); var this_ = this[_]; if (this_.modesty && !!this.bitmap) { if (Graphics.frameCount % MPD.cycle === 0) { var pl = parseInt(this.x - this.anchor.x * this._realFrame.width); var pt = parseInt(this.y - this.anchor.y * this._realFrame.height); var pr = pl + this._realFrame.width; var pb = pt + this._realFrame.height; var gp = $gamePlayer[_]; var bl = (gp.left === gp.left.clamp(pl, pr)); var bt = (gp.top === gp.top.clamp(pt, pb)); var br = (gp.right === gp.right.clamp(pl, pr)); var bb = (gp.bottom === gp.bottom.clamp(pt, pb)); this_.overlap = false; if ((bl && bt) || (bl && bb) || (br && bt) || (br && bb)) { var cl = gp.left - pl; var ct = gp.top - pt; var cr = gp.right - pl; var cb = gp.bottom - pt; var cx = parseInt((cl + cr) / 2); var cy = parseInt((ct + cb) / 2); if ((MPD.check1 && ((this.bitmap.getAlphaPixel(cl, ct) > 0) || (this.bitmap.getAlphaPixel(cl, cb) > 0) || (this.bitmap.getAlphaPixel(cr, ct) > 0) || (this.bitmap.getAlphaPixel(cr, cb) > 0))) || (MPD.check2 && ((this.bitmap.getAlphaPixel(cx, ct) > 0) || (this.bitmap.getAlphaPixel(cx, cb) > 0) || (this.bitmap.getAlphaPixel(cl, cy) > 0) || (this.bitmap.getAlphaPixel(cr, cy) > 0))) || (MPD.check3 && (this.bitmap.getAlphaPixel(cx, cy) > 0))) { this_.overlap = true; } } } this_.opacity += (MPD.step * (this_.overlap ? -1 : 1)); this_.opacity = this_.opacity.clamp(MPD.opacity, this.picture().opacity()); this.opacity = this_.opacity; } }; }(Sprite_Picture.prototype, 'updateOther')); }());
dazed/translations
www/js/plugins/MPI_ModestyPicture.js
JavaScript
unknown
9,022
//=========================================================================== // MPI_PictureOnWindow.js //=========================================================================== /*: * @plugindesc 指定のピクチャをウインドウより手前に表示します。 * @author 奏ねこま(おとぶき ねこま) * * @param ピクチャ番号 * @desc ウインドウよりも手前に表示するピクチャの番号を指定して下さい。カンマ区切りで複数指定できます。 * @default * * @help * [ 概要 ] ... * プラグインパラメータで指定した番号のピクチャが、ウインドウよりも手前に表示さ * れるようになります。 * * [ プラグインコマンド ] ... * プラグインコマンドはありません。 * * [ 利用規約 ] ................................................................ * ・本プラグインの利用は、RPGツクールMV/RPGMakerMVの正規ユーザーに限られます。 * ・商用、非商用、有償、無償、一般向け、成人向けを問わず、利用可能です。 * ・利用の際、連絡や報告は必要ありません。また、製作者名の記載等も不要です。 * ・プラグインを導入した作品に同梱する形以外での再配布、転載はご遠慮ください。 * ・不具合対応以外のサポートやリクエストは、基本的に受け付けておりません。 * ・本プラグインにより生じたいかなる問題についても、一切の責任を負いかねます。 * [ 改訂履歴 ] ................................................................ * Version 1.00 2017/01/15 First edition. * -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- * Web Site: http://makonet.sakura.ne.jp/rpg_tkool/ * Twitter : https://twitter.com/koma_neko * Copylight (c) 2017 Nekoma Otobuki */ var Imported = Imported || {}; Imported.MPI_PictureOnWindow = true; var Makonet = Makonet || {}; Makonet.POW = {}; (function () { 'use strict'; var MPD = Makonet.POW; MPD.product = 'MPI_PictureOnWindow'; MPD.parameters = PluginManager.parameters(MPD.product); MPD.pictureId = MPD.parameters['ピクチャ番号'].trim().split(/ *, */).map(function (value) { return +value }); var _ = MPD.product; //============================================================================== // Spriteset_Base //============================================================================== (function (o, p) { var f = o[p]; o[p] = function () { f.apply(this, arguments); this._pictureContainer.children.forEach(function (picture) { if (~MPD.pictureId.indexOf(picture._pictureId)) { this._pictureContainer.removeChild(picture); } }, this); }; }(Spriteset_Base.prototype, 'createPictures')); //============================================================================== // Scene_Base //============================================================================== (function (o, p) { var f = o[p]; o[p] = function () { f.apply(this, arguments); var width = Graphics.boxWidth; var height = Graphics.boxHeight; var x = (Graphics.width - width) / 2; var y = (Graphics.height - height) / 2; var sprite = new Sprite(); sprite.setFrame(x, y, width, height); MPD.pictureId.forEach(function (id) { sprite.addChild(new Sprite_Picture(id)); }); this.addChild(sprite); }; }(Scene_Base.prototype, 'createWindowLayer')); }());
dazed/translations
www/js/plugins/MPI_PictureOnWindow.js
JavaScript
unknown
3,759
//============================================================================= // MPP_ChoiceEX.js //============================================================================= // Copyright (c) 2015-2019 Mokusei Penguin // Released under the MIT license // http://opensource.org/licenses/mit-license.php //============================================================================= /*: * @plugindesc 【ver.3.11】選択肢の機能拡張 * @author 木星ペンギン * * @help ※[]内は未設定でも動作します。 * プラグインコマンド: * ChoicePos x y[ row] # 選択肢の位置(x,y)と行数(row)指定 * ChoiceVariableId n # 選択肢のデフォルト位置を変数n番にする * ChoiceRect x y width height * # 選択肢の座標とサイズを指定 * ChoiceUnderMessage # 選択肢をメッセージの下に表示 * * ※ プラグインコマンドにて指定する値には変数が使用できます。 * v[n] と記述することでn番の変数の値を参照します。 * * 注釈: * 選択肢ヘルプ # 各項目の下に設定することでヘルプを表示させる * * 選択肢テキスト: * if(条件) # 条件が偽になると項目が表示されなくなる * en(条件) # 条件が偽になると項目が選択不可 * * ================================================================ * ▼ 使い方 * -------------------------------- * 〇 選択肢を増やす * イベントコマンド『選択肢の表示』を続けて配置すると * 一つの選択肢にまとめられます。 * まとめたくない場合は、間に注釈などを入れることで * 通常通り分けることができます。 * * 『デフォルト』の処理は、なし以外を設定したものが適用されます。 * 『デフォルト』の処理が複数ある場合、 * 後に設定された選択肢のものが適用されます。 * * 『キャンセル』の処理は、禁止以外を設定したものが適用されます。 * 『キャンセル』の処理が複数ある場合、 * 後に設定された選択肢のものが適用されます。 * * 『背景』と『ウィンドウ位置』は後の選択肢のものが適用されます。 * * * ================================================================ * ▼ プラグインコマンド 詳細 * -------------------------------- * 〇 ChoicePos x y[ row] * x : 選択肢ウィンドウのX座標 * y : 選択肢ウィンドウのY座標 * row : 選択肢ウィンドウの行数。未設定の場合はすべて表示 * * 次に表示する選択肢の位置(x,y)と行数(row)指定します。 * * -------------------------------- * 〇 ChoiceVariableId n * n : 変数番号 * * 次に表示する選択肢のデフォルト位置を変数の値にします。 * さらに現在のカーソル位置を変数に入れます。 * * カーソル位置は最初の選択肢が上から0~5、次の選択肢は10~15と、 * 選択肢毎に+10されます。 * * 変数に入った値の項目が表示されない場合、なしと同じ処理をします。 * * -------------------------------- * 〇 ChoiceRect x y width height * x : X座標 * y : Y座標 * width : 幅 * height : 高さ * * 次に表示する選択肢の座標とサイズを指定します。 * * 各項目、未設定もしくは-1を指定した場合、通常の値が適用されます。 * * -------------------------------- * 〇 ChoiceUnderMessage * * 次に表示する選択肢をメッセージウィンドウ内に表示させます。 * * この機能は[文章の表示]と併用しなければ機能しません。 * [文章の表示]の前に実行してください。 * * 選択肢ウィンドウの[背景]は設定したものが適用されます。 * * * ================================================================ * ▼ 選択肢テキスト 詳細 * -------------------------------- * 〇 項目が表示される条件の設定 * 選択肢の文章中に * if(条件) * と入れ、その条件が偽になると項目が表示されなくなります。 * * 『デフォルト』の項目が表示されない場合の動作は、 * プラグインパラメータの[Disabled Index]にて設定できます。 * * 『キャンセル』の項目が表示されない場合、禁止と同じ処理をします。 * * 条件内では s でスイッチ、v で変数を参照できます。 * * 例:if(s[1]) とした場合 * => スイッチ1番がONで表示、OFFで非表示。 * if(!s[2]) とした場合 * => スイッチ2番がOFFで表示、ONで非表示。 * if(v[5]>0) とした場合 * => 変数5番が0より大きければ表示、0以下で非表示。 * * 変数で使える不等号 * === : 等しい * !== : 等しくない * < : より小さい * <= : より小さいまたは等しい * > : より大きい * >= : より大きいまたは等しい * * 条件式はeval関数で処理されているため、他演算子も使用できます。 * * -------------------------------- * 〇 項目を半透明で表示する条件の設定 * 選択肢の文章中に * en(条件) * と入れ、その条件が偽になると項目が半透明で表示されます。 * 半透明となった項目は選択できなくなります。 * * 条件は上の『項目が表示される条件の設定』と同じです。 * * 『キャンセル』の項目が半透明の場合、ブザーが鳴ります。 * * * ================================================================ * ▼ プラグインパラメータ 詳細 * -------------------------------- * 〇 Disabled Index * * [デフォルト]となる項目がif(条件)により非表示となった場合、 * デフォルト位置をどこにするかを設定します。 * * none : [なし]と同じ * top : 先頭の項目 * * -------------------------------- * 〇 Plugin Commands / Event Comment * * プラグインコマンドや注釈で使用するコマンドは、 * プラグインパラメータから変更できます。 * * コマンドを短くしたり日本語にしたりなどして、 * 自分が使いやすいようにしてください。 * * プラグインコマンドのみ、変更後もデフォルトのコマンドでも動作します。 * * * ================================================================ * ▼ その他 * -------------------------------- * 〇 プラグインコマンドの実行タイミング * プラグインコマンドを使用する場合、[選択肢の表示]の前に実行するのが * 好ましいです。 * ただし、メッセージウィンドウを表示したまま選択肢の処理を実行したい場合、 * [文章の表示]より前にプラグインコマンドを実行してください。 * * -------------------------------- * 〇 ヘルプメッセージの表示 * 各選択肢項目の下に注釈で以下の文字列を入れると、 * 続きの文章をヘルプメッセージとしてカーソルを合わせたときに * 標示させることができます。 * * 選択肢ヘルプ * * ※注意点 * ヘルプメッセージは[文章の表示]と同じ機能を使っているため、 * 制御文字が使用できます。 * ただし、\!と\^は使用できません。 * * ================================ * 制作 : 木星ペンギン * URL : http://woodpenguin.blog.fc2.com/ * * @param maxPageRow * @type number * @desc 1ページに表示される行数 * @default 6 * * @param Disabled Index * @type select * @option none * @option top * @desc [デフォルト]となる選択肢が表示されない場合のデフォルト位置 * @default none * * * @param === Command === * * @param Plugin Commands * @type struct<Plugin> * @desc プラグインコマンド名 * @default {"ChoicePos":"ChoicePos","ChoiceVariableId":"ChoiceVariableId","ChoiceRect":"ChoiceRect","ChoiceUnderMessage":"ChoiceUnderMessage"} * @parent === Command === * * @param Event Comment * @type struct<EventComment> * @desc イベントの注釈で使うコマンド名 * @default {"ChoiceHelp":"選択肢ヘルプ"} * @parent === Command === * */ /*~struct~Plugin: * @param ChoicePos * @desc 選択肢の位置(x,y)と行数(row)指定 * @default ChoicePos * * @param ChoiceVariableId * @desc 選択肢のデフォルト位置を変数n番にする * @default ChoiceVariableId * * @param ChoiceRect * @desc 選択肢の座標とサイズ(x,y,width,height)指定 * @default ChoiceRect * * @param ChoiceUnderMessage * @desc 選択肢をメッセージの下に表示 * @default ChoiceUnderMessage * */ /*~struct~EventComment: * @param ChoiceHelp * @desc 各項目の下に設定することでヘルプを表示させる * @default 選択肢ヘルプ */ (function () { const MPPlugin = {}; { let parameters = PluginManager.parameters('MPP_ChoiceEX'); MPPlugin.maxPageRow = Number(parameters['maxPageRow']); MPPlugin.DisabledIndex = parameters['Disabled Index']; MPPlugin.PluginCommands = JSON.parse(parameters['Plugin Commands']); MPPlugin.EventComment = JSON.parse(parameters['Event Comment']); } const Alias = {}; //----------------------------------------------------------------------------- // Game_Message //15 Alias.GaMe_clear = Game_Message.prototype.clear; Game_Message.prototype.clear = function () { Alias.GaMe_clear.apply(this, arguments); this._choiceEnables = []; this._choiceResults = []; this._helpTexts = []; this._choiceX = -1; this._choiceY = -1; this._choiceWidth = -1; this._choiceHeight = -1; this._choiceMaxRow = MPPlugin.maxPageRow; this._choiceVariableId = 0; this.choiceUnderMes = false; }; Game_Message.prototype.setChoiceEnables = function (enables) { this._choiceEnables = enables; }; Game_Message.prototype.choiceEnables = function () { return this._choiceEnables; }; Game_Message.prototype.setChoiceResults = function (results) { this._choiceResults = results; }; Game_Message.prototype.setChoiceHelpTexts = function (texts) { this._helpTexts = texts; }; Game_Message.prototype.isHelp = function () { return this._helpTexts.length > 0; }; Game_Message.prototype.setChoicePos = function (x, y, row) { this._choiceX = x; this._choiceY = y; this._choiceWidth = -1; this._choiceHeight = -1; this._choiceMaxRow = row; }; Game_Message.prototype.setChoiceRect = function (x, y, width, height) { this._choiceX = x; this._choiceY = y; this._choiceWidth = width; this._choiceHeight = height; }; Game_Message.prototype.setChoiceVariableId = function (id) { this._choiceVariableId = id; }; Game_Message.prototype.shiftLine = function (height) { this._choiceY += height; this._choiceHeight -= height; }; //----------------------------------------------------------------------------- // Game_Interpreter //336 Game_Interpreter.prototype.setupChoices = function (params) { var data = { choices: [], enables: [], results: [], helpTexts: [], cancelType: -1, defaultType: -1, positionType: 0, background: 0 }; data = this.addChoices(params, this._index, data, 0); if (data.choices.length > 0) { var helpTexts = []; if (data.helpTexts.length > 0) { helpTexts = data.results.map(i => data.helpTexts[i]); } var cancelType = -1; if (data.cancelType.mod(10) === 8 || data.results.contains(data.cancelType)) { data.results.push(data.cancelType); cancelType = data.choices.length; } var index = data.defaultType; if ($gameMessage._choiceVariableId > 0) { index = $gameVariables.value($gameMessage._choiceVariableId); } var defaultType = data.results.indexOf(index); if (index >= 0 && defaultType < 0 && MPPlugin.DisabledIndex === "top") { defaultType = 0; } $gameMessage.setChoices(data.choices, defaultType, cancelType); $gameMessage.setChoiceEnables(data.enables); $gameMessage.setChoiceResults(data.results); $gameMessage.setChoiceHelpTexts(helpTexts); $gameMessage.setChoiceBackground(data.background); $gameMessage.setChoicePositionType(data.positionType); $gameMessage.setChoiceCallback(n => this._branch[this._indent] = data.results[n]); } else { this._branch[this._indent] = -1; } }; Game_Interpreter.prototype.addChoices = function (params, i, data, d) { var regIf = /\s*if\((.+?)\)/; var regEn = /\s*en\((.+?)\)/; for (var n = 0; n < params[0].length; n++) { var str = params[0][n]; if (regIf.test(str)) { str = str.replace(regIf, ''); if (RegExp.$1 && !this.evalChoice(RegExp.$1)) continue; } var enable = true; if (regEn.test(str)) { str = str.replace(regEn, ''); enable = this.evalChoice(RegExp.$1); } data.choices.push(str); data.enables.push(enable); data.results.push(n + d); } var cancelType = params[1]; if (cancelType !== -1) { data.cancelType = cancelType + d; } var defaultType = params.length > 2 ? params[2] : 0; if (defaultType >= 0) { data.defaultType = defaultType + d; } data.positionType = params.length > 3 ? params[3] : 2; data.background = params.length > 4 ? params[4] : 0; var command; for (; ;) { i++; command = this._list[i]; if (!command) break; if (command.indent === this._indent) { if (command.code === 402) { this.getHelpText(command.parameters[0] + d, i + 1, data); } else if (command.code === 404) { break; } } } command = this._list[i + 1]; if (command && command.code === 102) { this.addChoices(command.parameters, i + 1, data, d + 10); } return data; }; Game_Interpreter.prototype.getHelpText = function (c, i, data) { var command = MPPlugin.EventComment.ChoiceHelp || '選択肢ヘルプ'; if (this._list[i].code === 108 && this._list[i].parameters[0] === command) { var texts = []; while (this._list[i + 1].code === 408) { i++; texts.push(this._list[i].parameters[0]); } data.helpTexts[c] = texts; } }; Game_Interpreter.prototype.evalChoice = function (formula) { try { var s = $gameSwitches._data; var formula2 = formula.replace(/v\[(\d+)\]/g, (match, p1) => $gameVariables.value(parseInt(p1))); return !!eval(formula2); } catch (e) { alert("条件エラー \n\n " + formula); return true; } }; //362 Game_Interpreter.prototype.command403 = function () { if (this._branch[this._indent] !== -2) { this.skipBranch(); } return true; }; Game_Interpreter.prototype.command404 = function () { if (this.nextEventCode() === 102) { this._branch[this._indent] -= 10; this._index++; } return true; }; //1739 Alias.GaIn_pluginCommand = Game_Interpreter.prototype.pluginCommand; Game_Interpreter.prototype.pluginCommand = function (command, args) { Alias.GaIn_pluginCommand.apply(this, arguments); var args2 = this.mppPluginCommandArgs(args); switch (command) { case MPPlugin.PluginCommands.ChoicePos: case 'ChoicePos': var x = args2[0]; var y = args2[1]; var row = args2[2] || 99; $gameMessage.setChoicePos(x, y, row); break; case MPPlugin.PluginCommands.ChoiceVariableId: case 'ChoiceVariableId': $gameMessage.setChoiceVariableId(args2[0]); break; case MPPlugin.PluginCommands.ChoiceRect: case 'ChoiceRect': var x = (args2[0] === undefined ? -1 : args2[0]); var y = (args2[1] === undefined ? -1 : args2[1]); var width = (args2[2] === undefined ? -1 : args2[2]); var height = (args2[3] === undefined ? -1 : args2[3]); $gameMessage.setChoiceRect(x, y, width, height); break; case MPPlugin.PluginCommands.ChoiceUnderMessage: case 'ChoiceUnderMessage': $gameMessage.choiceUnderMes = true; break; } return true; }; Game_Interpreter.prototype.mppPluginCommandArgs = function (args) { var v = $gameVariables._data; return args.map(function (arg) { try { return eval(arg) || 0; } catch (e) { return arg; } }); }; //----------------------------------------------------------------------------- // Window Window.prototype.isClearWindowRect = function () { return true; }; //----------------------------------------------------------------------------- // WindowLayer //7100 Alias.WiLa__canvasClearWindowRect = WindowLayer.prototype._canvasClearWindowRect; WindowLayer.prototype._canvasClearWindowRect = function (renderSession, window) { if (window.isClearWindowRect()) Alias.WiLa__canvasClearWindowRect.apply(this, arguments); }; //7162 Alias.WiLa__maskWindow = WindowLayer.prototype._maskWindow; WindowLayer.prototype._maskWindow = function (window, shift) { Alias.WiLa__maskWindow.apply(this, arguments); if (!window.isClearWindowRect()) { var rect = this._windowRect; rect.x = 0; rect.y = 0; rect.width = 0; rect.height = 0; } }; //----------------------------------------------------------------------------- // Window_ChoiceList Window_ChoiceList.prototype.isClearWindowRect = function () { return !this._underMessage; }; if (Window_ChoiceList.prototype.hasOwnProperty('close')) { Alias.WiChLi_close = Window_ChoiceList.prototype.close } Window_ChoiceList.prototype.close = function () { if ($gameMessage.isHelp()) this._messageWindow.onShowFast(); var _super = Alias.WiChLi_close || Window_Command.prototype.close; _super.apply(this, arguments); }; if (Window_ChoiceList.prototype.hasOwnProperty('select')) { Alias.WiChli_select = Window_ChoiceList.prototype.select; } Window_ChoiceList.prototype.select = function (index) { var variableId = $gameMessage._choiceVariableId; if (index !== this.index() && variableId > 0) { var results = $gameMessage._choiceResults; $gameVariables.setValue(variableId, results[index]); } var _super = Alias.WiChli_select = Window_Command.prototype.select _super.apply(this, arguments); }; //34 Alias.WiChLi_updatePlacement = Window_ChoiceList.prototype.updatePlacement; Window_ChoiceList.prototype.updatePlacement = function () { Alias.WiChLi_updatePlacement.apply(this, arguments); if ($gameMessage._choiceWidth >= 0) { this.width = Math.min($gameMessage._choiceWidth, Graphics.boxWidth); } if ($gameMessage._choiceHeight >= 0) { this.height = Math.min($gameMessage._choiceHeight, Graphics.boxHeight); } if ($gameMessage._choiceX >= 0) { this.x = Math.min($gameMessage._choiceX, Graphics.boxWidth - this.width); } if ($gameMessage._choiceY >= 0) { this.y = Math.min($gameMessage._choiceY, Graphics.boxHeight - this.height); } this._underMessage = $gameMessage.choiceUnderMes; }; //67 Window_ChoiceList.prototype.numVisibleRows = function () { return Math.min($gameMessage.choices().length, $gameMessage._choiceMaxRow); }; //103 Window_ChoiceList.prototype.makeCommandList = function () { var choices = $gameMessage.choices(); var enables = $gameMessage._choiceEnables; for (var i = 0; i < choices.length; i++) { this.addCommand(choices[i], 'choice', enables[i]); } }; //110 Alias.WiChLi_drawItem = Window_ChoiceList.prototype.drawItem; Window_ChoiceList.prototype.drawItem = function (index) { this.changePaintOpacity(this.isCommandEnabled(index)); Alias.WiChLi_drawItem.apply(this, arguments); }; //123 Alias.WiChLi_callOkHandler = Window_ChoiceList.prototype.callOkHandler; Window_ChoiceList.prototype.callOkHandler = function () { Alias.WiChLi_callOkHandler.apply(this, arguments); this._messageWindow.forceClear(); }; //129 Alias.WiChLi_callCancelHandler = Window_ChoiceList.prototype.callCancelHandler; Window_ChoiceList.prototype.callCancelHandler = function () { Alias.WiChLi_callCancelHandler.apply(this, arguments); this._messageWindow.forceClear(); }; if (Window_ChoiceList.prototype.hasOwnProperty('processCancel')) { Alias.WiChLi_processCancel = Window_ChoiceList.prototype.processCancel } Window_ChoiceList.prototype.processCancel = function () { var type = $gameMessage.choiceCancelType(); var results = $gameMessage._choiceResults; var index = results.indexOf(results[type]); if (this.isCancelEnabled() && index !== type && !this.isCommandEnabled(index)) { this.playBuzzerSound(); } else { var _super = Alias.WiChLi_processCancel || Window_Command.prototype.processCancel; _super.apply(this, arguments); } }; Window_ChoiceList.prototype.callUpdateHelp = function () { if (this.active && this._messageWindow && $gameMessage.isHelp()) this.updateHelp(); }; Window_ChoiceList.prototype.updateHelp = function () { this._messageWindow.forceClear(); var texts = $gameMessage._helpTexts[this.index()]; $gameMessage._texts = texts ? texts.clone() : ['']; this._messageWindow.startMessage(); }; //----------------------------------------------------------------------------- // Window_Message //109 Alias.WiMe_updatePlacement = Window_Message.prototype.updatePlacement; Window_Message.prototype.updatePlacement = function () { Alias.WiMe_updatePlacement.apply(this, arguments); this.clearUnderChoice(); }; Window_Message.prototype.clearUnderChoice = function () { if ($gameMessage.choiceUnderMes) { var x = this.x + this.standardPadding(); x += this._textState.left || 0; var y = this.y + 4; var height = this.windowHeight(); $gameMessage.setChoiceRect(x, y, -1, height); } }; if (Window_Message.prototype.hasOwnProperty('processNewLine')) { Alias.WiMe_processNewLine = Window_Message.prototype.processNewLine; } Window_Message.prototype.processNewLine = function (textState) { if ($gameMessage.choiceUnderMes) $gameMessage.shiftLine(textState.height); var _super = Alias.WiMe_processNewLine || Window_Base.prototype.processNewLine; _super.apply(this, arguments); }; //149 Alias.WiMe_updateInput = Window_Message.prototype.updateInput; Window_Message.prototype.updateInput = function () { if ($gameMessage.isHelp() && this._textState) return false; return Alias.WiMe_updateInput.apply(this, arguments); }; //196 Alias.WiMe_onEndOfText = Window_Message.prototype.onEndOfText; Window_Message.prototype.onEndOfText = function () { if ($gameMessage.isHelp() && !this._choiceWindow.active) { this.startInput(); } else { Alias.WiMe_onEndOfText.apply(this, arguments); } }; //207 Alias.WiMe_startInput = Window_Message.prototype.startInput; Window_Message.prototype.startInput = function () { if (this._choiceWindow.active) return true; if ($gameMessage.isChoice() && $gameMessage.choiceUnderMes && this._textState.x !== this._textState.left) { $gameMessage.shiftLine(this._textState.height); } return Alias.WiMe_startInput.apply(this, arguments); }; Window_Message.prototype.forceClear = function () { this._textState = null; this.close(); this._goldWindow.close(); }; Window_Message.prototype.onShowFast = function () { this._showFast = true; }; //243 Alias.WiMe_newPage = Window_Message.prototype.newPage; Window_Message.prototype.newPage = function (textState) { Alias.WiMe_newPage.apply(this, arguments); this.clearUnderChoice(); }; })();
dazed/translations
www/js/plugins/MPP_ChoiceEX.js
JavaScript
unknown
26,302
//============================================================================= // MPP_MessageEX.js //============================================================================= // Copyright (c) 2016 Mokusei Penguin // Released under the MIT license // http://opensource.org/licenses/mit-license.php //============================================================================= /*: * @target MV MZ * @plugindesc Extend the text display function and add display effects. * @author Mokusei Penguin * @url * * @help [version 4.0.0] * This plugin is for RPG Maker MV and MZ. * * ▼ [Display text] control characters * \SP[n] # Text speed(characters per second / 0:Instant display) * \AT[n] # Change animation type to n(※1) * \SET[n] # Convert to the set string set(※2) * \CO[S] # Display character string S as one character * \RB[S,R] # Display character string S with ruby R(※3) * \MX[n] # Shift the next letter X coordinate by n pixels * \MY[n] # Shift the next letter Y coordinate by n pixels * \PX[n] # Change the X coordinate of the next character to n * \PY[n] # Change the Y coordinate of the next character to n * \SW[n] # Turn on switch n * \SN[n] # Replace with the name of skill ID n * \SIN[n] # Replace with icon and name of skill ID n * \IN[n] # Replace with the name of item ID n * \IIN[n] # Replace with the icon and name of item ID n * \WN[n] # Replace with the name of weapon ID n * \WIN[n] # Replace with icon and name of weapon ID n * \AN[n] # Replace with the name of armor ID n * \AIN[n] # Replace with icon and name of armor ID n * \WE # Wait until the event production is over(※4) * \C[r,g,b] # Specify the font color in RGB * \FS[n] # Change font size to n / Default:MV=28,MZ=26 * \OP[n] # Character opacity(0~255) / Default:255 * \OC[n] # Change the color of the character edge to n / 0:Default * \OC[r,g,b] # Specify the border color of characters in RGB * \OC[r,g,b,a] # Specify the border color of characters with RGBA(※5) * \OW[n] # Change the thickness of the character edge / Default:4 * \RC[n] # Changed ruby color to n / 0:Default * \RC[r,g,b] # Specify ruby color in RGB * \RC[r,g,b,a] # Specify ruby color with RGBA(※5) * \DF # Return the text display setting to the default value(※6) * \SV # Memorize the current text display settings(※6) * \LD # Calling the settings memorized by \SV(※6) * * - The following applies if it is included in the text * \A # Prohibition of skipping with enter key or shift key * \ES # Temporarily enable skipping event production(※7) * * - All control characters can be in either case * * ▼ Control character details * ※1: \AT[n] (Change animation type to n) * - The default animation type is as follows. * 0: Default * 1: Letters emerge while sliding to the right * 2: Characters are displayed while spreading horizontally * 3: Characters are displayed while expanding * 4: Display characters from the left side(Text speed 6 recommended) * * ※2: \SET[n] (Convert to the set string set) * - Converts to the character string specified by the plug-in parameter * [Text Set]. * - Control characters can also be set. * * ※3: \RB[S,R] (Display character string S with ruby R) * - Character strings with ruby characters are displayed together, * not individually. * * ※4: \WE (Wait until the event production is over) * - Wait until the production of the event set in the plug-in parameter * [Wait Effects] is completed. * - Even if you skip sentences, weight will be applied. * * ※5: \OC[r,g,b,a] (Specify the border color of characters with RGBA) * - Specify the alpha value (a) from 0.0 to 1.0. * * ※6: \DF, \SV, \LD (Initialize / save / recall text display settings) * - Specify the target information in the plug-in parameter [Text Informations]. * * ※7: \ES (Temporarily enable skipping event production) * - See the plugin command SetEffectSkip for details. * * ▼ Plugin command details * - In MV, the variable N is referred to by writing v [N] in the item for * inputting a numerical value. * - In MZ, in the item to enter a numerical value, select the text and * write v [N] to refer to the variable N. * * 〇 MV / MZ * * 〇 SetMesRow row / messageRow * row : Number of lines in the message window * - Change the number of lines displayed in the message window. * * 〇 SetMesFadeOut type / messageFadeOut * type : Fade out type * - Change the fade-out type. * - The types to specify are as follows. * 0: Default * 1: Gradually disappear * 2: Scroll up * * 〇 SetEffectSkip bool / effectSkip * bool : Enabled with true, disabled with false * - When you skip a sentence, you can change whether to skip the production. * - The default setting is invalid. * - The effect to skip can be set in the plug-in parameter [Skip Effects]. * - The control character \ES is temporary, but it is always applied after * the command is executed. * * ================================ * Mail : wood_penguin@yahoo.co.jp (@ is half-width) * Blog : http://woodpenguin.blog.fc2.com/ * License : MIT license * * @command messageRow * @desc * * @arg row * @desc * @type number * @min 1 * @default 4 * * * @command messageFadeOut * @desc * * @arg type * @desc * @type number * @max 2 * @default 0 * * * @command effectSkip * @desc * * @arg boolean * @desc * @type boolean * @default true * * * @param -----Basic * * @param Text Set * @desc An array of sets of strings to call with \SET * (From the top, \SET[1], \SET[2] ...) * @type string[] * @default [] * @parent -----Basic * * @param Text Informations * @desc Information to be operated when \DF,\SV,\LD is executed * @type struct<Informations> * @default {"Text Speed":"true","Anime Type":"true","Text Color":"true","Text Size":"true","Text Opacity":"true","Outline Color":"true","Outline Width":"true","Ruby Color":"true"} * @parent -----Basic * * @param Wait Effects * @desc \WE Directing to wait for the end when executing * @type struct<WaitEffects> * @default {"Scroll Map":"true","Set Movement Route":"true","Show Animation":"true","Show Balloon Icon":"true","Move Picture":"true","Tint Picture":"true","Tint Screen":"true","Flash Screen":"true","Shake Screen":"false","Set Weather Effect":"false","Fadeout BGM":"false","Fadeout BGS":"false","Play ME":"false"} * @parent -----Basic * * @param Skip Effects * @desc A production that skips sentences at the same time when skipping sentences * @type struct<SkipEffects> * @default {"Scroll Map":"true","Set Movement Route":"true","Move Picture":"true","Tint Picture":"true","Tint Screen":"false","Flash Screen":"false","Shake Screen":"false","Set Weather Effect":"false"} * @parent -----Basic * * @param Skip Effects Timing * @desc * @type select * @option skip * @option end of text * @default skip * @parent Skip Effects * * @param Ruby Oy * @desc * @type number * @min -9999 * @default 0 * @parent -----Basic * * @param Always Leave Ruby Height * @desc * @type boolean * @default false * @parent -----Basic * * @param -----Default * * @param Default Anime Type * @desc * @type number * @default 1 * @parent -----Default * * @param Default Message Row * @desc * @type number * @min 1 * @default 4 * @parent -----Default * * @param Default FadeOut Type * @desc * @type select * @option 0:Default * @value 0 * @option 1:Gradually disappear * @value 1 * @option 2:Scroll up * @value 2 * @default 0 * @parent -----Default * * @param Default FadeOut Speed * @desc * @type number * @default 5 * @parent -----Default * * @param Default Text Speed * @desc * @type number * @default 60 * @parent -----Default * * @param Default Ruby Color * @desc * @default 255,255,255 * @parent -----Default * * @param Default Ruby Size * @desc * @type number * @default 14 * @parent -----Default * * @param Default Ruby Outline * @desc * @type number * @default 2 * @parent -----Default * */ /*~struct~Informations: * @param Text Speed * @desc * @type boolean * @default true * * @param Anime Type * @desc * @type boolean * @default true * * @param Text Color * @desc * @type boolean * @default true * * @param Text Size * @desc * @type boolean * @default true * * @param Text Opacity * @desc * @type boolean * @default true * * @param Outline Color * @desc * @type boolean * @default true * * @param Outline Width * @desc * @type boolean * @default true * * @param Ruby Color * @desc * @type boolean * @default true * */ /*~struct~WaitEffects: * @param Scroll Map * @desc * @type boolean * @default true * * @param Set Movement Route * @desc Excludes [Repeat operation] * @type boolean * @default true * * @param Show Animation * @desc * @type boolean * @default true * * @param Show Balloon Icon * @desc * @type boolean * @default true * * @param Move Picture * @desc * @type boolean * @default true * * @param Tint Picture * @desc * @type boolean * @default true * * @param Tint Screen * @desc * @type boolean * @default true * * @param Flash Screen * @desc * @type boolean * @default true * * @param Shake Screen * @desc * @type boolean * @default false * * @param Set Weather Effect * @desc * @type boolean * @default false * * @param Fadeout BGM * @desc * @type boolean * @default false * * @param Fadeout BGS * @desc * @type boolean * @default false * * @param Play ME * @desc * @type boolean * @default false * * */ /*~struct~SkipEffects: * @param Scroll Map * @desc * @type boolean * @default true * * @param Set Movement Route * @desc Excludes [Repeat operation] * @type boolean * @default true * * @param Move Picture * @desc * @type boolean * @default true * * @param Tint Picture * @desc * @type boolean * @default true * * @param Tint Screen * @desc * @type boolean * @default false * * @param Flash Screen * @desc * @type boolean * @default false * * @param Shake Screen * @desc * @type boolean * @default false * * @param Set Weather Effect * @desc * @type boolean * @default false * */ /*:ja * @target MV MZ * @plugindesc 文章表示の機能を拡張したり表示の演出を追加します。 * @author 木星ペンギン * @url * * @help [version 4.0.0] * このプラグインはRPGツクールMVおよびMZ用です。 * * ▼ [文章の表示]の制御文字 * \SP[n] # 文章の表示速度(秒間描写文字数n / 0:瞬間表示) * \AT[n] # アニメーションタイプをn番に変更(※1) * \SET[n] # 設定した文字列に変換(※2) * \CO[S] # 文字列Sを1文字として表示 * \RB[S,R] # 文字列SにルビRを付けて表示(※3) * \MX[n] # 次に表示する文字のX座標をnピクセルずらす * \MY[n] # 次に表示する文字のY座標をnピクセルずらす * \PX[n] # 次に表示する文字のX座標をnに変更 * \PY[n] # 次に表示する文字のY座標をnに変更 * \SW[n] # スイッチn番をONにする * \SN[n] # スキルID n 番の名前に置き換える * \SIN[n] # スキルID n 番のアイコンと名前に置き換える * \IN[n] # アイテムID n 番の名前に置き換える * \IIN[n] # アイテムID n 番のアイコンと名前に置き換える * \WN[n] # 武器ID n 番の名前に置き換える * \WIN[n] # 武器ID n 番のアイコンと名前に置き換える * \AN[n] # 防具ID n 番の名前に置き換える * \AIN[n] # 防具ID n 番のアイコンと名前に置き換える * \WE # イベントの演出が終了するまでウェイト(※4) * \C[r,g,b] # 文字色をRGBで指定 * \FS[n] # 文字サイズをnに変更 / デフォルト値:MV=28,MZ=26 * \OP[n] # 文字の不透明度(0~255) / デフォルト値:255 * \OC[n] # 文字の縁の色をn番に変更 / 0:デフォルト(黒) * \OC[r,g,b] # 文字の縁の色をRGBで指定 * \OC[r,g,b,a] # 文字の縁の色をRGBAで指定(※5) * \OW[n] # 文字の縁の太さを変更 / デフォルト値:4 * \RC[n] # ルビの色をn番に変更 / 0:デフォルト * \RC[r,g,b] # ルビの色をRGBで指定 * \RC[r,g,b,a] # ルビの色をRGBAで指定(※5) * \DF # 文章表示の設定をデフォルト値に戻す(※6) * \SV # 現在の文章表示の設定を記憶(※6) * \LD # \SVで記憶した設定の呼び出し(※6) * * - 以下は文章内に含まれていた場合に適用 * \A # 決定キーやシフトキーによるスキップの禁止 * \ES # イベントの演出のスキップを一時的に有効にする(※7) * * - すべての制御文字は大文字小文字どちらでも可能 * * ▼ 制御文字詳細 * ※1: \AT[n] (アニメーションタイプをn番に変更) * - アニメーションタイプのデフォルトは以下のようになります。 * 0: デフォルト * 1: 文字が右にスライドしながら浮かび上がる * 2: 文字が横に広がりながら表示される * 3: 文字が拡大しながら表示される * 4: 文字を左側から表示する(表示速度6推奨) * * ※2: \SET[n] (設定した文字列に変換) * - プラグインパラメータ[Text Set]で指定した文字列に変換します。 * - 制御文字も設定可能です。 * * ※3: \RB[S,R] (文字列SにルビRを付けて表示) * - ルビを振った文字列は一文字ずつではなくまとめて表示されます。 * * ※4: \WE (演出が終了するまでウェイト) * - プラグインパラメータ[Wait Effects]で設定したイベントの演出が終了するまで * ウェイトを行います。 * - 文章のスキップを行ってもウェイトがかかります。 * * ※5: \OC[r,g,b,a] (文字の縁の色をRGBAで指定) * - アルファ値(a)は0.0~1.0で指定してください。 * * ※6: \DF, \SV, \LD (文章表示の設定を初期化/保存/呼び出し) * - プラグインパラメータ[Text Informations]で対象となる情報を指定してください。 * * ※7: \ES (イベントの演出のスキップを一時的に有効にする) * - 詳細はプラグインコマンドの SetEffectSkip を参照。 * * ▼ プラグインコマンド詳細 * - MVでは数値を入力する項目で v[N] と記述することで変数N番を参照します。 * - MZでは数値を入力する項目で、テキストを選択して v[N] と記述することで * 変数N番を参照します。 * * 〇 MV / MZ * * 〇 SetMesRow row / メッセージ行数設定 * row : メッセージウィンドウの行数 * - メッセージウィンドウの表示行数をn行に変更します。 * * 〇 SetMesFadeOut type / メッセージフェードアウト * type : フェードアウトのタイプ * - フェードアウトのタイプを変更します。 * - 指定するタイプは以下の通りです。 * 0: デフォルト * 1: 徐々に消える * 2: 上にスクロール * * 〇 SetEffectSkip bool / 演出スキップ * bool : trueで有効, falseで無効 * - 文章のスキップを行った際、演出のスキップをするかどうかを変更できます。 * - 初期設定は無効です。 * - スキップする演出はプラグインパラメータ[Skip Effects]にて設定できます。 * - 制御文字 \ES は一時的なものですが、こちらはコマンド実行後、常に適用されます。 * * ================================ * Mail : wood_penguin@yahoo.co.jp (@は半角) * Blog : http://woodpenguin.blog.fc2.com/ * License : MIT license * * @command messageRow * @text メッセージ行数設定 * @desc * * @arg row * @desc * @type number * @min 1 * @default 4 * * * @command messageFadeOut * @text メッセージフェードアウト * @desc * * @arg type * @desc * @type number * @max 2 * @default 0 * * * @command effectSkip * @text 演出スキップ * @desc * * @arg boolean * @desc * @type boolean * @default true * * * @param -----Basic * * @param Text Set * @text 文字列セット * @desc \SETにて呼び出す文字列のセットの配列 * (上から \SET[1],\SET[2]... となります) * @type string[] * @default [] * @parent -----Basic * * @param Text Informations * @text 保存するテキスト情報 * @desc \DF,\SV,\LDを実行した際に操作する情報 * @type struct<Informations> * @default {"Text Speed":"true","Anime Type":"true","Text Color":"true","Text Size":"true","Text Opacity":"true","Outline Color":"true","Outline Width":"true","Ruby Color":"true"} * @parent -----Basic * * @param Wait Effects * @text 終了待ちする演出 * @desc \WE実行時に終了待ちをする演出 * @type struct<WaitEffects> * @default {"Scroll Map":"true","Set Movement Route":"true","Show Animation":"true","Show Balloon Icon":"true","Move Picture":"true","Tint Picture":"true","Tint Screen":"true","Flash Screen":"true","Shake Screen":"false","Set Weather Effect":"false","Fadeout BGM":"false","Fadeout BGS":"false","Play ME":"false"} * @parent -----Basic * * @param Skip Effects * @text スキップする演出 * @desc 文章のスキップをした際、同時にスキップを行う演出 * @type struct<SkipEffects> * @default {"Scroll Map":"true","Set Movement Route":"true","Move Picture":"true","Tint Picture":"true","Tint Screen":"false","Flash Screen":"false","Shake Screen":"false","Set Weather Effect":"false"} * @parent -----Basic * * @param Skip Effects Timing * @text 演出スキップのタイミング * @desc * @type select * @option スキップ時 * @value skip * @option 文章の表示終了時 * @value end of text * @default skip * @parent Skip Effects * * @param Ruby Oy * @text ルビY軸補正値 * @desc * @type number * @min -9999 * @default 0 * @parent -----Basic * * @param Always Leave Ruby Height * @text 常にルビの高さを空ける * @desc * @type boolean * @default false * @parent -----Basic * * @param -----Default * * @param Default Anime Type * @text アニメーションタイプ * @desc * @type number * @default 1 * @parent -----Default * * @param Default Message Row * @text メッセージ行数 * @desc [メッセージウィンドウの表示行数]のデフォルト値 * @type number * @min 1 * @default 4 * @parent -----Default * * @param Default FadeOut Type * @text フェードアウトタイプ * @desc * @type select * @option 0:なし(瞬時に消える) * @value 0 * @option 1:徐々に消える * @value 1 * @option 2:上にスクロール * @value 2 * @default 0 * @parent -----Default * * @param Default FadeOut Speed * @text フェードアウト速度 * @desc * @type number * @default 5 * @parent -----Default * * @param Default Text Speed * @text 文章の表示速度 * @desc * @type number * @default 60 * @parent -----Default * * @param Default Ruby Color * @text ルビの色 * @desc * @default 255,255,255 * @parent -----Default * * @param Default Ruby Size * @text ルビの文字サイズ * @desc * @type number * @default 14 * @parent -----Default * * @param Default Ruby Outline * @text ルビの縁の太さ * @desc * @type number * @default 2 * @parent -----Default * */ /*~struct~Informations:ja * @param Text Speed * @text 文章の表示速度 * @desc * @type boolean * @default true * * @param Anime Type * @text アニメーションタイプ * @desc * @type boolean * @default true * * @param Text Color * @text 文字色 * @desc * @type boolean * @default true * * @param Text Size * @text 文字サイズ * @desc * @type boolean * @default true * * @param Text Opacity * @text 文字の不透明度 * @desc * @type boolean * @default true * * @param Outline Color * @text 文字の縁の色 * @desc * @type boolean * @default true * * @param Outline Width * @text 文字の縁の太さ * @desc * @type boolean * @default true * * @param Ruby Color * @text ルビの色 * @desc * @type boolean * @default true * */ /*~struct~WaitEffects:ja * @param Scroll Map * @text マップのスクロール * @desc * @type boolean * @default true * * @param Set Movement Route * @text 移動ルートの設定 * @desc [動作を繰り返す]は除く * @type boolean * @default true * * @param Show Animation * @text アニメーションの表示 * @desc * @type boolean * @default true * * @param Show Balloon Icon * @text フキダシアイコンの表示 * @desc * @type boolean * @default true * * @param Move Picture * @text ピクチャの移動 * @desc * @type boolean * @default true * * @param Tint Picture * @text ピクチャの色調変更 * @desc * @type boolean * @default true * * @param Tint Screen * @text 画面の色調変更 * @desc * @type boolean * @default true * * @param Flash Screen * @text 画面のフラッシュ * @desc * @type boolean * @default true * * @param Shake Screen * @text 画面のシェイク * @desc * @type boolean * @default false * * @param Set Weather Effect * @text 天候の設定 * @desc * @type boolean * @default false * * @param Fadeout BGM * @text BGMのフェードアウト * @desc * @type boolean * @default false * * @param Fadeout BGS * @text BGSのフェードアウト * @desc * @type boolean * @default false * * @param Play ME * @text MEの演奏 * @desc * @type boolean * @default false * * */ /*~struct~SkipEffects:ja * @param Scroll Map * @text マップのスクロール * @desc * @type boolean * @default true * * @param Set Movement Route * @text 移動ルートの設定 * @desc [動作を繰り返す]は除く * @type boolean * @default true * * @param Move Picture * @text ピクチャの移動 * @desc * @type boolean * @default true * * @param Tint Picture * @text ピクチャの色調変更 * @desc * @type boolean * @default true * * @param Tint Screen * @text 画面の色調変更 * @desc * @type boolean * @default false * * @param Flash Screen * @text 画面のフラッシュ * @desc * @type boolean * @default false * * @param Shake Screen * @text 画面のシェイク * @desc * @type boolean * @default false * * @param Set Weather Effect * @text 天候の設定 * @desc * @type boolean * @default false * */ (() => { 'use strict'; const pluginName = 'MPP_MessageEX'; // Plugin Parameters const parameters = PluginManager.parameters(pluginName); const paramReplace = (key, value) => { try { return JSON.parse(value); } catch (e) { return value; } }; // -----Basic const param_TextSet = JSON.parse(parameters['Text Set'] || '[]'); const param_TextInformations = JSON.parse(parameters['Text Informations'] || '{}', paramReplace); const param_WaitEffects = JSON.parse(parameters['Wait Effects'] || '{}', paramReplace); const param_SkipEffects = JSON.parse(parameters['Skip Effects'] || '{}', paramReplace); const param_SkipEffectsTiming = parameters['Skip Effects Timing'] || 'skip'; const param_RubyOy = Number(parameters['Ruby Oy'] || 0); const param_AlwaysLeaveRubyHeight = parameters['Always Leave Ruby Height'] === 'true'; // -----Default const param_DefaultMessageRow = Number(parameters['Default Message Row']); const param_DefaultFadeOutType = Number(parameters['Default FadeOut Type']); const param_DefaultFadeOutSpeed = Number(parameters['Default FadeOut Speed']); const param_DefaultTextSpeed = Number(parameters['Default Text Speed']); const param_DefaultAnimeType = Number(parameters['Default Anime Type']); const param_DefaultRubyColor = 'rgb(%1)'.format(parameters['Default Ruby Color'] || '255,255,255'); const param_DefaultRubySize = Number(parameters['Default Ruby Size'] || 14); const param_DefaultRubyOutline = Number(parameters['Default Ruby Outline']); // Dealing with other plugins const __base = (obj, prop) => { if (obj.hasOwnProperty(prop)) { return obj[prop]; } else { const proto = Object.getPrototypeOf(obj); return function () { return proto[prop].apply(this, arguments); }; } }; const _importedPlugin = (...names) => { return names.some(name => PluginManager._scripts.includes(name)); }; // MPP_Patch.js let param_Patch6 = false; if (_importedPlugin('MPP_Patch')) { const patchParameters = PluginManager.parameters('MPP_Patch'); param_Patch6 = patchParameters['Patch6 enabled?'] === 'true'; } // RPG Maker Param const _textColor = function (index) { return Utils.RPGMAKER_NAME === 'MV' ? this.textColor(index) : ColorManager.textColor(index); }; //----------------------------------------------------------------------------- // Bitmap if (Utils.RPGMAKER_NAME === 'MV') { Bitmap.prototype.destroy = function () { if (this._baseTexture) { this._baseTexture.destroy(); this.__baseTexture = null; } this._destroyCanvas(); }; Bitmap.prototype._destroyCanvas = function () { if (this._canvas) { this._canvas.width = 0; this._canvas.height = 0; this.__canvas = null; } }; } //------------------------------------------------------------------------- // WebAudio WebAudio.prototype.realVolume = function () { return this._gainNode ? this._gainNode.gain.value : 0; }; //------------------------------------------------------------------------- // Html5Audio if (Utils.RPGMAKER_NAME === 'MV') { Html5Audio.realVolume = function () { return this._audioElement ? this._audioElement.volume : 0; }; } //------------------------------------------------------------------------- // AudioManager AudioManager.isBgmFadeOuting = function () { return ( this._bgmBuffer && !this._currentBgm && this._bgmBuffer.realVolume() > 0 ); }; AudioManager.isBgsFadeOuting = function () { return ( this._bgsBuffer && !this._currentBgs && this._bgsBuffer.realVolume() > 0 ); }; AudioManager.isMePlaying = function () { return this._meBuffer && this._meBuffer.isPlaying(); }; //------------------------------------------------------------------------- // PluginManager PluginManager._commands = PluginManager._commands || {}; if (!PluginManager.registerCommand) { PluginManager.registerCommand = function (pluginName, commandName, func) { const key = pluginName + ":" + commandName; this._commands[key] = func; }; } if (!PluginManager.callCommand) { PluginManager.callCommand = function (self, pluginName, commandName, args) { const key = pluginName + ":" + commandName; const func = this._commands[key]; if (typeof func === "function") { func.bind(self)(args); } }; } PluginManager.registerCommand(pluginName, 'messageRow', args => { $gameMessage.setMessageRow(PluginManager.mppValue(args.row)); }); PluginManager.registerCommand(pluginName, 'messageFadeOut', args => { $gameMessage.setFadeOutType(PluginManager.mppValue(args.type)); }); PluginManager.registerCommand(pluginName, 'effectSkip', args => { $gameMessage.setEffectSkip(args.boolean === 'true'); }); PluginManager.mppValue = function (value) { const match = /^V\[(\d+)\]$/i.exec(value); return match ? $gameVariables.value(+match[1]) : +value; }; //----------------------------------------------------------------------------- // Game_Character Game_Character.prototype.isMoveRouteForcingNr = function () { return this.isMoveRouteForcing() && !this._moveRoute.repeat; }; //------------------------------------------------------------------------- // Game_Map Game_Map.prototype.isAnyMoveRouteForcingNr = function () { return ( this.events().some(e => e.isMoveRouteForcingNr()) || $gamePlayer.isMoveRouteForcingNr() ); }; Game_Map.prototype.isAnyAnimationPlaying = function () { return ( this.events().some(e => e.isAnimationPlaying()) || $gamePlayer.isAnimationPlaying() ); }; Game_Map.prototype.isAnyBalloonPlaying = function () { return ( this.events().some(e => e.isBalloonPlaying()) || $gamePlayer.isBalloonPlaying() ); }; //------------------------------------------------------------------------- // Game_Screen Game_Screen.prototype.isAnyPictureMoving = function () { return this._pictures.some(p => p && p.isMoving()); }; Game_Screen.prototype.isAnyPictureTinting = function () { return this._pictures.some(p => p && p.isTinting()); }; Game_Screen.prototype.isTinting = function () { return this._toneDuration > 0; }; Game_Screen.prototype.isFlashing = function () { return this._flashDuration > 0; }; Game_Screen.prototype.isShaking = function () { return this._shakeDuration > 0; }; Game_Screen.prototype.isWeatherChanging = function () { return this._weatherDuration > 0; }; //------------------------------------------------------------------------- // Game_Picture Game_Picture.prototype.isMoving = function () { return this._duration > 0; }; Game_Picture.prototype.isTinting = function () { return this._toneDuration > 0; }; //------------------------------------------------------------------------- // Game_Message const _Game_Message_initialize = Game_Message.prototype.initialize; Game_Message.prototype.initialize = function () { _Game_Message_initialize.apply(this, arguments); this._messageRow = param_DefaultMessageRow; this._fadeOutType = param_DefaultFadeOutType; this._effectSkip = false; }; const _Game_Message_clear = Game_Message.prototype.clear; Game_Message.prototype.clear = function () { _Game_Message_clear.apply(this, arguments); this._sceneEffectSkip = false; }; Game_Message.prototype.clearSceneEffectSkip = function () { this._sceneEffectSkip = false; }; Game_Message.prototype.requestSceneEffectSkip = function () { this._sceneEffectSkip = true; }; Game_Message.prototype.messageRow = function () { return this._messageRow; }; Game_Message.prototype.fadeOutType = function () { return this._fadeOutType; }; Game_Message.prototype.effectSkip = function () { return this._effectSkip; }; Game_Message.prototype.sceneEffectSkip = function () { return this._sceneEffectSkip; }; Game_Message.prototype.setMessageRow = function (row) { this._messageRow = row; }; Game_Message.prototype.setFadeOutType = function (type) { this._fadeOutType = type; }; Game_Message.prototype.setEffectSkip = function (skip) { this._effectSkip = skip; }; const _Game_Message_isBusy = Game_Message.prototype.isBusy; Game_Message.prototype.isBusy = function () { return ( _Game_Message_isBusy.apply(this, arguments) || this._sceneEffectSkip ); }; //----------------------------------------------------------------------------- // Game_Interpreter const _mzCommands = { SetMesRow: { name: 'messageRow', keys: ['row'] }, SetMesFadeOut: { name: 'messageFadeOut', keys: ['type'] }, SetEffectSkip: { name: 'effectSkip', keys: ['boolean'] } }; Object.assign(_mzCommands, { 'メッセージ行数設定': _mzCommands.SetMesRow, 'メッセージフェードアウト': _mzCommands.SetMesFadeOut, '演出スキップ': _mzCommands.SetEffectSkip }); const _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand; Game_Interpreter.prototype.pluginCommand = function (command, args) { _Game_Interpreter_pluginCommand.apply(this, arguments); const params = _mzCommands[command]; if (params) { const args2 = Object.assign(...params.keys.map((k, i) => ({ [k]: args[i] }))); PluginManager.callCommand(this, pluginName, params.name, args2); } }; //------------------------------------------------------------------------- // Sprite_TextCharacter function Sprite_TextCharacter() { this.initialize.apply(this, arguments); } Sprite_TextCharacter.prototype = Object.create(Sprite.prototype); Sprite_TextCharacter.prototype.constructor = Sprite_TextCharacter; Sprite_TextCharacter.prototype.initialize = function () { Sprite.prototype.initialize.call(this); this._rect = null; this._list = null; this._index = -1; this._waitCount = 0; }; Sprite_TextCharacter.prototype.setCallback = function (callback) { this._drawCallback = callback; }; Sprite_TextCharacter.prototype.setup = function (bitmap, rect, list) { this.bitmap = bitmap; this._rect = rect; this._list = list; this._index = 0; this._waitCount = 0; this.initBasic(); this.initMove(); this.initScale(); this.initOpacity(); this.initTone(); this.initRotation(); this.initFrame(); this.x = rect.x; this.y = rect.y; this.scale.x = 1.0; this.scale.y = 1.0; this.opacity = 255; this.anchor.x = 0; this.anchor.y = 0; this.setColorTone([0, 0, 0, 0]); this.rotation = 0; this.update(); }; Sprite_TextCharacter.prototype.initBasic = function () { this._origin = 0; this._offsetX = 0; this._offsetY = 0; }; Sprite_TextCharacter.prototype.initMove = function () { this._targetX = 0; this._targetY = 0; this._moveDuration = 0; }; Sprite_TextCharacter.prototype.initScale = function () { this._targetScaleX = 1; this._targetScaleY = 1; this._scaleDuration = 0; }; Sprite_TextCharacter.prototype.initOpacity = function () { this._targetOpacity = 255; this._opacityDuration = 0; }; Sprite_TextCharacter.prototype.initTone = function () { this._tone = null; this._toneTarget = null; this._toneDuration = 0; }; Sprite_TextCharacter.prototype.initRotation = function () { this._angle = 0; this._targetAngle = 0; this._angleDuration = 0; }; Sprite_TextCharacter.prototype.initFrame = function () { const bitmap = this._bitmap; if (bitmap) { this.setFrame(0, 0, bitmap.width, bitmap.height); } else { this.setFrame(0, 0, 0, 0); } this._frame2 = null; this._frame2Target = null; this._frame2Duration = 0; }; Sprite_TextCharacter.prototype.isPlaying = function () { return !!this._list; }; Sprite_TextCharacter.prototype.isEffecting = function () { return ( this._moveDuration > 0 || this._scaleDuration > 0 || this._opacityDuration > 0 || this._toneDuration > 0 || this._angleDuration > 0 || this._frame2Duration > 0 ); }; Sprite_TextCharacter.prototype.update = function () { Sprite.prototype.update.call(this); if (this.isPlaying() && this.updateCommand()) { this.updateMove(); this.updateScale(); this.updateOpacity(); this.updateTone(); this.updateRotation(); this.updateFrame2(); } }; Sprite_TextCharacter.prototype.updateCommand = function () { for (; ;) { if (this.updateWaitCount()) { return true; } const code = this._list[this._index]; if (code) { const [command, ...args] = code.split(' '); this.callMethod(command, args.map(Number)); } else { this.draw(); return false; } this._index++; } }; Sprite_TextCharacter.prototype.updateWaitCount = function () { if (this._waitCount < 0) { if (this.isEffecting()) return true; this._waitCount = 0; } else if (this._waitCount > 0) { this._waitCount--; return true; } return false; }; Sprite_TextCharacter.prototype.callMethod = function (command, args) { switch (command) { case 'show': this.commandShow(args); break; case 'move': this.commandMove(args); break; case 'scale': this.commandScale(args); break; case 'opacity': this.commandOpacity(args); break; case 'rotate': this.commandRotate(args); break; case 'tone': this.commandTone(args); break; case 'frame': this.commandFrame(args); break; case 'wait': this.commandWait(args); break; case 'finish': this.commandFinish(args); break; } }; Sprite_TextCharacter.prototype.updateMove = function () { if (this._moveDuration > 0) { const d = this._moveDuration; this._offsetX = (this._offsetX * (d - 1) + this._targetX) / d; this._offsetY = (this._offsetY * (d - 1) + this._targetY) / d; this._moveDuration--; } this.x = this._rect.x + this._offsetX; this.y = this._rect.y + this._offsetY; if (this._origin === 1) { this.x += this._rect.width / 2; this.y += this._rect.height / 2; } this.refreshAnchor(); }; Sprite_TextCharacter.prototype.updateScale = function () { if (this._scaleDuration > 0) { const d = this._scaleDuration; this.scale.x = (this.scale.x * (d - 1) + this._targetScaleX) / d; this.scale.y = (this.scale.y * (d - 1) + this._targetScaleY) / d; this._scaleDuration--; } }; Sprite_TextCharacter.prototype.updateOpacity = function () { if (this._opacityDuration > 0) { const d = this._opacityDuration; this.opacity = (this.opacity * (d - 1) + this._targetOpacity) / d; this._opacityDuration--; } }; Sprite_TextCharacter.prototype.updateTone = function () { if (this._toneDuration > 0) { const d = this._toneDuration; for (const [i, target] of this._toneTarget.entries()) { this._tone[i] = (this._tone[i] * (d - 1) + target) / d; } this._toneDuration--; } if (this._tone) this.setColorTone(this._tone); }; Sprite_TextCharacter.prototype.updateRotation = function () { if (this._angleDuration > 0) { const d = this._angleDuration; this._angle = (this._angle * (d - 1) + this._targetAngle) / d; this._angleDuration--; } this.rotation = this._angle * Math.PI / 180; }; Sprite_TextCharacter.prototype.updateFrame2 = function () { if (this._frame2Duration > 0) { const d = this._frame2Duration; for (const [i, target] of this._frame2Target.entries()) { this._frame2[i] = (this._frame2[i] * (d - 1) + target) / d; } this._frame2Duration--; this.refreshFrame2(); this.refreshAnchor(); } }; Sprite_TextCharacter.prototype.refreshFrame2 = function () { const { width, height } = this.bitmap; const frame = this._frame2; const fx = Math.round(width * frame[0] / 100); const fy = Math.round(height * frame[1] / 100); const fw = Math.max(Math.round(width * frame[2] / 100) - fx, 0); const fh = Math.max(Math.round(height * frame[3] / 100) - fy, 0); this.setFrame(fx, fy, fw, fh); }; Sprite_TextCharacter.prototype.refreshAnchor = function () { const ox = (this._origin === 0 ? 0 : this._rect.width / 2) + 4; const oy = this._origin === 0 ? 0 : this._rect.height / 2; this.anchor.x = this.width > 0 ? ox / this.width : 0; this.anchor.y = this.height > 0 ? oy / this.height : 0; }; Sprite_TextCharacter.prototype.draw = function () { if (this._drawCallback) { this._drawCallback(this.bitmap, this._rect); } this.delete(); }; Sprite_TextCharacter.prototype.delete = function () { this.parent.removeChild(this); this.bitmap.destroy(); this.bitmap = null; this._list = null; }; Sprite_TextCharacter.prototype.commandShow = function (args) { this._origin = (args[0] || 0).clamp(0, 1); this._offsetX = args[1] || 0; this._offsetY = args[2] || 0; this.scale.x = args.length > 3 ? args[3] / 100 : 1; this.scale.y = args.length > 4 ? args[4] / 100 : 1; this.opacity = args.length > 5 ? args[5] : 255; this.initMove(); this.initScale(); this.initOpacity(); this.initTone(); this.initRotation(); this.initFrame(); }; Sprite_TextCharacter.prototype.commandMove = function (args) { this._targetX = args[0] || 0; this._targetY = args[1] || 0; this._moveDuration = Math.max(args[2] || 0, 0); if (this._moveDuration === 0) { this._offsetX = this._targetX; this._offsetY = this._targetY; } }; Sprite_TextCharacter.prototype.commandScale = function (args) { this._targetScaleX = args.length > 0 ? args[0] / 100 : 1; this._targetScaleY = args.length > 0 ? args[1] / 100 : 1; this._scaleDuration = Math.max(args[2] || 0, 0); if (this._scaleDuration === 0) { this.scale.x = this._targetScaleX; this.scale.y = this._targetScaleY; } }; Sprite_TextCharacter.prototype.commandOpacity = function (args) { this._targetOpacity = args.length > 0 ? args[0].clamp(0, 255) : 255; this._opacityDuration = Math.max(args[1] || 0, 0); if (this._opacityDuration === 0) { this.opacity = this._targetOpacity; } }; Sprite_TextCharacter.prototype.commandRotate = function (args) { this._targetAngle = args[0] || 0; this._angleDuration = Math.max(args[1] || 0, 0); if (this._angleDuration === 0) { this._angle = this._targetAngle; } }; Sprite_TextCharacter.prototype.commandTone = function (args) { if (!this._tone) this._tone = [0, 0, 0, 0]; this._toneTarget = []; for (let i = 0; i < 4; i++) { this._toneTarget[i] = (args[i] || 0).clamp(-255, 255); } this._toneDuration = Math.max(args[4] || 0, 0); if (this._toneDuration === 0) { this._tone = this._toneTarget.clone(); this.setColorTone(this._tone); } }; Sprite_TextCharacter.prototype.commandFrame = function (args) { if (!this._frame2) this._frame2 = [0, 0, 100, 100]; this._frame2Target = []; this._frame2Target[0] = args.length > 0 ? args[0].clamp(0, 100) : 0; this._frame2Target[1] = args.length > 1 ? args[1].clamp(0, 100) : 0; this._frame2Target[2] = args.length > 2 ? args[2].clamp(0, 100) : 100; this._frame2Target[3] = args.length > 3 ? args[3].clamp(0, 100) : 100; this._frame2Duration = Math.max(args[4] || 0, 0); if (this._frame2Duration === 0) { this._frame2 = this._frame2Target.clone(); this.refreshFrame2(); } }; Sprite_TextCharacter.prototype.commandWait = function (args) { this._waitCount = args.length > 0 ? Math.max(args[0], 0) : -1; }; Sprite_TextCharacter.prototype.commandFinish = function (args) { const count = Math.max(args[0] || 0, 0); this.commandMove([0, 0, count]); this.commandScale([100, 100, count]); this.commandOpacity([255, count]); this.commandRotate([0, count]); this.commandTone([0, 0, 0, 0, count]); this.commandFrame([0, 0, 100, 100, count]); this.commandWait([count]); }; //----------------------------------------------------------------------------- // Window_Message const _Window_Base_convertEscapeCharacters = Window_Base.prototype.convertEscapeCharacters; Window_Base.prototype.convertEscapeCharacters = function (text) { text = _Window_Base_convertEscapeCharacters.apply(this, arguments); text = text.replace(/\x1bSET\[(\d+)\]/gi, (_, p1) => { const index = Number(p1 || 0); const setText = index > 0 ? param_TextSet[index - 1] : null; return setText ? this.convertEscapeCharacters(setText) : ''; }); text = text.replace(/\x1b([SIWA])(I?)N\[(\d+)\]/gi, (_, p1, p2, p3) => { return this.mppConvertItemName(p1, p2 !== '', Number(p3)); }); return text; }; Window_Base.prototype.mppConvertItemName = function (type, icon, itemId) { let text = ''; let item; switch (type.toUpperCase()) { case 'S': item = $dataSkills[itemId]; break; case 'I': item = $dataItems[itemId]; break; case 'W': item = $dataWeapons[itemId]; break; case 'A': item = $dataArmors[itemId]; break; } if (item) { if (icon) text += '\x1bI[%1]'.format(item.iconIndex); text += item.name; } return text; }; //------------------------------------------------------------------------- // Window_Message Window_Message.ANIMATIONS = [ null, [ // type 1 'show 0 -6 0 100 100 0', 'finish 15' ], [ // type 2 'show 0 0 0 0 100', 'scale 75 100 6', 'wait', 'finish 6' ], [ // type 3 'show 1 0 0 0 0', 'scale 60 60 7', 'wait', 'scale 100 100 7', 'wait', 'scale 120 120 8', 'wait', 'finish 8' ], [ // type 4 'show', 'frame 0 0 0 100 0', 'finish 10' ], ]; const _Window_Message_initialize = Window_Message.prototype.initialize; Window_Message.prototype.initialize = function () { this._messageRow = $gameMessage.messageRow(); this._textInfo = []; this._rubyBitmap = new Bitmap(); _Window_Message_initialize.apply(this, arguments); this.createCharacterContainer(); this._characterSprites = []; this._waitEffect = false; }; const _Window_Message_destroy = __base(Window_Message.prototype, 'destroy'); Window_Message.prototype.destroy = function (options) { this._rubyBitmap.destroy(); _Window_Message_destroy.apply(this, arguments); }; Window_Message.prototype.createCharacterContainer = function () { if (Utils.RPGMAKER_NAME === 'MV') { this._characterContainer = new Sprite(); this.addChild(this._characterContainer); this.updateCharacterContainer(); } }; const _Window_Message_fittingHeight = __base(Window_Message.prototype, 'fittingHeight'); Window_Message.prototype.fittingHeight = function (numLines) { let height = _Window_Message_fittingHeight.apply(this, arguments); if (param_AlwaysLeaveRubyHeight) { height += numLines * (param_DefaultRubySize - param_RubyOy); } return height; }; const _Window_Message_resetFontSettings = __base(Window_Message.prototype, 'resetFontSettings'); Window_Message.prototype.resetFontSettings = function () { _Window_Message_resetFontSettings.apply(this, arguments); this.contents.paintOpacity = 255; this._paintOpacity = 255; this.contents.outlineColor = 'rgba(0, 0, 0, 0.5)'; this.contents.outlineWidth = 4; this._rubyBitmap.textColor = param_DefaultRubyColor; this._rubyBitmap.fontSize = param_DefaultRubySize; this._rubyBitmap.outlineWidth = param_DefaultRubyOutline; }; const _Window_Message_initMembers = Window_Message.prototype.initMembers; Window_Message.prototype.initMembers = function () { _Window_Message_initMembers.apply(this, arguments); this.clearFlagsMessageEx(); }; // overwrite mv Window_Message.prototype.windowHeight = function () { return this.fittingHeight(this.numVisibleRows()); }; const _Window_Message_clearFlags = Window_Message.prototype.clearFlags; Window_Message.prototype.clearFlags = function () { _Window_Message_clearFlags.apply(this, arguments); this._speed = param_DefaultTextSpeed; this._animeType = param_DefaultAnimeType; this._fadeOutType = 0; this._lastBottomY = 0; this._messageCount = 0; }; Window_Message.prototype.clearFlagsMessageEx = function () { this._auto = false; this._effectSkip = $gameMessage.effectSkip(); }; Window_Message.prototype.numVisibleRows = function () { return this._messageRow; }; Window_Message.prototype.getAnimationList = function () { return Window_Message.ANIMATIONS[this._animeType]; }; Window_Message.prototype.getTextCharacterSprite = function () { let sprite = this._characterSprites.find(sprite => !sprite.isPlaying); if (!sprite) { sprite = new Sprite_TextCharacter(); sprite.setCallback(this.drawTextCharacter.bind(this)); this._characterSprites.push(sprite); } if (this._characterContainer) { this._characterContainer.addChild(sprite); } else { this.addInnerChild(sprite); } return sprite; }; Window_Message.prototype.drawTextCharacter = function (bitmap, rect) { const { x, y } = rect; this.contents.blt(bitmap, 0, 0, bitmap.width, bitmap.height, x - 4, y); }; const _Window_Message_flushTextState = __base(Window_Base.prototype, 'flushTextState'); Window_Message.prototype.flushTextState = function (textState) { const list = this.getAnimationList(); if (!textState.drawing || !list || this._showFast || this._lineShowFast) { this.contents.paintOpacity = this._paintOpacity; _Window_Message_flushTextState.apply(this, arguments); this.contents.paintOpacity = 255; } else { const text = textState.buffer; const rtl = textState.rtl; const { y, height } = textState; const width = this.textWidth(text); const x = rtl ? textState.x - width : textState.x; const bitmap = this.createCharacterBitmap(width + 8, height); bitmap.drawText(text, 4, 0, width + 4, height); const sprite = this.getTextCharacterSprite(); const rect = new Rectangle(x, y, width, height); sprite.setup(bitmap, rect, list); textState.x += rtl ? -width : width; textState.buffer = this.createTextBuffer(rtl); const outputWidth = Math.abs(textState.x - textState.startX); if (textState.outputWidth < outputWidth) { textState.outputWidth = outputWidth; } textState.outputHeight = y - textState.startY + height; } }; const _Window_Message_convertEscapeCharacters = __base(Window_Message.prototype, 'convertEscapeCharacters'); Window_Message.prototype.convertEscapeCharacters = function (text) { text = _Window_Message_convertEscapeCharacters.apply(this, arguments); text = text.replace(/\x1bA(?:[^NIT]|$)/gi, () => { this._auto = true; return ''; }); text = text.replace(/\x1bES/gi, () => { this._effectSkip = true; return ''; }); return text; }; const _Window_Message_update = Window_Message.prototype.update; Window_Message.prototype.update = function () { _Window_Message_update.apply(this, arguments); this.updateCharacterContainer(); }; Window_Message.prototype.updateCharacterContainer = function () { if (this._characterContainer) { const pad = this._padding; this._characterContainer.move(pad, pad); } }; const _Window_Message_startMessage = Window_Message.prototype.startMessage; Window_Message.prototype.startMessage = function () { this.clearFlagsMessageEx(); _Window_Message_startMessage.apply(this, arguments); }; const _Window_Message_updatePlacement = Window_Message.prototype.updatePlacement; Window_Message.prototype.updatePlacement = function () { this._messageRow = $gameMessage.messageRow(); this.height = this.windowHeight(); _Window_Message_updatePlacement.apply(this, arguments); this.createContents(); }; const _Window_Message_terminateMessage = Window_Message.prototype.terminateMessage; Window_Message.prototype.terminateMessage = function () { if (!this.isOpen() || $gameMessage.fadeOutType() === 0) { this.terminateMessageEx(); } else { this._fadeOutType = $gameMessage.fadeOutType(); } }; Window_Message.prototype.terminateMessageEx = function () { _Window_Message_terminateMessage.call(this); if (this._effectSkip && param_SkipEffectsTiming === 'end of text') { $gameMessage.requestSceneEffectSkip(); } }; const _Window_Message_updateWait = Window_Message.prototype.updateWait; Window_Message.prototype.updateWait = function () { if (_Window_Message_updateWait.apply(this, arguments) || this.updateFadeOut()) { return true; } else if (this._waitEffect) { if (param_Patch6) this.updateShowFast(); this._waitEffect = this.isEffectingEx(param_WaitEffects); return this._waitEffect; } return false; }; const _Window_Message_updateMessage = Window_Message.prototype.updateMessage; Window_Message.prototype.updateMessage = function () { if (this._textState) { this.updateShowFast(); this._messageCount += this._speed; while (this._messageCount >= 60 || this._speed === 0) { if (_Window_Message_updateMessage.apply(this, arguments)) { this._messageCount = Math.max(this._messageCount - 60, 0); } else { break; } } return true; } return this._characterSprites.some(sprite => sprite.isPlaying()); }; Window_Message.prototype.updateFadeOut = function () { if (this._fadeOutType > 0) { let finish = true; switch (this._fadeOutType) { case 1: this.contentsOpacity -= param_DefaultFadeOutSpeed; finish = (this.contentsOpacity === 0); break; case 2: this.origin.y += param_DefaultFadeOutSpeed; finish = (this.origin.y >= this._lastBottomY); break; } if (finish) { this._fadeOutType = 0; this.terminateMessageEx(); } return true; } return false; }; const _Window_Message_areSettingsChanged = Window_Message.prototype.areSettingsChanged; Window_Message.prototype.areSettingsChanged = function () { return ( _Window_Message_areSettingsChanged.apply(this, arguments) || this._messageRow !== $gameMessage.messageRow() ); }; const _Window_Message_updateShowFast = Window_Message.prototype.updateShowFast; Window_Message.prototype.updateShowFast = function () { const lastShowFast = this._showFast; if (!this._auto) _Window_Message_updateShowFast.apply(this, arguments); if (!lastShowFast && this._showFast) { if (this._effectSkip && param_SkipEffectsTiming === 'skip') { $gameMessage.requestSceneEffectSkip(); } for (const item of this._characterSprites.clone()) { if (item.isPlaying()) item.draw(); } } }; const _Window_Message_newPage = Window_Message.prototype.newPage; Window_Message.prototype.newPage = function (textState) { for (const item of this._characterSprites.clone()) { if (item.isPlaying()) item.delete(); } _Window_Message_newPage.apply(this, arguments); this.contentsOpacity = 255; this.origin.y = 0; textState.rubyHeight = this.calcRubyHeight(textState); textState.y += textState.rubyHeight; this._lastBottomY = textState.y + textState.height; }; Window_Message.prototype.calcRubyHeight = function (textState) { const lines = textState.text.slice(textState.index).split('\n'); const rubyHeight = this.maxRubySizeInLine(lines[0]); return rubyHeight === 0 ? 0 : Math.max(rubyHeight - param_RubyOy, 4); }; Window_Message.prototype.maxRubySizeInLine = function (line) { const rubySize = param_DefaultRubySize; const regExp = /\x1bRB\[.+?\]/i; return param_AlwaysLeaveRubyHeight || regExp.test(line) ? rubySize : 0; }; const _Window_Message_processCharacter = __base(Window_Message.prototype, 'processCharacter'); Window_Message.prototype.processCharacter = function (textState) { _Window_Message_processCharacter.apply(this, arguments); this._lastBottomY = textState.y + textState.height; }; const _Window_Message_processNewLine = Window_Message.prototype.processNewLine; Window_Message.prototype.processNewLine = function (textState) { if (this.isEndOfText(textState) && textState.x === textState.left) { return; } _Window_Message_processNewLine.apply(this, arguments); textState.rubyHeight = this.calcRubyHeight(textState); textState.y += textState.rubyHeight; if (this.needsNewPage(textState)) { this.startPause(); } }; const _Window_Message_processEscapeCharacter = Window_Message.prototype.processEscapeCharacter; Window_Message.prototype.processEscapeCharacter = function (code, textState) { switch (code) { case 'SP': this._speed = this.obtainEscapeParam(textState); break; case 'AT': this._animeType = this.obtainEscapeParam(textState); break; case 'CO': this.processGroupCharacter(textState, this.obtainEscapeTexts(textState)); break; case 'RB': this.processRubyCharacter(textState, this.obtainEscapeTexts(textState)); break; case 'MX': textState.x += this.obtainEscapeParam2(textState); break; case 'MY': textState.y += this.obtainEscapeParam2(textState); break; case 'PX': textState.x = this.obtainEscapeParam(textState); break; case 'PY': textState.y = this.obtainEscapeParam(textState); break; case 'SW': $gameSwitches.setValue(this.obtainEscapeParam(textState), true); break; case 'WE': this.waitForEffect(); break; case 'C': this.contents.textColor = this.obtainEscapeColor(textState); break; case 'FS': this.contents.fontSize = this.obtainEscapeParam(textState); break; case 'OP': this._paintOpacity = this.obtainEscapeParam(textState); break; case 'OC': this.contents.outlineColor = this.obtainEscapeColor(textState, 'rgba(0,0,0,0.5)'); break; case 'OW': this.contents.outlineWidth = this.obtainEscapeParam(textState); break; case 'RC': this._rubyBitmap.textColor = this.obtainEscapeColor(textState, param_DefaultRubyColor); break; case 'DF': this.defaultTextInfo(); break; case 'SV': this.saveTextInfo(); break; case 'LD': this.loadTextInfo(); break; default: _Window_Message_processEscapeCharacter.apply(this, arguments); break; } }; Window_Message.prototype.waitForEffect = function () { if (this.isEffectingEx(param_WaitEffects)) { this._waitEffect = true; this._waitCount = 1; } }; Window_Message.prototype.obtainEscapeParam2 = function (textState) { const arr = /^\[-?\d+\]/.exec(textState.text.slice(textState.index)); if (arr) { textState.index += arr[0].length; return parseInt(arr[0].slice(1)); } return ''; }; Window_Message.prototype.obtainEscapeTexts = function (textState) { const arr = /^\[(.+?)\]/.exec(textState.text.slice(textState.index)); if (arr) { textState.index += arr[0].length; return arr[1].split(','); } return []; }; Window_Message.prototype.obtainEscapeColor = function (textState, defaultColor) { const arr = /^\[([\d\s,\.]+)\]/.exec(textState.text.slice(textState.index)); if (arr) { textState.index += arr[0].length; switch (arr[1].split(',').length) { case 1: const index = Number(arr[1]); return index === 0 ? defaultColor || _textColor.call(this, 0) : _textColor.call(this, index); case 3: return 'rgb(%1)'.format(arr[1]); case 4: return 'rgba(%1)'.format(arr[1]); } } return ''; }; Window_Message.prototype.defaultTextInfo = function () { const info = param_TextInformations; if (info['Text Speed']) this._speed = param_DefaultTextSpeed; if (info['Anime Type']) this._animeType = param_DefaultAnimeType; if (info['Text Color']) this.resetTextColor(); if (info['Text Size']) this.contents.fontSize = this.standardFontSize(); if (info['Text Opacity']) this._paintOpacity = 255; if (info['Outline Color']) this.contents.outlineColor = 'rgba(0, 0, 0, 0.5)'; if (info['Outline Width']) this.contents.outlineWidth = 4; if (info['Ruby Color']) this._rubyBitmap.textColor = param_DefaultRubyColor; }; Window_Message.prototype.saveTextInfo = function () { const info = param_TextInformations; if (info['Text Speed']) this._textInfo[0] = this._speed; if (info['Anime Type']) this._textInfo[1] = this._animeType; if (info['Text Color']) this._textInfo[2] = this.contents.textColor; if (info['Text Size']) this._textInfo[3] = this.contents.fontSize; if (info['Text Opacity']) this._textInfo[4] = this._paintOpacity; if (info['Outline Color']) this._textInfo[5] = this.contents.outlineColor; if (info['Outline Width']) this._textInfo[6] = this.contents.outlineWidth; if (info['Ruby Color']) this._textInfo[7] = this._rubyBitmap.textColor; }; Window_Message.prototype.loadTextInfo = function () { if (this._textInfo.length === 0) return; const info = param_TextInformations; if (info['Text Speed']) this._speed = this._textInfo[0]; if (info['Anime Type']) this._animeType = this._textInfo[1]; if (info['Text Color']) this.contents.textColor = this._textInfo[2]; if (info['Text Size']) this.contents.fontSize = this._textInfo[3]; if (info['Text Opacity']) this._paintOpacity = this._textInfo[4]; if (info['Outline Color']) this.contents.outlineColor = this._textInfo[5]; if (info['Outline Width']) this.contents.outlineWidth = this._textInfo[6]; if (info['Ruby Color']) this._rubyBitmap.textColor = this._textInfo[7]; }; Window_Message.prototype.isEffectingEx = function (info) { return ( (info['Scroll Map'] && $gameMap.isScrolling()) || (info['Set Movement Route'] && $gameMap.isAnyMoveRouteForcingNr()) || (info['Show Animation'] && $gameMap.isAnyAnimationPlaying()) || (info['Show Balloon Icon'] && $gameMap.isAnyBalloonPlaying()) || (info['Move Picture'] && $gameScreen.isAnyPictureMoving()) || (info['Tint Picture'] && $gameScreen.isAnyPictureTinting()) || (info['Tint Screen'] && $gameScreen.isTinting()) || (info['Flash Screen'] && $gameScreen.isFlashing()) || (info['Shake Screen'] && $gameScreen.isShaking()) || (info['Set Weather Effect'] && $gameScreen.isWeatherChanging()) || (info['Fadeout BGM'] && AudioManager.isBgmFadeOuting()) || (info['Fadeout BGS'] && AudioManager.isBgsFadeOuting()) || (info['Play ME'] && AudioManager.isMePlaying()) ); }; const _Window_Message_processNormalCharacter = __base(Window_Message.prototype, 'processNormalCharacter'); Window_Message.prototype.processNormalCharacter = function (textState) { const list = this.getAnimationList(); if (!list || this._showFast || this._lineShowFast) { this.contents.paintOpacity = this._paintOpacity; _Window_Message_processNormalCharacter.apply(this, arguments); this.contents.paintOpacity = 255; } else { const c = textState.text[textState.index++]; const { x, y, height } = textState; const width = this.textWidth(c); const bitmap = this.createCharacterBitmap(width + 8, height); bitmap.drawText(c, 4, 0, width + 4, height); const sprite = this.getTextCharacterSprite(); const rect = new Rectangle(x, y, width, height); sprite.setup(bitmap, rect, list); textState.x += width; } }; Window_Message.prototype.processDrawIcon = function (iconIndex, textState) { const pw = Window_Base._iconWidth || ImageManager.iconWidth; const ph = Window_Base._iconHeight || ImageManager.iconHeight; const { x, y, height } = textState; const width = pw + 4; if (Utils.RPGMAKER_NAME === 'MV' || textState.drawing) { const offsetY = Math.floor(height - ph) / 2; const list = this.getAnimationList(); if (!list || this._showFast || this._lineShowFast) { this.contents.paintOpacity = this._paintOpacity; this.drawIcon(iconIndex, x + 2, y + offsetY); this.contents.paintOpacity = 255; } else { const bitmap = this.createCharacterBitmap(width + 8, height); const iconSet = ImageManager.loadSystem('IconSet'); const sx = iconIndex % 16 * pw; const sy = Math.floor(iconIndex / 16) * ph; bitmap.blt(iconSet, sx, sy, pw, ph, 6, offsetY); const sprite = this.getTextCharacterSprite(); const rect = new Rectangle(x, y, width, height); sprite.setup(bitmap, rect, list); } } textState.x += width; }; Window_Message.prototype.processGroupCharacter = function (textState, texts) { const c = texts[0]; const { x, y, height } = textState; const width = this.textWidth(c); if (Utils.RPGMAKER_NAME === 'MV' || textState.drawing) { const list = this.getAnimationList(); if (!list || this._showFast || this._lineShowFast) { this.contents.paintOpacity = this._paintOpacity; this.contents.drawText(c, x, y, width * 2, width); this.contents.paintOpacity = 255; } else { const bitmap = this.createCharacterBitmap(width + 8, height); bitmap.drawText(c, 4, 0, width + 4, height); const sprite = this.getTextCharacterSprite(); const rect = new Rectangle(x, y, width, height); sprite.setup(bitmap, rect, list); } } textState.x += width; }; Window_Message.prototype.processRubyCharacter = function (textState, texts) { const c = texts[0]; const { x, y, height } = textState; const cw = this.textWidth(c); const rubyBitmap = this._rubyBitmap; const r = texts[1]; const rw = rubyBitmap.measureTextWidth(r); const rh = textState.rubyHeight; const width = Math.max(cw, rw); if (Utils.RPGMAKER_NAME === 'MV' || textState.drawing) { rubyBitmap.clear(); rubyBitmap.resize(rw + 8, rh + 8); rubyBitmap.drawText(r, 4, 0, rw + 8, rh + 8); const list = this.getAnimationList(); if (!list || this._showFast || this._lineShowFast) { this.contents.paintOpacity = this._paintOpacity; const cx = x + (width - cw) / 2; this.contents.drawText(c, cx, y, cw + 4, height); const rx = x + (width - rw) / 2; const ry = y - rh + param_RubyOy - 4; this.contents.blt(rubyBitmap, 0, 0, rw + 8, rh + 8, rx, ry); this.contents.paintOpacity = 255; } else { const bitmap = this.createCharacterBitmap(width + 8, height + rh); const cx = (width - cw) / 2; bitmap.drawText(c, cx + 4, rh, width + 4, height); const rx = (width - rw) / 2; const ry = param_RubyOy - 4; bitmap.blt(rubyBitmap, 0, 0, rw + 8, rh + 8, rx, ry); const sprite = this.getTextCharacterSprite(); const rect = new Rectangle(x, y - rh, width, height); sprite.setup(bitmap, rect, list); } } textState.x += width; }; Window_Message.prototype.createCharacterBitmap = function (width, height) { const bitmap = new Bitmap(width, height); bitmap.fontFace = this.contents.fontFace; bitmap.fontSize = this.contents.fontSize; bitmap.textColor = this.contents.textColor; bitmap.paintOpacity = this._paintOpacity; bitmap.outlineColor = this.contents.outlineColor; bitmap.outlineWidth = this.contents.outlineWidth; return bitmap; }; const _Window_Message_calcTextHeight = Window_Message.prototype.calcTextHeight; Window_Message.prototype.calcTextHeight = function (textState, all) { if (Utils.RPGMAKER_NAME === 'MZ') { return _Window_Message_calcTextHeight.apply(this, arguments); } const lines = textState.text.slice(textState.index).split('\n'); const regExp = /\x1bFS\[(\d+)\]/gi; let maxFontSize = this.contents.fontSize; for (; ;) { const array = regExp.exec(lines[0]); if (array) { const fontSize = Number(array[1]); if (maxFontSize < fontSize) { maxFontSize = fontSize; } } else { break; } } const height = _Window_Message_calcTextHeight.apply(this, arguments); return Math.max(height, maxFontSize + 8); }; //------------------------------------------------------------------------- // Scene_Map const _Scene_Map_updateMainMultiply = Scene_Map.prototype.updateMainMultiply; Scene_Map.prototype.updateMainMultiply = function () { _Scene_Map_updateMainMultiply.apply(this, arguments); if ($gameMessage.sceneEffectSkip()) { for (let i = 1; i < 16; i++) { if (this._messageWindow.isEffectingEx(param_SkipEffects)) { this.updateMain(); } else { $gameMessage.clearSceneEffectSkip(); break; } } } }; })();
dazed/translations
www/js/plugins/MPP_MessageEX.js
JavaScript
unknown
74,986
//============================================================================= // MPP_MessageEX_Op1.js //============================================================================= // Copyright (c) 2021 Mokusei Penguin // Released under the MIT license // http://opensource.org/licenses/mit-license.php //============================================================================= /*: * @target MV MZ * @plugindesc Add functions related to the name window and face graphic window to the text display. * @author Mokusei Penguin * @url * * @base MPP_MessageEX * @orderAfter MPP_MessageEX * * @help [version 1.1.0] * This plugin is for RPG Maker MV and MZ. * * ▼ [Display text] control characters * - The following applies if it is included in the text * \NW[S] # Display string S in name window * \NC[n] # Change the text color of the name window to n * \FL # Face graphic on the left(※1) * \FR # Face graphic on the right(※1) * \FM # Flip face graphic left and right(※1) * \FW # Display face graphic in a separate window(※1) * * - All control characters can be in either case * * ▼ Control character details * ※1: \FL, \FR, \FM, \FW (Face graphic related) * - These control characters can be used in combination. * - If the head is F, the order after that is appropriate and OK. * Example: \FRM * => Face graphic is displayed flipped to the right * \FWR * => Show face graphic window on the right * * ▼ Plugin command details * - In MV, the variable N is referred to by writing v [N] in the item for * inputting a numerical value. * - In MZ, in the item to enter a numerical value, select the text and * write v [N] to refer to the variable N. * * 〇 MV / MZ * * 〇 SetSpeakerName name / speakerName * name : Not set and hidden * - Change the name displayed in the Name window. * - Differences from \NW[s] apply from using this command until a different * name is set for this command or \NW[s]. * - You can also use control commands such as \RB[S,R], display icons and * item names. * - Due to the specifications of the plug-in command, spaces cannot be used. * (MV only) * - If you want to use whitespace, use the \SET[n] command. * - We do not recommend using this command with RPG Maker MZ. * * ================================ * Mail : wood_penguin@yahoo.co.jp (@ is half-width) * Blog : http://woodpenguin.blog.fc2.com/ * License : MIT license * * @command speakerName * @desc * * @arg name * @desc * @default * * * @param Name Window * @desc * @type struct<NameWindow> * @default {"Offset X":"0","Offset Y":"0","Padding":"12","Offset Line Spacing":"0","Windowskin":"Window","Default Color":"0","Font Size":"","Ruby Color":"255,255,255","Always Leave Ruby Height":"false"} * * @param Face Window * @desc * @type struct<FaceWindow> * @default {"Offset X":"0","Offset Y":"0","Padding":"12","Windowskin":"Window"} * */ /*~struct~NameWindow: * @param Offset X * @desc * @type number * @min -3000 * @default 0 * * @param Offset Y * @desc * @type number * @min -3000 * @default -56 * * @param Padding * @desc * @type number * @default 12 * * @param Offset Line Spacing * @desc * @type number * @min -999 * @default 0 * * @param Windowskin * @desc * @type file * @require 1 * @dir img/system * @default Window * * @param Default Color * @desc Specified by color number * @type number * @default 0 * * @param Font Size * @desc Default value if not set * (Default: MV=28, MZ=26) * @type number * @min 4 * @default * * @param Ruby Color * @desc Not set and always the same as the text color * @default 255,255,255 * * @param Always Leave Ruby Height * @desc * @type boolean * @default false * */ /*~struct~FaceWindow: * @param Offset X * @desc * @type number * @default 0 * * @param Offset Y * @desc * @type number * @default 0 * * @param Padding * @desc * @type number * @default 12 * * @param Windowskin * @desc * @type file * @require 1 * @dir img/system * @default Window */ /*:ja * @target MV MZ * @plugindesc 文章の表示に名前ウィンドウや顔グラフィックウィンドウに関する機能を追加します。 * @author 木星ペンギン * @url * * @base MPP_MessageEX * @orderAfter MPP_MessageEX * * @help [version 1.1.0] * このプラグインはRPGツクールMVおよびMZ用です。 * * ▼ [文章の表示]の制御文字 * - 以下は文章内に含まれていた場合に適用 * \NW[S] # 文字列Sを名前ウィンドウに表示 * \NC[n] # 名前ウィンドウの文字色をn番に変更 * \FL # 顔グラフィックを左側に表示(※1) * \FR # 顔グラフィックを右側に表示(※1) * \FM # 顔グラフィックを左右反転(※1) * \FW # 顔グラフィックを別ウィンドウで表示(※1) * * - すべての制御文字は大文字小文字どちらでも可能 * * ▼ 制御文字詳細 * ※1: \FL, \FR, \FM, \FW (顔グラフィック関連) * - これらの制御文字は組み合わせて使用できます。 * - 頭がFであれば、そのあとの順番は適当でOKです。 * 例: \FRM * => 顔グラフィックを右側に左右反転に表示 * \FWR * => 顔グラフィックウィンドウを右側に表示 * * ▼ プラグインコマンド詳細 * - MVでは数値を入力する項目で v[N] と記述することで変数N番を参照します。 * - MZでは数値を入力する項目で、テキストを選択して v[N] と記述することで * 変数N番を参照します。 * * 〇 MV / MZ * * 〇 SetSpeakerName name / メッセージ名前表示 * name : 名前 (未設定で非表示) * - 名前ウィンドウに表示する名前を変更します。 * - \NW[s] との違いは、このコマンドを使用してからこのコマンドや\NW[s]で * 別の名前が設定されるまで適用されます。 * - \RB[S,R],アイコンやアイテム名の表示といった制御コマンドも使用できます。 * - プラグインコマンドの仕様上、空白は使用できません。(MVのみ) * - 空白を使用したい場合、\SET[n]コマンドを使用してください。 * - RPGツクールMZでこのコマンドを使用することはお勧めしません。 * * ================================ * Mail : wood_penguin@yahoo.co.jp (@は半角) * Blog : http://woodpenguin.blog.fc2.com/ * License : MIT license * * @command speakerName * @text 名前表示 * @desc * * @arg name * @desc * @default * * * @param Name Window * @text 名前ウィンドウ * @desc * @type struct<NameWindow> * @default {"Offset X":"0","Offset Y":"0","Padding":"12","Offset Line Spacing":"0","Windowskin":"Window","Default Color":"0","Font Size":"","Ruby Color":"255,255,255","Always Leave Ruby Height":"false"} * * @param Face Window * @text 顔グラウィンドウ * @desc * @type struct<FaceWindow> * @default {"Offset X":"0","Offset Y":"0","Padding":"12","Windowskin":"Window"} * */ /*~struct~NameWindow:ja * @param Offset X * @text X軸補正値 * @desc * @type number * @min -3000 * @default 0 * * @param Offset Y * @text Y軸補正値 * @desc * @type number * @min -3000 * @default -56 * * @param Padding * @text 余白 * @desc * @type number * @default 12 * * @param Offset Line Spacing * @text 行の高さ補正値 * @desc * @type number * @min -999 * @default 0 * * @param Windowskin * @text ウィンドウスキン * @desc * @type file * @require 1 * @dir img/system * @default Window * * @param Default Color * @text 文字色のデフォルト値 * @desc 色番号で指定 * @type number * @default 0 * * @param Font Size * @text 文字サイズ * @desc 未設定の場合、デフォルト値 * (デフォルト値: MV=28, MZ=26) * @type number * @min 4 * @default * * @param Ruby Color * @text 名前のルビの色 * @desc 未設定で常に文字色と同じ * @default 255,255,255 * * @param Always Leave Ruby Height * @text 常にルビの高さを空ける * @desc * @type boolean * @default false * */ /*~struct~FaceWindow:ja * @param Offset X * @text X軸補正値 * @desc * @type number * @default 0 * * @param Offset Y * @text Y軸補正値 * @desc * @type number * @default 0 * * @param Padding * @text 余白 * @desc * @type number * @default 12 * * @param Windowskin * @text ウィンドウスキン * @desc * @type file * @require 1 * @dir img/system * @default Window */ (() => { 'use strict'; const pluginName = 'MPP_MessageEX_Op1'; // Plugin Parameters const parameters = PluginManager.parameters(pluginName); const paramReplace = (key, value) => { try { return JSON.parse(value); } catch (e) { return value; } }; const param_NameWindow = JSON.parse(parameters['Name Window'] || '{}', paramReplace); const param_FaceWindow = JSON.parse(parameters['Face Window'] || '{}', paramReplace); // MPP_MessageEX.js const baseParameters = PluginManager.parameters('MPP_MessageEX'); const param_RubyOy = Number(baseParameters['Ruby Oy'] || 0); const param_DefaultRubySize = Number(baseParameters['Default Ruby Size'] || 14); // Dealing with other plugins const __base = (obj, prop) => { if (obj.hasOwnProperty(prop)) { return obj[prop]; } else { const proto = Object.getPrototypeOf(obj); return function () { return proto[prop].apply(this, arguments); }; } }; // RPG Maker Param const _textColor = function (index) { return Utils.RPGMAKER_NAME === 'MV' ? this.textColor(index) : ColorManager.textColor(index); }; const _fontSize = function () { return Utils.RPGMAKER_NAME === 'MV' ? this.standardFontSize() : $gameSystem.mainFontSize(); }; //------------------------------------------------------------------------- // PluginManager PluginManager.registerCommand(pluginName, 'speakerName', args => { $gameMessage.setBasicSpeakerName(args.name || ''); }); //------------------------------------------------------------------------- // Game_Message const _Game_Message_initialize = Game_Message.prototype.initialize; Game_Message.prototype.initialize = function () { _Game_Message_initialize.apply(this, arguments); this._basicSpeakerName = ''; }; const _Game_Message_clear = Game_Message.prototype.clear; Game_Message.prototype.clear = function () { _Game_Message_clear.apply(this, arguments); this._nameColorIndex = 0; }; Game_Message.prototype.clearBasicSpeakerName = function () { this._basicSpeakerName = ''; }; Game_Message.prototype.basicSpeakerName = function () { return this._basicSpeakerName; }; Game_Message.prototype.nameColorIndex = function () { return this._nameColorIndex; }; Game_Message.prototype.setBasicSpeakerName = function (name) { this._basicSpeakerName = name || ''; }; Game_Message.prototype.setNameColorIndex = function (colorIndex) { this._nameColorIndex = colorIndex; }; if (!Game_Message.prototype.isRTL) { Game_Message.prototype.isRTL = function () { return false; }; } //----------------------------------------------------------------------------- // Game_Interpreter const _mzCommands = { SetSpeakerName: { name: 'speakerName', keys: ['name'] } }; Object.assign(_mzCommands, { 'メッセージ名前表示': _mzCommands.SetSpeakerName }); const _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand; Game_Interpreter.prototype.pluginCommand = function (command, args) { _Game_Interpreter_pluginCommand.apply(this, arguments); const params = _mzCommands[command]; if (params) { const args2 = Object.assign(...params.keys.map((k, i) => ({ [k]: args[i] }))); PluginManager.callCommand(this, pluginName, params.name, args2); } }; //----------------------------------------------------------------------------- // Window_Message Window_Message.prototype.setFaceBoxWindow = function (faceBoxWindow) { this._faceBoxWindow = faceBoxWindow; }; Window_Message.prototype.setNameBoxWindow = function (nameBoxWindow) { this._nameBoxWindow = nameBoxWindow; }; const _Window_Message_clearFlagsMessageEx = Window_Message.prototype.clearFlagsMessageEx; Window_Message.prototype.clearFlagsMessageEx = function () { _Window_Message_clearFlagsMessageEx.call(this); this._faceParams = { mirror: $gameMessage.isRTL() }; this._speakerName = ''; this._nameColorIndex = param_NameWindow['Default Color'] || 0; }; const _Window_Message_convertEscapeCharacters = Window_Message.prototype.convertEscapeCharacters; Window_Message.prototype.convertEscapeCharacters = function (text) { text = _Window_Message_convertEscapeCharacters.apply(this, arguments); text = text.replace(/\x1bF([LRMW]+)/gi, (_, p1) => { const code = p1.toUpperCase(); if (code.includes('L')) this._faceParams.right = false; if (code.includes('R')) this._faceParams.right = true; if (code.includes('M')) this._faceParams.mirror = true; if (code.includes('W')) this._faceParams.onBox = true; return ''; }); text = text.replace(/\x1bNW\[([^\]]+)\]/gi, (_, p1) => { this._speakerName = p1; return ''; }); text = text.replace(/\x1bNC\[(\d+)\]/gi, (_, p1) => { this._nameColorIndex = Number(p1); return ''; }); return text; }; const _Window_Message_update = Window_Message.prototype.update; Window_Message.prototype.update = function () { _Window_Message_update.apply(this, arguments); this.synchronizeNameBoxMV(); }; Window_Message.prototype.synchronizeNameBoxMV = function () { if (Utils.RPGMAKER_NAME === 'MV') { this._nameBoxWindow.openness = this.openness; } }; const _Window_Message_startMessage = Window_Message.prototype.startMessage; Window_Message.prototype.startMessage = function () { this._faceBoxWindow.clear(); _Window_Message_startMessage.apply(this, arguments); this._faceBoxWindow.start(); this._nameBoxWindow.start(); }; const _Window_Message_terminateMessageEx = Window_Message.prototype.terminateMessageEx; Window_Message.prototype.terminateMessageEx = function () { _Window_Message_terminateMessageEx.call(this); this._faceBoxWindow.needClose(); }; const _Window_Message_newPage = Window_Message.prototype.newPage; Window_Message.prototype.newPage = function (textState) { _Window_Message_newPage.apply(this, arguments); if (Utils.RPGMAKER_NAME === 'MV') this.updateSpeakerNameMv(); this.updateSpeakerFace(); }; const _Window_Message_updateSpeakerName = Window_Message.prototype.updateSpeakerName; Window_Message.prototype.updateSpeakerName = function () { $gameMessage.setNameColorIndex(this._nameColorIndex); _Window_Message_updateSpeakerName.apply(this, arguments); }; Window_Message.prototype.updateSpeakerNameMv = function () { $gameMessage.setNameColorIndex(this._nameColorIndex); if (this._speakerName !== '') { $gameMessage.clearBasicSpeakerName(); } const name = this._speakerName || $gameMessage.basicSpeakerName(); this._nameBoxWindow.setName(name); }; Window_Message.prototype.updateSpeakerFace = function () { const faceName = $gameMessage.faceName(); const faceIndex = $gameMessage.faceIndex(); this._faceBoxWindow.setParam(faceName, faceIndex, this._faceParams); }; Window_Message.prototype.drawMessageFace = function () { this._faceBoxWindow.refresh(); }; const _Window_Message_newLineX = Window_Message.prototype.newLineX; Window_Message.prototype.newLineX = function () { const { right, onBox = false } = this._faceParams; return onBox || right ? 0 : _Window_Message_newLineX.apply(this, arguments); }; //------------------------------------------------------------------------- // Window_FaceBox function Window_FaceBox() { this.initialize.apply(this, arguments); } Window_FaceBox.prototype = Object.create(Window_Base.prototype); Window_FaceBox.prototype.constructor = Window_FaceBox; Window_FaceBox.prototype.initialize = function () { if (Utils.RPGMAKER_NAME === 'MV') { Window_Base.prototype.initialize.call(this, 0, 0, 0, 0); } else { Window_Base.prototype.initialize.call(this, new Rectangle()); } this.openness = 0; this._targetX = 0; this._moveDuration = 0; this._needClose = false; this.clear(); }; Window_FaceBox.prototype.setMessageWindow = function (messageWindow) { this._messageWindow = messageWindow; }; Window_FaceBox.prototype.clear = function () { this._faceName = ''; this._faceIndex = 0; this._onBox = false; this._mirror = false; this._right = false; }; Window_FaceBox.prototype.loadWindowskin = function () { const name = param_FaceWindow['Windowskin'] || 'Window'; this.windowskin = ImageManager.loadSystem(name); }; Window_FaceBox.prototype.needClose = function () { this._needClose = true; }; Window_FaceBox.prototype.setParam = function (faceName, faceIndex, params) { this._faceName = faceName; this._faceIndex = faceIndex; this._onBox = !!params.onBox; this._right = params.right; this._mirror = !!params.mirror; }; Window_FaceBox.prototype.update = function () { Window_Base.prototype.update.call(this); if (this._needClose) { this.close(); this._needClose = false; } this.updateMove(); }; Window_FaceBox.prototype.updateMove = function () { if (this._moveDuration > 0) { const d = this._moveDuration; this.x = (this.x * (d - 1) + this._targetX) / d; this._moveDuration--; } }; Window_FaceBox.prototype.start = function () { this.updatePlacement(); this.updateBackground(); this.updateMirror(); this.appear(); this.createContents(); }; Window_FaceBox.prototype.appear = function () { this._targetX = this.windowX(); const targetY = this.windowY(); if (!this._onBox) { this.x = this._targetX; this._moveDuration = 0; } else if (this.isClosed() || this.x !== this._targetX || this.y !== targetY) { const boxMarginX = (Graphics.width - Graphics.boxWidth) / 2 this.x = (this._right ? Graphics.width : -this.width) - boxMarginX; this._moveDuration = 8; } this.y = targetY; this.openness = 255; this._closing = false; this._needClose = false; }; Window_FaceBox.prototype.updatePlacement = function () { this.padding = this._onBox ? param_FaceWindow['Padding'] || 12 : this._messageWindow.padding; this.width = this.windowWidth(); this.height = this.windowHeight(); }; Window_FaceBox.prototype.windowX = function () { const messageWindow = this._messageWindow; const targetX = messageWindow.x + (this._right ? messageWindow.width - this.width : 0); if (this._onBox) { const offsetX = param_FaceWindow['Offset X'] || 0; return targetX + offsetX; } else { return targetX; } }; Window_FaceBox.prototype.windowY = function () { const messageWindow = this._messageWindow; if (this._onBox) { const offsetY = param_FaceWindow['Offset Y'] || 0; if (messageWindow.y >= this.height) { return messageWindow.y - this.height + offsetY; } else { return messageWindow.y + messageWindow.height + offsetY; } } else { return messageWindow.y; } }; Window_FaceBox.prototype.updateBackground = function () { const background = this._onBox ? $gameMessage.background() : 2; this.setBackgroundType(background); this._isWindow = this._onBox; }; Window_FaceBox.prototype.updateMirror = function () { const contentsSprite = this._windowContentsSprite || this._contentsSprite; contentsSprite.anchor.x = this._mirror ? 1 : 0; contentsSprite.scale.x = this._mirror ? -1 : 1; }; Window_FaceBox.prototype.windowWidth = function () { const faceWidth = Window_Base._faceWidth || ImageManager.faceWidth; const padding = this.padding + (this._onBox ? 0 : 4); return faceWidth + padding * 2; }; Window_FaceBox.prototype.windowHeight = function () { if (this._onBox) { const faceHeight = Window_Base._faceHeight || ImageManager.faceHeight; return faceHeight + this.padding * 2; } else { return this._messageWindow.height; } }; Window_FaceBox.prototype.refresh = function () { this.contents.clear(); const height = this.height - this.padding * 2; const faceHeight = Window_Base._faceHeight || ImageManager.faceHeight; const dx = this._onBox ? 0 : 4; const dy = Math.floor((height - faceHeight) / 2); Window_Base.prototype.drawFace.call( this, this._faceName, this._faceIndex, dx, dy ); }; //------------------------------------------------------------------------- // Window_NameBox if (Utils.RPGMAKER_NAME === 'MZ') { Window_NameBox.prototype.loadWindowskin = function () { const name = param_NameWindow['Windowskin'] || 'Window'; this.windowskin = ImageManager.loadSystem(name); }; Window_NameBox.prototype.lineHeight = function () { const spacing = param_NameWindow['Offset Line Spacing'] || 0; return this.contents.fontSize + 10 + spacing; }; Window_NameBox.prototype.updatePadding = function () { this.padding = param_NameWindow['Padding'] || $gameSystem.windowPadding(); }; const _Window_NameBox_resetFontSettings = Window_NameBox.prototype.resetFontSettings; Window_NameBox.prototype.resetFontSettings = function () { _Window_NameBox_resetFontSettings.apply(this, arguments); this.contents.fontSize = param_NameWindow['Font Size'] || _fontSize.call(this); this.resetTextColor(); }; const _Window_NameBox_resetTextColor = __base(Window_NameBox.prototype, 'resetTextColor'); Window_NameBox.prototype.resetTextColor = function () { _Window_NameBox_resetTextColor.apply(this, arguments); const color = _textColor.call(this, $gameMessage.nameColorIndex()); this.changeTextColor(color); }; // overwrite Window_NameBox.prototype.windowHeight = function () { return this.itemHeight() + this.padding * 2 + this._rubyHeight; }; Window_NameBox.prototype.createTextState = function (text, x, y, width) { const textState = Window_Base.prototype.createTextState.apply(this, arguments); textState.y += this._rubyHeight; return textState; }; const _Window_NameBox_start = Window_NameBox.prototype.start; Window_NameBox.prototype.start = function () { this.updateRubyHeight(); _Window_NameBox_start.apply(this, arguments); }; Window_NameBox.prototype.updateRubyHeight = function () { Window_NameBoxMV.prototype.updateRubyHeight.call(this); }; const _Window_NameBox_processEscapeCharacter = __base(Window_NameBox.prototype, 'processEscapeCharacter'); Window_NameBox.prototype.processEscapeCharacter = function (code, textState) { if (code === 'RB') { this.processRubyCharacter(textState, this.obtainEscapeTexts(textState)); } else { _Window_NameBox_processEscapeCharacter.apply(this, arguments); } }; Window_NameBox.prototype.obtainEscapeTexts = function (textState) { return Window_Message.prototype.obtainEscapeTexts.call(this, textState); }; Window_NameBox.prototype.processRubyCharacter = function (textState, texts) { const c = texts[0]; const cw = this.textWidth(c); const fontSize = this.contents.fontSize; const textColor = this.contents.textColor; this.contents.fontSize = param_DefaultRubySize; const r = texts[1]; const rw = this.textWidth(r); const maxWidth = Math.max(cw, rw); if (textState.drawing) { if (param_NameWindow['Ruby Color']) { this.changeTextColor('rgb(%1)'.format(param_NameWindow['Ruby Color'])); } const rx = textState.x + (maxWidth - rw) / 2; const ry = textState.y - this._rubyHeight + param_RubyOy; this.contents.drawText(r, rx, ry, rw * 2, param_DefaultRubySize + 4); const cx = textState.x + (maxWidth - cw) / 2; this.changeTextColor(textColor); this.contents.fontSize = fontSize; this.contents.drawText(c, cx, textState.y, cw * 2, textState.height); } else { this.contents.fontSize = fontSize; } textState.x += maxWidth; }; const _Window_NameBox_updatePlacement = Window_NameBox.prototype.updatePlacement; Window_NameBox.prototype.updatePlacement = function () { _Window_NameBox_updatePlacement.apply(this, arguments); const offsetX = param_NameWindow['Offset X'] || 0; const offsetY = param_NameWindow['Offset Y'] || 0; this.x += $gameMessage.isRTL() ? -offsetX : offsetX; this.y += this._messageWindow.y > 0 ? offsetY : -offsetY; }; } //------------------------------------------------------------------------- // Window_NameBoxMV function Window_NameBoxMV() { this.initialize(...arguments); } Window_NameBoxMV.prototype = Object.create(Window_Base.prototype); Window_NameBoxMV.prototype.constructor = Window_NameBoxMV; Window_NameBoxMV.prototype.initialize = function () { Window_Base.prototype.initialize.call(this, 0, 0, 0, 0); this.openness = 0; this._name = ''; }; Window_NameBoxMV.prototype.lineHeight = function () { const spacing = param_NameWindow['Offset Line Spacing'] || 0; return this.contents.fontSize + 8 + spacing; }; Window_NameBoxMV.prototype.standardPadding = function () { return param_NameWindow['Padding'] || Window_Base.prototype.standardPadding.call(this); }; Window_NameBoxMV.prototype.setMessageWindow = function (messageWindow) { this._messageWindow = messageWindow; }; Window_NameBoxMV.prototype.loadWindowskin = function () { const name = param_NameWindow['Windowskin'] || 'Window'; this.windowskin = ImageManager.loadSystem(name); }; Window_NameBoxMV.prototype.setName = function (name) { if (this._name !== name) { this._name = name; this.refresh(); } }; Window_NameBoxMV.prototype.clear = function () { this.setName(''); }; Window_NameBoxMV.prototype.start = function () { this.updateRubyHeight(); this.updatePlacement(); this.updateBackground(); this.createContents(); this.refresh(); }; Window_NameBoxMV.prototype.updateRubyHeight = function () { this._rubyHeight = 0; const text = this.convertEscapeCharacters(this._name); const regExp = /\x1bRB\[.+?\]/i; if (param_NameWindow['Always Leave Ruby Height'] || regExp.test(text)) { this._rubyHeight = Math.max(param_DefaultRubySize - param_RubyOy, 4); } }; Window_NameBoxMV.prototype.updatePlacement = function () { this.width = this.windowWidth(); this.height = this.windowHeight(); const messageWindow = this._messageWindow; const offsetX = param_NameWindow['Offset X'] || 0; const offsetY = param_NameWindow['Offset Y'] || 0; this.x = messageWindow.x + offsetX; if (messageWindow.y > 0) { this.y = messageWindow.y - this.height + offsetY; } else { this.y = messageWindow.y + messageWindow.height - offsetY; } }; Window_NameBoxMV.prototype.updateBackground = function () { this.setBackgroundType($gameMessage.background()); }; Window_NameBoxMV.prototype.windowWidth = function () { if (this._name) { const textWidth = this.textWidthEx(this._name); const padding = this.padding + this.textPadding(); const width = Math.ceil(textWidth) + padding * 2; return Math.min(width, Graphics.boxWidth); } else { return 0; } }; Window_NameBoxMV.prototype.windowHeight = function () { return this.fittingHeight(1) + this._rubyHeight; }; Window_NameBoxMV.prototype.refresh = function () { this.contents.clear(); const pad = this.textPadding(); const width = this.contents.width - pad * 2; this.drawTextEx(this._name, pad, this._rubyHeight, width); }; Window_NameBoxMV.prototype.textWidthEx = function (text) { return this.drawTextEx(text, 0, this.contents.height + this._rubyHeight); }; Window_NameBoxMV.prototype.resetFontSettings = function () { Window_Base.prototype.resetFontSettings.call(this); this.contents.fontSize = param_NameWindow['Font Size'] || _fontSize.call(this); this.resetTextColor(); }; Window_NameBoxMV.prototype.resetTextColor = function () { Window_Base.prototype.resetTextColor.call(this); const color = _textColor.call(this, $gameMessage.nameColorIndex()); this.changeTextColor(color); }; Window_NameBoxMV.prototype.processEscapeCharacter = function (code, textState) { if (code === 'RB') { this.processRubyCharacter(textState, this.obtainEscapeTexts(textState)); } else { Window_Base.prototype.processEscapeCharacter.call(this, code, textState); } }; Window_NameBoxMV.prototype.obtainEscapeTexts = function (textState) { return Window_Message.prototype.obtainEscapeTexts.call(this, textState); }; Window_NameBoxMV.prototype.processRubyCharacter = function (textState, texts) { const c = texts[0]; const cw = this.textWidth(c); const fontSize = this.contents.fontSize; const textColor = this.contents.textColor; this.contents.fontSize = param_DefaultRubySize; const r = texts[1]; const rw = this.textWidth(r); const maxWidth = Math.max(cw, rw); if (param_NameWindow['Ruby Color']) { this.changeTextColor('rgb(%1)'.format(param_NameWindow['Ruby Color'])); } const rx = textState.x + (maxWidth - rw) / 2; const ry = textState.y - this._rubyHeight + param_RubyOy; this.contents.drawText(r, rx, ry, rw + 8, param_DefaultRubySize + 4); const cx = textState.x + (maxWidth - cw) / 2; this.changeTextColor(textColor); this.contents.fontSize = fontSize; this.contents.drawText(c, cx, textState.y, cw + 8, textState.height); textState.x += maxWidth; }; Window_NameBoxMV.prototype.calcTextHeight = function (textState, all) { const textHeight = Window_Base.prototype.calcTextHeight.call(this, textState, all); const spacing = param_NameWindow['Offset Line Spacing'] || 0; return textHeight + spacing; }; //----------------------------------------------------------------------------- // Scene_Message if (Utils.RPGMAKER_NAME === 'MZ') { const _Scene_Message_createAllWindows = Scene_Message.prototype.createAllWindows; Scene_Message.prototype.createAllWindows = function () { _Scene_Message_createAllWindows.apply(this, arguments); this.createFaceBoxWindow(); this._messageWindow.setFaceBoxWindow(this._faceBoxWindow); this._faceBoxWindow.setMessageWindow(this._messageWindow); }; Scene_Message.prototype.createFaceBoxWindow = function () { this._faceBoxWindow = new Window_FaceBox(); const index = this._windowLayer.children.indexOf(this._nameBoxWindow); this._windowLayer.addChildAt(this._faceBoxWindow, index); }; } //------------------------------------------------------------------------- // Scene_Map if (Utils.RPGMAKER_NAME === 'MV') { const _Scene_Map_createAllWindows = Scene_Map.prototype.createAllWindows; Scene_Map.prototype.createAllWindows = function () { _Scene_Map_createAllWindows.apply(this, arguments); this.createFaceBoxWindowMV(); this.createNameBoxWindowMV(); this.associateWindowsMessageEx(); }; Scene_Map.prototype.createFaceBoxWindowMV = function () { this._faceBoxWindow = new Window_FaceBox(); this.addWindow(this._faceBoxWindow); }; Scene_Map.prototype.createNameBoxWindowMV = function () { this._nameBoxWindow = new Window_NameBoxMV(); this.addWindow(this._nameBoxWindow); }; Scene_Map.prototype.associateWindowsMessageEx = function () { const messageWindow = this._messageWindow; messageWindow.setNameBoxWindow(this._nameBoxWindow); messageWindow.setFaceBoxWindow(this._faceBoxWindow); this._nameBoxWindow.setMessageWindow(messageWindow); this._faceBoxWindow.setMessageWindow(messageWindow); }; } //------------------------------------------------------------------------- // Scene_Battle if (Utils.RPGMAKER_NAME === 'MV') { const _Scene_Battle_createAllWindows = Scene_Battle.prototype.createAllWindows; Scene_Battle.prototype.createAllWindows = function () { _Scene_Battle_createAllWindows.apply(this, arguments); this.createFaceBoxWindowMV(); this.createNameBoxWindowMV(); this.associateWindowsMessageEx(); }; Scene_Battle.prototype.createFaceBoxWindowMV = function () { this._faceBoxWindow = new Window_FaceBox(); this.addWindow(this._faceBoxWindow); }; Scene_Battle.prototype.createNameBoxWindowMV = function () { this._nameBoxWindow = new Window_NameBoxMV(); this.addWindow(this._nameBoxWindow); }; Scene_Battle.prototype.associateWindowsMessageEx = function () { const messageWindow = this._messageWindow; messageWindow.setNameBoxWindow(this._nameBoxWindow); messageWindow.setFaceBoxWindow(this._faceBoxWindow); this._nameBoxWindow.setMessageWindow(messageWindow); this._faceBoxWindow.setMessageWindow(messageWindow); }; } })();
dazed/translations
www/js/plugins/MPP_MessageEX_Op1.js
JavaScript
unknown
36,528
//============================================================================= // MPP_MovePos.js //============================================================================= // Copyright (c) 2015 Mokusei Penguin // Released under the MIT license // http://opensource.org/licenses/mit-license.php //============================================================================= /*: * @plugindesc 【ver.1.0】指定座標まで自動で移動させるスクリプトの追加。 * @author 木星ペンギン * * @help [移動ルートの設定]内のスクリプト: * this.movePos(x, y) # 座標(x, y)に向かって移動します。 * this.movePos(x, y, skip) * * skip で true を設定した場合、移動できなかった時点で移動を中断します。 * * ●注意 * ・[移動ルートの設定]のオプションにある[移動できない場合は飛ばす]には * チェックを入れないでください。 * * ・プラグインパラメータで指定できる移動できる[Search Limit(移動できる距離)]が * 一度に移動できる最大距離です。 * 現在位置からこの数値以上に遠い座標を指定することはできません。 * 一度で移動するのではなく複数回に分けて移動させてください。 * * ・[Search Limit(移動できる距離)]を増やすことで一度に移動できる距離を * 増やせますが、処理が重くなります。 * * ================================ * 制作 : 木星ペンギン * URL : http://woodpenguin.blog.fc2.com/ * * @param Search Limit * @desc 移動できる距離 * @default 12 * */ (function () { var parameters = PluginManager.parameters('MPP_MovePos'); var searchLimit = Number(parameters['Search Limit']); Game_Character.prototype.movePos = function (x, y, skippable) { skippable = skippable || false; var direction = this.findDirectionTo(x, y); if (direction > 0) { this.moveStraight(direction); this.setMovementSuccess(false); } else if (Math.abs(this._x - x) + Math.abs(this._y - y) < searchLimit) { this.setMovementSuccess(skippable || this.pos(x, y)); } }; //558 Game_Character.prototype.searchLimit = function () { return searchLimit; }; })();
dazed/translations
www/js/plugins/MPP_MovePos.js
JavaScript
unknown
2,376
//============================================================================= // MPP_SelfVariable.js //============================================================================= // Copyright (c) 2017-2020 Mokusei Penguin // Released under the MIT license // http://opensource.org/licenses/mit-license.php //============================================================================= /*: * @plugindesc 【v1.3】各イベントにセルフ変数を追加します。 * @author 木星ペンギン * * @help プラグインコマンド: * DeleteSelfVariable mapIds var # 指定したマップIDのセルフ変数を0にする * SetSelfVariable mapIds evIds var n # セルフ変数の値を変更する * * ================================================================ * ▼ 概要 * -------------------------------- * 〇 セルフ変数について * ・プラグインパラメータにて設定した番号の変数が、 *   イベントごとのセルフ変数を参照するようになります。 * * ・イベントコマンドの[変数の操作]から設定した番号の変数の操作を行うと、 * 実行中のイベントのセルフ変数が変更されます。 * * ・イベントの[出現条件]ではセルフ変数が参照されます。 * * ・コモンイベントでセルフ変数を操作した場合、以下のようになります。 * >マップのイベントから[コモンイベントの呼び出し]を行った場合 * 各イベントのセルフ変数が参照されます。 * * >コモンイベントを自動実行or並列実行した場合 * コモンイベントごとのセルフ変数が参照されます。 * * ・トループのバトルイベントにはセルフ変数が適用されません。 * 通常の変数と同じ扱いとなります。 * * ・通常のイベントでも、並列処理の場合は以下のコマンドでは使用できません。 *   (並列処理でなければ使用できます) * >文章の表示(制御文字) * >選択肢の表示(制御文字) * >数値入力の処理 * >アイテム選択の処理 * >文章のスクロール表示(制御文字) * * * ================================================================ * ▼ パラメータ全般 * -------------------------------- * 〇 範囲指定について * 一部のプラグインコマンドとプラグインパラメータでは範囲指定が使用できます。 * * n-m と表記することで、nからmまでの数値を指定できます。 * (例 : 1-4,8,10-12 => 1,2,3,4,8,10,11,12) * * * ================================================================ * ▼ プラグインコマンド詳細 * -------------------------------- * 〇 DeleteSelfVariable mapIds var * mapIds : マップID (範囲指定可) * var : 0にするセルフ変数の番号 (範囲指定可) * * 指定したマップIDの指定したセルフ変数を全て0にします。 * v[n] と指定することで変数 n 番の値を参照します。 * 範囲指定する場合は間にスペースを入れないでください。 * * 例: DeleteSelfVariable 1 3 * => マップID 1 番のセルフ変数 3 番を0にします。 * * DeleteSelfVariable v[13] 1-5 * => 変数 n 番のマップIDのセルフ変数 1~5 番を0にします。 * * DeleteSelfVariable 1-5,8 1,2 * => マップID 1~5と8 のセルフ変数 1と2 番を0にします。 * * -------------------------------- * 〇 SetSelfVariable mapIds evIds var n * mapIds : マップID (範囲指定可) * evIds : イベントID (範囲指定可) * var : セルフ変数の番号 (範囲指定可) * n : 設定する値 * * マップID、イベントID、セルフ変数番号を指定して、値 n を設定します。 * v[n] と指定することで変数 n 番の値を参照します。 * 範囲指定する場合は間にスペースを入れないでください。 * * 例: SetSelfVariable 1 2 3 5 * => マップID 1 番のイベントID 3 番のセルフ変数 3 番を5にします。 * * DeleteSelfVariable 1-3 1,3,5 2-5, v[5] * => マップID 1~3 番のイベントID 1と3と5 番のセルフ変数 2~5 番を * 変数 5 番の値にします。 * * * ================================================================ * ▼ プラグインパラメータ 詳細 * -------------------------------- * 〇 Plugin Commands * プラグインコマンド名はプラグインパラメータから変更できます。 * コマンドを短くしたり日本語にしたりなどして、自分が使いやすいようにしてください。 * 変更後もデフォルトのコマンドでも動作します。 * * * ================================ * 制作 : 木星ペンギン * URL : http://woodpenguin.blog.fc2.com/ * * @param === Basic === * @default 【基本的な設定】 * * @param Variables * @desc セルフ変数にする変数の番号 * (範囲指定可) * @default * @parent === Basic === * * @param === Command === * @default 【コマンド関連】 * * @param Plugin Commands * @type struct<Plugin> * @desc プラグインコマンド名 * @default {"DeleteSelfVariable":"DeleteSelfVariable","SetSelfVariable":"SetSelfVariable"} * @parent === Command === * */ /*~struct~Plugin: * @param DeleteSelfVariable * @desc 指定したマップIDのセルフスイッチをOFFにする * @default DeleteSelfVariable * * @param SetSelfVariable * @desc セルフ変数の値を変更する * @default SetSelfVariable * */ var MPP = MPP || {}; (function (exports) { 'use strict'; MPP.paramRange = MPP.paramRange || function (param) { var result = []; param.split(',').forEach(id => { if (/(\d+)-(\d+)/.test(id)) { for (var n = Number(RegExp.$1); n <= Number(RegExp.$2); n++) { result.push(n); } } else { result.push(Number(id)); } }); return result; }; const Params = {}; { let parameters = PluginManager.parameters('MPP_SelfVariable'); Params.Variables = MPP.paramRange(parameters['Variables']); //=== Command === Params.PluginCommands = JSON.parse(parameters['Plugin Commands']); } const Alias = {}; //----------------------------------------------------------------------------- // Game_Variables //15 Alias.GaVa_clear = Game_Variables.prototype.clear; Game_Variables.prototype.clear = function () { Alias.GaVa_clear.apply(this, arguments); this._selfVariables = {}; this._mapId = 0; this._eventId = 0; }; //19 Alias.GaVa_value = Game_Variables.prototype.value; Game_Variables.prototype.value = function (variableId) { if (this._eventId > 0 && Params.Variables.contains(variableId)) { var key = [this._mapId, this._eventId, variableId]; return this._selfVariables[key] || 0; } else { return Alias.GaVa_value.apply(this, arguments); } }; //23 Alias.GaVa_setValue = Game_Variables.prototype.setValue; Game_Variables.prototype.setValue = function (variableId, value) { if (this._eventId > 0 && Params.Variables.contains(variableId)) { if (typeof value === 'number') { value = Math.floor(value); } var key = [this._mapId, this._eventId, variableId]; this._selfVariables[key] = value; this.onChange(); } else { Alias.GaVa_setValue.apply(this, arguments); } }; Game_Variables.prototype.setSelfVariable = function (mapId, eventId, variableId, value) { if (eventId > 0 && eventId > 0 && Params.Variables.contains(variableId)) { if (typeof value === 'number') { value = Math.floor(value); } var key = [mapId, eventId, variableId]; this._selfVariables[key] = value; this.onChange(); } }; Game_Variables.prototype.deleteSelfVariables = function (mapId, evIds, vaIds) { var re = new RegExp(mapId + ',(\\d+),(\\d+)'); for (var key in this._selfVariables) { if (re.test(key)) { if ((evIds.length === 0 || evIds.includes(parseInt(RegExp.$1))) && (vaIds.length === 0 || vaIds.includes(parseInt(RegExp.$2)))) { delete this._selfVariables[key]; } } } this.onChange(); }; Game_Variables.prototype.reserveEvent = function (mapId, eventId) { this._mapId = mapId; this._eventId = eventId; }; //----------------------------------------------------------------------------- // Game_Event //188 Alias.GaEv_findProperPageIndex = Game_Event.prototype.findProperPageIndex; Game_Event.prototype.findProperPageIndex = function () { $gameVariables.reserveEvent(this._mapId, this._eventId); return Alias.GaEv_findProperPageIndex.apply(this, arguments); }; //----------------------------------------------------------------------------- // Game_CommonEvent //24 Alias.GaCoEv_refresh = Game_CommonEvent.prototype.refresh; Game_CommonEvent.prototype.refresh = function () { Alias.GaCoEv_refresh.apply(this, arguments); if (this._interpreter) { this._interpreter._commonEventId = this._commonEventId; } }; //----------------------------------------------------------------------------- // Game_Interpreter //55 Alias.GaIn_setupReservedCommonEvent = Game_Interpreter.prototype.setupReservedCommonEvent; Game_Interpreter.prototype.setupReservedCommonEvent = function () { this._commonEventId = $gameTemp._commonEventId; return Alias.GaIn_setupReservedCommonEvent.apply(this, arguments); }; //68 Alias.GaIn_update = Game_Interpreter.prototype.update; Game_Interpreter.prototype.update = function () { this.reserveSelfVar(); Alias.GaIn_update.apply(this, arguments); }; //608 Alias.GaIn_setupChild = Game_Interpreter.prototype.setupChild; Game_Interpreter.prototype.setupChild = function (list, eventId) { Alias.GaIn_setupChild.apply(this, arguments); this._childInterpreter._commonEventId = this._commonEventId; }; Game_Interpreter.prototype.reserveSelfVar = function () { if (this._commonEventId) { $gameVariables.reserveEvent(-1, this._commonEventId); } else { $gameVariables.reserveEvent(this._mapId, this._eventId); } }; //1722 Alias.GaIn_pluginCommand = Game_Interpreter.prototype.pluginCommand; Game_Interpreter.prototype.pluginCommand = function (command, args) { Alias.GaIn_pluginCommand.apply(this, arguments); var args2 = this.mppPluginCommandArgs2(args); switch (command) { case Params.PluginCommands.DeleteSelfVariable: case 'DeleteSelfVariable': var varIds = MPP.paramRange(args2[1]); MPP.paramRange(args2[0]).forEach(function (mapId) { $gameVariables.deleteSelfVariables(mapId, [], varIds); }); break; case Params.PluginCommands.SetSelfVariable: case 'SetSelfVariable': var mapIds = MPP.paramRange(args2[0]); var evIds = MPP.paramRange(args2[1]); var varIds = MPP.paramRange(args2[2]); mapIds.forEach(n1 => evIds.forEach(n2 => varIds.forEach(n3 => $gameVariables.setSelfVariable(n1, n2, n3, args2[3])))); break; } }; Game_Interpreter.prototype.mppPluginCommandArgs2 = function (args) { var convertVar = function () { return $gameVariables.value(parseInt(arguments[1])); }; return args.map(arg => arg.replace(/v\[(\d+)\]/gi, convertVar)); }; })(this);
dazed/translations
www/js/plugins/MPP_SelfVariable.js
JavaScript
unknown
12,424
/*: * NOTE: Images are stored in the img/system folder. * * @plugindesc Show a Splash Screen "Made with MV" and/or a Custom Splash Screen before going to main screen. * @author Dan "Liquidize" Deptula * * @help This plugin does not provide plugin commands. * * @param Show Made With MV * @desc Enabled/Disables showing the "Made with MV" splash screen. * OFF - false ON - true * Default: ON * @default true * * @param Made with MV Image * @desc The image to use when showing "Made with MV" * Default: MadeWithMv * @default MadeWithMv * @require 1 * @dir img/system/ * @type file * * @param Show Custom Splash * @desc Enabled/Disables showing the "Made with MV" splash screen. * OFF - false ON - true * Default: OFF * @default false * * @param Custom Image * @desc The image to use when showing "Made with MV" * Default: * @default * @require 1 * @dir img/system/ * @type file * * @param Fade Out Time * @desc The time it takes to fade out, in frames. * Default: 120 * @default 120 * * @param Fade In Time * @desc The time it takes to fade in, in frames. * Default: 120 * @default 120 * * @param Wait Time * @desc The time between fading in and out, in frames. * Default: 160 * @default 160 * */ /*:ja * メモ: イメージはimg/systemフォルダ内に保存されます。 * * @plugindesc メイン画面へ進む前に、"Made with MV"のスプラッシュ画面もしくはカスタマイズされたスプラッシュ画面を表示します。 * @author Dan "Liquidize" Deptula * * @help このプラグインにはプラグインコマンドはありません。 * * @param Show Made With MV * @desc "Made with MV"のスプラッシュ画面を表示できる/できないようにします。 * OFF - false ON - true * デフォルト: ON * @default true * * @param Made with MV Image * @desc "Made with MV"を表示する際に使用する画像 * デフォルト: MadeWithMv * @default MadeWithMv * @require 1 * @dir img/system/ * @type file * * @param Show Custom Splash * @desc "Made with MV"のスプラッシュ画面を表示できる/できないようにします。 * OFF - false ON - true * デフォルト: OFF * @default false * * @param Custom Image * @desc "Made with MV"を表示する際に使用する画像 * デフォルト: * @default * @require 1 * @dir img/system/ * @type file * * @param Fade Out Time * @desc フェードアウトに要する時間(フレーム数) * デフォルト: 120 * @default 120 * * @param Fade In Time * @desc フェードインに要する時間(フレーム数) * デフォルト: 120 * @default 120 * * @param Wait Time * @desc フェードインからフェードアウトまでに要する時間(フレーム数) * デフォルト: 160 * @default 160 * */ var Liquidize = Liquidize || {}; Liquidize.MadeWithMV = {}; Liquidize.MadeWithMV.Parameters = PluginManager.parameters('MadeWithMv'); Liquidize.MadeWithMV.ShowMV = JSON.parse(Liquidize.MadeWithMV.Parameters["Show Made With MV"]); Liquidize.MadeWithMV.MVImage = String(Liquidize.MadeWithMV.Parameters["Made with MV Image"]); Liquidize.MadeWithMV.ShowCustom = JSON.parse(Liquidize.MadeWithMV.Parameters["Show Custom Splash"]); Liquidize.MadeWithMV.CustomImage = String(Liquidize.MadeWithMV.Parameters["Custom Image"]); Liquidize.MadeWithMV.FadeOutTime = Number(Liquidize.MadeWithMV.Parameters["Fade Out Time"]) || 120; Liquidize.MadeWithMV.FadeInTime = Number(Liquidize.MadeWithMV.Parameters["Fade In Time"]) || 120; Liquidize.MadeWithMV.WaitTime = Number(Liquidize.MadeWithMV.Parameters["Wait Time"]) || 160; //----------------------------------------------------------------------------- // Scene_Splash // // This is a constructor, implementation is done in the inner scope. function Scene_Splash() { this.initialize.apply(this, arguments); } (function () { //----------------------------------------------------------------------------- // Scene_Boot // // The scene class for dealing with the game boot. var _Scene_Boot_loadSystemImages = Scene_Boot.prototype.loadSystemImages; Scene_Boot.prototype.loadSystemImages = function () { _Scene_Boot_loadSystemImages.call(this); if (Liquidize.MadeWithMV.ShowMV) { ImageManager.loadSystem(Liquidize.MadeWithMV.MVImage); } if (Liquidize.MadeWithMV.ShowCustom) { ImageManager.loadSystem(Liquidize.MadeWithMV.CustomImage); } }; var _Scene_Boot_start = Scene_Boot.prototype.start; Scene_Boot.prototype.start = function () { if ((Liquidize.MadeWithMV.ShowMV || Liquidize.MadeWithMV.ShowCustom) && !DataManager.isBattleTest() && !DataManager.isEventTest()) { SceneManager.goto(Scene_Splash); } else { _Scene_Boot_start.call(this); } }; //----------------------------------------------------------------------------- // Scene_Splash // // The scene class for dealing with the splash screens. Scene_Splash.prototype = Object.create(Scene_Base.prototype); Scene_Splash.prototype.constructor = Scene_Splash; Scene_Splash.prototype.initialize = function () { Scene_Base.prototype.initialize.call(this); this._mvSplash = null; this._customSplash = null; this._mvWaitTime = Liquidize.MadeWithMV.WaitTime; this._customWaitTime = Liquidize.MadeWithMV.WaitTime; this._mvFadeOut = false; this._mvFadeIn = false; this._customFadeOut = false; this._customFadeIn = false; }; Scene_Splash.prototype.create = function () { Scene_Base.prototype.create.call(this); this.createSplashes(); }; Scene_Splash.prototype.start = function () { Scene_Base.prototype.start.call(this); SceneManager.clearStack(); if (this._mvSplash != null) { this.centerSprite(this._mvSplash); } if (this._customSplash != null) { this.centerSprite(this._customSplash); } }; Scene_Splash.prototype.update = function () { if (Liquidize.MadeWithMV.ShowMV) { if (!this._mvFadeIn) { this.startFadeIn(Liquidize.MadeWithMV.FadeInTime, false); this._mvFadeIn = true; } else { if (this._mvWaitTime > 0 && this._mvFadeOut == false) { this._mvWaitTime--; } else { if (this._mvFadeOut == false) { this._mvFadeOut = true; this.startFadeOut(Liquidize.MadeWithMV.FadeOutTime, false); } } } } if (Liquidize.MadeWithMV.ShowCustom) { if (Liquidize.MadeWithMV.ShowMV && this._mvFadeOut == true) { if (!this._customFadeIn && this._fadeDuration == 0) { this._customSplash.opacity = 255; this._customWaitTime = Liquidize.MadeWithMV.WaitTime; this.startFadeIn(Liquidize.MadeWithMV.FadeInTime, false); this._customFadeIn = true; } else { if (this._customWaitTime > 0 && this._customFadeOut == false) { this._customWaitTime--; } else { if (this._customFadeOut == false) { this._customFadeOut = true; this.startFadeOut(Liquidize.MadeWithMV.FadeOutTime, false); } } } } else if (!Liquidize.MadeWithMV.ShowMV) { if (!this._customFadeIn) { this._customSplash.opacity = 255; this.startFadeIn(Liquidize.MadeWithMV.FadeInTime, false); this._customFadeIn = true; } else { if (this._customWaitTime > 0 && this._customFadeOut == false) { this._customWaitTime--; } else { if (this._customFadeOut == false) { this._customFadeOut = true; this.startFadeOut(Liquidize.MadeWithMV.FadeOutTime, false); } } } } } if (Liquidize.MadeWithMV.ShowCustom) { if (Liquidize.MadeWithMV.ShowMV && this._mvFadeOut == true && this._customFadeOut == true) { this.gotoTitleOrTest(); } else if (!Liquidize.MadeWithMV.ShowMV && this._customFadeOut == true) { this.gotoTitleOrTest(); } } else { if (this._mvFadeOut == true) { this.gotoTitleOrTest(); } } Scene_Base.prototype.update.call(this); }; Scene_Splash.prototype.createSplashes = function () { if (Liquidize.MadeWithMV.ShowMV) { this._mvSplash = new Sprite(ImageManager.loadSystem(Liquidize.MadeWithMV.MVImage)); this.addChild(this._mvSplash); } if (Liquidize.MadeWithMV.ShowCustom) { this._customSplash = new Sprite(ImageManager.loadSystem(Liquidize.MadeWithMV.CustomImage)); this._customSplash.opacity = 0; this.addChild(this._customSplash); } }; Scene_Splash.prototype.centerSprite = function (sprite) { sprite.x = Graphics.width / 2; sprite.y = Graphics.height / 2; sprite.anchor.x = 0.5; sprite.anchor.y = 0.5; }; Scene_Splash.prototype.gotoTitleOrTest = function () { Scene_Base.prototype.start.call(this); SoundManager.preloadImportantSounds(); if (DataManager.isBattleTest()) { DataManager.setupBattleTest(); SceneManager.goto(Scene_Battle); } else if (DataManager.isEventTest()) { DataManager.setupEventTest(); SceneManager.goto(Scene_Map); } else { this.checkPlayerLocation(); DataManager.setupNewGame(); SceneManager.goto(Scene_Title); Window_TitleCommand.initCommandPosition(); } this.updateDocumentTitle(); }; Scene_Splash.prototype.updateDocumentTitle = function () { document.title = $dataSystem.gameTitle; }; Scene_Splash.prototype.checkPlayerLocation = function () { if ($dataSystem.startMapId === 0) { throw new Error('Player\'s starting position is not set'); } }; })();
dazed/translations
www/js/plugins/MadeWithMv.js
JavaScript
unknown
10,632
//============================================================================= // MakeScreenCapture.js // ---------------------------------------------------------------------------- // (C)2015-2018 Triacontane // This software is released under the MIT License. // http://opensource.org/licenses/mit-license.php // ---------------------------------------------------------------------------- // Version // 1.7.3 2018/06/28 出力パスの算出方法を変更 // 1.7.2 2018/03/06 各種ファンクションキーにCtrlおよびAltの同時押し要否の設定を追加しました。 // 1.7.1 2017/11/11 総合開発支援プラグインとの連携による修正 // 1.7.0 2017/08/13 パラメータの型指定機能に対応 // 1.6.0 2016/12/25 jpg保存時の拡張子を「jpeg」→「jpg」に変更 // jpeg品質をパラメータから指定できる機能を追加 // 1.5.0 2016/10/20 本体バージョン1.3.2でエラーが発生していたのを修正 // 1.4.0 2016/10/06 パラメータに環境変数を使えるように修正 // 1.3.0 2016/06/24 WEBP形式のショートカットキーを追加 // 1.2.3 2016/06/23 著名に画像とテキストを両方使えるよう修正 // 1.2.2 2016/05/13 プラグインコマンドから出力したときに拡張子の表示がおかしくなる問題を修正 // 1.2.1 2016/05/11 定期実行キャプチャを行ったときに拡張子の表示がおかしくなる問題を修正 // 1.2.0 2016/04/23 署名に任意の画像ファイルを利用できるようになりました。 // 細部のリファクタリング // 1.1.5 2016/04/10 画像の出力先を管理画面のパラメータとして設定できるよう修正 // 1.1.4 2016/03/31 画像の出力先を絶対パスで指定できるよう修正 // 1.1.3 2016/03/15 文章のスクロール表示が正しくキャプチャできない問題を修正 // 1.1.2 2016/03/01 pngとjpegの形式ごとのファンクションキーを割り当てるよう修正 // 1.1.1 2016/02/26 PrintScreenでもキャプチャできるように修正 // 1.1.0 2016/02/25 複数のウィンドウを含む画面で正しくキャプチャできない不具合を修正 // 高度な設定項目の追加 // 1.0.0 2016/02/24 初版 // ---------------------------------------------------------------------------- // [Blog] : https://triacontane.blogspot.jp/ // [Twitter]: https://twitter.com/triacontane/ // [GitHub] : https://github.com/triacontane/ //============================================================================= /*: * @plugindesc Screen Capture Plugin * @author triacontane * * @param FuncKeyPngCapture * @desc キャプチャとファイル保存を行うファンクションキーです。 * 保存形式の設定にかかわらずpng形式で出力します。 * @default F6 * @type select * @option none * @option F1 * @option F2 * @option F3 * @option F4 * @option F5 * @option F6 * @option F7 * @option F8 * @option F9 * @option F10 * @option F11 * @option F12 * * @param FuncKeyJpegCapture * @desc キャプチャとファイル保存を行うファンクションキーです。 * 保存形式の設定にかかわらずjpeg形式で出力します。 * @default F7 * @type select * @option none * @option F1 * @option F2 * @option F3 * @option F4 * @option F5 * @option F6 * @option F7 * @option F8 * @option F9 * @option F10 * @option F11 * @option F12 * * @param FuncKeyWebpCapture * @desc キャプチャとファイル保存を行うファンクションキーです。 * 保存形式の設定にかかわらずwebp形式で出力します。 * @default * @type select * @option none * @option F1 * @option F2 * @option F3 * @option F4 * @option F5 * @option F6 * @option F7 * @option F8 * @option F9 * @option F10 * @option F11 * @option F12 * * @param SimultaneousCtrl * @desc 各機能を利用する際にCtrlキーの同時押しが必要かどうかです。他のプラグインと対象キーが競合する場合に利用します。 * @default false * @type boolean * * @param SimultaneousAlt * @desc 各機能を利用する際にAltキーの同時押しが必要かどうかです。他のプラグインと対象キーが競合する場合に利用します。 * @default false * @type boolean * * @param FileName * @desc 画像のファイル名です。 * プラグインコマンドから実行した場合は参照されません。 * @default image * * @param Location * @desc ファイルの出力パスです。相対パス、絶対パスが利用できます。 * 区切り文字は「/」もしくは「\」で指定してください。 * @default captures * * @param FileFormat * @desc 画像のデフォルト保存形式です。(png/jpeg/webp) * @default png * @type select * @option png * @option jpeg * @option webp * * @param NumberDigit * @desc キャプチャファイルの連番桁数です。 * @default 2 * @type number * * @param TimeStamp * @desc ONにすると連番の代わりにタイムスタンプを付与します。(ON/OFF) * @default true * @type boolean * * @param Signature * @desc 保存時に画像の右下に書き込まれる署名です。 * @default * * @param SignatureSize * @desc 署名のフォントサイズです。 * @default 22 * @type number * * @param SignatureImage * @desc 保存時に画像の右下に書き込まれる著名画像ファイル名です。「img/pictures」に配置。拡張子不要。 * @default * @require 1 * @dir img/pictures/ * @type file * * @param Interval * @desc キャプチャを定期実行する間隔(秒単位)です。 * 0にすると、定期キャプチャを行いません。 * @default 0 * @type number * * @param SeName * @desc キャプチャ実行時に演奏する効果音のファイル名です。 * @default * @require 1 * @dir audio/se/ * @type file * * @param JpegQuality * @desc JPEG出力したときの品質です。値を小さくすると容量も小さくなります。(1...10) * @default 9 * @type number * @min 1 * @max 10 * * @help プレー中のゲーム画面をキャプチャして * ファイルに保存したり、ピクチャとして表示したりできます。 * キャプチャは以下のタイミングで実行されます。 * * ・ファンクションキー or PrintScreen押下 * ・一定時間ごと * ・プラグインコマンド実行時 * * プラグインコマンド以外は、テストプレー時のみ有効になります。 * * キャプチャしたファイルの保存場所は絶対パス、相対パスいずれも指定できるほか、 * OSの環境変数(%USERPROFILE%など)にも対応しています。 * * また、キャプチャの際に著名を自動で埋め込むことができます。 * 著名は文字列で指定できるほか、任意の画像も指定可能です。 * (両方指定すると画像が優先されます) * * 注意! * キャプチャピクチャの表示状態はセーブできません。 * セーブされる前に「ピクチャの消去」で消去してください。 * * 注意! * キャプチャを出力する機能はローカル環境でのみ有効です。 * ブラウザやスマホ上では動作しません。 * * プラグインコマンド詳細 * イベントコマンド「プラグインコマンド」から実行。 * (パラメータの間は半角スペースで区切る) * * MSC_MAKE * 実行時点でのキャプチャを作成して保持します。 * ex:MSC_MAKE * * MSC_PICTURE * 保持していた画面キャプチャをピクチャに表示します。 * このコマンドの直後に「ピクチャの表示」を実行するとキャプチャピクチャが * 表示されます。 * ex:MSC_PICTURE * * MSC_SAVE [ファイル名] * 保持していた画面キャプチャをファイルに保存します。 * ファイル名は自由に指定できます。 * 拡張子は自動で設定されるので設定不要です。 * ex:MSC_SAVE image * * This plugin is released under the MIT License. */ /*:ja * @plugindesc 画面キャプチャ管理プラグイン * @author トリアコンタン * * @param PNGキャプチャキー * @desc キャプチャとファイル保存を行うファンクションキーです。 * 保存形式の設定にかかわらずpng形式で出力します。 * @default F6 * @type select * @option none * @option F1 * @option F2 * @option F3 * @option F4 * @option F5 * @option F6 * @option F7 * @option F8 * @option F9 * @option F10 * @option F11 * @option F12 * * @param JPEGキャプチャキー * @desc キャプチャとファイル保存を行うファンクションキーです。 * 保存形式の設定にかかわらずjpeg形式で出力します。 * @default F7 * @type select * @option none * @option F1 * @option F2 * @option F3 * @option F4 * @option F5 * @option F6 * @option F7 * @option F8 * @option F9 * @option F10 * @option F11 * @option F12 * * @param WEBPキャプチャキー * @desc キャプチャとファイル保存を行うファンクションキーです。 * 保存形式の設定にかかわらずwebp形式で出力します。 * @default F9 * @type select * @option none * @option F1 * @option F2 * @option F3 * @option F4 * @option F5 * @option F6 * @option F7 * @option F8 * @option F9 * @option F10 * @option F11 * @option F12 * * @param Ctrl同時押し * @desc 各機能を利用する際にCtrlキーの同時押しが必要かどうかです。他のプラグインと対象キーが競合する場合に利用します。 * @default false * @type boolean * * @param Alt同時押し * @desc 各機能を利用する際にAltキーの同時押しが必要かどうかです。他のプラグインと対象キーが競合する場合に利用します。 * @default false * @type boolean * * @param ファイル名 * @desc 画像のファイル名です。 * プラグインコマンドから実行した場合は参照されません。 * @default image * * @param 出力場所 * @desc ファイルの出力パスです。相対パス、絶対パスが利用できます。 * 区切り文字は「/」もしくは「\」で指定してください。 * @default captures * * @param 保存形式 * @desc 画像のデフォルト保存形式です。(png/jpeg/webp) * @default png * @type select * @option png * @option jpeg * @option webp * * @param 連番桁数 * @desc キャプチャファイルの連番桁数です。数値はゲーム実行の度に初期化されるのでご注意ください。 * @default 2 * @type number * * @param タイムスタンプ * @desc ONにすると連番の代わりにタイムスタンプを付与します。(ON/OFF) * @default true * @type boolean * * @param 署名 * @desc 保存時に画像の右下に書き込まれる署名です。 * @default * * @param 署名サイズ * @desc 署名のフォントサイズです。 * @default 22 * @type number * * @param 署名画像 * @desc 保存時に画像の右下に書き込まれる著名画像ファイル名です。「img/pictures」に配置。拡張子不要。 * @default * @require 1 * @dir img/pictures/ * @type file * * @param 実行間隔 * @desc キャプチャを定期実行する間隔(秒単位)です。 * 0にすると、定期キャプチャを行いません。 * @default 0 * @type number * * @param 効果音 * @desc キャプチャ実行時に演奏する効果音のファイル名です。 * @default * @require 1 * @dir audio/se/ * @type file * * @param JPEG品質 * @desc JPEG出力したときの品質です。値を小さくすると容量も小さくなります。(1...10) * @default 9 * @type number * @min 1 * @max 10 * * @help プレー中のゲーム画面をキャプチャして * ファイルに保存したり、ピクチャとして表示したりできます。 * キャプチャは以下のタイミングで実行されます。 * * ・ファンクションキー or PrintScreen押下 * ・一定時間ごと * ・プラグインコマンド実行時 * * プラグインコマンド以外は、テストプレー時のみ有効になります。 * * キャプチャしたファイルの保存場所は絶対パス、相対パスいずれも指定できるほか、 * OSの環境変数(%USERPROFILE%など)にも対応しています。 * * また、キャプチャの際に著名を自動で埋め込むことができます。 * 著名は文字列で指定できるほか、任意の画像も指定可能です。 * (両方指定すると画像が優先されます) * * 注意! * キャプチャピクチャの表示状態はセーブできません。 * セーブされる前に「ピクチャの消去」で消去してください。 * * 注意! * キャプチャを出力する機能はローカル環境でのみ有効です。 * ブラウザやスマホ上では動作しません。 * * プラグインコマンド詳細 * イベントコマンド「プラグインコマンド」から実行。 * (パラメータの間は半角スペースで区切る) * * MSC_MAKE or 画面キャプチャ作成 * 実行時点でのキャプチャを作成して保持します。 * 例:画面キャプチャ作成 * * MSC_PICTURE or 画面キャプチャピクチャ * 保持していた画面キャプチャをピクチャに表示します。 * このコマンドの直後に「ピクチャの表示」を実行するとキャプチャピクチャが * 表示されます。 * 例:画面キャプチャピクチャ * * MSC_SAVE [ファイル名] or 画面キャプチャ保存 [ファイル名] * 保持していた画面キャプチャをファイルに保存します。 * ファイル名は自由に指定できます。 * 拡張子は自動で設定されるので設定不要です。 * 例:画面キャプチャ保存 image * * 利用規約: * 作者に無断で改変、再配布が可能で、利用形態(商用、18禁利用等) * についても制限はありません。 * このプラグインはもうあなたのものです。 */ (function () { 'use strict'; //============================================================================= // ユーザ書き換え領域 - 開始 - // 高度な設定を記述しています。必要な場合は書き換えてください。 //============================================================================= var settings = { /* 署名のフォント情報です。faceはあらかじめフォントをロードしておかなければ使えません */ signature: { face: 'GameFont', color: 'rgba(255,255,255,1.0)', align: 'right' }, /* 効果音情報です。ファイル名はプラグイン管理画面から取得します */ se: { volume: 90, pitch: 100, pan: 0 }, /* テストプレー以外での動作を無効にするフラグです */ testOnly: true }; //============================================================================= // ユーザ書き換え領域 - 終了 - //============================================================================= var pluginName = 'MakeScreenCapture'; var getParamString = function (paramNames) { var value = getParamOther(paramNames); return value == null ? '' : value; }; var getParamNumber = function (paramNames, min, max) { var value = getParamOther(paramNames); if (arguments.length < 2) min = -Infinity; if (arguments.length < 3) max = Infinity; return (parseInt(value, 10) || 0).clamp(min, max); }; var getParamBoolean = function (paramNames) { var value = getParamOther(paramNames); return (value || '').toUpperCase() === 'ON' || (value || '').toUpperCase() === 'TRUE'; }; var getParamOther = function (paramNames) { if (!Array.isArray(paramNames)) paramNames = [paramNames]; for (var i = 0; i < paramNames.length; i++) { var name = PluginManager.parameters(pluginName)[paramNames[i]]; if (name) return Utils.isNwjs() ? convertEnvironmentVariable(name) : name; } return null; }; var getCommandName = function (command) { return (command || '').toUpperCase(); }; var getArgString = function (arg, upperFlg) { arg = convertEscapeCharacters(arg); return upperFlg ? arg.toUpperCase() : arg; }; var convertEnvironmentVariable = function (text) { if (text == null) text = ''; text = text.replace(/%(\w+)%/gi, function () { return process.env[arguments[1]] || ''; }.bind(this)); return text; }; var convertEscapeCharacters = function (text) { if (text == null) text = ''; var window = SceneManager._scene._windowLayer.children[0]; return window ? window.convertEscapeCharacters(text) : text; }; //============================================================================= // パラメータの取得と整形 //============================================================================= var paramFuncKeyPngCapture = getParamString(['FuncKeyPngCapture', 'PNGキャプチャキー']); var paramFuncKeyJpegCapture = getParamString(['FuncKeyJpegCapture', 'JPEGキャプチャキー']); var paramFuncKeyWebpCapture = getParamString(['FuncKeyWebpCapture', 'WEBPキャプチャキー']); var paramFileName = getParamString(['FileName', 'ファイル名']); var paramLocation = getParamString(['Location', '出力場所']); var paramFileFormat = getParamString(['FileFormat', '保存形式']).toLowerCase(); var paramSignature = getParamString(['Signature', '署名']); var paramSignatureImage = getParamString(['SignatureImage', '署名画像']); var paramSignatureSize = getParamNumber(['SignatureSize', '署名サイズ']); var paramNumberDigit = getParamNumber(['NumberDigit', '連番桁数']); var paramInterval = getParamNumber(['Interval', '実行間隔']); var paramSeName = getParamString(['SeName', '効果音']); var paramTimeStamp = getParamBoolean(['TimeStamp', 'タイムスタンプ']); var paramJpegQuality = getParamNumber(['JpegQuality', 'JPEG品質']); var paramSimultaneousCtrl = getParamBoolean(['SimultaneousCtrl', 'Ctrl同時押し']); var paramSimultaneousAlt = getParamBoolean(['SimultaneousAlt', 'Alt同時押し']); //============================================================================= // Game_Interpreter // プラグインコマンドを追加定義します。 //============================================================================= var _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand; Game_Interpreter.prototype.pluginCommand = function (command, args) { _Game_Interpreter_pluginCommand.apply(this, arguments); this.pluginCommandMakeScreenCapture(command, args); }; Game_Interpreter.prototype.pluginCommandMakeScreenCapture = function (command, args) { switch (getCommandName(command)) { case 'MSC_MAKE': case '画面キャプチャ作成': SceneManager.makeCapture(); break; case 'MSC_PICTURE': case '画面キャプチャピクチャ': $gameScreen.captureFlg = true; break; case 'MSC_SAVE': case '画面キャプチャ保存': SceneManager.saveCapture(getArgString(args[0]) || paramFileName, paramFileFormat); break; } }; //============================================================================= // Game_Screen // キャプチャピクチャ用のプロパティを追加定義します。 //============================================================================= var _Game_Screen_clear = Game_Screen.prototype.clear; Game_Screen.prototype.clear = function () { _Game_Screen_clear.apply(this, arguments); this.clearCapturePicture(); }; Game_Screen.prototype.clearCapturePicture = function () { this.captureFlg = false; }; //============================================================================= // Game_Picture // キャプチャピクチャ用のプロパティを追加定義します。 //============================================================================= var _Game_Picture_show = Game_Picture.prototype.show; Game_Picture.prototype.show = function (name, origin, x, y, scaleX, scaleY, opacity, blendMode) { if ($gameScreen.captureFlg) { arguments[0] = Date.now().toString(); this.captureFlg = true; } else { this.captureFlg = null; } $gameScreen.clearCapturePicture(); _Game_Picture_show.apply(this, arguments); }; //============================================================================= // Scene_Base // 定期実行キャプチャを定義します。 //============================================================================= var _Scene_Base_update = Scene_Base.prototype.update; Scene_Base.prototype.update = function () { _Scene_Base_update.apply(this, arguments); var count = Graphics.frameCount; if (paramInterval !== 0 && Utils.isTestCapture() && (count + 1) % (paramInterval * 60) === 0) { SceneManager.takeCapture(); } }; //============================================================================= // Sprite_Picture // 画像の動的生成を追加定義します。 //============================================================================= var _Sprite_Picture_loadBitmap = Sprite_Picture.prototype.loadBitmap; Sprite_Picture.prototype.loadBitmap = function () { if (this.picture().captureFlg) { this.bitmap = SceneManager.getCapture(); } else { _Sprite_Picture_loadBitmap.apply(this, arguments); } }; //============================================================================= // Utils // テスト用のキャプチャを許可するかどうかを返します。 //============================================================================= Utils.isTestCapture = function () { return !settings.testOnly || Utils.isOptionValid('test'); }; //============================================================================= // Bitmap // 対象のビットマップを保存します。現状、ローカル環境下でのみ動作します。 //============================================================================= Bitmap.prototype.save = function (fileName, format, extend) { var data = this._canvas.toDataURL('image/' + format, extend); data = data.replace(/^.*,/, ''); if (format === 'jpeg') format = 'jpg'; if (data) StorageManager.saveImg(fileName, format, data); }; Bitmap.prototype.sign = function (text, fontInfo) { this.fontFace = fontInfo.face; this.fontSize = fontInfo.size; this.textColor = fontInfo.color; this.drawText(text, 8, this.height - this.fontSize - 8, this.width - 8 * 2, this.fontSize, fontInfo.align); }; Bitmap.prototype.signAndSave = function (signature, fileName, format, signatureImage) { var fileFullPath = StorageManager.getLocalImgFileName(fileName); if (signatureImage) { this.signImage(signatureImage, signature); } this.sign(paramSignature, signature); this.save(fileFullPath, format, format === 'jpeg' ? paramJpegQuality / 10 : undefined); }; Bitmap.prototype.signImage = function (signBitmap, fontInfo) { var dx = 0, dy = this.height - signBitmap.height; switch (fontInfo.align) { case 'center': dx = this.width / 2 - signBitmap.width / 2; break; case 'right': dx = this.width - signBitmap.width; break; } this.blt(signBitmap, 0, 0, signBitmap.width, signBitmap.height, dx, dy); }; //============================================================================= // Input // ファンクションキーのマップを定義します。 //============================================================================= Input.functionReverseMapper = { F1: 112, F2: 113, F3: 114, F4: 115, F5: 116, F6: 117, F7: 118, F8: 119, F9: 120, F10: 121, F11: 122, F12: 123 }; //============================================================================= // SceneManager // ファンクションキーが押下されたときにキャプチャを実行します。 //============================================================================= SceneManager.captureNumber = 0; SceneManager.makeCapture = function () { if (paramSeName) { var se = settings.se; se.name = paramSeName; AudioManager.playSe(se); } this._captureBitmap = this.snap(); }; SceneManager.getCapture = function () { return this._captureBitmap || ImageManager.loadEmptyBitmap(); }; SceneManager.saveCapture = function (fileName, format) { if (!this._captureBitmap) return; var signature = this.getSignature(); if (paramSignatureImage) { var image = ImageManager.loadPicture(paramSignatureImage, 0); image.addLoadListener(function () { this._captureBitmap.signAndSave(signature, fileName, format, image); }.bind(this)); } else { this._captureBitmap.signAndSave(signature, fileName, format, null); } }; SceneManager.getSignature = function () { var signature = settings.signature; signature.size = paramSignatureSize; return signature; }; SceneManager.takeCapture = function (format) { if (!format) { format = paramFileFormat; } this.makeCapture(); this.saveCapture(paramFileName, format); }; var _SceneManager_setupErrorHandlers = SceneManager.setupErrorHandlers; SceneManager.setupErrorHandlers = function () { _SceneManager_setupErrorHandlers.apply(this, arguments); if (Utils.isTestCapture()) { document.addEventListener('keyup', this.onKeyUpForCapture.bind(this)); } }; var _SceneManager_onKeyDown = SceneManager.onKeyDown; SceneManager.onKeyDown = function (event) { _SceneManager_onKeyDown.apply(this, arguments); if (paramSimultaneousCtrl === event.ctrlKey && paramSimultaneousAlt === event.altKey && Utils.isTestCapture()) { this.onKeyDownForCapture(event); } }; SceneManager.onKeyDownForCapture = function (event) { switch (event.keyCode) { case Input.functionReverseMapper[paramFuncKeyPngCapture]: SceneManager.takeCapture('png'); break; case Input.functionReverseMapper[paramFuncKeyJpegCapture]: SceneManager.takeCapture('jpeg'); break; case Input.functionReverseMapper[paramFuncKeyWebpCapture]: SceneManager.takeCapture('webp'); break; } }; SceneManager.onKeyUpForCapture = function (event) { // PrintScreen if (event.keyCode === 44) SceneManager.takeCapture(); }; //============================================================================= // StorageManager // イメージファイルを保存します。 //============================================================================= StorageManager.saveImg = function (fileName, format, data) { if (this.isLocalMode()) { this.saveImgToLocalFile(fileName + '.' + format, data); } else { this.saveImgToWebStorage(fileName, data); } }; StorageManager.saveImgToWebStorage = function (fileName, data) { localStorage.setItem(fileName, data); }; StorageManager.saveImgToLocalFile = function (fileName, data) { var fs = require('fs'); var dirPath = this.localImgFileDirectoryPath(); var filePath = dirPath + fileName; if (!fs.existsSync(dirPath)) { fs.mkdirSync(dirPath); } fs.writeFileSync(filePath, new Buffer(data, 'base64')); }; StorageManager.localImgFileDirectoryPath = function () { var filePath = paramLocation; if (!filePath.match(/^[A-Z]:/)) { var path = require('path'); filePath = path.join(path.dirname(process.mainModule.filename), filePath); } return decodeURIComponent(filePath.match(/\/$/) ? filePath : filePath + '/'); }; StorageManager.getLocalImgFileName = function (fileName) { if (paramTimeStamp) { var date = new Date(); return fileName + '_' + date.getFullYear() + (date.getMonth() + 1).padZero(2) + date.getDate().padZero(2) + '_' + date.getHours().padZero(2) + date.getMinutes().padZero(2) + date.getSeconds().padZero(2); } else { var number = SceneManager.captureNumber; if (number >= Math.pow(10, paramNumberDigit)) number = 0; SceneManager.captureNumber = number + 1; return fileName + (number > 0 ? number.padZero(paramNumberDigit) : ''); } }; })();
dazed/translations
www/js/plugins/MakeScreenCapture.js
JavaScript
unknown
30,122
//@ts-check //============================================================================= // Mano_InputConfig.js // ---------------------------------------------------------------------------- // Copyright (c) 2017-2021 Sigureya // This software is released under the MIT License. // http://opensource.org/licenses/mit-license.php // ---------------------------------------------------------------------------- // Version // ver 8.0.1 2022/03/15 // ---------------------------------------------------------------------------- // [Twitter]: https://twitter.com/Sigureya/ //============================================================================= /*: * @plugindesc ゲームの操作に関する機能をまとめて管理します。 * ユーザーによる拡張も支援します。 * @author しぐれん(https://github.com/Sigureya/RPGmakerMV) * @url https://raw.githubusercontent.com/Sigureya/RPGmakerMZ/master/Mano_InputConfig.js * * @target MZ * @orderAfter VisuMZ_1_OptionsCore * @orderAfter MOG_TitleSplashScreen * * @command GetButtonName * @text GetButton/ボタン名の取得 * @desc 指定した操作がどのボタンにあるかを返します。 * Returns which button has the specified action. * @arg symbol * @type select * @option ok(決定) * @value ok * @option cancel(取り消し) * @value cancel * @option shift(ダッシュ) * @value shift * @option menu(メニュー) * @value menu * @option pageup(前) * @value pageup * @option pagedown(次) * @value pagedown * @default ok * * @arg nameVariable * @text ボタン名称/buttonName * @desc ボタン名称を受け取る変数です。 * Variable to store the result. * @type variable * @default 0 * @command GetButtonNameEX * @text GetButtonEX/ボタン名の取得 * @desc 指定した操作がどのボタンにあるかを返します。 * Returns which button has the specified action. * @arg symbol * @desc アクションのシンボル * * @arg nameVariable * @desc ボタン名称を受け取る変数です。 * Variable to store the result. * @type variable * @default 0 * * @command IsKeyboardValid * @desc キーボードの設定が正しい場合、指定スイッチをONにします。 * @arg switchId * @type switch * @default 0 * @desc 結果を保存するスイッチ * Where to save the results * * @command GamepadScene * @text GamepadScene/ゲームパッド設定を開く * @desc ゲームパッド設定のシーンを開きます。 * Open the gamepad settings scene. * * @command KeyboardScene * @text KeyboardScene/キーボード設定を開く * @desc キーボード設定のシーンを開きます。 * Open the keyboard settings scene. * * @param color * @text 色設定/ColorSetting * @type struct<ColorManager> * @default {"normal":"#880000","mandatory":"#22e488","move":"#22e488"} * * @param basicOk * @text 決定/ok * @type struct<BasicSymbol> * @default {"name":"{\"jp\":\"決定\",\"en\":\"OK\"}","keyText":"{\"jp\":\"\",\"en\":\"\"}","helpText":"{\"jp\":\"\",\"en\":\"\"}"} * * @param basicCancel * @text 取り消し/cancle * @type struct<BasicSymbol> * @default {"name":"{\"jp\":\"キャンセル\",\"en\":\"cancel\"}","keyText":"{\"jp\":\"\",\"en\":\"\"}","helpText":"{\"jp\":\"\",\"en\":\"\"}"} * * @param basicShift * @text ダッシュ/dash * @type struct<BasicSymbol> * @default {"name":"{\"jp\":\"ダッシュ\",\"en\":\"dash\"}","keyText":"{\"jp\":\"\",\"en\":\"\"}","helpText":"{\"jp\":\"\",\"en\":\"\"}"} * * @param basicMenu * @text メニュー/menu * @type struct<BasicSymbol> * @default {"name":"{\"jp\":\"メニュー\",\"en\":\"menu\"}","keyText":"{\"jp\":\"\",\"en\":\"\"}","helpText":"{\"jp\":\"\",\"en\":\"\"}"} * * @param basicEscape * @text メニュー(2)/menu(2) * @type struct<BasicSymbol> * @default {"name":"{\"jp\":\"メニュー/キャンセル\",\"en\":\"menu/cancel\"}","keyText":"{\"jp\":\"\",\"en\":\"\"}","helpText":"{\"jp\":\"\",\"en\":\"\"}"} * * @param basicPageup * @text 次/next * @type struct<BasicSymbol> * @default {"name":"{\"jp\":\"次\",\"en\":\"next\"}","keyText":"{\"jp\":\"\",\"en\":\"\"}","helpText":"{\"jp\":\"\",\"en\":\"\"}"} * * @param basicPagedown * @text 前/prev * @type struct<BasicSymbol> * @default {"name":"{\"jp\":\"前\",\"en\":\"prev\"}","keyText":"{\"jp\":\"\",\"en\":\"\"}","helpText":"{\"jp\":\"\",\"en\":\"\"}"} * * * * @param mapperDelete * @text 設定を消去/delete * @type struct<MultiLangString> * @default {"en":"delete","jp":"設定を消去"} * * * @param extendsMapper * @desc ボタンイベント・追加の入力設定の登録 * Registration of button events and additional input settings * @text 入力拡張/inputExtension * @type struct<InputDefine>[] * @default [] * * @param eventList * @desc コモンイベントの呼び出し設定(簡単版) * Registration of button events and additional input settings * @text コモンイベント/CommonEvent * @type struct<EventDefine>[] * @default [] * * @param GamepadIsNotConnectedText * @text 未接続/GamepadIsNotConnected * @desc ゲームパッドが接続されていない場合の文章です。 * This is the text when the gamepad is not connected. * @type struct<MultiLangNote> * @default {"jp":"\"ゲームパッドが接続されていません\\nボタンを押して再度試してください\"","en":"\"The gamepad is not connected.\\nPress the button and try again.\""} * * @param needButtonDetouchText * @text ボタンから手を放すように促すメッセージ * @desc キーコンフィグはボタンから手を離さない限り終了しません。 * 手を放すように促すメッセージを設定します。 * @type struct<MultiLangNote> * @default {"jp":"\"コンフィグを終了するために、\\nボタンから手を放してください。\"","en":"\"Release the button to exit the config.\""} * * @param apply * @text 設定の保存/apply * @type struct<KeyconfigCommand> * @default {"width":"4","text":"{\"jp\":\"設定を保存\",\"en\":\"save settings\"}"} * * @param rollback * @text 変更を破棄/rollback * @type struct<KeyconfigCommand> * @default {"width":"4","text":"{\"jp\":\"変更前に戻す\",\"en\":\"rollback\"}"} * * @param reset * @text 初期設定に戻す/reset * @type struct<KeyconfigCommand> * @default {"width":"4","text":"{\"jp\":\"初期設定に戻す\",\"en\":\"reset\"}"} * * @param WASD * @type struct<KeyconfigCommand> * @default {"width":"3","text":"{\"jp\":\"WASD\",\"en\":\"WASD\"}"} * * @param style * @type struct<KeyconfigCommand> * @default {"width":"3","text":"{\"jp\":\"設定方法変更\",\"en\":\"Change setting style\"}"} * * @param changeLayout * @text JIS/US * @type struct<KeyconfigCommand> * @default {"width":"3","text":"{\"jp\":\"JIS/US\",\"en\":\"JIS/US\"}"} * * @param exit * @text やめる/exit * @type struct<KeyconfigCommand> * @default {"width":"3","text":"{\"jp\":\"やめる\",\"en\":\"exit\"}"} * * * * @param gamepadConfigCommandText * @desc ゲームパッドコンフィグを開くコマンドの名前です * @type struct<MultiLangString> * @default {"en":"gamepad config","jp":"ゲームパッドコンフィグ"} * * @param keyConfigCommandText * @desc キーコンフィグを開くコマンドの名前です * @type struct<MultiLangString> * @default {"en":"keyboard config","jp":"キーコンフィグ"} * * @param gamepadBackground * @type file * @dir img/title1/ * * @param keyBackground * @type file * @dir img/title1/ * * @param SettingsForYEP_OptionsCore * @type struct<DisguiseAsYEP> * @default {"gamepad":"true","Keyboard":"true"} * * @help * ※日本語テキストは下の方にあるのでスクロールしてください * * Loads the settings at game startup as initial values. * Detects input changes regardless of where the plugin is installed. * It is OK even if the button is modified by another plug-in. * * The config data set by this plug-in is recorded in the file. * If you install a new plugin, * Please reset the config with "Reset to default" after starting the game. * * ■ What to do if strange characters such as "? KEY: Symbol" are displayed * Occurs because the input added by another plugin is unknown. * If the above display is displayed, * It can be handled by adding an element to extendsMapper. * 1. Add an element * 2. Try either of the following AB methods. * Copy the character corresponding to A: KEY and paste it into Key Setting. * B: Copy the characters corresponding to Symbol and paste them into symbol. * Be careful not to confuse the case. * * ■ What to do if a display like unknow: XXXX appears * The following causes are possible. * -Symbols were set after the game started (after Scene_Boot) * -Initialization process was not performed correctly * It may be improved by moving this plugin down. * * ■ Button operation diffusion function * If the operation is set by another plugin, * May be set on only one of the gamepad / keyboard. * In such a case, you can operate it from others by setting it in extendsMapper. * For example, suppose that the operation is set when you press only T on the keyboard. * If you want to set the operation for the buttons on the gamepad in this state, set as follows. * Key setting: T * Pad button: (any button number) * By doing this, this plugin will read the behavior set for T on the keyboard and * Set so that the same function can be used with the buttons on the gamepad. * The same is true for the opposite. * * If the operation is set on both the keyboard and the gamepad, * Determine which one to prioritize in the overwrite setting. * When using manual symbol settings (for advanced users) * Ignore the priority settings and use the contents set manually. * * ■ Common event call button * extendsMapper has an item called "Events". * If you set an event here, the event will be called when the button is pressed. * You can use it to create a function to open the map when you press the button. * * ■All functions can be used without eval () * There are no items in this plugin that use eval (). * If you're writing a JavaScript expression for use with eval (), * you're wrong. * * ■ If you want to control the transition with a script * Used when modifying other plugins or switching scenes directly with a script. * SceneManager.push (Mano_InputConfig.Scene_GamepadConfig); // Gamepad Config * SceneManager.push (Mano_InputConfig.Scene_KeyConfig); // Keyboard config * You can now move to the specified scene. * * ゲームの起動時の設定を初期値として読み込みます。 * プラグインの導入位置に関わらず、入力の変更を検知します。 * 他のプラグインでボタンが改造されていてもOKです。 * * このプラグインで設定したコンフィグデータは、ファイルに記録されます。 * 新しいプラグインを入れた場合、 * ゲーム起動後にコンフィグを「初期設定に戻す」でリセットしてください。 * * ■"?KEY:Symbol"のような変な文字が表示される場合の対処法 * 他のプラグインによって追加された入力が不明なために発生します。 * 上記のような表示が出ている場合、 * extendsMapperに要素を追加することで対応できます。 * 1.要素を追加する * 2.下記のABどちらかの方法を試す。 * A:KEYにあたる部分の文字をコピーして、KeySettingに貼り付ける。 * B:Symbolにあたる部分の文字をコピーし、symbolに貼り付ける。 * 大文字・小文字を間違えないように注意すること。 * * ■unknow:XXXXのような表示が出る場合の対処法 * 以下の原因が考えられます。 * ・シンボルの設定がゲーム起動後(Scene_Bootより後)で行われた * ・初期化処理が正しく行われなかった * このプラグインを下の方に移動することで改善する可能性があります。 * * ■ボタン操作拡散機能 * 他のプラグインで操作が設定されている場合に、 * ゲームパッド・キーボードの片方にしか設定されていない場合があります。 * そういった場合、extendsMapperで設定を行うことで他からも操作できるようになります。 * 例えば、キーボードのTにのみ押した場合の動作が設定されているとします。 * この状態でゲームパッドのボタンにも操作を設定する場合、以下のように設定します。 * キー設定:T * パッドボタン:(任意のボタン番号) * こうすることで、このプラグインはキーボードのTに設定されている動作を読み込み、 * ゲームパッドのボタンでも同じ機能が使えるように設定を行います。 * 逆の場合も同様です。 * * キーボードとゲームパッドの双方に操作が設定されている場合、 * どちらを優先するかを上書き設定で決めます。 * シンボル手動設定(上級者向け)を使った場合、 * 優先設定を無視して手動設定による内容を使います。 * * ■コモンイベント呼び出しボタン * extendsMapperには「イベント」という項目があります。 * ここにイベントを設定すると、ボタンが押された時にイベントを呼び出します。 * ボタンを押したら地図を開く機能を作る時などに使えます。 * * ■eval()無しで全機能が使えます * このプラグインにはeval()を使う項目はありません。 * eval()で使うJavaScriptの式を書いている場合、あなたは間違っています。 * * ■スクリプトで遷移を制御したい場合 * 他のプラグインを改造したり、スクリプトで直接シーンを切り替える時に使います。 * SceneManager.push(Mano_InputConfig.Scene_GamepadConfig ); //ゲームパッドコンフィグ * SceneManager.push(Mano_InputConfig.Scene_KeyConfig ); // キーボードコンフィグ * これで、指定されたシーンに移動できます。 * * 更新履歴 * 2022/06/10 ver 8.1.0 * コモンイベントの設定方法が複雑という意見があったので簡易版を作成。 * * * 2022/03/15 ver 8.0.1 * ゲームパッドコンフィグをリニューアル。 * MV環境での不具合を修正 * * 2022/03/08 ver 7.1.0 * シンボルに対してボタンを割り当てる方式の廃止。 * メンテナンスコストが大きいため。 * ver8.0に向けた準備工事。 * * 2022/01/18 ver7.0.1 * PP_Optionとの連携関連で不具合があったのを修正。 * * 2021/12/30 ver7.0.0 * プラグインパラメータ「入力拡張」を中心に大改造。 * * 2021/12/24 ver6.3.1 * エラーメッセージの英語表記を追加。 * * 2021/12/22 ver6.3.0 * シンボル設定関連を更新。 * ヘルプの内容を追加。 * * 2021/12/18 ver6.2.1 * ラムダ式関連の記述を修正した際に、バグを埋め込んでいたのを修正。 * プラグインコマンドを追加。 * * 2021/11/30 ver6.2.0 * ManoPP_VisuMZ_OptionCore対応を実装。 * * 2021/08/30 ver6.1.2 * 一部環境でラムダ式がエラーを起こすため、使用しない形に修正 * 一部テキストが日本語のままだったのを英語対応 * * 2021/07/17 ver6.1.1 * 拡張入力の上書き設定が機能していないのを修正 * * 2021/06/13 ver6.1.0 * シンボルからボタンの名称を取得するプラグインコマンドを追加(MZのみ) * * 2021/05/23 ver 6.0.0 * ゲームパッドにシンボルに対してボタンを割り当てる機能を実装。 * * * 2021/04/22 ver 5.4.0 * MZのみ:タッチボタンの表示機能を試験的に実装 * * 2021/04/15 ver 5.3.1 * コモンイベント呼び出しを修正(簡単にしました) * イベントコマンドでコンフィグを開くと保存されない不具合を修正 * * 2021/02/23 ver 5.3.0 * ボタン入力がある時にコモンイベントを呼び出すプラグインコマンドを追加 * * 2021/01/27 ver 5.2.0 * 不明なシンボルの表示機能を強化 * * 2021/01/23 ver5.1.0 * 画面レイアウトを変更 * 必須シンボルの扱いを調整 * 不明なシンボルがある場合、画面上部へ表示するようにした * * 2020/12/25 ver5.0.3 * 必須シンボルチェックの動作が正しくなかったのを修正 * バージョン管理を修正し、番号付けを変更。 * * 2020/12/25 ver5.0.2(旧5.2) * 拡張シンボル設定にバグがあったので修正 * * 2020/11/26 ver5.0.1(旧5.1) * プラグインが起動できないバグがあったので修正 * * 2020/11/24 ver5.0 * プラグインパラメータを再設計。 * 内部実装であるsymbolを意識する必要が無くなりました。 * * 2020/08/23 ver4.0 * ツクールMZに対応。 * 基本システムはMZ向けに最適化し、MVはラッパーで調整 * * 2020/05/25 ver 3.2 * YEP_OptionCoreと競合するので、対策処理を追加。 * * 2020/04/01 ver 3.1 * 英語対応につきヘルプを追加。 * * 2020/03/14 ver3.0 * WASD移動を設定できる機能を追加。 * キーコンフィグの内部実装を大幅改造。 * * 2020/02/26 ver2.9 * コンフィグから抜けた際にボタンが連打されてしまう問題を対策。 * RPGアツマールにおいて、他のゲームとコンフィグ設定が混ざる問題を修正。 * 別プラグインとの競合があったので対策 * symbolAutoSelectがキーコンフィグで機能していなかったのを修正。 * * 2019/07/12 ver2.8.1 * ゲームパッドのハードごとの識別情報を表示する機能を追加。 * * 2019/07/06 ver2.8 * 外部プラグインによって追加されたmapperのsymbolを強制的に取り込む機能。 * プラグインパラメータで無効化できます。 * * 2019/03/19 ver2.7 * キーボードに任意の初期設定を割り当てる機能を追加。 * * 2018/09/28 ver2.6 * ゲームパッドコンフィグを改造すると誤作動があったので、誤作動を減らす修正。 * プラグインの位置に関わらず初期設定の変更を捕まえられるように。 * * 2018/06/25 ver 2.5 * 色々あった細かいバグ修正を重ねた最新版。 * * 2017/10/21 ver 2.2 更新 * 外部から追加したシンボルがsymbolsと重複していた場合、追加しないようにした。 * USキー配列に仮対応。 * * 2017/10/18 ver 2.1 更新 * キーボードで目立ったバグの報告がなかったため、2.0に。 * 外部からコンフィグを改造できる機能を導入。 * * 2017/10/13 ver 1.9 更新 * キーボードのコンフィグにも対応。 * 仕様が固まっていないので、1.9とします。 * 2017/10/05 ver 1.0 公開 * */ /*~struct~BasicSymbol: * @param name * @type struct<MultiLangString> * @default {"jp":"","en":""} * * @param keyText * @text キーの表示/keyText * @desc キーコンフィグの際の表示名を定義します(空欄OK) * Define the display name for key config (blank OK) * @type struct<MultiLangString> * @default {"jp":"","en":""} * * @param helpText * @text 詳細/helpText * @desc 画面上部に表示する説明文 * Description to be displayed at the top of the screen * @type struct<MultiLangNote> * @default {"jp":"","en":""} * */ /*~struct~TouchButton: * @param image * @type file * @dir img/ * @desc 通常時は上の半分、押されている間は下の半分が使われます。 * upper is used normally, and lower is used when pressed. * @default system * * @param x * @type number * @default 0 * * @param y * @type number * @default 0 * */ /*~struct~EventCaller: * @param id * @text 呼び出すイベント/event * @desc ボタンを押した際に呼び出すコモンイベント(マップのみ) * Common event to call when a button is pressed(MapOnly) * @type common_event * @default 0 * * @param inputType * @text 入力方式/inputType * @desc 呼び出し時のボタンの入力形式。 * Button input format when calling. * @type select * @option 押されている/pressed * @value 0 * @option トリガー/triggerd * @value 1 * @option リピート/repeated * @value 2 * @default 0 */ /*~struct~KeyboradSetting: * @param keys * @type string * @desc 半角英字で設定。例 Ef65 * Set the key corresponding to the action (ex:Ef65) * * * @param text * @text キーの表示/keyText * @desc キーコンフィグの際の表示名を定義します(空欄OK) * Define the display name for key config (blank OK) * @type struct<MultiLangString> * @default {"jp":"","en":""} * */ /* * TODO:あとでキー設定にカラーを追加 * @param color * @type combo * @option #FF00FF * @default * */ /*~struct~AdvancedSetting: * @param symbol * @text シンボル/symbol * @desc ボタンを押した場合の動作(上級者向け) * Operation when the button is pressed (for advanced users) * @type string * @default * * @param overwrite * @text 上書き/overwrite * @desc どのボタンのシンボルを基準にするか * Which button symbol to base on * @type select * @option 上書きしない/none * @value 0 * @option ゲームパッド/gamepad * @value 1 * @option キーボード/Keyboard * @value 2 * @option イベント/event * @value 3 * @default 0 * * @param mandatory * @text 必須フラグ/mandatory * @type boolean * @default false */ /*~struct~EventDefine: * * @param key * @type select * @option none/設定無し * @value * @option A * @option B * @option C * @option D * @option E * @option F * @option G * @option H * @option I * @option J * @option K * @option L * @option M * @option N * @option O * @option P * @option Q * @option R * @option S * @option T * @option U * @option V * @option W * @option X * @option Y * @option Z * @default * * @param keyText * @desc キーコンフィグの際に表示するテキスト * @type struct<MultiLangString> * @default {"jp":"","en":""} * * * @param button * @text パッドボタン/padButton * @desc ボタン設定。配置と名前は任天堂のスタイルを想定。 * Button settings. The layout and name the style of Nintendo. * @type select * @default NaN * @option none * @value NaN * @option 0(B/×) * @value 0 * @option 1(A/○) * @value 1 * @option 2(X/□) * @value 2 * @option 3(Y/△) * @value 3 * @option 4(L1) * @value 4 * @option 5(R1) * @value 5 * @option 6(L2) * @value 6 * @option 7(R2) * @value 7 * @option 8(select) * @value 8 * @option 9(start) * @value 9 * @option 10(L3) * @value 10 * @option 11(R3) * @value 11 * @option 16(center) * @value 16 * * @param name * @text 行動名/actionName * @desc 言語別に行動の説明を入力します * Enter a description of the action by language * @type struct<MultiLangString> * @default {"jp":"","en":""} * * @param helpText * @text 詳細/helpText * @desc 画面上部に表示する説明文 * Description to be displayed at the top of the screen * @type struct<MultiLangString> * @default {"jp":"","en":""} * * @param event * @text イベント/event * @desc ボタンを押した際にコモンイベントを実行します。 * Executes a common event when the button is pressed. * @type struct<EventCaller> * @default {"id":"0","inputType":"0"} * * @param enabled * @text 有効化 * @desc テスト用に一時的に無効化したい場合などで使います。 * @type boolean * @default true */ /*~struct~InputDefine: * * @param keys * @text キー設定/KeySetting * @desc 廃止予定。同名の新しいパラメータを使用してください。 * Scheduled to be abolished. Use the new parameter. * * @param keySetting * @text キー設定/keySetting * @type struct<KeyboradSetting> * @default {"keys":"","color":"","text":"{\"jp\":\"\",\"en\":\"\"}"} * * @param button * @text パッドボタン/padButton * @desc ボタン設定。配置と名前は任天堂のスタイルを想定。 * Button settings. The layout and name the style of Nintendo. * @type select * @default NaN * @option none * @value NaN * @option 0(B/×) * @value 0 * @option 1(A/○) * @value 1 * @option 2(X/□) * @value 2 * @option 3(Y/△) * @value 3 * @option 4(L1) * @value 4 * @option 5(R1) * @value 5 * @option 6(L2) * @value 6 * @option 7(R2) * @value 7 * @option 8(select) * @value 8 * @option 9(start) * @value 9 * @option 10(L3) * @value 10 * @option 11(R3) * @value 11 * @option 16(center) * @value 16 * * @param name * @text 行動名/actionName * @desc 言語別に行動の説明を入力します * Enter a description of the action by language * @type struct<MultiLangString> * @default {"jp":"","en":""} * * @param helpText * @text 詳細/helpText * @desc 画面上部に表示する説明文 * Description to be displayed at the top of the screen * @type struct<MultiLangString> * @default {"jp":"","en":""} * * @param event * @text イベント/event * @desc ボタンを押した際にコモンイベントを実行します。 * Executes a common event when the button is pressed. * @type struct<EventCaller> * @default {"id":"0","inputType":"0"} * * @param touchButton * @text タッチボタン/touchButton * @type struct<TouchButton> * @desc MZのみ:画面上にタッチUI向けのボタンを追加します * * @param adovanced * @text 上級者向け/adovanced * @desc 多くの場合、これを変更する必要はありません。 * In most cases you do not need to change this. * @type struct<AdvancedSetting> * @default {"symbol":"","overwrite":"0","mandatory":"false"} * * @param enabled * @text 有効化 * @desc テスト用に一時的に無効化したい場合などで使います。 * @type boolean * @default true */ /* * @param sourcePlugin * @desc 指定した名前のプラグインがONの場合のみ、有効化します * @type combo * @default */ /*~struct~MultiLangNote: * @param jp * @text 日本語 * @type multiline_string * @type note * @param en * @type multiline_string * @type note */ /*~struct~MultiLangNoteFull: * @param jp * @text 日本語 * @type multiline_string * @type note * @param en * @type multiline_string * @type note * @param ch * @text 中文 * @type multiline_string * @type note * @param ko * @text 한국 * @type multiline_string * @type note * @param ge * @text Deutsche * @type multiline_string * @type note * @param fr * @text français * @type multiline_string * @type note * @param ru * @text русский * @type multiline_string * @type note */ /*~struct~MultiLangString: * @param jp * @text 日本語 * @param en * @text English */ /*~struct~MultiLangStringFull: * @param jp @text 日本語 @param en @text English @param ch @text 中文 @param ko @text 한국 @param ge @text Deutsche @param fr @text français @param ru @text русский */ /*~struct~KeyconfigCommand: * * @param width * @desc コマンドの幅 * @type number * @min 0 * @max 10 * @default 3 * * @param text * @type struct<MultiLangString> * @default {} * */ /*~struct~ColorManager: * * @param normal * @default #880000 * * @param mandatory * @text 必須シンボル/mandatory * @default #22e488 * * @param move * @text 移動/move * @default #22e488 * * @param extends * @text 拡張シンボル/extends * @default #22e488 * * */ /*~struct~DisguiseAsYEP: * @param gamepad * @desc Impersonate the configuration as if it were GamepadConfig.js (by Yanfly). * @type boolean * @default true * * @param Keyboard * @desc Impersonate the configuration as if it were YEP_KeyboardConfig.js (by Yanfly). * @type boolean * @default true */ //@ts-ignore var Imported = Imported || {}; if (Imported.Mano_InputConfig) { throw new Error("Mano_InputConfig is Duplicate") } Imported.Mano_InputConfig = true; var Mano_InputConfig = (function () { 'use strict' /** * @typedef {Object} MyRectType * @property {Number} x * @property {Number} y * @property {Number} width * @property {Number} height * @property {()=>MyRectType} clone */ const GetEnabledPlugins = function () { /** * @type {Set<String>} */ const set = new Set(); for (const iterator of $plugins) { if (iterator.status) { set.add(iterator.name); } } return set; } /** * @type {String} */ const PLUGIN_NAME = ('Mano_InputConfig'); function getCurrentScriptName() { //@ts-ignore const pluginName = decodeURIComponent(document.currentScript.src).match(/([^/]+)\.js$/); if (pluginName) { return pluginName[1]; } return ''; } /** * @param {String} officialFileName */ function TestFileNameValid(officialFileName) { const currentFileName = getCurrentScriptName(); if (officialFileName === currentFileName) { return; } const message = `Do not rename the plugin file.<br>` + `Current file name: currentFileName<br>` + `Original file name: officialFileName<br>` + `プラグインファイルの名前を変更してはいけません<br>` + `現在のファイル名: currentFileName<br>` + `本来のファイル名: officialFileName` throw new Error(message); } TestFileNameValid(PLUGIN_NAME); //@ts-ignore const IS_Atsumaru = location.hostname === "html5.nicogame.jp"; function getParam() { return PluginManager.parameters(PLUGIN_NAME); } /** * @param {Window_Base|Window_Selectable} window_ * @param {MyRectType} rect * @param {(srect:Rectangle)=>void} initFuncton */ function window_initializeMVMZ(window_, rect, initFuncton) { if (Utils.RPGMAKER_NAME === "MZ") { initFuncton.call(window_, rect); return } if (Utils.RPGMAKER_NAME === "MV") { initFuncton.call(window_, rect.x, rect.y, rect.width, rect.height); return; } throw (new Error("Unknow RPG MAKER:" + Utils.RPGMAKER_NAME)); } class Scene_MenuBaseMVMZ extends Scene_MenuBase { bottomAreaHeight() { return 20; } createHelpWindow() { const helpRect = this.helpWindowRect ? this.helpWindowRect() : null; const hw = InputConfigManager.getWorkaround().createHelpWindow(helpRect); this.addWindow(hw); this._helpWindow = hw; } /** * @returns {Number} */ mainAreaTop() { if (Utils.RPGMAKER_NAME === "MV") { return this._helpWindow.y + this._helpWindow.height; } return super.mainAreaTop(); } isBottomButtonMode() { return false; } helpAreaHeight() { return this.calcWindowHeight(this.helpWindowLines(), false); } isBottomHelpMode() { return false; } helpWindowLines() { return 3; } /** * @param {Number} numLines * @param {Boolean} selectable */ calcWindowHeight(numLines, selectable) { if (selectable) { return Window_Selectable.prototype.fittingHeight((numLines)) } return Window_Base.prototype.fittingHeight(numLines); } } /** * * @param {InputMapperType} obj */ function objectClone(obj) { /** * @type {Record<Number,String>} */ const result = {}; Object.keys(obj).forEach(function (key) { result[key] = obj[key]; }) return result; } //言語判定 //本体の処理タイミングがおかしいので、コピペしてきた const isJapanese = function () { return $dataSystem.locale.match(/^ja/); }; const isChinese = function () { return $dataSystem.locale.match(/^zh/); }; const isKorean = function () { return $dataSystem.locale.match(/^ko/); }; const isRussian = function () { return $dataSystem.locale.match(/^ru/); }; class MultiLanguageText { /** * * @param {String} en * @param {String} jp */ constructor(en, jp) { this.setNameEN(en); this.setNameJP(jp); this.setDefaultName(""); } static create(objText) { if (!objText) { return null; } const obj = JSON.parse(objText); const en = noteOrString(obj.en || ""); const jp = noteOrString(obj.jp || ""); const mtext = new MultiLanguageText(en, jp); return mtext; } isEmpty() { return (!this.ja_JP) && (!this.en_US); } /** * @param {String} name */ setNameJP(name) { this.ja_JP = name; } /** * @param {String} name */ setNameEN(name) { this.en_US = name; } /** * @param {String} name */ setDefaultName(name) { this._defaultName = name; } isUnknow() { return this._defaultName[0] === "?"; } refresh() { if (!this.isUnknow()) { this.setDefaultName(this.currentName()); } } currentName() { if (isJapanese() && this.ja_JP) { return this.ja_JP; } return this.en_US; } name() { return this._defaultName; } } class TouchButton { /** * @param {String} filePath * @param {Number} x * @param {Number} y */ constructor(filePath, x, y) { const result = (/(.*)\/(.*)/).exec(filePath); if (result) { this.setFilePath("img/" + result[1] + "/", result[2]); } else { this.setFilePath("", ""); } this._x = x; this._y = y; this.setSymbolObject(null); } /** * * @param {String} objText * @returns */ static create(objText) { if (!objText) { return null; } const obj = JSON.parse(objText); const x = Number(obj.x); const y = Number(obj.y); const button = new TouchButton(obj.image, x, y); return button; } /** * @param {String} folder * @param {String} fileName */ setFilePath(folder, fileName) { this._folder = folder; this._fileName = fileName; } isValid() { return !!this._fileName; } /** * @param {ExtendsSymbol} symbol */ setSymbolObject(symbol) { this._symbol = symbol; } isVisible() { return true; } bitmap() { //@ts-ignore return ImageManager.loadBitmap(this._folder, this._fileName); } rect() { return new Rectangle(); } symbol() { return this._symbol.symbol(); } symbolObject() { return this._symbol; } x() { return this._x; } y() { return this._y; } isEnabled() { return true; } clearPress() { const symbol = this.symbol(); Input._currentState[symbol] = false; } virtualPress() { const symbol = this.symbol(); if (!Input._currentState[symbol]) { Input._currentState[symbol] = TouchInput.isPressed(); } } } class ButtonManager_T { constructor() { /** * @type {TouchButton[]} */ this._list = []; } /** * @param {TouchButton[]} list */ addItemList(list) { this._list.push(...list); } getList() { return this._list; } /** * @param {TouchButton} button */ addButton(button) { this._list.push(button); } isTouchButtonEnabled() { return Utils.RPGMAKER_NAME === "MZ" && this._list.length > 0; } } const ButtonManager = new ButtonManager_T(); //todo //必須シンボル不足の際に、色で知らせたほうが良さそう class SymbolColorManager_T { /** * @param {string} normal * @param {string} mandatory * @param {string} move * @param {string} extendsSymbol */ constructor(normal, mandatory, move, extendsSymbol) { this._normal = (normal || "#880000") this._mandatory = (mandatory || "#22e488"); this._move = (move || "#22e488"); this._extends = extendsSymbol; } /** * * @param {String} objText * @returns */ static create(objText) { if (!objText) { return new SymbolColorManager_T(null, null, null, null); } const obj = JSON.parse(objText); const normal = (obj.normal || null); const mandatory = (obj.mandatory || null); const move = (obj.move || null); const extendsSymbol = (obj.extends); return new SymbolColorManager_T(normal, mandatory, move, extendsSymbol); } paramatorInvalidColor() { return "#FF00FF"; } emptyColor() { return "#000000"; } mandatoryColor() { return this._mandatory; } normalColor() { return this._normal; } moveSymbolColor() { if (this._move) { return this._move; } return this.mandatoryColor(); } } //TODO const SymbolColorManager = SymbolColorManager_T.create(getParam().color); //デバッグ用の情報を扱うクラス class DebugSymbol { /** * * @param {I_SymbolDefine} symbol * @param {String} type */ constructor(symbol, type) { this._symbol = symbol; this._type = type; } symbolName() { return this._symbol.name(); } exInfos() { //return this._symbol. } } //TODO:基本・拡張の双方で使うので、1クラス追加 class SymbolFill { constructor(keys, button) { } } class I_SymbolDefine { createDebugSymbol() { return new DebugSymbol(this, this.constructor.name); } isDeleter() { return false; } isParamatorValid() { if (!this.symbol()) { return false; } if (!this.name()) { return false; } if (this.isUnknow()) { return false; } return true; } symbolBackColor() { return this.backColor(); } // /** // * @desc keyconfigで使う背景色 // */ // keyBackColor(){ // return "#ffd530" ; // } customBackColor() { return ""; } backColor() { const custom = this.customBackColor(); if (custom) { return custom; } if (this.isMandatory()) { return SymbolColorManager.mandatoryColor() } if (this.isEmpty()) { return SymbolColorManager.emptyColor(); } return SymbolColorManager.normalColor(); } textColor() { return "#ffd530"; } isUnknow() { return false; } name() { return ""; } hasName() { return !!this.name(); } isEnabled() { return !this.isEmpty(); } symbol() { return ""; } isMandatory() { return false; } debugInfo() { return ""; } isEmpty() { return !this.symbol(); } displayKeyName() { return this.symbol(); } errorText() { if (!symbolManager.isInitialized()) { return setting.errorText.initFauled.currentName(); } if (this.isEmpty()) { return setting.errorText.symbolEmpty.currentName(); } if (!this.hasName()) { return setting.errorText.nameEmpty.currentName() + this.symbol(); } return ""; } helpText() { return "" } getHelpText() { const errorText = this.errorText(); if (errorText) { return errorText; } return this.helpText(); } createErrorObject() { } isPressed() { return Input.isPressed(this.symbol()); } isRepeated() { return Input.isRepeated(this.symbol()); } isTriggered() { return Input.isTriggered(this.symbol()); } } class MoveSymbol extends I_SymbolDefine { /** * @param {String} symbol * @param {String} name */ constructor(symbol, name) { super(); this._symbol = symbol; this._name = name; } backColor() { return SymbolColorManager.moveSymbolColor(); } symbol() { return this._symbol; } name() { return this._name; } displayKeyName() { return this._name; } // isMandatory(){ // return true; // } } function createMoveSymbols() { const up = new MoveSymbol("up", "↑"); const down = new MoveSymbol("down", "↓"); const left = new MoveSymbol("left", "←"); const right = new MoveSymbol("right", "→"); return [up, down, left, right]; } class SymbolDeleteObject extends I_SymbolDefine { isEnabled() { return true; } isDeleter() { return true; } name() { return setting.text.mapperDelete.currentName(); } symbol() { return null; } errorText() { return ""; } helpText() { return this.name(); } } class EscapeSymbol extends I_SymbolDefine { /** * @param {MultiLanguageText} name * @param {MultiLanguageText} helpText * @param {MultiLanguageText} keyText */ constructor(name, helpText, keyText) { super(); this._name = name; this._helpText = xxxxMtext(helpText); this._keyText = xxxxMtext(keyText); } static create(objText) { if (!objText) { const name = new MultiLanguageText("menu/cancel", "メニュー/キャンセル"); return new EscapeSymbol(name, null, null); } const obj = JSON.parse(objText); const name = MultiLanguageText.create(obj.name); const helpText = MultiLanguageText.create(obj.helpText); const keyText = MultiLanguageText.create(obj.keyText); return new EscapeSymbol(name, helpText, keyText); } name() { return this._name.currentName(); } symbol() { return "escape"; } backColor() { return SymbolColorManager.mandatoryColor(); } } /** * * @param {MultiLanguageText} mText */ function xxxxMtext(mText) { if (mText) { if (!mText.isEmpty()) { return mText } } return null; } class BasicSymbol extends I_SymbolDefine { /** * @param {String} symbol * @param {MultiLanguageText} name * @param {MultiLanguageText} keyText * @param {MultiLanguageText} helpText * @param {String} exKeys * @param {Number} exButton */ constructor(symbol, name, keyText, helpText, exKeys, exButton) { super(); this._symbol = symbol; //名前が未設定の場合、シンボルで初期化してしまう this._name = name ? name : new MultiLanguageText(symbol, symbol); //テキストが空っぽならnullにして、基底クラスの処理に任せる this._keyText = xxxxMtext(keyText); this._helpText = xxxxMtext(helpText); this._exKeys = exKeys; this._buttonId = exButton; } static create(symbol, objText) { if (!objText) { return new BasicSymbol(symbol, null, null, null, null, null); } const obj = JSON.parse(objText); const name = MultiLanguageText.create(obj.name); const keyText = MultiLanguageText.create(obj.keyText); const helpText = MultiLanguageText.create(obj.helpText); const exKeys = String(obj.exKeys || ""); const exButton = Number(obj.exButton); return new BasicSymbol(symbol, name, keyText, helpText, exKeys, exButton); } isMandatory() { return true; } helpText() { return super.helpText(); } name() { return this._name.currentName(); } symbol() { return this._symbol; } displayKeyName() { if (this._keyText) { return this._keyText.currentName(); } return super.displayKeyName(); } } function createBasicSymbols() { const param = getParam(); const ok = BasicSymbol.create("ok", param.basicOk); const cancel = BasicSymbol.create("cancel", param.basicCancel); const shift = BasicSymbol.create("shift", param.basicShift); const menu = BasicSymbol.create("menu", param.basicMenu); const pageup = BasicSymbol.create("pageup", param.basicPageup); const pagedown = BasicSymbol.create("pagedown", param.basicPagedown); const esacape = EscapeSymbol.create(param.basicEscape); return [ok, cancel, shift, menu, pageup, pagedown, esacape]; } class EventCaller { /** * @param {Number} eventId * @param {Number} triggereType */ constructor(eventId, triggereType) { this._eventId = eventId; this._inputType = triggereType; } /** * @param {String} objText * @returns */ static create(objText) { if (!objText) { return new EventCaller(0, 0); } const obj = JSON.parse(objText); const eventId = Number(obj.id); const inputType = Number(obj.inputType); return new EventCaller(eventId, inputType); } isValidEvent() { return this._eventId > 0; } eventId() { return this._eventId; } callEvent() { if (!$gameTemp.isCommonEventReserved()) { $gameTemp.reserveCommonEvent(this._eventId); } } /** * @param {String} symbol */ updateEvent(symbol) { if (this._eventId > 0 && this.needsEventCall(symbol)) { this.callEvent(); } } /** * @param {String} symbol * @returns */ needsEventCall(symbol) { switch (this._inputType) { case 0: return Input.isPressed(symbol); case 1: return Input.isTriggered(symbol) case 2: return Input.isRepeated(symbol); } return false; } typeIsPressed() { return this._inputType === 0; } typeIsTriggered() { return this._inputType === 1; } typeIsRepeated() { return this._inputType === 2; } } class KeySetting { /** * * @param {String} keys * @param {String} color * @param {MultiLanguageText} text */ constructor(keys, color, text) { this._keys = keys.toUpperCase(); this._color = color; this._mText = text; } static create(objText) { if (!objText) { return new KeySetting("", null, new MultiLanguageText("", "")); } const obj = JSON.parse(objText); const keys = obj.keys; const color = (obj.color || null); const mtext = MultiLanguageText.create(obj.text); return new KeySetting(keys, color, mtext); } backColor() { return this._color; } keys() { return this._keys; } keyText() { if (this._mText) { return this._mText.currentName(); } return ""; } } class AdovancedSetting { /** * * @param {String} symbol * @param {Number} overwriteType * @param {boolean} mandatory */ constructor(symbol, overwriteType, mandatory) { this._symbol = symbol; //シンボルが手動で設定されている場合、上書きで確定 this._overwriteType = (!!symbol) ? 9 : overwriteType; this._mandatory = mandatory; } /** * @param {String} objText * @returns */ static create(objText) { if (!objText) { return new AdovancedSetting(null, 0, false); } const obj = JSON.parse(objText); const symbol = (obj.symbol); const overwiteType = Number(obj.overwrite || 0); const mandatory = (obj.mandatory === "true"); return new AdovancedSetting(symbol, overwiteType, mandatory); } isSymbolValid() { return !symbolManager.isBasicSymbol(this._symbol); } symbol() { return this._symbol; } isOverwriteEnabled() { return this._overwriteType !== 0; } /** * * @param {Boolean} value */ setMandatory(value) { this._mandatory = value; } isMandatory() { return this._mandatory; } overwriteType() { return this._overwriteType; } } /** * @typedef {object} ExtendsSymbolPair * @property {ExtendsSymbol} exSymbol * @property {TouchButton} button */ /** * @param {String} objText * @returns {ExtendsSymbolPair} */ const createExtendsSymbol = function (objText) { const obj = JSON.parse(objText); //名前が滅茶苦茶だけど、==="true"が使えない状態なのでやむを得ずこれ const enabled = (obj.enabled === "false"); if (enabled) { return { exSymbol: null, button: null }; } const adovanced = AdovancedSetting.create(obj.adovanced); const buttonId = Number(obj.button); const mtext = MultiLanguageText.create(obj.name); //keysは非推奨だったので、廃止 問題が無いことを確認したら消す //const keys =String(obj.keys||""); //const keyText =String(obj.keyText||""); const helpText = MultiLanguageText.create(obj.helpText || "{}"); const keySetting = KeySetting.create(obj.keySetting); const eventObj = EventCaller.create(obj.event); const def = new ExtendsSymbol(adovanced, mtext, buttonId, eventObj, enabled, helpText, keySetting); /** * @type {String} */ const touchButtonText = (obj.touchButton) const button = TouchButton.create(touchButtonText);//:null; if (button && button.isValid()) { button.setSymbolObject(def); } return { exSymbol: def, button: button, } } class ExtendsSymbol extends I_SymbolDefine { /** * @param {AdovancedSetting} adovanced * @param {MultiLanguageText} actionName * @param {Number} buttonId * @param {EventCaller} eventCaller * @param {Boolean} enabled * @param {MultiLanguageText} helpText * @param {KeySetting} keySetting */ constructor(adovanced, actionName, buttonId, eventCaller, enabled, helpText, keySetting) { super(); this._event = eventCaller; this._symbol = null; //this._keys = (keys ||"").toUpperCase(); this._buttonId = buttonId; this._actionName = actionName; //this._keyText=keyText; this._helpText = helpText; this._advanced = adovanced; this._keySetting = keySetting; } getKeys() { return this._keySetting.keys(); } overwriteType() { return this._advanced.overwriteType(); } isOverwriteEnabled() { return this._advanced.isOverwriteEnabled(); } isMandatory() { return this._advanced.isMandatory(); } displayKeyName() { const keyText = this._keySetting.keyText(); if (keyText) { return keyText; } return super.displayKeyName(); } eventParam() { return this._event; } helpText() { if (this._helpText) { return this._helpText.currentName(); } return null; } hasName() { return !!this._actionName.currentName(); } name() { const name = this._actionName.currentName(); if (!this._symbol) { return `empty(${this.overwriteType()}):${name}`; } if (!name) { return `unnamed:${this._symbol}`; } return name; } customBackColor() { return this._keySetting.backColor(); } symbol() { return this._symbol; } /** * @param {(symbol:string)=>Boolean} isBasicSymbol * @returns {String} */ readManualySymbol(isBasicSymbol) { const symbol = this._advanced.symbol(); if (isBasicSymbol(symbol)) { return null; } return symbol; } /** * @param {(symbol:string)=>Boolean} isBasicSymbol * @returns {String} */ padSymbol(isBasicSymbol) { const symbol = Input.gamepadMapper[this._buttonId]; if (!isBasicSymbol(symbol)) { return symbol; } return null; } /** * @param {(symbol:string)=>Boolean} isBasicSymbol * @returns {String} */ firstKeySymbol(isBasicSymbol) { const keys = this.getKeys(); const charLen = keys.length; for (let i = 0; i < charLen; ++i) { const char_ = keys.charCodeAt(i); const symbol = Input.keyMapper[char_]; if (symbol) { if (!isBasicSymbol(symbol)) { return symbol; } } } return null; } evantCallSymbol() { if (this._event) { const eventId = this._event.eventId() if (eventId > 0) { return "call" + eventId; } } return null } /** * @param {(symbol:String)=>Boolean} isBasicSymbol * @returns {String} * @description 優先シンボルの読み込み */ readPreferredSymbol(isBasicSymbol) { const manualSymbol = this.readManualySymbol(isBasicSymbol); if (manualSymbol) { return manualSymbol; } switch (this._advanced.overwriteType()) { case 1: return this.padSymbol(isBasicSymbol); case 2: return this.firstKeySymbol(isBasicSymbol); case 3: return this.evantCallSymbol() } return ""; } /** * @param {(symbol:String)=>Boolean} isBasicSymbol * @returns {String} */ readMySymbol(isBasicSymbol) { //上書き用の優先されるシンボルを取り出す const xxxx = this.readPreferredSymbol(isBasicSymbol); if (xxxx) { return xxxx; } //無かったら、この順番で適当に読み込む const pad = this.padSymbol(isBasicSymbol); if (pad) { return pad; } const key = this.firstKeySymbol(isBasicSymbol) if (key) { return key; } const eventCall = this.evantCallSymbol(); if (eventCall) { return eventCall; } return ""; } /** * @param {(symbol:String)=>Boolean} mapper */ loadSymbol(mapper) { if (!this._symbol) { const symbol = this.readMySymbol(mapper); this._symbol = symbol; } if (this.isEmpty()) { this._advanced.setMandatory(false); } } mapperWrite(mapper, targetKey) { //上書きが許可されてない場合 if (!this.isOverwriteEnabled()) { //指定位置のシンボルがあるか調べる const oldSymbol = mapper[targetKey]; if (oldSymbol) { //上書きせずに終了 return; } } //TODO:mapperをmainMapperクラスにする //これで直接触るのを避ける mapper[targetKey] = this._symbol; } fillSymbol() { if (!this._symbol) { return; } if (!isNaN(this._buttonId)) { this.mapperWrite(Input.gamepadMapper, this._buttonId); } const keys = this.getKeys(); const len = keys.length; for (let i = 0; i < len; ++i) { const charcode = keys.charCodeAt(i); this.mapperWrite(Input.keyMapper, charcode); } } updateEventCall() { if (this._event) { const symbol = this.symbol(); if (symbol) { this._event.updateEvent(symbol); } } } errorText() { //シンボル手動設定で、標準シンボルと同じ文字列が指定されている if (!this._advanced.isSymbolValid()) { const current = setting.errorText.advanceSymbolInvalid.currentName(); return `${current}\nsymbol:${this._symbol}`; } return super.errorText(); } isEnabled() { return super.isEnabled() && this._advanced.isSymbolValid(); } debugInfo() { return `ot:${this.overwriteType()},id:${this._buttonId},keys:${this.getKeys()}`; } } /** * @description 指定したシンボルを持つキーの一覧を取得 * @param {String} symbol */ function KeyWithTheSymbolPlaced(symbol) { let keys = ""; for (const iterator of Object.entries(Input.keyMapper)) { if (iterator[1] === symbol) { const keyN = Number(iterator[0]); const char = String.fromCodePoint(keyN); keys += char; } } return keys; } /** * @description 指定したシンボルを持つパッドボタン番号を取得 * @param {String} symbol */ function buttonWithTheSymbolPlaced(symbol) { for (const iterator of Object.entries(Input.gamepadMapper)) { if (iterator[1] === symbol) { return Number(iterator[0]); } } return NaN; } class UnknowSymbol extends I_SymbolDefine { /** * @param {String} symbol */ constructor(symbol) { super(); //TODO:初期化処理を変えて、下記の関数をメソッドへと移行する this._kesy = KeyWithTheSymbolPlaced(symbol); this._buttonId = buttonWithTheSymbolPlaced(symbol); this._symbol = symbol; } symbol() { return this._symbol; } name() { return "?" + this.buttonIdText() + this._kesy + ":" + this.symbol(); } buttonIdText() { if (isNaN(this._buttonId)) { return ""; } return "(" + this._buttonId + ")"; } isUnknow() { return true; } debugInfo() { return "button:" + this._buttonId + ",keys:" + this._kesy; } helpText() { return setting.errorText.unknowSymbol.currentName() + "\n" + this.debugInfo(); } } class BasicSymbolList { constructor(ok, cancel, shift, pageup, pagedown, menu, shift_) { } } class SymbolManager_T { /** * @param {I_SymbolDefine[]} basicSymbols * @param {MoveSymbol[]} moveSymbols */ constructor(basicSymbols, moveSymbols) { /** * @type {Map<String,I_SymbolDefine>} */ this._symbolDictionary = new Map(); /** * @type {UnknowSymbol[]} */ this._unknowList = []; /** * @type {ExtendsSymbol[]} */ this._extendSymbols = []; this._basicSymbols = basicSymbols this._moveSymbols = moveSymbols this.addDictionaryItems(this._basicSymbols); this.addDictionaryItems(this._moveSymbols); this._initialized = false; this._event = null; } /** * @param {String} symbolString */ isBasicSymbol(symbolString) { if (!symbolString) { return false; } return this._basicSymbols.some(function (symbolObject) { return symbolObject.symbol() === symbolString; }) // const symbolObect = this.findSymbol(symbolString); // if(symbolObect){ // return this._basicSymbols.contains(symbolObect); // } // return false; } /** * @param {ExtendsSymbol[]} list */ addExtendsSymbols(list) { this._extendSymbols.push(...list); } /** * @private * @param {ExtendsSymbol[]} list */ setExtendSymbols(list) { this._extendSymbols = list; } onBoot() { if (this._initialized) { return; } this.loadExtendsSymbols(); this.loadUnknowSymbols(); //初期化成功フラグ //競合で頻繁に問題を起こすため this._initialized = true; } isInitialized() { return this._initialized; } loadExtendsSymbols() { const selfObject = this; const isBasicSymbol = function (symbol) { return selfObject.isBasicSymbol(symbol); }; const numExSymbols = this._extendSymbols.length; for (const iterator of this._extendSymbols) { iterator.loadSymbol(isBasicSymbol); } if (numExSymbols !== this._extendSymbols.length) { throw new Error("要素数を書き換えてはいけません") } for (const iterator of this._extendSymbols) { iterator.fillSymbol(); } //他のプラグインによる設定が完了した後で呼び出される //なので、このタイミングで行う必要がある this.addDictionaryItems(this._extendSymbols); } loadUnknowSymbols() { /** * @type {String[]} */ const padSymbols = Object.values(Input.gamepadMapper); /** * @type {String[]} */ const keySymbols = Object.values(Input.keyMapper) //mapperにある全てのシンボルを列挙する const set = new Set(keySymbols); for (const iterator of padSymbols) { set.add(iterator); } //Managerにあるシンボルを列挙した中から消す for (const iterator of this.getSymbolList()) { const symbol = iterator.symbol(); if (symbol) { set.delete(symbol); } } //移動シンボル4種を消す // for (const iterator of this._moveSymbols) { // const symbol = iterator.symbol(); // if(symbol){ // set.delete(symbol); // } // } for (const iterator of this.systemSymbols()) { set.delete(iterator); } //ラムダ式が使えないので、この方法でthisを捕まえておく const seleObject = this; set.forEach(function (symbol) { const obj = new UnknowSymbol(symbol) seleObject._unknowList.push(obj); // seleObject._symbolDictionary.set(symbol,obj); }); this.addDictionaryItems(this._unknowList) } callButtonEvent() { for (const iterator of this._extendSymbols) { //既に予約されている場合、あるいはupdateEventCall()で予約されたら処理を止める if ($gameTemp.isCommonEventReserved()) { break; } iterator.updateEventCall(); } } /** * @param {I_SymbolDefine[]} list */ addDictionaryItems(list) { for (const iterator of list) { const symbol = iterator.symbol(); if (symbol) { this._symbolDictionary.set(symbol, iterator); } } } /** * @returns {I_SymbolDefine[]} */ getSymbolList() { return this._basicSymbols.concat( this._extendSymbols, this._unknowList, this._moveSymbols //,[ new SymbolDeleteObject() ] ); } /** * @param {String} symbol */ actionName(symbol) { if (!symbol) { return ""; } const item = this.findSymbol(symbol); if (item) { return item.name(); } //TODO:この表記になるとガチで正体不明になるので対策 //この場合、初期化が正しく行われていない可能性 return "unknow:" + symbol; } /** * @param {String} symbol */ findSymbol(symbol) { return this._symbolDictionary.get(symbol); } systemSymbols() { return ["debug", "control", "tab"]; } /** * @param {String} symbol */ isMandatorySymbol(symbol) { if (!symbol) { return false; } const def = this._symbolDictionary.get(symbol); if (def) { return def.isMandatory(); } return false; } /** * @returns {I_SymbolDefine[]} */ allMandatorySymbols() { return this.getSymbolList().filter(function (def) { return def.isMandatory() }); } /** * @param {Set<String>} set * @returns */ isValidMapper_v3(set) { const m = this.allMandatorySymbols() for (const iterator of m) { const symbol = iterator.symbol(); if (Input._isEscapeCompatible(symbol)) { if (set.has("escape")) { continue; } } if (!set.has(symbol)) { return false; } } return true; } } const symbolManager = new SymbolManager_T( createBasicSymbols(), createMoveSymbols() ); /** * @param {string[]} textList * @param {SymbolManager_T} symbolManager * @param {ButtonManager_T} buttonManager * @param {(text:string)=>ExtendsSymbolPair} func */ function setupExtendsSymbols(textList, symbolManager, buttonManager, func) { //const param = getParam(); // /** // * @type {String[]} // */ // const textList = JSON.parse(param.extendsMapper); const buttons = []; const symbols = []; for (const iterator of textList) { const item = func(iterator); if (item.exSymbol) { symbols.push(item.exSymbol); } if (item.button) { buttons.push(item.button); } } symbolManager.addExtendsSymbols(symbols); buttonManager.addItemList(buttons); } setupExtendsSymbols(JSON.parse(getParam().extendsMapper || "[]"), symbolManager, ButtonManager, function (arg) { return createExtendsSymbol(arg); }); setupExtendsSymbols(JSON.parse(getParam().eventList || "[]"), symbolManager, ButtonManager, function (arg) { const obj = JSON.parse(arg); const actionName = MultiLanguageText.create(obj.name) const helpText = MultiLanguageText.create(obj.helpText); const adv = new AdovancedSetting(null, 0, false); const eventCaller = EventCaller.create(obj.event); const enabled = (obj.enabled === "true") const buttonNumber = Number(obj.button); const keyText = MultiLanguageText.create(obj.keyText); const keySetting = new KeySetting(String(obj.key || ""), null, keyText); const e = new ExtendsSymbol(adv, actionName, buttonNumber, eventCaller, enabled, helpText, keySetting); return { exSymbol: e, button: null, } }); if (ButtonManager.isTouchButtonEnabled()) { class Sprite_EX_Base extends Sprite_Clickable { /** * @param {Bitmap} bitmap */ constructor(bitmap) { super(); this.bitmap = bitmap; this._imageHeight = 0; this.setupBitmapOnLoad(); } setupBitmapOnLoad() { if (this.bitmap.isReady()) { this.onLoadeed(); } else { //ラムダ禁止 const selfObject = this; this.bitmap.addLoadListener(function (bitmap) { selfObject.onLoadeed(); }); } } onLoadeed() { //画像を上下半々で使うように設定 this._imageHeight = this.bitmap.height / 2; this.setColdFrame(); } setColdFrame() { this.setFrame(0, 0, this.bitmap.width, this._imageHeight) } setHotFrame() { this.setFrame(0, this._imageHeight, this.bitmap.width, this._imageHeight); } updateFrame() { if (this.isPressed()) { this.setHotFrame(); } else { this.setColdFrame(); } } } class Sprite_EX_ButtonMZ extends Sprite_EX_Base { /** * @param {TouchButton} touchButton */ constructor(touchButton) { super(touchButton.bitmap()); this._button = touchButton; this.resetPosition(); } resetPosition() { this.x = this._button.x(); this.y = this._button.y(); } onPress() { this._button.virtualPress(); } onClick() { Input.virtualClick(this._button.symbol()); } update() { super.update(); if (!this.isPressed()) { this._button.clearPress(); } this.updateFrame(); } } class Spriteset_TouchButton extends PIXI.Container { constructor() { super(); this._buttons = []; const buttons = ButtonManager.getList(); for (const iterator of buttons) { const sprite = new Sprite_EX_ButtonMZ(iterator); this.addChild(sprite); this._buttons.push(sprite); } } get z() { return 1; } update() { for (const iterator of this._buttons) { iterator.update(); } } isAnyButtonPressed() { //ラムダ禁止 return this._buttons.some(function (button) { return button.isPressed() }); } } const Scene_Map_createButtons = Scene_Map.prototype.createButtons; Scene_Map.prototype.createButtons = function () { Scene_Map_createButtons.call(this); if (ConfigManager.touchUI) { const spriteset = new Spriteset_TouchButton(); this.addWindow(spriteset); //@ts-ignore this._touchButtonsMA = spriteset; } }; const Scene_Map_isAnyButtonPressed = Scene_Map.prototype.isAnyButtonPressed; Scene_Map.prototype.isAnyButtonPressed = function () { const result = Scene_Map_isAnyButtonPressed.call(this); if (result) { return true; } //@ts-ignore return this._touchButtonsMA && this._touchButtonsMA.isAnyButtonPressed(); }; } //ボタンとキーの共通基底クラス class I_InputButton { name() { return ""; } mapperId() { return NaN; } } /** * @typedef {Object} SymbolCodePair * @property {Number} code * @property {String} symbol */ class I_ReadonlyMapper { /** * @param {Number} buttonId * @returns */ symbolString(buttonId) { return ""; } /** * @param {I_InputButton} button */ symbolString_V8(button) { return this.symbolString(button.mapperId()); } /** * @returns {Iterable<SymbolCodePair>} */ xxList() { return null; } /** * @param {String} symbol * @param {I_InputButton[]} buttonList * @returns */ buttonFromSymbol_XX(symbol, buttonList) { if (!symbol) { return null; } for (const button of buttonList) { const id = button.mapperId(); if (symbol === this.symbolString(id)) { return button; } } return null; } /** * @description Map<>を生成するための補助関数 * @returns {Map<Number,String>} * @param {InputMapperType} mapper */ createMapSupport(mapper) { const map = new Map(); for (const iterator of Object.entries(mapper)) { const code = Number(iterator[0]); if (!isNaN(code)) { map.set(code, iterator[1]); } } return map; } applyGamepad() { if (this.isValidMapper()) { Input._latestButton = null; const mapper = this.cloneMapper(); Input.gamepadMapper = mapper; } } applyKeyboard() { if (this.isValidMapper()) { Input._latestButton = null; const mapper = this.cloneMapper(); Input.keyMapper = mapper; } } /** * @returns {InputMapperType} */ cloneMapper() { throw new Error("未実装") } isValidMapper() { return false; } } //ゲーム実行中のマッパーに直接触れるヤツ //主にFillSymbol用 //初期状態も、これに持たせてしまう class MainMapperBase { constructor() { this._defaultMapper = null; } target() { return {}; } /** * * @param {Number} key * @param {String} symbolString */ change(key, symbolString) { const target = this.target(); target[key] = symbolString; } saveDefault() { this._defaultMapper = new DefaultMapper(this.target()); } loadDefault() { this.reset(this._defaultMapper.cloneMapper()); } /** * @param {InputMapperType} mapper */ reset(mapper) { } } class MainGamepadMapper extends MainMapperBase { target() { return Input.gamepadMapper; } reset() { } } class DefaultMapper extends I_ReadonlyMapper { /** * * @param {InputMapperType} obj */ constructor(obj) { super(); this._mapper = (objectClone(obj)); } mapper() { return this._mapper; } cloneMapper() { return objectClone(this._mapper); } } class InputDeviceBase extends I_ReadonlyMapper { constructor() { super(); this.setDefaultMapper(null); } /** * @param {DefaultMapper} mapper */ setDefaultMapper(mapper) { this._defaultMapper = mapper; } /** * @desc ABC順に並んだリスト * @returns {I_InputButton[]} */ indexList() { return []; } /** * @returns {I_InputButton[]} */ buttonList() { return [] } /** * @param {Number} buttonId * @returns {I_InputButton} */ buttonAt(buttonId) { return null } numButtons() { return this.buttonList().length; } /** * @returns {I_ReadonlyMapper} */ defaultMapper_v2() { return null; } defaultMapper() { return {}; } currentMapper() { return {} } /** * @param {String} symbol * @returns */ getButtonBySymbol(symbol) { const indexList = this.indexList(); return this.buttonFromSymbol_XX(symbol, indexList); } /** * @param {Number} buttonId * @returns {String} */ symbolString(buttonId) { const mapper = this.currentMapper(); const symbol = mapper[buttonId]; if (symbol) { return symbol; } return ""; } createTemporaryMapper() { const tmp = new TemporaryMappper(this.currentMapper()); return tmp; } } class GamepadButtonObj extends I_InputButton { /** * @param {Number} buttonId * @param {String} name */ constructor(buttonId, name) { super(); /** * @private */ this._name = name; /** * @private */ this._buttonId = buttonId; } name() { return this._name; } mapperId() { return this.buttonId(); } buttonId() { return this._buttonId; } text() { const buttonNumber = this._buttonId.toString().padStart(2, " "); return buttonNumber + ":" + this.name(); } color() { return "#000000"; } } //ハードメーカーの違いに対応するためのやつ /** * @template {I_InputButton} T_Button */ class I_DeviceLayout { deviceSymbol() { return ""; } name() { return ""; } /** * @param {Number} index * @returns {T_Button} */ button(index) { return null; } numButtons() { return 0; } } /** * @template {I_InputButton} T_Button * @extends {I_DeviceLayout<T_Button>} */ class DeviceLayout extends I_DeviceLayout { /** * @param {T_Button[]} list * @param {String} name * @param {String} symbol */ constructor(list, name, symbol) { super(); this._name = name; this._list = list; this._symbol = symbol; } /** * @returns {T_Button[]} */ buttons() { return this._list; } name() { return this._name; } deviceSymbol() { return this._symbol; } numButtons() { return this._list.length; } /** * @param {Number} index */ button(index) { return this._list[index]; } /** * @param {Number} code */ getButtonByCode(code) { for (const iterator of this._list) { if (iterator.mapperId() === code) { return iterator; } } return null; } } /** * * @param {String} symbol * @param {String} name * @param {String} button0 * @param {String} button1 * @param {String} button2 * @param {String} button3 */ function createGamepadLayout(symbol, name, button0, button1, button2, button3) { const buttons = [ new GamepadButtonObj(0, button0), new GamepadButtonObj(1, button1), new GamepadButtonObj(2, button2), new GamepadButtonObj(3, button3), new GamepadButtonObj(4, "L1"), new GamepadButtonObj(5, "R1"), new GamepadButtonObj(6, "L2"), new GamepadButtonObj(7, "R2"), new GamepadButtonObj(8, "select"), new GamepadButtonObj(9, "start"), new GamepadButtonObj(10, "L3"), new GamepadButtonObj(11, "R3") ]; return new DeviceLayout(buttons, name, symbol); } /** * * @param {String} symbol * @param {String} name */ function createButtonNumberLayout(symbol, name) { const buttonNumber = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]; const buttons = buttonNumber.map(function (number) { const buttonName = String(number); return new GamepadButtonObj(number, buttonName); }); return new DeviceLayout(buttons, name, symbol); } //ボタンの名前を入れておくクラス //また、編集可能なボタンを制御する際にも使う class Gamepad extends InputDeviceBase { /** * @param {GamepadLayoutSelector} layout */ constructor(layout) { super(); this._selector = layout; this._defaultMapper_V2 = null; } onBoot() { } buttonList() { const d = this._selector.currentLayout(); if (d) { return d.buttons(); } return []; } // /** // * @param {Number} buttonId // * @returns // */ // buttonObject(buttonId){ // return this._list[buttonId]; // } // indexList(){ // return this._list; // } /** * @param {Number} code */ getButtonByCode(code) { if (code <= 11) { return this._selector.getButtonByCode(code); // return this._selector. // return this.currentGGG().getButtonByCode(code); } return null; } /** * @param {number} index */ buttonAt(index) { return this._selector.buttonAt(index); //return this.currentGGG().button(index); } /** * @param {Number} index */ buttonName(index) { const b = this.buttonAt(index); if (b) { return b.name(); } return ""; } // buttonList(){ // return this._list; // } defaultMapper() { return Mano_InputConfig.defaultGamepadMapper; } currentMapper() { return Input.gamepadMapper; } isConected() { const pad = createPadState(0); return !!pad; } deviceName() { const pad = createPadState(0); if (pad) { return pad.id } return ""; } defaultMapper_v2() { const tmp = new TemporaryMappper(this.defaultMapper()); return tmp; } numButtons() { return this._selector.numButtons(); } } /** * @return {string[]} */ function createMandatorySymbols(params) { return ["ok", "cancel", "menu"]; } /** * @param {String} text * @returns {String} */ function noteOrString(text) { if (text == undefined) { return "undefined" } const last = text[text.length - 1] if (text[0] === '"' && last === '"') { return JSON.parse(text); } return String(text); } function createText(params) { const guid = new MultiLanguageText("This is an unknown symbol. Add an item to the input extension", "不明なシンボルです 入力拡張に項目を追加してください"); return { gamepadConfigCommandText: MultiLanguageText.create(params.gamepadConfigCommandText), keyConfigCommandText: MultiLanguageText.create(params.keyConfigCommandText), mapperDelete: MultiLanguageText.create(params.mapperDelete), //TODO:安定したら今後のバージョンで消す gamepadIsNotConnected: MultiLanguageText.create(params.GamepadIsNotConnectedText), needButtonDetouch: MultiLanguageText.create(params.needButtonDetouchText), unknowguid: guid, } } class ErrorObject { constructor(mtext, errorCategory) { } errorNumber() { //E1 //E9 その他のエラー } createErrorMessage(symbol) { } //一覧表示用の内容を返す itemText() { } //解決方法を返す helpText() { } } function createErrorTexts() { const advanceSymbolInvalid = new MultiLanguageText("", "拡張シンボルは標準シンボルと異なる内容でなければいけません。"); const initFauled = new MultiLanguageText("The initialization process was not performed correctly. \nThere is a possibility of a plugin conflict. \nMove the plugin down may help.", "初期化処理が正しく行われませんでした。\nプラグインの競合の可能性があります。\nプラグインを下の方に移動すると解決する場合があります。"); const unknowSymbol = new MultiLanguageText("This is an unknown symbol. Add an item to the input extension", "不明なシンボルです 入力拡張に項目を追加してください"); const symbolEmpty = new MultiLanguageText("The symbol is not set \n Check the contents of the inputExtension from the plugin parameters", "シンボルが設定されていません\nプラグインパラメータから拡張設定の内容を確認してください"); const nameEmpty = new MultiLanguageText("The name for display is not set\nsymbol:", "表示用の名称が設定されていません\nsymbol:"); return { advanceSymbolInvalid: advanceSymbolInvalid, initFauled: initFauled, unknowSymbol: unknowSymbol, symbolEmpty: symbolEmpty, nameEmpty: nameEmpty, } } class InputDevice_Readonly { constructor(mapper) { this._mapper = mapper; } mapper() { return this._mapper; } } class DeviceXXX { constructor() { this._defaultKeyMapper = null; this._defaultGamepadMapper = null; this.setKeyLayout(null, null); } /** * @param {Key_Layout} jis * @param {Key_Layout} us */ setKeyLayout(jis, us) { this._keyLayoutJIS = jis; this._keyLayoutUS = us; } onBoot() { this.setupDefaultMapper() } setupDefaultMapper() { this._defaultKeyMapper = new InputDevice_Readonly(Object.freeze(objectClone(Input.keyMapper))); this._defaultGamepadMapper = new InputDevice_Readonly(Object.freeze(objectClone(Input.gamepadMapper))); } keyMapper() { return this._defaultKeyMapper; } gamepadMapper() { return this._defaultGamepadMapper; } } /** * @template {I_InputButton} T_Button */ class LayoutSelecter { /** * @param {DeviceLayout<T_Button>[]} list */ constructor(list) { this._list = list; this._index = 0; } /** * * @param {String} symbolText */ selectOfSymbol(symbolText) { for (let index = 0; index < this._list.length; index++) { const element = this._list[index]; if (element && element.deviceSymbol() === symbolText) { this._index = index; return; } } this._index = -1; } changeNext() { this._index += 1; if (this._index >= this._list.length) { this._index = 0; } } /** * @param {Number} code * @returns */ getButtonByCode(code) { const d = this.currentLayout(); if (d) { return d.getButtonByCode(code); } return null; } currentLayout() { return this._list[this._index]; } currentDeviceSymbol() { const device = this.currentLayout(); if (device) { return device.deviceSymbol(); } return ""; } buttonAt(index) { const device = this.currentLayout(); if (device) { return device.button(index); } return null; } numButtons() { const device = this.currentLayout(); if (device) { return device.numButtons(); } return 0; } /** * @param {Number} index * @returns */ buttonName(index) { const device = this.currentLayout(); if (device) { //TODO: //return device.button(index) } return ""; } } /** * @typedef {LayoutSelecter<GamepadButtonObj>} GamepadLayoutSelector */ const setting = (function () { const params = getParam(); const keyText = { up: "↑", down: "↓", right: "→", left: "←" }; const buttonUsedForALT = new MultiLanguageText("", ""); buttonUsedForALT.setNameJP("このボタンには%1が割り当て済みです"); buttonUsedForALT.setNameEN("%1 has been assigned to this button"); const nintendo = createGamepadLayout("N", "nintendo", "B", "A", "Y", "X"); const playstation = createGamepadLayout("P", "playstation", "×", "○", "□", "△"); const xbox = createGamepadLayout("X", "xbox", "A", "B", "X", "Y"); const numberGamepad = createButtonNumberLayout("Number", "ButtonNumber"); const gamepadLayoutSelector = new LayoutSelecter([nintendo, numberGamepad, xbox, playstation]); const gamepad = new Gamepad(gamepadLayoutSelector); const result = { gamepadSelector: gamepadLayoutSelector, gamepad: gamepad, device: new DeviceXXX(), errorText: createErrorTexts(), text: createText(params), buttonUsedForALT: buttonUsedForALT, keyWindowLineHeight: 22, keyText: keyText, emptySymbolText: String(params.textEmpty), mandatorySymbols: createMandatorySymbols(params), windowSymbolListWidht: Number(params.windowSymbolListWidth), gamepadBackground: String(params.gamepadBackground), keyBackground: String(params.keyBackground), //needButtonDetouch:MultiLanguageText.create(params.needButtonDetouchText), //gamepadIsNotConnected: MultiLanguageText.create(params.GamepadIsNotConnectedText), //gamepadConfigCommandText:MultiLanguageText.create(params.gamepadConfigCommandText), //keyConfigCommandText:MultiLanguageText.create(params.keyConfigCommandText), //mapperDelete:MultiLanguageText.create(params.mapperDelete), numVisibleRows: 16,//Number(params.numVisibleRows), cols: 4, }; return result; })(); function currentGamepadConfigText() { return setting.text.gamepadConfigCommandText.currentName(); } function currentKeyConfigText() { return setting.text.keyConfigCommandText.currentName(); } /** * @typedef {Object} ConfigSavedata * @property {String} keyboardLayout * @property {String} padLayout * @property {Object} gamepadConfig * @property {Object} keyboardConfig */ /** * @param {String} base */ function makeCONFIG_KEY(base) { if (IS_Atsumaru) { //@ts-ignore return base + location.pathname; } return base; } class I_MVMZ_Workaround { /** * @returns {Window_Help} * @param {Rectangle} rect */ createHelpWindow(rect) { return null; } /** * @param {Scene_MenuBase} scene */ mainAreaHeigth(scene) { return 0; } /** * @param {Number} numLines * @param {Boolean} selectable */ calcWindowHeight(numLines, selectable) { if (selectable) { return Window_Selectable.prototype.fittingHeight((numLines)) } return Window_Base.prototype.fittingHeight(numLines); } } class MV_Impriment extends I_MVMZ_Workaround { /** * @param {Rectangle} rect * @returns */ createHelpWindow(rect) { const lines = this.helpWindowLines() return new Window_Help(lines); } mainAreaHeigth() { const helpAreaHeight = this.calcWindowHeight(this.helpWindowLines(), false); return Graphics.boxHeight - helpAreaHeight; } helpWindowLines() { return 3; } } class MZ_Impriment extends I_MVMZ_Workaround { /** * * @param {Rectangle} rect * @returns {Window_Help} */ createHelpWindow(rect) { return new Window_Help(rect); } /** * * @param {Scene_MenuBase} scene */ mainAreaHeigth(scene) { return scene.mainAreaHeight(); } /** * @param {Window_Base} window */ colorSrc(window) { return ColorManager; } } class InputConfigReadOnly { /** * @param {I_MVMZ_Workaround} workaround */ constructor(workaround) { this._workaround = workaround; } workaround() { return this._workaround; } } class InputConfigManager_T { /** * @param {InputConfigReadOnly} readonlyData */ constructor(readonlyData) { this._readonly = readonlyData; /** * @type {ConfigSavedata} */ this._saveData = null; this._defaultGamepad = null; } getWorkaround() { return this._readonly.workaround(); } makeDefaultMapper() { this._defaultGamepad = new DefaultMapper(Input.gamepadMapper); } defaultGamepadMapper() { return this._defaultGamepad; } /** * @param {Rectangle} rect * @returns */ createHelpWindow(rect) { //@ts-ignore return this._readonly.workaround().createHelpWindow(rect, 3); } makeSaveData() { if (!this._saveData) { /** * @type {ConfigSavedata} */ const save = { gamepadConfig: {}, keyboardConfig: {}, padLayout: "", keyboardLayout: "", } this._saveData = save; } } /** * @param {ConfigSavedata} config */ setConfigObject(config) { this._saveData = config; } defaultKeyLayout() { //オプション系プラグインで先行してmakeData()するタイプへの対策 if ($gameSystem && $gameSystem.isJapanese()) { return 'JIS'; } return 'US'; } createTemporalyGamepadMapper() { const mapper = new TemporaryMappper(this._saveData.gamepadConfig); return mapper; } applyGamepadConfig() { } isAllButtonDetouch() { return Input._latestButton === null; } isAnyButtonLongPressed() { return Input._pressedTime > 60; } } const InputConfigManager = (function () { const mvmz = (Utils.RPGMAKER_NAME === "MV") ? new MV_Impriment() : new MZ_Impriment(); const readonlyData = new InputConfigReadOnly(mvmz) return new InputConfigManager_T(readonlyData); }()) const MA_INPUTCONFIG_CONTENTS = makeCONFIG_KEY("MANO_INPUTCONFIG"); const MA_INPUTCONFIG_STYLE = makeCONFIG_KEY("MA_INPUTCONFIG_STYLE"); const MA_KEYBOARD_CONFIG = makeCONFIG_KEY('KEYBOARD_CONFIG'); const MA_GAMEPAD_CONFIG = makeCONFIG_KEY('GAMEPAD_CONFIG'); const MA_KEYBOARD_LAYOUT = makeCONFIG_KEY('KEYBOARD_LAYOUT'); function readGamePadConfig(config) { const value = config[MA_GAMEPAD_CONFIG]; if (value) { return value; } return null; } function readKeyboardConfig(config) { const value = config[MA_KEYBOARD_CONFIG]; if (value) { return value; } return null; } /** * @param {String} value */ //@ts-ignore ConfigManager.setInputConfigStyle = function (value) { this[MA_INPUTCONFIG_STYLE] = value; }; //@ts-ignore ConfigManager.setKeyLayoutMA = function (layout) { //@ts-ignore ConfigManager.keyLayout_MA = layout; }; function defaultKeyLayout() { //オプション系プラグインで先行してmakeData()するタイプへの対策 if ($gameSystem && $gameSystem.isJapanese()) { return 'JIS'; } return 'US'; } //saveconfig const ConfigManager_makeData = ConfigManager.makeData; ConfigManager.makeData = function () { const result = ConfigManager_makeData.call(this); result[MA_INPUTCONFIG_STYLE] = ConfigManager[MA_INPUTCONFIG_STYLE] || "normal"; result[MA_GAMEPAD_CONFIG] = Input.gamepadMapper; result[MA_KEYBOARD_CONFIG] = Input.keyMapper; //@ts-ignore result[MA_KEYBOARD_LAYOUT] = ConfigManager.keyLayout_MA || defaultKeyLayout(); return result; }; //loadconfig const ConfigManager_applyData = ConfigManager.applyData; ConfigManager.applyData = function (config) { ConfigManager_applyData.call(this, config); const gamepad = readGamePadConfig(config); if (gamepad) { Input.gamepadMapper = gamepad; } const keyMapper = readKeyboardConfig(config); if (keyMapper) { Input.keyMapper = keyMapper; } //@ts-ignore ConfigManager.setInputConfigStyle(config[MA_INPUTCONFIG_STYLE]); //@ts-ignore ConfigManager.setKeyLayoutMA(config[MA_KEYBOARD_LAYOUT] || 'JIS'); Input.clear(); }; //@ts-ignore const ColorSrc = window["ColorManager"] || null; /** * @returns {Window_Base} * @param {Window_Base|Window_Selectable} window_base */ function getColorSrc(window_base) { return ColorSrc || window_base; } class TemporaryMappperBase extends I_ReadonlyMapper { /** * * @param {String} symbol * @returns */ hasSymbol(symbol) { return false; } isValidMapper() { return false; } /** * @param {Number} code * @param {String} symbol */ change(code, symbol) { } /** * @returns {InputMapperType} */ createNormalizedMapper() { return {} } reset(mapper) { } } /** * @typedef {Record<Number,String> } InputMapperType */ //TODO:mapperのリセット用に保存してあるデータを何とかする //主にリセットで使うので、それに向いた構造に改造したい class TemporaryMappper extends TemporaryMappperBase { /** * @private * @param {InputMapperType} mapper */ static createMap(mapper) { /** * @type {Map<Number,String>} */ const map = new Map(); for (const iterator of Object.entries(mapper)) { const code = Number(iterator[0]); if (!isNaN(code)) { map.set(code, iterator[1]); } } return map; } /** * * @param {InputMapperType} mapper */ constructor(mapper) { super(); this.reset(mapper); } createSymbolsSet() { const set = new Set(this._map.values()); return set; } /** * @param {I_ReadonlyMapper} mapper */ readOtherMapper(mapper) { } /** * @param {DefaultMapper} mapper */ reset_V2(mapper) { this.reset(mapper.cloneMapper()); } /** * @param {InputMapperType} mapper */ reset(mapper) { this._map = TemporaryMappper.createMap(mapper); } /** * @param {Number} code * @param {String} symbol */ change(code, symbol) { this._map.set(Number(code), symbol); } /** * * @param {I_InputButton} botton * @param {I_SymbolDefine} symbolObject */ change_V8(botton, symbolObject) { this.change(botton.mapperId(), symbolObject.symbol()); } createNormalizedMapper() { /** * @type {InputMapperType} */ const result = {}; for (const iterator of this._map.entries()) { const n = (iterator[0]); const symbol = iterator[1]; if (!isNaN(n) && symbol) { result[n] = symbol; } } return result; } cloneMapper() { return this.createNormalizedMapper(); } /** * * @param {I_InputButton} button */ getSymbolObjectByCode_V8(button) { return this.getSymbolObjectByCode(button.mapperId()); } /** * @param {Number} codeId * @returns */ getSymbolObjectByCode(codeId) { const symbol = this._map.get(codeId); return symbolManager.findSymbol(symbol); } /** * @param {Number} codeId */ symbolString(codeId) { const symbol = this.getSymbolObjectByCode(codeId); if (symbol) { return symbol.symbol(); } return "" } /** * @param {Number} code * @returns {String} */ findSymbolByCode(code) { return this._map.get(code); } /** * @param {Number} code * @returns */ findObjectByCode(code) { const symbolString = this.findSymbolByCode(code); return symbolManager.findSymbol(symbolString); } // /** // * @param {String} symbol // */ // findFromSymbol(symbol){ // for (const iterator of this._map.entries()) { // if(iterator[1]===symbol){ // return iterator[0]; // } // } // return NaN; // } findObjectFromSymbol(symbolString) { } /** * @param {String} symbol * @param {Number} code */ canSymbolChange(symbol, code) { return !this.areSymbolAndCode(symbol, code); } /** * @param {String} symbol * @param {Number} code */ areSymbolAndCode(symbol, code) { const aa = this._map.get(code); return aa === symbol; } /** * @param {Number} code */ daleteByCode(code) { this._map.delete(code); } /** * @param {String} symbol */ hasSymbol(symbol) { const isEscapeCompatible = Input._isEscapeCompatible(symbol); for (const iterator of this._map.values()) { if (iterator === symbol) { return true; } if (isEscapeCompatible) { if (iterator === "escape") { return true; } } } return false; } isValidMapper() { return symbolManager.isValidMapper_v3(this.createSymbolsSet()); } } class Window_Selectable_InputConfigVer extends Window_Selectable { /** * @param {Rectangle} rect */ constructor(rect) { super(rect); } /** * @returns {Number} */ bottom() { return this.y + this.height; } /** * @param {MyRectType} rect */ initialize(rect) { window_initializeMVMZ(this, rect, super.initialize); } isOkTriggered() { return Input.isTriggered("ok"); } isCancelTriggered() { return Input.isTriggered('cancel'); } textPadding() { return 6; } /** * @param {MyRectType} rect * @param {String} color */ drawSymbolBack(rect, color) { this.changePaintOpacity(false); this.contents.fillRect(rect.x + 1, rect.y + 1, rect.width - 2, rect.height - 2, color); this.changePaintOpacity(true); } /** * @returns {typeof ColorManager} * @desc MV/MZ共用処理。ソースコードはMZ向けで記述。 */ colorSrc() { //@ts-ignore return getColorSrc(this); } /** * @param {I_SymbolDefine} symbolObject * @param {Number} x * @param {Number} y * @param {Number} width */ drawSymbolObject(symbolObject, x, y, width) { this.changePaintOpacity(symbolObject.isEnabled()); this.drawText(symbolObject.name(), x, y, width); } numberWidth() { return 26; } /** * @param {I_InputButton} button * @param {Number} x * @param {Number} y * @param {Number} width */ drawButton_V3(button, x, y, width) { const numberWidth = this.numberWidth(); this.drawText(button.mapperId(), x, y, numberWidth); const nameWidth = width - numberWidth const nameX = x + numberWidth; this.drawText(":" + button.name(), nameX, y, nameWidth); } } class Window_InputConfigBase extends Window_Selectable_InputConfigVer { /** * @param {MyRectType} rect */ initialize(rect) { this.initializeMapper(); super.initialize(rect); } initializeMapper() { } mainItems() { return 0; } /** * @returns {Key_Command[]} */ commandList() { return []; } /** * @param {Number} index * @returns */ command(index) { const commandList = this.commandList(); const commandIndex = this.commandIndex(index); return commandList[commandIndex]; } commandLength() { return this.commandList().length; } /** * @param {Number} index */ commandIndex(index) { return index - this.mainItems(); } exitCommandIndex() { return -1; } /** * @param {Number} index */ isExitCommand(index) { return this.exitCommandIndex() === index; } /** * * @param { Number} index */ drawCommand(index) { //メモ ボタン一覧を示すリストと、保存などに使うコマンドは別の配列 //なので、描画機能は分けてある const command = this.command(index); if (command) { this.changePaintOpacity(true); const rect = this.itemRectWithPadding(index); const text = command.text(); this.drawText(text, rect.x, rect.y, rect.width); } } processCommandOk() { const command = this.command(this.index()); if (command) { if (this.isHandled(command.handle)) { this.updateInputData(); this.deactivate(); this.callHandler(command.handle); } } else { this.playBuzzerSound(); } } callDrawItem(index) { } callDrawCommand() { } playLayoutChangeSound() { SoundManager.playEquip(); } playResetSound() { SoundManager.playEquip(); } playApplySound() { SoundManager.playEquip(); } playSymbolSetSound() { SoundManager.playOk(); } /** * @returns {Number} */ currentButtonCode() { throw (new Error("not imple")); } processCancel() { this.updateInputData(); if (this.isExitCommand(this._index)) { this.callCancelHandler(); } else { SoundManager.playCancel(); const cancellationIndex = this.exitCommandIndex(); this.select(cancellationIndex); } } /** * @returns {String} * @param {Number} index */ symbolString(index) { throw new Error("method not impriments!") } currentSymbolString() { return this.symbolString(this._index); } currentSymbolObject() { const symbol = this.currentSymbolString(); return symbolManager.findSymbol(symbol) } /** * @param {Boolean} value */ redrawApplyCommand(value) { } /** * @returns {InputDeviceBase} */ inputDevice() { throw new Error("input device unknow!") } // buttonItems(){ // return 0; // } /** * @returns {TemporaryMappper} */ temporaryMappper() { return null; } mapperSrc() { return {}; } /** * @param {String} symbol */ hasSymbol(symbol) { return this.temporaryMappper().hasSymbol(symbol); } canApplySetting() { return this.isValidMapper(); } isValidMapper() { return this.temporaryMappper().isValidMapper(); } resetMapper() { this.temporaryMappper().reset(this.defaultMapper()); } resetMapper_V2() { } defaultMapper() { return this.inputDevice().defaultMapper(); } cloneMapper() { return this.temporaryMappper().createNormalizedMapper(); } updateHelp() { const obj = this.currentSymbolObject(); if (obj) { this._helpWindow.setText(obj.getHelpText()); } else { this._helpWindow.clear(); } } } class Window_InputSymbolListBase extends Window_Selectable_InputConfigVer { /** * @param {Rectangle} rect */ initialize(rect) { this.makeItemList(); super.initialize(rect); this.deactivate(); this.deselect(); this.refresh(); } makeItemList() { this._list = symbolManager.getSymbolList(); } maxItems() { return this._list.length; } /** * @param {Number} index */ symbolObject(index) { return this._list[index]; } currentSymbolObject() { return this.symbolObject(this.index()); } /** * @param {String} symbol */ indexOfSymbol(symbol) { const numItms = this.maxItems(); for (let i = 0; i < numItms; i++) { const symbolObj = this.symbolObject(i); if (symbolObj && symbolObj.symbol() === symbol) { return i; } } return -1; } /** * @param {String} symbol */ selectSymbol(symbol) { if (symbol) { const index = this.indexOfSymbol(symbol); if (index >= 0) { this.select(index); return; } } this.select(0); } /** * @param {Number} index */ drawItem(index) { const item = this.symbolObject(index); if (item) { const rect = this.itemRectWithPadding(index); this.drawSymbolObject(item, rect.x, rect.y, rect.width); } } isCurrentItemEnabled() { return this.isItemEnabled(this._index); } currentItemIsDeleter() { const item = this.symbolObject(this.index()); if (item) { return item.isDeleter(); //有効化されていて、シンボルがnullなのはdeleteにしかない //return item.isEnabled() && (!item.symbol()); } return false; } /** * @param {Number} index */ isItemEnabled(index) { const symbol = this.symbolObject(index); if (symbol) { return symbol.isEnabled(); } return false; } updateHelp() { const symbol = this.currentSymbolObject() if (symbol) { this._helpWindow.setText(symbol.getHelpText()); } else { this._helpWindow.clear(); } } } class Window_InputSymbolList extends Window_InputSymbolListBase { makeItemList() { super.makeItemList(); //TODO:初期設定に戻す(ボタン単位)を追加 原理的には可能 this._list.push(new SymbolDeleteObject()); } maxCols() { return 4; } } function createPadState(padId) { //@ts-ignore if (!navigator.getGamepads) { return null; } //@ts-ignore const gamepads = navigator.getGamepads(); if (!gamepads) { return null } return gamepads[padId]; } class V8_Item { /** * @param {String} handlerSymbol */ constructor(handlerSymbol) { this._commandSymbol = handlerSymbol; } refresh() { } leftText() { return ""; } rigthText() { return ""; } xxOpacity() { return true; } helpText() { return ""; } handlerSymbol() { return this._commandSymbol; } /** * @returns {GamepadButtonObj} */ button() { return null; } } class V8Item_Button extends V8_Item { /** * @param {GamepadButtonObj} button * @param {TemporaryMappper} mapper */ constructor(button, mapper) { super("button"); this._button = button; this._mapper = mapper; this.refresh(); } refresh() { this._symbolObject = this._mapper.getSymbolObjectByCode_V8(this._button); } helpText() { if (this._symbolObject) { return this._symbolObject.helpText(); } return ""; } button() { return this._button; } leftText() { return this._button.name(); } rigthText() { const symbolName = this._symbolObject ? this._symbolObject.name() : ""; return `:${symbolName}`; } } class V8Item_Command extends V8_Item { /** * * @param {Key_Command} command */ constructor(command) { super(command.handle); this._command = command; } leftText() { return this._command.name(); } handlerSymbol() { return this._command.handle; } } class V8_Itemn_LayoutCommand extends V8Item_Command { /** * @param {Key_Command} command */ constructor(command) { super(command); this.setLayout(null); } /** * * @param {DeviceLayout<GamepadButtonObj>} layout */ setLayout(layout) { this._layout = layout; } helpText() { if (this._layout) { return this._layout.name(); } return ""; } } class V8_Item_ApplyCommand extends V8Item_Command { /** * @param {Key_Command} command * @param {I_ReadonlyMapper} mapper */ constructor(command, mapper) { super(command); this._mapper = mapper; } refresh() { } xxOpacity() { return this._mapper.isValidMapper(); } } class Window_GamepadConfig_V8 extends Window_Selectable_InputConfigVer { /** * @param {Rectangle} rect */ initialize(rect) { this._tmpMapper = new TemporaryMappper(Input.gamepadMapper); this._layoutCommand = new V8_Itemn_LayoutCommand(CommandManager.buttonLayout()); this._exitCommand = new V8Item_Command(CommandManager.exit()); this._resetCommand = new V8Item_Command(CommandManager.reset()); this._applyCommand = new V8_Item_ApplyCommand(CommandManager.apply(), this._tmpMapper); const layout = setting.gamepadSelector.currentLayout(); /** * @type {V8_Item[]} */ this._v8List = []; super.initialize(rect); this.setLayout(layout); } maxCols() { return 4; } getMapper() { return this._tmpMapper; } isCurrentCommandExit() { return this.currentItem() === this._exitCommand; } selectExitCommand() { const index = this._v8List.lastIndexOf(this._exitCommand); if (index >= 0) { this.select(index); } } refresh() { this.makeV8Item(); super.refresh(); } /** * @private */ makeV8Item() { const self_ = this; const baseList = this._layout.buttons().map(function (b) { /** * @type {V8_Item} */ const result = new V8Item_Button(b, self_._tmpMapper); return result; }); baseList.push(this._applyCommand, this._resetCommand, this._layoutCommand, this._exitCommand); this._v8List = baseList; } maxItems() { return this._v8List.length; } /** * @param {Number} index * @returns */ drawItem(index) { const item = this.itemAt(index); if (!item) { return } const right = item.rigthText(); const left = item.leftText(); const rect = this.itemRectWithPadding(index); this.changePaintOpacity(item.xxOpacity()); const rightWidth = (!!right) ? rect.width * 0.7 : 0; this.drawText(left, rect.x, rect.y, rect.width - rightWidth); if (!!right) { const rightX = rect.x + rect.width - rightWidth; this.drawText(right, rightX, rect.y, rightWidth); } } isOkEnabled() { return true; } callOkHandler() { const item = this.currentItem(); if (item) { const handlerSymbol = item.handlerSymbol(); if (this.isHandled(handlerSymbol)) { this.callHandler(handlerSymbol); } } } /** * @private * @param {Number} index */ itemAt(index) { return this._v8List[index]; } currentItem() { return this.itemAt(this.index()); } currentButton() { const item = this.currentItem(); if (item) { return item.button(); } return null; } isCurrentItemEnabled() { const item = this.currentItem(); if (item) { return item.xxOpacity(); } return false; } gamepad() { return setting.gamepadSelector } /** * @param {GamepadButtonObj} button */ buttonName(button) { return button.name(); } /** * @param {DeviceLayout<GamepadButtonObj>} layout */ setLayout(layout) { this._layout = layout; this._layoutCommand.setLayout(layout); this.makeV8Item(); this.refresh(); } updateHelp() { const item = this.currentItem(); if (item) { this._helpWindow.setText(item.helpText()); } } } class Scene_GamepadConfig_V8 extends Scene_MenuBaseMVMZ { symbolListHeight() { const mainAreaHeight = InputConfigManager.getWorkaround().mainAreaHeigth(this); return mainAreaHeight - this.mainWindowHeight(); } mainWindowHeight() { return this.calcWindowHeight(4, true); } mainWindowRect() { const x = 0; const y = this.mainAreaTop(); const width = Graphics.boxWidth; const height = this.mainWindowHeight() return new Rectangle(x, y, width, height); } createGamepadWindow() { const rect = this.mainWindowRect(); const ww = new Window_GamepadConfig_V8(rect); ww.setHandler("button", this.onGamepadButton.bind(this)); ww.setHandler("cancel", this.onGamepadCancel.bind(this)); ww.setHandler("exit", this.onGamepadCancel.bind(this)); ww.setHandler(CommandManager.apply().handle, this.onApply.bind(this)); ww.setHandler(CommandManager.reset().handle, this.onReset.bind(this)); ww.setHandler(CommandManager.buttonLayout().handle, this.onChangeLayoutOk.bind(this)); this.addWindow(ww); this._gamepadWindow = ww; } createSymbolListRect() { const width = Graphics.boxWidth; const height = this.symbolListHeight(); const x = 0; const y = Graphics.boxHeight - height; return new Rectangle(x, y, width, height); } createSymbolListWindow() { const rect = this.createSymbolListRect(); const sw = new Window_InputSymbolList(rect); sw.setHandler("ok", this.onSymbolListOk.bind(this)); sw.setHandler("cancel", this.onSymbolListCnacel.bind(this)); this._sybmolWindow = sw; this.addWindow(sw); } create() { super.create(); this.createAllWindows(); } createAllWindows() { this.createHelpWindow(); this.createGamepadWindow(); this.createSymbolListWindow(); this.linkWindow(); } linkWindow() { this._sybmolWindow.setHelpWindow(this._helpWindow); this._gamepadWindow.setHelpWindow(this._helpWindow); this._gamepadWindow.activate(); this._gamepadWindow.select(0); } xx() { return setting.gamepadSelector } onGamepadReset() { const mapper = this._gamepadWindow.getMapper(); mapper.reset_V2(InputConfigManager.defaultGamepadMapper()); this._gamepadWindow.refresh(); this._gamepadWindow.activate(); } onGamepadButton() { const button = this._gamepadWindow.currentButton(); if (!button) { this._gamepadWindow.activate(); return; } const mapper = this._gamepadWindow.getMapper(); //そのボタンからシンボルを決定する const symbol = mapper.getSymbolObjectByCode_V8(button); const symbolString = symbol ? symbol.symbol() : ""; this._sybmolWindow.selectSymbol(symbolString); this._sybmolWindow.show(); this._sybmolWindow.activate(); } onGamepadCancel() { if (this._gamepadWindow.isCurrentCommandExit()) { this.popScene(); return; } this._gamepadWindow.selectExitCommand(); this._gamepadWindow.activate(); } onSymbolListOk() { //tmpMapperを捕まえる const mapper = this._gamepadWindow.getMapper(); //シンボルとボタンを特定する const button = this._gamepadWindow.currentButton(); const symbol = this._sybmolWindow.currentSymbolObject(); if (button && symbol) { SoundManager.playEquip(); //書き換えを行う mapper.change_V8(button, symbol); //gamepadWindowを再描画 this._gamepadWindow.refresh(); } //制御を移す this._sybmolWindow.deselect(); this._gamepadWindow.activate(); } onSymbolListCnacel() { this._sybmolWindow.deselect(); this._sybmolWindow.hide(); this._gamepadWindow.activate(); } onReset() { //マッパーを捕まえる const mapper = this._gamepadWindow.getMapper(); const defaultMapper = InputConfigManager.defaultGamepadMapper() //デフォルトのマッパーを持ってくる //書き込む mapper.reset_V2(defaultMapper); //再描画する this._gamepadWindow.refresh(); this._gamepadWindow.activate(); } onApply() { //mapperを取得 const mapper = this._gamepadWindow.getMapper(); //状態が正しいかを確認 if (mapper.isValidMapper()) { mapper.applyGamepad(); this.popScene(); } else { this._gamepadWindow.activate(); } } onChangeLayoutOk() { this.xx().changeNext(); this._gamepadWindow.setLayout(this.xx().currentLayout()); this._gamepadWindow.activate(); } } class Scene_InputConfigBase_MA extends Scene_MenuBaseMVMZ { constructor() { super(); //popSceneModeとapplyOnExitは別 //前者はシーン切り替え検知で、後者は一度設定が変更されたことの検知 //混ぜてはいけない this._popSceneMode = false; } isALTmode() { return false; } /** * @param {String} value */ setAltMode(value) { //@ts-ignore ConfigManager.setInputConfigStyle(value); } start() { const mode = this.isALTmode() ? "ALT" : "normal"; this.setAltMode(mode); super.start(); } /** * @param {String} text */ setHelpText(text) { this._helpWindow.setText(text) } /** * @returns {Bitmap} */ backBitmap() { return null; } createBackground() { const bitmap = this.backBitmap(); if (!bitmap) { super.createBackground(); return; } const sprite = new Sprite(bitmap); this._backgroundSprite = sprite; this.addChild(sprite); } defaultMapper() { return this.mainWidnow().defaultMapper(); } symbolListWidth() { return Graphics.boxWidth; } helpWindowInitParam() { if (Utils.RPGMAKER_NAME === "MV") { return this.helpWindowLines(); } return this.helpWindowRect(); } createHelpWindow() { this._helpWindow = new Window_Help(this.helpWindowInitParam()); this.addWindow(this._helpWindow); } mainWindowHeight() { return this.subWindowTop() - this.mainAreaTop(); } mainWindowRect() { const x = 0; const y = this.mainAreaTop(); const width = Graphics.boxWidth; const height = this.mainWindowHeight(); return new Rectangle(x, y, width, height); } subWindowTop() { return Graphics.boxHeight - this.subWindowHeight(); } subWindowHeight() { return this.calcWindowHeight(3, true); } subWindowRect() { const width = Graphics.boxWidth; const height = this.subWindowHeight(); const x = 0; const y = this.subWindowTop(); return new Rectangle(x, y, width, height); } createSymbolListWindow() { const rect = this.subWindowRect(); const asw = new Window_InputSymbolList(rect); asw.setHandler('ok', this.onSymbolListOk.bind(this)); asw.setHandler('cancel', this.onSymbolListCancel.bind(this)); asw.hide(); // asw.refresh(); asw.setHelpWindow(this._helpWindow); this.addWindow(asw); this._symbolListWindow = asw; } popScene() { this._popSceneMode = true; } resetMapper() { const mainWindow = this.mainWidnow(); mainWindow.resetMapper(); mainWindow.playResetSound(); mainWindow.refresh(); mainWindow.redrawApplyCommand(mainWindow.isValidMapper()); mainWindow.activate(); } applyConfig() { const mainWindow = this.mainWidnow(); if (mainWindow.isValidMapper()) { mainWindow.playApplySound(); this._applyOnExit = true; this.popScene(); } else { mainWindow.playBuzzerSound(); mainWindow.activate(); } } isAllButtonDetouch() { return Input._latestButton === null; } isAnyButtonLongPressed() { return Input._pressedTime > 60; } updateSceneChange() { if (this._popSceneMode) { if (this.isAnyButtonLongPressed()) { if (this._helpWindow) { this._helpWindow.setText(setting.text.needButtonDetouch.currentName()); } } if (this.isAllButtonDetouch()) { super.popScene(); return; } } } update() { this.updateSceneChange(); super.update(); } onConfigOk() { this.selectSymbol(); } onConfigCancel() { SoundManager.playCancel(); SceneManager.pop(); } selectSymbol() { const currentSymbol = this.mainWidnow().currentSymbolString(); this._symbolListWindow.show(); this._symbolListWindow.activate(); this._symbolListWindow.selectSymbol(currentSymbol); } /** * @return {Window_InputConfigBase} */ mainWidnow() { return null; } /** * @returns {Window_Selectable} */ subWindow() { return null; } currentSymbolObject() { return this._symbolListWindow.currentSymbolObject(); } currentButtonCode() { throw (new Error("not imple")); return -1; } /** * @param {String} symbol * @param {Number} code */ changeSymbolV9(symbol, code) { } callChangeSymbol_v5() { const symbol = this.currentSymbolObject(); if (!symbol) { return; } const code = this.currentButtonCode(); if (isNaN(code)) { return; } const mapper = this.mapperClass(); //明示的な削除処理をあらかじめ用意する //実装を変える時にミスしがちなので、こうする if (symbol.isDeleter()) { mapper.daleteByCode(code); this.redrawXXX(); return; } const symbolString = symbol.symbol(); if (mapper.canSymbolChange(symbolString, code)) { mapper.change(code, symbolString); this.redrawXXX(); } } redrawXXX() { const mainWindow = this.mainWidnow(); mainWindow.redrawCurrentItem(); mainWindow.redrawApplyCommand(mainWindow.canApplySetting()); } onSymbolListOk() { this.callChangeSymbol_v5(); this.endSubWindowSelect(); } onSymbolListCancel() { this.endSubWindowSelect(); } endSubWindowSelect() { const sub = this.subWindow(); sub.deselect(); sub.hide(); // this._symbolListWindow.deselect(); // this._symbolListWindow.hide(); this.mainWidnow().activate(); } mapperClass() { return this.mainWidnow().temporaryMappper(); } terminate() { super.terminate(); if (this._applyOnExit) { this.saveMapper(); ConfigManager.save(); } } saveMapper() { //override } } class Key_Base extends I_InputButton { /** * @returns {String} */ get handle() { return "ok"; } get locked() { return false; } get char() { return ""; } get isLink() { return false; } get keycord() { return 0; } name() { return this.char; } mapperId() { return this.keycord; } /** * @param {Window_KeyConfig_MA} keyWindow * @param {Number} index */ draw(keyWindow, index) { this.drawBasicChar(keyWindow, index); } /** * @param {Window_KeyConfig_MA} keyWindow * @param {Number} index */ redraw(keyWindow, index) { this.drawBasicChar(keyWindow, index); } /** * @param {Number} index * @desc 一部の複数マスにまたがるキーのための機能 基本実装しないでいい */ setIndex(index) { } /** * @param {Window_KeyConfig_MA} keyWindow * @param {Number} index */ drawBasicChar(keyWindow, index) { const s = keyWindow.symbolObjectFromKeyNumber(this.keycord); const rect = keyWindow.itemRect(index); keyWindow.drawInputDefine(this, s, rect); } /** * @param {Window_KeyConfig_MA} keyWindow * @param {Number} index */ rect(keyWindow, index) { return keyWindow.baseRect(index); } } class Key_Null extends Key_Base { get locked() { return true; } /** * @param {Window_KeyConfig_MA} keyWindow * @param {Number} index */ draw(keyWindow, index) { } } class Key_Char extends Key_Base { /** * @param {String} char * @param {Number} keycord */ constructor(char, keycord) { super(); this._char = char; this._keycord = keycord; } get char() { return this._char; } get keycord() { return this._keycord; } } class Key_Locked extends Key_Char { get locked() { return true; } } class Key_Big extends Key_Char { /** * @param {String} char * @param {Number} keycord * @param {Number} width * @param {Number} height * @param {boolean} looked */ constructor(char, keycord, width, height, looked) { super(char, keycord); this._widthEx = Math.max(width, 1); this._heightEx = Math.max(height, 1); this._locked = looked || false; } get locked() { return this._locked; } /** * @param {Window_KeyConfig_MA} keyWindow */ rect(keyWindow) { const rect = keyWindow.baseRect(this._index); rect.width *= this._widthEx; rect.height *= this._heightEx; return rect; } /** * @param {Number} index */ setIndex(index) { if (isNaN(this._index)) { this._index = index; } } /** * @param {Window_KeyConfig_MA} keyWindow * @param {Number} index */ draw(keyWindow, index) { if (index === this._index) { super.draw(keyWindow, index); } } /** * @param {Window_KeyConfig_MA} keyWindow * @param {Number} index */ redraw(keyWindow, index) { super.draw(keyWindow, this._index); } } class Key_Command extends Key_Base { /** * @param {String} handlerName * @param {MultiLanguageText} mtext * @param {Number} width */ constructor(handlerName, mtext, width) { super(); this._callBackHandle = handlerName; this._widthEx = width; this._mtext = mtext; } static create(objText, handler) { const obj = JSON.parse(objText); return new Key_Command( handler, MultiLanguageText.create(obj.text), Number(obj.width) ); } get char() { return this._mtext.currentName(); } text() { return this.char; } get isLink() { return this._widthEx > 1; } get locked() { return false; } get keycord() { return 0; } get isCommand() { return true; } get handle() { return this._callBackHandle; } /** * @param {Window_KeyConfig_MA} keyConfigWindow */ onOk(keyConfigWindow) { keyConfigWindow.callHandler(this._callBackHandle); } /** * @param {Number} index */ setIndex(index) { if (isNaN(this._index)) { this._index = index; } } /** * @param {Window_KeyConfig_MA} keyWindow * @param {Number} index */ rect(keyWindow, index) { const rect = keyWindow.baseRect(this._index); rect.width *= this._widthEx; return rect; } /** * @param {Window_KeyConfig_MA} keyWindow * @param {Number} index */ draw(keyWindow, index) { if (index === this._index) { const rect = this.rect(keyWindow, index); keyWindow.drawCommandXX(this.char, rect); } } helpText() { return "コマンドのヘルプ"; } } function createButtonLayoutChangeCommand() { const mText = new MultiLanguageText("Change button notation", "ボタン表記変更"); const command = new Key_Command("ButtonLayout", mText, 3); return command; } class Key_CommandManager_T { constructor() { const params = getParam(); this._apply = Key_Command.create(params.apply, "apply"); this._wasd = Key_Command.create(params.WASD, "WASD"); this._exit = Key_Command.create(params.exit, "exit"); this._reset = Key_Command.create(params.reset, "reset"); //this._alt = Key_Command.create(params.style,"ALT"); this._changeButtonLayout = createButtonLayoutChangeCommand(); this._changeLayout = Key_Command.create(params.changeLayout, "keylayout"); } buttonLayout() { return this._changeButtonLayout; } keylayout() { return this._changeLayout; } getKeylayoutText() { return this._changeLayout.text(); } wasd() { return this._wasd; } getWasdText() { return this._wasd.text(); } reset() { return this._reset; } getResetText() { return this._reset.text(); } apply() { return this._apply } getApplyText() { return this._apply.text(); } // alt(){ // return this._alt; // } exit() { return this._exit; } getExitText() { return this._exit.text(); } createCommandList_ForKeyLayout() { const commandList = [ this._reset, this._apply, this._wasd, this._changeLayout, this._exit ]; const result = []; for (const iterator of commandList) { for (var i = 0; i < iterator._widthEx; ++i) { result.push(iterator); } } return result; } createCommandList_ForGamepad() { const layout = this.buttonLayout(); const exit = this.exit(); const reset = this.reset() //const alt = this.alt(); const apply = this.apply(); return [ apply, reset, layout, exit ]; } } const CommandManager = (function () { return new Key_CommandManager_T(); })() /** * @param {string} char * @param {number} keycord */ function keyinfo(char, keycord) { return new Key_Char(char, keycord); } const WASD_KEYMAP = { 81: "pageup", //Q 69: "pagedown", //E 87: "up", //W 65: "left", //A 83: "down", //S 68: "right", //D }; const KEYS = { SPACE: new Key_Big("Space", 32, 4, 1, false), ENTER_JIS: new Key_Big('Enter', 13, 2, 2, true), ENTER_US: new Key_Big("Entre", 13, 3, 1, true), NULL: new Key_Null(), UP: new Key_Locked(setting.keyText.up, 38), DOWN: new Key_Locked(setting.keyText.down, 40), LEFT: new Key_Locked(setting.keyText.left, 37), RIGHT: new Key_Locked(setting.keyText.right, 39), TENKEY0: new Key_Big('0', 96, 2, 1, false), TENKEY1: keyinfo('1', 97), TENKEY2: keyinfo('2', 98), TENKEY3: keyinfo('3', 99), TENKEY4: keyinfo('4', 100), TENKEY5: keyinfo('5', 101), TENKEY6: keyinfo('6', 102), TENKEY7: keyinfo('7', 103), TENKEY8: keyinfo('8', 104), TENKEY9: keyinfo('9', 105), TENKEY_DOT: keyinfo('.', 110), TAB: keyinfo("TAB", 9), _0: keyinfo('0', 48), _1: keyinfo('1', 49), _2: keyinfo('2', 50), _3: keyinfo('3', 51), _4: keyinfo('4', 52), _5: keyinfo('5', 53), _6: keyinfo('6', 54), _7: keyinfo('7', 55), _8: keyinfo('8', 56), _9: keyinfo('9', 57), A: keyinfo('A', 65), B: keyinfo('B', 66), C: keyinfo('C', 67), D: keyinfo('D', 68), E: keyinfo('E', 69), F: keyinfo('F', 70), G: keyinfo('G', 71), H: keyinfo('H', 72), I: keyinfo('I', 73), J: keyinfo('J', 74), K: keyinfo('K', 75), L: keyinfo('L', 76), M: keyinfo('M', 77), N: keyinfo('N', 78), O: keyinfo('O', 79), P: keyinfo('P', 80), Q: keyinfo('Q', 81), R: keyinfo('R', 82), S: keyinfo('S', 83), T: keyinfo('T', 84), U: keyinfo('U', 85), V: keyinfo('V', 86), W: keyinfo('W', 87), X: keyinfo('X', 88), Y: keyinfo('Y', 89), Z: keyinfo('Z', 90), SHIFT: new Key_Locked('Shift', 16), CTRL: new Key_Locked('CTRL', 17), INSERT: keyinfo('Ins', 45), BACK: keyinfo('Back', 8), HOME: keyinfo('Home', 36), END: keyinfo('End', 35), PAGEUP: keyinfo('PgUp', 33), PAGEDOWN: keyinfo('PgDn', 34), ESC: keyinfo('esc', 27), ATMARK: keyinfo("@", 192), TENKEY_MINUS: keyinfo('-', 109), TENKEY_PLUS: keyinfo('+', 107), MINUS: keyinfo('-', 189), COMMA: keyinfo(',', 188), SEMICOLON: keyinfo(';', 186), SLASH: keyinfo('/', 191), BACKSLASH: keyinfo('\\', 226), DOT: keyinfo('.', 190), COLON: keyinfo(':', 58), CARET: keyinfo('^', 222), APOSTROPHE: keyinfo("'", 222), EQUAL_JIS: keyinfo('=', 189), SQUARE_BRACKETS_OPEN: keyinfo('[', 219), SQUARE_BRACKETS_CLOSE: keyinfo(']', 221), }; const keyXXXX = [ KEYS.A, KEYS.B, KEYS.C, KEYS.D, KEYS.E, KEYS.F, KEYS.G, KEYS.H, KEYS.I, KEYS.J, KEYS.K, KEYS.L, KEYS.M, KEYS.N, KEYS.O, KEYS.P, KEYS.Q, KEYS.R, KEYS.S, KEYS.T, KEYS.U, KEYS.V, KEYS.W, KEYS.X, KEYS.Y, KEYS.Z, KEYS._0, KEYS._1, KEYS._2, KEYS._3, KEYS._4, KEYS._5, KEYS._6, KEYS._7, KEYS._8, KEYS._9 ]; class Key_Layout extends InputDeviceBase { /** * @param {Key_Base[]} keyList */ static keylayout_SetupIndex(keyList) { for (let index = 0; index < keyList.length; index++) { const element = keyList[index]; element.setIndex(index); } } indexList() { return keyXXXX; } button(buttonCode) { return null; } /** * @param {String} layoutName * @param {Key_Base[]} srcList */ constructor(layoutName, srcList) { super(); this._name = layoutName; this._buttonItems = srcList.length; const list = srcList.concat(CommandManager.createCommandList_ForKeyLayout()); Key_Layout.keylayout_SetupIndex(list); this._list = list;//Object.freeze( list); this._enterKeyIndex = this._list.indexOf(KEYS.ENTER_JIS); } numButtons() { return this._buttonItems; } buttonList() { return this._list; } /** * @param {Key_Big} enter */ setEnterKey(enter) { this._enter = enter; } defaultMapper() { return Mano_InputConfig.defaultKeyMapper; } currentMapper() { return Input.keyMapper; } } const KEY_LAYOUT_JIS = (function () { const list = [ KEYS.ESC, KEYS._1, KEYS._2, KEYS._3, KEYS._4, KEYS._5, KEYS._6, KEYS._7, KEYS._8, KEYS._9, KEYS._0, KEYS.MINUS, KEYS.CARET, KEYS.INSERT, KEYS.BACK, KEYS.HOME, KEYS.END, KEYS.PAGEUP, KEYS.PAGEDOWN, KEYS.TAB, KEYS.Q, KEYS.W, KEYS.E, KEYS.R, KEYS.T, KEYS.Y, KEYS.U, KEYS.I, KEYS.O, KEYS.P, KEYS.ATMARK, KEYS.SQUARE_BRACKETS_OPEN, KEYS.ENTER_JIS, KEYS.ENTER_JIS, KEYS.TENKEY7, KEYS.TENKEY8, KEYS.TENKEY9, KEYS.TENKEY_MINUS, KEYS.NULL, KEYS.A, KEYS.S, KEYS.D, KEYS.F, KEYS.G, KEYS.H, KEYS.J, KEYS.K, KEYS.L, KEYS.SEMICOLON, KEYS.COLON, KEYS.SQUARE_BRACKETS_CLOSE, KEYS.ENTER_JIS, KEYS.ENTER_JIS, KEYS.TENKEY4, KEYS.TENKEY5, KEYS.TENKEY6, KEYS.TENKEY_PLUS, KEYS.SHIFT, KEYS.Z, KEYS.X, KEYS.C, KEYS.V, KEYS.B, KEYS.N, KEYS.M, KEYS.COMMA, KEYS.DOT, KEYS.SLASH, KEYS.BACKSLASH, KEYS.SHIFT, KEYS.UP, KEYS.NULL, KEYS.TENKEY1, KEYS.TENKEY2, KEYS.TENKEY3, KEYS.NULL, KEYS.CTRL, KEYS.NULL, KEYS.NULL, KEYS.NULL, KEYS.SPACE, KEYS.SPACE, KEYS.SPACE, KEYS.SPACE, KEYS.NULL, KEYS.NULL, KEYS.NULL, KEYS.NULL, KEYS.LEFT, KEYS.DOWN, KEYS.RIGHT, KEYS.TENKEY0, KEYS.TENKEY0, KEYS.TENKEY_DOT, KEYS.NULL, ]; const layout = new Key_Layout("JIS", list); layout.setEnterKey(KEYS.ENTER_JIS); return Object.freeze(layout); })(); const KEY_LAYOUT_US = (function () { const list = [KEYS.ESC, KEYS._1, KEYS._2, KEYS._3, KEYS._4, KEYS._5, KEYS._6, KEYS._7, KEYS._8, KEYS._9, KEYS._0, KEYS.MINUS, KEYS.EQUAL_JIS, KEYS.INSERT, KEYS.BACK, KEYS.HOME, KEYS.END, KEYS.PAGEUP, KEYS.PAGEDOWN, KEYS.TAB, KEYS.Q, KEYS.W, KEYS.E, KEYS.R, KEYS.T, KEYS.Y, KEYS.U, KEYS.I, KEYS.O, KEYS.P, KEYS.SQUARE_BRACKETS_OPEN, KEYS.SQUARE_BRACKETS_CLOSE, KEYS.BACKSLASH, KEYS.NULL, KEYS.TENKEY7, KEYS.TENKEY8, KEYS.TENKEY9, KEYS.TENKEY_MINUS, KEYS.NULL, KEYS.A, KEYS.S, KEYS.D, KEYS.F, KEYS.G, KEYS.H, KEYS.J, KEYS.K, KEYS.L, KEYS.SEMICOLON, KEYS.APOSTROPHE, KEYS.ENTER_US, KEYS.ENTER_US, KEYS.ENTER_US, KEYS.TENKEY4, KEYS.TENKEY5, KEYS.TENKEY6, KEYS.TENKEY_PLUS, KEYS.SHIFT, KEYS.Z, KEYS.X, KEYS.C, KEYS.V, KEYS.B, KEYS.N, KEYS.M, KEYS.COMMA, KEYS.DOT, KEYS.SLASH, KEYS.NULL, KEYS.SHIFT, KEYS.UP, KEYS.NULL, KEYS.TENKEY1, KEYS.TENKEY2, KEYS.TENKEY3, KEYS.NULL, KEYS.CTRL, KEYS.NULL, KEYS.NULL, KEYS.NULL, KEYS.SPACE, KEYS.SPACE, KEYS.SPACE, KEYS.SPACE, KEYS.NULL, KEYS.NULL, KEYS.NULL, KEYS.NULL, KEYS.LEFT, KEYS.DOWN, KEYS.RIGHT, KEYS.TENKEY0, KEYS.TENKEY0, KEYS.TENKEY_DOT, KEYS.NULL, ]; const layout = new Key_Layout("US", list); layout.setEnterKey(KEYS.ENTER_US); return Object.freeze(layout); })(); /** * @returns {Readonly<InputDeviceBase>} */ function getCurrentDevice() { if (setting.gamepad.isConected()) { return setting.gamepad; } return KEY_LAYOUT_JIS; } //TODO:カーソル移動に異常があるので修正する class Window_KeyConfig_MA extends Window_InputConfigBase { initializeMapper() { const device = this.inputDevice(); this._mapper217 = device.createTemporaryMapper(); //new TemporaryMappper(device.currentMapper()); } temporaryMappper() { return this._mapper217; } /** * @param {Rectangle} rect */ initialize(rect) { //@ts-ignore this.setKeyLayout(ConfigManager.keyLayout_MA); super.initialize(rect); this.refresh(); this.activate(); this.select(0); } lineHeight() { return setting.keyWindowLineHeight; } mainFontFace() { if (Utils.RPGMAKER_NAME === "MV") { return this.standardFontFace(); } return $gameSystem.mainFontFace(); } resetFontSettings() { this.contents.fontFace = this.mainFontFace(); this.contents.fontSize = this.lineHeight() - 2;//$gameSystem.mainFontSize(); this.resetTextColor(); } setWASD_Move() { for (const key in WASD_KEYMAP) { if (WASD_KEYMAP.hasOwnProperty(key)) { const element = WASD_KEYMAP[key]; this._mapper217.change(Number(key), element); } } this.refresh(); } /** * @param {String} layoutText */ setKeyLayout(layoutText) { this._layout = layoutText === "JIS" ? KEY_LAYOUT_JIS : KEY_LAYOUT_US; } inputDevice() { return this._layout; } getKeyLayout() { return this._layout._name; } itemTextAlign() { return 'center'; } exitCommandIndex() { return CommandManager.exit()._index; } processChangeLayout() { this.playLayoutChangeSound(); const L = this.getKeyLayout(); if (L !== 'JIS') { this.setKeyLayout('JIS'); } else { this.setKeyLayout('US'); } this.refresh(); } processOk() { const index = this.index(); if (index < 0) { return; } const item = this.item(index); if (!item) { this.playBuzzerSound(); return; } if (item.locked) { this.playBuzzerSound(); return; } if (item.handle === "ok") { this.playSymbolSetSound() this.updateInputData(); this.deactivate(); this.callOkHandler(); return } this.callHandler(item.handle); } itemHeight() { return this.lineHeight() * 2; } maxPageRows() { return 100; } maxCols() { return 19; } numVisibleRows() { return this._layout._list.length; } /** * @param {Number} index */ baseRect(index) { return super.itemRect(index); } /** * @param {Number} index */ itemRect(index) { const item = this.item(index); if (!item) { return new Rectangle(Number.MIN_SAFE_INTEGER, Number.MIN_SAFE_INTEGER, 0, 0); } return item.rect(this, index); } maxItems() { return this._layout.buttonList().length; } spacing() { return 0; } /** * @param {number}index */ keyNumber(index) { return this.item(index).keycord; } currentButtonCode() { return this.keyNumber(this.index()); } keyName(index) { return this.item(index).char; } cursorUp(wrap) { if (wrap || this._index >= this.maxCols()) { this.cursorMoveCheck(-this.maxCols()); } } cursorDown(wrap) { if (wrap || this._index < this.maxItems() - this.maxCols()) { this.cursorMoveCheck(this.maxCols()); } } cursorLeft(wrap) { if (wrap || this._index > 0) { this.cursorMoveCheck(-1); } } cursorRight(wrap) { if (wrap || this._index < this.maxItems() - 1) { this.cursorMoveCheck(1); } } nextIndex(current, moveDir) { const maxItems = this.maxItems(); return (current + moveDir + maxItems) % maxItems; } cursorMoveCheck(moveDir) { const current = this.index(); let next = this.nextIndex(current, moveDir); const last = Math.abs(this.maxItems() / moveDir); for (var i = 0; i < last; ++i) { const itemA = this.item(current); const itemB = this.item(next); if (itemB === KEYS.NULL) { break; } if (itemA !== itemB) { break; } next = this.nextIndex(next, moveDir); } this.select(next); } symbolTextColor() { return this.textColor(4); } /** * @param {I_SymbolDefine} inputDef * @param {Rectangle} rect */ drawKeyback(inputDef, rect) { if (!inputDef) { this.drawSymbolBack(rect, SymbolColorManager.emptyColor()); return; } if (inputDef.isParamatorValid()) { this.drawSymbolBack(rect, inputDef.backColor()); } else { this.drawSymbolBack(rect, SymbolColorManager.paramatorInvalidColor()); } } /** * @param {Key_Base} key * @param {I_SymbolDefine} inputDef * @param {Rectangle} rect */ drawInputDefine(key, inputDef, rect) { this.drawKeyback(inputDef, rect); this.drawText(key.char, rect.x, rect.y, rect.width, "center"); if (inputDef && !inputDef.isEmpty()) { const symbolY = rect.y + this.lineHeight() - 6; this.drawText(inputDef.displayKeyName(), rect.x, symbolY, rect.width, "center"); } } /** * @param {Number} index * @returns */ symbolString(index) { const keyNumber = this.keyNumber(index); return this.temporaryMappper().findSymbolByCode(keyNumber); } /** * @param {Number} index */ symbolObject(index) { const keyNumber = this.keyNumber(index); return this.symbolObjectFromKeyNumber(keyNumber); } symbolObjectFromKeyNumber(keyNumber) { const symbol = this.temporaryMappper().findSymbolByCode(keyNumber) return symbolManager.findSymbol(symbol); } /** * @param {Number} index * @desc 画面に表示するシンボル文字列の取得 */ symbolText(index) { const symbol = this.symbolString(index); return symbol; } /** * @param {Number} index */ item(index) { return this._layout.buttonList()[index]; } /** * @param {Number} index */ drawItem(index) { const item = this.item(index); if (item) { item.draw(this, index); } } redrawItem(index) { const item = this.item(index); if (item) { this.clearItem(index); item.redraw(this, index); } } commandBackColor() { return getColorSrc(this).gaugeBackColor(); } commandColor() { return getColorSrc(this).normalColor(); } /** * @param {String} commandName * @param {MyRectType} rect */ drawCommandXX(commandName, rect) { this.drawSymbolBack(rect, this.commandBackColor()); this.changeTextColor(this.commandColor()); this.drawText(commandName, rect.x, rect.y, rect.width, 'center'); } } class Scene_KeyConfig_MA extends Scene_InputConfigBase_MA { helpWindowLines() { return 2; } backBitmap() { if (setting.keyBackground) { return ImageManager.loadTitle1(setting.keyBackground); } return null; } create() { super.create(); this.createHelpWindow(); this.createKeyboradConfigWindow(); this.createSymbolListWindow(); } onKeyLayoutOk() { this._keyconfigWindow.processChangeLayout(); } configKey() { return MA_KEYBOARD_CONFIG; } saveMapper() { Input.keyMapper = this._keyconfigWindow.cloneMapper(); } setWASD_Move() { this._keyconfigWindow.setWASD_Move(); this._keyconfigWindow.playApplySound(); } keyconfigWindowRect() { return this.mainWindowRect(); } calcKeyWindowHeight() { const lineHeight = 0; return 12 * 24; } createKeyboradConfigWindow() { const rect = this.keyconfigWindowRect(); const kcw = new Window_KeyConfig_MA(rect); kcw.setHandler('cancel', this.onConfigCancel.bind(this)); kcw.setHandler('ok', this.onConfigOk.bind(this)); kcw.setHandler(CommandManager.reset().handle, this.resetMapper.bind(this)); kcw.setHandler(CommandManager.apply().handle, this.applyConfig.bind(this)); kcw.setHandler(CommandManager.wasd().handle, this.setWASD_Move.bind(this)); kcw.setHandler(CommandManager.keylayout().handle, this.onKeyLayoutOk.bind(this)); kcw.setHandler(CommandManager.exit().handle, this.onConfigCancel.bind(this)); kcw.setHelpWindow(this._helpWindow); this.addWindow(kcw); this._keyconfigWindow = kcw; } mainWidnow() { return this._keyconfigWindow; } subWindow() { return this._symbolListWindow; } currentButtonCode() { return this._keyconfigWindow.currentButtonCode(); } } const Window_Options_addVolumeOptions = Window_Options.prototype.addVolumeOptions; Window_Options.prototype.addVolumeOptions = function () { Window_Options_addVolumeOptions.call(this); this.addCommand(currentGamepadConfigText(), MA_GAMEPAD_CONFIG, true); this.addCommand(currentKeyConfigText(), MA_KEYBOARD_CONFIG, true); } const Window_Options_statusText = Window_Options.prototype.statusText; /** * @param {Number} index * @returns */ Window_Options.prototype.statusText = function (index) { const symbol = this.commandSymbol(index) if (symbol === MA_GAMEPAD_CONFIG) { return ""; } if (symbol === MA_KEYBOARD_CONFIG) { return ""; } return Window_Options_statusText.call(this, index); } const Window_Options_processOk = Window_Options.prototype.processOk; Window_Options.prototype.processOk = function () { Window_Options_processOk.call(this); if (SceneManager.isSceneChanging()) { return; } if (this.currentSymbol() === MA_GAMEPAD_CONFIG) { this.playOkSound(); Mano_InputConfig.gotoGamepad(); return; } if (this.currentSymbol() === MA_KEYBOARD_CONFIG) { this.playOkSound(); Mano_InputConfig.gotoKey(); return; } }; function setupPP_option() { //これ以外の方法だと、変数が宣言されていないエラーで死ぬ if (!Imported.PP_Option) { return; } if (PP_Option && PP_Option.Manager) { PP_Option.Manager.addOptionEX(MA_GAMEPAD_CONFIG, currentGamepadConfigText, function (w, s, i) { Mano_InputConfig.gotoGamepad(); }); PP_Option.Manager.addOptionEX(MA_KEYBOARD_CONFIG, currentKeyConfigText, function (w, s, i) { Mano_InputConfig.gotoKey(); }); } } function setupDefaultMapper() { //メモ //この処理はConfigManager.load()よりも先に行う必要がある。 //MVでの挙動が怪しい予感はする symbolManager.onBoot(); //TODO:これの型を変更する 変数の保存場所も変更する Mano_InputConfig.defaultGamepadMapper = Object.freeze(objectClone(Input.gamepadMapper)); Mano_InputConfig.defaultKeyMapper = Object.freeze(objectClone(Input.keyMapper)); InputConfigManager.makeDefaultMapper(); } const DataManager_loadDatabase = DataManager.loadDatabase; DataManager.loadDatabase = function () { DataManager_loadDatabase.call(this); //メモ・MV/MZの双方で、ここの方がタイミングとして安全 setupDefaultMapper(); setupPP_option(); }; const Game_Map_setupStartingEvent = Game_Map.prototype.setupStartingEvent; Game_Map.prototype.setupStartingEvent = function () { symbolManager.callButtonEvent(); return Game_Map_setupStartingEvent.call(this); }; // const Scene_Boot_onDatabaseLoaded =Scene_Boot.prototype.onDatabaseLoaded ||(function(){}); // Scene_Boot.prototype.onDatabaseLoaded =function(){ // setupDefaultMapper(); // if(Imported.PP_Option ){ // this.PP_Option_InputConfig(); // } // Scene_Boot_onDatabaseLoaded.call(this); // }; class Window_DebugSymbols extends Window_InputSymbolListBase { } //TODO:エラー診断 パラメータの問題を検出して、解決方法を提示 class Scene_ErrorDetection extends Scene_MenuBaseMVMZ { } /** * @param {String} symbol * @returns */ const GetButtonNameMV = function (symbol) { const device = getCurrentDevice(); const button = device.getButtonBySymbol(symbol); if (button) { return button.name(); } return ""; }; /** * @param {{symbol:String, nameVariable:Number}} arg */ const GetButtonName = function (arg) { const device = getCurrentDevice(); const button = device.getButtonBySymbol(arg.symbol); if (button) { $gameVariables.setValue(arg.nameVariable, button.name()); } }; if (Utils.RPGMAKER_NAME == "MV") { (function () { // const Scene_Boot_start =Scene_Boot.prototype.start; // Scene_Boot.prototype.start =function(){ // Scene_Boot_start.call(this); // setupDefaultMapper(); // }; Window_Selectable_InputConfigVer.prototype.drawItemBackground = function () { }; Window_Selectable_InputConfigVer.prototype.maxVisibleItems = function () { const visibleRows = Math.ceil(this.contentsHeight() / this.itemHeight()); return visibleRows * this.maxCols(); }; Window_Selectable_InputConfigVer.prototype.itemRectWithPadding = Window_Selectable_InputConfigVer.prototype.itemRectForText; })(); } else { PluginManager.registerCommand(PLUGIN_NAME, "IsGamepadValid", function (arg) { const sid = (arg.switchId); const set = new Set(Object.values(Input.gamepadMapper)) const value = symbolManager.isValidMapper_v3(set); $gameSwitches.setValue(sid, value); }); PluginManager.registerCommand(PLUGIN_NAME, "IsKeyboardValid", function (arg) { const sid = (arg.switchId); const set = new Set(Object.values(Input.keyMapper)) const value = symbolManager.isValidMapper_v3(set); $gameSwitches.setValue(sid, value); }); PluginManager.registerCommand(PLUGIN_NAME, "GetButtonName", GetButtonName); PluginManager.registerCommand(PLUGIN_NAME, "GetButtonNameEX", GetButtonName); PluginManager.registerCommand(PLUGIN_NAME, "GamepadScene", function () { Mano_InputConfig.gotoGamepad(); }) PluginManager.registerCommand(PLUGIN_NAME, "KeyboardScene", function () { Mano_InputConfig.gotoKey(); }) } const exportClass = { //MV用・ヘルプへの記載予定なし GetButtonNameMV: GetButtonNameMV, Scene_ConfigBase: Scene_InputConfigBase_MA, Scene_KeyConfig: Scene_KeyConfig_MA, Scene_GamepadConfig: Scene_GamepadConfig_V8, //Scene_GamepadConfig_ALT:Scene_GamepadConfig_ALT, // Window_InputSymbolList:Window_InputSymbolList, // Window_GamepadConfig:Window_GamepadConfig_MA, Window_KeyConfig: Window_KeyConfig_MA, defaultKeyMapper: {}, defaultGamepadMapper: {}, gotoKey: function () { SceneManager.push(Mano_InputConfig.Scene_KeyConfig); }, gotoGamepad: function () { SceneManager.push(Scene_GamepadConfig_V8); //SceneManager.push(Mano_InputConfig.Scene_GamepadConfig ); }, }; return exportClass; })(); { //Sorry for the dirty implementation. //Since there were many questions from users who use YEP_OptionCore together on how to set plug-in parameters, we are responding by the following method. const param = PluginManager.parameters("Mano_InputConfig"); if (param && param.SettingsForYEP_OptionsCore) { const obj = JSON.parse(param.SettingsForYEP_OptionsCore); //インポート情報を偽装し、GamepadConfig/KeybordConfigと認識させる if (obj.gamepad === "true") { Imported.GamepadConfig = true; //@ts-ignore window["Scene_GamepadConfig"] = Mano_InputConfig.Scene_GamepadConfig; //何かよくわからない関数が追加されているので、適当に追加する //@ts-ignore Input.isControllerConnected = Input.isControllerConnected || function () { return true; }; } if (obj.Keyboard === "true") { Imported.YEP_KeyboardConfig = true; //@ts-ignore window["Scene_KeyConfig"] = Mano_InputConfig.Scene_KeyConfig; } } }
dazed/translations
www/js/plugins/Mano_InputConfig.js
JavaScript
unknown
178,680
//============================================================================= // MenuCommonEvent.js // ---------------------------------------------------------------------------- // (C)2017 Triacontane // This software is released under the MIT License. // http://opensource.org/licenses/mit-license.php // ---------------------------------------------------------------------------- // Version // 1.4.0 2021/02/06 ピクチャなどの画像をウィンドウの背後に表示できる設定を追加 // 1.3.7 2020/08/28 1.3.6の修正方法が間違っていた問題を修正 // 1.3.6 2020/08/27 DWindow.jsと組み合わせたときにコモンイベントが存在するメニューで動的ウィンドウが作成されてしまう競合を修正 // 1.3.5 2020/05/09 MOG_Weather_EX.jsと併用したときに発生するエラーを解消 // 1.3.4 2020/03/21 SceneCustomMenu.jsに合わせた微修正 // 1.3.3 2020/03/17 Canvasモード時、マップの色調変更がウィンドウに反映されていた問題を修正 // 1.3.2 2019/01/23 1.3.1の修正でGUI画面デザインプラグインと共存できなくなっていた問題を修正 // 1.3.1 2019/01/18 他のプラグインと連携しやすいように一部の実装を変更 // 1.3.0 2018/09/23 対象イベントの並列実行を停止するコマンドを追加 // 1.2.0 2017/12/24 公式ガチャプラグインと連携できるよう修正 // 1.1.3 2017/12/02 NobleMushroom.jsとの競合を解消 // 1.1.2 2017/11/18 コモンイベントを一切指定しない状態でメニューを開くとエラーになる現象を修正 // 1.1.1 2017/11/05 ヘルプとダウンロード先を追記 // 1.1.0 2017/11/05 タイマー有効化機能などいくつかの機能を追加 // 1.0.0 2017/11/04 初版 // ---------------------------------------------------------------------------- // [Blog] : https://triacontane.blogspot.jp/ // [Twitter]: https://twitter.com/triacontane/ // [GitHub] : https://github.com/triacontane/ //============================================================================= /*: * @plugindesc MenuCommonEventPlugin * @author triacontane * * @param CommonEventInfo * @desc 各画面で実行するコモンイベントの情報です。 * @default * @type struct<CommonEventInfo>[] * * @param MaxMenuPicture * @desc メニュー画面で表示するピクチャの最大数です。 * @default 10 * @type number * @min 1 * @max 100 * * @param SaveInterpreterIndex * @desc イベントの実行位置を記憶して別画面から戻ってきたときに記憶した位置から再開します。 * @default false * @type boolean * * @param ActivateTimer * @desc メニュー画面中でもタイマーを表示し、かつタイマーを進めます。 * @default false * @type boolean * * @param PictureUnderWindow * @desc ピクチャなどの画像要素をウィンドウの背後に表示します。 * @default false * @type boolean * * @param CommandPrefix * @desc プラグインコマンドおよびメモ欄の接頭辞です。コマンドやメモ欄が他プラグインと被る場合に指定してください。 * @default * * @help MenuCommonEvent.js * * メニュー画面やプラグインで追加した画面(※1)でコモンイベントを並列実行できます。 * メッセージやピクチャ、変数の操作などが各イベントコマンド(※2)が実行可能です。 * コモンイベントは各画面につきひとつ実行できます。 * * ※1 メニュー系の画面であれば利用できます。 * サウンドテストプラグインや用語辞典プラグインとの連携は確認済みです。 * * ※2 移動ルートの設定などキャラクターを対象にする一部コマンドは動作しません。 * また、プラグインによって追加されたスクリプトやコマンドは正しく動作しない * 可能性があります。 * * プラグインコマンド詳細 * イベントコマンド「プラグインコマンド」から実行。 * (パラメータの間は半角スペースで区切る) * * ウィンドウ操作禁止 # メニュー画面のウィンドウ操作を禁止します。 * DISABLE_WINDOW_CONTROL # 同上 * ウィンドウ操作許可 # 禁止したメニュー画面のウィンドウ操作を許可します。 * ENABLE_WINDOW_CONTROL # 同上 * * プラグインコメント名が他のプラグインと被っている場合はパラメータの * 「コマンド接頭辞」に値を設定してください。 * * スクリプト詳細 * イベントコマンド「スクリプト」「変数の操作」から実行。 * * // ウィンドウオブジェクトを取得 * this.getSceneWindow(windowName); * 指定した名前のウィンドウオブジェクトを返します。 * プロパティの取得や設定が可能です。上級者向け機能です。 * 主要画面のウィンドウ名は以下の通りです。 * * ・メインメニュー * commandWindow コマンドウィンドウ * statusWindow ステータスウィンドウ * goldWindow お金ウィンドウ * * ・アイテム画面 * categoryWindow アイテムカテゴリウィンドウ * itemWindow アイテムウィンドウ * actorWindow アクター選択ウィンドウ * * ・スキル画面 * skillTypeWindow スキルタイプウィンドウ * statusWindow ステータスウィンドウ * itemWindow スキルウィンドウ * actorWindow アクター選択ウィンドウ * * ・装備画面 * helpWindow ヘルプウィンドウ * commandWindow コマンドウィンドウ * slotWindow スロットウィンドウ * statusWindow ステータスウィンドウ * itemWindow 装備品ウィンドウ * * ・ステータス画面 * statusWindow ステータスウィンドウ * * // ウィンドウアクティブ判定 * this.isWindowActive(windowName); * 指定した名前のウィンドウがアクティブなときにtrueを返します。 * ウィンドウの指定例は上と同じです。 * * // ウィンドウインデックス取得 * this.getSceneWindowIndex(); * 現在アクティブなウィンドウのインデックスを取得します。先頭は0です。 * * // 選択中のアクターオブジェクト取得 * $gameParty.menuActor(); * 装備画面やステータス画面で選択中のアクターの情報を取得します。 * 上級者向けスクリプトです。(※1) * * // 選択中のアクターID取得 * $gameParty.menuActor().actorId(); * 装備画面やステータス画面で選択中のアクターIDを取得します。 * * ※1 既存のコアスクリプトですが、有用に使えるため記載しています。 * * // 用語辞典の表示内容更新 * this.refreshGlossary(); * 用語辞典プラグインにおいて用語の表示内容を最新にします。 * 同プラグインと連携した場合に使用します。 * * 〇他のプラグインとの連携 * ピクチャのボタン化プラグイン(PictureCallCommon.js)と併用する場合 * コマンドは「P_CALL_CE」ではなく「P_CALL_SWITCH」を使ってください。 * * プラグインURL * https://raw.githubusercontent.com/triacontane/RPGMakerMV/master/MenuCommonEvent.js * * ヘルプURL * https://github.com/triacontane/RPGMakerMV/blob/master/ReadMe/MenuCommonEvent.md * * 利用規約: * 作者に無断で改変、再配布が可能で、利用形態(商用、18禁利用等) * についても制限はありません。 * このプラグインはもうあなたのものです。 */ /*~struct~CommonEventInfo: * * @param SceneName * @desc コモンイベント実行対象の画面です。独自に追加した画面を対象にする場合はクラス名を直接入力してください。 * @type select * @default * @option メインメニュー * @value Scene_Menu * @option アイテム * @value Scene_Item * @option スキル * @value Scene_Skill * @option 装備 * @value Scene_Equip * @option ステータス * @value Scene_Status * @option オプション * @value Scene_Options * @option セーブ * @value Scene_Save * @option ロード * @value Scene_Load * @option ゲーム終了 * @value Scene_End * @option ショップ * @value Scene_Shop * @option 名前入力 * @value Scene_Name * @option デバッグ * @value Scene_Debug * @option サウンドテスト * @value Scene_SoundTest * @option 用語辞典 * @value Scene_Glossary * * @param CommonEventId * @desc 画面で並列実行するコモンイベントのIDです。トリガーを並列実行にする必要はなく、スイッチも参照されません。 * @default 1 * @type common_event * */ /*:ja * @plugindesc メニュー内コモンイベントプラグイン * @author トリアコンタン * * @param コモンイベント情報 * @desc 各画面で実行するコモンイベントの情報です。 * @default * @type struct<CommonEventInfo>[] * * @param ピクチャ表示最大数 * @desc メニュー画面で表示するピクチャの最大数です。 * @default 10 * @type number * @min 1 * @max 100 * * @param 実行位置を記憶 * @desc イベントの実行位置を記憶して別画面から戻ってきたときに記憶した位置から再開します。 * @default false * @type boolean * * @param タイマー有効化 * @desc メニュー画面中でもタイマーを表示し、かつタイマーを進めます。 * @default false * @type boolean * * @param 画像をウィンドウ背後に配置 * @desc ピクチャなどの画像要素をウィンドウの背後に表示します。 * @default false * @type boolean * * @param コマンド接頭辞 * @desc プラグインコマンドおよびメモ欄の接頭辞です。コマンドやメモ欄が他プラグインと被る場合に指定してください。 * @default * * @help MenuCommonEvent.js * * メニュー画面やプラグインで追加した画面(※1)でコモンイベントを並列実行できます。 * メッセージやピクチャ、変数の操作などが各イベントコマンド(※2)が実行可能です。 * コモンイベントは各画面につきひとつ実行できます。 * * ※1 メニュー系の画面であれば利用できます。 * サウンドテストプラグインや用語辞典プラグインとの連携は確認済みです。 * * ※2 移動ルートの設定などキャラクターを対象にする一部コマンドは動作しません。 * また、プラグインによって追加されたスクリプトやコマンドは正しく動作しない * 可能性があります。 * * プラグインコマンド詳細 * イベントコマンド「プラグインコマンド」から実行。 * (パラメータの間は半角スペースで区切る) * * ウィンドウ操作禁止 # メニュー画面のウィンドウ操作を禁止します。 * DISABLE_WINDOW_CONTROL # 同上 * ウィンドウ操作許可 # 禁止したメニュー画面のウィンドウ操作を許可します。 * ENABLE_WINDOW_CONTROL # 同上 * イベントの実行停止 # イベントの並列実行を停止します。画面遷移して戻ると再実行されます。 * STOP_EVENT # 同上 * * プラグインコメント名が他のプラグインと被っている場合はパラメータの * 「コマンド接頭辞」に値を設定してください。 * * スクリプト詳細 * イベントコマンド「スクリプト」「変数の操作」から実行。 * * // ウィンドウオブジェクトを取得 * this.getSceneWindow(windowName); * 指定した名前のウィンドウオブジェクトを返します。 * プロパティの取得や設定が可能です。上級者向け機能です。 * 主要画面のウィンドウ名は以下の通りです。 * * ・メインメニュー * commandWindow コマンドウィンドウ * statusWindow ステータスウィンドウ * goldWindow お金ウィンドウ * * ・アイテム画面 * categoryWindow アイテムカテゴリウィンドウ * itemWindow アイテムウィンドウ * actorWindow アクター選択ウィンドウ * * ・スキル画面 * skillTypeWindow スキルタイプウィンドウ * statusWindow ステータスウィンドウ * itemWindow スキルウィンドウ * actorWindow アクター選択ウィンドウ * * ・装備画面 * helpWindow ヘルプウィンドウ * commandWindow コマンドウィンドウ * slotWindow スロットウィンドウ * statusWindow ステータスウィンドウ * itemWindow 装備品ウィンドウ * * ・ステータス画面 * statusWindow ステータスウィンドウ * * // ウィンドウアクティブ判定 * this.isWindowActive(windowName); * 指定した名前のウィンドウがアクティブなときにtrueを返します。 * ウィンドウの指定例は上と同じです。 * * // ウィンドウインデックス取得 * this.getSceneWindowIndex(); * 現在アクティブなウィンドウのインデックスを取得します。先頭は0です。 * * // 選択中のアクターオブジェクト取得 * $gameParty.menuActor(); * 装備画面やステータス画面で選択中のアクターの情報を取得します。 * 上級者向けスクリプトです。(※1) * * // 選択中のアクターID取得 * $gameParty.menuActor().actorId(); * 装備画面やステータス画面で選択中のアクターIDを取得します。 * * ※1 既存のコアスクリプトですが、有用に使えるため記載しています。 * * // 用語辞典の表示内容更新 * this.refreshGlossary(); * 用語辞典プラグインにおいて用語の表示内容を最新にします。 * 同プラグインと連携した場合に使用します。 * * 〇他のプラグインとの連携 * ピクチャのボタン化プラグイン(PictureCallCommon.js)と併用する場合 * コマンドは「P_CALL_CE」ではなく「P_CALL_SWITCH」を使ってください。 * * プラグインURL * https://raw.githubusercontent.com/triacontane/RPGMakerMV/master/MenuCommonEvent.js * * ヘルプURL * https://github.com/triacontane/RPGMakerMV/blob/master/ReadMe/MenuCommonEvent.md * * 利用規約: * 作者に無断で改変、再配布が可能で、利用形態(商用、18禁利用等) * についても制限はありません。 * このプラグインはもうあなたのものです。 */ /*~struct~CommonEventInfo:ja * * @param SceneName * @desc コモンイベント実行対象の画面です。独自に追加した画面を対象にする場合はクラス名を直接入力してください。 * @type select * @default * @option メインメニュー * @value Scene_Menu * @option アイテム * @value Scene_Item * @option スキル * @value Scene_Skill * @option 装備 * @value Scene_Equip * @option ステータス * @value Scene_Status * @option オプション * @value Scene_Options * @option セーブ * @value Scene_Save * @option ロード * @value Scene_Load * @option ゲーム終了 * @value Scene_End * @option ショップ * @value Scene_Shop * @option 名前入力 * @value Scene_Name * @option デバッグ * @value Scene_Debug * @option サウンドテスト * @value Scene_SoundTest * @option 用語辞典 * @value Scene_Glossary * @option 公式ガチャ * @value Scene_Gacha * * @param CommonEventId * @desc 画面で並列実行するコモンイベントのIDです。トリガーを並列実行にする必要はなく、スイッチも参照されません。 * @default 1 * @type common_event * */ (function () { 'use strict'; var pluginName = 'MenuCommonEvent'; //============================================================================= // ローカル関数 // プラグインパラメータやプラグインコマンドパラメータの整形やチェックをします //============================================================================= var getParamString = function (paramNames) { if (!Array.isArray(paramNames)) paramNames = [paramNames]; for (var i = 0; i < paramNames.length; i++) { var name = PluginManager.parameters(pluginName)[paramNames[i]]; if (name !== undefined) return name; } return ''; }; var getParamNumber = function (paramNames, min, max) { var value = getParamString(paramNames); if (arguments.length < 2) min = -Infinity; if (arguments.length < 3) max = Infinity; return (parseInt(value) || 0).clamp(min, max); }; var getParamBoolean = function (paramNames) { var value = getParamString(paramNames); return value.toUpperCase() === 'TRUE'; }; var getParamArrayJson = function (paramNames, defaultValue) { var value = getParamString(paramNames) || null; try { value = JSON.parse(value); if (value === null) { value = defaultValue; } else { value = value.map(function (valueData) { return JSON.parse(valueData); }); } } catch (e) { alert('!!!Plugin param is wrong.!!!\nPlugin:.js\nName:[]\nValue:'); value = defaultValue; } return value; }; var convertEscapeCharacters = function (text) { if (isNotAString(text)) text = ''; var windowLayer = SceneManager._scene._windowLayer; return windowLayer ? windowLayer.children[0].convertEscapeCharacters(text) : text; }; var isNotAString = function (args) { return String(args) !== args; }; var convertAllArguments = function (args) { return args.map(function (arg) { return convertEscapeCharacters(arg); }); }; var setPluginCommand = function (commandName, methodName) { pluginCommandMap.set(param.commandPrefix + commandName, methodName); }; var getClassName = function (object) { var define = object.constructor.toString(); if (define.match(/^class/)) { return define.replace(/class\s+(.*?)\s+[\s\S]*/m, '$1'); } return define.replace(/function\s+(.*)\s*\([\s\S]*/m, '$1'); }; //============================================================================= // パラメータの取得と整形 //============================================================================= var param = {}; param.commonEventInfo = getParamArrayJson(['CommonEventInfo', 'コモンイベント情報'], []); param.commandPrefix = getParamString(['CommandPrefix', 'コマンド接頭辞']); param.maxMenuPicture = getParamNumber(['MaxMenuPicture', 'ピクチャ表示最大数'], 1); param.saveInterpreterIndex = getParamBoolean(['SaveInterpreterIndex', '実行位置を記憶']); param.activateTimer = getParamBoolean(['ActivateTimer', 'タイマー有効化']); param.pictureUnderWindow = getParamBoolean(['PictureUnderWindow', '画像をウィンドウ背後に配置']); var pluginCommandMap = new Map(); setPluginCommand('ウィンドウ操作禁止', 'execDisableWindowControl'); setPluginCommand('DISABLE_WINDOW_CONTROL', 'execDisableWindowControl'); setPluginCommand('ウィンドウ操作許可', 'execEnableWindowControl'); setPluginCommand('ENABLE_WINDOW_CONTROL', 'execEnableWindowControl'); setPluginCommand('イベントの実行停止', 'execStopEvent'); setPluginCommand('STOP_EVENT', 'execStopEvent'); //============================================================================= // Game_Interpreter // プラグインコマンドを追加定義します。 //============================================================================= var _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand; Game_Interpreter.prototype.pluginCommand = function (command, args) { _Game_Interpreter_pluginCommand.apply(this, arguments); var pluginCommandMethod = pluginCommandMap.get(command.toUpperCase()); if (pluginCommandMethod) { this[pluginCommandMethod](convertAllArguments(args)); } }; Game_Interpreter.prototype.execDisableWindowControl = function () { $gameTemp.setDisableWindowControl(true); }; Game_Interpreter.prototype.execEnableWindowControl = function () { $gameTemp.setDisableWindowControl(false); }; Game_Interpreter.prototype.isWindowActive = function (windowName) { var sceneWindow = this.getSceneWindow(windowName); return sceneWindow ? sceneWindow.active : false; }; Game_Interpreter.prototype.getSceneWindow = function (windowName) { return SceneManager.getSceneWindow('_' + windowName); }; Game_Interpreter.prototype.getSceneWindowIndex = function () { var index = -1; SceneManager.getSceneWindowList().some(function (sceneWindow) { if (sceneWindow instanceof Window_Selectable && sceneWindow.active) { index = sceneWindow.index(); return true; } else { return false; } }); return index; }; Game_Interpreter.prototype.refreshGlossary = function () { var glossaryWindow = this.getSceneWindow('glossaryWindow'); if (glossaryWindow.visible) { var glossaryListWindow = this.getSceneWindow('glossaryListWindow'); glossaryWindow.refresh(glossaryListWindow.item()); } }; Game_Interpreter.prototype.execStopEvent = function () { this._menuCommonStop = true; }; Game_Interpreter.prototype.isMenuCommonStop = function () { return this._menuCommonStop; }; //============================================================================= // Game_Temp // メニューコモンイベントを作成、更新します。 //============================================================================= var _Game_Temp_initialize = Game_Temp.prototype.initialize; Game_Temp.prototype.initialize = function () { _Game_Temp_initialize.apply(this, arguments); this._menuCommonEvent = {}; this.clearSceneInformation(); }; Game_Temp.prototype.setupMenuCommonEvent = function (commonEventId, sceneName, sceneIndex) { this._sceneName = sceneName; this._sceneIndex = sceneIndex; if (param.saveInterpreterIndex && this.isExistSameCommonEvent(commonEventId)) { return this._menuCommonEvent[sceneName]; } return this._menuCommonEvent[sceneName] = this.createMenuCommonEvent(commonEventId); }; Game_Temp.prototype.createMenuCommonEvent = function (commonEventId) { if (commonEventId > 0) { var commonEvent = new Game_MenuCommonEvent(commonEventId); if (commonEvent.event()) { return commonEvent; } } return null; }; Game_Temp.prototype.isExistSameCommonEvent = function (commonEventId) { var commonEvent = this._menuCommonEvent[this._sceneName]; return commonEvent && commonEvent.isSameEvent(commonEventId); }; Game_Temp.prototype.setDisableWindowControl = function (value) { this._disableWindowControl = value; }; Game_Temp.prototype.isDisableWindowControl = function () { return !!this._disableWindowControl; }; Game_Temp.prototype.getSceneIndex = function () { return this._sceneIndex; }; Game_Temp.prototype.isInMenu = function () { return this.getSceneIndex() >= 0; }; Game_Temp.prototype.clearSceneInformation = function () { this._sceneIndex = -1; this._sceneName = ''; }; //============================================================================= // Game_Screen // シーンごとにピクチャを管理できるようにします。 //============================================================================= if (param.maxMenuPicture > 0) { var _Game_Screen_realPictureId = Game_Screen.prototype.realPictureId; Game_Screen.prototype.realPictureId = function (pictureId) { var sceneIndex = $gameTemp.getSceneIndex(); if (sceneIndex >= 0) { return pictureId + this.maxMapPictures() * 2 + sceneIndex * this.maxPictures(); } else { return _Game_Screen_realPictureId.apply(this, arguments); } }; var _Game_Screen_maxPictures = Game_Screen.prototype.maxPictures; Game_Screen.prototype.maxPictures = function () { return $gameTemp.isInMenu() ? param.maxMenuPicture : _Game_Screen_maxPictures.apply(this, arguments); }; Game_Screen.prototype.maxMapPictures = function () { return _Game_Screen_maxPictures.apply(this, arguments); }; } //============================================================================= // Game_MenuCommonEvent // メニューコモンイベントを扱うクラスです。 //============================================================================= function Game_MenuCommonEvent() { this.initialize.apply(this, arguments); } Game_MenuCommonEvent.prototype = Object.create(Game_CommonEvent.prototype); Game_MenuCommonEvent.prototype.constructor = Game_MenuCommonEvent; Game_MenuCommonEvent.prototype.isActive = function () { return true; }; Game_MenuCommonEvent.prototype.isSameEvent = function (commonEventId) { return this._commonEventId === commonEventId; }; var _Game_MenuCommonEvent_update = Game_MenuCommonEvent.prototype.update; Game_MenuCommonEvent.prototype.update = function () { if (this._interpreter) { if (!this._interpreter.isRunning()) { this._interpreter.execEnableWindowControl(); } if (this._interpreter.isMenuCommonStop()) { return; } } _Game_MenuCommonEvent_update.apply(this, arguments); }; //============================================================================= // Scene_MenuBase // メニューコモンイベントを実行します。 //============================================================================= var _Scene_MenuBase_create = Scene_MenuBase.prototype.create; Scene_MenuBase.prototype.create = function () { _Scene_MenuBase_create.apply(this, arguments); this.createCommonEvent(); }; Scene_MenuBase.prototype.createCommonEvent = function () { this.setupCommonEvent(); if (!this.hasCommonEvent()) { return; } this.createSpriteset(); if (param.pictureUnderWindow) { this.addChildAt(this._spriteset, this.children.indexOf(this._windowLayer)); } if (!this._messageWindow) { this.createMessageWindow(); } if (!this._scrollTextWindow) { this.createScrollTextWindow(); } this.changeParentMessageWindow(); }; var _Scene_MenuBase_start = Scene_MenuBase.prototype.start; Scene_MenuBase.prototype.start = function () { _Scene_MenuBase_start.apply(this, arguments); if (this.hasCommonEvent()) { this.addChild(this._messageWindow); this.addChild(this._scrollTextWindow); this._messageWindow.subWindows().forEach(function (win) { this.addChild(win); }, this); } }; Scene_MenuBase.prototype.hasCommonEvent = function () { return !!this._commonEvent; }; Scene_MenuBase.prototype.createMessageWindow = function () { Scene_Map.prototype.createMessageWindow.call(this); }; Scene_MenuBase.prototype.createScrollTextWindow = function () { Scene_Map.prototype.createScrollTextWindow.call(this); }; Scene_MenuBase.prototype.changeParentMessageWindow = function () { this.addChild(this._windowLayer.removeChild(this._messageWindow)); this.addChild(this._windowLayer.removeChild(this._scrollTextWindow)); this._messageWindow.subWindows().forEach(function (win) { this.addChild(this._windowLayer.removeChild(win)); }, this); }; // Resolve conflict for NobleMushroom.js Scene_MenuBase.prototype.changeImplementationWindowMessage = Scene_Map.prototype.changeImplementationWindowMessage; Scene_MenuBase.prototype.restoreImplementationWindowMessage = Scene_Map.prototype.restoreImplementationWindowMessage; Scene_MenuBase.prototype.onPause = Scene_Map.prototype.onPause; Scene_MenuBase.prototype.offPause = Scene_Map.prototype.offPause; Scene_MenuBase._stopWindow = false; Scene_MenuBase.prototype.createSpriteset = function () { this._spriteset = new Spriteset_Menu(); this.addChild(this._spriteset); }; Scene_MenuBase.prototype.setupCommonEvent = function () { var commonEventItem = this.getCommonEventData(); var commonEventId = commonEventItem ? parseInt(commonEventItem['CommonEventId']) : 0; var sceneIndex = param.commonEventInfo.indexOf(commonEventItem); this._commonEvent = $gameTemp.setupMenuCommonEvent(commonEventId, this._sceneName, sceneIndex); }; Scene_MenuBase.prototype.getCommonEventData = function () { this._sceneName = getClassName(this); return param.commonEventInfo.filter(function (data) { return data['SceneName'] === this._sceneName; }, this)[0]; }; var _Scene_MenuBase_updateChildren = Scene_MenuBase.prototype.updateChildren; Scene_MenuBase.prototype.updateChildren = function () { Scene_MenuBase._stopWindow = this.hasCommonEvent() && this.isNeedStopWindow(); _Scene_MenuBase_updateChildren.apply(this, arguments); }; Scene_MenuBase.prototype.isNeedStopWindow = function () { return $gameTemp.isDisableWindowControl() || $gameMessage.isBusy(); }; Scene_MenuBase.prototype.updateCommonEvent = function () { if (!this.hasCommonEvent()) { return; } this._commonEvent.update(); $gameScreen.update(); if (param.activateTimer) { $gameTimer.update(true); } this.checkGameover(); this.updateTouchPicturesIfNeed(); }; /** * updateTouchPicturesIfNeed * for PictureCallCommon.js */ Scene_MenuBase.prototype.updateTouchPicturesIfNeed = function () { if (this.updateTouchPictures && param.maxMenuPicture > 0) { this.updateTouchPictures(); } }; //============================================================================= // Scene_Base // メニューコモンイベントを更新します。 //============================================================================= var _Scene_Base_update = Scene_Base.prototype.update; Scene_Base.prototype.update = function () { this.updateCommonEvent(); _Scene_Base_update.apply(this, arguments); }; Scene_Base.prototype.updateCommonEvent = function () { // do nothing }; var _Scene_Base_terminate = Scene_Base.prototype.terminate; Scene_Base.prototype.terminate = function () { _Scene_Base_terminate.apply(this, arguments); if ($gameTemp) { $gameTemp.clearSceneInformation(); } }; //============================================================================= // Spriteset_Menu // メニュー画面用のスプライトセットです。 //============================================================================= function Spriteset_Menu() { this.initialize.apply(this, arguments); } Spriteset_Menu.prototype = Object.create(Spriteset_Base.prototype); Spriteset_Menu.prototype.constructor = Spriteset_Menu; var _Spriteset_Menu_createBaseSprite = Spriteset_Menu.prototype.createBaseSprite; Spriteset_Menu.prototype.createBaseSprite = function () { _Spriteset_Menu_createBaseSprite.apply(this, arguments); this._blackScreen.opacity = 0; }; var _Spriteset_Menu_createTimer = Spriteset_Menu.prototype.createTimer; Spriteset_Menu.prototype.createTimer = function () { if (param.activateTimer) { _Spriteset_Menu_createTimer.apply(this, arguments); } }; Spriteset_Menu.prototype.createDynamicWindow = function () { }; Spriteset_Menu.prototype.createToneChanger = function () { }; Spriteset_Menu.prototype.updateToneChanger = function () { }; Spriteset_Menu.prototype.reloadWeatherEX = function () { }; //============================================================================= // SceneManager // ウィンドウオブジェクトを取得します。 //============================================================================= SceneManager.getSceneWindow = function (windowName) { var sceneWindow = this._scene[windowName]; return sceneWindow instanceof Window ? sceneWindow : null; }; SceneManager.getSceneWindowList = function () { var windowList = []; for (var sceneWindow in this._scene) { if (this._scene.hasOwnProperty(sceneWindow) && this._scene[sceneWindow] instanceof Window) { windowList.push(this._scene[sceneWindow]); } } return windowList; }; //============================================================================= // Window_Selectable // 必要な場合にウィンドウの状態更新を停止します。 //============================================================================= var _Window_Selectable_update = Window_Selectable.prototype.update; Window_Selectable.prototype.update = function () { if (Scene_MenuBase._stopWindow && this.isStopWindow()) { return; } _Window_Selectable_update.apply(this, arguments); }; Window_Selectable.prototype.isStopWindow = function () { return !this._messageWindow; }; })();
dazed/translations
www/js/plugins/MenuCommonEvent.js
JavaScript
unknown
34,751
//============================================================================= // MenuSubCommand.js // ---------------------------------------------------------------------------- // (C) 2017 Triacontane // This software is released under the MIT License. // http://opensource.org/licenses/mit-license.php // ---------------------------------------------------------------------------- // Version // 2.7.4 2020/08/22 2.7.3の修正で復元が、動的イベント生成されたプラグインに対しても行われるよう修正 // 2.7.3 2020/08/18 イベントの一時消去後にサブコマンドマップに移動して戻ってきたときに消去状態が復元されるよう修正 // 2.7.2 2020/04/03 2.5.0で適用したMOG_SceneMenu.jsとの競合解消と、2.0.1で適用したMOG_MenuCursor.jsとの競合解消を両立できるよう修正 // 2.7.1 2020/03/13 Window_MenuCommandの初期化で引数を渡し忘れていたのを修正 // 2.7.0 2019/10/25 メニューマップと通常マップのピクチャの表示状態を別々に管理できる機能を追加 // 2.6.1 2019/10/12 2.6.0の修正で、メニューを開いたあと一度もサブコマンドを開かずにメニューを閉じるとエラーになる問題を修正 // その他軽微な不具合の修正 // 2.6.0 2019/09/16 サブコマンドのスクリプト実行後、マップに戻る機能を追加 // MOG_MenuBackground.jsとの競合を解消 // サブコマンドをキャンセル後、スキルや装備コマンドを選択して戻ると、再度サブコマンドにフォーカスする問題を修正 // サブコマンドの座標固定値設定で、XかYいずれかひとつの値を設定していると設定が有効になるよう仕様変更 // 2.5.2 2019/09/08 2.0.1で対策して、2.5.0で何らかの理由で元に戻した競合対策を再度有効化 // 2.5.1 2019/07/11 FixCursorSeByMouse.jsとの競合対策のためメソッド名を変更 // 2.5.0 2018/11/25 サブメニューの絶対座標と揃えを設定できる機能を追加 // MOG_SceneMenu.jsとの競合を解消 // 2.4.1 2018/11/24 用語辞典プラグインと連携する方法をヘルプに記載 // 2.4.0 2018/09/26 サブコマンドを逐次消去するオプションを追加 // 2.3.0 2018/09/26 サブコマンドを横並べにするオプションを追加 // 2.2.1 2018/01/28 サブコマンドを選択後メニューに戻って通常コマンドを選択し、さらにメニューに戻ったときに最初のサブコマンドが展開される問題を修正 // 2.2.0 2018/01/07 同名の親コマンドを指定できる機能を追加 // 2.1.0 2017/12/24 対象メンバーを選択するサブコマンド選択時にメニューコマンドをその名前に置き換える処理を追加 // メニューへ戻った際に対象メンバー選択やサブコマンド選択に戻るように変更 // 2.0.1 2017/11/19 MOG_MenuCursor.jsとの併用時、カーソルがサブコマンドの下に隠れてしまう競合の解消 // 2.0.0 2017/09/04 メニューコマンドやサブコマンドを好きなだけ追加できるようパラメータの仕様を変更 // 1.1.0 2017/05/14 デフォルトのオプションとゲーム終了コマンドを削除できる機能を追加 // カンマ(,)を含むスクリプトを正しく実行できない問題を修正 // 1.0.3 2017/04/09 サブコマンドマップから戻ってきたときにイベント位置を復元できるよう修正 // 1.0.2 2017/04/08 サブコマンドマップから戻ってきたときにフォロワー位置を復元できるよう修正 // 1.0.1 2017/04/08 サブコマンドマップから戻ってきたタイミングでセーブしたときにロード時の位置がサブコマンドマップに // なってしまう問題を修正 // 戦闘リトライプラグインと併用したときにリトライ中は、マップ移動するメニューを使用禁止に設定 // 1.0.0 2017/04/01 初版 // ---------------------------------------------------------------------------- // [Blog] : https://triacontane.blogspot.jp/ // [Twitter]: https://twitter.com/triacontane/ // [GitHub] : https://github.com/triacontane/ //============================================================================= /*: * @plugindesc MenuSubCommandPlugin * @author triacontane * * @param SubCommand * @desc サブコマンド情報です。 * @default * @type struct<SubCommand>[] * * @param CommandPosition * @desc サブコマンド群を追加する位置です。 * 0:並び替えの下 1:オプションの下 2:セーブの下 3:ゲーム終了の下 * @default 0 * * @param SubMenuWidth * @desc サブメニューを表示するウィンドウの横幅です。指定しない場合デフォルト値「240」が適用されます。 * @default 0 * * @param SelectActorIdVariable * @desc サブメニュー用マップに移動する際に選択していたアクターのIDを格納する変数番号です。 * @default 0 * * @param WindowSkin * @desc サブコマンド用のウィンドウに専用のスキンを設定します。 * @default * @require 1 * @dir img/system/ * @type file * * @param HideOption * @desc メインメニューからオプションを消去します。 * @default OFF * * @param HideGameEnd * @desc メインメニューからゲーム終了を消去します。 * @default OFF * * @param HorizontalSubMenu * @desc サブメニューを横並べにします。 * @default false * @type boolean * * @param ClearSubMenuOneByOne * @desc サブメニューを逐次消去します * @default true * @type boolean * * @param SubMenuX * @desc 指定するとサブコマンドのX座標が固定値になります。 * @default 0 * @type number * * @param SubMenuY * @desc 指定するとサブコマンドのY座標が固定値になります。 * @default 0 * @type number * * @param SubMenuAlign * @desc サブコマンドの揃えを設定します。 * @default * @type select * @option Left(default) * @value * @option Center * @value center * @option Right * @value right * * @param AnotherPicturesInMenuMap * @desc メニューマップと通常マップのピクチャの表示状態を別々に管理します。 * @default false * @type boolean * * @help MenuSubCommand.js * * メインメニュー画面に任意の名前のコマンドおよび * ツリー表示されるサブコマンドを好きなだけ追加できます。 * サブコマンドを実行(決定)すると、任意のスクリプトが実行されるか、 * もしくは指定したマップに移動します。(両方も可能) * * スクリプトは、主にスクリプトで組まれた別画面に遷移する場合に使用します。 * もちろん他のプラグインで追加された画面にも遷移可能です。 * マップ移動は主にイベントによる自作メニュー画面に遷移する場合に使用します。 * 自作メニュー画面から戻る際は、再度メニューを開いてください。 * 元々メニューを開いていた場所は、別途保存しているので意識する必要はありません。 * * また、通常の縦レイアウトとメニュー画面はもちろん、 * プラグインによる横レイアウトのメニュー画面にも対応しています。 * * メンバー選択してマップ移動する際に選択したアクターIDを変数に保存できます。 * * サブコマンドが全て非表示だった場合、親項目自体も非表示になります。 * 同じく全て使用禁止だった場合、親項目自体も使用禁止になります。 * * サブコマンドがひとつしかない場合、サブコマンドウィンドウは表示されず * 親コマンドを選択した時点でサブコマンドを実行します。 * * サブコマンドウィンドウのフォントサイズ等、一部の高度な設定は * 「ユーザ設定領域」に直接記述されています。必要に応じて改変可能です。 * * 〇用語辞典プラグインと組み合わせる場合 * 「用語辞典プラグイン」を同時に使用する場合は * スクリプトで以下の通り実行すると用語辞典画面を呼び出せます。 * this.commandGlossary(1); // 用語種別[1]の用語辞典を呼ぶ * * このプラグインにはプラグインコマンドはありません。 * * This plugin is released under the MIT License. */ /*:ja * @plugindesc メニュー画面のサブコマンドプラグイン * @author トリアコンタン * * @param サブコマンド * @desc サブコマンド情報です。 * @default * @type struct<SubCommand>[] * * @param コマンド追加位置 * @desc サブコマンド群を追加する位置です。0:並び替えの下 1:オプションの下 2:セーブの下 3:ゲーム終了の下 * @default 0 * @type select * @option 並び替えの下 * @value 0 * @option オプションの下 * @value 1 * @option セーブの下 * @value 2 * @option ゲーム終了の下 * @value 3 * * @param サブメニュー横幅 * @desc サブメニューを表示するウィンドウの横幅です。指定しない場合デフォルト値「240」が適用されます。 * @default 0 * @type number * * @param 選択アクターID変数 * @desc サブメニュー用マップに移動する際に選択していたアクターのIDを格納する変数番号です。 * @default 0 * @type variable * * @param ウィンドウスキン * @desc サブコマンド用のウィンドウに専用のスキンを設定します。 * @default * @require 1 * @dir img/system/ * @type file * * @param オプション消去 * @desc メインメニューからオプションを消去します。 * @default false * @type boolean * * @param ゲーム終了消去 * @desc メインメニューからゲーム終了を消去します。 * @default false * @type boolean * * @param 横並びサブメニュー * @desc サブメニューを横並べにします。 * @default false * @type boolean * * @param サブメニュー逐次消去 * @desc サブメニューを逐次消去します * @default true * @type boolean * * @param サブメニューX座標 * @desc 指定するとサブコマンドのX座標が固定値になります。 * @default 0 * @type number * * @param サブメニューY座標 * @desc 指定するとサブコマンドのY座標が固定値になります。 * @default 0 * @type number * * @param サブメニュー揃え * @desc サブコマンドの揃えを設定します。 * @default * @type select * @option 左揃え(デフォルト) * @value * @option 中央揃え * @value center * @option 右揃え * @value right * * @param メニューピクチャ別管理 * @desc メニューマップと通常マップのピクチャの表示状態を別々に管理します。 * @default false * @type boolean * * @help MenuSubCommand.js * * メインメニュー画面に任意の名前のコマンドおよび * ツリー表示されるサブコマンドを好きなだけ追加できます。 * サブコマンドを実行(決定)すると、任意のスクリプトが実行されるか、 * もしくは指定したマップに移動します。(両方も可能) * * スクリプトは、主にスクリプトで組まれた別画面に遷移する場合に使用します。 * もちろん他のプラグインで追加された画面にも遷移可能です。 * マップ移動は主にイベントによる自作メニュー画面に遷移する場合に使用します。 * 自作メニュー画面から戻る際は、再度メニューを開いてください。 * 元々メニューを開いていた場所は、別途保存しているので意識する必要はありません。 * * また、通常の縦レイアウトとメニュー画面はもちろん、 * プラグインによる横レイアウトのメニュー画面にも対応しています。 * * メンバー選択してマップ移動する際に選択したアクターIDを変数に保存できます。 * * サブコマンドが全て非表示だった場合、親項目自体も非表示になります。 * 同じく全て使用禁止だった場合、親項目自体も使用禁止になります。 * * サブコマンドがひとつしかない場合、サブコマンドウィンドウは表示されず * 親コマンドを選択した時点でサブコマンドを実行します。 * * サブコマンドウィンドウのフォントサイズ等、一部の高度な設定は * 「ユーザ設定領域」に直接記述されています。必要に応じて改変可能です。 * * 〇用語辞典プラグインと組み合わせる場合 * 「用語辞典プラグイン」を同時に使用する場合は * スクリプトで以下の通り実行すると用語辞典画面を呼び出せます。 * this.commandGlossary(1); // 用語種別[1]の用語辞典を呼ぶ * * このプラグインにはプラグインコマンドはありません。 * * 利用規約: * 作者に無断で改変、再配布が可能で、利用形態(商用、18禁利用等) * についても制限はありません。 * このプラグインはもうあなたのものです。 */ /*~struct~SubCommand:ja * * @param CommandId * @desc サブコマンドの識別番号。この番号と名称とでコマンドがまとめられます。通常は全て0で問題ありません。 * @default 0 * * @param Name * @desc サブコマンドに表示される任意のコマンド名称 * @default アイテム * * @param ParentName * @desc メインコマンドに表示されるサブコマンドの親名称。同一の名称の親を持つサブコマンドは一つに纏められます。 * @default 親コマンド1 * * @param HiddenSwitchId * @desc ONのときコマンドが非表示になるスイッチID * @default 0 * @type switch * * @param DisableSwitchId * @desc ONのときコマンドが使用禁止になるスイッチID * @default 0 * @type switch * * @param Script * @desc コマンドを決定したときに実行されるスクリプト * @default this.commandItem(); * * @param ReturnMap * @desc スクリプト実行後にマップに戻ります。 * @default false * @type boolean * * @param MapId * @desc コマンドを決定したときに移動するマップID * @default 0 * @type map_id * * @param SelectMember * @desc コマンド実行前に対象メンバーを選択するかどうか * @default false * @type boolean */ /*~struct~SubCommand: * * @param CommandId * @desc サブコマンドの識別番号。この番号と名称とでコマンドがまとめられます。通常は全て0で問題ありません。 * @default 0 * * @param Name * @desc サブコマンドに表示される任意のコマンド名称 * @default アイテム * * @param ParentName * @desc メインコマンドに表示されるサブコマンドの親名称。同一の名称の親を持つサブコマンドは一つに纏められます。 * @default 親コマンド1 * * @param HiddenSwitchId * @desc ONのときコマンドが非表示になるスイッチID * @default 0 * @type switch * * @param DisableSwitchId * @desc ONのときコマンドが使用禁止になるスイッチID * @default 0 * @type switch * * @param Script * @desc コマンドを決定したときに実行されるスクリプト * @default this.commandItem(); * * @param ReturnMap * @desc スクリプト実行後にマップに戻ります。 * @default false * @type boolean * * @param MapId * @desc コマンドを決定したときに移動するマップID * @default 0 * * @param SelectMember * @desc コマンド実行前に対象メンバーを選択するかどうか * @default false * @type boolean */ (function () { 'use strict'; //============================================================================= // ユーザ設定領域 開始 //============================================================================= var userSetting = { /** * サブコマンドウィンドウに関する設定です */ subCommandWindow: { adjustX: 0, adjustY: 0, fontSize: null, padding: null, }, /** * サブマップ移動時に自働でプレイヤーを透明にします。 */ autoTransparent: true }; //============================================================================= // ユーザ設定領域 終了 //============================================================================= var pluginName = 'MenuSubCommand'; //============================================================================= // ローカル関数 // プラグインパラメータやプラグインコマンドパラメータの整形やチェックをします //============================================================================= var getParamBoolean = function (paramNames) { var value = getParamString(paramNames); return value.toUpperCase() === 'ON' || value.toUpperCase() === 'TRUE'; }; var getParamString = function (paramNames) { if (!Array.isArray(paramNames)) paramNames = [paramNames]; for (let i = 0; i < paramNames.length; i++) { const name = PluginManager.parameters(pluginName)[paramNames[i]]; if (name) return name; } return ''; }; var getParamNumber = function (paramNames, min, max) { const value = getParamString(paramNames); if (arguments.length < 2) min = -Infinity; if (arguments.length < 3) max = Infinity; return (parseInt(value) || 0).clamp(min, max); }; var convertEscapeCharacters = function (text) { if (isNotAString(text)) text = ''; text = text.replace(/\\/g, '\x1b'); text = text.replace(/\x1b\x1b/g, '\\'); text = text.replace(/\x1bV\[(\d+)\]/gi, function () { return $gameVariables.value(parseInt(arguments[1])); }.bind(this)); text = text.replace(/\x1bV\[(\d+)\]/gi, function () { return $gameVariables.value(parseInt(arguments[1])); }.bind(this)); text = text.replace(/\x1bN\[(\d+)\]/gi, function () { var actor = parseInt(arguments[1]) >= 1 ? $gameActors.actor(parseInt(arguments[1])) : null; return actor ? actor.name() : ''; }.bind(this)); text = text.replace(/\x1bP\[(\d+)\]/gi, function () { var actor = parseInt(arguments[1]) >= 1 ? $gameParty.members()[parseInt(arguments[1]) - 1] : null; return actor ? actor.name() : ''; }.bind(this)); text = text.replace(/\x1bG/gi, TextManager.currencyUnit); return text; }; var isNotAString = function (args) { return String(args) !== args; }; var getArgBoolean = function (arg) { return arg.toUpperCase() === 'ON' || arg.toUpperCase() === 'TRUE'; }; var getParamArrayJson = function (paramNames, defaultValue) { var value = getParamString(paramNames) || null; try { value = JSON.parse(value); if (value === null) { value = defaultValue; } else { value = value.map(function (valueData) { return JSON.parse(valueData); }); } } catch (e) { alert(`!!!Plugin param is wrong.!!!\nPlugin:${pluginName}.js\nName:[${paramNames}]\nValue:${value}`); value = defaultValue; } return value; }; //============================================================================= // パラメータの取得と整形 //============================================================================= var param = {}; param.subCommands = getParamArrayJson(['サブコマンド', 'SubCommand'], []); param.commandPosition = getParamNumber(['CommandPosition', 'コマンド追加位置']); param.subMenuWidth = getParamNumber(['SubMenuWidth', 'サブメニュー横幅']); param.selectActorIdVariable = getParamNumber(['SelectActorIdVariable', '選択アクターID変数']); param.windowSkin = getParamString(['WindowSkin', 'ウィンドウスキン']); param.hideOption = getParamBoolean(['HideOption', 'オプション消去']); param.hideGameEnd = getParamBoolean(['HideGameEnd', 'ゲーム終了消去']); param.horizontalSubMenu = getParamBoolean(['HorizontalSubMenu', '横並びサブメニュー']); param.clearSubMenuOneByObe = getParamBoolean(['ClearSubMenuOneByOne', 'サブメニュー逐次消去']); param.subMenuX = getParamNumber(['SubMenuX', 'サブメニューX座標']); param.subMenuY = getParamNumber(['SubMenuY', 'サブメニューY座標']); param.subMenuAlign = getParamString(['SubMenuAlign', 'サブメニュー揃え']); param.anotherPicInMenuMap = getParamBoolean(['AnotherPicturesInMenuMap', 'メニューピクチャ別管理']); //============================================================================= // Game_Temp // メニューコマンド情報を構築して保持します。 //============================================================================= var _Game_Temp_initialize = Game_Temp.prototype.initialize; Game_Temp.prototype.initialize = function () { _Game_Temp_initialize.apply(this, arguments); this.createMenuCommands(); }; Game_Temp.prototype.createMenuCommands = function () { this._menuParentCommands = new Map(); param.subCommands.forEach(function (commands) { this.createMenuCommand(commands); }, this); /* 最後に選択したサブコマンド */ this._lastSubCommand = { parent: null, index: 0 }; }; Game_Temp.prototype.createMenuCommand = function (commands) { var parentName = commands.ParentName + commands.CommandId; if (!this._menuParentCommands.has(parentName)) { this._menuParentCommands.set(parentName, []); } var parent = this._menuParentCommands.get(parentName); parent.push(new Game_MenuSubCommand(commands)); }; Game_Temp.prototype.iterateMenuParents = function (callBackFunc, thisArg) { this._menuParentCommands.forEach(callBackFunc, thisArg); }; Game_Temp.prototype.getSubMenuCommands = function (parentName) { return this._menuParentCommands.get(parentName); }; /** * 最後に選択したサブコマンドを取得する */ Game_Temp.prototype.getLastSubCommand = function () { return this._lastSubCommand; }; Game_Temp.prototype.setLastSubCommandParent = function (parentName) { this._lastSubCommand.parent = parentName; }; Game_Temp.prototype.setLastSubCommandIndex = function (index) { this._lastSubCommand.index = index; }; /** * 最後に選択したサブコマンドをリセットする */ Game_Temp.prototype.resetLastSubCommand = function () { this._lastSubCommand = { parent: null, index: 0 }; }; //============================================================================= // Game_CharacterBase // サブコマンドマップへ移動します。 //============================================================================= Game_CharacterBase.prototype.savePosition = function () { this._originalX = this.x; this._originalY = this.y; this._originalDirection = this.direction(); }; Game_CharacterBase.prototype.restorePosition = function () { this.locate(this._originalX, this._originalY); this.setDirection(this._originalDirection); }; //============================================================================= // Game_Player // サブコマンドマップへ移動します。 //============================================================================= Game_Player.prototype.reserveTransferToSubCommandMap = function (subCommandMapId) { this.saveOriginalMap(); this.reserveTransfer(subCommandMapId, 0, 0, 0, 2); if (userSetting.autoTransparent) { this.setTransparent(true); } if (param.anotherPicInMenuMap) { $gameScreen.setupMenuMapPictures(); } }; Game_Player.prototype.reserveTransferToOriginalMap = function () { DataManager.loadMapData(this._originalMapId); this.reserveTransfer(this._originalMapId, this._originalX, this._originalY, this._originalDirection, 2); if (userSetting.autoTransparent) { this.setTransparent(this._originalTransparent); } this._originalMapId = 0; this._transferringToOriginalMap = true; if (param.anotherPicInMenuMap) { $gameScreen.restoreNormalMapPictures(); } }; Game_Player.prototype.isInSubCommandMap = function () { return this._originalMapId > 0; }; Game_Player.prototype.isTransferringToOriginalMap = function () { return this._transferringToOriginalMap; }; Game_Player.prototype.saveOriginalMap = function () { this._originalMapId = $gameMap.mapId(); this._originalTransparent = this._transparent; this.savePosition(); }; var _Game_Player_performTransfer = Game_Player.prototype.performTransfer; Game_Player.prototype.performTransfer = function () { _Game_Player_performTransfer.apply(this, arguments); if (this.isTransferringToOriginalMap()) { this.restorePosition(); this._transferringToOriginalMap = false; } }; Game_Player.prototype.savePosition = function () { Game_CharacterBase.prototype.savePosition.call(this, arguments); this._followers.forEach(function (follower) { follower.savePosition(); }); $gameMap.saveOriginalMapEvent(); }; Game_Player.prototype.restorePosition = function () { Game_CharacterBase.prototype.restorePosition.call(this, arguments); this._followers.forEach(function (follower) { follower.restorePosition(); }); $gameMap.restoreOriginalMapEvent(); }; //============================================================================= // Game_Map // すべてのイベントの状態を保存します。 //============================================================================= Game_Map.prototype.saveOriginalMapEvent = function () { this._originalMapEvents = this._events; }; Game_Map.prototype.restoreOriginalMapEvent = function () { if (this._originalMapEvents) { this._events = this._originalMapEvents; } this._originalMapEvents = null; }; //============================================================================= // Game_Party // 無効なアクター設定時のエラーを回避します。 //============================================================================= var _Game_Party_setMenuActor = Game_Party.prototype.setMenuActor; Game_Party.prototype.setMenuActor = function (actor) { if (!actor) return; _Game_Party_setMenuActor.apply(this, arguments); }; Game_Screen.prototype.setupMenuMapPictures = function () { this._normalMapPictures = this._pictures; this.clearPictures(); }; Game_Screen.prototype.restoreNormalMapPictures = function () { if (this._normalMapPictures) { this._pictures = this._normalMapPictures; } this._normalMapPictures = null; }; //============================================================================= // AudioManager // システム効果音を消音します。 //============================================================================= AudioManager.stopAllStaticSe = function () { this._staticBuffers.forEach(function (buffer) { buffer.stop(); }); this._staticBuffers = []; }; //============================================================================= // SceneManager // メニュー用マップではキャプチャを無効にします。 //============================================================================= var _SceneManager_snapForBackground = SceneManager.snapForBackground; SceneManager.snapForBackground = function () { if ($gamePlayer.isInSubCommandMap()) return; _SceneManager_snapForBackground.apply(this, arguments); }; //============================================================================= // Scene_Map // 自作ゲーム用マップ遷移の場合、一部演出を無効化します。 //============================================================================= var _Scene_Map_callMenu = Scene_Map.prototype.callMenu; Scene_Map.prototype.callMenu = function () { _Scene_Map_callMenu.apply(this, arguments); if ($gamePlayer.isInSubCommandMap()) { AudioManager.stopAllStaticSe(); SoundManager.playCancel(); } }; var _Scene_Map_onMapLoaded = Scene_Map.prototype.onMapLoaded; Scene_Map.prototype.onMapLoaded = function () { _Scene_Map_onMapLoaded.apply(this, arguments); if ($gamePlayer.isInSubCommandMap()) { this._transfer = false; } }; //============================================================================= // Scene_Menu // メインメニューにコマンドを追加します。 //============================================================================= var _Scene_Menu_create = Scene_Menu.prototype.create; Scene_Menu.prototype.create = function () { _Scene_Menu_create.apply(this, arguments); this.loadSubCommandWindowSkin(); if ($gamePlayer.isInSubCommandMap()) { $gamePlayer.reserveTransferToOriginalMap(); } if (this._isSubCommandOkAfterCreate) { this.onSubCommandOk(); } }; Scene_Menu.prototype.loadSubCommandWindowSkin = function () { if (param.windowSkin) { ImageManager.loadSystem(param.windowSkin); } }; var _Scene_Menu_isReady = Scene_Menu.prototype.isReady; Scene_Menu.prototype.isReady = function () { return _Scene_Menu_isReady.apply(this, arguments) && (!$gamePlayer.isTransferringToOriginalMap() || DataManager.isMapLoaded()); }; var _Scene_Menu_start = Scene_Menu.prototype.start; Scene_Menu.prototype.start = function () { _Scene_Menu_start.apply(this, arguments); if ($gamePlayer.isTransferringToOriginalMap()) { $gamePlayer.performTransfer(); } }; var _Scene_Menu_createCommandWindow = Scene_Menu.prototype.createCommandWindow; Scene_Menu.prototype.createCommandWindow = function () { _Scene_Menu_createCommandWindow.apply(this, arguments); $gameTemp.iterateMenuParents(function (subCommands, parentName) { this._commandWindow.setHandler('parent' + parentName, this.commandParent.bind(this)); }, this); /* 最後に選択していたメニューにカーソルを合わせる */ this.selectLastCommand(); }; Scene_Menu.prototype.commandParent = function () { var parentName = this._commandWindow.currentExt(); var subCommands = $gameTemp.getSubMenuCommands(parentName); $gameTemp.setLastSubCommandParent(parentName); if (subCommands.length === 1) { this.onSubCommandOk(subCommands[0]); } else { if (!param.clearSubMenuOneByObe && this._subMenuWindow) { this._subMenuWindow.activate(); } else { this.createSubMenuCommandWindow(parentName); } } }; Scene_Menu.prototype.createSubMenuCommandWindow = function (parentName) { this._subMenuWindow = new Window_MenuSubCommand(this.x, this.y, parentName); this._subMenuWindow.updatePlacement(this._commandWindow); this._subMenuWindow.setHandler('ok', this.onSubCommandOk.bind(this)); this._subMenuWindow.setHandler('cancel', this.onSubCommandCancel.bind(this)); // for MOG_MenuBackground.js if (typeof this._subMenuWindow.updateBackgroundOpacity === 'function') { this._subMenuWindow.updateBackgroundOpacity(); } // for MOG_MenuCursor.js and MOG_SceneMenu.js if (typeof Imported !== 'undefined' && Imported.MMOG_SceneMenu) { this.addChild(this._subMenuWindow); } else { var index = this.getChildIndex(this._windowLayer) + 1; this.addChildAt(this._subMenuWindow, index); } }; Scene_Menu.prototype.removeSubMenuCommandWindow = function () { if (this._subMenuWindow) { this.removeChild(this._subMenuWindow); } this._subMenuWindow = null; }; Scene_Menu.prototype.onSubCommandOk = function (subCommand) { this._subCommand = (this._subMenuWindow ? this._subMenuWindow.currentExt() : subCommand); $gameTemp.setLastSubCommandIndex(this._subMenuWindow ? this._subMenuWindow.index() : 0); if (this._subCommand.isNeedSelectMember()) { if (this._subMenuWindow) { this._commandWindow.maskCommand(this._subCommand.getName()); } this._statusWindow.selectLast(); this._statusWindow.activate(); this._statusWindow.setHandler('ok', this.executeSubCommand.bind(this)); this._statusWindow.setHandler('cancel', this.onPersonalCancel.bind(this)); if (param.clearSubMenuOneByObe) { this.removeSubMenuCommandWindow(); } else { this._subMenuWindow.deactivate(); } } else { this.executeSubCommand(); } }; Scene_Menu.prototype.onSubCommandCancel = function () { this.removeSubMenuCommandWindow(); $gameTemp.resetLastSubCommand(); this._commandWindow.activate(); }; var _Scene_Menu_onPersonalCancel = Scene_Menu.prototype.onPersonalCancel; Scene_Menu.prototype.onPersonalCancel = function () { _Scene_Menu_onPersonalCancel.apply(this); this._commandWindow.maskOff(); /* 最後に選択していたメニューにカーソルを合わせる */ this.selectLastCommand(); }; /** * 最後に選択していたメニューにカーソルを合わせる */ Scene_Menu.prototype.selectLastCommand = function () { var lastSubCommand = $gameTemp.getLastSubCommand(); if (lastSubCommand.parent) { this._commandWindow.selectSymbol('parent' + lastSubCommand.parent); var subCommands = $gameTemp.getSubMenuCommands(lastSubCommand.parent); if (subCommands.length !== 1) { this.commandParent(); this._commandWindow.deactivate(); this._subMenuWindow.select(lastSubCommand.index); /* 別シーンからキャラ選択に戻った時 */ var subCommand = subCommands[lastSubCommand.index]; if (subCommand.isNeedSelectMember()) { this._isSubCommandOkAfterCreate = true; } } } $gameTemp.resetLastSubCommand(); }; Scene_Menu.prototype.executeSubCommand = function () { this.executeSubScript(); this.moveSubCommandMap(); if (!SceneManager.isSceneChanging()) { this.onSubCommandCancel(); this._statusWindow.deselect(); this._commandWindow.maskOff(); } else { this._subCommandSelected = true; } }; Scene_Menu.prototype.executeSubScript = function () { var script = this._subCommand.getSelectionScript(); if (!script) return; try { eval(script); } catch (e) { SoundManager.playBuzzer(); console.error(`実行スクリプトエラー[${script}] メッセージ[${e.message}]`); } if (this._subCommand.isReturnMap()) { SceneManager.pop(); } }; Scene_Menu.prototype.moveSubCommandMap = function () { var mapId = this._subCommand.getMoveTargetMap(); if (mapId <= 0) { return; } $gamePlayer.reserveTransferToSubCommandMap(mapId); if (param.selectActorIdVariable && this._subCommand.isNeedSelectMember()) { $gameVariables.setValue(param.selectActorIdVariable, this._statusWindow.getSelectedActorId()); } SceneManager.pop(); }; /** * メニューから抜ける際に最後に選択したサブコマンドをリセットする */ var _Scene_Menu_terminate = Scene_Menu.prototype.terminate; Scene_Menu.prototype.terminate = function () { _Scene_Menu_terminate.apply(this, arguments); if (this._subCommand && this._subCommand.getMoveTargetMap() <= 0) { $gameTemp.resetLastSubCommand(); } }; var _Scene_Menu_createField = Scene_Menu.prototype.createField; Scene_Menu.prototype.createField = function () { _Scene_Menu_createField.apply(this, arguments); if (this._subMenuWindow) { this.addChild(this._subMenuWindow); } }; //============================================================================= // Window_MenuCommand // サブコマンドを追加します。 //============================================================================= var _Window_MenuCommand_initialize = Window_MenuCommand.prototype.initialize; Window_MenuCommand.prototype.initialize = function () { this._maskedName = {}; _Window_MenuCommand_initialize.apply(this, arguments); }; var _Window_MenuCommand_initCommandPosition = Window_MenuCommand.initCommandPosition; Window_MenuCommand.initCommandPosition = function () { if ($gamePlayer.isInSubCommandMap()) return; _Window_MenuCommand_initCommandPosition.apply(this, arguments); }; var _Window_MenuCommand_addOriginalCommands = Window_MenuCommand.prototype.addOriginalCommands; Window_MenuCommand.prototype.addOriginalCommands = function () { _Window_MenuCommand_addOriginalCommands.apply(this, arguments); if (param.commandPosition === 0) this.makeSubCommandList(); }; var _Window_MenuCommand_addOptionsCommand = Window_MenuCommand.prototype.addOptionsCommand; Window_MenuCommand.prototype.addOptionsCommand = function () { _Window_MenuCommand_addOptionsCommand.apply(this, arguments); if (param.commandPosition === 1) this.makeSubCommandList(); }; var _Window_MenuCommand_addSaveCommand = Window_MenuCommand.prototype.addSaveCommand; Window_MenuCommand.prototype.addSaveCommand = function () { _Window_MenuCommand_addSaveCommand.apply(this, arguments); if (param.commandPosition === 2) this.makeSubCommandList(); }; var _Window_MenuCommand_addGameEndCommand = Window_MenuCommand.prototype.addGameEndCommand; Window_MenuCommand.prototype.addGameEndCommand = function () { if (this.needsCommand('gameEnd')) { _Window_MenuCommand_addGameEndCommand.apply(this, arguments); } if (param.commandPosition === 3) this.makeSubCommandList(); }; var _Window_MenuCommand_needsCommand = Window_MenuCommand.prototype.needsCommand; Window_MenuCommand.prototype.needsCommand = function (name) { var need = _Window_MenuCommand_needsCommand.apply(this, arguments); if (name === 'options' && param.hideOption) { return false; } if (name === 'gameEnd' && param.hideGameEnd) { return false; } return need; }; Window_MenuCommand.prototype.makeSubCommandList = function () { $gameTemp.iterateMenuParents(function (subCommands, parentName) { this._subCommands = subCommands; if (this.checkSubCommands('isVisible')) { var commandName = this._maskedName[parentName] ? this._maskedName[parentName] : subCommands[0].getParentName(); this.addCommand(commandName, 'parent' + parentName, this.checkSubCommands('isEnable'), parentName); } }, this); }; Window_MenuCommand.prototype.checkSubCommands = function (methodName) { return this._subCommands.some(function (subCommand) { return subCommand[methodName](); }); }; Window_MenuCommand.prototype.calculateSubCommandX = function (width) { var x = (this.isHorizontalMenu() ? this._cursorRect.x : this.x + this.width); x += userSetting.subCommandWindow.adjustX; return x.clamp(0, Graphics.boxWidth - width); }; Window_MenuCommand.prototype.calculateSubCommandY = function (height) { var y = (this.isHorizontalMenu() ? this.y + this.height : this._cursorRect.y); y += userSetting.subCommandWindow.adjustY; return y.clamp(0, Graphics.boxHeight - height); }; Window_MenuCommand.prototype.isHorizontalMenu = function () { return this.maxCols() >= this.maxPageRows(); }; Window_MenuCommand.prototype.maskCommand = function (maskName) { this._maskedName = {}; this._maskedName[this.commandName(this.index())] = maskName; this.refresh(); }; Window_MenuCommand.prototype.maskOff = function () { this._maskedName = {}; this.refresh(); }; //============================================================================= // Window_MenuStatus // 選択しているアクターのIDを取得します。 //============================================================================= Window_MenuStatus.prototype.getSelectedActorId = function () { return $gameParty.members()[this._index].actorId(); }; //============================================================================= // Window_MenuSubCommand // サブコマンドウィンドウのクラスです。 //============================================================================= function Window_MenuSubCommand() { this.initialize.apply(this, arguments); } Window_MenuSubCommand.prototype = Object.create(Window_Command.prototype); Window_MenuSubCommand.prototype.constructor = Window_MenuSubCommand; Window_MenuSubCommand.prototype.initialize = function (x, y, parentName) { this._parentName = parentName; Window_Command.prototype.initialize.call(this, x, y); }; Window_MenuSubCommand.prototype.makeCommandList = function () { var subMenus = $gameTemp.getSubMenuCommands(this._parentName); subMenus.forEach(function (subMenu) { if (subMenu.isVisible()) { this.addCommand(subMenu.getName(), 'ok', subMenu.isEnable(), subMenu); } }, this); }; Window_MenuSubCommand.prototype.numVisibleRows = function () { return param.horizontalSubMenu ? 1 : Window_Command.prototype.numVisibleRows.call(this); }; Window_MenuSubCommand.prototype.maxCols = function () { return param.horizontalSubMenu ? this.maxItems() : 1; }; Window_MenuSubCommand.prototype.windowWidth = function () { return param.subMenuWidth || Window_Command.prototype.windowWidth.call(this); }; Window_MenuSubCommand.prototype.lineHeight = function () { if (userSetting.subCommandWindow.fontSize) { return userSetting.subCommandWindow.fontSize + 8; } else { return Window_Command.prototype.lineHeight.call(this); } }; Window_MenuSubCommand.prototype.updatePlacement = function (commandWindow) { if (param.subMenuX || param.subMenuY) { this.x = param.subMenuX; this.y = param.subMenuY; } else { this.x = commandWindow.calculateSubCommandX(this.width); this.y = commandWindow.calculateSubCommandY(this.height); } }; Window_MenuSubCommand.prototype.standardFontSize = function () { return userSetting.subCommandWindow.fontSize || Window_Command.prototype.standardFontSize.call(this); }; Window_MenuSubCommand.prototype.standardPadding = function () { return userSetting.subCommandWindow.padding || Window_Command.prototype.standardPadding.call(this); }; Window_MenuSubCommand.prototype.loadWindowskin = function () { if (param.windowSkin) { this.windowskin = ImageManager.loadSystem(param.windowSkin); } else { Window_Command.prototype.loadWindowskin.call(this); } }; var _Window_MenuSubCommand_itemTextAlign = Window_MenuSubCommand.prototype.itemTextAlign; Window_MenuSubCommand.prototype.itemTextAlign = function () { return param.subMenuAlign || _Window_MenuSubCommand_itemTextAlign.apply(this, arguments); }; //============================================================================= // Game_MenuSubCommand // サブコマンドを扱うクラスです。 //============================================================================= class Game_MenuSubCommand { constructor(subCommandData) { this._parentName = subCommandData.ParentName; this._name = subCommandData.Name; this._hiddenSwitchId = subCommandData.HiddenSwitchId; this._disableSwitchId = subCommandData.DisableSwitchId; this._targetScript = subCommandData.Script; this._targetMapId = subCommandData.MapId; this._returnMap = subCommandData.ReturnMap === 'true'; this._memberSelect = getArgBoolean(subCommandData.SelectMember); } getName() { return this._name; } getParentName() { return this._parentName; } isReturnMap() { return (!this.getMoveTargetMap()) && this._returnMap; } isVisible() { return !$gameSwitches.value(this.convert(this._hiddenSwitchId, true)); } isEnable() { return !$gameSwitches.value(this.convert(this._disableSwitchId, true)) && !(SceneManager.isSceneRetry && SceneManager.isSceneRetry() && this.getMoveTargetMap() > 0); } isNeedSelectMember() { return !!this._memberSelect; } getSelectionScript() { return this.convert(this._targetScript, false); } getMoveTargetMap() { return this.convert(this._targetMapId, true); } convert(text, isNumber) { var convertText = convertEscapeCharacters(text); return isNumber ? parseInt(convertText) : convertText; } } })();
dazed/translations
www/js/plugins/MenuSubCommand.js
JavaScript
unknown
47,765
//============================================================================= // MessageSkip.js // ---------------------------------------------------------------------------- // (C) 2016 Triacontane // This software is released under the MIT License. // http://opensource.org/licenses/mit-license.php // ---------------------------------------------------------------------------- // Version // 1.16.1 2021/08/29 スキップ中はウィンドウ背景が変わってもウィンドウを閉じないよう修正 // 1.16.0 2021/06/15 ピクチャによるクリックは押し続けスキップの対象外とするよう仕様変更 // 1.15.1 2021/06/01 1.15.0でループボイスを再生するとオートモードで文章が送られなくなる問題を修正 // 1.15.0 2021/05/31 SimpleVoice.jsと併用したとき、ボイス演奏中はオートモードによる文章送りを待機するよう変更 // 1.14.1 2020/10/15 ヘルプに注釈を追加 // 1.14.0 2020/08/02 クリックすることで任意のスイッチをONにできるピクチャをメッセージウィンドウに表示する機能を追加 // 1.13.0 2020/03/26 オート、スキップピクチャの表示方法をメッセージウィンドウからの相対座標と絶対座標とを選択できる機能を追加 // 1.12.1 2020/03/25 アイコン表示位置をメッセージウィンドウの位置やサイズの変更に追従するよう修正 // 1.12.0 2019/05/26 オート、スキップアイコンの位置を自由に指定できる機能を追加 // 1.11.0 2018/06/16 オート及びスキップの機能を一時的に無効化するスイッチを追加 // 1.10.1 2018/05/07 オートモードで途中に「\!」が含まれる場合の待機フレームが正しく計算されない問題を修正 // 1.10.0 2018/05/01 スキップモードとオートモードをスイッチで自動制御できる機能を追加 // 1.9.0 2018/02/18 イベント終了時にオート、スキップを解除するかどうかを任意のスイッチで判定できるように仕様変更 // 1.8.0 2018/02/16 オート待機フレーム数の計算式にウィンドウに表示した文字数を組み込める機能を追加 // 1.7.0 2017/12/12 SkipAlreadyReadMessage.jsとの連携したときに当プラグインのスキップ機能が既読スキップになるよう修正 // スキップピクチャの条件スイッチが0(指定なし)のときに同ピクチャが表示されない問題を修正 // 1.6.1 2017/09/21 オートモード時 改ページを伴わない入力待ちの後のメッセージを一瞬でスキップする問題を修正(by DarkPlasmaさん) // 1.6.0 2017/08/03 キーを押している間だけスキップが有効にできる機能を追加 // 1.5.0 2017/05/27 オートおよびスキップボタンの原点指定と表示可否を変更できるスイッチの機能を追加 // 1.4.0 2017/05/26 クリックでオートおよびスキップを切り替えるボタンを追加 // 1.3.1 2017/05/13 アイコンの量を増やしたときにオートとスキップのアイコンが正常に表示されない問題を修正 // 1.3.0 2017/05/05 スキップ中はメッセージのウェイトを無視するよう修正 // 1.2.0 2017/04/29 並列実行のイベントでも通常イベントが実行中でなければスキップを解除するよう修正 // キーコードの「右」と「上」が逆になっていた問題を修正 // オート待機フレームを制御文字を使って動的に変更できる機能を追加 // 1.1.0 2016/12/14 並列処理イベントが実行されている場合にスキップが効かなくなる問題を修正 // 1.0.1 2016/02/15 モバイル端末での動作が遅くなる不具合を修正 // 1.0.0 2016/01/15 初版 // ---------------------------------------------------------------------------- // [Blog] : https://triacontane.blogspot.jp/ // [Twitter]: https://twitter.com/triacontane/ // [GitHub] : https://github.com/triacontane/ //============================================================================= /*: * @plugindesc MessageSkipPlugin * @author triacontane * * @param SkipKey * @desc メッセージスキップに該当するキー(controlを選択するとAltキーも対象に含まれます) * (キーのアルファベット/shift/control/tab) * @default S * @type select * @option shift * @option control * @option tab * @option S * * @param AutoKey * @desc メッセージオートに該当するキー(controlを選択するとAltキーも対象に含まれます) * (キーのアルファベット/shift/control/tab) * @default A * @type select * @option shift * @option control * @option tab * @option A * * @param SkipSwitchId * @desc 指定した番号のスイッチがONになっている場合は常にスキップします。 * @default 0 * @type switch * * @param AutoSwitchIId * @desc 指定した番号のスイッチがONになっている場合は常にオートします。スキップが優先されます。 * @default 0 * @type switch * * @param SkipIcon * @desc メッセージスキップ中にウィンドウ右下に表示されるアイコン * @default 140 * @type number * * @param AutoIcon * @desc メッセージオート中にウィンドウ右下に表示されるアイコン * @default 75 * @type number * * @param IconX * @desc オート、スキップのアイコン位置を自由に変更したい場合に指定するX座標です。 * @default 0 * @type number * @min -2000 * @max 2000 * * @param IconY * @desc オート、スキップのアイコン位置を自由に変更したい場合に指定するX座標です。 * @default 0 * @type number * @min -2000 * @max 2000 * * @param PressingSkip * @desc スキップの判定が指定のキーを押している間のみになります。 * @default false * @type boolean * * @param AutoWaitFrame * @desc オートモードが有効の場合にメッセージを表示しておくフレーム数。制御文字\v[n]および計算式が指定できます。 * @default 100 + textSize * 10 * * @param ResetOnEndSwitch * @desc 指定した番号のスイッチがONのとき、イベント終了時にスキップ、オート状態を解除します。0の場合は常に解除します。 * @default 0 * @type switch * * @param SkipPicture * @desc ウィンドウ内に表示するスキップピクチャのファイル名です。クリックするとスキップモードになります。 * @default * @require 1 * @dir img/pictures/ * @type file * * @param SkipPictureX * @desc ウィンドウ内に表示するスキップピクチャのX座標です。 * @default 500 * @type number * * @param SkipPictureY * @desc ウィンドウ内に表示するスキップピクチャのY座標です。 * @default 0 * @type number * * @param AutoPicture * @desc ウィンドウ内に表示するオートピクチャのファイル名です。クリックするとオートモードになります。 * @default * @require 1 * @dir img/pictures/ * @type file * * @param AutoPictureX * @desc ウィンドウ内に表示するオートピクチャのX座標です。 * @default 750 * @type number * * @param AutoPictureY * @desc ウィンドウ内に表示するオートピクチャのY座標です。 * @default 0 * @type number * * @param SwitchPicture * @desc ウィンドウ内に表示するスイッチピクチャのファイル名です。クリックすると指定したスイッチがONになります。 * @default * @require 1 * @dir img/pictures/ * @type file * * @param SwitchPictureTrigger * @desc スイッチピクチャをクリックしたときにONにするスイッチ番号です。 * @default 0 * @type switch * * @param SwitchPictureX * @desc ウィンドウ内に表示するスイッチピクチャのX座標です。 * @default 750 * @type number * * @param SwitchPictureY * @desc ウィンドウ内に表示するスイッチピクチャのY座標です。 * @default 0 * @type number * * @param PictureSwitchId * @desc 指定した番号のスイッチがONのときのみスキップ、オートの各ピクチャボタンを表示します。0の場合は無条件で表示します。 * @default 0 * @type switch * * @param PictureAnchor * @desc スキップ、オートの各ピクチャボタン座標の原点です。(0:左上、1:右上、2:左下、3:右下) * @default 0 * @type select * @option 0 * @option 1 * @option 2 * @option 3 * * @param PicturePosType * @desc オート、スキップピクチャの配置方法です。相対座標を選択するとウィンドウ表示位置からの相対座標となります。 * @default relative * @type select * @option absolute * @option relative * * @param InvalidSwitchId * @desc 指定したスイッチがONのときプラグインの全機能が無効になります。 * @default 0 * @type switch * * @help メッセージウィンドウでメッセージのスキップやオートモードの切替ができます。 * イベントが終了すると自働でスキップやオートモードは解除されます。 * 並列実行イベントは、通常イベントが実行中でない場合のみ解除されます。 * 明示的に解除したい場合は、以下のスクリプトを実行してください。 * * $gameMessage.clearSkipInfo(); * * ・SkipAlreadyReadMessage.jsとの連携 * SkipAlreadyReadMessage.js(奏ねこま様作)と併用したときに * 当プラグインのスキップ機能は「既読スキップ」機能になります。 * http://makonet.sakura.ne.jp/rpg_tkool/ * * ・パラメータ「オート待機フレーム」を設定するとオートモード時の待機フレームを変更できます。 * 制御文字\v[n]のほか、JavaScript計算式が使えます。 * さらにtextSizeで表示文字数を計算式に組み込むことができます。 * * 指定例: * 100 + textSize * 10 * * このプラグインにはプラグインコマンドはありません。 * * This plugin is released under the MIT License. */ /*:ja * @plugindesc メッセージスキッププラグイン * @author トリアコンタン * * @param スキップキー * @desc メッセージスキップに該当するキー * (キーのアルファベット/shift/control/tab) * @default S * @type select * @option shift * @option control * @option tab * @option S * * @param オートキー * @desc メッセージオートに該当するキー * (キーのアルファベット/shift/control/tab) * @default A * @type select * @option shift * @option control * @option tab * @option A * * @param スキップスイッチ * @desc 指定した番号のスイッチがONになっている場合は常にスキップします。 * @default 0 * @type switch * * @param オートスイッチ * @desc 指定した番号のスイッチがONになっている場合は常にオートします。スキップが優先されます。 * @default 0 * @type switch * * @param スキップアイコン * @desc メッセージスキップ中にウィンドウ右下に表示されるアイコン * @default 140 * @type number * * @param オートアイコン * @desc メッセージオート中にウィンドウ右下に表示されるアイコン * @default 75 * @type number * * @param アイコンX * @desc オート、スキップのアイコン位置を自由に変更したい場合に指定するX座標です。 * @default 0 * @type number * @min -2000 * @max 2000 * * @param アイコンY * @desc オート、スキップのアイコン位置を自由に変更したい場合に指定するX座標です。 * @default 0 * @type number * @min -2000 * @max 2000 * * @param 押し続けスキップ * @desc スキップの判定が指定のキーを押している間のみになります。 * @default false * @type boolean * * @param オート待機フレーム * @desc オートモードが有効の場合にメッセージを表示しておくフレーム数。制御文字\v[n]および計算式が指定できます。 * @default 100 + textSize * 10 * * @param 終了解除スイッチID * @desc 指定した番号のスイッチがONのとき、イベント終了時にスキップ、オート状態を解除します。0の場合は常に解除します。 * @default 0 * @type switch * * @param スキップピクチャ * @desc ウィンドウ内に表示するスキップピクチャのファイル名です。クリックするとスキップモードになります。 * @default * @require 1 * @dir img/pictures/ * @type file * * @param スキップピクチャX * @desc ウィンドウ内に表示するスキップピクチャのX座標です。 * @default 500 * @type number * * @param スキップピクチャY * @desc ウィンドウ内に表示するスキップピクチャのY座標です。 * @default 0 * @type number * * @param オートピクチャ * @desc ウィンドウ内に表示するオートピクチャのファイル名です。クリックするとオートモードになります。 * @default * @require 1 * @dir img/pictures/ * @type file * * @param オートピクチャX * @desc ウィンドウ内に表示するオートピクチャのX座標です。 * @default 750 * @type number * * @param オートピクチャY * @desc ウィンドウ内に表示するオートピクチャのY座標です。 * @default 0 * @type number * * @param スイッチピクチャ * @desc ウィンドウ内に表示するスイッチピクチャのファイル名です。クリックすると指定したスイッチがONになります。 * @default * @require 1 * @dir img/pictures/ * @type file * * @param スイッチピクチャトリガー * @desc スイッチピクチャをクリックしたときにONにするスイッチ番号です。 * @default 0 * @type switch * * @param スイッチピクチャX * @desc ウィンドウ内に表示するスイッチピクチャのX座標です。 * @default 750 * @type number * * @param スイッチピクチャY * @desc ウィンドウ内に表示するスイッチピクチャのY座標です。 * @default 0 * @type number * * @param ボタン原点 * @desc スキップ、オートの各ピクチャボタン座標の原点です。(0:左上、1:右上、2:左下、3:右下) * @default 0 * @type select * @option 0 * @option 1 * @option 2 * @option 3 * * @param ボタン表示スイッチID * @desc 指定した番号のスイッチがONのときのみスキップ、オートの各ピクチャボタンを表示します。0の場合は無条件で表示します。 * @default 0 * @type switch * * @param ピクチャ座標タイプ * @desc オート、スキップピクチャの配置方法です。相対座標を選択するとウィンドウ表示位置からの相対座標となります。 * @default relative * @type select * @option 絶対座標 * @value absolute * @option 相対座標 * @value relative * * @param 無効化スイッチ * @desc 指定したスイッチがONのときプラグインの全機能が無効になります。 * @default 0 * @type switch * * @help メッセージウィンドウでメッセージのスキップやオートモードの切替ができます。 * イベントが終了すると自働でスキップやオートモードは解除されます。 * 並列実行イベントは、通常イベントが実行中でない場合のみ解除されます。 * 明示的に解除したい場合は、以下のスクリプトを実行してください。 * * $gameMessage.clearSkipInfo(); * * ・SkipAlreadyReadMessage.jsとの連携 * SkipAlreadyReadMessage.js(奏ねこま様作)と併用したときに * 当プラグインのスキップ機能は「既読スキップ」機能になります。 * http://makonet.sakura.ne.jp/rpg_tkool/ * * ・パラメータ「オート待機フレーム」を設定するとオートモード時の待機フレームを変更できます。 * 制御文字\v[n]のほか、JavaScript計算式が使えます。 * さらにtextSizeで表示文字数を計算式に組み込むことができます。 * * 指定例: * 100 + textSize * 10 * * このプラグインにはプラグインコマンドはありません。 * * 利用規約: * 作者に無断で改変、再配布が可能で、利用形態(商用、18禁利用等) * についても制限はありません。 * このプラグインはもうあなたのものです。 */ /** * メッセージボタンスプライト * @constructor */ function Sprite_MessageButton() { this.initialize.apply(this, arguments); } /** * アイコン描画用スプライト * @constructor */ function Sprite_Frame() { this.initialize.apply(this, arguments); } (function () { 'use strict'; var pluginName = 'MessageSkip'; var getParamString = function (paramNames, upperFlg) { var value = getParamOther(paramNames); return value === null ? '' : upperFlg ? value.toUpperCase() : value; }; var getParamNumber = function (paramNames, min, max) { var value = getParamOther(paramNames); if (arguments.length < 2) min = -Infinity; if (arguments.length < 3) max = Infinity; return (parseInt(value) || 0).clamp(min, max); }; var getParamBoolean = function (paramNames) { var value = getParamString(paramNames); return value.toUpperCase() === 'ON' || value.toUpperCase() === 'TRUE'; }; var getParamOther = function (paramNames) { if (!Array.isArray(paramNames)) paramNames = [paramNames]; for (var i = 0; i < paramNames.length; i++) { var name = PluginManager.parameters(pluginName)[paramNames[i]]; if (name) return name; } return null; }; var convertEscapeCharacters = function (text) { if (isNotAString(text)) text = ''; var windowLayer = SceneManager._scene._windowLayer; return windowLayer ? windowLayer.children[0].convertEscapeCharacters(text) : text; }; var isNotAString = function (args) { return String(args) !== args; }; Number.prototype.times = function (handler) { var i = 0; while (i < this) handler.call(this, i++); }; Input.keyCodeReverseMapper = { a: 65, b: 66, c: 67, d: 68, e: 69, f: 70, g: 71, h: 72, i: 73, j: 74, k: 75, l: 76, m: 77, n: 78, o: 79, p: 80, q: 81, r: 82, s: 83, t: 84, u: 85, v: 86, w: 87, x: 88, y: 89, z: 90, backspace: 8, tab: 9, enter: 13, shift: 16, ctrl: 17, alt: 18, pause: 19, esc: 27, space: 32, page_up: 33, page_down: 34, end: 35, home: 36, left: 37, right: 39, up: 38, down: 40, insert: 45, delete: 46 }; (9).times(function (i) { Input.keyCodeReverseMapper[i] = i + 48; }); (12).times(function (i) { Input.keyCodeReverseMapper['f' + (i + 1)] = i + 112; }); //============================================================================= // パラメータの取得と整形 //============================================================================= var skipKeyName = getParamString(['SkipKey', 'スキップキー']).toLowerCase(); var skipKeyCode = Input.keyCodeReverseMapper[skipKeyName]; var autoKeyName = getParamString(['AutoKey', 'オートキー']).toLowerCase(); var autoKeyCode = Input.keyCodeReverseMapper[autoKeyName]; if (skipKeyCode) { if (!Input.keyMapper[skipKeyCode]) { Input.keyMapper[skipKeyCode] = 'messageSkip'; } else { skipKeyName = Input.keyMapper[skipKeyCode]; } } if (autoKeyCode) { if (!Input.keyMapper[autoKeyCode]) { Input.keyMapper[autoKeyCode] = 'messageAuto'; } else { autoKeyName = Input.keyMapper[autoKeyCode]; } } var paramSkipPicture = getParamString(['SkipPicture', 'スキップピクチャ']); var paramSkipPictureX = getParamNumber(['SkipPictureX', 'スキップピクチャX']); var paramSkipPictureY = getParamNumber(['SkipPictureY', 'スキップピクチャY']); var paramAutoPicture = getParamString(['AutoPicture', 'オートピクチャ']); var paramAutoPictureX = getParamNumber(['AutoPictureX', 'オートピクチャX']); var paramAutoPictureY = getParamNumber(['AutoPictureY', 'オートピクチャY']); var paramSwitchPicture = getParamString(['SwitchPicture', 'スイッチピクチャ']); var paramSwitchPictureX = getParamNumber(['SwitchPictureX', 'スイッチピクチャX']); var paramSwitchPictureY = getParamNumber(['SwitchPictureY', 'スイッチピクチャY']); var paramSwitchPictureTrigger = getParamNumber(['SwitchPictureTrigger', 'スイッチピクチャトリガー'], 0); var paramPictureAnchor = getParamNumber(['PictureAnchor', 'ボタン原点']); var paramPictureSwitchId = getParamNumber(['PictureSwitchId', 'ボタン表示スイッチID'], 0); var paramPressingSkip = getParamBoolean(['PressingSkip', '押し続けスキップ']); var paramSkipSwitchId = getParamNumber(['SkipSwitchId', 'スキップスイッチ'], 0); var paramAutoSwitchIId = getParamNumber(['AutoSwitchIId', 'オートスイッチ'], 0); var paramInvalidSwitchId = getParamNumber(['InvalidSwitchId', '無効化スイッチ'], 0); var paramIconX = getParamNumber(['IconX', 'アイコンX'], 0); var paramIconY = getParamNumber(['IconY', 'アイコンY'], 0); var paramPicturePosType = getParamString(['PicturePosType', 'ピクチャ座標タイプ']); //============================================================================= // Game_Message // メッセージスキップ情報を保持します。 //============================================================================= var _Game_Message_initialize = Game_Message.prototype.initialize; Game_Message.prototype.initialize = function () { _Game_Message_initialize.apply(this, arguments); this.clearSkipInfo(); this._autoClearSkipSwitch = getParamNumber(['ResetOnEndSwitch', '終了解除スイッチID']); }; Game_Message.prototype.toggleSkip = function () { this.setSkipFlg(!this._skipFlg); }; Game_Message.prototype.toggleAuto = function () { this.setAutoFlg(!this._autoFlg); }; Game_Message.prototype.skipFlg = function () { return this._skipFlg; }; Game_Message.prototype.autoFlg = function () { return this._autoFlg; }; Game_Message.prototype.setSkipFlg = function (value) { this._skipFlg = value; if (this._skipFlg) this._autoFlg = false; }; Game_Message.prototype.setAutoFlg = function (value) { if (!this._skipFlg) { this._autoFlg = value; } }; Game_Message.prototype.clearSkipInfo = function () { this._skipFlg = false; this._autoFlg = false; }; Game_Message.prototype.terminateEvent = function () { if (!this._autoClearSkipSwitch || $gameSwitches.value(this._autoClearSkipSwitch)) { this.clearSkipInfo(); } }; //============================================================================= // Game_Interpreter // マップイベント終了時にメッセージスキップフラグを初期化します。 //============================================================================= var _Game_Interpreter_terminate = Game_Interpreter.prototype.terminate; Game_Interpreter.prototype.terminate = function () { _Game_Interpreter_terminate.apply(this, arguments); if (this.isNeedClearSkip()) { $gameMessage.terminateEvent(); } }; Game_Interpreter.prototype.isNeedClearSkip = function () { return ($gameMap.isMapInterpreterOf(this) || !$gameMap.isEventRunning()) && this._depth === 0; }; //============================================================================= // Game_Map // 指定されたインタプリタがマップイベントかどうかを返します。 //============================================================================= Game_Map.prototype.isMapInterpreterOf = function (interpreter) { return this._interpreter === interpreter; }; //============================================================================= // Window_Message // メッセージスキップ状態を描画します。 //============================================================================= var _Window_Message_initialize = Window_Message.prototype.initialize; Window_Message.prototype.initialize = function () { _Window_Message_initialize.apply(this, arguments); this.createSpriteFrame(); this.createSpriteSkipButton(); this.createSpriteAutoButton(); this.createSpriteSwitchButton(); }; Window_Message.prototype.createSpriteFrame = function () { this._icon = new Sprite_Frame(ImageManager.loadSystem('IconSet'), -1); this.addChild(this._icon); this.updatePlacementIcon(); }; Window_Message.prototype.updatePlacementIcon = function () { this._icon.x = (paramIconX ? paramIconX - this.x : this.width - this._icon.width); this._icon.y = (paramIconY ? paramIconY - this.y : this.height - this._icon.height); }; Window_Message.prototype.createSpriteSkipButton = function () { if (!paramSkipPicture) return; this._skipButton = new Sprite_MessageButton(paramSkipPicture); this.addChild(this._skipButton); }; var _Window_Message_areSettingsChanged = Window_Message.prototype.areSettingsChanged; Window_Message.prototype.areSettingsChanged = function () { var result = _Window_Message_areSettingsChanged.apply(this, arguments); if ($gameMessage.skipFlg()) { return this._positionType !== $gameMessage.positionType(); } else { return result; } }; Window_Message.prototype.createSpriteAutoButton = function () { if (!paramAutoPicture) return; this._autoButton = new Sprite_MessageButton(paramAutoPicture); this.addChild(this._autoButton); }; Window_Message.prototype.createSpriteSwitchButton = function () { if (!paramSwitchPicture) return; this._switchButton = new Sprite_MessageButton(paramSwitchPicture); this.addChild(this._switchButton); }; Window_Message.prototype.getRelativeButtonX = function (originalX) { if (paramPictureAnchor === 1 || paramPictureAnchor === 3) { originalX += this.width; } if (paramPicturePosType === 'absolute') { originalX -= this.x; } return originalX; }; Window_Message.prototype.getRelativeButtonY = function (originalY) { if (paramPictureAnchor === 2 || paramPictureAnchor === 3) { originalY += this.height; } if (paramPicturePosType === 'absolute') { originalY -= this.y; } return originalY; }; var _Window_Message_startMessage = Window_Message.prototype.startMessage; Window_Message.prototype.startMessage = function () { _Window_Message_startMessage.apply(this, arguments); this.initializeMessageAutoCount(); }; Window_Message.prototype.initializeMessageAutoCount = function () { var textSize = 0; if (this._textState) { var index = this._textState.index; var text = this._textState.text; while (text[index] && !(text[index] === '\x1b' && text[index + 1] === '!')) { index++; } // use in eval textSize = index - this._textState.index; } var paramValue = convertEscapeCharacters(getParamString(['AutoWaitFrame', 'オート待機フレーム'])) || 1; this._messageAutoCount = eval(paramValue); }; var _Window_Message_update = Window_Message.prototype.update; Window_Message.prototype.update = function () { this.updateAutoIcon(); return _Window_Message_update.apply(this, arguments); }; var _Window_Message_updatePlacement = Window_Message.prototype.updatePlacement; Window_Message.prototype.updatePlacement = function () { _Window_Message_updatePlacement.apply(this, arguments); if (this._skipButton) { this.updateSkipButtonPlacement(); } if (this._autoButton) { this.updateAutoButtonPlacement(); } if (this._switchButton) { this.updateSwitchButtonPlacement(); } }; Window_Message.prototype.updateSkipButtonPlacement = function () { var x = this.getRelativeButtonX(paramSkipPictureX); var y = this.getRelativeButtonY(paramSkipPictureY); this._skipButton.move(x, y); }; Window_Message.prototype.updateAutoButtonPlacement = function () { var x = this.getRelativeButtonX(paramAutoPictureX); var y = this.getRelativeButtonY(paramAutoPictureY); this._autoButton.move(x, y); }; Window_Message.prototype.updateSwitchButtonPlacement = function () { var x = this.getRelativeButtonX(paramSwitchPictureX); var y = this.getRelativeButtonY(paramSwitchPictureY); this._switchButton.move(x, y); }; Window_Message.prototype.updateAutoIcon = function () { if (this.messageSkip() && this.openness === 255) { this._icon.refresh(getParamNumber(['SkipIcon', 'スキップアイコン'])); this._icon.flashSpeed = 16; this._icon.flash = true; this.updatePlacementIcon(); } else if (this.messageAuto() && this.openness === 255) { this._icon.refresh(getParamNumber(['AutoIcon', 'オートアイコン'])); this._icon.flashSpeed = 2; this._icon.flash = true; this.updatePlacementIcon(); } else { this._icon.refresh(0); this._icon.flash = false; } }; var _Window_Message_updateWait = Window_Message.prototype.updateWait; Window_Message.prototype.updateWait = function () { this.updateSkipAuto(); this.updateSwitchPicture(); if (this.messageSkip()) { this._waitCount = 0; } return _Window_Message_updateWait.apply(this, arguments); }; Window_Message.prototype.updateSkipAuto = function () { if (this.isClosed()) return; if (this.isAnySubWindowActive()) { $gameMessage.clearSkipInfo(); } else { this.setSkipAutoFlagByTrigger(); this.setSkipAutoFlagBySwitch(); } this.updateSkipForSkipAlreadyReadMessage(); }; Window_Message.prototype.updateSwitchPicture = function () { if (this.isTriggeredMessageSwitchButton()) { $gameSwitches.setValue(paramSwitchPictureTrigger, true); } }; Window_Message.prototype.setSkipAutoFlagByTrigger = function () { if (this.isTriggeredMessageSkip()) { if (!paramPressingSkip) { $gameMessage.toggleSkip(); } this._pressSkipStop = false; } else if (this.isTriggeredMessageSkipButton()) { $gameMessage.toggleSkip(); this._pressSkipStop = true; } else if (this.isTriggeredMessageAuto()) { $gameMessage.toggleAuto(); } else if (paramPressingSkip && !this._pressSkipStop) { $gameMessage.setSkipFlg(this.isPressedMessageSkip()); } }; Window_Message.prototype.setSkipAutoFlagBySwitch = function () { if (paramInvalidSwitchId > 0 && $gameSwitches.value(paramInvalidSwitchId)) { $gameMessage.setSkipFlg(false); $gameMessage.setAutoFlg(false); return; } if (paramSkipSwitchId > 0) { $gameMessage.setSkipFlg($gameSwitches.value(paramSkipSwitchId)); } if (paramAutoSwitchIId > 0) { $gameMessage.setAutoFlg($gameSwitches.value(paramAutoSwitchIId)); } }; // for SkipAlreadyReadMessage.js Window_Message.prototype.updateSkipForSkipAlreadyReadMessage = function () { var pluginName = 'SkipAlreadyReadMessage'; if ($gameMessage[pluginName] && !$gameMessage[pluginName].already_read) { $gameMessage.setSkipFlg(false); } }; Window_Message.prototype.messageAuto = function () { return $gameMessage.autoFlg(); }; Window_Message.prototype.messageSkip = function () { return $gameMessage.skipFlg(); }; var _Window_Message_updateInput = Window_Message.prototype.updateInput; Window_Message.prototype.updateInput = function () { if (this.messageAuto() && this._messageAutoCount > 0 && this.visible) this._messageAutoCount--; return _Window_Message_updateInput.apply(this, arguments); }; Window_Message.prototype.isTriggeredMessageSkip = function () { return Input.isTriggered('messageSkip') || Input.isTriggered(skipKeyName); }; Window_Message.prototype.isPressedMessageSkip = function () { return Input.isPressed('messageSkip') || Input.isPressed(skipKeyName); }; Window_Message.prototype.isTriggeredMessageSkipButton = function (pressed) { return this.isTriggeredButton(this._skipButton, pressed); }; Window_Message.prototype.isTriggeredMessageAuto = function () { return Input.isTriggered('messageAuto') || Input.isTriggered(autoKeyName) || this.isTriggeredMessageAutoButton(); }; Window_Message.prototype.isTriggeredMessageAutoButton = function () { return this.isTriggeredButton(this._autoButton, false); }; Window_Message.prototype.isTriggeredMessageSwitchButton = function () { return this.isTriggeredButton(this._switchButton, false); }; Window_Message.prototype.isTriggeredButton = function (button, pressed) { if (!button) { return false; } var x = this.canvasToLocalX(TouchInput.x); var y = this.canvasToLocalY(TouchInput.y); return button.isTriggered(x, y, pressed); }; var _Window_Message_isTriggered = Window_Message.prototype.isTriggered; Window_Message.prototype.isTriggered = function () { if (this.isTriggeredAnyButton()) { return false; } if (this.messageAuto() && this._messageAutoCount <= 0) { if (!AudioManager.isExistVoice()) { this.initializeMessageAutoCount(); return true; } } return _Window_Message_isTriggered.apply(this, arguments) || this.messageSkip(); }; Window_Message.prototype.isTriggeredAnyButton = function () { return this.isTriggeredMessageSkipButton() || this.isTriggeredMessageAutoButton() || this.isTriggeredMessageSwitchButton(); }; var _Window_Message_startPause = Window_Message.prototype.startPause; Window_Message.prototype.startPause = function () { _Window_Message_startPause.apply(this, arguments); if (this.messageSkip()) this.startWait(2); }; AudioManager.isExistVoice = function () { if (!AudioManager._voiceBuffers) { return false; } this.filterPlayingVoice(); return this._voiceBuffers.some(function (buffer) { return !buffer._sourceNode.loop; }); } //============================================================================= // Sprite_MessageButton // メッセージボタン描画用スプライトです。 //============================================================================= Sprite_MessageButton.prototype = Object.create(Sprite.prototype); Sprite_MessageButton.prototype.constructor = Sprite_MessageButton; Sprite_MessageButton.prototype.initialize = function (fileName) { Sprite.prototype.initialize.call(this); this.bitmap = ImageManager.loadPicture(fileName); this.anchor.x = 0.5; this.anchor.y = 0.5; this.visible = false; }; Sprite_MessageButton.prototype.update = function () { Sprite.prototype.update.call(this); this.updateOpacity(); this.updateVisibility(); }; Sprite_MessageButton.prototype.updateOpacity = function () { this.opacity = this.parent.openness; }; Sprite_MessageButton.prototype.updateVisibility = function () { if (paramInvalidSwitchId > 0 && $gameSwitches.value(paramInvalidSwitchId)) { this.visible = false; return; } this.visible = (!paramPictureSwitchId || $gameSwitches.value(paramPictureSwitchId)); }; Sprite_MessageButton.prototype.isTriggered = function (targetX, targetY, pressed) { var realX = targetX + this._frame.width * this.anchor.x; var realY = targetY + this._frame.height * this.anchor.y; var triggeredOk = (pressed ? TouchInput.isPressed() : TouchInput.isTriggered()); return triggeredOk && this.isInSprite(realX, realY); }; Sprite_MessageButton.prototype.isInSprite = function (targetX, targetY) { return this.x <= targetX && this.x + this._frame.width >= targetX && this.y <= targetY && this.y + this._frame.height >= targetY; }; //============================================================================= // Sprite_Frame // アイコン描画用スプライトです。 //============================================================================= Sprite_Frame.prototype = Object.create(Sprite.prototype); Sprite_Frame.prototype.constructor = Sprite_Frame; Sprite_Frame.prototype.initialize = function (bitmap, index) { Sprite.prototype.initialize.call(this); bitmap.addLoadListener(function () { this._column = Math.floor(bitmap.width / Window_Base._iconWidth); this._row = Math.floor(bitmap.height / Window_Base._iconHeight); }.bind(this)); this.bitmap = bitmap; this.anchor.x = 0.5; this.anchor.y = 0.5; this.flash = false; this.flashSpeed = 2; this._flashAlpha = 0; this.refresh(index ? index : 0); }; Sprite_Frame.prototype.refresh = function (index) { if (!this.bitmap.isReady()) return; var w = Window_Base._iconWidth; var h = Window_Base._iconHeight; this.setFrame((index % this._column) * w, Math.floor(index / this._column) * h, w, h); }; Sprite_Frame.prototype.update = function () { if (this.flash) { if (this._flashAlpha <= -64) this._flashAlpha = 192; this.setBlendColor([255, 255, 255, this._flashAlpha]); this._flashAlpha -= this.flashSpeed; } }; })();
dazed/translations
www/js/plugins/MessageSkip.js
JavaScript
unknown
39,406
//============================================================================= // MessageWindowHidden.js // ---------------------------------------------------------------------------- // (C)2015 Triacontane // This software is released under the MIT License. // http://opensource.org/licenses/mit-license.php // ---------------------------------------------------------------------------- // Version // 2.3.0 2019/10/22 ウィンドウを表示状態にもどしたとき、連動ピクチャは、もともと表示していた不透明度を復元するよう仕様変更 // 2.2.0 2019/06/09 メッセージウィンドウと逆に連動して指定したピクチャの表示/非表示が自動で切り替わる機能を追加 // 2.1.0 2018/10/10 戦闘中にプラグインを無効化できる機能を追加。 // 2.0.0 2018/03/31 消去するトリガーを複数指定できる機能を追加。パラメータの指定方法を見直し。 // 1.4.0 2018/03/10 指定したスイッチがONの間はウィンドウ消去を無効化できる機能を追加 // 1.3.2 2017/08/02 ponidog_BackLog_utf8.jsとの競合を解消 // 1.3.1 2017/07/03 古いYEP_MessageCore.jsのネーム表示ウィンドウが再表示できない不具合の修正(by DarkPlasmaさま) // 1.3.0 2017/03/16 連動して非表示にできるピクチャを複数指定できる機能を追加 // 1.2.1 2017/02/07 端末依存の記述を削除 // 1.2.0 2016/01/02 メッセージウィンドウと連動して指定したピクチャの表示/非表示が自動で切り替わる機能を追加 // 1.1.0 2016/08/25 選択肢の表示中はウィンドウを非表示にできないよう仕様変更 // 1.0.4 2016/07/22 YEP_MessageCore.jsのネーム表示ウィンドウと連携する機能を追加 // 1.0.3 2016/01/24 メッセージウィンドウが表示されていないときも非表示にできてしまう現象の修正 // 1.0.2 2016/01/02 競合対策 // 1.0.1 2015/12/31 コメント追加+英語対応(仕様に変化なし) // 1.0.0 2015/12/30 初版 // ---------------------------------------------------------------------------- // [Blog] : https://triacontane.blogspot.jp/ // [Twitter]: https://twitter.com/triacontane/ // [GitHub] : https://github.com/triacontane/ //============================================================================= /*: * @plugindesc Erase message window * @author triacontane * * @param triggerButton * @desc Trigger buttons * (light_click or shift or control) * @default ["light_click"] * @type combo[] * @option light_click * @option shift * @option control * @option tab * @option pageup * @option pagedown * @option debug * * @param linkPictureNumbers * @desc Picture number of window show/hide * @default [] * @type number[] * * @param linkShowPictureNumbers * @desc Picture number of window show/hide * @default [] * @type number[] * * @param disableSwitchId * @desc 指定した番号のスイッチがONのとき、プラグインの機能が無効になります。 * @default 0 * @type switch * * @param disableInBattle * @desc trueのとき、戦闘中にプラグインの機能を無効にします。 * @default false * @type boolean * * @help Erase message window (and restore) when triggered * * This plugin is released under the MIT License. */ /*:ja * @plugindesc メッセージウィンドウ一時消去プラグイン * @author トリアコンタン * * @param triggerButton * @text ボタン名称 * @desc ウィンドウを消去するボタンです。(複数登録可能) プラグイン等で入力可能なボタンを追加した場合は直接入力 * @default ["右クリック"] * @type combo[] * @option 右クリック * @option shift * @option control * @option tab * @option pageup * @option pagedown * @option debug * * @param linkPictureNumbers * @text 連動ピクチャ番号 * @desc ウィンドウ消去時に連動して不透明度を[0]にするピクチャの番号です。 * @default [] * @type number[] * * @param linkShowPictureNumbers * @text 連動表示ピクチャ番号 * @desc ウィンドウ消去時に連動して不透明度を[255]にするピクチャの番号です。 * @default [] * @type number[] * * @param disableSwitchId * @text 無効スイッチ番号 * @desc 指定した番号のスイッチがONのとき、プラグインの機能が無効になります。 * @default 0 * @type switch * * @param disableInBattle * @text 戦闘中無効化 * @desc trueのとき、戦闘中にプラグインの機能を無効にします。 * @default false * @type boolean * * @help メッセージウィンドウを表示中に指定したボタンを押下することで * メッセージウィンドウを消去します。もう一度押すと戻ります。 * * ウィンドウ消去時に連動して不透明度を[0]にするピクチャを指定することができます。 * 背景に特定のピクチャを使用している場合などに指定してください。 * 再表示すると不透明度は、ウィンドウ非表示まえの不透明度で復元されます。 * * ver2.0.0よりパラメータの指定方法が一部変更になりました。 * 以前のバージョンを使っていた方は再設定をお願いします。 * * このプラグインにはプラグインコマンドはありません。 * * 利用規約: * 作者に無断で改変、再配布が可能で、利用形態(商用、18禁利用等) * についても制限はありません。 * このプラグインはもうあなたのものです。 */ (function () { 'use strict'; /** * Create plugin parameter. param[paramName] ex. param.commandPrefix * @param pluginName plugin name(EncounterSwitchConditions) * @returns {Object} Created parameter */ var createPluginParameter = function (pluginName) { var paramReplacer = function (key, value) { if (value === 'null') { return value; } if (value[0] === '"' && value[value.length - 1] === '"') { return value; } try { return JSON.parse(value); } catch (e) { return value; } }; var parameter = JSON.parse(JSON.stringify(PluginManager.parameters(pluginName), paramReplacer)); PluginManager.setParameters(pluginName, parameter); return parameter; }; var param = createPluginParameter('MessageWindowHidden'); //============================================================================= // Game_Picture // メッセージウィンドウの表示可否と連動します。 //============================================================================= Game_Picture.prototype.linkWithMessageWindow = function (opacity) { this._opacity = opacity; this._targetOpacity = opacity; }; //============================================================================= // Window_Message // 指定されたボタン押下時にウィンドウとサブウィンドウを非表示にします。 //============================================================================= var _Window_Message_updateWait = Window_Message.prototype.updateWait; Window_Message.prototype.updateWait = function () { if (!this.isClosed() && this.isTriggeredHidden() && !$gameMessage.isChoice()) { if (!this.isHidden()) { this.hideAllWindow(); } else { this.showAllWindow(); } } var wait = _Window_Message_updateWait.apply(this, arguments); if (this.isHidden() && this.visible) { this.hideAllWindow(); } return wait; }; Window_Message.prototype.hideAllWindow = function () { this.hide(); this.subWindows().forEach(function (subWindow) { this.hideSubWindow(subWindow); }.bind(this)); if (this.hasNameWindow() && !this.nameWindowIsSubWindow()) this.hideSubWindow(this._nameWindow); this._originalPictureOpacities = {}; this.linkPictures(0, param.linkPictureNumbers); this.linkPictures(255, param.linkShowPictureNumbers); this._hideByMessageWindowHidden = true; }; Window_Message.prototype.showAllWindow = function () { this.show(); this.subWindows().forEach(function (subWindow) { this.showSubWindow(subWindow); }.bind(this)); if (this.hasNameWindow() && !this.nameWindowIsSubWindow()) this.showSubWindow(this._nameWindow); this.linkPictures(null, param.linkShowPictureNumbers); this.linkPictures(null, param.linkPictureNumbers); this._hideByMessageWindowHidden = false; }; Window_Message.prototype.isHidden = function () { return this._hideByMessageWindowHidden; }; Window_Message.prototype.linkPictures = function (opacity, pictureNumbers) { if (!pictureNumbers) { return; } pictureNumbers.forEach(function (pictureId) { this.linkPicture(opacity, pictureId); }, this); }; Window_Message.prototype.linkPicture = function (opacity, pictureId) { var picture = $gameScreen.picture(pictureId); if (!picture) { return; } if (opacity === null) { opacity = this._originalPictureOpacities[pictureId] || 255; } else { this._originalPictureOpacities[pictureId] = picture.opacity(); } picture.linkWithMessageWindow(opacity); }; Window_Message.prototype.hideSubWindow = function (subWindow) { subWindow.prevVisible = subWindow.visible; subWindow.hide(); }; Window_Message.prototype.showSubWindow = function (subWindow) { if (subWindow.prevVisible) subWindow.show(); subWindow.prevVisible = undefined; }; Window_Message.prototype.hasNameWindow = function () { return this._nameWindow && typeof Window_NameBox !== 'undefined'; }; // 古いYEP_MessageCore.jsでは、ネーム表示ウィンドウはsubWindowsに含まれる Window_Message.prototype.nameWindowIsSubWindow = function () { return this.subWindows().filter(function (subWindow) { return subWindow === this._nameWindow; }, this).length > 0; }; Window_Message.prototype.disableWindowHidden = function () { return (param.disableSwitchId > 0 && $gameSwitches.value(param.disableSwitchId)) || (param.disableInBattle && $gameParty.inBattle()); }; Window_Message.prototype.isTriggeredHidden = function () { if (this.disableWindowHidden()) { return false; } return param.triggerButton.some(function (button) { switch (button) { case '': case '右クリック': case 'light_click': return TouchInput.isCancelled(); case 'ok': return false; default: return Input.isTriggered(button); } }); }; var _Window_Message_updateInput = Window_Message.prototype.updateInput; Window_Message.prototype.updateInput = function () { if (this.isHidden()) return true; return _Window_Message_updateInput.apply(this, arguments); }; //============================================================================= // Window_ChoiceList、Window_NumberInput、Window_EventItem // 非表示の間は更新を停止します。 //============================================================================= var _Window_ChoiceList_update = Window_ChoiceList.prototype.update; Window_ChoiceList.prototype.update = function () { if (!this.visible) return; _Window_ChoiceList_update.apply(this, arguments); }; var _Window_NumberInput_update = Window_NumberInput.prototype.update; Window_NumberInput.prototype.update = function () { if (!this.visible) return; _Window_NumberInput_update.apply(this, arguments); }; var _Window_EventItem_update = Window_EventItem.prototype.update; Window_EventItem.prototype.update = function () { if (!this.visible) return; _Window_EventItem_update.apply(this, arguments); }; })();
dazed/translations
www/js/plugins/MessageWindowHidden.js
JavaScript
unknown
12,522
//============================================================================= // MessageWindowPopup.js // ---------------------------------------------------------------------------- // (C) 2016 Triacontane // This software is released under the MIT License. // http://opensource.org/licenses/mit-license.php // ---------------------------------------------------------------------------- // Version // 2.14.9 2019/12/27 StandPictureEC.jsおよびMessageAlignmentEC.jsと組み合わせた場合に発生する競合を修正 // 2.14.8 2019/12/27 2.14.7の修正で一部制御文字を使用するとウィンドウ幅の計算が正しく行われない問題を修正 // 2.14.7 2019/12/22 不明な制御文字が挿入されたとき、ウィンドウの横幅が拡張されないよう修正 // StandPictureEC.jsでピクチャを表示したとき、初回のみポップアップウィンドウの座標が反映されない競合を修正 // 2.14.6 2019/12/07 YEP_MessageCore.jsでネームボックスを表示する際、同プラグインの位置調整が反映されない競合を修正 // 2.14.5 2019/07/21 YEP_MessageCore.jsでネームボックスを表示する際、特定の条件下で一瞬だけネームボックスが不正な位置に表示される問題を修正 // 2.14.4 2019/06/23 フキダシウィンドウを無効化したときのX座標の値をデフォルトのコアスクリプトの動作に準拠するよう修正 // 2.14.3 2019/06/18 MKR_MessageWindowCustom.jsとの連携で、フキダシウィンドウ有効時はフキダシの横幅と高さを優先するよう変更 // 2.14.2 2019/06/16 FTKR_ExMessageWindow2.jsおよびPauseSignToTextEnd.jsとの連携で、フキダシウィンドウ表示時にポーズサインがはみ出してしまう競合を修正 // 2.14.1 2019/06/16 2.14.0で追加したテール画像がフキダシウィンドウ無効のときも表示されていた問題を修正 // 2.14.0 2019/06/10 テール画像を別途指定できる機能を追加 // 2.13.0 2019/05/26 PauseSignToTextEnd.jsと完全に組み合わせて使用できるよう修正 // 2.12.2 2019/04/14 フキダシウィンドウをキャラクター下に表示した際、Y座標の位置調整が効かなくなる問題を修正 // 2.12.1 2019/02/07 GraphicalDesignMode.jsと併用し、かつフキダシウィンドウ無効時、カスタマイズしたウィンドウの横幅が反映されるよう修正 // 2.12.0 2019/10/21 フキダシウィンドウの表示位置の上限と下限を設定できる機能を追加 // フキダシウィンドウを画面上の任意の位置に表示できる機能を追加 // 2.11.2 2018/11/26 ポップアップ用のウィンドウスキン設定後、ポップアップを解除してもスキンがそのままになってしまう場合がある問題を修正 // 2.11.1 2018/11/26 MPP_MessageEX.jsとの競合を解消(ネームウィンドウの表示不整合) // 2.11.0 2018/11/11 ポップアップウィンドウの横幅と高さの最小値を変数から取得できる機能を追加 // 2.10.2 2018/11/07 ポップアップ用のウィンドウスキン設定後、メニューを開くか場所移動すると設定が戻ってしまう問題を修正 // 2.10.1 2018/06/15 ウィンドウ連携が有効かつ、フキダシウィンドウを1回も表示していない場合に選択肢ウィンドウが見えなくなる問題を修正 // 2.10.0 2018/05/20 ポーズサインのテール化機能を使わない設定を追加しました。 // 2.9.8 2018/03/19 プラグインを未適用の状態でセーブしたデータをロードするとエラーになる現象を修正 // 2.9.7 2018/01/30 BetweenCharacters.jsとの競合を解消 // 2.9.6 2018/01/15 MPP_MessageEX.jsとの競合を解消、パラメータの型指定誤りを修正、2.9.1の修正の取り込みが一部間違っていた問題を修正 // 2.9.5 2018/01/12 KMS_DebugUtil.jsとの競合を解消 // 2.9.4 2017/12/21 FTKR_ExMessageWindow2.jsとの連携で、上下にフキダシウィンドウを同時表示できるよう修正 // 2.9.3 2017/12/14 2.9.2の修正で上方向に対する調整が抜けていたのを修正 // 2.9.2 2017/12/10 フキダシ位置のY座標を調整する際にテール画像が表示されるように微調整 // 2.9.1 2017/12/07 フキダシ表示を無効化後、メッセージの表示をする前に選択肢を表示すると位置がおかしくなる問題を修正(by 奏ねこまさん) // 2.9.0 2017/10/18 AltWindowFrame.jsとの競合を解消してMADOと連携できるようになりました。 // 2.8.1 2017/08/14 ウィンドウの振動時間を設定できる機能を追加 // 2.8.0 2017/08/14 ウィンドウを振動させる機能を追加 // パラメータの型指定機能に対応 // 2.7.0 2017/06/24 フキダシ位置を設定する機能で、イベント名で指定できる機能を追加 // フキダシ有効化時にウィンドウ位置を設定できる機能を追加 // 2.6.0 2017/06/21 ウィンドウが画面外に出ないように調整するパラメータを追加 // フキダシの位置固定をイベントごとに設定できる機能で、イベント名で指定できる機能を追加 // 2.5.1 2017/06/11 DP_MapZoom.js以外のマップズーム機能に対してフキダシ位置が正しく表示されていなかった問題を修正 // 2.5.0 2017/06/05 マップズームに対してフキダシ位置が正しく表示されるよう対応 // フキダシの位置固定をイベントごとに設定できる機能を追加 // 2.4.1 2017/05/28 ウィンドウスキンを変更した直後の文字色のみ変更前の文字色になってしまう問題を修正(by 奏ねこまさん) // 2行目以降の文字サイズを変更したときにウィンドウの高さが正しく計算されない問題を修正 // 2.4.0 2017/05/16 並列実行のコモンイベントで「MWP_VALID 0」を実行したときに、実行中のマップイベントを対象とするよう修正 // 2.3.2 2017/05/25 「FTKR_ExMessageWindow2.js」の連携機能の修正(byフトコロ) // ウィンドウを閉じた時にフキダシ無効化をする対象を、指定していたウィンドウIDのみに変更 // フキダシ無効化コマンドにウィンドウIDを指定する機能追加 // 場所移動時にすべてのウィンドウIDのフキダシ無効化処理を追加 // プラグインパラメータ[自動設定]をOFFに設定した場合、イベント起動時にフキダシ無効化する対象をウィンドウID0だけに変更 // 2.3.1 2017/05/14 「FTKR_ExMessageWindow2.js」の連携機能の修正(byフトコロ) // ポップアップの初期化および、ポップアップ無効時の文章の表示位置の不具合修正 // フキダシ有効化コマンドにウィンドウIDを指定する機能追加 // 2.3.0 2017/05/01 フトコロさんの「FTKR_ExMessageWindow2.js」と連携してフキダシを複数表示できる機能を追加(byフトコロさん) // 2.2.0 2017/04/20 選択肢および数値ウィンドウをテール画像の右側に表示できるプラグインコマンドを追加 // 2.1.0 2017/02/21 フキダシウィンドウ内で制御文字「\{」「\}」を指定したときの上限、下限、増減幅を設定できる機能を追加 // 2.0.5 2017/01/23 ウィンドウスキンを変更しているデータをロード直後にフキダシメッセージを表示すると // 文字が黒くなってしまう問題を修正 // 2.0.4 2016/12/25 ウィンドウを閉じている最中にウィンドウ表示位置を変更するプラグインコマンドを実行すると、 // 一瞬だけ空ウィンドウが表示される問題を修正 // 2.0.3 2016/10/22 デフォルト以外で制御文字と見なされる記述(\aaa[333]や\d<test>)を枠幅の計算から除外するよう修正 // 2.0.2 2016/09/29 キャラクターの位置によってはネームポップが一部見切れてしまう現象を修正 // 2.0.1 2016/08/25 フォントサイズを\{で変更して\}で戻さなかった場合の文字サイズがおかしくなっていた現象を修正 // 2.0.0 2016/08/22 本体v1.3.0によりウィンドウ透過の実装が変更されたので対応 // 1.3.3 2016/07/02 ポップアップ有効時は選択肢の最大表示数が8になるよう修正 // 1.3.2 2016/06/02 YEP_MessageCore.jsとのウィンドウ位置に関する競合を解消 // 1.3.1 2016/05/25 フォロワーにフキダシを表示できる機能を追加 // 1.3.0 2016/03/21 ウィンドウの表示位置をキャラクターの高さに合わせて自動調整するよう修正 // ポップアップウィンドウ専用のウィンドウスキンを使用する機能を追加 // 位置とサイズを微調整する機能を追加 // 選択肢と数値入力ウィンドウの表示方法を2種類追加 // 1.2.3 2016/02/23 YEP_MessageCore.jsより上に配置した場合に発生するエラーを修正 // (正常に動作しない点はそのままです) // 1.2.2 2016/02/20 YEP_MessageCore.js最新版に対応 // 1.2.1 2016/02/20 YEP_MessageCore.jsのネームポップをポップアップウィンドウと連動するよう対応 // 1.2.0 2016/02/13 並列処理のイベントが存在するときにポップアップ設定がクリアされてしまう // 問題の修正 // ウィンドウの表示位置を下に表示できる設定を追加 // 1.1.3 2016/02/04 イベント終了時にポップアップ設定をクリアするよう修正 // 1.1.2 2016/01/31 行間を調整できる機能を追加 // 1.1.1 2016/01/30 選択肢と数値入力ウィンドウをポップアップと連携するよう修正 // その他微調整と軽微な表示不良修正 // 1.1.0 2016/01/29 高確率で競合するバグを修正 // ポップアップウィンドウがキャラクターの移動に追従するよう修正 // 顔グラフィックが見切れないよう修正 // 実行中のイベントをポップアップ対象にできる機能を追加(0を指定) // 英語対応 // 1.0.0 2016/01/28 初版 // ---------------------------------------------------------------------------- // [Blog] : https://triacontane.blogspot.jp/ // [Twitter]: https://twitter.com/triacontane/ // [GitHub] : https://github.com/triacontane/ //============================================================================= /*: * @plugindesc Popup window plugin * @author triacontane * * @param FontSize * @desc Font size of popup window * @default 22 * @type number * * @param Padding * @desc Padding of popup window * @default 10 * @type number * * @param AutoPopup * @desc Popup set when event starting(ON/OFF) * @default true * @type boolean * * @param FaceScale * @desc Scale of face graphic of popup window(1-100%) * @default 75 * @type number * * @param WindowLinkage * @desc Select window and Number input window is linkage with popup window(ON/OFF) * @default true * @type boolean * * @param BetweenLines * @desc Between the Lines * @default 4 * @type number * * @param ThroughWindow * @desc Window through if overlap windows(ON/OFF) * @default false * @type boolean * * @param FontSizeRange * @desc フキダシウィンドウで制御文字「\{」「\}」を使用した場合のフォントサイズの増減幅です。デフォルトは12です。 * @default 12 * @type number * * @param FontUpperLimit * @desc フキダシウィンドウで制御文字「\{」「\}」を使用した場合のフォントサイズの上限値です。デフォルトは96です。 * @default 96 * @type number * * @param FontLowerLimit * @desc フキダシウィンドウで制御文字「\{」「\}」を使用した場合のフォントサイズの下限値です。デフォルトは24です。 * @default 24 * @type number * * @param InnerScreen * @desc 横方向だけでなく縦方向についても画面内にフキダシウィンドウが収まるように位置を調整します。 * @default false * @type boolean * * @param ShakeSpeed * @desc ウィンドウを振動させる際の速さです。制御文字\v[n]が利用できます。 * @default 5 * @type number * * @param ShakeDuration * @desc ウィンドウを振動させる時間(フレーム)です。制御文字\v[n]が利用できます。0を指定するとずっと振動し続けます。 * @default 60 * @type number * * @param NoUseTail * @desc ポーズサインのテール化機能を無効化します。デフォルトの位置に表示されます。 * @default false * @type boolean * * @param MinWidthVariableId * @desc 指定した番号の変数の値が、フキダシウィンドウの横幅の最小値(単位はピクセル数)となります。 * @default 0 * @type variable * * @param MinHeightVariableId * @desc 指定した番号の変数の値が、フキダシウィンドウの高さの最小値(単位はピクセル数)となります。 * @default 0 * @type variable * * @param lowerLimitX * @desc フキダシウィンドウの下限X座標です。 * @default 0 * @type number * * @param lowerLimitY * @desc フキダシウィンドウの下限Y座標です。 * @default 0 * @type number * * @param upperLimitX * @desc フキダシウィンドウの下限X座標です。 * @default 0 * @type number * * @param upperLimitY * @desc フキダシウィンドウの下限Y座標です。 * @default 0 * @type number * * @param tailImage * @desc テールに使う画像をピクチャから指定します。 * @default * @require 1 * @dir img/system/ * @type file * * @help Change the message window from fixed to popup * * Plugin Command * * MWP_VALID [Character ID] * Popup window valid * Player:-1 Current event:0 Event:1... * ex:MWP_VALID 0 * * MWP_INVALID * Popup window invalid * ex:MWP_INVALID * * MWP_FREE 100 200 * フキダシウィンドウフリー配置 100 200 * 指定した任意の位置にフキダシウィンドウを表示します。 * * MWP_SETTING [parameter] * Popup window setting. parameter are... * POS_UPPER * Window position fixed upper. * *  POS_LOWER * Window position fixed upper. * *  POS_AUTO * Window position auto. * * SKIN [File name(/img/system/...)] * Setting window skin for popup message. * * SUB_POS_PLAYER * Choice window or NumberInput displays player. * * SUB_POS_INNER * Choice window or NumberInput displays internal message window. * * SUB_POS_NORMAL * Choice window or NumberInput displays normal position. * * MWP_ADJUST [parameter] * Popup window adjust. parameter are... * * POS [X] [Y] * Popup window adjust relative position. * *  SIZE [Width] [Height] *   Popup window adjust relative size. * * ・使用可能な制御文字 * \sh[5] # 強さ[5]でウィンドウを振動させます。 * * This plugin is released under the MIT License. */ /*:ja * @plugindesc フキダシウィンドウプラグイン * @author トリアコンタン * * @param フォントサイズ * @desc フキダシウィンドウのデフォルトフォントサイズ * 通常ウィンドウのフォントサイズ:28 * @default 22 * @type number * * @param 余白 * @desc フキダシウィンドウの余白サイズ * 通常ウィンドウの余白:18 * @default 10 * @type number * * @param 自動設定 * @desc イベント起動時にフキダシの対象が、起動したイベントに自動設定されます。(ON/OFF) * OFFの場合は通常のメッセージウィンドウに設定されます。 * @default true * @type boolean * * @param フェイス倍率 * @desc フキダシウィンドウの顔グラフィック表示倍率(1-100%) * @default 75 * @type number * * @param ウィンドウ連携 * @desc 選択肢ウィンドウと数値入力ウィンドウを * ポップアップウィンドウに連動させます。(ON/OFF) * @default true * @type boolean * * @param 行間 * @desc 行と行の間のスペースをピクセル単位で設定します。 * @default 4 * @type number * * @param ウィンドウ透過 * @desc ウィンドウが重なったときに透過表示します。(ON/OFF) * 選択肢をフキダシ内に表示する場合はONにしてください。 * @default false * @type boolean * * @param フォントサイズ増減幅 * @desc フキダシウィンドウで制御文字「\{」「\}」を使用した場合のフォントサイズの増減幅です。デフォルトは12です。 * @default 12 * @type number * * @param フォントサイズ上限 * @desc フキダシウィンドウで制御文字「\{」「\}」を使用した場合のフォントサイズの上限値です。デフォルトは96です。 * @default 96 * @type number * * @param フォントサイズ下限 * @desc フキダシウィンドウで制御文字「\{」「\}」を使用した場合のフォントサイズの下限値です。デフォルトは24です。 * @default 24 * @type number * * @param 画面内に収める * @desc 横方向だけでなく縦方向についても画面内にフキダシウィンドウが収まるように位置を調整します。 * @default false * @type boolean * * @param 振動の速さ * @desc ウィンドウを振動させる際の速さです。制御文字\v[n]が利用できます。 * @default 5 * @type number * * @param 振動時間 * @desc ウィンドウを振動させる時間(フレーム)です。制御文字\v[n]が利用できます。0を指定するとずっと振動し続けます。 * @default 60 * @type number * * @param テールを使わない * @desc ポーズサインのテール化機能を無効化します。デフォルトの位置に表示されます。 * @default false * @type boolean * * @param 最小横幅取得変数ID * @desc 指定した番号の変数の値が、フキダシウィンドウの横幅の最小値(単位はピクセル数)となります。 * @default 0 * @type variable * * @param 最小高さ取得変数ID * @desc 指定した番号の変数の値が、フキダシウィンドウの高さの最小値(単位はピクセル数)となります。 * @default 0 * @type variable * * @param lowerLimitX * @text 下限X座標 * @desc フキダシウィンドウの下限X座標です。 * @default 0 * @type number * * @param upperLimitX * @text 上限X座標 * @desc フキダシウィンドウの上限X座標です。 * @default 0 * @type number * * @param lowerLimitY * @text 下限Y座標 * @desc フキダシウィンドウの下限Y座標です。 * @default 0 * @type number * * @param upperLimitY * @text 上限Y座標 * @desc フキダシウィンドウの上限Y座標です。 * @default 0 * @type number * * @param tailImage * @text テール画像 * @desc テールに使う画像をシステム画像から指定します。 * @default * @require 1 * @dir img/system/ * @type file * * @param tailImageAdjustY * @text テール画像Y座標 * @desc テールに使う画像のY座標補正値です。 * @default 0 * @type number * @min -2000 * @max 2000 * * @help メッセージウィンドウを指定したキャラクターの頭上にフキダシで * 表示するよう変更します。 * * YEP_MessageCore.jsのネームポップと併せて使用する場合は、 * プラグイン管理画面で当プラグインをYEP_MessageCore.jsより * 下に配置してください。 * * また、FTKR_ExMessageWindow2.jsの複数メッセージウィンドウ表示と * 併せて使用する場合は、プラグイン管理画面で当プラグインを * FTKR_ExMessageWindow2.jsより下に配置してください。 * * * プラグインパラメータ[自動設定]詳細 * FTKR_ExMessageWindow2.jsと併用する場合、 * 自動設定で使用するメッセージウィンドウは、ウィンドウID0 です。 * OFFの場合、ウィンドウID0 を通常の表示方法に戻します。 * * * プラグインコマンド詳細 * イベントコマンド「プラグインコマンド」から実行。 * (パラメータの間は半角スペースで区切る) * * MWP_VALID [キャラクターID] [ウィンドウ位置] or * フキダシウィンドウ有効化 [キャラクターID] [ウィンドウ位置] *  メッセージウィンドウを指定したキャラクターIDの頭上に表示します。 *  プレイヤー : -1 このイベント : 0 指定したIDのイベント : 1 ~ *  フォロワー : -2, -3, -4 * *  ウィンドウ位置 * 0 : 自動(指定しなかった場合も含む) * 1 : キャラクターの上に表示 * 2 : キャラクターの下に表示 * * 例:MWP_VALID 0 1 *   フキダシウィンドウ有効化 3 1 * * MWP_VALID [イベント名] [ウィンドウ位置] or * フキダシウィンドウ有効化 [イベント名] [ウィンドウ位置] *  メッセージウィンドウを指定した名称と一致するイベントの頭上に表示します。 * * 例:MWP_VALID test_event 1 *   フキダシウィンドウ有効化 テストイベント 2 * * !複数メッセージウィンドウ表示を使う場合! * MWP_VALID [キャラクターID] [ウィンドウID] [ウィンドウ位置] or * フキダシウィンドウ有効化 [キャラクターID] [ウィンドウID] [ウィンドウ位置] *  指定したメッセージウィンドウIDを指定したキャラクターIDの頭上に表示するようにします。 *  プレイヤー : -1 このイベント : 0 指定したIDのイベント : 1 ~ *  フォロワー : -2, -3, -4 *  ウィンドウIDを指定しない(入力なし)場合は、ウィンドウID0を使用します。 * * 例:MWP_VALID 0 1 *   フキダシウィンドウ有効化 3 2 * * MWP_INVALID or * フキダシウィンドウ無効化 *  ウィンドウの表示方法を通常に戻します。 * * 例:MWP_INVALID *   フキダシウィンドウ無効化 * * !複数メッセージウィンドウ表示を使う場合! * MWP_INVALID [ウィンドウID] * フキダシウィンドウ無効化 [ウィンドウID] *  指定したメッセージウィンドウIDの表示方法を通常に戻します。 *  入力無しはすべてのウィンドウIDの表示方法を通常に戻します。 * * 例:MWP_INVALID 1 *   フキダシウィンドウ無効化 2 *   フキダシウィンドウ無効化 * * MWP_FREE 100 200 * フキダシウィンドウフリー配置 100 200 * 指定した任意の位置にフキダシウィンドウを表示します。 * * MWP_SETTING [設定内容] or * フキダシウィンドウ設定 [設定内容] *  フキダシウィンドウの設定を行います。設定内容に以下を入力。 * * POS_UPPER or 位置_上固定 *   ウィンドウの位置をキャラクターの上で固定します。 * * POS_UPPER 1 or 位置_上固定 1 *   イベントID[1]のみウィンドウの位置をキャラクターの上で固定します。 * * POS_UPPER aaa or 位置_上固定 aaa *   イベント名[aaa]のみウィンドウの位置をキャラクターの上で固定します。 * * POS_LOWER or 位置_下固定 *   ウィンドウの位置をキャラクターの下で固定します。 * * POS_LOWER -1 or 位置_下固定 -1 *   プレイヤーのみウィンドウの位置をキャラクターの下で固定します。 * * POS_LOWER aaa or 位置_下固定 aaa *   イベント名[aaa]のみウィンドウの位置をキャラクターの下で固定します。 * * POS_AUTO or 位置_自動 *   通常はキャラクターの上に表示し、ウィンドウが上に見切れる場合のみ *   下に表示します。 * * SKIN or スキン [/img/system/以下に配置するスキンのファイル名] * フキダシウィンドウ時専用のウィンドウスキンを設定します。 * * SUB_POS_PLAYER or サブ位置_プレイヤーの頭上 *  選択肢および数値入力のウィンドウをプレイヤーの頭上に表示します。 *  位置関係次第でウィンドウが被る場合があるので、必要に応じて *  ウィンドウ透過のパラメータを有効にしてください。 * * SUB_POS_INNER or サブ位置_メッセージウィンドウ内部 * 選択肢および数値入力のウィンドウをメッセージウィンドウに含めます。 * この設定を使用する場合は必ずウィンドウ透過のパラメータを * 有効にしてください。 * * SUB_POS_NORMAL or サブ位置_通常 *  選択肢および数値入力のウィンドウをフキダシウィンドウの下に表示します。 *  特に設定を変更しない場合はこの設定になります。 * * SUB_POS_RIGHT or サブ位置_右 *  選択肢および数値入力のウィンドウをフキダシウィンドウのテール部分の *  右側に表示します。 * * 例:MWP_SETTING POS_UPPER *   フキダシウィンドウ設定 位置_自動 *   MWP_SETTING SKIN window2 *   フキダシウィンドウ設定 サブ位置_プレイヤーの頭上 * * MWP_ADJUST [設定内容] or * フキダシウィンドウ調整 [設定内容] *  フキダシウィンドウの表示位置やサイズを微調整します。設定内容に以下を入力。 * *  POS or 位置 [X座標] [Y座標] *   ウィンドウのX座標とY座標を調整します。指定するのは元の座標からの相対です。 * *  SIZE or サイズ [横幅] [高さ] *   ウィンドウの横幅と高さを調整します。指定するのは元のサイズからの相対です。 * * 例:MWP_ADJUST POS 5 -3 *   フキダシウィンドウ調整 サイズ 20 -40 * * !複数メッセージウィンドウ表示を使う場合! * フキダシウィンドウの設定や表示位置、サイズの調整結果は * すべてのウィンドウIDで共通です。 * * ・使用可能な制御文字 * \sh[5] # 強さ[5]でウィンドウを振動させます。 * * 利用規約: * 作者に無断で改変、再配布が可能で、利用形態(商用、18禁利用等) * についても制限はありません。 * このプラグインはもうあなたのものです。 */ (function () { 'use strict'; var pluginName = 'MessageWindowPopup'; var checkTypeFunction = function (value) { return checkType(value, 'Function'); }; var checkType = function (value, typeName) { return Object.prototype.toString.call(value).slice(8, -1) === typeName; }; var getParamNumber = function (paramNames, min, max) { var value = getParamString(paramNames); if (arguments.length < 2) min = -Infinity; if (arguments.length < 3) max = Infinity; return (parseInt(value) || 0).clamp(min, max); }; var getParamBoolean = function (paramNames) { var value = getParamString(paramNames); return (value || '').toUpperCase() === 'ON' || (value || '').toUpperCase() === 'TRUE'; }; var getParamString = function (paramNames) { if (!Array.isArray(paramNames)) paramNames = [paramNames]; for (var i = 0; i < paramNames.length; i++) { var name = PluginManager.parameters(pluginName)[paramNames[i]]; if (name) return name; } return null; }; var getArgNumber = function (arg, min, max) { if (arguments.length <= 2) min = -Infinity; if (arguments.length <= 3) max = Infinity; return (parseInt(convertEscapeCharacters(arg)) || 0).clamp(min, max); }; var getArgString = function (arg, upperFlg) { arg = convertEscapeCharacters(arg); return upperFlg ? arg.toUpperCase() : arg; }; var getCommandName = function (command) { return (command || '').toUpperCase(); }; var convertEscapeCharacters = function (text) { if (text == null) text = ''; var window = SceneManager._scene._windowLayer.children[0]; return window ? window.convertEscapeCharacters(text) : text; }; //FTKR_ExMessageWindow2.jsを使用しているか var imported_FTKR_EMW = function () { return typeof Imported !== 'undefined' && Imported.FTKR_EMW; }; var isExistPlugin = function (pluginName) { return Object.keys(PluginManager.parameters(pluginName)).length > 0; }; //============================================================================= // パラメータのバリデーション //============================================================================= var paramThroughWindow = getParamBoolean(['ThroughWindow', 'ウィンドウ透過']); var paramFaceScale = getParamNumber(['FaceScale', 'フェイス倍率'], 1, 100); var paramFontSize = getParamNumber(['FontSize', 'フォントサイズ'], 1); var paramPadding = getParamNumber(['Padding', '余白'], 1); var paramLinkage = getParamBoolean(['WindowLinkage', 'ウィンドウ連携']); var paramBetweenLines = getParamNumber(['BetweenLines', '行間'], 0); var paramAutoPopup = getParamBoolean(['AutoPopup', '自動設定']); var paramFontSizeRange = getParamNumber(['FontSizeRange', 'フォントサイズ増減幅'], 0); var paramFontUpperLimit = getParamNumber(['FontUpperLimit', 'フォントサイズ上限'], 0); var paramFontLowerLimit = getParamNumber(['FontLowerLimit', 'フォントサイズ下限'], 0); var paramInnerScreen = getParamBoolean(['InnerScreen', '画面内に収める']); var paramShakeSpeed = getParamString(['ShakeSpeed', '振動の速さ']); var paramShakeDuration = getParamString(['ShakeDuration', '振動時間']); var paramNoUseTail = getParamBoolean(['NoUseTail', 'テールを使わない']); var paramMinWidthVariableId = getParamNumber(['MinWidthVariableId', '最小横幅取得変数ID']); var paramMinHeightVariableId = getParamNumber(['MinHeightVariableId', '最小高さ取得変数ID']); var paramLowerLimitX = getParamNumber(['lowerLimitX']); var paramUpperLimitX = getParamNumber(['upperLimitX']); var paramLowerLimitY = getParamNumber(['lowerLimitY']); var paramUpperLimitY = getParamNumber(['upperLimitY']); var paramTailImage = getParamString(['tailImage']); var paramTailImageAdjustY = getParamNumber(['tailImageAdjustY']); //============================================================================= // Game_Interpreter // プラグインコマンドを追加定義します。 //============================================================================= var _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand; Game_Interpreter.prototype.pluginCommand = function (command, args) { _Game_Interpreter_pluginCommand.apply(this, arguments); this.pluginCommandMessageWindowPopup(command, args); }; Game_Interpreter.prototype.pluginCommandMessageWindowPopup = function (command, args) { switch (getCommandName(command)) { case 'MWP_VALID': case 'フキダシウィンドウ有効化': $gameSystem.clearMessagePopupFree(); var eventId = this.getEventIdForMessagePopup(args[0]); if (isNaN(eventId)) { eventId = this.getEventIdFromEventName(eventId); } $gameSystem.setMessagePopup(eventId); var windowPosition; if (imported_FTKR_EMW() && args[1]) { var windowId = getArgNumber(args[1]); if (windowId >= 0) $gameSystem.setMessagePopupEx(windowId, eventId); windowPosition = getArgNumber(args[2]); } else { windowPosition = getArgNumber(args[1]); } if (windowPosition === 1) { $gameSystem.setPopupFixUpper(eventId); } else if (windowPosition === 2) { $gameSystem.setPopupFixLower(eventId); } break; case 'MWP_FREE': case 'フキダシウィンドウフリー配置': var x = getArgNumber(args[0]) || 0; var y = getArgNumber(args[1]) || 0; $gameSystem.setMessagePopupFree(x, y); break; case 'MWP_INVALID': case 'フキダシウィンドウ無効化': $gameSystem.clearMessagePopupFree(); if (imported_FTKR_EMW() && args[0]) { var windowId2 = getArgNumber(args[0]); if (windowId2 >= 0) $gameSystem.clearMessagePopupEx(windowId2); } else { $gameSystem.clearMessagePopup(); } break; case 'MWP_SETTING': case 'フキダシウィンドウ設定': switch (getCommandName(args[0])) { case 'POS_UPPER': case '位置_上固定': $gameSystem.setPopupFixUpper(args[1] ? this.getEventIdForMessagePopup(args[1]) : null); break; case 'POS_LOWER': case '位置_下固定': $gameSystem.setPopupFixLower(args[1] ? this.getEventIdForMessagePopup(args[1]) : null); break; case 'POS_AUTO': case '位置_自動': $gameSystem.setPopupAuto(args[1] ? this.getEventIdForMessagePopup(args[1]) : null); break; case 'SKIN': case 'スキン': $gameSystem.setPopupWindowSkin(getArgString(args[1])); this.setWaitMode('image'); break; case 'SUB_POS_NORMAL': case 'サブ位置_通常': $gameSystem.setPopupSubWindowPosition(0); break; case 'SUB_POS_PLAYER': case 'サブ位置_プレイヤーの頭上': $gameSystem.setPopupSubWindowPosition(1); break; case 'SUB_POS_INNER': case 'サブ位置_メッセージウィンドウ内部': $gameSystem.setPopupSubWindowPosition(2); break; case 'SUB_POS_RIGHT': case 'サブ位置_右': $gameSystem.setPopupSubWindowPosition(3); break; } break; case 'MWP_ADJUST': case 'フキダシウィンドウ調整': switch (getCommandName(args[0])) { case 'SIZE': case 'サイズ': $gameSystem.setPopupAdjustSize(getArgNumber(args[1]), getArgNumber(args[2])); break; case 'POS': case '位置': $gameSystem.setPopupAdjustPosition(getArgNumber(args[1]), getArgNumber(args[2])); break; } break; } }; Game_Interpreter.prototype.getEventIdForMessagePopup = function (arg) { var convertedArg = convertEscapeCharacters(arg); var eventId = parseInt(convertedArg); if (isNaN(eventId)) { return convertedArg; } if (eventId === 0) { eventId = this.eventId() || ($gameMap.isEventRunning() ? $gameMap._interpreter.eventId() : 0); } return eventId; }; Game_Interpreter.prototype.getEventIdFromEventName = function (eventName) { var eventId = 0; $gameMap.events().some(function (event) { if (event.event().name === eventName) { eventId = event.eventId(); return true; } return false; }); return eventId; }; var _Game_Interpreter_terminate = Game_Interpreter.prototype.terminate; Game_Interpreter.prototype.terminate = function () { _Game_Interpreter_terminate.apply(this, arguments); if (this._depth === 0 && this.isGameMapInterpreter()) { if (imported_FTKR_EMW()) { $gameSystem.clearMessagePopupEx(this.windowId()); } else { $gameSystem.clearMessagePopup(); } } }; Game_Interpreter.prototype.setGameMapInterpreter = function () { this._gameMapInterpreter = true; }; Game_Interpreter.prototype.isGameMapInterpreter = function () { return this._gameMapInterpreter; }; //============================================================================= // Game_System // ポップアップフラグを保持します。 //============================================================================= var _Game_System_initialize = Game_System.prototype.initialize; Game_System.prototype.initialize = function () { _Game_System_initialize.apply(this, arguments); this._messagePopupCharacterId = 0; this._messagePopupPosition = null; this._messagePopupAdjustSize = null; this._messagePopupAdjustPosition = null; this._messagePopupWindowSkin = null; this._messagePopupSubWindowPosition = 0; }; Game_System.prototype.initMessagePositionEvents = function () { if (!this._messagePopupPositionEvents) { this._messagePopupPositionEvents = []; } }; Game_System.prototype.setPopupSubWindowPosition = function (position) { this._messagePopupSubWindowPosition = position.clamp(0, 3); }; Game_System.prototype.getPopupSubWindowPosition = function () { return this._messagePopupSubWindowPosition; }; Game_System.prototype.setPopupWindowSkin = function (fileName) { this._messagePopupWindowSkin = fileName; ImageManager.loadSystem(fileName); }; Game_System.prototype.getPopupWindowSkin = function () { return this._messagePopupWindowSkin; }; Game_System.prototype.setMessagePopup = function (id) { this._messagePopupCharacterId = id; }; Game_System.prototype.clearMessagePopup = function () { this._messagePopupCharacterId = 0; this._messagePopupPositionEvents = []; }; Game_System.prototype.setMessagePopupFree = function (x, y) { this._messagePopupFreeX = x; this._messagePopupFreeY = y; this._messagePopupCharacterId = 1; }; Game_System.prototype.clearMessagePopupFree = function () { this.setMessagePopupFree(undefined, undefined); }; Game_System.prototype.getMessagePopupId = function () { return this._messagePopupCharacterId !== 0 ? this._messagePopupCharacterId : null; }; Game_System.prototype.getMessagePopupFree = function () { if (this._messagePopupFreeX === undefined || this._messagePopupFreeY === undefined) { return null; } return { x: this._messagePopupFreeX, y: this._messagePopupFreeY }; }; Game_System.prototype.setPopupFixUpper = function (characterId) { this.setPopupFixPosition(characterId, 1); }; Game_System.prototype.setPopupFixLower = function (characterId) { this.setPopupFixPosition(characterId, 2); }; Game_System.prototype.setPopupAuto = function (characterId) { this.setPopupFixPosition(characterId, 0); }; Game_System.prototype.setPopupFixPosition = function (characterId, position) { if (characterId !== null) { this.initMessagePositionEvents(); this._messagePopupPositionEvents[characterId] = position; } else { this._messagePopupPosition = position; } }; Game_System.prototype.setPopupAdjustSize = function (w, h) { this._messagePopupAdjustSize = [w, h]; }; Game_System.prototype.getPopupAdjustSize = function () { return this._messagePopupAdjustSize; }; Game_System.prototype.setPopupAdjustPosition = function (x, y) { this._messagePopupAdjustPosition = [x, y]; }; Game_System.prototype.getPopupAdjustPosition = function () { return this._messagePopupAdjustPosition; }; Game_System.prototype.isPopupFixUpper = function (eventId) { return this.isPopupFixPosition(1, eventId); }; Game_System.prototype.isPopupFixLower = function (eventId) { return this.isPopupFixPosition(2, eventId); }; Game_System.prototype.isPopupFixPosition = function (position, eventId) { var id = eventId || this._messagePopupCharacterId; this.initMessagePositionEvents(); var positionFixForId = this._messagePopupPositionEvents[id]; var event = $gameMap.event(id); var positionFixForName = event ? this._messagePopupPositionEvents[event.event().name] : 0; if (positionFixForId > 0) { return positionFixForId === position; } else if (positionFixForName > 0) { return positionFixForName === position; } else { return this._messagePopupPosition === position; } }; //============================================================================= // Game_Map // イベント起動時に自動設定を適用します。 //============================================================================= var _Game_Map_setupStartingMapEvent = Game_Map.prototype.setupStartingMapEvent; Game_Map.prototype.setupStartingMapEvent = function () { var result = _Game_Map_setupStartingMapEvent.apply(this, arguments); if (result) { if (paramAutoPopup) { $gameSystem.setMessagePopup(this._interpreter.eventId()); } else if (imported_FTKR_EMW()) { $gameSystem.clearMessagePopupEx(0); } else { $gameSystem.clearMessagePopup(); } } return result; }; var _Game_Map_setup = Game_Map.prototype.setup; Game_Map.prototype.setup = function (mapId) { _Game_Map_setup.apply(this, arguments); this._interpreter.setGameMapInterpreter(); }; //============================================================================= // Game_Troop // 戦闘開始時にポップアップフラグを解除します。 //============================================================================= var _Game_Troop_setup = Game_Troop.prototype.setup; Game_Troop.prototype.setup = function (troopId) { _Game_Troop_setup.apply(this, arguments); $gameSystem.clearMessagePopup(); }; //============================================================================= // Game_CharacterBase // キャラクターの高さを設定します。 //============================================================================= var _Game_CharacterBase_initMembers = Game_CharacterBase.prototype.initMembers; Game_CharacterBase.prototype.initMembers = function () { _Game_CharacterBase_initMembers.apply(this, arguments); this.setSizeForMessagePopup(0, 0); }; Game_CharacterBase.prototype.setSizeForMessagePopup = function (width, height) { this._size = [width, height]; }; Game_CharacterBase.prototype.getHeightForPopup = function () { return $gameScreen.zoomScale() * this._size[1]; }; Game_CharacterBase.prototype.getRealScreenX = function () { return $gameScreen.convertRealX(this.screenX()); }; Game_CharacterBase.prototype.getRealScreenY = function () { return $gameScreen.convertRealY(this.screenY()); }; //============================================================================= // Game_Screen // 画面座標をズームを考慮した座標に変換します。 //============================================================================= Game_Screen.prototype.convertRealX = function (x) { var scale = this.zoomScale(); return scale * x - (scale - 1.0) * this.zoomX(); }; Game_Screen.prototype.convertRealY = function (y) { var scale = this.zoomScale(); return scale * y - (scale - 1.0) * this.zoomY(); }; //============================================================================= // Scene_Map // ポップアップ用のウィンドウスキンをロードします。 //============================================================================= var _Scene_Map_isReady = Scene_Map.prototype.isReady; Scene_Map.prototype.isReady = function () { var ready = _Scene_Map_isReady.apply(this, arguments); var popSkin = $gameSystem.getPopupWindowSkin(); if (popSkin && ready) { var bitmap = ImageManager.loadSystem(popSkin); return bitmap.isReady(); } return ready; }; //============================================================================= // Sprite_Character // キャラクターの高さを逆設定します。 //============================================================================= var _Sprite_Character_updateBitmap = Sprite_Character.prototype.updateBitmap; Sprite_Character.prototype.updateBitmap = function () { if (this.isImageChanged()) this._imageChange = true; _Sprite_Character_updateBitmap.apply(this, arguments); if (this._imageChange) { this.bitmap.addLoadListener(function () { var width = this.bitmap.width === 1 ? $gameMap.tileWidth() : this.patternWidth(); var height = this.bitmap.height === 1 ? $gameMap.tileHeight() : this.patternHeight(); this._character.setSizeForMessagePopup(width, height); }.bind(this)); this._imageChange = false; } }; //============================================================================= // Window_Base // 共通処理を定義します。 //============================================================================= var _Window_Base_loadWindowskin = Window_Base.prototype.loadWindowskin; Window_Base.prototype.loadWindowskin = function () { var popSkin = $gameSystem.getPopupWindowSkin(); if (this.isPopup() && popSkin) { this.windowskin = ImageManager.loadSystem(popSkin); } else { _Window_Base_loadWindowskin.apply(this, arguments); } }; Window_Base.prototype.setPauseSignToTail = function (lowerFlg) { if (lowerFlg) { this._windowPauseSignSprite.rotation = 180 * Math.PI / 180; this._windowPauseSignSprite.y = 12; this._windowPauseSignSprite.anchor.y = 0; } else { this._windowPauseSignSprite.rotation = 0; this._windowPauseSignSprite.y = this.height + 12; this._windowPauseSignSprite.anchor.y = 1; } this._pauseSignLower = lowerFlg; this._pauseSignToTail = true; }; Window_Base.prototype.setPauseSignImageToTail = function (lowerFlg) { this._windowPauseSignSprite.visible = false; if (lowerFlg) { this._messageTailImage.rotation = 180 * Math.PI / 180; this._messageTailImage.y = -paramTailImageAdjustY; this._messageTailImage.anchor.y = 0; } else { this._messageTailImage.rotation = 0; this._messageTailImage.y = this.height + paramTailImageAdjustY; this._messageTailImage.anchor.y = 0; } }; Window_Base.prototype.setPauseSignToNormal = function () { this._windowPauseSignSprite.rotation = 0; this._windowPauseSignSprite.anchor.y = 1.0; this._windowPauseSignSprite.move(this._width / 2, this._height); this._pauseSignToTail = false; }; var _Window_Base_updatePauseSign = Window_Base.prototype._updatePauseSign; Window_Base.prototype._updatePauseSign = function () { _Window_Base_updatePauseSign.apply(this, arguments); if (this._pauseSignToTail) this._windowPauseSignSprite.alpha = 1.0; }; Window_Base.prototype.isPopupLower = function () { return $gameSystem.isPopupFixLower() || (!$gameSystem.isPopupFixUpper() && this.y < 0); }; Window_Base.prototype.setPopupPosition = function (character) { this._popupCharacter = character; this._popupFreePos = $gameSystem.getMessagePopupFree(); this.setPopupBasePosition(); this.setPopupLowerPosition(); this.setPopupAdjustInnerScreen(); if (this._shakePower > 0) { this.setPopupShakePosition(); } }; Window_Base.prototype.getPopupBaseX = function () { return this._popupFreePos ? this._popupFreePos.x : this._popupCharacter.getRealScreenX(); }; Window_Base.prototype.getPopupBaseY = function () { return this._popupFreePos ? this._popupFreePos.y : this._popupCharacter.getRealScreenY(); }; Window_Base.prototype.getHeightForPopup = function () { return this._popupFreePos ? 0 : (this._popupCharacter.getHeightForPopup() + 8); }; Window_Base.prototype.setPopupBasePosition = function () { var pos = $gameSystem.getPopupAdjustPosition(); this.x = this.getPopupBaseX() - this.width / 2 + (pos ? pos[0] : 0); this.y = this.getPopupBaseY() - this.height - this.getHeightForPopup() + (pos ? pos[1] : 0); }; Window_Base.prototype.setPopupShakePosition = function () { var duration = getArgNumber(paramShakeDuration); if (duration && this._shakeCount > duration) { this.setWindowShake(0); } var speed = getArgNumber(paramShakeSpeed, 1); var position = Math.sin(this._shakeCount / 10 * speed) * this._shakePower; this.x += position; this._windowPauseSignSprite.x -= position; this._messageTailImage.x -= position; this._shakeCount++; }; Window_Base.prototype.setPopupLowerPosition = function () { var lowerFlg = this.isPopupLower(); if (lowerFlg) { this.y += this.height + this.getHeightForPopup() + 8; } if (!paramNoUseTail && !this.isUsePauseSignTextEnd()) { this.setPauseSignToTail(lowerFlg); } if (paramTailImage) { this.setPauseSignImageToTail(lowerFlg); } }; Window_Base.prototype.setPopupAdjustInnerScreen = function () { if (paramInnerScreen) { this.adjustPopupPositionY(); } var adjustResultX = this.adjustPopupPositionX(); var tailX = this._width / 2 + adjustResultX; if (!this.isUsePauseSignTextEnd()) { this._windowPauseSignSprite.x = tailX } this._messageTailImage.x = tailX; }; Window_Base.prototype.setWindowShake = function (power) { this._shakePower = power; this._shakeCount = 0; }; Window_Base.prototype.adjustPopupPositionX = function () { var deltaX = 0; var minX = paramLowerLimitX || 0; var maxX = paramUpperLimitX || Graphics.boxWidth; if (this.x < minX) { deltaX = this.x - minX; this.x = minX; } if (this.x + this.width > maxX) { deltaX = this.x + this.width - maxX; this.x = maxX - this.width; } return deltaX; }; Window_Base.prototype.adjustPopupPositionY = function () { var minY = (this._pauseSignLower ? this._windowPauseSignSprite.height / 2 : 0); minY += paramLowerLimitY || 0; if (this.y < minY) { this.y = minY; } var maxY = (paramUpperLimitY || Graphics.boxHeight) - this._windowPauseSignSprite.height / 2; if (this.y + this.height > maxY) { this.y = maxY - this.height; } }; Window_Base.prototype.updatePlacementPopup = function () { if (!this._messageWindow) return; if (paramLinkage) { switch ($gameSystem.getPopupSubWindowPosition()) { case 0: this.x = this._messageWindow.x; this.y = this._messageWindow.y + this._messageWindow.height; this.setPauseSignToNormal(); break; case 1: this.setPopupPosition($gamePlayer); break; case 2: var pos = this._messageWindow.getSubWindowPosition(); this.x = pos.x; this.y = pos.y; this.setPauseSignToNormal(); this.opacity = 0; break; case 3: this.x = this._messageWindow.x + this._messageWindow.width / 2 + 16; this.y = this._messageWindow.y + this._messageWindow.height; this.setPauseSignToNormal(); break; } } else { this.y = Graphics.boxHeight - this.height - this._messageWindow.windowHeight() / 2; } }; Window_Base.prototype.isPopup = function () { return false; }; Window_Base.prototype.isPopupLinkage = function () { return this.isPopup() && paramLinkage; }; Window_Base.prototype.resetLayout = function () { this.padding = this.standardPadding(); this.width = this.windowWidth(); this.height = this.windowHeight(); this.loadWindowskin(); this.setPauseSignToNormal(); }; var _Window_Base_makeFontBigger = Window_Base.prototype.makeFontBigger; Window_Base.prototype.makeFontBigger = function () { if (this.isValidFontRangeForPopup()) { if (this.contents.fontSize <= paramFontUpperLimit) { this.contents.fontSize += paramFontSizeRange; } } else { _Window_Base_makeFontBigger.apply(this, arguments); } }; var _Window_Base_makeFontSmaller = Window_Base.prototype.makeFontSmaller; Window_Base.prototype.makeFontSmaller = function () { if (this.isValidFontRangeForPopup()) { if (this.contents.fontSize >= paramFontLowerLimit) { this.contents.fontSize -= paramFontSizeRange; } } else { _Window_Base_makeFontSmaller.apply(this, arguments); } }; Window_Base.prototype.isValidFontRangeForPopup = function () { return this.isPopup() && paramFontSizeRange > 0; }; Window_Base.prototype.isUsePauseSignTextEnd = function () { return this.isValidPauseSignTextEnd && this.isValidPauseSignTextEnd() }; //============================================================================= // Window_Message // ポップアップする場合、表示内容により座標とサイズを自動設定します。 //============================================================================= Window_Message._faceHeight = Math.floor(Window_Base._faceHeight * paramFaceScale / 100); Window_Message._faceWidth = Math.floor(Window_Base._faceWidth * paramFaceScale / 100); var _Window_Message__createAllParts = Window_Message.prototype._createAllParts; Window_Message.prototype._createAllParts = function () { _Window_Message__createAllParts.apply(this, arguments); this._messageTailImage = new Sprite(); if (paramTailImage) { this._messageTailImage.bitmap = ImageManager.loadSystem(paramTailImage); this._messageTailImage.visible = false; this._messageTailImage.anchor.x = 0.5; this.addChild(this._messageTailImage); } }; var _Window_Message_standardFontSize = Window_Message.prototype.standardFontSize; Window_Message.prototype.standardFontSize = function () { return this.isPopup() ? paramFontSize : _Window_Message_standardFontSize.apply(this, arguments); }; var _Window_Message_standardPadding = Window_Message.prototype.standardPadding; Window_Message.prototype.standardPadding = function () { return this.isPopup() ? paramPadding : _Window_Message_standardPadding.apply(this, arguments); }; var _Window_Message_calcTextHeight = Window_Message.prototype.calcTextHeight; Window_Message.prototype.calcTextHeight = function (textState, all) { var height = _Window_Message_calcTextHeight.apply(this, arguments); return this.isPopup() ? height - 8 + paramBetweenLines : height; }; var _Window_Message_startMessage = Window_Message.prototype.startMessage; Window_Message.prototype.startMessage = function () { this.updateTargetCharacterId(); this.loadWindowskin(); // Resolve conflict for MPP_MessageEX if (isExistPlugin('MPP_MessageEX')) { this.width = this.windowWidth(); } // Resolve conflict for StandPictureEC if (typeof Imported !== 'undefined' && Imported['StandPictureEC']) { this._textState = {}; this._textState.index = 0; this._textState.text = ''; this.resetLayout(); } _Window_Message_startMessage.apply(this, arguments); this.resetLayout(); }; var _Window_Message_loadWindowskin = Window_Message.prototype.loadWindowskin; Window_Message.prototype.loadWindowskin = function () { var popupWindowSkin = $gameSystem.getPopupWindowSkin(); if (this._windowSkinName !== popupWindowSkin || !popupWindowSkin) { if (this.isPopup()) { this._windowSkinName = popupWindowSkin; } } _Window_Message_loadWindowskin.apply(this, arguments); }; Window_Message.prototype.updateTargetCharacterId = function () { this._targetCharacterId = $gameSystem.getMessagePopupId(); }; var _Window_Message_resetFontSettings = Window_Message.prototype.resetFontSettings; Window_Message.prototype.resetFontSettings = function () { _Window_Message_resetFontSettings.apply(this, arguments); if (this.isPopup()) this.contents.fontSize = paramFontSize; }; Window_Message.prototype.getPopupTargetCharacter = function () { var id = this._targetCharacterId; if (id < -1) { return $gamePlayer.followers().follower((id * -1) - 2); } else if (id === -1) { return $gamePlayer; } else if (id > -1) { return $gameMap.event(id); } else { return null; } }; Window_Message.prototype.isPopup = function () { return !!this.getPopupTargetCharacter(); }; var _Window_Message_update = Window_Message.prototype.update; Window_Message.prototype.update = function () { _Window_Message_update.apply(this, arguments); this.updatePlacementPopupIfNeed(); }; Window_Message.prototype.updatePlacementPopupIfNeed = function () { var prevX = this.x; var prevY = this.y; if (this.openness > 0 && this.isPopup()) { this.updatePlacementPopup(); } if ((prevX !== this.x || prevY !== this.y) && this.isClosing()) { this.openness = 0; } }; var _Window_Message_updatePlacement = Window_Message.prototype.updatePlacement; Window_Message.prototype.updatePlacement = function () { if (typeof Yanfly === 'undefined' || !Yanfly.Message) { var width = this.windowWidth(); this.x = (Graphics.boxWidth - width) / 2; } _Window_Message_updatePlacement.apply(this, arguments); if (!this.isPopup()) { if (this._positionLock) { this.loadContainerInfo(); } return; } this.updatePlacementPopup(); // Resolve conflict for MKR_MessageWindowCustom.js if (isExistPlugin('MKR_MessageWindowCustom')) { this.processVirtual(); } }; var _Window_Message__updatePauseSign = Window_Message.prototype.hasOwnProperty('_updatePauseSign') ? Window_Message.prototype._updatePauseSign : null; Window_Message.prototype._updatePauseSign = function () { if (_Window_Message__updatePauseSign) { _Window_Message__updatePauseSign.apply(this, arguments); } else { Window_Base.prototype._updatePauseSign.apply(this, arguments); } this.updateTailImage(); }; Window_Message.prototype.isPopupLower = function () { var id = this._targetCharacterId; return $gameSystem.isPopupFixLower(id) || (!$gameSystem.isPopupFixUpper(id) && this.getWindowTopY() < 0); }; Window_Message.prototype.getWindowTopY = function () { return this.y - (this._nameWindow && this._nameWindow.visible ? this._nameWindow.height : 0); }; Window_Message.prototype.updatePlacementPopup = function () { this.setPopupPosition(this.getPopupTargetCharacter()); if (this._choiceWindow && $gameMessage.isChoice()) { this._choiceWindow.updatePlacementPopup(); } this._numberWindow.updatePlacementPopup(); // Resolve conflict for YEP_MessageCore.js and MPP_MessageEX.js if (this._nameWindow && checkTypeFunction(this._nameWindow.updatePlacementPopup)) { this._nameWindow.updatePlacementPopup(); if (isExistPlugin('MPP_MessageEX')) { this._nameWindow.y = this.y - this._nameWindow.height; this._nameWindow.x = this.x; } } }; Window_Message.prototype.updateTailImage = function () { if (!this.isPopup()) { this._messageTailImage.visible = false; } else if (paramTailImage) { this._messageTailImage.visible = this.isOpen(); if (!this.isUsePauseSignTextEnd() && !paramNoUseTail) { this._windowPauseSignSprite.visible = false; } } }; Window_Message.prototype.resetLayout = function () { this.padding = this.standardPadding(); if (this.getPopupTargetCharacter()) { this.processVirtual(); } else { this.width = this.windowWidth(); this.height = this.windowHeight(); this.setPauseSignToNormal(); } this.updatePlacement(); this.updateBackground(); }; Window_Message.prototype.processVirtual = function () { var virtual = {}; virtual.index = 0; virtual.text = this.convertEscapeCharacters($gameMessage.allText()); var defaultEscapeList = ['C', 'I', '{', '}']; virtual.text = virtual.text.replace(/\x1b(\w+)\[.*]/gi, function (text) { return defaultEscapeList.contains(arguments[1].toUpperCase()) ? text : ''; }); virtual.maxWidth = 0; this.newPage(virtual); while (!this.isEndOfText(virtual)) { this.processVirtualCharacter(virtual); } virtual.y += virtual.height; this._subWindowY = virtual.y; var choices = $gameMessage.choices(); if (choices && $gameSystem.getPopupSubWindowPosition() === 2) { virtual.y += choices.length * this._choiceWindow.lineHeight(); virtual.maxWidth = Math.max(virtual.maxWidth, this.newLineX() + this._choiceWindow.maxChoiceWidth()); } var digit = $gameMessage.numInputMaxDigits(); if (digit && $gameSystem.getPopupSubWindowPosition() === 2) { virtual.y += this._numberWindow.lineHeight(); } var width = virtual.maxWidth + this.padding * 2; var height = Math.max(this.getFaceHeight(), virtual.y) + this.padding * 2; var adjust = $gameSystem.getPopupAdjustSize(); if (adjust) { width += adjust[0]; height += adjust[1]; } if (this.isUsePauseSignTextEnd()) { width += this._windowPauseSignSprite.width; } else if (paramNoUseTail) { height += 8; } this.width = Math.max(width, this.getMinimumWidth()); this.height = Math.max(height, this.getMinimumHeight()); this.resetFontSettings(); }; Window_Message.prototype.getMinimumWidth = function () { return $gameVariables.value(paramMinWidthVariableId); }; Window_Message.prototype.getMinimumHeight = function () { return $gameVariables.value(paramMinHeightVariableId); }; Window_Message.prototype.getSubWindowPosition = function () { var pos = new Point(); pos.x = this.x + this.newLineX(); pos.y = this.y + this._subWindowY; return pos; }; Window_Message.prototype.processVirtualCharacter = function (textState) { switch (textState.text[textState.index]) { case '\n': this.processNewLine(textState); break; case '\f': this.processNewPage(textState); break; case '\x1b': this.processVirtualEscapeCharacter(this.obtainEscapeCode(textState), textState); break; default: this.processVirtualNormalCharacter(textState); break; } }; var _Window_Message_processNewLine = Window_Message.prototype.processNewLine; Window_Message.prototype.processNewLine = function (textState) { if (this.isPopup()) { textState.index++; _Window_Message_processNewLine.apply(this, arguments); textState.index--; } else { _Window_Message_processNewLine.apply(this, arguments); } }; Window_Message.prototype.processVirtualEscapeCharacter = function (code, textState) { switch (code) { case 'C': this.changeTextColor(this.textColor(this.obtainEscapeParam(textState))); break; case 'I': this.processVirtualDrawIcon(this.obtainEscapeParam(textState), textState); break; case '{': this.makeFontBigger(); break; case '}': this.makeFontSmaller(); break; default: this.obtainEscapeParam(textState); if (this.obtainEscapeString) { this.obtainEscapeString(textState); } } }; Window_Message.prototype.processVirtualNormalCharacter = function (textState) { var c = textState.text[textState.index++]; textState.x += this.textWidth(c); // Resolve conflict for BetweenCharacters.js if (this.getBetweenCharacters) { textState.x += this.getBetweenCharacters(); } textState.maxWidth = Math.max(textState.maxWidth, textState.x); }; Window_Message.prototype.processVirtualDrawIcon = function (iconIndex, textState) { textState.x += Window_Base._iconWidth + 4; textState.maxWidth = Math.max(textState.maxWidth, textState.x); }; var _Window_Message_newLineX = Window_Message.prototype.newLineX; Window_Message.prototype.newLineX = function () { if (this.isPopup()) { return $gameMessage.faceName() === '' ? 0 : Window_Message._faceWidth + 8; } else { return _Window_Message_newLineX.apply(this, arguments); } }; Window_Message.prototype.getFaceHeight = function () { return $gameMessage.faceName() === '' ? 0 : Window_Message._faceHeight; }; var _Window_Message_drawFace = Window_Message.prototype.drawFace; Window_Message.prototype.drawFace = function (faceName, faceIndex, x, y, width, height) { if (this.isPopup()) { width = width || Window_Base._faceWidth; height = height || Window_Base._faceHeight; var bitmap = ImageManager.loadFace(faceName); var pw = Window_Base._faceWidth; var ph = Window_Base._faceHeight; var sw = Math.min(width, pw); var sh = Math.min(height, ph); var dx = Math.floor(x + Math.max(width - pw, 0) / 2); var dy = Math.floor(y + Math.max(height - ph, 0) / 2); var sx = faceIndex % 4 * pw + (pw - sw) / 2; var sy = Math.floor(faceIndex / 4) * ph + (ph - sh) / 2; this.contents.blt(bitmap, sx, sy, sw, sh, dx, dy, Window_Message._faceWidth, Window_Message._faceHeight); } else { _Window_Message_drawFace.apply(this, arguments); } }; var _Window_Message_processEscapeCharacter = Window_Message.prototype.processEscapeCharacter; Window_Message.prototype.processEscapeCharacter = function (code, textState) { if (code === 'SH') { this.setWindowShake(this.obtainEscapeParam(textState)); } else { _Window_Message_processEscapeCharacter.apply(this, arguments); } }; var _Window_Message_terminateMessage = Window_Message.prototype.terminateMessage; Window_Message.prototype.terminateMessage = function () { this.setWindowShake(0); _Window_Message_terminateMessage.apply(this, arguments); }; //============================================================================= // Window_ChoiceList // ポップアップする場合、メッセージウィンドウに連動して表示位置と余白を調整します。 //============================================================================= var _Window_ChoiceList_standardFontSize = Window_ChoiceList.prototype.standardFontSize; Window_ChoiceList.prototype.standardFontSize = function () { return this.isPopupLinkage() ? paramFontSize : _Window_ChoiceList_standardFontSize.apply(this, arguments); }; var _Window_ChoiceList_standardPadding = Window_ChoiceList.prototype.standardPadding; Window_ChoiceList.prototype.standardPadding = function () { return this.isPopupLinkage() ? paramPadding : _Window_ChoiceList_standardPadding.apply(this, arguments); }; var _Window_ChoiceList_lineHeight = Window_ChoiceList.prototype.lineHeight; Window_ChoiceList.prototype.lineHeight = function () { return this.isPopupLinkage() ? paramFontSize + 8 : _Window_ChoiceList_lineHeight.apply(this, arguments); }; var _Window_ChoiceList_start = Window_ChoiceList.prototype.start; Window_ChoiceList.prototype.start = function () { this._messageWindow.updateTargetCharacterId(); if (!this.isPopup()) { this._messageWindow.resetLayout(); } return _Window_ChoiceList_start.apply(this, arguments); }; var _Window_ChoiceList_updatePlacement = Window_ChoiceList.prototype.updatePlacement; Window_ChoiceList.prototype.updatePlacement = function () { this.resetLayout(); _Window_ChoiceList_updatePlacement.apply(this, arguments); if (this.isPopup()) this.updatePlacementPopup(); }; var _Window_ChoiceList_refresh = Window_ChoiceList.prototype.refresh; Window_ChoiceList.prototype.refresh = function () { this.resetLayout(); _Window_ChoiceList_refresh.apply(this, arguments); }; Window_ChoiceList.prototype.isPopup = function () { return this._messageWindow.isPopup() && this._messageWindow.isOpen(); }; var _Window_ChoiceList_numVisibleRows = Window_ChoiceList.prototype.numVisibleRows; Window_ChoiceList.prototype.numVisibleRows = function () { var result = _Window_ChoiceList_numVisibleRows.apply(this, arguments); if (this.isPopupLinkage()) { result = Math.min($gameMessage.choices().length, 8); } return result; }; //============================================================================= // Window_NumberInput // ポップアップする場合、メッセージウィンドウに連動して表示位置と余白を調整します。 //============================================================================= var _Window_NumberInput_standardFontSize = Window_NumberInput.prototype.standardFontSize; Window_NumberInput.prototype.standardFontSize = function () { return this.isPopupLinkage() ? paramFontSize : _Window_NumberInput_standardFontSize.apply(this, arguments); }; var _Window_NumberInput_standardPadding = Window_NumberInput.prototype.standardPadding; Window_NumberInput.prototype.standardPadding = function () { return this.isPopupLinkage() ? paramPadding : _Window_NumberInput_standardPadding.apply(this, arguments); }; var _Window_NumberInput_lineHeight = Window_NumberInput.prototype.lineHeight; Window_NumberInput.prototype.lineHeight = function () { return this.isPopupLinkage() ? paramFontSize + 8 : _Window_NumberInput_lineHeight.apply(this, arguments); }; var _Window_NumberInput_updatePlacement = Window_NumberInput.prototype.updatePlacement; Window_NumberInput.prototype.updatePlacement = function () { this.resetLayout(); this.opacity = 255; _Window_NumberInput_updatePlacement.apply(this, arguments); if (this.isPopup()) this.updatePlacementPopup(); }; Window_NumberInput.prototype.isPopup = function () { return this._messageWindow.isPopup() && this._messageWindow.isOpen(); }; // Resolve conflict for KMS_DebugUtil.js if (isExistPlugin('KMS_DebugUtil')) { Window_NumberInput.prototype.isPopup = function () { return this._messageWindow && this._messageWindow.isPopup() && this._messageWindow.isOpen(); }; } //============================================================================= // Window_NameBox // メッセージウィンドウに連動して表示位置と余白を調整します。 //============================================================================= if (typeof Window_NameBox !== 'undefined') { var _Window_NameBox_standardFontSize = Window_NameBox.prototype.standardFontSize; Window_NameBox.prototype.standardFontSize = function () { return this.isPopupLinkage() ? paramFontSize : _Window_NameBox_standardFontSize.apply(this, arguments); }; var _Window_NameBox_standardPadding = Window_NameBox.prototype.standardPadding; Window_NameBox.prototype.standardPadding = function () { return this.isPopupLinkage() ? paramPadding : _Window_NameBox_standardPadding.apply(this, arguments); }; var _Window_NameBox_lineHeight = Window_NameBox.prototype.lineHeight; Window_NameBox.prototype.lineHeight = function () { return this.isPopupLinkage() ? paramFontSize + 8 : _Window_NameBox_lineHeight.apply(this, arguments); }; var _Window_NameBox_updatePlacement = Window_NameBox.prototype.updatePlacement; Window_NameBox.prototype.updatePlacement = function () { this.resetLayout(); _Window_NameBox_updatePlacement.apply(this, arguments); if (this.isPopup()) this.updatePlacementPopup(); }; var _Window_NameBox_refresh = Window_NameBox.prototype.refresh; Window_NameBox.prototype.refresh = function () { this.resetLayout(); return _Window_NameBox_refresh.apply(this, arguments); }; Window_NameBox.prototype.isPopup = function () { return this._parentWindow.isPopup(); }; Window_NameBox.prototype.updatePlacementPopup = function () { this.adjustPositionX(); this.adjustPositionY(); if (!$gameSystem.getMessagePopupId()) { this.openness = 0; } }; } //============================================================================= // ウィンドウを透過して重なり合ったときの表示を自然にします。 //============================================================================= if (paramThroughWindow && !WindowLayer.throughWindow) { WindowLayer.throughWindow = true; //============================================================================= // WindowLayer // ウィンドウのマスク処理を除去します。 //============================================================================= WindowLayer.prototype._maskWindow = function (window) { }; WindowLayer.prototype._canvasClearWindowRect = function (renderSession, window) { }; } //============================================================================= // FTKR_ExMessageWindow2.js の修正 //============================================================================= if (imported_FTKR_EMW()) { //------------------------------------------------------------------------ //Game_System //フキダシウィンドウの有効無効フラグをウィンドウID毎に保持 //------------------------------------------------------------------------ var _EMW_Game_System_initialize = Game_System.prototype.initialize; Game_System.prototype.initialize = function () { _EMW_Game_System_initialize.apply(this, arguments); this._messagePopupCharacterIds = []; }; Game_System.prototype.setMessagePopupEx = function (windowId, eventId) { this._messagePopupCharacterIds[windowId] = eventId; }; var _EMW_Game_System_clearMessagePopup = Game_System.prototype.clearMessagePopup; Game_System.prototype.clearMessagePopup = function () { _EMW_Game_System_clearMessagePopup.apply(this, arguments); this._messagePopupCharacterIds.forEach(function (id, i) { this.clearMessagePopupEx(i); }, this); }; Game_System.prototype.clearMessagePopupEx = function (windowId) { this._messagePopupCharacterIds[windowId] = 0; }; Game_System.prototype.getMessagePopupIdEx = function (windowId) { windowId = windowId || 0; return this._messagePopupCharacterIds[windowId] !== 0 ? this._messagePopupCharacterIds[windowId] : null; }; //------------------------------------------------------------------------ //Scene_Map //場所移動時にすべてのウィンドウIDのフキダシ無効化 //------------------------------------------------------------------------ var _EMW_Scene_Map_terminate = Scene_Map.prototype.terminate; Scene_Map.prototype.terminate = function () { _EMW_Scene_Map_terminate.call(this); if (SceneManager.isNextScene(Scene_Map)) { $gameSystem.clearMessagePopup(); } }; //------------------------------------------------------------------------ //Window_MessageEx //------------------------------------------------------------------------ var _Window_MessageEx_startMessage = Window_MessageEx.prototype.startMessage; Window_MessageEx.prototype.startMessage = function () { this.updateTargetCharacterId(); this.loadWindowskin(); _Window_MessageEx_startMessage.apply(this, arguments); this.resetLayout(); }; var _Window_MessageEx_updatePlacement = Window_MessageEx.prototype.updatePlacement; Window_MessageEx.prototype.updatePlacement = function () { if (typeof Yanfly === 'undefined' || !Yanfly.Message) { this.x = 0; } _Window_MessageEx_updatePlacement.apply(this, arguments); if (!this.isPopup()) { return; } this.updatePlacementPopup(); }; Window_MessageEx.prototype.updateTargetCharacterId = function () { var id = $gameSystem.getMessagePopupIdEx(this._windowId); this._targetCharacterId = $gameSystem.getMessagePopupIdEx(this._windowId); }; Window_MessageEx.prototype.updatePlacementPopup = function () { this.setPopupPosition(this.getPopupTargetCharacter()); if (this._choiceWindow && this._gameMessage.isChoice()) { this._choiceWindow.updatePlacementPopup(); } this._numberWindow.updatePlacementPopup(); if (this._nameWindow && checkTypeFunction(this._nameWindow.updatePlacementPopup)) { this._nameWindow.updatePlacementPopup(); } }; Window_MessageEx.prototype.processVirtual = function () { var virtual = {}; virtual.index = 0; virtual.text = this.convertEscapeCharacters(this._gameMessage.allText()); virtual.maxWidth = 0; this.newPage(virtual); while (!this.isEndOfText(virtual)) { this.processVirtualCharacter(virtual); } virtual.y += virtual.height; this._subWindowY = virtual.y; var choices = this._gameMessage.choices(); if (choices && $gameSystem.getPopupSubWindowPosition() === 2) { virtual.y += choices.length * this._choiceWindow.lineHeight(); virtual.maxWidth = Math.max(virtual.maxWidth, this.newLineX() + this._choiceWindow.maxChoiceWidth()); } var digit = this._gameMessage.numInputMaxDigits(); if (digit && $gameSystem.getPopupSubWindowPosition() === 2) { virtual.y += this._numberWindow.lineHeight(); } var width = virtual.maxWidth + this.padding * 2; var height = Math.max(this.getFaceHeight(), virtual.y) + this.padding * 2; var adjust = $gameSystem.getPopupAdjustSize(); if (adjust) { width += adjust[0]; height += adjust[1]; } if (this.isUsePauseSignTextEnd()) { width += this._windowPauseSignSprite.width; } else if (paramNoUseTail) { height += 8; } this.width = width; this.height = height; this.resetFontSettings(); }; var _Window_MessageEx_newLineX = Window_MessageEx.prototype.newLineX; Window_MessageEx.prototype.newLineX = function () { if (this.isPopup()) { return this._gameMessage.faceName() === '' ? 0 : Window_Message._faceWidth + 8; } else { return _Window_MessageEx_newLineX.apply(this, arguments); } }; Window_MessageEx.prototype.getFaceHeight = function () { return this._gameMessage.faceName() === '' ? 0 : Window_Message._faceHeight; }; //------------------------------------------------------------------------ //Window_ChoiceListEx //------------------------------------------------------------------------ var _Window_ChoiceListEx_numVisibleRows = Window_ChoiceListEx.prototype.numVisibleRows; Window_ChoiceListEx.prototype.numVisibleRows = function () { var result = _Window_ChoiceListEx_numVisibleRows.apply(this, arguments); if (this.isPopupLinkage()) { result = Math.min(this._gameMessage.choices().length, 8); } return result; }; var _Window_ChoiceListEx_updatePlacement = Window_ChoiceListEx.prototype.updatePlacement; Window_ChoiceListEx.prototype.updatePlacement = function () { this.resetLayout(); _Window_ChoiceListEx_updatePlacement.apply(this, arguments); if (this.isPopup()) this.updatePlacementPopup(); }; //------------------------------------------------------------------------ //Window_NumberInputEx //------------------------------------------------------------------------ var _Window_NumberInputEx_updatePlacement = Window_NumberInputEx.prototype.updatePlacement; Window_NumberInputEx.prototype.updatePlacement = function () { this.resetLayout(); this.opacity = 255; _Window_NumberInputEx_updatePlacement.apply(this, arguments); if (this.isPopup()) this.updatePlacementPopup(); }; }//FTKR_ExMessageWindow2 })();
dazed/translations
www/js/plugins/MessageWindowPopup.js
JavaScript
unknown
85,694
//============================================================================= // MessageWindowSizeAdjuster.js // ---------------------------------------------------------------------------- // Copyright (c) 2017-2019 Tsumio // This software is released under the MIT License. // http://opensource.org/licenses/mit-license.php // ---------------------------------------------------------------------------- // Version // 1.0.0 2019/11/01 公開。 // ---------------------------------------------------------------------------- // [GitHub] : https://github.com/Tsumio/rmmv-plugins // [Twitter]: https://twitter.com/TsumioNtGame //============================================================================= /*: * @plugindesc Changes the size of the message window * @author Tsumio * * @param ----Basic Settings---- * @desc * @default * * @param SwitchId * @desc Switch number to enable window resizing. * @type number * @default 1 * * @param SizeVariableId * @desc Variable number that specifies the size of the window. * @type number * @default 1 * * @help Changes the size of the message window * * ----feature---- * -> Change the size of the message window. * -> Control the size using switches and variables. * * ----how to use---- * After installing the plugin, sets each plugin parameter. * You can adjust the size of the message window by turning on the specified switch and * adjusting the value of the specified variable. * * ----change log--- * 1.0.0 2019/11/01 Release. * * ----remarks---- * I shall not be responsible for any loss, damages and troubles from using this plugin. * * --Terms of Use-- * This plugin is free for both commercial and non-commercial use. * You may edit the source code to suit your needs, * so long as you don't claim the source code belongs to you. * */ /*:ja * @plugindesc メッセージウィンドウのサイズを変更するプラグイン * @author ツミオ * * @param ----基本的な設定---- * @desc * @default * * @param スイッチ番号 * @desc ウィンドウのサイズ変更を有効にするスイッチ番号 * @type number * @default 1 * * @param サイズ指定用変数番号 * @desc ウィンドウのサイズを指定する変数番号 * @type number * @default 1 * * @help メッセージウィンドウのサイズを変更するプラグイン * * 【特徴】 * ・メッセージウィンドウのサイズを変更できます * ・スイッチや変数を用いてサイズをコントロールできます * * 【使用方法】 * プラグインの導入後、プラグインパラメーターを設定してください。 * 指定したスイッチをONにし、指定した変数の値を調整することで * メッセージウィンドウのサイズを調整できます。 * * 【更新履歴】 * 1.0.0 2019/11/01 公開。 * * 【備考】 * 当プラグインを利用したことによるいかなる損害に対しても、制作者は一切の責任を負わないこととします。 * * 【利用規約】 * ソースコードの著作権者が自分であると主張しない限り、 * 作者に無断で改変、再配布が可能です。 * 利用形態(商用、18禁利用等)についても制限はありません。 * 自由に使用してください。 * */ (function () { 'use strict'; var pluginName = 'MessageWindowSizeAdjuster'; ////============================================================================= //// Local function //// These functions checks & formats pluguin's command parameters. //// I borrowed these functions from Triacontane.Thanks! ////============================================================================= var getParamString = function (paramNames) { if (!Array.isArray(paramNames)) paramNames = [paramNames]; for (var i = 0; i < paramNames.length; i++) { var name = PluginManager.parameters(pluginName)[paramNames[i]]; if (name) return name; } return ''; }; var getParamNumber = function (paramNames, min, max) { var value = getParamString(paramNames); if (arguments.length < 2) min = -Infinity; if (arguments.length < 3) max = Infinity; return (parseInt(value) || 0).clamp(min, max); }; ////============================================================================= //// Get and set pluguin parameters. ////============================================================================= var param = {}; //スイッチ番号 param.switchId = getParamNumber(['SwitchId', 'スイッチ番号']); //サイズ指定用変数番号 param.sizeVariableId = getParamNumber(['SizeVariableId', 'サイズ指定用変数番号']); //////============================================================================= ///// Window_Message ///// 特定のスイッチがONのとき、サイズを変更する //////============================================================================= //位置のupdateでサイズも調整する const _Window_Message_updatePlacement = Window_Message.prototype.updatePlacement; Window_Message.prototype.updatePlacement = function () { _Window_Message_updatePlacement.call(this); if (this.shouldAdjustWindow()) { this.width = this.adjustedWindowWidth(); console.log(this.adjustedWindowWidth()); } else { this.width = this.windowWidth(); } }; //ウィンドウを調整するべきかどうか Window_Message.prototype.shouldAdjustWindow = function () { return $gameSwitches.value(param.switchId); }; //変更後の幅 Window_Message.prototype.adjustedWindowWidth = function () { return $gameVariables.value(param.sizeVariableId); }; })();
dazed/translations
www/js/plugins/MessageWindowSizeAdjuster.js
JavaScript
unknown
5,938
//============================================================================== // MpiGetMapImage.js //============================================================================== /*: * @plugindesc マップ全体を画像として出力します。 * @author 奏ねこま(おとぶき ねこま) * * @param GetImageTrigger1 * @desc マップを画像出力するトリガーを指定してください。 * @default Input.isPressed('control') && Input.isTriggered('pageup') * * @param GetImageTrigger2 * @desc マップを画像出力するトリガーを指定してください。(キャラクター表示OFF) * @default Input.isPressed('control') && Input.isTriggered('pagedown') * * @param Vertical Split * @desc 画像出力時の縦方向の分割数を指定してください。 * @default 1 * * @param Horizontal Split * @desc 画像出力時の横方向の分割数を指定してください。 * @default 1 * * @param OutputFolder * @desc 画像を出力するフォルダを指定してください。 * @default output * * @param TestModeOnly * @desc テスト時のみ有効にする場合は true を指定してください。 * @default true * * @help * [説明] * マップ全体をPNG画像として出力します。 * * [使用方法] * プラグイン設定のGetImageTrigger1またはGetImageTrigger2で指定した条件が成立し * た瞬間のマップ全体の画像を、PNG画像に出力します。 * GetImageTrigger1とGetImageTrigger2のデフォルト設定は、以下のような意味です。 * * GetImageTrigger1 * Input.isPressed('control') && Input.isTriggered('pageup') * Ctrlキー(またはAltキー)を押しながら、PageUpキーが押された瞬間。 * * GetImageTrigger2 * Input.isPressed('control') && Input.isTriggered('pagedown') * Ctrlキー(またはAltキー)を押しながら、PageDownキーが押された瞬間。 * * [大きなマップを出力する際の注意] * 160×160以上の大きなマップを1枚の画像として出力するとエラーになることがありま * す。その場合はプラグイン設定のVertical SplitとHorizontal Splitに2以上の値を設 * 定して分割出力してください。例えばVertical SplitとHorizontal Splitの値がとも * に2の場合、縦横それぞれ2分割され4枚の画像として出力されます。 * * [利用規約] .................................................................. * - 本プラグインの利用は、RPGツクールMV/RPGMakerMVの正規ユーザーに限られます。 * - 商用、非商用、有償、無償、一般向け、成人向けを問わず、利用可能です。 * - 利用の際、連絡や報告は必要ありません。また、製作者名の記載等も不要です。 * - プラグインを導入した作品に同梱する形以外での再配布、転載はご遠慮ください。 * - 本プラグインにより生じたいかなる問題についても、一切の責任を負いかねます。 * [改訂履歴] .................................................................. * Version 1.02 2019/06/03 分割出力機能を追加。 * Version 1.01 2018/03/09 遠景、および一部の近・遠景関連プラグインに暫定対応。 * Foreground.js(公式プラグイン・神無月サスケ様) * 視差ゼロ遠景のぼかし除去プラグイン(トリアコンタン様) * Version 1.00 2018/12/27 初版 * -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- * Web Site: http://makonet.sakura.ne.jp/rpg_tkool/ * Twitter : https://twitter.com/koma_neko * Copylight (c) 2016-2019 Nekoma Otobuki */ var Imported = Imported || {}; var Makonet = Makonet || {}; (function () { 'use strict'; const plugin_name = 'MpiGetMapImage'; Imported[plugin_name] = true; Makonet[plugin_name] = {}; let _plugin = Makonet[plugin_name]; let _parameters = PluginManager.parameters(plugin_name); _plugin.trigger1 = _parameters['GetImageTrigger1']; _plugin.trigger2 = _parameters['GetImageTrigger2']; _plugin.vertical = Number(_parameters['Vertical Split']) || 1; _plugin.horizontal = Number(_parameters['Horizontal Split']) || 1; _plugin.folder = _parameters['OutputFolder']; _plugin.testOnly = _parameters['TestModeOnly'].toLowerCase() === 'true'; //============================================================================== // Local Function //============================================================================== function createMapImage() { // 現在のマップ表示情報を退避 let displayX = $gameMap._displayX; let displayY = $gameMap._displayY; let parallaxOx = $gameMap.parallaxOx(); let parallaxOy = $gameMap.parallaxOy(); let foregroundOx, foregroundOy; if ($gameMap.foregroundOx) { foregroundOx = $gameMap.foregroundOx(); foregroundOy = $gameMap.foregroundOy(); } // コピー情報作成 let copyInfo = []; let splitWidth = Math.ceil($gameMap.width() / _plugin.horizontal); let splitHeight = Math.ceil($gameMap.height() / _plugin.vertical); let screenWidth = Math.floor(Graphics.width / $gameMap.tileWidth()); let screenHeight = Math.floor(Graphics.height / $gameMap.tileHeight()); for (let i = 0; i < _plugin.vertical; i++) { for (let j = 0; j < _plugin.horizontal; j++) { let x1 = j * splitHeight; let y1 = i * splitWidth; let width1 = Math.min(splitWidth, $gameMap.width() - j * splitWidth); let height1 = Math.min(splitHeight, $gameMap.height() - i * splitHeight); for (let m = 0; m < Math.ceil(height1 / screenHeight); m++) { for (let n = 0; n < Math.ceil(width1 / screenWidth); n++) { let x2 = x1 + n * screenWidth; let y2 = y1 + m * screenHeight; let width2 = Math.min(screenWidth, width1 - n * screenWidth); let height2 = Math.min(screenHeight, height1 - m * screenHeight); copyInfo.push(new Map([ ['imageId', i * _plugin.vertical + j], ['imageWidth', width1 * $gameMap.tileWidth()], ['imageHeight', height1 * $gameMap.tileHeight()], ['srcMapX', x2], ['srcMapY', y2], ['copyWidth', width2 * $gameMap.tileWidth()], ['copyHeight', height2 * $gameMap.tileHeight()], ['dstX', (x2 - x1) * $gameMap.tileWidth()], ['dstY', (y2 - y1) * $gameMap.tileHeight()] ])); } } } } // Bitmap作成 let bitmap = []; copyInfo.forEach(info => { bitmap[info.get('imageId')] = bitmap[info.get('imageId')] || new Bitmap(info.get('imageWidth'), info.get('imageHeight')); $gameMap._displayX = info.get('srcMapX'); $gameMap._displayY = info.get('srcMapY'); let spriteset = SceneManager._scene._spriteset; spriteset.update(); if (spriteset._parallax.bitmap) { spriteset._parallax.origin.x = parallaxOx + ($gameMap._displayX - displayX) * $gameMap.tileWidth(); spriteset._parallax.origin.y = parallaxOy + ($gameMap._displayY - displayY) * $gameMap.tileHeight(); } if (spriteset._foreground && spriteset._foreground.bitmap) { spriteset._foreground.origin.x = foregroundOx + ($gameMap._displayX - displayX) * $gameMap.tileWidth(); spriteset._foreground.origin.y = foregroundOy + ($gameMap._displayY - displayY) * $gameMap.tileHeight(); } if (spriteset._parallaxNonBlur && spriteset._parallaxNonBlur.bitmap) { spriteset._parallaxNonBlur.setFrame( parallaxOx + ($gameMap._displayX - displayX) * $gameMap.tileWidth(), parallaxOy + ($gameMap._displayY - displayY) * $gameMap.tileHeight(), Graphics.width, Graphics.height ); } Graphics._renderer.render(SceneManager._scene); let snap = Bitmap.snap(SceneManager._scene); bitmap[info.get('imageId')].blt(snap, 0, 0, info.get('copyWidth'), info.get('copyHeight'), info.get('dstX'), info.get('dstY')); }); // ファイル出力 bitmap.forEach((bitmap, index, array) => { let fs = require('fs'); let path = StorageManager.localFileDirectoryPath().replace(/save[\\/]$/, ''); let folder = path + _plugin.folder; if (!fs.existsSync(folder)) { fs.mkdirSync(folder); } let strIndex = (array.length > 1) ? '_' + index.padZero(2) : ''; let date = (function () { let date = new Date(); let year = date.getFullYear(); let month = date.getMonth() + 1; let day = date.getDate(); let hours = date.getHours(); let minutes = date.getMinutes(); let seconds = date.getSeconds(); return year + month.padZero(2) + day.padZero(2) + hours.padZero(2) + minutes.padZero(2) + seconds.padZero(2); }()); let file = folder + '\\Map' + $gameMap.mapId().padZero(3) + strIndex + '_' + date + '.png'; let data = bitmap._canvas.toDataURL('img/png').replace(/^.*,/, ''); let buffer = new Buffer(data, 'base64'); fs.writeFileSync(file, buffer); }); // マップ表示位置を復帰 $gameMap._displayX = displayX; $gameMap._displayY = displayY; SceneManager._scene._spriteset.update(); Graphics._renderer.render(SceneManager._scene); } //============================================================================== // Scene_Map //============================================================================== { let __update = Scene_Map.prototype.update; Scene_Map.prototype.update = function () { if ($gameTemp.isPlaytest() || !_plugin.testOnly) { let trigger1 = !!eval(_plugin.trigger1); let trigger2 = !!eval(_plugin.trigger2); if (trigger2) this._spriteset.hideCharacters(); if (trigger1 || trigger2) { createMapImage(); } if (trigger2) { this._spriteset._characterSprites.forEach(sprite => { if (!sprite.isTile()) sprite.show(); }); } } __update.apply(this, arguments); }; } }());
dazed/translations
www/js/plugins/MpiGetMapImage.js
JavaScript
unknown
11,168
/*: * @plugindesc 指定の画像を2倍拡大表示にします * @help * 指定の画像を2倍拡大表示にします * * @param file1 * @desc ファイルその1 * @type string * * @param file2 * @desc ファイルその2 * @type string * * @param file3 * @desc ファイルその3 * @type string * * @param file4 * @desc ファイルその4 * @type string * * @param file5 * @desc ファイルその5 * @type string * * @param file6 * @desc ファイルその6 * @type string * * @param file7 * @desc ファイルその7 * @type string * * @param file8 * @desc ファイルその8 * @type string * * @param file9 * @desc ファイルその9 * @type string * * @param file10 * @desc ファイルその10 * @type string * * @param file11 * @desc ファイルその11 * @type string * * @param file12 * @desc ファイルその12 * @type string * * @param file13 * @desc ファイルその13 * @type string * * @param file14 * @desc ファイルその14 * @type string * * @param file15 * @desc ファイルその15 * @type string * * @param file16 * @desc ファイルその16 * @type string * * @param file17 * @desc ファイルその17 * @type string * * @param file18 * @desc ファイルその18 * @type string * * @param file19 * @desc ファイルその19 * @type string * * @param file20 * @desc ファイルその20 * @type string * */ var Nore; (function (Nore) { var fileMap = {}; var param = PluginManager.parameters('Nore_2xCharImage'); console.log(param['file1']) for (var i = 1; i <= 20; i++) { fileMap[param['file' + i]] = true; } var Sprite_Character_prototype_update = Sprite_Character.prototype.update; Sprite_Character.prototype.update = function () { Sprite_Character_prototype_update.call(this); this.update2xZoom(); }; Sprite_Character.prototype.update2xZoom = function () { if (this._characterName == '') { return; } if (fileMap[this._characterName]) { this.scale.x = 2; this.scale.y = 2; } else { this.scale.x = 1; this.scale.y = 1; } }; })(Nore || (Nore = {}));
dazed/translations
www/js/plugins/Nore_2xCharImage.js
JavaScript
unknown
2,272
var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); /*============================================================================ Nore_AutoSave.js ---------------------------------------------------------------------------- This software is released under the MIT License. http://opensource.org/licenses/mit-license.php ============================================================================*/ /*:ja * @plugindesc オートセーブができるスクリプト * @author ル * @version 0.02 * * @help * オートセーブのプラグインコマンド * Nore_AutoSave autoSave XXXX * XXXX にオートセーブのタイトルを設定できます * * * @param autosaveJp * @text オートセーブの日本語名 * @default オートセーブ * * @param autosaveEn * @text オートセーブの英語名 * @default Autosave * * @param autosaveCh * @text オートセーブの中国語名 * @default オートセーブ * */ var Nore; (function (Nore) { var parameters = PluginManager.parameters('Nore_AutoSave'); var AUTO_SAVE_TITLE_JP = parameters['autosaveJp']; var AUTO_SAVE_TITLE_EN = parameters['autosaveEn']; var AUTO_SAVE_TITLE_CH = parameters['autosaveCh']; var AUTO_SAVE_DUMMY_ID = 999; Nore.AUTO_SAVE_DUMMY_ID = AUTO_SAVE_DUMMY_ID; var AUTO_SAVE_ID = 0; var pluginName = 'Nore_AutoSave'; var _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand; Game_Interpreter.prototype.pluginCommand = function (command, args) { _Game_Interpreter_pluginCommand.apply(this, arguments); if (command === pluginName) { switch (args[0]) { case 'autoSave': $autoSaveManager.autoSave(args[1]); return; default: console.error('不正なプラグインコマンドです。' + args[0]); } } }; var $autoSaveManager; var _DataManager_createGameObjects = DataManager.createGameObjects; DataManager.createGameObjects = function () { _DataManager_createGameObjects.call(this); $autoSaveManager = new AutoSaveManager(); }; var AutoSaveManager = /** @class */ (function () { function AutoSaveManager() { } AutoSaveManager.prototype.autoSave = function (autoSaveName) { if (!autoSaveName) { //console.log('オートセーブ名が指定されていません'); } var info = DataManager.loadGlobalInfo()[AUTO_SAVE_ID]; if (info && info.playtime == $gameSystem.playtimeText()) { return; } SceneManager.snapForThumbnail(); $gameSystem.onBeforeSave(); var lastAccessId = DataManager._lastAccessedId; var saveId = AUTO_SAVE_DUMMY_ID; //console.log('オートセーブ実行:' + saveId + ' ' + autoSaveName); this._autoSaveName = autoSaveName; if (DataManager.saveGame(saveId)) { StorageManager.cleanBackup(saveId); } DataManager._lastAccessedId = lastAccessId; this._autoSaveName = null; }; return AutoSaveManager; }()); Nore.AutoSaveManager = AutoSaveManager; var _Window_SavefileList_prototype_drawFileId = Window_SavefileList.prototype.drawFileId; Window_SavefileList.prototype.drawFileId = function (id, x, y) { if (id == 0) { var text = AUTO_SAVE_TITLE_JP; switch ($gameVariables.value(1999)) { case 2: text = AUTO_SAVE_TITLE_EN; break; case 3: text = AUTO_SAVE_TITLE_CH; break; } this.drawText(text.format(id - AUTO_SAVE_ID + 1), x, y, 180); return; } _Window_SavefileList_prototype_drawFileId.call(this, id, x, y); }; Scene_File.prototype.savefileId = function () { var fileId = this._listWindow.selectedId(); if (fileId == AUTO_SAVE_ID) { return AUTO_SAVE_DUMMY_ID; } return fileId; }; var Scene_File_prototype_update = Scene_File.prototype.update; Scene_File.prototype.update = function () { Scene_File_prototype_update.call(this); if (this._interpreter) { this._interpreter.update(); if (TouchInput.rightButton) { $gameSwitches.setValue(50, true); return; } if (!this._interpreter.isRunning()) { var label = $gameVariables.value(renameVar2); this._interpreter = null; this._listWindow.activate(); var id = this._listWindow.selectedId(); var info = DataManager.loadGlobalInfo(); if (!info[id]) { return; } if (info[id].label == label) { SoundManager.playCancel(); return; } SoundManager.playOk(); info[id].label = label; this._listWindow.refresh(); DataManager.saveGlobalInfo(info); } } }; const _Scene_Save_prototype_onSavefileOk = Scene_Save.prototype.onSavefileOk; Scene_Save.prototype.onSavefileOk = function () { const fileId = this.savefileId(); if (fileId == undefined || fileId == AUTO_SAVE_DUMMY_ID) { this.onSaveFailure(); return; } _Scene_Save_prototype_onSavefileOk.call(this); }; var StorageManager_localFilePath = StorageManager.localFilePath; StorageManager.localFilePath = function (savefileId) { if (savefileId === AUTO_SAVE_DUMMY_ID) { return this.localFileDirectoryPath() + 'file%1.rpgsave'.format(AUTO_SAVE_ID); } return StorageManager_localFilePath.call(this, savefileId); }; DataManager.saveGameWithoutRescue = function (savefileId) { if (savefileId == undefined) { console.error('save file id が指定されていません'); return false; } var json = JsonEx.stringify(this.makeSaveContents()); if (json.length >= 200000) { console.warn('Save data too big!'); } StorageManager.save(savefileId, json); if (savefileId == AUTO_SAVE_DUMMY_ID) { savefileId = AUTO_SAVE_ID; } this._lastAccessedId = savefileId; var globalInfo = this.loadGlobalInfo() || []; globalInfo[savefileId] = this.makeSavefileInfo(); this.saveGlobalInfo(globalInfo); return true; }; var _DataManager_isThisGameFile = DataManager.isThisGameFile; DataManager.isThisGameFile = function (savefileId) { if (savefileId == AUTO_SAVE_DUMMY_ID) { return true; } else { return _DataManager_isThisGameFile.apply(this, arguments); } }; var _DataManager_loadGameWithoutRescue = DataManager.loadGameWithoutRescue; DataManager.loadGameWithoutRescue = function (savefileId) { const lastAccessId = this._lastAccessedId; const result = _DataManager_loadGameWithoutRescue.apply(this, arguments); if (this._lastAccessedId == AUTO_SAVE_DUMMY_ID) { this._lastAccessedId = lastAccessId; } return result; }; DataManager.selectSavefileForNewGame = function () { var globalInfo = this.loadGlobalInfo(); this._lastAccessedId = 1; if (globalInfo) { var numSavefiles = Math.max(0, getGlobalLength(globalInfo)); if (numSavefiles < this.maxSavefiles()) { this._lastAccessedId = numSavefiles + 1; } else { var timestamp = Number.MAX_VALUE; for (var i = 1; i < globalInfo.length; i++) { if (!globalInfo[i]) { this._lastAccessedId = i; break; } if (globalInfo[i].timestamp < timestamp) { timestamp = globalInfo[i].timestamp; this._lastAccessedId = i; } } } } }; function getGlobalLength(globalInfo) { let max = 0; for (let i = 0; i < 95; i++) { if (globalInfo[i]) { max = i; } } return max; } })(Nore || (Nore = {}));
dazed/translations
www/js/plugins/Nore_AutoSave.js
JavaScript
unknown
9,121
var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); /*:ja * @author ル * * @param rightTreeOffset * @desc 右側のツリーは、この値だけずれます * @default 15 * * @param closeRelativeX * @desc 近親マークのx座標 * @default 0 * * @param closeRelativeY * @desc 近親マークのy座標 * @default 0 * * @param closeRelativeNameY * @desc 近親マークつきの家系図の名前のy座標 * @default 0 * */ var Nore; (function (Nore) { var Parameters = PluginManager.parameters('Nore_FamilyTree2'); Nore.RIGHT_TREE_OFFSET = Parameters['rightTreeOffset'] ? Math.trunc(Parameters['rightTreeOffset']) : 15; Nore.CLOSE_RELATIVE_X = Parameters['closeRelativeX'] ? Math.trunc(Parameters['closeRelativeX']) : 0; Nore.CLOSE_RELATIVE_Y = Parameters['closeRelativeY'] ? Math.trunc(Parameters['closeRelativeY']) : 0; Nore.CLOSE_RELATIVE_NAME_Y = Parameters['closeRelativeNameY'] ? Math.trunc(Parameters['closeRelativeNameY']) : 0; // 設定 var FONT_NAME = '游ゴシック'; var FONT_SIZE = 18; var COLOR = 0x2A1713; Nore.CHILD_TEXT_JA = 'の子供'; Nore.CHILD_TEXT_EN = 'Child of'; var loader; var _Scene_Boot_loadSystemImages = Scene_Boot.loadSystemImages; Scene_Boot.loadSystemImages = function () { _Scene_Boot_loadSystemImages.call(this); loader = new PIXI.loaders.Loader(); loader.add('HeaderFont', './fonts/bgfont.fnt') .load(function () { }); }; var Scene_Map_prototype_update = Scene_Map.prototype.update; Scene_Map.prototype.update = function () { Scene_Map_prototype_update.call(this); if ($gameSwitches.value(601)) { this.showFamilyTree(); } else { this.hideFamilyTree(); } }; Scene_Map.prototype.showFamilyTree = function () { if (!this._familyTreeWindow) { this.createFamilyTreeBg(); this._familyTreeWindow = new Nore.Window_FamilyTree(0, 0, Graphics.boxWidth, Graphics.boxHeight); this._spriteset.addChild(this._familyTreeWindow); } this._familyTreeBg.visible = true; this._familyTreeWindow.visible = true; this._familyTreeWindow.update(); }; Scene_Map.prototype.hideFamilyTree = function () { if (this._familyTreeWindow && this._familyTreeWindow.visible) { this._familyTreeWindow.visible = false; this._familyTreeBg.visible = false; } }; Scene_Map.prototype.createFamilyTreeBg = function () { if (this._familyTreeBg) { return; } var g = new PIXI.Graphics(); g.beginFill(0x976d64, 1); g.drawRect(0, 0, Graphics.boxWidth + 10, Graphics.boxHeight + 10); g.endFill(); this._familyTreeBg = g; this._spriteset.addChild(g); }; })(Nore || (Nore = {})); var Game_FamilyTree = /** @class */ (function () { function Game_FamilyTree() { this._children = []; } Game_FamilyTree.prototype.addChild = function (taneoyaId, childCount) { var newChild = new Game_Child(taneoyaId); newChild.plusBrother(childCount - 1); this._children.push(newChild); this._lastChild = newChild; return newChild.id(); }; Game_FamilyTree.prototype.addGrandchild = function (childCount, id) { if (id) { var parent_1 = this.findChild(id); if (!parent_1) { console.error('孫を追加しようとしましたが、' + id + 'のIDの子供が存在しません'); return; } var newChild = new Game_Child(parent_1.taneoyaId(), parent_1.generation() + 1); newChild.plusBrother(childCount - 1); parent_1.addChild(newChild); return newChild.id(); } else { if (!this._lastChild) { console.error('孫を追加しようとしましたが、直前に産まれた子供が存在しません'); return; } var newChild = new Game_Child(this._lastChild.taneoyaId(), this._lastChild.generation() + 1); newChild.plusBrother(childCount - 1); this._lastChild.addChild(newChild); this._lastChild = newChild; return newChild.id(); } }; Game_FamilyTree.prototype.addBrother = function (taneoyaId) { if (!taneoyaId) { console.error('兄弟を追加しようとしましたが、種親IDが指定されていません'); return; } var child = this.findLastChild(taneoyaId); if (!child) { console.error('兄弟を追加しようとしましたが、' + taneoyaId + 'の種親IDが見つからないため新規に追加しました'); this.addChild(taneoyaId); return; } child.plusBrother(1); }; Game_FamilyTree.prototype.findLastChild = function (taneoyaId) { for (var i = this._children.length - 1; i >= 0; i--) { var child = this._children[i]; if (child.taneoyaId() == taneoyaId) { return child; } } return null; }; Game_FamilyTree.prototype.children = function () { return this._children; }; Game_FamilyTree.prototype.countChild = function (taneoyaId) { var total = 0; for (var _i = 0, _a = this._children; _i < _a.length; _i++) { var c = _a[_i]; total += c.countChild(taneoyaId); } return total; }; Game_FamilyTree.prototype.findChild = function (id) { for (var _i = 0, _a = this._children; _i < _a.length; _i++) { var c = _a[_i]; if (c.id() == id) { return c; } var found = c.findChild(id); if (found) { return found; } } return null; }; return Game_FamilyTree; }()); var Game_Child = /** @class */ (function () { function Game_Child(taneoyaId, generation) { if (generation === void 0) { generation = 1; } this._brotherCount = 1; this._children = []; this._id = $gameSystem.nextChildId(); this._taneoyaId = taneoyaId; this._generation = generation; } Game_Child.prototype.id = function () { return this._id; }; Game_Child.prototype.taneoyaId = function () { return this._taneoyaId; }; Game_Child.prototype.addChild = function (child) { this._children.push(child); }; Game_Child.prototype.plusBrother = function (n) { this._brotherCount += n; }; Game_Child.prototype.brotherCount = function () { return this._brotherCount; }; Game_Child.prototype.hasGrandchild = function () { return this._children.length > 0; }; Game_Child.prototype.child = function () { return this._children[0]; }; Game_Child.prototype.generation = function () { return this._generation; }; Game_Child.prototype.countChild = function (taneoyaId) { if (this._taneoyaId != taneoyaId) { return 0; } var total = this._brotherCount; for (var _i = 0, _a = this._children; _i < _a.length; _i++) { var c = _a[_i]; total += c.countChild(taneoyaId); } return total; }; Game_Child.prototype.findChild = function (id) { var c = this.child(); if (c) { if (c.id() == id) { return c; } return c.findChild(id); } return null; }; return Game_Child; }()); Game_System.prototype.addChild = function (taneoyaId, childCount) { if (childCount === void 0) { childCount = 1; } this._familyTree = this._familyTree || new Game_FamilyTree(); return this._familyTree.addChild(taneoyaId, childCount); }; Game_System.prototype.addBrother = function (taneoyaId) { this._familyTree = this._familyTree || new Game_FamilyTree(); this._familyTree.addBrother(taneoyaId); }; Game_System.prototype.addGrandchild = function (childCount, parentId) { if (childCount === void 0) { childCount = 1; } this._familyTree = this._familyTree || new Game_FamilyTree(); return this._familyTree.addGrandchild(childCount, parentId); }; Game_System.prototype.nextChildId = function () { this._nextChildId = this._nextChildId || 0; this._nextChildId++; return this._nextChildId; }; Game_System.prototype.familyTree = function () { this._familyTree = this._familyTree || new Game_FamilyTree(); return this._familyTree; }; Game_System.prototype.countChild = function (taneoyaId) { this._familyTree = this._familyTree || new Game_FamilyTree(); return this._familyTree.countChild(taneoyaId); }; (function (Nore) { var Scene_FamilyTree = /** @class */ (function (_super) { __extends(Scene_FamilyTree, _super); function Scene_FamilyTree() { return _super !== null && _super.apply(this, arguments) || this; } Scene_FamilyTree.prototype.create = function () { _super.prototype.create.call(this); this.createFamilyTreeWindow(); }; Scene_FamilyTree.prototype.createBackground = function () { var g = new PIXI.Graphics(); g.beginFill(0x976d64, 1); g.drawRect(0, 0, Graphics.boxWidth + 10, Graphics.boxHeight + 10); g.endFill(); this.addChild(g); }; Scene_FamilyTree.prototype.createFamilyTreeWindow = function () { this._familyTreeWindow = new Window_FamilyTree(0, 0, Graphics.boxWidth, Graphics.boxHeight); this._familyTreeWindow.refresh(); this.addWindow(this._familyTreeWindow); }; Scene_FamilyTree.prototype.update = function () { _super.prototype.update.call(this); if (Input.isTriggered('cancel')) { SoundManager.playCancel(); SceneManager.pop(); } }; return Scene_FamilyTree; }(Scene_MenuBase)); Nore.Scene_FamilyTree = Scene_FamilyTree; var Sprite_Pic = /** @class */ (function (_super) { __extends(Sprite_Pic, _super); function Sprite_Pic(name) { var _this = _super.call(this) || this; _this._name = name; _this.bitmap = ImageManager.loadPicture('エロステータス/' + name); return _this; } Sprite_Pic.prototype.update = function () { _super.prototype.update.call(this); }; return Sprite_Pic; }(Sprite)); var BG_COLOR = '#976d64'; var LINE_COLOR = '#2a1713'; var BLOCK_COLOR = '#ffe9c3'; var INTERBAL_X = 120; var MARGIN_BETWEEN_FATHER_AND_CHILD = 50; var MARGIN_BETWEEN_FATHER_AND_CHILDREN = 80; var GRAND_CHILD_X = 76; var GRAND_CHILD_Y = 30; var INTERVAL_GRANDCHILD_Y = 120; var MAX_CHILDREN = 4; // 最大の表示子供。これより多い子供は省略 var CenterLineInfo = /** @class */ (function () { function CenterLineInfo(initialY) { this._leftYList = []; this._rightYList = []; this._initialY = initialY; } CenterLineInfo.prototype.addLeft = function (y) { this._leftYList.push(y); }; CenterLineInfo.prototype.addRight = function (y) { this._rightYList.push(y); }; CenterLineInfo.prototype.maxY = function () { return Math.max(this.maxLeft(), this.maxRight()); }; CenterLineInfo.prototype.maxLeft = function () { var max = this._initialY; for (var _i = 0, _a = this._leftYList; _i < _a.length; _i++) { var n = _a[_i]; if (max < n) { max = n; } } return max - this._initialY; }; CenterLineInfo.prototype.maxRight = function () { var max = this._initialY; for (var _i = 0, _a = this._rightYList; _i < _a.length; _i++) { var n = _a[_i]; if (max < n) { max = n; } } return max - this._initialY; }; CenterLineInfo.prototype.initialY = function () { return this._initialY; }; CenterLineInfo.prototype.leftYList = function () { return this._leftYList; }; CenterLineInfo.prototype.rightYList = function () { return this._rightYList; }; return CenterLineInfo; }()); var FONT_NAME = '游ゴシック'; var FONT_SIZE = 18; var COLOR = 0x2A1713; var Sprite_Name = /** @class */ (function (_super) { __extends(Sprite_Name, _super); function Sprite_Name(taneoyaId, isChild) { var _this = _super.call(this) || this; //this.bitmap.drawText('ゴブリン', 0, 0, 100, 30, 'center'); var name; if (isChild) { name = getBabyName(taneoyaId); } else { name = getTaneoyaName(taneoyaId); } var bmtext2 = new PIXI.extras.BitmapText(name, { font: { name: FONT_NAME, size: FONT_SIZE, }, align: 'left', tint: COLOR, }); bmtext2.x = Math.floor((102 - bmtext2.width) / 2); bmtext2.y = 8; _this.addChild(bmtext2); return _this; } return Sprite_Name; }(Sprite)); var Sprite_Child = /** @class */ (function (_super) { __extends(Sprite_Child, _super); function Sprite_Child() { var _this = _super !== null && _super.apply(this, arguments) || this; _this._maxHeight = 0; return _this; } Sprite_Child.prototype.createNameSprite = function (taneoyaId, x, y, isChild, isCloseRelative) { if (isChild) { var type = getBabyPic(taneoyaId); var babyPic = new Sprite_Pic('menu_P04 PC001 子孫-' + type); babyPic.x = x; babyPic.y = y - 82; this.addChild(babyPic); if (isCloseRelative) { var closePic = new Sprite_Pic('menu_P04 PC001 家系図_子_近親マーク'); closePic.x = x + Nore.CLOSE_RELATIVE_X; closePic.y = y - 26 + Nore.CLOSE_RELATIVE_Y; this.addChild(closePic); } var sprite = new Sprite_Name(taneoyaId, true); sprite.x = x; if (isCloseRelative) { sprite.y = y + 6 + Nore.CLOSE_RELATIVE_NAME_Y; } else { sprite.y = y; } this.addChild(sprite); } else { var sprite = new Sprite_Name(taneoyaId, false); sprite.x = x; sprite.y = y; this.addChild(sprite); } }; Sprite_Child.prototype.calcGrandChildCount = function () { var n = 0; var child = this._child; while (child.hasGrandchild()) { n++; child = child.child(); } return n; }; Sprite_Child.prototype.calcHeight = function () { if (this._maxHeight > 0) { return this._maxHeight; } if (this._child.brotherCount() === 1) { // 兄弟がいない場合 return 150; } return 190; }; Sprite_Child.prototype.createBitmap = function () { var height = 200 + this.calcGrandChildCount() * INTERVAL_GRANDCHILD_Y; this.bitmap = new Bitmap(600, height); }; Sprite_Child.prototype.drawLineVertial = function (x, y, height) { this.bitmap.fillRect(x, y, 3, height, LINE_COLOR); this.bitmap.fillRect(x + 1, y, 1, height, BLOCK_COLOR); }; Sprite_Child.prototype.drawLineHorizontal = function (x, y, width) { this.bitmap.fillRect(x, y, width, 3, LINE_COLOR); this.bitmap.fillRect(x, y + 1, width, 1, BLOCK_COLOR); }; Sprite_Child.prototype.drawLineHorizontalDouble = function (x, y, width) { this.drawLineHorizontal(x, y, width); this.drawLineHorizontal(x, y + 4, width); }; Sprite_Child.prototype.putDot = function (x, y, color) { this.bitmap.fillRect(x, y, 1, 1, color); }; Sprite_Child.prototype.drawPlus = function (plus, x, y) { var bmtext2 = new PIXI.extras.BitmapText('+' + plus, { font: { name: FONT_NAME, size: FONT_SIZE, }, align: 'center', tint: COLOR, }); bmtext2.x = x; bmtext2.y = y; this.addChild(bmtext2); return bmtext2; }; Sprite_Child.prototype.maxChildren = function () { return MAX_CHILDREN; }; return Sprite_Child; }(Sprite)); var Sprite_ChildLeft = /** @class */ (function (_super) { __extends(Sprite_ChildLeft, _super); function Sprite_ChildLeft(child, y, centerLineInfo) { var _this = _super.call(this) || this; _this.y = y; _this._centerLineInfo = centerLineInfo; _this._child = child; _this.updatePosition(); _this.createBitmap(); _this.addFatherPic(); _this.addChildPic(child, 0); _this._centerLineInfo.addLeft(_this.y); return _this; } Sprite_ChildLeft.prototype.addFatherPic = function () { var fatherPic = new Sprite_Pic('menu_P04 PC001 家系図_親_left'); fatherPic.x = INTERBAL_X * 3; this.addChild(fatherPic); this.createNameSprite(this._child.taneoyaId(), fatherPic.x, fatherPic.y, false); }; Sprite_ChildLeft.prototype.addChildPic = function (child, y) { if (child.hasGrandchild()) { this.addGrandChild(y, child); } else { this.drawBgLines(child, y); var maxChild = Math.min(child.brotherCount(), MAX_CHILDREN); var xx = (MAX_CHILDREN - maxChild) * INTERBAL_X; var yy = y; for (var i = 0; i < maxChild; i++) { var childPic = new Sprite_Pic('menu_P04 PC001 家系図_子'); childPic.x = 77 + INTERBAL_X * i + xx; if (child.brotherCount() == 1) { childPic.y = MARGIN_BETWEEN_FATHER_AND_CHILD + yy; } else { childPic.y = MARGIN_BETWEEN_FATHER_AND_CHILDREN + yy; } this.addChild(childPic); this.createNameSprite(child.taneoyaId(), childPic.x, childPic.y + 26, true, child.generation() > 1); } if (child.brotherCount() > this.maxChildren()) { this.addOmitPic(child.brotherCount() - this.maxChildren(), y); } } }; Sprite_ChildLeft.prototype.addOmitPic = function (num, y) { var bro1 = (MAX_CHILDREN); var childPic = new Sprite_Pic('menu_P04 PC001 家系図_省略'); childPic.x = 21 + INTERBAL_X * bro1; childPic.y = MARGIN_BETWEEN_FATHER_AND_CHILD + 8 + y; this.drawLineHorizontal(childPic.x - 10, childPic.y + 2, 10); this.addChild(childPic); this.drawPlus(num, childPic.x + 15, childPic.y - 7); }; Sprite_ChildLeft.prototype.addGrandChild = function (y, child) { this._centerLineInfo.addLeft(this.y + y + INTERVAL_GRANDCHILD_Y); var hh = 70; var xx = 129 + 3 * INTERBAL_X; this.drawLineHorizontal(xx - GRAND_CHILD_X, y + 0 + hh - 1, GRAND_CHILD_X + 2); this.drawLineVertial(xx, y + 20, 50); this.drawLineVertial(xx - GRAND_CHILD_X, y + 0 + hh + 1, 50); var childPic = new Sprite_Pic('menu_P04 PC001 家系図_親_left'); childPic.x = 3 * INTERBAL_X; childPic.y = y + 20 + hh + GRAND_CHILD_Y; this.addChild(childPic); this.createNameSprite(child.taneoyaId(), childPic.x, childPic.y, true, child.generation() > 1); if (!this._maxHeight) { this._maxHeight = 190; } this._maxHeight += INTERVAL_GRANDCHILD_Y; if (child.brotherCount() > 1) { var maxChild = Math.min(child.brotherCount(), MAX_CHILDREN - 1) - 1; this.drawLineHorizontal(409 - INTERBAL_X * maxChild, y + hh - 1, INTERBAL_X * maxChild + 5); var xx_1 = 0; var yy = y + 12; for (var i = 0; i < maxChild; i++) { this.drawLineVertial(289 - INTERBAL_X * i, y + MARGIN_BETWEEN_FATHER_AND_CHILDREN - 9, 50); var childPic_1 = new Sprite_Pic('menu_P04 PC001 家系図_子'); childPic_1.x = 237 - INTERBAL_X * i + xx_1; childPic_1.y = MARGIN_BETWEEN_FATHER_AND_CHILDREN + yy; this.addChild(childPic_1); this.createNameSprite(child.taneoyaId(), childPic_1.x, childPic_1.y + 26, true, child.generation() > 1); } this.putDot(409 - INTERBAL_X * maxChild, y + 70, LINE_COLOR); } else { this.putDot(xx - GRAND_CHILD_X, y + 70, LINE_COLOR); } if (child.brotherCount() > MAX_CHILDREN - 1) { this.addOmitPic(child.brotherCount() - (MAX_CHILDREN - 1), y + 9); } else { this.putDot(491, y + 70, LINE_COLOR); } this.addChildPic(child.child(), y + INTERVAL_GRANDCHILD_Y); }; Sprite_ChildLeft.prototype.updatePosition = function () { this.x = 306 - INTERBAL_X * 3; }; Sprite_ChildLeft.prototype.drawBgLines = function (child, y) { var bro1 = Math.min((child.brotherCount() - 1), 3); if (child.brotherCount() == 1) { this.drawLineVertial(129 + INTERBAL_X * 3, 20 + y, 30); return; } var xx = (3 - bro1) * INTERBAL_X; var maxChild = Math.min(bro1, MAX_CHILDREN); this.drawLineVertial(129 + INTERBAL_X * maxChild + xx, 23 + y, 60); this.drawLineHorizontal(129 + xx, 60 + y, INTERBAL_X * Math.min(bro1, MAX_CHILDREN - 1) + 1); this.putDot(129 + xx, 61 + y, LINE_COLOR); for (var i = 0; i < Math.min(bro1, MAX_CHILDREN); i++) { this.drawLineVertial(129 + INTERBAL_X * i + xx, 62 + y, 29); } }; return Sprite_ChildLeft; }(Sprite_Child)); var Sprite_ChildRight = /** @class */ (function (_super) { __extends(Sprite_ChildRight, _super); function Sprite_ChildRight(child, y, centerLineInfo) { var _this = _super.call(this) || this; _this.y = y; _this._centerLineInfo = centerLineInfo; _this._child = child; _this.updatePosition(); _this.createBitmap(); _this.addFatherPic(); _this.addChildPic(child, 0); _this._centerLineInfo.addRight(_this.y); return _this; } Sprite_ChildRight.prototype.addFatherPic = function () { var fatherPic = new Sprite_Pic('menu_P04 PC001 家系図_親_right'); fatherPic.x = 0; this.addChild(fatherPic); this.createNameSprite(this._child.taneoyaId(), fatherPic.x + 45, fatherPic.y, false); }; Sprite_ChildRight.prototype.addChildPic = function (child, y) { if (child.hasGrandchild()) { this.addGrandChild(y, child); } else { this.drawBgLines(child, y); var maxChild = Math.min(child.brotherCount(), MAX_CHILDREN); var xx = -33; var yy = y; for (var i = 0; i < maxChild; i++) { var childPic = new Sprite_Pic('menu_P04 PC001 家系図_子'); childPic.x = INTERBAL_X * i + xx; if (child.brotherCount() == 1) { childPic.y = MARGIN_BETWEEN_FATHER_AND_CHILD + yy; } else { childPic.y = MARGIN_BETWEEN_FATHER_AND_CHILDREN + yy; } this.addChild(childPic); this.createNameSprite(child.taneoyaId(), childPic.x, childPic.y + 26, true, child.generation() > 1); } if (child.brotherCount() > this.maxChildren()) { this.addOmitPic(child.brotherCount() - this.maxChildren(), y); } } }; Sprite_ChildRight.prototype.addOmitPic = function (num, y) { var childPic = new Sprite_Pic('menu_P04 PC001 家系図_省略'); childPic.x = 0; childPic.y = MARGIN_BETWEEN_FATHER_AND_CHILD + 8 + y; this.drawLineHorizontal(childPic.x + 10, childPic.y + 2, 10); this.addChild(childPic); var sprite = this.drawPlus(num, childPic.x - 6, childPic.y - 7); sprite.x -= sprite.width; }; Sprite_ChildRight.prototype.addGrandChild = function (y, child) { this._centerLineInfo.addRight(this.y + y + INTERVAL_GRANDCHILD_Y); var hh = 70; var xx = 19; this.drawLineHorizontal(20, y + 0 + hh - 1, GRAND_CHILD_X + 2); this.drawLineVertial(xx, y + 20, 50); this.drawLineVertial(xx + GRAND_CHILD_X, y + 0 + hh + 1, 50); var childPic = new Sprite_Pic('menu_P04 PC001 家系図_親_right'); childPic.x = 0; childPic.y = y + 20 + hh + GRAND_CHILD_Y; this.addChild(childPic); this.createNameSprite(child.taneoyaId(), childPic.x + 45, childPic.y, true, child.generation() > 1); if (!this._maxHeight) { this._maxHeight = 190; } this._maxHeight += INTERVAL_GRANDCHILD_Y; if (child.brotherCount() > 1) { var maxChild = Math.min(child.brotherCount(), MAX_CHILDREN - 1) - 1; this.drawLineHorizontal(98, y + hh - 1, INTERBAL_X * maxChild + 4); var xx_2 = 0; var yy = y + 12; this.putDot(98 + INTERBAL_X * maxChild + 3, y + hh, LINE_COLOR); for (var i = 0; i < maxChild; i++) { this.drawLineVertial(219 + INTERBAL_X * i, y + MARGIN_BETWEEN_FATHER_AND_CHILDREN - 9, 50); var childPic_2 = new Sprite_Pic('menu_P04 PC001 家系図_子'); childPic_2.x = 167 + INTERBAL_X * i + xx_2; childPic_2.y = MARGIN_BETWEEN_FATHER_AND_CHILDREN + yy; this.addChild(childPic_2); this.createNameSprite(child.taneoyaId(), childPic_2.x, childPic_2.y + 26, true, child.generation() > 1); } } else { this.putDot(97, y + 70, LINE_COLOR); } if (child.brotherCount() > MAX_CHILDREN - 1) { this.addOmitPic(child.brotherCount() - (MAX_CHILDREN - 1), y + 9); } else { this.putDot(491, y + 70, LINE_COLOR); } this.addChildPic(child.child(), y + INTERVAL_GRANDCHILD_Y); }; Sprite_ChildRight.prototype.updatePosition = function () { this.x = 566; }; Sprite_ChildRight.prototype.drawBgLines = function (child, y) { var bro1 = Math.min((child.brotherCount() - 1), 4); if (child.brotherCount() == 1) { this.drawLineVertial(19, 20 + y, 30); return; } var xx = 10; var maxChild = Math.min(bro1, MAX_CHILDREN - 1); this.drawLineVertial(19, 23 + y, 60); this.drawLineHorizontal(21, 60 + y, INTERBAL_X * Math.min(bro1, MAX_CHILDREN - 1) + 1); this.putDot(21 + INTERBAL_X * Math.min(bro1, MAX_CHILDREN - 1), 60 + y + 1, LINE_COLOR); for (var i = 0; i < Math.min(bro1, MAX_CHILDREN - 1); i++) { this.drawLineVertial(129 + INTERBAL_X * i + xx, 62 + y, 29); } }; return Sprite_ChildRight; }(Sprite_Child)); var Sprite_VerticalLine = /** @class */ (function (_super) { __extends(Sprite_VerticalLine, _super); function Sprite_VerticalLine(centerLineInfo) { var _this = _super.call(this) || this; var offsetX = 60; var max = centerLineInfo.maxY() + 6; // bitmapの最大サイズ超え let margin = 20; max = Math.min(max, 16384 - margin); _this.bitmap = new Bitmap(120, max + margin); _this.drawLineVertial(offsetX + 0, 0, max); _this.drawLineVertial(offsetX + 3, 0, max); var yList = centerLineInfo.leftYList(); for (var i = 0; i < yList.length; i++) { var y = yList[i]; _this.drawLineHorizontal(0, y - centerLineInfo.initialY(), offsetX + 1); _this.drawLineHorizontal(0, y - centerLineInfo.initialY() + 4, offsetX + 1); } var yList2 = centerLineInfo.rightYList(); for (var i = 0; i < yList2.length; i++) { var y = yList2[i]; _this.drawLineHorizontal(offsetX + 5, y - centerLineInfo.initialY(), offsetX + 1); _this.drawLineHorizontal(offsetX + 5, y - centerLineInfo.initialY() + 4, offsetX + 1); } if (centerLineInfo.maxLeft() > centerLineInfo.maxRight()) { _this.bitmap.fillRect(offsetX + 1, centerLineInfo.maxLeft() + 2, 3, 1, LINE_COLOR); _this.bitmap.fillRect(offsetX, centerLineInfo.maxLeft() + 3, 3, 1, BG_COLOR); _this.bitmap.fillRect(offsetX + 1, centerLineInfo.maxLeft() + 4, 3, 1, LINE_COLOR); _this.bitmap.fillRect(offsetX + 1, centerLineInfo.maxLeft() + 5, 4, 1, BLOCK_COLOR); _this.bitmap.fillRect(offsetX + 1, centerLineInfo.maxLeft() + 6, 4, 1, LINE_COLOR); } else if (centerLineInfo.maxLeft() < centerLineInfo.maxRight()) { _this.bitmap.fillRect(offsetX + 2, centerLineInfo.maxRight() + 2, 3, 1, LINE_COLOR); _this.bitmap.fillRect(offsetX + 4, centerLineInfo.maxRight() + 3, 3, 1, BG_COLOR); _this.bitmap.fillRect(offsetX + 2, centerLineInfo.maxRight() + 4, 3, 1, LINE_COLOR); _this.bitmap.fillRect(offsetX + 2, centerLineInfo.maxRight() + 5, 4, 1, BLOCK_COLOR); _this.bitmap.fillRect(offsetX + 1, centerLineInfo.maxRight() + 6, 4, 1, LINE_COLOR); } else { } return _this; } Sprite_VerticalLine.prototype.drawLineVertial = function (x, y, height) { this.bitmap.fillRect(x, y, 3, height, LINE_COLOR); this.bitmap.fillRect(x + 1, y, 1, height, BLOCK_COLOR); }; Sprite_VerticalLine.prototype.drawLineHorizontal = function (x, y, width) { this.bitmap.fillRect(x, y, width, 3, LINE_COLOR); this.bitmap.fillRect(x, y + 1, width, 1, BLOCK_COLOR); }; return Sprite_VerticalLine; }(Sprite)); var Window_FamilyTree = /** @class */ (function (_super) { __extends(Window_FamilyTree, _super); function Window_FamilyTree() { return _super !== null && _super.apply(this, arguments) || this; } Window_FamilyTree.prototype.initialize = function (x, y, w, h) { _super.prototype.initialize.call(this, x, y, w, h); this.backOpacity = 0; this._windowBackSprite.alpha = 0; this._windowFrameSprite.visible = false; //this.contentsOpacity = 0; this._maxHeight = 1100; this.createBaseSprite(); this.addPicture(); this.createChildSprites(); this.createFadeSprite(); this.y = -1000; }; Window_FamilyTree.prototype.createFadeSprite = function () { this._fadeSprite = new ScreenSprite(); this.addChild(this._fadeSprite); }; ; Window_FamilyTree.prototype.createBaseSprite = function () { this._baseSprite = new Sprite(); this.addChild(this._baseSprite); }; Window_FamilyTree.prototype.addPicture = function () { this._pic1 = new Sprite_Pic('menu_P04 PC001 家系図_A'); this._baseSprite.addChild(this._pic1); this._pic2 = new Sprite_Pic('menu_P04 PC001 家系図_B'); this._pic2.y = Graphics.boxHeight; this._baseSprite.addChild(this._pic2); }; Window_FamilyTree.prototype.createChildSprites = function () { var familyTree = $gameSystem.familyTree(); if (familyTree.children().length === 0) { return; } this.addSerenaBack(); var initialY = 1420; var centerLineInfo = new CenterLineInfo(initialY); var leftY = initialY; var rightY = initialY; var plusRightHeight = false; for (var _i = 0, _a = familyTree.children(); _i < _a.length; _i++) { var child = _a[_i]; var isLeft = leftY <= rightY; if (isLeft) { /*if (lastLeftHeight > 0) { this.addVertialLine(leftY, lastLeftHeight); }*/ leftY += this.addLeft(child, leftY, centerLineInfo); } else { rightY += this.addRight(child, rightY, centerLineInfo); if (!plusRightHeight) { plusRightHeight = true; rightY += Nore.RIGHT_TREE_OFFSET; } } } this.drawCenterLine(centerLineInfo); this.addSerenaSprite(); this._maxHeight = Math.max(leftY, rightY) - 550; }; Window_FamilyTree.prototype.drawCenterLine = function (centerLineInfo) { var height = centerLineInfo.maxY(); var sprite = new Sprite_VerticalLine(centerLineInfo); sprite.x = 450; sprite.y = centerLineInfo.initialY() + 16; this._baseSprite.addChild(sprite); }; Window_FamilyTree.prototype.addSerenaBack = function () { var g = new PIXI.Graphics(); g.beginFill(0x976d64, 1); g.drawRect(0, 0, 140, 160); g.endFill(); g.x = 440; g.y = Graphics.boxHeight * 2 - 204; this._baseSprite.addChild(g); }; Window_FamilyTree.prototype.addSerenaSprite = function () { this._pic3 = new Sprite_Pic('menu_P04 PC001 家系図_C'); this._pic3.x = 424; this._pic3.y = 1332; this._baseSprite.addChild(this._pic3); }; Window_FamilyTree.prototype.addLeft = function (child, y, centerLineInfo) { var sprite = new Sprite_ChildLeft(child, y, centerLineInfo); this._baseSprite.addChild(sprite); return sprite.calcHeight(); }; Window_FamilyTree.prototype.addRight = function (child, y, centerLineInfo) { var sprite = new Sprite_ChildRight(child, y, centerLineInfo); this._baseSprite.addChild(sprite); return sprite.calcHeight(); }; Window_FamilyTree.prototype.refresh = function () { }; Object.defineProperty(Window_FamilyTree.prototype, "backOpacity", { set: function (n) { }, enumerable: true, configurable: true }); Window_FamilyTree.prototype.update = function () { _super.prototype.update.call(this); if (this._fadeSprite) { this._fadeSprite.opacity = 255 - $gameScreen.brightness(); } if (Input.isPressed('up')) { this.y += this.interval(); if (this.y > 0) { this.y = 0; } } else if (Input.isPressed('down')) { this.y -= this.interval(); if (this.y < -this.maxY()) { this.y = -this.maxY(); } } }; Window_FamilyTree.prototype.interval = function () { return 10; }; Window_FamilyTree.prototype.maxY = function () { return this._maxHeight; }; return Window_FamilyTree; }(Window_Base)); Nore.Window_FamilyTree = Window_FamilyTree; })(Nore || (Nore = {})); /* (function() { function p(arg) { console.log(arg); } (window as any).p = p; })(); */ var TANEOYA_MAP = { 1: ["不明", "不明"], 2: ["ジャック", "ジャック"], 3: ["ヘンリー", "ヘンリー"], 4: ["ゴードン", "ゴードン"], 5: ["ドッヂ", "ドッヂ"], 6: ["通り魔ジョン(賞金首)", "ジョン"], 7: ["異教徒ブライ(賞金首)", "ブライ"], 8: ["強姦魔トム(賞金首)", "トム"], 9: ["強盗ゴブログ(賞金首)", "ゴブログ"], 10: ["ゴミ漁りギー(賞金首)", "ギー"], 11: ["人攫いビョーン(賞金首)", "ビョーン"], 12: ["博愛者ギニュー(賞金首)", "ギニュー"], 13: ["ヴァンサン(スラム)", "ヴァンサン"], 14: ["アルベール(市民)", "アルベール"], 15: ["サミュエル(市民)", "サミュエル"], 16: ["ドニ(市民)", "ドニ"], 17: ["マチアス(市民)", "マチアス"], 18: ["マルセル(市民)", "マルセル"], 19: ["店主ディーコン(市民)", "ディーコン"], 20: ["富豪グービル(市民)", "グーピル"], 21: ["市警長デムーラン(市民)", "デムーラン"], 22: ["町医者ロドリグ(市民)", "ロドリグ"], 23: ["オリバー(冒険者)", "オリバー"], 24: ["ガエタン(冒険者)", "ガエタン"], 25: ["ジョエル(冒険者)", "ジョエル"], 26: ["トリスタン(冒険者)", "トリスタン"], 27: ["豚のゲクラン(市民)", "ゲクラン"], 28: ["本屋のティム(市民)", "ティム"], 29: ["ギャングリーダーガヌロン(スラム)", "ガヌロン"], 30: ["ギャングのバーダン(スラム)", "バーダン"], 31: ["人間(個人", ""], 32: ["人間(個人", ""], 33: ["人間(個人", ""], 34: ["人間(個人", ""], 35: ["人間(個人", ""], 36: ["人間(個人", ""], 37: ["人間(個人", ""], 38: ["人間(個人", ""], 39: ["人間(個人", ""], 40: ["人間(個人", ""], 41: ["人間(個人", ""], 42: ["人間(個人", ""], 43: ["人間(個人", ""], 44: ["人間(個人", ""], 45: ["人間(個人", ""], 46: ["人間(個人", ""], 47: ["人間(個人", ""], 48: ["人間(個人", ""], 49: ["人間(個人", ""], 50: ["人間(個人", ""], 51: ["温泉屋ヘンリー(第三部)", "ヘンリー"], 52: ["鬼狩りマクシス(第三部)", "マクシス"], 53: ["宿屋モリス(第三部)", "モリス"], 54: ["武器屋ピエール(第三部)", "ピエール"], 55: ["乱暴者ブリュノ(第三部)", "ブリュノ"], 56: ["マセガキマセル(第三部)", "マセル"], 57: ["種馬スタリオン(第三部)", "スタリオン"], 58: ["農夫ボンド(第三部)", "ボンド"], 59: ["人間(個人", ""], 60: ["人間(個人", ""], 61: ["人間(個人", ""], 62: ["人間(個人", ""], 63: ["人間(個人", ""], 64: ["人間(個人", ""], 65: ["人間(個人", ""], 66: ["人間(個人", ""], 67: ["人間(個人", ""], 68: ["人間(個人", ""], 69: ["人間(個人", ""], 70: ["人間(個人", ""], 71: ["人間(個人", ""], 72: ["人間(個人", ""], 73: ["人間(個人", ""], 74: ["人間(個人", ""], 75: ["人間(個人", ""], 76: ["人間(個人", ""], 77: ["人間(個人", ""], 78: ["人間(個人", ""], 79: ["人間(個人", ""], 80: ["人間(個人", ""], 81: ["人間(個人", ""], 82: ["人間(個人", ""], 83: ["人間(個人", ""], 84: ["人間(個人", ""], 85: ["人間(個人", ""], 86: ["人間(個人", ""], 87: ["人間(個人", ""], 88: ["人間(個人", ""], 89: ["人間(個人", ""], 90: ["人間(個人", ""], 91: ["人間(個人", ""], 92: ["人間(個人", ""], 93: ["人間(個人", ""], 94: ["人間(個人", ""], 95: ["人間(個人", ""], 96: ["人間(個人", ""], 97: ["人間(個人", ""], 98: ["人間(個人", ""], 99: ["人間(個人", ""], 100: ["分からない", "父親不明"], 101: ["不明", "不明", "父親不明"], 102: ["孤児", "孤児"], 103: ["市警隊員", "市警隊員"], 104: ["冒険者", "冒険者"], 105: ["ごろつき", "ごろつき"], 106: ["市民悪漢(ちんぴら)", "チンピラ"], 107: ["異教徒", "異教徒"], 108: ["浮浪者", "浮浪者"], 109: ["ガヌロンの息子", "ガヌロンの息子", "ガヌロンの孫"], 110: ["人間(職業", ""], 111: ["人間(職業", ""], 112: ["人間(職業", ""], 113: ["人間(職業", ""], 114: ["人間(職業", ""], 115: ["売春客", "売春客"], 116: ["異人", "異人"], 117: ["囚人", "囚人"], 118: ["人間(職業", ""], 119: ["人間(職業", ""], 120: ["人間(職業", ""], 121: ["人間(職業", ""], 122: ["人間(職業", ""], 123: ["人間(職業", ""], 124: ["人間(職業", ""], 125: ["人間(職業", ""], 126: ["人間(職業", ""], 127: ["人間(職業", ""], 128: ["人間(職業", ""], 129: ["人間(職業", ""], 130: ["人間(職業", ""], 131: ["人間(職業", ""], 132: ["人間(職業", ""], 133: ["人間(職業", ""], 134: ["人間(職業", ""], 135: ["人間(職業", ""], 136: ["人間(職業", ""], 137: ["人間(職業", ""], 138: ["人間(職業", ""], 139: ["人間(職業", ""], 140: ["人間(職業", ""], 141: ["人間(職業", ""], 142: ["人間(職業", ""], 143: ["人間(職業", ""], 144: ["人間(職業", ""], 145: ["人間(職業", ""], 146: ["人間(職業", ""], 147: ["人間(職業", ""], 148: ["人間(職業", ""], 149: ["人間(職業", ""], 150: ["人間(職業", ""], 151: ["モンスター(個体", ""], 152: ["モンスター(個体", ""], 153: ["モンスター(個体", ""], 154: ["モンスター(個体", ""], 155: ["モンスター(個体", ""], 156: ["モンスター(個体", ""], 157: ["モンスター(個体", ""], 158: ["モンスター(個体", ""], 159: ["モンスター(個体", ""], 160: ["モンスター(個体", ""], 161: ["モンスター(個体", ""], 162: ["モンスター(個体", ""], 163: ["モンスター(個体", ""], 164: ["モンスター(個体", ""], 165: ["モンスター(個体", ""], 166: ["モンスター(個体", ""], 167: ["モンスター(個体", ""], 168: ["モンスター(個体", ""], 169: ["モンスター(個体", ""], 170: ["モンスター(個体", ""], 171: ["モンスター(個体", ""], 172: ["モンスター(個体", ""], 173: ["モンスター(個体", ""], 174: ["モンスター(個体", ""], 175: ["モンスター(個体", ""], 176: ["モンスター(個体", ""], 177: ["モンスター(個体", ""], 178: ["モンスター(個体", ""], 179: ["モンスター(個体", ""], 180: ["モンスター(個体", ""], 181: ["モンスター(個体", ""], 182: ["モンスター(個体", ""], 183: ["モンスター(個体", ""], 184: ["モンスター(個体", ""], 185: ["モンスター(個体", ""], 186: ["モンスター(個体", ""], 187: ["モンスター(個体", ""], 188: ["モンスター(個体", ""], 189: ["モンスター(個体", ""], 190: ["モンスター(個体", ""], 191: ["モンスター(個体", ""], 192: ["モンスター(個体", ""], 193: ["モンスター(個体", ""], 194: ["モンスター(個体", ""], 195: ["モンスター(個体", ""], 196: ["モンスター(個体", ""], 197: ["モンスター(個体", ""], 198: ["モンスター(個体", ""], 199: ["モンスター(個体", ""], 200: ["モンスター(個体", ""], 201: ["ゴブリン", "ゴブリン"], 202: ["ゴブリンの仔", "ゴブリンの仔"], 203: ["モンスター(種族", ""], 204: ["モンスター(種族", ""], 205: ["モンスター(種族", ""], 206: ["オーク", "オーク"], 207: ["オークの仔", "オークの仔"], 208: ["モンスター(種族", ""], 209: ["モンスター(種族", ""], 210: ["モンスター(種族", ""], 211: ["スライム", "スライム"], 212: ["モンスター(種族", ""], 213: ["ビッグスライム", "スライム"], 214: ["ビッグスライム", "スライム", "セレナの子"], 215: ["モンスターの仔", ""], 216: ["スタリオン", "スタリオン"], 217: ["スタリオンの仔", "スタリオンの仔"], 218: ["モンスター(種族", ""], 219: ["モンスター(種族", ""], 220: ["モンスター(種族", ""], 221: ["ローパー", "ローパー", "ローパーの幼体"], 222: ["ローパーの仔", "ローパーの幼体"], 223: ["モンスター(種族", ""], 224: ["モンスター(種族", ""], 225: ["モンスター(種族", ""], 226: ["ピッグマン", "ピッグマン"], 227: ["ピッグマンの仔", "ピッグマンの仔"], 228: ["モンスター(種族", ""], 229: ["モンスター(種族", ""], 230: ["モンスター(種族", ""], 231: ["ワーグ", "ワーグ", "ワーグの仔"], 232: ["ワーグの仔", "ワーグの仔"], 233: ["モンスター(種族", ""], 234: ["モンスター(種族", ""], 235: ["モンスター(種族", ""], 236: ["モンスター(個体", ""], 237: ["モンスター(個体", ""], 238: ["モンスター(種族", ""], 239: ["モンスター(種族", ""], 240: ["モンスター(種族", ""], 241: ["モンスター(種族", ""], 242: ["モンスター(種族", ""], 243: ["モンスター(種族", ""], 244: ["モンスター(種族", ""], 245: ["モンスター(種族", ""], 246: ["モンスター(種族", ""], 247: ["モンスター(種族", ""], 248: ["モンスター(種族", ""], 249: ["モンスター(種族", ""], 250: ["モンスター(種族", ""], 251: ["その他", ""], 252: ["その他", ""], 253: ["その他", ""], 254: ["その他", ""], 255: ["その他", ""], 256: ["その他", ""], 257: ["その他", ""], 258: ["その他", ""], 259: ["その他", ""], 260: ["その他", ""], 261: ["その他", ""], 262: ["その他", ""], 263: ["その他", ""], 264: ["その他", ""], 265: ["その他", ""], 266: ["その他", ""], 267: ["その他", ""], 268: ["その他", ""], 269: ["その他", ""], 270: ["その他", ""], 271: ["その他", ""], 272: ["その他", ""], 273: ["その他", ""], 274: ["その他", ""], 275: ["その他", ""], 276: ["その他", ""], 277: ["その他", ""], 278: ["その他", ""], 279: ["その他", ""], 280: ["その他", ""], 281: ["その他", ""], 282: ["その他", ""], 283: ["その他", ""], 284: ["その他", ""], 285: ["その他", ""], 286: ["その他", ""], 287: ["その他", ""], 288: ["その他", ""], 289: ["その他", ""], 290: ["その他", ""], 291: ["その他", ""], 292: ["その他", ""], 293: ["その他", ""], 294: ["その他", ""], 295: ["その他", ""], 296: ["その他", ""], 297: ["その他", ""], 298: ["その他", ""], 299: ["その他", ""], 300: ["その他", ""], }; function getTaneoyaName(id) { if (!TANEOYA_MAP[id]) { console.error('ID が' + id + 'の種親が見つかりません'); return ''; } return TANEOYA_MAP[id][1]; } function getBabyName(id) { if (!TANEOYA_MAP[id]) { console.error('ID が' + id + 'の子供が見つかりません'); return ''; } if (TANEOYA_MAP[id][2]) { return TANEOYA_MAP[id][2]; } return TANEOYA_MAP[id][1] + 'の子'; } function getBabyPic(id) { switch (id) { case 201: return 'ゴブリンの子供'; case 202: return 'ゴブリンの子供'; case 206: return 'オークの子供'; case 207: return 'オークの子供'; case 211: return 'スライムの幼体'; case 213: return 'スライムの幼体'; case 216: return 'スタリオンの子供'; case 217: return 'スタリオンの子供'; case 221: return 'ローパーの子供'; case 222: return 'ローパーの子供'; case 226: return 'ピッグマンの子供'; case 227: return 'ピッグマンの子供'; case 231: return 'ワーグの子供'; case 232: return 'ワーグの子供'; case 6: return '悪人の子供'; case 7: return '黒人の子供'; case 29: return '黒人の子供'; case 30: return '黒人の子供'; case 109: return '黒人の子供'; default: return '〇〇の子供'; } }
dazed/translations
www/js/plugins/Nore_FamilyTree2.js
JavaScript
unknown
51,720
var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); /*:ja * @author ル * * @param rightTreeOffset * @desc 右側のツリーは、この値だけずれます * @default 15 */ var Nore; (function (Nore) { var Parameters = PluginManager.parameters('Nore_FamilyTree2'); Nore.RIGHT_TREE_OFFSET = Parameters['rightTreeOffset'] ? Math.trunc(Parameters['rightTreeOffset']) : 15; // 設定 var FONT_NAME = '游ゴシック'; var FONT_SIZE = 18; var COLOR = 0x2A1713; Nore.CHILD_TEXT_JA = 'の子供'; Nore.CHILD_TEXT_EN = 'Child of'; var loader; var _Scene_Boot_loadSystemImages = Scene_Boot.loadSystemImages; Scene_Boot.loadSystemImages = function () { _Scene_Boot_loadSystemImages.call(this); loader = new PIXI.loaders.Loader(); loader.add('HeaderFont', './fonts/bgfont.fnt') .load(function () { }); }; var Scene_Map_prototype_update = Scene_Map.prototype.update; Scene_Map.prototype.update = function () { Scene_Map_prototype_update.call(this); if ($gameSwitches.value(601)) { this.showFamilyTree(); } else { this.hideFamilyTree(); } }; Scene_Map.prototype.showFamilyTree = function () { if (!this._familyTreeWindow) { this.createFamilyTreeBg(); this._familyTreeWindow = new Nore.Window_FamilyTree(0, 0, Graphics.boxWidth, Graphics.boxHeight); this._spriteset.addChild(this._familyTreeWindow); } this._familyTreeBg.visible = true; this._familyTreeWindow.visible = true; this._familyTreeWindow.update(); }; Scene_Map.prototype.hideFamilyTree = function () { if (this._familyTreeWindow && this._familyTreeWindow.visible) { this._familyTreeWindow.visible = false; this._familyTreeBg.visible = false; } }; Scene_Map.prototype.createFamilyTreeBg = function () { if (this._familyTreeBg) { return; } var g = new PIXI.Graphics(); g.beginFill(0x976d64, 1); g.drawRect(0, 0, Graphics.boxWidth + 10, Graphics.boxHeight + 10); g.endFill(); this._familyTreeBg = g; this._spriteset.addChild(g); }; })(Nore || (Nore = {})); var Game_FamilyTree = /** @class */ (function () { function Game_FamilyTree() { this._children = []; } Game_FamilyTree.prototype.addChild = function (taneoyaId, childCount) { var newChild = new Game_Child(taneoyaId); newChild.plusBrother(childCount - 1); this._children.push(newChild); this._lastChild = newChild; return newChild.id(); }; Game_FamilyTree.prototype.addGrandchild = function (childCount, id) { if (id) { var parent_1 = this.findChild(id); if (!parent_1) { console.error('孫を追加しようとしましたが、' + id + 'のIDの子供が存在しません'); return; } var newChild = new Game_Child(parent_1.taneoyaId(), parent_1.generation() + 1); newChild.plusBrother(childCount - 1); parent_1.addChild(newChild); return newChild.id(); } else { if (!this._lastChild) { console.error('孫を追加しようとしましたが、直前に産まれた子供が存在しません'); return; } var newChild = new Game_Child(this._lastChild.taneoyaId(), this._lastChild.generation() + 1); newChild.plusBrother(childCount - 1); this._lastChild.addChild(newChild); this._lastChild = newChild; return newChild.id(); } }; Game_FamilyTree.prototype.addBrother = function (taneoyaId) { if (!taneoyaId) { console.error('兄弟を追加しようとしましたが、種親IDが指定されていません'); return; } var child = this.findLastChild(taneoyaId); if (!child) { console.error('兄弟を追加しようとしましたが、' + taneoyaId + 'の種親IDが見つからないため新規に追加しました'); this.addChild(taneoyaId); return; } child.plusBrother(1); }; Game_FamilyTree.prototype.findLastChild = function (taneoyaId) { for (var i = this._children.length - 1; i >= 0; i--) { var child = this._children[i]; if (child.taneoyaId() == taneoyaId) { return child; } } return null; }; Game_FamilyTree.prototype.children = function () { return this._children; }; Game_FamilyTree.prototype.countChild = function (taneoyaId) { var total = 0; for (var _i = 0, _a = this._children; _i < _a.length; _i++) { var c = _a[_i]; total += c.countChild(taneoyaId); } return total; }; Game_FamilyTree.prototype.findChild = function (id) { for (var _i = 0, _a = this._children; _i < _a.length; _i++) { var c = _a[_i]; if (c.id() == id) { return c; } var found = c.findChild(id); if (found) { return found; } } return null; }; return Game_FamilyTree; }()); var Game_Child = /** @class */ (function () { function Game_Child(taneoyaId, generation) { if (generation === void 0) { generation = 1; } this._brotherCount = 1; this._children = []; this._id = $gameSystem.nextChildId(); this._taneoyaId = taneoyaId; this._generation = generation; } Game_Child.prototype.id = function () { return this._id; }; Game_Child.prototype.taneoyaId = function () { return this._taneoyaId; }; Game_Child.prototype.addChild = function (child) { this._children.push(child); }; Game_Child.prototype.plusBrother = function (n) { this._brotherCount += n; }; Game_Child.prototype.brotherCount = function () { return this._brotherCount; }; Game_Child.prototype.hasGrandchild = function () { return this._children.length > 0; }; Game_Child.prototype.child = function () { return this._children[0]; }; Game_Child.prototype.generation = function () { return this._generation; }; Game_Child.prototype.countChild = function (taneoyaId) { if (this._taneoyaId != taneoyaId) { return 0; } var total = this._brotherCount; for (var _i = 0, _a = this._children; _i < _a.length; _i++) { var c = _a[_i]; total += c.countChild(taneoyaId); } return total; }; Game_Child.prototype.findChild = function (id) { var c = this.child(); if (c) { if (c.id() == id) { return c; } return c.findChild(id); } return null; }; return Game_Child; }()); Game_System.prototype.addChild = function (taneoyaId, childCount) { if (childCount === void 0) { childCount = 1; } this._familyTree = this._familyTree || new Game_FamilyTree(); return this._familyTree.addChild(taneoyaId, childCount); }; Game_System.prototype.addBrother = function (taneoyaId) { this._familyTree = this._familyTree || new Game_FamilyTree(); this._familyTree.addBrother(taneoyaId); }; Game_System.prototype.addGrandchild = function (childCount, parentId) { if (childCount === void 0) { childCount = 1; } this._familyTree = this._familyTree || new Game_FamilyTree(); return this._familyTree.addGrandchild(childCount, parentId); }; Game_System.prototype.nextChildId = function () { this._nextChildId = this._nextChildId || 0; this._nextChildId++; return this._nextChildId; }; Game_System.prototype.familyTree = function () { this._familyTree = this._familyTree || new Game_FamilyTree(); return this._familyTree; }; Game_System.prototype.countChild = function (taneoyaId) { this._familyTree = this._familyTree || new Game_FamilyTree(); return this._familyTree.countChild(taneoyaId); }; (function (Nore) { var Scene_FamilyTree = /** @class */ (function (_super) { __extends(Scene_FamilyTree, _super); function Scene_FamilyTree() { return _super !== null && _super.apply(this, arguments) || this; } Scene_FamilyTree.prototype.create = function () { _super.prototype.create.call(this); this.createFamilyTreeWindow(); }; Scene_FamilyTree.prototype.createBackground = function () { var g = new PIXI.Graphics(); g.beginFill(0x976d64, 1); g.drawRect(0, 0, Graphics.boxWidth + 10, Graphics.boxHeight + 10); g.endFill(); this.addChild(g); }; Scene_FamilyTree.prototype.createFamilyTreeWindow = function () { this._familyTreeWindow = new Window_FamilyTree(0, 0, Graphics.boxWidth, Graphics.boxHeight); this._familyTreeWindow.refresh(); this.addWindow(this._familyTreeWindow); }; Scene_FamilyTree.prototype.update = function () { _super.prototype.update.call(this); if (Input.isTriggered('cancel')) { SoundManager.playCancel(); SceneManager.pop(); } }; return Scene_FamilyTree; }(Scene_MenuBase)); Nore.Scene_FamilyTree = Scene_FamilyTree; var Sprite_Pic = /** @class */ (function (_super) { __extends(Sprite_Pic, _super); function Sprite_Pic(name) { var _this = _super.call(this) || this; _this._name = name; _this.bitmap = ImageManager.loadPicture('エロステータス/' + name); return _this; } Sprite_Pic.prototype.update = function () { _super.prototype.update.call(this); }; return Sprite_Pic; }(Sprite)); var BG_COLOR = '#976d64'; var LINE_COLOR = '#2a1713'; var BLOCK_COLOR = '#ffe9c3'; var INTERBAL_X = 120; var MARGIN_BETWEEN_FATHER_AND_CHILD = 50; var MARGIN_BETWEEN_FATHER_AND_CHILDREN = 80; var GRAND_CHILD_X = 76; var GRAND_CHILD_Y = 30; var INTERVAL_GRANDCHILD_Y = 120; var MAX_CHILDREN = 4; // 最大の表示子供。これより多い子供は省略 var CenterLineInfo = /** @class */ (function () { function CenterLineInfo(initialY) { this._leftYList = []; this._rightYList = []; this._initialY = initialY; } CenterLineInfo.prototype.addLeft = function (y) { this._leftYList.push(y); }; CenterLineInfo.prototype.addRight = function (y) { this._rightYList.push(y); }; CenterLineInfo.prototype.maxY = function () { return Math.max(this.maxLeft(), this.maxRight()); }; CenterLineInfo.prototype.maxLeft = function () { var max = this._initialY; for (var _i = 0, _a = this._leftYList; _i < _a.length; _i++) { var n = _a[_i]; if (max < n) { max = n; } } return max - this._initialY; }; CenterLineInfo.prototype.maxRight = function () { var max = this._initialY; for (var _i = 0, _a = this._rightYList; _i < _a.length; _i++) { var n = _a[_i]; if (max < n) { max = n; } } return max - this._initialY; }; CenterLineInfo.prototype.initialY = function () { return this._initialY; }; CenterLineInfo.prototype.leftYList = function () { return this._leftYList; }; CenterLineInfo.prototype.rightYList = function () { return this._rightYList; }; return CenterLineInfo; }()); var FONT_NAME = '游ゴシック'; var FONT_SIZE = 18; var COLOR = 0x2A1713; var Sprite_Name = /** @class */ (function (_super) { __extends(Sprite_Name, _super); function Sprite_Name(taneoyaId, isChild) { var _this = _super.call(this) || this; //this.bitmap.drawText('ゴブリン', 0, 0, 100, 30, 'center'); var name; if (isChild) { name = getBabyName(taneoyaId); } else { name = getTaneoyaName(taneoyaId); } var bmtext2 = new PIXI.extras.BitmapText(name, { font: { name: FONT_NAME, size: FONT_SIZE, }, align: 'left', tint: COLOR, }); bmtext2.x = Math.floor((102 - bmtext2.width) / 2); bmtext2.y = 8; _this.addChild(bmtext2); return _this; } return Sprite_Name; }(Sprite)); var Sprite_Child = /** @class */ (function (_super) { __extends(Sprite_Child, _super); function Sprite_Child() { var _this = _super !== null && _super.apply(this, arguments) || this; _this._maxHeight = 0; return _this; } Sprite_Child.prototype.createNameSprite = function (taneoyaId, x, y, isChild) { if (isChild) { var type = getBabyPic(taneoyaId); var babyPic = new Sprite_Pic('menu_P04 PC001 子孫-' + type); babyPic.x = x; babyPic.y = y - 82; this.addChild(babyPic); var sprite = new Sprite_Name(taneoyaId, true); sprite.x = x; sprite.y = y; this.addChild(sprite); } else { var sprite = new Sprite_Name(taneoyaId, false); sprite.x = x; sprite.y = y; this.addChild(sprite); } }; Sprite_Child.prototype.calcGrandChildCount = function () { var n = 0; var child = this._child; while (child.hasGrandchild()) { n++; child = child.child(); } return n; }; Sprite_Child.prototype.calcHeight = function () { if (this._maxHeight > 0) { return this._maxHeight; } if (this._child.brotherCount() === 1) { // 兄弟がいない場合 return 150; } return 190; }; Sprite_Child.prototype.createBitmap = function () { var height = 200 + this.calcGrandChildCount() * INTERVAL_GRANDCHILD_Y; this.bitmap = new Bitmap(600, height); }; Sprite_Child.prototype.drawLineVertial = function (x, y, height) { this.bitmap.fillRect(x, y, 3, height, LINE_COLOR); this.bitmap.fillRect(x + 1, y, 1, height, BLOCK_COLOR); }; Sprite_Child.prototype.drawLineHorizontal = function (x, y, width) { this.bitmap.fillRect(x, y, width, 3, LINE_COLOR); this.bitmap.fillRect(x, y + 1, width, 1, BLOCK_COLOR); }; Sprite_Child.prototype.drawLineHorizontalDouble = function (x, y, width) { this.drawLineHorizontal(x, y, width); this.drawLineHorizontal(x, y + 4, width); }; Sprite_Child.prototype.putDot = function (x, y, color) { this.bitmap.fillRect(x, y, 1, 1, color); }; Sprite_Child.prototype.drawPlus = function (plus, x, y) { var bmtext2 = new PIXI.extras.BitmapText('+' + plus, { font: { name: FONT_NAME, size: FONT_SIZE, }, align: 'center', tint: COLOR, }); bmtext2.x = x; bmtext2.y = y; this.addChild(bmtext2); return bmtext2; }; Sprite_Child.prototype.maxChildren = function () { return MAX_CHILDREN; }; return Sprite_Child; }(Sprite)); var Sprite_ChildLeft = /** @class */ (function (_super) { __extends(Sprite_ChildLeft, _super); function Sprite_ChildLeft(child, y, centerLineInfo) { var _this = _super.call(this) || this; _this.y = y; _this._centerLineInfo = centerLineInfo; _this._child = child; _this.updatePosition(); _this.createBitmap(); _this.addFatherPic(); _this.addChildPic(child, 0); _this._centerLineInfo.addLeft(_this.y); return _this; } Sprite_ChildLeft.prototype.addFatherPic = function () { var fatherPic = new Sprite_Pic('menu_P04 PC001 家系図_親_left'); fatherPic.x = INTERBAL_X * 3; this.addChild(fatherPic); this.createNameSprite(this._child.taneoyaId(), fatherPic.x, fatherPic.y, false); }; Sprite_ChildLeft.prototype.addChildPic = function (child, y) { if (child.hasGrandchild()) { this.addGrandChild(y, child); } else { this.drawBgLines(child, y); var maxChild = Math.min(child.brotherCount(), MAX_CHILDREN); var xx = (MAX_CHILDREN - maxChild) * INTERBAL_X; var yy = y; for (var i = 0; i < maxChild; i++) { var childPic = new Sprite_Pic('menu_P04 PC001 家系図_子'); childPic.x = 77 + INTERBAL_X * i + xx; if (child.brotherCount() == 1) { childPic.y = MARGIN_BETWEEN_FATHER_AND_CHILD + yy; } else { childPic.y = MARGIN_BETWEEN_FATHER_AND_CHILDREN + yy; } this.addChild(childPic); this.createNameSprite(child.taneoyaId(), childPic.x, childPic.y + 26, true); } if (child.brotherCount() > this.maxChildren()) { this.addOmitPic(child.brotherCount() - this.maxChildren(), y); } } }; Sprite_ChildLeft.prototype.addOmitPic = function (num, y) { var bro1 = (MAX_CHILDREN); var childPic = new Sprite_Pic('menu_P04 PC001 家系図_省略'); childPic.x = 21 + INTERBAL_X * bro1; childPic.y = MARGIN_BETWEEN_FATHER_AND_CHILD + 8 + y; this.drawLineHorizontal(childPic.x - 10, childPic.y + 2, 10); this.addChild(childPic); this.drawPlus(num, childPic.x + 15, childPic.y - 7); }; Sprite_ChildLeft.prototype.addGrandChild = function (y, child) { this._centerLineInfo.addLeft(this.y + y + INTERVAL_GRANDCHILD_Y); var hh = 70; var xx = 129 + 3 * INTERBAL_X; this.drawLineHorizontal(xx - GRAND_CHILD_X, y + 0 + hh - 1, GRAND_CHILD_X + 2); this.drawLineVertial(xx, y + 20, 50); this.drawLineVertial(xx - GRAND_CHILD_X, y + 0 + hh + 1, 50); var childPic = new Sprite_Pic('menu_P04 PC001 家系図_親_left'); childPic.x = 3 * INTERBAL_X; childPic.y = y + 20 + hh + GRAND_CHILD_Y; this.addChild(childPic); this.createNameSprite(child.taneoyaId(), childPic.x, childPic.y, true); if (!this._maxHeight) { this._maxHeight = 190; } this._maxHeight += INTERVAL_GRANDCHILD_Y; if (child.brotherCount() > 1) { var maxChild = Math.min(child.brotherCount(), MAX_CHILDREN - 1) - 1; this.drawLineHorizontal(409 - INTERBAL_X * maxChild, y + hh - 1, INTERBAL_X * maxChild + 5); var xx_1 = 0; var yy = y + 12; for (var i = 0; i < maxChild; i++) { this.drawLineVertial(289 - INTERBAL_X * i, y + MARGIN_BETWEEN_FATHER_AND_CHILDREN - 9, 50); var childPic_1 = new Sprite_Pic('menu_P04 PC001 家系図_子'); childPic_1.x = 237 - INTERBAL_X * i + xx_1; childPic_1.y = MARGIN_BETWEEN_FATHER_AND_CHILDREN + yy; this.addChild(childPic_1); this.createNameSprite(child.taneoyaId(), childPic_1.x, childPic_1.y + 26, true); } this.putDot(409 - INTERBAL_X * maxChild, y + 70, LINE_COLOR); } else { this.putDot(xx - GRAND_CHILD_X, y + 70, LINE_COLOR); } if (child.brotherCount() > MAX_CHILDREN - 1) { this.addOmitPic(child.brotherCount() - (MAX_CHILDREN - 1), y + 9); } else { this.putDot(491, y + 70, LINE_COLOR); } this.addChildPic(child.child(), y + INTERVAL_GRANDCHILD_Y); }; Sprite_ChildLeft.prototype.updatePosition = function () { this.x = 306 - INTERBAL_X * 3; }; Sprite_ChildLeft.prototype.drawBgLines = function (child, y) { var bro1 = Math.min((child.brotherCount() - 1), 3); if (child.brotherCount() == 1) { this.drawLineVertial(129 + INTERBAL_X * 3, 20 + y, 30); return; } var xx = (3 - bro1) * INTERBAL_X; var maxChild = Math.min(bro1, MAX_CHILDREN); this.drawLineVertial(129 + INTERBAL_X * maxChild + xx, 23 + y, 60); this.drawLineHorizontal(129 + xx, 60 + y, INTERBAL_X * Math.min(bro1, MAX_CHILDREN - 1) + 1); this.putDot(129 + xx, 61 + y, LINE_COLOR); for (var i = 0; i < Math.min(bro1, MAX_CHILDREN); i++) { this.drawLineVertial(129 + INTERBAL_X * i + xx, 62 + y, 29); } }; return Sprite_ChildLeft; }(Sprite_Child)); var Sprite_ChildRight = /** @class */ (function (_super) { __extends(Sprite_ChildRight, _super); function Sprite_ChildRight(child, y, centerLineInfo) { var _this = _super.call(this) || this; _this.y = y; _this._centerLineInfo = centerLineInfo; _this._child = child; _this.updatePosition(); _this.createBitmap(); _this.addFatherPic(); _this.addChildPic(child, 0); _this._centerLineInfo.addRight(_this.y); return _this; } Sprite_ChildRight.prototype.addFatherPic = function () { var fatherPic = new Sprite_Pic('menu_P04 PC001 家系図_親_right'); fatherPic.x = 0; this.addChild(fatherPic); this.createNameSprite(this._child.taneoyaId(), fatherPic.x + 45, fatherPic.y, false); }; Sprite_ChildRight.prototype.addChildPic = function (child, y) { if (child.hasGrandchild()) { this.addGrandChild(y, child); } else { this.drawBgLines(child, y); var maxChild = Math.min(child.brotherCount(), MAX_CHILDREN); var xx = -33; var yy = y; for (var i = 0; i < maxChild; i++) { var childPic = new Sprite_Pic('menu_P04 PC001 家系図_子'); childPic.x = INTERBAL_X * i + xx; if (child.brotherCount() == 1) { childPic.y = MARGIN_BETWEEN_FATHER_AND_CHILD + yy; } else { childPic.y = MARGIN_BETWEEN_FATHER_AND_CHILDREN + yy; } this.addChild(childPic); this.createNameSprite(child.taneoyaId(), childPic.x, childPic.y + 26, true); } if (child.brotherCount() > this.maxChildren()) { this.addOmitPic(child.brotherCount() - this.maxChildren(), y); } } }; Sprite_ChildRight.prototype.addOmitPic = function (num, y) { var childPic = new Sprite_Pic('menu_P04 PC001 家系図_省略'); childPic.x = 0; childPic.y = MARGIN_BETWEEN_FATHER_AND_CHILD + 8 + y; this.drawLineHorizontal(childPic.x + 10, childPic.y + 2, 10); this.addChild(childPic); var sprite = this.drawPlus(num, childPic.x - 6, childPic.y - 7); sprite.x -= sprite.width; }; Sprite_ChildRight.prototype.addGrandChild = function (y, child) { this._centerLineInfo.addRight(this.y + y + INTERVAL_GRANDCHILD_Y); var hh = 70; var xx = 19; this.drawLineHorizontal(20, y + 0 + hh - 1, GRAND_CHILD_X + 2); this.drawLineVertial(xx, y + 20, 50); this.drawLineVertial(xx + GRAND_CHILD_X, y + 0 + hh + 1, 50); var childPic = new Sprite_Pic('menu_P04 PC001 家系図_親_right'); childPic.x = 0; childPic.y = y + 20 + hh + GRAND_CHILD_Y; this.addChild(childPic); this.createNameSprite(child.taneoyaId(), childPic.x + 45, childPic.y, true); if (!this._maxHeight) { this._maxHeight = 190; } this._maxHeight += INTERVAL_GRANDCHILD_Y; if (child.brotherCount() > 1) { var maxChild = Math.min(child.brotherCount(), MAX_CHILDREN - 1) - 1; this.drawLineHorizontal(98, y + hh - 1, INTERBAL_X * maxChild + 4); var xx_2 = 0; var yy = y + 12; this.putDot(98 + INTERBAL_X * maxChild + 3, y + hh, LINE_COLOR); for (var i = 0; i < maxChild; i++) { this.drawLineVertial(219 + INTERBAL_X * i, y + MARGIN_BETWEEN_FATHER_AND_CHILDREN - 9, 50); var childPic_2 = new Sprite_Pic('menu_P04 PC001 家系図_子'); childPic_2.x = 167 + INTERBAL_X * i + xx_2; childPic_2.y = MARGIN_BETWEEN_FATHER_AND_CHILDREN + yy; this.addChild(childPic_2); this.createNameSprite(child.taneoyaId(), childPic_2.x, childPic_2.y + 26, true); } } else { this.putDot(97, y + 70, LINE_COLOR); } if (child.brotherCount() > MAX_CHILDREN - 1) { this.addOmitPic(child.brotherCount() - (MAX_CHILDREN - 1), y + 9); } else { this.putDot(491, y + 70, LINE_COLOR); } this.addChildPic(child.child(), y + INTERVAL_GRANDCHILD_Y); }; Sprite_ChildRight.prototype.updatePosition = function () { this.x = 566; }; Sprite_ChildRight.prototype.drawBgLines = function (child, y) { var bro1 = Math.min((child.brotherCount() - 1), 4); if (child.brotherCount() == 1) { this.drawLineVertial(19, 20 + y, 30); return; } var xx = 10; var maxChild = Math.min(bro1, MAX_CHILDREN - 1); this.drawLineVertial(19, 23 + y, 60); this.drawLineHorizontal(21, 60 + y, INTERBAL_X * Math.min(bro1, MAX_CHILDREN - 1) + 1); this.putDot(21 + INTERBAL_X * Math.min(bro1, MAX_CHILDREN - 1), 60 + y + 1, LINE_COLOR); for (var i = 0; i < Math.min(bro1, MAX_CHILDREN - 1); i++) { this.drawLineVertial(129 + INTERBAL_X * i + xx, 62 + y, 29); } }; return Sprite_ChildRight; }(Sprite_Child)); var Sprite_VerticalLine = /** @class */ (function (_super) { __extends(Sprite_VerticalLine, _super); function Sprite_VerticalLine(centerLineInfo) { var _this = _super.call(this) || this; var offsetX = 60; var max = centerLineInfo.maxY() + 6; _this.bitmap = new Bitmap(160, max + 20); _this.drawLineVertial(offsetX + 0, 0, max); _this.drawLineVertial(offsetX + 3, 0, max); var yList = centerLineInfo.leftYList(); for (var i = 0; i < yList.length; i++) { var y = yList[i]; _this.drawLineHorizontal(0, y - centerLineInfo.initialY(), offsetX + 1); _this.drawLineHorizontal(0, y - centerLineInfo.initialY() + 4, offsetX + 1); } var yList2 = centerLineInfo.rightYList(); for (var i = 0; i < yList2.length; i++) { var y = yList2[i]; _this.drawLineHorizontal(offsetX + 5, y - centerLineInfo.initialY(), offsetX + 1); _this.drawLineHorizontal(offsetX + 5, y - centerLineInfo.initialY() + 4, offsetX + 1); } if (centerLineInfo.maxLeft() > centerLineInfo.maxRight()) { _this.bitmap.fillRect(offsetX + 1, centerLineInfo.maxLeft() + 2, 3, 1, LINE_COLOR); _this.bitmap.fillRect(offsetX, centerLineInfo.maxLeft() + 3, 3, 1, BG_COLOR); _this.bitmap.fillRect(offsetX + 1, centerLineInfo.maxLeft() + 4, 3, 1, LINE_COLOR); _this.bitmap.fillRect(offsetX + 1, centerLineInfo.maxLeft() + 5, 4, 1, BLOCK_COLOR); _this.bitmap.fillRect(offsetX + 1, centerLineInfo.maxLeft() + 6, 4, 1, LINE_COLOR); } else if (centerLineInfo.maxLeft() < centerLineInfo.maxRight()) { _this.bitmap.fillRect(offsetX + 2, centerLineInfo.maxRight() + 2, 3, 1, LINE_COLOR); _this.bitmap.fillRect(offsetX + 4, centerLineInfo.maxRight() + 3, 3, 1, BG_COLOR); _this.bitmap.fillRect(offsetX + 2, centerLineInfo.maxRight() + 4, 3, 1, LINE_COLOR); _this.bitmap.fillRect(offsetX + 2, centerLineInfo.maxRight() + 5, 4, 1, BLOCK_COLOR); _this.bitmap.fillRect(offsetX + 1, centerLineInfo.maxRight() + 6, 4, 1, LINE_COLOR); } else { } return _this; } Sprite_VerticalLine.prototype.drawLineVertial = function (x, y, height) { this.bitmap.fillRect(x, y, 3, height, LINE_COLOR); this.bitmap.fillRect(x + 1, y, 1, height, BLOCK_COLOR); }; Sprite_VerticalLine.prototype.drawLineHorizontal = function (x, y, width) { this.bitmap.fillRect(x, y, width, 3, LINE_COLOR); this.bitmap.fillRect(x, y + 1, width, 1, BLOCK_COLOR); }; return Sprite_VerticalLine; }(Sprite)); var Window_FamilyTree = /** @class */ (function (_super) { __extends(Window_FamilyTree, _super); function Window_FamilyTree() { return _super !== null && _super.apply(this, arguments) || this; } Window_FamilyTree.prototype.initialize = function (x, y, w, h) { _super.prototype.initialize.call(this, x, y, w, h); this.backOpacity = 0; this._windowBackSprite.alpha = 0; this._windowFrameSprite.visible = false; //this.contentsOpacity = 0; this._maxHeight = 1100; this.createBaseSprite(); this.addPicture(); this.createChildSprites(); this.createFadeSprite(); this.y = -1000; }; Window_FamilyTree.prototype.createFadeSprite = function () { this._fadeSprite = new ScreenSprite(); this.addChild(this._fadeSprite); }; ; Window_FamilyTree.prototype.createBaseSprite = function () { this._baseSprite = new Sprite(); this.addChild(this._baseSprite); }; Window_FamilyTree.prototype.addPicture = function () { this._pic1 = new Sprite_Pic('menu_P04 PC001 家系図_A'); this._baseSprite.addChild(this._pic1); this._pic2 = new Sprite_Pic('menu_P04 PC001 家系図_B'); this._pic2.y = Graphics.boxHeight; this._baseSprite.addChild(this._pic2); }; Window_FamilyTree.prototype.createChildSprites = function () { var familyTree = $gameSystem.familyTree(); if (familyTree.children().length === 0) { return; } this.addSerenaBack(); var initialY = 1420; var centerLineInfo = new CenterLineInfo(initialY); var leftY = initialY; var rightY = initialY; var plusRightHeight = false; for (var _i = 0, _a = familyTree.children(); _i < _a.length; _i++) { var child = _a[_i]; var isLeft = leftY <= rightY; if (isLeft) { /*if (lastLeftHeight > 0) { this.addVertialLine(leftY, lastLeftHeight); }*/ leftY += this.addLeft(child, leftY, centerLineInfo); } else { rightY += this.addRight(child, rightY, centerLineInfo); if (!plusRightHeight) { plusRightHeight = true; rightY += Nore.RIGHT_TREE_OFFSET; } } } this.drawCenterLine(centerLineInfo); this.addSerenaSprite(); this._maxHeight = Math.max(leftY, rightY) - 550; }; Window_FamilyTree.prototype.drawCenterLine = function (centerLineInfo) { var height = centerLineInfo.maxY(); var sprite = new Sprite_VerticalLine(centerLineInfo); sprite.x = 450; sprite.y = centerLineInfo.initialY() + 16; this._baseSprite.addChild(sprite); }; Window_FamilyTree.prototype.addSerenaBack = function () { var g = new PIXI.Graphics(); g.beginFill(0x976d64, 1); g.drawRect(0, 0, 140, 160); g.endFill(); g.x = 440; g.y = Graphics.boxHeight * 2 - 204; this._baseSprite.addChild(g); }; Window_FamilyTree.prototype.addSerenaSprite = function () { this._pic3 = new Sprite_Pic('menu_P04 PC001 家系図_C'); this._pic3.x = 424; this._pic3.y = 1332; this._baseSprite.addChild(this._pic3); }; Window_FamilyTree.prototype.addLeft = function (child, y, centerLineInfo) { var sprite = new Sprite_ChildLeft(child, y, centerLineInfo); this._baseSprite.addChild(sprite); return sprite.calcHeight(); }; Window_FamilyTree.prototype.addRight = function (child, y, centerLineInfo) { var sprite = new Sprite_ChildRight(child, y, centerLineInfo); this._baseSprite.addChild(sprite); return sprite.calcHeight(); }; Window_FamilyTree.prototype.refresh = function () { }; Object.defineProperty(Window_FamilyTree.prototype, "backOpacity", { set: function (n) { }, enumerable: true, configurable: true }); Window_FamilyTree.prototype.update = function () { _super.prototype.update.call(this); if (this._fadeSprite) { this._fadeSprite.opacity = 255 - $gameScreen.brightness(); } if (Input.isPressed('up')) { this.y += this.interval(); if (this.y > 0) { this.y = 0; } } else if (Input.isPressed('down')) { this.y -= this.interval(); if (this.y < -this.maxY()) { this.y = -this.maxY(); } } }; Window_FamilyTree.prototype.interval = function () { return 10; }; Window_FamilyTree.prototype.maxY = function () { return this._maxHeight; }; return Window_FamilyTree; }(Window_Base)); Nore.Window_FamilyTree = Window_FamilyTree; })(Nore || (Nore = {})); /* (function() { function p(arg) { console.log(arg); } (window as any).p = p; })(); */ var TANEOYA_MAP = { 1: ["不明", "不明"], 2: ["ジャック", "ジャック"], 3: ["ヘンリー", "ヘンリー"], 4: ["ゴードン", "ゴードン"], 5: ["ドッヂ", "ドッヂ"], 6: ["通り魔ジョン(賞金首)", "ジョン"], 7: ["異教徒ブライ(賞金首)", "ブライ"], 8: ["強姦魔トム(賞金首)", "トム"], 9: ["強盗ゴブログ(賞金首)", "ゴブログ"], 10: ["ゴミ漁りギー(賞金首)", "ギー"], 11: ["人攫いビョーン(賞金首)", "ビョーン"], 12: ["博愛者ギニュー(賞金首)", "ギニュー"], 13: ["ヴァンサン(スラム)", "ヴァンサン"], 14: ["アルベール(市民)", "アルベール"], 15: ["サミュエル(市民)", "サミュエル"], 16: ["ドニ(市民)", "ドニ"], 17: ["マチアス(市民)", "マチアス"], 18: ["マルセル(市民)", "マルセル"], 19: ["店主ディーコン(市民)", "ディーコン"], 20: ["富豪グービル(市民)", "グーピル"], 21: ["市警長デムーラン(市民)", "デムーラン"], 22: ["町医者ロドリグ(市民)", "ロドリグ"], 23: ["オリバー(冒険者)", "オリバー"], 24: ["ガエタン(冒険者)", "ガエタン"], 25: ["ジョエル(冒険者)", "ジョエル"], 26: ["トリスタン(冒険者)", "トリスタン"], 27: ["豚のゲクラン(市民)", "ゲクラン"], 28: ["本屋のティム(市民)", "ティム"], 29: ["ギャングリーダーガヌロン(スラム)", "ガヌロン"], 30: ["ギャングのバーダン(スラム)", "バーダン"], 31: ["人間(個人", ""], 32: ["人間(個人", ""], 33: ["人間(個人", ""], 34: ["人間(個人", ""], 35: ["人間(個人", ""], 36: ["人間(個人", ""], 37: ["人間(個人", ""], 38: ["人間(個人", ""], 39: ["人間(個人", ""], 40: ["人間(個人", ""], 41: ["人間(個人", ""], 42: ["人間(個人", ""], 43: ["人間(個人", ""], 44: ["人間(個人", ""], 45: ["人間(個人", ""], 46: ["人間(個人", ""], 47: ["人間(個人", ""], 48: ["人間(個人", ""], 49: ["人間(個人", ""], 50: ["人間(個人", ""], 51: ["温泉屋ヘンリー(第三部)", "ヘンリー"], 52: ["鬼狩りマクシス(第三部)", "マクシス"], 53: ["宿屋モリス(第三部)", "モリス"], 54: ["武器屋ピエール(第三部)", "ピエール"], 55: ["乱暴者ブリュノ(第三部)", "ブリュノ"], 56: ["マセガキマセル(第三部)", "マセル"], 57: ["種馬スタリオン(第三部)", "スタリオン"], 58: ["農夫ボンド(第三部)", "ボンド"], 59: ["人間(個人", ""], 60: ["人間(個人", ""], 61: ["人間(個人", ""], 62: ["人間(個人", ""], 63: ["人間(個人", ""], 64: ["人間(個人", ""], 65: ["人間(個人", ""], 66: ["人間(個人", ""], 67: ["人間(個人", ""], 68: ["人間(個人", ""], 69: ["人間(個人", ""], 70: ["人間(個人", ""], 71: ["人間(個人", ""], 72: ["人間(個人", ""], 73: ["人間(個人", ""], 74: ["人間(個人", ""], 75: ["人間(個人", ""], 76: ["人間(個人", ""], 77: ["人間(個人", ""], 78: ["人間(個人", ""], 79: ["人間(個人", ""], 80: ["人間(個人", ""], 81: ["人間(個人", ""], 82: ["人間(個人", ""], 83: ["人間(個人", ""], 84: ["人間(個人", ""], 85: ["人間(個人", ""], 86: ["人間(個人", ""], 87: ["人間(個人", ""], 88: ["人間(個人", ""], 89: ["人間(個人", ""], 90: ["人間(個人", ""], 91: ["人間(個人", ""], 92: ["人間(個人", ""], 93: ["人間(個人", ""], 94: ["人間(個人", ""], 95: ["人間(個人", ""], 96: ["人間(個人", ""], 97: ["人間(個人", ""], 98: ["人間(個人", ""], 99: ["人間(個人", ""], 100: ["分からない(輪姦)", "父親不明"], 101: ["名も知らぬ男", "名も知らぬ男"], 102: ["孤児", "孤児"], 103: ["市警隊員", "市警隊員"], 104: ["冒険者", "冒険者"], 105: ["ごろつき", "ごろつき"], 106: ["市民悪漢(ちんぴら)", "チンピラ"], 107: ["異教徒", "異教徒"], 108: ["浮浪者", "浮浪者"], 109: ["人間(職業", ""], 110: ["人間(職業", ""], 111: ["人間(職業", ""], 112: ["人間(職業", ""], 113: ["人間(職業", ""], 114: ["人間(職業", ""], 115: ["売春客", "売春客"], 116: ["異人", "異人"], 117: ["囚人", "囚人"], 118: ["人間(職業", ""], 119: ["人間(職業", ""], 120: ["人間(職業", ""], 121: ["人間(職業", ""], 122: ["人間(職業", ""], 123: ["人間(職業", ""], 124: ["人間(職業", ""], 125: ["人間(職業", ""], 126: ["人間(職業", ""], 127: ["人間(職業", ""], 128: ["人間(職業", ""], 129: ["人間(職業", ""], 130: ["人間(職業", ""], 131: ["人間(職業", ""], 132: ["人間(職業", ""], 133: ["人間(職業", ""], 134: ["人間(職業", ""], 135: ["人間(職業", ""], 136: ["人間(職業", ""], 137: ["人間(職業", ""], 138: ["人間(職業", ""], 139: ["人間(職業", ""], 140: ["人間(職業", ""], 141: ["人間(職業", ""], 142: ["人間(職業", ""], 143: ["人間(職業", ""], 144: ["人間(職業", ""], 145: ["人間(職業", ""], 146: ["人間(職業", ""], 147: ["人間(職業", ""], 148: ["人間(職業", ""], 149: ["人間(職業", ""], 150: ["人間(職業", ""], 151: ["モンスター(個体", ""], 152: ["モンスター(個体", ""], 153: ["モンスター(個体", ""], 154: ["モンスター(個体", ""], 155: ["モンスター(個体", ""], 156: ["モンスター(個体", ""], 157: ["モンスター(個体", ""], 158: ["モンスター(個体", ""], 159: ["モンスター(個体", ""], 160: ["モンスター(個体", ""], 161: ["モンスター(個体", ""], 162: ["モンスター(個体", ""], 163: ["モンスター(個体", ""], 164: ["モンスター(個体", ""], 165: ["モンスター(個体", ""], 166: ["モンスター(個体", ""], 167: ["モンスター(個体", ""], 168: ["モンスター(個体", ""], 169: ["モンスター(個体", ""], 170: ["モンスター(個体", ""], 171: ["モンスター(個体", ""], 172: ["モンスター(個体", ""], 173: ["モンスター(個体", ""], 174: ["モンスター(個体", ""], 175: ["モンスター(個体", ""], 176: ["モンスター(個体", ""], 177: ["モンスター(個体", ""], 178: ["モンスター(個体", ""], 179: ["モンスター(個体", ""], 180: ["モンスター(個体", ""], 181: ["モンスター(個体", ""], 182: ["モンスター(個体", ""], 183: ["モンスター(個体", ""], 184: ["モンスター(個体", ""], 185: ["モンスター(個体", ""], 186: ["モンスター(個体", ""], 187: ["モンスター(個体", ""], 188: ["モンスター(個体", ""], 189: ["モンスター(個体", ""], 190: ["モンスター(個体", ""], 191: ["モンスター(個体", ""], 192: ["モンスター(個体", ""], 193: ["モンスター(個体", ""], 194: ["モンスター(個体", ""], 195: ["モンスター(個体", ""], 196: ["モンスター(個体", ""], 197: ["モンスター(個体", ""], 198: ["モンスター(個体", ""], 199: ["モンスター(個体", ""], 200: ["モンスター(個体", ""], 201: ["ゴブリン", "ゴブリン"], 202: ["ゴブリン近親", "ゴブリンの子"], 203: ["モンスター(種族", ""], 204: ["モンスター(種族", ""], 205: ["モンスター(種族", ""], 206: ["オーク", "オーク"], 207: ["オーク(近親", "オークの子"], 208: ["モンスター(種族", ""], 209: ["モンスター(種族", ""], 210: ["モンスター(種族", ""], 211: ["スライム", "スライム"], 212: ["モンスター(種族", ""], 213: ["ビッグスライム", "ビッグスライム"], 214: ["モンスター(種族", ""], 215: ["モンスター(種族", ""], 216: ["スタリオン", "スタリオン"], 217: ["スタリオン近親", "スタリオンの子"], 218: ["モンスター(種族", ""], 219: ["モンスター(種族", ""], 220: ["モンスター(種族", ""], 221: ["ローパー", "ローパー", "ローパーの幼体"], 222: ["ローパー(近親", "ローパーの幼体"], 223: ["モンスター(種族", ""], 224: ["モンスター(種族", ""], 225: ["モンスター(種族", ""], 226: ["ピッグマン", "ピッグマン"], 227: ["ピッグマン近親", "ピッグマンの子"], 228: ["モンスター(種族", ""], 229: ["モンスター(種族", ""], 230: ["モンスター(種族", ""], 231: ["ワーグ", "ワーグ", "ワーグの仔"], 232: ["ワーグ(近親", "ワーグの仔"], 233: ["モンスター(種族", ""], 234: ["モンスター(種族", ""], 235: ["モンスター(種族", ""], 236: ["モンスター(個体", ""], 237: ["モンスター(個体", ""], 238: ["モンスター(種族", ""], 239: ["モンスター(種族", ""], 240: ["モンスター(種族", ""], 241: ["モンスター(種族", ""], 242: ["モンスター(種族", ""], 243: ["モンスター(種族", ""], 244: ["モンスター(種族", ""], 245: ["モンスター(種族", ""], 246: ["モンスター(種族", ""], 247: ["モンスター(種族", ""], 248: ["モンスター(種族", ""], 249: ["モンスター(種族", ""], 250: ["モンスター(種族", ""], 251: ["その他", ""], 252: ["その他", ""], 253: ["その他", ""], 254: ["その他", ""], 255: ["その他", ""], 256: ["その他", ""], 257: ["その他", ""], 258: ["その他", ""], 259: ["その他", ""], 260: ["その他", ""], 261: ["その他", ""], 262: ["その他", ""], 263: ["その他", ""], 264: ["その他", ""], 265: ["その他", ""], 266: ["その他", ""], 267: ["その他", ""], 268: ["その他", ""], 269: ["その他", ""], 270: ["その他", ""], 271: ["その他", ""], 272: ["その他", ""], 273: ["その他", ""], 274: ["その他", ""], 275: ["その他", ""], 276: ["その他", ""], 277: ["その他", ""], 278: ["その他", ""], 279: ["その他", ""], 280: ["その他", ""], 281: ["その他", ""], 282: ["その他", ""], 283: ["その他", ""], 284: ["その他", ""], 285: ["その他", ""], 286: ["その他", ""], 287: ["その他", ""], 288: ["その他", ""], 289: ["その他", ""], 290: ["その他", ""], 291: ["その他", ""], 292: ["その他", ""], 293: ["その他", ""], 294: ["その他", ""], 295: ["その他", ""], 296: ["その他", ""], 297: ["その他", ""], 298: ["その他", ""], 299: ["その他", ""], 300: ["その他", ""], }; function getTaneoyaName(id) { if (!TANEOYA_MAP[id]) { console.error('ID が' + id + 'の種親が見つかりません'); return ''; } return TANEOYA_MAP[id][1]; } function getBabyName(id) { if (!TANEOYA_MAP[id]) { console.error('ID が' + id + 'の子供が見つかりません'); return ''; } if (TANEOYA_MAP[id][2]) { return TANEOYA_MAP[id][2]; } return TANEOYA_MAP[id][1] + 'の子'; } function getBabyPic(id) { switch (id) { case 201: return 'ゴブリンの子供'; case 206: return 'オークの子供'; case 211: return 'スライムの幼体'; case 216: return 'スタリオンの子供'; case 221: return 'ローパーの子供'; case 226: return 'ピッグマンの子供'; case 231: return 'ワーグの子供'; case 6: return '悪人の子供'; case 7: return '黒人の子供'; default: return '〇〇の子供'; } }
dazed/translations
www/js/plugins/Nore_FamilyTree2バックアップ/Nore_FamilyTree2.js
JavaScript
unknown
49,831
/*: * @plugindesc 画像で文字を描画するよ * @author ル * @version 1.01 * * * @param numOffsetX * @text 画像数字のx座標の調整 * @desc この値だけ、数字のx座標がずれます * @default 0 * * @param numOffsetY * @text 画像数字のy座標の調整 * @desc この値だけ、数字のy座標がずれます * @default 0 * * @param width1 * @text 画像数字の幅1 * @desc 1文字につきこれだけ幅がとられます * @default 12 * * @param width2 * @text 画像数字の幅2 * @desc 1文字につきこれだけ幅がとられます * @default 8 * * @param textOffsetX * @text 画像文字のx座標の調整 * @desc この値だけ、x座標がずれます * @default 0 * * @param textOffsetY * @text 画像文字のy座標の調整 * @desc この値だけ、y座標がずれます * @default 4 */ var Nore; (function (Nore) { // 設定 var FONT_NAME = '游ゴシック'; var FONT_SIZE = 18; var TEXT_COLOR = 0xffffff; var OUTLINE_COLOR = 0x2A1713; var HANKAKU_SPACE_WIDTH = 8; var ZENKAKU_SPACE_WIDTH = 16; var parameters = PluginManager.parameters('Nore_ImageFont'); var numOffsetX = parseInt(parameters['numOffsetX']); var numOffsetY = parseInt(parameters['numOffsetY']); var textOffsetX = parseInt(parameters['textOffsetX']); var textOffsetY = parseInt(parameters['textOffsetY']); var width1 = parseInt(parameters['width1']); var width2 = parseInt(parameters['width2']); var _Scene_Boot_loadSystemImages = Scene_Boot.loadSystemImages; Scene_Boot.loadSystemImages = function () { _Scene_Boot_loadSystemImages.call(this); ImageManager.reserveSystem('Number'); }; function getBaseTexture() { var baseTexture = PIXI.utils.BaseTextureCache['system/Number']; if (!baseTexture) { var bitmap = ImageManager.loadSystem('Number'); if (!bitmap.isReady()) { return; } baseTexture = new PIXI.BaseTexture(bitmap._image); //baseTexture.resource.url = 'system/Number'; PIXI.utils.BaseTextureCache['system/Number'] = baseTexture; } return baseTexture; } Nore.getBaseTexture = getBaseTexture; var Sprite_Picture_prototype_loadBitmap = Sprite_Picture.prototype.loadBitmap; Sprite_Picture.prototype.loadBitmap = function () { Sprite_Picture_prototype_loadBitmap.call(this); if (!this.dTextInfo) { this.removeBitmapText(); } }; Sprite_Picture.prototype.removeBitmapText = function () { if (this.bitmapTextList) { for (var _i = 0, _a = this.bitmapTextList; _i < _a.length; _i++) { var b = _a[_i]; b.destroy(); this.removeChild(b); } } }; var _Sprite_Picture_prototype_makeDynamicBitmap = Sprite_Picture.prototype.makeDynamicBitmap; Sprite_Picture.prototype.makeDynamicBitmap = function () { this.removeBitmapText(); this.bitmapTextList = []; _Sprite_Picture_prototype_makeDynamicBitmap.call(this); }; var _Sprite_Picture_prototype_processText = Sprite_Picture.prototype._processText; Sprite_Picture.prototype._processText = function (bitmap) { var text = this.dTextInfo.value.substr(0, this.dTextInfo.value.length - 1); var right = isRight(text); if (right) { text = text.substr(0, text.length - ' right'.length); } var re = /([0-9]*)( *)( *)(.*)/g; var match = re.exec(text); //console.log(text) //console.log(match) if (!match) { console.error('テキストが不正です。' + text); return; } if (!match[1] && !isEroStatusScene()) { // エロステページでも数字描画でもない場合 _Sprite_Picture_prototype_processText.call(this, bitmap); return; } var xx = 0; if (match[1]) { var fontType = choiceFontType(this.dTextInfo.size); if (right) { xx -= (match[1].length - 1) * fontWidth(fontType); } xx += this.drawNumber(parseInt(match[1]), numOffsetX + xx, numOffsetY, 100, fontType); } if (match[2]) { xx += HANKAKU_SPACE_WIDTH; } if (match[3]) { xx += ZENKAKU_SPACE_WIDTH; } if (match[4]) { this.addBitmapTexts(xx, match[4], FONT_SIZE); } }; /** * 右詰めか? * @param text * @returns */ function isRight(text) { var re = / right/g; var match = re.exec(text); return match; } function choiceFontType(size) { switch (size) { case 22: return 0; default: return 1; } } function isEroStatusScene() { /*if ($gameVariables.value(2000) > 0) { return true; }*/ if ($gameSwitches.value(81)) { return true; } return false; } Sprite_Picture.prototype.addBitmapTexts = function (xx, text, size) { this.addBitmapText(text, size, OUTLINE_COLOR, xx + -1, -1); this.addBitmapText(text, size, OUTLINE_COLOR, xx + 1, -1); this.addBitmapText(text, size, OUTLINE_COLOR, xx + -1, 1); this.addBitmapText(text, size, OUTLINE_COLOR, xx + 1, 1); this.addBitmapText(text, size, TEXT_COLOR, xx + 0, 0); }; Sprite_Picture.prototype.addBitmapText = function (text, size, color, x, y) { var bmtext = new PIXI.extras.BitmapText(text, { font: { name: FONT_NAME, size: size, }, tint: color, }); bmtext.x = textOffsetX + x; bmtext.y = textOffsetY + y; this.addChild(bmtext); this.bitmapTextList.push(bmtext); }; function fontWidth(fontType) { switch (fontType) { case 0: return width1; case 1: return width2; default: return width2; } } Sprite_Picture.prototype.drawNumber = function drawNumber(num, x, y, w, type) { var baseTexture = getBaseTexture(); if (!baseTexture) { return; } var xx = 0; var yy = type * 32; var pw = 32; var ph = 32; var ww = fontWidth(type); var str = num + ''; if (num < 0) { str = Math.abs(num) + ''; } var dx; for (var i = 0; i < str.length; i++) { var s = parseInt(str[i]); var sx = s * pw + xx; var sy = yy; var dy = y; dx = x + i * ww; var texture = new PIXI.Texture(baseTexture); texture.frame = new PIXI.Rectangle(sx, sy, pw, ph); var sprite = new PIXI.Sprite(texture); sprite.x = dx; sprite.y = dy; this.addChild(sprite); this.bitmapTextList.push(sprite); } return dx + ww - x; }; })(Nore || (Nore = {}));
dazed/translations
www/js/plugins/Nore_ImageFont.js
JavaScript
unknown
7,190
/*: * @plugindesc マウス操作を拡張します * @author ル * * @help * 条件分岐で ボタン[キャンセル]が押されている を指定した場合、 * マウスの右クリックも条件に含めるようにします。 * * 条件分岐で ボタン[左]が押されている を指定した場合、 * 画面左半分でのマウスの左クリックも条件に含めるようにします。 * * 条件分岐で ボタン[右]が押されている を指定した場合、 * 画面右半分でのマウスの左クリックも条件に含めるようにします。 * * 家系図で、マウスホイールでのスクロールができるようにします。 * * セーブ画面で、マウス操作でページを選択できるようにします。 * */ var Nore; (function (Nore) { const parameters = PluginManager.parameters('Nore_Plugins'); const _Game_Interpreter_prototype_command111 = Game_Interpreter.prototype.command111; Game_Interpreter.prototype.command111 = function () { var result = false; //console.log(TouchInput.isCancelled()) switch (this._params[0]) { case 11: // Button //console.log(this._params[1]) if (this._params[1] == 'cancel') { //console.log(TouchInput._cancelled2) //console.log(TouchInput.rightButton) if (TouchInput.rightButton) { result = true; this._branch[this._indent] = result; if (this._branch[this._indent] === false) { this.skipBranch(); } return true; } } if (this._params[1] == 'left') { if (TouchInput.leftButtonByLeftSide) { result = true; this._branch[this._indent] = result; if (this._branch[this._indent] === false) { this.skipBranch(); } return true; } } if (this._params[1] == 'right') { if (TouchInput.leftButtonByRightSide) { result = true; this._branch[this._indent] = result; if (this._branch[this._indent] === false) { this.skipBranch(); } return true; } } } return _Game_Interpreter_prototype_command111.call(this); }; var _TouchInput_clear = TouchInput.clear; TouchInput.clear = function () { _TouchInput_clear.call(this); this.rightButton = false; this.leftButtonByRightSide = false; this.leftButtonByLeftSide = false; this.rightButtonCount = 0; }; TouchInput._onRightButtonDown = function (event) { var x = Graphics.pageToCanvasX(event.pageX); var y = Graphics.pageToCanvasY(event.pageY); if (Graphics.isInsideCanvas(x, y)) { this._onCancel(x, y); this.rightButton = true; this.rightButtonCount = 10; } }; TouchInput._onLeftButtonDown = function (event) { var x = Graphics.pageToCanvasX(event.pageX); var y = Graphics.pageToCanvasY(event.pageY); if (Graphics.isInsideCanvas(x, y)) { this._mousePressed = true; this._pressedTime = 0; this._onTrigger(x, y); if (Graphics._boxWidth / 2 < x) { this.leftButtonByRightSide = true; } else { this.leftButtonByLeftSide = true; } this.leftButtonCount = 10; } }; var _TouchInput_update = TouchInput.update; TouchInput.update = function () { _TouchInput_update.call(this); if (this.rightButtonCount > 0) { this.rightButtonCount--; if (this.rightButtonCount <= 0) { this.rightButton = false; } } if (this.leftButtonCount > 0) { this.leftButtonCount--; if (this.leftButtonCount <= 0) { this.leftButtonByRightSide = false; this.leftButtonByLeftSide = false; } } }; const Window_FamilyTree_prototype_update = Nore.Window_FamilyTree.prototype.update Nore.Window_FamilyTree.prototype.update = function () { Window_FamilyTree_prototype_update.call(this); if (TouchInput.wheelY < 0) { this.y += this.interval() * 2; if (this.y > 0) { this.y = 0; } } else if (TouchInput.wheelY > 0) { this.y -= this.interval() * 2; if (this.y < -this.maxY()) { this.y = -this.maxY(); } } }; const _Scene_File_update = Scene_File.prototype.update; Scene_File.prototype.update = function () { _Scene_File_update.call(this); if (!this._pageWindow) { return; } if (!this._pageWindow.isTouchedInsideFrame()) { return; } if (!TouchInput.isTriggered()) { return; } for (var i = 0; i < 16; i++) { const rect = this._pageWindow.itemRect(i); if (rect.x <= TouchInput.x && rect.x + rect.width >= TouchInput.x) { if (this._pageWindow._index == i) { break; } SoundManager.playCursor(); var before = this._listWindow.index(); this._pageWindow._index = i; this._pageWindow.refresh(); this._listWindow.setPageIndex(i); if (this._listWindow.maxItems() <= before) { this._listWindow.select(0); } break; } } }; })(Nore || (Nore = {})); /* (function() { function p(arg) { console.log(arg); } (window).p = p; })(); */
dazed/translations
www/js/plugins/Nore_Mouse.js
JavaScript
unknown
6,225
/*: * @plugindesc いろいろ気になったところ * @author ル * * @param choiseLiseWindowMargin * @desc 選択肢を表示するウィンドウの右側の隙間を設定します * @default 195 * * @param volumeOffset * @desc ボリュームを変更したときに変わる値を設定します * @default 5 * * @param loadSkinScript * @desc BB_WindowSelector3 と MessageWindowPopup の競合対策をする場合1 しない場合0 * @default 1 */ var Nore; (function (Nore) { const parameters = PluginManager.parameters('Nore_Plugins'); let choiseLiseWindowMargin = parseInt(parameters['choiseLiseWindowMargin']); if (choiseLiseWindowMargin > 0) { // 選択肢ウィンドウの位置 const _Window_ChoiceList_prototype_updatePlacement = Window_ChoiceList.prototype.updatePlacement; Window_ChoiceList.prototype.updatePlacement = function () { _Window_ChoiceList_prototype_updatePlacement.call(this); var positionType = $gameMessage.choicePositionType(); console.log(positionType) switch (positionType) { case 2: this.x = Graphics.boxWidth - this.width - choiseLiseWindowMargin; return; } }; } let volumeOffset = parseInt(parameters['volumeOffset']); if (choiseLiseWindowMargin > 0) { Window_Options.prototype.volumeOffset = function () { return volumeOffset; }; } let loadSkinScript = parseInt(parameters['loadSkinScript']); if (loadSkinScript > 0) { var _Window_Message_loadWindowskin = Window_Message.prototype.loadWindowskin; Window_Message.prototype.loadWindowskin = function () { let BBWSvar = 11 if ($gameVariables.value(BBWSvar) == 3) { this.windowskin = ImageManager.loadSystem('Window3'); } else if ($gameVariables.value(BBWSvar) == 2) { this.windowskin = ImageManager.loadSystem('Window2'); } else { this.windowskin = ImageManager.loadSystem('Window'); } }; // 通常文字色は固定(ウィンドウ画像読み込み前に文字色を設定された時用) Window_Base.prototype.normalColor = function () { return '#ffffff'; }; } })(Nore || (Nore = {}));
dazed/translations
www/js/plugins/Nore_Plugins.js
JavaScript
unknown
2,395
/*: * @plugindesc 回想拡張プラグイン * @author ノレ * * @param 回想スイッチ * @desc 回想時に自動的にONになるスイッチ番号 * @default 1997 * * @help * プラグインコマンド * EndRecollection * →回想シーンに戻ります。 * Scene_Recollection.prototype.rngd_exit_scene() をスクリプトで書くのと同じ。 * */ (function () { const pluginName = 'Nore_RecollectionMode'; const parameters = PluginManager.parameters(pluginName); const RECO_SW = parseInt(parameters['回想スイッチ']); const LOAD_SAVE_FILES = 12 * 10; // 12個入りのセーブ画面が10枚。保管セーブを除いたもの let globalVariableCache = null; const _DataManager_saveGameWithoutRescue = DataManager.saveGameWithoutRescue; DataManager.saveGameWithoutRescue = function (savefileId) { // セーブが入るとキャッシュ削除 globalVariableCache = null; return _DataManager_saveGameWithoutRescue.call(this, savefileId); } Window_RecList.prototype.get_global_variables = function () { if (globalVariableCache) { this._global_variables = globalVariableCache; return; } this._global_variables = { "switches": {} }; globalVariableCache = this._global_variables; var maxSaveFiles = LOAD_SAVE_FILES; let t = new Date().getTime(); for (var i = 1; i <= maxSaveFiles; i++) { if (DataManager.loadGameSwitch(i)) { var rec_cg_max = rngd_hash_size(rngd_recollection_mode_settings.rec_cg_set); for (var j = 0; j < rec_cg_max; j++) { var cg = rngd_recollection_mode_settings.rec_cg_set[j + 1]; if ($gameSwitches._data[cg.switch_id]) { this._global_variables["switches"][cg.switch_id] = true; } } } } //console.log('time:' + (new Date().getTime() - t)); }; var _nore_recollection_pluginCommand = Game_Interpreter.prototype.pluginCommand; Game_Interpreter.prototype.pluginCommand = function (command, args) { _nore_recollection_pluginCommand.call(this, command, args); if (command === 'EndRecollection') { Scene_Recollection.reload_rec_list = true; SceneManager.push(Scene_Recollection); } }; Scene_Recollection.prototype.commandDoRecMode = function () { var target_index = this._rec_list.index() + 1; Scene_Recollection.rec_list_index = target_index - 1; if (this._rec_list.is_valid_picture(this._rec_list.index() + 1)) { // 回想モードの場合 if (this._mode == "recollection") { Scene_Recollection._rngd_recollection_doing = true; DataManager.setupNewGame(); $gamePlayer.setTransparent(255); this.fadeOutAll(); // TODO: パーティを透明状態にする //$dataSystem.optTransparent = false; $gameSwitches.setValue(RECO_SW, true); $gameTemp.reserveCommonEvent(rngd_recollection_mode_settings.rec_cg_set[target_index]["common_event_id"]); $gamePlayer.reserveTransfer(rngd_recollection_mode_settings.sandbox_map_id, 0, 0, 0); SceneManager.push(Scene_Map); // CGモードの場合 } else if (this._mode == "cg") { this._cg_sprites = []; this._cg_sprites_index = 0; // シーン画像をロードする rngd_recollection_mode_settings.rec_cg_set[target_index].pictures.forEach(function (name) { // CGクリックを可能とする var sp = new Sprite_Button(); sp.setClickHandler(this.commandDummyOk.bind(this)); sp.processTouch = function () { Sprite_Button.prototype.processTouch.call(this); }; sp.bitmap = ImageManager.loadPicture(name); // 最初のSprite以外は見えないようにする if (this._cg_sprites.length > 0) { sp.visible = false; } // TODO: 画面サイズにあわせて、拡大・縮小すべき this._cg_sprites.push(sp); this.addChild(sp); }, this); this.do_exchange_status_window(this._rec_list, this._dummy_window); this._dummy_window.visible = false; } } else { this._rec_list.activate(); } }; })();
dazed/translations
www/js/plugins/Nore_RecollectionMode.js
JavaScript
unknown
4,782
var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); /*:ja * @author ル * @plugindesc 回想セーブができるスクリプト * * @help * 回想セーブのプラグインコマンド * 回想セーブ <回想ファイルID> <テキスト> * * 例 * 回想セーブ オーク敗北 * * @param recollectionPage * @text このページから回想セーブになります * @desc このページから回想セーブになります * @type number * @default 11 * * @param maxCols * @text セーブページの行の数 * @desc セーブページの行の数 * @type number * @default 4 * * @param alreadySaveExists * @text 回想セーブが存在する時のメッセージ * @default 既にセーブデータがあるため回想セーブされませんでした * * @param alreadySaveExistsEn * @text 回想セーブが存在する時のメッセージ(英語) * @default Not recollection saved because there is already saved data. * * @param alreadySaveExistsCh * @text 回想セーブが存在する時のメッセージ(中国語) * @default 既にセーブデータがあるため回想セーブされませんでした * * @param fullSaveFiles * @text 回想セーブがまんたんでセーブができない時のメッセージ * @default これ以上回想セーブを登録することができません * * @param fullSaveFilesEn * @text 回想セーブがまんたん時(英語) * @default The maximum number of recollection saves has been reached * * @param fullSaveFilesCh * @text 回想セーブがまんたん時(中国語) * @default これ以上回想セーブを登録することができません * * @param recosaveJp * @text 回想セーブの日本語名 * @default 回想%1 * * @param recosaveEn * @text 回想セーブの英語名 * @default reco%1 * * @param recosaveCh * @text 回想セーブの中国語名 * @default 回想%1 * * * @param loadJp * @text ロードするの日本語名 * @default ロードする * * @param loadEn * @text ロードするの英語名 * @default load * * @param loadCh * @text ロードするの中国語名 * @default ロードする * * * @param confirmloadJp * @text ロードしますかの日本語名 * @default このファイルをロードしますか? * * @param confirmloadEn * @text ロードするの英語名 * @default Do you want to load this file? * * @param confirmloadCh * @text ロードするの中国語名 * @default このファイルをロードしますか? * * * @param deleteJp * @text 削除するの日本語名 * @default 削除する * * @param deleteEn * @text 削除するの英語名 * @default delete * * @param deleteCh * @text 削除するの中国語名 * @default 削除する * * @param copiedJp * @text コピーされたファイルの日本語名 * @default コピーされたファイル * * @param copiedEn * @text コピーされたファイルの英語名 * @default Copied file * * @param copiedCh * @text コピーされたファイルの中国語名 * @default Copied file */ var Nore; (function (Nore) { var parameters = PluginManager.parameters('Nore_RecollectionSave'); var RECOLLECTION_PAGE = parameters['recollectionPage']; var maxCols = parseInt(parameters['maxCols'] || '4'); var MAX_PAGE_FILES = maxCols * 3; var AUTO_SAVE_ID = 0; var maxPage = 16; var MAX_ROW = 3; var ALREADY_SAVE_EXISTS = parameters['alreadySaveExists']; var ALREADY_SAVE_EXISTS_EN = parameters['alreadySaveExistsEn']; var ALREADY_SAVE_EXISTS_CH = parameters['alreadySaveExistsCh']; var FULL_SAVE_FILES = parameters['fullSaveFiles']; var FULL_SAVE_FILES_EN = parameters['fullSaveFilesEn']; var FULL_SAVE_FILES_CH = parameters['fullSaveFilesCh']; var RECO_LABEL_JP = parameters['recosaveJp']; var RECO_LABEL_EN = parameters['recosaveEn']; var RECO_LABEL_CH = parameters['recosaveCh']; var LOAD_LABEL_JP = parameters['loadJp']; var LOAD_LABEL_EN = parameters['loadEn']; var LOAD_LABEL_CH = parameters['loadCh']; var LOAD_CONFIRM_JP = parameters['confirmloadJp']; var LOAD_CONFIRM_EN = parameters['confirmloadEn']; var LOAD_CONFIRM_CH = parameters['confirmloadCh']; var DELETE_LABEL_JP = parameters['deleteJp']; var DELETE_LABEL_EN = parameters['deleteEn']; var DELETE_LABEL_CH = parameters['deleteCh']; var COPIED_LABEL_JP = parameters['copiedJp']; var COPIED_LABEL_EN = parameters['copiedEn']; var COPIED_LABEL_CH = parameters['copiedCh']; var pluginName = 'Nore_RecollectionSave'; var _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand; Game_Interpreter.prototype.pluginCommand = function (command, args) { _Game_Interpreter_pluginCommand.apply(this, arguments); if (command === '回想セーブ') { $recoSaveManager.save(args[0]); } }; DataManager.latestSavefileId = function () { var globalInfo = this.loadGlobalInfo(); var savefileId = 1; var timestamp = 0; var recoId = getRecoStartId(); if (globalInfo) { for (var i = 1; i < this.maxSavefiles(); i++) { if (i >= recoId) { break; } if (this.isThisGameFile(i) && globalInfo[i].timestamp > timestamp) { timestamp = globalInfo[i].timestamp; savefileId = i; } } } return savefileId; }; var _Window_SavefileList_prototype_drawFileId = Window_SavefileList.prototype.drawFileId; Window_SavefileList.prototype.drawFileId = function (id, x, y) { var recoId = getRecoStartId(); if (id >= recoId) { var text = RECO_LABEL_JP; switch ($gameVariables.value(1999)) { case 2: text = RECO_LABEL_EN; break; case 3: text = RECO_LABEL_CH; break; } this.drawText(text.format(id - recoId + 1), x, y, 180); return; } _Window_SavefileList_prototype_drawFileId.call(this, id, x, y); }; function getRecoStartId() { var recoId = (RECOLLECTION_PAGE - 1) * MAX_PAGE_FILES; return recoId; } var $recoSaveManager; var _DataManager_createGameObjects = DataManager.createGameObjects; DataManager.createGameObjects = function () { _DataManager_createGameObjects.call(this); $recoSaveManager = new RecoSaveManager(); }; var RecoSaveManager = /** @class */ (function () { function RecoSaveManager() { this._recoSaveName = null; } RecoSaveManager.prototype.save = function (saveFileName) { var slotId = this.findSlotId(saveFileName); if (slotId == -1) { CommonPopupManager.showInfo({}, this.getAlreadySaveExistMsg(), ''); return; } if (slotId == -2) { CommonPopupManager.showInfo({}, this.getFullSaveFilesMsg(), ''); return; } var lastAccessId = DataManager._lastAccessedId; var saveId = getRecoStartId() + slotId - 1; var info = DataManager.loadGlobalInfo()[saveId]; if (info && info.playtime == $gameSystem.playtimeText()) { return; } if (saveId > DataManager.maxSavefiles()) { CommonPopupManager.showInfo({}, this.getFullSaveFilesMsg(), ''); return; } SceneManager.snapForThumbnail(); $gameSystem.onBeforeSave(); this._recoSaveName = saveFileName; console.log('回想セーブを実行 ' + slotId + ' ' + saveId + ' ' + saveFileName); if (DataManager.saveGame(saveId)) { StorageManager.cleanBackup(saveId); } DataManager._lastAccessedId = lastAccessId; this._recoSaveName = null; }; RecoSaveManager.prototype.getAlreadySaveExistMsg = function () { switch ($gameVariables.value(1999)) { case 2: return ALREADY_SAVE_EXISTS_EN; case 3: return ALREADY_SAVE_EXISTS_CH; default: return ALREADY_SAVE_EXISTS; } }; RecoSaveManager.prototype.getFullSaveFilesMsg = function () { switch ($gameVariables.value(1999)) { case 2: return FULL_SAVE_FILES_EN; case 3: return FULL_SAVE_FILES_CH; default: return FULL_SAVE_FILES; } }; RecoSaveManager.prototype.findSlotId = function (saveFileName) { var start = getRecoStartId(); var globalInfo = DataManager.loadGlobalInfo(); let maxSaveFiles = DataManager.maxSavefiles(); for (var i = 0; i < maxSaveFiles; i++) { let fileId = i + start; if (fileId >= maxSaveFiles) { break; } var info = globalInfo[fileId]; if (info) { if (info.label == saveFileName) { return -1; } } } for (var i = 0; i < maxSaveFiles; i++) { let fileId = i + start; if (fileId >= maxSaveFiles) { return -2; } var info = globalInfo[i + start]; if (!info) { return i + 1; } } return -1; }; RecoSaveManager.prototype.inRecoSave = function () { return this._recoSaveName != null; }; RecoSaveManager.prototype.recoSaveName = function () { return this._recoSaveName; }; return RecoSaveManager; }()); var _DataManager_makeSavefileInfo = DataManager.makeSavefileInfo; DataManager.makeSavefileInfo = function () { var info = _DataManager_makeSavefileInfo.call(this); if (!$recoSaveManager.inRecoSave()) { return info; } info.label = $recoSaveManager.recoSaveName(); return info; }; var _Scene_Save_prototype_onSavefileOk = Scene_Save.prototype.onSavefileOk; Scene_Save.prototype.onSavefileOk = function () { var fileId = this.savefileId(); if (fileId == undefined || fileId >= getRecoStartId()) { this.onSaveFailure(); return; } _Scene_Save_prototype_onSavefileOk.call(this); }; Scene_File.prototype.createListWindow = function () { var x = 0; var y = this._helpWindow.height; var width = Graphics.boxWidth; var height = Graphics.boxHeight - y; this._listWindow = new Window_SavefileList2(x, y, width, height - 60); this._listWindow.setHandler('ok', this.onSavefileOk.bind(this)); this._listWindow.setHandler('cancel', this.popScene.bind(this)); this._listWindow.setHandler('pageup', this.onPageup.bind(this)); this._listWindow.setHandler('pagedown', this.onPagedown.bind(this)); this._listWindow.setHandler('right', this.onRight.bind(this)); this._listWindow.setHandler('left', this.onLeft.bind(this)); this._listWindow.setHandler('up', this.onUp.bind(this)); this._listWindow.setHandler('down', this.onDown.bind(this)); this._listWindow.setHandler('right', this.onRight.bind(this)); var index = this.firstSavefileIndex() + 1; var page = Math.floor(index / MAX_PAGE_FILES); this._listWindow.setPageIndex(page); this._listWindow.select(index % MAX_PAGE_FILES); this._listWindow.setMode(this.mode()); this._listWindow.refresh(); this.addWindow(this._listWindow); var yy = this._listWindow.y + this._listWindow.height; this._pageWindow = new Window_SavePage(0, yy + 0, width, 60); this._pageWindow.setPage(page); this.addWindow(this._pageWindow); }; const _Scene_File_prototype_popScene = Scene_File.prototype.popScene; Scene_File.prototype.popScene = function () { $gameVariables.setValue(11, 0); _Scene_File_prototype_popScene.call(this); } Scene_File.prototype.onRight = function () { var page = this._pageWindow.right(); this._listWindow.setPageIndex(page); this._listWindow.select(0); }; Scene_File.prototype.onLeft = function () { var page = this._pageWindow.left(); this._listWindow.setPageIndex(page); this._listWindow.select(this._listWindow.maxItems() - 1); }; Scene_File.prototype.onDown = function () { var page = this._pageWindow.right(); var before = this._listWindow.index(); this._listWindow.setPageIndex(page); this._listWindow.select(before % maxCols); }; Scene_File.prototype.onUp = function () { var page = this._pageWindow.left(); var before = this._listWindow.index(); this._listWindow.setPageIndex(page); this._listWindow.select(before % maxCols + this._listWindow.maxItems() - maxCols); }; Scene_File.prototype.onPageup = function () { var page = this._pageWindow.left(); var before = this._listWindow.index(); this._listWindow.setPageIndex(page); if (this._listWindow.maxItems() <= before) { this._listWindow.select(0); } }; Scene_File.prototype.onPagedown = function () { var page = this._pageWindow.right(); var before = this._listWindow.index(); this._listWindow.setPageIndex(page); if (this._listWindow.maxItems() <= before) { this._listWindow.select(0); } }; var _Scene_Load_prototype_onSavefileOk = Scene_Load.prototype.onSavefileOk; Scene_Load.prototype.onSavefileOk = function () { var saveFileId = this.savefileId(); if (saveFileId < getRecoStartId() || saveFileId == Nore.AUTO_SAVE_DUMMY_ID) { _Scene_Load_prototype_onSavefileOk.call(this); return; } if (!DataManager.isThisGameFile(saveFileId)) { _Scene_Load_prototype_onSavefileOk.call(this); return; } SoundManager.playOk(); var confiemWindow; if (this._confiemWindow) { confiemWindow = this._confiemWindow; } else { confiemWindow = new Window_Confirm(); confiemWindow.setHandler('ok', this.onConfirmOk.bind(this)); confiemWindow.setHandler('delete', this.onConfirmDelete.bind(this)); confiemWindow.setHandler('cancel', this.onConfirmCancel.bind(this)); this._confiemWindow = confiemWindow; } var text = LOAD_CONFIRM_JP; switch ($gameVariables.value(1999)) { case 2: text = LOAD_CONFIRM_EN; break; case 3: text = LOAD_CONFIRM_CH; break; } confiemWindow.setText(text); confiemWindow.show(); confiemWindow.activate(); confiemWindow.select(0); this.addWindow(confiemWindow); //_Scene_Load_prototype_onSavefileOk.call(this); }; Scene_Load.prototype.onConfirmOk = function () { _Scene_Load_prototype_onSavefileOk.call(this); }; Scene_Load.prototype.onConfirmDelete = function () { var saveFileId = this.savefileId(); StorageManager.remove(saveFileId); var info = DataManager.loadGlobalInfo(); delete info[saveFileId]; this._confiemWindow.deactivate(); this._confiemWindow.hide(); this._listWindow.refresh(); this._listWindow.activate(); }; Scene_Load.prototype.onConfirmCancel = function () { this._confiemWindow.deactivate(); this._confiemWindow.hide(); this._listWindow.activate(); }; var Window_SavefileList2 = /** @class */ (function (_super) { __extends(Window_SavefileList2, _super); function Window_SavefileList2() { return _super !== null && _super.apply(this, arguments) || this; } Window_SavefileList2.prototype.maxItems = function () { return MAX_PAGE_FILES; }; Window_SavefileList2.prototype.update = function () { if (!$gameVariables) { return; } if (this._page >= RECOLLECTION_PAGE - 1) { $gameVariables.setValue(11, 2); //this.windowskin = ImageManager.loadSystem(recoPageWindowFile); } else { $gameVariables.setValue(11, 0); //this.windowskin = ImageManager.loadSystem('Window'); } _super.prototype.update.call(this); }; Window_SavefileList2.prototype.drawItem = function (index) { var id = index + this.pageTopIndex(); //console.log(id) var valid = DataManager.isThisGameFile(id); if (!valid && this._page == -1) { return; } var info = DataManager.loadSavefileInfo(id); var rect = this.itemRectForText(index); this.resetTextColor(); if (!valid && !info && id > 0) { if (StorageManager.exists(id)) { try { const jsonStr = StorageManager.load(id); const json = JsonEx.parse(jsonStr); info = this.makeDummySaveFile(); valid = true; } catch (e) { console.error(e); } } } this.changePaintOpacity(valid); this.drawFileId(id, rect.x + 33, rect.y); if (valid && info && info.label != null && info.label != 0) { this.drawText(info.label, rect.x + 33, rect.y + 30, rect.width - 33); } if (info) { this.changePaintOpacity(valid); this.drawContents(info, rect, valid); this.changePaintOpacity(true); } }; Window_SavefileList2.prototype.makeDummySaveFile = function () { var info = {}; info.globalId = this._globalId; info.title = $dataSystem.gameTitle; info.characters = []; info.faces = []; info.timestamp = Date.now(); var text = COPIED_LABEL_JP; switch ($gameVariables.value(1999)) { case 2: text = COPIED_LABEL_EN; break; case 3: text = COPIED_LABEL_CH; break; } info.playtime = text; return info; }; Window_SavefileList2.prototype.pageTopIndex = function () { return this._page * this.maxItems(); }; Window_SavefileList2.prototype.drawThumbnail = function (info, thumbRect, valid) { var _this = this; var savefileId = DataManager.getSavefileId(info); if (savefileId < 0 && info.title != null) { savefileId = AUTO_SAVE_ID; } var listIndex = savefileId - this.pageTopIndex(); if (savefileId >= 0 && info.thumbnail) { var sprite_1 = this._thumbContainer.children[listIndex]; if (!sprite_1) { console.error(savefileId + 'のサムネイルを表示できません'); return; } sprite_1.visible = true; sprite_1.x = thumbRect.x; sprite_1.y = thumbRect.y + 65; var thunmbBitmap_1 = ImageManager.loadThumbnail(savefileId, info); if (!thunmbBitmap_1.isReady()) { // 読み込み終わるまで別のビットマップを表示 var empty = ImageManager.loadBusyThumbBitmap(thumbRect.width, thumbRect.height); sprite_1.bitmap = empty; } thunmbBitmap_1.addLoadListener(function () { // 読み込み終わったときにリスト表示範囲内であれば描画 if (_this.topIndex() <= listIndex && _this.bottomIndex() >= listIndex) { sprite_1.visible = true; sprite_1.bitmap = thunmbBitmap_1; sprite_1.bitmap.paintOpacity = valid ? 255 : _this.translucentOpacity(); } else { sprite_1.visible = false; } }); } }; Window_SavefileList2.prototype.drawPlaytime = function (info, x, y, width) { if (info.playtime) { this.contents.fontSize = 22; this.drawText(info.playtime, x, y, width, 'right'); } }; Window_SavefileList2.prototype.selectedId = function () { return this.index() + this.pageTopIndex(); }; Window_SavefileList2.prototype.maxCols = function () { return maxCols; }; Window_SavefileList2.prototype.itemHeight = function () { return (this._height / MAX_ROW) - this.spacing(); }; Window_SavefileList2.prototype.setPageIndex = function (page) { this._page = page; this.refresh(); this.activate(); }; Window_SavefileList2.prototype.cursorUp = function (wrap) { var index = this.index(); if (index - this.maxCols() < 0) { this.callHandler('up'); return; } _super.prototype.cursorUp.call(this, wrap); }; ; Window_SavefileList2.prototype.cursorDown = function (wrap) { var index = this.index(); var maxItems = this.maxItems(); if (index + this.maxCols() >= maxItems) { this.callHandler('down'); return; } _super.prototype.cursorDown.call(this, wrap); }; ; Window_SavefileList2.prototype.cursorRight = function (wrap) { var index = this.index(); var maxItems = this.maxItems(); if (index + 1 >= maxItems) { this.callHandler('right'); return; } _super.prototype.cursorRight.call(this, wrap); }; Window_SavefileList2.prototype.cursorLeft = function (wrap) { var index = this.index(); if (index == 0) { this.callHandler('left'); return; } _super.prototype.cursorLeft.call(this, wrap); }; Window_SavefileList2.prototype.scrollDown = function (wrap) { SoundManager.playCursor(); this.callHandler('pagedown'); }; Window_SavefileList2.prototype.scrollUp = function (wrap) { SoundManager.playCursor(); this.callHandler('pageup'); }; ; return Window_SavefileList2; }(Window_SavefileList)); var Window_SavePage = /** @class */ (function (_super) { __extends(Window_SavePage, _super); function Window_SavePage() { return _super !== null && _super.apply(this, arguments) || this; } Window_SavePage.prototype.refresh = function () { this.margin = 0; this.makeItems(); _super.prototype.refresh.call(this); }; Window_SavePage.prototype.makeItems = function () { this._data = []; for (var i = 0; i < maxPage; i++) { this._data.push(i); } }; Window_SavePage.prototype.maxCols = function () { return 99; }; Window_SavePage.prototype.maxItems = function () { if (!this._data) { return 0; } return this._data.length; }; Window_SavePage.prototype.itemRect = function (index) { var rect = new Rectangle(); var maxCols = this.maxCols(); rect.width = this.itemWidth(); rect.height = this.itemHeight(); rect.x = index % maxCols * (rect.width + this.spacing()) - this._scrollX + 40; rect.y = Math.floor(index / maxCols) * rect.height - this._scrollY; return rect; }; Window_SavePage.prototype.drawItem = function (index) { this.contents.fontSize = 24; var rect = this.itemRect(index); var data = this._data[index]; this.resetTextColor(); this.changePaintOpacity(index == this._index); if (data >= RECOLLECTION_PAGE - 1) { var text = RECO_LABEL_JP; switch ($gameVariables.value(1999)) { case 2: text = RECO_LABEL_EN; break; case 3: text = RECO_LABEL_CH; break; } this.drawText(text.format(data + 2 - RECOLLECTION_PAGE), rect.x, -5, 40, 30, 'center'); } else { this.drawText(data + 1, rect.x, -5, 30, 30, 'center'); } }; Window_SavePage.prototype.itemWidth = function () { return 48; }; Window_SavePage.prototype.setPage = function (page) { this._index = page; this.refresh(); }; Window_SavePage.prototype.left = function () { this._index--; if (this._index < 0) { this._index = this._data.length - 1; } this.refresh(); return this.page(); }; Window_SavePage.prototype.right = function () { this._index++; if (this._index == this._data.length) { this._index = 0; } this.refresh(); return this.page(); }; Window_SavePage.prototype.page = function () { return this._data[this._index]; }; return Window_SavePage; }(Window_Selectable)); var Window_Confirm = /** @class */ (function (_super) { __extends(Window_Confirm, _super); function Window_Confirm() { var _this_1 = this; var w = 680; var h = 150; var y = (Graphics.boxHeight - h) / 2; _this_1 = _super.call(this, (Graphics.boxWidth - w) / 2, y, w, h) || this; _this_1.update(); return _this_1; } Window_Confirm.prototype.setInfo = function (ok) { this._ok = ok; this.refresh(); }; Window_Confirm.prototype.setText = function (text) { this._text = text; this._texts = null; this.height = 140; this.refresh(); }; Window_Confirm.prototype.setTexts = function (texts) { this._texts = texts; this.height = 180; this.refresh(); }; Window_Confirm.prototype.makeCommandList = function () { var loadText = LOAD_LABEL_JP; switch ($gameVariables.value(1999)) { case 2: loadText = LOAD_LABEL_EN; break; case 3: loadText = LOAD_LABEL_CH; break; } var deleteText = DELETE_LABEL_JP; switch ($gameVariables.value(1999)) { case 2: deleteText = DELETE_LABEL_EN; break; case 3: deleteText = DELETE_LABEL_CH; break; } this.addCommand(loadText, 'ok', this._ok); this.addCommand(deleteText, 'delete', true); this.addCommand(TextManager.cancel, 'cancel', true); }; Window_Confirm.prototype.windowWidth = function () { return 620; }; Window_Confirm.prototype.windowHeight = function () { return 140; }; Window_Confirm.prototype.maxCols = function () { return 3; }; Window_Confirm.prototype.refresh = function () { _super.prototype.refresh.call(this); if (this._texts) { var yy = 4; for (var _i = 0, _a = this._texts; _i < _a.length; _i++) { var t = _a[_i]; this.drawText(t, 10, yy, this.windowWidth() - 60, 'center'); yy += 35; } } else { this.drawText(this._text, 10, 4, this.windowWidth() - 60, 'center'); } }; Window_Confirm.prototype.itemRect = function (index) { var rect = new Rectangle(0, 0, 0, 0); var maxCols = this.maxCols(); rect.width = this.itemWidth(); rect.height = this.itemHeight(); rect.x = index % maxCols * (rect.width + this.spacing()) - this._scrollX; rect.y = Math.floor(index / maxCols) * rect.height - this._scrollY + 64; if (this._texts) { rect.y += 40; } return rect; }; Window_Confirm.prototype.spacing = function () { return 8; }; return Window_Confirm; }(Window_HorzCommand)); Nore.Window_Confirm = Window_Confirm; var _DataManager_loadGameWithoutRescue = DataManager.loadGameWithoutRescue; DataManager.loadGameWithoutRescue = function (savefileId) { var lastAccessId = this._lastAccessedId; let result; if (this.isThisGameFile2(savefileId)) { var json = StorageManager.load(savefileId); this.createGameObjects(); this.extractSaveContents(JsonEx.parse(json)); this._lastAccessedId = savefileId; result = true; } else { result = false; } $gameTemp.interceptorType = 2; if (this._lastAccessedId >= getRecoStartId()) { this._lastAccessedId = lastAccessId; } if (this._lastAccessedId == Nore.AUTO_SAVE_DUMMY_ID) { this._lastAccessedId = lastAccessId; } return result; }; var _Nore_DataManager_isThisGameFile = DataManager.isThisGameFile; DataManager.isThisGameFile2 = function (savefileId) { const result = _Nore_DataManager_isThisGameFile.apply(this, arguments); if (!result) { if (StorageManager.exists(savefileId)) { return true; } return false; } return true; }; })(Nore || (Nore = {})); /* (function () { function p(arg) { console.log(arg); } window.p = p; })(); */
dazed/translations
www/js/plugins/Nore_RecollectionSave.js
JavaScript
unknown
31,906
//============================================================================= // PANDA_KeywordColor.js //============================================================================= // [Update History] // 2020-08-30 Ver.1.0.0 First Release for MV/MZ. // 2020-09-06 Ver.1.0.1 Added the Korean Description. /*: * @target MV MZ * @plugindesc simplify changing the color of keywords in messages. * @author panda(werepanda.jp) * @url http://www.werepanda.jp/blog/20200830005445.html * * @help In messages, replace the following descriptions as follows. * You can change the text color of keywords etc. with a simple description. * <Xsome text> → \C[n]some text\C[0] * "X" is one alphabet character that means the kind of word. * You can specify the color according to the kind of word, * such as blue for the person name and red for the item name etc. * * The word kinds and colors can be defined by parameters, * and the default is as follows: * N:4 (person Name : blue) * E:4 (Enemy name : blue) * P:6 (Place name : yellow) * I:2 (Item name : red) * S:2 (Skill name : red) * K:27 (other Keyword : pink) * * [License] * this plugin is released under MIT license. * https://opensource.org/licenses/mit-license.php * * @param KeyList * @text Word Kind List * @desc The list of an alphabet character that means a kind of the word, "N" as the person name, "I" as the item name etc. * @type string[] * @default ["N","E","P","I","S","K"] * * @param ColorList * @text Color Number List * @desc The list of a color number for a kind of the word. The Color Number List should correspond to the Word Kind List. * @type number[] * @default ["4","4","6","2","2","27"] * @max 31 * @min 0 */ /*:ja * @target MV MZ * @plugindesc 文章中で重要語句の文字色変更を簡略化できます。 * @author panda(werepanda.jp) * @url http://www.werepanda.jp/blog/20200830005445.html * * @help 文章の表示や説明文等において、以下の記述を次のように置き換えます。 * 簡単な記述で、重要語句等の文字色を変更することができます。 * <X文章> → \C[n]文章\C[0] * "X"の部分には語句の種類を表すアルファベット1文字が入ります。 * 人名は青、アイテム名は赤など、語句の種類に応じて色の指定が可能です。 * * 語句の種類と色はパラメータで定義が可能で、デフォルトは以下となっています。 * N:4(人名:青) * E:4(敵キャラ名:青) * P:6(地名:黄) * I:2(アイテム名:赤) * S:2(スキル名:赤) * K:27(その他の重要語句:ピンク) * * ■ 利用規約 * このプラグインはMITライセンスで配布されます。 * ご自由にお使いください。 * https://opensource.org/licenses/mit-license.php * * @param KeyList * @text 語句種リスト * @desc 人名に"N"、アイテム名に"I"など、語句の種類を表す英字1文字のリスト。 * @type string[] * @default ["N","E","P","I","S","K"] * * @param ColorList * @text 色番号リスト * @desc 語句種リストに対応する色番号のリスト。語句種リストと対応させる必要があります。 * @type number[] * @default ["4","4","6","2","2","27"] * @max 31 * @min 0 */ /*:ko * @target MV MZ * @plugindesc 텍스트중에서 중요 단어의 글자 색 변경이 간단해집니다. * @author panda(werepanda.jp) * @url http://www.werepanda.jp/blog/20200830005445.html * * @help 텍스트 표시나 설명등에서 이하의 기술을 다음과 같이 바꿉니다. * 쉬운 기술로 중요 단어의 글자 색깔을 변경할 수 있습니다. * <X텍스트> → \C[n]텍스트\C[0] * "X" 부분에는 단어의 종류를 나타내는 알파벳 1글자가 들어갑니다. * 인명은 파란색, 아이템명은 빨간색등, 단어의 종류에 따라 색깔 지정이 가능합니다. * * 단어의 종류와 색깔은 매개변수애서 정의가 되며 기본값은 다음과 같습니다. * N:4 (인명 : 파랑) * E:4 (적 캐릭터명 : 파랑) * P:6 (지명 : 노랑) * I:2 (아이템명 : 빨강) * S:2 (스킬명 : 빨강) * K:27 (기타 중요단어 : 핑크) * * [이용 약관] * 이 플러그인은 MIT 라이센스로 공개됩니다. * https://opensource.org/licenses/mit-license.php * * @param KeyList * @text 종류 리스트 * @desc 인명에 "N", 아이템명에 "I"등, 단어의 종류를 나타내는 알파벳 1글자 리스트. * @type string[] * @default ["N","E","P","I","S","K"] * * @param ColorList * @text 색 번호 리스트 * @desc 종류 리스트에 대응되는 색 번호 리스트. 종류 리스트와 대응시켜야 합니다. * @type number[] * @default ["4","4","6","2","2","27"] * @max 31 * @min 0 */ (() => { 'use strict'; // This Plugin Name const pluginName = 'PANDA_KeywordColor'; // Parameters const parameters = PluginManager.parameters(pluginName); const KeyList = JSON.parse(parameters['KeyList']) || []; const ColorList = JSON.parse(parameters['ColorList']) || []; // Key String for RegExp and [Key => Color] Map let keyString = ''; let keyMap = new Map(); for (let i in KeyList) { let k = KeyList[i]; if (k) { k = k.charAt(0).toUpperCase(); let c = parseInt(ColorList[i]) || 0; keyString += k; keyMap.set(k, c); } } // RegExp Object const keyRegExp = new RegExp("<([" + keyString + "])(.+?)>", "ig"); //-------------------------------------------------- // Window_Base.convertEscapeCharacters // [Additional Definition] //-------------------------------------------------- const _Window_Base_convertEscapeCharacters = Window_Base.prototype.convertEscapeCharacters; Window_Base.prototype.convertEscapeCharacters = function (text) { // Convert Keyword String to Color text = text.replace(keyRegExp, function () { let k = arguments[1].toUpperCase(); let c = keyMap.get(k) || 0; return "\\C[" + c + "]" + arguments[2] + "\\C[0]"; }.bind(this)); // Original Processing text = _Window_Base_convertEscapeCharacters.call(this, text); return text; }; })();
dazed/translations
www/js/plugins/PANDA_KeywordColor.js
JavaScript
unknown
6,205
//============================================================================= // PictureAnimation.js // ---------------------------------------------------------------------------- // (C) 2015 Triacontane // This software is released under the MIT License. // http://opensource.org/licenses/mit-license.php // ---------------------------------------------------------------------------- // Version // 1.5.10 2020/01/30 現在のセル番号を取得できるスクリプトのヘルプを追加 // 1.5.9 2020/01/26 アニメーション中のピクチャを別のピクチャに差し替えて表示したとき、クロスフェード用の半透明ピクチャが残ってしまう場合がある不具合を修正 // 1.5.8 2019/10/27 アニメーションタイプが1以外の場合に、非ループアニメの終了位置が間違っている問題を修正 // 1.5.7 2019/04/20 コマンド「PA_SOUND」にて「1」番目のセルを指定したとき、アニメーション開始直後にも演奏されるよう修正 // 1.5.6 2019/03/03 シーン外のピクチャのアニメーションおよび効果音演奏を無効にするよう修正 // 1.5.5 2019/02/13 コマンド「PA_SET_CELL」において0番(最初のセル)に対する指定が機能しない問題を修正 // 1.5.4 2019/02/09 1.5.3の修正によりセルパターンを指定しないでアニメ再生するとエラーになる問題を修正 // 1.5.3 2019/02/27 セルパターンの直接指定でアニメ再生する際、最初のセルが必ず1番になってしまう現象を修正 // 1.5.2 2018/03/04 縦及び横でアニメーションピクチャを表示した後、同じ番号でピクチャの表示をすると正常に表示されない場合がある不具合を修正 // 1.5.1 2017/08/22 アニメーション再生中に、セル数が少ない別のアニメーションに切り替えたときにエラーが発生する場合がある現象を修正 // 1.5.0 2017/07/03 ループしないアニメーションの終了後に最初のセルに戻るかどうかを選択できる機能を追加 // 1.4.0 2016/09/03 アニメーションに合わせて指定したSEを演奏する機能を追加 // 1.3.2 2016/05/11 クロスフェードを指定していた場合に2回目のアニメ表示でエラーになる場合がある問題を修正 // 1.3.1 2016/03/15 ピクチャ上に戦闘アニメを表示するプラグイン「PictureOnAnimation」との競合を解消 // 原点を中央したピクチャにクロスフェードを行うと表示位置がずれる問題を修正 // 1.3.0 2016/02/28 セル番号を変数と連動する機能を追加 // 処理の負荷を少し軽減 // 1.2.3 2016/02/07 戦闘画面でもピクチャのアニメーションができるように修正 // 1.2.2 2016/01/24 空のピクチャを表示しようとした際にエラーが発生する現象を修正 // 1.2.1 2016/01/16 同じ画像を指定してピクチャ表示→アニメーション準備→ピクチャ表示の順で実行した // 場合にエラーが発生する現象の修正 // 1.2.0 2016/01/04 セルのパターンを自由に指定できる機能を追加 // セルの最大数を100から200に拡大 // 1.1.2 2015/12/24 クロスフェードによる画像切替に対応しました // 1.1.1 2015/12/21 ピクチャのファイル名を連番方式で指定できる機能を追加 // アニメーションの強制終了の機能を追加 // 1.0.0 2015/12/19 初版 // ---------------------------------------------------------------------------- // [Blog] : https://triacontane.blogspot.jp/ // [Twitter]: https://twitter.com/triacontane/ // [GitHub] : https://github.com/triacontane/ //============================================================================= /*: * @plugindesc ピクチャのアニメーションプラグイン * @author トリアコンタン * * @param 最初のセルに戻る * @desc ループしないアニメーションの終了後、最初のセルに戻ります。無効にすると最後のセルで止まります。 * @default true * @type boolean * * @help 指定したフレーム間隔でピクチャをアニメーションします。 * アニメーションしたいセル画像(※)を用意の上 * 以下のコマンドを入力してください。 * * 1. ピクチャのアニメーション準備(プラグインコマンド) * 2. ピクチャの表示(通常のイベントコマンド) * 3. ピクチャのアニメーション開始(プラグインコマンド) * 4. ピクチャのアニメーション終了(プラグインコマンド) * * ※配置方法は以下の3通りがあります。 * 縦 :セルを縦に並べて全体を一つのファイルにします。 * 横 :セルを横に並べて全体を一つのファイルにします。 * 連番:連番のセル画像を複数用意します。(original部分は任意の文字列) * original00.png(ピクチャの表示で指定するオリジナルファイル) * original01.png * original02.png... * * 要注意! 配置方法の連番を使う場合、デプロイメント時に * 未使用ファイルとして除外される可能性があります。 * その場合、削除されたファイルを入れ直す等の対応が必要です。 * * また、単にアニメーションさせる以外にも、プラグインコマンドから * セル番号を直接指定したり、変数の値とセル番号を連動させたりできます。 * 紙芝居のような演出や、条件次第で立ち絵の表示状態を変化させたりする場合に * 有効です。 * * プラグインコマンド詳細 * イベントコマンド「プラグインコマンド」から実行。 * (パラメータの間は半角スペースで区切る) * * PA_INIT or * ピクチャのアニメーション準備 [セル数] [フレーム数] [セル配置方法] [フェード時間] *  ピクチャをアニメーション対象にする準備をします。 *  「ピクチャの表示」の直前に実行してください。 *  セル数   :アニメーションするセル画の数(最大200枚) *  フレーム数 :アニメーション間隔のフレーム数(最低でも1を設定) *  セル配置方向:セルの配置(縦 or 横 or 連番) *  フェード時間:画像切替に掛かるフレーム数(0にするとフェードしない) * 使用例:PA_INIT 4 10 連番 20 * * PA_START or * ピクチャのアニメーション開始 [ピクチャ番号] [アニメーションタイプ] [カスタムパターン配列] *  指定したピクチャ番号のピクチャをアニメーションを開始します。 *  一周するとアニメーションは自動で止まります。 * *  アニメーションのタイプは以下の3パターンがあります。 *   例:セル数が 4 の場合 *    タイプ1: 1→2→3→4→1→2→3→4... *    タイプ2: 1→2→3→4→3→2→1→2... *    タイプ3: 好きな順番を配列で指定(セルの最小値は 1 です) * 使用例:PA_START 1 2 *     PA_START 1 3 [1,2,1,3,1,4] * * PA_START_LOOP or * ピクチャのループアニメーション開始 [ピクチャ番号] [アニメーションタイプ] [カスタムパターン配列] *  指定したピクチャ番号のピクチャをアニメーションを開始します。 *  明示的に終了するまでアニメーションが続きます。 * 使用例:PA_START_LOOP 1 2 *     PA_START_LOOP 1 3 [1,2,1,3,1,4] * * PA_STOP or * ピクチャのアニメーション終了 [ピクチャ番号] *  指定したピクチャ番号のピクチャをアニメーションを終了します。 *  一番上のセルに戻った時点でアニメーションが止まります。 * 使用例:PA_STOP 1 * * PA_STOP_FORCE or * ピクチャのアニメーション強制終了 [ピクチャ番号] *  指定したピクチャ番号のピクチャをアニメーションを終了します。 *  現在表示しているセルでアニメーションが止まります。 * 使用例:PA_STOP_FORCE 1 * * PA_SET_CELL or * ピクチャのアニメーションセル設定 [ピクチャ番号] [セル番号] [ウェイトあり] *  アニメーションのセルを直接設定します。(セルの最小値は 1 です) *  任意のタイミングでアニメーションしたい場合に有効です。 *  ウェイトありを設定すると、クロスフェード中はイベントの実行を待機します。 * 使用例:PA_SET_CELL 1 3 ウェイトあり * * PA_PROG_CELL or * ピクチャのアニメーションセル進行 [ピクチャ番号] [ウェイトあり] *  アニメーションのセルをひとつ先に進めます。 *  任意のタイミングでアニメーションしたい場合に有効です。 *  ウェイトありを設定すると、クロスフェード中はイベントの実行を待機します。 * 使用例:PA_PROG_CELL 1 ウェイトあり * * PA_SET_VARIABLE or * ピクチャのアニメーションセル変数の設定 [ピクチャ番号] [変数番号] *  アニメーションのセルを指定した変数と連動させます。 *  変数の値が変化すると表示しているセルも自動的に変化します。 * 使用例:PA_SET_VARIABLE 1 2 * * PA_SOUND or * ピクチャのアニメーション効果音予約 [セル番号] *  アニメーションのセルが切り替わったタイミングで効果音を演奏します。 *  このコマンドの直後にイベントコマンド「SEの演奏」を実行すると *  その場でSEは演奏されず、ピクチャのアニメーション開始後に指定のタイミングで *  演奏されるようになります。 *  必ずピクチャのアニメーション開始前に実行してください。 * * スクリプト詳細 * * アニメーション中のピクチャに対して現在のセル番号を取得します。 * イベントコマンド「変数の操作」や「条件分岐」で使用できます。 * ピクチャを表示していないときに実行するとエラーになります。 * $gameScreen.picture(1).cell; // ピクチャ番号[1]のセルを取得 * * 利用規約: * 作者に無断で改変、再配布が可能で、利用形態(商用、18禁利用等) * についても制限はありません。 * このプラグインはもうあなたのものです。 */ (function () { 'use strict'; var pluginName = 'PictureAnimation'; var settings = { /* maxCellAnimation:セル数の最大値 */ maxCellAnimation: 200 }; var getParamString = function (paramNames) { if (!Array.isArray(paramNames)) paramNames = [paramNames]; for (var i = 0; i < paramNames.length; i++) { var name = PluginManager.parameters(pluginName)[paramNames[i]]; if (name) return name; } return ''; }; var getParamBoolean = function (paramNames) { var value = getParamString(paramNames); return value.toUpperCase() === 'ON' || value.toUpperCase() === 'TRUE'; }; //============================================================================= // ローカル関数 // プラグインパラメータやプラグインコマンドパラメータの整形やチェックをします //============================================================================= var getCommandName = function (command) { return (command || '').toUpperCase(); }; var getArgArrayString = function (args, upperFlg) { var values = getArgString(args, upperFlg); return (values || '').split(','); }; var getArgArrayNumber = function (args, min, max) { if (!args) { return []; } var values = getArgArrayString(args.substring(1, args.length - 1), false); if (arguments.length < 2) min = -Infinity; if (arguments.length < 3) max = Infinity; for (var i = 0; i < values.length; i++) values[i] = (parseInt(values[i], 10) || 0).clamp(min, max); return values; }; var getArgString = function (arg, upperFlg) { arg = convertEscapeCharacters(arg); return upperFlg ? arg.toUpperCase() : arg; }; var getArgNumber = function (arg, min, max) { if (arguments.length < 2) min = -Infinity; if (arguments.length < 3) max = Infinity; return (parseInt(convertEscapeCharacters(arg), 10) || 0).clamp(min, max); }; var convertEscapeCharacters = function (text) { if (text == null) text = ''; var window = SceneManager._scene._windowLayer.children[0]; return window ? window.convertEscapeCharacters(text) : text; }; //============================================================================= // パラメータの取得と整形 //============================================================================= var param = {}; param.returnToFirstCell = getParamBoolean(['ReturnToFirstCell', '最初のセルに戻る']); //============================================================================= // Game_Interpreter // プラグインコマンドを追加定義します。 //============================================================================= var _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand; Game_Interpreter.prototype.pluginCommand = function (command, args) { _Game_Interpreter_pluginCommand.call(this, command, args); this.pluginCommandPictureAnimation(command, args); }; Game_Interpreter.prototype.pluginCommandPictureAnimation = function (command, args) { var pictureNum, animationType, picture, cellNumber, frameNumber, direction, fadeDuration, wait, customArray; switch (getCommandName(command)) { case 'PA_INIT': case 'ピクチャのアニメーション準備': cellNumber = getArgNumber(args[0], 1, settings.maxCellAnimation); frameNumber = getArgNumber(args[1], 1, 9999); direction = getArgString(args[2], true) || '縦'; fadeDuration = getArgNumber(args[3], 0, 9999) || 0; $gameScreen.setPicturesAnimation(cellNumber, frameNumber, direction, fadeDuration); break; case 'PA_SOUND': case 'ピクチャのアニメーション効果音予約': cellNumber = getArgNumber(args[0], 1, settings.maxCellAnimation); this.reservePaSound(cellNumber); break; case 'PA_START': case 'ピクチャのアニメーション開始': pictureNum = getArgNumber(args[0], 1, $gameScreen.maxPictures()); animationType = getArgNumber(args[1], 1, 3); customArray = getArgArrayNumber(args[2], 1, settings.maxCellAnimation); picture = $gameScreen.picture(pictureNum); if (picture) picture.startAnimationFrame(animationType, false, customArray); break; case 'PA_START_LOOP': case 'ピクチャのループアニメーション開始': pictureNum = getArgNumber(args[0], 1, $gameScreen.maxPictures()); animationType = getArgNumber(args[1], 1, 3); customArray = getArgArrayNumber(args[2], 1, settings.maxCellAnimation); picture = $gameScreen.picture(pictureNum); if (picture) picture.startAnimationFrame(animationType, true, customArray); break; case 'PA_STOP': case 'ピクチャのアニメーション終了': pictureNum = getArgNumber(args[0], 1, $gameScreen.maxPictures()); picture = $gameScreen.picture(pictureNum); if (picture) picture.stopAnimationFrame(false); break; case 'PA_STOP_FORCE': case 'ピクチャのアニメーション強制終了': pictureNum = getArgNumber(args[0], 1, $gameScreen.maxPictures()); picture = $gameScreen.picture(pictureNum); if (picture) picture.stopAnimationFrame(true); break; case 'PA_SET_CELL': case 'ピクチャのアニメーションセル設定': pictureNum = getArgNumber(args[0], 1, $gameScreen.maxPictures()); cellNumber = getArgNumber(args[1], 0, settings.maxCellAnimation); wait = getArgString(args[2]); picture = $gameScreen.picture(pictureNum); if (picture) { if (wait === 'ウェイトあり' || wait.toUpperCase() === 'WAIT') this.wait(picture._fadeDuration); picture.cell = cellNumber; } break; case 'PA_PROG_CELL': case 'ピクチャのアニメーションセル進行': pictureNum = getArgNumber(args[0], 1, $gameScreen.maxPictures()); wait = getArgString(args[1]); picture = $gameScreen.picture(pictureNum); if (picture) { if (wait === 'ウェイトあり' || wait.toUpperCase() === 'WAIT') this.wait(picture._fadeDuration); picture.addCellCount(); } break; case 'PA_SET_VARIABLE': case 'ピクチャのアニメーションセル変数の設定': pictureNum = getArgNumber(args[0], 1, $gameScreen.maxPictures()); picture = $gameScreen.picture(pictureNum); if (picture) picture.linkToVariable(getArgNumber(args[1])); break; } }; Game_Interpreter.prototype.reservePaSound = function (cellNumber) { this._paSoundFrame = cellNumber; }; var _Game_Interpreter_command250 = Game_Interpreter.prototype.command250; Game_Interpreter.prototype.command250 = function () { if (this._paSoundFrame) { var se = this._params[0]; AudioManager.loadStaticSe(se); $gameScreen.addPaSound(se, this._paSoundFrame); this._paSoundFrame = null; return true; } return _Game_Interpreter_command250.apply(this, arguments); }; //============================================================================= // Game_Screen // アニメーション関連の情報を追加で保持します。 //============================================================================= Game_Screen.prototype.setPicturesAnimation = function (cellNumber, frameNumber, direction, fadeDuration) { this._paCellNumber = cellNumber; this._paFrameNumber = frameNumber; this._paDirection = direction; this._paFadeDuration = fadeDuration; }; Game_Screen.prototype.addPaSound = function (sound, frame) { if (!this._paSounds) this._paSounds = []; this._paSounds[frame] = sound; }; Game_Screen.prototype.clearPicturesAnimation = function () { this._paCellNumber = 1; this._paFrameNumber = 1; this._paDirection = ''; this._paFadeDuration = 0; this._paSounds = null; }; var _Game_Screen_showPicture = Game_Screen.prototype.showPicture; Game_Screen.prototype.showPicture = function (pictureId, name, origin, x, y, scaleX, scaleY, opacity, blendMode) { _Game_Screen_showPicture.apply(this, arguments); var realPictureId = this.realPictureId(pictureId); if (this._paCellNumber > 1) { this._pictures[realPictureId].setAnimationFrameInit( this._paCellNumber, this._paFrameNumber, this._paDirection, this._paFadeDuration, this._paSounds); this.clearPicturesAnimation(); } }; Game_Screen.prototype.isActivePicture = function (picture) { var realId = this._pictures.indexOf(picture); return realId > this.maxPictures() === $gameParty.inBattle(); }; //============================================================================= // Game_Picture // アニメーション関連の情報を追加で保持します。 //============================================================================= var _Game_Picture_initialize = Game_Picture.prototype.initialize; Game_Picture.prototype.initialize = function () { _Game_Picture_initialize.call(this); this.initAnimationFrameInfo(); }; Game_Picture.prototype.initAnimationFrameInfo = function () { this._cellNumber = 1; this._frameNumber = 1; this._cellCount = 0; this._frameCount = 0; this._animationType = 0; this._customArray = null; this._loopFlg = false; this._direction = ''; this._fadeDuration = 0; this._fadeDurationCount = 0; this._prevCellCount = 0; this._animationFlg = false; this._linkedVariable = 0; this._cellSes = []; }; Game_Picture.prototype.direction = function () { return this._direction; }; Game_Picture.prototype.cellNumber = function () { return this._cellNumber; }; Game_Picture.prototype.prevCellCount = function () { return this._prevCellCount; }; Game_Picture.prototype.isMulti = function () { var dir = this.direction(); return dir === '連番' || dir === 'N'; }; /** * The cellCount of the Game_Picture (0 to cellNumber). * * @property cellCount * @type Number */ Object.defineProperty(Game_Picture.prototype, 'cell', { get: function () { if (this._linkedVariable > 0) { return $gameVariables.value(this._linkedVariable) % this._cellNumber; } switch (this._animationType) { case 3: return (this._customArray[this._cellCount] - 1).clamp(0, this._cellNumber - 1); case 2: return this._cellNumber - 1 - Math.abs(this._cellCount - (this._cellNumber - 1)); case 1: return this._cellCount; default: return this._cellCount; } }, set: function (value) { var newCellCount = value % this.getCellNumber(); if (this._cellCount !== newCellCount) { this._prevCellCount = this.cell; this._fadeDurationCount = this._fadeDuration; } this._cellCount = newCellCount; } }); Game_Picture.prototype.getCellNumber = function () { switch (this._animationType) { case 3: return this._customArray.length; case 2: return (this._cellNumber - 1) * 2; case 1: return this._cellNumber; default: return this._cellNumber; } }; var _Game_Picture_update = Game_Picture.prototype.update; Game_Picture.prototype.update = function () { _Game_Picture_update.call(this); if (this.isFading()) { this.updateFading(); } else if (this.hasAnimationFrame() && this.isActive()) { this.updateAnimationFrame(); } }; Game_Picture.prototype.linkToVariable = function (variableNumber) { this._linkedVariable = variableNumber.clamp(1, $dataSystem.variables.length); }; Game_Picture.prototype.updateAnimationFrame = function () { this._frameCount = (this._frameCount + 1) % this._frameNumber; if (this._frameCount === 0) { this.addCellCount(); this.playCellSe(); if (this.isEndFirstLoop() && !this._loopFlg) { this._animationFlg = false; } } }; Game_Picture.prototype.isEndFirstLoop = function () { return this._cellCount === (param.returnToFirstCell ? 0 : this.getCellNumber() - 1); }; Game_Picture.prototype.updateFading = function () { this._fadeDurationCount--; }; Game_Picture.prototype.prevCellOpacity = function () { if (this._fadeDuration === 0) return 0; return this.opacity() / this._fadeDuration * this._fadeDurationCount; }; Game_Picture.prototype.addCellCount = function () { this.cell = this._cellCount + 1; }; Game_Picture.prototype.playCellSe = function () { var se = this._cellSes[this.cell + 1]; if (se) { AudioManager.playSe(se); } }; Game_Picture.prototype.setAnimationFrameInit = function (cellNumber, frameNumber, direction, fadeDuration, cellSes) { this._cellNumber = cellNumber; this._frameNumber = frameNumber; this._frameCount = 0; this._cellCount = 0; this._direction = direction; this._fadeDuration = fadeDuration; this._cellSes = cellSes || []; }; Game_Picture.prototype.startAnimationFrame = function (animationType, loopFlg, customArray) { this._animationType = animationType; this._customArray = customArray; this._animationFlg = true; this._loopFlg = loopFlg; if (this._cellNumber <= this._cellCount) { this._cellCount = this._cellNumber - 1; } this.playCellSe(); }; Game_Picture.prototype.stopAnimationFrame = function (forceFlg) { this._loopFlg = false; if (forceFlg) { this._animationFlg = false; } }; Game_Picture.prototype.hasAnimationFrame = function () { return this._animationFlg; }; Game_Picture.prototype.isFading = function () { return this._fadeDurationCount !== 0; }; Game_Picture.prototype.isNeedFade = function () { return this._fadeDuration !== 0; }; Game_Picture.prototype.isActive = function () { return $gameScreen.isActivePicture(this); }; //============================================================================= // Sprite_Picture // アニメーション関連の情報を追加で保持します。 //============================================================================= var _Sprite_Picture_initialize = Sprite_Picture.prototype.initialize; Sprite_Picture.prototype.initialize = function (pictureId) { this._prevSprite = null; _Sprite_Picture_initialize.apply(this, arguments); }; var _Sprite_Picture_update = Sprite_Picture.prototype.update; Sprite_Picture.prototype.update = function () { _Sprite_Picture_update.apply(this, arguments); var picture = this.picture(); if (picture && picture.name()) { if (picture.isMulti() && !this._bitmaps) { this.loadAnimationBitmap(); } if (this.isBitmapReady()) { this.updateAnimationFrame(this, picture.cell); if (picture.isNeedFade()) this.updateFading(); } } }; var _Sprite_Picture_updateBitmap = Sprite_Picture.prototype.updateBitmap; Sprite_Picture.prototype.updateBitmap = function () { _Sprite_Picture_updateBitmap.apply(this, arguments); if (!this.picture()) { this._bitmaps = null; if (this._prevSprite) { this._prevSprite.bitmap = null; } } }; Sprite_Picture.prototype.updateFading = function () { if (!this._prevSprite) { this.makePrevSprite(); } if (!this._prevSprite.bitmap) { this.makePrevBitmap(); } var picture = this.picture(); if (picture.isFading()) { this._prevSprite.visible = true; this.updateAnimationFrame(this._prevSprite, picture.prevCellCount()); this._prevSprite.opacity = picture.prevCellOpacity(); } else { this._prevSprite.visible = false; } }; Sprite_Picture.prototype.updateAnimationFrame = function (sprite, cellCount) { switch (this.picture().direction()) { case '連番': case 'N': sprite.bitmap = this._bitmaps[cellCount]; sprite.setFrame(0, 0, sprite.bitmap.width, sprite.bitmap.height); break; case '縦': case 'V': var height = sprite.bitmap.height / this.picture().cellNumber(); var y = cellCount * height; sprite.setFrame(0, y, sprite.bitmap.width, height); break; case '横': case 'H': var width = sprite.bitmap.width / this.picture().cellNumber(); var x = cellCount * width; sprite.setFrame(x, 0, width, sprite.bitmap.height); break; default: sprite.setFrame(0, 0, this.bitmap.width, this.bitmap.height); } }; var _Sprite_Picture_loadBitmap = Sprite_Picture.prototype.loadBitmap; Sprite_Picture.prototype.loadBitmap = function () { _Sprite_Picture_loadBitmap.apply(this, arguments); this._bitmapReady = false; this._bitmaps = null; if (this._prevSprite) { this._prevSprite.visible = false; } }; Sprite_Picture.prototype.loadAnimationBitmap = function () { var cellNumber = this.picture().cellNumber(); var cellDigit = cellNumber.toString().length; this._bitmaps = [this.bitmap]; for (var i = 1; i < cellNumber; i++) { var filename = this._pictureName.substr(0, this._pictureName.length - cellDigit) + i.padZero(cellDigit); this._bitmaps[i] = ImageManager.loadPicture(filename); } this._bitmapReady = false; }; Sprite_Picture.prototype.makePrevSprite = function () { this._prevSprite = new Sprite(); this._prevSprite.visible = false; this.addChild(this._prevSprite); }; Sprite_Picture.prototype.makePrevBitmap = function () { this._prevSprite.bitmap = this.bitmap; this._prevSprite.anchor.x = this.anchor.x; this._prevSprite.anchor.y = this.anchor.y; }; Sprite_Picture.prototype.isBitmapReady = function () { if (!this.bitmap) return false; if (this._bitmapReady) return true; var result; if (this.picture().isMulti()) { result = this._bitmaps.every(function (bitmap) { return bitmap.isReady(); }); } else { result = this.bitmap.isReady(); } this._bitmapReady = result; return result; }; })();
dazed/translations
www/js/plugins/PictureAnimation.js
JavaScript
unknown
31,238
//============================================================================= // PictureCallCommon.js // ---------------------------------------------------------------------------- // (C)2015 Triacontane // This plugin is released under the MIT License. // http://opensource.org/licenses/mit-license.php // ---------------------------------------------------------------------------- // Version // 1.13.0 2019/12/22 ピクチャコモンを並列処理として実行する設定を追加。 // 1.12.2 2019/03/31 キーバインドで追加でキーを指定した場合に、ボタン名称が小文字でないと反応しない仕様を変更 // 1.12.1 2019/03/19 コミュニティ版コアスクリプト1.3以降でピクチャコモンから移動ルートの設定を実行するとエラーになっていた問題を修正 // 1.12.0 2018/11/02 すべてのピクチャタッチを無効にできるスイッチを追加 // 1.11.0 2018/08/10 なでなで機能に透過設定が正しく適用されない問題を修正 // なでなで機能にもプラグインコマンドから透過設定を変更できる機能を追加 // 1.10.8 2018/06/16 Boolean型のパラメータが一部正常に取得できていなかった問題を修正 // 1.10.7 2018/06/01 イベント「戦闘の処理」による戦闘の場合、「戦闘中に常にコモン実行」の機能が使えない問題を修正 // 1.10.6 2018/04/12 ヘルプの記述を微修正 // 1.10.5 2017/12/17 コモンイベントを実行するタイプのボタンは、イベント実行中に無効になるよう仕様変更 // 1.10.4 2017/11/01 ピクチャコモンが呼ばれる瞬間に対象ピクチャが表示されていない場合はイベントを呼ばない仕様に変更 // 1.10.3 2017/10/28 ピクチャタッチイベントの呼び出し待機中に戦闘に突入すると、戦闘画面表示後に実行されてしまう問題を修正 // 1.10.2 2017/10/21 戦闘画面に突入する際のエフェクトで、マウスオーバーイベントが予期せず発生する場合がある問題を修正 // 1.10.1 2017/05/27 動的文字列ピクチャプラグインのウィンドウフレームクリックをピクチャクリックに対応 // 1.9.3 2017/05/27 競合の可能性のある記述(Objectクラスへのプロパティ追加)をリファクタリング(by liplyさん) // 1.9.2 2017/03/16 1.9.0で戦闘中にコモンイベント実行が正しく動作していなかった問題を修正 // 1.9.1 2017/03/16 透明色を考慮する場合、不透明度が0のピクチャは一切反応しなくなるように仕様変更 // 1.9.0 2017/03/13 戦闘中常にピクチャクリックイベントを実行できる機能を追加 // 1.8.2 2017/02/14 1.8.0の修正により、ピクチャクリック時に変数に値を格納する機能が無効化されていたのを修正 // 1.8.1 2017/02/07 端末依存の記述を削除 // 1.8.0 2017/02/03 ピクチャクリックを任意のボタンにバインドできる機能を追加 // 1.7.0 2017/02/02 マップのズームおよびシェイク中でも正確にピクチャをクリックできるようになりました。 // マウスポインタがピクチャ内にあるかどうかをスクリプトで判定できる機能を追加。 // 1.6.0 2016/12/29 ピクチャクリックでイベントが発生したらマップタッチを無効化するよう仕様修正 // 1.5.1 2016/11/20 1.5.0で混入した不要なコードを削除 // 1.5.0 2016/11/19 ピクチャクリック時にコモンイベントではなくスイッチをONにできる機能を追加 // 1.4.0 2016/08/20 ピクチャごとに透明色を考慮するかどうかを設定できる機能を追加 // プラグインを適用していないセーブデータをロードした場合に発生するエラーを修正 // 1.3.5 2016/04/20 リファクタリングによりピクチャの優先順位が逆転していたのをもとに戻した // 1.3.4 2016/04/08 ピクチャが隣接する状態でマウスオーバーとマウスアウトが正しく機能しない場合がある問題を修正 // 1.3.3 2016/03/19 トリガー条件を満たした場合に以後のタッチ処理を抑制するパラメータを追加 // 1.3.2 2016/02/28 処理の負荷を少し軽減 // 1.3.1 2016/02/21 トリガーにマウスを押したまま移動を追加 // 1.3.0 2016/01/24 ピクチャをなでなでする機能を追加 // トリガーにマウスムーブを追加 // ピクチャが回転しているときに正しく位置を補足できるよう修正 // 1.2.1 2016/01/21 呼び出すコモンイベントの上限を100から1000(DB上の最大値)に修正 // 競合対策(YEP_MessageCore.js) // 1.2.0 2016/01/14 ホイールクリック、ダブルクリックなどトリガーを10種類に拡充 // 1.1.3 2016/01/02 競合対策(TDDP_BindPicturesToMap.js) // 1.1.2 2015/12/20 長押しイベント発生時に1秒間のインターバルを設定するよう仕様変更 // 1.1.1 2015/12/10 ピクチャを消去後にマウスオーバーするとエラーになる現象を修正 // 1.1.0 2015/11/23 コモンイベントを呼び出した対象のピクチャ番号を特定する機能を追加 // 設定で透明色を考慮する機能を追加 // トリガーとして「右クリック」や「長押し」を追加 // 1.0.0 2015/11/14 初版 // ---------------------------------------------------------------------------- // [Blog] : https://triacontane.blogspot.jp/ // [Twitter]: https://twitter.com/triacontane/ // [GitHub] : https://github.com/triacontane/ //============================================================================= /*:ja * @plugindesc ピクチャのボタン化プラグイン * @author トリアコンタン * * @param 透明色を考慮 * @desc クリックされた箇所が透明色だった場合は、クリックを無効にする。 * @default true * @type boolean * * @param ピクチャ番号の変数番号 * @desc ピクチャクリック時にピクチャ番号を格納するゲーム変数の番号。 * @default 0 * @type variable * * @param ポインタX座標の変数番号 * @desc マウスカーソルもしくはタッチした位置のX座標を常に格納するゲーム変数の番号 * @default 0 * @type variable * * @param ポインタY座標の変数番号 * @desc マウスカーソルもしくはタッチした位置のY座標を常に格納するゲーム変数の番号 * @default 0 * @type variable * * @param タッチ操作抑制 * @desc トリガー条件を満たした際にタッチ情報をクリアします。(ON/OFF) * 他のタッチ操作と動作が重複する場合にONにします。 * @default false * @type boolean * * @param 戦闘中常にコモン実行 * @desc 戦闘中にピクチャをクリックしたとき、常にコモンイベントを実行します。(ON/OFF) * @default false * @type boolean * * @param 並列処理として実行 * @desc ピクチャクリックによるコモンイベント実行を並列処理扱いで実行します。 * @default false * @type boolean * * @param 無効スイッチ * @desc 指定した番号のスイッチがONになっている場合、すべてのピクチャタッチが無効になります。 * @default 0 * @type switch * * @help ピクチャをクリックすると、指定したコモンイベントが * 呼び出される、もしくは任意のスイッチをONにするプラグインコマンドを提供します。 * このプラグインを利用すれば、JavaScriptの知識がなくても * 誰でも簡単にクリックやタッチを主体にしたゲームを作れます。 * * 戦闘中でも実行可能ですが、ツクールMVの仕様により限られたタイミングでしか * イベントは実行されません。パラメータ「戦闘中常にコモン実行」を有効にすると * 常にイベントが実行されるようになりますが、 * 一部イベントコマンドは正しく動作しない制約があります。 * * 注意! * 一度関連づけたピクチャとコモンイベントはピクチャを消去しても有効です。 * ピクチャが存在しなければどこをクリックしても反応しませんが、 * 同じ番号で再度、ピクチャの表示を行うと反応するようになります。 * * プラグインコマンド詳細 * イベントコマンド「プラグインコマンド」から実行。 * (引数の間は半角スペースで区切る) * * ピクチャのボタン化 or * P_CALL_CE [ピクチャ番号] [コモンイベントID] [トリガー] [透明色を考慮]: * ピクチャの領域内でトリガー条件を満たした場合に呼び出されるコモンイベントを関連づけます。 *   トリガーは以下の通りです。(省略すると 1 になります) * 1 : クリックした場合 * 2 : 右クリックした場合 * 3 : 長押しした場合 * 4 : マウスをピクチャに重ねた場合 * 5 : マウスをピクチャから放した場合 * 6 : クリックを解放(リリース)した場合 * 7 : クリックした場合(かつ長押しの際の繰り返しを考慮) * 8 : クリックしている間ずっと * 9 : ホイールクリックした場合(PCの場合のみ有効) * 10 : ダブルクリックした場合 * 11 : マウスをピクチャ内で移動した場合 * 12 : マウスを押しつつピクチャ内で移動した場合 * * 透明色を考慮のパラメータ(ON/OFF)を指定するとピクチャごとに透明色を考慮するかを * 設定できます。何も設定しないとプラグインパラメータの設定が適用されます。(従来の仕様) * * 例:P_CALL_CE 1 3 7 ON *  :ピクチャのボタン化 \v[1] \v[2] \v[3] OFF * * ピクチャのスイッチ化 or * P_CALL_SWITCH [ピクチャ番号] [スイッチID] [トリガー] [透明色を考慮] *   ピクチャの領域内でトリガー条件を満たした場合に、任意のスイッチをONにします。 *   トリガーの設定などは、ピクチャのボタン化と同一です。 * * ピクチャのキーバインド or * P_CALL_KEY_BIND [ピクチャ番号] [ボタン名称] [トリガー] [透明色を考慮] *   ピクチャの領域内でトリガー条件を満たした場合に、任意のボタンを押したことにします。 *   ボタン名の設定は以下の通りです。(Windows基準) * ok : Enter,Z * shift : Shift * control : Ctrl,Alt * escape : Esc,X * left : ← * up : ↑ * right : → * down : ↓ * * ピクチャのボタン化解除 or * P_CALL_CE_REMOVE [ピクチャ番号] : * ピクチャとコモンイベントもしくはスイッチの関連づけを解除します。 * 全てのトリガーが削除対象です。 * * 例:P_CALL_CE_REMOVE 1 *  :ピクチャのボタン化解除 \v[1] * * ピクチャのなでなで設定 or * P_STROKE [ピクチャ番号] [変数番号] [透明色を考慮] *   指定したピクチャの上でマウスやタッチを動かすと、 *   速さに応じた値が指定した変数に値が加算されるようになります。 *   この設定はピクチャを差し替えたり、一時的に非表示にしても有効です。 *   10秒でだいたい1000くらいまで溜まります。 * * 例:P_STROKE 1 2 ON *  :ピクチャのなでなで設定 \v[1] \v[2] OFF * * ピクチャのなでなで解除 or * P_STROKE_REMOVE [ピクチャ番号] *   指定したピクチャのなでなで設定を解除します。 * * 例:P_STROKE_REMOVE 1 *  :ピクチャのなでなで解除 \v[1] * * ピクチャのポインタ化 or * P_POINTER [ピクチャ番号] *   指定したピクチャがタッチ座標を自動で追従するようになります。 *   タッチしていないと自動で非表示になります。 * * 例:P_POINTER 1 *  :ピクチャのポインタ化 \v[1] * * ピクチャのポインタ化解除 or * P_POINTER_REMOVE [ピクチャ番号] *   指定したピクチャのポインタ化を解除します。 * * 例:P_POINTER_REMOVE 1 *  :ピクチャのポインタ化解除 \v[1] * * ・スクリプト(上級者向け) * $gameScreen.isPointerInnerPicture([ID]); * * 指定した[ID]のピクチャ内にマウスポインタもしくはタッチ座標が存在する場合に * trueを返します。このスクリプトは[P_CALL_CE]を使用していなくても有効です。 * * 例:$gameScreen.isPointerInnerPicture(5); * * 利用規約: * 作者に無断で改変、再配布が可能で、利用形態(商用、18禁利用等) * についても制限はありません。 * このプラグインはもうあなたのものです。 */ /*: * @plugindesc Clickable picture plugin * @author triacontane * * @param TransparentConsideration * @desc if click position is transparent, click is disabled. * @default true * @type boolean * * @param GameVariablePictureNum * @desc Game variable number that stores the picture number when common event called. * @default 0 * @type variable * * @param GameVariableTouchX * @desc Game variable number that stores touch x position * @default 0 * @type variable * * @param GameVariableTouchY * @desc Game variable number that stores touch y position * @default 0 * @type variable * * @param SuppressTouch * @desc Suppress touch event for others(ON/OFF) * @default false * @type boolean * * @param AlwaysCommonInBattle * @desc Always execute common event in battle(ON/OFF) * @default false * @type boolean * * @param AsParallelCommon * @desc ピクチャクリックによるコモンイベント実行を並列処理扱いで実行します。 * @default false * @type boolean * * @param InvalidSwitchId * @desc 指定した番号のスイッチがONになっている場合、すべてのピクチャタッチが無効になります。 * @default 0 * @type switch * * @help When clicked picture, call common event. * * Plugin Command * * P_CALL_CE [Picture number] [Common event ID] [Trigger] [TransparentConsideration]: * When picture was clicked, assign common event id. *   Trigger are As below(if omit, It is specified to 1) * 1 : Left click * 2 : Right click * 3 : Long click * 4 : Mouse over * 5 : Mouse out * 6 : Mouse release * 7 : Mouse repeat click * 8 : Mouse press * 9 : Wheel click * 10 : Double click * 11 : Mouse move * 12 : Mouse move and press * * P_CALL_CE_REMOVE [Picture number] : * break relation from picture to common event. * * - Script * $gameScreen.isPointerInnerPicture([ID]); * * If mouse pointer inner the picture, return true. * * ex:$gameScreen.isPointerInnerPicture(5); * * This plugin is released under the MIT License. */ (function () { 'use strict'; var pluginName = 'PictureCallCommon'; var getParamOther = function (paramNames) { if (!Array.isArray(paramNames)) paramNames = [paramNames]; for (var i = 0; i < paramNames.length; i++) { var name = PluginManager.parameters(pluginName)[paramNames[i]]; if (name) return name; } return null; }; var getParamBoolean = function (paramNames) { var value = getParamOther(paramNames); return (value || '').toUpperCase() === 'ON' || (value || '').toUpperCase() === 'TRUE'; }; var getParamNumber = function (paramNames, min, max) { var value = getParamOther(paramNames); if (arguments.length < 2) min = -Infinity; if (arguments.length < 3) max = Infinity; return (parseInt(value, 10) || 0).clamp(min, max); }; var getCommandName = function (command) { return (command || '').toUpperCase(); }; var getArgNumber = function (arg, min, max) { if (arguments.length < 2) min = -Infinity; if (arguments.length < 3) max = Infinity; return (parseInt(convertEscapeCharacters(arg), 10) || 0).clamp(min, max); }; var getArgBoolean = function (arg) { return (arg || '').toUpperCase() === 'ON'; }; var convertEscapeCharacters = function (text) { if (text == null) text = ''; var window = SceneManager._scene._windowLayer.children[0]; return window ? window.convertEscapeCharacters(text) : text; }; var iterate = function (that, handler) { Object.keys(that).forEach(function (key, index) { handler.call(that, key, that[key], index); }); }; //============================================================================= // パラメータの取得とバリデーション //============================================================================= var paramGameVariableTouchX = getParamNumber(['GameVariableTouchX', 'ポインタX座標の変数番号'], 0); var paramGameVariableTouchY = getParamNumber(['GameVariableTouchY', 'ポインタY座標の変数番号'], 0); var paramGameVariablePictNum = getParamNumber(['GameVariablePictureNum', 'ピクチャ番号の変数番号'], 0); var paramTransparentConsideration = getParamBoolean(['TransparentConsideration', '透明色を考慮']); var paramSuppressTouch = getParamBoolean(['SuppressTouch', 'タッチ操作抑制']); var paramAlwaysCommonInBattle = getParamBoolean(['AlwaysCommonInBattle', '戦闘中常にコモン実行']); var paramInvalidSwitchId = getParamNumber(['InvalidSwitchId', '無効スイッチ'], 0); var paramAsParallelCommon = getParamBoolean(['AsParallelCommon', '並列処理として実行']); //============================================================================= // Game_Interpreter // プラグインコマンド[P_CALL_CE]などを追加定義します。 //============================================================================= var _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand; Game_Interpreter.prototype.pluginCommand = function (command, args) { _Game_Interpreter_pluginCommand.apply(this, arguments); var pictureId, touchParam, trigger, variableNum, transparent; switch (getCommandName(command)) { case 'P_CALL_CE': case 'ピクチャのボタン化': pictureId = getArgNumber(args[0], 1, $gameScreen.maxPictures()); touchParam = getArgNumber(args[1], 1, $dataCommonEvents.length - 1); trigger = getArgNumber(args[2], 1); transparent = (args.length > 3 ? getArgBoolean(args[3]) : null); $gameScreen.setPictureCallCommon(pictureId, touchParam, trigger, transparent); break; case 'P_CALL_SWITCH': case 'ピクチャのスイッチ化': pictureId = getArgNumber(args[0], 1, $gameScreen.maxPictures()); touchParam = getArgNumber(args[1], 1); trigger = getArgNumber(args[2], 1); transparent = (args.length > 3 ? getArgBoolean(args[3]) : null); $gameScreen.setPictureCallCommon(pictureId, touchParam * -1, trigger, transparent); break; case 'P_CALL_KEY_BIND': case 'ピクチャのキーバインド': pictureId = getArgNumber(args[0], 1, $gameScreen.maxPictures()); touchParam = convertEscapeCharacters(args[1]); trigger = getArgNumber(args[2], 1); transparent = (args.length > 3 ? getArgBoolean(args[3]) : null); $gameScreen.setPictureCallCommon(pictureId, touchParam, trigger, transparent); break; case 'P_CALL_CE_REMOVE': case 'ピクチャのボタン化解除': pictureId = getArgNumber(args[0], 1, $gameScreen.maxPictures()); $gameScreen.setPictureRemoveCommon(pictureId); break; case 'P_STROKE': case 'ピクチャのなでなで設定': pictureId = getArgNumber(args[0], 1, $gameScreen.maxPictures()); variableNum = getArgNumber(args[1], 1, $dataSystem.variables.length - 1); transparent = (args.length > 2 ? getArgBoolean(args[2]) : null); $gameScreen.setPictureStroke(pictureId, variableNum, transparent); break; case 'P_STROKE_REMOVE': case 'ピクチャのなでなで解除': pictureId = getArgNumber(args[0], 1, $gameScreen.maxPictures()); $gameScreen.removePictureStroke(pictureId); break; case 'P_POINTER': case 'ピクチャのポインタ化': pictureId = getArgNumber(args[0], 1, $gameScreen.maxPictures()); $gameScreen.setPicturePointer(pictureId); break; case 'P_POINTER_REMOVE': case 'ピクチャのポインタ化解除': pictureId = getArgNumber(args[0], 1, $gameScreen.maxPictures()); $gameScreen.removePicturePointer(pictureId); break; } }; var _Game_Interpreter_terminate = Game_Interpreter.prototype.terminate; Game_Interpreter.prototype.terminate = function () { _Game_Interpreter_terminate.apply(this, arguments); this._setupFromPicture = false; }; Game_Interpreter.prototype.setupFromPicture = function (eventList, commonId) { this.setup(eventList, null); if (this.setEventInfo) { this.setEventInfo({ eventType: 'common_event', commonEventId: commonId }); } this._setupFromPicture = true; }; Game_Interpreter.prototype.isSetupFromPicture = function () { return this._setupFromPicture; }; //============================================================================= // Game_Temp // 呼び出し予定のコモンイベントIDのフィールドを追加定義します。 //============================================================================= var _Game_Temp_initialize = Game_Temp.prototype.initialize; Game_Temp.prototype.initialize = function () { _Game_Temp_initialize.call(this); this.clearPictureCallInfo(); }; Game_Temp.prototype.clearPictureCallInfo = function () { this._pictureCommonId = 0; this._touchPictureId = 0; }; Game_Temp.prototype.setPictureCallInfo = function (pictureCommonId) { this._pictureCommonId = pictureCommonId; }; Game_Temp.prototype.pictureCommonId = function () { if (!$gameScreen.picture(this._touchPictureId)) { this.clearPictureCallInfo(); } return this._pictureCommonId; }; Game_Temp.prototype.onTouchPicture = function (param, pictureId) { this._touchPictureParam = param; if (this.isTouchPictureSetSwitch()) { $gameSwitches.setValue(param * -1, true); } if (this.isTouchPictureCallCommon()) { if (!paramAsParallelCommon && $gameMap.isEventRunning() && !$gameParty.inBattle()) { this._touchPictureParam = null; return; } this.setPictureCallInfo(param); } if (this.isTouchPictureButtonTrigger()) { Input.bindKeyState(param); } if (paramGameVariablePictNum > 0) { $gameVariables.setValue(paramGameVariablePictNum, pictureId); } this._touchPictureId = pictureId; }; Game_Temp.prototype.isTouchPictureButtonTrigger = function () { return isNaN(this._touchPictureParam); }; Game_Temp.prototype.isTouchPictureSetSwitch = function () { return !isNaN(this._touchPictureParam) && this._touchPictureParam < 0; }; Game_Temp.prototype.isTouchPictureCallCommon = function () { return !isNaN(this._touchPictureParam) && this._touchPictureParam > 0; }; //============================================================================= // Game_System // ロード時にピクチャ関連メンバを初期化します。 //============================================================================= var _Game_System_onAfterLoad = Game_System.prototype.onAfterLoad; Game_System.prototype.onAfterLoad = function () { _Game_System_onAfterLoad.apply(this, arguments); $gameScreen.initPictureArray(); }; //============================================================================= // Game_Map // ピクチャがタッチされたときのコモンイベント呼び出し処理を追加定義します。 //============================================================================= var _Game_Map_setupStartingEvent = Game_Map.prototype.setupStartingEvent; Game_Map.prototype.setupStartingEvent = function () { var result = _Game_Map_setupStartingEvent.call(this); return result || this.setupPictureCommonEvent(); }; var _Game_Map_updateInterpreter = Game_Map.prototype.updateInterpreter; Game_Map.prototype.updateInterpreter = function () { _Game_Map_updateInterpreter.apply(this, arguments); this.setupPictureParallelCommonEvent(); }; Game_Map.prototype.setupPictureParallelCommonEvent = function () { if (!paramAsParallelCommon) { return; } var commonId = $gameTemp.pictureCommonId(); var event = $dataCommonEvents[commonId]; if (event) { if (!this._pictureCommonEvents) { this._pictureCommonEvents = []; } var interpreter = new Game_Interpreter(); interpreter.setupFromPicture(event.list, commonId); this._pictureCommonEvents.push(interpreter); $gameTemp.clearPictureCallInfo(); } }; Game_Map.prototype.setupPictureCommonEvent = function () { if (paramAsParallelCommon) { return false; } var commonId = $gameTemp.pictureCommonId(); var event = $dataCommonEvents[commonId]; var result = false; if (!this.isEventRunning() && event) { this._interpreter.setupFromPicture(event.list, commonId); result = true; } $gameTemp.clearPictureCallInfo(); return result; }; var _Game_Map_updateEvents = Game_Map.prototype.updateEvents; Game_Map.prototype.updateEvents = function () { _Game_Map_updateEvents.apply(this, arguments); if (this._pictureCommonEvents && this._pictureCommonEvents.length > 0) { this.updatePictureCommonEvents(); } }; Game_Map.prototype.updatePictureCommonEvents = function () { this._pictureCommonEvents.forEach(function (event) { event.update(); }); this._pictureCommonEvents = this._pictureCommonEvents.filter(function (event) { return event.isRunning(); }) }; //============================================================================= // Game_Troop // ピクチャがタッチされたときのコモンイベント呼び出し処理を追加定義します。 //============================================================================= Game_Troop.prototype.setupPictureCommonEvent = Game_Map.prototype.setupPictureCommonEvent; Game_Troop.prototype.isExistPictureCommon = function () { return this._interpreter.isSetupFromPicture(); }; //============================================================================= // Game_Screen // ピクチャに対応するコモンイベント呼び出し用のID配列を追加定義します。 //============================================================================= var _Game_Screen_initialize = Game_Screen.prototype.initialize; Game_Screen.prototype.initialize = function () { _Game_Screen_initialize.apply(this, arguments); this.initPictureArray(); }; Game_Screen.prototype.initPictureArray = function () { this._pictureCidArray = this._pictureCidArray || []; this._pictureSidArray = this._pictureSidArray || []; this._picturePidArray = this._picturePidArray || []; this._pictureTransparentArray = this._pictureTransparentArray || []; }; var _Game_Screen_update = Game_Screen.prototype.update; Game_Screen.prototype.update = function () { _Game_Screen_update.apply(this, arguments); this.updatePointer(); }; Game_Screen.prototype.updatePointer = function () { if (paramGameVariableTouchX) $gameVariables._data[paramGameVariableTouchX] = TouchInput.x; if (paramGameVariableTouchY) $gameVariables._data[paramGameVariableTouchY] = TouchInput.y; }; Game_Screen.prototype.setPictureCallCommon = function (pictureId, touchParameter, trigger, transparent) { var realPictureId = this.realPictureId(pictureId); if (this._pictureCidArray[realPictureId] == null) this._pictureCidArray[realPictureId] = []; this._pictureCidArray[realPictureId][trigger] = touchParameter; this._pictureTransparentArray[realPictureId] = transparent; }; Game_Screen.prototype.setPictureRemoveCommon = function (pictureId) { this._pictureCidArray[this.realPictureId(pictureId)] = []; }; Game_Screen.prototype.setPictureStroke = function (pictureId, variableNum, transparent) { var realPictureId = this.realPictureId(pictureId); this._pictureSidArray[realPictureId] = variableNum; this._pictureTransparentArray[realPictureId] = transparent; }; Game_Screen.prototype.removePictureStroke = function (pictureId) { this._pictureSidArray[this.realPictureId(pictureId)] = null; }; Game_Screen.prototype.setPicturePointer = function (pictureId) { this._picturePidArray[this.realPictureId(pictureId)] = true; }; Game_Screen.prototype.removePicturePointer = function (pictureId) { this._picturePidArray[this.realPictureId(pictureId)] = null; }; Game_Screen.prototype.getPictureCid = function (pictureId) { return this._pictureCidArray[this.realPictureId(pictureId)]; }; Game_Screen.prototype.getPictureSid = function (pictureId) { return this._pictureSidArray[this.realPictureId(pictureId)]; }; Game_Screen.prototype.getPicturePid = function (pictureId) { return this._picturePidArray[this.realPictureId(pictureId)]; }; Game_Screen.prototype.getPictureTransparent = function (pictureId) { return this._pictureTransparentArray[this.realPictureId(pictureId)]; }; Game_Screen.prototype.disConvertPositionX = function (x) { return Math.round((x + this.zoomX() - this.shake()) / this.zoomScale()); }; Game_Screen.prototype.disConvertPositionY = function (y) { return Math.round((y + this.zoomY()) / this.zoomScale()); }; Game_Screen.prototype.disConvertPositionY = function (y) { return Math.round((y + this.zoomY()) / this.zoomScale()); }; Game_Screen.prototype.isPointerInnerPicture = function (pictureId) { var picture = SceneManager.getPictureSprite(pictureId); return picture ? picture.isIncludePointer() : false; }; //============================================================================= // SceneManager // ピクチャスプライトを取得します。 //============================================================================= SceneManager.getPictureSprite = function (pictureId) { return this._scene.getPictureSprite(pictureId); }; //============================================================================= // BattleManager // ピクチャコモンを常に実行できるようにします。 //============================================================================= BattleManager.updatePictureCommon = function () { if ($gameTroop.isExistPictureCommon() && paramAlwaysCommonInBattle) { this.updateEventMain(); return true; } return false; }; //============================================================================= // Scene_Base // ピクチャに対する繰り返し処理を追加定義します。 //============================================================================= Scene_Base.prototype.updateTouchPictures = function () { if (paramInvalidSwitchId && $gameSwitches.value(paramInvalidSwitchId)) { return; } this._spriteset.iteratePictures(function (picture) { if (typeof picture.callTouch === 'function') picture.callTouch(); return $gameTemp.pictureCommonId() === 0; }); }; Scene_Base.prototype.getPictureSprite = function (pictureId) { var result = null; this._spriteset.iteratePictures(function (picture) { if (picture.isIdEquals(pictureId)) { result = picture; return false; } return true; }); return result; }; //============================================================================= // Scene_Map // ピクチャのタッチ状態からのコモンイベント呼び出し予約を追加定義します。 //============================================================================= var _Scene_Map_update = Scene_Map.prototype.update; Scene_Map.prototype.update = function () { this.updateTouchPictures(); _Scene_Map_update.apply(this, arguments); }; var _Scene_Map_processMapTouch = Scene_Map.prototype.processMapTouch; Scene_Map.prototype.processMapTouch = function () { _Scene_Map_processMapTouch.apply(this, arguments); if ($gameTemp.isDestinationValid() && $gameTemp.pictureCommonId() > 0) { $gameTemp.clearDestination(); } }; var _Scene_Map_terminate = Scene_Map.prototype.terminate; Scene_Map.prototype.terminate = function () { _Scene_Map_terminate.apply(this, arguments); $gameTemp.clearPictureCallInfo(); }; //============================================================================= // Scene_Battle // ピクチャのタッチ状態からのコモンイベント呼び出し予約を追加定義します。 //============================================================================= var _Scene_Battle_update = Scene_Battle.prototype.update; Scene_Battle.prototype.update = function () { this.updateTouchPictures(); $gameTroop.setupPictureCommonEvent(); _Scene_Battle_update.apply(this, arguments); }; var _Scene_Battle_updateBattleProcess = Scene_Battle.prototype.updateBattleProcess; Scene_Battle.prototype.updateBattleProcess = function () { var result = BattleManager.updatePictureCommon(); if (result) return; _Scene_Battle_updateBattleProcess.apply(this, arguments); }; var _Scene_Battle_terminate = Scene_Battle.prototype.terminate; Scene_Battle.prototype.terminate = function () { _Scene_Battle_terminate.apply(this, arguments); $gameTemp.clearPictureCallInfo(); }; //============================================================================= // Spriteset_Base // ピクチャに対するイテレータを追加定義します。 //============================================================================= Spriteset_Base.prototype.iteratePictures = function (callBackFund) { var containerChildren = this._pictureContainer.children; if (!Array.isArray(containerChildren)) { iterate(this._pictureContainer, function (property) { if (this._pictureContainer[property].hasOwnProperty('children')) { containerChildren = this._pictureContainer[property].children; this._iteratePicturesSub(containerChildren, callBackFund); } }.bind(this)); } else { this._iteratePicturesSub(containerChildren, callBackFund); } }; Spriteset_Base.prototype._iteratePicturesSub = function (containerChildren, callBackFund) { for (var i = containerChildren.length - 1; i >= 0; i--) { if (!callBackFund(containerChildren[i])) { break; } } }; //============================================================================= // Sprite_Picture // ピクチャのタッチ状態からのコモンイベント呼び出し予約を追加定義します。 //============================================================================= var _Sprite_Picture_initialize = Sprite_Picture.prototype.initialize; Sprite_Picture.prototype.initialize = function (pictureId) { _Sprite_Picture_initialize.call(this, pictureId); this._triggerHandler = []; this._triggerHandler[1] = this.isTriggered; this._triggerHandler[2] = this.isCancelled; this._triggerHandler[3] = this.isLongPressed; this._triggerHandler[4] = this.isOnFocus; this._triggerHandler[5] = this.isOutFocus; this._triggerHandler[6] = this.isReleased; this._triggerHandler[7] = this.isRepeated; this._triggerHandler[8] = this.isPressed; this._triggerHandler[9] = this.isWheelTriggered; this._triggerHandler[10] = this.isDoubleTriggered; this._triggerHandler[11] = this.isMoved; this._triggerHandler[12] = this.isMovedAndPressed; this._onMouse = false; this._outMouse = false; this._wasOnMouse = false; }; var _Sprite_update = Sprite_Picture.prototype.update; Sprite_Picture.prototype.update = function () { _Sprite_update.apply(this, arguments); this.updateTouch(); }; Sprite_Picture.prototype.updateTouch = function () { this.updateMouseMove(); this.updateStroke(); this.updatePointer(); }; Sprite_Picture.prototype.updateMouseMove = function () { if (this.isIncludePointer()) { if (!this._wasOnMouse) { this._onMouse = true; this._wasOnMouse = true; } } else if (this._wasOnMouse) { this._outMouse = true; this._wasOnMouse = false; } }; Sprite_Picture.prototype.isIncludePointer = function () { return this.isTouchable() && this.isTouchPosInRect() && !this.isTransparent(); }; Sprite_Picture.prototype.updateStroke = function () { var strokeNum = $gameScreen.getPictureSid(this._pictureId); if (strokeNum > 0 && TouchInput.isPressed() && this.isIncludePointer()) { var value = $gameVariables.value(strokeNum); $gameVariables.setValue(strokeNum, value + TouchInput.pressedDistance); } }; Sprite_Picture.prototype.updatePointer = function () { var strokeNum = $gameScreen.getPicturePid(this._pictureId); if (strokeNum > 0) { this.opacity = TouchInput.isPressed() ? 255 : 0; this.x = TouchInput.x; this.y = TouchInput.y; this.anchor.x = 0.5; this.anchor.y = 0.5; } }; Sprite_Picture.prototype.callTouch = function () { var commandIds = $gameScreen.getPictureCid(this._pictureId); if (!commandIds || SceneManager.isNextScene(Scene_Battle)) { return; } for (var i = 0, n = this._triggerHandler.length; i < n; i++) { var handler = this._triggerHandler[i]; if (handler && commandIds[i] && handler.call(this) && (this.triggerIsFocus(i) || !this.isTransparent())) { this.fireTouchEvent(commandIds, i); } } }; Sprite_Picture.prototype.fireTouchEvent = function (commandIds, i) { if (paramSuppressTouch) TouchInput.suppressEvents(); if (this.triggerIsLongPressed(i)) TouchInput._pressedTime = -60; if (this.triggerIsOnFocus(i)) this._onMouse = false; if (this.triggerIsOutFocus(i)) this._outMouse = false; $gameTemp.onTouchPicture(commandIds[i], this._pictureId); }; Sprite_Picture.prototype.triggerIsLongPressed = function (triggerId) { return triggerId === 3; }; Sprite_Picture.prototype.triggerIsOnFocus = function (triggerId) { return triggerId === 4; }; Sprite_Picture.prototype.triggerIsOutFocus = function (triggerId) { return triggerId === 5; }; Sprite_Picture.prototype.triggerIsFocus = function (triggerId) { return this.triggerIsOnFocus(triggerId) || this.triggerIsOutFocus(triggerId); }; Sprite_Picture.prototype.isTransparent = function () { if (this.isTouchPosInFrameWindow()) return false; if (!this.isValidTransparent()) return false; if (this.opacity === 0) return true; var dx = this.getTouchScreenX() - this.x; var dy = this.getTouchScreenY() - this.y; var sin = Math.sin(-this.rotation); var cos = Math.cos(-this.rotation); var bx = Math.floor(dx * cos + dy * -sin) / this.scale.x + this.anchor.x * this.width; var by = Math.floor(dx * sin + dy * cos) / this.scale.y + this.anchor.y * this.height; return this.bitmap.getAlphaPixel(bx, by) === 0; }; Sprite_Picture.prototype.isValidTransparent = function () { var transparent = $gameScreen.getPictureTransparent(this._pictureId); return transparent !== null ? transparent : paramTransparentConsideration; }; Sprite_Picture.prototype.screenWidth = function () { return (this.width || 0) * this.scale.x; }; Sprite_Picture.prototype.screenHeight = function () { return (this.height || 0) * this.scale.y; }; Sprite_Picture.prototype.screenX = function () { return (this.x || 0) - this.anchor.x * this.screenWidth(); }; Sprite_Picture.prototype.screenY = function () { return (this.y || 0) - this.anchor.y * this.screenHeight(); }; Sprite_Picture.prototype.minX = function () { return Math.min(this.screenX(), this.screenX() + this.screenWidth()); }; Sprite_Picture.prototype.minY = function () { return Math.min(this.screenY(), this.screenY() + this.screenHeight()); }; Sprite_Picture.prototype.maxX = function () { return Math.max(this.screenX(), this.screenX() + this.screenWidth()); }; Sprite_Picture.prototype.maxY = function () { return Math.max(this.screenY(), this.screenY() + this.screenHeight()); }; Sprite_Picture.prototype.isTouchPosInRect = function () { if (this.isTouchPosInFrameWindow()) return true; var dx = this.getTouchScreenX() - this.x; var dy = this.getTouchScreenY() - this.y; var sin = Math.sin(-this.rotation); var cos = Math.cos(-this.rotation); var rx = this.x + Math.floor(dx * cos + dy * -sin); var ry = this.y + Math.floor(dx * sin + dy * cos); return (rx >= this.minX() && rx <= this.maxX() && ry >= this.minY() && ry <= this.maxY()); }; Sprite_Picture.prototype.isTouchPosInFrameWindow = function () { if (!this._frameWindow) return false; var frame = this._frameWindow; var x = this.getTouchScreenX(); var y = this.getTouchScreenY(); return frame.x <= x && frame.x + frame.width >= x && frame.y <= y && frame.y + frame.height >= y; }; Sprite_Picture.prototype.isTouchable = function () { return this.bitmap && this.visible && this.scale.x !== 0 && this.scale.y !== 0; }; Sprite_Picture.prototype.isTriggered = function () { return this.isTouchEvent(TouchInput.isTriggered); }; Sprite_Picture.prototype.isCancelled = function () { return this.isTouchEvent(TouchInput.isCancelled); }; Sprite_Picture.prototype.isLongPressed = function () { return this.isTouchEvent(TouchInput.isLongPressed); }; Sprite_Picture.prototype.isPressed = function () { return this.isTouchEvent(TouchInput.isPressed); }; Sprite_Picture.prototype.isReleased = function () { return this.isTouchEvent(TouchInput.isReleased); }; Sprite_Picture.prototype.isRepeated = function () { return this.isTouchEvent(TouchInput.isRepeated); }; Sprite_Picture.prototype.isOnFocus = function () { return this._onMouse; }; Sprite_Picture.prototype.isOutFocus = function () { return this._outMouse; }; Sprite_Picture.prototype.isMoved = function () { return this.isTouchEvent(TouchInput.isMoved); }; Sprite_Picture.prototype.isMovedAndPressed = function () { return this.isTouchEvent(TouchInput.isMoved) && TouchInput.isPressed(); }; Sprite_Picture.prototype.isWheelTriggered = function () { return this.isTouchEvent(TouchInput.isWheelTriggered); }; Sprite_Picture.prototype.isDoubleTriggered = function () { return this.isTouchEvent(TouchInput.isDoubleTriggered); }; Sprite_Picture.prototype.isTouchEvent = function (triggerFunc) { return this.isTouchable() && triggerFunc.call(TouchInput) && this.isTouchPosInRect(); }; Sprite_Picture.prototype.getTouchScreenX = function () { return $gameScreen.disConvertPositionX(TouchInput.x); }; Sprite_Picture.prototype.getTouchScreenY = function () { return $gameScreen.disConvertPositionY(TouchInput.y); }; Sprite_Picture.prototype.isIdEquals = function (pictureId) { return this._pictureId === pictureId; }; //============================================================================= // Input // ピクチャクリックをキー入力に紐付けます。 //============================================================================= Input._bindKeyStateFrames = new Map(); Input.bindKeyState = function (name) { this._currentState[name] = true; this._bindKeyStateFrames.set(name, 5); }; var _Input_update = Input.update; Input.update = function () { _Input_update.apply(this, arguments); this._updateBindKeyState(); }; Input._updateBindKeyState = function () { this._bindKeyStateFrames.forEach(function (frame, keyName) { frame--; if (frame === 0 || !this._currentState[keyName]) { this._currentState[keyName] = false; this._bindKeyStateFrames.delete(keyName); } else { this._bindKeyStateFrames.set(keyName, frame); } }, this); }; //============================================================================= // TouchInput // ホイールクリック、ダブルクリック等を実装 //============================================================================= TouchInput.keyDoubleClickInterval = 300; TouchInput._pressedDistance = 0; TouchInput._prevX = -1; TouchInput._prevY = -1; Object.defineProperty(TouchInput, 'pressedDistance', { get: function () { return this._pressedDistance; }, configurable: true }); TouchInput.suppressEvents = function () { this._triggered = false; this._cancelled = false; this._released = false; this._wheelTriggered = false; this._doubleTriggered = false; }; TouchInput._onMouseMove = function (event) { var x = Graphics.pageToCanvasX(event.pageX); var y = Graphics.pageToCanvasY(event.pageY); this._onMove(x, y); }; var _TouchInput_clear = TouchInput.clear; TouchInput.clear = function () { _TouchInput_clear.apply(this, arguments); this._events.wheelTriggered = false; this._events.doubleTriggered = false; }; var _TouchInput_update = TouchInput.update; TouchInput.update = function () { _TouchInput_update.apply(this, arguments); this._wheelTriggered = this._events.wheelTriggered; this._doubleTriggered = this._events.doubleTriggered; this._events.wheelTriggered = false; this._events.doubleTriggered = false; }; TouchInput.isWheelTriggered = function () { return this._wheelTriggered; }; TouchInput.isDoubleTriggered = function () { return this._doubleTriggered; }; var _TouchInput_onMiddleButtonDown = TouchInput._onMiddleButtonDown; TouchInput._onMiddleButtonDown = function (event) { _TouchInput_onMiddleButtonDown.apply(this, arguments); var x = Graphics.pageToCanvasX(event.pageX); var y = Graphics.pageToCanvasY(event.pageY); if (Graphics.isInsideCanvas(x, y)) { this._onWheelTrigger(x, y); } }; TouchInput._onWheelTrigger = function (x, y) { this._events.wheelTriggered = true; this._x = x; this._y = y; }; var _TouchInput_onTrigger = TouchInput._onTrigger; TouchInput._onTrigger = function (x, y) { if (this._date && Date.now() - this._date < this.keyDoubleClickInterval) this._events.doubleTriggered = true; this._pressedDistance = 0; this._prevX = x; this._prevY = y; _TouchInput_onTrigger.apply(this, arguments); }; var _TouchInput_onMove = TouchInput._onMove; TouchInput._onMove = function (x, y) { if (this.isPressed()) this._pressedDistance = Math.abs(this._prevX - x) + Math.abs(this._prevY - y); this._prevX = x; this._prevY = y; _TouchInput_onMove.apply(this, arguments); }; var _TouchInput_onRelease = TouchInput._onRelease; TouchInput._onRelease = function (x, y) { this._pressedDistance = 0; this._prevX = x; this._prevY = y; _TouchInput_onRelease.apply(this, arguments); }; })();
dazed/translations
www/js/plugins/PictureCallCommon.js
JavaScript
unknown
50,823
//============================================================================ // PictureLoop.js //============================================================================ /*: * @plugindesc ピクチャをランダム間隔で表示させます * @author riru * * @param Pictureloop Count1 * @desc まばたき用ベース間隔。 * @default 60 * * @param Pictureloop Count2 * @desc まばたき用ランダム間隔。ベース間隔+この数値までのランダムで出た間隔でまばたきします * @default 100 * * @help * * まばたきプラグイン ver 1.02 * * <使い方> * イベントコマンド「スクリプト」で以下のように記述してください * LoopPicture(ピクチャ番号,閉じかけ目ピクチャネーム,閉じ目ピクチャネーム, * 原点, x, y, X拡大率, Y拡大率, 不透明度, 合成方法); * * ピクチャ番号…イベントコマンド「ピクチャの表示」の番号と同じです。 * 数字が多いほど上に表示されます。通常のピクチャと共有なので、 * 同時に表示させたいピクチャと番号が被らないようにしてください * 原点…〃表示位置と同じです。0で左上、1で中心が原点になります。 * 拡大率…100で原寸です。-をつけると反転します。 * 不透明度…0~255で設定できます。数字が低いほど透明になります。 * 合成方法…ピクチャの表示の合成方法と同じです。 * 0で通常、1で加算、2で乗算になります * ※数字の場所は * * 例: * LoopPicture(1,"actor1tojikake","actortoji", 0, 10, 80, -100, 100, 255, 0); * ピクチャ名が長い場合は代入してもOKです * name = "actor1tojikake"; * name2 = "actor1tojikake"; * x = $gameVariables.value(5); * y = $gameVariables.value(6); * LoopPicture(7,name,name2, 0, x, y, 100, 100, 255, 0); * * 瞬きをとめる場合は同じくイベントコマンドスクリプトで以下を記入 * EraseLoopPicture(瞬きしているピクチャ番号); * 例:EraseLoopPicture(7); * <規約> * 有償無償問わず使用できます。改変もご自由にどうぞ。使用報告もいりません。 * 2次配布は作成者を偽らなければOKです * (ただし素材単品を有償でやりとりするのはNG)。 * 著作権は放棄していません。 * 使用する場合は以下の作者とURLをreadmeなどどこかに記載してください * * <作者情報> * 作者:riru * HP:ガラス細工の夢幻 * URL:http://garasuzaikunomugen.web.fc2.com/index.html * * <更新情報> * 2015/11/21 1.00公開。 * 2015/12/23 1.01。バトル中では反映されない不具合を修正。 * 2019/6/3 1.02。まばたきを止める時に条件によってどのピクチャ番号を入れても * 止まってしまう不具合を修正。 */ var parameters = PluginManager.parameters('PictureLoop'); var PictureloopCount1 = Number(parameters['Pictureloop Count1'] || 60); var PictureloopCount2 = Number(parameters['Pictureloop Count2'] || 100); function LoopPicture(layer, name, name2, origin, x, y, scaleX, scaleY, opacity, blendMode) { $gameScreen.CreateLoopPictureCount(layer); $gameScreen.CreateLoopPicture(layer, name, name2, origin, x, y, scaleX, scaleY, opacity, blendMode); }; LoopPictures = new Array(100); LoopPictureCount_rand = new Array(100); LoopPicture_v = 0;//現在瞬きしている数 //まばたき用ピクチャの消去 function EraseLoopPicture(layer) { if (typeof !LoopPictures[layer] == null) LoopPicture_v -= 1; LoopPictureCount[layer] = null; LoopPictures[layer] = null; var realPictureId = $gameScreen.realPictureId(layer); if ($gameScreen._pictures[realPictureId] != null) $gameScreen.erasePicture(layer); }; //ループピクチャの情報作成 Game_Screen.prototype.CreateLoopPicture = function (layer, name, name2, origin, x, y, scaleX, scaleY, opacity, blendMode) { LoopPictures[layer] = [layer, name, name2, origin, x, y, scaleX, scaleY, opacity, blendMode]; LoopPicture_v += 1; LoopPictureCount_rand[layer] = []; LoopPictureCount_rand[layer] = (Math.floor((Math.random() * PictureloopCount2 + 1) + PictureloopCount1));//瞬きの間隔を作成 }; var picture_loop_flug = false;//まばたきしているか? //ループピクチャの情報作成 var LoopPictureCount = [];//new Array(); Game_Screen.prototype.CreateLoopPictureCount = function (layer) { LoopPictureCount[layer] = 0; picture_loop_flug = true;//まばたきしているか? }; //まばたき用ピクチャループ Game_Screen.prototype.LoopPicture = function (layer, name, name2, origin, x, y, scaleX, scaleY, opacity, blendMode) { switch (LoopPictureCount[layer]) { case LoopPictureCount_rand[layer]: //閉じかけ目表示 // alert(layer); $gameScreen.showPicture(layer, name, origin, x, y, scaleX, scaleY, opacity, blendMode); break; case LoopPictureCount_rand[layer] + 10: //閉じかけ目表示 $gameScreen.showPicture(layer, name, origin, x, y, scaleX, scaleY, opacity, blendMode); break; case LoopPictureCount_rand[layer] + 5: //閉じ目表示 $gameScreen.showPicture(layer, name2, origin, x, y, scaleX, scaleY, opacity, blendMode); break; case LoopPictureCount_rand[layer] + 15: $gameScreen.erasePicture(layer); LoopPictureCount[layer] = 0; LoopPictureCount_rand[layer] = Math.floor((Math.random() * PictureloopCount2 + 1) + PictureloopCount1);//瞬きの間隔を作成 break; default: break; } }; //フレーム更新 var RiruPictureloop_Update = Game_Screen.prototype.update; Game_Screen.prototype.update = function (sceneActive) { RiruPictureloop_Update.call(this, sceneActive); this.updateLooppicture();//riru追加 }; //まばたき更新 Game_Screen.prototype.updateLooppicture = function () { if (picture_loop_flug == true) { var j = 0; for (i = 1; i < 101; i++) { if (j == LoopPicture_v) break; if (LoopPictures[i] != null) { var layer = LoopPictures[i]; if (LoopPictureCount[LoopPictures[i][0]] != null) { LoopPictureCount[LoopPictures[i][0]] += 1; this.LoopPicture(layer[0], layer[1], layer[2], layer[3], layer[4], layer[5], layer[6], layer[7], layer[8], layer[9], layer[10]); } } } } };
dazed/translations
www/js/plugins/PictureLoop.js
JavaScript
unknown
6,561
//============================================================================= // PictureVariableSetting.js // ---------------------------------------------------------------------------- // (C) 2015 Triacontane // This software is released under the MIT License. // http://opensource.org/licenses/mit-license.php // ---------------------------------------------------------------------------- // Version // 1.5.2 2019/06/02 P_OUT_OF_SCREEN_SHAKE_ON設定時、シェイクの強さ次第で僅かに揺れていた問題を修正 // 1.5.1 2019/05/02 P_OUT_OF_SCREEN_SHAKE_ONのヘルプを追記 // 1.5.0 2016/08/06 ピクチャを画面のシェイクと連動しないようにするコマンドを追加 // 1.4.0 2016/06/23 ピクチャをシェイクさせるコマンドを追加 // 1.3.0 2016/04/29 ピクチャを指定した角度まで回転させるコマンドを追加 // 1.2.1 2016/04/14 処理を適用するピクチャを範囲指定もしくは複数指定する機能を追加 // 1.2.0 2016/03/19 表示中のすべてのピクチャに処理を適用するコマンドを追加 // 1.1.2 2016/01/24 ピクチャの最大表示数を設定できる機能を追加 // 1.1.1 2015/12/20 番号の変数指定の初期値を有効/無効で設定できるよう修正 // 1.1.0 2015/11/27 ピクチャのファイル名に変数を組み込むことが出来る機能を追加 // 1.0.0 2015/11/24 初版 // ---------------------------------------------------------------------------- // [Blog] : https://triacontane.blogspot.jp/ // [Twitter]: https://twitter.com/triacontane/ // [GitHub] : https://github.com/triacontane/ //============================================================================= /*: * @plugindesc ピクチャ関連のイベント機能拡張プラグイン * @author トリアコンタン * * @param 初期値 * @desc 初期状態での有効/無効の設定値(ON/OFF) * @default OFF * * @param ピクチャ表示最大数 * @desc ピクチャ表示最大数(デフォルト100個)を設定します。 * 変えない場合は何も入力しないでください。 * @default * * @help ピクチャ関連のイベント命令の機能を拡張します。 * プラグインコマンドから機能を有効にしてください。 * * 1.ピクチャ関連のイベント命令で番号が「指定された変数の値」になるよう * 仕様を変更します。 * 例えば番号に「1」を設定すると「1」番の変数の値をピクチャ番号として設定します。 * プラグインコマンドから「P_VARIABLE_VALID」「P_VARIABLE_INVALID」で * 有効/無効を切り替えてください。(初期状態では無効です) * * 2.ピクチャのファイル名に変数を組み込むことが出来るようになります。 * 連番を含むファイル名などの柔軟な指定に有効です。 * プラグインコマンド「P_D_FILENAME」を実行してから * 「画像」を指定せず「ピクチャの表示」を行ってください。 * * 要注意! ピクチャのファイル名を動的指定した場合、デプロイメント時に * 未使用ファイルとして除外される可能性があります。 * その場合、削除されたファイルを入れ直す等の対応が必要です。 * * 3.以下のイベントコマンドの対象が「複数のピクチャ」になります。 *   詳細は各プラグインコマンドの説明を確認してください。 * ・ピクチャの移動 * ・ピクチャの色調変更 * ・ピクチャの回転 * ・ピクチャの消去 * * プラグインコマンド詳細 * イベントコマンド「プラグインコマンド」から実行。 * (引数の間は半角スペースで区切る) * * P_VARIABLE_VALID : ピクチャ番号の変数設定が有効になります。 * P_VARIABLE_INVALID : ピクチャ番号の変数設定が無効になります。 * ※ 一度有効に設定したら、無効にするまでずっとそのままです。 * 例 P_VARIABLE_VALID * * P_D_FILENAME [ファイル名] * 次に表示するピクチャのファイル名に変数を含めることができます。 * 変数は「文章の表示」と同様の書式\V[n]で組み込んでください。 * 拡張子は指定しないでください。 * 例 P_D_FILENAME file\V[1] * * P_TARGET_ALL * ピクチャ関連のイベントコマンドの対象を * 「表示している全てのピクチャ」に変更します。 * 1回実行すると設定はもとに戻ります。 * 例 P_TARGET_ALL * * P_TARGET_RANGE [開始番号] [終了番号] * ピクチャ関連のイベントコマンドの対象を * 「開始番号から終了番号までのピクチャ」に変更します。 * 1回実行すると設定はもとに戻ります。 * 例 P_TARGET_RANGE 3 5 // 3番から5番までの表示しているピクチャが対象 * * P_TARGET_MULTI [ピクチャ番号] * ピクチャ関連のイベントコマンドの対象を * 「指定したすべてのピクチャ」に変更します。カンマで区切ってください。 * 1回実行すると設定はもとに戻ります。 * 例 P_TARGET_MULTI 3,5,6,\v[1] // 3番、5番、6番、変数「1」番のピクチャが対象 * * P_SPIN [ピクチャ番号] [角度] [時間(フレーム)] [完了までウェイト] * 対象のピクチャを指定した角度(degree)まで回転させます。正の値が時計回りです。 * 時間を0にすると即座に指定した角度に設定されます。 * このコマンドには「P_TARGET_ALL」等が適用されます。 * 一番後ろに「WAIT」と付けると、回転が完了するまでウェイトします。 * 例 P_SPIN 1 90 60 WAIT * -> ピクチャ番号「1」を60フレーム掛けて90度回転させる。 * * P_SPIN_RELATIVE [ピクチャ番号] [角度] [時間(フレーム)] [完了までウェイト] * 対象のピクチャを現在の角度を基準に、指定した角度のぶんだけ回転させます。 * それ以外は「P_SPIN」と同様です。 * 例 P_SPIN_RELATIVE \v[1] -90 0 * -> 変数「1」の値のピクチャを、現在の角度から-90度まで即座に回転させる。 * * P_SHAKE [ピクチャ番号] [強さ] [速さ] [角度] [時間(フレーム)] [完了までウェイト] * 対象のピクチャをシェイクさせます。強さと速さはイベント「画面のシェイク」と * 同様の9段階の数値で指定します。角度(degree)はシェイク方向を0から360までの * 値で指定します。(90で縦方向にシェイクします) * 時間を指定しないと、停止するまでシェイクし続けます。 * 一番後ろに「WAIT」と付けると、回転が完了するまでウェイトします。 * このコマンドには「P_TARGET_ALL」等が適用されます。 * 例 P_SHAKE 1 3 9 0 60 WAIT * -> ピクチャ番号「1」を60フレームのあいだ、強さ3、速さ9で横方向にシェイクします。 * * P_STOP_SHAKE [ピクチャ番号] * 対象のピクチャをシェイクを止めます。P_SHAKEで時間を指定しないと * ずっとシェイクし続けるので当コマンドで無効にします。 * このコマンドには「P_TARGET_ALL」等が適用されます。 * 例 P_STOP_SHAKE \v[1] * -> 変数「1」の値のピクチャのシェイクを止めます。 * * P_OUT_OF_SCREEN_SHAKE_ON [ピクチャ番号] * 対象のピクチャが画面のシェイクと連動しないようになります。 * メッセージウィンドウ等と同じ扱いになります。 * このコマンドはピクチャの表示後に実行する必要があります。 * また、このコマンド実行後に同一番号でピクチャを再表示すると無効になります。 * * 例 P_OUT_OF_SCREEN_SHAKE_ON 1 * -> ピクチャ番号「1」が画面のシェイクと連動しないようになります。 * * P_OUT_OF_SCREEN_SHAKE_OFF [ピクチャ番号] * 対象のピクチャが画面のシェイクと再度、連動するようになります。 * 例 P_OUT_OF_SCREEN_SHAKE_OFF 1 * -> ピクチャ番号「1」が画面のシェイクと再度、連動するようになります。 * * 利用規約: * 作者に無断で改変、再配布が可能で、利用形態(商用、18禁利用等) * についても制限はありません。 * このプラグインはもうあなたのものです。 */ (function () { 'use strict'; var pluginName = 'PictureVariableSetting'; //============================================================================= // ローカル関数 // プラグインパラメータやプラグインコマンドパラメータの整形やチェックをします //============================================================================= var getParamBoolean = function (paramNames) { var value = getParamOther(paramNames); return (value || '').toUpperCase() === 'ON'; }; var getParamNumber = function (paramNames, min, max) { var value = getParamOther(paramNames); if (arguments.length < 2) min = -Infinity; if (arguments.length < 3) max = Infinity; return (parseInt(value, 10) || 0).clamp(min, max); }; var getParamOther = function (paramNames) { if (!Array.isArray(paramNames)) paramNames = [paramNames]; for (var i = 0; i < paramNames.length; i++) { var name = PluginManager.parameters(pluginName)[paramNames[i]]; if (name) return name; } return null; }; var getCommandName = function (command) { return (command || '').toUpperCase(); }; var getArgString = function (arg, upperFlg) { arg = convertEscapeCharactersAndEval(arg, false); return upperFlg ? arg.toUpperCase() : arg; }; var getArgNumber = function (arg, min, max) { if (arguments.length < 2) min = -Infinity; if (arguments.length < 3) max = Infinity; return (parseInt(convertEscapeCharactersAndEval(arg, true), 10) || 0).clamp(min, max); }; var getArgArrayString = function (args, upperFlg) { var values = getArgString(args, upperFlg).split(','); for (var i = 0; i < values.length; i++) values[i] = values[i].trim(); return values; }; var getArgArrayNumber = function (args, min, max) { var values = getArgArrayString(args, false); if (arguments.length < 2) min = -Infinity; if (arguments.length < 3) max = Infinity; for (var i = 0; i < values.length; i++) values[i] = (parseInt(values[i], 10) || 0).clamp(min, max); return values; }; var convertEscapeCharactersAndEval = function (text, evalFlg) { if (text === null || text === undefined) text = ''; var window = SceneManager._scene._windowLayer.children[0]; if (window) { var result = window.convertEscapeCharacters(text); return evalFlg ? eval(result) : result; } else { return text; } }; //============================================================================= // Game_Interpreter // プラグインコマンド[P_VARIABLE_VALID]などを追加定義します。 // ピクチャ番号を変数で指定するよう変更します。 //============================================================================= var _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand; Game_Interpreter.prototype.pluginCommand = function (command, args) { _Game_Interpreter_pluginCommand.call(this, command, args); switch (getCommandName(command)) { case 'P_VARIABLE_VALID': $gameSystem.pictureNumVariable = true; break; case 'P_VARIABLE_INVALID': $gameSystem.pictureNumVariable = false; break; case 'P_D_FILENAME': $gameScreen.dPictureFileName = getArgString(args[0]); break; case 'P_TARGET_ALL': $gameScreen.setPictureTargetAll(); break; case 'P_TARGET_RANGE': $gameScreen.setPictureTargetRange(getArgNumber(args[0], 1), getArgNumber(args[1], 1)); break; case 'P_TARGET_MULTI': $gameScreen.setPictureTargetMulti(getArgArrayNumber(args[0], 1)); break; case 'P_SPIN': var spinDuration = getArgNumber(args[2], 0); $gameScreen.spinPicture(getArgNumber(args[0], 1), getArgNumber(args[1]), spinDuration); if (args[3]) this.wait(spinDuration); break; case 'P_SPIN_RELATIVE': var spinRelativeDuration = getArgNumber(args[2], 0); $gameScreen.spinPictureRelative(getArgNumber(args[0], 1), getArgNumber(args[1]), spinRelativeDuration); if (args[3]) this.wait(spinRelativeDuration); break; case 'P_SHAKE': var shakeDuration = getArgNumber(args[4], 0) || Infinity; var power = getArgNumber(args[1], 1, 9); var speed = getArgNumber(args[2], 1, 9); var rotation = getArgNumber(args[3], 0, 360); $gameScreen.shakePicture(getArgNumber(args[0], 1), power, speed, rotation, shakeDuration); if (args[5] && shakeDuration !== Infinity) this.wait(shakeDuration); break; case 'P_STOP_SHAKE': $gameScreen.shakePicture(getArgNumber(args[0], 1), 0, 0, 0, 0); break; case 'P_OUT_OF_SCREEN_SHAKE_ON': $gameScreen.setOutOfScreenShakePicture(getArgNumber(args[0], 1), true); break; case 'P_OUT_OF_SCREEN_SHAKE_OFF': $gameScreen.setOutOfScreenShakePicture(getArgNumber(args[0], 1), false); break; } }; var _Game_Interpreter_command231 = Game_Interpreter.prototype.command231; Game_Interpreter.prototype.command231 = function () { return this.transPictureNumber(_Game_Interpreter_command231.bind(this)); }; var _Game_Interpreter_command232 = Game_Interpreter.prototype.command232; Game_Interpreter.prototype.command232 = function () { return this.transPictureNumber(_Game_Interpreter_command232.bind(this)); }; var _Game_Interpreter_command233 = Game_Interpreter.prototype.command233; Game_Interpreter.prototype.command233 = function () { return this.transPictureNumber(_Game_Interpreter_command233.bind(this)); }; var _Game_Interpreter_command234 = Game_Interpreter.prototype.command234; Game_Interpreter.prototype.command234 = function () { return this.transPictureNumber(_Game_Interpreter_command234.bind(this)); }; var _Game_Interpreter_command235 = Game_Interpreter.prototype.command235; Game_Interpreter.prototype.command235 = function () { return this.transPictureNumber(_Game_Interpreter_command235.bind(this)); }; Game_Interpreter.prototype.transPictureNumber = function (handler) { var result; if ($gameSystem.pictureNumVariable) { var oldValue = this._params[0]; this._params[0] = $gameVariables.value(this._params[0]).clamp(1, $gameScreen.maxPictures()); result = handler(); this._params[0] = oldValue; } else { result = handler(); } return result; }; //============================================================================= // Game_System // ピクチャ番号の変数指定フラグを追加定義します。 //============================================================================= var _Game_System_initialize = Game_System.prototype.initialize; Game_System.prototype.initialize = function () { _Game_System_initialize.call(this); this.pictureNumVariable = getParamBoolean('初期値'); }; //============================================================================= // Game_Screen // 動的ファイル名指定用のプロパティを追加定義します。 //============================================================================= var _Game_Screen_clear = Game_Screen.prototype.clear; Game_Screen.prototype.clear = function () { _Game_Screen_clear.call(this); this.dPictureFileName = null; this._pictureTargetStart = null; this._pictureTargetEnd = null; this._pictureTargetNumbers = null; }; Game_Screen.prototype.setPictureTargetAll = function () { this._pictureTargetAll = 1; }; Game_Screen.prototype.setPictureTargetRange = function (start, end) { this._pictureTargetAll = 2; this._pictureTargetStart = start; this._pictureTargetEnd = end; }; Game_Screen.prototype.setPictureTargetMulti = function (args) { this._pictureTargetAll = 3; this._pictureTargetNumbers = args; }; var _Game_Screen_movePicture = Game_Screen.prototype.movePicture; Game_Screen.prototype.movePicture = function (pictureId, origin, x, y, scaleX, scaleY, opacity, blendMode, duration) { if (this._pictureTargetAll > 0) { this.iteratePictures(function (picture) { picture.move(origin, x, y, scaleX, scaleY, opacity, blendMode, duration); }.bind(this)); this._pictureTargetAll = 0; } else { _Game_Screen_movePicture.apply(this, arguments); } }; var _Game_Screen_rotatePicture = Game_Screen.prototype.rotatePicture; Game_Screen.prototype.rotatePicture = function (pictureId, speed) { if (this._pictureTargetAll > 0) { this.iteratePictures(function (picture) { picture.rotate(speed); }.bind(this)); this._pictureTargetAll = 0; } else { _Game_Screen_rotatePicture.apply(this, arguments); } }; var _Game_Screen_tintPicture = Game_Screen.prototype.tintPicture; Game_Screen.prototype.tintPicture = function (pictureId, tone, duration) { if (this._pictureTargetAll > 0) { this.iteratePictures(function (picture) { picture.tint(tone, duration); }.bind(this)); this._pictureTargetAll = 0; } else { _Game_Screen_tintPicture.apply(this, arguments); } }; var _Game_Screen_erasePicture = Game_Screen.prototype.erasePicture; Game_Screen.prototype.erasePicture = function (pictureId) { if (this._pictureTargetAll) { this.iteratePictures(function (picture, pictureId) { var realPictureId = this.realPictureId(pictureId); this._pictures[realPictureId] = null; }.bind(this)); this._pictureTargetAll = 0; } else { _Game_Screen_erasePicture.apply(this, arguments); } }; Game_Screen.prototype.spinPicture = function (pictureId, rotation, duration) { if (this._pictureTargetAll > 0) { this.iteratePictures(function (picture) { picture.spin(rotation, duration); }.bind(this)); this._pictureTargetAll = 0; } else { var picture = this.picture(pictureId); if (picture) { picture.spin(rotation, duration); } } }; Game_Screen.prototype.spinPictureRelative = function (pictureId, relativeRotation, duration) { if (this._pictureTargetAll > 0) { this.iteratePictures(function (picture) { picture.spinRelative(relativeRotation, duration); }.bind(this)); this._pictureTargetAll = 0; } else { var picture = this.picture(pictureId); if (picture) { picture.spinRelative(relativeRotation, duration); } } }; Game_Screen.prototype.shakePicture = function (pictureId, power, speed, rotation, duration) { if (this._pictureTargetAll > 0) { this.iteratePictures(function (picture) { picture.shake(power, speed, rotation, duration); }.bind(this)); this._pictureTargetAll = 0; } else { var picture = this.picture(pictureId); if (picture) { picture.shake(power, speed, rotation, duration); } } }; Game_Screen.prototype.setOutOfScreenShakePicture = function (pictureId, value) { if (this._pictureTargetAll > 0) { this.iteratePictures(function (picture) { picture.setOutOfScreenShake(value); }.bind(this)); this._pictureTargetAll = 0; } else { var picture = this.picture(pictureId); if (picture) { picture.setOutOfScreenShake(value); } } }; Game_Screen.prototype.iteratePictures = function (callBack) { for (var i = 1, n = this.maxPictures(); i <= n; i++) { var picture = this.picture(i); if (picture && this.isTargetPicture(i)) { callBack.call(this, picture, i); } } }; Game_Screen.prototype.isTargetPicture = function (number) { switch (this._pictureTargetAll) { case 2: return this._pictureTargetStart <= number && this._pictureTargetEnd >= number; case 3: return this._pictureTargetNumbers.contains(number); default: return true; } }; var _Game_Screen_maxPictures = Game_Screen.prototype.maxPictures; Game_Screen.prototype.maxPictures = function () { var max = getParamNumber('ピクチャ表示最大数', 0); return max > 0 ? max : _Game_Screen_maxPictures.apply(this, arguments); }; //============================================================================= // Game_Picture // ファイル名の動的生成処理を追加定義します。 //============================================================================= var _Game_Picture_show = Game_Picture.prototype.show; Game_Picture.prototype.show = function (name, origin, x, y, scaleX, scaleY, opacity, blendMode) { if ($gameScreen.dPictureFileName != null) { arguments[0] = $gameScreen.dPictureFileName; $gameScreen.dPictureFileName = null; } _Game_Picture_show.apply(this, arguments); }; var _Game_Picture_x = Game_Picture.prototype.x; Game_Picture.prototype.x = function () { return _Game_Picture_x.apply(this, arguments) + this.getShakeX() - (this._outOfScreenShake ? Math.round($gameScreen.shake()) : 0); }; var _Game_Picture_y = Game_Picture.prototype.y; Game_Picture.prototype.y = function () { return _Game_Picture_y.apply(this, arguments) + this.getShakeY(); }; Game_Picture.prototype.setOutOfScreenShake = function (value) { this._outOfScreenShake = !!value; }; Game_Picture.prototype.spin = function (targetRotation, duration) { this._targetRotation = targetRotation; this._angle = (this._angle % 360); if (duration === 0) { this._angle = this._targetRotation; } else { this._spinDuration = duration; } }; Game_Picture.prototype.spinRelative = function (targetRelativeRotation, duration) { this._angle = (this._angle % 360); this.spin(this._angle + targetRelativeRotation, duration); }; Game_Picture.prototype.shake = function (power, speed, rotation, duration) { this.stopShake(); this._shakePower = power; this._shakeSpeed = speed; this._shakeDuration = duration; this._shakeRotation = rotation * Math.PI / 180; }; Game_Picture.prototype.stopShake = function () { this._shakeDirection = 1; this._shake = 0; }; var _Game_Picture_update = Game_Picture.prototype.update; Game_Picture.prototype.update = function () { _Game_Picture_update.apply(this, arguments); this.updateSpin(); this.updateShake(); }; Game_Picture.prototype.updateSpin = function () { if (this._spinDuration > 0) { var d = this._spinDuration; this._angle = (this._angle * (d - 1) + this._targetRotation) / d; this._spinDuration--; } }; Game_Picture.prototype.updateShake = function () { if (this._shakeDuration > 0) { var delta = (this._shakePower * this._shakeSpeed * this._shakeDirection) / 10; if (this._shakeDuration <= 1 && this._shake * (this._shake + delta) < 0) { this._shake = 0; } else { this._shake += delta; } if (this._shake > this._shakePower * 2) { this._shakeDirection = -1; } if (this._shake < -this._shakePower * 2) { this._shakeDirection = 1; } this._shakeDuration--; } }; Game_Picture.prototype.getShakeX = function () { return this._shake ? this._shake * Math.cos(this._shakeRotation) : 0; }; Game_Picture.prototype.getShakeY = function () { return this._shake ? this._shake * Math.sin(this._shakeRotation) : 0; }; })();
dazed/translations
www/js/plugins/PictureVariableSetting.js
JavaScript
unknown
25,821
// // ポップアップメッセージ ver1.02 // // ------------------------------------------------------ // Copyright (c) 2016 Yana // Released under the MIT license // http://opensource.org/licenses/mit-license.php // ------------------------------------------------------ // // author Yana // var Imported = Imported || {}; Imported['PopupMessage'] = 1.02; if (!Imported.CommonPopupCore) { console.error('CommonPopupCoreを導入してください。') } /*: * @plugindesc ver1.02/メッセージの表示をポップアップに変更する制御文字_pum[delay,x,y,action]を追加します。 * @author Yana * * @param Pop Message FontSize * @desc ポップアップメッセージのデフォルトフォントサイズです。 * @default 28 * * @param Pop Message Count * @desc ポップアップメッセージの表示時間です。 * @default 120 * * @param Popup Pattern * @desc ポップアップパターンの初期設定です。 * @default Down * * @help プラグインコマンドはありません。 * * メッセージの表示のメッセージの中に_pum[delay,x,y,action,pattern]と記述することで、 * メッセージをポップアップに変更します。 * delayはディレイ値で、この値フレーム分待ってから、ポップアップを行います。 * xは表示位置のX座標です。未指定の場合は、0が設定されます。 * yは表示位置のY座標です。未指定の場合は、画面高さ-ポップアップの高さが設定されます。 * actionはアクション形式です。1を指定すると、上から下にアクションします。 * patternは動作パターンです。Normalで今まで通り、GrowUpでにょき、Stretchでうにょーんとなります。 * ------------------------------------------------------ * 利用規約 * ------------------------------------------------------ * 当プラグインはMITライセンスで公開されています。 * 使用に制限はありません。商用、アダルト、いずれにも使用できます。 * 二次配布も制限はしませんが、サポートは行いません。 * 著作表示は任意です。行わなくても利用できます。 * 要するに、特に規約はありません。 * バグ報告や使用方法等のお問合せはネ実ツクールスレ、または、Twitterにお願いします。 * https://twitter.com/yanatsuki_ * 素材利用は自己責任でお願いします。 * ------------------------------------------------------ * このプラグインには「汎用ポップアップベース」のプラグインが必要です。 * 汎用ポップアップベースより下に配置してください。 * ------------------------------------------------------ * 更新履歴: * ver1.03: * 各パラメータに制御文字が使用できるように変更。 * ポップアップパターンのプラグインパラメータを追加。 * ver1.02: * 動作パターンの設定を追加。 * ver1.01: * 表示位置を調整する機能を追加。 * ver1.00: * 公開 */ (function () { 'use strict'; var parameters = PluginManager.parameters('PopupMessage'); var popMesFontSize = Number(parameters['Pop Message FontSize'] || 28); var popMesCount = Number(parameters['Pop Message Count'] || 120); var popMesSlide = Number(parameters['Pop Message Slide'] || 60); var popupPattern = parameters['Popup Pattern'] || 0; var popMesRegExp = /_PUM\[(.+)\]/gi; var _pMes_GInterpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand; Game_Interpreter.prototype.pluginCommand = function (command, args) { _pMes_GInterpreter_pluginCommand.call(this, command, args); if (command === 'PopupMessage') { } }; var _pMes_GInterpreter_c101 = Game_Interpreter.prototype.command101; Game_Interpreter.prototype.command101 = function () { var texts = []; var pIndex = this._index; var param = { 'delay': null }; while (this.nextEventCode() === 401) { this._index++; texts.push(this.currentCommand().parameters[0]); } var window = CommonPopupManager.window(); for (var i = 0; i < texts.length; i++) { if (texts[i].match(popMesRegExp)) { var ary = [0, null, null, 0, popupPattern]; var text = texts[i].replace(popMesRegExp, function () { var arg = arguments[1].split(','); ary[0] = Number(window.convertEscapeCharacters(arg[0])); if (arg[1]) ary[1] = Number(window.convertEscapeCharacters(arg[1])); if (arg[2]) ary[2] = Number(window.convertEscapeCharacters(arg[2])); if (arg[3]) ary[3] = Number(window.convertEscapeCharacters(arg[3])); if (arg[4]) ary[4] = arg[4]; return ''; }.bind(this)); texts[i] = text; CommonPopupManager.setPopupMessage(this._params, texts, ary); return true; } } this._index = pIndex; var result = _pMes_GInterpreter_c101.call(this); return result; }; var _pMes_GMessage_add = Game_Message.prototype.add; Game_Message.prototype.add = function (text) { text = text.replace(popMesRegExp, ''); _pMes_GMessage_add.call(this, text); }; CommonPopupManager.setPopupMessage = function (params, texts, ary) { this._readyPopup = this._readyPopup || []; var bitmap = ImageManager.loadFace(params[0]); this.bltCheck(bitmap); this._readyPopup.push([params, texts, ary, 'pMessage']); }; var _pMes_CPManager_makeBitmap = CommonPopupManager.makeBitmap; CommonPopupManager.makeBitmap = function (arg) { if (arg[3] === 'pMessage') { return ImageManager.loadFace(arg[0][0]); } else { return _pMes_CPManager_makeBitmap.call(this, arg); } }; var _pMes_CPManager_startPopup = CommonPopupManager.startPopup; CommonPopupManager.startPopup = function (arg) { if (arg[3] === 'pMessage') { this.startPopupMessage(arg[0], arg[1], arg[2]); } else { _pMes_CPManager_startPopup.call(this, arg); } }; CommonPopupManager.startPopupMessage = function (params, texts, arg) { var fontSize = popMesFontSize; var oneHeight = (fontSize + 8); var height = params[0] ? 144 : oneHeight * texts.length; var bitmap = new Bitmap(Graphics.boxWidth, height); var faceSize = params[0] === '' ? 0 : 144; var delay = arg[0]; var x = arg[1]; var y = arg[2]; var action = arg[3]; var pattern = arg[4]; bitmap.fillRect(0, 0, bitmap.width / 2, bitmap.height, 'rgba(0,0,0,0.5)'); bitmap.gradientFillRect(bitmap.width / 2, 0, bitmap.width / 2, bitmap.height, 'rgba(0,0,0,0.5)', 'rgba(0,0,0,0)'); this.window().contents = bitmap; this.window().drawTextEx('\\FS[' + fontSize + ']', 0, 0); this.window().drawFace(params[0], params[1], 0, 0); var iFontSize = fontSize; for (var i = 0; i < texts.length; i++) { var text = '\\FS[' + iFontSize + ']' + texts[i]; this.window().drawTextEx(text, 8 + faceSize, i * oneHeight); iFontSize = this.window().contents.fontSize; } var arg = this.setPopup([]); arg.bitmap = bitmap; if (pattern === 'GrowUp') { arg.x = 0; arg.y = Graphics.boxHeight; arg.moveX = 0; arg.anchorX = 0; arg.anchorY = 1.0; arg.pattern = -2; } else if (pattern === 'Stretch') { arg.x = 0; arg.y = Graphics.boxHeight - height; arg.moveX = 0; arg.anchorX = 0; arg.anchorY = 0; arg.pattern = -1; } else { arg.x = Graphics.boxWidth * -1; arg.y = Graphics.boxHeight - height; arg.moveX = Graphics.boxWidth; arg.anchorX = 0; arg.anchorY = 0; } if (x) { arg.x += x } if (y) { arg.y = y } if ($gameParty.inBattle()) { arg.y = Math.min(Graphics.boxHeight - 180, arg.y) } arg.moveY = 0; arg.count = popMesCount; arg.fixed = false; arg.slideCount = popMesSlide; if (action === 1) { arg.slideAction = 'Down' } arg.delay = delay; this._tempCommonSprites.setNullPos(arg); } })();
dazed/translations
www/js/plugins/PopupMessage.js
JavaScript
unknown
8,656
//============================================================================= // RecollectionMode.js // Copyright (c) 2015 rinne_grid // This plugin is released under the MIT license. // http://opensource.org/licenses/mit-license.php // // Version // 1.0.0 2015/12/26 公開 // 1.1.0 2016/04/19 回想一覧にサムネイルを指定できるように対応 // 1.1.1 2016/05/03 セーブデータ20番目のスイッチが反映されない不具合を修正 // セーブデータ間のスイッチ共有オプション // (share_recollection_switches)を追加 // 1.1.2 2016/05/09 回想用のCGリストのキーを数字から文字列に変更 // 1.1.3 2016/11/23 セーブデータが増えた場合にロード時間が長くなる問題を解消 // 1.1.4 2016/12/23 CG閲覧時にクリック・タップで画像送りができるよう対応 // 1.1.5 2017/01/26 CG・シーンで一部サムネイルが表示されない問題を解消 //============================================================================= /*:ja * @plugindesc 回想モード機能を追加します。 * @author rinne_grid * * * @help このプラグインには、プラグインコマンドはありません。 * */ //----------------------------------------------------------------------------- // ◆ プラグイン設定 //----------------------------------------------------------------------------- var rngd_recollection_mode_settings = { //--------------------------------------------------------------------- // ★ 回想モードで再生するBGMの設定をします //--------------------------------------------------------------------- "rec_mode_bgm": { "bgm": { "name": "M06_Bathhouse ", "pan": 0, "pitch": 100, "volume": 90 } }, //--------------------------------------------------------------------- // ★ 回想CG選択ウィンドウの設定を指定します //--------------------------------------------------------------------- "rec_mode_window": { "x": 260, "y": 180, "recollection_title": "回想モード", "str_select_recollection": "回想を見る", "str_select_cg": "CGを見る", "str_select_back_title": "タイトルに戻る" }, //--------------------------------------------------------------------- // ★ 回想リストウィンドウの設定を指定します //--------------------------------------------------------------------- "rec_list_window": { // 1画面に表示する縦の数 "item_height": 4, // 1画面に表示する横の数 "item_width": 4, // 1枚のCGに説明テキストを表示するかどうか "show_title_text": true, // タイトルテキストの表示位置(left:左寄せ、center:中央、right:右寄せ) "title_text_align": "center", // 閲覧したことのないCGの場合に表示するピクチャファイル名 "never_watch_picture_name": "回想/never_watch_picture", // 閲覧したことのないCGのタイトルテキスト "never_watch_title_text": "???" }, //--------------------------------------------------------------------- // ★ 回想用のCGを指定します //--------------------------------------------------------------------- "rec_cg_set": { "1": { "title": "第一部ゴブリン敗北", "pictures": ["回想/a", "回想/b"], "common_event_id": 1201, "switch_id": 1301, "thumbnail": "回想/第一部ゴブリン" }, "2": { "title": "第一部オーク敗北", "pictures": ["回想/a", "回想/b"], "common_event_id": 1202, "switch_id": 1302, "thumbnail": "回想/第一部オーク" }, "3": { "title": "第一部チンピラ敗北", "pictures": ["回想/a", "回想/b"], "common_event_id": 1203, "switch_id": 1303, "thumbnail": "回想/第一部チンピラ" }, "4": { "title": "エリカ輪姦", "pictures": ["回想/a", "回想/b"], "common_event_id": 1204, "switch_id": 1304, "thumbnail": "回想/エリカ輪姦" }, "5": { "title": "ドッヂ敗北", "pictures": ["回想/a", "回想/b"], "common_event_id": 1205, "switch_id": 1305, "thumbnail": "回想/ドッヂ敗北" }, "6": { "title": "相続薬取引敗北", "pictures": ["回想/a", "回想/b"], "common_event_id": 1206, "switch_id": 1306, "thumbnail": "回想/相続薬取引敗北" }, "7": { "title": "通り魔ジョン敗北", "pictures": ["回想/a", "回想/b"], "common_event_id": 1207, "switch_id": 1307, "thumbnail": "回想/通り魔ジョン敗北" }, "8": { "title": "ゴブリン敗北凌辱", "pictures": ["回想/a", "回想/b"], "common_event_id": 1208, "switch_id": 1308, "thumbnail": "回想/ゴブリン敗北凌辱" }, "9": { "title": "マリルーと凌辱", "pictures": ["回想/a", "回想/b"], "common_event_id": 1209, "switch_id": 1309, "thumbnail": "回想/マリルーと凌辱" }, "10": { "title": "ゴブリン苗床レイプ", "pictures": ["回想/a", "回想/b"], "common_event_id": 1210, "switch_id": 1310, "thumbnail": "回想/ゴブリン苗床レイプ" }, "11": { "title": "ゴブリン苗床出産", "pictures": ["回想/a", "回想/b"], "common_event_id": 1211, "switch_id": 1311, "thumbnail": "回想/ゴブリン苗床出産" }, "12": { "title": "浴場強姦1", "pictures": ["回想/a", "回想/b"], "common_event_id": 1212, "switch_id": 1312, "thumbnail": "回想/浴場強姦1" }, "13": { "title": "浴場強姦2", "pictures": ["回想/a", "回想/b"], "common_event_id": 1213, "switch_id": 1313, "thumbnail": "回想/浴場強姦2" }, "14": { "title": "浴場売春1", "pictures": ["回想/a", "回想/b"], "common_event_id": 1214, "switch_id": 1314, "thumbnail": "回想/浴場売春1" }, "15": { "title": "浴場売春2", "pictures": ["回想/a", "回想/b"], "common_event_id": 1215, "switch_id": 1315, "thumbnail": "回想/浴場売春2" }, "16": { "title": "浴場売春3", "pictures": ["回想/a", "回想/b"], "common_event_id": 1216, "switch_id": 1316, "thumbnail": "回想/浴場売春3" }, "17": { "title": "トイレスタリオン", "pictures": ["回想/a", "回想/b"], "common_event_id": 1217, "switch_id": 1317, "thumbnail": "回想/トイレスタリオン" }, "18": { "title": "ギー敗北", "pictures": ["回想/a", "回想/b"], "common_event_id": 1218, "switch_id": 1318, "thumbnail": "回想/ギー敗北" }, "19": { "title": "ロドリグ診察", "pictures": ["回想/a", "回想/b"], "common_event_id": 1219, "switch_id": 1319, "thumbnail": "回想/ロドリグ診察" }, "20": { "title": "ロドリグと出産", "pictures": ["回想/a", "回想/b"], "common_event_id": 1220, "switch_id": 1320, "thumbnail": "回想/ロドリグと出産" }, "21": { "title": "睡眠アナル姦", "pictures": ["回想/a", "回想/b"], "common_event_id": 1221, "switch_id": 1321, "thumbnail": "回想/睡眠アナル姦" }, "22": { "title": "娼館で初売春", "pictures": ["回想/a", "回想/b"], "common_event_id": 1222, "switch_id": 1322, "thumbnail": "回想/娼館で初売春" }, "23": { "title": "媚薬漬けの夜", "pictures": ["回想/a", "回想/b"], "common_event_id": 1223, "switch_id": 1323, "thumbnail": "回想/媚薬漬けの夜" }, "24": { "title": "ロドリグのマッサージ", "pictures": ["回想/a", "回想/b"], "common_event_id": 1224, "switch_id": 1324, "thumbnail": "回想/ロドリグのマッサージ" }, "25": { "title": "ディーコンの調教1", "pictures": ["回想/a", "回想/b"], "common_event_id": 1225, "switch_id": 1325, "thumbnail": "回想/ディーコンの調教1" }, "26": { "title": "ディーコンの調教2", "pictures": ["回想/a", "回想/b"], "common_event_id": 1226, "switch_id": 1326, "thumbnail": "回想/ディーコンの調教2" }, "27": { "title": "ディーコンの調教3", "pictures": ["回想/a", "回想/b"], "common_event_id": 1227, "switch_id": 1327, "thumbnail": "回想/ディーコンの調教3" }, "28": { "title": "ディーコンの調教4", "pictures": ["回想/a", "回想/b"], "common_event_id": 1228, "switch_id": 1328, "thumbnail": "回想/ディーコンの調教4" }, "29": { "title": "ディーコンの調教5", "pictures": ["回想/a", "回想/b"], "common_event_id": 1229, "switch_id": 1329, "thumbnail": "回想/ディーコンの調教5" }, "30": { "title": "ディーコンの調教6", "pictures": ["回想/a", "回想/b"], "common_event_id": 1230, "switch_id": 1330, "thumbnail": "回想/ディーコンの調教6" }, "31": { "title": "ディーコンの調教7", "pictures": ["回想/a", "回想/b"], "common_event_id": 1231, "switch_id": 1331, "thumbnail": "回想/ディーコンの調教7" }, "32": { "title": "宿で出産", "pictures": ["回想/a", "回想/b"], "common_event_id": 1232, "switch_id": 1332, "thumbnail": "回想/宿で出産" }, "33": { "title": "モンスターと近親相姦", "pictures": ["回想/a", "回想/b"], "common_event_id": 1233, "switch_id": 1333, "thumbnail": "回想/モンスターと近親相姦" }, "34": { "title": "スラムチンピラレイプ", "pictures": ["回想/a", "回想/b"], "common_event_id": 1234, "switch_id": 1334, "thumbnail": "回想/スラムチンピラレイプ" }, "35": { "title": "浮浪者敗北1", "pictures": ["回想/a", "回想/b"], "common_event_id": 1235, "switch_id": 1335, "thumbnail": "回想/浮浪者敗北1" }, "36": { "title": "浮浪者敗北2", "pictures": ["回想/a", "回想/b"], "common_event_id": 1236, "switch_id": 1336, "thumbnail": "回想/浮浪者敗北2" }, "37": { "title": "浮浪者敗北3", "pictures": ["回想/a", "回想/b"], "common_event_id": 1237, "switch_id": 1337, "thumbnail": "回想/浮浪者敗北3" }, "38": { "title": "浮浪者敗北4", "pictures": ["回想/a", "回想/b"], "common_event_id": 1238, "switch_id": 1338, "thumbnail": "回想/浮浪者敗北4" }, "39": { "title": "ごろつき敗北レイプ", "pictures": ["回想/a", "回想/b"], "common_event_id": 1239, "switch_id": 1339, "thumbnail": "回想/ごろつき敗北レイプ" }, "40": { "title": "ごろつき監禁レイプ", "pictures": ["回想/a", "回想/b"], "common_event_id": 1240, "switch_id": 1340, "thumbnail": "回想/ごろつき監禁レイプ" }, "41": { "title": "ごろつき監禁出産", "pictures": ["回想/a", "回想/b"], "common_event_id": 1241, "switch_id": 1341, "thumbnail": "回想/ごろつき監禁出産" }, "42": { "title": "ワーグ敗北レイプ", "pictures": ["回想/a", "回想/b"], "common_event_id": 1242, "switch_id": 1342, "thumbnail": "回想/ワーグ敗北レイプ" }, "43": { "title": "ワーグ苗床レイプ", "pictures": ["回想/a", "回想/b"], "common_event_id": 1243, "switch_id": 1343, "thumbnail": "回想/ワーグ苗床レイプ" }, "44": { "title": "ワーグ野外公開レイプ", "pictures": ["回想/a", "回想/b"], "common_event_id": 1244, "switch_id": 1344, "thumbnail": "回想/ワーグ野外公開レイプ" }, "45": { "title": "ワーグ苗床出産", "pictures": ["回想/a", "回想/b"], "common_event_id": 1245, "switch_id": 1345, "thumbnail": "回想/ワーグ苗床出産" }, "46": { "title": "ピッグマン敗北", "pictures": ["回想/a", "回想/b"], "common_event_id": 1246, "switch_id": 1346, "thumbnail": "回想/ピッグマン敗北" }, "47": { "title": "ピッグマン苗床出産", "pictures": ["回想/a", "回想/b"], "common_event_id": 1247, "switch_id": 1347, "thumbnail": "回想/ピッグマン苗床出産" }, "48": { "title": "バーダン敗北レイプ", "pictures": ["回想/a", "回想/b"], "common_event_id": 1248, "switch_id": 1348, "thumbnail": "回想/バーダン敗北レイプ" }, "49": { "title": "バーダンと対面座位", "pictures": ["回想/a", "回想/b"], "common_event_id": 1249, "switch_id": 1349, "thumbnail": "回想/バーダンと対面座位" }, "50": { "title": "ティムの脳破壊", "pictures": ["回想/a", "回想/b"], "common_event_id": 1250, "switch_id": 1350, "thumbnail": "回想/ティムの脳破壊" }, "51": { "title": "バーダンに奉仕", "pictures": ["回想/a", "回想/b"], "common_event_id": 1251, "switch_id": 1351, "thumbnail": "回想/バーダンに奉仕" }, "52": { "title": "バーダンと正常位", "pictures": ["回想/a", "回想/b"], "common_event_id": 1252, "switch_id": 1352, "thumbnail": "回想/バーダンと正常位" }, "53": { "title": "バーダンと子供と", "pictures": ["回想/a", "回想/b"], "common_event_id": 1253, "switch_id": 1353, "thumbnail": "回想/バーダンと子供と" }, "54": { "title": "バーダンとシシリア", "pictures": ["回想/a", "回想/b"], "common_event_id": 1254, "switch_id": 1354, "thumbnail": "回想/バーダンとシシリア" }, "55": { "title": "カトリーヌと出産", "pictures": ["回想/a", "回想/b"], "common_event_id": 1255, "switch_id": 1355, "thumbnail": "回想/カトリーヌと出産" }, "56": { "title": "カトリーヌ敗北レイプ", "pictures": ["回想/a", "回想/b"], "common_event_id": 1256, "switch_id": 1356, "thumbnail": "回想/カトリーヌ敗北レイプ" }, "57": { "title": "オーク敗北レイプ", "pictures": ["回想/a", "回想/b"], "common_event_id": 1257, "switch_id": 1357, "thumbnail": "回想/オーク敗北レイプ" }, "58": { "title": "オーク公開レイプ", "pictures": ["回想/a", "回想/b"], "common_event_id": 1258, "switch_id": 1358, "thumbnail": "回想/オーク公開レイプ" }, "59": { "title": "オークバッドエンド", "pictures": ["回想/a", "回想/b"], "common_event_id": 1259, "switch_id": 1359, "thumbnail": "回想/オークバッドエンド" }, "60": { "title": "スライム敗北", "pictures": ["回想/a", "回想/b"], "common_event_id": 1260, "switch_id": 1360, "thumbnail": "回想/スライム敗北" }, "61": { "title": "スライム排泄凌辱", "pictures": ["回想/a", "回想/b"], "common_event_id": 1261, "switch_id": 1361, "thumbnail": "回想/スライム排泄凌辱" }, "62": { "title": "ビッグスライム敗北1", "pictures": ["回想/a", "回想/b"], "common_event_id": 1262, "switch_id": 1362, "thumbnail": "回想/ビッグスライム敗北1" }, "63": { "title": "ビッグスライム敗北2", "pictures": ["回想/a", "回想/b"], "common_event_id": 1263, "switch_id": 1363, "thumbnail": "回想/ビッグスライム敗北2" }, "64": { "title": "ローパー敗北", "pictures": ["回想/a", "回想/b"], "common_event_id": 1264, "switch_id": 1364, "thumbnail": "回想/ローパー敗北" }, "65": { "title": "ローパーの苗床レイプ", "pictures": ["回想/a", "回想/b"], "common_event_id": 1265, "switch_id": 1365, "thumbnail": "回想/ローパーの苗床レイプ" }, "66": { "title": "ローパーの苗床出産", "pictures": ["回想/a", "回想/b"], "common_event_id": 1266, "switch_id": 1366, "thumbnail": "回想/ローパーの苗床出産" }, "67": { "title": "ローパーバッドエンド", "pictures": ["回想/a", "回想/b"], "common_event_id": 1267, "switch_id": 1367, "thumbnail": "回想/ローパーバッドエンド" }, "68": { "title": "魔物スタリオン敗北1", "pictures": ["回想/a", "回想/b"], "common_event_id": 1268, "switch_id": 1368, "thumbnail": "回想/魔物スタリオン敗北1" }, "69": { "title": "魔物スタリオン敗北2", "pictures": ["回想/a", "回想/b"], "common_event_id": 1269, "switch_id": 1369, "thumbnail": "回想/魔物スタリオン敗北2" }, "70": { "title": "ゲクラン催眠1", "pictures": ["回想/a", "回想/b"], "common_event_id": 1270, "switch_id": 1370, "thumbnail": "回想/ゲクラン催眠1" }, "71": { "title": "ゲクラン催眠2", "pictures": ["回想/a", "回想/b"], "common_event_id": 1271, "switch_id": 1371, "thumbnail": "回想/ゲクラン催眠2" }, "72": { "title": "ゲクラン催眠3", "pictures": ["回想/a", "回想/b"], "common_event_id": 1272, "switch_id": 1372, "thumbnail": "回想/ゲクラン催眠3" }, "73": { "title": "ゲクラン催眠4", "pictures": ["回想/a", "回想/b"], "common_event_id": 1273, "switch_id": 1373, "thumbnail": "回想/ゲクラン催眠4" }, "74": { "title": "ゲクラン催眠5", "pictures": ["回想/a", "回想/b"], "common_event_id": 1274, "switch_id": 1374, "thumbnail": "回想/ゲクラン催眠5" }, "75": { "title": "ゲクラン催眠6", "pictures": ["回想/a", "回想/b"], "common_event_id": 1275, "switch_id": 1375, "thumbnail": "回想/ゲクラン催眠6" }, "76": { "title": "ゲクランと出産", "pictures": ["回想/a", "回想/b"], "common_event_id": 1276, "switch_id": 1376, "thumbnail": "回想/ゲクランと出産" }, "77": { "title": "ゲクランバッドエンド", "pictures": ["回想/a", "回想/b"], "common_event_id": 1277, "switch_id": 1377, "thumbnail": "回想/ゲクランバッドエンド" }, "78": { "title": "武器屋でアルバイト1", "pictures": ["回想/a", "回想/b"], "common_event_id": 1278, "switch_id": 1378, "thumbnail": "回想/武器屋でアルバイト1" }, "79": { "title": "武器屋でアルバイト2", "pictures": ["回想/a", "回想/b"], "common_event_id": 1279, "switch_id": 1421, "thumbnail": "回想/武器屋でアルバイト2" }, "80": { "title": "酒場でアルバイト1", "pictures": ["回想/a", "回想/b"], "common_event_id": 1280, "switch_id": 1379, "thumbnail": "回想/酒場でアルバイト1" }, "81": { "title": "酒場でアルバイト2", "pictures": ["回想/a", "回想/b"], "common_event_id": 1281, "switch_id": 1380, "thumbnail": "回想/酒場でアルバイト2" }, "82": { "title": "酒場でアルバイト3", "pictures": ["回想/a", "回想/b"], "common_event_id": 1282, "switch_id": 1381, "thumbnail": "回想/酒場でアルバイト3" }, "83": { "title": "酒場でアルバイト4", "pictures": ["回想/a", "回想/b"], "common_event_id": 1283, "switch_id": 1382, "thumbnail": "回想/酒場でアルバイト4" }, "84": { "title": "酒場でアルバイト5", "pictures": ["回想/a", "回想/b"], "common_event_id": 1284, "switch_id": 1383, "thumbnail": "回想/酒場でアルバイト5" }, "85": { "title": "路上売春", "pictures": ["回想/a", "回想/b"], "common_event_id": 1285, "switch_id": 1384, "thumbnail": "回想/路上売春" }, "86": { "title": "スラム宿屋睡眠姦1", "pictures": ["回想/a", "回想/b"], "common_event_id": 1286, "switch_id": 1385, "thumbnail": "回想/スラム宿屋睡眠姦1" }, "87": { "title": "スラム宿屋睡眠姦2", "pictures": ["回想/a", "回想/b"], "common_event_id": 1287, "switch_id": 1386, "thumbnail": "回想/スラム宿屋睡眠姦2" }, "88": { "title": "壁尻レイプA", "pictures": ["回想/a", "回想/b"], "common_event_id": 1288, "switch_id": 1387, "thumbnail": "回想/壁尻レイプA" }, "89": { "title": "壁尻レイプB", "pictures": ["回想/a", "回想/b"], "common_event_id": 1289, "switch_id": 1388, "thumbnail": "回想/壁尻レイプB" }, "90": { "title": "ガヌロン敗北1", "pictures": ["回想/a", "回想/b"], "common_event_id": 1290, "switch_id": 1389, "thumbnail": "回想/ガヌロン敗北1" }, "91": { "title": "ガヌロン敗北2", "pictures": ["回想/a", "回想/b"], "common_event_id": 1291, "switch_id": 1390, "thumbnail": "回想/ガヌロン敗北2" }, "92": { "title": "ガヌロンの呼出1", "pictures": ["回想/a", "回想/b"], "common_event_id": 1292, "switch_id": 1391, "thumbnail": "回想/ガヌロンの呼出1" }, "93": { "title": "ガヌロンの呼出2", "pictures": ["回想/a", "回想/b"], "common_event_id": 1293, "switch_id": 1392, "thumbnail": "回想/ガヌロンの呼出2" }, "94": { "title": "ガヌロンの呼出3", "pictures": ["回想/a", "回想/b"], "common_event_id": 1294, "switch_id": 1393, "thumbnail": "回想/ガヌロンの呼出3" }, "95": { "title": "ガヌロンの呼出4", "pictures": ["回想/a", "回想/b"], "common_event_id": 1295, "switch_id": 1394, "thumbnail": "回想/ガヌロンの呼出4" }, "96": { "title": "ガヌロンの呼出5", "pictures": ["回想/a", "回想/b"], "common_event_id": 1296, "switch_id": 1395, "thumbnail": "回想/ガヌロンの呼出5" }, "97": { "title": "ボテ重ね", "pictures": ["回想/a", "回想/b"], "common_event_id": 1297, "switch_id": 1396, "thumbnail": "回想/ボテ重ね" }, "98": { "title": "ガヌロンへの懇願", "pictures": ["回想/a", "回想/b"], "common_event_id": 1298, "switch_id": 1421, "thumbnail": "回想/ガヌロンへの懇願" }, "99": { "title": "ガヌロンの子とセックス1", "pictures": ["回想/a", "回想/b"], "common_event_id": 1299, "switch_id": 1397, "thumbnail": "回想/ガヌロンの子とセックス1" }, "100": { "title": "ガヌロンの子とセックス2", "pictures": ["回想/a", "回想/b"], "common_event_id": 1300, "switch_id": 1398, "thumbnail": "回想/ガヌロンの子とセックス2" }, "101": { "title": "ガヌロンの子とセックス3", "pictures": ["回想/a", "回想/b"], "common_event_id": 1301, "switch_id": 1399, "thumbnail": "回想/ガヌロンの子とセックス3" }, "102": { "title": "スラム娼館売春", "pictures": ["回想/a", "回想/b"], "common_event_id": 1302, "switch_id": 1400, "thumbnail": "回想/スラム娼館売春" }, "103": { "title": "スラム娼館耐久ショー", "pictures": ["回想/a", "回想/b"], "common_event_id": 1303, "switch_id": 1401, "thumbnail": "回想/スラム娼館耐久ショー" }, "104": { "title": "スラム娼館で出産", "pictures": ["回想/a", "回想/b"], "common_event_id": 1304, "switch_id": 1402, "thumbnail": "回想/スラム娼館で出産" }, "105": { "title": "ティムとセックス1", "pictures": ["回想/a", "回想/b"], "common_event_id": 1305, "switch_id": 1403, "thumbnail": "回想/ティムとセックス1" }, "106": { "title": "ティムとセックス2", "pictures": ["回想/a", "回想/b"], "common_event_id": 1306, "switch_id": 1404, "thumbnail": "回想/ティムとセックス2" }, "107": { "title": "ティムとセックス3", "pictures": ["回想/a", "回想/b"], "common_event_id": 1307, "switch_id": 1405, "thumbnail": "回想/ティムとセックス3" }, "108": { "title": "異教徒敗北バッドエンド", "pictures": ["回想/a", "回想/b"], "common_event_id": 1308, "switch_id": 1406, "thumbnail": "回想/異教徒敗北バッドエンド" }, "109": { "title": "見せしめ磔", "pictures": ["回想/a", "回想/b"], "common_event_id": 1309, "switch_id": 1407, "thumbnail": "回想/見せしめ磔" }, "110": { "title": "市警隊の気晴らし", "pictures": ["回想/a", "回想/b"], "common_event_id": 1310, "switch_id": 1408, "thumbnail": "回想/市警隊の気晴らし" }, "111": { "title": "市警隊敗北", "pictures": ["回想/a", "回想/b"], "common_event_id": 1311, "switch_id": 1409, "thumbnail": "回想/市警隊敗北" }, "112": { "title": "市警長とセックス", "pictures": ["回想/a", "回想/b"], "common_event_id": 1312, "switch_id": 1410, "thumbnail": "回想/市警長とセックス" }, "113": { "title": "市警隊と橋の上で", "pictures": ["回想/a", "回想/b"], "common_event_id": 1313, "switch_id": 1411, "thumbnail": "回想/市警隊と橋の上で" }, "114": { "title": "監獄輪姦", "pictures": ["回想/a", "回想/b"], "common_event_id": 1314, "switch_id": 1412, "thumbnail": "回想/監獄輪姦" }, "115": { "title": "監獄日常レイプ", "pictures": ["回想/a", "回想/b"], "common_event_id": 1315, "switch_id": 1413, "thumbnail": "回想/監獄日常レイプ" }, "116": { "title": "監獄出産レイプ", "pictures": ["回想/a", "回想/b"], "common_event_id": 1316, "switch_id": 1414, "thumbnail": "回想/監獄出産レイプ" }, "117": { "title": "ニコラと一緒に", "pictures": ["回想/a", "回想/b"], "common_event_id": 1317, "switch_id": 1415, "thumbnail": "回想/ニコラと一緒に" }, "118": { "title": "ニコラと市警隊長", "pictures": ["回想/a", "回想/b"], "common_event_id": 1318, "switch_id": 1416, "thumbnail": "回想/ニコラと市警隊長" }, "119": { "title": "ニコラと出産", "pictures": ["回想/a", "回想/b"], "common_event_id": 1319, "switch_id": 1417, "thumbnail": "回想/ニコラと出産" }, "120": { "title": "門前の辱め", "pictures": ["回想/a", "回想/b"], "common_event_id": 1320, "switch_id": 1423, "thumbnail": "回想/門前の辱め" }, "121": { "title": "オークション", "pictures": ["回想/a", "回想/b"], "common_event_id": 1321, "switch_id": 1418, "thumbnail": "回想/オークション" }, "122": { "title": "第一部バッドエンド", "pictures": ["回想/a", "回想/b"], "common_event_id": 1322, "switch_id": 1419, "thumbnail": "回想/第一部バッドエンド" }, "123": { "title": "第二部バッドエンド", "pictures": ["回想/a", "回想/b"], "common_event_id": 1323, "switch_id": 1420, "thumbnail": "回想/第二部バッドエンド" } }, //--------------------------------------------------------------------- // ★ 回想時に一時的に利用するマップIDを指定します //--------------------------------------------------------------------- // 通常は何もないマップを指定します //--------------------------------------------------------------------- "sandbox_map_id": 50, //--------------------------------------------------------------------- // ★ 回想用スイッチをセーブデータ間で共有するかどうかを指定します //--------------------------------------------------------------------- // パラメータの説明 // true: // 回想用スイッチを共有します。 // // 例1:セーブ1で回想スイッチ1, 2, 3がONとする // ニューゲームで開始し、セーブ1を上書きする // →セーブ1の回想スイッチ1, 2, 3はONのままとなる。 // // 例2: セーブ1で回想スイッチ1, 2, 3がONとする // セーブ1をロードし、セーブ2を保存する // セーブ2で回想スイッチ1, 2, 3, 7がONとする // セーブ1, セーブ2それぞれで、回想スイッチ1, 2, 3, 7がONとなる // // false: // 回想用スイッチを共有しません // // すべてのセーブデータを削除した場合にのみ、スイッチがリセットされます //--------------------------------------------------------------------- "share_recollection_switches": false }; function rngd_hash_size(obj) { var cnt = 0; for (var o in obj) { cnt++; } return cnt; } //----------------------------------------------------------------------------- // ◆ Scene関数 //----------------------------------------------------------------------------- //========================================================================= // ■ Scene_Recollection //========================================================================= // 回想用のシーン関数です //========================================================================= function Scene_Recollection() { this.initialize.apply(this, arguments); } Scene_Recollection.prototype = Object.create(Scene_Base.prototype); Scene_Recollection.prototype.constructor = Scene_Recollection; Scene_Recollection.prototype.initialize = function () { Scene_Base.prototype.initialize.call(this); }; Scene_Recollection.prototype.create = function () { Scene_Base.prototype.create.call(this); this.createWindowLayer(); this.createCommandWindow(); }; // 回想モードのカーソル Scene_Recollection.rec_list_index = 0; // 回想モードの再読み込み判定用 true: コマンドウィンドウを表示せず回想リストを表示 false:コマンドウィンドウを表示 Scene_Recollection.reload_rec_list = false; Scene_Recollection.prototype.createCommandWindow = function () { if (Scene_Recollection.reload_rec_list) { // 回想モード選択ウィンドウ this._rec_window = new Window_RecollectionCommand(); this._rec_window.setHandler('select_recollection', this.commandShowRecollection.bind(this)); this._rec_window.setHandler('select_cg', this.commandShowCg.bind(this)); this._rec_window.setHandler('select_back_title', this.commandBackTitle.bind(this)); // リロードの場合:選択ウィンドウを非表示にする this._rec_window.visible = false; this._rec_window.deactivate(); this.addWindow(this._rec_window); // 回想リスト this._rec_list = new Window_RecList(0, 0, Graphics.width, Graphics.height); // リロードの場合:回想リストを表示にする this._rec_list.visible = true; this._rec_list.setHandler('ok', this.commandDoRecMode.bind(this)); this._rec_list.setHandler('cancel', this.commandBackSelectMode.bind(this)); this._mode = "recollection"; this._rec_list.activate(); this._rec_list.select(Scene_Recollection.rec_list_index); this.addWindow(this._rec_list); // CG参照用ダミーコマンド this._dummy_window = new Window_Command(0, 0); this._dummy_window.deactivate(); this._dummy_window.visible = false; this._dummy_window.setHandler('ok', this.commandDummyOk.bind(this)); this._dummy_window.setHandler('cancel', this.commandDummyCancel.bind(this)); this._dummy_window.addCommand('next', 'ok'); this.addWindow(this._dummy_window); Scene_Recollection.reload_rec_list = false; } else { // 回想モード選択ウィンドウ this._rec_window = new Window_RecollectionCommand(); this._rec_window.setHandler('select_recollection', this.commandShowRecollection.bind(this)); this._rec_window.setHandler('select_cg', this.commandShowCg.bind(this)); this._rec_window.setHandler('select_back_title', this.commandBackTitle.bind(this)); this.addWindow(this._rec_window); // 回想リスト this._rec_list = new Window_RecList(0, 0, Graphics.width, Graphics.height); this._rec_list.visible = false; this._rec_list.setHandler('ok', this.commandDoRecMode.bind(this)); this._rec_list.setHandler('cancel', this.commandBackSelectMode.bind(this)); this._rec_list.select(Scene_Recollection.rec_list_index); this.addWindow(this._rec_list); // CG参照用ダミーコマンド this._dummy_window = new Window_Command(0, 0); this._dummy_window.deactivate(); this._dummy_window.playOkSound = function () { }; // CGモードの場合、OK音を鳴らさない this._dummy_window.visible = false; this._dummy_window.setHandler('ok', this.commandDummyOk.bind(this)); this._dummy_window.setHandler('cancel', this.commandDummyCancel.bind(this)); this._dummy_window.addCommand('next', 'ok'); this.addWindow(this._dummy_window); } }; //------------------------------------------------------------------------- // ● 開始処理 //------------------------------------------------------------------------- Scene_Recollection.prototype.start = function () { Scene_Base.prototype.start.call(this); this._rec_window.refresh(); this._rec_list.refresh(); AudioManager.playBgm(rngd_recollection_mode_settings.rec_mode_bgm.bgm); Scene_Recollection._rngd_recollection_doing = false; }; //------------------------------------------------------------------------- // ● 更新処理 //------------------------------------------------------------------------- Scene_Recollection.prototype.update = function () { Scene_Base.prototype.update.call(this); }; //------------------------------------------------------------------------- // ● 「回想を見る」を選択した際のコマンド //------------------------------------------------------------------------- Scene_Recollection.prototype.commandShowRecollection = function () { // モードウィンドウの無効化とリストウィンドウの有効化 this.do_exchange_status_window(this._rec_window, this._rec_list); this._mode = "recollection"; }; //------------------------------------------------------------------------- // ● 「CGを見る」を選択した際のコマンド //------------------------------------------------------------------------- Scene_Recollection.prototype.commandShowCg = function () { this.do_exchange_status_window(this._rec_window, this._rec_list); this._mode = "cg"; }; //------------------------------------------------------------------------- // ● 「タイトルに戻る」を選択した際のコマンド //------------------------------------------------------------------------- Scene_Recollection.prototype.commandBackTitle = function () { Scene_Recollection.rec_list_index = 0; SceneManager.goto(Scene_Title); }; //------------------------------------------------------------------------- // ● 回想orCGモードから「キャンセル」して前の画面に戻った場合のコマンド //------------------------------------------------------------------------- Scene_Recollection.prototype.commandBackSelectMode = function () { this.do_exchange_status_window(this._rec_list, this._rec_window); }; //------------------------------------------------------------------------- // ● 回想orCGモードにおいて、実際の回想orCGを選択した場合のコマンド //------------------------------------------------------------------------- Scene_Recollection.prototype.commandDoRecMode = function () { var target_index = this._rec_list.index() + 1; Scene_Recollection.rec_list_index = target_index - 1; if (this._rec_list.is_valid_picture(this._rec_list.index() + 1)) { // 回想モードの場合 if (this._mode == "recollection") { Scene_Recollection._rngd_recollection_doing = true; DataManager.setupNewGame(); $gamePlayer.setTransparent(255); this.fadeOutAll(); // TODO: パーティを透明状態にする //$dataSystem.optTransparent = false; $gameTemp.reserveCommonEvent(rngd_recollection_mode_settings.rec_cg_set[target_index]["common_event_id"]); $gamePlayer.reserveTransfer(rngd_recollection_mode_settings.sandbox_map_id, 0, 0, 0); SceneManager.push(Scene_Map); // CGモードの場合 } else if (this._mode == "cg") { this._cg_sprites = []; this._cg_sprites_index = 0; // シーン画像をロードする rngd_recollection_mode_settings.rec_cg_set[target_index].pictures.forEach(function (name) { // CGクリックを可能とする var sp = new Sprite_Button(); sp.setClickHandler(this.commandDummyOk.bind(this)); sp.processTouch = function () { Sprite_Button.prototype.processTouch.call(this); }; sp.bitmap = ImageManager.loadPicture(name); // 最初のSprite以外は見えないようにする if (this._cg_sprites.length > 0) { sp.visible = false; } // TODO: 画面サイズにあわせて、拡大・縮小すべき this._cg_sprites.push(sp); this.addChild(sp); }, this); this.do_exchange_status_window(this._rec_list, this._dummy_window); this._dummy_window.visible = false; } } else { this._rec_list.activate(); } }; Scene_Recollection.prototype.commandDummyOk = function () { if (this._cg_sprites_index < this._cg_sprites.length - 1) { this._cg_sprites[this._cg_sprites_index].visible = false; this._cg_sprites_index++; this._cg_sprites[this._cg_sprites_index].visible = true; SoundManager.playOk(); this._dummy_window.activate(); } else { SoundManager.playOk(); this.commandDummyCancel(); } }; Scene_Recollection.prototype.commandDummyCancel = function () { this._cg_sprites.forEach(function (obj) { obj.visible = false; obj = null; }); this.do_exchange_status_window(this._dummy_window, this._rec_list); }; // コモンイベントから呼び出す関数 Scene_Recollection.prototype.rngd_exit_scene = function () { if (Scene_Recollection._rngd_recollection_doing) { // Window_RecListを表示する Scene_Recollection.reload_rec_list = true; SceneManager.push(Scene_Recollection); } }; //------------------------------------------------------------------------- // ● ウィンドウの無効化と有効化 //------------------------------------------------------------------------- // win1: 無効化するウィンドウ // win2: 有効化するウィンドウ //------------------------------------------------------------------------- Scene_Recollection.prototype.do_exchange_status_window = function (win1, win2) { win1.deactivate(); win1.visible = false; win2.activate(); win2.visible = true; }; //------------------------------------------------------------------------- // ● セーブ・ロード・ニューゲーム時に必要なスイッチをONにする //------------------------------------------------------------------------- Scene_Recollection.setRecollectionSwitches = function () { // 各セーブデータを参照し、RecollectionMode用のスイッチを検索する // スイッチが一つでもONになっている場合は回想をONにする for (var i = 1; i <= DataManager.maxSavefiles(); i++) { var data = null; try { data = StorageManager.loadFromLocalFile(i); } catch (e) { data = StorageManager.loadFromWebStorage(i); } if (data) { var save_data_obj = JsonEx.parse(data); var rec_cg_max = rngd_hash_size(rngd_recollection_mode_settings.rec_cg_set); for (var j = 0; j < rec_cg_max; j++) { var cg = rngd_recollection_mode_settings.rec_cg_set[j + 1]; if (save_data_obj["switches"]._data[cg.switch_id] && save_data_obj["switches"]._data[cg.switch_id] == true) { $gameSwitches.setValue(cg.switch_id, true); } } } } }; //----------------------------------------------------------------------------- // ◆ Window関数 //----------------------------------------------------------------------------- //========================================================================= // ■ Window_RecollectionCommand //========================================================================= // 回想モードかCGモードを選択するウィンドウです //========================================================================= function Window_RecollectionCommand() { this.initialize.apply(this, arguments); } Window_RecollectionCommand.prototype = Object.create(Window_Command.prototype); Window_RecollectionCommand.prototype.constructor = Window_RecollectionCommand; Window_RecollectionCommand.prototype.initialize = function () { Window_Command.prototype.initialize.call(this, 0, 0); this.x = rngd_recollection_mode_settings.rec_mode_window.x; this.y = rngd_recollection_mode_settings.rec_mode_window.y; }; Window_RecollectionCommand.prototype.makeCommandList = function () { Window_Command.prototype.makeCommandList.call(this); this.addCommand(rngd_recollection_mode_settings.rec_mode_window.str_select_recollection, "select_recollection"); this.addCommand(rngd_recollection_mode_settings.rec_mode_window.str_select_cg, "select_cg"); this.addCommand(rngd_recollection_mode_settings.rec_mode_window.str_select_back_title, "select_back_title"); }; //========================================================================= // ■ Window_RecollectionList //========================================================================= // 回想またはCGを選択するウィンドウです //========================================================================= function Window_RecList() { this.initialize.apply(this, arguments); } Window_RecList.prototype = Object.create(Window_Selectable.prototype); Window_RecList.prototype.constructor = Window_RecList; //------------------------------------------------------------------------- // ● 初期化処理 //------------------------------------------------------------------------- Window_RecList.prototype.initialize = function (x, y, width, height) { Window_Selectable.prototype.initialize.call(this, x, y, width, height); this.windowWidth = width; this.windowHeight = height; this.select(0); this._formationMode = false; this.get_global_variables(); this.refresh(); }; Window_RecList.prototype.maxItems = function () { return rngd_hash_size(rngd_recollection_mode_settings.rec_cg_set); }; Window_RecList.prototype.itemHeight = function () { return (this.height - this.standardPadding()) / rngd_recollection_mode_settings.rec_list_window.item_height; }; Window_RecList.prototype.maxPageItems = function () { return rngd_hash_size(rngd_recollection_mode_settings.rec_cg_set); }; Window_RecList.prototype.maxCols = function () { return rngd_recollection_mode_settings.rec_list_window.item_width; }; Window_RecList.prototype.maxPageRows = function () { var pageHeight = this.height;// - this.padding * 2; return Math.floor(pageHeight / this.itemHeight()); }; Window_RecList.prototype.drawItem = function (index) { var rec_cg = rngd_recollection_mode_settings.rec_cg_set[index + 1]; var rect = this.itemRect(index); var text_height = 0; if (rngd_recollection_mode_settings.rec_list_window.show_title_text) { if (this._global_variables["switches"][rec_cg.switch_id]) { this.contents.drawText(rec_cg.title, rect.x + 4, rect.y + 4, this.itemWidth(), 32, rngd_recollection_mode_settings.rec_list_window.title_text_align); } else { this.contents.drawText(rngd_recollection_mode_settings.rec_list_window.never_watch_title_text, rect.x + 4, rect.y + 4, this.itemWidth(), 32, rngd_recollection_mode_settings.rec_list_window.title_text_align); } text_height = 32; } // CGセットのスイッチ番号が、全てのセーブデータを走査した後にTrueであればピクチャ表示 if (this._global_variables["switches"][rec_cg.switch_id]) { var thumbnail_file_name = rec_cg.pictures[0]; if (rec_cg.thumbnail !== undefined && rec_cg.thumbnail !== null) { thumbnail_file_name = rec_cg.thumbnail; } this.drawRecollection(thumbnail_file_name, 0, 0, this.itemWidth() - 36, this.itemHeight() - 8 - text_height, rect.x + 16, rect.y + 4 + text_height); } else { this.drawRecollection(rngd_recollection_mode_settings.rec_list_window.never_watch_picture_name, 0, 0, this.itemWidth() - 36, this.itemHeight() - 8 - text_height, rect.x + 16, rect.y + 4 + text_height); } }; //------------------------------------------------------------------------- // ● 全てのセーブデータを走査し、対象のシーンスイッチ情報を取得する //------------------------------------------------------------------------- Window_RecList.prototype.get_global_variables = function () { this._global_variables = { "switches": {} }; var maxSaveFiles = DataManager.maxSavefiles(); for (var i = 1; i <= maxSaveFiles; i++) { if (DataManager.loadGameSwitch(i)) { var rec_cg_max = rngd_hash_size(rngd_recollection_mode_settings.rec_cg_set); for (var j = 0; j < rec_cg_max; j++) { var cg = rngd_recollection_mode_settings.rec_cg_set[j + 1]; if ($gameSwitches._data[cg.switch_id]) { this._global_variables["switches"][cg.switch_id] = true; } } } } }; //------------------------------------------------------------------------- // ● index番目に表示された回想orCGが有効かどうか判断する //------------------------------------------------------------------------- Window_RecList.prototype.is_valid_picture = function (index) { // CG情報の取得と対象スイッチの取得 var _rec_cg_obj = rngd_recollection_mode_settings.rec_cg_set[index]; return (this._global_variables["switches"][_rec_cg_obj.switch_id] == true); }; (function () { //----------------------------------------------------------------------------- // ◆ 組み込み関数Fix //----------------------------------------------------------------------------- Window_Base.prototype.drawRecollection = function (bmp_name, x, y, width, height, dx, dy) { var bmp = ImageManager.loadPicture(bmp_name); var _width = width; var _height = height; if (_width > bmp.width) { _width = bmp.width - 1; } if (_height > bmp.height) { _height = bmp.height - 1; } this.contents.blt(bmp, x, y, _width, _height, dx, dy); }; var Window_TitleCommand_makeCommandList = Window_TitleCommand.prototype.makeCommandList; Window_TitleCommand.prototype.makeCommandList = function () { Window_TitleCommand_makeCommandList.call(this); this.clearCommandList(); this.addCommand(TextManager.newGame, 'newGame'); this.addCommand(TextManager.continue_, 'continue', this.isContinueEnabled()); this.addCommand(rngd_recollection_mode_settings.rec_mode_window.recollection_title, 'recollection'); this.addCommand(TextManager.options, 'options'); }; Scene_Title.prototype.commandRecollection = function () { SceneManager.push(Scene_Recollection); }; var Scene_Title_createCommandWindow = Scene_Title.prototype.createCommandWindow; Scene_Title.prototype.createCommandWindow = function () { Scene_Title_createCommandWindow.call(this); this._commandWindow.setHandler('recollection', this.commandRecollection.bind(this)); }; // セーブデータ共有オプションが指定されている場合のみ、カスタマイズ if (rngd_recollection_mode_settings["share_recollection_switches"]) { DataManager.makeSaveContents = function () { // A save data does not contain $gameTemp, $gameMessage, and $gameTroop. Scene_Recollection.setRecollectionSwitches(); var contents = {}; contents.system = $gameSystem; contents.screen = $gameScreen; contents.timer = $gameTimer; contents.switches = $gameSwitches; contents.variables = $gameVariables; contents.selfSwitches = $gameSelfSwitches; contents.actors = $gameActors; contents.party = $gameParty; contents.map = $gameMap; contents.player = $gamePlayer; return contents; }; DataManager.extractSaveContents = function (contents) { $gameSystem = contents.system; $gameScreen = contents.screen; $gameTimer = contents.timer; $gameSwitches = contents.switches; $gameVariables = contents.variables; $gameSelfSwitches = contents.selfSwitches; $gameActors = contents.actors; $gameParty = contents.party; $gameMap = contents.map; $gamePlayer = contents.player; Scene_Recollection.setRecollectionSwitches(); }; DataManager.setupNewGame = function () { this.createGameObjects(); Scene_Recollection.setRecollectionSwitches(); this.selectSavefileForNewGame(); $gameParty.setupStartingMembers(); $gamePlayer.reserveTransfer($dataSystem.startMapId, $dataSystem.startX, $dataSystem.startY); Graphics.frameCount = 0; }; } //----------------------------------------------------------------------------- // ◆ DataManager関数 //----------------------------------------------------------------------------- //------------------------------------------------------------------------- // ● スイッチのみロードする //------------------------------------------------------------------------- DataManager.loadGameSwitch = function (savefileId) { try { return this.loadGameSwitchWithoutRescue(savefileId); } catch (e) { console.error(e); return false; } }; DataManager.loadGameSwitchWithoutRescue = function (savefileId) { var globalInfo = this.loadGlobalInfo(); if (this.isThisGameFile(savefileId)) { var json = StorageManager.load(savefileId); this.createGameObjectSwitch(); this.extractSaveContentsSwitches(JsonEx.parse(json)); //this._lastAccessedId = savefileId; return true; } else { return false; } }; DataManager.createGameObjectSwitch = function () { $gameSwitches = new Game_Switches(); }; DataManager.extractSaveContentsSwitches = function (contents) { $gameSwitches = contents.switches; }; })();
dazed/translations
www/js/plugins/RecollectionMode.js
JavaScript
unknown
59,228
//============================================================================= // RecollectionMode_through_command_patch.js // RecollectionMode(https://github.com/rinne-grid/tkoolmv_plugin_RecollectionMode) // Copyright (c) 2016 rinne_grid // This plugin is released under the MIT license. // http://opensource.org/licenses/mit-license.php //============================================================================= /*:ja * @plugindesc RecollectionModeのパッチです。タイトルから直接回想閲覧に遷移します * @author rinne_grid * * * @help このプラグインには、プラグインコマンドはありません。 * */ // 回想モードのカーソル Scene_Recollection.rec_list_index = 0; // 回想モードの背景に表示する画像 Scene_Recollection.background_image_name = "background"; Scene_Recollection.prototype.createCommandWindow = function () { // 回想モード選択ウィンドウ this._rec_window = new Window_RecollectionCommand(); this._rec_window.setHandler('select_recollection', this.commandShowRecollection.bind(this)); this._rec_window.setHandler('select_cg', this.commandShowCg.bind(this)); this._rec_window.setHandler('select_back_title', this.commandBackTitle.bind(this)); // パッチ:選択ウィンドウを非表示にする。通常はここがtrue this._rec_window.visible = false; this._rec_window.deactivate(); this.addWindow(this._rec_window); // 回想リスト this._rec_list = new Window_RecList(0, 0, Graphics.width, Graphics.height); // パッチ:回想リストを表示にする。通常はここがfalse this._rec_list.visible = true; this._rec_list.setHandler('ok', this.commandDoRecMode.bind(this)); this._rec_list.setHandler('cancel', this.commandBackSelectMode.bind(this)); this._mode = "recollection"; this._rec_list.activate(); this._rec_list.select(Scene_Recollection.rec_list_index); this._rec_list.opacity = 0; this.addWindow(this._rec_list); // CG参照用ダミーコマンド this._dummy_window = new Window_Command(0, 0); this._dummy_window.deactivate(); this._dummy_window.visible = false; this._dummy_window.setHandler('ok', this.commandDummyOk.bind(this)); this._dummy_window.setHandler('cancel', this.commandDummyCancel.bind(this)); this._dummy_window.addCommand('next', 'ok'); this.addWindow(this._dummy_window); }; //------------------------------------------------------------------------- // ● 回想orCGモードから「キャンセル」して前の画面に戻った場合のコマンド //------------------------------------------------------------------------- Scene_Recollection.prototype.commandBackSelectMode = function () { // タイトルに戻る場合は、インデックスをリセットする Scene_Recollection.rec_list_index = 0; SceneManager.goto(Scene_Title); };
dazed/translations
www/js/plugins/RecollectionMode_through_command_patch.js
JavaScript
unknown
2,938
//============================================================================= // SAN_MapGenerator.js //============================================================================= // Copyright (c) 2015-2018 Sanshiro // Released under the MIT license // http://opensource.org/licenses/mit-license.php //============================================================================= /*: * @plugindesc 自動マップ生成 1.1.9 * 自動的にマップを生成しイベントを配置します。 * @author サンシロ https://twitter.com/rev2nym * * @param WallHight * @desc 壁の高さを指定します。(1~3) * @default 1 * * @param MinRoomSize * @desc 部屋の大きさの最小値を指定します。(3~) * @default 5 * * @param MaxRoomSize * @desc 部屋の大きさの最大値を指定します。(3~) * MaxRoomSizeがMinRoomSizeより小さい場合、MinRoomSizeと同じ値に補正されます。 * @default 10 * * @param ShowOuterWall * @desc 部屋の外側の壁を表示します。(ONで有効) * @default ON * * @help * ■概要 * マップ生成プラグインコマンドを実行するとマップが自動生成され * プレイヤーが入口イベントの地点に移動します。 * * ■設定 * ツクールMVのエディタ上でベースとなるマップの下記の座標に * タイルとイベントを配置して下さい。 * * ・タイル * 空白:{x:0, y:0} * 部屋:{x:0, y:1} * 通路:{x:0, y:2} * 天井:{x:0, y:3} * 壁 :{x:0, y:4} * 瓦礫:{x:0, y:5} * * ・イベント * 入口:{x:1, y:0} * 出口:{x:1, y:1} * 他 :上記以外の座標 * * ・イベント出現率 * 入口と出口以外のイベントには出現率を設定できます。 * イベントのメモ欄に下記を記載して下さい。 * 出現率設定がないイベント生成されません。 * * マップ毎の出現率:<RateMap: [1.0以下の正の小数]> * 部屋毎の出現率 :<RateRoom:[1.0以下の正の小数]> * * ■プラグインコマンド * ・MapGenerator RoomAndPass * 部屋と通路から構成されるマップを生成します。 * * ・MapGenerator FillRoom * マップ全体に及ぶ一つの部屋を生成します。 * * ■スクリプトコマンド * ・Game_Character.prototype.isSameRoomWithPlayer() * キャラクターのプレイヤーとの同部屋判定です。 * 例:条件分岐イベントコマンドのスクリプト欄に * 「this.character().isSameRoomWithPlayer()」 * と記述するとそのイベントがプレイヤーと同じ部屋に * 存在するか判定します。 * * ・Game_Map.prototype.pickel() * ツルハシコマンドです。 * プレイヤーの正面の非地面タイルを通路タイルに変換します。 * このコマンドは自動生成マップ内のみ有効です。 * 例:コモンイベントのスクリプトコマンドに * 「$gameMap.pickel()」 * と記述して実行すると正面の壁を掘ることができます。 * * ・Game_Map.prototype.bomb(x, y) * バクダンコマンドです。 * 指定した座標と周囲の9タイルの非地面タイルを通路タイルに変換します。 * このコマンドは自動生成マップ内のみ有効です。 * 例:コモンイベントのスクリプトコマンドに * 「$gameMap.bomb($gamePlayer.x, $gamePlayer.y)」 * と記述して実行するとプレイヤーの周囲の壁を取り除くことができます。 * * ・Game_Map.prototype.makeWall(x, y) * 壁生成コマンドです。 * 指定した座標の地面タイルを壁(瓦礫)タイルに変換します。 * このコマンドは自動生成マップ内のみ有効です。 * 例:コモンイベントのスクリプトコマンドに * 「var x = $gamePlayer.x; * var y = $gamePlayer.y; * var d = $gamePlayer.direction(); * $gameMap.makeWall( * $gameMap.xWithDirection(x, d), * $gameMap.yWithDirection(y, d) * );」 * と記述して実行するとプレイヤーの正面に壁を設置することができます。 * * ・Game_Map.prototype.bigRoom() * 大部屋コマンドです。 * マップ全体に及ぶ一つの部屋を生成します。 * このコマンドは自動生成マップ内のみ有効です。 * 例:コモンイベントのスクリプトコマンドに * 「$gameMap.bigRoom()」 * と記述して実行すると大部屋を生成します。 * * ■利用規約 * MITライセンスのもと、商用利用、改変、再配布が可能です。 * ただし冒頭のコメントは削除や改変をしないでください。 * よかったらクレジットに作者名を記載してください。 * * これを利用したことによるいかなる損害にも作者は責任を負いません。 * サポートは期待しないでください><。 * */ var Imported = Imported || {}; Imported.SAN_MapGenerator = true; var Sanshiro = Sanshiro || {}; Sanshiro.Game_MapGenerator = Sanshiro.Game_MapGenerator || {}; //----------------------------------------------------------------------------- // Game_MapGenerator // // マップジェネレーター(大部屋) function Game_MapGenerator() { this.initialize(); } // オートタイル解析タイルidリスト // tileIdsFloor : 床 // tileIdsWall : 壁 // candidate : 候補タイル ID // connect : 接続タイル ID // noConnect : 非接続タイル ID Game_MapGenerator.tileIdsFloor = {}; Game_MapGenerator.tileIdsFloor.candidate = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47]; Game_MapGenerator.tileIdsFloor.connect = { 1: [0, 1, 2, 3, 4, 5, 6, 7, 16, 17, 18, 19, 20, 21, 24, 26, 28, 29, 30, 31, 32, 33, 34, 35, 36, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47], // 1:左下 2: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 32, 34, 35, 36, 37, 42, 47], // 2:下 3: [0, 1, 2, 3, 8, 9, 10, 11, 16, 17, 20, 22, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47], // 3:右下 4: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 33, 36, 37, 38, 39, 45, 47], // 4:左 6: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 28, 29, 30, 31, 33, 34, 35, 40, 41, 43, 47], // 6:右 7: [0, 2, 4, 6, 8, 10, 12, 14, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 28, 30, 32, 33, 34, 35, 36, 37, 38, 40, 41, 42, 43, 44, 45, 46, 47], // 7:左上 8: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 24, 25, 26, 27, 28, 29, 30, 31, 32, 38, 39, 40, 41, 44, 47], // 8:上 9: [0, 1, 4, 5, 8, 9, 12, 13, 16, 18, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 32, 33, 34, 35, 36, 37, 38, 39, 40, 42, 43, 44, 45, 46, 47] // 9:右上 }; Game_MapGenerator.tileIdsFloor.noConnect = { 1: [8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 22, 23, 25, 27, 28, 29, 30, 31, 32, 33, 34, 35, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47], // 1:左下 2: [28, 29, 30, 31, 33, 38, 39, 40, 41, 43, 44, 45, 46], // 2:下 3: [4, 5, 6, 7, 12, 13, 14, 15, 18, 19, 21, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47], // 3:右下 4: [16, 17, 18, 19, 32, 34, 35, 40, 41, 42, 43, 44, 46], // 4:左 6: [24, 25, 26, 27, 32, 36, 37, 38, 39, 42, 44, 45, 46], // 6:右 7: [1, 3, 5, 7, 9, 11, 13, 15, 16, 17, 18, 19, 20, 21, 22, 23, 26, 27, 29, 31, 32, 33, 34, 35, 36, 37, 39, 40, 41, 42, 43, 44, 45, 46, 47], // 7:左上 8: [20, 21, 22, 23, 33, 34, 35, 36, 37, 42, 43, 45, 46], // 8:上 9: [2, 3, 6, 7, 10, 11, 14, 15, 17, 19, 20, 21, 22, 23, 24, 25, 26, 27, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 41, 42, 43, 44, 45, 46, 47] // 9:右上 }; Game_MapGenerator.tileIdsWall = {}; Game_MapGenerator.tileIdsWall.candidate = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]; Game_MapGenerator.tileIdsWall.connect = { 2: [0, 1, 2, 3, 4, 5, 6, 7], // 2:下 4: [0, 2, 4, 6, 8, 10, 12, 14], // 4:左 6: [0, 1, 2, 3, 8, 9, 10, 11], // 6:右 8: [0, 1, 4, 5, 8, 9, 12, 13] // 8:上 }; Game_MapGenerator.tileIdsWall.noConnect = { 2: [8, 9, 10, 11, 12, 13, 14, 15], // 2:下 4: [1, 3, 5, 7, 9, 11, 13, 15], // 4:左 6: [4, 5, 6, 7, 12, 13, 14, 15], // 6:右 8: [2, 3, 6, 7, 10, 11, 14, 15] // 8:上 }; // 初期化 Game_MapGenerator.prototype.initialize = function () { this._wallHeight = Number(PluginManager.parameters('SAN_MapGenerator')['WallHight']); this._showOuterWall = (PluginManager.parameters('SAN_MapGenerator')['ShowOuterWall'] === 'ON'); this._startXY = { x: 0, y: 0 }; this._goalXY = { x: 0, y: 0 }; this._blocks = []; this._rooms = []; this._passes = []; this._data = []; this._isReady = false; }; // マップ生成 Game_MapGenerator.prototype.setup = function () { $gameMap._events = [undefined]; for (key in $gameSelfSwitches._data) { if (key.split(",")[0] === String($gameMap.mapId())) { delete $gameSelfSwitches._data[key]; } } this._isReady = false; this._blocks = []; this._rooms = []; this._passes = []; this._startXY = { x: 0, y: 0 }; this._goalXY = { x: 0, y: 0 }; this._data = []; this.initSymbolTable(); this.initSymbolMap(); this.generateMap(); this.refreshWallAndRoof(); this.makeData(); this.setStart(); this.setGoal(); this.setRateEvents(); SceneManager._scene.createDisplayObjects(); this._isReady = true; }; // シンボル定義表の初期化 Game_MapGenerator.prototype.initSymbolTable = function () { // シンボル定義 // refXY : シンボルに対応するタイルのツクールのマップ上の座標 // baseTileId : シンボルに対応するタイル ID // dispChar : 生成したマップを文字列として表示する際の文字 this._symbolTable = { player: { refXY: { x: 0, y: 0 }, baseTileId: [], dispChar: '@', passable: ['room', 'pass'] }, space: { refXY: { x: 0, y: 0 }, baseTileId: [], dispChar: ' ', passable: ['space'] }, room: { refXY: { x: 0, y: 1 }, baseTileId: [], dispChar: '□', passable: ['room', 'pass'] }, pass: { refXY: { x: 0, y: 2 }, baseTileId: [], dispChar: '■', passable: ['room', 'pass'] }, roof: { refXY: { x: 0, y: 3 }, baseTileId: [], dispChar: '#', passable: ['roof'] }, wall: { refXY: { x: 0, y: 4 }, baseTileId: [], dispChar: '=', passable: [] }, rubble: { refXY: { x: 0, y: 5 }, baseTileId: [], dispChar: '*', passable: [] }, start: { refXY: { x: 1, y: 0 }, baseTileId: [], dispChar: '△', passable: ['room', 'pass'] }, goal: { refXY: { x: 1, y: 1 }, baseTileId: [], dispChar: '▽', passable: ['room', 'pass'] }//, // fence: {refXY:{x:0, y:6}, baseTileId:[], dispChar:'只'}, // pond: {refXY:{x:0, y:7}, baseTileId:[], dispChar:'○'}, // hole: {refXY:{x:0, y:8}, baseTileId:[], dispChar:'●'}, // brink: {refXY:{x:0, y:9}, baseTileId:[], dispChar:'^'}, // enemy: {refXY:{x:1, y:2}, baseTileId:[], dispChar:'$'}, // crawler:{refXY:{x:0, y:1}, baseTileId:[], dispChar:'&'} }; for (symbol in this._symbolTable) { var x = this._symbolTable[symbol].refXY.x; var y = this._symbolTable[symbol].refXY.y; for (var z = 0; z < 6; z++) { // z0:タイルA下層, z1:タイルA上層, z2:タイルB下層, z3:タイルB上層, z4:影, z5:リージョン this._symbolTable[symbol].baseTileId[z] = this.baseAutoTileId(x, y, z); } } }; // オートタイルタイルの基点タイルID Game_MapGenerator.prototype.baseAutoTileId = function (x, y, z) { if ($gameMap.tileId(x, y, z) >= Tilemap.TILE_ID_A1) { return (Math.floor(($gameMap.tileId(x, y, z) - Tilemap.TILE_ID_A1) / 48)) * 48 + Tilemap.TILE_ID_A1; } else { return $gameMap.tileId(x, y, z); } }; // シンボルで表現されるマップの初期化(初期化時はスペースで埋める) Game_MapGenerator.prototype.initSymbolMap = function () { this._symbolMap = new Array($gameMap.width()); for (var x = 0; x < $gameMap.width(); x++) { this._symbolMap[x] = new Array($gameMap.height()); for (var y = 0; y < $gameMap.height(); y++) { this._symbolMap[x][y] = 'space'; } } }; // シンボルによる通行可能判定 Game_MapGenerator.prototype.isPassable = function (x, y, d) { var x2 = $gameMap.roundXWithDirection(x, d); var y2 = $gameMap.roundYWithDirection(y, d); if (!this._symbolMap[x] || !this._symbolMap[x][y] || !this._symbolMap[x2] || !this._symbolMap[x2][y2]) { return false; } var symbol = this._symbolMap[x][y]; var symbol2 = this._symbolMap[x2][y2]; return this._symbolTable[symbol].passable.contains(symbol2); }; // シンボルによる地面判定 Game_MapGenerator.prototype.isGround = function (x, y) { if (!this._symbolMap[x] || !this._symbolMap[x][y]) { return false; } return ['room', 'pass', 'start', 'goal'].indexOf(this._symbolMap[x][y]) !== -1; }; // シンボルによる壁判定 Game_MapGenerator.prototype.isWall = function (x, y) { if (!this._symbolMap[x] || !this._symbolMap[x][y]) { return false; } return this._symbolMap[x][y] === 'wall'; }; // シンボルマップ生成 Game_MapGenerator.prototype.generateMap = function () { var block = { x: 1, y: 1, w: $dataMap.width - 2, h: $dataMap.height - 2 }; var room = { x: block.x + 2, y: block.y + 2 + this._wallHeight, w: block.w - 4, h: block.h - 4 - this._wallHeight * 2, hasPass: { t: false, b: false, l: false, r: false } }; this._blocks = [block]; this._rooms = [room]; this._passes = []; this.initSymbolMap(); for (var y = 0; y < room.h; y++) { for (var x = 0; x < room.w; x++) { this._symbolMap[room.x + x][room.y + y] = 'room'; } } }; // イベントの設置 Game_MapGenerator.prototype.setEvent = function (event, targetSymbols, targetArea) { targetSymbols = targetSymbols || ['room']; targetArea = targetArea || { x: 0, y: 0, w: $dataMap.width, h: $dataMap.height }; var canSet = false; for (var x = targetArea.x; x < targetArea.x + targetArea.w && !canSet; x++) { for (var y = targetArea.y; y < targetArea.y + targetArea.h && !canSet; y++) { canSet = (targetSymbols.indexOf(this._symbolMap[x][y]) !== -1); } } if (canSet) { for (var i = 0; i < Math.pow(targetArea.w * targetArea.h, 2); i++) { var x = targetArea.x + Math.randomInt(targetArea.w); var y = targetArea.y + Math.randomInt(targetArea.h); if ($gameMap.eventsXy(x, y).length === 0 && targetSymbols.indexOf(this._symbolMap[x][y]) !== -1) { break; } } $gameMap._events.push(event); event._eventId = $gameMap._events.indexOf(event); event.setPosition(x, y); return { x: x, y: y } } else { return undefined; } }; // 座標によるイベントデータの配列 Game_MapGenerator.prototype.dataMapEventsXy = function (x, y) { return $dataMap.events.filter(function (event) { return (!!event && event.x === x && event.y === y); }, this); }; // スタート地点イベントの設置 Game_MapGenerator.prototype.setStart = function () { var refXY = this._symbolTable['start'].refXY; var event = new Game_Event($gameMap.mapId(), this.dataMapEventsXy(refXY.x, refXY.y)[0].id); this._startXY = this.setEvent(event); $gamePlayer.locate(this._startXY.x, this._startXY.y); $gamePlayer.reserveTransfer($gameMap.mapId(), this._startXY.x, this._startXY.y); $gameMap._interpreter.setWaitMode('transfer') }; // ゴール地点イベントの設置 Game_MapGenerator.prototype.setGoal = function () { var refXY = this._symbolTable['goal'].refXY; var event = new Game_Event($gameMap.mapId(), this.dataMapEventsXy(refXY.x, refXY.y)[0].id); this._goalXY = this.setEvent(event); }; // 確率イベントの設置 Game_MapGenerator.prototype.setRateEvents = function () { var mapDataRateMapEvents = $dataMap.events.filter(function (event) { return !!event && !!event.meta.RateMap; }); mapDataRateMapEvents.forEach(function (mapDataEvent) { if (this.randBool(parseFloat(mapDataEvent.meta.RateMap))) { var event = new Game_Event($gameMap.mapId(), mapDataEvent.id); this.setEvent(event); } }, this); var mapDataRateRoomEvents = $dataMap.events.filter(function (event) { return !!event && !!event.meta.RateRoom; }); mapDataRateRoomEvents.forEach(function (mapDataEvent) { this._rooms.forEach(function (room) { if (this.randBool(parseFloat(mapDataEvent.meta.RateRoom))) { var event = new Game_Event($gameMap.mapId(), mapDataEvent.id); this.setEvent(event, 'room', room); } }, this); }, this); }; //ランダムブール //probability : true が返る確立 Game_MapGenerator.prototype.randBool = function (probability) { return Math.random() < probability; }; // シンボルマップの壁と天井を設置:マップ全体 // 床と通路だけのシンボルマップに壁と天井を追加する Game_MapGenerator.prototype.refreshWallAndRoof = function () { for (var x = 0; x < this._symbolMap.length; x++) { for (var y = 0; y < this._symbolMap[x].length; y++) { if (!this.isGround(x, y)) { continue; } this.refreshWallAndRoofUpperSide(x - 1, y - 1); // 左上 this.refreshWallAndRoofUpper(x, y - 1); // 上 this.refreshWallAndRoofUpperSide(x + 1, y - 1); // 右上 this.refreshWallAndRoofSide(x - 1, y); // 左 this.refreshWallAndRoofSide(x + 1, y); // 右 this.refreshWallAndRoofDowner(x - 1, y + 1); // 左下 this.refreshWallAndRoofDowner(x, y + 1); // 下 this.refreshWallAndRoofDowner(x + 1, y + 1); // 右下 } } for (var x = this._symbolMap.length - 1; x >= 0; x--) { for (var y = this._symbolMap[x].length - 1; y >= 0; y--) { if (this._symbolMap[x][y] === 'roof' && this._symbolMap[x][y - 1] === 'wall') { this._symbolMap[x][y - 1] = 'roof'; } } } }; // シンボルマップの壁と天井を設置:上 Game_MapGenerator.prototype.refreshWallAndRoofUpper = function (x, y) { if (!this._symbolMap[x] || !this._symbolMap[x][y] || this.isGround(x, y)) { return; } for (var h = 0; h < y && !this.isGround(x, y - h); h++); if (h > this._wallHeight) { for (var wH = 0; wH < this._wallHeight; wH++) { this._symbolMap[x][y - wH] = 'wall'; } this._symbolMap[x][y - this._wallHeight] = 'roof'; } else { for (var wH = 0; wH < h; wH++) { if (!this.isGround(x, y - wH)) { this._symbolMap[x][y - wH] = 'rubble'; } } } }; // シンボルマップの壁と天井を設置:下 Game_MapGenerator.prototype.refreshWallAndRoofDowner = function (x, y) { if (!this._symbolMap[x] || !this._symbolMap[x][y] || this.isGround(x, y)) { return; } for (var h = 0; h + y < $gameMap.height() && !this.isGround(x, y + h); h++); if (h > this._wallHeight) { this._symbolMap[x][y] = 'roof'; if (this._showOuterWall) { for (var wH = 0; wH < this._wallHeight; wH++) { if (this._symbolMap[x][y + wH + 1] !== 'roof') { this._symbolMap[x][y + wH + 1] = 'wall'; } } } } else { for (var wH = 0; wH < h; wH++) { if (!this.isGround(x, y + wH) && !this.isWall(x, y)) { this._symbolMap[x][y + wH] = 'rubble'; } } } }; //シンボルマップの壁と天井を設置:横 Game_MapGenerator.prototype.refreshWallAndRoofSide = function (x, y) { if (!this._symbolMap[x] || !this._symbolMap[x][y] || this.isGround(x, y)) { return; } if (this.isGround(x, y + 1)) { this.refreshWallAndRoofUpper(x, y); } else { this.refreshWallAndRoofDowner(x, y); } }; // シンボルマップの壁と天井を設置:斜め上 Game_MapGenerator.prototype.refreshWallAndRoofUpperSide = function (x, y) { if (!this._symbolMap[x] || !this._symbolMap[x][y] || this.isGround(x, y)) { return; } this.refreshWallAndRoofDowner(x, y - this._wallHeight); }; // オートタイルを考慮したタイルID Game_MapGenerator.prototype.autoTileId = function (x, y, z) { var baseTileId = this._symbolTable[this._symbolMap[x][y]].baseTileId[z]; if ((x < 0 || x >= $dataMap.width) || (y < 0 || y >= $dataMap.height)) { return undefined; } else if (z === 4) { return this.shadow(x, y); } else if (!Tilemap.isAutotile(baseTileId)) { return baseTileId; } var candidateTileIds = []; if (!Tilemap.isWallSideTile(baseTileId)) { // 壁以外の場合 candidateTileIds = Game_MapGenerator.tileIdsFloor.candidate.concat(); [1, 2, 3, 4, 6, 7, 8, 9].forEach(function (direction) { var dx = x + Math.floor((direction - 1) % 3) - 1; var dy = y - Math.floor((direction - 1) / 3) + 1; if ((dx < 0 || dx >= $dataMap.width) || (dy < 0 || dy >= $dataMap.height)) { return; // マップ範囲外なら判定しない } var roundTileId = this._symbolTable[this._symbolMap[dx][dy]].baseTileId[z]; if (Tilemap.isSameKindTile(baseTileId, roundTileId)) { candidateTileIds = candidateTileIds.filter(function (Id) { return Game_MapGenerator.tileIdsFloor.connect[direction].indexOf(Id) !== -1; }); // 同種オートタイルの場合候補タイルIDから接続タイルIDを選択 } else { candidateTileIds = candidateTileIds.filter(function (Id) { return Game_MapGenerator.tileIdsFloor.noConnect[direction].indexOf(Id) !== -1; }); // 異種オートタイルの場合候補タイルIDから非接続タイルIDを選択 } }, this); } else { // 壁の場合 candidateTileIds = Game_MapGenerator.tileIdsWall.candidate.concat(); for (var by = y; this._symbolMap[x][y] === this._symbolMap[x][by + 1]; by++); // 壁の下端 for (var ty = y; this._symbolMap[x][y] === this._symbolMap[x][ty - 1]; ty--); // 壁の上端 // 上下の処理 [2, 8].forEach(function (direction) { var dx = x + Math.floor((direction - 1) % 3) - 1; var dy = y - Math.floor((direction - 1) / 3) + 1; if ((dx < 0 || dx >= $dataMap.width) || (dy < 0 || dy >= $dataMap.height)) { return; // マップ範囲外なら判定しない } var roundTileId = this._symbolTable[this._symbolMap[dx][dy]].baseTileId[z]; if (Tilemap.isSameKindTile(baseTileId, roundTileId)) { candidateTileIds = candidateTileIds.filter(function (Id) { return Game_MapGenerator.tileIdsWall.connect[direction].indexOf(Id) !== -1; }); // 同種オートタイルの場合候補タイルIDから接続タイルIDを選択 } else { candidateTileIds = candidateTileIds.filter(function (Id) { return Game_MapGenerator.tileIdsWall.noConnect[direction].indexOf(Id) !== -1; }); // 異種オートタイルの場合候補タイルIDから非接続タイルIDを選択 } }, this); // 左右の処理 [4, 6].forEach(function (direction) { var dx = x + Math.floor((direction - 1) % 3) - 1; var dy = y - Math.floor((direction - 1) / 3) + 1; if ((dx < 0 || dx >= $dataMap.width) || (dy < 0 || dy >= $dataMap.height)) { return; // マップ範囲外なら判定しない } var upperSideTileId = this._symbolTable[this._symbolMap[dx][ty]].baseTileId[z]; var downerSideTileId = this._symbolTable[this._symbolMap[dx][by]].baseTileId[z]; if ((Tilemap.isWallTile(upperSideTileId) || Tilemap.isRoofTile(upperSideTileId)) && (Tilemap.isWallTile(downerSideTileId) || Tilemap.isRoofTile(downerSideTileId))) { candidateTileIds = candidateTileIds.filter(function (Id) { return Game_MapGenerator.tileIdsWall.connect[direction].indexOf(Id) !== -1; }); // 壁の下端の両横隣が壁タイルまたは天井タイルでかつ上端の両横隣が壁タイルまたは天井タイルでなければ接続タイルIDを選択 } else { candidateTileIds = candidateTileIds.filter(function (Id) { return Game_MapGenerator.tileIdsWall.noConnect[direction].indexOf(Id) !== -1; }); // 非接続タイルIDを選択 } }, this); } return this._symbolTable[this._symbolMap[x][y]].baseTileId[z] + candidateTileIds[0]; }; // タイル同種判定 Game_MapGenerator.prototype.isSameKindTileSymbol = function (symbol1, symbol2) { return Tilemap.isSameKindTile(symbol1, symbol2); }; // 影の算出 Game_MapGenerator.prototype.shadow = function (x, y) { if (!this._symbolMap[x - 1] || this._symbolMap[x][y] === 'space' || this._symbolMap[x][y] === 'roof' || this._symbolMap[x][y] === 'wall') { return 0; } else if (this._symbolMap[x - 1][y] === 'roof') { if (this._symbolMap[x - 1][y - 1] === 'roof' || this._symbolMap[x - 1][y - 1] === 'wall') { return 5; } } else if (this._symbolMap[x - 1][y] === 'wall') { return 5; } return 0; }; // マップデータ作成 Game_MapGenerator.prototype.makeData = function () { var width = $dataMap.width; var height = $dataMap.height; for (var x = 0; x < this._symbolMap.length; x++) { for (var y = 0; y < this._symbolMap[x].length; y++) { for (var z = 0; z < 6; z++) { this._data[(z * height + y) * width + x] = this.autoTileId(x, y, z); } } } }; // 非地面タイルを通路タイルに変換 Game_MapGenerator.prototype.notGroundToPass = function (x, y) { var wH = this._wallHeight; if (x < 2 || $gameMap.width() - 2 <= x) { return; } if (y < wH + 2 || $gameMap.height() - wH - 2 <= y) { return; } if (!this.isGround(x, y)) { this._symbolMap[x][y] = 'pass'; } }; // ツルハシ(プレイヤーの前方1タイルを通路タイルに変換) Game_MapGenerator.prototype.pickel = function () { this.notGroundToPass( $gameMap.xWithDirection($gamePlayer.x, $gamePlayer.direction()), $gameMap.yWithDirection($gamePlayer.y, $gamePlayer.direction()) ); this.refreshWallAndRoof(); this.makeData(); if (Imported.SAN_AnalogMove) { Game_CollideMap.setup(); } }; // バクダン(指定座標と周囲の計9タイルを通路タイルに変換) Game_MapGenerator.prototype.bomb = function (x, y) { for (var x2 = x - 1; x2 <= x + 1; x2++) { for (var y2 = y - 1; y2 <= y + 1; y2++) { this.notGroundToPass(x2, y2); } } this.refreshWallAndRoof(); this.makeData(); if (Imported.SAN_AnalogMove) { Game_CollideMap.setup(); } }; // 大部屋 Game_MapGenerator.prototype.bigRoom = function () { Game_MapGenerator.prototype.generateMap.call(this); this.refreshWallAndRoof(); this.makeData(); if (Imported.SAN_AnalogMove) { Game_CollideMap.setup(); } }; // 指定したタイルを空白タイルに変換 Game_MapGenerator.prototype.anyToSpace = function (x, y) { if (x < 0 || $gameMap.width() <= x) { return; } if (y < 0 || $gameMap.height() <= y) { return; } this._symbolMap[x][y] = 'space'; }; // 壁生成 Game_MapGenerator.prototype.makeWall = function (x, y) { this.anyToSpace(x, y); this.refreshWallAndRoof(); this.makeData(); if (Imported.SAN_AnalogMove) { Game_CollideMap.setup(); } }; // マップデータ Game_MapGenerator.prototype.data = function () { return this._data; }; // タイルID Game_MapGenerator.prototype.tileId = function (x, y, z) { return this._data[(z * $dataMap.height + y) * $dataMap.width + x]; }; // 準備完了判定 Game_MapGenerator.prototype.isReady = function () { return this._isReady; }; // マップのコンソール表示(デバッグ用) Game_MapGenerator.prototype.printMap = function () { var dispMap = ""; for (var y = 0; y < this._symbolMap[0].length; y++) { for (var x = 0; x < this._symbolMap.length; x++) { dispMap += this._symbolTable[this._symbolMap[x][y]].dispChar; } dispMap += "\r\n"; } console.log(dispMap); }; //----------------------------------------------------------------------------- // Game_MapGeneratorRoomAndPass // // マップジェネレーター(部屋と通路) function Game_MapGeneratorRoomAndPass() { this.initialize.apply(this, arguments); } Game_MapGeneratorRoomAndPass.prototype = Object.create(Game_MapGenerator.prototype); Game_MapGeneratorRoomAndPass.prototype.constructor = Game_MapGeneratorRoomAndPass; // 初期化 Game_MapGeneratorRoomAndPass.prototype.initialize = function () { Game_MapGenerator.prototype.initialize.call(this); }; // マップ(ダンジョン)自動生成 Game_MapGeneratorRoomAndPass.prototype.generateMap = function () { this._minRoomSize = Number(PluginManager.parameters('SAN_MapGenerator')['MinRoomSize']); this._maxRoomSize = Number(PluginManager.parameters('SAN_MapGenerator')['MaxRoomSize']); if (this._maxRoomSize < this._minRoomSize) { this._maxRoomSize = this._minRoomSize; } this._minBlockSize = this._minRoomSize + (this._wallHeight + 1) * 2 + 2; this._minRooms = 2; this._maxRooms = 5; this._adjacentBlockIndexList = []; var block = { x: 1, y: 1, w: $dataMap.width - 2, h: $dataMap.height - 2 }; this._blocks.push(block); this.splitBlock(this._blocks[0]); this.makeAdjacentBlockIndexList(); this.makeRooms(); this.makePasses(); }; // 隣り合うブロックのリスト作成 Game_MapGeneratorRoomAndPass.prototype.makeAdjacentBlockIndexList = function () { for (var crntIndex = 0; crntIndex < this._blocks.length; crntIndex++) { var crntBlock = this._blocks[crntIndex]; this._adjacentBlockIndexList[crntIndex] = { t: [], b: [], l: [], r: [] }; for (var tgetIndex = 0; tgetIndex < this._blocks.length; tgetIndex++) { var tgetBlock = this._blocks[tgetIndex]; if (crntBlock === tgetBlock) { continue; } var adjacentT = (crntBlock.y === tgetBlock.y + tgetBlock.h + 1); var adjacentB = (tgetBlock.y === crntBlock.y + crntBlock.h + 1); var adjacentL = (crntBlock.x === tgetBlock.x + tgetBlock.w + 1); var adjacentR = (tgetBlock.x === crntBlock.x + crntBlock.w + 1); if (!adjacentT && !adjacentB && !adjacentL && !adjacentR) { continue; } var matchH = (tgetBlock.x <= crntBlock.x + crntBlock.w && tgetBlock.x >= crntBlock.x) || (tgetBlock.x + tgetBlock.w <= crntBlock.x + crntBlock.w && tgetBlock.x + tgetBlock.w >= crntBlock.x) || (crntBlock.x <= tgetBlock.x + tgetBlock.w && crntBlock.x >= tgetBlock.x) || (crntBlock.x + crntBlock.w <= tgetBlock.x + tgetBlock.w && crntBlock.x + crntBlock.w >= tgetBlock.x); var matchV = (tgetBlock.y <= crntBlock.y + crntBlock.h && tgetBlock.y >= crntBlock.y) || (tgetBlock.y + tgetBlock.h <= crntBlock.y + crntBlock.h && tgetBlock.y + tgetBlock.h >= crntBlock.y) || (crntBlock.y <= tgetBlock.y + tgetBlock.h && crntBlock.y >= tgetBlock.y) || (crntBlock.y + crntBlock.h <= tgetBlock.y + tgetBlock.h && crntBlock.y + crntBlock.h >= tgetBlock.y); if (adjacentT && matchH) { this._adjacentBlockIndexList[crntIndex].t.push(tgetIndex); continue; } else if (adjacentB && matchH) { this._adjacentBlockIndexList[crntIndex].b.push(tgetIndex); continue; } if (adjacentL && matchV) { this._adjacentBlockIndexList[crntIndex].l.push(tgetIndex); continue; } else if (adjacentR && matchV) { this._adjacentBlockIndexList[crntIndex].r.push(tgetIndex); continue; } } } }; // 部屋作成 Game_MapGeneratorRoomAndPass.prototype.makeRooms = function () { this._blocks.forEach(function (block) { var roomW = this._minRoomSize + Math.randomInt((block.w - (this._wallHeight + 1) * 2) - this._minRoomSize - 2); var roomH = this._minRoomSize + Math.randomInt((block.h - (this._wallHeight + 1) * 2) - this._minRoomSize - 2); if (roomW > this._maxRoomSize) { roomW = this._maxRoomSize; } if (roomH > this._maxRoomSize) { roomH = this._maxRoomSize; } var roomX = block.x + (this._wallHeight + 1) + 1 + Math.randomInt(block.w - roomW - (this._wallHeight + 1) * 2 - 1); var roomY = block.y + (this._wallHeight + 1) + 1 + Math.randomInt(block.h - roomH - (this._wallHeight + 1) * 2 - 1); var room = { x: roomX, y: roomY, w: roomW, h: roomH, hasPass: { t: false, b: false, l: false, r: false } }; this._rooms.push(room); }, this); this._rooms.forEach(function (room) { for (var y = 0; y < room.h; y++) { for (var x = 0; x < room.w; x++) { this._symbolMap[room.x + x][room.y + y] = 'room'; } } }, this); }; // 通路作成 Game_MapGeneratorRoomAndPass.prototype.makePasses = function () { var cache = {}; for (var crntIndex = 0; crntIndex < this._adjacentBlockIndexList.length; crntIndex++) { cache[crntIndex] = []; var crngBlock = this._blocks[crntIndex]; for (var direction in this._adjacentBlockIndexList[crntIndex]) { var tgetIndexList = this._adjacentBlockIndexList[crntIndex][direction]; tgetIndexList.forEach(function (tgetIndex) { if (cache[tgetIndex] !== undefined && cache[tgetIndex].indexOf(crntIndex) !== -1) { return; } cache[crntIndex].push(tgetIndex); var tgetBlock = this._blocks[tgetIndex]; var crntRoom = this._rooms[crntIndex]; var tgetRoom = this._rooms[tgetIndex]; var crntPass = { x: 0, y: 0, w: 0, h: 0 }; var tgetPass = { x: 0, y: 0, w: 0, h: 0 }; var bordPass = { x: 0, y: 0, w: 0, h: 0 }; switch (direction) { case 't': if (crntRoom.hasPass.t || tgetRoom.hasPass.b) { return; } crntPass.x = crntRoom.x + 1 + Math.randomInt(crntRoom.w - 2); crntPass.y = crngBlock.y; crntPass.w = 1; crntPass.h = crntRoom.y - crngBlock.y; tgetPass.x = tgetRoom.x + 1 + Math.randomInt(tgetRoom.w - 2); tgetPass.y = tgetRoom.y + tgetRoom.h; tgetPass.w = 1; tgetPass.h = crngBlock.y - tgetPass.y; bordPass.x = Math.min(crntPass.x, tgetPass.x); bordPass.y = crngBlock.y - 1; bordPass.w = Math.max(crntPass.x, tgetPass.x) - bordPass.x + 1; bordPass.h = 1; crntRoom.hasPass.t = true; tgetRoom.hasPass.b = true; break; case 'b': if (crntRoom.hasPass.b || tgetRoom.hasPass.t) { return; } crntPass.x = crntRoom.x + 1 + Math.randomInt(crntRoom.w - 2); crntPass.y = crntRoom.y + crntRoom.h; crntPass.w = 1; crntPass.h = tgetBlock.y - crntPass.y; tgetPass.x = tgetRoom.x + 1 + Math.randomInt(tgetRoom.w - 2); tgetPass.y = tgetBlock.y; tgetPass.w = 1; tgetPass.h = tgetRoom.y - tgetBlock.y; bordPass.x = Math.min(crntPass.x, tgetPass.x); bordPass.y = tgetBlock.y - 1; bordPass.w = Math.max(crntPass.x, tgetPass.x) - bordPass.x + 1; bordPass.h = 1; crntRoom.hasPass.b = true; tgetRoom.hasPass.t = true; break; case 'l': if (crntRoom.hasPass.l || tgetRoom.hasPass.r) { return; } crntPass.x = crngBlock.x - 1; crntPass.y = crntRoom.y + 1 + Math.randomInt(crntRoom.h - 2); crntPass.w = crntRoom.x - crntPass.x; crntPass.h = 1; tgetPass.x = tgetRoom.x + tgetRoom.w; tgetPass.y = tgetRoom.y + 1 + Math.randomInt(tgetRoom.h - 2); tgetPass.w = crntPass.x - tgetRoom.x - tgetRoom.w; tgetPass.h = 1; bordPass.x = crngBlock.x - 1; bordPass.y = Math.min(crntPass.y, tgetPass.y); bordPass.w = 1; bordPass.h = Math.max(crntPass.y, tgetPass.y) - bordPass.y + 1; crntRoom.hasPass.l = true; tgetRoom.hasPass.r = true; break; case 'r': if (crntRoom.hasPass.r || tgetRoom.hasPass.l) { return; } crntPass.x = crntRoom.x + crntRoom.w crntPass.w = tgetBlock.x - 1 - crntRoom.x - crntRoom.w crntPass.y = crntRoom.y + 1 + Math.randomInt(crntRoom.h - 2); crntPass.h = 1; tgetPass.x = tgetBlock.x - 1; tgetPass.y = tgetRoom.y + 1 + Math.randomInt(tgetRoom.h - 2); tgetPass.w = tgetRoom.x - tgetPass.x; tgetPass.h = 1; bordPass.x = tgetBlock.x - 1; bordPass.y = Math.min(crntPass.y, tgetPass.y); bordPass.w = 1; bordPass.h = Math.max(crntPass.y, tgetPass.y) - bordPass.y + 1; crntRoom.hasPass.r = true; tgetRoom.hasPass.l = true; break; } this._passes.push(crntPass); this._passes.push(tgetPass); this._passes.push(bordPass); }, this); } } this._passes.forEach(function (pass) { for (var y = 0; y < pass.h; y++) { for (var x = 0; x < pass.w; x++) { this._symbolMap[pass.x + x][pass.y + y] = 'pass'; } } }, this); }; // ブロック分割:ランダム Game_MapGeneratorRoomAndPass.prototype.splitBlock = function (block) { if (this.randBool(0.5)) { if (this.isSplitableH(block)) { this.splitBlockH(block); } if (this.isSplitableV(block)) { this.splitBlockV(block); } } else { if (this.isSplitableV(block)) { this.splitBlockV(block); } if (this.isSplitableH(block)) { this.splitBlockH(block); } } }; //ブロック分割:横分割 Game_MapGeneratorRoomAndPass.prototype.splitBlockH = function (block) { var orgBlockW = 0; var newBlockW = 0; while (orgBlockW < this._minBlockSize || newBlockW < this._minBlockSize) { orgBlockW = Math.floor(block.w / 4 + block.w * Math.random() / 2); newBlockW = block.w - orgBlockW - 1; } block.w = orgBlockW; var newBlock = { x: block.x + orgBlockW + 1, y: block.y, w: newBlockW, h: block.h }; this._blocks.push(newBlock); this.splitBlock(block); this.splitBlock(newBlock); }; // ブロック分割:縦分割 Game_MapGeneratorRoomAndPass.prototype.splitBlockV = function (block) { var orgBlockH = 0; var newBlockH = 0; while (orgBlockH < this._minBlockSize || newBlockH < this._minBlockSize) { orgBlockH = Math.floor(block.h / 4 + block.h * Math.random() / 2); newBlockH = block.h - orgBlockH - 1; } block.h = orgBlockH; var newBlock = { x: block.x, y: block.y + orgBlockH + 1, w: block.w, h: newBlockH }; this._blocks.push(newBlock); this.splitBlock(block); this.splitBlock(newBlock); }; // ブロック分割可能判定:部屋数 Game_MapGeneratorRoomAndPass.prototype.isSplitableByRoomNum = function () { if (this._blocks.length >= this._maxRooms) { return false; } if (this._blocks.length >= this._minRooms && this.randBool((this._blocks.length - this._minRooms + 1) / (this._maxRooms - this._minRooms + 1))) { return false; } return true; }; // ブロック分割可能判定:横分割 Game_MapGeneratorRoomAndPass.prototype.isSplitableV = function (block) { return block.h > (this._minBlockSize * 2 + 1) && this.isSplitableByRoomNum(); }; // ブロック分割可能判定:縦分割 Game_MapGeneratorRoomAndPass.prototype.isSplitableH = function (block) { return block.w > (this._minBlockSize * 2 + 1) && this.isSplitableByRoomNum(); }; // 座標によって部屋を取得 Game_MapGeneratorRoomAndPass.prototype.roomByXY = function (x, y) { for (i = 0; i < this._rooms.length; i++) { var room = this._rooms[i]; if (room.x <= x && x < room.x + room.w && room.y <= y && y < room.y + room.h) { return room; } } return undefined; }; //----------------------------------------------------------------------------- // Game_Map // // マップクラス // マップクラスの初期化 Sanshiro.Game_MapGenerator.Game_Map_initialize = Game_Map.prototype.initialize; Game_Map.prototype.initialize = function () { Sanshiro.Game_MapGenerator.Game_Map_initialize.call(this); }; // マップジェネレーターの取得 Game_Map.prototype.mapGenerator = function () { return this._mapGenerator; }; // マップクラスのセットアップ Sanshiro.Game_MapGenerator.Game_Map_setup = Game_Map.prototype.setup; Game_Map.prototype.setup = function (mapId) { Sanshiro.Game_MapGenerator.Game_Map_setup.call(this, mapId) this._mapGenerator = null; }; // マップクラスのタイルID Sanshiro.Game_MapGenerator.Game_Map_tileId = Game_Map.prototype.tileId Game_Map.prototype.tileId = function (x, y, z) { if (this.isGenegratedMap()) { return this._mapGenerator.tileId(x, y, z); } return Sanshiro.Game_MapGenerator.Game_Map_tileId.call(this, x, y, z); }; // マップクラスのマップデータ Sanshiro.Game_MapGenerator.Game_Map_data = Game_Map.prototype.data Game_Map.prototype.data = function () { if (this.isGenegratedMap()) { return this._mapGenerator.data(); } return Sanshiro.Game_MapGenerator.Game_Map_data.call(this); }; // マップクラスの通行判定 Sanshiro.Game_MapGenerator.Game_Map_isPassable = Game_Map.prototype.isPassable Game_Map.prototype.isPassable = function (x, y, d) { if (this.isGenegratedMap()) { return this._mapGenerator.isPassable(x, y, d); } return Sanshiro.Game_MapGenerator.Game_Map_isPassable.call(this, x, y, d); }; // マップクラスのマップ自動生成 Game_Map.prototype.generateMap = function (mapType) { mapType = mapType || 'FillRoom'; switch (mapType) { case 'RoomAndPass': this._mapGenerator = new Game_MapGeneratorRoomAndPass(); break; case 'FillRoom': this._mapGenerator = new Game_MapGenerator(); break; } this._mapGenerator.setup(); if (Imported.SAN_AnalogMove) { Game_CollideMap.setup(); } }; // 自動生成マップ判定 Game_Map.prototype.isGenegratedMap = function () { return !!this._mapGenerator && this._mapGenerator.isReady(); }; // ツルハシ Game_Map.prototype.pickel = function () { if (this.isGenegratedMap()) { this._mapGenerator.pickel(); } }; // バクダン Game_Map.prototype.bomb = function (x, y) { if (this.isGenegratedMap()) { this._mapGenerator.bomb(x, y); } }; // 大部屋 Game_Map.prototype.bigRoom = function () { if (this.isGenegratedMap()) { this._mapGenerator.bigRoom(); } }; // 壁生成 Game_Map.prototype.makeWall = function (x, y) { if (this.isGenegratedMap()) { this._mapGenerator.makeWall(x, y); } }; //----------------------------------------------------------------------------- // Game_Character // // キャラクタークラス Game_Character.prototype.currentRoom = function () { if (!$gameMap.isGenegratedMap || !($gameMap.mapGenerator() instanceof Game_MapGeneratorRoomAndPass)) { return undefined; } return $gameMap.mapGenerator().roomByXY(this.x, this.y); }; // プレイヤーと同部屋判定 Game_Character.prototype.isSameRoomWithPlayer = function () { if ($gameMap.mapGenerator().constructor === Game_MapGenerator) { return true; } var room1 = this.currentRoom(); var room2 = $gamePlayer.currentRoom(); return (!!room1 && !!room2 && room1 === room2); }; //----------------------------------------------------------------------------- // Game_Event // // イベントクラス // イベントクラスの初期化 Sanshiro.Game_MapGenerator.Game_Event_initialize = Game_Event.prototype.initialize; Game_Event.prototype.initialize = function (mapId, eventId) { this._dataEventId = eventId; Sanshiro.Game_MapGenerator.Game_Event_initialize.call(this, mapId, eventId); }; // イベントクラスのデータベースのイベントデータ Game_Event.prototype.event = function () { return $dataMap.events[this._dataEventId]; }; //----------------------------------------------------------------------------- // Game_Interpreter // // インタープリタークラス // プラグインコマンド Sanshiro.Game_MapGenerator.Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand; Game_Interpreter.prototype.pluginCommand = function (command, args) { Sanshiro.Game_MapGenerator.Game_Interpreter_pluginCommand.call(this, command, args); if (command === 'MapGenerator') { switch (args[0]) { case 'FillRoom': $gameMap.generateMap(args[0]); break; case 'RoomAndPass': $gameMap.generateMap(args[0]); break; } } };
dazed/translations
www/js/plugins/SAN_MapGenerator.js
JavaScript
unknown
48,661
//============================================================================= // SNH_MsgNameLabel.js //============================================================================= /*: * @plugindesc Change something. * @author Gabacho * * @help OMG! Sory. I can not write a English. Because I am Japanese! * * This plugin is released under the MIT License. */ /*:ja * @plugindesc メッセージ名前ラベルプラグイン * @author ガバチョ(溟犬一六)(https:/star-write-dream.com) * @help プラグインコマンドはありません。 * このプラグインはMITライセンスです。 * ---------------------------------------------------------------------------- * * 文章の表示をする時、指定した名前を表示します。 * 文字と背景(ネームプレート)の色、サイズ、位置を設定できます。 * * また飾りつけ用に四角形・円を複数描画できます。 * 画像ファイルも追加可能です。 * * ---------------------------------------------------------------------------- * * ■使い方 * メッセージ内に「\nl<名前>」と入れると「名前」が表示されます。 * * ---------------------------------------------------------------------------- * ☆パラメーター設定の前に * * ○位置調整 * デフォルト値は、顔グラフィックの下側に表示する設定になっています。 * 名前文字の0位置はメッセージウィンドウの左上、 * 追加部品の0位置は名前文字の左上です。 * * ○ネームプレート * 名前文字の背景として使う四角形です。 * 表示したくない場合は以下の設定で透明にできます。 * ・gradationMode:false * ・color1のopacity:0 * * * ○必須項目 * 「文字サイズ」から「ネームプレート」までが必須です。 * 「追加四角部品」から下はデータなしでかまいません。 * ※「ネームプレート」は初期データが入っていませんので、 * 手動で登録してください。 * * * ○入力方法 * 「ネームプレート」「追加四角部品」「追加円部品」 * 「追加ネームプレート画像」「追加画像部品」は、ダブルクリックすると子画面が出てきます。 * 子画面で「行」をダブルクリックすると、中身を登録できます。 * 「行」は何件も登録できます。 * ただし、「ネームプレート」と「追加ネームプレート画像」は1行目だけ使用されます。 * * ---------------------------------------------------------------------------- * * ☆パラメータ説明 * 入力画面の下側に表示される説明を読んでください。 * 補足が必要なものだけ記載します。 * * ■文字サイズ自動調整(初期値:ON) * ネームプレートのwidthが0の場合、OFFで動作します。 * * 【ネームプレート】 * 一番奥に表示されます。 * 表示順を設定できる文字・部品より手前には表示できません。 * 見せたくない場合は以下の設定で透明にしてください。 * ・color1のopasity:0 * ・gradationMode:OFF(false) * * ■width(初期値:144) * 0だと文字の長さに合わせて伸び縮みします。 * * ■文字の寄せ方(縦) * 中央寄せ、下寄せにしたい時は、 * ネームプレートの高さに余裕をもたせてください。 * * 【追加ネームプレート画像】 * ネームプレートのすぐ手前に表示されます。 * 表示順を設定できる文字・部品より手前には表示できません。 * * ■autoScaleMode * ONにすると、文字の長さに合わせて横方向に伸び縮みします。 * (scaleXが、名前の長さに合わせて自動設定されるイメージです) * * ---------------------------------------------------------------------------- * * ☆こんな時はどうする? * * ■名前とネームプレートの位置をずらしたい * ネームプレートを透明にして、四角部品を使ってください。 * ただし、四角部品は文字の長さによる伸び縮みはできません。 * * * ■ネームプレート画像を使う時、文字の「寄せ方」がずれる気がする * 文字の寄せ方は、「ネームプレート」の幅、高さを相手にしています。 * まずは「ネームプレート画像」の幅・高さを調べて、 * 「ネームプレート」のwidth・heightに設定してください。 * その後は目視確認をしながら、 * 「ネームプレート画像」のpositionXとposionYの値を使って調整してください。 * * * ■名前ラベルをメッセージウィンドウの上にはみ出させると、 * ウィンドウ位置「上」の時画面外に出てしまう。 * 「SNH_MessageWindowPosition.js」を使うと、 * メッセージウィンドウの上下位置を調整できるようになります。 * * ---------------------------------------------------------------------------- * * @param 文字サイズ * @type number * @desc 名前ラベルのフォントサイズを指定。(初期値:24) * @default 24 * * @param 文字サイズ自動調整 * @type boolean * @desc ON:ネームプレートに収まるように文字サイズを自動調整します。 OFF:設定した文字サイズのままで表示します。 * @default true * * @param 文字色 * @type number * @desc 名前ラベルの文字色を指定。数値と色の対応は、メッセージの文字色指定と同じ。(初期値:17) * @default 17 * @min 0 * @max 31 * * @param 文字フチ色 * @type number * @desc 名前ラベルの文字色を指定。数値と色の対応は、メッセージの文字色指定と同じ。(初期値:19) * @default 19 * @min 0 * @max 31 * * @param 文字の寄せ方(縦) * @type select * @desc 名前ラベルの縦位置の寄せ方を指定。(初期値:中央寄せ) * @option 上寄せ * @value up * @option 中央寄せ * @value center * @option 下寄せ * @value down * @default center * * @param 文字の寄せ方(横) * @type select * @desc 名前ラベルの横位置の寄せ方を指定。(初期値:中央寄せ) * @option 左寄せ * @value left * @option 中央寄せ * @value center * @option 右寄せ * @value right * @default center * * * @param 左右位置調整 * @type number * @desc 左右位置を調整する値をピクセルで指定。プラスで右、マイナスで左に調整。(初期値:18) * @default 18 * @min -9999 * * @param 上下位置調整 * @type number * @desc 上下位置を調整する値をピクセルで指定。プラスで下、マイナスで上に調整。(初期値:134) * @default 134 * @min -9999 * * * @param 文字の表示順 * @type number * @desc 部品と重なった時、どちらを手前にするかの値を指定します。この値が大きいほど手前になります。 * @default 99 * @max 99 * * @param ネームプレート * @type struct<NamePlate>[] * @desc ネームプレートの設定。1件目のデータしか使われません。表示しない場合は透明にしてください。 * * @param 追加四角部品 * @type struct<AttachmentRect>[] * @desc 追加する四角部品の設定。複数登録可能ですが、処理が重くなるかもしれません。 * * @param 追加円部品 * @type struct<AttachmentCircle>[] * @desc 追加する円部品の設定。複数登録可能ですが、処理が重くなるかもしれません。 * * @param 追加ネームプレート画像 * @type struct<PlatePicture>[] * @desc 追加する画像ファイルの設定。1件目のデータしか使われません。ネームプレートのように配置されます。 * @dir img/pictures/ * * @param 追加画像部品 * @type struct<Picture>[] * @desc 追加する画像ファイルの設定。 * @dir img/pictures/ * */ /*~struct~NamePlate: * * @param width * @type number * @desc 幅をピクセルで指定。(初期値:144) 0だと文字数に合わせて伸び縮みします。 * @default 144 * * @param height * @type number * @desc 高さをピクセルで指定 。(初期値:34)文字サイズ+paddingY×2でぴったりサイズです。 * @default 34 * * @param paddingX * @type number * @desc 左右の内側余白をピクセルで指定。(初期値:5)値を大きくするとネームプレートと文字のスキマが増えます。 * @default 5 * * @param paddingY * @type number * @desc 上下の内側余白をピクセルで指定。(初期値:5)値を大きくするとネームプレートと文字のスキマが増えます。 * @default 5 * * @param color1 * @type struct<Color> * @desc ネームプレートの色 * @default {"red":"240","green":"248","blue":"255", "opacity":"0.3"} * * @param gradationMode * @type boolean * @desc true:color1からcolor2へグラデーションします。 false:color1単色です。 * @default false * * @param gradationVertical * @type boolean * @desc true:縦にグラデーションします。 false:横にグラデーションします。 * @default false * * * @param color2 * @type struct<Color> * @desc グラデーションカラー * @default {"red":"0","green":"0","blue":"0", "opacity":"1"} * */ /*~struct~AttachmentRect: * * @param orderNo * @type number * @desc この値が大きいほど手前に表示されます。同じ値だと後に定義された部品ほど手前に表示されます。 * @default 0 * @max 99 * @min 0 * * @param width * @type number * @desc 四角形の幅をピクセルで指定。 * @default 0 * * @param height * @type number * @desc 四角形の高さをピクセルで指定。 * @default 0 * * @param positionX * @type number * @desc 横方向の表示位置を調整する値をピクセルで指定。 * @min -999 * @default 0 * * @param positionY * @type number * @desc 縦方向の表示位置を調整する値をピクセルで指定。 * @min -999 * @default 0 * * @param color1 * @type struct<Color> * @desc 四角形の色 * @default {"red":"0","green":"0","blue":"0", "opacity":"1"} * * @param gradationMode * @type boolean * @desc true:color1からcolor2へグラデーションします。 false:color1単色です。 * @default false * * @param gradationVertical * @type boolean * @desc true:縦にグラデーションします。 false:横にグラデーションします。 * @default false * * @param color2 * @type struct<Color> * @desc グラデーションカラー * @default {"red":"0","green":"0","blue":"0", "opacity":"1"} * * @param rotation * @type number * @desc 何度かたむけるかを指定。(0~360) * @max 360 * @default 0 * */ /*~struct~AttachmentCircle: * * @param orderNo * @type number * @desc この値が大きいほど手前に表示されます。同じ値だと後に定義された部品ほど手前に表示されます。 * @default 0 * @max 99 * @min 0 * * @param radius * @type number * @desc 円の半径をピクセルで指定。 * @default 0 * * @param positionX * @type number * @desc 横方向の表示位置を調整する値をピクセルで指定。 * @default 0 * @min -9999 * * @param positionY * @type number * @desc 縦方向の表示位置を調整する値をピクセルで指定。 * @default 0 * @min -9999 * * @param color * @type struct<Color> * @desc 円の色 * @default {"red":"0","green":"0","blue":"0", "opacity":"1"} * */ /*~struct~Color: * * @param red * @type number * @max 255 * @desc 赤(R)。0~255で指定してください。 * @default 0 * * @param green * @type number * @max 255 * @desc 緑(G)。0~255で指定してください。 * @default 0 * * @param blue * @type number * @max 255 * @desc 青(B)。0~255で指定してください。 * @default 0 * * @param opacity * @type number * @max 1 * @desc 不透明度を0~1で指定してください。0で透明です。 * @default 1 * @decimals 1 * */ /*~struct~Picture: * * @param orderNo * @type number * @desc この値が大きいほど手前に表示されます。同じ値だと後に定義された画像ほど手前に表示されます。 * @default 0 * @max 99 * * @param fileName * @type file * @desc img/picturesフォルダの画像ファイルを指定。 * @dir img/pictures/ * @default fileName_Nothing * * @param positionX * @type number * @desc 横方向の表示位置を調整する値をピクセルで指定。 * @min -999 * @default 0 * * @param positionY * @type number * @desc 縦方向の表示位置を調整する値をピクセルで指定。 * @min -999 * @default 0 * * @param scaleX * @type number * @desc 横方向の拡大倍率を指定。1で等倍。2で2倍。マイナスだと画像が反転します。 * @default 1 * @max 10 * @min -10 * @decimals 1 * * @param scaleY * @type number * @desc 縦方向の拡大倍率を指定。1で等倍。2で2倍。マイナスだと画像が反転します。 * @default 1 * @max 10 * @min -10 * @decimals 1 * * @param opacity * @type number * @max 255 * @desc 不透明度を0~255で指定してください。0で透明です。 * @default 255 * * @param rotation * @type number * @desc 何度かたむけるかを指定。(0~360) * @max 360 * @default 0 * */ /*~struct~PlatePicture: * * @param fileName * @type file * @desc img/picturesフォルダの画像ファイルを指定。 * @dir img/pictures/ * @default fileName_Nothing * * @param positionX * @type number * @desc 横方向の表示位置を調整する値をピクセルで指定。 * @min -999 * @default 0 * * @param positionY * @type number * @desc 縦方向の表示位置を調整する値をピクセルで指定。 * @min -999 * @default 0 * * @param autoScaleMode * @type boolean * @desc true:名前文字が長い時自動で伸びます。 false:伸びません。 * @default false * * @param scaleX * @type number * @desc 横方向の拡大倍率を指定。1で等倍。2で2倍。マイナスだと画像が反転します。 * @default 1 * @max 10 * @min -10 * @decimals 1 * * @param scaleY * @type number * @desc 縦方向の拡大倍率を指定。1で等倍。2で2倍。マイナスだと画像が反転します。 * @default 1 * @max 10 * @min -10 * @decimals 1 * * @param opacity * @type number * @max 255 * @desc 不透明度を0~255で指定してください。0で透明です。 * @default 255 * */ (function () { 'use strict'; var convertToNumber = function (obj) { for (var prop in obj) { obj[prop] = Number(obj[prop]); } return obj; } var getParamString = function (paramNames) { if (!Array.isArray(paramNames)) paramNames = [paramNames]; for (var i = 0; i < paramNames.length; i++) { var name = PluginManager.parameters(pluginName)[paramNames[i]]; if (name) return name; } return ''; }; var convertArrayParam = function (param) { if (!param) { return; } if (param !== undefined) { try { const array = JSON.parse(param); for (let i = 0; i < array.length; i++) { array[i] = JSON.parse(array[i]); } return array; } catch (e) { console.group(); console.error('%cParameter is invalid ! SNH_MsgNameLableのパラメータ準備に失敗しました。', 'background-color: #5174FF'); console.error('Parameter:' + eval(param)); console.error('Error message :' + e); console.groupEnd(); } } }; var convertParam = function (param) { if (param !== undefined) { try { return JSON.parse(param); } catch (e) { console.group(); console.error('%cParameter is invalid ! SNH_MsgNameLableのパラメータ準備に失敗しました。', 'background-color: #5174FF'); console.error('Parameter:' + eval(param)); console.error('Error message :' + e); console.groupEnd(); } } }; var parameters = PluginManager.parameters('SNH_MsgNameLabel'); var nameLabelFontSize = Number(parameters['文字サイズ'] || 24); var nameLabelFontColor = Number(parameters['文字色'] || 0); var nameLabelFontOutLineColor = Number(parameters['文字フチ色'] || 15); var nameLabelAlignY = String(parameters['文字の寄せ方(縦)'] || 'center'); var nameLabelAlignX = String(parameters['文字の寄せ方(横)'] || 'center'); var nameAutoMode = Boolean(parameters['文字サイズ自動調整'] === 'true' || false); var nameLabelBackHeight = Number(parameters['背景の高さ調整'] || 10); var nameLabelChoseiX = Number(parameters['左右位置調整'] || 0); var nameLabelChoseiY = Number(parameters['上下位置調整'] || 0); var nameLabelOrderNo = Number(parameters['文字の表示順'] || 99); var param = {}; param.NamePlate = String(parameters['ネームプレート']); param.NamePlate = convertArrayParam(param.NamePlate); param.AttachmentRect = String(parameters['追加四角部品']); param.AttachmentRect = convertArrayParam(param.AttachmentRect); param.AttachmentCircle = String(parameters['追加円部品']); param.AttachmentCircle = convertArrayParam(param.AttachmentCircle); param.NamePlatePictures = String(parameters['追加ネームプレート画像']); param.NamePlatePictures = convertArrayParam(param.NamePlatePictures); param.AttachmentPictures = String(parameters['追加画像部品']); param.AttachmentPictures = convertArrayParam(param.AttachmentPictures); let partsList = []; let namePlate = []; let namePlatePicture = []; let namePlatePictureWidth = 0; // 矩形bitmap作成 function createPartsSpriteRect(parts) { let bitmap = new Bitmap(0, 0); bitmap.resize(parts.width, parts.height); if (parts.gradationMode) { bitmap.gradientFillRect(0, 0, parts.width, parts.height , 'rgba(' + parts.color1.red + ',' + parts.color1.green + ',' + parts.color1.blue + ',' + parts.color1.opacity + ')' , 'rgba(' + parts.color2.red + ',' + parts.color2.green + ',' + parts.color2.blue + ',' + parts.color2.opacity + ')' , parts.gradationVertical); } else { bitmap.fillRect(0, 0, parts.width, parts.height , 'rgba(' + parts.color1.red + ',' + parts.color1.green + ',' + parts.color1.blue + ',' + parts.color1.opacity + ')'); } return bitmap; } //円bitmap作成 function createPartsSpriteCircle(parts) { let bitmap = new Bitmap(0, 0); bitmap.resize(parts.radius * 2, parts.radius * 2); bitmap.drawCircle(parts.radius, parts.radius, parts.radius , 'rgba(' + parts.color.red + ',' + parts.color.green + ',' + parts.color.blue + ',' + parts.color.opacity + ')'); return bitmap; } //画像bitmap作成 function createPartsSpritePicture(parts) { let bitmap = new Bitmap(0, 0); bitmap = ImageManager.loadBitmap('img/pictures/', parts.fileName, 0, false); return bitmap; } //初期処理:構造体の整形とbitmapの準備 (function initPartsList() { if (param.NamePlate && param.NamePlate.length > 0) { let plate = param.NamePlate[0]; plate.type = 'rect'; plate.orderNo = -1; plate.width = Number(plate.width); plate.height = Number(plate.height); plate.paddingX = Number(plate.paddingX); plate.paddingY = Number(plate.paddingY); plate.gradationMode = Boolean(plate.gradationMode === 'true' || false); plate.gradationVertical = Boolean(plate.gradationVertical === 'true' || false); plate.color1 = convertToNumber(convertParam(plate.color1)) plate.color2 = convertToNumber(convertParam(plate.color2)) plate.rotation = 0; if (plate.height === 0) { plate.height = nameLabelFontSize; } plate.bitmap = createPartsSpriteRect(plate); namePlate.push(plate); } if (param.AttachmentRect && param.AttachmentRect.length > 0) { for (let rect of param.AttachmentRect) { rect.type = 'rect'; rect.orderNo = Number(rect.orderNo); rect.width = Number(rect.width); rect.heigth = Number(rect.heigth); rect.positionX = Number(rect.positionX); rect.positionY = Number(rect.positionY); rect.gradationMode = Boolean(rect.gradationMode === 'true' || false); rect.gradationVertical = Boolean(rect.gradationVertical === 'true' || false); rect.color1 = convertToNumber(convertParam(rect.color1)) rect.color2 = convertToNumber(convertParam(rect.color2)) rect.rotation = Number(rect.rotation); rect.bitmap = createPartsSpriteRect(rect); if (rect.width === 0 || rect.height === 0) { continue; } partsList.push(rect); } } if (param.AttachmentCircle && param.AttachmentCircle.length > 0) { for (let circle of param.AttachmentCircle) { circle.type = 'circle'; circle.orderNo = Number(circle.orderNo); circle.radius = Number(circle.radius); circle.positionX = Number(circle.positionX); circle.positionY = Number(circle.positionY); circle.color = convertToNumber(convertParam(circle.color)) circle.bitmap = createPartsSpriteCircle(circle); if (circle.radius === 0) { continue; } partsList.push(circle); } } if (param.AttachmentPictures && param.AttachmentPictures.length > 0) { let pictureBitmap = new Bitmap(0, 0); for (let picture of param.AttachmentPictures) { picture.type = 'picture'; picture.orderNo = Number(picture.orderNo); picture.fileName = String(picture.fileName); picture.positionX = Number(picture.positionX); picture.positionY = Number(picture.positionY); picture.scaleX = Number(picture.scaleX); picture.scaleY = Number(picture.scaleY); picture.opacity = Number(picture.opacity); picture.rotation = Number(picture.rotation); if (picture.fileName === 'fileName_Nothing') { continue; } picture.bitmap = createPartsSpritePicture(picture); partsList.push(picture); } } if (param.NamePlatePictures && param.NamePlatePictures.length > 0) { let pPictureBitmap = new Bitmap(0, 0); let pPicture = param.NamePlatePictures[0]; pPicture.type = 'picture'; pPicture.orderNo = 0; pPicture.fileName = String(pPicture.fileName); pPicture.positionX = Number(pPicture.positionX); pPicture.positionY = Number(pPicture.positionY); pPicture.autoScaleMode = Boolean(pPicture.autoScaleMode === 'true' || false); pPicture.scaleX = Number(pPicture.scaleX); pPicture.scaleY = Number(pPicture.scaleY); pPicture.opacity = Number(pPicture.opacity); pPicture.rotation = 0; if (pPicture.fileName != 'fileName_Nothing') { pPicture.bitmap = createPartsSpritePicture(pPicture); namePlatePictureWidth = pPicture.bitmap.width; namePlatePicture.push(pPicture); } } //並び替え partsList.sort(function (a, b) { if (a.orderNo < b.orderNo) return -1; if (a.orderNo > b.orderNo) return 1; return 0; }); })(); //----------------------------------------------- // Window_Messageの機能追加 //----------------------------------------------- // 名前ラベルのテキストを取得 let nameLabelText = ''; var escapeNameLabel = function (nameText) { // 名前ラベルの描画 if (nameText != '') { nameLabelText = nameText; } return ''; }; var _Window_Message_initialize = Window_Message.prototype.initialize; Window_Message.prototype.initialize = function () { _Window_Message_initialize.call(this); this._snhNameLabelList = []; } var _Window_Message_startMessage = Window_Message.prototype.startMessage; Window_Message.prototype.startMessage = function () { _Window_Message_startMessage.call(this); //制御文字の除去 if (this._textState) { this._textState.text = this._textState.text.replace(/\x1bNL\<(.*?)\>/gi, function () { return escapeNameLabel(arguments[1]); }, this); if (nameLabelText != '') { this.snhDrawNameLabel(); } } }; var _Window_Message_terminateMessage = Window_Message.prototype.terminateMessage; Window_Message.prototype.terminateMessage = function () { _Window_Message_terminateMessage.call(this); //ラベルの除去 this.snhRemoveNameLabel(); }; //メイン処理 Window_Message.prototype.snhDrawNameLabel = function () { let spriteBase = new Sprite(); let nameBitmap = new Bitmap(0, 0); let nameSprite = new Sprite(); let cSize = nameBitmap.measureTextWidth('幅'); let nameWidth = nameBitmap.measureTextWidth(nameLabelText); let scene = SceneManager._scene; //位置調整 let startX = nameLabelChoseiX; let startY = nameLabelChoseiY; spriteBase.move(startX, startY); //文字の設定 nameBitmap.fontSize = nameLabelFontSize; nameBitmap.textColor = scene._messageWindow.textColor(nameLabelFontColor); nameBitmap.outlineColor = scene._messageWindow.textColor(nameLabelFontOutLineColor); //ネームプレートがない時は終わり let wNamePlate = namePlate[0]; if (!wNamePlate) { return; } let height = wNamePlate.height; let width = wNamePlate.width; //ネームプレートを設定 let namePlateSprite = new Sprite(); if (width > 0) { namePlateSprite.bitmap = wNamePlate.bitmap; spriteBase.addChild(namePlateSprite); } else { //描画 width = nameWidth + wNamePlate.paddingX * 2; let namePlateBitmap = new Bitmap(width, wNamePlate.height); namePlateSprite.bitmap = namePlateBitmap; namePlateSprite.rotation = wNamePlate.rotation * Math.PI / 180; if (wNamePlate.gradationMode) { namePlateBitmap.gradientFillRect(0, 0, width, wNamePlate.height , 'rgba(' + wNamePlate.color1.red + ',' + wNamePlate.color1.green + ',' + wNamePlate.color1.blue + ',' + wNamePlate.color1.opacity + ')' , 'rgba(' + wNamePlate.color2.red + ',' + wNamePlate.color2.green + ',' + wNamePlate.color2.blue + ',' + wNamePlate.color2.opacity + ')' , wNamePlate.gradationVertical); } else { namePlateBitmap.fillRect(0, 0, width, wNamePlate.height , 'rgba(' + wNamePlate.color1.red + ',' + wNamePlate.color1.green + ',' + wNamePlate.color1.blue + ',' + wNamePlate.color1.opacity + ')'); } spriteBase.addChild(namePlateSprite); } //ネームプレート画像 if (namePlatePicture && namePlatePicture.length > 0) { namePlatePicture[0] let platePictureSprite = new Sprite(); platePictureSprite.bitmap = namePlatePicture[0].bitmap; if (!nameAutoMode && namePlatePicture[0].autoScaleMode) { if (namePlatePictureWidth === 0) { namePlatePictureWidth = namePlatePicture[0].width; } width = nameWidth + wNamePlate.paddingX * 2; platePictureSprite.scale.x = width / namePlatePictureWidth; } platePictureSprite.move(namePlatePicture[0].positionX, namePlatePicture[0].positionY); spriteBase.addChild(platePictureSprite); } //名前の描画の準備 let yChosei = 0; //プレートの高さが十分な時 if (nameLabelFontSize < wNamePlate.height - wNamePlate.paddingY * 2) { let wHeight = wNamePlate.height - wNamePlate.paddingY; if (nameLabelAlignY === 'up') { yChosei = wNamePlate.paddingY; } else if (nameLabelAlignY === 'center') { yChosei = wNamePlate.paddingY + (wHeight - wNamePlate.paddingY - nameLabelFontSize) / 2; } else if (nameLabelAlignY === 'down') { yChosei = wNamePlate.paddingY + (wHeight - nameLabelFontSize - wNamePlate.paddingY); } } else { yChosei = wNamePlate.paddingY; } if (nameAutoMode && wNamePlate.width > 0) { width -= wNamePlate.paddingX * 2; } else { width = nameWidth; } nameBitmap.resize(width, cSize); nameSprite.bitmap = nameBitmap; let drawNameFinish = false; nameSprite.move(wNamePlate.paddingX, yChosei); //パーツと名前の描画 if (partsList.length > 0) { for (let parts of partsList) { if (nameLabelOrderNo < parts.orderNo && !drawNameFinish) { spriteBase.addChild(this.snhDrawingName(nameSprite, width, cSize)); drawNameFinish = true; } let sprite = new Sprite(parts.bitmap); sprite.move(parts.positionX, parts.positionY); if (parts.type === 'rect') { sprite.rotation = parts.rotation * Math.PI / 180; } else if (parts.type === 'picture') { sprite.opacity = parts.opacity; sprite.rotation = parts.rotation * Math.PI / 180; sprite.scale.x = parts.scaleX; sprite.scale.y = parts.scaleY; } spriteBase.addChild(sprite); } } if (!drawNameFinish) { spriteBase.addChild(this.snhDrawingName(nameSprite, width, cSize)); } this.snhSetNameLabelSprite(spriteBase); }; // 名前を描画して返す Window_Message.prototype.snhDrawingName = function (sprite, width, height) { sprite.bitmap.drawText(nameLabelText, 0, 0, width, height, nameLabelAlignX); return sprite; } // スプライトの登録 Window_Message.prototype.snhSetNameLabelSprite = function (sprite) { this.addChild(sprite); //実際に入るスプライトは1件なのでリストに入れる必要はないですが、作る時に紆余曲折あり、その名残です。 this._snhNameLabelList.push(sprite); } //名前ラベルの除去 Window_Message.prototype.snhRemoveNameLabel = function () { if (this._snhNameLabelList && this._snhNameLabelList.length > 0) { for (let label of this._snhNameLabelList) { this.removeChild(label); } } this._snhNameLabelList = []; nameLabelText = ''; }; })();
dazed/translations
www/js/plugins/SNH_MsgNameLabel.js
JavaScript
unknown
32,541
/*============================================================================ _SentenceExtractor.js ---------------------------------------------------------------------------- (C)2020 kiki This software is released under the MIT License. http://opensource.org/licenses/mit-license.php ---------------------------------------------------------------------------- [Blog] : http://sctibacromn.hatenablog.com/ ============================================================================*/ /*:ja * @plugindesc ツクールmv内の文章と選択肢を全て出力し、csv形式で保存する。 * @author kiki * @version 1.00 * * @help */ function SentenceData() { throw new Error("This is a static class"); } (function () { var Sentence = {}; Sentence.Param = PluginManager.parameters('SentenceExtractor'); const DIR_NAME = "文章出力"; const SENTENCE_TYPE_NUM = 0; const CHOICE_TYPE_NUM = 1; Sentence.saveMapFileNames = ["マップ文章", "マップ選択肢"]; Sentence.saveComFileNames = ["コモン文章", "コモン選択肢"]; Sentence.saveMapName = "マップ名" const _Scene_Boot_start = Scene_Boot.prototype.start; Scene_Boot.prototype.start = function () { _Scene_Boot_start.call(this); SentenceData.start(); }; SentenceData.start = function () { if (!Utils.isNwjs()) { return; } let path = require('path'); this._fs = require('fs'); this._projectFilePath = path.dirname(process.mainModule.filename); let mapInfo = this._fs.readFileSync(this._projectFilePath + '/data/MapInfos.json'); this._jsonMapData = JSON.parse(mapInfo); this.makeDir(); this.writeMapSentence(SENTENCE_TYPE_NUM); this.writeMapSentence(CHOICE_TYPE_NUM); this.writeCommonSentence(SENTENCE_TYPE_NUM); this.writeCommonSentence(CHOICE_TYPE_NUM); this.writeMapNames(); }; SentenceData.makeDir = function () { let fs = this._fs; let dirPath = this._projectFilePath + "/" + DIR_NAME; if (!fs.existsSync(dirPath)) { fs.mkdirSync(dirPath); } }; SentenceData.writeMapNames = function () { let jsonMapData = this._jsonMapData; var dataStr = ""; for (i = 1; i < jsonMapData.length; i++) { if (jsonMapData[i] == null) continue; dataStr += '"' + jsonMapData[i].name + '"' + ':{"en":""},' + "\n"; } let saveFileName = Sentence.saveMapName; this.saveText(dataStr, saveFileName); }; SentenceData.saveText = function (dataStr, saveFileName) { // 後方「,改行」削除 dataStr = dataStr.replace(/\,\n$/g, ""); let saveFilePath = this._projectFilePath + "/" + DIR_NAME + "/" + saveFileName + ".txt"; this._fs.writeFileSync(saveFilePath, dataStr); }; SentenceData.writeMapSentence = function (typeNum) { let jsonMapData = this._jsonMapData; var dataStr = ""; for (i = 1; i < jsonMapData.length; i++) { if (jsonMapData[i] == null) continue; var filename = 'Map%1.json'.format(i.padZero(3)); let dataMapName = '/data/' + filename; let data = this._fs.readFileSync(this._projectFilePath + dataMapName); let jsonData = JSON.parse(data); let mapId = jsonMapData[i].id; dataStr += this.extractInMap(typeNum, mapId, jsonData); } // 空でも表示 // エラーじゃないことを示すため let saveFileName = Sentence.saveMapFileNames[typeNum]; this.saveCsv(dataStr, saveFileName); }; SentenceData.extractInMap = function (typeNum, mapId, jsonData) { var dataStr = ""; for (n = 1; n < jsonData.events.length; n++) { let event = jsonData.events[n]; if (event == null) continue; let extracted = ""; switch (typeNum) { case 0: extracted = this.serifInMap(event, mapId); break; case 1: extracted = this.choicesInMap(event); break; } if (extracted != "") { dataStr += extracted; } } return dataStr; }; SentenceData.saveCsv = function (dataStr, saveFileName) { let saveFilePath = this._projectFilePath + "/" + DIR_NAME + "/" + saveFileName + ".csv"; let fs = this._fs; if (dataStr == "") { fs.writeFileSync(saveFilePath, dataStr); } else { // bom付きじゃないとエクセル表示で文字化けするため、追加 fs.writeFileSync(saveFilePath, '\uFEFF'); fs.appendFile(saveFilePath, dataStr); } }; SentenceData.serifInMap = function (event, mapId) { var serifInMap = ""; for (m = 0; m < event.pages.length; m++) { let page = event.pages[m]; let l = 0; let list = page.list; while (list[l]) { var oneSerif = ""; //一イベントコマンドにある文章を抽出 while (this.nextEventCode(list, l) === 401) { l++; oneSerif += list[l].parameters[0] + "\n"; } if (oneSerif != "") { // 後方改行削除 oneSerif = oneSerif.replace(/\r?\n$/g, ""); oneSerif = '"' + oneSerif + '"'; // マップID,イベントIDを文章の前に接頭文字で入れる let prefix = String(mapId) + "," + String(event.id) + ","; oneSerif = prefix + oneSerif; serifInMap += oneSerif + "\n"; } l++; } } return serifInMap; }; SentenceData.choicesInMap = function (event) { var choicesInMap = ""; for (let i = 0; i < event.pages.length; i++) { let page = event.pages[i]; for (let i = 0; i < page.list.length; i++) { let command = page.list[i]; if (command.code == 402) { choicesInMap += command.parameters[1] + '\n'; } } } return choicesInMap; }; SentenceData.nextEventCode = function (list, l) { var command = list[l + 1]; if (command) { return command.code; } else { return 0; } }; SentenceData.writeCommonSentence = function (typeNum) { let fs = this._fs; var data = fs.readFileSync(this._projectFilePath + '/data/CommonEvents.json'); var jsonData = JSON.parse(data); var dataStr = ""; dataStr += this.extractInCommonEv(typeNum, jsonData); let saveFileName = Sentence.saveComFileNames[typeNum]; this.saveCsv(dataStr, saveFileName); }; SentenceData.extractInCommonEv = function (typeNum, jsonData) { var dataStr = ""; for (i = 1; i < jsonData.length; i++) { if (jsonData[i] == null) continue; commonId = jsonData[i].id; let list = jsonData[i].list; switch (typeNum) { case 0: dataStr += this.serifInCommonEv(list, commonId); break; case 1: dataStr += this.choicesInCommonEv(list); break; } } return dataStr; }; SentenceData.serifInCommonEv = function (list, commonId) { var serIfInCommonEv = ""; let i = 0; while (list[i]) { var oneSerif = ""; //一イベントコマンドにある文章を抽出 while (this.nextEventCode(list, i) === 401) { i++; oneSerif += list[i].parameters[0] + "\n"; } if (oneSerif != "") { // 後方改行削除 oneSerif = oneSerif.replace(/\r?\n$/g, ""); oneSerif = '"' + oneSerif + '"'; // コモンイベントIDを文章の前に接頭文字で入れる let prefix = String(commonId) + ","; oneSerif = prefix + oneSerif; serIfInCommonEv += oneSerif + "\n"; } i++; } return serIfInCommonEv; }; SentenceData.choicesInCommonEv = function (list) { var choicesInCommon = ""; for (let i = 0; i < list.length; i++) { let command = list[i]; if (command.code == 402) { choicesInCommon += command.parameters[1] + '\n'; } } return choicesInCommon; }; })();
dazed/translations
www/js/plugins/SentenceExtractor.js
JavaScript
unknown
8,886
//============================================================================= // SimpleMsgSideView.js //============================================================================= /*: * @plugindesc at sideview battle, only display item/skill names. * @author Sasuke KANNAZUKI * * @param displayAttack * @desc Whether to display normal attack. 1:yes 0:no * @default 0 * * @param position * @desc Skill name display position. 0:left, 1:center * @default 1 * * @help This plugin does not provide plugin commands. * * By not displaying the log and only displaying the skill name, * the speed of battle will increase slightly. */ /*:ja * @plugindesc サイドビューバトルで技/アイテムの名前のみ表示します。 * @author 神無月サスケ * * @param displayAttack * @desc 通常攻撃も表示するか (1:する 0:しない) * @default 0 * * @param position * @desc 技名を表示する位置 (0:左寄せ, 1:中央) * @default 1 * * @help このプラグインには、プラグインコマンドはありません。 * * ログを表示せず、技名のみを表示することで、戦闘のテンポが若干高速になります。 */ (function () { var parameters = PluginManager.parameters('SimpleMsgSideView'); var displayAttack = Number(parameters['displayAttack']) != 0; var position = Number(parameters['position'] || 1); var _Window_BattleLog_addText = Window_BattleLog.prototype.addText; Window_BattleLog.prototype.addText = function (text) { if ($gameSystem.isSideView()) { this.refresh(); this.wait(); return; // not display battle log } _Window_BattleLog_addText.call(this, text); }; // for sideview battle only Window_BattleLog.prototype.addItemNameText = function (itemName) { this._lines.push(itemName); this.refresh(); this.wait(); }; var _Window_BattleLog_displayAction = Window_BattleLog.prototype.displayAction; Window_BattleLog.prototype.displayAction = function (subject, item) { if ($gameSystem.isSideView()) { if (displayAttack || !(DataManager.isSkill(item) && item.id == subject.attackSkillId())) { this.push('addItemNameText', item.name); // display item/skill name } else { this.push('wait'); } return; } _Window_BattleLog_displayAction.call(this, subject, item); }; // to put skill/item name at center var _Window_BattleLog_drawLineText = Window_BattleLog.prototype.drawLineText; Window_BattleLog.prototype.drawLineText = function (index) { if ($gameSystem.isSideView() && position == 1) { var rect = this.itemRectForText(index); this.contents.clearRect(rect.x, rect.y, rect.width, rect.height); this.drawText(this._lines[index], rect.x, rect.y, rect.width, 'center'); return; } _Window_BattleLog_drawLineText.call(this, index); }; })();
dazed/translations
www/js/plugins/SimpleMsgSideView.js
JavaScript
unknown
2,917
//============================================================================= // Skittle.js //============================================================================= /*:ja * v0.1.0 * @plugindesc * 自作ゲージのメーターを増減する * * @author オオホタルサイコ * * @param Container * @default * @desc 容器(img/system) * * @param Content * @default * @desc 容量(img/system) * * @param Capacity * @default 100 * @desc 最大値 * * @param Default * @default 100 * @desc 開始値 * * @param Variable * @default 1 * @desc 容量値格納先変数番号 * * @param Visible * @default true * @desc 表示状態 * * @param Location * @default 0 0 * @desc 座標[X Y]を設定 * * @param Size * @default 100 100 * @desc 画像のサイズ[Width Height]を設定 * * @param Margin * @default 0 0 * @desc 中身の余白(上下)[MarginTop MarginBottom]を指定 * * @help ■概要 * Skittleプラグインを利用するにはプラグインコマンドから実行します。 * プラグインコマンドを実行するとイベント内でメーターの増減、表示を行います。 * * ■プラグインコマンド * Skittle add [増減値] # ゲージの増減を行う * Skittle visivle [表示状態] # ゲージの表示状態を制御 */ /* * 共通処理系 */ var parseIntStrict = function (value) { var result = parseInt(value, 10); if (isNaN(result)) result = 0; return result; }; /* * 中身 */ var Content = (function () { // クラス変数 var sprite = null; // コンストラクタ var Content = function (skittle, location, size, parameters) { if (!(this instanceof Content)) { return new Content(skittle, fileName, location, size, margin); } this.skittle = skittle; this.size = size; this.remains = 0; var fileName = parameters['Content'] || ''; this.margin = parameters['Margin'].split(' ').map(s => parseIntStrict(s)); this.variable = parseIntStrict(parameters['Variable']) || 0; this.LoadSprite(fileName, location, size); this.ReflectsRemainigHeight(); } // プロトタイプ内でメソッドを定義 Content.prototype.LoadSprite = function (fileName, location, size) { sprite = new Sprite(); sprite.bitmap = ImageManager.loadSystem(fileName); sprite.x = location[0] + size[0]; sprite.y = location[1] + size[1]; sprite.rotation = 180 * Math.PI / 180; } Content.prototype.Scale = function () { // 純粋な画像部分の高さ / ゲージの最大量 return (this.size[1] - this.margin[0] - this.margin[1]) / this.skittle.Capacity; } Content.prototype.RemainingHeight = function () { // 余白下を差し引いて画像の表示幅を調整 return this.remains * this.Scale() - this.margin[1]; } Content.prototype.Sprite = function () { return sprite; } Content.prototype.getX = function () { return this.Sprite().x; } Content.prototype.getY = function () { return this.Sprite().y; } Content.prototype.ReflectsRemainigHeight = function () { this.Sprite().setFrame(0, 0, this.size[0], this.RemainingHeight()); } Content.prototype.setValue = function (value) { this.remains += value; if (this.remains < 0) this.remains = 0; if (this.remains > this.skittle.Capacity) this.remains = this.skittle.Capacity; this.ReflectsRemainigHeight(); $gameVariables.setValue(this.variable, this.remains); } return Content; })(); /* *本体 */ var Skittle = (function () { // クラス内変数 var parameters = null; // コンストラクタ var Skittle = function () { if (!(this instanceof Skittle)) { return new Skittle(); } this.isFirst = true; this.IsDisp = true; this.startAnimetion = false; this.animeContents = ''; this.addContent = 0; this.initialize(); } Skittle.prototype.clearValue = function () { this.clearAnimetion(); this.addContent = 0; } Skittle.prototype.clearAnimetion = function () { this.animeContents = ''; this.startAnimetion = false; }; // プロトタイプ内でメソッドを定義 Skittle.prototype.initialize = function () { parameters = PluginManager.parameters('Skittle'); var container = parameters['Container'] || ''; var location = parameters['Location'].split(' ').map(s => parseIntStrict(s)); var size = parameters['Size'].split(' ').map(s => parseIntStrict(s)); this.IsDisp = eval(parameters['Visible']); this.Displyed = !this.IsDisp; this.Capacity = parseIntStrict(parameters['Capacity']) || 0; // 中身の描画 this.content = new Content(this, location, size, parameters); this.content.setValue(parseIntStrict(parameters['Default']) || 0); // 容器の描画 this.LoadSprite(container, location); this.clearValue(); } Skittle.prototype.LoadSprite = function (fileName, location) { sprite = new Sprite(); sprite.bitmap = ImageManager.loadSystem(fileName); sprite.x = location[0]; sprite.y = location[1]; } Skittle.prototype.Sprite = function () { return sprite; } Skittle.prototype.setParameter = function (args) { //parse if (args.length < 2) { throw new SyntaxError("setParameter: args is invalid."); } this.animeContents = args[0]; if (args[0] == 'visible') { this.IsDisp = eval(args[1]); } else { this.addContent = parseIntStrict(args[1]); this.startAnimetion = true; } return true; }; Skittle.prototype.update = function () { if (this.startAnimetion) { if (this.animeContents == 'add') { //ゲージのアニメーションを行う if (this.addContent > 0) { var add = 1; this.addContent -= add; this.content.setValue(add); } else if (this.addContent < 0) { var add = -1 this.addContent -= add; this.content.setValue(add); } else { this.startAnimetion = false; } } } return true; }; return Skittle; })(); // グローバル変数 var $skittle = null; /* * インスタンスの生成 * プラグイン実行 * セーブデータの保存・読み込み * メーターの表示制御 */ (function () { //----------------------------------------------------------------------------- // インスタンスの生成(ゲーム起動時に呼ばれる) //----------------------------------------------------------------------------- var createGameObjects = DataManager.createGameObjects; DataManager.createGameObjects = function () { createGameObjects.call(this); // ゲージの作成 $skittle = new Skittle(); }; //----------------------------------------------------------------------------- // プラグイン実行 //----------------------------------------------------------------------------- var _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand; Game_Interpreter.prototype.pluginCommand = function (command, args) { _Game_Interpreter_pluginCommand.call(this, command, args); if (command === 'Skittle') { switch (args[0]) { case 'add': case 'visible': //増減したい値を設定したい //表示するかの設定をしたい if ($skittle.startAnimetion) return; $skittle.setParameter(args); break; default: break; } } }; //----------------------------------------------------------------------------- // セーブデータの生成 //----------------------------------------------------------------------------- var makeSaveContents = DataManager.makeSaveContents; DataManager.makeSaveContents = function () { // セーブデータ本体 var contents = makeSaveContents.call(this); // ゲージをセーブデータに設定する。 contents.skittle = $skittle; return contents; }; //----------------------------------------------------------------------------- // セーブデータの読み込み //----------------------------------------------------------------------------- var extractSaveContents = DataManager.extractSaveContents; DataManager.extractSaveContents = function (contents) { // セーブデータ本体を取得 extractSaveContents.call(this, contents); // Skittleを読み込み $skittle = contents.skittle; $skittle.content.ReflectsRemainigHeight(); }; //----------------------------------------------------------------------------- // メーターの表示制御 // 画像の表示・非表示は子の追加・削除で対応 //----------------------------------------------------------------------------- var _Spriteset_Map = Spriteset_Map.prototype.update; Spriteset_Map.prototype.update = function () { _Spriteset_Map.call(this); $skittle.update(); // ゲージが表示状態になっていない場合で表示フラグがONの場合に表示 if ($skittle != null && $skittle.IsDisp) { $skittle.Displyed = true; this.addChild($skittle.content.Sprite()); this.addChild($skittle.Sprite()); } // ゲージが非表示状態になっていない場合で表示フラグがOFFの場合に表示 else if ($skittle != null && !$skittle.IsDisp) { $skittle.Displyed = false; this.removeChild($skittle.content.Sprite()); this.removeChild($skittle.Sprite()); } }; })();
dazed/translations
www/js/plugins/Skittle.js
JavaScript
unknown
10,409
//============================================================================= // SwitchOnWithLevelUp.js //============================================================================= /*: * @plugindesc レベルアップ時に、指定したスイッチをONにします。 * @author 奏ねこま(おとぶきねこま) * * @param Switch ID * @desc レベルアップ時にONにするスイッチのIDを指定してください。 * @default 0 * * @param Variable ID for Actor ID * @desc レベルアップしたアクターのIDを格納する変数のIDを指定してください。 * @default 0 * * @help * レベルアップ時に、指定したスイッチをONにしますが、自動でOFFにはしません。 * 同スイッチをトリガーにしたコモンイベント等でOFFにしてください。 * * バトル終了時のリザルトでのレベルアップではスイッチはONになりません。 * * レベルアップしたアクターのIDを変数に格納する機能を有していますが、そのアクターID * を使って何ができるかという説明はここでは割愛します。 * ざっくり言うと、スクリプトを使っていろいろなアクター情報を取得できたりします。 * 複数のアクターが同時にレベルアップした場合に、どのアクターのIDが格納されるかは * 保証できませんので、予めご了承ください。 * * *このプラグインには、プラグインコマンドはありません。 * * [ 利用規約 ] ................................................................... * 本プラグインの利用者は、RPGツクールMV/RPGMakerMVの正規ユーザーに限られます。 * 商用、非商用、ゲームの内容(年齢制限など)を問わず利用可能です。 * ゲームへの利用の際、報告や出典元の記載等は必須ではありません。 * 二次配布や転載、ソースコードURLやダウンロードURLへの直接リンクは禁止します。 * (プラグインを利用したゲームに同梱する形での結果的な配布はOKです) * 不具合対応以外のサポートやリクエストは受け付けておりません。 * 本プラグインにより生じたいかなる問題においても、一切の責任を負いかねます。 * [ 改訂履歴 ] ................................................................... * Version 1.00 2016/07/06 初版 * -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * Web Site: http://i.gmobb.jp/nekoma/rpg_tkool/ * Twitter : https://twitter.com/koma_neko */ (function () { 'use strict'; const _PNAME = 'SwitchOnWithLevelUp'; const _PARAMETERS = PluginManager.parameters(_PNAME); const _SWITCH_ID = +_PARAMETERS['Switch ID'] || 0; const _VARIABLE_ID = +_PARAMETERS['Variable ID for Actor ID'] || 0; var _Game_Actor_levelUp = Game_Actor.prototype.levelUp; Game_Actor.prototype.levelUp = function () { _Game_Actor_levelUp.call(this); if (!$gameParty.inBattle() && _SWITCH_ID) { $gameSwitches.setValue(_SWITCH_ID, true); } if (_VARIABLE_ID) { $gameVariables.setValue(_VARIABLE_ID, this.actorId()); } }; }());
dazed/translations
www/js/plugins/SwitchOnWithLevelUp.js
JavaScript
unknown
3,329
//============================================================================= // TMPlugin - ログウィンドウ // バージョン: 1.1.1 // 最終更新日: 2019/03/11 // 配布元 : https://hikimoki.sakura.ne.jp/ //----------------------------------------------------------------------------- // Copyright (c) 2017 tomoaky // Released under the MIT license. // http://opensource.org/licenses/mit-license.php //============================================================================= /*: * @plugindesc マップシーンにログウィンドウを表示します。 * * @author tomoaky (https://hikimoki.sakura.ne.jp/) * * @param logWindowX * @type number * @min -1000 * @desc ログウィンドウの X 座標。 * 初期値: 0 * @default 0 * * @param logWindowY * @type number * @min -1000 * @desc ログウィンドウの Y 座標。 * 初期値: 460 * @default 460 * * @param logWindowWidth * @type number * @desc ログウィンドウの幅。 * 初期値: 480 * @default 480 * * @param lines * @type number * @desc ログウィンドウの行数。 * 初期値: 6 * @default 6 * * @param lineHeight * @type number * @desc ログウィンドウの1行の高さ。 * 初期値: 24 * @default 24 * * @param padding * @type number * @desc ログウィンドウの余白の大きさ。 * 初期値: 10 * @default 10 * * @param fontSize * @type number * @desc ログウィンドウのフォントサイズ。 * 初期値: 20 * @default 20 * * @param startVisible * @type boolean * @desc ゲーム開始時の表示状態。 * 初期値: ON( true = ON 表示 / false = OFF 非表示 ) * @default true * * @param opacity * @type number * @max 255 * @desc ウィンドウフレームと背景の不透明度。 * 初期値: 255 ( 0 ~ 255 ) * @default 255 * * @param collideOpacity * @type number * @max 255 * @desc プレイヤーと重なったときの不透明度。 * 初期値: 128( 0 ~ 255 ) * @default 128 * * @param messageBusyHide * @type boolean * @desc メッセージウィンドウ表示中はログウィンドウを隠す。 * 初期値: ON( true = ON 隠す / false = OFF 隠さない ) * @default true * * @param eventBusyHide * @type boolean * @desc イベント起動中はログウィンドウを隠す。 * 初期値: ON( true = ON 隠す / false = OFF 隠さない ) * @default true * * @param maxLogs * @type number * @desc 保存するログの最大行数。 * 初期値: 30 * @default 30 * * @param autoDelete * @type variable * @desc 指定したゲーム変数に代入された値の間隔で、自動的にテキストを * 削除する。単位はフレーム数( 60フレーム = 1秒 ) * @default 0 * * @help * TMPlugin - ログウィンドウ ver1.1.1 * * 使い方: * * プラグインを導入するとマップシーンにログウィンドウが追加されます。 * プラグインコマンドを使って手動で書き込むか、転記モードで * 自動的に書き込むことでログウィンドウにテキストを表示できます。 * * このプラグインは RPGツクールMV Version 1.6.1 で動作確認をしています。 * * このプラグインはMITライセンスのもとに配布しています、商用利用、 * 改造、再配布など、自由にお使いいただけます。 * * * プラグインコマンド: * * showLogWindow * ログウィンドウを表示する。 * * hideLogWindow * ログウィンドウを隠す。 * * addLog テキスト * テキストをログウィンドウに追加する。 * 一部の制御文字も使えます(\V[n], \N[n], \P[n], \G, \C[n]) * * deleteLog * 一番古いテキストをひとつ削除する。 * * startMirrorLogWindow * イベントコマンド『文章の表示』をトレースする転記モードを有効化。 * * stopMirrorLogWindow * startMirrorLogWindow で有効化した機能を無効化します。 * * startAutoLogWindow * 『TMJumpAction.js』などの対応プラグインと併用した場合に * 敵撃破時の報酬情報を自動でログに追記する機能を有効化します。 * この機能はゲーム開始時には自動的にオンになっています。 * * stopAutoLogWindow * startAutoLogWindow で有効化した機能を無効化します。 * * openLogScene * ログ確認シーンへ移行します。 * * * プラグインパラメータ補足: * * padding * テキストの表示領域とウィンドウフレーム外側までのドット数です。 * ウィンドウの高さ(縦方向の大きさ)は以下の式で算出されます。 * 1行の高さ(lineHeight) * 行数(lines) + 余白(padding) * 2 * 画面の下部ぴったりにウィンドウを表示したい場合は縦方向の * 画面サイズから上記の式の結果を引いた値を logWindowY に * 設定してください。 * * collideOpacity * opacity よりも大きい値を設定した場合、ログの内容には * collideOpacity を適用し、ウィンドウフレームと背景には * opacity を適用します。 * * autoDelete * 指定したゲーム変数の値が 0 の場合は、自動削除の機能が * 停止します。 */ var Imported = Imported || {}; Imported.TMLogWindow = true; (function () { parameters = PluginManager.parameters('TMLogWindow'); logWindowX = +(parameters['logWindowX'] || 0); logWindowY = +(parameters['logWindowY'] || 464); logWindowWidth = +(parameters['logWindowWidth'] || 480); logWindowLines = +(parameters['lines'] || 6); logWindowLineHeight = +(parameters['lineHeight'] || 24); logWindowPadding = +(parameters['padding'] || 10); logWindowFontSize = +(parameters['fontSize'] || 20); logWindowStartVisible = JSON.parse(parameters['startVisible']); logWindowOpacity = +(parameters['opacity'] || 255); logWindowCollideOpacity = +(parameters['collideOpacity'] || 128); logWindowMessageBusyHide = JSON.parse(parameters['messageBusyHide']); logWindowEventBusyHide = JSON.parse(parameters['eventBusyHide']); logWindowMaxLogs = +(parameters['maxLogs'] || 20); logWindowAutoDelete = +(parameters['autoDelete'] || 0); //----------------------------------------------------------------------------- // Game_Temp // Game_Temp.prototype.dummyWindow = function () { if (!this._dummyWindow) { this._dummyWindow = new Window_Base(0, 0, 64, 64); } return this._dummyWindow; }; //----------------------------------------------------------------------------- // Game_System // var _Game_System_initialize = Game_System.prototype.initialize; Game_System.prototype.initialize = function () { _Game_System_initialize.call(this); this._visibleLogWindow = logWindowStartVisible; this._mirrorLogWindow = false; this._autoLogWindow = true; this._actionLog = []; }; Game_System.prototype.isVisibleLogWindow = function () { return this._visibleLogWindow; }; Game_System.prototype.isMirrorLogWindow = function () { return this._mirrorLogWindow; }; Game_System.prototype.isAutoLogWindow = function () { return this._autoLogWindow; }; Game_System.prototype.setVisibleLogWindow = function (visible) { this._visibleLogWindow = visible; }; Game_System.prototype.setMirrorMode = function (flag) { this._mirrorLogWindow = flag; }; Game_System.prototype.setAutoMode = function (flag) { this._autoLogWindow = flag; }; Game_System.prototype.addLog = function (text) { text = $gameTemp.dummyWindow().convertEscapeCharacters(text); this._actionLog.push(text); if (this._actionLog.length > logWindowMaxLogs) { this._actionLog.shift(); } this._needsActionLogRefresh = true; }; Game_System.prototype.deleteLog = function () { if (this._actionLog.length > 0) { this._actionLog.shift(); this._needsActionLogRefresh = true; } }; Game_System.prototype.actionLog = function () { return this._actionLog; }; //----------------------------------------------------------------------------- // Game_Message // var _Game_Message_add = Game_Message.prototype.add; Game_Message.prototype.add = function (text) { _Game_Message_add.call(this, text); if ($gameSystem.isMirrorLogWindow()) { $gameSystem.addLog(text); } }; //----------------------------------------------------------------------------- // Game_Actor // // レベルアップの表示 var _Game_Actor_displayLevelUp = Game_Actor.prototype.displayLevelUp; Game_Actor.prototype.displayLevelUp = function (newSkills) { _Game_Actor_displayLevelUp.call(this, newSkills); if ($gameSystem.isAutoLogWindow() && !$gameParty.inBattle()) { var text = TextManager.levelUp.format(this._name, TextManager.level, this._level); $gameSystem.addLog(text); } }; //----------------------------------------------------------------------------- // Game_Event // var _Game_Event_gainRewards = Game_Event.prototype.gainRewards; Game_Event.prototype.gainRewards = function () { if ($gameSystem.isAutoLogWindow()) { var battler = this.battler(); var exp = battler.exp(); var gold = battler.gold(); var text = battler.name() + $dataStates[battler.deathStateId()].message2; var rewardText = ''; if (exp > 0) { rewardText += '' + exp + '\\C[16]' + TextManager.expA + '\\C[0]'; } if (gold > 0) { if (exp > 0) { rewardText += ' / '; } rewardText += '' + gold + '\\C[16]' + TextManager.currencyUnit + '\\C[0]'; } if (rewardText) { text += ' ( ' + rewardText + ' )'; } $gameSystem.addLog(text) } _Game_Event_gainRewards.call(this); }; var _Game_Event_gainRewardItem = Game_Event.prototype.gainRewardItem; Game_Event.prototype.gainRewardItem = function (item, y) { _Game_Event_gainRewardItem.call(this, item, y); if ($gameSystem.isAutoLogWindow()) { var text = TextManager.obtainItem.format(item.name); $gameSystem.addLog(text); } }; //----------------------------------------------------------------------------- // Game_Interpreter // // プラグインコマンド var _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand; Game_Interpreter.prototype.pluginCommand = function (command, args) { _Game_Interpreter_pluginCommand.call(this, command, args); if (command === 'showLogWindow') { $gameSystem.setVisibleLogWindow(true); } else if (command === 'hideLogWindow') { $gameSystem.setVisibleLogWindow(false); } else if (command === 'addLog') { $gameSystem.addLog(args[0]); } else if (command === 'deleteLog') { $gameSystem.deleteLog(); } else if (command === 'startMirrorLogWindow') { $gameSystem.setMirrorMode(true); } else if (command === 'stopMirrorLogWindow') { $gameSystem.setMirrorMode(false); } else if (command === 'startAutoLogWindow') { $gameSystem.setAutoMode(true); } else if (command === 'stopAutoLogWindow') { $gameSystem.setAutoMode(false); } else if (command === 'openLogScene') { SceneManager.push(Scene_Log); } }; //----------------------------------------------------------------------------- // Window_MapLog // function Window_MapLog() { this.initialize.apply(this, arguments); } Window_MapLog.prototype = Object.create(Window_Base.prototype); Window_MapLog.prototype.constructor = Window_MapLog; Window_MapLog.prototype.initialize = function () { var x = logWindowX; var y = logWindowY; var wight = this.windowWidth(); var height = this.windowHeight(); Window_Base.prototype.initialize.call(this, x, y, wight, height); this.openness = $gameSystem.isVisibleLogWindow() ? 255 : 0; this.opacity = 255; this.contentsOpacity = 255; this._hideCount = 0; this._autoDeleteCount = 0; this.refresh(); }; Window_MapLog.prototype.standardFontSize = function () { return logWindowFontSize; }; // ウィンドウの幅を取得 Window_MapLog.prototype.windowWidth = function () { return logWindowWidth; }; // ウィンドウの高さを取得 Window_MapLog.prototype.windowHeight = function () { return this.fittingHeight(logWindowLines); }; // 標準パディングを取得 Window_MapLog.prototype.standardPadding = function () { return logWindowPadding; }; // ウィンドウの1行の高さを取得 Window_MapLog.prototype.lineHeight = function () { return logWindowLineHeight; }; // フレーム更新 Window_MapLog.prototype.update = function () { Window_Base.prototype.update.call(this); if (logWindowAutoDelete > 0) { var maxCount = $gameVariables.value(logWindowAutoDelete); if (maxCount > 0) { var actionLog = $gameSystem.actionLog(); if (actionLog.length > 0) { this._autoDeleteCount++; } if (this._autoDeleteCount >= maxCount) { $gameSystem.deleteLog(); this._autoDeleteCount = 0; } } } if (this.updateVisibility()) { this.open(); if ($gameSystem._needsActionLogRefresh) { this.refresh(); $gameSystem._needsActionLogRefresh = false; } this.updateOpacity(); } else { this.close(); } }; // ウィンドウ表示状態の更新 Window_MapLog.prototype.updateVisibility = function () { if (!$gameSystem.isVisibleLogWindow()) { return false; } if ((logWindowEventBusyHide && $gameMap.isEventRunning()) || (logWindowMessageBusyHide && $gameMessage.isBusy())) { this._hideCount++; } else { this._hideCount = 0; } return this._hideCount < 10; }; // 不透明度の更新 Window_MapLog.prototype.updateOpacity = function () { if (this.x < $gamePlayer.screenX() + 24 && this.x + this.windowWidth() > $gamePlayer.screenX() - 24 && this.y < $gamePlayer.screenY() && this.y + this.windowHeight() > $gamePlayer.screenY() - 48) { this.opacity = Math.min(logWindowCollideOpacity, logWindowOpacity); this.contentsOpacity = logWindowCollideOpacity; } else { this.opacity = logWindowOpacity; this.contentsOpacity = 255; } }; // リフレッシュ Window_MapLog.prototype.refresh = function () { this.contents.clear(); var actionLog = $gameSystem.actionLog(); var lh = this.lineHeight(); var n = Math.min(logWindowLines, actionLog.length); for (var i = 0; i < n; i++) { this.drawTextEx(actionLog[actionLog.length - n + i], 0, lh * i); } }; //----------------------------------------------------------------------------- // Window_MenuLog // function Window_MenuLog() { this.initialize.apply(this, arguments); } Window_MenuLog.prototype = Object.create(Window_Selectable.prototype); Window_MenuLog.prototype.constructor = Window_MenuLog; Window_MenuLog.prototype.initialize = function () { Window_Selectable.prototype.initialize.call(this, 0, 0, Graphics.boxWidth, Graphics.boxHeight); this._data = $gameSystem.actionLog(); this.refresh(); this.select(Math.max(this._data.length - 1, 0)); this.activate(); }; Window_MenuLog.prototype.standardFontSize = function () { return logWindowFontSize; }; Window_MenuLog.prototype.standardPadding = function () { return logWindowPadding; }; Window_MenuLog.prototype.lineHeight = function () { return logWindowLineHeight; }; Window_MenuLog.prototype.maxItems = function () { return this._data ? this._data.length : 1; }; Window_MenuLog.prototype.item = function () { var index = this.index(); return this._data && index >= 0 ? this._data[index] : null; }; Window_MenuLog.prototype.drawItem = function (index) { var item = this._data[index]; if (item) { var rect = this.itemRectForText(index); this.drawTextEx(item, 0, rect.y); } }; //----------------------------------------------------------------------------- // Scene_Map // var _Scene_Map_createDisplayObjects = Scene_Map.prototype.createDisplayObjects; Scene_Map.prototype.createDisplayObjects = function () { _Scene_Map_createDisplayObjects.call(this); this.createMapLogWindow(); }; // ログウィンドウの作成 Scene_Map.prototype.createMapLogWindow = function () { this._mapLogWindow = new Window_MapLog(); this.addChild(this._mapLogWindow); }; var _Scene_Map_terminate = Scene_Map.prototype.terminate; Scene_Map.prototype.terminate = function () { if (!SceneManager.isNextScene(Scene_Battle)) { this._mapLogWindow.hide(); } _Scene_Map_terminate.call(this); }; var _Scene_Map_launchBattle = Scene_Map.prototype.launchBattle; Scene_Map.prototype.launchBattle = function () { this._mapLogWindow.hide(); this.removeChild(this._mapLogWindow); this._mapLogWindow = null; _Scene_Map_launchBattle.call(this); }; //----------------------------------------------------------------------------- // Scene_Log // function Scene_Log() { this.initialize.apply(this, arguments); } Scene_Log.prototype = Object.create(Scene_MenuBase.prototype); Scene_Log.prototype.constructor = Scene_Log; Scene_Log.prototype.initialize = function () { Scene_MenuBase.prototype.initialize.call(this); }; Scene_Log.prototype.create = function () { Scene_MenuBase.prototype.create.call(this); this.createCreditsWindow(); }; Scene_Log.prototype.createCreditsWindow = function () { this._logWindow = new Window_MenuLog(); this._logWindow.setHandler('ok', this.popScene.bind(this)); this._logWindow.setHandler('cancel', this.popScene.bind(this)); this.addWindow(this._logWindow); }; })();
dazed/translations
www/js/plugins/TMLogWindow.js
JavaScript
unknown
17,488
//============================================================================= // TMPlugin - マップHPゲージ // バージョン: 1.4.4 // 最終更新日: 2019/11/04 // 配布元  : https://hikimoki.sakura.ne.jp/ //----------------------------------------------------------------------------- // Copyright (c) 2016 tomoaky // Released under the MIT license. // http://opensource.org/licenses/mit-license.php //============================================================================= /*: * @plugindesc マップシーンに顔グラフィックとHPゲージを表示します。 * 必要に応じてMPや変数などをゲージで表示することもできます。 * * @author tomoaky (https://hikimoki.sakura.ne.jp/) * * @param gaugeWindowX * @type number * @min -1000 * @desc HPゲージウィンドウのX座標 * 初期値: 0 * @default 0 * * @param gaugeWindowY * @type number * @min -1000 * @desc HPゲージウィンドウのY座標 * 初期値: 0 * @default 0 * * @param gaugeWindowWidth * @type number * @desc HPゲージウィンドウの幅 * 初期値: 288 * @default 288 * * @param gaugeWindowHeight * @type number * @desc HPゲージウィンドウの高さ * 初期値: 64 * @default 64 * * @param gaugeA * @type struct<Gauge> * @desc ゲージAのパラメータ * @default {"type":"HP","x":"12","y":"12","width":"144","height":"36","fontSize":"28","param":"0","max":"0","name":"AP","color":"#ff60c0 #ffa0e0"} * * @param gaugeB * @type struct<Gauge> * @desc ゲージBのパラメータ * @default {"type":"","x":"12","y":"12","width":"144","height":"36","fontSize":"28","param":"0","max":"0","name":"AP","color":"#ff60c0 #ffa0e0"} * * @param gaugeC * @type struct<Gauge> * @desc ゲージCのパラメータ * @default {"type":"","x":"12","y":"12","width":"144","height":"36","fontSize":"28","param":"0","max":"0","name":"AP","color":"#ff60c0 #ffa0e0"} * * @param gaugeD * @type struct<Gauge> * @desc ゲージDのパラメータ * @default {"type":"","x":"12","y":"12","width":"144","height":"36","fontSize":"28","param":"0","max":"0","name":"AP","color":"#ff60c0 #ffa0e0"} * * @param faceOffsetX * @type number * @min -1000 * @desc 顔グラフィックのX座標補正値 * 初期値: -4 ( -1000 で顔グラフィックを使用しない) * @default -4 * * @param faceOffsetY * @type number * @min -1000 * @desc 顔グラフィックのY座標補正値 * 初期値: -4 * @default -4 * * @param stateIconMax * @type number * @desc ステートアイコンを表示する個数 * 初期値: 4 * @default 4 * * @param stateIconX * @type number * @min -1000 * @desc ステートアイコンのX座標 * 初期値: 156 * @default 156 * * @param stateIconY * @type number * @min -1000 * @desc ステートアイコンのY座標 * 初期値: 24 * @default 24 * * @param stateIconScale * @type number * @desc ステートアイコンの拡大率( % ) * 初期値: 100 * @default 100 * * @param stateIconOpacity * @type number * @desc ステートアイコンの不透明度( 0 ~ 255 ) * 初期値: 255 * @default 255 * * @param goldWidth * @type number * @desc 所持金表示の幅 * 初期値: 0 ( 0 で非表示 ) * @default 0 * * @param goldX * @type number * @min -9999 * @desc 所持金表示のX座標 * 初期値: 12 * @default 12 * * @param goldY * @type number * @min -1000 * @desc 所持金表示のY座標 * 初期値: 12 * @default 12 * * @param vnMax * @type boolean * @desc ゲージタイプ VN の最大値を表示するかどうか * 初期値: OFF ( true = ON 表示 / false = OFF 非表示 ) * @default false * * @param shakeTime * @type number * @desc ダメージを受けたときにウィンドウを揺らす時間(フレーム) * 初期値: 20 ( 0 で揺らさない ) * @default 20 * * @param startVisible * @type boolean * @desc ゲーム開始時の表示状態 * 初期値: ON( true = ON 表示 / false = OFF 非表示 ) * @default true * * @param windowOpacity * @type number * @desc HPゲージウィンドウの不透明度 * 初期値: 255 * @default 255 * * @param collideOpacity * @type number * @max 255 * @desc プレイヤーと重なったときの不透明度 * 初期値: 128( 0 ~ 255 ) * @default 128 * * @param messageBusyHide * @type boolean * @desc メッセージウィンドウ表示中はHPゲージウィンドウを隠す * 初期値: ON ( true = ON 隠す / false = OFF 隠さない ) * @default true * * @param eventBusyHide * @type boolean * @desc イベント起動中はHPゲージウィンドウを隠す * 初期値: ON( true = ON 隠す / false = OFF 隠さない ) * @default true * * @param useBattleScene * @type boolean * @desc 戦闘シーンでもHPゲージウィンドウを表示する。 * 初期値: OFF( true = ON 表示 / false = OFF 非表示 ) * @default false * * @param gaugeWindowBattleX * @type number * @min -1000 * @desc 戦闘シーンのHPゲージウィンドウのX座標 * 初期値: 0 * @default 0 * * @param gaugeWindowBattleY * @type number * @min -1000 * @desc 戦闘シーンのHPゲージウィンドウのY座標 * 初期値: 0 * @default 0 * * @help * TMPlugin - マップHPゲージ ver1.4.4 * * 使い方: * * プラグインパラメータをいじってお好みのHPゲージを表示してください。 * * このプラグインは RPGツクールMV Version 1.6.2 で動作確認をしています。 * * このプラグインはMITライセンスのもとに配布しています、商用利用、 * 改造、再配布など、自由にお使いいただけます。 * * * プラグインコマンド: * * showHpGauge * HPゲージウィンドウを表示します。 * プラグインパラメータ startVisible が 0 の場合、 * このコマンドが実行されるまでHPゲージは表示されません。 * * showHpGauge A * ゲージAを表示します。プラグインパラメータでタイプが設定されている場合、 * ゲーム開始時に自動的に表示状態になります。 * * hideHpGauge * HPゲージウィンドウを隠します。showHpGauge コマンドが実行されるまで * 表示されないままです。 * * hideHpGauge B * ゲージBを隠します。showHpGauge B コマンドが実行されるまで * 表示されないままです。 * * moveHpGaugeWindow 100 200 * HPゲージウィンドウの位置を X座標 = 100 / Y座標 = 200 の位置へ * 移動します。 * * * プラグインパラメータ補足: * * gaugeA ~ gaugeD * * param * ゲージのタイプが VN の場合に、ゲージの現在値として扱う * ゲーム変数番号を設定してください。 * * max * ゲージのタイプが VN の場合に、ゲージの最大値として扱う * ゲーム変数番号を指定してください。 * このパラメータに設定した番号のゲーム変数に値を代入することで、 * 初めて最大値として機能します。 * この設定はゲージの長さにのみ影響します、変数の値が最大値を * 超えなくなるような機能はありません。 * * windowOpacity / collideOpacity * windowOpacity はウィンドウフレーム及び背景に影響し、collideOpacity * はゲージや顔グラフィックにも影響します。 * windowOpacity の値が collideOpacity よりも低い場合、プレイヤーと * 重なった際の不透明度として windowOpacity の値が適用されます。 * ただし、ゲージと顔グラフィックに関しては通常どおり collideOpacity の * 値が適用されます。 * * faceOffsetX * この値を -1000 に設定すると顔グラフィックが非表示となります。 * * vnMax * 値が true なら最大値も表示しますが、現在値と最大値を表示するための * スペースが足りない(ゲージの長さが短い)場合は vnMax の設定に関わらず * 強制的に現在値のみの表示になります。 */ /*~struct~Gauge: * * @param type * @type select * @option なし * @value * @option HP * @option MP * @option TP * @option LV * @option VN * @desc ゲージのタイプ(HP / MP / TP / LV / VN) * 初期値: HP * @default HP * * @param x * @type number * @min -1000 * @desc ゲージのX座標(ウィンドウ内の左端が 0 ) * 初期値: 12 * @default 12 * * @param y * @type number * @min -1000 * @desc ゲージのY座標(ウィンドウ内の上端が 0 ) * 初期値: 12 * @default 12 * * @param width * @type number * @desc ゲージの長さ * 初期値: 144 * @default 144 * * @param height * @type number * @desc ゲージの表示領域(数値とゲージ合わせて)の高さ * 初期値: 36 * @default 36 * * @param fontSize * @type number * @desc フォントサイズ * 初期値: 28 * @default 28 * * @param param * @type variable * @desc ゲージのタイプが VN のときに現在値とするゲーム変数番号 * 初期値: 0 * @default 0 * * @param max * @type variable * @desc ゲージのタイプが VN のときに最大値とするゲーム変数番号 * 初期値: 0 * @default 0 * * @param name * @type string * @desc ゲージのタイプが VN のときに表示するパラメータ名 * 初期値: AP * @default AP * * @param color * @type string * @desc ゲージのタイプが LV / VN のときのゲージカラー * 初期値: #ff60c0 #ffa0e0 * @default #ff60c0 #ffa0e0 */ var Imported = Imported || {}; Imported.TMMapHpGauge = true; (function () { var parameters = PluginManager.parameters('TMMapHpGauge'); var gaugeWindowX = +(parameters['gaugeWindowX'] || 0); var gaugeWindowY = +(parameters['gaugeWindowY'] || 0); var gaugeWindowWidth = +(parameters['gaugeWindowWidth'] || 288); var gaugeWindowHeight = +(parameters['gaugeWindowHeight'] || 64); var gauges = []; ['A', 'B', 'C', 'D'].forEach(function (code, i) { gauges[i] = JSON.parse(parameters['gauge' + code]); gauges[i].x = +gauges[i].x; gauges[i].y = +gauges[i].y; gauges[i].width = +gauges[i].width; gauges[i].height = +gauges[i].height; gauges[i].fontSize = +gauges[i].fontSize; gauges[i].param = +gauges[i].param; gauges[i].max = +gauges[i].max; gauges[i].color = gauges[i].color.split(' '); }); var faceOffsetX = +(parameters['faceOffsetX'] || -4); var faceOffsetY = +(parameters['faceOffsetY'] || -4); var stateIconMax = +(parameters['stateIconMax'] || 4); var stateIconX = +(parameters['stateIconX'] || 156); var stateIconY = +(parameters['stateIconY'] || 24); var stateIconScale = +(parameters['stateIconScale'] || 100); var stateIconOpacity = +(parameters['stateIconOpacity'] || 255); var goldWidth = +(parameters['goldWidth'] || 0); var goldX = +(parameters['goldX'] || 0); var goldY = +(parameters['goldY'] || 0); var vnMax = JSON.parse(parameters['vnMax'] || 'false'); var shakeTime = +(parameters['shakeTime'] || 20); var collideOpacity = +(parameters['collideOpacity'] || 128); var startVisible = JSON.parse(parameters['startVisible'] || 'true'); var windowOpacity = +(parameters['windowOpacity'] || 255); var messageBusyHide = JSON.parse(parameters['messageBusyHide'] || 'true'); var eventBusyHide = JSON.parse(parameters['eventBusyHide'] || 'true'); var useBattleScene = JSON.parse(parameters['useBattleScene'] || 'false'); var gaugeWindowBattleX = +(parameters['gaugeWindowBattleX'] || 0); var gaugeWindowBattleY = +(parameters['gaugeWindowBattleY'] || 0); //----------------------------------------------------------------------------- // Game_System // Game_System.prototype.isVisibleMapHpGauge = function () { if (this._visibleMapHpGauge == null) this._visibleMapHpGauge = startVisible; return this._visibleMapHpGauge; }; Game_System.prototype.setVisibleMapHpGauge = function (flag) { this._visibleMapHpGauge = flag; }; Game_System.prototype.isVisibleMapHpGauges = function (gaugeId) { if (this._visibleMapHpGauges == null) { this._visibleMapHpGauges = []; for (var i = 0; i < gauges.length; i++) { this._visibleMapHpGauges[i] = gauges[i].type !== ''; } } return this._visibleMapHpGauges[gaugeId]; }; Game_System.prototype.setVisibleMapHpGauges = function (gaugeId, flag) { this._visibleMapHpGauges[gaugeId] = flag; }; //----------------------------------------------------------------------------- // Game_Interpreter // var _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand; Game_Interpreter.prototype.pluginCommand = function (command, args) { _Game_Interpreter_pluginCommand.call(this, command, args); if (command === 'showHpGauge') { if (args[0]) { var gaugeId = ['A', 'B', 'C', 'D'].indexOf(args[0]); $gameSystem.setVisibleMapHpGauges(gaugeId, true); } else { $gameSystem.setVisibleMapHpGauge(true); } } else if (command === 'hideHpGauge') { if (args[0]) { var gaugeId = ['A', 'B', 'C', 'D'].indexOf(args[0]); $gameSystem.setVisibleMapHpGauges(gaugeId, false); } else { $gameSystem.setVisibleMapHpGauge(false); } } else if (command === 'moveHpGaugeWindow') { $gameSystem._mapHpGaugeWindowX = +args[0]; $gameSystem._mapHpGaugeWindowY = +args[1]; if (SceneManager._scene._mapHpGaugeWindow) { SceneManager._scene._mapHpGaugeWindow.x = +args[0]; SceneManager._scene._mapHpGaugeWindow.y = +args[1]; SceneManager._scene._mapHpGaugeWindow._baseX = +args[0]; } } }; //----------------------------------------------------------------------------- // Window_MapHpGauge // function Window_MapHpGauge() { this.initialize.apply(this, arguments); } Window_MapHpGauge.prototype = Object.create(Window_Base.prototype); Window_MapHpGauge.prototype.constructor = Window_MapHpGauge; Window_MapHpGauge.prototype.initialize = function () { if (SceneManager.isNextScene(Scene_Battle)) { var x = gaugeWindowBattleX; var y = gaugeWindowBattleY; } else { var x = $gameSystem._mapHpGaugeWindowX != null ? $gameSystem._mapHpGaugeWindowX : gaugeWindowX; var y = $gameSystem._mapHpGaugeWindowY != null ? $gameSystem._mapHpGaugeWindowY : gaugeWindowY; } var wight = gaugeWindowWidth; var height = gaugeWindowHeight; Window_Base.prototype.initialize.call(this, x, y, wight, height); this.openness = $gameSystem.isVisibleMapHpGauge() ? 255 : 0; this.opacity = windowOpacity; this._gaugeParams = []; this._gaugeVisible = []; for (var i = 0; i < gauges.length; i++) { this._gaugeParams.push({ param: -1, max: -1 }); this._gaugeVisible[i] = $gameSystem.isVisibleMapHpGauges(i); } this._icons = []; this._gold = 0; this._actorId = -1; this._faceName = ''; this._faceIndex = ''; this._shakeDuration = 0; this._baseX = x; this._needFaceRefresh = false; this._hideCount = 0; }; Window_MapHpGauge.prototype.lineHeight = function () { return this._lineHeight || 36; }; Window_MapHpGauge.prototype.standardPadding = function () { return 0; }; Window_MapHpGauge.prototype.setShake = function (power) { this._shakeDuration = power; }; Window_MapHpGauge.prototype.update = function () { Window_Base.prototype.update.call(this); if (this.updateVisibility()) { this.open(); if (this.isNeedRefresh()) { var actor = $gameParty.leader(); for (var i = 0; i < gauges.length; i++) { this._gaugeVisible[i] = $gameSystem.isVisibleMapHpGauges(i); var gauge = gauges[i]; if (gauge.type === 'HP') { this._gaugeParams[i].param = actor.hp; this._gaugeParams[i].max = actor.mhp; } else if (gauge.type === 'MP') { this._gaugeParams[i].param = actor.mp; this._gaugeParams[i].max = actor.mmp; } else if (gauge.type === 'TP') { this._gaugeParams[i].param = actor.tp; this._gaugeParams[i].max = actor.maxTp(); } else if (gauge.type === 'LV') { this._gaugeParams[i].param = actor.currentExp(); this._gaugeParams[i].max = actor.nextLevelExp(); this._gaugeParams[i].subParam = actor.level; } else if (gauge.type === 'VN') { this._gaugeParams[i].param = $gameVariables.value(gauge.param); this._gaugeParams[i].max = $gameVariables.value(gauge.max); } } this._icons = actor.stateIcons().concat(actor.buffIcons()); this._gold = $gameParty.gold(); this._actorId = actor.actorId(); this._faceName = actor.faceName(); this._faceIndex = actor.faceIndex(); this.refresh(); } this.updateShake(); this.updateOpacity(); } else { this.close(); } }; Window_MapHpGauge.prototype.updateVisibility = function () { if (!$gameSystem.isVisibleMapHpGauge()) { return false; } if ($gameParty.inBattle()) { return true; } if ((eventBusyHide && $gameMap.isEventRunning()) || (messageBusyHide && $gameMessage.isBusy())) { this._hideCount++; } else { this._hideCount = 0; } return this._hideCount < 10 && $gameParty.leader(); }; Window_MapHpGauge.prototype.isNeedRefresh = function () { var actor = $gameParty.leader(); if (actor) { var result = false; if (this._actorId !== actor.actorId()) { this.setShake(1); return true; } for (var i = 0; i < gauges.length; i++) { if (this._gaugeVisible[i] !== $gameSystem.isVisibleMapHpGauges(i)) { result = true; } var gauge = gauges[i]; var gaugeParam = this._gaugeParams[i]; if (gauge.type === 'HP') { if (gaugeParam.param !== actor.hp || gaugeParam.max !== actor.mhp) { if (gaugeParam.param > actor.hp) { this.setShake(shakeTime); } result = true; } } else if (gauge.type === 'MP') { if (gaugeParam.param !== actor.mp || gaugeParam.max !== actor.mmp) { result = true; } } else if (gauge.type === 'TP') { if (gaugeParam.param !== actor.tp || gaugeParam.max !== actor.maxTp()) { result = true; } } else if (gauge.type === 'LV') { if (gaugeParam.param !== actor.currentExp() || gaugeParam.max !== actor.nextLevelExp() || gaugeParam.subParam !== actor.level) { result = true; } } else if (gauge.type === 'VN') { if (gaugeParam.param !== $gameVariables.value(gauge.param) || gaugeParam.max !== $gameVariables.value(gauge.max)) { result = true; } } } if (stateIconMax > 0) { var icons = actor.stateIcons().concat(actor.buffIcons()); if (this._icons.toString() !== icons.toString()) { result = true; } } if (goldWidth > 0 && this._gold !== $gameParty.gold()) { result = true; } } if (this._needFaceRefresh) { this.refreshFace(); if (!this._needFaceRefresh) { result = true; } } return result; }; Window_MapHpGauge.prototype.updateShake = function () { if (this._shakeDuration > 0) { this._shakeDuration--; this.x = this._baseX; if (this._shakeDuration > 0) { this.x += Math.floor(Math.sin((this._shakeDuration % 10) * Math.PI / 5) * 8); } } }; Window_MapHpGauge.prototype.updateOpacity = function () { if (this.x < $gamePlayer.screenX() + 24 && this.x + gaugeWindowWidth > $gamePlayer.screenX() - 24 && this.y < $gamePlayer.screenY() && this.y + gaugeWindowHeight > $gamePlayer.screenY() - 48) { this.opacity = Math.min(collideOpacity, windowOpacity); this.contentsOpacity = collideOpacity; } else { this.opacity = windowOpacity; this.contentsOpacity = 255; } }; Window_MapHpGauge.prototype.refresh = function () { this.contents.clear(); var actor = $gameParty.leader(); if (actor) { this.refreshFace(); for (var i = 0; i < gauges.length; i++) { if (!$gameSystem.isVisibleMapHpGauges(i)) { continue; } var gauge = gauges[i]; this._lineHeight = gauge.height; this.contents.fontSize = gauge.fontSize; if (gauge.type === 'HP') { this.drawActorHp(actor, gauge.x, gauge.y, gauge.width); } else if (gauge.type === 'MP') { this.drawActorMp(actor, gauge.x, gauge.y, gauge.width); } else if (gauge.type === 'TP') { this.drawActorTp(actor, gauge.x, gauge.y, gauge.width); } else if (gauge.type === 'LV') { this.drawLvGauge(actor, gauge); } else if (gauge.type === 'VN') { this.drawVnGauge(this._gaugeParams[i], gauge); } } for (var i = 0; i < stateIconMax; i++) { if (!this._icons[i]) break; var x = stateIconX + i * Math.floor(Window_Base._iconWidth * stateIconScale / 100); this.drawIcon(this._icons[i], x, stateIconY); } if (goldWidth > 0) { this.drawCurrencyValue(this._gold, TextManager.currencyUnit, goldX, goldY, goldWidth); } this._lineHeight = 36; } }; Window_MapHpGauge.prototype.drawIcon = function (iconIndex, x, y) { var bitmap = ImageManager.loadSystem('IconSet'); var pw = Window_Base._iconWidth; var ph = Window_Base._iconHeight; var sx = iconIndex % 16 * pw; var sy = Math.floor(iconIndex / 16) * ph; var dw = Math.floor(pw * stateIconScale / 100); var dh = Math.floor(ph * stateIconScale / 100); var lastPaintOpacity = this.contents.paintOpacity; this.contents.paintOpacity = stateIconOpacity; this.contents.blt(bitmap, sx, sy, pw, ph, x, y, dw, dh); this.contents.paintOpacity = lastPaintOpacity; }; Window_MapHpGauge.prototype.drawLvGauge = function (actor, gauge) { if (actor.isMaxLevel()) { var value1 = '-------'; var value2 = '-------'; var rate = 1; } else { var n = actor.currentLevelExp(); var value1 = actor.currentExp() - n; var value2 = actor.nextLevelExp() - n; var rate = value1 / value2; } this.drawGauge(gauge.x, gauge.y, gauge.width, rate, gauge.color[0], gauge.color[1]); this.changeTextColor(this.systemColor()); this.drawText(TextManager.levelA, gauge.x, gauge.y, 44); var color = this.normalColor(); this.changeTextColor(color); var width = this.textWidth(TextManager.levelA) + 4; this.drawText(actor.level, gauge.x + width, gauge.y, 44) width = gauge.width - width - this.textWidth('' + actor.level); this.drawCurrentAndMax(value1, value2, gauge.x + gauge.width - width, gauge.y, width, color, color); }; Window_MapHpGauge.prototype.drawVnGauge = function (params, gauge) { var rate = params.max === 0 ? 0 : params.param / params.max; this.drawGauge(gauge.x, gauge.y, gauge.width, rate, gauge.color[0], gauge.color[1]); this.changeTextColor(this.systemColor()); this.drawText(gauge.name, gauge.x, gauge.y, this.textWidth(gauge.name)); this.changeTextColor(this.normalColor()); if (vnMax) { this.drawVnCurrentAndMax(gauge.name, params.param, params.max, gauge.x, gauge.y, gauge.width); } else { this.drawText(params.param, gauge.x + gauge.width - 64, gauge.y, 64, 'right'); } }; Window_MapHpGauge.prototype.drawVnCurrentAndMax = function (name, current, max, x, y, width) { var labelWidth = this.textWidth(name); var valueWidth = this.textWidth('0' + max); var slashWidth = this.textWidth('/'); var x1 = x + width - valueWidth; var x2 = x1 - slashWidth; var x3 = x2 - valueWidth; this.changeTextColor(this.normalColor()); if (x3 >= x + labelWidth) { this.drawText(current, x3, y, valueWidth, 'right'); this.drawText('/', x2, y, slashWidth, 'right'); this.drawText(max, x1, y, valueWidth, 'right'); } else { this.drawText(current, x1, y, valueWidth, 'right'); } }; Window_MapHpGauge.prototype.refreshFace = function () { if (faceOffsetX === -1000) { return; } var actor = $gameParty.leader(); var bitmap = ImageManager.loadFace(actor.faceName()); this._needFaceRefresh = bitmap.width === 0; if (!this._needFaceRefresh) { var x = gaugeWindowWidth - 144 + faceOffsetX; var y = faceOffsetY; var height = Math.min(gaugeWindowHeight, 144); this.drawFace(actor.faceName(), actor.faceIndex(), x, y, 144, height); } }; //----------------------------------------------------------------------------- // Scene_Base // Scene_Base.prototype.createMapHpGaugeWindow = function () { this._mapHpGaugeWindow = new Window_MapHpGauge(); this.addChild(this._mapHpGaugeWindow); }; //----------------------------------------------------------------------------- // Scene_Map // var _Scene_Map_createDisplayObjects = Scene_Map.prototype.createDisplayObjects; Scene_Map.prototype.createDisplayObjects = function () { _Scene_Map_createDisplayObjects.call(this); this.createMapHpGaugeWindow(); }; var _Scene_Map_terminate = Scene_Map.prototype.terminate; Scene_Map.prototype.terminate = function () { if (!SceneManager.isNextScene(Scene_Battle)) this._mapHpGaugeWindow.hide(); _Scene_Map_terminate.call(this); this.removeChild(this._mapHpGaugeWindow); }; var _Scene_Map_launchBattle = Scene_Map.prototype.launchBattle; Scene_Map.prototype.launchBattle = function () { this._mapHpGaugeWindow.hide(); _Scene_Map_launchBattle.call(this); }; //----------------------------------------------------------------------------- // Scene_Battle // var _Scene_Battle_createDisplayObjects = Scene_Battle.prototype.createDisplayObjects; Scene_Battle.prototype.createDisplayObjects = function () { _Scene_Battle_createDisplayObjects.call(this); if (useBattleScene) { this.createMapHpGaugeWindow(); } }; var _Scene_Battle_terminate = Scene_Battle.prototype.terminate; Scene_Battle.prototype.terminate = function () { _Scene_Battle_terminate.call(this); if (this._mapHpGaugeWindow) { this.removeChild(this._mapHpGaugeWindow); } }; })();
dazed/translations
www/js/plugins/TMMapHpGauge.js
JavaScript
unknown
25,873
//============================================================================= // TMPlugin - 移動機能拡張 // バージョン: 1.3.1 // 最終更新日: 2017/06/16 // 配布元 : http://hikimoki.sakura.ne.jp/ //----------------------------------------------------------------------------- // Copyright (c) 2015 tomoaky // Released under the MIT license. // http://opensource.org/licenses/mit-license.php //============================================================================= /*: * @plugindesc 壁衝突音やリージョンによる通行設定などの機能を追加します。 * * @author tomoaky (http://hikimoki.sakura.ne.jp/) * * @param passableRegionId * @type number * @desc タイルに関係なく通行を可能にするリージョン番号 * 初期値: 251 * @default 251 * * @param dontPassRegionId * @type number * @desc タイルに関係なく通行を不可にするリージョン番号 * 初期値: 252 * @default 252 * * @param knockWallSe * @desc 壁衝突時に鳴らす効果音のファイル名 * 初期値: Blow1 * @default Blow1 * @require 1 * @dir audio/se/ * @type file * * @param knockWallSeParam * @type string * @desc 壁衝突時に鳴らす効果音のパラメータ * 初期値: {"volume":90, "pitch":100} * @default {"volume":90, "pitch":100} * * @param knockWallPan * @type number * @desc 壁衝突効果音の左右バランス * 初期値: 75 * @default 75 * * @param knockWallInterval * @type number * @desc 壁衝突効果音の再生間隔(フレーム数) * 初期値: 30 * @default 30 * * @param turnKeyCode * @type string * @desc その場で向き変更に使うキー * 初期値: S * @default S * * @param movableRegion1 * @type string * @desc イベントの移動可能リージョンタイプ設定1番 * 設定例: 1,2,3 * @default * * @param movableRegion2 * @type string * @desc イベントの移動可能リージョンタイプ設定2番 * 設定例: 1,2,3 * @default * * @param movableRegion3 * @type string * @desc イベントの移動可能リージョンタイプ設定3番 * 設定例: 1,2,3 * @default * * @param movableRegion4 * @type string * @desc イベントの移動可能リージョンタイプ設定4番 * 設定例: 1,2,3 * @default * * @param movableRegion5 * @type string * @desc イベントの移動可能リージョンタイプ設定5番 * 設定例: 1,2,3 * @default * * @param movableRegion6 * @type string * @desc イベントの移動可能リージョンタイプ設定6番 * 設定例: 1,2,3 * @default * * @param movableRegion7 * @type string * @desc イベントの移動可能リージョンタイプ設定7番 * 設定例: 1,2,3 * @default * * @param movableRegion8 * @type string * @desc イベントの移動可能リージョンタイプ設定8番 * 設定例: 1,2,3 * @default * * @param movableRegion9 * @type string * @desc イベントの移動可能リージョンタイプ設定9番 * 設定例: 1,2,3 * @default * * @param movableRegion10 * @type string * @desc イベントの移動可能リージョンタイプ設定10番 * 設定例: 1,2,3 * @default * * @help * TMPlugin - 移動機能拡張 ver1.3.1 * * 使い方: * * Sキーを押しながら方向キーを押すと、移動せずにプレイヤーの向きだけを * 変えることができます。マウス(タップ)操作の場合はプレイヤーがいる場所 * をクリックすることで、時計回りに90度回転します。 * * その場で移動せずに向きを変更する機能で使用するキーは turnKeyCode の値を * 変更することで設定できます。XやZなど標準機能ですでに使用しているキーは * 設定しないでください。 * * メモ欄タグを使って、イベントごとに移動可能なリージョンを変更できます。 * プラグインパラメータで移動可能リージョンタイプをカスタマイズしてから * 利用してください。 * たとえば movableRegion1 の値を 1,2,3 にして、イベントのメモ欄に * <movableRegion:1> というタグを書いた場合、そのイベントはリージョンが * 1~3番の場所のみ移動できるようになります。 * * このプラグインは RPGツクールMV Version 1.5.0 で動作確認をしています。 * * * メモ欄タグ(イベント): * * <movableRegion:1> * 移動可能リージョンタイプを1番に設定する * * <stepSwitchOnA:64> * イベントが移動してリージョン64番を踏むとセルフスイッチAをオン * A以外のセルフスイッチを使用する場合は stepSwitchOnB のようにして * ください。 * * <stepSwitchOffB:65> * イベントが移動してリージョン65番を踏むとセルフスイッチBをオフ * * 上記タグはイベントコマンド『注釈』に書き込むことでも機能します。 * メモ欄と注釈の両方にタグがあった場合、注釈の方が優先されます。 * * * プラグインコマンド: * * regionLocate 3 20 * 3番のイベントをリージョン20番が設定されている座標のどこかへ場所移動 * させます。 * イベント番号が 0 ならコマンドを実行したイベント自体、-1 ならプレイヤー * を対象とします。 */ var Imported = Imported || {}; Imported.TMMoveEx = true; var TMPlugin = TMPlugin || {}; if (!TMPlugin.EventBase) { TMPlugin.EventBase = true; (function () { var _Game_Event_setupPage = Game_Event.prototype.setupPage; Game_Event.prototype.setupPage = function () { _Game_Event_setupPage.call(this); if (this._pageIndex >= 0) this.loadCommentParams(); }; Game_Event.prototype.loadCommentParams = function () { this._commentParams = {}; var re = /<([^<>:]+)(:?)([^>]*)>/g; var list = this.list(); for (var i = 0; i < list.length; i++) { var command = list[i]; if (command && command.code == 108 || command.code == 408) { for (; ;) { var match = re.exec(command.parameters[0]); if (match) { this._commentParams[match[1]] = match[2] === ':' ? match[3] : true; } else { break; } } } else { break; } } }; Game_Event.prototype.loadTagParam = function (paramName) { return this._commentParams[paramName] || this.event().meta[paramName]; }; })(); } // TMPlugin.EventBase (function () { var parameters = PluginManager.parameters('TMMoveEx'); var passableRegionId = +(parameters['passableRegionId'] || 251); var dontPassRegionId = +(parameters['dontPassRegionId'] || 252); var knockWallSe = JSON.parse(parameters['knockWallSeParam'] || '{}'); knockWallSe.name = parameters['knockWallSe'] || ''; var knockWallPan = +(parameters['knockWallPan'] || 75); var knockWallInterval = +(parameters['knockWallInterval'] || 30); var movableRegionType = []; for (var i = 1; i <= 10; i++) { movableRegionType[i] = parameters['movableRegion' + i].split(','); } //----------------------------------------------------------------------------- // Input // Input.keyMapper[parameters['turnKeyCode'].charCodeAt()] = 'turn'; //----------------------------------------------------------------------------- // Game_Map // var _Game_Map_checkPassage = Game_Map.prototype.checkPassage; Game_Map.prototype.checkPassage = function (x, y, bit) { var regionId = this.regionId(x, y); if (regionId === passableRegionId) return true; if (regionId === dontPassRegionId) return false; return _Game_Map_checkPassage.call(this, x, y, bit); }; Game_Map.prototype.regionPoints = function (regionId) { var result = []; for (var x = 0; x < this.width(); x++) { for (var y = 0; y < this.height(); y++) { if (this.regionId(x, y) === regionId && this.eventIdXy(x, y) === 0) { result.push(new Point(x, y)); } } } return result; }; Game_Map.prototype.regionPointRandom = function (regionId) { var regionPoints = this.regionPoints(regionId); if (regionPoints.length === 0) return null; return regionPoints[Math.randomInt(regionPoints.length)]; }; //----------------------------------------------------------------------------- // Game_Player // var _Game_Player_moveStraight = Game_Player.prototype.moveStraight; Game_Player.prototype.moveStraight = function (d) { _Game_Player_moveStraight.call(this, d); if (!this.isMovementSucceeded()) { var x2 = $gameMap.roundXWithDirection(this.x, d); var y2 = $gameMap.roundYWithDirection(this.y, d); if (this.isNormal() && ($gameMap.boat().pos(x2, y2) || $gameMap.ship().pos(x2, y2))) return; if (this.isInVehicle() && this.vehicle().isLandOk(this.x, this.y, this.direction())) return; var d2 = this.reverseDir(d); if (!$gameMap.isPassable(this.x, this.y, d) || !$gameMap.isPassable(x2, y2, d2)) { this._knockWallCount = this._knockWallCount == null ? 0 : this._knockWallCount; if (this._knockWallCount + knockWallInterval <= Graphics.frameCount || this._lastKnockWallDir !== d) { if (d === 4) { knockWallSe.pan = -knockWallPan; } else if (d === 6) { knockWallSe.pan = knockWallPan; } else { knockWallSe.pan = 0; } AudioManager.playSe(knockWallSe); this._knockWallCount = Graphics.frameCount; this._lastKnockWallDir = d; } } } }; var _Game_Player_moveByInput = Game_Player.prototype.moveByInput; Game_Player.prototype.moveByInput = function () { if (!this.isMoving() && this.canMove()) { var direction = this.getInputDirection(); if (Input.isPressed('turn') && direction > 0) { this.setDirection(direction); return; } if (TouchInput.isTriggered() && $gameTemp.isDestinationValid()) { var x = $gameTemp.destinationX(); var y = $gameTemp.destinationY(); if (this.pos(x, y)) { this.turnRight90(); return; } } } _Game_Player_moveByInput.call(this); }; //----------------------------------------------------------------------------- // Game_Event // var _Game_Event_isMapPassable = Game_Event.prototype.isMapPassable; Game_Event.prototype.isMapPassable = function (x, y, d) { var movableRegion = this.loadTagParam('movableRegion'); if (movableRegion) { var x2 = $gameMap.roundXWithDirection(x, d); var y2 = $gameMap.roundYWithDirection(y, d); var region = $gameMap.regionId(x2, y2); return movableRegionType[+movableRegion].indexOf('' + region) >= 0; } else { return _Game_Event_isMapPassable.call(this, x, y, d); } }; var _Game_Event_moveStraight = Game_Event.prototype.moveStraight; Game_Event.prototype.moveStraight = function (d) { _Game_Event_moveStraight.call(this, d); ['A', 'B', 'C', 'D'].forEach(function (code) { var regionId = this.loadTagParam('stepSwitchOn' + code); if (regionId && this.regionId() === +regionId) { var key = [$gameMap.mapId(), this.eventId(), code]; $gameSelfSwitches.setValue(key, true); } else { regionId = this.loadTagParam('stepSwitchOff' + code); if (regionId && this.regionId() === +regionId) { var key = [$gameMap.mapId(), this.eventId(), code]; $gameSelfSwitches.setValue(key, false); } } }, this); }; //----------------------------------------------------------------------------- // Game_Interpreter // var _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand; Game_Interpreter.prototype.pluginCommand = function (command, args) { _Game_Interpreter_pluginCommand.call(this, command, args); if (command === 'regionLocate') { var character = this.character(+args[0]); if (character) { var point = $gameMap.regionPointRandom(+args[1]); if (point) character.locate(point.x, point.y); } } }; })();
dazed/translations
www/js/plugins/TMMoveEx.js
JavaScript
unknown
12,405
//============================================================================= // TemplateEvent.js // ---------------------------------------------------------------------------- // (C)2016 Triacontane // This software is released under the MIT License. // http://opensource.org/licenses/mit-license.php // ---------------------------------------------------------------------------- // Version // 2.1.3 2020/03/16 プラグインパラメータ『上書き対象項目』の初期値を設定 // 2.1.2 2019/06/09 EventReSpawn.jsで生成したテンプレートイベントがgetTemplateIdを取得できない問題を修正 // 2.1.1 2019/04/14 2.1.0の機能で、統合ではなく上書きできる機能を追加 // 2.1.0 2019/04/07 テンプレートイベントと個別イベントとでメモ欄を統合できる機能を追加 // 2.0.0 2018/10/21 イベント設定の項目ごとにテンプレートイベントの設定を固有イベントで上書きできるよう修正 // それに伴い、上書きに関する既存設定を見直しました。 // 1.8.3 2018/10/16 1.8.2の競合対策によって、別のプラグインと競合が発生する可能性がある記述を修正 // 1.8.2 2018/10/14 OnlineAvatar.jsとの併用時、起動時にエラーになる問題を解消 // 1.8.1 2018/10/14 ParallaxTitle.jsとの競合を解消 // 1.8.0 2018/05/27 セルフ変数のキーに数値ではなく文字列を使用できるよう修正 // 1.7.1 2017/09/01 スクリプトヘルプの誤記を修正 // 1.7.0 2017/08/29 プラグインコマンドで制御文字\sv[n]が利用できる機能を追加 // 1.6.1 2017/08/26 セルフ変数に文字列が入っている場合でも出現条件の注釈が正しく動作するよう修正 // 1.6.0 2017/08/19 セルフ変数の一括操作のコマンドおよびセルフ変数を外部から操作するスクリプトを追加 // 1.5.1 2017/08/15 文章のスクロール表示でセルフ変数が正しく表示できていなかった問題を修正 // 1.5.0 2017/08/14 セルフ変数の操作を「移動ルートの設定」からも行えるよう修正 // 1.4.1 2017/07/21 SAN_MapGenerator.jsとの競合を解消 // 1.4.0 2017/07/16 セルフ変数機能を追加 // 1.3.0 2017/07/07 固有処理呼び出し中にテンプレートイベントのIDと名称を取得できるスクリプトを追加 // 1.2.0 2017/06/09 設定を固有イベントで上書きする機能を追加。それに伴い既存のパラメータ名称を一部変更 // 1.1.2 2017/06/03 固有イベントのグラフィックで上書きした場合は、オプションと向き、パターンも固有イベントで上書きするよう変更 // 1.1.1 2017/05/25 場所移動直後にアニメパターンが一瞬だけ初期化されてしまう問題を修正 // 1.1.0 2017/04/22 テンプレートイベントIDに変数の値を指定できる機能を追加 // 1.0.2 2017/04/09 イベント生成系のプラグインで発生する可能性のある競合を解消 // 1.0.1 2016/06/28 固有イベントのページ数がテンプレートイベントのページ数より少ない場合に発生するエラーを修正 // 1.0.0 2016/06/12 初版 // ---------------------------------------------------------------------------- // [Blog] : https://triacontane.blogspot.jp/ // [Twitter]: https://twitter.com/triacontane/ // [GitHub] : https://github.com/triacontane/ //============================================================================= /*: * @plugindesc Template Event Plugin * @author triacontane * * @param TemplateMapId * @desc The map ID where the template event resides. * @default 1 * @type number * * @param KeepEventId * @desc Maintain the event ID of the caller when invoking the map event. * @default false * @type boolean * * @param OverrideTarget * @desc メモ欄で上書き(テンプレートイベントより固有イベントの設定を優先)指定したイベントの上書き対象項目を設定します。 * @default {"Image":"true","Direction":"false","Move":"false","Priority":"false","Trigger":"false","Option":"false"} * @type struct<override> * * @param AutoOverride * @desc メモ欄で上書き設定をしなくても「上書き対象項目」の設定を上書きします。 * @default false * @type boolean * * @param IntegrateNote * @desc テンプレートイベントと固有イベントのメモ欄を統合もしくは上書きします。 * @default 0 * @type select * @option None * @value 0 * @option Integrate * @value 1 * @option Override * @value 2 * * @help TemplateEvent.js[Template Event Plugin] * * You can template commonly used events. * Please define the template event in the map prepared exclusively. * Just by writing a predetermined description in the note of the actual event, * It can be replaced dynamically. * * You can also call up the source event from the template event. * It is effective when you want to do some unique processing, * such as treasure boxes and place movement events. * Describe the appearance and event processing of the common part * in the template event, * We describe only the unique part such as item acquisition and * location destination designation in the original event. * * It also provides a function to call an arbitrary map event like a common event. * Events to be called can be specified by ID and event name. * * Procedure * 1.Create a template map and place a template event. * * 2.Write a memo field of the event you want to replace * with the template event. Both ID and event name can be specified. * <TE:1> It is replaced with the event of ID [1] of the template map. * <TE:aaa> It is replaced with the event of event name [aaa] of the template map. * <TE:\v[1]> It is replaced with the event of ID of template map [value of variable [1]]. * * In principle, all settings except initial placement will be replaced with * template event settings If you specify graphics as an exception and when you * write a memo field (* 1) * Priority is given to the settings of unique events for the following settings. * Image * Autonomous Movement * Options * Priority * Trigger * * *1 Write it in the memo field of the unique event as follows. * <TEOverRide> * * Plugin Command * * TE_CALL_ORIGIN_EVENT [PageIndex] * Call up the event processing of the replacement source. After processing is completed, * it returns to the original processing. If you omit the page number, the running page * number is applied as it is. It is effective only when described in the template event. * * ex * TE_CALL_ORIGIN_EVENT 1 * * TE_CALL_MAP_EVENT [EventId] [PageIndex] * Call up another event processing in the same map. After processing is completed, * it returns to the original processing. If you specify an event ID other than a numeric value, * it calls processing of an event that is treated as an event name and whose event name matches. * It is valid even if it is described in the template event. * * ex1 * TE_CALL_MAP_EVENT 5 1 * * ex2 * TE_CALL_MAP_EVENT aaa 1 * * This plugin is released under the MIT License. */ /*:ja * @plugindesc テンプレートイベントプラグイン * @author トリアコンタン * * @param TemplateMapId * @text テンプレートマップID * @desc テンプレートイベントが存在するマップIDです。 * @default 1 * @type number * * @param KeepEventId * @text イベントIDを維持 * @desc マップイベントを呼び出す際に、呼び出し元のイベントIDを維持します。対象を「このイベント」にした際の挙動が変わります。 * @default false * @type boolean * * @param OverrideTarget * @text 上書き対象項目 * @desc メモ欄で上書き(テンプレートイベントより固有イベントの設定を優先)指定したイベントの上書き対象項目を設定します。 * @default {"Image":"true","Direction":"false","Move":"false","Priority":"false","Trigger":"false","Option":"false"} * @type struct<override> * * @param AutoOverride * @text 自動上書き * @desc メモ欄で上書き設定をしなくても「上書き対象項目」の設定を上書きします。 * @default false * @type boolean * * @param IntegrateNote * @text メモ欄統合 * @desc テンプレートイベントと固有イベントのメモ欄を統合もしくは上書きします。 * @default 0 * @type select * @option 何もしない * @value 0 * @option 統合 * @value 1 * @option 上書き * @value 2 * * @help TemplateEvent.js[テンプレートイベントプラグイン] * * 汎用的に使用するイベントをテンプレート化できます。 * テンプレートイベントは、専用に用意したマップに定義してください。 * 実際のイベントのメモ欄に所定の記述をするだけで、テンプレートイベントと * 動的に置き換えることができます。 * * またテンプレートイベントから置き換え元のイベントを呼び出すことができます。 * 宝箱や場所移動イベント等、一部だけ固有の処理をしたい場合に有効です。 * 外観や共通部分のイベント処理をテンプレートイベントに記述し、 * アイテム入手や場所移動先指定など固有部分だけを元のイベントに記述します。 * * 任意のマップイベントをコモンイベントのように呼び出す機能も提供します。 * IDおよびイベント名で呼び出すイベントを指定可能です。 * * 利用手順 * 1.テンプレートマップを作成して、テンプレートイベントを配置します。 * * 2.テンプレートイベントに置き換えたいイベントのメモ欄を記述します。 * IDとイベント名の双方が指定可能です。 * <TE:1> テンプレートマップのID[1]のイベントに置き換わります。 * <TE:aaa> テンプレートマップのイベント名[aaa]のイベントに置き換わります。 * <TE:\v[1]> テンプレートマップのID[変数[1]の値]のイベントに置き換わります。 * * 原則、初期配置以外の全設定はテンプレートイベントの設定に置き換わりますが * 例外としてメモ欄(※1)を記述した場合は * 以下の任意の設定について固有イベントの設定で上書きします。 * ・画像 * ・自律移動 * ・オプション * ・プライオリティ * ・トリガー * * ※1 固有イベントのメモ欄に以下の通り記述します。 * <TE上書き> * <TEOverRide> * * ・セルフ変数機能 * イベントに対してセルフ変数(そのイベント専用の変数)を定義できます。 * プラグインコマンドから操作し、文章の表示やイベント出現条件として使用可能です。 * * 「文章の表示」で使用する場合 * 制御文字「\sv[n](n:インデックス)」で表示できます。 * * 「イベント出現条件」で使用する場合 * 対象ページのイベントコマンドの先頭を「注釈」にして * 以下の書式で条件を指定してください。複数指定も可能です。 * * \TE{条件} * * 条件はJavaScriptとしてで記述し、制御文字が使用可能です。 * 指定例: * \TE{\sv[1] >= 3} # セルフ変数[1]が3以上の場合 * \TE{\sv[2] === \v[1]} # セルフ変数[2]が変数[1]と等しい場合 * \TE{\sv[3] === 'AAA'} # セルフ変数[3]が'AAA'と等しい場合 * * 「条件分岐」などのスクリプトで使用する場合 * 以下のスクリプトで指定したインデックスのセルフ変数が取得できます。 * this.getSelfVariable(n) * 指定例: * this.getSelfVariable(1) !== 0 # セルフ変数[1]が3以上の場合 * * プラグインコマンド詳細 * イベントコマンド「プラグインコマンド」から実行。 * (パラメータの間は半角スペースで区切る) * * TE固有イベント呼び出し [ページ番号] * TE_CALL_ORIGIN_EVENT [ページ番号] * 置き換え元のイベント処理を呼び出します。処理完了後、元の処理に戻ります。 * ページ番号を省略すると、実行中のページ番号がそのまま適用されます。 * テンプレートイベントに記述した場合のみ有効です。 * * 例1:置き換え元イベントの1ページ目を呼び出します。 * TE固有イベント呼び出し 1 * * TEマップイベント呼び出し [イベントID] [ページ番号] * TE_CALL_MAP_EVENT [イベントID] [ページ番号] * 同一マップ内の別イベント処理を呼び出します。処理完了後、元の処理に戻ります。 * イベントIDに数値以外を指定すると、イベント名として扱われ * イベント名が一致するイベントの処理を呼び出します。 * テンプレートイベントに記述した場合以外でも有効です。 * * 例1:ID[5]のイベントの1ページ目を呼び出します。 * TEマップイベント呼び出し 5 1 * * 例2:[aaa]という名前のイベントの1ページ目を呼び出します。 * TEマップイベント呼び出し aaa 1 * * TEセルフ変数の操作 [インデックス] [操作種別] [オペランド] * TE_SET_SELF_VARIABLE [インデックス] [操作種別] [オペランド] * セルフ変数を操作します。 * インデックス : 操作対象のセルフ変数のインデックスです。1以上の数値を指定 * 操作種別 : 操作種別です。以下の通り指定してください。 * 0 : 代入 * 1 : 加算 * 2 : 減算 * 3 : 乗算 * 4 : 除算 * 5 : 剰余 * オペランド : 設定値です。数値を指定してください。 * ※セルフ変数に数値以外を設定したい場合は、スクリプトで指定してください。 * * 例1:インデックス[1]のセルフ変数に値[100]を代入します。 * TE_SET_SELF_VARIABLE 1 0 100 * * 例2:インデックス[3]のセルフ変数から値[50]を減算します。 * TE_SET_SELF_VARIABLE 3 2 50 * * 例2:インデックス[5]のセルフ変数に値[セルフ変数[1]の値]を加算します。 * TE_SET_SELF_VARIABLE 5 1 \sv[1] * * TEセルフ変数の一括操作 [開始INDEX] [終了INDEX] [操作種別] [オペランド] * TE_SET_RANGE_SELF_VARIABLE [開始INDEX] [終了INDEX] [操作種別] [オペランド] * セルフ変数を一括操作します。 * * 本プラグインのすべてのプラグインコマンドで制御文字\sv[n]を使用できます。 * * ・スクリプト(イベントコマンドのスクリプト、変数の操作から実行) * 固有処理呼び出し中にテンプレートイベントのIDと名称を取得します。 * this.character(0).getTemplateId(); * this.character(0).getTemplateName(); * * 指定したインデックスのセルフ変数を取得します。 * this.getSelfVariable(index); * * セルフ変数に値を設定します。 * このスクリプトは「移動ルートの設定」でも実行できます。 * formulaFlgをtrueに設定すると、operandを計算式として評価します。 * this.controlSelfVariable(index, type, operand, formulaFlg); * * セルフ変数に値を一括設定します。 * このスクリプトは「移動ルートの設定」でも実行できます。 * this.controlSelfVariableRange(start, end, type, operand, formulaFlg); * * 外部のイベントのセルフ変数を操作します。 * $gameSelfSwitches.setVariableValue([マップID, イベントID, INDEX], 設定値); * * 外部のイベントのセルフ変数を取得します。 * $gameSelfSwitches.getVariableValue([マップID, イベントID, INDEX]); * * SAN_MapGenerator.jsと組み合わせる場合 * このプラグインをSAN_MapGenerator.jsより下に定義してください。 * * 利用規約: * 作者に無断で改変、再配布が可能で、利用形態(商用、18禁利用等) * についても制限はありません。 * このプラグインはもうあなたのものです。 */ /*~struct~override: * * @param Image * @text 画像 * @desc イベントの画像および画像インデックスです。 * @type boolean * @default false * * @param Direction * @text 向き * @desc イベントの向き及びアニメパターンです。 * @type boolean * @default false * * @param Move * @text 自律移動 * @desc イベントの自律移動です。 * @type boolean * @default false * * @param Priority * @text プライオリティ * @desc イベントのプライオリティです。 * @type boolean * @default false * * @param Trigger * @text トリガー * @desc イベントのトリガーです。 * @type boolean * @default false * * @param Option * @text オプション * @desc イベントのオプションです。 * @type boolean * @default false */ var $dataTemplateEvents = null; (function () { 'use strict'; var metaTagPrefix = 'TE'; var getMetaValue = function (object, name) { var metaTagName = metaTagPrefix + (name ? name : ''); return object.meta.hasOwnProperty(metaTagName) ? object.meta[metaTagName] : undefined; }; var getMetaValues = function (object, names) { if (!object) return undefined; if (!Array.isArray(names)) return getMetaValue(object, names); for (var i = 0, n = names.length; i < n; i++) { var value = getMetaValue(object, names[i]); if (value !== undefined) return value; } return undefined; }; var getArgNumber = function (arg, min, max) { if (arguments.length < 2) min = -Infinity; if (arguments.length < 3) max = Infinity; return (parseInt(arg) || 0).clamp(min, max); }; var convertEscapeCharacters = function (text) { if (isNotAString(text)) text = ''; text = text.replace(/\\/g, '\x1b'); text = text.replace(/\x1b\x1b/g, '\\'); text = text.replace(/\x1bV\[(\d+)]/gi, function () { return $gameVariables.value(parseInt(arguments[1])); }.bind(this)); text = text.replace(/\x1bV\[(\d+)]/gi, function () { return $gameVariables.value(parseInt(arguments[1])); }.bind(this)); text = text.replace(/\x1bN\[(\d+)]/gi, function () { var actor = parseInt(arguments[1]) >= 1 ? $gameActors.actor(parseInt(arguments[1])) : null; return actor ? actor.name() : ''; }.bind(this)); text = text.replace(/\x1bP\[(\d+)]/gi, function () { var actor = parseInt(arguments[1]) >= 1 ? $gameParty.members()[parseInt(arguments[1]) - 1] : null; return actor ? actor.name() : ''; }.bind(this)); text = text.replace(/\x1bG/gi, TextManager.currencyUnit); return text; }; var isNotAString = function (args) { return String(args) !== args; }; var isExistPlugin = function (pluginName) { return Object.keys(PluginManager.parameters(pluginName)).length > 0; }; var convertAllArguments = function (args) { return args.map(function (arg) { return convertEscapeCharacters(arg); }); }; var setPluginCommand = function (commandName, methodName) { pluginCommandMap.set(metaTagPrefix + commandName, methodName); }; var pluginCommandMap = new Map(); setPluginCommand('固有イベント呼び出し', 'execCallOriginEvent'); setPluginCommand('_CALL_ORIGIN_EVENT', 'execCallOriginEvent'); setPluginCommand('マップイベント呼び出し', 'execCallMapEvent'); setPluginCommand('_CALL_MAP_EVENT', 'execCallMapEvent'); setPluginCommand('セルフ変数の操作', 'execControlSelfVariable'); setPluginCommand('_SET_SELF_VARIABLE', 'execControlSelfVariable'); setPluginCommand('セルフ変数の一括操作', 'execControlSelfVariableRange'); setPluginCommand('_SET_RANGE_SELF_VARIABLE', 'execControlSelfVariableRange'); //============================================================================= // パラメータの取得と整形 //============================================================================= /** * Create plugin parameter. param[paramName] ex. param.commandPrefix * @param pluginName plugin name(EncounterSwitchConditions) * @returns {Object} Created parameter */ var createPluginParameter = function (pluginName) { var paramReplacer = function (key, value) { if (value === 'null') { return value; } if (value[0] === '"' && value[value.length - 1] === '"') { return value; } try { return JSON.parse(value); } catch (e) { return value; } }; var parameter = JSON.parse(JSON.stringify(PluginManager.parameters(pluginName), paramReplacer)); PluginManager.setParameters(pluginName, parameter); return parameter; }; var param = createPluginParameter('TemplateEvent'); //============================================================================= // Game_Interpreter // プラグインコマンドを追加定義します。 //============================================================================= var _Game_Interpreter_command101 = Game_Interpreter.prototype.command101; Game_Interpreter.prototype.command101 = function () { if (!$gameMessage.isBusy()) { $gameMessage.setEventId(this._eventId); } return _Game_Interpreter_command101.apply(this, arguments); }; var _Game_Interpreter_command105 = Game_Interpreter.prototype.command105; Game_Interpreter.prototype.command105 = function () { if (!$gameMessage.isBusy()) { $gameMessage.setEventId(this._eventId); } return _Game_Interpreter_command105.apply(this, arguments); }; var _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand; Game_Interpreter.prototype.pluginCommand = function (command, args) { _Game_Interpreter_pluginCommand.apply(this, arguments); var pluginCommandMethod = pluginCommandMap.get(command.toUpperCase()); if (pluginCommandMethod) { this[pluginCommandMethod](this.convertAllSelfVariables(convertAllArguments(args))); } }; Game_Interpreter.prototype.execCallOriginEvent = function (args) { this.callOriginEvent(getArgNumber(args[0])); }; Game_Interpreter.prototype.execCallMapEvent = function (args) { var pageIndex = getArgNumber(args[1], 1); var eventId = getArgNumber(args[0]); if ($gameMap.event(eventId)) { this.callMapEventById(pageIndex, eventId); } else if (args[0] !== '') { this.callMapEventByName(pageIndex, args[0]); } else { this.callMapEventById(pageIndex, this._eventId); } }; Game_Interpreter.prototype.execControlSelfVariable = function (args) { var selfIndex = getArgNumber(args[0], 0) || args[0]; var controlType = getArgNumber(args[1], 0, 5); var operand = isNaN(Number(args[2])) ? args[2] : getArgNumber(args[2]); this.controlSelfVariable(selfIndex, controlType, operand, false); }; Game_Interpreter.prototype.execControlSelfVariableRange = function (args) { var selfStartIndex = getArgNumber(args[0], 0) || args[0]; var selfEndIndex = getArgNumber(args[1], 0) || args[0]; var controlType = getArgNumber(args[2], 0, 5); var operand = isNaN(Number(args[3])) ? args[3] : getArgNumber(args[3]); this.controlSelfVariableRange(selfStartIndex, selfEndIndex, controlType, operand, false); }; Game_Interpreter.prototype.callOriginEvent = function (pageIndex) { var event = $gameMap.event(this._eventId); if (event && event.hasTemplate()) { this.setupAnotherList(null, event.getOriginalPages(), pageIndex); } }; Game_Interpreter.prototype.callMapEventById = function (pageIndex, eventId) { var event = $gameMap.event(eventId); if (event) { this.setupAnotherList(param.KeepEventId ? null : eventId, event.getPages(), pageIndex); } }; Game_Interpreter.prototype.callMapEventByName = function (pageIndex, eventName) { var event = DataManager.searchDataItem($dataMap.events, 'name', eventName); if (event) { this.setupAnotherList(param.KeepEventId ? null : event.id, event.pages, pageIndex); } }; Game_Interpreter.prototype.setupAnotherList = function (eventId, pages, pageIndex) { var page = pages[pageIndex - 1 || this._pageIndex] || pages[0]; if (!eventId) eventId = this.isOnCurrentMap() ? this._eventId : 0; this.setupChild(page.list, eventId); }; Game_Interpreter.prototype.controlSelfVariable = function (index, type, operand, formulaFlg) { var character = this.character(0); if (character) { character.controlSelfVariable(index, type, operand, formulaFlg); } }; Game_Interpreter.prototype.controlSelfVariableRange = function (startIndex, endIndex, type, operand, formulaFlg) { var character = this.character(0); if (character) { character.controlSelfVariableRange(startIndex, endIndex, type, operand, formulaFlg); } }; Game_Interpreter.prototype.getSelfVariable = function (selfVariableIndex) { var character = this.character(0); return character ? character.getSelfVariable(selfVariableIndex) : 0; }; Game_Interpreter.prototype.convertAllSelfVariables = function (args) { return args.map(function (arg) { return $gameSelfSwitches.convertSelfVariableCharacter(this._eventId, arg, false); }, this); }; //============================================================================= // Game_Message // メッセージ表示中のイベントIDを保持します。 //============================================================================= var _Game_Message_clear = Game_Message.prototype.clear; Game_Message.prototype.clear = function () { _Game_Message_clear.apply(this, arguments); this._eventId = 0; }; Game_Message.prototype.setEventId = function (id) { this._eventId = id; }; Game_Message.prototype.getEventId = function () { return this._eventId; }; //============================================================================= // Game_System // ロード完了時に必要ならセルフ変数を初期化します。 //============================================================================= var _Game_System_onAfterLoad = Game_System.prototype.onAfterLoad; Game_System.prototype.onAfterLoad = function () { _Game_System_onAfterLoad.apply(this, arguments); $gameSelfSwitches.clearVariableIfNeed(); }; //============================================================================= // Game_SelfSwitches // セルフ変数を追加します。 //============================================================================= var _Game_SelfSwitches_initialize = Game_SelfSwitches.prototype.initialize; Game_SelfSwitches.prototype.initialize = function () { _Game_SelfSwitches_initialize.apply(this, arguments); this.clearVariable(); }; Game_SelfSwitches.prototype.clearVariable = function () { this._variableData = {}; }; Game_SelfSwitches.prototype.clearVariableIfNeed = function () { if (!this._variableData) { this.clearVariable(); } }; Game_SelfSwitches.prototype.getVariableValue = function (key) { return this._variableData.hasOwnProperty(key) ? this._variableData[key] : 0; }; Game_SelfSwitches.prototype.setVariableValue = function (key, value) { if (this._variableData[key] === value) { return; } if (value !== undefined && value !== 0) { this._variableData[key] = value; } else { delete this._variableData[key]; } this.onChange(); }; Game_SelfSwitches.prototype.makeSelfVariableKey = function (eventId, index) { return eventId > 0 ? [$gameMap.mapId(), eventId, index] : null; }; Game_SelfSwitches.prototype.convertSelfVariableCharacter = function (eventId, text, scriptFlag) { text = text.replace(/\x1bSV\[(\w+)]/gi, function () { var key = this.makeSelfVariableKey(eventId, arguments[1]); var value = this.getVariableValue(key); return isNotAString(value) || !scriptFlag ? value : '\'' + value + '\''; }.bind(this)); return text; }; //============================================================================= // Game_Event // テンプレートイベントマップをロードしてグローバル変数に保持します。 //============================================================================= var _Game_Event_initialize = Game_Event.prototype.initialize; Game_Event.prototype.initialize = function (mapId, eventId) { var event = $dataMap.events[eventId]; this.setTemplate(event); _Game_Event_initialize.apply(this, arguments); if (this.hasTemplate()) { this.setPosition(event.x, event.y); this.refreshBushDepth(); } }; var _Game_Event_setupPageSettings = Game_Event.prototype.setupPageSettings; Game_Event.prototype.setupPageSettings = function () { _Game_Event_setupPageSettings.apply(this, arguments); if (this.hasTemplate() && param.OverrideTarget && this._override) { this.overridePageSettings(); } }; Game_Event.prototype.overridePageSettings = function () { var page = this.getOriginalPage(); if (!page) { return; } var image = page.image; var target = param.OverrideTarget; if (target.Image) { if (image.tileId > 0) { this.setTileImage(image.tileId); } else { this.setImage(image.characterName, image.characterIndex); } } if (target.Direction) { if (this._originalDirection !== image.direction) { this._originalDirection = image.direction; this._prelockDirection = 0; this.setDirectionFix(false); this.setDirection(image.direction); } if (this._originalPattern !== image.pattern) { this._originalPattern = image.pattern; this.setPattern(image.pattern); } } if (target.Move) { this.setMoveSpeed(page.moveSpeed); this.setMoveFrequency(page.moveFrequency); this.setMoveRoute(page.moveRoute); this._moveType = page.moveType; } if (target.Priority) { this.setPriorityType(page.priorityType); } if (target.Option) { this.setWalkAnime(page.walkAnime); this.setStepAnime(page.stepAnime); this.setDirectionFix(page.directionFix); this.setThrough(page.through); } if (target.Trigger) { this._trigger = page.trigger; if (this._trigger === 4) { this._interpreter = new Game_Interpreter(); } else { this._interpreter = null; } } }; Game_Event.prototype.setTemplate = function (event) { var templateId = this.generateTemplateId(event); if (templateId) { this._templateId = templateId; this._templateEvent = $dataTemplateEvents[this._templateId]; this._override = param.AutoOverride || !!getMetaValues(event, ['OverRide', '上書き']); if (param.IntegrateNote > 0) { this.integrateNote(event, param.IntegrateNote); } } else { this._templateId = 0; this._templateEvent = null; this._override = false; } }; Game_Event.prototype.generateTemplateId = function (event) { var value = getMetaValues(event, ''); if (!value) { return 0; } var templateId = getArgNumber(value, 0, $dataTemplateEvents.length - 1); if (!templateId) { var template = DataManager.searchDataItem($dataTemplateEvents, 'name', value); if (template) { templateId = template.id; } } return templateId; }; Game_Event.prototype.integrateNote = function (event, type) { this._templateEvent = JsonEx.makeDeepCopy(this._templateEvent); this._templateEvent.note = (type === 1 ? this._templateEvent.note : '') + event.note; DataManager.extractMetadata(this._templateEvent); }; Game_Event._userScripts = ['getTemplateId', 'getTemplateName']; Game_Event.prototype.getTemplateId = function () { return this._templateId; }; Game_Event.prototype.getTemplateName = function () { return this.hasTemplate() ? this._templateEvent.name : ''; }; Game_Event.prototype.hasTemplate = function () { return this._templateId > 0; }; var _Game_Event_event = Game_Event.prototype.event; Game_Event.prototype.event = function () { return this.hasTemplate() ? this._templateEvent : _Game_Event_event.apply(this, arguments); }; Game_Event.prototype.getOriginalPages = function () { var eventId = isExistPlugin('SAN_MapGenerator') ? this._dataEventId : this._eventId; return $dataMap.events[eventId].pages; }; Game_Event.prototype.getOriginalPage = function () { return this.getOriginalPages()[this._pageIndex]; }; Game_Event.prototype.getPages = function () { return this.event().pages; }; var _Game_Event_meetsConditions = Game_Event.prototype.meetsConditions; Game_Event.prototype.meetsConditions = function (page) { return _Game_Event_meetsConditions.apply(this, arguments) && this.meetsConditionsForSelfVariable(page); }; Game_Event.prototype.meetsConditionsForSelfVariable = function (page) { var comment = this.getStartComment(page); return !(comment && this.execConditionScriptForSelfVariable(comment) === false); }; Game_Event.prototype.getStartComment = function (page) { return page.list.filter(function (command) { return command && (command.code === 108 || command.code === 408); }).reduce(function (prev, command) { return prev + command.parameters[0]; }, ''); }; Game_Event.prototype.execConditionScriptForSelfVariable = function (note) { var scripts = []; note.replace(/\\TE{(.+?)}/gi, function () { scripts.push(arguments[1]); }.bind(this)); return scripts.every(function (script) { script = convertEscapeCharacters(script); script = $gameSelfSwitches.convertSelfVariableCharacter(this._eventId, script, true); return eval(script); }, this); }; Game_Event.prototype.getSelfVariableKey = function (index) { return $gameSelfSwitches.makeSelfVariableKey(this._eventId, index); }; Game_Event.prototype.controlSelfVariable = function (index, type, operand, formulaFlg) { var key = this.getSelfVariableKey(index); if (key) { this.operateSelfVariable(key, type, formulaFlg ? eval(operand) : operand); } }; Game_Event.prototype.controlSelfVariableRange = function (startIndex, endIndex, type, operand, formulaFlg) { for (var index = startIndex; index <= endIndex; index++) { this.controlSelfVariable(index, type, operand, formulaFlg); } }; Game_Event.prototype.getSelfVariable = function (selfVariableIndex) { var key = this.getSelfVariableKey(selfVariableIndex); return $gameSelfSwitches.getVariableValue(key); }; Game_Event.prototype.operateSelfVariable = function (key, operationType, value) { var oldValue = $gameSelfSwitches.getVariableValue(key); switch (operationType) { case 0: // Set $gameSelfSwitches.setVariableValue(key, oldValue = value); break; case 1: // Add $gameSelfSwitches.setVariableValue(key, oldValue + value); break; case 2: // Sub $gameSelfSwitches.setVariableValue(key, oldValue - value); break; case 3: // Mul $gameSelfSwitches.setVariableValue(key, oldValue * value); break; case 4: // Div $gameSelfSwitches.setVariableValue(key, oldValue / value); break; case 5: // Mod $gameSelfSwitches.setVariableValue(key, oldValue % value); break; } }; //============================================================================= // DataManager // データ検索用の共通処理です。 //============================================================================= if (!DataManager.searchDataItem) { DataManager.searchDataItem = function (dataArray, columnName, columnValue) { var result = 0; dataArray.some(function (dataItem) { if (dataItem && dataItem[columnName] === columnValue) { result = dataItem; return true; } return false; }); return result; }; } var _Window_Base_convertEscapeCharacters = Window_Base.prototype.convertEscapeCharacters; Window_Base.prototype.convertEscapeCharacters = function (text) { text = _Window_Base_convertEscapeCharacters.apply(this, arguments); return $gameSelfSwitches.convertSelfVariableCharacter($gameMessage.getEventId(), text, false); }; //============================================================================= // Scene_Boot // テンプレートイベントマップをロードしてグローバル変数に保持します。 //============================================================================= var _Scene_Boot_create = Scene_Boot.prototype.create; Scene_Boot.prototype.create = function () { _Scene_Boot_create.apply(this, arguments); this._templateMapGenerator = this.templateMapLoadGenerator(); $dataMap = {}; }; var _Scene_Boot_isReady = Scene_Boot.prototype.isReady; Scene_Boot.prototype.isReady = function () { var isReady = _Scene_Boot_isReady.apply(this, arguments); return this._templateMapGenerator.next().done && isReady; }; Scene_Boot.prototype.templateMapLoadGenerator = function* () { while (!DataManager.isMapLoaded()) { yield false; } // Resolve conflict for OnlineAvatar.js if (!$gamePlayer) { $gamePlayer = { isTransferring: function () { } }; } DataManager.loadMapData(param.TemplateMapId); $gamePlayer = null; while (!DataManager.isMapLoaded()) { yield false; } $dataTemplateEvents = $dataMap.events; $dataMap = {}; return true; }; })();
dazed/translations
www/js/plugins/TemplateEvent.js
JavaScript
unknown
40,050
//============================================================================= // Text2Frame.js // ---------------------------------------------------------------------------- // (C)2018-2020 Yuki Katsura // This software is released under the MIT License. // http://opensource.org/licenses/mit-license.php // ---------------------------------------------------------------------------- // Version // 2.0.0 2020/12/06: ツクールMZに対応 // ・ツクールMZ仕様のプラグインコマンドの定義 // ・取り込み先にページ番号を設定する機能の追加 // ・実行時のメッセージ表示ON・OFFを切り替えるプラグインオプションの追加 // ・MZ用のネームボックス機能の追加 // ・MZ用のピクチャ移動(イージング)の追加 // ・MZ用の変数操作(直前の情報)の追加 // ・MZ用の条件分岐条件(タッチ・マウス操作)の追加 // ・MZ用プラグインコマンドタグの追加 // ・日本語表現に誤りがあったので、正しいものを追加(エネミー->敵キャラ, スタート->始動, ストップ->停止) // 1.4.1 2020/08/16: 文法エラー時に行数を表示する機能を削除 // 1.4.0 2020/08/14: // ・条件分岐タグ追加 // ・ループタグ追加 // ・ループの中断タグ追加 // ・イベント処理の中断タグ追加 // ・ラベルの設定タグ追加 // ・ラベルジャンプタグ追加 // 1.3.0 2020/08/09: // ・ピクチャの表示タグ追加 // ・ピクチャの移動タグ追加 // ・ピクチャの回転タグ追加 // ・ピクチャの色調変更タグ追加 // ・ピクチャの消去タグ追加 // 1.2.0 2020/06/15: // ・スイッチの操作タグ追加 // ・変数の操作タグ追加 // ・セルフスイッチの操作タグ追加 // ・タイマーの操作タグ追加 // ・バグの修正 // ・ヘルプ文のレイアウト修正 // 1.1.2 2019/01/03 PlayME, StopMEタグ追加 // 1.1.1 2019/01/02 StopBGM, StopBGSタグ追加 // 1.1.0 2018/10/15 script,wait,fadein,fadeout,comment,PluginCommand,CommonEventタグ追加 // 1.0.2 2018/09/10 translate REAMDE to eng(Partial) // 1.0.1 2018/09/06 bug fix オプションパラメータ重複、CRLFコード対応 // 1.0.0 2018/09/02 Initial Version // 0.5.5 2018/11/18 [draft] PlaySE、StopSEタグ対応 // 0.5.4 2018/10/28 [draft] ChangeBattleBGMタグ対応 // 0.5.3 2018/10/28 [draft] PlayBGS, FadeoutBGSタグ対応 // 0.5.2 2018/10/28 [draft] refactor pretext, text_frame, command_bottom // 0.5.1 2018/10/28 [draft] PlayBGM, FadeoutBGM, SaveBGM, ReplayBGMタグ対応 // 0.4.2 2018/09/29 [draft] waitタグ対応、フェードイン、アウトタグ対応 // 0.4.1 2018/09/27 [draft] commentタグ対応 // 0.4.0 2018/09/24 [draft] scriptタグ対応、Plugin Command対応、Common Event対応 // 0.3.3 2018/08/28 コメントアウト記号の前、行頭に任意個の空白を認めるように変更 // 0.3.2 2018/08/28 MapIDをIntegerへ変更 // 0.3.1 2018/08/27 CE書き出し追加 // 0.3.0 2018/08/26 機能が増えた // 0.2.0 2018/08/24 機能テスト版 // 0.1.0 2018/08/18 最小テスト版 // ---------------------------------------------------------------------------- // [Twitter]: https://twitter.com/kryptos_nv/ // [GitHub] : https://github.com/yktsr/ //============================================================================= /*: *: @target MZ * @plugindesc Simple compiler to convert text to event command. * @author Yuki Katsura, えーしゅん * * @command IMPORT_MESSAGE_TO_EVENT * @text Import message to event * @desc Import a message to the event. Specify the source file information and the map, event, page ID, etc. to be imported. * * @arg FileFolder * @text Scenario Folder Name * @desc Setting of the folder name which the text file is stored. Default is "text". * @type string * @default text * * @arg FileName * @text Scenario File Name * @desc setting of text file name. Default is "message.txt". * @type string * @default message.txt * * @arg MapID * @text MapID * @desc Map ID of the output destination. Default is "1". It means that it is taken in the map ID 1. * @type number * @default 1 * * @arg EventID * @text EventID * @desc setting of the eventID of the output destination. Default is "2". It means that it is taken in the event ID 2. * @type number * @default 2 * * @arg PageID * @text PageID * @desc page ID of the output destination. Default is "1". It means that it is taken in the page ID 1. * @type number * @default 1 * * @arg IsOverwrite * @text !!!Is overwrite!!! * @desc text is added to the end of event, this param can change it to overwrite. Default is false. * @default false * @type select * @option true(!!!overwrite!!!) * @value true * @option false(don't overwrite) * @value false * @default false * * @command IMPORT_MESSAGE_TO_CE * @text Import message to a common event. * @desc Import a message to a common event. Specify the source file information, the common event ID of the destination, etc. * * @arg FileFolder * @text Scenario Folder Name * @desc Setting of the folder name which the text file is stored. Default is "text". * @type string * @default text * * @arg FileName * @text Scenario File Name * @desc setting of text file name. Default is "message.txt". * @type string * @default message.txt * * @arg CommonEventID * @text Common Event ID * @desc setting of the common event ID of the output destination. Default is "1". It means that it is taken in the common event 1. * @type common_event * @default 1 * * @arg IsOverwrite * @text !!!Is overwrite!!! * @desc text is added to the end of event, this param can change it to overwrite. Default is false. * @default false * @type select * @option true(!!!overwrite!!!) * @value true * @option false(don't overwrite) * @value false * @default false * * @param Default Window Position * @text Window Position * @desc Default setting of window position. Default is "Bottom". Command line mode can overwrite this option. * @type select * @option Top * @option Middle * @option Bottom * @default Bottom * * @param Default Background * @text Background * @desc Default setting of background. Default is "Window". Command line mode can overweite this option. * @type select * @option Window * @option Dim * @option Transparent * @default Window * * @param Default Scenario Folder * @text Scenario Folder Name * @desc Default setting of the folder name which the text file is stored. Default is "text". * @default text * @require 1 * @dir text * @type string * * @param Default Scenario File * @text Scenario File Name * @desc Default setting of text file name. Default is "message.txt". * @default message.txt * @require 1 * @dir text * @type string * * @param Default Common Event ID * @text Common Event ID * @desc Default setting of the common event ID of the output destination. Default is "1". It means that it is taken in the common event 1. * @default 1 * @type common_event * * @param Default MapID * @text MapID * @desc Default setting of the map ID of the output destination. Default is "1". It means that it is taken in the map ID 1. * @default 1 * @type number * * @param Default EventID * @text EventID * @desc Default setting of the eventID of the output destination. Default is "1". It means that it is taken in the event ID 2. * @default 2 * @type number * * @param Default PageID * @text PageID * @desc page ID of the output destination. Default is "1". It means that it is taken in the page ID 1. * @default 1 * @type number * * @param IsOverwrite * @text IsOverwrite * @desc In the default case, text is added to the end of event, this param can change it to overwrite. Default is false. * @default false * @type boolean * * @param Comment Out Char * @text Comment Out Char * @desc If this charactor is placed at the beginning of a line, this line is not taken. Default is %. * @default % * @type string * * @param IsDebug * @text IsDebug * @desc Detail log is outputted to console log (F8). Default is false. * @default false * @type boolean * * @param DisplayMsg * @text DisplayMsg * @desc Display messages when execution. * @default true * @type boolean * * @param DisplayWarning * @text DisplayWarning * @desc Display warnings when execution. * @default true * @type boolean * * @help * Update Soon. * Please see wiki. * https://github.com/yktsr/Text2Frame-MV/wiki */ /*:ja * @target MZ * @plugindesc テキストファイル(.txtファイルなど)から「文章の表示」イベントコマンドに簡単に変換するための、開発支援プラグインです。ツクールMV・MZの両方に対応しています。 * @author Yuki Katsura, えーしゅん * * @command IMPORT_MESSAGE_TO_EVENT * @text イベントにインポート * @desc イベントにメッセージをインポートします。取り込み元ファイルの情報や、取り込み先のマップ・イベント・ページID等を指定します。 * * @arg FileFolder * @text 取り込み元フォルダ名 * @desc テキストファイルを保存しておくフォルダ名を設定します。デフォルトはtextです。 * @type string * @default text * * @arg FileName * @text 取り込み元ファイル名 * @desc 読み込むシナリオファイルのファイル名を設定します。デフォルトはmessage.txtです。 * @type string * @default message.txt * * @arg MapID * @text 取り込み先マップID * @desc 取り込み先となるマップのIDを設定します。デフォルト値は1です。 * @type number * @default 1 * * @arg EventID * @text 取り込み先イベントID * @desc 取り込み先となるイベントのIDを設定します。デフォルト値は2です。 * @type number * @default 2 * * @arg PageID * @text 取り込み先ページID * @desc 取り込み先となるページのIDを設定します。デフォルト値は1です。 * @type number * @default 1 * * @arg IsOverwrite * @text 【取り扱い注意】上書きする * @desc 通常イベントの末尾に追加しますが、上書きに変更できます。trueのとき上書きです。デフォルト値はfalseです。 * @type select * @option true(!!!上書きする!!!) * @value true * @option false(上書きしない) * @value false * @default false * * @command IMPORT_MESSAGE_TO_CE * @text コモンイベントにインポート * @desc コモンイベントにメッセージをインポートします。取り込み元ファイルの情報や、取り込み先のコモンイベントID等を指定します。 * * @arg FileFolder * @text 取り込み元フォルダ名 * @desc テキストファイルを保存しておくフォルダ名を設定します。デフォルトはtextです。 * @type string * @default text * * @arg FileName * @text 取り込み元ファイル名 * @desc 読み込むシナリオファイルのファイル名を設定します。デフォルトはmessage.txtです。 * @type string * @default message.txt * * @arg CommonEventID * @text 取り込み先コモンイベントID * @desc 出力先のコモンイベントIDを設定します。デフォルト値は1です。 * @type common_event * @default 1 * * @arg IsOverwrite * @text 【取り扱い注意】上書きする * @desc 通常イベントの末尾に追加しますが、上書きに変更できます。trueのとき上書きです。デフォルト値はfalseです。 * @type select * @option true(!!!上書きする!!!) * @value true * @option false(上書きしない) * @value false * @default false * * @param Default Window Position * @text 位置のデフォルト値 * @desc テキストフレームの表示位置デフォルト値を設定します。デフォルトは下です。個別に指定した場合は上書きされます。 * @type select * @option 上 * @option 中 * @option 下 * @default 下 * * @param Default Background * @text 背景のデフォルト値 * @desc テキストフレームの背景デフォルト値を設定します。デフォルトはウインドウです。個別に指定した場合は上書きされます。 * @type select * @option ウインドウ * @option 暗くする * @option 透明 * @default ウインドウ * * @param Default Scenario Folder * @text 取り込み元フォルダ名 * @desc テキストファイルを保存しておくフォルダ名を設定します。デフォルトはtextです。(MZでは無視されます) * @default text * @require 1 * @dir text * @type string * * @param Default Scenario File * @text 取り込み元ファイル名 * @desc 読み込むシナリオファイルのファイル名を設定します。デフォルトはmessage.txtです。(MZでは無視されます) * @default message.txt * @require 1 * @dir text * @type string * * @param Default Common Event ID * @text 取り込み先コモンイベントID * @desc 出力先のコモンイベントIDを設定します。デフォルト値は1です。(MZでは無視されます) * @default 1 * @type common_event * * @param Default MapID * @text 取り込み先マップID * @desc 取り込み先となるマップのIDを設定します。デフォルト値は1です。(MZでは無視されます) * @default 1 * @type number * * @param Default EventID * @text 取り込み先イベントID * @desc 取り込み先となるイベントのIDを設定します。デフォルト値は2です。(MZでは無視されます) * @default 2 * @type number * * @param Default PageID * @text 取り込み先ページID * @desc 取り込み先となるページのIDを設定します。デフォルト値は1です。(MZでは無視されます) * @default 1 * @type number * * @param IsOverwrite * @text 【取り扱い注意】上書きする * @desc 通常イベントの末尾に追加しますが、上書きに変更できます。trueのとき上書きです。デフォルト値はfalseです。 * @default false * @type boolean * * @param Comment Out Char * @text コメントアウト記号 * @desc 行頭に置いた場合、その行をコメントとして処理する記号を定義します。デフォルト値は「%」(半角パーセント)です。 * @default % * @type string * * @param IsDebug * @text デバッグモードを利用する * @desc F8のコンソールログにこのプラグインの詳細ログが出力されます。デフォルト値はfalseです。処理時間が伸びます。 * @default false * @type boolean * * @param DisplayMsg * @text メッセージ表示 * @desc 実行時に通常メッセージを表示します。OFFで警告以外のメッセージが表示されなくなります。デフォルト値はtrueです。 * @default true * @type boolean * * @param DisplayWarning * @text 警告文表示 * @desc 実行時に警告を表示します。OFFで警告が表示されなくなります。デフォルト値はtrueです。 * @default true * @type boolean * * @help * 本プラグインはテキストファイル(.txtファイルなど)から「文章の表示」イベント * コマンドに簡単に変換するための、開発支援プラグインです。キャラクター同士の * 会話などをツクールMV・MZ**以外**のエディタで編集して、後でイベントコマンド * として組み込みたい人をサポートします。 * * 所定のプラグインコマンド(後述)を実行することにより、テキストファイルを読 * み込み、ツクールMV・MZのマップイベントまたはコモンイベントにイベントコマン * ドとして取り込むことができます。 * * テストプレイおよびイベントテスト(イベントエディタ上で右クリック→テスト) * から実行することを想定しています。 * * また、追加機能としてフェードインやBGM再生等のイベントコマンドも組み込むこ * とができます。追加機能の詳細はこのREADMEの下部に記載していますので、そちら * をご覧ください * * なお、以下のヘルプ文の内容は本プラグインのWikiにも記載しています。 * * https://github.com/yktsr/Text2Frame-MV/wiki * * Wikiのほうが閲覧しやすいと思いますので、RPGツクールMV・MZ上では読みづらい * と感じた場合は、こちらをご覧ください。 * * * ------------------------------------- * ツクールMVでの実行方法 * -------------------------------------- * 1. dataフォルダのバックアップをとっておく。(重要) * * 2. プロジェクトの最上位フォルダ(dataやimgのあるところ)にフォルダを作成する。 * * 3. 作成したフォルダに読み込みたいテキストファイルを保存する。 * * 4. 任意のマップ・位置に空のイベントをひとつ作成します。 * この時マップID, イベントID, ページIDをメモしておきましょう。 * マップIDは画面左のマップを、右クリック→「編集」として出るウィンドウの * 左上に記載されています。 * イベントIDはイベントをダブルクリックして出るイベントエディターの左上に * 記載されています。 * ページIDはイベントエディターのイベントの名前の下に記載されています。 * * 5. プラグインの管理画面から本プラグインのパラメータを下記の通り編集します。 * ・「取り込み元フォルダ名」に2.で作成したフォルダのフォルダ名を入力。 * (デフォルトはtextです) * ・「取り込み元ファイル名」に3.で保存したファイルのファイル名を入力。 * (デフォルトはmessage.txtです) * ・「取り込み先マップID」に4.でメモしたマップIDを入力。 * (デフォルトは1です) * ・「取り込み先イベントID」に4.でメモしたイベントIDを入力。 * (デフォルトは2です) * ・「取り込み先ページID」に4.でメモしたページIDを入力。 * (デフォルトで1です) * * 6. 以下のうちいずれかを記述したプラグインコマンドを作成する。 * IMPORT_MESSAGE_TO_EVENT * メッセージをイベントにインポート * これらは全く同じ機能なのでどちらを使ってもかまいません。 * * 7. 作成したイベントコマンドをテストプレイかイベントテストで実行する。 * 実行前に本プラグインを管理画面からONにして「プロジェクトの保存」を * 実行しておきましょう。 * * 8. **セーブせずに**プロジェクトを開き直します。 * 成功していれば、7.で設定したマップのイベントの中に「文章の表示」 * イベントコマンドとして書きだされています。 * デフォルトの場合はtextフォルダのmessage.txtの内容を * IDが1のマップの、IDが1のイベントの、IDが1のページに書き出したことに * なります。 * * ------------------------------------- * ツクールMZでの実行方法 * -------------------------------------- * 1. dataフォルダのバックアップをとっておく。(重要) * * 2. プロジェクトの最上位フォルダ(dataやimgのあるところ)にフォルダを作成する。 * * 3. 作成したフォルダに読み込みたいテキストファイルを保存する。 * * 4. 任意のマップ・位置に空のイベントをひとつ作成します。 * この時マップID, イベントID, ページIDをメモしておきましょう。 * マップIDは画面左のマップを、右クリック→「編集」として出るウィンドウの * 左上に記載されています。 * イベントIDはイベントをダブルクリックして出るイベントエディターの左上に * 記載されています。 * ページIDはイベントエディターのイベントの名前の下に記載されています。 * * 5. 以下の手順でプラグインコマンドを作成する。 * ・ プラグイン名「Text2Frame」のコマンド「イベントにインポート」を選択 * ・引数を下記のように設定する。 * -「取り込み元フォルダ名」に2.で作成したフォルダのフォルダ名を入力。 * (デフォルトはtextです) * -「取り込み元ファイル名」に3.で保存したファイルのファイル名を入力。 * (デフォルトはmessage.txtです) * -「取り込み先マップID」に4.でメモしたマップIDを入力。 * (デフォルトは1です) * -「取り込み先イベントID」に4.でメモしたイベントIDを入力。 * (デフォルトは2です) * -「取り込み先ページID」に4.でメモしたページIDを入力。 * (デフォルトで1です) * * 6. 作成したイベントコマンドをテストプレイかイベントテストで実行する。 * 実行前に本プラグインを管理画面からONにして「プロジェクトの保存」を * 実行しておきましょう。 * * 7. **セーブせずに**リロードする、もしくはプロジェクトを開き直す。 * 成功していれば、7.で設定したマップのイベントの中に「文章の表示」 * イベントコマンドとして書きだされています。 * デフォルトの場合はtextフォルダのmessage.txtの内容を * IDが1のマップの、IDが1のイベントの、IDが1のページに書き出したことに * なります。 * * * -------------------------------------- * テキストファイルの書き方 * -------------------------------------- * ◆ 基本となる書き方 * 1つのメッセージを改行で区切るという書き方をします。 * 例えば以下の通りです。 * * ↓↓↓↓↓ここから例文1↓↓↓↓↓ * やめて!ラーの翼神竜の特殊能力で、 * ギルフォード・ザ・ライトニングを焼き払われたら、 * 闇のゲームでモンスターと繋がってる城之内の精神まで燃え尽きちゃう! * * お願い、死なないで城之内!あんたが今ここで倒れたら、 * 舞さんや遊戯との約束はどうなっちゃうの? * ライフはまだ残ってる。 * ここを耐えれば、マリクに勝てるんだから! * * 次回、「城之内死す」。デュエルスタンバイ! * ↑↑↑↑↑ここまで例文1↑↑↑↑↑ * * この場合は3つの「文章の表示」イベントコマンドに変換されて * 取り込まれます。改行は何行いれても同様の動作になります。 * 以上の方法で実行した場合、 * メッセージウィンドウの「背景」「ウィンドウ位置」については * プラグインパラメータの「位置のデフォルト値」「背景のデフォルト値」の * 値が反映されます。 * * ◆ タグについて * Text2Frameは文章を単純に組み込むだけでなく、タグを挿入することでより柔軟な * 設定を可能としています。例えば、メッセージの顔・背景・ウィンドウの位置変更 * や名前の設定(MZ限定)、メッセージ以外のイベントコマンドを挿入することが可能 * です。各タグについては以降の説明をご覧ください。 * * タグについては以下の特徴があります。 * ・タグや値の大文字小文字は区別されません。(ファイル名の指定は除く) * (例:FaceとFACEは同じ動作です) * ・タグは同じ行に複数個配置することができます。 * (例:<顔: Actor1(0)><位置: 上><背景: 暗く> * ・基本は英語で指定ですが、省略形や日本語で指定可能な場合もある。 * * ◆ 顔・背景・ウィンドウ位置・名前の設定について * それぞれのメッセージの「顔」「背景」「ウィンドウ位置」「名前」については、 * メッセージの手前にタグを記述することで指定することができます。 * 上述の例のように指定しない場合は、パラメータで設定したものが適用されます。 * * 例えば以下の通りです。 * * ↓↓↓↓↓ここから例文2↓↓↓↓↓ * <Face: Actor1(0)><WindowPosition: Bottom><Background: Dim><Name: 真崎杏子> * やめて!ラーの翼神竜の特殊能力で、 * ギルフォード・ザ・ライトニングを焼き払われたら、 * 闇のゲームでモンスターと繋がってる城之内の精神まで燃え尽きちゃう! * * <WindowPosition: Top><Name: 真崎杏子> * お願い、死なないで城之内!あんたが今ここで倒れたら、 * 舞さんや遊戯との約束はどうなっちゃうの? * ライフはまだ残ってる。 * ここを耐えれば、マリクに勝てるんだから! * * 次回、「城之内死す」。デュエルスタンバイ! * ↑↑↑↑↑ここまで例文2↑↑↑↑↑ * * この例の場合では、 * 1つ目のメッセージ(やめて!〜)ではActor1ファイルの場所が1の顔が表示(詳細は後 * 述)され、位置は下、背景が暗いメッセージウィンドウになります。名前は「真崎杏 * 子」と表示されます。 * * 2つ目のメッセージ(お願い、〜)は、位置が上であることと名前だけ指定されてい * ます。指定されなかった他の顔や背景はプラグインのパラメータで設定されている * ものが適用されます。ここでも名前は「真崎杏子」と表示されます。 * * 3つめのメッセージ(次回、〜)は、何も指定されていません。 * そのため、例文1と同様にプラグインのパラメータで設定されているものが適用され * ます。ここでは名前は表示されません。 * * タグの詳細は下記をご覧ください。 * * ○ 顔の指定方法 * <Face: ファイル名(顔の指定番号)> * <FC: ファイル名(顔の指定番号)> * <顔: ファイル名(顔の指定番号)> * * の3つのうちいずれかの記法で指定します。 * ファイル名はimg/facesのフォルダ内のものを参照します。 * 顔の指定番号は、ファイルの中で参照する位置を指定します。 * 番号の法則はツクールMV・MZの仕様に準拠します。最も左上が0,右下が7です。 * * ○ 位置の指定方法 * <WindowPosition: 表示したい位置> * <WP: 表示したい位置> * <位置: 表示したい位置> * * の3つのうちいずれかの記法で指定します。 * 表示したい位置に記述できるのは以下の3種類です。 * ・Top # 上 * ・Middle # 中 * ・Bottom # 下 * Topは「上」、Middleは「中」、Bottomは「下」となります。 * それぞれ大文字小文字を区別しません。つまりTOP,top,toPなどはTopと同じです。 * また、英語ではなく<WindowPosition: 上>のように日本語指定もできます。 * * ○ 背景の設定方法 * <Background: 背景の指定> * <BG: 背景の指定> * <背景: 背景の指定> * * の3つのうちいずれかの記法で指定します。 * 背景の指定に記述できるのは、以下の3種類です。 * ・Window # ウィンドウ * ・Dim # 暗くする * ・Transparent # 透明 * Windowは「ウィンドウ」,Dimは「暗くする」,Transparentは「透明」となります。 * それぞれ大文字小文字を区別しません。 * また、英語ではなくて<Background: ウィンドウ>のように日本語指定もできます。 * * ○ 名前の設定方法【MZ用】 * メッセージウィンドウへの名前の設定は * <Name: 設定する名前> * <NM: 設定する名前> * <名前: 設定する名前> * * の3つのうちいずれかの記法で指定します。 * 例えば、<Name: リード>と設定することで、名前欄に「リード」と設定できます。 * * * ◆ コメントアウトについて * テキストファイルのうち、イベントコマンドとして取り込まないようにする、 * いわゆるコメントアウトをするための記法もあります。 * メモ書き等に利用することができます。 * * 行頭に「%」(半角パーセント)を記述することで、実現できます。 * * ↓↓↓↓↓ここから例文3↓↓↓↓↓ * % かわいい感じで * 今日も一日がんばるぞい! * ↑↑↑↑↑ここまで例文3↑↑↑↑↑ * * このように記載することで、実際に取り込まれるのは * 「今日も一日がんばるぞい!」のみとなります。 * 「かわいい感じで」はメッセージとしては取り込まれません。 * * なお、コメントアウト記号はプラグインパラメータから自由に変更可能です。 * 「%」はあくまでデフォルト値です。 * * * -------------------------------------- * コモンイベントへの書き出し * -------------------------------------- * マップのイベントではなくコモンイベントに取り込むことも可能です。 * ◆ ツクールMVの場合 * 以下のプラグインコマンドのうちいずれかを使用してください。 * IMPORT_MESSAGE_TO_CE * メッセージをコモンイベントにインポート * これらは全く同じ機能なのでどちらを使ってもかまいません。 * 取り込む先のコモンイベントのIDはプラグインパラメータの * 「取り込み先コモンイベントID」で指定できます。 * * ◆ ツクールMZの場合 * プラグインコマンドからプラグイン名「Text2Frame」のコマンド * 「コモンイベントにインポート」を選択してください。 * フォルダ名・ファイル名・取り込み先のコモンイベントIDを引数から * 入力してください。 * * * -------------------------------------- * ツクールMVでのプラグインコマンドの引数 * -------------------------------------- * ツクールMVでのプラグインコマンドに引数を設定することにより、プラグインパラ * メータで指定したテキストファイルやマップIDとは違うパラメータで実行ができま * す。 * * 例1:text/message.txtをマップIDが1, イベントIDが2, ページIDが3で上書きせず * に取り込む。 * IMPORT_MESSAGE_TO_EVENT text message.txt 1 2 3 false * メッセージをイベントにインポート text message.txt 1 2 3 false * * 例2:text/message.txtをIDが3のコモンイベントに上書きしてに取り込む。 * IMPORT_MESSAGE_TO_CE text message.txt 3 true * メッセージをコモンイベントにインポート text message.txt 3 true * * ◆ 旧版のプラグインコマンドの引数(非推奨) * 最新版(ツクールMZ対応後,ver2.0.0)と旧版(ツクールMZ対応前,ver1.4.1)では、 * イベントへのインポートにおいて仕様が異なります。 * 以下の旧仕様でも実行は可能ですが、非推奨となっております。 * * 例:text/message.txtをマップIDが1, イベントIDが2, ページIDが3で上書きせず * に取り込む(ページIDは1として)。 * IMPORT_MESSAGE_TO_EVENT text message.txt 1 2 false * メッセージをイベントにインポート text message.txt 1 2 false * * 旧版ではページIDの指定ができず、必ず1となっていました。 * * * -------------------------------------- * 追加機能(その他イベントコマンドの組み込み) * -------------------------------------- * メッセージだけでなく、指定の記法を用いることでいくつかのイベントコマンドを * 組み込むこともできます。 * 例えば、 * * ↓↓↓↓↓ここから例文4↓↓↓↓↓ * <=: 1, 2> * <CommonEvent: 3> * 今日も一日がんばるぞい! * ↑↑↑↑↑ここまで例文4↑↑↑↑↑ * * とすることで、「今日も一日がんばるぞい!」というメッセージの前に、 * 「変数の操作(変数1に定数2を代入する)」と「コモンイベント(ID3)」のイベント * コマンドが組み込まれます。 * * 現在対応しているコマンドは以下のとおりです。 * - (1) スイッチの操作 * - (2) 変数の操作 * - (3) セルフスイッチの操作 * - (4) タイマーの操作 * - (5) 条件分岐 * - (6) ループ * - (7) ループの中断 * - (8) イベント処理の中断 * - (9) コモンイベント * - (10) ラベル * - (12) 注釈 * - (13) ピクチャの表示 * - (14) ピクチャの移動 * - (15) ピクチャの回転 * - (16) ピクチャの色調変更 * - (17) ピクチャの消去 * - (18) ウェイト * - (19) 画面のフェードアウト * - (20) 画面のフェードイン * - (21) BGMの演奏 * - (22) BGMのフェードアウト * - (23) BGMの保存 * - (24) BGMの再開 * - (25) BGSの演奏 * - (26) BGSのフェードアウト * - (27) MEの演奏 * - (28) SEの演奏 * - (29) SEの停止 * - (30) 戦闘BGMの変更 * - (31) スクリプト * - (32) プラグインコマンド * * ○ (1) スイッチの操作 * 「スイッチの操作」は以下の記法で組み込むことができます。 * <Switch: スイッチ番号, 代入値("ON" or "OFF")> * "Switch"は"SW", "スイッチ"でも代替できます。 * * 例えば、以下の通りです。 * 例1: 番号1のスイッチをONにする。 * <Switch: 1, ON> * <SW: 1, ON> * <スイッチ: 1, ON> * 例2: 番号1-10のスイッチをすべてOFFにする。 * <Switch: 1-10, OFF> * <SW: 1-10, OFF> * <スイッチ: 1-10, OFF> * * スイッチ番号は単一か範囲で指定します。範囲の場合は"1-10"のようにハイフンで * 始端と終端をつなげます。 * 代入値は基本的に"ON"か"OFF"で指定します。 * "ON"は"オン", "true", "1"として、 * "OFF"は"オフ", "false", "0"でも代替できます。 * * * ○ (2) 変数の操作 * 「変数の操作」は、代入・加算・減算・乗算・除算・除算・余剰をそれぞれ以下の * 記法で組み込みます。 * ・代入 * <Set: 変数番号, オペランド> * "Set"は"=" か"代入"でも代替できます。 * * ・加算(足し算) * <Add: 変数番号, オペランド> * "Add"は"+" か"加算"でも代替できます。 * * ・減算(引き算) * <Sub: 変数番号, オペランド> * "Sub"は"-" か"減算"でも代替できます。 * * ・乗算(掛け算) * <Mul: 変数番号, オペランド> * "Mul"は"*" か"乗算"でも代替できます。 * * ・除算(割り算) * <Div: 変数番号, オペランド> * "Div"は"/" か"除算"でも代替できます。 * * ・剰余(割り算のあまり) * <Mod: 変数番号, オペランド> * "Mod"は"%" か"剰余"でも代替できます。 * * 変数番号は単一か範囲で指定します。範囲の場合は"1-10"のようにハイフンで * 始端と終端をつなげます。 * オペランドでは演算対象の値を定数・変数・乱数・ゲームデータ・スクリプトで * 指定します。指定方法の詳細を述べる前に、以下にいくつか具体例を記します。 * * 例1: 変数1に定数2を代入する。 * <Set: 1, 2> * <=: 1, 2> * <代入: 1, 2> * * 例2: 1から10の変数すべてに変数2の値を加算する。 * <Add: 1-10, variables[2]> * <+: 1-10, V[2]> * <加算: 1-10, 変数[2]> * * 例3: 変数1に50から100の乱数を減算する。 * <Sub: 1, random[50][100]> * <-: 1, r[50][100]> * <減算: 1, 乱数[50][100]> * * 例4: 1から10の変数すべてににゲームデータのアクター2のレベルを乗算する。 * <Mul: 1-10, GameData[actor][2][level]> * <*: 1-10, gd[actor][2][level]> * <乗算: 1-10, ゲームデータ[アクター][2][レベル]> * * 例5: 変数1にゲームデータのパーティ人数を除算する。 * <Div: 1, GameData[PartyMembers]> * </: 1, gd[PartyMembers]> * <除算: 1, ゲームデータ[パーティ人数]> * * 例6: 変数1にスクリプト"$gameVariables.value(1)"の値との剰余を代入する。 * <Mod: 1, Script[$gameVariables.value(1)]> * <%: 1, sc[$gameVariables.value(1)]> * <剰余: 1, スクリプト[$gameVariables.value(1)]> * * オペランドに定数を指定する場合は、 * "1","2"のように数値をそのままお書きください。 * * オペランドに変数を指定する場合は、 * Variables[変数番号] * で指定します。Variablesは"V"か"変数"で代替できます。 * 例えば、変数2の場合は"Variables[2]"とお書きください。 * * オペランドに乱数を指定する場合は、 * Random[最小値][最大値] * で指定します。Randomは"R"か"乱数"で代替できます。 * 例えば、最小値50, 最大値50の乱数の場合は"Random[50][100]"とお書きください。 * * オペランドにスクリプトを指定する場合は、 * Script[スクリプト本文(Javascript)] * で指定します。Scriptは"SC"か"スクリプト"で代替できます。 * 例えば、$gameVariables.value(1)の場合は、"Script[$gameVariables.value(1)]" * とお書きください。 * * オペランドにゲームデータを指定する場合は、 * GameData[引数1][引数2][引数3] * で指定します。GameDataは"gd"か"ゲームデータ"で代替できます。 * 引数1,2,3で使用するゲームデータの値を指定します。 * 引数1には * アイテム・武器・防具・アクター・敵キャラ・キャラクター・パーティ・その他 * のいずれかを指定します。どれを指定するかで引数2,3の扱いも変わるので、ケー * スにわけて説明します。 * ・アイテム * GameData[Item][アイテムID] * 例: 変数1にIDが5のアイテムの所持数を代入する。 * <Set: 1, GameData[Item][5]> * 引数1の"Item"は"アイテム"でも代替できます。引数3は使用しません。 * * ・武器 * GameData[Weapon][武器ID] * 例: 変数1にIDが5の武器の所持数を代入する。 * <Set: 1, GameData[Weapon][5]> * 引数1の"Weapon"は"武器"でも代替できます。引数3は使用しません。 * * ・防具 * GameData[Armor][防具ID] * 例: 変数1にIDが5の防具の所持数を代入する。 * <Set: 1, GameData[Armor][5]> * 引数1の"Armor"は"防具"でも代替できます。引数3は使用しません。 * * ・アクター * GameData[Actor][アクターID][パラメータ名] * 例: 変数1にIDが4のアクターのレベルを代入する。 * <Set: 1, GameData[actor][4][Level]> * 引数3のパラメータ名は以下のリストからご指定ください。 * - レベル: "Level", "レベル" * - 経験値: "Exp", "経験値" * - HP: "HP" * - MP: "MP" * - 最大HP: "MaxHp", "最大HP" * - 最大MP: "MaxMP", "最大MP" * - 攻撃力: "Attack", "攻撃力" * - 防御力: "Defense", "防御力" * - 魔法攻撃力: "M.Attack", "魔法攻撃力" * - 魔法防御力: "M.Defense", "魔法防御力" * - 敏捷性: "Agility", "敏捷性" * - 運: "Luck", "運" * * ・敵キャラ * GameData[Enemy][(戦闘中の)敵キャラID][パラメータ名] * 例: 変数1に戦闘中の2番目の敵キャラのHPを代入する。 * <Set: 1, GameData[Enemy][2][HP]> * パラメータ名は、上述したゲームデータのアクターのパラメータ名のリストを * 参照してください。ただし、レベルと経験値は設定出来ません。 * * ・キャラクター * GameData[Character][イベントの指定][参照値] * 例1: 変数1にプレイヤーのマップX座標を代入する。 * <Set: 1, GameData[Character][Player][MapX]> * 例2: 変数1にこのイベントの方向を代入する。 * <Set: 1, GameData[Character][ThisEvent][Direction]> * 例3: 変数1にID2のイベントの画面Y座標を代入する。 * <Set: 1, GameData[Character][2][ScreenY]> * 引数2のイベントの指定は以下のリストからご指定ください。 * - プレイヤー: "Player", "プレイヤー", "-1" * - このイベント: "ThisEvent", "このイベント", "0" * - イベントID指定: "1", "2", ... * 引数3の参照値は以下のリストからご指定ください。 * - マップX座標: "MapX", "マップX" * - マップY座標: "MapY", "マップY" * - 方向: "Direction", "方向" * - 画面X座標: "ScreenX", "画面X" * - 画面Y座標: "ScreenY", "画面Y" * * ・パーティ * GameData[party][並び順] * 例: パーティの先頭のアクターIDを変数1に代入する。 * <Set: 1, gamedata[party][1]> * 並び順は整数で指定します。 * 引数1の"party"は"パーティ"でも代替できます。 * * ・ 直前 * GameData[Last][項目] * * 例: 直前に使用したスキルのIDを変数1に代入する。 * <Set: 1, gamedata[Last][Last Used Skill ID]> * * 項目は以下のリストからご指定ください。 * - 直前に使用したスキルのID: * - "Last Used Skill ID" * - "直前に使用したスキルのID" * - "Used Skill ID" * - 直前に使用したアイテムのID: * - "Last Used Item ID" * - "直前に使用したアイテムのID" * - "Used Item ID" * - 直前に行動したアクターのID: * - "Last Actor ID to Act" * - "直前に行動したアクターのID" * - "Actor ID to Act" * - 直前に行動した敵キャラのインデックス: * - "Last Enemy Index to Act" * - "直前に行動した敵キャラのインデックス" * - "Enemy Index to Act" * - 直前に対象となったアクターのID: * - "Last Target Actor ID" * - "直前に対象となったアクターのID" * - "Target Actor ID" * - 直前に対象となった敵キャラのインデックス: * - "Last Target Enemy Index" * - "直前に対象となった敵キャラのインデックス" * - "Target Enemy Index" * * 引数1の"Last"は"直前"でも代替できます。 * * * ・その他 * その他では、引数1のみを使用します。以下のリストから指定してください。 * - パーティ人数: "PartyMembers", "パーティ人数" * - 所持金: "gold", "所持金", * - 歩数: "steps", "歩数" * - プレイ時間: "PlayTime", "プレイ時間" * - タイマー: "timer", "タイマー" * - セーブ回数: "SaveCount", "セーブ回数" * - 戦闘回数: "BattleCount", "戦闘回数" * - 勝利回数: "WinCount", "勝利回数" * - 逃走回数: "EscapeCount", "逃走回数" * * 例: パーティ人数を変数1に代入する。 * <Set: 1, gamedata[PartyMembers]> * * * ○ (3) セルフスイッチの操作 * 「セルフスイッチの操作」は以下の記法で組み込むことができます。 * <SelfSwitch: セルフスイッチ記号, 代入値("ON" or "OFF")> * "SelSwitch"は"SSW", "セルフスイッチ"でも代替できます。 * * 例1: セルフスイッチAをONにする。 * <SelfSwitch: A, ON> * <SSW: A, true> * <セルフスイッチ: A, オフ> * 例2: セルフスイッチBをOFFにする。 * <SelfSwitch: B, OFF> * <SSW: B, false> * <セルフスイッチ: B, オフ> * * 代入値は基本的に"ON"か"OFF"で指定します。 * "ON"は"オン", "true", "1"として、 * "OFF"は"オフ", "false", "0"でも代替できます。 * * * ○ (4) タイマーの操作 * 「タイマーの操作」は以下のいずれか記法で組み込みます。 * <Timer: 操作, 分, 秒> * <タイマー: 操作, 分, 秒> * * 操作ではスタートするかストップするかを以下の記法で指定する。 * - スタート: "Start", "始動", "スタート" * - ストップ: "Stop", "停止", "ストップ" * スタートの場合は分と秒を数値で指定してください。 * ストップでは分と秒は指定しないでください。 * * 例1: 1分10秒のタイマーをスタートする * <Timer: Start, 1, 10> * <タイマー: 始動, 1, 10> * <タイマー: スタート, 1, 10> * 例2: タイマーをストップする * <Timer: Stop> * <タイマー: 停止> * <タイマー: ストップ> * * ○ (5) 条件分岐 * 「条件分岐」は、以下の記法で組み込みます。 * --- * <If: 条件の対象, 引数1, 引数2, 引数3> * 条件を満たしている時の処理 * <Else> * 条件を満たしていない時の処理 * --- * 詳細を述べる前に、いくつか具体例を記します。 * いずれの例も、条件が満たされているときは * 「私もずっと前から好きでした。」 * というメッセージを、条件を満たさないときは * 「ごめんなさい。お友達でいましょう。」 * とメッセージを表示します。 * * 例1: スイッチ1がONのとき * --- * <If: Switch[1], ON> * 私もずっと前から好きでした。 * <Else> * ごめんなさい。お友達でいましょう。 * <End> * --- * * 例2: 変数1が定数2と等しいとき * --- * <If: Variables[1], ==, 2> * 私もずっと前から好きでした * <Else> * ごめんなさい。お友達でいましょう。 * <End> * --- * * 例3: ID1のアクターがパーティにいるとき * --- * <If: Actors[1], in the party> * 私もずっと前から好きでした。 * <Else> * ごめんなさい。お友達でいましょう。 * <End> * --- * * 条件の対象毎に引数の記法が異なり、引数2,引数3を使わないものもあります。 * 以降、条件の対象毎に記法を説明します。 * * ・スイッチを条件に使うとき * スイッチを条件に使うときは、以下のように条件を書きます。 * <If: Switches[スイッチID], 値("ON" or "OFF")> * * "Switches"は"SW"や"スイッチ"で代替できます。 * また、代入値は基本的に"ON"か"OFF"で指定しますが、 * 以下のような代替記号でも指定できます。 * - "ON": "オン", "true", "1" * - "OFF": "オフ", "false", "0" * * 例えば、以下の通りです。 * 例1: スイッチ1が"ON"のとき * - "<If: Switches[1], ON>" * - "<If: SW[1], true>" * - "<If: スイッチ[1], オン>" * 例2: スイッチ1が"OFF"のとき * - "<If: Switches[1], OFF>" * - "<If: SW[1], false>" * - "<If: スイッチ[1], オフ>" * * ・変数を条件に使うとき * 変数を条件に使うときは、以下のように条件を書きます。 * <If: Variables[変数ID], 条件式(記号), オペランド(定数 or 変数)> * * "Variables"は"V"や"変数"でも代替できます。 * 条件式に使える記号は以下の通りです。 * - 等しい: "==" , "="(全角のイコールです) * - 以上: ">=", "≧" * - 以下: "<=", "≦" * - 大きい: ">", ">" * - 小さい: "<", "<" * - 等しくない: "!=", "≠" * * オペランドの指定方法は以下の通りです。 * - 定数: "1", "2"など数値をそのまま記入 * - 変数: "Variables[変数ID]", "V[変数ID]", "変数[変数ID]" * * 例えば、以下の通りです。 * 例1: 変数1が定数2と等しいとき * - "<If: Variables[1], ==, 2>" * - "<If: V[1], ==, 2>" * - "<If: 変数[1], =, 2>" * 例2: 変数1が変数2の値以上のとき * - "<If: Variables[1], >=, Variables[2]>" * - "<If: V[1], >=, V[2]>" * - "<If: 変数[1], >=, 変数[2]>" * * ・セルフスイッチを条件に使うとき * セルフスイッチを条件に使うときは、以下のように条件を書きます。 * <If: SelfSwitches[セルフスイッチ記号(A,B,C, or D)], 代入値(ON or OFF)> * * "SelfSwitch"は"SSW"や"セルフスイッチ"でも代替できます。 * また、代入値は基本的に"ON"か"OFF"で指定しますが、 * 以下のような代替記号でも指定できます。 * - "ON": "オン", "true", "1" * - "OFF": "オフ", "false", "0" * * 例えば、以下の通りです。 * 例1: セルフスイッチAがONのとき * - "<If: SelfSwitches[A], ON>" * - "<If: SSW[A], true>" * - "<If: セルフスイッチ[A], オフ>" * 例2: セルフスイッチBがOFFのとき * - "<If: SelfSwitches[B], OFF>" * - "<If: SSW[B], false>" * - "<If: セルフスイッチ[B], オフ>" * * ・タイマーを条件に使うとき * タイマーを条件に使うときは、以下のように条件を書きます。 * <If: Timer, 条件式(">=" or "<="), 分, 秒> * * "Timer"は"タイマー"でも代替できます。 * また、条件式">="は"≧"で、"<="は"≦"で代替できます。 * * 例えば、以下の通りです。 * 例1: タイマーが1分10秒以上のとき * - "<If: Timer, >=, 1, 10>" * - "<If: タイマー, ≧, 1, 10>" * 例2: タイマーが1分10秒以下のとき * - "<If: Timer, <=, 1, 10>" * - "<If: タイマー, ≦, 1, 10>" * * ・アクターに関する情報を条件に使うとき * アクターに関する情報を条件に使うときは、以下のように書きます。 * <If: Actors[アクターID], 条件1, 条件2> * * "Actors"は"アクター"でも代替できます。 * 条件1で対象を指定します。 * - パーティにいる * - 名前 * - 職業 * - スキル * - 武器 * - 防具 * - ステート * を指定できます。 * 条件2は条件1で指定した対象によって使い方が異なります。 * 以下に、条件1での対象毎に説明します。 * * * アクターがパーティにいるかどうか * アクターがパーティにいるかどうかを判定するときは以下のように指定します。 * <If: Actors[アクターID], in the party> * * "in the party"は"パーティにいる"という文字列でも代替できます。 * 条件2は使用しません。 * * 例えば、ID1のアクターがパーティにいるかどうかを条件に使うときは以下の * ように書きます。 * - "<If: Actors[1], in the party>" * - "<If: アクター[1], パーティにいる>" * * * アクターの名前 * アクターの名前を条件式に使うときは以下のように指定します。 * <If: Actors[アクターID], Name, 名前(自由記述)> * * "Name"は"名前"でも代替できます。 * * 例えば、ID1のアクターの名前が"ハロルド"かどうかは以下のように書きます。 * - "<If: Actors[アクターID], Name, ハロルド>" * - "<If: アクター[アクターID], 名前, ハロルド>" * * * 職業、スキル、武器、防具、ステート * 職業、スキル、武器、防具、ステートは以下のように指定します。 * <If: Actors[アクターID], テーブル名, テーブルID(1,2,...などの整数)> * * テーブル名では、アクターに紐付いた情報のテーブル名を指定します。 * 指定方法は以下のとおりです。 * - 職業: "Class", "職業" * - スキル: "Skill", "スキル" * - 武器: "Weapon", "武器" * - 防具: "Armor", "防具" * - ステート: "State", "ステート" * * 例えば、以下の通りです。 * 例1: ID1のアクターの職業が、ID2の職業のとき * - "<If: Actors[1], Class, 2>" * - "<If: アクター[1], 職業, 2>" * 例2: ID1のアクターがID2のスキルを習得しているとき * - "<If: Actors[1], Skill, 2>" * - "<If: アクター[1], スキル, 2>" * 例3: ID1のアクターがID2の武器を装備しているとき * - "<If: Actors[1], Weapon, 2>" * - "<If: アクター[1], 武器, 2>" * 例4: ID1のアクターがID2の防具を装備しているとき * - "<If: Actors[1], Armor, 2>" * - "<If: アクター[1], 防具, 2>" * 例5: ID1のアクターがID2のステートを付与されているとき * - "<If: Actors[1], State, 2>" * - "<If: アクター[1], ステート, 2>" * * * 敵キャラに関する情報を条件に使うとき * 敵キャラに関する情報を条件に使うときは、以下のように書きます。 * <If: Enemies[戦闘中の敵キャラの番号], 条件1, 条件2> * * "Enemies"は"敵キャラ", "エネミー"でも代替できます。 * * 条件1は以下いずれかで設定します。 * - 出現している: "Appeared" or "出現している" * - ステート: "State" or "ステート" * * また、ステートを指定した場合は、条件2でステートのIDを指定します。 * * 例えば以下の通りです。 * 例1: 1体目の敵キャラが出現しているとき * - "<If: Enemies[1], Appeared>" * - "<If: 敵キャラ[1], 出現している>" * - "<If: エネミー[1], 出現している>" * 例2: 1体目の敵キャラがID2のステートにかかっているとき * - "<If: Enemies[1], State, 2>" * - "<If: 敵キャラ[1], ステート, 2>" * - "<If: エネミー[1], ステート, 2>" * * * キャラクターの向きを条件に使うとき * キャラクターの向きを条件に使うときは、以下のように書きます。 * <If: Characters[イベントの指定], 向き(下, 左, 右, 上)> * * "Characters"は"キャラクター"でも代替できます。 * * 引数のイベントの指定は以下のリストからご指定ください。 * - プレイヤー: "Player", "プレイヤー", "-1" * - このイベント: "ThisEvent", "このイベント", "0" * - イベントID指定: "1", "2", ... * * 向きは以下のリストからご指定ください。 * - 下: "Down", "下", "2" * - 左: "Left", "左", "4" * - 右: "Right", "右", "6" * - 上: "Up", "上", "8" * * 例えば、以下の通りです。 * 例1: プレイヤーが下向きの時 * - "<If: Characters[Player], Down>" * - "<If: キャラクター[プレイヤー], 下>" * - "<If: Characters[-1], 2>" * 例2: このイベントが左向きのとき * - "<If: Characters[ThisEvent], Left>" * - "<If: キャラクター[このイベント], 左>" * - "<If: Characters[0], 4>" * 例3: ID1のイベントが右向きのとき * - "<If: Characters[1], Right>" * - "<If: キャラクター[1], 右>" * - "<If: Characters[1], 6>" * * * 乗り物を条件に使うとき * 乗り物に乗っていることを条件に使うときは、以下のように書きます。 * <If: Vehicle, 乗り物の種類(小型船、大型船、飛行船)> * * "Vehicle"は"乗り物"でも代替できます。 * * 乗り物の種類は以下のリストからご指定ください。 * - 小型船: "Boat", "小型船" * - 大型船: "Ship", "大型船" * - 飛行船: "Airship", "飛行船" * * 例えば以下の通りです。 * 例1: 小型船に乗っている時 * - "<If: Vehicle, Boat>" * - "<If: 乗り物, 小型船>" * 例2: 大型船に乗っている時 * - "<If: Vehicle, Ship>" * - "<If: 乗り物, 大型船>" * 例3: 飛行船に乗っている時 * - "<If: Vehicle, Airsip>" * - "<If: 乗り物, 飛行船>" * * * お金を条件に使うとき * お金を条件に使うときは、いかのようにかきます * <If: Gold, 条件式(≧, ≦, <), 数値(定数) * * "Gold"は"お金"でも代替出来ます。 * * 条件式に使える記号は以下の通りです。 * - 以上: ">=", "≧" * - 以下: "<=", "≦" * - 小さい: "<", "<" * * 例えば以下の通りです。 * 例1: お金を500以上所持しているとき * - "<If: Gold, >=, 500>" * - "<If: お金, ≧, 500>" * 例2: 500以下しかお金を所持していないとき * - "<If: Gold, <=, 500>" * - "<If: お金, ≦, 500>" * 例2: 500未満しかお金を所持していないとき * - "<If: Gold, <, 500>" * - "<If: お金, <, 500>" * * * アイテムを条件に使うとき * アイテムを条件に使うときは以下のように書きます。 * <If: Items[ID]> * * "Items"は"アイテム"でも代替できます。 * * 例えば、以下の通りです。 * 例1: IDが1のアイテムを所持しているとき * - "<If: Items[1]>" * - "<If: アイテム[1]>" * * * 武器を条件に使うとき * 武器を条件に使うときは以下のように書きます。 * <If: Weapons[ID], 装備品を含むか> * * "Weapons"は"武器"でも代替できます。 * 装備品を含む場合は、2つ目の引数の部分に"Include Equipment"もしくは * "装備品を含む"と記載してください。含まない場合は、省略してください。 * * 例えば、以下の通りです。 * 例1: IDが1の武器を所持しているとき(装備品は含まない) * - "<If: Weapons[1]>" * - "<If: 武器[1]>" * 例2: IDが1の武器を所持しているとき(装備品は含む) * - "<If: Weapons[1], Include Equipment>" * - "<If: 武器[1], 装備品を含む>" * * * 防具を条件に使うとき * 防具を条件に使うときは以下のように書きます。 * <If: Armors[ID], 装備品を含むか> * * "Armors"は"防具"でも代替できます。 * 装備品を含む場合は、2つ目の引数の部分に"Include Equipment"もしくは * "装備品を含む"と記載してください。含まない場合は、省略してください。 * * 例えば、以下の通りです。 * 例1: IDが1の防具を所持しているとき(装備品は含まない) * - "<If: Armors[1]>" * - "<If: 防具[1]>" * 例2: IDが1の防具を所持しているとき(装備品は含む) * - "<If: Armors[1], Include Equipment>" * - "<If: 防具[1], 装備品を含む>" * * * ボタンを条件に使うとき * ボタンを条件に使うときは以下のように書きます。 * <If: Button, ボタンの種類, 押され方(省略可能)> * * "Button"は"ボタン"でも代替できます。 * 以下のリストからボタンの種類を指定してください。 * - 決定: "OK", "決定" * - キャンセル: "Cancel", "キャンセル" * - シフト: "Shift", "シフト" * - 下: "Down", "下" * - 左: "Left", "左" * - 右: "Right", "右" * - 上: "Up", "上" * - ページアップ: "Pageup", "ページアップ" * - ページダウン: "Pagedown", "ページダウン" * * 押され方は以下のリストから指定してください。 * - が押されている: * "is being pressed", "が押されている", "pressed" * - がトリガーされている: * "is being triggered", "がトリガーされている", "triggered" * - がリピートされている: * "is being repeated", "がリピートされている", "repeated" * * 押され方は省略が可能です。その場合は`is being pressed`が設定されます。 * * 例えば以下の通りです。 * 例1: 決定ボタンが押されているとき * - "<If: Button, OK, is being pressed>" * - "<If: ボタン, 決定, が押されている>" * - "<If: Button, OK>" * - "<If: Button, OK, pressed>" * 例2: シフトボタンがトリガーされているとき * - "<If: Button, Shift, is being triggered>" * - "<If: ボタン, シフト, がトリガーされている>" * - "<If: Button, Shift, triggered>" * 例3: 下ボタンがリピートされているとき * - "<If: Button, Down, is being repeated>" * - "<If: ボタン, 下, がリピートされている>" * - "<If: Button, Down, repeated>" * * * スクリプトを条件に使う時 * スクリプトを条件に使うときは以下のように書きます。 * <If: Script, スクリプト本文(Javascript)> * * "Script"は"スクリプト"か"SC"でも代替できます。 * 例えば、"$gameParty._gold < $gameVariables.value(1)"を * 条件にするときは以下のように書けます。 * - "<If: Script, $gameParty._gold == $gameVariables.value(1)>" * - "<If: スクリプト, $gameParty._gold == $gameVariables.value(1)>" * - "<If: SC, $gameParty._gold == $gameVariables.value(1)>" * * ・その他の条件分岐の特徴 * 別記法として、以下の対応関係で日本語表記もできます。 * - If: "条件分岐" * - Else: "それ以外のとき" * - End: "分岐修了" * <Else>とその処理は省略することができます。 * * 入れ子にすることができます。例えば以下のようにすることもできます。 * --- * <If: Switch[1], ON> * <If: Switch[2], ON> * 1つ目と2つ目の条件が満たされているときの処理 * <End> * <Else> * 1つ目の条件が満たされていないときの処理 * <End> * --- * * 条件分岐の中は「変数の操作」や「コモンイベント」など、その他の * イベントコマンドも組み込むことができます。 * --- * <If: Switch[1], ON> * <Set: 1, 2> * <CommonEvent: 3> * 私もずっと前から好きでした。 * <Else> * <Set: 3, 4> * <CommonEvent: 4> * ごめんなさい。お友達でいましょう。 * <End> * --- * * "<End>"を書かなかった場合は、以降のメッセージやタグが全てIfもしくはElseの処 * 理として組み込まれます。 * タグ(If, Else, END)の直後は可能な限り改行してください。改行せずに次のイベン * トやメッセージを入力した場合の動作は保証されていません。 * * * * ○ (6) ループ * 「ループ」は以下の記法で組み込みます * --- * <Loop> * ループしたい処理 * <RepeatAbove> * --- * * "Loop"は"ループ"、"RepeatAbove"は"以上繰り返し"や"RA"で代替できます。 * * ループしたい処理は、メッセージの表示や他のタグを自由に組み込めます。 * * 以下の具体例は、"今日も一日がんばるぞい!"というメッセージが * 無限ループします。 * --- * <Loop> * 今日も一日がんばるぞい! * <RepeatAbove> * --- * * 以下の例では、他のタグと組み合わせることで、 * "今日も一日がんばるぞい!"を * 5回表示させる処理になります。 * """ * <Set: 1, 0> * <Loop> * <If: Variables[1], ==, 5> * <BreakLoop> * <End> * 今日も一日がんばるぞい! * <Add: 1, 1> * <RepeatAbove> * """ * "Set"と"Add"は「変数の操作」を、"If"と"End"は「条件分岐」を、 * "BreakLoop"はループの * 中断の説明をご覧ください。 * * * ○ (7) ループの中断 * 「ループの中断」は以下のいずれかの記法で組み込みます。 * <BreakLoop> * <ループの中断> * <BL> * * ○ (8) イベント処理の中断 * 「イベント処理の中断」は以下のいずれかの記法で組み込みます。 * <ExitEventProcessing> * <イベント処理の中断> * <EEP> * * ○ (9) コモンイベント * 「コモンイベント」は以下のいずれかの記法で組み込みます。 * <CommonEvent: コモンイベントID> * <CE: コモンイベントID> * <コモンイベント: コモンイベントID> * * 例えば以下のように記述すると、ID2のコモンイベントが組み込まれます。 * <CommonEvent: 2> * <CE: 2> * <コモンイベント: 2> * * ○ (10) ラベル * 「ラベル」は以下のいずれかの記法で指定します。 * <Label: ラベル名> * <ラベル: ラベル名> * * 例えば以下のように記述すると"Start"というラベルが組み込まれます。 * <Label: Start> * <ラベル: Start> * * ○ (11) ラベルジャンプ * 「ラベルジャンプ」は以下のいずれかの記法で指定します。 * <JumpToLabel: ジャンプ先のラベル名> * <ラベルジャンプ: ジャンプ先のラベル名> * <JTL: ジャンプ先のラベル名> * * 例えば以下のように記述すると"Start"と名付けられたラベルへのラベルジャンプが * 組み込まれます。 * <JumpToLabel: Start>" * <ラベルジャンプ: Start> * <JumpToLabel: Start>" * * ○ (12) 注釈 * 注釈のイベントコマンドは、以下のように<comment>と</comment>で挟み込む * 記法で指定します。 * <comment> * 注釈の内容 * </comment> * * 例えば以下のとおりです。 * <comment> * この辺からいい感じのBGMを再生する。 * 選曲しないと・・・。 * </comment> * * 別記法として<CO>か、<注釈>としても記述できます。 * また、 * <comment>この辺からいい感じのBGMを再生する。</comment> * というように1行で記述することもできます。 * * ○ (13) ピクチャの表示 * ピクチャの表示は、以下の記法で指定します。 * <ShowPicture: ピクチャ番号,ファイル名,オプション1,オプション2,オプション3> * * 必須の引数はピクチャ番号(整数)とファイル名だけです。 * 位置・拡大率・合成はオプションとして指定でき、指定しない場合はデフォルト値 * が設定されます。 * "ShowPicture"は"ピクチャの表示"か"SP"で代替できます。 * * オプションの指定方法を述べる前に、いくつか具体例を記します。 * * 例1: 以下のデフォルト設定でピクチャを表示する。 * - ピクチャ番号: 1 * - 画像ファイル名: Castle.png * - 位置: 原点は左上でX座標0, Y座標0(デフォルト設定) * - 拡大率: 幅50%, 高さ55% * - 合成: 不透明度は255, 合成方法は通常(デフォルト設定) * <ShowPicture: 1, Castle, Scale[50][55],> * <ピクチャの表示: 1, Castle, 拡大率[50][55]> * <SP: 1, Castle, Scale[50][55]> * * 例2: 以下の設定(拡大率だけ指定)でピクチャを表示 * - ピクチャ番号: 2 * - 画像ファイル名: Castle.png * - 位置: 原点は中央でX座標は変数2,Y座標は変数3 * - 拡大率: 幅100%, 高さ100%(デフォルト設定) * - 合成: 不透明度は255, 合成方法は通常(デフォルト設定) * <ShowPicture: 2, Castle, Position[Center][Variables[2]][Variables[3]]> * <ピクチャの表示: 2, Castle, 位置[中央][変数[2][変数[3]]> * <SP: 2, Castle, Position[Center][V[2]][V[3]]> * * 例3: 以下の設定でピクチャを表示 * - ピクチャ番号: 3 * - 画像ファイル名: Castle.png * - 位置: 原点は中央で、X座標は10,Y座標は20 * - 拡大率:幅100%, 高さ100%(デフォルト設定) * - 合成: 不透明度は235, 合成方法はスクリーン * <ShowPicture: 3, Castle, Position[Upper Left][10][20], Blend[235][Screen]> * <ピクチャの表示: 3, Castle, 位置[左上][100][200], 合成[235][スクリーン]> * <SP: 3, Castle, Position[Upper Left][10][20], Blend[235][Screen]> * * オプションは順不同です。ピクチャ番号とファイル名は引数の位置は固定ですが、 * オプション1,2,3はどのような順番で指定しても大丈夫です。 * * ・位置 * ピクチャの位置は、以下の記法で指定します。 * Position[原点("Upper Left"か "Center")][X座標][Y座標] * * "Position"は"位置"でも代替できます。 * X,Y座標は定数か変数で指定できます。 * 定数は整数値をそのまま入力し、変数の場合は"Variables[変数ID]"というよう * に指定します。 * "Variables"は"変数"か"V"でも代替できます。 * * 例えば以下の通りです。 * - 例1: 原点は左上, X座標は100, Y座標は200, * - "Position[Upper Left][100][200]" * - "位置[左上][100][200]" * - 例2: X座標は変数2の値, 変数3の値 * - "Position[Center][Variables[2]][Variables[3]]" * - "位置[中央][変数[2]][変数[3]]" * - "Position[Center][V[2]][V[3]]" * 位置を指定しなかった場合のデフォルト値は"Position[Upper Left][0][0]" * となります。 * * ・拡大率 * ピクチャの拡大率は、以下の記法で指定します。 * Scale[幅(%)][高さ(%)] * * "Scale"は"拡大率"でも代替できます。 * * 例えば幅90%, 高さ95%は以下のように指定します。 * - "Scale[90][95]" * - "拡大率[90][95]" * 拡大率を指定しなかった場合のデフォルト値は"Scale[100][100]" * となります。 * * ・合成 * ピクチャの合成は、以下の記法で指定します。 * Blend[不透明度(0~255の整数)][合成方法(通常,加算,乗算,or スクリーン)] * "Blend"は"合成"で代替できます。 * * 不透明度は以下のリストから指定します。 * - 通常: "Normal", "通常" * - 加算: "Additive", "加算" * - 乗算: "Multiply", "乗算" * - スクリーン: "Screen", "スクリーン" * * 例えば不透明度が200で、加算を指定する場合は以下のように指定します。 * - "Blend[200][Additive]" * - "合成[200][加算]" * 合成を指定しなかった場合のデフォルト値は"Blend[255][Normal]" * となります。 * * * ○ (14) ピクチャの移動 * ピクチャの合成は、以下の記法で指定します。 * <MovePicture:ピクチャ番号,オプション1,オプション2,オプション3,オプション4> * * 必須の引数はピクチャ番号だけです。 * 移動にかける時間と、位置・拡大率・合成はオプションとして指定でき、 * 指定しない場合はデフォルト値が設定されます。 * * "MovePictures"は"ピクチャの移動"か"MP"で代替できます。 * * オプションの指定方法を述べる前に、いくつか具体例を記します。 * 例1: 以下のデフォルト設定でピクチャを移動する。 * - ピクチャ番号: 1 * - 時間: 60フレーム, 完了までウェイト(デフォルト設定) * - 位置: 原点は中央で、X座標は変数2,Y座標は変数3 * - 拡大率: 幅100%, 高さ100%(デフォルト設定) * - 合成: 不透明度は255, 合成方法は通常(デフォルト設定) * <MovePicture: 1, Position[Center][Variables[2]][Variables[3]]> * <ピクチャの移動: 1, 位置[中央][変数[2]][変数[3]]> * <MP: 1, Position[Center][V[2]][V[3]]> * * 例2: 以下の設定でピクチャを移動 * - ピクチャ番号: 2 * - 時間: 45フレーム, 完了までウェイトしない * - 位置: 原点は左上でX座標0, Y座標0(デフォルト設定) * - 拡大率:幅90%, 高さ95% * - 合成: 不透明度は235, 合成方法はスクリーン * <MovePicture: 2, Duration[45][], Blend[235][Screen], Scale[90][95]> * <ピクチャの移動: 2, 時間[45], 合成[235][スクリーン], 拡大率[90][95]> * <MP: 2, Duration[45], Blend[235][Screen], Scale[90][95]> * * オプションは順不同です。ピクチャ番号の引数の位置は固定ですが、 * オプション1,2,3,4はどのような順番で指定しても大丈夫です。 * また、 * - 位置 * - 拡大率 * - 合成 * については、「ピクチャの表示」イベントタグのオプションの記法と * 同一なので、そちらをご覧ください。 * * ・時間 * ピクチャの移動時間は、以下の記法で指定します。 * Duration[フレーム数][ウェイトするか否か("Wait for Completion" or 省略)] * * "Duration"は"時間"で、"Wait for Completion"は"完了までウェイト"か * "Wait"で代替できます。 * * 例えば、以下の通りです。 * 例1: 45フレームで完了するまでウェイトする * - "Duration[45][Wait for Completion]" * - "時間[45][完了までウェイト]" * - "時間[45][Wait]" * 例2: 60フレームで完了するまでウェイトしない * - "Duration[60]" * - "時間[60]" * - "Duration[60][]" * * 時間を指定しなかった場合のデフォルト値は * "Duration[60][Wait for Completion]"となります。 * * ・イージング * イージングは以下の記法で指定します。 * Easing[モード] * モードは以下の4つを選択できます。 * - "Constant speed" * - "Slow start" * - "Slow end" * - "Slow start and end" * * "Easing"は"イージング"でも代替できます。 * モードは以下の対応関係で代替できます。 * - "Constant speed": "一定速度", "Linear" * - "Slow start": "ゆっくり始まる", "Ease-in" * - "Slow end": "ゆっくり終わる", "Ease-out" * - "Slow start and end": "ゆっくり始まってゆっくり終わる", "Ease-in-out" * * 例えば、以下の通りです。 * 例1: 一定速度 * - "Easing[Constant speed]" * - "イージング[一定速度]" * - "Easing[Linear]" * 例2: ゆっくり始まってゆっくり終わる * - "Easing[Slow start and end]" * - "イージング[ゆっくり始まってゆっくり終わる]" * - "Easing[Ease-in-out]" * * イージングを指定しなかった場合のデフォルト値は * "Easing[Constant speed]"となります。 * * * ○ (15) ピクチャの回転 * ピクチャの回転は以下の記法で指定します。 * <RotatePicture: ピクチャ番号(整数), 回転速度(-90~90の整数)> * * "RotatePicture"は"ピクチャの回転"か"RP"でも代替できます。 * * 例えば、速度が-30で番号1のピクチャを回転するのは、以下の通りとなります。 * <RotatePicture: 1, -30> * <ピクチャの回転: 1, -30> * <RP: 1, -30> * * ○ (16) ピクチャの色調変更 * ピクチャの色調変更は以下の記法で指定します。 * <TintPicture: ピクチャ番号(整数), オプション1, オプション2> * * 必須の引数はピクチャ番号だけです。 * 色調変更にかける時間と色調はオプションとして指定でき、 * 指定しない場合はデフォルト値が設定されます。 * * "TintPicture"は"ピクチャの色調変更"か"TP"で代替できます。 * * オプションの指定方法を述べる前にいくつか具体例を記します。 * 例1: 以下のデフォルト設定でピクチャの色調を変更する。 * - ピクチャ番号: 1 * - 時間: 60フレーム, 完了までウェイト(デフォルト設定) * - 色調: 赤0, 緑0, 青0, グレイ0(デフォルト設定) * <TintPicture: 1> * <ピクチャの色調変更: 1> * <TP: 1> * * 例2: 以下の設定でピクチャの色調を変更する。 * - ピクチャ番号: 2 * - 時間: 60フレーム, 完了までウェイト(デフォルト設定) * - 色調: 赤0, 緑255, 青255, グレイ0 * <TintPicture: 2, ColorTone[0][255][255][0]> * <ピクチャの色調変更: 2, 色調[0][255][255][0]> * <TP: 2, CT[0][255][255][0]> * * 例3: 以下の設定でピクチャの色調を変更する。 * - ピクチャ番号: 3 * - 時間: 30フレーム, 完了までウェイト * - 色調: ダーク(赤-68, 緑-68, 青-68, グレイ0) * <TintPicture: 3, Duration[30][Wait for Completion], ColorTone[Dark]> * <ピクチャの色調変更: 3, 時間[30][完了までウェイト], 色調[ダーク]> * <TP: 3, Duration[30][Wait], CT[Dark]> * * オプションは順不同です。ピクチャ番号は固定ですが、オプション1,2は * どのような順番で指定しても大丈夫です。 * * また、時間については、「ピクチャの移動」イベントタグのオプションの記法と * 同一なので、そちらをご覧ください。 * ここでは、色調の指定方法について記します。 * * ・色調の指定方法 * ピクチャの色調は、以下の記法で指定します。 * ColorTone[赤の強さ][緑の強さ][青の強さ][グレイの強さ]> * * "ColorTone"は"色調"か"CT"で代替できます。 * * 例えば、以下のように設定できます。 * - "ColorTone[-68][68][100][0]" * - "色調[-68][68][100][0]" * - "CT[-68][68][100][0]" * * [赤の強さ]の部分に指定の文字列を入力することで、RPGツクールMV・MZの機能と * 同様に「通常」, 「ダーク」, 「セピア」, 「夕暮れ」,「夜」で設定することが * できます。以下のように色調が対応しています。 * - "通常" or "Normal": "ColorTone[0][0][0][0]" * - "ダーク" or "Dark": "ColorTone[-68][-68][-68][0]" * - "セピア" or "Sepia": "ColorTone[34][-34][-68][170]" * - "夕暮れ" or "Sunset": "ColorTone[68][-34][-34][0]" * - "夜" or "Night": "ColorTone[-68][-68][0][68]" * * 例えば、番号4のピクチャを1秒でセピアに変更する場合は以下のように書けます。 * 1秒(60フレーム)はデフォルト設定です。 * <TintPicture: 4, ColorTone[Sepia]> * <ピクチャの色調変更: 4, ColorTone[セピア]> * <TP: 4, CT[Sepia]> * * * ○ (17) ピクチャの消去 * ピクチャの消去は以下の記法で指定します。 * <ErasePicture: ピクチャ番号(整数)> * * "ErasePicture"は"ピクチャの消去"か"EP"でも代替できます。 * * 例えば、以下のように書くと番号1のピクチャを削除できます。 * <ErasePicture: 1> * <ピクチャの消去: 1> * <EP: 1> * * ○ (18) ウェイト * ウェイトのイベントコマンドは、以下のいずれかの記法でしていします。 * <wait: フレーム数(1/60秒)> * <ウェイト: フレーム数(1/60秒)> * * 例えば以下のように記述すると60フレーム(1秒)のウェイトが組み込まれます。 * <wait: 60> * * ○ (19) 画面のフェードアウト * フェードアウトは以下のいずれかの記法で組み込めます。 * <fadeout> * <FO> * <フェードアウト> * * ○ (20) 画面のフェードイン * フェードインは以下のいずれかの記法で組み込めます。 * <fadein> * <FI> * <フェードイン> * * ○ (21) BGMの演奏 * BGMの演奏は、以下のいずれかの記法で指定します。 * <PlayBGM: ファイル名, 音量, ピッチ, 位相> * <BGMの演奏: ファイル名, 音量, ピッチ, 位相> * * 必須の引数はファイル名のみです。音量・ピッチ・位相は任意で指定します。 * 指定しない場合は音量は90, ピッチは100, 位相は0として組み込まれます。 * * 例1: Castle1をデフォルト設定で演奏 * <PlayBGM: Castle1> * 例2: Castle2を音量50, ピッチ80, 位相30で演奏 * <PlayBGM: Castle2, 50, 80, 30> * * BGMを「なし」に設定したい場合は以下のいずれかの記法で指定してください。 * <PlayBGM: None> * <PlayBGM: なし> * <StopBGM> * * 本プラグインを使用する場合は、「None」「なし」というファイル名のBGMは * ご利用できないことにご注意ください。 * * * ○ (22) BGMのフェードアウト * BGMのフェードアウトは以下のいずれかの記法で組み込みます。 * <FadeoutBGM: 時間(秒)> * <BGMのフェードアウト: 時間(秒)> * * 例えば、以下のように記述すると3秒でBGMがフェードアウトします。 * <FadeoutBGM: 3> * <BGMのフェードアウト: 3> * * ○ (23) BGMの保存 * BGMの保存は以下のいずれかの記法で組み込みます。 * <SaveBGM> * <BGMの保存> * * ○ (24) BGMの再開 * BGMの再開は以下のいずれかの記法で組み込みます。 * <ReplayBGM> * <BGMの再開> * * ○ (25) BGSの演奏 * BGSの演奏は、以下のいずれかの記法で指定します。 * <PlayBGS: ファイル名, 音量, ピッチ, 位相> * <BGSの演奏: ファイル名, 音量, ピッチ, 位相> * * 必須の引数はファイル名のみです。音量・ピッチ・位相は任意で指定します。 * 指定しない場合は音量は90, ピッチは100, 位相は0として組み込まれます。 * * 例1: Cityをデフォルト設定で演奏 * <PlayBGS: City> * 例2: Darknessを音量50, ピッチ80, 位相30で演奏 * <PlayBGS: Darkness, 50, 80, 30> * * BGSを「なし」に設定したい場合は以下のいずれかの記法で指定してください。 * <PlayBGS: None> * <PlayBGS: なし> * <StopBGS> * * 本プラグインを使用する場合は、「None」「なし」というファイル名のBGSは * ご利用できないことにご注意ください。 * * * ○ (26) BGSのフェードアウト * BGSのフェードアウトは以下のいずれかの記法で組み込みます。 * <FadeoutBGS: 時間(秒)> * <BGSのフェードアウト: 時間(秒)> * * 例えば、以下のように記述すると3秒でBGSがフェードアウトします。 * <FadeoutBGS: 3> * <BGSのフェードアウト: 3> * * ○ (27) MEの演奏 * MEの演奏は、以下のいずれかの記法で指定します。 * <PlayME: ファイル名, 音量, ピッチ, 位相> * <MEの演奏: ファイル名, 音量, ピッチ, 位相> * * 必須の引数はファイル名のみです。音量・ピッチ・位相は任意で指定します。 * 指定しない場合は音量は90, ピッチは100, 位相は0として組み込まれます。 * * 例1: Innをデフォルト設定で演奏 * <PlayME: Inn> * 例2: Mysteryを音量50, ピッチ80, 位相30で演奏 * <PlayME: Mystery, 50, 80, 30> * * MEを「なし」に設定したい場合は以下のいずれかの記法で指定してください。 * <PlayME: None> * <PlayME: なし> * <StopME> * * 本プラグインを使用する場合は、「None」「なし」というファイル名のMEは * ご利用できないことにご注意ください。 * * * ○ (28) SEの演奏 * SEの演奏は、以下のいずれかの記法で指定します。 * <PlaySE: ファイル名, 音量, ピッチ, 位相> * <SEの演奏: ファイル名, 音量, ピッチ, 位相> * * 必須の引数はファイル名のみです。音量・ピッチ・位相は任意で指定します。 * 指定しない場合は音量は90, ピッチは100, 位相は0として組み込まれます。 * * 例1: Attack1をデフォルト設定で演奏 * <PlaySE: Attack1> * 例2: Attack2を音量50, ピッチ80, 位相30で演奏 * <PlaySE: Attack2, 50, 80, 30> * * SEを「なし」に設定したい場合は以下のいずれかの記法で指定してください。 * <PlaySE: None> * <PlaySE: なし> * * 本プラグインを使用する場合は、「None」「なし」というファイル名のSEは * ご利用できないことにご注意ください。 * * * ○ (29) SEの停止 * SEの停止は以下のいずれかの記法で指定します。 * <StopSE> * <SEの停止> * * ○ (30) 戦闘BGMの変更 * 戦闘BGMの変更は、以下のいずれかの記法で指定します。 * <ChangeBattleBGM: ファイル名, 音量, ピッチ, 位相> * <戦闘曲の変更: ファイル名, 音量, ピッチ, 位相> * * 必須の引数はファイル名のみです。音量・ピッチ・位相は任意で指定します。 * 指定しない場合は音量は90, ピッチは100, 位相は0として組み込まれます。 * * 例1: Battle1をデフォルト設定で演奏 * <ChangeBattleBGM: Battle1> * 例2: Battle2を音量50, ピッチ80, 位相30で演奏 * <ChangeBattleBGM: Battle2, 50, 80, 30> * * 「なし」に設定したい場合は以下のいずれかの方法で指定してください。 * <ChangeBattleBGM: None> * <ChangeBattleBGM: なし> * * * ○ (31) スクリプト * スクリプトのイベントコマンドは、以下のように<script>と</script>で挟み込む * 記法で指定します。 * <script> * 処理させたいスクリプト * </script> * * 例えば以下のとおりです。 * <script> * for(let i = 0; i < 10; i++) { * console.log("今日も一日がんばるぞい!"); * } * </script> * * このようにテキストファイル中に記載することで、 * for(let i = 0; i < 10; i++) { * console.log("今日も一日がんばるぞい!"); * } * という内容のスクリプトのイベントコマンドが組み込まれます。 * ツクールMV・MZのエディタ上からは12行を超えるスクリプトは記述出来ませんが、 * 本プラグインの機能では13行以上のスクリプトも組み込めます。 * ただし、ツクールMV・MZ上から一度開いて保存してしまうと、13行目以降はロス * トしてしまいます。 * 別記法として<SC>か、<スクリプト>としても記述できます。 * また、 * <script>console.log("今日も一日がんばるぞい!");</script> * というように1行で記述することもできます。 * * * ○ (32)-1 プラグインコマンド(ツクールMV) * プラグインコマンドのイベントコマンドは、以下のいずれかの記法で指定します。 * <plugincommand: プラグインコマンドの内容> * <PC: プラグインコマンドの内容> * <プラグインコマンド: プラグインコマンドの内容> * * 例えば以下のように記述すると、ItemBook openと入ったプラグインコマンドが * 組み込まれます。 * <plugincommand: ItemBook open> * <PC: ItemBook open> * <プラグインコマンド: ItemBook open> * * ○ (32)-2 プラグインコマンド(ツクールMZ, 上級者向け) * プラグインコマンドのイベントコマンドは、以下の記法で指定します。 * <PluginCommandMZ: プラグイン名, 関数名, コマンド, 引数[値][注釈],...> * * プラグイン名はプラグインファイルの名前です。○○.jsの○○を記入して * ください。Text2Frame.jsの場合は"Text2Frame"となります。 * * 内部関数名はプラグイン内で設定されている関数名を指定してください。 * ただし、対応しているプラグイン本体であるJavascriptファイルかdataフォ * ルダ内のJSONファイルから直接確認する必要がある可能性が高いです。 * そのため、このタグはある程度プラグインを開発する能力がある方向けと * なります。 * * コマンドはプラグインコマンド設定ウィンドウで、呼び出すコマンドの * 名前を記述してください。 * * プラグインコマンドのパラメータは、コマンド名以降にカンマ区切りで * "引数の名前[値]"として記述してください。数に制限はありません。 * 例えば、引数の名前が"FileFolder", 値が"text"の場合は * "FileFolder[text]"と記述してください。 * 引数の名前は、「プラグインコマンド」ウィンドウの、指定したい引数の * 「パラメータ」ウィンドウから確認できます。薄い灰色文字で書かれた * 括弧書きされている文字が引数の名前です。 * 注釈は、ツクールMZ上での表示を正式なものにするために使います。 * 指定しない場合は、自動で補完します。実行上の違いはありませんが、 * ツクールMZ上から設定した場合の表記とは異なります。 * * "PluginCommandMZ"は"PCZ","プラグインコマンドMZ"でも代替できます。 * * 例えば、TextPictureプラグインで"ほげ"という文字列を画像にする * プラグインコマンドは以下のように設定します。 * <PCZ: TextPicture, set, テキストピクチャの設定, text[ほげ]> * * * -------------------------------------- * 動作確認テキスト * -------------------------------------- * https://github.com/yktsr/Text2Frame-MV/wiki/動作確認テキスト * に全機能を使ったテキストを記載しています。 * 動作確認用にお使いください。 * * -------------------------------------- * 注意事項 * -------------------------------------- * 当プラグインの機能を使用する前にプロジェクト以下の「data」フォルダの * バックアップを「必ず」取得してください。 * プラグイン作者は、いかなる場合も破損したプロジェクトの復元には応じられませ * んのでご注意ください。 * テキストファイルの文字コードはUTF-8にのみ対応しています。 * * -------------------------------------- * 連絡先 * -------------------------------------- * このプラグインに関し、バグ・疑問・追加要望を発見した場合は、 * 以下の連絡先まで連絡してください。 * [Twitter]: https://twitter.com/Asyun3i9t/ * [GitHub] : https://github.com/yktsr/ */ /* global Game_Interpreter, $gameMessage, process, PluginManager */ var Laurus = Laurus || {}; Laurus.Text2Frame = {}; if (typeof PluginManager === 'undefined') { // for test /* eslint-disable no-global-assign */ Game_Interpreter = {}; Game_Interpreter.prototype = {}; $gameMessage = {}; $gameMessage.add = function () { }; /* eslint-enable */ } (function () { 'use strict'; const fs = require('fs'); const path = require('path'); const PATH_SEP = path.sep; const BASE_PATH = path.dirname(process.mainModule.filename); if (typeof PluginManager === 'undefined') { Laurus.Text2Frame.WindowPosition = "Bottom"; Laurus.Text2Frame.Background = "Window"; Laurus.Text2Frame.FileFolder = "test"; Laurus.Text2Frame.FileName = "basic.txt"; Laurus.Text2Frame.CommonEventID = "1"; Laurus.Text2Frame.MapID = "1"; Laurus.Text2Frame.EventID = "1"; Laurus.Text2Frame.PageID = "1"; Laurus.Text2Frame.IsOverwrite = true; Laurus.Text2Frame.CommentOutChar = "%"; Laurus.Text2Frame.IsDebug = true; Laurus.Text2Frame.DisplayMsg = true; Laurus.Text2Frame.DisplayWarning = true; } else { // for default plugin command Laurus.Text2Frame.Parameters = PluginManager.parameters('Text2Frame'); Laurus.Text2Frame.WindowPosition = String(Laurus.Text2Frame.Parameters["Default Window Position"]); Laurus.Text2Frame.Background = String(Laurus.Text2Frame.Parameters["Default Background"]); Laurus.Text2Frame.FileFolder = String(Laurus.Text2Frame.Parameters["Default Scenario Folder"]); Laurus.Text2Frame.FileName = String(Laurus.Text2Frame.Parameters["Default Scenario File"]); Laurus.Text2Frame.CommonEventID = String(Laurus.Text2Frame.Parameters["Default Common Event ID"]); Laurus.Text2Frame.MapID = String(Laurus.Text2Frame.Parameters["Default MapID"]); Laurus.Text2Frame.EventID = String(Laurus.Text2Frame.Parameters["Default EventID"]); Laurus.Text2Frame.PageID = String(Laurus.Text2Frame.Parameters["Default PageID"]); Laurus.Text2Frame.IsOverwrite = (String(Laurus.Text2Frame.Parameters["IsOverwrite"]) == 'true') ? true : false; Laurus.Text2Frame.CommentOutChar = String(Laurus.Text2Frame.Parameters["Comment Out Char"]); Laurus.Text2Frame.IsDebug = (String(Laurus.Text2Frame.Parameters["IsDebug"]) == 'true') ? true : false; Laurus.Text2Frame.DisplayMsg = (String(Laurus.Text2Frame.Parameters["DisplayMsg"]) == 'true') ? true : false; Laurus.Text2Frame.DisplayWarning = (String(Laurus.Text2Frame.Parameters["DisplayWarning"]) == 'true') ? true : false; Laurus.Text2Frame.TextPath = `${BASE_PATH}${PATH_SEP}${Laurus.Text2Frame.FileFolder}${PATH_SEP}${Laurus.Text2Frame.FileName}`; Laurus.Text2Frame.MapPath = `${BASE_PATH}${path.sep}data${path.sep}Map${('000' + Laurus.Text2Frame.MapID).slice(-3)}.json`; Laurus.Text2Frame.CommonEventPath = `${BASE_PATH}${path.sep}data${path.sep}CommonEvents.json`; } const addMessage = function (text) { if (Laurus.Text2Frame.DisplayMsg) { $gameMessage.add(text); } }; const addWarning = function (warning) { if (Laurus.Text2Frame.DisplayWarning) { $gameMessage.add(warning); } }; const getDefaultPage = function () { return { "conditions": { "actorId": 1, "actorValid": false, "itemId": 1, "itemValid": false, "selfSwitchCh": "A", "selfSwitchValid": false, "switch1Id": 1, "switch1Valid": false, "switch2Id": 1, "switch2Valid": false, "variableId": 1, "variableValid": false, "variableValue": 0 }, "directionFix": false, "image": { "characterIndex": 0, "characterName": "", "direction": 2, "pattern": 0, "tileId": 0 }, "list": [ { "code": 0, "indent": 0, "parameters": [] } ], "moveFrequency": 3, "moveRoute": { "list": [{ "code": 0, "parameters": [] }], "repeat": true, "skippable": false, "wait": false }, "moveSpeed": 3, "moveType": 0, "priorityType": 0, "stepAnime": false, "through": false, "trigger": 0, "walkAnime": true } }; //============================================================================= // Game_Interpreter //============================================================================= // for MZ plugin command if (typeof PluginManager != 'undefined' && PluginManager.registerCommand) { PluginManager.registerCommand('Text2Frame', 'IMPORT_MESSAGE_TO_EVENT', function (args) { let file_folder = args.FileFolder; let file_name = args.FileName; let map_id = args.MapID; let event_id = args.EventID; let page_id = args.PageID; let is_overwrite = args.IsOverwrite; this.pluginCommand('IMPORT_MESSAGE_TO_EVENT', [file_folder, file_name, map_id, event_id, page_id, is_overwrite]); }); PluginManager.registerCommand('Text2Frame', 'IMPORT_MESSAGE_TO_CE', function (args) { let file_folder = args.FileFolder; let file_name = args.FileName; let common_event_id = args.CommonEventID; let is_overwrite = args.IsOverwrite; this.pluginCommand('IMPORT_MESSAGE_TO_CE', [file_folder, file_name, common_event_id, is_overwrite]); }); } const _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand; Game_Interpreter.prototype.pluginCommand = function (command, args) { _Game_Interpreter_pluginCommand.apply(this, arguments); this.pluginCommandText2Frame(command, args); }; Game_Interpreter.prototype.pluginCommandText2Frame = function (command, args) { Laurus.Text2Frame.ExecMode = command.toUpperCase(); switch (Laurus.Text2Frame.ExecMode) { // for custom plugin command case 'IMPORT_MESSAGE_TO_EVENT': case 'メッセージをイベントにインポート': addMessage('import message to event. \n/ メッセージをイベントにインポートします。'); if (args[0]) Laurus.Text2Frame.FileFolder = args[0]; if (args[1]) Laurus.Text2Frame.FileName = args[1]; if (args[2]) Laurus.Text2Frame.MapID = args[2]; if (args[3]) Laurus.Text2Frame.EventID = args[3]; if (args[4] && (args[4].toLowerCase() === 'true' || args[4].toLowerCase() === 'false')) { Laurus.Text2Frame.IsOverwrite = args[4].toLowerCase() === 'true' ? true : false; addWarning('【警告】5番目の引数に上書き判定を設定することは非推奨に'); addWarning('なりました。ページIDを設定してください。上書き判定は6番'); addWarning('目に設定してください。(警告はオプションでOFFにできます)'); } else if (args[4]) { Laurus.Text2Frame.PageID = args[4]; } if (args[5] && args[5].toLowerCase() === 'true') Laurus.Text2Frame.IsOverwrite = true; if (args[0] || args[1]) { Laurus.Text2Frame.TextPath = `${BASE_PATH}${PATH_SEP}${Laurus.Text2Frame.FileFolder}${PATH_SEP}${Laurus.Text2Frame.FileName}`; Laurus.Text2Frame.MapPath = `${BASE_PATH}${path.sep}data${path.sep}Map${('000' + Laurus.Text2Frame.MapID).slice(-3)}.json`; } break; case 'IMPORT_MESSAGE_TO_CE': case 'メッセージをコモンイベントにインポート': if (args.length == 4) { addMessage('import message to common event. \n/ メッセージをコモンイベントにインポートします。'); Laurus.Text2Frame.ExecMode = 'IMPORT_MESSAGE_TO_CE'; Laurus.Text2Frame.FileFolder = args[0]; Laurus.Text2Frame.FileName = args[1]; Laurus.Text2Frame.CommonEventID = args[2]; Laurus.Text2Frame.IsOverwrite = (args[3] == 'true') ? true : false; Laurus.Text2Frame.TextPath = `${BASE_PATH}${PATH_SEP}${Laurus.Text2Frame.FileFolder}${PATH_SEP}${Laurus.Text2Frame.FileName}`; Laurus.Text2Frame.CommonEventPath = `${BASE_PATH}${path.sep}data${path.sep}CommonEvents.json`; } break; case 'COMMAND_LINE': Laurus.Text2Frame.ExecMode = args[0]; break; default: return; } const logger = {}; logger.log = function () { if (Laurus.Text2Frame.IsDebug) { console.debug.apply(console, arguments); } }; logger.error = function () { console.error(Array.prototype.join.call(arguments)); }; const readText = function (filepath) { try { return fs.readFileSync(filepath, { encoding: 'utf8' }); } catch (e) { throw new Error('File not found. / ファイルが見つかりません。\n' + filepath); } }; const readJsonData = function (filepath) { try { let jsondata = JSON.parse(readText(filepath)); if (typeof (jsondata) == 'object') { return jsondata; } else { throw new Error('Json syntax error. \nファイルが壊れています。RPG Makerでプロジェクトをセーブし直してください\n' + filepath); } } catch (e) { throw new Error('Json syntax error. \nファイルが壊れています。RPG Makerでプロジェクトをセーブし直してください\n' + filepath); } }; const writeData = function (filepath, jsonData) { try { fs.writeFileSync(filepath, JSON.stringify(jsonData, null, " "), { encoding: 'utf8' }); } catch (e) { throw new Error('Save failed. / 保存に失敗しました。\n' + 'ファイルが開いていないか確認してください。\n' + filepath); } }; /* 改行コードを統一する関数 */ const uniformNewLineCode = function (text) { return text.replace(/\r\n/g, "\n").replace(/\r/g, "\n"); }; /* コメントアウト行を削除する関数 */ const eraseCommentOutLines = function (scenario_text, commentOutChar) { // 一度改行毎にsplitして、要素毎にチェックして最後にひとつのテキストに結合する。 let re = new RegExp("^ *" + commentOutChar); return scenario_text.split("\n").filter(x => !x.match(re)).join('\n'); }; /*************************************************************************************************************/ const getBackground = function (background) { switch (background.toUpperCase()) { case 'WINDOW': case 'ウインドウ': return 0; case 'DIM': case '暗くする': case '暗く': return 1; case 'TRANSPARENT': case '透明': return 2; default: throw new Error('Syntax error. / 文法エラーです。'); } }; const getWindowPosition = function (windowPosition) { switch (windowPosition.toUpperCase()) { case 'TOP': case '上': return 0; case 'MIDDLE': case '中': return 1; case 'BOTTOM': case '下': return 2; default: throw new Error('Syntax error. / 文法エラーです。'); } }; const getPretextEvent = function () { return { "code": 101, "indent": 0, "parameters": ["", 0, getBackground(Laurus.Text2Frame.Background), getWindowPosition(Laurus.Text2Frame.WindowPosition), ""] } }; const getTextFrameEvent = function (text) { return { "code": 401, "indent": 0, "parameters": [text] } }; const getCommandBottomEvent = function () { return { "code": 0, "indent": 0, "parameters": [] }; }; const getScriptHeadEvent = function (text) { let script_head = { "code": 355, "indent": 0, "parameters": [""] } script_head["parameters"][0] = text; return script_head; }; const getScriptBodyEvent = function (text) { let script_body = { "code": 655, "indent": 0, "parameters": [""] } script_body["parameters"][0] = text; return script_body; }; const getPluginCommandEvent = function (text) { let plugin_command = { "code": 356, "indent": 0, "parameters": [""] } plugin_command["parameters"][0] = text; return plugin_command; }; const getPluginCommandEventMZ = function ( plugin_name, plugin_command, disp_plugin_command, args) { let plugin_args = {}; let plugin_command_mz = { "code": 357, "indent": 0, "parameters": [ plugin_name, plugin_command, disp_plugin_command, plugin_args ] }; let arg_regexp = /([^[\]]+)(\[.+\])/i; for (let i = 0; i < args.length; i++) { let matched = args[i].match(arg_regexp); if (matched) { let arg_name = matched[1] || ''; let values = matched[2].slice(1, -1).split('][') || []; plugin_args[arg_name] = values[0] || ''; } } return plugin_command_mz; }; const getPluginCommandMzParamsComment = function (plugin_command_mz_arg) { let arg_regexp = /([^[\]]+)(\[.+\])/i; let matched = plugin_command_mz_arg.match(arg_regexp); if (matched) { let arg_name = matched[1] || ''; let values = matched[2].slice(1, -1).split('][') || []; let value = values[0] || ''; if (values[1]) { arg_name = values[1]; } var parameters = [arg_name + " = " + value]; } return { "code": 657, "indent": 0, "parameters": parameters }; }; const getCommonEventEvent = function (num) { let common_event = { "code": 117, "indent": 0, "parameters": [""] } common_event["parameters"][0] = num; return common_event; }; const getCommentOutHeadEvent = function (text) { let comment_out = { "code": 108, "indent": 0, "parameters": [""] } comment_out["parameters"][0] = text; return comment_out; }; const getCommentOutBodyEvent = function (text) { let comment_out = { "code": 408, "indent": 0, "parameters": [""] } comment_out["parameters"][0] = text; return comment_out; }; const getWaitEvent = function (num) { let wait = { "code": 230, "indent": 0, "parameters": [""] } wait["parameters"][0] = num; return wait; }; const getFadeinEvent = function () { return { "code": 222, "indent": 0, "parameters": [] }; }; const getFadeoutEvent = function () { return { "code": 221, "indent": 0, "parameters": [] }; }; const getPlayBgmEvent = function (name, volume, pitch, pan) { let param_volume = 90; let param_pitch = 100; let param_pan = 0; if (typeof (volume) == "number") { param_volume = volume; } if (typeof (pitch) == "number") { param_pitch = pitch; } if (typeof (pan) == "number") { param_pan = pan; } return { "code": 241, "indent": 0, "parameters": [{ "name": name, "volume": param_volume, "pitch": param_pitch, "pan": param_pan }] }; }; const getStopBgmEvent = function (volume, pitch, pan) { return getPlayBgmEvent("", volume, pitch, pan); }; const getFadeoutBgmEvent = function (duration) { let param_duration = 10; if (typeof (duration) == "number") { param_duration = duration; } return { "code": 242, "indent": 0, "parameters": [param_duration] }; }; const getSaveBgmEvent = function () { return { "code": 243, "indent": 0, "parameters": [] }; }; const getReplayBgmEvent = function () { return { "code": 244, "indent": 0, "parameters": [] }; }; const getChangeBattleBgmEvent = function (name, volume, pitch, pan) { let param_volume = 90; let param_pitch = 100; let param_pan = 0; if (typeof (volume) == "number") { param_volume = volume; } if (typeof (pitch) == "number") { param_pitch = pitch; } if (typeof (pan) == "number") { param_pan = pan; } return { "code": 132, "indent": 0, "parameters": [{ "name": name, "volume": param_volume, "pitch": param_pitch, "pan": param_pan }] }; }; const getPlayBgsEvent = function (name, volume, pitch, pan) { let param_volume = 90; let param_pitch = 100; let param_pan = 0; if (typeof (volume) == "number") { param_volume = volume; } if (typeof (pitch) == "number") { param_pitch = pitch; } if (typeof (pan) == "number") { param_pan = pan; } return { "code": 245, "indent": 0, "parameters": [{ "name": name, "volume": param_volume, "pitch": param_pitch, "pan": param_pan }] }; }; const getStopBgsEvent = function (volume, pitch, pan) { return getPlayBgsEvent("", volume, pitch, pan); }; const getFadeoutBgsEvent = function (duration) { let param_duration = 10; if (typeof (duration) == "number") { param_duration = duration; } return { "code": 246, "indent": 0, "parameters": [param_duration] }; }; const getPlaySeEvent = function (name, volume, pitch, pan) { let param_volume = 90; let param_pitch = 100; let param_pan = 0; if (typeof (volume) == "number") { param_volume = volume; } if (typeof (pitch) == "number") { param_pitch = pitch; } if (typeof (pan) == "number") { param_pan = pan; } return { "code": 250, "indent": 0, "parameters": [{ "name": name, "volume": param_volume, "pitch": param_pitch, "pan": param_pan }] }; }; const getStopSeEvent = function () { return { "code": 251, "indent": 0, "parameters": [] }; }; const getPlayMeEvent = function (name, volume, pitch, pan) { let param_volume = 90; let param_pitch = 100; let param_pan = 0; if (typeof (volume) == "number") { param_volume = volume; } if (typeof (pitch) == "number") { param_pitch = pitch; } if (typeof (pan) == "number") { param_pan = pan; } return { "code": 249, "indent": 0, "parameters": [{ "name": name, "volume": param_volume, "pitch": param_pitch, "pan": param_pan }] }; }; const getStopMeEvent = function (volume, pitch, pan) { return getPlayMeEvent("", volume, pitch, pan); }; const getControlSwitch = function (start_pointer, end_pointer, value) { switch (value.toLowerCase()) { case 'on': case 'オン': case '1': case 'true': { return { "code": 121, "indent": 0, "parameters": [parseInt(start_pointer), parseInt(end_pointer), 0] }; } case 'off': case 'オフ': case '0': case 'false': { return { "code": 121, "indent": 0, "parameters": [parseInt(start_pointer), parseInt(end_pointer), 1] }; } } }; const getControlValiable = function (operation, start_pointer, end_pointer, operand, operand_arg1 = 0, operand_arg2 = 0, operand_arg3 = 0) { let parameters = [start_pointer, end_pointer]; switch (operation.toLowerCase()) { case 'set': parameters.push(0); break; case 'add': parameters.push(1); break; case 'sub': parameters.push(2); break; case 'mul': parameters.push(3); break; case 'div': parameters.push(4); break; case 'mod': parameters.push(5); break; default: parameters.push(0); break; } switch (operand.toLowerCase()) { case 'constant': parameters.push(0); parameters.push(operand_arg1); break; case 'variables': parameters.push(1); parameters.push(operand_arg1); break; case 'random': // operator, start_pointer, end_pointer, 'random', random_range1, random_range2 parameters.push(2); parameters.push(parseInt(operand_arg1)); parameters.push(parseInt(operand_arg2)); break; case 'gamedata': { // operator, start_pointer, end_pointer, 'gamedata', 'item', arg1, arg2, arg3 parameters.push(3); operand_arg1 = operand_arg1.toLowerCase(); switch (operand_arg1) { case 'item': case 'アイテム': parameters.push(0); parameters.push(parseInt(operand_arg2)); parameters.push(0); break; case 'weapon': case '武器': parameters.push(1); parameters.push(parseInt(operand_arg2)); parameters.push(0); break; case 'armor': case '防具': parameters.push(2); parameters.push(parseInt(operand_arg2)); parameters.push(0); break; case 'actor': case 'アクター': case 'enemy': case '敵キャラ': case 'エネミー': { if (operand_arg1 == 'actor' || operand_arg1 == 'アクター') { parameters.push(3); } else { parameters.push(4); } parameters.push(parseInt(operand_arg2)); switch (operand_arg3.toLowerCase()) { case 'level': case 'レベル': { parameters.push(0); break; } case 'exp': case '経験値': { parameters.push(1); break; } case 'hp': { parameters.push(2); break; } case 'mp': { parameters.push(3); break; } case 'maxhp': case '最大hp': { parameters.push(4); break; } case 'maxmp': case '最大mp': { parameters.push(5); break; } case 'attack': case '攻撃力': { parameters.push(6); break; } case 'defense': case '防御力': { parameters.push(7); break; } case 'm.attack': case '魔法攻撃力': { parameters.push(8); break; } case 'm.defense': case '魔法防御力': { parameters.push(9); break; } case 'agility': case '敏捷性': { parameters.push(10); break; } case 'luck': case '運': { parameters.push(11); break; } default: { parameters.push(0); break; } } if (operand_arg1 == 'enemy' || operand_arg1 == '敵キャラ' || operand_arg1 == 'エネミー') { let value = parameters.pop(); let key = parameters.pop(); value = value - 2; key = key - 1; parameters.push(key); parameters.push(value); } break; } case 'character': case 'キャラクター': parameters.push(5); switch (operand_arg2.toLowerCase()) { case 'player': case 'プレイヤー': case '-1': { parameters.push(-1); break; } case 'thisevent': case 'このイベント': case '0': { parameters.push(0); break; } default: { parameters.push(parseInt(operand_arg2)); break; } } switch (operand_arg3.toLowerCase()) { case 'mapx': case 'マップx': { parameters.push(0); break; } case 'mapy': case 'マップy': { parameters.push(1); break; } case 'direction': case '方向': { parameters.push(2); break; } case 'screenx': case '画面x': { parameters.push(3); break; } case 'screeny': case '画面y': { parameters.push(4); break; } default: { parameters.push(0); break; } } break; case 'party': case 'パーティ': parameters.push(6); parameters.push(parseInt(operand_arg2) - 1); parameters.push(0); break; case 'other': parameters.push(7); switch (operand_arg2.toLowerCase()) { case 'mapid': case 'マップid': { parameters.push(0); break; } case 'partymembers': case 'パーティ人数': { parameters.push(1); break; } case 'gold': case '所持金': { parameters.push(2); break; } case 'steps': case '歩数': { parameters.push(3); break; } case 'playtime': case 'プレイ時間': { parameters.push(4); break; } case 'timer': case 'タイマー': { parameters.push(5); break; } case 'savecount': case 'セーブ回数': { parameters.push(6); break; } case 'battlecount': case '戦闘回数': { parameters.push(7); break; } case 'wincount': case '勝利回数': { parameters.push(8); break; } case 'escapecount': case '逃走回数': { parameters.push(9); break; } default: { parameters.push(parseInt(operand_arg2)); break; } } parameters.push(0); break; case 'last': case '直前': parameters.push(8); switch (operand_arg2.toLowerCase()) { case 'last used skill id': case '直前に使用したスキルのid': case 'used skill id': { parameters.push(0); break; } case 'last used item id': case '直前に使用したアイテムのid': case 'used item id': { parameters.push(1); break; } case 'last actor id to act': case '直前に行動したアクターのid': case 'actor id to act': { parameters.push(2); break; } case 'last enemy index to act': case '直前に行動した敵キャラのインデックス': case 'enemy index to act': { parameters.push(3); break; } case 'last target actor id': case '直前に対象となったアクターのid': case 'target actor id': { parameters.push(4); break; } case 'last target enemy index': case '直前に対象となった敵キャラのインデックス': case 'target enemy index': { parameters.push(5); break; } default: { parameters.push(0); break; } } parameters.push(0); break; } break; } case 'script': { parameters.push(4); parameters.push(operand_arg1); break; } default: parameters.push(0); parameters.push(operand_arg1); parameters.push(operand_arg2); parameters.push(operand_arg3); break; } return { "code": 122, "indent": 0, "parameters": parameters }; }; const getControlSelfSwitch = function (target, value) { switch (value.toLowerCase()) { case 'on': case 'オン': case '1': case 'true': { return { "code": 123, "indent": 0, "parameters": [target.toUpperCase(), 0] }; } case 'off': case 'オフ': case '0': case 'false': { return { "code": 123, "indent": 0, "parameters": [target.toUpperCase(), 1] }; } default: return { "code": 123, "indent": 0, "parameters": [target.toUpperCase(), 1] }; } }; const getControlTimer = function (operation, sec) { switch (operation.toLowerCase()) { case 'start': case '始動': case 'スタート': { return { "code": 124, "indent": 0, "parameters": [0, parseInt(sec)] }; } case 'stop': case '停止': case 'ストップ': { return { "code": 124, "indent": 0, "parameters": [1, parseInt(sec)] }; } default: return { "code": 124, "indent": 0, "parameters": [1, parseInt(sec)] }; } }; /*************************************************************************************************************/ const getBlockStatement = function (scenario_text, statement) { let block_map = {}; let block_count = 0; let re = null; let event_head_func = function () { }; let event_body_func = function () { }; if (statement == 'script') { re = /<script>([\s\S]*?)<\/script>|<sc>([\s\S]*?)<\/sc>|<スクリプト>([\s\S]*?)<\/スクリプト>/i; event_head_func = getScriptHeadEvent; event_body_func = getScriptBodyEvent; } else if (statement == 'comment') { re = /<comment>([\s\S]*?)<\/comment>|<co>([\s\S]*?)<\/co>|<注釈>([\s\S]*?)<\/注釈>/i; event_head_func = getCommentOutHeadEvent; event_body_func = getCommentOutBodyEvent; } let block = scenario_text.match(re); while (block !== null) { let match_block = block[0]; let match_text = block[1] || block[2] || block[3]; scenario_text = scenario_text.replace(match_block, `\n#${statement.toUpperCase()}_BLOCK${block_count}#\n`); let match_text_list = match_text.replace(/^\n/, '').replace(/\n$/, '').split('\n'); let event_list = []; for (let i = 0; i < match_text_list.length; i++) { let text = match_text_list[i]; if (i == 0) { event_list.push(event_head_func(text)); } else { event_list.push(event_body_func(text)); } } block_map[`#${statement.toUpperCase()}_BLOCK${block_count}#`] = event_list; block = scenario_text.match(re); block_count++; } return { scenario_text, block_map }; }; const getDefaultPictureOptions = function () { return { "origin": 0, // 0: UpperLeft, 1:Center "variable": 0, // 0: Constant, 1: Variable // if variable is 0, x and y are a constant values. // if variable is 1, x is a number of variables "x": 0, "y": 0, "width": 100, "height": 100, //% "opacity": 255, "blend_mode": 0, // 0:Normal, 1:Additive, 2:Multiply, 3:Screen "duration": 60, "wait": true, // for a function that move a picture "red": 0, "green": 0, "blue": 0, "gray": 0, // for a function that tints a picture. "easing": 0 // for MZ }; }; const getPictureOptions = function (option_str) { let out = {}; let option_regexp = /([^[\]]+)(\[[\s\-a-zA-Z0-9\u30a0-\u30ff\u3040-\u309f\u3005-\u3006\u30e0-\u9fcf[\]]+\])/i; let option = option_str.match(option_regexp); if (option) { let key = option[1] || ''; let values = option[2].slice(1, -1).split('][') || ''; switch (key.toLowerCase()) { case "position": case "位置": { let origin = values[0] || 'Upper Left'; if (origin.toLowerCase() == 'center' || origin == '中央') { out["origin"] = 1; } let constant_regexp = /^[0-9]+$/; let variable_regexp = /(?:variables|v|変数)\[([0-9]+)\]/i; let x = values[1] || '0'; if (x.match(constant_regexp)) { out["variable"] = 0; out["x"] = Number(x); } else { let v = x.match(variable_regexp); if (v) { out["variable"] = 1; out["x"] = Number(v[1]) } } let y = values[2] || '0'; if (y.match(constant_regexp)) { out["variable"] = 0; out["y"] = Number(y); } else { let v = y.match(variable_regexp); if (v) { out["variable"] = 1; out["y"] = Number(v[1]); } } break; } case "scale": case "拡大率": { out["width"] = Number(values[0]) || 100; out["height"] = Number(values[1]) || 100; break; } case "blend": case '合成': { out["opacity"] = Number(values[0]) || 255; out["blend_mode"] = ({ "normal": 0, "通常": 0, "additive": 1, "加算": 1, "multiply": 2, "乗算": 2, "screen": 3, "スクリーン": 3 })[values[1].toLowerCase()] || 0; break; } case "duration": case "時間": { out["duration"] = Number(values[0]) || 60; if (typeof (values[1]) == "undefined" || values[1] == "") { out["wait"] = false; } break; } case "colortone": case "色調": case "ct": { let firstValue = values[0].toLowerCase() || 0; switch (firstValue) { case "normal": case "通常": { out["red"] = 0; out["green"] = 0; out["blue"] = 0; out["gray"] = 0; break; } case "dark": case "ダーク": { out["red"] = -68; out["green"] = -68; out["blue"] = -68; out["gray"] = 0; break; } case "sepia": case "セピア": { out["red"] = 34; out["green"] = -34; out["blue"] = -68; out["gray"] = 170; break; } case "sunset": case "夕暮れ": { out["red"] = 68; out["green"] = -34; out["blue"] = -34; out["gray"] = 0; break; } case "night": case "夜": { out["red"] = -68; out["green"] = -68; out["blue"] = 0; out["gray"] = 68; break; } default: { out["red"] = Number(values[0]) || 0; out["green"] = Number(values[1]) || 0; out["blue"] = Number(values[2]) || 0; out["gray"] = Number(values[3]) || 0; break; } } break; } case "easing": case "イージング": { let easingMode = values[0].toLowerCase() || "inear"; out["easing"] = { "constant speed": 0, "一定速度": 0, "linear": 0, "slow start": 1, "ゆっくり始まる": 1, "ease-in": 1, "slow end": 2, "ゆっくり終わる": 2, "ease-out": 2, "slow start and end": 3, "ゆっくり始まってゆっくり終わる": 3, "ease-in-out": 3 }[easingMode]; break; } } } return out; }; const getShowPicture = function (pic_no, name, options = []) { let ps = getDefaultPictureOptions(); options.map(x => Object.assign(ps, getPictureOptions(x))); return { "code": 231, "indent": 0, "parameters": [pic_no, name, ps.origin, ps.variable, ps.x, ps.y, ps.width, ps.height, ps.opacity, ps.blend_mode] }; }; const getMovePicture = function (pic_no, options = []) { let ps = getDefaultPictureOptions(); options.map(x => Object.assign(ps, getPictureOptions(x))); return { "code": 232, "indent": 0, "parameters": [pic_no, 0, ps.origin, ps.variable, ps.x, ps.y, ps.width, ps.height, ps.opacity, ps.blend_mode, ps.duration, ps.wait, ps.easing] }; }; const getRotatePicture = function (pic_no, speed) { return { "code": 233, "indent": 0, "parameters": [pic_no, speed] }; }; const getTintPicture = function (pic_no, options = []) { let ps = getDefaultPictureOptions(); options.map(x => Object.assign(ps, getPictureOptions(x))); return { "code": 234, "indent": 0, "parameters": [pic_no, [ps.red, ps.green, ps.blue, ps.gray], ps.duration, ps.wait] }; }; const getIfSwitchParameters = function (switchId, params) { switchId = Math.max(Number(switchId) || 1, 1); if (typeof (params[0]) == "undefined") { return [0, switchId, 0]; } const value = ({ "on": 0, "オン": 0, "true": 0, "1": 0, "off": 1, "オフ": 1, "false": 1, "0": 1 })[params[0].toLowerCase()]; if (switchId > 0 && (value == 1 || value == 0)) { return [0, switchId, value]; } return [0, switchId, 0]; }; const getIfVariableParameters = function (variableId, params) { variableId = Math.max(Number(variableId) || 1, 1); const operator = { "==": 0, "=": 0, ">=": 1, "≧": 1, "<=": 2, "≦": 2, ">": 3, ">": 3, "<": 4, "<": 4, "!=": 5, "≠": 5 }[params[0]] || 0 const constant_regexp = /^\d+$/; const variable_regexp = /(?:variables|v|変数)\[([0-9]+)\]/i; const operand = params[1] || "0"; if (operand.match(constant_regexp)) { return [1, variableId, 0, Number(operand), operator]; } else if (operand.match(variable_regexp)) { const value = Math.max(Number(operand.match(variable_regexp)[1]), 1); return [1, variableId, 1, value, operator]; } return [1, variableId, 0, 0, 0]; }; const getIfSelfSwitchParameters = function (selfSwitchId, params) { selfSwitchId = selfSwitchId.toUpperCase(); switch (selfSwitchId) { case "A": case "B": case "C": case "D": break; default: selfSwitchId = "A"; } if (typeof (params[0]) == "undefined") { return [2, selfSwitchId, 0]; } const value = ({ "on": 0, "オン": 0, "true": 0, "1": 0, "off": 1, "オフ": 1, "false": 1, "0": 1 })[params[0].toLowerCase()]; if (value == 0 || value == 1) { return [2, selfSwitchId, value]; } return [2, selfSwitchId, 0]; }; const getIfTimerParameters = function (params) { const condition = { ">=": 0, "≧": 0, "<=": 1, "≦": 1 }[params[0]] || 0; const minute = Number(params[1]) || 0; const second = Number(params[2]) || 0; return [3, 60 * minute + second, condition]; }; const getIfActorParameters = function (actorId, params) { actorId = Math.max(Number(actorId) || 1, 1); const actor_mode = { "in the party": 0, "パーティにいる": 0, "name": 1, "名前": 1, "class": 2, "職業": 2, "skill": 3, "スキル": 3, "weapon": 4, "武器": 4, "armor": 5, "防具": 5, "state": 6, "ステート": 6 }[params[0].toLowerCase()] || 0; if (actor_mode > 0) { if (actor_mode == 1) { return [4, actorId, 1, params[1]]; } else if (Number(params[1])) { return [4, actorId, actor_mode, Math.max(Number(params[1]), 1)]; } } return [4, actorId, 0]; }; const getIfEnemyParameters = function (enemyId, params) { enemyId = Math.max(Number(enemyId) || 1, 1) - 1; const condition = (params[0] || "appeared").toLowerCase(); const state_id = Math.max(Number(params[1]) || 1, 1); if (condition == "appeared" || condition == "出現している") { return [5, enemyId, 0]; } else if (condition == "state" || condition == "ステート") { return [5, enemyId, 1, state_id]; } else { return [5, enemyId, 0]; } }; const getIfCharacterParameters = function (character, params) { let characterId = { "player": -1, "プレイヤー": -1, "thisevent": 0, "このイベント": 0, }[character.toLowerCase()]; if (typeof (characterId) == "undefined") { characterId = Math.max(Number(character) || 0, -1); } const direction = { "down": 2, "下": 2, "2": 2, "left": 4, "左": 4, "4": 4, "right": 6, "右": 6, "6": 6, "up": 8, "上": 8, "8": 8 }[(params[0] || "").toLowerCase()] || 2; return [6, characterId, direction]; }; const getIfVehicleParameters = function (params) { const vehicle = { "boat": 0, "小型船": 0, "ship": 1, "大型船": 1, "airship": 2, "飛行船": 2 }[(params[0] || "").toLowerCase()] || 0 return [13, vehicle]; }; const getIfGoldParameters = function (params) { const condition = { ">=": 0, "≧": 0, "<=": 1, "≦": 1, "<": 2, "<": 2 }[params[0]] || 0; const gold = Number(params[1]) || 0; return [7, gold, condition]; }; const getIfItemParameters = function (itemId) { itemId = Math.max(Number(itemId) || 1, 1); return [8, itemId]; }; const getIfWeaponParameters = function (weaponId, params) { weaponId = Math.max(Number(weaponId) || 1, 1); let include_equipment = false; if (params[0]) include_equipment = true; return [9, weaponId, include_equipment]; }; const getIfArmorParameters = function (armorId, params) { armorId = Math.max(Number(armorId) || 1, 1); let include_equipment = false; if (params[0]) include_equipment = true; return [10, armorId, include_equipment]; }; const getIfButtonParameters = function (params) { let button = { "ok": "ok", "決定": "ok", "cancel": "cancel", "キャンセル": "cancel", "shift": "shift", "シフト": "shift", "down": "down", "下": "down", "left": "left", "左": "left", "right": "right", "右": "right", "up": "up", "上": "up", "pageup": "pageup", "ページアップ": "pageup", "pagedown": "pagedown", "ページダウン": "pagedown" }[(params[0] || "").toLowerCase()] || "ok"; let how = { "is being pressed": 0, "が押されている": 0, "pressed": 0, "is being triggered": 1, "がトリガーされている": 1, "triggered": 1, "is being repeated": 2, "がリピートされている": 2, "repeated": 2 }[(params[1] || "").toLowerCase()] || 0; return [11, button, how]; }; const getIfScriptParameters = function (params) { return [12, params.join(",").trim()]; }; const getConditionalBranch = function (target, params) { let out = { "code": 111, "indent": 0, "parameters": [0, 1, 0] }; // default let target_regexp = /([^[\]]+)(\[[\s\-a-zA-Z0-9\u30a0-\u30ff\u3040-\u309f\u3005-\u3006\u30e0-\u9fcf[\]]+\])*/i; target = target.match(target_regexp); let mode = target[1]; let mode_value = (target[2] || "").replace(/[[\]]/g, ""); switch (mode.toLowerCase()) { case "script": case "スクリプト": case "sc": break; default: params = params.map(s => s.trim()); break; } switch (mode.toLowerCase()) { case "switches": case "スイッチ": case "sw": { out.parameters = getIfSwitchParameters(mode_value, params); break; } case "variables": case "変数": case "v": { out.parameters = getIfVariableParameters(mode_value, params); break; } case "selfswitches": case "セルフスイッチ": case "ssw": { out.parameters = getIfSelfSwitchParameters(mode_value, params); break; } case "timer": case "タイマー": { out.parameters = getIfTimerParameters(params); break; } case "actors": case "アクター": { out.parameters = getIfActorParameters(mode_value, params); break; } case "enemies": case "敵キャラ": case "エネミー": { out.parameters = getIfEnemyParameters(mode_value, params); break; } case "characters": case "キャラクター": { out.parameters = getIfCharacterParameters(mode_value, params); break; } case "vehicle": case "乗り物": { out.parameters = getIfVehicleParameters(params); break; } case "gold": case "お金": { out.parameters = getIfGoldParameters(params); break; } case "items": case "アイテム": { out.parameters = getIfItemParameters(mode_value); break; } case "weapons": case "武器": { out.parameters = getIfWeaponParameters(mode_value, params); break; } case "armors": case "防具": { out.parameters = getIfArmorParameters(mode_value, params); break; } case "button": case "ボタン": { out.parameters = getIfButtonParameters(params); break; } case "script": case "スクリプト": case "sc": { out.parameters = getIfScriptParameters(params); break; } } return out; }; const getElse = function () { return { "code": 411, "indent": 0, "parameters": [] }; }; const getEnd = function () { return { "code": 412, "indent": 0, "parameters": [] }; }; const getLoop = function () { return { "code": 112, "indent": 0, "parameters": [] }; }; const getRepeatAbove = function () { return { "code": 413, "indent": 0, "parameters": [] }; }; const getBreakLoop = function () { return { "code": 113, "indent": 0, "parameters": [] }; }; const getExitEventProcessing = function () { return { "code": 115, "indent": 0, "parameters": [] }; }; const getLabel = function (name) { return { "code": 118, "indent": 0, "parameters": [name] }; }; const getJumpToLabel = function (name) { return { "code": 119, "indent": 0, "parameters": [name] }; }; const completeLackedBottomEvent = function (events) { const BOTTOM_CODE = 0; const IF_CODE = 111; const ELSE_CODE = 411; const LOOP_CODE = 112; const stack = events.reduce((s, e) => { const code = e.code; if (code == IF_CODE) s.push(IF_CODE); else if (code == ELSE_CODE) s.push(ELSE_CODE); else if (code == BOTTOM_CODE) s.pop(); return s; }, []); const bottom = stack.reduce((b, code) => { b.push(getCommandBottomEvent()); if (code == IF_CODE) b.push(getEnd()); else if (code == ELSE_CODE) b.push(getEnd()); else if (code == LOOP_CODE) b.push(getRepeatAbove()); return b; }, []); return events.concat(bottom); }; const autoIndent = function (events) { const BOTTOM_CODE = 0; const IF_CODE = 111; const ELSE_CODE = 411; const LOOP_CODE = 112; const out_events = events.reduce((o, e) => { const parameters = JSON.parse(JSON.stringify(e.parameters)); let now_indent = 0; const last = o.slice(-1)[0] if (last !== undefined) { now_indent = last.indent; switch (last.code) { case IF_CODE: case ELSE_CODE: case LOOP_CODE: { now_indent += 1; break; } case BOTTOM_CODE: now_indent -= 1; break; } } o.push({ "code": e.code, "indent": now_indent, "parameters": parameters }); return o; }, []); return out_events; }; let scenario_text = readText(Laurus.Text2Frame.TextPath); scenario_text = uniformNewLineCode(scenario_text); scenario_text = eraseCommentOutLines(scenario_text, Laurus.Text2Frame.CommentOutChar) let block_map = {}; { const t = getBlockStatement(scenario_text, 'script'); scenario_text = t.scenario_text; block_map = Object.assign(block_map, t.block_map); } { const t = getBlockStatement(scenario_text, 'comment'); scenario_text = t.scenario_text; block_map = Object.assign(block_map, t.block_map); } let text_lines = scenario_text.split('\n'); let event_command_list = []; let frame_param = getPretextEvent(); logger.log("Default", frame_param.parameters); for (let i = 0; i < text_lines.length; i++) { let text = text_lines[i]; logger.log(i, text); if (text) { let face = text.match(/<face *: *(.+?)>/i) || text.match(/<FC *: *(.+?)>/i) || text.match(/<顔 *: *(.+?)>/i); let window_position = text.match(/<windowposition *: *(.+?)>/i) || text.match(/<WP *: *(.+?)>/i) || text.match(/<位置 *: *(.+?)>/i); let background = text.match(/<background *: *(.+?)>/i) || text.match(/<BG *: *(.+?)>/i) || text.match(/<背景 *: *(.+?)>/i); let namebox = text.match(/<name *: ?(.+?)>/i) || text.match(/<NM *: ?(.+?)>/i) || text.match(/<名前 *: ?(.+?)>/i); let plugin_command = text.match(/<plugincommand *: *(.+?)>/i) || text.match(/<PC *: *(.+?)>/i) || text.match(/<プラグインコマンド *: *(.+?)>/i); let plugin_command_mz = text.match(/<plugincommandmz\s*:\s*([^\s].*)>/i) || text.match(/<PCZ\s*:\s*([^\s].*)>/i) || text.match(/<プラグインコマンドmz\s*:\s*([^\s].*)>/i); let common_event = text.match(/<commonevent *: *(.+?)>/i) || text.match(/<CE *: *(.+?)>/i) || text.match(/<コモンイベント *: *(.+?)>/i); let wait = text.match(/<wait *: *(.+?)>/i) || text.match(/<ウェイト *: *(.+?)>/i); let fadein = text.match(/<fadein>/i) || text.match(/<FI>/i) || text.match(/<フェードイン>/i); let fadeout = text.match(/<fadeout>/i) || text.match(/<FO>/i) || text.match(/<フェードアウト>/i); let play_bgm = text.match(/<playbgm *: *([^ ].+)>/i) || text.match(/<BGMの演奏 *: *([^ ].+)>/); let stop_bgm = text.match(/<stopbgm>/i) || text.match(/<playbgm *: *none>/i) || text.match(/<playbgm *: *なし>/i) || text.match(/<BGMの停止>/); let fadeout_bgm = text.match(/<fadeoutbgm *: *(.+?)>/i) || text.match(/<BGMのフェードアウト *: *(.+?)>/); let save_bgm = text.match(/<savebgm>/i) || text.match(/<BGMの保存>/); let replay_bgm = text.match(/<replaybgm>/i) || text.match(/<BGMの再開>/); let change_battle_bgm = text.match(/<changebattlebgm *: *([^ ].+)>/i) || text.match(/<戦闘曲の変更 *: *([^ ].+)>/); let play_bgs = text.match(/<playbgs *: *([^ ].+)>/i) || text.match(/<BGSの演奏 *: *([^ ].+)>/); let stop_bgs = text.match(/<stopbgs>/i) || text.match(/<playbgs *: *none>/i) || text.match(/<playbgs *: *なし>/i) || text.match(/<BGSの停止>/); let fadeout_bgs = text.match(/<fadeoutbgs *: *(.+?)>/i) || text.match(/<BGSのフェードアウト *: *(.+?)>/); let play_se = text.match(/<playse *: *([^ ].+)>/i) || text.match(/<SEの演奏 *: *([^ ].+)>/); let stop_se = text.match(/<stopse>/i) || text.match(/<SEの停止>/); let play_me = text.match(/<playme *: *([^ ].+)>/i) || text.match(/<MEの演奏 *: *([^ ].+)>/); let stop_me = text.match(/<stopme>/i) || text.match(/<playme *: *none>/i) || text.match(/<playme *: *なし>/i) || text.match(/<MEの停止>/); let show_picture = text.match(/<showpicture\s*:\s*([^\s].*)>/i) || text.match(/<ピクチャの表示\s*:\s*([^\s].+)>/i) || text.match(/<SP\s*:\s*([^\s].+)>/i); let move_picture = text.match(/<movepicture\s*:\s*([^\s].*)>/i) || text.match(/<ピクチャの移動\s*:\s*([^\s].*)>/i) || text.match(/<MP\s*:\s*([^\s].*)>/i); let rotate_picture = text.match(/<rotatepicture\s*:\s*(\d{1,2})\s*,\s*(-?\d{1,2})\s*>/i) || text.match(/<ピクチャの回転\s*:\s*(\d{1,2})\s*,\s*(-?\d{1,2})\s*>/i) || text.match(/<RP\s*:\s*(\d{1,2})\s*,\s*(-?\d{1,2})\s*>/i); let tint_picture = text.match(/<tintpicture\s*:\s*([^\s].*)>/i) || text.match(/<ピクチャの色調変更\s*:\s*([^\s].*)>/i) || text.match(/<TP\s*:\s*([^\s].*)>/i); let erase_picture = text.match(/<erasepicture\s*:\s*(\d{1,2})\s*>/i) || text.match(/<ピクチャの消去\s*:\s*(\d{1,2})\s*>/i) || text.match(/<ep\s*:\s*(\d{1,2})\s*>/i); let conditional_branch_if = text.match(/\s*<if\s*:\s*([^\s].*)>/i) || text.match(/\s*<条件分岐\s*:\s*([^\s].*)>/i); let conditional_branch_else = text.match(/\s*<else>/i) || text.match(/\s*<それ以外のとき>/); let conditional_branch_end = text.match(/\s*<end>/i) || text.match(/\s*<分岐修了>/); let loop = text.match(/\s*<loop>/i) || text.match(/\s*<ループ>/); let repeat_above = text.match(/<repeatabove>/i) || text.match(/\s*<以上繰り返し>/) || text.match(/\s*<ra>/i); let break_loop = text.match(/<breakloop>/i) || text.match(/<ループの中断>/) || text.match(/<BL>/i); let exit_event_processing = text.match(/<ExitEventProcessing>/i) || text.match(/<イベント処理の中断>/) || text.match(/<EEP>/i); let label = text.match(/<label\s*:\s*(\S+)\s*>/i) || text.match(/<ラベル\s*:\s*(\S+)\s*>/i); let jump_to_label = text.match(/<jumptolabel\s*:\s*(\S+)\s*>/i) || text.match(/<ラベルジャンプ\s*:\s*(\S+)\s*>/) || text.match(/<jtl\s*:\s*(\S+)\s*>/i); const script_block = text.match(/#SCRIPT_BLOCK[0-9]+#/i); const comment_block = text.match(/#COMMENT_BLOCK[0-9]+#/i); // Script Block if (script_block) { const block_tag = script_block[0]; event_command_list = event_command_list.concat(block_map[block_tag]); continue; } // Comment Block if (comment_block) { const block_tag = comment_block[0]; event_command_list = event_command_list.concat(block_map[block_tag]); continue; } // Plugin Command if (plugin_command) { event_command_list.push(getPluginCommandEvent(plugin_command[1])); continue; } // Plugin Command MZ if (plugin_command_mz) { let params = plugin_command_mz[1].split(',').map(s => s.trim()); if (params.length > 2) { let arg_plugin_name = params[0]; let arg_plugin_command = params[1]; let arg_disp_plugin_command = params[2]; let pcz_args = params.slice(3); let pcemz = getPluginCommandEventMZ( arg_plugin_name, arg_plugin_command, arg_disp_plugin_command, pcz_args ); event_command_list.push(pcemz); pcz_args.map(arg => event_command_list.push(getPluginCommandMzParamsComment(arg))) } else { throw new Error('Syntax error. / 文法エラーです。' + text.replace(/</g, ' ').replace(/>/g, ' ')); } continue; } // Common Event if (common_event) { let event_num = Number(common_event[1]); if (event_num) { event_command_list.push(getCommonEventEvent(event_num)); } else { throw new Error('Syntax error. / 文法エラーです。' + common_event[1] + ' is not number. / ' + common_event[1] + 'は整数ではありません'); } continue; } // Wait if (wait) { let wait_num = Number(wait[1]); if (wait_num) { event_command_list.push(getWaitEvent(wait_num)); } else { throw new Error('Syntax error. / 文法エラーです。' + common_event[1] + ' is not number. / ' + common_event[1] + 'は整数ではありません'); } continue; } // Fadein if (fadein) { event_command_list.push(getFadeinEvent()); continue; } // Fadeout if (fadeout) { event_command_list.push(getFadeoutEvent()); continue; } // Stop BGM if (stop_bgm) { event_command_list.push(getStopBgmEvent(90, 100, 0)); continue; } // Play BGM if (play_bgm) { if (play_bgm[1]) { let params = play_bgm[1].replace(/ /g, '').split(','); let name = "Battle1"; let volume = 90; let pitch = 100; let pan = 0; if (params[0]) { name = params[0]; } if (Number(params[1]) || Number(params[1]) == 0) { volume = Number(params[1]); } if (Number(params[2]) || Number(params[2]) == 0) { pitch = Number(params[2]); } if (Number(params[3]) || Number(params[3]) == 0) { pan = Number(params[3]); } if (name.toUpperCase() === "NONE" || name === "なし") { event_command_list.push(getPlayBgmEvent("", volume, pitch, pan)); } else { event_command_list.push(getPlayBgmEvent(name, volume, pitch, pan)); } } continue; } // Fadeout BGM if (fadeout_bgm) { if (fadeout_bgm[1]) { let duration = 10; let d = fadeout_bgm[1].replace(/ /g, ''); if (Number(d) || Number(d) == 0) { duration = Number(d); } event_command_list.push(getFadeoutBgmEvent(duration)); } continue; } // Save BGM if (save_bgm) { event_command_list.push(getSaveBgmEvent()); continue; } // Replay BGM if (replay_bgm) { event_command_list.push(getReplayBgmEvent()); continue; } // Change Battle BGM if (change_battle_bgm) { if (change_battle_bgm[1]) { let params = change_battle_bgm[1].replace(/ /g, '').split(','); let name = "Battle1"; let volume = 90; let pitch = 100; let pan = 0; if (params[0]) { name = params[0]; } if (Number(params[1]) || Number(params[1]) == 0) { volume = Number(params[1]); } if (Number(params[2]) || Number(params[2]) == 0) { pitch = Number(params[2]); } if (Number(params[3]) || Number(params[3]) == 0) { pan = Number(params[3]); } if (name.toUpperCase() === "NONE" || name === "なし") { event_command_list.push(getChangeBattleBgmEvent("", volume, pitch, pan)); } else { event_command_list.push(getChangeBattleBgmEvent(name, volume, pitch, pan)); } } continue; } // Stop BGS if (stop_bgs) { event_command_list.push(getStopBgsEvent(90, 100, 0)); continue; } // Play BGS if (play_bgs) { if (play_bgs[1]) { let params = play_bgs[1].replace(/ /g, '').split(','); let name = "City"; let volume = 90; let pitch = 100; let pan = 0; if (params[0]) { name = params[0]; } if (Number(params[1]) || Number(params[1]) == 0) { volume = Number(params[1]); } if (Number(params[2]) || Number(params[2]) == 0) { pitch = Number(params[2]); } if (Number(params[3]) || Number(params[3]) == 0) { pan = Number(params[3]); } if (name.toUpperCase() === "NONE" || name === "なし") { event_command_list.push(getPlayBgsEvent("", volume, pitch, pan)); } else { event_command_list.push(getPlayBgsEvent(name, volume, pitch, pan)); } } continue; } // Fadeout BGS if (fadeout_bgs) { if (fadeout_bgs[1]) { let duration = 10; let d = fadeout_bgs[1].replace(/ /g, ''); if (Number(d) || Number(d) == 0) { duration = Number(d); } event_command_list.push(getFadeoutBgsEvent(duration)); } continue; } // Play SE if (play_se) { if (play_se[1]) { let params = play_se[1].replace(/ /g, '').split(','); let name = "Attack1"; let volume = 90; let pitch = 100; let pan = 0; if (params[0]) { name = params[0]; } if (Number(params[1]) || Number(params[1]) == 0) { volume = Number(params[1]); } if (Number(params[2]) || Number(params[2]) == 0) { pitch = Number(params[2]); } if (Number(params[3]) || Number(params[3]) == 0) { pan = Number(params[3]); } if (name.toUpperCase() === "NONE" || name === "なし") { event_command_list.push(getPlaySeEvent("", volume, pitch, pan)); } else { event_command_list.push(getPlaySeEvent(name, volume, pitch, pan)); } } continue; } // Stop SE if (stop_se) { event_command_list.push(getStopSeEvent()); continue; } // Stop ME if (stop_me) { event_command_list.push(getStopMeEvent(90, 100, 0)); continue; } // Play ME if (play_me) { if (play_me[1]) { let params = play_me[1].replace(/ /g, '').split(','); let name = "Curse1"; let volume = 90; let pitch = 100; let pan = 0; if (params[0]) { name = params[0]; } if (Number(params[1]) || Number(params[1]) == 0) { volume = Number(params[1]); } if (Number(params[2]) || Number(params[2]) == 0) { pitch = Number(params[2]); } if (Number(params[3]) || Number(params[3]) == 0) { pan = Number(params[3]); } if (name.toUpperCase() === "NONE" || name === "なし") { event_command_list.push(getPlayMeEvent("", volume, pitch, pan)); } else { event_command_list.push(getPlayMeEvent(name, volume, pitch, pan)); } } continue; } /* eslint-disable no-useless-escape */ const num_char_regex = '\\w\u30a0-\u30ff\u3040-\u309f\u3005-\u3006\u30e0-\u9fcf' //const control_variable_arg_regex = `[${num_char_regex}\\[\\]\\.\\-]+`; const control_variable_arg_regex = '.+'; const set_operation_list = ['set', '代入', '=']; const set_reg_list = set_operation_list.map(x => `<${x} *: *(\\d+\\-?\\d*) *, *(${control_variable_arg_regex}) *>`); const set = text.match(new RegExp(set_reg_list.join('|'), 'i')); const add_operation_list = ['add', '加算', '\\+']; const add_reg_list = add_operation_list.map(x => `<${x} *: *(\\d+\\-?\\d*) *, *(${control_variable_arg_regex}) *>`); const add = text.match(new RegExp(add_reg_list.join('|'), 'i')); const sub_operation_list = ['sub', '減算', '-']; const sub_reg_list = sub_operation_list.map(x => `<${x} *: *(\\d+\\-?\\d*) *, *(${control_variable_arg_regex}) *>`); const sub = text.match(new RegExp(sub_reg_list.join('|'), 'i')); const mul_operation_list = ['mul', '乗算', '\\*']; const mul_reg_list = mul_operation_list.map(x => `<${x} *: *(\\d+\\-?\\d*) *, *(${control_variable_arg_regex}) *>`); const mul = text.match(new RegExp(mul_reg_list.join('|'), 'i')); const div_operation_list = ['div', '除算', '\\/']; const div_reg_list = div_operation_list.map(x => `<${x} *: *(\\d+\\-?\\d*) *, *(${control_variable_arg_regex}) *>`); const div = text.match(new RegExp(div_reg_list.join('|'), 'i')); const mod_operation_list = ['mod', '剰余', '\\%']; const mod_reg_list = mod_operation_list.map(x => `<${x} *: *(\\d+\\-?\\d*) *, *(${control_variable_arg_regex}) *>`); const mod = text.match(new RegExp(mod_reg_list.join('|'), 'i')); const switch_operation_list = ['sw', 'switch', 'スイッチ']; const switch_reg_list = switch_operation_list.map(x => `<${x} *: *(\\d+\\-?\\d*) *, *(${control_variable_arg_regex}) *>`); const switch_tag = text.match(new RegExp(switch_reg_list.join('|'), 'i')); const self_switch_operation_list = ['ssw', 'selfswitch', 'セルフスイッチ']; const self_switch_reg_list = self_switch_operation_list.map(x => `<${x} *: *([abcd]) *, *(${control_variable_arg_regex}) *>`); const self_switch_tag = text.match(new RegExp(self_switch_reg_list.join('|'), 'i')); /* eslint-enable */ const getControlTag = function (operator, operand1, operand2) { if (operator == 'selfswitch') { const selfswitch_target = operand1.match(/[abcd]/i); const selfswitch_value = operand2.match(/on|オン|1|true|off|オフ|0|false/i); if (selfswitch_target && selfswitch_value) { return getControlSelfSwitch(selfswitch_target[0], selfswitch_value[0]); } } let operand1_num = operand1.match(/\d+/i); /* eslint-disable no-useless-escape */ let operand1_range = operand1.match(/(\d+)\-?(\d+)/i); /* eslint-enable */ let start_pointer = 0; let end_pointer = 0; if (operand1_range) { start_pointer = parseInt(operand1_range[1]); end_pointer = parseInt(operand1_range[2]); } else if (operand1_num) { let num = parseInt(operand1_num[0]); start_pointer = num; end_pointer = num; } else { throw new Error('Syntax error. / 文法エラーです。'); } if (operator == 'switch') { const switch_tag = operand2.match(/on|オン|1|true|off|オフ|0|false/i); if (switch_tag) { return getControlSwitch(start_pointer, end_pointer, switch_tag[0]); } } const variables = operand2.match(/v\[(\d+)\]|variables\[(\d+)\]|変数\[(\d+)\]/i); if (variables) { const num = variables[1] || variables[2] || variables[3]; return getControlValiable(operator, start_pointer, end_pointer, 'variables', parseInt(num)); } /* eslint-disable no-useless-escape */ const random = operand2.match(/r\[(\-?\d+)\]\[(\-?\d+)\]|random\[(\-?\d+)\]\[(\-?\d+)\]|乱数\[(\-?\d+)\]\[(\-?\d+)\]/i); /* eslint-enable */ if (random) { const random_range1 = random[1] || random[3] || random[5]; const random_range2 = random[2] || random[4] || random[6]; return getControlValiable(operator, start_pointer, end_pointer, 'random', parseInt(random_range1), parseInt(random_range2)); } const gamedata_operation_list = ['gd', 'gamedata', 'ゲームデータ']; const gamedata_reg_list = gamedata_operation_list.map(x => `(${x})(${control_variable_arg_regex})`) const gamedata = operand2.match(new RegExp(gamedata_reg_list.join('|'), 'i')) if (gamedata) { const func = gamedata[2] || gamedata[4] || gamedata[6]; const gamedata_key_match = func.match(new RegExp(`\\[([${num_char_regex}]+)\\]`, 'i')); if (gamedata_key_match) { const gamedata_key = gamedata_key_match[1]; switch (gamedata_key.toLowerCase()) { case 'mapid': case 'マップid': case 'partymembers': case 'パーティ人数': case 'gold': case '所持金': case 'steps': case '歩数': case 'playtime': case 'プレイ時間': case 'timer': case 'タイマー': case 'savecount': case 'セーブ回数': case 'battlecount': case '戦闘回数': case 'wincount': case '勝利回数': case 'escapecount': case '逃走回数': { return getControlValiable(operator, start_pointer, end_pointer, 'gamedata', 'other', gamedata_key.toLowerCase(), 0); } case 'item': case 'アイテム': case 'weapon': case '武器': case 'armor': case '防具': case 'party': case 'パーティ': { const args = func.match(new RegExp(`\\[[${num_char_regex}]+\\]\\[([${num_char_regex}]+)\\]`, 'i')); if (args) { const arg1 = args[1]; return getControlValiable(operator, start_pointer, end_pointer, 'gamedata', gamedata_key.toLowerCase(), parseInt(arg1)); } break; } case 'last': case '直前': { const args = func.match(new RegExp(`\\[[${num_char_regex}]+\\]\\[([${num_char_regex} ]+)\\]`, 'i')); if (args) { const arg1 = args[1]; return getControlValiable(operator, start_pointer, end_pointer, 'gamedata', gamedata_key.toLowerCase(), arg1); } break; } case 'actor': case 'アクター': case 'enemy': case '敵キャラ': case 'エネミー': case 'character': case 'キャラクター': { const args = func.match(new RegExp(`\\[[${num_char_regex}]+\\]\\[([${num_char_regex}\\-]+)\\]\\[([${num_char_regex}\\.]+)\\]`, 'i')); if (args) { const arg1 = args[1]; const arg2 = args[2]; return getControlValiable(operator, start_pointer, end_pointer, 'gamedata', gamedata_key.toLowerCase(), arg1, arg2); } break; } } } } const script = operand2.match(/sc\[(.+)\]|script\[(.+)\]|スクリプト\[(.+)\]/i); if (script) { const script_body = script[1] || script[2] || script[3]; return getControlValiable(operator, start_pointer, end_pointer, 'script', script_body); } let value_num = Number(operand2); return getControlValiable(operator, start_pointer, end_pointer, 'constant', value_num); } // set if (set) { const operand1 = set[1] || set[3] || set[5]; const operand2 = set[2] || set[4] || set[6]; event_command_list.push(getControlTag('set', operand1, operand2)); continue; } // add if (add) { const operand1 = add[1] || add[3] || add[5]; const operand2 = add[2] || add[4] || add[6]; event_command_list.push(getControlTag('add', operand1, operand2)); continue; } // sub if (sub) { const operand1 = sub[1] || sub[3] || sub[5]; const operand2 = sub[2] || sub[4] || sub[6]; event_command_list.push(getControlTag('sub', operand1, operand2)); continue; } // mul if (mul) { const operand1 = mul[1] || mul[3] || mul[5]; const operand2 = mul[2] || mul[4] || mul[6]; event_command_list.push(getControlTag('mul', operand1, operand2)); continue; } // div if (div) { const operand1 = div[1] || div[3] || div[5]; const operand2 = div[2] || div[4] || div[6]; event_command_list.push(getControlTag('div', operand1, operand2)); continue; } // mod if (mod) { const operand1 = mod[1] || mod[3] || mod[5]; const operand2 = mod[2] || mod[4] || mod[6]; event_command_list.push(getControlTag('mod', operand1, operand2)); continue; } // switch if (switch_tag) { const operand1 = switch_tag[1] || switch_tag[3] || switch_tag[5]; const operand2 = switch_tag[2] || switch_tag[4] || switch_tag[6]; event_command_list.push(getControlTag('switch', operand1, operand2)); continue; } // self switch if (self_switch_tag) { const operand1 = self_switch_tag[1] || self_switch_tag[3] || self_switch_tag[5]; const operand2 = self_switch_tag[2] || self_switch_tag[4] || self_switch_tag[6]; event_command_list.push(getControlTag('selfswitch', operand1, operand2)); continue; } /// timer control const timer_start_reg_list = ['timer', 'タイマー'].map(x => `<${x} *: *(.+) *, *(\\d+), *(\\d+) *>`); const timer_start = text.match(new RegExp(timer_start_reg_list.join('|'), 'i')); const timer_stop_reg_list = ['timer', 'タイマー'].map(x => `<${x} *: *(.+) *>`); const timer_stop = text.match(new RegExp(timer_stop_reg_list.join('|'), 'i')); if (timer_start) { let operand1 = timer_start[1] || timer_start[4]; let min = parseInt(timer_start[2] || timer_start[5]); let sec = parseInt(timer_start[3] || timer_start[6]); let setting_sec = 60 * min + sec; event_command_list.push(getControlTimer(operand1, setting_sec)); continue; } if (timer_stop) { let operand1 = timer_stop[1] || timer_stop[2]; event_command_list.push(getControlTimer(operand1, 0)); continue; } // Show Picture if (show_picture) { let params = show_picture[1].split(',').map(s => s.trim()); if (params.length > 1) { let pic_no = Number(params[0]); let name = params[1]; let options = params.slice(2); event_command_list.push(getShowPicture(pic_no, name, options)); continue; } else { console.error(text); throw new Error('Syntax error. / 文法エラーです。' + text.replace(/</g, ' ').replace(/>/g, ' ')); } } // Move Picture if (move_picture) { let params = move_picture[1].split(',').map(s => s.trim()); if (params.length > 0) { let pic_no = Number(params[0]); let options = params.slice(1); event_command_list.push(getMovePicture(pic_no, options)); continue; } else { console.error(text); throw new Error('Syntax error. / 文法エラーです。' + text.replace(/</g, ' ').replace(/>/g, ' ')); } } // Rotate Picture if (rotate_picture) { let pic_no = Number(rotate_picture[1]); let speed = Number(rotate_picture[2]); event_command_list.push(getRotatePicture(pic_no, speed)); continue; } //Tint Picture if (tint_picture) { let params = tint_picture[1].split(',').map(s => s.trim()); if (params.length > 0) { let pic_no = Number(params[0]); let options = params.slice(1); event_command_list.push(getTintPicture(pic_no, options)); continue; } else { console.error(text); throw new Error('Syntax error. / 文法エラーです。' + text.replace(/</g, ' ').replace(/>/g, ' ')); } } // Erase Picture if (erase_picture) { let pic_no = Number(erase_picture[1]); event_command_list.push({ "code": 235, "indent": 0, "parameters": [pic_no] }); continue; } // Conditional Branch (If) if (conditional_branch_if) { let args = conditional_branch_if[1].split(','); if (args.length > 0) { let target = args[0].trim(); let params = args.slice(1); event_command_list.push(getConditionalBranch(target, params)); frame_param = frame_param || getPretextEvent(); continue; } else { console.error(text); throw new Error('Syntax error. / 文法エラーです。' + text.replace(/</g, ' ').replace(/>/g, ' ')); } } // Conditional Branch (Else) if (conditional_branch_else) { event_command_list.push(getCommandBottomEvent()); event_command_list.push(getElse()); frame_param = frame_param || getPretextEvent(); continue; } // Conditional Branch (End) if (conditional_branch_end) { event_command_list.push(getCommandBottomEvent()); event_command_list.push(getEnd()); frame_param = frame_param || getPretextEvent(); continue; } // Loop if (loop) { event_command_list.push(getLoop()); continue; } // Repeat Above if (repeat_above) { event_command_list.push(getCommandBottomEvent()); event_command_list.push(getRepeatAbove()); frame_param = frame_param || getPretextEvent(); continue; } // Break Loop if (break_loop) { event_command_list.push(getBreakLoop()); continue; } // Exit Event Processing if (exit_event_processing) { event_command_list.push(getExitEventProcessing()); continue; } // Label if (label) { let label_name = label[1] || ""; event_command_list.push(getLabel(label_name)); continue; } // Jump to Label if (jump_to_label) { let label_name = jump_to_label[1] || ""; event_command_list.push(getJumpToLabel(label_name)); continue; } // Face if (face) { if (!frame_param) { frame_param = getPretextEvent(); } let face_number = face[1].match(/.*\((.+?)\)/i); if (face_number) { frame_param.parameters[0] = face[1].replace(/\(\d\)/, ''); frame_param.parameters[1] = parseInt(face_number[1]); text = text.replace(face[0], ''); } else { console.error(text); throw new Error('Syntax error. / 文法エラーです。' + text.replace(/</g, ' ').replace(/>/g, ' ')); } } // window backgound if (background) { if (!frame_param) { frame_param = getPretextEvent(); } try { frame_param.parameters[2] = getBackground(background[1]); } catch (e) { console.error(text); throw new Error('Syntax error. / 文法エラーです。' + text.replace(/</g, ' ').replace(/>/g, ' ')); } text = text.replace(background[0], ''); } // window position if (window_position) { if (!frame_param) { frame_param = getPretextEvent(); } try { frame_param.parameters[3] = getWindowPosition(window_position[1]); } catch (e) { console.error(text); throw new Error('Syntax error. / 文法エラーです。' + text.replace(/</g, ' ').replace(/>/g, ' ')); } text = text.replace(window_position[0], ''); } //name box if (namebox) { if (!frame_param) { frame_param = getPretextEvent(); } frame_param.parameters[4] = namebox[1]; text = text.replace(namebox[0], ''); } if (text) { if (frame_param) { logger.log("push: ", frame_param.parameters); event_command_list.push(frame_param); frame_param = null; } logger.log("push: ", text); event_command_list.push(getTextFrameEvent(text)); } } else { frame_param = getPretextEvent(); } } event_command_list = completeLackedBottomEvent(event_command_list); event_command_list = autoIndent(event_command_list); event_command_list.push(getCommandBottomEvent()); switch (Laurus.Text2Frame.ExecMode) { case 'IMPORT_MESSAGE_TO_EVENT': case 'メッセージをイベントにインポート': { let map_data = readJsonData(Laurus.Text2Frame.MapPath); if (!map_data.events[Laurus.Text2Frame.EventID]) { throw new Error('EventID not found. / EventIDが見つかりません。\n' + "Event ID: " + Laurus.Text2Frame.EventID); } let pageID = Number(Laurus.Text2Frame.PageID) - 1; while (!map_data.events[Laurus.Text2Frame.EventID].pages[pageID]) { map_data.events[Laurus.Text2Frame.EventID].pages.push(getDefaultPage()); } let map_events = map_data.events[Laurus.Text2Frame.EventID].pages[pageID].list; if (Laurus.Text2Frame.IsOverwrite) { map_events = []; } map_events.pop(); map_events = map_events.concat(event_command_list); map_data.events[Laurus.Text2Frame.EventID].pages[pageID].list = map_events; writeData(Laurus.Text2Frame.MapPath, map_data); addMessage('Success / 書き出し成功!\n' + "======> MapID: " + Laurus.Text2Frame.MapID + " -> EventID: " + Laurus.Text2Frame.EventID + " -> PageID: " + Laurus.Text2Frame.PageID); break; } case 'IMPORT_MESSAGE_TO_CE': case 'メッセージをコモンイベントにインポート': { const ce_data = readJsonData(Laurus.Text2Frame.CommonEventPath); if (ce_data.length - 1 < Laurus.Text2Frame.CommonEventID) { throw new Error("Common Event not found. / コモンイベントが見つかりません。: " + Laurus.Text2Frame.CommonEventID); } let ce_events = ce_data[Laurus.Text2Frame.CommonEventID].list; if (Laurus.Text2Frame.IsOverwrite) { ce_events = []; } ce_events.pop(); ce_data[Laurus.Text2Frame.CommonEventID].list = ce_events.concat(event_command_list); writeData(Laurus.Text2Frame.CommonEventPath, ce_data); addMessage('Success / 書き出し成功!\n' + "=====> Common EventID :" + Laurus.Text2Frame.CommonEventID); break; } } addMessage('\n'); addMessage('Please restart RPG Maker MV(Editor) WITHOUT save. \n' + '**セーブせずに**プロジェクトファイルを開き直してください'); console.log('Please restart RPG Maker MV(Editor) WITHOUT save. \n' + '**セーブせずに**プロジェクトファイルを開き直してください'); }; })(); // developer mode // // $ node Text2Frame.js if (typeof require.main !== 'undefined' && require.main === module) { let program = require('commander'); program .version('0.0.1') .usage('[options]') .option('-m, --mode <map|common|test>', 'output mode', /^(map|common|test)$/i) .option('-t, --text_path <name>', 'text file path') .option('-o, --output_path <name>', 'output file path') .option('-e, --event_id <name>', 'event file id') .option('-p, --page_id <name>', 'page id') .option('-c, --common_event_id <name>', 'common event id') .option('-w, --overwrite <true/false>', 'overwrite mode', 'false') .option('-v, --verbose', 'debug mode', false) .parse(process.argv); Laurus.Text2Frame.IsDebug = program.verbose; Laurus.Text2Frame.TextPath = program.text_path; Laurus.Text2Frame.IsOverwrite = (program.overwrite == 'true') ? true : false; if (program.mode === 'map') { Laurus.Text2Frame.MapPath = program.output_path; Laurus.Text2Frame.EventID = program.event_id; Laurus.Text2Frame.PageID = program.page_id ? program.page_id : '1'; Game_Interpreter.prototype.pluginCommandText2Frame('COMMAND_LINE', ['IMPORT_MESSAGE_TO_EVENT']); } else if (program.mode === 'common') { Laurus.Text2Frame.CommonEventPath = program.output_path; Laurus.Text2Frame.CommonEventID = program.common_event_id; Game_Interpreter.prototype.pluginCommandText2Frame('COMMAND_LINE', ['IMPORT_MESSAGE_TO_CE']); } else if (program.mode === 'test') { const folder_name = 'test'; const file_name = 'basic.txt'; const map_id = '1'; const event_id = '1'; const page_id = '1'; const overwrite = 'true'; Game_Interpreter.prototype.pluginCommandText2Frame('IMPORT_MESSAGE_TO_EVENT', [folder_name, file_name, map_id, event_id, page_id, overwrite]); } else { console.log('===== Manual ====='); console.log(` NAME Text2Frame - Simple compiler to convert text to event command. SYNOPSIS node Text2Frame.js node Text2Frame.js --verbose --mode map --text_path <text file path> --output_path <output file path> --event_id <event id> --page_id <page id> --overwrite <true|false> node Text2Frame.js --verbose --mode common --text_path <text file path> --common_event_id <common event id> --overwrite <true|false> node Text2Frame.js --verbose --mode test DESCRIPTION node Text2Frame.js テストモードです。test/basic.txtを読み込み、data/Map001.jsonに出力します。 node Text2Frame.js --verbose --mode map --text_path <text file path> --output_path <output file path> --event_id <event id> --page_id <page id> --overwrite <true|false> マップへのイベント出力モードです。 読み込むファイル、出力マップ、上書きの有無を引数で指定します。 test/basic.txt を読み込み data/Map001.json に上書きするコマンド例は以下です。 例1:$ node Text2Frame.js --mode map --text_path test/basic.txt --output_path data/Map001.json --event_id 1 --page_id 1 --overwrite true 例2:$ node Text2Frame.js -m map -t test/basic.txt -o data/Map001.json -e 1 -p 1 -w true node Text2Frame.js --verbose --mode common --text_path <text file path> --common_event_id <common event id> --overwrite <true|false> コモンイベントへのイベント出力モードです。 読み込むファイル、出力コモンイベント、上書きの有無を引数で指定します。 test/basic.txt を読み込み data/CommonEvents.json に上書きするコマンド例は以下です。 例1:$ node Text2Frame.js --mode common --text_path test/basic.txt --output_path data/CommonEvents.json --common_event_id 1 --overwrite true 例2:$ node Text2Frame.js -m common -t test/basic.txt -o data/CommonEvents.json -c 1 -w true `); } }
dazed/translations
www/js/plugins/Text2Frame.js
JavaScript
unknown
180,470
//============================================================================= // TitleCommandPosition.js //============================================================================= /*: * @plugindesc Changes the position of the title command window. * @author Yoji Ojima * * @param Offset X * @desc The offset value for the x coordinate. * @default 0 * * @param Offset Y * @desc The offset value for the y coordinate. * @default 0 * * @param Width * @desc The width of the command window. * @default 240 * * @param Background * @desc The background type. 0: Normal, 1: Dim, 2: Transparent * @default 0 * * @help This plugin does not provide plugin commands. */ /*:ja * @plugindesc タイトルコマンドウィンドウの位置を変更します。 * @author Yoji Ojima * * @param Offset X * @desc X座標のオフセット値です。 * @default 0 * * @param Offset Y * @desc Y座標のオフセット値です。 * @default 0 * * @param Width * @desc コマンドウィンドウの幅です。 * @default 240 * * @param Background * @desc 背景タイプです。0: 通常、1: 暗くする、2: 透明 * @default 0 * * @help このプラグインには、プラグインコマンドはありません。 */ (function () { var parameters = PluginManager.parameters('TitleCommandPosition'); var offsetX = Number(parameters['Offset X'] || 0); var offsetY = Number(parameters['Offset Y'] || 0); var width = Number(parameters['Width'] || 240); var background = Number(parameters['Background'] || 0); var _Window_TitleCommand_updatePlacement = Window_TitleCommand.prototype.updatePlacement; Window_TitleCommand.prototype.updatePlacement = function () { _Window_TitleCommand_updatePlacement.call(this); this.x += offsetX; this.y += offsetY; this.setBackgroundType(background); }; Window_TitleCommand.prototype.windowWidth = function () { return width; }; })();
dazed/translations
www/js/plugins/TitleCommandPosition.js
JavaScript
unknown
2,001
//============================================================================= // TitleImageChange.js // ---------------------------------------------------------------------------- // (C) 2016 Triacontane // This software is released under the MIT License. // http://opensource.org/licenses/mit-license.php // ---------------------------------------------------------------------------- // Version // 1.4.5 2020/03/01 進行度変数の値を戻したときに、リロードするまで元のタイトル画面に戻らない問題を修正 // 1.4.4 2018/07/11 1.4.3の修正でタイトル画面が変更される条件を満たした状態でセーブ後にタイトルに戻るで再表示しても変更が反映されない問題を修正 // 1.4.3 2018/06/09 セーブファイル数の上限を大きく増やしている場合にタイトル画面の表示が遅くなる現象を修正 // 1.4.2 2018/04/26 ニューゲーム開始後、一度もセーブしていないデータで進行状況のみをセーブするスクリプトを実行しても設定が反映されない問題を修正 // 1.4.1 2017/07/20 1.4.0で追加した機能で画像やBGMを4つ以上しないとタイトルがずれてしまう問題を修正 // 1.4.0 2017/02/12 画像やBGMを4つ以上指定できる機能を追加 // 1.3.1 2017/02/04 簡単な競合対策 // 1.3.0 2017/02/04 どのセーブデータの進行度を優先させるかを決めるための優先度変数を追加 // 1.2.1 2016/12/17 進行状況のみセーブのスクリプトを実行した場合に、グローバル情報が更新されてしまう問題を修正 // 1.2.0 2016/08/27 進行状況に応じてタイトルBGMを変更できる機能を追加 // 1.1.0 2016/06/05 セーブデータに歯抜けがある場合にエラーが発生する問題を修正 // 進行状況のみをセーブする機能を追加 // 1.0.0 2016/04/06 初版 // ---------------------------------------------------------------------------- // [Blog] : https://triacontane.blogspot.jp/ // [Twitter]: https://twitter.com/triacontane/ // [GitHub] : https://github.com/triacontane/ //============================================================================= /*: * @plugindesc タイトル画面変更プラグイン * @author トリアコンタン * * @param 進行度変数 * @desc ゲームの進行度に対応する変数番号(1...) * @default 1 * @type variable * * @param 優先度変数 * @desc 複数のセーブデータが存在するとき、どのセーブデータの進行度を優先するかを決める変数番号(1...) * @default 0 * @type variable * * @param タイトル1の進行度 * @desc 進行度変数の値がこの値以上ならタイトル1の画像が表示されます。 * @default 1 * * @param タイトル1の画像 * @desc 進行度変数の値がタイトル1の進行度以上のときに表示される画像(img/titles1)のファイル名です。 * @default * @require 1 * @dir img/titles1/ * @type file * * @param タイトル1のBGM * @desc 進行度変数の値がタイトル1の進行度以上のときに演奏されるBGM(audio/bgm)のファイル名です。 * @default * @require 1 * @dir audio/bgm/ * @type file * * @param タイトル2の進行度 * @desc 進行度変数の値がこの値以上ならタイトル2の画像が表示されます。 * @default 2 * * @param タイトル2の画像 * @desc 進行度変数の値がタイトル2の進行度以上のときに表示される画像(img/titles1)のファイル名です。 * @default * @require 1 * @dir img/titles1/ * @type file * * @param タイトル2のBGM * @desc 進行度変数の値がタイトル2の進行度以上のときに演奏されるBGM(audio/bgm)のファイル名です。 * @default * @require 1 * @dir audio/bgm/ * @type file * * @param タイトル3の進行度 * @desc 進行度変数の値がこの値以上ならタイトル3の画像が表示されます。 * @default 3 * * @param タイトル3の画像 * @desc 進行度変数の値がタイトル3の進行度以上のときに表示される画像(img/titles1)のファイル名です。 * @default * @require 1 * @dir img/titles1/ * @type file * * @param タイトル3のBGM * @desc 進行度変数の値がタイトル3の進行度以上のときに演奏されるBGM(audio/bgm)のファイル名です。 * @default * @require 1 * @dir audio/bgm/ * @type file * * @param 以降の進行度 * @desc タイトルを4パターン以上使いたい場合はカンマ区切りで進行度を指定します。例(4,5,6) * @default * * @param 以降の画像 * @desc タイトルを4パターン以上使いたい場合はカンマ区切りで画像(img/titles1)のファイル名を指定します。例(aaa,bbb,ccc) * @default * * @param 以降のBGM * @desc タイトルを4パターン以上使いたい場合はカンマ区切りでBGM(audio/bgm)のファイル名を指定します。例(aaa,bbb,ccc) * @default * * @help ゲームの進行度に応じてタイトル画面の画像およびBGMを変更します。 * 進行度には任意の変数が指定でき、通常は全セーブデータの中の最大値が反映されます。 * * ただし、優先度変数が別途指定されている場合は、その変数値が最も大きい * セーブデータの進行度をもとに画像及びBGMが決まります。 * * タイトル画像は最大3つまで指定可能で、複数の条件を満たした場合は * 以下のような優先順位になります。 * * 1. 4以降の画像及びBGM * 2. タイトル3の画像およびBGM * 3. タイトル2の画像およびBGM * 4. タイトル1の画像およびBGM * 5. デフォルトのタイトル画像およびBGM * * ゲームデータをセーブせず進行状況のみをセーブしたい場合は、 * イベントコマンドの「スクリプト」から以下を実行してください。 * DataManager.saveOnlyGradeVariable(); * * このプラグインにはプラグインコマンドはありません。 * * 利用規約: * 作者に無断で改変、再配布が可能で、利用形態(商用、18禁利用等) * についても制限はありません。 * このプラグインはもうあなたのものです。 */ (function () { 'use strict'; var pluginName = 'TitleImageChange'; var getParamString = function (paramNames) { var value = getParamOther(paramNames); return value == null ? '' : value; }; var getParamNumber = function (paramNames, min, max) { var value = getParamOther(paramNames); if (arguments.length < 2) min = -Infinity; if (arguments.length < 3) max = Infinity; return (parseInt(value, 10) || 0).clamp(min, max); }; var getParamOther = function (paramNames) { if (!Array.isArray(paramNames)) paramNames = [paramNames]; for (var i = 0; i < paramNames.length; i++) { var name = PluginManager.parameters(pluginName)[paramNames[i]]; if (name) return name; } return null; }; var getParamArrayString = function (paramNames) { var valuesText = getParamString(paramNames); if (!valuesText) return []; var values = valuesText.split(','); for (var i = 0; i < values.length; i++) { values[i] = values[i].trim(); } return values; }; var getParamArrayNumber = function (paramNames, min, max) { var values = getParamArrayString(paramNames); if (arguments.length < 2) min = -Infinity; if (arguments.length < 3) max = Infinity; for (var i = 0; i < values.length; i++) { if (!isNaN(parseInt(values[i], 10))) { values[i] = (parseInt(values[i], 10) || 0).clamp(min, max); } else { values.splice(i--, 1); } } return values; }; //============================================================================= // パラメータの取得と整形 //============================================================================= var paramGradeVariable = getParamNumber(['GradeVariable', '進行度変数'], 1, 5000); var paramPriorityVariable = getParamNumber(['PriorityVariable', '優先度変数'], 0, 5000); var paramTitleGrades = []; paramTitleGrades.push(getParamNumber(['TitleGrade1', 'タイトル1の進行度'])); paramTitleGrades.push(getParamNumber(['TitleGrade2', 'タイトル2の進行度'])); paramTitleGrades.push(getParamNumber(['TitleGrade3', 'タイトル3の進行度'])); var paramTitleImages = []; paramTitleImages.push(getParamString(['TitleImage1', 'タイトル1の画像'])); paramTitleImages.push(getParamString(['TitleImage2', 'タイトル2の画像'])); paramTitleImages.push(getParamString(['TitleImage3', 'タイトル3の画像'])); var paramTitleBgms = []; paramTitleBgms.push(getParamString(['TitleBgm1', 'タイトル1のBGM'])); paramTitleBgms.push(getParamString(['TitleBgm2', 'タイトル2のBGM'])); paramTitleBgms.push(getParamString(['TitleBgm3', 'タイトル3のBGM'])); paramTitleGrades = paramTitleGrades.concat(getParamArrayNumber(['TitleGradeAfter', '以降の進行度'])).reverse(); paramTitleImages = paramTitleImages.concat(getParamArrayString(['TitleImageAfter', '以降の画像'])).reverse(); paramTitleBgms = paramTitleBgms.concat(getParamArrayString(['TitleBgmAfter', '以降のBGM'])).reverse(); //============================================================================= // DataManager // ゲーム進行状況を保存します。 //============================================================================= var _DataManager_makeSavefileInfo = DataManager.makeSavefileInfo; DataManager.makeSavefileInfo = function () { var info = _DataManager_makeSavefileInfo.apply(this, arguments); this.setGradeVariable(info); return info; }; DataManager.getFirstPriorityGradeVariable = function () { this._loadGrade = true; var globalInfo = this.loadGlobalInfo().filter(function (data, id) { return this.isThisGameFile(id); }, this); this._loadGrade = false; var gradeVariable = 0; if (globalInfo && globalInfo.length > 0) { var sortedGlobalInfo = globalInfo.clone().sort(this._compareOrderForGradeVariable); if (sortedGlobalInfo[0]) { gradeVariable = sortedGlobalInfo[0].gradeVariable || 0; } } return gradeVariable; }; var _DataManager_loadGlobalInfo = DataManager.loadGlobalInfo; DataManager.loadGlobalInfo = function () { if (this._loadGrade) { if (!this._globalInfo) { try { var json = StorageManager.load(0); this._globalInfo = json ? JSON.parse(json) : []; } catch (e) { console.error(e); this._globalInfo = []; } } return this._globalInfo; } else { return _DataManager_loadGlobalInfo.apply(this, arguments); } }; DataManager._compareOrderForGradeVariable = function (a, b) { if (!a) { return 1; } else if (!b) { return -1; } else if (a.priorityVariable !== b.priorityVariable && paramPriorityVariable > 0) { return (b.priorityVariable || 0) - (a.priorityVariable || 0); } else { return (b.gradeVariable || 0) - (a.gradeVariable || 0); } }; DataManager.saveOnlyGradeVariable = function () { var saveFileId = this.lastAccessedSavefileId(); var globalInfo = this.loadGlobalInfo() || []; if (globalInfo[saveFileId]) { this.setGradeVariable(globalInfo[saveFileId]); } else { globalInfo[saveFileId] = this.makeSavefileInfo(); } this.saveGlobalInfo(globalInfo); }; DataManager.setGradeVariable = function (info) { info.gradeVariable = $gameVariables.value(paramGradeVariable); if (paramPriorityVariable > 0) { info.priorityVariable = $gameVariables.value(paramPriorityVariable); } }; var _DataManager_saveGlobalInfo = DataManager.saveGlobalInfo; DataManager.saveGlobalInfo = function (info) { _DataManager_saveGlobalInfo.apply(this, arguments); this._globalInfo = null; }; //============================================================================= // Scene_Title // 進行状況が一定以上の場合、タイトル画像を差し替えます。 //============================================================================= var _Scene_Title_initialize = Scene_Title.prototype.initialize; Scene_Title.prototype.initialize = function () { _Scene_Title_initialize.apply(this, arguments); this.changeTitleImage(); this.changeTitleBgm(); }; Scene_Title.prototype.changeTitleImage = function () { var gradeVariable = DataManager.getFirstPriorityGradeVariable(); if ($dataSystem.originalTitle1Name !== undefined) { $dataSystem.title1Name = $dataSystem.originalTitle1Name; } for (var i = 0, n = paramTitleGrades.length; i < n; i++) { if (paramTitleImages[i] && gradeVariable >= paramTitleGrades[i]) { $dataSystem.originalTitle1Name = $dataSystem.title1Name; $dataSystem.title1Name = paramTitleImages[i]; break; } } }; Scene_Title.prototype.changeTitleBgm = function () { var gradeVariable = DataManager.getFirstPriorityGradeVariable(); if ($dataSystem.titleBgm.originalName !== undefined) { $dataSystem.titleBgm.name = $dataSystem.titleBgm.originalName; } for (var i = 0, n = paramTitleGrades.length; i < n; i++) { if (paramTitleBgms[i] && gradeVariable >= paramTitleGrades[i]) { $dataSystem.titleBgm.originalName = $dataSystem.titleBgm.name; $dataSystem.titleBgm.name = paramTitleBgms[i]; break; } } }; })();
dazed/translations
www/js/plugins/TitleImageChange.js
JavaScript
unknown
14,434
/*---------------------------------------------------------------------------* * Torigoya_SaveCommand.js *---------------------------------------------------------------------------* * 2019/01/26 ru_shalm * http://torigoya.hatenadiary.jp/ *---------------------------------------------------------------------------*/ /*: * @plugindesc Add save command in Plugin Command * @author ru_shalm * * @help * * Plugin Command: * SaveCommand save 1 # save to slot 1 * SaveCommand save [1] # save to slot variables[1] * SaveCommand save last # save to last accessed file * SaveCommand load 1 # load from slot 1 * SaveCommand load [1] # load from slot variables[1] * SaveCommand load last # load from last accessed file * SaveCommand remove 1 # remove save file of slot 1 * SaveCommand remove [1] # remove save file of slot variables[1] * SaveCommand remove last # remove last accessed file * * (default last accessed file: 1) */ /*:ja * @plugindesc プラグインコマンドからセーブを実行できるようにします。 * @author ru_shalm * * @help * イベントコマンドの「プラグインコマンド」を使って、 * イベント中に自動的にセーブを実行できるようになります。 * * 例えばオートセーブのゲームなどが作れるようになります。 * * ------------------------------------------------------------ * ■ プラグインコマンド(セーブ系) * ------------------------------------------------------------ * * ● スロット1にセーブを実行する * SaveCommand save 1 * * ※ 1 の部分の数字を変えると別のスロットにセーブされます * * ● 変数[1]番のスロットにセーブを実行する * SaveCommand save [1] * * ● 前回ロード/セーブしたスロットにセーブを実行する * SaveCommand save last * * ※ ロード/セーブしていない場合はスロット1になります。 * * <おまけ> * セーブ時に以下のように末尾に「notime」をつけることで * セーブ時刻を更新せずにセーブすることができます。 * * SaveCommand save 1 notime * * これによってロード画面でカーソル位置をオートセーブした場所ではなく * プレイヤーが自分でセーブしたファイルに合わせたままにすることができます。 * * ------------------------------------------------------------ * ■ プラグインコマンド(ロード系) * ------------------------------------------------------------ * <注意> * RPGツクールはイベントの途中で * セーブデータがロードされることが想定されていません。 * そのためイベントのタイミングによっては、 * ロード後のゲームの動作がおかしくなることがあります。 * * ● スロット1からロードを実行する * SaveCommand load 1 * * ● 変数[1]番のスロットからロードを実行する * SaveCommand load [1] * * ● 前回ロード/セーブしたスロットからロードを実行する * SaveCommand load last * * ※ ロード/セーブしていない場合はスロット1になります。 * * ● 一番最後にセーブをしたスロットからロードを実行する * SaveCommand load latest * * ※ last ではなく latest です><; * * ------------------------------------------------------------ * ■ プラグインコマンド(削除系) * ------------------------------------------------------------ * <注意> * セーブデータを削除するコマンドなので取扱注意ですよ! * * ● スロット1を削除する * SaveCommand remove 1 * * ● 変数[1]番のスロットを削除する * SaveCommand remove [1] * * ● 前回ロード/セーブしたスロットを削除する * SaveCommand remove last * * ※ ロード/セーブしていない場合はスロット1になります。 */ (function (global) { 'use strict'; var SaveCommand = { name: 'Torigoya_SaveCommand', settings: {}, lastTimestamp: undefined, lastAccessId: undefined }; // ------------------------------------------------------------------------- // SaveCommand /** * スロットID指定文字列からスロットIDを求める * @param {string} str * @returns {number} */ SaveCommand.parseSlotId = function (str) { var slotId, matches; if (matches = str.match(/^\[(\d+)\]$/)) { slotId = $gameVariables.value(~~matches[1]); } else if (str.match(/^\d+$/)) { slotId = ~~str; } else { switch (str) { case 'last': slotId = DataManager.lastAccessedSavefileId(); break; case 'latest': slotId = DataManager.latestSavefileId(); break; } } if (~~slotId <= 0) { throw '[Torigoya_SaveCommand.js] invalid SlotId: ' + slotId; } return slotId; }; /** * セーブ系コマンド処理の実行 * @param {Game_Interpreter} gameInterpreter * @param {string} type * @param {number} slotId * @param {boolean} skipTimestamp */ SaveCommand.runCommand = function (gameInterpreter, type, slotId, skipTimestamp) { switch (type) { case 'load': this.runCommandLoad(gameInterpreter, slotId); break; case 'save': this.runCommandSave(gameInterpreter, slotId, skipTimestamp); break; case 'remove': this.runCommandRemove(gameInterpreter, slotId); break; } }; /** * ロード処理 * @note ちょっと無理やり感があるのでイベントの組み方次第ではまずそう * @param {Game_Interpreter} gameInterpreter * @param {number} slotId */ SaveCommand.runCommandLoad = function (gameInterpreter, slotId) { if (!DataManager.isThisGameFile(slotId)) return; var scene = SceneManager._scene; scene.fadeOutAll(); DataManager.loadGame(slotId); gameInterpreter.command115(); // 今のイベントが継続しないように中断コマンドを実行する Scene_Load.prototype.reloadMapIfUpdated.apply(scene); SceneManager.goto(Scene_Map); $gameSystem.onAfterLoad(); }; /** * セーブ処理 * @param {Game_Interpreter} gameInterpreter * @param {number} slotId * @param {boolean} skipTimestamp */ SaveCommand.runCommandSave = function (gameInterpreter, slotId, skipTimestamp) { if (skipTimestamp) { var info = DataManager.loadSavefileInfo(slotId); SaveCommand.lastTimestamp = info && info.timestamp ? info.timestamp : 0; SaveCommand.lastAccessId = DataManager.lastAccessedSavefileId(); } // そのままセーブしてしまうと // ロード時にもプラグインコマンドが呼び出されてしまうため // 次の行のイベントコマンドから始まるように細工する var originalIndex = gameInterpreter._index; gameInterpreter._index++; $gameSystem.onBeforeSave(); if (DataManager.saveGame(slotId) && StorageManager.cleanBackup) { StorageManager.cleanBackup(slotId); } if (skipTimestamp) { DataManager._lastAccessedId = SaveCommand.lastAccessId; SaveCommand.lastTimestamp = undefined; SaveCommand.lastAccessId = undefined; } // 細工した分を戻す gameInterpreter._index = originalIndex; }; /** * セーブファイルの削除処理 * @param {Game_Interpreter} _ * @param {number} slotId */ SaveCommand.runCommandRemove = function (_, slotId) { StorageManager.remove(slotId); }; // ------------------------------------------------------------------------- // alias var upstream_DataManager_makeSavefileInfo = DataManager.makeSavefileInfo; DataManager.makeSavefileInfo = function () { var info = upstream_DataManager_makeSavefileInfo.apply(this); if (SaveCommand.lastTimestamp !== undefined) { info.timestamp = SaveCommand.lastTimestamp; } return info; }; var upstream_Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand; Game_Interpreter.prototype.pluginCommand = function (command, args) { if (command === 'SaveCommand') { var type = (args[0] || '').trim(); var slotId = SaveCommand.parseSlotId((args[1] || '').trim()); var skipTimestamp = (args[2] === 'notime'); SaveCommand.runCommand(this, type, slotId, skipTimestamp); return; } upstream_Game_Interpreter_pluginCommand.apply(this, arguments); }; // ------------------------------------------------------------------------- global.Torigoya = (global.Torigoya || {}); global.Torigoya.SaveCommand = SaveCommand; })(window);
dazed/translations
www/js/plugins/Torigoya_SaveCommand.js
JavaScript
unknown
9,304
/*============================================================================ _TranslateStrings.js ---------------------------------------------------------------------------- (C)2020 kiki This software is released under the MIT License. http://opensource.org/licenses/mit-license.php ---------------------------------------------------------------------------- [Blog] : http://sctibacromn.hatenablog.com/ ============================================================================*/ /*: * @plugindesc 文章をトリガーとして、jsonから対応する文字列を言語別に取得するプラグインです。 * @author kiki * @version 1.00 * * @help * 言語を追加するときの手順 * 1.言語文字に追加したい言語を表す二文字を追記します。 *   この二文字は、window.navigator.languageを実行したときに出力される *   文字のことです。 * 2.このjsを開いてもらって、強制言語の設定に英語と同様に追記。 *   ただしvalueの値を連番にする。 * * @param 強制言語の設定 * @desc テストするときの強制言語の設定 * @type select * @option なし * @value 0 * @option 英語 * @value 1 * @default 0 * * @param データベースを言語別に使用する * @desc 日本語ではない場合、対応言語のデータベースをロードするかどうか * @type boolean * @default false * * @param 文章を言語別に取得する * @desc 文章を対応する言語で取得するか * @type boolean * @default false * * @param 言語データベース名 * @type string[] * @desc 言語データベースを追加するときに追記する * @default ["", "", ""] * * @param 言語文字 * @type string[] * @desc 他の言語を追加するときに追記する * 例えば中国語ならzh * @default ["en"] * * @param 言語jsonフォルダ名 * @desc 言語jsonが入ったフォルダ名 * @type string * @default Translate */ var $gameStrings = null; // ゲーム中恒常的に使う文言系。 var $gameMapText = null; // マップのセリフテキスト。 var $gameCommonText = null;// コモンイベントのセリフテキスト。 var $language = "ja"; // 言語設定 function GameStrings() { throw new Error("This is a static class"); } (function () { var Lang = {}; Lang.Param = PluginManager.parameters('TranslateStrings'); Lang.forceLangIndex = Number(Lang.Param["強制言語の設定"]); Lang.reflectDataBase = Lang.Param["データベースを言語別に使用する"] == "true" ? true : false; Lang.reflectSentence = Lang.Param["文章を言語別に取得する"] == "true" ? true : false; Lang.dirName = Lang.Param["言語jsonフォルダ名"]; Lang.nameList = JSON.parse(Lang.Param["言語文字"]); Lang.dbNameList = JSON.parse(Lang.Param["言語データベース名"]); Lang.useCommonId = 0; for (var i = 0; i < Lang.dbNameList.length; i++) { Lang.dbNameList[i] = Lang.dbNameList[i] + ".json"; } // 言語設定を取得 let lang = (window.navigator.languages && window.navigator.languages[0]) || window.navigator.language || window.navigator.userLanguage || window.navigator.browserLanguage; $language = lang.slice(0, 2); if (Lang.forceLangIndex != 0) { Lang.forceLangIndex -= 1; $language = Lang.nameList[Lang.forceLangIndex]; } console.log("言語:" + $language) // GameStrings.jsonロード DataManager._databaseFiles.push( { name: '$gameStrings', src: Lang.dirName + '/GameStrings.json' } ); //----------------------------------------------------------------------------- // 対応言語のデータベースの反映 //----------------------------------------------------------------------------- const _DataManager_loadDatabase = DataManager.loadDatabase; DataManager.loadDatabase = function () { if (!Lang.reflectDataBase) { _DataManager_loadDatabase.call(this); return; } var test = this.isBattleTest() || this.isEventTest(); var prefix = test ? 'Test_' : ''; for (var i = 0; i < this._databaseFiles.length; i++) { var name = this._databaseFiles[i].name; var src = this._databaseFiles[i].src; // 日本語以外は外国語の該当フォルダ名から出力 if (Lang.dbNameList.includes(src)) { if ($language != "ja") { src = $language + "/" + src; } } this.loadDataFile(name, prefix + src); } if (this.isEventTest()) { this.loadDataFile('$testEvent', prefix + 'Event.json'); } }; //----------------------------------------------------------------------------- // イベントスタート時、マップId、イベントIdの記憶 //----------------------------------------------------------------------------- const _Game_System_prototype_initialize = Game_System.prototype.initialize; Game_System.prototype.initialize = function () { _Game_System_prototype_initialize.apply(this, arguments); this._serifEventId; }; Game_Event.prototype.start = function () { var list = this.list(); if (list && list.length > 1) { this._starting = true; // $gameMap._mapIdは場所移動するとその場所のマップIDに変更される // 場所移動後もセリフを反映させるために記憶する // イベントIDを記憶するのも同じ理由 $gameSystem._mapId = $gameMap._mapId; $gameSystem._eventId = this._eventId; if (this.isTriggerIn([0, 1, 2])) { this.lock(); } } }; //----------------------------------------------------------------------------- // 文章の言語表示 //----------------------------------------------------------------------------- Game_Interpreter.prototype.command101 = function () { if (!$gameMessage.isBusy()) { $gameMessage.setFaceImage(this._params[0], this._params[1]); $gameMessage.setBackground(this._params[2]); $gameMessage.setPositionType(this._params[3]); let messages = ""; while (this.nextEventCode() === 401) { // Text data this._index++; var message = this.currentCommand().parameters[0]; messages += message + "\n"; } if (messages != "") { // 後方改行削除 messages = messages.replace(/\n$/g, ""); // 一行ずつではなく、コマンド一つの文章と、言語jsonを比較する // 文章そのものをトリガーにすることによって、仕組みをシンプルにする // ただし同一イベント内でセリフが被ると、上のセリフが優先される let transMessages = GameStrings.GetText(messages, $gameSystem._eventId); let messageList = transMessages.split(/\r\n|\n/); messageList.forEach(function (message) { $gameMessage.add(message); }); } switch (this.nextEventCode()) { case 102: // Show Choices this._index++; this.setupChoices(this.currentCommand().parameters); break; case 103: // Input Number this._index++; this.setupNumInput(this.currentCommand().parameters); break; case 104: // Select Item this._index++; this.setupItemChoice(this.currentCommand().parameters); break; } this._index++; this.setWaitMode('message'); } return false; }; Game_Interpreter.prototype.convertVariables = function (text) { text = text.replace(/\\/g, '\x1b'); text = text.replace(/\x1b\x1b/g, '\\'); text = text.replace(/\x1bV\[(\d+)\]/gi, function () { return $gameVariables.value(parseInt(arguments[1])); }.bind(this)); return text; }; GameStrings.GetText = function (messages, eventId) { if ($language != "ja" && Lang.reflectSentence) { // マップイベントの文章を出力する(MapSerif.jsonから) for (let i = 0; i < $gameMapText.length; i++) { let text = $gameMapText[i]; if (text.mapId != $gameSystem._mapId || text.eventId != eventId) { continue; } let transMessages = GameStrings.GetTransMessages(text, messages) if (transMessages != "") { return transMessages; } } // コモンイベントの文章を出力する(CommonSerif.jsonから) if (Lang.useCommonId == 0) { return messages; } for (var i = 0; i < $gameCommonText.length; i++) { let text = $gameCommonText[i]; let commonId = Lang.useCommonId; if (text.commonId != commonId) { continue; } let transMessages = GameStrings.GetTransMessages(text, messages) if (transMessages != "") { return transMessages; } } } return messages; }; GameStrings.GetTransMessages = function (text, messages) { let transMessages = ""; if (text.ja == messages) { transMessages = GameStrings.GetMessage(text); } return transMessages; }; //----------------------------------------------------------------------------- // セリフ以外の単語の言語表示 //----------------------------------------------------------------------------- Window_MapName.prototype.refresh = function () { this.contents.clear(); if ($gameMap.displayName()) { var width = this.contentsWidth(); this.drawBackground(0, 0, width, this.lineHeight()); this.drawText(GameStrings.GetString($gameMap.displayName()), 0, 0, width, 'center'); } }; Window_Command.prototype.drawItem = function (index) { var rect = this.itemRectForText(index); var align = this.itemTextAlign(); this.resetTextColor(); this.changePaintOpacity(this.isCommandEnabled(index)); this.drawText(GameStrings.GetString(this.commandName(index)), rect.x, rect.y, rect.width, align); }; GameStrings.GetString = function (message) { if ($gameStrings == null || $language == "ja") { return message; } let array = message.split(":"); for (var i = 0; i < array.length; i++) { let word = array[i]; if ($gameStrings[word]) { let text = $gameStrings[word]; let transMessage = GameStrings.GetMessage(text); let regexp = new RegExp("(" + word + ")"); message = message.replace(regexp, transMessage); } } return message; }; GameStrings.GetMessage = function (text) { // $languageがenなら"text.en"として、出力する // 初めはスイッチ文で分けていたが、こっちのほうが変更容易なため return eval("text." + $language); }; //----------------------------------------------------------------------------- // コモンイベントIDの記録 //----------------------------------------------------------------------------- // ゲームスタート時、コモンイベントを全て調べて文章があるコモンイベントIDを抽出 const _Scene_Boot_prototype_start = Scene_Boot.prototype.start; Scene_Boot.prototype.start = function () { _Scene_Boot_prototype_start.call(this); if (!Lang.reflectSentence) return; $gameCommonText._commonIdsHasSerif = []; for (let i = 1; i < $dataCommonEvents.length; i++) { let data = $dataCommonEvents[i]; for (let i = 0; i < data.list.length; i++) { let code = data.list[i].code; if (code == 401) { $gameCommonText._commonIdsHasSerif.push(data.id); break; } } } }; Game_Interpreter.prototype.command117 = function () { let commonId = this._params[0]; var commonEvent = $dataCommonEvents[commonId]; if (commonEvent) { var eventId = this.isOnCurrentMap() ? this._eventId : 0; // セリフを持つコモンイベントIDのみ記憶する if ($gameCommonText._commonIdsHasSerif.includes(commonId)) { Lang.useCommonId = commonId; } this.setupChild(commonEvent.list, eventId); } return true; }; const _Game_Interpreter_prototype_terminate = Game_Interpreter.prototype.terminate; Game_Interpreter.prototype.terminate = function () { _Game_Interpreter_prototype_terminate.call(this); Lang.useCommonId = 0; }; //----------------------------------------------------------------------------- // 言語jsonのロード //----------------------------------------------------------------------------- const _Scene_Boot_create = Scene_Boot.prototype.create; Scene_Boot.prototype.create = function () { if (Lang.reflectSentence) { DataManager.loadMapText(); DataManager.loadCommonText(); } _Scene_Boot_create.apply(this, arguments); }; DataManager.loadMapText = function () { var filename = Lang.dirName + "/MapSerif.json"; this.loadDataFile('$gameMapText', filename); }; DataManager.loadCommonText = function () { var filename = Lang.dirName + "/CommonSerif.json"; this.loadDataFile('$gameCommonText', filename); }; DataManager.isMapLoaded = function () { this.checkError(); if (!Lang.reflectSentence) { return !!$dataMap; } return !!$dataMap && !!$gameMapText && !!$gameCommonText; }; })();
dazed/translations
www/js/plugins/TranslateStrings.js
JavaScript
unknown
14,570
//============================================================================= // VariableControlItem.js // ---------------------------------------------------------------------------- // (C)2016 Triacontane // This software is released under the MIT License. // http://opensource.org/licenses/mit-license.php // ---------------------------------------------------------------------------- // Version // 1.2.0 2020/11/23 変数操作の実行条件に実行者を指定できる機能を追加 // 1.1.1 2017/04/19 範囲が「なし」の場合も操作できるよう修正 // 1.1.0 2016/10/21 加算と代入を別々のメモ欄で設定できるよう変更 // 1.0.0 2016/10/21 初版 // ---------------------------------------------------------------------------- // [Blog] : https://triacontane.blogspot.jp/ // [Twitter]: https://twitter.com/triacontane/ // [GitHub] : https://github.com/triacontane/ //============================================================================= /*: * @plugindesc VariableControlItemPlugin * @author triacontane * * @help アイテムもしくはスキルを使用し、かつ * 行動が成功した場合に、変数を操作できます。 * * アイテムもしくはスキルのメモ欄に以下の通り指定してください。 * * <VCI変数番号:3> # 変数番号[3]に値を設定します。 * <VCIVarNumber:3> # 同上 * <VCI代入値:5> # 指定した変数に値[5]を代入します。 * <VCISetValue:5> # 同上 * <VCI加算値:5> # 指定した変数に値[5]を加算します。 * <VCIAddValue:5> # 同上 * <VCI実行者:actor> # 実行者がアクターの場合のみ変数操作します。 * <VCISubject:actor> # 同上 * <VCI実行者:enemy> # 実行者が敵キャラの場合のみ変数操作します。 * <VCISubject:enemy> # 同上 * ※加算値に負の値を指定すると減算になります。 * * 設定値は、制御文字を適用した上でJavaScript計算式として評価されます。 * たとえば、アイテムの使用で変数[1]に[5]を乗算したい場合は以下の通り設定します。 * <VCI変数番号:1> * <VCI代入値:\v[1] * 5> # 変数[1]の値に[5]を乗算した結果を変数[1]に設定 * * このプラグインにはプラグインコマンドはありません。 */ /*:ja * @plugindesc 変数操作アイテムプラグイン * @author トリアコンタン * * @help アイテムもしくはスキルを使用し、かつ * 行動が成功した場合に、変数を操作できます。 * * アイテムもしくはスキルのメモ欄に以下の通り指定してください。 * * <VCI変数番号:3> # 変数番号[3]に値を設定します。 * <VCIVarNumber:3> # 同上 * <VCI代入値:5> # 指定した変数に値[5]を代入します。 * <VCISetValue:5> # 同上 * <VCI加算値:5> # 指定した変数に値[5]を加算します。 * <VCIAddValue:5> # 同上 * <VCI実行者:actor> # 実行者がアクターの場合のみ変数操作します。 * <VCISubject:actor> # 同上 * <VCI実行者:enemy> # 実行者が敵キャラの場合のみ変数操作します。 * <VCISubject:enemy> # 同上 * ※加算値に負の値を指定すると減算になります。 * * 設定値は、制御文字を適用した上でJavaScript計算式として評価されます。 * たとえば、アイテムの使用で変数[1]に[5]を乗算したい場合は以下の通り設定します。 * <VCI変数番号:1> * <VCI代入値:\v[1] * 5> # 変数[1]の値に[5]を乗算した結果を変数[1]に設定 * * このプラグインにはプラグインコマンドはありません。 * * 利用規約: * 作者に無断で改変、再配布が可能で、利用形態(商用、18禁利用等) * についても制限はありません。 * このプラグインはもうあなたのものです。 */ (function () { 'use strict'; var metaTagPrefix = 'VCI'; var getArgNumber = function (arg, min, max) { if (arguments.length < 2) min = -Infinity; if (arguments.length < 3) max = Infinity; return (parseInt(convertEscapeCharacters(arg), 10) || 0).clamp(min, max); }; var getArgEval = function (arg, min, max) { if (arguments.length < 2) min = -Infinity; if (arguments.length < 3) max = Infinity; return (eval(convertEscapeCharacters(arg)) || 0).clamp(min, max); }; var getMetaValue = function (object, name) { var metaTagName = metaTagPrefix + (name ? name : ''); return object.meta.hasOwnProperty(metaTagName) ? object.meta[metaTagName] : undefined; }; var getMetaValues = function (object, names) { if (!Array.isArray(names)) return getMetaValue(object, names); for (var i = 0, n = names.length; i < n; i++) { var value = getMetaValue(object, names[i]); if (value !== undefined) return value; } return undefined; }; var convertEscapeCharacters = function (text) { if (text == null) text = ''; var windowLayer = SceneManager._scene._windowLayer; return windowLayer ? windowLayer.children[0].convertEscapeCharacters(text) : text; }; //============================================================================= // Game_Action // 行動が成功した場合、変数の操作を実行します。 //============================================================================= var _Game_Action_applyItemUserEffect = Game_Action.prototype.applyItemUserEffect; Game_Action.prototype.applyItemUserEffect = function (target) { _Game_Action_applyItemUserEffect.apply(this, arguments); if (!this.isForNone()) { this.applyVariableControl(); } }; var _Game_Action_applyGlobal = Game_Action.prototype.applyGlobal; Game_Action.prototype.applyGlobal = function (target) { _Game_Action_applyGlobal.apply(this, arguments); if (this.isForNone()) { this.applyVariableControl(); } }; Game_Action.prototype.isForNone = function () { return this.checkItemScope([0]); }; Game_Action.prototype.applyVariableControl = function () { if (!this.isVariableControlSubject()) { return; } var varNumberStr = getMetaValues(this.item(), ['VarNumber', '変数番号']); if (varNumberStr) { var varNumber = getArgNumber(varNumberStr, 0); var setValue = getMetaValues(this.item(), ['SetValue', '代入値']); if (setValue) { $gameVariables.setValue(varNumber, getArgEval(setValue)); return; } var addValue = getMetaValues(this.item(), ['AddValue', '加算値']); if (addValue) { var originalValue = $gameVariables.value(varNumber); $gameVariables.setValue(varNumber, originalValue + getArgEval(addValue)); } } }; Game_Action.prototype.isVariableControlSubject = function () { var subject = getMetaValues(this.item(), ['Subject', '実行者']); if (!subject || subject === true) { return true; } subject = subject.toLowerCase(); if (subject === 'actor' && this._subjectEnemyIndex >= 0) { return false; } if (subject === 'enemy' && this._subjectActorId > 0) { return false; } return true; }; })();
dazed/translations
www/js/plugins/VariableControlItem.js
JavaScript
unknown
7,557
/******************************************************************************/ // // Wataridori_AutoSave.js // /******************************************************************************/ //プラグインの説明 //「オートセーブプラグイン」 // //更新履歴(ver1.0) // //2019_12_08 ver1.0リリース // /******************************************************************************/ //This software is released under the MIT License. //http://opensource.org/licenses/mit-license.php // //Copyright(c) 渡り鳥の楽園 /******************************************************************************/ /*: * @plugindesc 「オートセーブプラグイン」 * @author 「渡り鳥の楽園」飯尾隼人 * * @param autoSaveNumber * @desc セーブIDを指定しない場合のオートセーブ先のセーブデータのID * @default 20 * @type Number * * @param show_Console * @desc オートセーブに失敗した場合、コンソールに情報を表示させます。 * @default true * @type boolean * * @help * 説明: * 本プラグインはオートセーブを提供します。 * プラグインコマンドの引数にセーブデータの番号を設定することで、指定されたセーブデータにセーブを実行します。 * 何も指定しない場合、いま現在のセーブデータにセーブを実行します。 * セーブデータIdの数字を引数に下記関数からも実行可能です。 * $gameSystem.autoSave(savefileId); * * Deny_AutoSaveのプラグインコマンドを実行することで、オートセーブの実行を不可能にできます。 * 次にAllow_AutoSaveのプラグインコマンドを実行するまでオートセーブの実行を拒否し続けます。 * * プラグインコマンド:AutoSave *  最新アクセスのセーブデータにセーブを実行します。 * * プラグインコマンド:AutoSave Number *  Numberで指定された数字のセーブデータにセーブを実行します。 *  有効なセーブデータID以外(0を除く)を指定すると、プラグインパラメータで設定されているセーブデータにセーブを実行します。 * * プラグインコマンド:Allow_AutoSave *  オートセーブの実行を許可状態します。 * * プラグインコマンド:Deny_AutoSave *  オートセーブの実行を拒否状態にします。拒否状態ではプラグインコマンドでオートセーブを実行しても実施されません。 * * 注意事項: * 本プラグインの使用によって生じたいかなる損失・損害、トラブルについても * 一切責任を負いかねます。 * * 利用規約: * 無断で改変、再配布が可能で商用、18禁利用等を問わずにご利用が可能です。 * 改良して頂いた場合、報告して頂けると喜びます。 * * 「渡り鳥の楽園」飯尾隼人 * Twitter: https://twitter.com/wataridori_raku * Ci-en : https://ci-en.dlsite.com/creator/2449 */ (function () { /******************************************************************************/ // // Plugin_Parameters // /******************************************************************************/ var p_parameters = PluginManager.parameters("Wataridori_AutoSave"); var p_autoSaveNumber = Number(p_parameters.autoSaveNumber) || 20; var p_show_Console = p_parameters.show_Console == 'true'; /******************************************************************************/ // // PluginCommand // /******************************************************************************/ var _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand; Game_Interpreter.prototype.pluginCommand = function (command, args) { _Game_Interpreter_pluginCommand.call(this, command, args); if (command == 'AutoSave') { $gameSystem.autoSave(args[0]); } if (command == 'Allow_AutoSave') { $gameSystem.setAutoSaveStatement(true); } if (command == 'Deny_AutoSave') { $gameSystem.setAutoSaveStatement(false); } }; /******************************************************************************/ // // Game_System // /******************************************************************************/ var _Game_System_prototype_initialize = Game_System.prototype.initialize; Game_System.prototype.initialize = function () { _Game_System_prototype_initialize.call(this); this._autoSaveStatement = true; }; Game_System.prototype.getAutoSaveStatement = function () { return this._autoSaveStatement; }; Game_System.prototype.setAutoSaveStatement = function (bool) { this._autoSaveStatement = !!bool; }; Game_System.prototype.autoSave = function (saveFileIdString) { if (this.getAutoSaveStatement()) { this.onBeforeSave(); DataManager.autoSave(saveFileIdString); } else { if (p_show_Console) { console.log('オートセーブの許可状態:' + this.getAutoSaveStatement() + ' (true:実行可能です。false:実行できません。オートセーブを実行可能にするためにはAllow_AutoSaveをプラグインコマンドで実行してください)') } } }; /******************************************************************************/ // // DataManager // /******************************************************************************/ DataManager.getAutoSavefileId = function () { return p_autoSaveNumber; }; DataManager.autoSave = function (saveFileId) { // オートセーブを実行するセーブデータIDの取得 var _saveFileId = function (id) { if (typeof id === 'undefined') { // 最後にアクセスしたセーブデータのID return this.lastAccessedSavefileId(); } else if (!isNaN(Number(id)) // idが数字か判定 && (Number(id) > 0) // idが0以上の数か判定 && (this.maxSavefiles() >= Number(id)) // idがセーブできる最大個数以下か判定 ) { // 念のため指定された数字から小数点を切り捨てたId return Math.floor(Number(id)); } else if (id == 'auto') { // プラグインパラメータで設定したId return this.getAutoSavefileId(); } else { // 不正な値の場合は、プラグインパラメータで設定したId console.log('不正なセーブデータIDです。'); return this.getAutoSavefileId(); } }.bind(this)(saveFileId); // セーブ実行 if (DataManager.saveGame(_saveFileId)) { StorageManager.cleanBackup(_saveFileId); console.log('セーブに成功しました。セーブデータID:' + _saveFileId); return true; } // オートセーブに失敗した場合に状態を表示 if (p_show_Console) { console.log('オートセーブに失敗しました。'); console.log('指定したセーブデータのID:' + saveFileId); console.log('プログラム内で変換後のID:' + _saveFileId); } return false; }; })();
dazed/translations
www/js/plugins/Wataridori_AutoSave.js
JavaScript
unknown
7,008
//============================================================================= // WeaponSkill.js //============================================================================= /*: * @plugindesc Change skill id of attack for each weapon. * @author Sasuke KANNAZUKI * * @help This plugin does not provide plugin commands. * * When <skill_id:3> is written in a weapon's note field, * skill id # 3 is used for the weapon's attack. * If nothing is written, default id(=1) is used. * * Check Points: * - When multiple weapons are equipped, the skill id of the weapon * held in the dominant hand (previously defined) is used. * - It is most favorable for "skill type" to be "none"(=0), * otherwise you cannot attack when your skill is blocked. * * Usage examples of this plugin: * - to create all-range weapons * - to create dual-attack or triple-attack weapons * - If healing skill is set when actor attacks, you can choose a friend to heal. * - It is possible to make a weapon that functions similar to a guard command. */ /*:ja * @plugindesc 武器ごとに通常攻撃のスキルIDを変更します。 * @author 神無月サスケ * * @help このプラグインにはプラグインコマンドはありません。 * * 武器の「メモ」欄に、<skill_id:3> と書いた場合、 * 通常攻撃の際、3番のスキルが発動します。 * ※特に記述がなければ、通常通り1番のスキルが採用されます。 * * チェックポイント: * - 二刀流の場合、利き腕(先に定義された方)に持っているスキルIDが採用されます。 * - スキルタイプは「なし」にするのが望ましいです。 * さもなくば、技などを封じられたとき、攻撃が出来なくなります。 * * 想定される用途: * - 全体攻撃可能な武器 * - 2回攻撃、3回攻撃する武器 * - 回復魔法をスキルに指定した場合、 * 「攻撃」を選んだ際、味方の選択が出来、その仲間を回復します * - 防御コマンドなどと同等になる武器も実現可能です。 */ (function () { // // set skill id for attack. // Game_Actor.prototype.attackSkillId = function () { var normalId = Game_BattlerBase.prototype.attackSkillId.call(this); if (this.hasNoWeapons()) { return normalId; } var weapon = this.weapons()[0]; // at plural weapon, one's first skill. var id = weapon.meta.skill_id; return id ? Number(id) : normalId; }; // // for command at battle // var _Scene_Battle_commandAttack = Scene_Battle.prototype.commandAttack; Scene_Battle.prototype.commandAttack = function () { BattleManager.inputtingAction().setAttack(); // normal attack weapon (or other single attack weapon) var action = BattleManager.inputtingAction(); if (action.needsSelection() && action.isForOpponent()) { _Scene_Battle_commandAttack.call(this); return; } // special skill weapon this.onSelectAction(); }; })();
dazed/translations
www/js/plugins/WeaponSkill.js
JavaScript
unknown
3,037
//============================================================================= // Yanfly Engine Plugins - Core Engine // YEP_CoreEngine.js //============================================================================= var Imported = Imported || {}; Imported.YEP_CoreEngine = true; var Yanfly = Yanfly || {}; Yanfly.Core = Yanfly.Core || {}; Yanfly.Core.version = 1.32; //============================================================================= /*: * @plugindesc v1.32 Needed for the majority of Yanfly Engine Scripts. Also * contains bug fixes found inherently in RPG Maker. * @author Yanfly Engine Plugins * * @param ---Screen--- * @default * * @param Screen Width * @parent ---Screen--- * @type number * @min 0 * @desc Adjusts the width of the screen. * Default: 816 * @default 816 * * @param Screen Height * @parent ---Screen--- * @type number * @min 0 * @desc Adjusts the height of the screen. * Default: 624 * @default 624 * * @param Scale Battlebacks * @parent ---Screen--- * @type boolean * @on YES * @off NO * @desc Do you wish to scale battlebacks to resolution? * NO - false YES - true * @default true * * @param Scale Title * @parent ---Screen--- * @type boolean * @on YES * @off NO * @desc Do you wish to scale the title screen to resolution? * NO - false YES - true * @default true * * @param Scale Game Over * @parent ---Screen--- * @type boolean * @on YES * @off NO * @desc Do you wish to scale the game over screen to resolution? * NO - false YES - true * @default true * * @param Open Console * @parent ---Screen--- * @type boolean * @on Open * @off Don't Open * @desc For testing and debug purposes, this opens up the console. * Don't Open - false Open - true * @default false * * @param Reposition Battlers * @parent ---Screen--- * @type boolean * @on YES * @off NO * @desc Allow the plugin to reposition battlers to resolution? * NO - false YES - true * @default true * * @param GameFont Load Timer * @parent ---Screen--- * @type number * @min 0 * @desc This allows you to set the timer for loading the GameFont. * Set to 0 for unlimited time. Default: 20000 * @default 0 * * @param Update Real Scale * @parent ---Screen--- * @type boolean * @on YES * @off NO * @desc For now, best left alone, but it will allow real scaling for * screen stretching. NO - false YES - true * @default false * * @param Collection Clear * @parent ---Screen--- * @type boolean * @on YES * @off NO * @desc Clears stored objects within major scenes upon switching * scenes to free up memory. NO - false YES - true * @default true * * @param ---Gold--- * @desc * * @param Gold Max * @parent ---Gold--- * @type number * @min 1 * @desc The maximum amount of gold the player can have. * Default: 99999999 * @default 99999999 * * @param Gold Font Size * @parent ---Gold--- * @type number * @min 1 * @desc The font size used to display gold. * Default: 28 * @default 20 * * @param Gold Icon * @parent ---Gold--- * @type number * @min 0 * @desc This will be the icon used to represent gold in the gold * window. If left at 0, no icon will be displayed. * @default 313 * * @param Gold Overlap * @parent ---Gold--- * @desc This will be what's displayed when the gold number * exceeds the allocated area's content size. * @default A lotta * * @param ---Items--- * @desc * * @param Default Max * @parent ---Items--- * @type number * @min 1 * @desc This is the maximum number of items a player can hold. * Default: 99 * @default 99 * * @param Quantity Text Size * @parent ---Items--- * @type number * @min 1 * @desc This is the text's font size used for the item quantity. * Default: 28 * @default 20 * * @param ---Parameters--- * @default * * @param Max Level * @parent ---Parameters--- * @type number * @min 1 * @desc Adjusts the maximum level limit for actors. * Default: 99 * @default 99 * * @param Actor MaxHP * @parent ---Parameters--- * @type number * @min 1 * @desc Adjusts the maximum HP limit for actors. * Default: 9999 * @default 9999 * * @param Actor MaxMP * @parent ---Parameters--- * @type number * @min 0 * @desc Adjusts the maximum MP limit for actors. * Default: 9999 * @default 9999 * * @param Actor Parameter * @parent ---Parameters--- * @type number * @min 1 * @desc Adjusts the maximum parameter limit for actors. * Default: 999 * @default 999 * * @param Enemy MaxHP * @parent ---Parameters--- * @type number * @min 1 * @desc Adjusts the maximum HP limit for enemies. * Default: 999999 * @default 999999 * * @param Enemy MaxMP * @parent ---Parameters--- * @type number * @min 0 * @desc Adjusts the maximum MP limit for enemies. * Default: 9999 * @default 9999 * * @param Enemy Parameter * @parent ---Parameters--- * @type number * @min 1 * @desc Adjusts the maximum parameter limit for enemies. * Default: 999 * @default 999 * * @param ---Battle--- * @desc * * @param Animation Rate * @parent ---Battle--- * @type number * @min 1 * @desc Adjusts the rate of battle animations. Lower for faster. * Default: 4 * @default 4 * * @param Flash Target * @parent ---Battle--- * @type boolean * @on YES * @off NO * @desc If an enemy is targeted, it flashes or it can whiten. * OFF - false ON - true * @default false * * @param Show Events Transition * @parent ---Battle--- * @type boolean * @on Show * @off Hide * @desc Show events during the battle transition? * SHOW - true HIDE - false Default: false * @default true * * @param Show Events Snapshot * @parent ---Battle--- * @type boolean * @on Show * @off Hide * @desc Show events for the battle background snapshot? * SHOW - true HIDE - false Default: false * @default true * * @param ---Map Optimization--- * @desc * * @param Refresh Update HP * @parent ---Map Optimization--- * @type boolean * @on Show * @off Hide * @desc Do a full actor refresh when updating HP on map? * YES - true NO - false Default: true * @default true * * @param Refresh Update MP * @parent ---Map Optimization--- * @type boolean * @on Show * @off Hide * @desc Do a full actor refresh when updating MP on map? * YES - true NO - false Default: true * @default true * * @param Refresh Update TP * @parent ---Map Optimization--- * @type boolean * @on Show * @off Hide * @desc Do a full actor refresh when updating TP on map? * YES - true NO - false Default: true * @default false * * @param ---Font--- * @desc * * @param Chinese Font * @parent ---Font--- * @desc Default font(s) used for a Chinese RPG. * Default: SimHei, Heiti TC, sans-serif * @default SimHei, Heiti TC, sans-serif * * @param Korean Font * @parent ---Font--- * @desc Default font(s) used for a Korean RPG. * Default: Dotum, AppleGothic, sans-serif * @default Dotum, AppleGothic, sans-serif * * @param Default Font * @parent ---Font--- * @desc Default font(s) used for everything else. * Default: GameFont * @default GameFont, Verdana, Arial, Courier New * * @param Font Size * @parent ---Font--- * @type number * @min 1 * @desc Default font size used for windows. * Default: 28 * @default 28 * * @param Text Align * @parent ---Font--- * @type combo * @option left * @option center * @option right * @desc How to align the text for command windows. * left center right * @default left * * @param ---Windows--- * @default * * @param Digit Grouping * @parent ---Windows--- * @type boolean * @on YES * @off NO * @desc Groups together digits with a comma. * false - OFF true - ON * @default true * * @param Line Height * @parent ---Windows--- * @type number * @min 0 * @desc Adjusts universal line height used in Windows. * Default: 36 * @default 36 * * @param Icon Width * @parent ---Windows--- * @type number * @min 0 * @desc Adjusts the width of your icons. * Default: 32 * @default 32 * * @param Icon Height * @parent ---Windows--- * @type number * @min 0 * @desc Adjusts the height of your icons. * Default: 32 * @default 32 * * @param Face Width * @parent ---Windows--- * @type number * @min 0 * @desc Adjusts the width of actors' faces. * Default: 144 * @default 144 * * @param Face Height * @parent ---Windows--- * @type number * @min 0 * @desc Adjusts the height of actors' faces. * Default: 144 * @default 144 * * @param Window Padding * @parent ---Windows--- * @type number * @min 0 * @desc Adjusts the padding for all standard windows. * Default: 18 * @default 18 * * @param Text Padding * @parent ---Windows--- * @type number * @min 0 * @desc Adjusts the padding for text inside of windows. * Default: 6 * @default 6 * * @param Window Opacity * @parent ---Windows--- * @type number * @min 0 * @desc Adjusts the background opacity for windows. * Default: 192 * @default 192 * * @param Gauge Outline * @parent ---Windows--- * @type boolean * @on YES * @off NO * @desc Enable outlines for gauges. * false - OFF true - ON * @default true * * @param Gauge Height * @parent ---Windows--- * @type number * @min 0 * @desc Sets the height for gauges. * Default: 6 * @default 18 * * @param Menu TP Bar * @parent ---Windows--- * @type boolean * @on YES * @off NO * @desc Draws a TP bar in the menu status for actors. * false - OFF true - ON * @default true * * @param ---Window Colors--- * @default * * @param Color: Normal * @parent ---Window Colors--- * @type number * @min 0 * @max 31 * @desc Changes the text color for Windows. * Default: 0 * @default 0 * * @param Color: System * @parent ---Window Colors--- * @type number * @min 0 * @max 31 * @desc Changes the text color for Windows. * Default: 16 * @default 16 * * @param Color: Crisis * @parent ---Window Colors--- * @type number * @min 0 * @max 31 * @desc Changes the text color for Windows. * Default: 17 * @default 17 * * @param Color: Death * @parent ---Window Colors--- * @type number * @min 0 * @max 31 * @desc Changes the text color for Windows. * Default: 18 * @default 18 * * @param Color: Gauge Back * @parent ---Window Colors--- * @type number * @min 0 * @max 31 * @desc Changes the text color for Windows. * Default: 19 * @default 19 * * @param Color: HP Gauge 1 * @parent ---Window Colors--- * @type number * @min 0 * @max 31 * @desc Changes the text color for Windows. * Default: 20 * @default 20 * * @param Color: HP Gauge 2 * @parent ---Window Colors--- * @type number * @min 0 * @max 31 * @desc Changes the text color for Windows. * Default: 21 * @default 21 * * @param Color: MP Gauge 1 * @parent ---Window Colors--- * @type number * @min 0 * @max 31 * @desc Changes the text color for Windows. * Default: 22 * @default 22 * * @param Color: MP Gauge 2 * @parent ---Window Colors--- * @type number * @min 0 * @max 31 * @desc Changes the text color for Windows. * Default: 23 * @default 23 * * @param Color: MP Cost * @parent ---Window Colors--- * @type number * @min 0 * @max 31 * @desc Changes the text color for Windows. * Default: 23 * @default 23 * * @param Color: Power Up * @parent ---Window Colors--- * @type number * @min 0 * @max 31 * @desc Changes the text color for Windows. * Default: 24 * @default 24 * * @param Color: Power Down * @parent ---Window Colors--- * @type number * @min 0 * @max 31 * @desc Changes the text color for Windows. * Default: 25 * @default 25 * * @param Color: TP Gauge 1 * @parent ---Window Colors--- * @type number * @min 0 * @max 31 * @desc Changes the text color for Windows. * Default: 28 * @default 28 * * @param Color: TP Gauge 2 * @parent ---Window Colors--- * @type number * @min 0 * @max 31 * @desc Changes the text color for Windows. * Default: 29 * @default 29 * * @param Color: TP Cost Color * @parent ---Window Colors--- * @type number * @min 0 * @max 31 * @desc Changes the text color for Windows. * Default: 29 * @default 29 * * @help * ============================================================================ * Introduction and Instructions * ============================================================================ * * Yanfly Engine Plugins - Core Engine is made for RPG Maker MV. This plugin * functions primarily to fix bugs and to allow the user more control over RPG * Maker MV's various features, such as the screen resolution, font, window * colors, and more. * * Just place this on top of all the other Yanfly Engine Plugins. * Adjust any parameters as you see fit. * * ============================================================================ * Bug Fixes * ============================================================================ * * This plugin fixes a few bugs found present within RPG Maker MV. Of them are * the following: * * Animation Overlay * When a skill/item that targets multiple enemies at once using a fullscreen * animation, it will overlay multiple times causing the image to look * distorted by a series of overlayed effects. The plugin fixes this issue by * having only one animation played over the group instead of every one. * * Audio Volume Stacking * Sometimes when multiple sound effects are played in the same frame with * the exact settings (usually due to animaitons), the volume stacks upon * each other, causing them to not play the intended volume for the effect. * This plugin fixes this issue by preventing sound effects of the same exact * settings from playing during the same frame, allowing only the first to * go through without stacking the volume higher. * * Event Movement Speed * The movement speed of events are slightly slower than what they should be * due a small error in the source code. The plugin fixes this issue and they * move at the properly speed. * * Event Movement Queue * If an event were to move through an event command, changing a condition * that would set the event to change to a different page would cause that * event's move route to halt in its tracks. The plugin fixes this issue and * the event's move route will finish. * * Event Colliding * Events cannot move over other events with a Below Player setting. This * makes it difficult for certain types of puzzles or events to exist. This * plugin fixes this issue by making the collision check only apply to events * of "Same as Characters" priority. Any event that's above or below the * characters will no longer collide with other events. * * Screen Tearing * When moving slowly, the tiles on the screen tear. While it's not * noticeable on all systems, slower computers will definitely show it. The * plugin will fix this issue and synch the tiles to keep up to pace with * the screen's camera movement properly. * * Sprite Distortion * Because of JavaScript's strange mathematical behavior, sometimes values * with decimal places cause spritesheets to end up looking distorted. The * plugin will get rid of the decimal places and have sprite sheets take out * frames properly by using integer values only. * * ============================================================================ * Gold * ============================================================================ * * You can use the plugin commands to add or remove gold more than the * editor's 9,999,999 limit. You can also place notetags into items, weapons, * and armors to over the 999,999 cost limit. * * Plugin Command: * GainGold 1234567890 # Party gains 1234567890 gold. * LoseGold 9876543210 # Party loses 9876543210 gold. * * Item, Weapon, Armor Notetags * <Price: x> * Changes the price of the item to x. This notetag allows you to bypass the * editor's 999,999 gold cost limit. * * Enemy Notetag * <Gold: x> * Changes the gold drop value of enemies to x. This notetag allows you to * bypass the editor's 9,999,999 gold drop limit. * * ============================================================================ * Items * ============================================================================ * * Change the parameters to reflect the maximum number of items a player can * hold per item. If you wish to make individual items have different max * values, use the following notetag: * * Item, Weapon, Armor Notetag: * <Max Item: x> * This changes the maximum amount of the item to x. * * ============================================================================ * Stats * ============================================================================ * * Even with the parameter limits raised, the editor is still confined to RPG * Maker MV's default limits. To break past them, use the following notetags * to allow further control over the individual aspects for the parameters. * * Actor Notetag * <Initial Level: x> * Changes the actor's initial level to x. This allows you to bypass the * editor's level 99 limit. * * <Max Level: x> * Changes the actor's max level to x. This allows you to bypass the editor's * level 99 limit. * * Class Skill Learn Notetag * <Learn at Level: x> * When placed inside a class's "Skills to Learn" notetag, this will cause * the class to learn the skill at level x. * * Weapon and Armor Notetags * <stat: +x> * <stat: -x> * Allows the piece of weapon or armor to gain or lose x amount of stat. * Replace "stat" with "hp", "mp", "atk", "def", "mat", "mdf", "agi", or * "luk" to alter that specific stat. This allows the piece of equipment * to go past the editor's default limitation so long as the maximum value * allows for it. * * Enemy Notetags * <stat: x> * This changes the enemy's stat to x amount. Replace "stat" with "hp", * "mp", "atk", "def", "mat", "mdf", "agi", or "luk" to alter that * specific stat. This allows the piece of equipment to go past the * editor's default limitation. * * <exp: x> * This changes the enemy's exp given out to x amount. This allows the * enemy give out more exp than the editor's default 9,999,999 limit. * * ============================================================================ * Script Call Fail Safe * ============================================================================ * * Irregular code in damage formulas, script calls, conditional branches, and * variable events will no longer crash the game. Instead, they will force open * the console window to display the error only during test play. * * If the player is not in test play, the game will continue as normal without * the error being shown. If the game is being played in a browser, opening up * the console window will still display the error. * * ============================================================================ * Changelog * ============================================================================ * * Version 1.32: * - Reversed the disable for the screen jitter fix from version 1.24. Somehow * it came back and I don't know when, but now it needs to go. * * Version 1.31: * - Added Fallen Angel Olivia's full error message display to the Core Engine * (with her permission of course). * - Bug fixed regarding blend modes and bush depth making sprites not blend * properly in-game. * - Tab key no longer requires you to press it twice before triggering Tab-key * related inputs. * * Version 1.30: * - Bug fixed for audio Sound Effect stacking. * - Optimization update. * * Version 1.29: * - Bypass the isDevToolsOpen() error when bad code is inserted into a script * call or custom Lunatic Mode code segment due to updating to MV 1.6.1. * * Version 1.28: * - Upon pressing F5 to reload your game, this will close the DevTools Debug * Console if it is opened before reloading. This is because reloading with it * closed ends up reloading the game faster. * - New plugin parameters added: Refresh Update HP, MP, and TP * - Option to choose to do a full actor refresh upon changing HP, MP, or TP * - This is to reduce overall map lagging. * * Version 1.27: * - Updated for RPG Maker MV version 1.6.0: * - Fixing script call checks made with switches and self switches under * conditional branches due to how ES6 handles === differently. * * Version 1.26: * - Updated for RPG Maker MV version 1.6.0: * - Removal of the destructive code in Scene_Item.update function. * - Open Console parameter now occurs after the map's been loaded or after * the battle has started. This is because after the 1.6.0 changes, loading * the console before anything else will lock up other aspects of RPG Maker * from loading properly. * * Version 1.25: * - Updated for RPG Maker MV version 1.5.0. * - Updated Scale Title and Scale GameOver to work with 1.5.0. * * Version 1.24: * - Screen jittering prevention is now prevented for RPG Maker MV 1.3.4 and * above since Pixi4 handles that now. * * Version 1.23: * - For RPG Maker MV version 1.3.2 and above, the 'Scale Battlebacks' plugin * parameter will now recreate the battleback sprites in a different format. * This is because battleback scaling with Tiling Sprites is just too volatile. * Battleback sprites are now just regular sprites instead of tiling sprites. * This may or may not cause plugin incompatibilities with other plugins that * alter battlebacks. * - For RPG Maker MV version 1.3.4, Game_Actor.meetsUsableItemConditions is * now updated to return a check back to the original Game_BattlerBase version * to maintain compatibility with other plugins. * * Version 1.22: * - Added 'Show Events Transition' plugin parameter. Enabling this will make * events on the map no longer hide themselves while entering battle during the * transition. * - Added 'Show Events Snapshot' plugin parameter. Enabling this will keep * events shown as a part of the battle snapshot when entering battle. * - Irregular code in damage formulas, script calls, conditional branches, and * variable events will no longer crash the game. Instead, it will force open * the console window to display the error only during Test Play. * * Version 1.21: * - Fixed a bug with scaling battlebacks not working properly for Front View. * - Optimization update to keep garbage collection across all scenes. * * Version 1.20: * - Altered increasing resolution function. * - Added 'Update Real Scale' plugin parameter. This is best left alone for * now and to be used if a later update meshes with rendered scaling. * - Added memory clear functionality for versions under 1.3.2 to free up more * memory upon leaving the map scene. * - Added 'Collection Clear' plugin parameter. This option, if left on, will * clear the attached children to Scene_Map and Scene_Battle upon switching to * a different scene. This will potentially free up memory from various objects * added to those scenes from other plugins (depending on how they're added) * and serve as a means of reducing memory bloat. * * Version 1.19: * - Updated for RPG Maker MV version 1.3.2. * - Fixed 'LearnSkill' function for actors to not be bypassed if a piece of * equipment has temporarily added a skill. * * Version 1.18: * - Fixed a bug with scaling battlebacks not working properly for Front View. * * Version 1.17: * - Updated for RPG Maker MV version 1.3.0. * * Version 1.16: * - Fixed a bug with RPG Maker MV's inherent 'drawTextEx' function. By default * it calculates the text height and then resets the font settings before * drawing the text, which makes the text height inconsistent if it were to * match the calculated height settings. * * Version 1.15: * - Window's are now set to have only widths and heights of whole numbers. No * longer is it possible for them to have decimal values. This is to reduce any * and all clipping issues caused by non-whole numbers. * * Version 1.14: * - Optimization update for RPG Maker MV itself by replacing more memory * intensive loops in commonly used functions with more efficient loops. * * Version 1.13: * - Updated for RPG Maker MV version 1.1.0. * * Version 1.12: * - Fixed a bug with a notetag: <Learn at Level: x>. Now, the notetag works * with both <Learn at Level: x> and <Learn Level: x> * * Version 1.11: * - Made fixes to the MV Source Code where FaceWidth was using a hard-coded * 144 value regardless of what was changed for the Face Width parameter. * - Fixed a notetag that wasn't working with the enemy EXP values. * - Updated battler repositioning to no longer clash when entering-exiting the * scene with Row Formation. * * Version 1.10: * - Removed an MV bugfix that was applied through MV's newes tupdate. * * Version 1.09: * - Changed minimum display width for status drawing to accomodate Party * Formation defaults. * * Version 1.08: * - Fixed a bug within the MV Source with changing classes and maintaining * levels, even though the feature to maintain the levels has been removed. * * Version 1.07: * - Fixed an issue with the gauges drawing outlines thicker than normal at odd * intervals when windows are scaled irregularly. * * Version 1.06: * - Removed event frequency bug fix since it's now included in the source. * * Version 1.05: * - Added 'Scale Game Over' parameter to plugin settings. * * Version 1.04: * - Reworked math for calculating scaled battleback locations. * - Fixed a bug where if the party failed to escape from battle, states that * would be removed by battle still get removed. *Fixed by Emjenoeg* * * Version 1.03: * - Fixed a strange bug that made scaled battlebacks shift after one battle. * * Version 1.02: * - Fixed a bug that made screen fading on mobile devices work incorrectly. * - Added 'Scale Battlebacks' and 'Scale Title' parameters. * * Version 1.01: * - Fixed a bug that where if button sprites had different anchors, they would * not be properly clickable. *Fixed by Zalerinian* * * Version 1.00: * - Finished plugin! */ //============================================================================= //============================================================================= // Parameter Variables //============================================================================= Yanfly.Parameters = PluginManager.parameters('YEP_CoreEngine'); Yanfly.Param = Yanfly.Param || {}; Yanfly.Icon = Yanfly.Icon || {}; Yanfly.Param.ScreenWidth = Number(Yanfly.Parameters['Screen Width'] || 816); Yanfly.Param.ScreenHeight = Number(Yanfly.Parameters['Screen Height'] || 624); Yanfly.Param.ScaleBattleback = String(Yanfly.Parameters['Scale Battlebacks']); Yanfly.Param.ScaleBattleback = eval(Yanfly.Param.ScaleBattleback); Yanfly.Param.ScaleTitle = eval(String(Yanfly.Parameters['Scale Title'])); Yanfly.Param.ScaleGameOver = eval(String(Yanfly.Parameters['Scale Game Over'])); Yanfly.Param.OpenConsole = String(Yanfly.Parameters['Open Console']); Yanfly.Param.OpenConsole = eval(Yanfly.Param.OpenConsole); Yanfly.Param.ReposBattlers = String(Yanfly.Parameters['Reposition Battlers']); Yanfly.Param.ReposBattlers = eval(Yanfly.Param.ReposBattlers); Yanfly.Param.GameFontTimer = Number(Yanfly.Parameters['GameFont Load Timer']); Yanfly.Param.UpdateRealScale = String(Yanfly.Parameters['Update Real Scale']); Yanfly.Param.UpdateRealScale = eval(Yanfly.Param.UpdateRealScale); Yanfly.Param.CollectionClear = String(Yanfly.Parameters['Collection Clear']); Yanfly.Param.CollectionClear = eval(Yanfly.Param.CollectionClear); Yanfly.Param.MaxGold = String(Yanfly.Parameters['Gold Max']); Yanfly.Param.GoldFontSize = Number(Yanfly.Parameters['Gold Font Size']); Yanfly.Icon.Gold = Number(Yanfly.Parameters['Gold Icon']); Yanfly.Param.GoldOverlap = String(Yanfly.Parameters['Gold Overlap']); Yanfly.Param.MaxItem = Number(Yanfly.Parameters['Default Max']); Yanfly.Param.ItemQuantitySize = Number(Yanfly.Parameters['Quantity Text Size']); Yanfly.Param.MaxLevel = Number(Yanfly.Parameters['Max Level']); Yanfly.Param.EnemyMaxHp = Number(Yanfly.Parameters['Enemy MaxHP']); Yanfly.Param.EnemyMaxMp = Number(Yanfly.Parameters['Enemy MaxMP']); Yanfly.Param.EnemyParam = Number(Yanfly.Parameters['Enemy Parameter']); Yanfly.Param.ActorMaxHp = Number(Yanfly.Parameters['Actor MaxHP']); Yanfly.Param.ActorMaxMp = Number(Yanfly.Parameters['Actor MaxMP']); Yanfly.Param.ActorParam = Number(Yanfly.Parameters['Actor Parameter']); Yanfly.Param.AnimationRate = Number(Yanfly.Parameters['Animation Rate']); Yanfly.Param.FlashTarget = eval(String(Yanfly.Parameters['Flash Target'])); Yanfly.Param.ShowEvTrans = String(Yanfly.Parameters['Show Events Transition']); Yanfly.Param.ShowEvTrans = eval(Yanfly.Param.ShowEvTrans); Yanfly.Param.ShowEvSnap = String(Yanfly.Parameters['Show Events Snapshot']); Yanfly.Param.ShowEvSnap = eval(Yanfly.Param.ShowEvSnap); Yanfly.Param.RefreshUpdateHp = String(Yanfly.Parameters['Refresh Update HP']); Yanfly.Param.RefreshUpdateHp = eval(Yanfly.Param.RefreshUpdateHp); Yanfly.Param.RefreshUpdateMp = String(Yanfly.Parameters['Refresh Update MP']); Yanfly.Param.RefreshUpdateMp = eval(Yanfly.Param.RefreshUpdateMp); Yanfly.Param.RefreshUpdateTp = String(Yanfly.Parameters['Refresh Update TP']); Yanfly.Param.RefreshUpdateTp = eval(Yanfly.Param.RefreshUpdateTp); Yanfly.Param.ChineseFont = String(Yanfly.Parameters['Chinese Font']); Yanfly.Param.KoreanFont = String(Yanfly.Parameters['Korean Font']); Yanfly.Param.DefaultFont = String(Yanfly.Parameters['Default Font']); Yanfly.Param.FontSize = Number(Yanfly.Parameters['Font Size']); Yanfly.Param.TextAlign = String(Yanfly.Parameters['Text Align']); Yanfly.Param.DigitGroup = eval(String(Yanfly.Parameters['Digit Grouping'])); Yanfly.Param.LineHeight = Number(Yanfly.Parameters['Line Height']); Yanfly.Param.IconWidth = Number(Yanfly.Parameters['Icon Width'] || 32);; Yanfly.Param.IconHeight = Number(Yanfly.Parameters['Icon Height'] || 32);; Yanfly.Param.FaceWidth = Number(Yanfly.Parameters['Face Width'] || 144); Yanfly.Param.FaceHeight = Number(Yanfly.Parameters['Face Height'] || 144); Yanfly.Param.WindowPadding = Number(Yanfly.Parameters['Window Padding']); Yanfly.Param.TextPadding = Number(Yanfly.Parameters['Text Padding']); Yanfly.Param.WindowOpacity = Number(Yanfly.Parameters['Window Opacity']); Yanfly.Param.GaugeOutline = eval(String(Yanfly.Parameters['Gauge Outline'])); Yanfly.Param.GaugeHeight = Number(Yanfly.Parameters['Gauge Height']); Yanfly.Param.MenuTpGauge = eval(String(Yanfly.Parameters['Menu TP Bar'])); Yanfly.Param.ColorNormal = Number(Yanfly.Parameters['Color: Normal']); Yanfly.Param.ColorSystem = Number(Yanfly.Parameters['Color: System']); Yanfly.Param.ColorCrisis = Number(Yanfly.Parameters['Color: Crisis']); Yanfly.Param.ColorDeath = Number(Yanfly.Parameters['Color: Death']); Yanfly.Param.ColorGaugeBack = Number(Yanfly.Parameters['Color: Gauge Back']); Yanfly.Param.ColorHpGauge1 = Number(Yanfly.Parameters['Color: HP Gauge 1']); Yanfly.Param.ColorHpGauge2 = Number(Yanfly.Parameters['Color: HP Gauge 2']); Yanfly.Param.ColorMpGauge1 = Number(Yanfly.Parameters['Color: MP Gauge 1']); Yanfly.Param.ColorMpGauge2 = Number(Yanfly.Parameters['Color: MP Gauge 2']); Yanfly.Param.ColorMpCost = Number(Yanfly.Parameters['Color: MP Cost']); Yanfly.Param.ColorPowerUp = Number(Yanfly.Parameters['Color: Power Up']); Yanfly.Param.ColorPowerDown = Number(Yanfly.Parameters['Color: Power Down']); Yanfly.Param.ColorTpGauge1 = Number(Yanfly.Parameters['Color: TP Gauge 1']); Yanfly.Param.ColorTpGauge2 = Number(Yanfly.Parameters['Color: TP Gauge 2']); Yanfly.Param.ColorTpCost = Number(Yanfly.Parameters['Color: TP Cost Color']); //============================================================================= // Bitmap //============================================================================= Yanfly.Core.Bitmap_initialize = Bitmap.prototype.initialize; Bitmap.prototype.initialize = function (width, height) { Yanfly.Core.Bitmap_initialize.call(this, width, height); this.fontFace = Yanfly.Param.DefaultFont; }; Yanfly.Core.Bitmap_blt = Bitmap.prototype.blt; Bitmap.prototype.blt = function (source, sx, sy, sw, sh, dx, dy, dw, dh) { sx = Math.floor(sx); sy = Math.floor(sy); sw = Math.floor(sw); sh = Math.floor(sh); dx = Math.floor(dx); dy = Math.floor(dy); dw = Math.floor(dw); dh = Math.floor(dh); Yanfly.Core.Bitmap_blt.call(this, source, sx, sy, sw, sh, dx, dy, dw, dh); }; Yanfly.Core.Bitmap_fillRect = Bitmap.prototype.fillRect; Bitmap.prototype.fillRect = function (x, y, w, h, c) { x = Math.floor(x); y = Math.floor(y); w = Math.floor(w); h = Math.floor(h); Yanfly.Core.Bitmap_fillRect.call(this, x, y, w, h, c); }; Yanfly.Core.Bitmap_gradientFillRect = Bitmap.prototype.gradientFillRect; Bitmap.prototype.gradientFillRect = function (x, y, w, h, c1, c2, ve) { Yanfly.Core.Bitmap_gradientFillRect.call(this, x, y, w, h, c1, c2, ve); }; Yanfly.Core.Bitmap_drawCircle = Bitmap.prototype.drawCircle; Bitmap.prototype.drawCircle = function (x, y, r, c) { x = Math.floor(x); y = Math.floor(y); Yanfly.Core.Bitmap_drawCircle.call(this, x, y, r, c); }; Yanfly.Core.Bitmap_drawText = Bitmap.prototype.drawText; Bitmap.prototype.drawText = function (text, x, y, mW, l, align) { x = Math.floor(x); y = Math.floor(y); if (mW < 0) mW = 0; mW = Math.floor(mW); l = Math.floor(l); Yanfly.Core.Bitmap_drawText.call(this, text, x, y, mW, l, align); }; //============================================================================= // Graphics //============================================================================= if (Yanfly.Param.UpdateRealScale) { Graphics._updateRealScale = function () { if (this._stretchEnabled) { var h = window.innerWidth / this._width; var v = window.innerHeight / this._height; this._realScale = Math.min(h, v); if (this._realScale >= 3) this._realScale = 3; else if (this._realScale >= 2) this._realScale = 2; else if (this._realScale >= 1.5) this._realScale = 1.5; else if (this._realScale >= 1) this._realScale = 1; else this._realScale = 0.5; } else { this._realScale = this._scale; } }; }; // Yanfly.Param.UpdateRealScale Graphics.printFullError = function (name, message, stack) { stack = this.processErrorStackMessage(stack); if (this._errorPrinter) { this._errorPrinter.innerHTML = this._makeFullErrorHtml(name, message, stack); } this._applyCanvasFilter(); this._clearUpperCanvas(); }; Graphics._makeFullErrorHtml = function (name, message, stack) { var text = ''; for (var i = 2; i < stack.length; ++i) { text += '<font color=white>' + stack[i] + '</font><br>'; } return ('<font color="yellow"><b>' + stack[0] + '</b></font><br>' + '<font color="yellow"><b>' + stack[1] + '</b></font><br>' + text); }; Graphics.processErrorStackMessage = function (stack) { var data = stack.split(/(?:\r\n|\r|\n)/); data.unshift('Game has encountered a bug. Please report it.<br>'); for (var i = 1; i < data.length; ++i) { data[i] = data[i].replace(/[\(](.*[\/])/, '('); } data.push('<br><font color="yellow"><b>Press F5 to restart the game.' + '</b></font><br>'); return data; }; Yanfly.Core.Graphics_updateErrorPrinter = Graphics._updateErrorPrinter; Graphics._updateErrorPrinter = function () { Yanfly.Core.Graphics_updateErrorPrinter.call(this); this._errorPrinter.height = this._height * 0.5; this._errorPrinter.style.textAlign = 'left'; this._centerElement(this._errorPrinter); }; SceneManager.catchException = function (e) { if (e instanceof Error) { Graphics.printFullError(e.name, e.message, e.stack); console.error(e.stack); } else { Graphics.printError('UnknownError', e); } AudioManager.stopAll(); this.stop(); }; //============================================================================= // Input //============================================================================= Yanfly.Core.Input_shouldPreventDefault = Input._shouldPreventDefault; Input._shouldPreventDefault = function (keyCode) { if (keyCode === 9) return true; return Yanfly.Core.Input_shouldPreventDefault.call(this, keyCode); }; //============================================================================= // Sprite //============================================================================= Yanfly.Core.Sprite_updateTransform = Sprite.prototype.updateTransform; Sprite.prototype.updateTransform = function () { Yanfly.Core.Sprite_updateTransform.call(this); this.worldTransform.tx = Math.floor(this.worldTransform.tx); this.worldTransform.ty = Math.floor(this.worldTransform.ty); }; //============================================================================= // ScreenSprite //============================================================================= Yanfly.Core.ScreenSprite_initialize = ScreenSprite.prototype.initialize; ScreenSprite.prototype.initialize = function () { Yanfly.Core.ScreenSprite_initialize.call(this); if (Utils.RPGMAKER_VERSION && Utils.RPGMAKER_VERSION >= '1.3.0') return; this.scale.x = Graphics.boxWidth * 10; this.scale.y = Graphics.boxHeight * 10; this.anchor.x = 0.5; this.anchor.y = 0.5; this.x = 0; this.y = 0; }; //============================================================================= // Window //============================================================================= Yanfly.Core.Window_refreshAllParts = Window.prototype._refreshAllParts; Window.prototype._refreshAllParts = function () { this._roundWhUp(); Yanfly.Core.Window_refreshAllParts.call(this); }; Window.prototype._roundWhUp = function () { this._width = Math.ceil(this._width); this._height = Math.ceil(this._height); }; //============================================================================= // DataManager //============================================================================= Yanfly.Core.DataManager_isDatabaseLoaded = DataManager.isDatabaseLoaded; DataManager.isDatabaseLoaded = function () { if (!Yanfly.Core.DataManager_isDatabaseLoaded.call(this)) return false; if (!Yanfly._loaded_YEP_CoreEngine) { this.processCORENotetags1($dataItems); this.processCORENotetags1($dataWeapons); this.processCORENotetags1($dataArmors); this.processCORENotetags2($dataEnemies); this.processCORENotetags3($dataActors); this.processCORENotetags4($dataClasses); Yanfly._loaded_YEP_CoreEngine = true; } return true; }; DataManager.processCORENotetags1 = function (group) { for (var n = 1; n < group.length; n++) { var obj = group[n]; var notedata = obj.note.split(/[\r\n]+/); obj.maxItem = Yanfly.Param.MaxItem; for (var i = 0; i < notedata.length; i++) { var line = notedata[i]; if (line.match(/<(?:PRICE):[ ](\d+)>/i)) { obj.price = parseInt(RegExp.$1); } else if (line.match(/<(?:MAX ITEM):[ ](\d+)>/i)) { obj.maxItem = Math.max(1, parseInt(RegExp.$1)); } else if (line.match(/<(.*):[ ]([\+\-]\d+)>/i)) { var stat = String(RegExp.$1).toUpperCase(); var value = parseInt(RegExp.$2); switch (stat) { case 'HP': case 'MAXHP': case 'MAX HP': obj.params[0] = value; break; case 'MP': case 'MAXMP': case 'MAX MP': case 'SP': case 'MAXSP': case 'MAX SP': obj.params[1] = value; break; case 'ATK': case 'STR': obj.params[2] = value; break; case 'DEF': obj.params[3] = value; break; case 'MAT': case 'INT' || 'SPI': obj.params[4] = value; break; case 'MDF': case 'RES': obj.params[5] = value; break; case 'AGI': case 'SPD': obj.params[6] = value; break; case 'LUK': obj.params[7] = value; break; case 'EXP': case 'XP': obj.exp = value; break; } } } } }; DataManager.processCORENotetags2 = function (group) { for (var n = 1; n < group.length; n++) { var obj = group[n]; var notedata = obj.note.split(/[\r\n]+/); for (var i = 0; i < notedata.length; i++) { var line = notedata[i]; if (line.match(/<(?:GOLD):[ ](\d+)>/i)) { obj.gold = parseInt(RegExp.$1); } else if (line.match(/<(.*):[ ](\d+)>/i)) { var stat = String(RegExp.$1).toUpperCase(); var value = parseInt(RegExp.$2); switch (stat) { case 'HP': case 'MAXHP': case 'MAX HP': obj.params[0] = value; break; case 'MP': case 'MAXMP': case 'MAX MP': case 'SP': case 'MAXSP': case 'MAX SP': obj.params[1] = value; break; case 'ATK': case 'STR': obj.params[2] = value; break; case 'DEF': obj.params[3] = value; break; case 'MAT': case 'INT': case 'SPI': obj.params[4] = value; break; case 'MDF': case 'RES': obj.params[5] = value; break; case 'AGI': case 'SPD': obj.params[6] = value; break; case 'LUK': obj.params[7] = value; break; case 'EXP': case 'XP': obj.exp = value; break; } } } } }; DataManager.processCORENotetags3 = function (group) { for (var n = 1; n < group.length; n++) { var obj = group[n]; var notedata = obj.note.split(/[\r\n]+/); obj.maxLevel = Yanfly.Param.MaxLevel; for (var i = 0; i < notedata.length; i++) { var line = notedata[i]; if (line.match(/<(?:MAX LEVEL):[ ](\d+)>/i)) { obj.maxLevel = parseInt(RegExp.$1); if (obj.maxLevel < 1) obj.maxLevel = 1; } else if (line.match(/<(?:INITIAL LEVEL):[ ](\d+)>/i)) { obj.initialLevel = parseInt(RegExp.$1); if (obj.initialLevel < 1) obj.initialLevel = 1; } } } }; DataManager.processCORENotetags4 = function (group) { for (var n = 1; n < group.length; n++) { var obj = group[n]; var notedata = obj.note.split(/[\r\n]+/); obj.learnings.forEach(function (learning) { if (learning.note.match(/<(?:LEARN LEVEL|LEARN AT LEVEL):[ ](\d+)>/i)) { learning.level = parseInt(RegExp.$1); if (learning.level < 1) obj.maxLevel = 1; } }, this); } }; //============================================================================= // AudioManager Stacking Volume Bug Fix //============================================================================= Yanfly.Core.AudioManager_playSe = AudioManager.playSe; AudioManager.playSe = function (se) { this._frameSe = this._frameSe || []; if (this.uniqueCheckSe(se)) { Yanfly.Core.AudioManager_playSe.call(this, se); this._frameSe.push(se); } }; AudioManager.uniqueCheckSe = function (se1) { if (this._frameSe.contains(se1)) return false; return true; }; AudioManager.clearUniqueCheckSe = function () { this._frameSe = []; }; Yanfly.Core.SceneManager_updateInputData = SceneManager.updateInputData; SceneManager.updateInputData = function () { Yanfly.Core.SceneManager_updateInputData.call(this); AudioManager.clearUniqueCheckSe(); }; //============================================================================= // SceneManager //============================================================================= SceneManager._screenWidth = Yanfly.Param.ScreenWidth; SceneManager._screenHeight = Yanfly.Param.ScreenHeight; SceneManager._boxWidth = Yanfly.Param.ScreenWidth; SceneManager._boxHeight = Yanfly.Param.ScreenHeight Yanfly.Core.SceneManager_run = SceneManager.run; SceneManager.run = function (sceneClass) { Yanfly.Core.SceneManager_run.call(this, sceneClass); Yanfly.updateResolution(); if (!Utils.isNwjs()) return; if (Utils.RPGMAKER_VERSION && Utils.RPGMAKER_VERSION >= "1.6.0") return; if (Yanfly.Param.OpenConsole) Yanfly.openConsole(); }; Yanfly.updateResolution = function () { var resizeWidth = Yanfly.Param.ScreenWidth - window.innerWidth; var resizeHeight = Yanfly.Param.ScreenHeight - window.innerHeight; if (!Imported.ScreenResolution) { window.moveBy(-1 * resizeWidth / 2, -1 * resizeHeight / 2); window.resizeBy(resizeWidth, resizeHeight); } }; Yanfly.openConsole = function () { Yanfly._openedConsole = true; if (Utils.isNwjs() && Utils.isOptionValid('test')) { var _debugWindow = require('nw.gui').Window.get().showDevTools(); if (_debugWindow) _debugWindow.moveTo(0, 0); window.focus(); } }; Yanfly.Core.SceneManager_onKeyDown = SceneManager.onKeyDown; SceneManager.onKeyDown = function (event) { if (!event.ctrlKey && !event.altKey && event.keyCode === 116) { if (Utils.isNwjs() && Utils.isOptionValid('test')) { var win = require('nw.gui').Window.get(); win.closeDevTools(); } } Yanfly.Core.SceneManager_onKeyDown.call(this, event); }; if (Utils.RPGMAKER_VERSION && Utils.RPGMAKER_VERSION >= "1.6.0") { Yanfly.openConsole = function () { Yanfly._openedConsole = true; if (!Yanfly.Param.OpenConsole) return; if (Utils.isNwjs() && Utils.isOptionValid('test')) { var win = require('nw.gui').Window.get(); win.showDevTools(); setTimeout(this.focusWindow.bind(this, win), 500); } }; Yanfly.focusWindow = function (win) { win.focus(); }; Yanfly.Core.Scene_Map_update = Scene_Map.prototype.update; Scene_Map.prototype.update = function () { Yanfly.Core.Scene_Map_update.call(this); if (!Yanfly._openedConsole) Yanfly.openConsole(); }; Yanfly.Core.Scene_Battle_update = Scene_Battle.prototype.update; Scene_Battle.prototype.update = function () { Yanfly.Core.Scene_Battle_update.call(this); if (!Yanfly._openedConsole) Yanfly.openConsole(); }; }; // 1.6.0 //============================================================================= // BattleManager //============================================================================= Yanfly.Core.BattleManager_displayStartMessages = BattleManager.displayStartMessages; BattleManager.displayStartMessages = function () { Yanfly.Core.BattleManager_displayStartMessages.call(this); $gameTroop.members().forEach(function (enemy) { enemy.recoverAll(); }); }; BattleManager.processEscape = function () { $gameParty.performEscape(); SoundManager.playEscape(); var success = this._preemptive ? true : (Math.random() < this._escapeRatio); if (success) { $gameParty.removeBattleStates(); this.displayEscapeSuccessMessage(); this._escaped = true; this.processAbort(); } else { this.displayEscapeFailureMessage(); this._escapeRatio += 0.1; $gameParty.clearActions(); this.startTurn(); } return success; }; //============================================================================= // Game_BattlerBase //============================================================================= Game_BattlerBase.prototype.paramMax = function (paramId) { if (paramId === 0) { return Yanfly.Param.EnemyMaxHp; } else if (paramId === 1) { return Yanfly.Param.EnemyMaxMp; } else { return Yanfly.Param.EnemyParam; } }; Yanfly.Core.Game_BattlerBase_refresh = Game_BattlerBase.prototype.refresh; Game_BattlerBase.prototype.mapRegenUpdateCheck = function (type) { if ($gameParty.inBattle()) return true; if (type === 'hp') { return Yanfly.Param.RefreshUpdateHp; } else if (type === 'mp') { return Yanfly.Param.RefreshUpdateMp; } else if (type === 'tp') { return Yanfly.Param.RefreshUpdateTp; } }; Game_BattlerBase.prototype.setHp = function (hp) { if (this._hp === hp) return; this._hp = hp; if (this.mapRegenUpdateCheck('hp')) { this.refresh(); } else { Yanfly.Core.Game_BattlerBase_refresh.call(this); } }; Game_BattlerBase.prototype.setMp = function (mp) { if (this._mp === mp) return; this._mp = mp; if (this.mapRegenUpdateCheck('mp')) { this.refresh(); } else { Yanfly.Core.Game_BattlerBase_refresh.call(this); } }; Game_BattlerBase.prototype.setTp = function (tp) { if (this._tp === tp) return; this._tp = tp; if (this.mapRegenUpdateCheck('tp')) { this.refresh(); } else { Yanfly.Core.Game_BattlerBase_refresh.call(this); } }; //============================================================================= // Game_Battler //============================================================================= Game_Battler.prototype.onTurnEnd = function () { this.clearResult(); this.regenerateAll(); this.updateStateTurns(); this.updateBuffTurns(); this.removeStatesAuto(2); }; //============================================================================= // Game_Actor //============================================================================= Yanfly.Core.Game_Actor_isMaxLevel = Game_Actor.prototype.isMaxLevel; Game_Actor.prototype.isMaxLevel = function () { if (this.maxLevel() === 0) return false; return Yanfly.Core.Game_Actor_isMaxLevel.call(this); }; Game_Actor.prototype.paramMax = function (paramId) { if (paramId === 0) { return Yanfly.Param.ActorMaxHp; } else if (paramId === 1) { return Yanfly.Param.ActorMaxMp; } else { return Yanfly.Param.ActorParam; } }; Yanfly.Core.Game_Actor_paramBase = Game_Actor.prototype.paramBase; Game_Actor.prototype.paramBase = function (paramId) { if (this.level > 99) { var i = this.currentClass().params[paramId][99]; var j = this.currentClass().params[paramId][98]; i += (i - j) * (this.level - 99); return i; } return Yanfly.Core.Game_Actor_paramBase.call(this, paramId); }; Game_Actor.prototype.changeClass = function (classId, keepExp) { if (keepExp) { this._exp[classId] = this._exp[this._classId]; } this._classId = classId; this.changeExp(this._exp[this._classId] || 0, false); this.refresh(); }; Game_Actor.prototype.learnSkill = function (skillId) { if (!this._skills.contains(skillId)) { this._skills.push(skillId); this._skills.sort(function (a, b) { return a - b; }); } }; if (Utils.RPGMAKER_VERSION && Utils.RPGMAKER_VERSION >= '1.3.4') { Game_Actor.prototype.meetsUsableItemConditions = function (item) { if ($gameParty.inBattle() && !BattleManager.canEscape() && this.testEscape(item)) { return false; } return Game_BattlerBase.prototype.meetsUsableItemConditions.call(this, item); }; }; // Utils.RPGMAKER_VERSION && Utils.RPGMAKER_VERSION >= '1.3.4' //============================================================================= // Game_Party //============================================================================= Game_Party.prototype.maxGold = function () { return eval(Yanfly.Param.MaxGold); }; Game_Party.prototype.maxItems = function (item) { if (!item) return 1; return item.maxItem; }; Game_Party.prototype.onPlayerWalk = function () { var group = this.members(); var length = group.length; for (var i = 0; i < length; ++i) { var actor = group[i]; if (actor) actor.onPlayerWalk(); } }; //============================================================================= // Game_Map //============================================================================= Yanfly.isPreventScreenJittering = function () { if (Utils.RPGMAKER_VERSION && Utils.RPGMAKER_VERSION >= '1.5.0') return true; if (Utils.RPGMAKER_VERSION && Utils.RPGMAKER_VERSION >= '1.3.4') return false; return true; }; if (Yanfly.isPreventScreenJittering()) { Game_Map.prototype.displayX = function () { return parseFloat(Math.floor(this._displayX * this.tileWidth())) / this.tileWidth(); }; Game_Map.prototype.displayY = function () { return parseFloat(Math.floor(this._displayY * this.tileHeight())) / this.tileHeight(); }; }; // Yanfly.isPreventScreenJittering Game_Map.prototype.adjustX = function (x) { if (this.isLoopHorizontal() && x < this.displayX() - (this.width() - this.screenTileX()) / 2) { return x - this.displayX() + $dataMap.width; } else { return x - this.displayX(); } }; Game_Map.prototype.adjustY = function (y) { if (this.isLoopVertical() && y < this.displayY() - (this.height() - this.screenTileY()) / 2) { return y - this.displayY() + $dataMap.height; } else { return y - this.displayY(); } }; Game_Map.prototype.updateEvents = function () { var group = this.events(); var length = group.length; for (var i = 0; i < length; ++i) { var ev = group[i]; if (ev) ev.update(); } var group = this._commonEvents; var length = group.length; for (var i = 0; i < length; ++i) { var ev = group[i]; if (ev) ev.update(); } }; Game_Map.prototype.updateVehicles = function () { var group = this._vehicles; var length = group.length; for (var i = 0; i < length; ++i) { var vehicle = group[i]; if (vehicle) vehicle.update(); } }; //============================================================================= // Game_Character //============================================================================= Game_Character.prototype.queueMoveRoute = function (moveRoute) { this._originalMoveRoute = moveRoute; this._originalMoveRouteIndex = 0; }; Yanfly.Core.Game_Event_setMoveRoute = Game_Event.prototype.setMoveRoute; Game_Character.prototype.setMoveRoute = function (moveRoute) { if (!this._moveRouteForcing) { Yanfly.Core.Game_Event_setMoveRoute.call(this, moveRoute); } else { this.queueMoveRoute(moveRoute); } }; Yanfly.Core.Game_Character_processMoveCommand = Game_Character.prototype.processMoveCommand; Game_Character.prototype.processMoveCommand = function (command) { var gc = Game_Character; var params = command.parameters; switch (command.code) { case gc.ROUTE_SCRIPT: try { eval(params[0]); } catch (e) { Yanfly.Util.displayError(e, params[0], 'MOVE ROUTE SCRIPT ERROR'); } return; break; } return Yanfly.Core.Game_Character_processMoveCommand.call(this, command); }; //============================================================================= // Game_Event //============================================================================= Game_Event.prototype.isCollidedWithEvents = function (x, y) { var events = $gameMap.eventsXyNt(x, y).filter(function (ev) { return ev.isNormalPriority(); }); if (events.length <= 0) return false; return this.isNormalPriority(); }; //============================================================================= // Game_Screen //============================================================================= Game_Screen.prototype.updatePictures = function () { var group = this._pictures; var length = group.length; for (var i = 0; i < length; ++i) { var picture = group[i]; if (picture) picture.update(); } }; //============================================================================= // Game_Action //============================================================================= Yanfly.Core.Game_Action_testItemEffect = Game_Action.prototype.testItemEffect; Game_Action.prototype.testItemEffect = function (target, effect) { switch (effect.code) { case Game_Action.EFFECT_LEARN_SKILL: return target.isActor() && !target._skills.contains(effect.dataId); default: return Yanfly.Core.Game_Action_testItemEffect.call(this, target, effect); } }; Game_Action.prototype.evalDamageFormula = function (target) { var item = this.item(); var a = this.subject(); var b = target; var v = $gameVariables._data; var sign = ([3, 4].contains(item.damage.type) ? -1 : 1); try { var value = Math.max(eval(item.damage.formula), 0) * sign; if (isNaN(value)) value = 0; return value; } catch (e) { Yanfly.Util.displayError(e, item.damage.formula, 'DAMAGE FORMULA ERROR'); return 0; } }; //============================================================================= // Game_Interpreter //============================================================================= // Conditional Branch Yanfly.Core.Game_Interpreter_command111 = Game_Interpreter.prototype.command111; Game_Interpreter.prototype.command111 = function () { var result = false; switch (this._params[0]) { case 0: // Switch if (this._params[2] === 0) { result = $gameSwitches.value(this._params[1]); } else { result = !$gameSwitches.value(this._params[1]); } this._branch[this._indent] = result; if (this._branch[this._indent] === false) this.skipBranch(); return true break; case 2: // Self Switch if (this._eventId > 0) { var key = [this._mapId, this._eventId, this._params[1]]; if (this._params[2] === 0) { result = $gameSelfSwitches.value(key); } else { result = !$gameSelfSwitches.value(key); } } this._branch[this._indent] = result; if (this._branch[this._indent] === false) this.skipBranch(); return true break; case 12: // Script var code = this._params[1]; try { result = !!eval(code); } catch (e) { result = false; Yanfly.Util.displayError(e, code, 'CONDITIONAL BRANCH SCRIPT ERROR'); } this._branch[this._indent] = result; if (this._branch[this._indent] === false) this.skipBranch(); return true break; } return Yanfly.Core.Game_Interpreter_command111.call(this); }; // Control Variables Yanfly.Core.Game_Interpreter_command122 = Game_Interpreter.prototype.command122; Game_Interpreter.prototype.command122 = function () { switch (this._params[3]) { case 4: // Script var value = 0; var code = this._params[4]; try { value = eval(code); } catch (e) { Yanfly.Util.displayError(e, code, 'CONTROL VARIABLE SCRIPT ERROR'); } for (var i = this._params[0]; i <= this._params[1]; i++) { this.operateVariable(i, this._params[2], value); } return true; break; } return Yanfly.Core.Game_Interpreter_command122.call(this); }; // Script Game_Interpreter.prototype.command355 = function () { var script = this.currentCommand().parameters[0] + '\n'; while (this.nextEventCode() === 655) { this._index++; script += this.currentCommand().parameters[0] + '\n'; } try { eval(script); } catch (e) { Yanfly.Util.displayError(e, script, 'SCRIPT CALL ERROR'); } return true; }; Yanfly.Core.Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand; Game_Interpreter.prototype.pluginCommand = function (command, args) { Yanfly.Core.Game_Interpreter_pluginCommand.call(this, command, args); if (command === 'GainGold') { $gameParty.gainGold(parseInt(args[0])); } if (command === 'LoseGold') { $gameParty.loseGold(parseInt(args[0])); } }; //============================================================================= // Scene_Base //============================================================================= Scene_Base.prototype.clearChildren = function () { while (this.children.length > 0) { this.removeChild(this.children[0]); } }; if (Yanfly.Param.CollectionClear) { Yanfly.Core.Scene_Base_terminate = Scene_Base.prototype.terminate; Scene_Base.prototype.terminate = function () { Yanfly.Core.Scene_Base_terminate.call(this); if (this._bypassFirstClear) return; this.clearChildren(); }; Yanfly.Core.Scene_Title_terminate = Scene_Title.prototype.terminate; Scene_Title.prototype.terminate = function () { this._bypassFirstClear = true; Yanfly.Core.Scene_Title_terminate.call(this); this.clearChildren(); }; Yanfly.Core.Scene_Map_terminate = Scene_Map.prototype.terminate; Scene_Map.prototype.terminate = function () { this._bypassFirstClear = true; Yanfly.Core.Scene_Map_terminate.call(this); this.clearChildren(); }; Yanfly.Core.Scene_Battle_terminate = Scene_Battle.prototype.terminate; Scene_Battle.prototype.terminate = function () { this._bypassFirstClear = true; Yanfly.Core.Scene_Battle_terminate.call(this); this.clearChildren(); }; Yanfly.Core.Scene_Options_terminate = Scene_Options.prototype.terminate; Scene_Options.prototype.terminate = function () { this._bypassFirstClear = true; Yanfly.Core.Scene_Options_terminate.call(this); this.clearChildren(); }; Yanfly.Core.Scene_Load_terminate = Scene_Load.prototype.terminate; Scene_Load.prototype.terminate = function () { this._bypassFirstClear = true; Yanfly.Core.Scene_Load_terminate.call(this); this.clearChildren(); }; Yanfly.Core.Scene_Gameover_terminate = Scene_Gameover.prototype.terminate; Scene_Gameover.prototype.terminate = function () { this._bypassFirstClear = true; Yanfly.Core.Scene_Gameover_terminate.call(this); this.clearChildren(); }; }; // Yanfly.Param.CollectionClear //============================================================================= // Scene_Boot //============================================================================= Scene_Boot.prototype.isGameFontLoaded = function () { if (Graphics.isFontLoaded('GameFont')) { return true; } else if (Yanfly.Param.GameFontTimer <= 0) { return false; } else { var elapsed = Date.now() - this._startDate; if (elapsed >= Yanfly.Param.GameFontTimer) { throw new Error('Failed to load GameFont'); } else { return false; } } }; //============================================================================= // Scene_Item //============================================================================= if (Utils.RPGMAKER_VERSION && Utils.RPGMAKER_VERSION >= "1.6.0") { Scene_Item.prototype.update = function () { Scene_ItemBase.prototype.update.call(this); }; }; // Utils.RPGMAKER_VERSION && Utils.RPGMAKER_VERSION >= "1.6.0" //============================================================================= // Scene_Title //============================================================================= Yanfly.Core.Scene_Title_start = Scene_Title.prototype.start; Scene_Title.prototype.start = function () { Yanfly.Core.Scene_Title_start.call(this); if (Yanfly.Param.ScaleTitle) this.rescaleTitle(); }; Scene_Title.prototype.rescaleTitle = function () { this.rescaleTitleSprite(this._backSprite1); this.rescaleTitleSprite(this._backSprite2); }; Scene_Title.prototype.rescaleTitleSprite = function (sprite) { if (sprite.bitmap.width <= 0 || sprite.bitmap <= 0) { return setTimeout(this.rescaleTitleSprite.bind(this, sprite), 5); } var width = Graphics.boxWidth; var height = Graphics.boxHeight; var ratioX = width / sprite.bitmap.width; var ratioY = height / sprite.bitmap.height; if (ratioX > 1.0) sprite.scale.x = ratioX; if (ratioY > 1.0) sprite.scale.y = ratioY; this.centerSprite(sprite); }; //============================================================================= // Scene_Map //============================================================================= if (Yanfly.Param.ShowEvTrans) { Scene_Map.prototype.startEncounterEffect = function () { this._encounterEffectDuration = this.encounterEffectSpeed(); }; }; // Yanfly.Param.ShowEvTrans Yanfly.Core.Scene_Map_snapForBattleBackground = Scene_Map.prototype.snapForBattleBackground; Scene_Map.prototype.snapForBattleBackground = function () { if (!Yanfly.Param.ShowEvSnap) this._spriteset.hideCharacters(); Yanfly.Core.Scene_Map_snapForBattleBackground.call(this); if (Yanfly.Param.ShowEvTrans) this._spriteset.showCharacters(); }; //============================================================================= // Scene_Gameover //============================================================================= Yanfly.Core.Scene_Gameover_start = Scene_Gameover.prototype.start; Scene_Gameover.prototype.start = function () { Yanfly.Core.Scene_Gameover_start.call(this); if (Yanfly.Param.ScaleGameOver) this.rescaleBackground(); }; Scene_Gameover.prototype.rescaleBackground = function () { this.rescaleImageSprite(this._backSprite); }; Scene_Gameover.prototype.rescaleImageSprite = function (sprite) { if (sprite.bitmap.width <= 0 || sprite.bitmap <= 0) { return setTimeout(this.rescaleImageSprite.bind(this, sprite), 5); } var width = Graphics.boxWidth; var height = Graphics.boxHeight; var ratioX = width / sprite.bitmap.width; var ratioY = height / sprite.bitmap.height; if (ratioX > 1.0) sprite.scale.x = ratioX; if (ratioY > 1.0) sprite.scale.y = ratioY; this.centerSprite(sprite); }; Scene_Gameover.prototype.centerSprite = function (sprite) { sprite.x = Graphics.width / 2; sprite.y = Graphics.height / 2; sprite.anchor.x = 0.5; sprite.anchor.y = 0.5; }; //============================================================================= // Sprite_Animation //============================================================================= Sprite_Animation.prototype.setupRate = function () { this._rate = Yanfly.Param.AnimationRate; }; //============================================================================= // Sprite_Battler //============================================================================= if (!Yanfly.Param.FlashTarget) { Yanfly.Core.Sprite_Battler_updateSelectionEffect = Sprite_Battler.prototype.updateSelectionEffect; Sprite_Battler.prototype.updateSelectionEffect = function () { if (this._battler.isActor()) { Yanfly.Core.Sprite_Battler_updateSelectionEffect.call(this); } else { if (this._battler.isSelected()) this.startEffect('whiten'); } }; }; // Yanfly.Param.FlashTarget //============================================================================= // Sprite_Actor //============================================================================= if (Yanfly.Param.ReposBattlers) { Yanfly.Core.Sprite_Actor_setActorHome = Sprite_Actor.prototype.setActorHome; Sprite_Actor.prototype.setActorHome = function (index) { Yanfly.Core.Sprite_Actor_setActorHome.call(this, index); this._homeX += Graphics.boxWidth - 816; this._homeY += Graphics.boxHeight - 624; }; }; Sprite_Actor.prototype.retreat = function () { this.startMove(1200, 0, 120); }; //============================================================================= // Sprite_Enemy //============================================================================= if (Yanfly.Param.ReposBattlers) { Yanfly.Core.Sprite_Enemy_setBattler = Sprite_Enemy.prototype.setBattler; Sprite_Enemy.prototype.setBattler = function (battler) { Yanfly.Core.Sprite_Enemy_setBattler.call(this, battler); if (!this._enemy._alteredScreenY) { this._homeY += Math.floor((Graphics.boxHeight - 624) / 2); this._enemy._screenY = this._homeY; this._enemy._alteredScreenY = true; } if ($gameSystem.isSideView()) return; if (!this._enemy._alteredScreenX) { this._homeX += (Graphics.boxWidth - 816) / 2; this._enemy._screenX = this._homeX; this._enemy._alteredScreenX = true; } }; }; // Yanfly.Param.ReposBattlers //============================================================================= // Sprite_StateIcon //============================================================================= Sprite_StateIcon._iconWidth = Yanfly.Param.IconWidth; Sprite_StateIcon._iconHeight = Yanfly.Param.IconHeight; //============================================================================= // Sprite_Button //============================================================================= Sprite_Button.prototype.isButtonTouched = function () { var x = this.canvasToLocalX(TouchInput.x) + (this.anchor.x * this.width); var y = this.canvasToLocalY(TouchInput.y) + (this.anchor.y * this.height); return x >= 0 && y >= 0 && x < this.width && y < this.height; }; //============================================================================= // Sprite_Battleback //============================================================================= function Sprite_Battleback() { this.initialize.apply(this, arguments); } Sprite_Battleback.prototype = Object.create(Sprite.prototype); Sprite_Battleback.prototype.constructor = Sprite_Battleback; Sprite_Battleback.prototype.initialize = function (bitmapName, type) { Sprite.prototype.initialize.call(this); this._bitmapName = bitmapName; this._battlebackType = type; this.createBitmap(); }; Sprite_Battleback.prototype.createBitmap = function () { if (this._bitmapName === '') { this.bitmap = new Bitmap(Graphics.boxWidth, Graphics.boxHeight); } else { if (this._battlebackType === 1) { this.bitmap = ImageManager.loadBattleback1(this._bitmapName); } else { this.bitmap = ImageManager.loadBattleback2(this._bitmapName); } this.scaleSprite(); } }; Sprite_Battleback.prototype.scaleSprite = function () { if (this.bitmap.width <= 0) return setTimeout(this.scaleSprite.bind(this), 5); var width = Graphics.boxWidth; var height = Graphics.boxHeight; if (this.bitmap.width < width) { this.scale.x = width / this.bitmap.width; } if (this.bitmap.height < height) { this.scale.y = height / this.bitmap.height; } this.anchor.x = 0.5; this.x = Graphics.boxWidth / 2; if ($gameSystem.isSideView()) { this.anchor.y = 1; this.y = Graphics.boxHeight; } else { this.anchor.y = 0.5; this.y = Graphics.boxHeight / 2; } }; //============================================================================= // Sprite_Character //============================================================================= Yanfly.Core.Sprite_Character_updateHalfBodySprites = Sprite_Character.prototype.updateHalfBodySprites; Sprite_Character.prototype.updateHalfBodySprites = function () { Yanfly.Core.Sprite_Character_updateHalfBodySprites.call(this); if (this._bushDepth > 0) { this._upperBody.blendMode = this.blendMode; this._lowerBody.blendMode = this.blendMode; } }; //============================================================================= // Spriteset_Map //============================================================================= Spriteset_Map.prototype.hideCharacters = function () { for (var i = 0; i < this._characterSprites.length; i++) { var sprite = this._characterSprites[i]; if (!sprite.isTile()) sprite.hide(); } }; Spriteset_Map.prototype.showCharacters = function () { for (var i = 0; i < this._characterSprites.length; i++) { var sprite = this._characterSprites[i]; if (!sprite.isTile()) sprite.show(); } }; //============================================================================= // Spriteset_Battle //============================================================================= if (Yanfly.Param.ScaleBattleback) { if (Utils.RPGMAKER_VERSION && Utils.RPGMAKER_VERSION >= '1.3.2') { // Rewriting the battlebacks Spriteset_Battle.prototype.createBattleback = function () { this._back1Sprite = new Sprite_Battleback(this.battleback1Name(), 1); this._back2Sprite = new Sprite_Battleback(this.battleback2Name(), 2); this._battleField.addChild(this._back1Sprite); this._battleField.addChild(this._back2Sprite); }; // No more updateBattleback Spriteset_Battle.prototype.updateBattleback = function () { }; } else { // Version 1.3.0 and below Yanfly.Core.Spriteset_Battle_locateBattleback = Spriteset_Battle.prototype.locateBattleback; Spriteset_Battle.prototype.locateBattleback = function () { var sprite1 = this._back1Sprite; var sprite2 = this._back2Sprite; if (sprite1.bitmap.width <= 0) return; if (sprite2.bitmap.width <= 0) return; if (this._rescaledBattlebackSprite) return; this._rescaledBattlebackSprite = true; Yanfly.Core.Spriteset_Battle_locateBattleback.call(this); var height = this._battleField.height; sprite1.origin.y = sprite1.x + sprite1.bitmap.height - height; sprite2.origin.y = sprite1.y + sprite2.bitmap.height - height; this.rescaleBattlebacks(); }; Spriteset_Battle.prototype.rescaleBattlebacks = function () { this.rescaleBattlebackSprite(this._back1Sprite); this.rescaleBattlebackSprite(this._back2Sprite); }; Spriteset_Battle.prototype.rescaleBattlebackSprite = function (sprite) { if (sprite.bitmap.width <= 0 || sprite.bitmap <= 0) return; var width = Graphics.boxWidth; var height = Graphics.boxHeight; var ratioX = width / sprite.bitmap.width; var ratioY = height / sprite.bitmap.height; if (ratioX > 1.0) { sprite.scale.x = ratioX; sprite.anchor.x = 0.5; sprite.x = width / 2; } if (ratioY > 1.0) { sprite.scale.y = ratioY; sprite.origin.y = 0; sprite.y = 0; } }; } // Version 1.3.0 and below } // Yanfly.Param.ScaleBattleback //============================================================================= // Window_Base //============================================================================= Window_Base._iconWidth = Yanfly.Param.IconWidth; Window_Base._iconHeight = Yanfly.Param.IconHeight; Window_Base._faceWidth = Yanfly.Param.FaceWidth; Window_Base._faceHeight = Yanfly.Param.FaceHeight; Window_Base.prototype.lineHeight = function () { return Yanfly.Param.LineHeight; }; Window_Base.prototype.drawTextEx = function (text, x, y) { if (text) { this.resetFontSettings(); var textState = { index: 0, x: x, y: y, left: x }; textState.text = this.convertEscapeCharacters(text); textState.height = this.calcTextHeight(textState, false); while (textState.index < textState.text.length) { this.processCharacter(textState); } return textState.x - x; } else { return 0; } }; Window_Base.prototype.textWidthEx = function (text) { return this.drawTextEx(text, 0, this.contents.height + this.lineHeight()); }; Window_Base.prototype.standardFontFace = function () { if ($gameSystem.isChinese()) { return Yanfly.Param.ChineseFont; } else if ($gameSystem.isKorean()) { return Yanfly.Param.KoreanFont; } else { return Yanfly.Param.DefaultFont; } }; Window_Base.prototype.standardFontSize = function () { return Yanfly.Param.FontSize; }; Window_Base.prototype.standardPadding = function () { return Yanfly.Param.WindowPadding; }; Window_Base.prototype.textPadding = function () { return Yanfly.Param.TextPadding; }; Window_Base.prototype.standardBackOpacity = function () { return Yanfly.Param.WindowOpacity; }; Window_Base.prototype.normalColor = function () { return this.textColor(Yanfly.Param.ColorNormal); }; Window_Base.prototype.systemColor = function () { return this.textColor(Yanfly.Param.ColorSystem); }; Window_Base.prototype.crisisColor = function () { return this.textColor(Yanfly.Param.ColorCrisis); }; Window_Base.prototype.deathColor = function () { return this.textColor(Yanfly.Param.ColorDeath); }; Window_Base.prototype.gaugeBackColor = function () { return this.textColor(Yanfly.Param.ColorGaugeBack); }; Window_Base.prototype.hpGaugeColor1 = function () { return this.textColor(Yanfly.Param.ColorHpGauge1); }; Window_Base.prototype.hpGaugeColor2 = function () { return this.textColor(Yanfly.Param.ColorHpGauge2); }; Window_Base.prototype.mpGaugeColor1 = function () { return this.textColor(Yanfly.Param.ColorMpGauge1); }; Window_Base.prototype.mpGaugeColor2 = function () { return this.textColor(Yanfly.Param.ColorMpGauge2); }; Window_Base.prototype.mpCostColor = function () { return this.textColor(Yanfly.Param.ColorMpCost); }; Window_Base.prototype.powerUpColor = function () { return this.textColor(Yanfly.Param.ColorPowerUp); }; Window_Base.prototype.powerDownColor = function () { return this.textColor(Yanfly.Param.ColorPowerDown); }; Window_Base.prototype.tpGaugeColor1 = function () { return this.textColor(Yanfly.Param.ColorTpGauge1); }; Window_Base.prototype.tpGaugeColor2 = function () { return this.textColor(Yanfly.Param.ColorTpGauge2); }; Window_Base.prototype.tpCostColor = function () { return this.textColor(Yanfly.Param.ColorTpCost); }; Window_Base.prototype.drawGauge = function (dx, dy, dw, rate, color1, color2) { var color3 = this.gaugeBackColor(); var fillW = Math.floor(dw * rate).clamp(0, dw); var gaugeH = this.gaugeHeight(); var gaugeY = dy + this.lineHeight() - gaugeH - 2; if (Yanfly.Param.GaugeOutline) { color3.paintOpacity = this.translucentOpacity(); this.contents.fillRect(dx, gaugeY - 1, dw, gaugeH, color3); fillW = Math.max(fillW - 2, 0); gaugeH -= 2; dx += 1; } else { var fillW = Math.floor(dw * rate); var gaugeY = dy + this.lineHeight() - gaugeH - 2; this.contents.fillRect(dx, gaugeY, dw, gaugeH, color3); } this.contents.gradientFillRect(dx, gaugeY, fillW, gaugeH, color1, color2); }; Window_Base.prototype.gaugeHeight = function () { return Yanfly.Param.GaugeHeight; }; Window_Base.prototype.drawActorLevel = function (actor, x, y) { this.changeTextColor(this.systemColor()); var dw1 = this.textWidth(TextManager.levelA); this.drawText(TextManager.levelA, x, y, dw1); this.resetTextColor(); var level = Yanfly.Util.toGroup(actor.level); var dw2 = this.textWidth(Yanfly.Util.toGroup(actor.maxLevel())); this.drawText(level, x + dw1, y, dw2, 'right'); }; Window_Base.prototype.drawCurrentAndMax = function (current, max, x, y, width, color1, color2) { var labelWidth = this.textWidth('HP'); var valueWidth = this.textWidth(Yanfly.Util.toGroup(max)); var slashWidth = this.textWidth('/'); var x1 = x + width - valueWidth; var x2 = x1 - slashWidth; var x3 = x2 - valueWidth; if (x3 >= x + labelWidth) { this.changeTextColor(color1); this.drawText(Yanfly.Util.toGroup(current), x3, y, valueWidth, 'right'); this.changeTextColor(color2); this.drawText('/', x2, y, slashWidth, 'right'); this.drawText(Yanfly.Util.toGroup(max), x1, y, valueWidth, 'right'); } else { this.changeTextColor(color1); this.drawText(Yanfly.Util.toGroup(current), x1, y, valueWidth, 'right'); } }; Window_Base.prototype.drawActorTp = function (actor, x, y, width) { width = width || 96; var color1 = this.tpGaugeColor1(); var color2 = this.tpGaugeColor2(); this.drawGauge(x, y, width, actor.tpRate(), color1, color2); this.changeTextColor(this.systemColor()); this.drawText(TextManager.tpA, x, y, 44); this.changeTextColor(this.tpColor(actor)); this.drawText(Yanfly.Util.toGroup(actor.tp), x + width - 64, y, 64, 'right'); }; Window_Base.prototype.drawActorSimpleStatus = function (actor, x, y, width) { var lineHeight = this.lineHeight(); var xpad = Window_Base._faceWidth + (2 * Yanfly.Param.TextPadding); var x2 = x + xpad; var width2 = Math.max(180, width - xpad - this.textPadding()); this.drawActorName(actor, x, y); this.drawActorLevel(actor, x, y + lineHeight * 1); this.drawActorIcons(actor, x, y + lineHeight * 2); this.drawActorClass(actor, x2, y, width2); this.drawActorHp(actor, x2, y + lineHeight * 1, width2); this.drawActorMp(actor, x2, y + lineHeight * 2, width2); if (Yanfly.Param.MenuTpGauge) { this.drawActorTp(actor, x2, y + lineHeight * 3, width2); } }; Window_Base.prototype.drawCurrencyValue = function (value, unit, wx, wy, ww) { this.resetTextColor(); this.contents.fontSize = Yanfly.Param.GoldFontSize; if (this.usingGoldIcon(unit)) { var cx = Window_Base._iconWidth; } else { var cx = this.textWidth(unit); } var text = Yanfly.Util.toGroup(value); if (this.textWidth(text) > ww - cx) { text = Yanfly.Param.GoldOverlap; } this.drawText(text, wx, wy, ww - cx - 4, 'right'); if (this.usingGoldIcon(unit)) { this.drawIcon(Yanfly.Icon.Gold, wx + ww - Window_Base._iconWidth, wy + 2); } else { this.changeTextColor(this.systemColor()); this.drawText(unit, wx, wy, ww, 'right'); } this.resetFontSettings(); }; Window_Base.prototype.usingGoldIcon = function (unit) { if (unit !== TextManager.currencyUnit) return false; return Yanfly.Icon.Gold > 0; }; //============================================================================= // Window_Command //============================================================================= Window_Command.prototype.itemTextAlign = function () { return Yanfly.Param.TextAlign; }; //============================================================================= // Window_MenuStatus //============================================================================= Window_MenuStatus.prototype.drawItemImage = function (index) { var actor = $gameParty.members()[index]; var rect = this.itemRect(index); this.changePaintOpacity(actor.isBattleMember()); var fw = Window_Base._faceWidth; this.drawActorFace(actor, rect.x + 1, rect.y + 1, fw, rect.height - 2); this.changePaintOpacity(true); }; Window_MenuStatus.prototype.drawItemStatus = function (index) { var actor = $gameParty.members()[index]; var rect = this.itemRect(index); var xpad = Yanfly.Param.WindowPadding + Window_Base._faceWidth; var x = rect.x + xpad; if (!Yanfly.Param.MenuTpGauge) { var y = Math.floor(rect.y + rect.height / 2 - this.lineHeight() * 1.5); } else { var y = Math.floor(rect.y); } var width = rect.width - x - this.textPadding(); this.drawActorSimpleStatus(actor, x, y, width); }; //============================================================================= // Window_ItemList //============================================================================= Window_ItemList.prototype.numberWidth = function () { return this.textWidth('\u00d70,000'); }; Window_ItemList.prototype.drawItemNumber = function (item, x, y, width) { if (!this.needsNumber()) return; var numItems = Yanfly.Util.toGroup($gameParty.numItems(item)); this.contents.fontSize = Yanfly.Param.ItemQuantitySize; this.drawText('\u00d7' + numItems, x, y, width, 'right'); this.resetFontSettings(); }; //============================================================================= // Window_SkillStatus //============================================================================= Window_SkillStatus.prototype.refresh = function () { this.contents.clear(); if (this._actor) { var w = this.width - this.padding * 2; var h = this.height - this.padding * 2; if (!Yanfly.Param.MenuTpGauge) { var y = h / 2 - this.lineHeight() * 1.5; } else { var y = 0; } var xpad = Yanfly.Param.WindowPadding + Window_Base._faceWidth; var width = w - xpad - this.textPadding(); this.drawActorFace(this._actor, 0, 0, Window_Base._faceWidth, h); this.drawActorSimpleStatus(this._actor, xpad, y, width); } }; Window_SkillList.prototype.drawSkillCost = function (skill, x, y, width) { if (this._actor.skillTpCost(skill) > 0) { this.changeTextColor(this.tpCostColor()); var skillcost = Yanfly.Util.toGroup(this._actor.skillTpCost(skill)); this.drawText(skillcost, x, y, width, 'right'); } else if (this._actor.skillMpCost(skill) > 0) { this.changeTextColor(this.mpCostColor()); var skillcost = Yanfly.Util.toGroup(this._actor.skillMpCost(skill)); this.drawText(skillcost, x, y, width, 'right'); } }; //============================================================================= // Window_EquipStatus //============================================================================= Window_EquipStatus.prototype.drawCurrentParam = function (x, y, paramId) { this.resetTextColor(); var actorparam = Yanfly.Util.toGroup(this._actor.param(paramId)); this.drawText(actorparam, x, y, 48, 'right'); }; Window_EquipStatus.prototype.drawNewParam = function (x, y, paramId) { var newValue = this._tempActor.param(paramId); var diffvalue = newValue - this._actor.param(paramId); var actorparam = Yanfly.Util.toGroup(newValue); this.changeTextColor(this.paramchangeTextColor(diffvalue)); this.drawText(actorparam, x, y, 48, 'right'); }; //============================================================================= // Window_SkillType //============================================================================= Window_SkillType.prototype.makeCommandList = function () { if (this._actor) { var skillTypes = this._actor.addedSkillTypes(); skillTypes.sort(function (a, b) { return a - b }); skillTypes.forEach(function (stypeId) { var name = $dataSystem.skillTypes[stypeId]; this.addCommand(name, 'skill', true, stypeId); }, this); } }; //============================================================================= // Window_ActorCommand //============================================================================= Window_ActorCommand.prototype.addSkillCommands = function () { var skillTypes = this._actor.addedSkillTypes(); skillTypes.sort(function (a, b) { return a - b }); skillTypes.forEach(function (stypeId) { var name = $dataSystem.skillTypes[stypeId]; this.addCommand(name, 'skill', true, stypeId); }, this); }; //============================================================================= // Window_Status //============================================================================= Window_Status.prototype.drawParameters = function (x, y) { var lineHeight = this.lineHeight(); for (var i = 0; i < 6; i++) { var paramId = i + 2; var y2 = y + lineHeight * i; this.changeTextColor(this.systemColor()); this.drawText(TextManager.param(paramId), x, y2, 160); this.resetTextColor(); var actorParam = Yanfly.Util.toGroup(this._actor.param(paramId)); var dw = this.textWidth(Yanfly.Util.toGroup(this._actor.paramMax(i + 2))); this.drawText(actorParam, x + 160, y2, dw, 'right'); } }; Window_Status.prototype.drawExpInfo = function (x, y) { var lineHeight = this.lineHeight(); var expTotal = TextManager.expTotal.format(TextManager.exp); var expNext = TextManager.expNext.format(TextManager.level); var value1 = this._actor.currentExp(); var value2 = this._actor.nextRequiredExp(); if (this._actor.isMaxLevel()) { value1 = '-------'; value2 = '-------'; } else { value1 = Yanfly.Util.toGroup(value1); value2 = Yanfly.Util.toGroup(value2); } this.changeTextColor(this.systemColor()); this.drawText(expTotal, x, y + lineHeight * 0, 270); this.drawText(expNext, x, y + lineHeight * 2, 270); this.resetTextColor(); this.drawText(value1, x, y + lineHeight * 1, 270, 'right'); this.drawText(value2, x, y + lineHeight * 3, 270, 'right'); }; //============================================================================= // Window_ShopBuy //============================================================================= Window_ShopBuy.prototype.drawItem = function (index) { var item = this._data[index]; var rect = this.itemRect(index); rect.width -= this.textPadding(); this.changePaintOpacity(this.isEnabled(item)); this.drawItemName(item, rect.x, rect.y, rect.width); this.contents.fontSize = Yanfly.Param.GoldFontSize; var itemPrice = Yanfly.Util.toGroup(this.price(item)); this.drawText(itemPrice, rect.x, rect.y, rect.width, 'right'); this.changePaintOpacity(true); this.resetFontSettings(); }; //============================================================================= // Window_ShopNumber //============================================================================= Window_ShopNumber.prototype.drawNumber = function () { var x = this.cursorX(); var y = this.itemY(); var width = this.cursorWidth() - this.textPadding(); this.resetTextColor(); var itemNumber = Yanfly.Util.toGroup(this._number); this.drawText(itemNumber, x, y, width, 'right'); }; //============================================================================= // Window_NameEdit //============================================================================= Window_NameEdit.prototype.faceWidth = function () { return Window_Base._faceWidth; }; //============================================================================= // Window_BattleStatus //============================================================================= Window_BattleStatus.prototype.gaugeAreaWidth = function () { return this.width / 2 + this.standardPadding(); }; Window_BattleStatus.prototype.drawBasicArea = function (rect, actor) { var minIconArea = Window_Base._iconWidth * 2; var nameLength = this.textWidth('0') * 16 + 6; var iconWidth = Math.max(rect.width - nameLength, minIconArea); var nameWidth = rect.width - iconWidth; this.drawActorName(actor, rect.x + 0, rect.y, nameWidth); this.drawActorIcons(actor, rect.x + nameWidth, rect.y, iconWidth); }; Window_BattleStatus.prototype.drawGaugeAreaWithTp = function (rect, actor) { var totalArea = this.gaugeAreaWidth() - 30; var hpW = Math.floor(parseInt(totalArea * 108 / 300)); var otW = Math.floor(parseInt(totalArea * 96 / 300)); this.drawActorHp(actor, rect.x + 0, rect.y, hpW); this.drawActorMp(actor, rect.x + hpW + 15, rect.y, otW); this.drawActorTp(actor, rect.x + hpW + otW + 30, rect.y, otW); }; Window_BattleStatus.prototype.drawGaugeAreaWithoutTp = function (rect, actor) { var totalArea = this.gaugeAreaWidth() - 15; var hpW = Math.floor(parseInt(totalArea * 201 / 315)); var otW = Math.floor(parseInt(totalArea * 114 / 315)); this.drawActorHp(actor, rect.x + 0, rect.y, hpW); this.drawActorMp(actor, rect.x + hpW + 15, rect.y, otW); }; //============================================================================= // Window_BattleLog //============================================================================= Window_BattleLog.prototype.showNormalAnimation = function (targets, animationId, mirror) { var animation = $dataAnimations[animationId]; if (animation) { if (animation.position === 3) { targets.forEach(function (target) { target.startAnimation(animationId, mirror, 0); }); } else { var delay = this.animationBaseDelay(); var nextDelay = this.animationNextDelay(); targets.forEach(function (target) { target.startAnimation(animationId, mirror, delay); delay += nextDelay; }); } } }; //============================================================================= // New Function //============================================================================= Yanfly.Util = Yanfly.Util || {}; if (Utils.RPGMAKER_VERSION && Utils.RPGMAKER_VERSION >= '1.5.0') { Yanfly.Util.toGroup = function (inVal) { if (typeof inVal === 'string') return inVal; if (!Yanfly.Param.DigitGroup) return inVal; return inVal.toLocaleString('en'); return inVal.replace(/(^|[^\w.])(\d{4,})/g, function ($0, $1, $2) { return $1 + $2.replace(/\d(?=(?:\d\d\d)+(?!\d))/g, "$&,"); }); }; } else { Yanfly.Util.toGroup = function (inVal) { if (typeof inVal !== 'string') { inVal = String(inVal); } if (!Yanfly.Param.DigitGroup) return inVal; return inVal.toLocaleString('en'); return inVal.replace(/(^|[^\w.])(\d{4,})/g, function ($0, $1, $2) { return $1 + $2.replace(/\d(?=(?:\d\d\d)+(?!\d))/g, "$&,"); }); }; } // Utils.RPGMAKER_VERSION && Utils.RPGMAKER_VERSION >= '1.5.0' Yanfly.Util.displayError = function (e, code, message) { console.log(message); console.log(code || 'NON-EXISTENT'); console.error(e); if (Utils.RPGMAKER_VERSION && Utils.RPGMAKER_VERSION >= "1.6.0") return; if (Utils.isNwjs() && Utils.isOptionValid('test')) { if (!require('nw.gui').Window.get().isDevToolsOpen()) { require('nw.gui').Window.get().showDevTools(); } } }; //============================================================================= // End of File //=============================================================================
dazed/translations
www/js/plugins/YEP_CoreEngine.js
JavaScript
unknown
92,367
//============================================================================= // Yanfly Engine Plugins - Main Menu Core // YEP_MainMenuManager.js //============================================================================= var Imported = Imported || {}; Imported.YEP_MainMenuManager = true; var Yanfly = Yanfly || {}; Yanfly.MMM = Yanfly.MMM || {}; //============================================================================= /*: * @plugindesc v1.00 This plugin allows you to manage the various aspects * of your main menu. * @author Yanfly Engine Plugins * * @param ---Command--- * @default * * @param Command Alignment * @desc This is the text alignment for the Command Window. * left center right * @default left * * @param Command Position * @desc Determine the command window's position. * left right * @default left * * @param Command Columns * @desc Amount of columns to be displayed by the command window. * Default: 1 * @default 1 * * @param Command Rows * @desc The number of visible rows for the command window. * @default Math.min(10, Math.ceil(this.maxItems() / this.maxCols())) * * @param Command Width * @desc This is the command window width in pixels. * Default: 240 * @default 240 * * @param ---Menu 1--- * @default * * @param Menu 1 Name * @desc This is the name for the menu command. This is an eval. To * make it a string, use 'quotes' around the name. * @default * * @param Menu 1 Symbol * @desc This is the symbol for the menu command. This needs to be * unique per menu command. * @default * * @param Menu 1 Show * @desc This is the eval condition for this menu command to appear. * @default * * @param Menu 1 Enabled * @desc Is this menu command enabled? This is an eval. * @default * * @param Menu 1 Ext * @desc This is the menu command's extension. This is an eval. * @default * * @param Menu 1 Main Bind * @desc This is the function activated by this menu command. * This is an eval. * @default * * @param Menu 1 Actor Bind * @desc If the menu command leads to selecting an actor, this is * the function activated after selecting an actor. * @default * * @param ---Menu 2--- * @default * * @param Menu 2 Name * @desc This is the name for the menu command. This is an eval. To * make it a string, use 'quotes' around the name. * @default * * @param Menu 2 Symbol * @desc This is the symbol for the menu command. This needs to be * unique per menu command. * @default * * @param Menu 2 Show * @desc This is the eval condition for this menu command to appear. * @default * * @param Menu 2 Enabled * @desc Is this menu command enabled? This is an eval. * @default * * @param Menu 2 Ext * @desc This is the menu command's extension. This is an eval. * @default * * @param Menu 2 Main Bind * @desc This is the function activated by this menu command. * This is an eval. * @default * * @param Menu 2 Actor Bind * @desc If the menu command leads to selecting an actor, this is * the function activated after selecting an actor. * @default * * @param ---Menu 3--- * @default * * @param Menu 3 Name * @desc This is the name for the menu command. This is an eval. To * make it a string, use 'quotes' around the name. * @default * * @param Menu 3 Symbol * @desc This is the symbol for the menu command. This needs to be * unique per menu command. * @default * * @param Menu 3 Show * @desc This is the eval condition for this menu command to appear. * @default * * @param Menu 3 Enabled * @desc Is this menu command enabled? This is an eval. * @default * * @param Menu 3 Ext * @desc This is the menu command's extension. This is an eval. * @default * * @param Menu 3 Main Bind * @desc This is the function activated by this menu command. * This is an eval. * @default * * @param Menu 3 Actor Bind * @desc If the menu command leads to selecting an actor, this is * the function activated after selecting an actor. * @default * * @param ---Menu 4--- * @default * * @param Menu 4 Name * @desc This is the name for the menu command. This is an eval. To * make it a string, use 'quotes' around the name. * @default * * @param Menu 4 Symbol * @desc This is the symbol for the menu command. This needs to be * unique per menu command. * @default * * @param Menu 4 Show * @desc This is the eval condition for this menu command to appear. * @default * * @param Menu 4 Enabled * @desc Is this menu command enabled? This is an eval. * @default * * @param Menu 4 Ext * @desc This is the menu command's extension. This is an eval. * @default * * @param Menu 4 Main Bind * @desc This is the function activated by this menu command. * This is an eval. * @default * * @param Menu 4 Actor Bind * @desc If the menu command leads to selecting an actor, this is * the function activated after selecting an actor. * @default * * @param ---Menu 5--- * @default * * @param Menu 5 Name * @desc This is the name for the menu command. This is an eval. To * make it a string, use 'quotes' around the name. * @default * * @param Menu 5 Symbol * @desc This is the symbol for the menu command. This needs to be * unique per menu command. * @default * * @param Menu 5 Show * @desc This is the eval condition for this menu command to appear. * @default * * @param Menu 5 Enabled * @desc Is this menu command enabled? This is an eval. * @default * * @param Menu 5 Ext * @desc This is the menu command's extension. This is an eval. * @default * * @param Menu 5 Main Bind * @desc This is the function activated by this menu command. * This is an eval. * @default * * @param Menu 5 Actor Bind * @desc If the menu command leads to selecting an actor, this is * the function activated after selecting an actor. * @default * * @param ---Menu 6--- * @default * * @param Menu 6 Name * @desc This is the name for the menu command. This is an eval. To * make it a string, use 'quotes' around the name. * @default * * @param Menu 6 Symbol * @desc This is the symbol for the menu command. This needs to be * unique per menu command. * @default * * @param Menu 6 Show * @desc This is the eval condition for this menu command to appear. * @default * * @param Menu 6 Enabled * @desc Is this menu command enabled? This is an eval. * @default * * @param Menu 6 Ext * @desc This is the menu command's extension. This is an eval. * @default * * @param Menu 6 Main Bind * @desc This is the function activated by this menu command. * This is an eval. * @default * * @param Menu 6 Actor Bind * @desc If the menu command leads to selecting an actor, this is * the function activated after selecting an actor. * @default * * @param ---Menu 7--- * @default * * @param Menu 7 Name * @desc This is the name for the menu command. This is an eval. To * make it a string, use 'quotes' around the name. * @default * * @param Menu 7 Symbol * @desc This is the symbol for the menu command. This needs to be * unique per menu command. * @default * * @param Menu 7 Show * @desc This is the eval condition for this menu command to appear. * @default * * @param Menu 7 Enabled * @desc Is this menu command enabled? This is an eval. * @default * * @param Menu 7 Ext * @desc This is the menu command's extension. This is an eval. * @default * * @param Menu 7 Main Bind * @desc This is the function activated by this menu command. * This is an eval. * @default * * @param Menu 7 Actor Bind * @desc If the menu command leads to selecting an actor, this is * the function activated after selecting an actor. * @default * * @param ---Menu 8--- * @default * * @param Menu 8 Name * @desc This is the name for the menu command. This is an eval. To * make it a string, use 'quotes' around the name. * @default * * @param Menu 8 Symbol * @desc This is the symbol for the menu command. This needs to be * unique per menu command. * @default * * @param Menu 8 Show * @desc This is the eval condition for this menu command to appear. * @default * * @param Menu 8 Enabled * @desc Is this menu command enabled? This is an eval. * @default * * @param Menu 8 Ext * @desc This is the menu command's extension. This is an eval. * @default * * @param Menu 8 Main Bind * @desc This is the function activated by this menu command. * This is an eval. * @default * * @param Menu 8 Actor Bind * @desc If the menu command leads to selecting an actor, this is * the function activated after selecting an actor. * @default * * @param ---Menu 9--- * @default * * @param Menu 9 Name * @desc This is the name for the menu command. This is an eval. To * make it a string, use 'quotes' around the name. * @default * * @param Menu 9 Symbol * @desc This is the symbol for the menu command. This needs to be * unique per menu command. * @default * * @param Menu 9 Show * @desc This is the eval condition for this menu command to appear. * @default * * @param Menu 9 Enabled * @desc Is this menu command enabled? This is an eval. * @default * * @param Menu 9 Ext * @desc This is the menu command's extension. This is an eval. * @default * * @param Menu 9 Main Bind * @desc This is the function activated by this menu command. * This is an eval. * @default * * @param Menu 9 Actor Bind * @desc If the menu command leads to selecting an actor, this is * the function activated after selecting an actor. * @default * * @param ---Menu 10--- * @default * * @param Menu 10 Name * @desc This is the name for the menu command. This is an eval. To * make it a string, use 'quotes' around the name. * @default TextManager.item * * @param Menu 10 Symbol * @desc This is the symbol for the menu command. This needs to be * unique per menu command. * @default item * * @param Menu 10 Show * @desc This is the eval condition for this menu command to appear. * @default this.needsCommand('item') * * @param Menu 10 Enabled * @desc Is this menu command enabled? This is an eval. * @default this.areMainCommandsEnabled() * * @param Menu 10 Ext * @desc This is the menu command's extension. This is an eval. * @default * * @param Menu 10 Main Bind * @desc This is the function activated by this menu command. * This is an eval. * @default this.commandItem.bind(this) * * @param Menu 10 Actor Bind * @desc If the menu command leads to selecting an actor, this is * the function activated after selecting an actor. * @default * * @param ---Menu 11--- * @default * * @param Menu 11 Name * @desc This is the name for the menu command. This is an eval. To * make it a string, use 'quotes' around the name. * @default * * @param Menu 11 Symbol * @desc This is the symbol for the menu command. This needs to be * unique per menu command. * @default * * @param Menu 11 Show * @desc This is the eval condition for this menu command to appear. * @default * * @param Menu 11 Enabled * @desc Is this menu command enabled? This is an eval. * @default * * @param Menu 11 Ext * @desc This is the menu command's extension. This is an eval. * @default * * @param Menu 11 Main Bind * @desc This is the function activated by this menu command. * This is an eval. * @default * * @param Menu 11 Actor Bind * @desc If the menu command leads to selecting an actor, this is * the function activated after selecting an actor. * @default * * @param ---Menu 12--- * @default * * @param Menu 12 Name * @desc This is the name for the menu command. This is an eval. To * make it a string, use 'quotes' around the name. * @default * * @param Menu 12 Symbol * @desc This is the symbol for the menu command. This needs to be * unique per menu command. * @default * * @param Menu 12 Show * @desc This is the eval condition for this menu command to appear. * @default * * @param Menu 12 Enabled * @desc Is this menu command enabled? This is an eval. * @default * * @param Menu 12 Ext * @desc This is the menu command's extension. This is an eval. * @default * * @param Menu 12 Main Bind * @desc This is the function activated by this menu command. * This is an eval. * @default * * @param Menu 12 Actor Bind * @desc If the menu command leads to selecting an actor, this is * the function activated after selecting an actor. * @default * * @param ---Menu 13--- * @default * * @param Menu 13 Name * @desc This is the name for the menu command. This is an eval. To * make it a string, use 'quotes' around the name. * @default * * @param Menu 13 Symbol * @desc This is the symbol for the menu command. This needs to be * unique per menu command. * @default * * @param Menu 13 Show * @desc This is the eval condition for this menu command to appear. * @default * * @param Menu 13 Enabled * @desc Is this menu command enabled? This is an eval. * @default * * @param Menu 13 Ext * @desc This is the menu command's extension. This is an eval. * @default * * @param Menu 13 Main Bind * @desc This is the function activated by this menu command. * This is an eval. * @default * * @param Menu 13 Actor Bind * @desc If the menu command leads to selecting an actor, this is * the function activated after selecting an actor. * @default * * @param ---Menu 14--- * @default * * @param Menu 14 Name * @desc This is the name for the menu command. This is an eval. To * make it a string, use 'quotes' around the name. * @default * * @param Menu 14 Symbol * @desc This is the symbol for the menu command. This needs to be * unique per menu command. * @default * * @param Menu 14 Show * @desc This is the eval condition for this menu command to appear. * @default * * @param Menu 14 Enabled * @desc Is this menu command enabled? This is an eval. * @default * * @param Menu 14 Ext * @desc This is the menu command's extension. This is an eval. * @default * * @param Menu 14 Main Bind * @desc This is the function activated by this menu command. * This is an eval. * @default * * @param Menu 14 Actor Bind * @desc If the menu command leads to selecting an actor, this is * the function activated after selecting an actor. * @default * * @param ---Menu 15--- * @default * * @param Menu 15 Name * @desc This is the name for the menu command. This is an eval. To * make it a string, use 'quotes' around the name. * @default TextManager.skill * * @param Menu 15 Symbol * @desc This is the symbol for the menu command. This needs to be * unique per menu command. * @default skill * * @param Menu 15 Show * @desc This is the eval condition for this menu command to appear. * @default this.needsCommand('skill') * * @param Menu 15 Enabled * @desc Is this menu command enabled? This is an eval. * @default this.areMainCommandsEnabled() * * @param Menu 15 Ext * @desc This is the menu command's extension. This is an eval. * @default * * @param Menu 15 Main Bind * @desc This is the function activated by this menu command. * This is an eval. * @default this.commandPersonal.bind(this) * * @param Menu 15 Actor Bind * @desc If the menu command leads to selecting an actor, this is * the function activated after selecting an actor. * @default SceneManager.push(Scene_Skill) * * @param ---Menu 16--- * @default * * @param Menu 16 Name * @desc This is the name for the menu command. This is an eval. To * make it a string, use 'quotes' around the name. * @default * * @param Menu 16 Symbol * @desc This is the symbol for the menu command. This needs to be * unique per menu command. * @default * * @param Menu 16 Show * @desc This is the eval condition for this menu command to appear. * @default * * @param Menu 16 Enabled * @desc Is this menu command enabled? This is an eval. * @default * * @param Menu 16 Ext * @desc This is the menu command's extension. This is an eval. * @default * * @param Menu 16 Main Bind * @desc This is the function activated by this menu command. * This is an eval. * @default * * @param Menu 16 Actor Bind * @desc If the menu command leads to selecting an actor, this is * the function activated after selecting an actor. * @default * * @param ---Menu 17--- * @default * * @param Menu 17 Name * @desc This is the name for the menu command. This is an eval. To * make it a string, use 'quotes' around the name. * @default * * @param Menu 17 Symbol * @desc This is the symbol for the menu command. This needs to be * unique per menu command. * @default * * @param Menu 17 Show * @desc This is the eval condition for this menu command to appear. * @default * * @param Menu 17 Enabled * @desc Is this menu command enabled? This is an eval. * @default * * @param Menu 17 Ext * @desc This is the menu command's extension. This is an eval. * @default * * @param Menu 17 Main Bind * @desc This is the function activated by this menu command. * This is an eval. * @default * * @param Menu 17 Actor Bind * @desc If the menu command leads to selecting an actor, this is * the function activated after selecting an actor. * @default * * @param ---Menu 18--- * @default * * @param Menu 18 Name * @desc This is the name for the menu command. This is an eval. To * make it a string, use 'quotes' around the name. * @default * * @param Menu 18 Symbol * @desc This is the symbol for the menu command. This needs to be * unique per menu command. * @default * * @param Menu 18 Show * @desc This is the eval condition for this menu command to appear. * @default * * @param Menu 18 Enabled * @desc Is this menu command enabled? This is an eval. * @default * * @param Menu 18 Ext * @desc This is the menu command's extension. This is an eval. * @default * * @param Menu 18 Main Bind * @desc This is the function activated by this menu command. * This is an eval. * @default * * @param Menu 18 Actor Bind * @desc If the menu command leads to selecting an actor, this is * the function activated after selecting an actor. * @default * * @param ---Menu 19--- * @default * * @param Menu 19 Name * @desc This is the name for the menu command. This is an eval. To * make it a string, use 'quotes' around the name. * @default * * @param Menu 19 Symbol * @desc This is the symbol for the menu command. This needs to be * unique per menu command. * @default * * @param Menu 19 Show * @desc This is the eval condition for this menu command to appear. * @default * * @param Menu 19 Enabled * @desc Is this menu command enabled? This is an eval. * @default * * @param Menu 19 Ext * @desc This is the menu command's extension. This is an eval. * @default * * @param Menu 19 Main Bind * @desc This is the function activated by this menu command. * This is an eval. * @default * * @param Menu 19 Actor Bind * @desc If the menu command leads to selecting an actor, this is * the function activated after selecting an actor. * @default * * @param ---Menu 20--- * @default * * @param Menu 20 Name * @desc This is the name for the menu command. This is an eval. To * make it a string, use 'quotes' around the name. * @default TextManager.equip * * @param Menu 20 Symbol * @desc This is the symbol for the menu command. This needs to be * unique per menu command. * @default equip * * @param Menu 20 Show * @desc This is the eval condition for this menu command to appear. * @default this.needsCommand('equip') * * @param Menu 20 Enabled * @desc Is this menu command enabled? This is an eval. * @default this.areMainCommandsEnabled() * * @param Menu 20 Ext * @desc This is the menu command's extension. This is an eval. * @default * * @param Menu 20 Main Bind * @desc This is the function activated by this menu command. * This is an eval. * @default this.commandPersonal.bind(this) * * @param Menu 20 Actor Bind * @desc If the menu command leads to selecting an actor, this is * the function activated after selecting an actor. * @default SceneManager.push(Scene_Equip) * * @param ---Menu 21--- * @default * * @param Menu 21 Name * @desc This is the name for the menu command. This is an eval. To * make it a string, use 'quotes' around the name. * @default * * @param Menu 21 Symbol * @desc This is the symbol for the menu command. This needs to be * unique per menu command. * @default * * @param Menu 21 Show * @desc This is the eval condition for this menu command to appear. * @default * * @param Menu 21 Enabled * @desc Is this menu command enabled? This is an eval. * @default * * @param Menu 21 Ext * @desc This is the menu command's extension. This is an eval. * @default * * @param Menu 21 Main Bind * @desc This is the function activated by this menu command. * This is an eval. * @default * * @param Menu 21 Actor Bind * @desc If the menu command leads to selecting an actor, this is * the function activated after selecting an actor. * @default * * @param ---Menu 22--- * @default * * @param Menu 22 Name * @desc This is the name for the menu command. This is an eval. To * make it a string, use 'quotes' around the name. * @default * * @param Menu 22 Symbol * @desc This is the symbol for the menu command. This needs to be * unique per menu command. * @default * * @param Menu 22 Show * @desc This is the eval condition for this menu command to appear. * @default * * @param Menu 22 Enabled * @desc Is this menu command enabled? This is an eval. * @default * * @param Menu 22 Ext * @desc This is the menu command's extension. This is an eval. * @default * * @param Menu 22 Main Bind * @desc This is the function activated by this menu command. * This is an eval. * @default * * @param Menu 22 Actor Bind * @desc If the menu command leads to selecting an actor, this is * the function activated after selecting an actor. * @default * * @param ---Menu 23--- * @default * * @param Menu 23 Name * @desc This is the name for the menu command. This is an eval. To * make it a string, use 'quotes' around the name. * @default * * @param Menu 23 Symbol * @desc This is the symbol for the menu command. This needs to be * unique per menu command. * @default * * @param Menu 23 Show * @desc This is the eval condition for this menu command to appear. * @default * * @param Menu 23 Enabled * @desc Is this menu command enabled? This is an eval. * @default * * @param Menu 23 Ext * @desc This is the menu command's extension. This is an eval. * @default * * @param Menu 23 Main Bind * @desc This is the function activated by this menu command. * This is an eval. * @default * * @param Menu 23 Actor Bind * @desc If the menu command leads to selecting an actor, this is * the function activated after selecting an actor. * @default * * @param ---Menu 24--- * @default * * @param Menu 24 Name * @desc This is the name for the menu command. This is an eval. To * make it a string, use 'quotes' around the name. * @default * * @param Menu 24 Symbol * @desc This is the symbol for the menu command. This needs to be * unique per menu command. * @default * * @param Menu 24 Show * @desc This is the eval condition for this menu command to appear. * @default * * @param Menu 24 Enabled * @desc Is this menu command enabled? This is an eval. * @default * * @param Menu 24 Ext * @desc This is the menu command's extension. This is an eval. * @default * * @param Menu 24 Main Bind * @desc This is the function activated by this menu command. * This is an eval. * @default * * @param Menu 24 Actor Bind * @desc If the menu command leads to selecting an actor, this is * the function activated after selecting an actor. * @default * * @param ---Menu 25--- * @default * * @param Menu 25 Name * @desc This is the name for the menu command. This is an eval. To * make it a string, use 'quotes' around the name. * @default Yanfly.Param.CCCCmdName * * @param Menu 25 Symbol * @desc This is the symbol for the menu command. This needs to be * unique per menu command. * @default class * * @param Menu 25 Show * @desc This is the eval condition for this menu command to appear. * @default Imported.YEP_ClassChangeCore && $gameSystem.isShowClass() * * @param Menu 25 Enabled * @desc Is this menu command enabled? This is an eval. * @default $gameSystem.isEnableClass() && this.areMainCommandsEnabled() * * @param Menu 25 Ext * @desc This is the menu command's extension. This is an eval. * @default * * @param Menu 25 Main Bind * @desc This is the function activated by this menu command. * This is an eval. * @default this.commandPersonal.bind(this) * * @param Menu 25 Actor Bind * @desc If the menu command leads to selecting an actor, this is * the function activated after selecting an actor. * @default SceneManager.push(Scene_Class) * * @param ---Menu 26--- * @default * * @param Menu 26 Name * @desc This is the name for the menu command. This is an eval. To * make it a string, use 'quotes' around the name. * @default * * @param Menu 26 Symbol * @desc This is the symbol for the menu command. This needs to be * unique per menu command. * @default * * @param Menu 26 Show * @desc This is the eval condition for this menu command to appear. * @default * * @param Menu 26 Enabled * @desc Is this menu command enabled? This is an eval. * @default * * @param Menu 26 Ext * @desc This is the menu command's extension. This is an eval. * @default * * @param Menu 26 Main Bind * @desc This is the function activated by this menu command. * This is an eval. * @default * * @param Menu 26 Actor Bind * @desc If the menu command leads to selecting an actor, this is * the function activated after selecting an actor. * @default * * @param ---Menu 27--- * @default * * @param Menu 27 Name * @desc This is the name for the menu command. This is an eval. To * make it a string, use 'quotes' around the name. * @default * * @param Menu 27 Symbol * @desc This is the symbol for the menu command. This needs to be * unique per menu command. * @default * * @param Menu 27 Show * @desc This is the eval condition for this menu command to appear. * @default * * @param Menu 27 Enabled * @desc Is this menu command enabled? This is an eval. * @default * * @param Menu 27 Ext * @desc This is the menu command's extension. This is an eval. * @default * * @param Menu 27 Main Bind * @desc This is the function activated by this menu command. * This is an eval. * @default * * @param Menu 27 Actor Bind * @desc If the menu command leads to selecting an actor, this is * the function activated after selecting an actor. * @default * * @param ---Menu 28--- * @default * * @param Menu 28 Name * @desc This is the name for the menu command. This is an eval. To * make it a string, use 'quotes' around the name. * @default * * @param Menu 28 Symbol * @desc This is the symbol for the menu command. This needs to be * unique per menu command. * @default * * @param Menu 28 Show * @desc This is the eval condition for this menu command to appear. * @default * * @param Menu 28 Enabled * @desc Is this menu command enabled? This is an eval. * @default * * @param Menu 28 Ext * @desc This is the menu command's extension. This is an eval. * @default * * @param Menu 28 Main Bind * @desc This is the function activated by this menu command. * This is an eval. * @default * * @param Menu 28 Actor Bind * @desc If the menu command leads to selecting an actor, this is * the function activated after selecting an actor. * @default * * @param ---Menu 29--- * @default * * @param Menu 29 Name * @desc This is the name for the menu command. This is an eval. To * make it a string, use 'quotes' around the name. * @default * * @param Menu 29 Symbol * @desc This is the symbol for the menu command. This needs to be * unique per menu command. * @default * * @param Menu 29 Show * @desc This is the eval condition for this menu command to appear. * @default * * @param Menu 29 Enabled * @desc Is this menu command enabled? This is an eval. * @default * * @param Menu 29 Ext * @desc This is the menu command's extension. This is an eval. * @default * * @param Menu 29 Main Bind * @desc This is the function activated by this menu command. * This is an eval. * @default * * @param Menu 29 Actor Bind * @desc If the menu command leads to selecting an actor, this is * the function activated after selecting an actor. * @default * * @param ---Menu 30--- * @default * * @param Menu 30 Name * @desc This is the name for the menu command. This is an eval. To * make it a string, use 'quotes' around the name. * @default * * @param Menu 30 Symbol * @desc This is the symbol for the menu command. This needs to be * unique per menu command. * @default * * @param Menu 30 Show * @desc This is the eval condition for this menu command to appear. * @default * * @param Menu 30 Enabled * @desc Is this menu command enabled? This is an eval. * @default * * @param Menu 30 Ext * @desc This is the menu command's extension. This is an eval. * @default * * @param Menu 30 Main Bind * @desc This is the function activated by this menu command. * This is an eval. * @default * * @param Menu 30 Actor Bind * @desc If the menu command leads to selecting an actor, this is * the function activated after selecting an actor. * @default * * @param ---Menu 31--- * @default * * @param Menu 31 Name * @desc This is the name for the menu command. This is an eval. To * make it a string, use 'quotes' around the name. * @default * * @param Menu 31 Symbol * @desc This is the symbol for the menu command. This needs to be * unique per menu command. * @default * * @param Menu 31 Show * @desc This is the eval condition for this menu command to appear. * @default * * @param Menu 31 Enabled * @desc Is this menu command enabled? This is an eval. * @default * * @param Menu 31 Ext * @desc This is the menu command's extension. This is an eval. * @default * * @param Menu 31 Main Bind * @desc This is the function activated by this menu command. * This is an eval. * @default * * @param Menu 31 Actor Bind * @desc If the menu command leads to selecting an actor, this is * the function activated after selecting an actor. * @default * * @param ---Menu 32--- * @default * * @param Menu 32 Name * @desc This is the name for the menu command. This is an eval. To * make it a string, use 'quotes' around the name. * @default * * @param Menu 32 Symbol * @desc This is the symbol for the menu command. This needs to be * unique per menu command. * @default * * @param Menu 32 Show * @desc This is the eval condition for this menu command to appear. * @default * * @param Menu 32 Enabled * @desc Is this menu command enabled? This is an eval. * @default * * @param Menu 32 Ext * @desc This is the menu command's extension. This is an eval. * @default * * @param Menu 32 Main Bind * @desc This is the function activated by this menu command. * This is an eval. * @default * * @param Menu 32 Actor Bind * @desc If the menu command leads to selecting an actor, this is * the function activated after selecting an actor. * @default * * @param ---Menu 33--- * @default * * @param Menu 33 Name * @desc This is the name for the menu command. This is an eval. To * make it a string, use 'quotes' around the name. * @default * * @param Menu 33 Symbol * @desc This is the symbol for the menu command. This needs to be * unique per menu command. * @default * * @param Menu 33 Show * @desc This is the eval condition for this menu command to appear. * @default * * @param Menu 33 Enabled * @desc Is this menu command enabled? This is an eval. * @default * * @param Menu 33 Ext * @desc This is the menu command's extension. This is an eval. * @default * * @param Menu 33 Main Bind * @desc This is the function activated by this menu command. * This is an eval. * @default * * @param Menu 33 Actor Bind * @desc If the menu command leads to selecting an actor, this is * the function activated after selecting an actor. * @default * * @param ---Menu 34--- * @default * * @param Menu 34 Name * @desc This is the name for the menu command. This is an eval. To * make it a string, use 'quotes' around the name. * @default * * @param Menu 34 Symbol * @desc This is the symbol for the menu command. This needs to be * unique per menu command. * @default * * @param Menu 34 Show * @desc This is the eval condition for this menu command to appear. * @default * * @param Menu 34 Enabled * @desc Is this menu command enabled? This is an eval. * @default * * @param Menu 34 Ext * @desc This is the menu command's extension. This is an eval. * @default * * @param Menu 34 Main Bind * @desc This is the function activated by this menu command. * This is an eval. * @default * * @param Menu 34 Actor Bind * @desc If the menu command leads to selecting an actor, this is * the function activated after selecting an actor. * @default * * @param ---Menu 35--- * @default * * @param Menu 35 Name * @desc This is the name for the menu command. This is an eval. To * make it a string, use 'quotes' around the name. * @default * * @param Menu 35 Symbol * @desc This is the symbol for the menu command. This needs to be * unique per menu command. * @default * * @param Menu 35 Show * @desc This is the eval condition for this menu command to appear. * @default * * @param Menu 35 Enabled * @desc Is this menu command enabled? This is an eval. * @default * * @param Menu 35 Ext * @desc This is the menu command's extension. This is an eval. * @default * * @param Menu 35 Main Bind * @desc This is the function activated by this menu command. * This is an eval. * @default * * @param Menu 35 Actor Bind * @desc If the menu command leads to selecting an actor, this is * the function activated after selecting an actor. * @default * * @param ---Menu 36--- * @default * * @param Menu 36 Name * @desc This is the name for the menu command. This is an eval. To * make it a string, use 'quotes' around the name. * @default * * @param Menu 36 Symbol * @desc This is the symbol for the menu command. This needs to be * unique per menu command. * @default * * @param Menu 36 Show * @desc This is the eval condition for this menu command to appear. * @default * * @param Menu 36 Enabled * @desc Is this menu command enabled? This is an eval. * @default * * @param Menu 36 Ext * @desc This is the menu command's extension. This is an eval. * @default * * @param Menu 36 Main Bind * @desc This is the function activated by this menu command. * This is an eval. * @default * * @param Menu 36 Actor Bind * @desc If the menu command leads to selecting an actor, this is * the function activated after selecting an actor. * @default * * @param ---Menu 37--- * @default * * @param Menu 37 Name * @desc This is the name for the menu command. This is an eval. To * make it a string, use 'quotes' around the name. * @default * * @param Menu 37 Symbol * @desc This is the symbol for the menu command. This needs to be * unique per menu command. * @default * * @param Menu 37 Show * @desc This is the eval condition for this menu command to appear. * @default * * @param Menu 37 Enabled * @desc Is this menu command enabled? This is an eval. * @default * * @param Menu 37 Ext * @desc This is the menu command's extension. This is an eval. * @default * * @param Menu 37 Main Bind * @desc This is the function activated by this menu command. * This is an eval. * @default * * @param Menu 37 Actor Bind * @desc If the menu command leads to selecting an actor, this is * the function activated after selecting an actor. * @default * * @param ---Menu 38--- * @default * * @param Menu 38 Name * @desc This is the name for the menu command. This is an eval. To * make it a string, use 'quotes' around the name. * @default * * @param Menu 38 Symbol * @desc This is the symbol for the menu command. This needs to be * unique per menu command. * @default * * @param Menu 38 Show * @desc This is the eval condition for this menu command to appear. * @default * * @param Menu 38 Enabled * @desc Is this menu command enabled? This is an eval. * @default * * @param Menu 38 Ext * @desc This is the menu command's extension. This is an eval. * @default * * @param Menu 38 Main Bind * @desc This is the function activated by this menu command. * This is an eval. * @default * * @param Menu 38 Actor Bind * @desc If the menu command leads to selecting an actor, this is * the function activated after selecting an actor. * @default * * @param ---Menu 39--- * @default * * @param Menu 39 Name * @desc This is the name for the menu command. This is an eval. To * make it a string, use 'quotes' around the name. * @default * * @param Menu 39 Symbol * @desc This is the symbol for the menu command. This needs to be * unique per menu command. * @default * * @param Menu 39 Show * @desc This is the eval condition for this menu command to appear. * @default * * @param Menu 39 Enabled * @desc Is this menu command enabled? This is an eval. * @default * * @param Menu 39 Ext * @desc This is the menu command's extension. This is an eval. * @default * * @param Menu 39 Main Bind * @desc This is the function activated by this menu command. * This is an eval. * @default * * @param Menu 39 Actor Bind * @desc If the menu command leads to selecting an actor, this is * the function activated after selecting an actor. * @default * * @param ---Menu 40--- * @default * * @param Menu 40 Name * @desc This is the name for the menu command. This is an eval. To * make it a string, use 'quotes' around the name. * @default * * @param Menu 40 Symbol * @desc This is the symbol for the menu command. This needs to be * unique per menu command. * @default * * @param Menu 40 Show * @desc This is the eval condition for this menu command to appear. * @default * * @param Menu 40 Enabled * @desc Is this menu command enabled? This is an eval. * @default * * @param Menu 40 Ext * @desc This is the menu command's extension. This is an eval. * @default * * @param Menu 40 Main Bind * @desc This is the function activated by this menu command. * This is an eval. * @default * * @param Menu 40 Actor Bind * @desc If the menu command leads to selecting an actor, this is * the function activated after selecting an actor. * @default * * @param ---Menu 41--- * @default * * @param Menu 41 Name * @desc This is the name for the menu command. This is an eval. To * make it a string, use 'quotes' around the name. * @default * * @param Menu 41 Symbol * @desc This is the symbol for the menu command. This needs to be * unique per menu command. * @default * * @param Menu 41 Show * @desc This is the eval condition for this menu command to appear. * @default * * @param Menu 41 Enabled * @desc Is this menu command enabled? This is an eval. * @default * * @param Menu 41 Ext * @desc This is the menu command's extension. This is an eval. * @default * * @param Menu 41 Main Bind * @desc This is the function activated by this menu command. * This is an eval. * @default * * @param Menu 41 Actor Bind * @desc If the menu command leads to selecting an actor, this is * the function activated after selecting an actor. * @default * * @param ---Menu 42--- * @default * * @param Menu 42 Name * @desc This is the name for the menu command. This is an eval. To * make it a string, use 'quotes' around the name. * @default * * @param Menu 42 Symbol * @desc This is the symbol for the menu command. This needs to be * unique per menu command. * @default * * @param Menu 42 Show * @desc This is the eval condition for this menu command to appear. * @default * * @param Menu 42 Enabled * @desc Is this menu command enabled? This is an eval. * @default * * @param Menu 42 Ext * @desc This is the menu command's extension. This is an eval. * @default * * @param Menu 42 Main Bind * @desc This is the function activated by this menu command. * This is an eval. * @default * * @param Menu 42 Actor Bind * @desc If the menu command leads to selecting an actor, this is * the function activated after selecting an actor. * @default * * @param ---Menu 43--- * @default * * @param Menu 43 Name * @desc This is the name for the menu command. This is an eval. To * make it a string, use 'quotes' around the name. * @default * * @param Menu 43 Symbol * @desc This is the symbol for the menu command. This needs to be * unique per menu command. * @default * * @param Menu 43 Show * @desc This is the eval condition for this menu command to appear. * @default * * @param Menu 43 Enabled * @desc Is this menu command enabled? This is an eval. * @default * * @param Menu 43 Ext * @desc This is the menu command's extension. This is an eval. * @default * * @param Menu 43 Main Bind * @desc This is the function activated by this menu command. * This is an eval. * @default * * @param Menu 43 Actor Bind * @desc If the menu command leads to selecting an actor, this is * the function activated after selecting an actor. * @default * * @param ---Menu 44--- * @default * * @param Menu 44 Name * @desc This is the name for the menu command. This is an eval. To * make it a string, use 'quotes' around the name. * @default * * @param Menu 44 Symbol * @desc This is the symbol for the menu command. This needs to be * unique per menu command. * @default * * @param Menu 44 Show * @desc This is the eval condition for this menu command to appear. * @default * * @param Menu 44 Enabled * @desc Is this menu command enabled? This is an eval. * @default * * @param Menu 44 Ext * @desc This is the menu command's extension. This is an eval. * @default * * @param Menu 44 Main Bind * @desc This is the function activated by this menu command. * This is an eval. * @default * * @param Menu 44 Actor Bind * @desc If the menu command leads to selecting an actor, this is * the function activated after selecting an actor. * @default * * @param ---Menu 45--- * @default * * @param Menu 45 Name * @desc This is the name for the menu command. This is an eval. To * make it a string, use 'quotes' around the name. * @default * * @param Menu 45 Symbol * @desc This is the symbol for the menu command. This needs to be * unique per menu command. * @default * * @param Menu 45 Show * @desc This is the eval condition for this menu command to appear. * @default * * @param Menu 45 Enabled * @desc Is this menu command enabled? This is an eval. * @default * * @param Menu 45 Ext * @desc This is the menu command's extension. This is an eval. * @default * * @param Menu 45 Main Bind * @desc This is the function activated by this menu command. * This is an eval. * @default * * @param Menu 45 Actor Bind * @desc If the menu command leads to selecting an actor, this is * the function activated after selecting an actor. * @default * * @param ---Menu 46--- * @default * * @param Menu 46 Name * @desc This is the name for the menu command. This is an eval. To * make it a string, use 'quotes' around the name. * @default * * @param Menu 46 Symbol * @desc This is the symbol for the menu command. This needs to be * unique per menu command. * @default * * @param Menu 46 Show * @desc This is the eval condition for this menu command to appear. * @default * * @param Menu 46 Enabled * @desc Is this menu command enabled? This is an eval. * @default * * @param Menu 46 Ext * @desc This is the menu command's extension. This is an eval. * @default * * @param Menu 46 Main Bind * @desc This is the function activated by this menu command. * This is an eval. * @default * * @param Menu 46 Actor Bind * @desc If the menu command leads to selecting an actor, this is * the function activated after selecting an actor. * @default * * @param ---Menu 47--- * @default * * @param Menu 47 Name * @desc This is the name for the menu command. This is an eval. To * make it a string, use 'quotes' around the name. * @default * * @param Menu 47 Symbol * @desc This is the symbol for the menu command. This needs to be * unique per menu command. * @default * * @param Menu 47 Show * @desc This is the eval condition for this menu command to appear. * @default * * @param Menu 47 Enabled * @desc Is this menu command enabled? This is an eval. * @default * * @param Menu 47 Ext * @desc This is the menu command's extension. This is an eval. * @default * * @param Menu 47 Main Bind * @desc This is the function activated by this menu command. * This is an eval. * @default * * @param Menu 47 Actor Bind * @desc If the menu command leads to selecting an actor, this is * the function activated after selecting an actor. * @default * * @param ---Menu 48--- * @default * * @param Menu 48 Name * @desc This is the name for the menu command. This is an eval. To * make it a string, use 'quotes' around the name. * @default * * @param Menu 48 Symbol * @desc This is the symbol for the menu command. This needs to be * unique per menu command. * @default * * @param Menu 48 Show * @desc This is the eval condition for this menu command to appear. * @default * * @param Menu 48 Enabled * @desc Is this menu command enabled? This is an eval. * @default * * @param Menu 48 Ext * @desc This is the menu command's extension. This is an eval. * @default * * @param Menu 48 Main Bind * @desc This is the function activated by this menu command. * This is an eval. * @default * * @param Menu 48 Actor Bind * @desc If the menu command leads to selecting an actor, this is * the function activated after selecting an actor. * @default * * @param ---Menu 49--- * @default * * @param Menu 49 Name * @desc This is the name for the menu command. This is an eval. To * make it a string, use 'quotes' around the name. * @default * * @param Menu 49 Symbol * @desc This is the symbol for the menu command. This needs to be * unique per menu command. * @default * * @param Menu 49 Show * @desc This is the eval condition for this menu command to appear. * @default * * @param Menu 49 Enabled * @desc Is this menu command enabled? This is an eval. * @default * * @param Menu 49 Ext * @desc This is the menu command's extension. This is an eval. * @default * * @param Menu 49 Main Bind * @desc This is the function activated by this menu command. * This is an eval. * @default * * @param Menu 49 Actor Bind * @desc If the menu command leads to selecting an actor, this is * the function activated after selecting an actor. * @default * * @param ---Menu 50--- * @default * * @param Menu 50 Name * @desc This is the name for the menu command. This is an eval. To * make it a string, use 'quotes' around the name. * @default TextManager.status * * @param Menu 50 Symbol * @desc This is the symbol for the menu command. This needs to be * unique per menu command. * @default status * * @param Menu 50 Show * @desc This is the eval condition for this menu command to appear. * @default this.needsCommand('status') * * @param Menu 50 Enabled * @desc Is this menu command enabled? This is an eval. * @default this.areMainCommandsEnabled() * * @param Menu 50 Ext * @desc This is the menu command's extension. This is an eval. * @default * * @param Menu 50 Main Bind * @desc This is the function activated by this menu command. * This is an eval. * @default this.commandPersonal.bind(this) * * @param Menu 50 Actor Bind * @desc If the menu command leads to selecting an actor, this is * the function activated after selecting an actor. * @default SceneManager.push(Scene_Status) * * @param ---Menu 51--- * @default * * @param Menu 51 Name * @desc This is the name for the menu command. This is an eval. To * make it a string, use 'quotes' around the name. * @default * * @param Menu 51 Symbol * @desc This is the symbol for the menu command. This needs to be * unique per menu command. * @default * * @param Menu 51 Show * @desc This is the eval condition for this menu command to appear. * @default * * @param Menu 51 Enabled * @desc Is this menu command enabled? This is an eval. * @default * * @param Menu 51 Ext * @desc This is the menu command's extension. This is an eval. * @default * * @param Menu 51 Main Bind * @desc This is the function activated by this menu command. * This is an eval. * @default * * @param Menu 51 Actor Bind * @desc If the menu command leads to selecting an actor, this is * the function activated after selecting an actor. * @default * * @param ---Menu 52--- * @default * * @param Menu 52 Name * @desc This is the name for the menu command. This is an eval. To * make it a string, use 'quotes' around the name. * @default * * @param Menu 52 Symbol * @desc This is the symbol for the menu command. This needs to be * unique per menu command. * @default * * @param Menu 52 Show * @desc This is the eval condition for this menu command to appear. * @default * * @param Menu 52 Enabled * @desc Is this menu command enabled? This is an eval. * @default * * @param Menu 52 Ext * @desc This is the menu command's extension. This is an eval. * @default * * @param Menu 52 Main Bind * @desc This is the function activated by this menu command. * This is an eval. * @default * * @param Menu 52 Actor Bind * @desc If the menu command leads to selecting an actor, this is * the function activated after selecting an actor. * @default * * @param ---Menu 53--- * @default * * @param Menu 53 Name * @desc This is the name for the menu command. This is an eval. To * make it a string, use 'quotes' around the name. * @default * * @param Menu 53 Symbol * @desc This is the symbol for the menu command. This needs to be * unique per menu command. * @default * * @param Menu 53 Show * @desc This is the eval condition for this menu command to appear. * @default * * @param Menu 53 Enabled * @desc Is this menu command enabled? This is an eval. * @default * * @param Menu 53 Ext * @desc This is the menu command's extension. This is an eval. * @default * * @param Menu 53 Main Bind * @desc This is the function activated by this menu command. * This is an eval. * @default * * @param Menu 53 Actor Bind * @desc If the menu command leads to selecting an actor, this is * the function activated after selecting an actor. * @default * * @param ---Menu 54--- * @default * * @param Menu 54 Name * @desc This is the name for the menu command. This is an eval. To * make it a string, use 'quotes' around the name. * @default * * @param Menu 54 Symbol * @desc This is the symbol for the menu command. This needs to be * unique per menu command. * @default * * @param Menu 54 Show * @desc This is the eval condition for this menu command to appear. * @default * * @param Menu 54 Enabled * @desc Is this menu command enabled? This is an eval. * @default * * @param Menu 54 Ext * @desc This is the menu command's extension. This is an eval. * @default * * @param Menu 54 Main Bind * @desc This is the function activated by this menu command. * This is an eval. * @default * * @param Menu 54 Actor Bind * @desc If the menu command leads to selecting an actor, this is * the function activated after selecting an actor. * @default * * @param ---Menu 55--- * @default * * @param Menu 55 Name * @desc This is the name for the menu command. This is an eval. To * make it a string, use 'quotes' around the name. * @default TextManager.formation * * @param Menu 55 Symbol * @desc This is the symbol for the menu command. This needs to be * unique per menu command. * @default formation * * @param Menu 55 Show * @desc This is the eval condition for this menu command to appear. * @default this.needsCommand('formation') * * @param Menu 55 Enabled * @desc Is this menu command enabled? This is an eval. * @default this.isFormationEnabled() * * @param Menu 55 Ext * @desc This is the menu command's extension. This is an eval. * @default * * @param Menu 55 Main Bind * @desc This is the function activated by this menu command. * This is an eval. * @default this.commandFormation.bind(this) * * @param Menu 55 Actor Bind * @desc If the menu command leads to selecting an actor, this is * the function activated after selecting an actor. * @default * * @param ---Menu 56--- * @default * * @param Menu 56 Name * @desc This is the name for the menu command. This is an eval. To * make it a string, use 'quotes' around the name. * @default * * @param Menu 56 Symbol * @desc This is the symbol for the menu command. This needs to be * unique per menu command. * @default * * @param Menu 56 Show * @desc This is the eval condition for this menu command to appear. * @default * * @param Menu 56 Enabled * @desc Is this menu command enabled? This is an eval. * @default * * @param Menu 56 Ext * @desc This is the menu command's extension. This is an eval. * @default * * @param Menu 56 Main Bind * @desc This is the function activated by this menu command. * This is an eval. * @default * * @param Menu 56 Actor Bind * @desc If the menu command leads to selecting an actor, this is * the function activated after selecting an actor. * @default * * @param ---Menu 57--- * @default * * @param Menu 57 Name * @desc This is the name for the menu command. This is an eval. To * make it a string, use 'quotes' around the name. * @default * * @param Menu 57 Symbol * @desc This is the symbol for the menu command. This needs to be * unique per menu command. * @default * * @param Menu 57 Show * @desc This is the eval condition for this menu command to appear. * @default * * @param Menu 57 Enabled * @desc Is this menu command enabled? This is an eval. * @default * * @param Menu 57 Ext * @desc This is the menu command's extension. This is an eval. * @default * * @param Menu 57 Main Bind * @desc This is the function activated by this menu command. * This is an eval. * @default * * @param Menu 57 Actor Bind * @desc If the menu command leads to selecting an actor, this is * the function activated after selecting an actor. * @default * * @param ---Menu 58--- * @default * * @param Menu 58 Name * @desc This is the name for the menu command. This is an eval. To * make it a string, use 'quotes' around the name. * @default * * @param Menu 58 Symbol * @desc This is the symbol for the menu command. This needs to be * unique per menu command. * @default * * @param Menu 58 Show * @desc This is the eval condition for this menu command to appear. * @default * * @param Menu 58 Enabled * @desc Is this menu command enabled? This is an eval. * @default * * @param Menu 58 Ext * @desc This is the menu command's extension. This is an eval. * @default * * @param Menu 58 Main Bind * @desc This is the function activated by this menu command. * This is an eval. * @default * * @param Menu 58 Actor Bind * @desc If the menu command leads to selecting an actor, this is * the function activated after selecting an actor. * @default * * @param ---Menu 59--- * @default * * @param Menu 59 Name * @desc This is the name for the menu command. This is an eval. To * make it a string, use 'quotes' around the name. * @default * * @param Menu 59 Symbol * @desc This is the symbol for the menu command. This needs to be * unique per menu command. * @default * * @param Menu 59 Show * @desc This is the eval condition for this menu command to appear. * @default * * @param Menu 59 Enabled * @desc Is this menu command enabled? This is an eval. * @default * * @param Menu 59 Ext * @desc This is the menu command's extension. This is an eval. * @default * * @param Menu 59 Main Bind * @desc This is the function activated by this menu command. * This is an eval. * @default * * @param Menu 59 Actor Bind * @desc If the menu command leads to selecting an actor, this is * the function activated after selecting an actor. * @default * * @param ---Menu 60--- * @default * * @param Menu 60 Name * @desc This is the name for the menu command. This is an eval. To * make it a string, use 'quotes' around the name. * @default * * @param Menu 60 Symbol * @desc This is the symbol for the menu command. This needs to be * unique per menu command. * @default * * @param Menu 60 Show * @desc This is the eval condition for this menu command to appear. * @default * * @param Menu 60 Enabled * @desc Is this menu command enabled? This is an eval. * @default * * @param Menu 60 Ext * @desc This is the menu command's extension. This is an eval. * @default * * @param Menu 60 Main Bind * @desc This is the function activated by this menu command. * This is an eval. * @default * * @param Menu 60 Actor Bind * @desc If the menu command leads to selecting an actor, this is * the function activated after selecting an actor. * @default * * @param ---Menu 61--- * @default * * @param Menu 61 Name * @desc This is the name for the menu command. This is an eval. To * make it a string, use 'quotes' around the name. * @default * * @param Menu 61 Symbol * @desc This is the symbol for the menu command. This needs to be * unique per menu command. * @default * * @param Menu 61 Show * @desc This is the eval condition for this menu command to appear. * @default * * @param Menu 61 Enabled * @desc Is this menu command enabled? This is an eval. * @default * * @param Menu 61 Ext * @desc This is the menu command's extension. This is an eval. * @default * * @param Menu 61 Main Bind * @desc This is the function activated by this menu command. * This is an eval. * @default * * @param Menu 61 Actor Bind * @desc If the menu command leads to selecting an actor, this is * the function activated after selecting an actor. * @default * * @param ---Menu 62--- * @default * * @param Menu 62 Name * @desc This is the name for the menu command. This is an eval. To * make it a string, use 'quotes' around the name. * @default * * @param Menu 62 Symbol * @desc This is the symbol for the menu command. This needs to be * unique per menu command. * @default * * @param Menu 62 Show * @desc This is the eval condition for this menu command to appear. * @default * * @param Menu 62 Enabled * @desc Is this menu command enabled? This is an eval. * @default * * @param Menu 62 Ext * @desc This is the menu command's extension. This is an eval. * @default * * @param Menu 62 Main Bind * @desc This is the function activated by this menu command. * This is an eval. * @default * * @param Menu 62 Actor Bind * @desc If the menu command leads to selecting an actor, this is * the function activated after selecting an actor. * @default * * @param ---Menu 63--- * @default * * @param Menu 63 Name * @desc This is the name for the menu command. This is an eval. To * make it a string, use 'quotes' around the name. * @default * * @param Menu 63 Symbol * @desc This is the symbol for the menu command. This needs to be * unique per menu command. * @default * * @param Menu 63 Show * @desc This is the eval condition for this menu command to appear. * @default * * @param Menu 63 Enabled * @desc Is this menu command enabled? This is an eval. * @default * * @param Menu 63 Ext * @desc This is the menu command's extension. This is an eval. * @default * * @param Menu 63 Main Bind * @desc This is the function activated by this menu command. * This is an eval. * @default * * @param Menu 63 Actor Bind * @desc If the menu command leads to selecting an actor, this is * the function activated after selecting an actor. * @default * * @param ---Menu 64--- * @default * * @param Menu 64 Name * @desc This is the name for the menu command. This is an eval. To * make it a string, use 'quotes' around the name. * @default * * @param Menu 64 Symbol * @desc This is the symbol for the menu command. This needs to be * unique per menu command. * @default * * @param Menu 64 Show * @desc This is the eval condition for this menu command to appear. * @default * * @param Menu 64 Enabled * @desc Is this menu command enabled? This is an eval. * @default * * @param Menu 64 Ext * @desc This is the menu command's extension. This is an eval. * @default * * @param Menu 64 Main Bind * @desc This is the function activated by this menu command. * This is an eval. * @default * * @param Menu 64 Actor Bind * @desc If the menu command leads to selecting an actor, this is * the function activated after selecting an actor. * @default * * @param ---Menu 65--- * @default * * @param Menu 65 Name * @desc This is the name for the menu command. This is an eval. To * make it a string, use 'quotes' around the name. * @default * * @param Menu 65 Symbol * @desc This is the symbol for the menu command. This needs to be * unique per menu command. * @default * * @param Menu 65 Show * @desc This is the eval condition for this menu command to appear. * @default * * @param Menu 65 Enabled * @desc Is this menu command enabled? This is an eval. * @default * * @param Menu 65 Ext * @desc This is the menu command's extension. This is an eval. * @default * * @param Menu 65 Main Bind * @desc This is the function activated by this menu command. * This is an eval. * @default * * @param Menu 65 Actor Bind * @desc If the menu command leads to selecting an actor, this is * the function activated after selecting an actor. * @default * * @param ---Menu 66--- * @default * * @param Menu 66 Name * @desc This is the name for the menu command. This is an eval. To * make it a string, use 'quotes' around the name. * @default * * @param Menu 66 Symbol * @desc This is the symbol for the menu command. This needs to be * unique per menu command. * @default * * @param Menu 66 Show * @desc This is the eval condition for this menu command to appear. * @default * * @param Menu 66 Enabled * @desc Is this menu command enabled? This is an eval. * @default * * @param Menu 66 Ext * @desc This is the menu command's extension. This is an eval. * @default * * @param Menu 66 Main Bind * @desc This is the function activated by this menu command. * This is an eval. * @default * * @param Menu 66 Actor Bind * @desc If the menu command leads to selecting an actor, this is * the function activated after selecting an actor. * @default * * @param ---Menu 67--- * @default * * @param Menu 67 Name * @desc This is the name for the menu command. This is an eval. To * make it a string, use 'quotes' around the name. * @default * * @param Menu 67 Symbol * @desc This is the symbol for the menu command. This needs to be * unique per menu command. * @default * * @param Menu 67 Show * @desc This is the eval condition for this menu command to appear. * @default * * @param Menu 67 Enabled * @desc Is this menu command enabled? This is an eval. * @default * * @param Menu 67 Ext * @desc This is the menu command's extension. This is an eval. * @default * * @param Menu 67 Main Bind * @desc This is the function activated by this menu command. * This is an eval. * @default * * @param Menu 67 Actor Bind * @desc If the menu command leads to selecting an actor, this is * the function activated after selecting an actor. * @default * * @param ---Menu 68--- * @default * * @param Menu 68 Name * @desc This is the name for the menu command. This is an eval. To * make it a string, use 'quotes' around the name. * @default * * @param Menu 68 Symbol * @desc This is the symbol for the menu command. This needs to be * unique per menu command. * @default * * @param Menu 68 Show * @desc This is the eval condition for this menu command to appear. * @default * * @param Menu 68 Enabled * @desc Is this menu command enabled? This is an eval. * @default * * @param Menu 68 Ext * @desc This is the menu command's extension. This is an eval. * @default * * @param Menu 68 Main Bind * @desc This is the function activated by this menu command. * This is an eval. * @default * * @param Menu 68 Actor Bind * @desc If the menu command leads to selecting an actor, this is * the function activated after selecting an actor. * @default * * @param ---Menu 69--- * @default * * @param Menu 69 Name * @desc This is the name for the menu command. This is an eval. To * make it a string, use 'quotes' around the name. * @default * * @param Menu 69 Symbol * @desc This is the symbol for the menu command. This needs to be * unique per menu command. * @default * * @param Menu 69 Show * @desc This is the eval condition for this menu command to appear. * @default * * @param Menu 69 Enabled * @desc Is this menu command enabled? This is an eval. * @default * * @param Menu 69 Ext * @desc This is the menu command's extension. This is an eval. * @default * * @param Menu 69 Main Bind * @desc This is the function activated by this menu command. * This is an eval. * @default * * @param Menu 69 Actor Bind * @desc If the menu command leads to selecting an actor, this is * the function activated after selecting an actor. * @default * * @param ---Menu 70--- * @default * * @param Menu 70 Name * @desc This is the name for the menu command. This is an eval. To * make it a string, use 'quotes' around the name. * @default * * @param Menu 70 Symbol * @desc This is the symbol for the menu command. This needs to be * unique per menu command. * @default * * @param Menu 70 Show * @desc This is the eval condition for this menu command to appear. * @default * * @param Menu 70 Enabled * @desc Is this menu command enabled? This is an eval. * @default * * @param Menu 70 Ext * @desc This is the menu command's extension. This is an eval. * @default * * @param Menu 70 Main Bind * @desc This is the function activated by this menu command. * This is an eval. * @default * * @param Menu 70 Actor Bind * @desc If the menu command leads to selecting an actor, this is * the function activated after selecting an actor. * @default * * @param ---Menu 71--- * @default * * @param Menu 71 Name * @desc This is the name for the menu command. This is an eval. To * make it a string, use 'quotes' around the name. * @default * * @param Menu 71 Symbol * @desc This is the symbol for the menu command. This needs to be * unique per menu command. * @default * * @param Menu 71 Show * @desc This is the eval condition for this menu command to appear. * @default * * @param Menu 71 Enabled * @desc Is this menu command enabled? This is an eval. * @default * * @param Menu 71 Ext * @desc This is the menu command's extension. This is an eval. * @default * * @param Menu 71 Main Bind * @desc This is the function activated by this menu command. * This is an eval. * @default * * @param Menu 71 Actor Bind * @desc If the menu command leads to selecting an actor, this is * the function activated after selecting an actor. * @default * * @param ---Menu 72--- * @default * * @param Menu 72 Name * @desc This is the name for the menu command. This is an eval. To * make it a string, use 'quotes' around the name. * @default * * @param Menu 72 Symbol * @desc This is the symbol for the menu command. This needs to be * unique per menu command. * @default * * @param Menu 72 Show * @desc This is the eval condition for this menu command to appear. * @default * * @param Menu 72 Enabled * @desc Is this menu command enabled? This is an eval. * @default * * @param Menu 72 Ext * @desc This is the menu command's extension. This is an eval. * @default * * @param Menu 72 Main Bind * @desc This is the function activated by this menu command. * This is an eval. * @default * * @param Menu 72 Actor Bind * @desc If the menu command leads to selecting an actor, this is * the function activated after selecting an actor. * @default * * @param ---Menu 73--- * @default * * @param Menu 73 Name * @desc This is the name for the menu command. This is an eval. To * make it a string, use 'quotes' around the name. * @default * * @param Menu 73 Symbol * @desc This is the symbol for the menu command. This needs to be * unique per menu command. * @default * * @param Menu 73 Show * @desc This is the eval condition for this menu command to appear. * @default * * @param Menu 73 Enabled * @desc Is this menu command enabled? This is an eval. * @default * * @param Menu 73 Ext * @desc This is the menu command's extension. This is an eval. * @default * * @param Menu 73 Main Bind * @desc This is the function activated by this menu command. * This is an eval. * @default * * @param Menu 73 Actor Bind * @desc If the menu command leads to selecting an actor, this is * the function activated after selecting an actor. * @default * * @param ---Menu 74--- * @default * * @param Menu 74 Name * @desc This is the name for the menu command. This is an eval. To * make it a string, use 'quotes' around the name. * @default * * @param Menu 74 Symbol * @desc This is the symbol for the menu command. This needs to be * unique per menu command. * @default * * @param Menu 74 Show * @desc This is the eval condition for this menu command to appear. * @default * * @param Menu 74 Enabled * @desc Is this menu command enabled? This is an eval. * @default * * @param Menu 74 Ext * @desc This is the menu command's extension. This is an eval. * @default * * @param Menu 74 Main Bind * @desc This is the function activated by this menu command. * This is an eval. * @default * * @param Menu 74 Actor Bind * @desc If the menu command leads to selecting an actor, this is * the function activated after selecting an actor. * @default * * @param ---Menu 75--- * @default * * @param Menu 75 Name * @desc This is the name for the menu command. This is an eval. To * make it a string, use 'quotes' around the name. * @default * * @param Menu 75 Symbol * @desc This is the symbol for the menu command. This needs to be * unique per menu command. * @default * * @param Menu 75 Show * @desc This is the eval condition for this menu command to appear. * @default * * @param Menu 75 Enabled * @desc Is this menu command enabled? This is an eval. * @default * * @param Menu 75 Ext * @desc This is the menu command's extension. This is an eval. * @default * * @param Menu 75 Main Bind * @desc This is the function activated by this menu command. * This is an eval. * @default * * @param Menu 75 Actor Bind * @desc If the menu command leads to selecting an actor, this is * the function activated after selecting an actor. * @default * * @param ---Menu 76--- * @default * * @param Menu 76 Name * @desc This is the name for the menu command. This is an eval. To * make it a string, use 'quotes' around the name. * @default * * @param Menu 76 Symbol * @desc This is the symbol for the menu command. This needs to be * unique per menu command. * @default * * @param Menu 76 Show * @desc This is the eval condition for this menu command to appear. * @default * * @param Menu 76 Enabled * @desc Is this menu command enabled? This is an eval. * @default * * @param Menu 76 Ext * @desc This is the menu command's extension. This is an eval. * @default * * @param Menu 76 Main Bind * @desc This is the function activated by this menu command. * This is an eval. * @default * * @param Menu 76 Actor Bind * @desc If the menu command leads to selecting an actor, this is * the function activated after selecting an actor. * @default * * @param ---Menu 77--- * @default * * @param Menu 77 Name * @desc This is the name for the menu command. This is an eval. To * make it a string, use 'quotes' around the name. * @default * * @param Menu 77 Symbol * @desc This is the symbol for the menu command. This needs to be * unique per menu command. * @default * * @param Menu 77 Show * @desc This is the eval condition for this menu command to appear. * @default * * @param Menu 77 Enabled * @desc Is this menu command enabled? This is an eval. * @default * * @param Menu 77 Ext * @desc This is the menu command's extension. This is an eval. * @default * * @param Menu 77 Main Bind * @desc This is the function activated by this menu command. * This is an eval. * @default * * @param Menu 77 Actor Bind * @desc If the menu command leads to selecting an actor, this is * the function activated after selecting an actor. * @default * * @param ---Menu 78--- * @default * * @param Menu 78 Name * @desc This is the name for the menu command. This is an eval. To * make it a string, use 'quotes' around the name. * @default * * @param Menu 78 Symbol * @desc This is the symbol for the menu command. This needs to be * unique per menu command. * @default * * @param Menu 78 Show * @desc This is the eval condition for this menu command to appear. * @default * * @param Menu 78 Enabled * @desc Is this menu command enabled? This is an eval. * @default * * @param Menu 78 Ext * @desc This is the menu command's extension. This is an eval. * @default * * @param Menu 78 Main Bind * @desc This is the function activated by this menu command. * This is an eval. * @default * * @param Menu 78 Actor Bind * @desc If the menu command leads to selecting an actor, this is * the function activated after selecting an actor. * @default * * @param ---Menu 79--- * @default * * @param Menu 79 Name * @desc This is the name for the menu command. This is an eval. To * make it a string, use 'quotes' around the name. * @default * * @param Menu 79 Symbol * @desc This is the symbol for the menu command. This needs to be * unique per menu command. * @default * * @param Menu 79 Show * @desc This is the eval condition for this menu command to appear. * @default * * @param Menu 79 Enabled * @desc Is this menu command enabled? This is an eval. * @default * * @param Menu 79 Ext * @desc This is the menu command's extension. This is an eval. * @default * * @param Menu 79 Main Bind * @desc This is the function activated by this menu command. * This is an eval. * @default * * @param Menu 79 Actor Bind * @desc If the menu command leads to selecting an actor, this is * the function activated after selecting an actor. * @default * * @param ---Menu 80--- * @default * * @param Menu 80 Name * @desc This is the name for the menu command. This is an eval. To * make it a string, use 'quotes' around the name. * @default * * @param Menu 80 Symbol * @desc This is the symbol for the menu command. This needs to be * unique per menu command. * @default * * @param Menu 80 Show * @desc This is the eval condition for this menu command to appear. * @default * * @param Menu 80 Enabled * @desc Is this menu command enabled? This is an eval. * @default * * @param Menu 80 Ext * @desc This is the menu command's extension. This is an eval. * @default * * @param Menu 80 Main Bind * @desc This is the function activated by this menu command. * This is an eval. * @default * * @param Menu 80 Actor Bind * @desc If the menu command leads to selecting an actor, this is * the function activated after selecting an actor. * @default * * @param ---Menu 81--- * @default * * @param Menu 81 Name * @desc This is the name for the menu command. This is an eval. To * make it a string, use 'quotes' around the name. * @default 'Common Event 1' * * @param Menu 81 Symbol * @desc This is the symbol for the menu command. This needs to be * unique per menu command. * @default common event * * @param Menu 81 Show * @desc This is the eval condition for this menu command to appear. * @default false * * @param Menu 81 Enabled * @desc Is this menu command enabled? This is an eval. * @default true * * @param Menu 81 Ext * @desc This is the menu command's extension. This is an eval. * @default 1 * * @param Menu 81 Main Bind * @desc This is the function activated by this menu command. * This is an eval. * @default this.callCommonEvent.bind(this) * * @param Menu 81 Actor Bind * @desc If the menu command leads to selecting an actor, this is * the function activated after selecting an actor. * @default * * @param ---Menu 82--- * @default * * @param Menu 82 Name * @desc This is the name for the menu command. This is an eval. To * make it a string, use 'quotes' around the name. * @default 'Common Event 2' * * @param Menu 82 Symbol * @desc This is the symbol for the menu command. This needs to be * unique per menu command. * @default common event * * @param Menu 82 Show * @desc This is the eval condition for this menu command to appear. * @default false * * @param Menu 82 Enabled * @desc Is this menu command enabled? This is an eval. * @default true * * @param Menu 82 Ext * @desc This is the menu command's extension. This is an eval. * @default 2 * * @param Menu 82 Main Bind * @desc This is the function activated by this menu command. * This is an eval. * @default this.callCommonEvent.bind(this) * * @param Menu 82 Actor Bind * @desc If the menu command leads to selecting an actor, this is * the function activated after selecting an actor. * @default * * @param ---Menu 83--- * @default * * @param Menu 83 Name * @desc This is the name for the menu command. This is an eval. To * make it a string, use 'quotes' around the name. * @default 'Common Event 3' * * @param Menu 83 Symbol * @desc This is the symbol for the menu command. This needs to be * unique per menu command. * @default common event * * @param Menu 83 Show * @desc This is the eval condition for this menu command to appear. * @default false * * @param Menu 83 Enabled * @desc Is this menu command enabled? This is an eval. * @default true * * @param Menu 83 Ext * @desc This is the menu command's extension. This is an eval. * @default 3 * * @param Menu 83 Main Bind * @desc This is the function activated by this menu command. * This is an eval. * @default this.callCommonEvent.bind(this) * * @param Menu 83 Actor Bind * @desc If the menu command leads to selecting an actor, this is * the function activated after selecting an actor. * @default * * @param ---Menu 84--- * @default * * @param Menu 84 Name * @desc This is the name for the menu command. This is an eval. To * make it a string, use 'quotes' around the name. * @default * * @param Menu 84 Symbol * @desc This is the symbol for the menu command. This needs to be * unique per menu command. * @default * * @param Menu 84 Show * @desc This is the eval condition for this menu command to appear. * @default * * @param Menu 84 Enabled * @desc Is this menu command enabled? This is an eval. * @default * * @param Menu 84 Ext * @desc This is the menu command's extension. This is an eval. * @default * * @param Menu 84 Main Bind * @desc This is the function activated by this menu command. * This is an eval. * @default * * @param Menu 84 Actor Bind * @desc If the menu command leads to selecting an actor, this is * the function activated after selecting an actor. * @default * * @param ---Menu 85--- * @default * * @param Menu 85 Name * @desc This is the name for the menu command. This is an eval. To * make it a string, use 'quotes' around the name. * @default * * @param Menu 85 Symbol * @desc This is the symbol for the menu command. This needs to be * unique per menu command. * @default * * @param Menu 85 Show * @desc This is the eval condition for this menu command to appear. * @default * * @param Menu 85 Enabled * @desc Is this menu command enabled? This is an eval. * @default * * @param Menu 85 Ext * @desc This is the menu command's extension. This is an eval. * @default * * @param Menu 85 Main Bind * @desc This is the function activated by this menu command. * This is an eval. * @default * * @param Menu 85 Actor Bind * @desc If the menu command leads to selecting an actor, this is * the function activated after selecting an actor. * @default * * @param ---Menu 86--- * @default * * @param Menu 86 Name * @desc This is the name for the menu command. This is an eval. To * make it a string, use 'quotes' around the name. * @default * * @param Menu 86 Symbol * @desc This is the symbol for the menu command. This needs to be * unique per menu command. * @default * * @param Menu 86 Show * @desc This is the eval condition for this menu command to appear. * @default * * @param Menu 86 Enabled * @desc Is this menu command enabled? This is an eval. * @default * * @param Menu 86 Ext * @desc This is the menu command's extension. This is an eval. * @default * * @param Menu 86 Main Bind * @desc This is the function activated by this menu command. * This is an eval. * @default * * @param Menu 86 Actor Bind * @desc If the menu command leads to selecting an actor, this is * the function activated after selecting an actor. * @default * * @param ---Menu 87--- * @default * * @param Menu 87 Name * @desc This is the name for the menu command. This is an eval. To * make it a string, use 'quotes' around the name. * @default * * @param Menu 87 Symbol * @desc This is the symbol for the menu command. This needs to be * unique per menu command. * @default * * @param Menu 87 Show * @desc This is the eval condition for this menu command to appear. * @default * * @param Menu 87 Enabled * @desc Is this menu command enabled? This is an eval. * @default * * @param Menu 87 Ext * @desc This is the menu command's extension. This is an eval. * @default * * @param Menu 87 Main Bind * @desc This is the function activated by this menu command. * This is an eval. * @default * * @param Menu 87 Actor Bind * @desc If the menu command leads to selecting an actor, this is * the function activated after selecting an actor. * @default * * @param ---Menu 88--- * @default * * @param Menu 88 Name * @desc This is the name for the menu command. This is an eval. To * make it a string, use 'quotes' around the name. * @default * * @param Menu 88 Symbol * @desc This is the symbol for the menu command. This needs to be * unique per menu command. * @default * * @param Menu 88 Show * @desc This is the eval condition for this menu command to appear. * @default * * @param Menu 88 Enabled * @desc Is this menu command enabled? This is an eval. * @default * * @param Menu 88 Ext * @desc This is the menu command's extension. This is an eval. * @default * * @param Menu 88 Main Bind * @desc This is the function activated by this menu command. * This is an eval. * @default * * @param Menu 88 Actor Bind * @desc If the menu command leads to selecting an actor, this is * the function activated after selecting an actor. * @default * * @param ---Menu 89--- * @default * * @param Menu 89 Name * @desc This is the name for the menu command. This is an eval. To * make it a string, use 'quotes' around the name. * @default * * @param Menu 89 Symbol * @desc This is the symbol for the menu command. This needs to be * unique per menu command. * @default * * @param Menu 89 Show * @desc This is the eval condition for this menu command to appear. * @default * * @param Menu 89 Enabled * @desc Is this menu command enabled? This is an eval. * @default * * @param Menu 89 Ext * @desc This is the menu command's extension. This is an eval. * @default * * @param Menu 89 Main Bind * @desc This is the function activated by this menu command. * This is an eval. * @default * * @param Menu 89 Actor Bind * @desc If the menu command leads to selecting an actor, this is * the function activated after selecting an actor. * @default * * @param ---Menu 90--- * @default * * @param Menu 90 Name * @desc This is the name for the menu command. This is an eval. To * make it a string, use 'quotes' around the name. * @default TextManager.options * * @param Menu 90 Symbol * @desc This is the symbol for the menu command. This needs to be * unique per menu command. * @default options * * @param Menu 90 Show * @desc This is the eval condition for this menu command to appear. * @default this.needsCommand('options') * * @param Menu 90 Enabled * @desc Is this menu command enabled? This is an eval. * @default this.isOptionsEnabled() * * @param Menu 90 Ext * @desc This is the menu command's extension. This is an eval. * @default * * @param Menu 90 Main Bind * @desc This is the function activated by this menu command. * This is an eval. * @default this.commandOptions.bind(this) * * @param Menu 90 Actor Bind * @desc If the menu command leads to selecting an actor, this is * the function activated after selecting an actor. * @default * * @param ---Menu 91--- * @default * * @param Menu 91 Name * @desc This is the name for the menu command. This is an eval. To * make it a string, use 'quotes' around the name. * @default * * @param Menu 91 Symbol * @desc This is the symbol for the menu command. This needs to be * unique per menu command. * @default * * @param Menu 91 Show * @desc This is the eval condition for this menu command to appear. * @default * * @param Menu 91 Enabled * @desc Is this menu command enabled? This is an eval. * @default * * @param Menu 91 Ext * @desc This is the menu command's extension. This is an eval. * @default * * @param Menu 91 Main Bind * @desc This is the function activated by this menu command. * This is an eval. * @default * * @param Menu 91 Actor Bind * @desc If the menu command leads to selecting an actor, this is * the function activated after selecting an actor. * @default * * @param ---Menu 92--- * @default * * @param Menu 92 Name * @desc This is the name for the menu command. This is an eval. To * make it a string, use 'quotes' around the name. * @default * * @param Menu 92 Symbol * @desc This is the symbol for the menu command. This needs to be * unique per menu command. * @default * * @param Menu 92 Show * @desc This is the eval condition for this menu command to appear. * @default * * @param Menu 92 Enabled * @desc Is this menu command enabled? This is an eval. * @default * * @param Menu 92 Ext * @desc This is the menu command's extension. This is an eval. * @default * * @param Menu 92 Main Bind * @desc This is the function activated by this menu command. * This is an eval. * @default * * @param Menu 92 Actor Bind * @desc If the menu command leads to selecting an actor, this is * the function activated after selecting an actor. * @default * * @param ---Menu 93--- * @default * * @param Menu 93 Name * @desc This is the name for the menu command. This is an eval. To * make it a string, use 'quotes' around the name. * @default * * @param Menu 93 Symbol * @desc This is the symbol for the menu command. This needs to be * unique per menu command. * @default * * @param Menu 93 Show * @desc This is the eval condition for this menu command to appear. * @default * * @param Menu 93 Enabled * @desc Is this menu command enabled? This is an eval. * @default * * @param Menu 93 Ext * @desc This is the menu command's extension. This is an eval. * @default * * @param Menu 93 Main Bind * @desc This is the function activated by this menu command. * This is an eval. * @default * * @param Menu 93 Actor Bind * @desc If the menu command leads to selecting an actor, this is * the function activated after selecting an actor. * @default * * @param ---Menu 94--- * @default * * @param Menu 94 Name * @desc This is the name for the menu command. This is an eval. To * make it a string, use 'quotes' around the name. * @default * * @param Menu 94 Symbol * @desc This is the symbol for the menu command. This needs to be * unique per menu command. * @default * * @param Menu 94 Show * @desc This is the eval condition for this menu command to appear. * @default * * @param Menu 94 Enabled * @desc Is this menu command enabled? This is an eval. * @default * * @param Menu 94 Ext * @desc This is the menu command's extension. This is an eval. * @default * * @param Menu 94 Main Bind * @desc This is the function activated by this menu command. * This is an eval. * @default * * @param Menu 94 Actor Bind * @desc If the menu command leads to selecting an actor, this is * the function activated after selecting an actor. * @default * * @param ---Menu 95--- * @default * * @param Menu 95 Name * @desc This is the name for the menu command. This is an eval. To * make it a string, use 'quotes' around the name. * @default TextManager.save * * @param Menu 95 Symbol * @desc This is the symbol for the menu command. This needs to be * unique per menu command. * @default save * * @param Menu 95 Show * @desc This is the eval condition for this menu command to appear. * @default this.needsCommand('save') * * @param Menu 95 Enabled * @desc Is this menu command enabled? This is an eval. * @default this.isSaveEnabled() * * @param Menu 95 Ext * @desc This is the menu command's extension. This is an eval. * @default * * @param Menu 95 Main Bind * @desc This is the function activated by this menu command. * This is an eval. * @default this.commandSave.bind(this) * * @param Menu 95 Actor Bind * @desc If the menu command leads to selecting an actor, this is * the function activated after selecting an actor. * @default * * @param ---Menu 96--- * @default * * @param Menu 96 Name * @desc This is the name for the menu command. This is an eval. To * make it a string, use 'quotes' around the name. * @default * * @param Menu 96 Symbol * @desc This is the symbol for the menu command. This needs to be * unique per menu command. * @default * * @param Menu 96 Show * @desc This is the eval condition for this menu command to appear. * @default * * @param Menu 96 Enabled * @desc Is this menu command enabled? This is an eval. * @default * * @param Menu 96 Ext * @desc This is the menu command's extension. This is an eval. * @default * * @param Menu 96 Main Bind * @desc This is the function activated by this menu command. * This is an eval. * @default * * @param Menu 96 Actor Bind * @desc If the menu command leads to selecting an actor, this is * the function activated after selecting an actor. * @default * * @param ---Menu 97--- * @default * * @param Menu 97 Name * @desc This is the name for the menu command. This is an eval. To * make it a string, use 'quotes' around the name. * @default * * @param Menu 97 Symbol * @desc This is the symbol for the menu command. This needs to be * unique per menu command. * @default * * @param Menu 97 Show * @desc This is the eval condition for this menu command to appear. * @default * * @param Menu 97 Enabled * @desc Is this menu command enabled? This is an eval. * @default * * @param Menu 97 Ext * @desc This is the menu command's extension. This is an eval. * @default * * @param Menu 97 Main Bind * @desc This is the function activated by this menu command. * This is an eval. * @default * * @param Menu 97 Actor Bind * @desc If the menu command leads to selecting an actor, this is * the function activated after selecting an actor. * @default * * @param ---Menu 98--- * @default * * @param Menu 98 Name * @desc This is the name for the menu command. This is an eval. To * make it a string, use 'quotes' around the name. * @default * * @param Menu 98 Symbol * @desc This is the symbol for the menu command. This needs to be * unique per menu command. * @default * * @param Menu 98 Show * @desc This is the eval condition for this menu command to appear. * @default * * @param Menu 98 Enabled * @desc Is this menu command enabled? This is an eval. * @default * * @param Menu 98 Ext * @desc This is the menu command's extension. This is an eval. * @default * * @param Menu 98 Main Bind * @desc This is the function activated by this menu command. * This is an eval. * @default * * @param Menu 98 Actor Bind * @desc If the menu command leads to selecting an actor, this is * the function activated after selecting an actor. * @default * * @param ---Menu 99--- * @default * * @param Menu 99 Name * @desc This is the name for the menu command. This is an eval. To * make it a string, use 'quotes' around the name. * @default 'Debug' * * @param Menu 99 Symbol * @desc This is the symbol for the menu command. This needs to be * unique per menu command. * @default debug * * @param Menu 99 Show * @desc This is the eval condition for this menu command to appear. * @default $gameTemp.isPlaytest() * * @param Menu 99 Enabled * @desc Is this menu command enabled? This is an eval. * @default true * * @param Menu 99 Ext * @desc This is the menu command's extension. This is an eval. * @default * * @param Menu 99 Main Bind * @desc This is the function activated by this menu command. * This is an eval. * @default this.commandDebug.bind(this) * * @param Menu 99 Actor Bind * @desc If the menu command leads to selecting an actor, this is * the function activated after selecting an actor. * @default * * @param ---Menu 100--- * @default * * @param Menu 100 Name * @desc This is the name for the menu command. This is an eval. To * make it a string, use 'quotes' around the name. * @default TextManager.gameEnd * * @param Menu 100 Symbol * @desc This is the symbol for the menu command. This needs to be * unique per menu command. * @default gameEnd * * @param Menu 100 Show * @desc This is the eval condition for this menu command to appear. * @default true * * @param Menu 100 Enabled * @desc Is this menu command enabled? This is an eval. * @default this.isGameEndEnabled() * * @param Menu 100 Ext * @desc This is the menu command's extension. This is an eval. * @default * * @param Menu 100 Main Bind * @desc This is the function activated by this menu command. * This is an eval. * @default this.commandGameEnd.bind(this) * * @param Menu 100 Actor Bind * @desc If the menu command leads to selecting an actor, this is * the function activated after selecting an actor. * @default * * @help * ============================================================================ * Introduction * ============================================================================ * * For those who wish to alter the various aspects of the main menu commands * without needing to touch the source code can use this plugin to do so. * Although this plugin mostly ports the menu creation process to the Plugin * Manager parameters, it allows for a cleaner way to handle the menu command * management process. * * ============================================================================ * How to Use This Plugin * ============================================================================ * * Each section in the parameters is divided up into various parts. Each of * these parts play a role in how the menu command functions. Here's what each * part does: * * Name * - This is how the command will appear visually in the main menu. This is an * eval, which means, it's code driven. If you want the command to appear just * as it is, use 'quotes' around it. * * Symbol * - This is the identifier for the command. Each command should have a unique * symbol, so much as to not cause conflicts with each command. However, shared * symbols are perfectly fine as long as you're fine with them performing the * same function when selected. * * Show * - This is an eval condition for whether or not the command shows up in the * main menu. If you wish for this to always show up, simply use 'true' without * the quotes. * * Enabled * - This is an eval condition for whether or not the command is enabled. The * difference between showing a command and enabling a command is that a * command can show, but it can't be selected because it isn't enabled. If you * wish for this command to always be enabled, use 'true' without the quotes. * * Ext * - Stands for extension. This serves as a secondary symbol for the command * and it can be used for pretty much anything. It has no direct impact on the * command unless the command's objective is related to the extension value. * The majority of commands do not need to make use of the Ext value. * * Main Bind * - This is an eval function that is to be ran when this command is selected * straight from the main menu. The function that is to be bound to this * command needs to be accessible from Scene_Menu is some way or another. For * commands that are meant to select an actor first, use * 'this.commandItem.bind(this)' without the quotes. * * Actor Bind * - This is an eval function that is to be ran when an actor is selected after * choosing this command, usually to push a scene. This function isn't needed * for any menu commands that don't require selecting an actor. * * ============================================================================ * Examples * ============================================================================ * * The following are some examples to help you add/alter/change the way * commands appear for your main menu. * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * * Name: TextManager.item * Symbol: item * Show: this.needsCommand('item') * Enabled: this.areMainCommandsEnabled() * Ext: * Main Bind: this.commandItem.bind(this) * Actor Bind: * * The item command is made using the above example. 'TextManager.item' is how * the command name will appear. It draws the name information from the * database Text Manager entry for 'Item' and uses whatever you put into the * database in here. The symbol 'item' is used to make the item command's * unique identifier. In order for the command to show, it will run a * 'needsCommand' function to check if it will appear. This 'needsCommand' * function is related to your database on whether or not you want the item to * appear there. In order for this command to be enabled, it will check for * whether or not the main commands are enabled, which is related to whether or * not there are actors in the current party. And finally, the line of code * 'this.commandItem.bind(this)' is the command that will run once the item * entry is selected. * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * * Name: TextManager.skill * Symbol: skill * Show: this.needsCommand('skill') * Enabled: this.areMainCommandsEnabled() * Ext: * Main Bind: this.commandPersonal.bind(this) * Actor Bind: SceneManager.push(Scene_Skill) * * The skill command is made using the above example. 'TextManager.skill' is * how the command name will appear. It draws the name information from the * database Text Manager entry for 'Skill' and uses whatever you put into the * database in here. The symbol 'skill' is used to make the skill command's * unique identifier. In order for the command to show, it will run a line code * 'needsCommand' function to check if it will appear. This 'needsCommand' * function is related to your database on whether or not you want the skill * option to appear there. In order for this command to be enabled, it will * check for whether or not the main commands are enabled, which is related to * whether or not there are actors in the current party. This time, the main * bind command is to send the player to the actor selection process using * 'this.commandPersonal.bind(this)' instead. Once the player selects an actor, * 'SceneManager.push(Scene_Skill)' is then ran to send the player to * Scene_Skill to manage the actor's skills. * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * * Name: 'Common Event 1' * Symbol: common event * Show: false * Enabled: true * Ext: 1 * Main Bind: this.callCommonEvent.bind(this) * Actor Bind: * * This is a customized command that is included by default with the plugin. * This command's name is 'Common Event 1', but it can be changed to whatever * you want by simply changing what's in between the 'quotes' in the parameter * settings. The symbol is the identifier for all common events. However, by * default, this common event item does not show in the main menu. If you want * it to appear, set the Show option to 'true' without the quotes and it will * appear. Because the Enabled option is 'true', the command can always be * selected by the player. The Ext actually has a role with this command. The * Ext determines which common event is to be played. In this example, the Ext * value is 1, which means common event 1 will be ran when this command is * selected. Should the Ext value equal to 25, it will be common event 25 that * will run once this command is selected. The reason is because the Main Bind * for this command option is 'this.callCommonEvent.bind(this)', which is a * function included in this plugin to allow for common events to be ran. * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ /*:ja * @plugindesc メインメニューに様々な変更を加えます。 * @author Yanfly Engine Plugins * * @param ---コマンド--- * @default * * @param Command Alignment * @desc コマンドウィンドウでのテキスト配置を指定してください。 * left(左) center(中央)   right(右) * @default left * * @param Command Position * @desc コマンドウィンドウの位置を指定してください。 * left(左) right(右) * @default left * * @param Command Columns * @desc コマンドウィンドウで表示される列数を指定してください。 * Default: 1 * @default 1 * * @param Command Rows * @desc コマンドウィンドウで表示される行数を指定してください。 * @default Math.min(10, Math.ceil(this.maxItems() / this.maxCols())) * * @param Command Width * @desc コマンドウィンドウの幅をピクセルで指定してください。 * Default: 240 * @default 240 * * @param ---Menu 1--- * @default * * @param Menu 1 Name * @desc メニューコマンドの名前を指定します。(eval) * stringに変更したい場合は、名前を''で囲ってください。 * @default * * @param Menu 1 Symbol * @desc メニューコマンドの記号です。メニューコマンドごとに独自のものとしてください。 * @default * * @param Menu 1 Show * @desc このメニューコマンドを表示するためのevalの状態です。 * @default * * @param Menu 1 Enabled * @desc メニューコマンドを有効にしますか? (eval) * @default * * @param Menu 1 Ext * @desc メニューコマンドの拡張です。(eval) * @default * * @param Menu 1 Main Bind * @desc メニューコマンドによって有効になる機能です。(eval) * @default * * @param Menu 1 Actor Bind * @desc メニューコマンドによりアクターを選択した際、有効になる機能です。 * @default * * @param ---Menu 2--- * @default * * @param Menu 2 Name * @desc メニューコマンドの名前を指定します。(eval) * stringに変更したい場合は、名前を''で囲ってください。 * @default * * @param Menu 2 Symbol * @desc メニューコマンドの記号です。メニューコマンドごとに独自のものとしてください。 * @default * * @param Menu 2 Show * @desc このメニューコマンドを表示するためのevalの状態です。 * @default * * @param Menu 2 Enabled * @desc メニューコマンドを有効にしますか? (eval) * @default * * @param Menu 2 Ext * @desc メニューコマンドの拡張です。(eval) * @default * * @param Menu 2 Main Bind * @desc メニューコマンドによって有効になる機能です。(eval) * @default * * @param Menu 2 Actor Bind * @desc メニューコマンドによりアクターを選択した際、有効になる機能です。 * @default * * @param ---Menu 3--- * @default * * @param Menu 3 Name * @desc メニューコマンドの名前を指定します。(eval) * stringに変更したい場合は、名前を''で囲ってください。 * @default * * @param Menu 3 Symbol * @desc メニューコマンドの記号です。メニューコマンドごとに独自のものとしてください。 * @default * * @param Menu 3 Show * @desc このメニューコマンドを表示するためのevalの状態です。 * @default * * @param Menu 3 Enabled * @desc メニューコマンドを有効にしますか? (eval) * @default * * @param Menu 3 Ext * @desc メニューコマンドの拡張です。(eval) * @default * * @param Menu 3 Main Bind * @desc メニューコマンドによって有効になる機能です。(eval) * @default * * @param Menu 3 Actor Bind * @desc メニューコマンドによりアクターを選択した際、有効になる機能です。 * @default * * @param ---Menu 4--- * @default * * @param Menu 4 Name * @desc メニューコマンドの名前を指定します。(eval) * stringに変更したい場合は、名前を''で囲ってください。 * @default * * @param Menu 4 Symbol * @desc メニューコマンドの記号です。メニューコマンドごとに独自のものとしてください。 * @default * * @param Menu 4 Show * @desc このメニューコマンドを表示するためのevalの状態です。 * @default * * @param Menu 4 Enabled * @desc メニューコマンドを有効にしますか? (eval) * @default * * @param Menu 4 Ext * @desc メニューコマンドの拡張です。(eval) * @default * * @param Menu 4 Main Bind * @desc メニューコマンドによって有効になる機能です。(eval) * @default * * @param Menu 4 Actor Bind * @desc メニューコマンドによりアクターを選択した際、有効になる機能です。 * @default * * @param ---Menu 5--- * @default * * @param Menu 5 Name * @desc メニューコマンドの名前を指定します。(eval) * stringに変更したい場合は、名前を''で囲ってください。 * @default * * @param Menu 5 Symbol * @desc メニューコマンドの記号です。メニューコマンドごとに独自のものとしてください。 * @default * * @param Menu 5 Show * @desc このメニューコマンドを表示するためのevalの状態です。 * @default * * @param Menu 5 Enabled * @desc メニューコマンドを有効にしますか? (eval) * @default * * @param Menu 5 Ext * @desc メニューコマンドの拡張です。(eval) * @default * * @param Menu 5 Main Bind * @desc メニューコマンドによって有効になる機能です。(eval) * @default * * @param Menu 5 Actor Bind * @desc メニューコマンドによりアクターを選択した際、有効になる機能です。 * @default * * @param ---Menu 6--- * @default * * @param Menu 6 Name * @desc メニューコマンドの名前を指定します。(eval) * stringに変更したい場合は、名前を''で囲ってください。 * @default * * @param Menu 6 Symbol * @desc メニューコマンドの記号です。メニューコマンドごとに独自のものとしてください。 * @default * * @param Menu 6 Show * @desc このメニューコマンドを表示するためのevalの状態です。 * @default * * @param Menu 6 Enabled * @desc メニューコマンドを有効にしますか? (eval) * @default * * @param Menu 6 Ext * @desc メニューコマンドの拡張です。(eval) * @default * * @param Menu 6 Main Bind * @desc メニューコマンドによって有効になる機能です。(eval) * @default * * @param Menu 6 Actor Bind * @desc メニューコマンドによりアクターを選択した際、有効になる機能です。 * @default * * @param ---Menu 7--- * @default * * @param Menu 7 Name * @desc メニューコマンドの名前を指定します。(eval) * stringに変更したい場合は、名前を''で囲ってください。 * @default * * @param Menu 7 Symbol * @desc メニューコマンドの記号です。メニューコマンドごとに独自のものとしてください。 * @default * * @param Menu 7 Show * @desc このメニューコマンドを表示するためのevalの状態です。 * @default * * @param Menu 7 Enabled * @desc メニューコマンドを有効にしますか? (eval) * @default * * @param Menu 7 Ext * @desc メニューコマンドの拡張です。(eval) * @default * * @param Menu 7 Main Bind * @desc メニューコマンドによって有効になる機能です。(eval) * @default * * @param Menu 7 Actor Bind * @desc メニューコマンドによりアクターを選択した際、有効になる機能です。 * @default * * @param ---Menu 8--- * @default * * @param Menu 8 Name * @desc メニューコマンドの名前を指定します。(eval) * stringに変更したい場合は、名前を''で囲ってください。 * @default * * @param Menu 8 Symbol * @desc メニューコマンドの記号です。メニューコマンドごとに独自のものとしてください。 * @default * * @param Menu 8 Show * @desc このメニューコマンドを表示するためのevalの状態です。 * @default * * @param Menu 8 Enabled * @desc メニューコマンドを有効にしますか? (eval) * @default * * @param Menu 8 Ext * @desc メニューコマンドの拡張です。(eval) * @default * * @param Menu 8 Main Bind * @desc メニューコマンドによって有効になる機能です。(eval) * @default * * @param Menu 8 Actor Bind * @desc メニューコマンドによりアクターを選択した際、有効になる機能です。 * @default * * @param ---Menu 9--- * @default * * @param Menu 9 Name * @desc メニューコマンドの名前を指定します。(eval) * stringに変更したい場合は、名前を''で囲ってください。 * @default * * @param Menu 9 Symbol * @desc メニューコマンドの記号です。メニューコマンドごとに独自のものとしてください。 * @default * * @param Menu 9 Show * @desc このメニューコマンドを表示するためのevalの状態です。 * @default * * @param Menu 9 Enabled * @desc メニューコマンドを有効にしますか? (eval) * @default * * @param Menu 9 Ext * @desc メニューコマンドの拡張です。(eval) * @default * * @param Menu 9 Main Bind * @desc メニューコマンドによって有効になる機能です。(eval) * @default * * @param Menu 9 Actor Bind * @desc メニューコマンドによりアクターを選択した際、有効になる機能です。 * @default * * @param ---Menu 10--- * @default * * @param Menu 10 Name * @desc メニューコマンドの名前を指定します。(eval) * stringに変更したい場合は、名前を''で囲ってください。 * @default TextManager.item * * @param Menu 10 Symbol * @desc メニューコマンドの記号です。メニューコマンドごとに独自のものとしてください。 * @default item * * @param Menu 10 Show * @desc このメニューコマンドを表示するためのevalの状態です。 * @default this.needsCommand('item') * * @param Menu 10 Enabled * @desc メニューコマンドを有効にしますか? (eval) * @default this.areMainCommandsEnabled() * * @param Menu 10 Ext * @desc メニューコマンドの拡張です。(eval) * @default * * @param Menu 10 Main Bind * @desc メニューコマンドによって有効になる機能です。(eval) * @default this.commandItem.bind(this) * * @param Menu 10 Actor Bind * @desc メニューコマンドによりアクターを選択した際、有効になる機能です。 * @default * * @param ---Menu 11--- * @default * * @param Menu 11 Name * @desc メニューコマンドの名前を指定します。(eval) * stringに変更したい場合は、名前を''で囲ってください。 * @default * * @param Menu 11 Symbol * @desc メニューコマンドの記号です。メニューコマンドごとに独自のものとしてください。 * @default * * @param Menu 11 Show * @desc このメニューコマンドを表示するためのevalの状態です。 * @default * * @param Menu 11 Enabled * @desc メニューコマンドを有効にしますか? (eval) * @default * * @param Menu 11 Ext * @desc メニューコマンドの拡張です。(eval) * @default * * @param Menu 11 Main Bind * @desc メニューコマンドによって有効になる機能です。(eval) * @default * * @param Menu 11 Actor Bind * @desc メニューコマンドによりアクターを選択した際、有効になる機能です。 * @default * * @param ---Menu 12--- * @default * * @param Menu 12 Name * @desc メニューコマンドの名前を指定します。(eval) * stringに変更したい場合は、名前を''で囲ってください。 * @default * * @param Menu 12 Symbol * @desc メニューコマンドの記号です。メニューコマンドごとに独自のものとしてください。 * @default * * @param Menu 12 Show * @desc このメニューコマンドを表示するためのevalの状態です。 * @default * * @param Menu 12 Enabled * @desc メニューコマンドを有効にしますか? (eval) * @default * * @param Menu 12 Ext * @desc メニューコマンドの拡張です。(eval) * @default * * @param Menu 12 Main Bind * @desc メニューコマンドによって有効になる機能です。(eval) * @default * * @param Menu 12 Actor Bind * @desc メニューコマンドによりアクターを選択した際、有効になる機能です。 * @default * * @param ---Menu 13--- * @default * * @param Menu 13 Name * @desc メニューコマンドの名前を指定します。(eval) * stringに変更したい場合は、名前を''で囲ってください。 * @default * * @param Menu 13 Symbol * @desc メニューコマンドの記号です。メニューコマンドごとに独自のものとしてください。 * @default * * @param Menu 13 Show * @desc このメニューコマンドを表示するためのevalの状態です。 * @default * * @param Menu 13 Enabled * @desc メニューコマンドを有効にしますか? (eval) * @default * * @param Menu 13 Ext * @desc メニューコマンドの拡張です。(eval) * @default * * @param Menu 13 Main Bind * @desc メニューコマンドによって有効になる機能です。(eval) * @default * * @param Menu 13 Actor Bind * @desc メニューコマンドによりアクターを選択した際、有効になる機能です。 * @default * * @param ---Menu 14--- * @default * * @param Menu 14 Name * @desc メニューコマンドの名前を指定します。(eval) * stringに変更したい場合は、名前を''で囲ってください。 * @default * * @param Menu 14 Symbol * @desc メニューコマンドの記号です。メニューコマンドごとに独自のものとしてください。 * @default * * @param Menu 14 Show * @desc このメニューコマンドを表示するためのevalの状態です。 * @default * * @param Menu 14 Enabled * @desc メニューコマンドを有効にしますか? (eval) * @default * * @param Menu 14 Ext * @desc メニューコマンドの拡張です。(eval) * @default * * @param Menu 14 Main Bind * @desc メニューコマンドによって有効になる機能です。(eval) * @default * * @param Menu 14 Actor Bind * @desc メニューコマンドによりアクターを選択した際、有効になる機能です。 * @default * * @param ---Menu 15--- * @default * * @param Menu 15 Name * @desc メニューコマンドの名前を指定します。(eval) * stringに変更したい場合は、名前を''で囲ってください。 * @default TextManager.skill * * @param Menu 15 Symbol * @desc メニューコマンドの記号です。メニューコマンドごとに独自のものとしてください。 * @default skill * * @param Menu 15 Show * @desc このメニューコマンドを表示するためのevalの状態です。 * @default this.needsCommand('skill') * * @param Menu 15 Enabled * @desc メニューコマンドを有効にしますか? (eval) * @default this.areMainCommandsEnabled() * * @param Menu 15 Ext * @desc メニューコマンドの拡張です。(eval) * @default * * @param Menu 15 Main Bind * @desc メニューコマンドによって有効になる機能です。(eval) * @default this.commandPersonal.bind(this) * * @param Menu 15 Actor Bind * @desc メニューコマンドによりアクターを選択した際、有効になる機能です。 * @default SceneManager.push(Scene_Skill) * * @param ---Menu 16--- * @default * * @param Menu 16 Name * @desc メニューコマンドの名前を指定します。(eval) * stringに変更したい場合は、名前を''で囲ってください。 * @default * * @param Menu 16 Symbol * @desc メニューコマンドの記号です。メニューコマンドごとに独自のものとしてください。 * @default * * @param Menu 16 Show * @desc このメニューコマンドを表示するためのevalの状態です。 * @default * * @param Menu 16 Enabled * @desc メニューコマンドを有効にしますか? (eval) * @default * * @param Menu 16 Ext * @desc メニューコマンドの拡張です。(eval) * @default * * @param Menu 16 Main Bind * @desc メニューコマンドによって有効になる機能です。(eval) * @default * * @param Menu 16 Actor Bind * @desc メニューコマンドによりアクターを選択した際、有効になる機能です。 * @default * * @param ---Menu 17--- * @default * * @param Menu 17 Name * @desc メニューコマンドの名前を指定します。(eval) * stringに変更したい場合は、名前を''で囲ってください。 * @default * * @param Menu 17 Symbol * @desc メニューコマンドの記号です。メニューコマンドごとに独自のものとしてください。 * @default * * @param Menu 17 Show * @desc このメニューコマンドを表示するためのevalの状態です。 * @default * * @param Menu 17 Enabled * @desc メニューコマンドを有効にしますか? (eval) * @default * * @param Menu 17 Ext * @desc メニューコマンドの拡張です。(eval) * @default * * @param Menu 17 Main Bind * @desc メニューコマンドによって有効になる機能です。(eval) * @default * * @param Menu 17 Actor Bind * @desc メニューコマンドによりアクターを選択した際、有効になる機能です。 * @default * * @param ---Menu 18--- * @default * * @param Menu 18 Name * @desc メニューコマンドの名前を指定します。(eval) * stringに変更したい場合は、名前を''で囲ってください。 * @default * * @param Menu 18 Symbol * @desc メニューコマンドの記号です。メニューコマンドごとに独自のものとしてください。 * @default * * @param Menu 18 Show * @desc このメニューコマンドを表示するためのevalの状態です。 * @default * * @param Menu 18 Enabled * @desc メニューコマンドを有効にしますか? (eval) * @default * * @param Menu 18 Ext * @desc メニューコマンドの拡張です。(eval) * @default * * @param Menu 18 Main Bind * @desc メニューコマンドによって有効になる機能です。(eval) * @default * * @param Menu 18 Actor Bind * @desc メニューコマンドによりアクターを選択した際、有効になる機能です。 * @default * * @param ---Menu 19--- * @default * * @param Menu 19 Name * @desc メニューコマンドの名前を指定します。(eval) * stringに変更したい場合は、名前を''で囲ってください。 * @default * * @param Menu 19 Symbol * @desc メニューコマンドの記号です。メニューコマンドごとに独自のものとしてください。 * @default * * @param Menu 19 Show * @desc このメニューコマンドを表示するためのevalの状態です。 * @default * * @param Menu 19 Enabled * @desc メニューコマンドを有効にしますか? (eval) * @default * * @param Menu 19 Ext * @desc メニューコマンドの拡張です。(eval) * @default * * @param Menu 19 Main Bind * @desc メニューコマンドによって有効になる機能です。(eval) * @default * * @param Menu 19 Actor Bind * @desc メニューコマンドによりアクターを選択した際、有効になる機能です。 * @default * * @param ---Menu 20--- * @default * * @param Menu 20 Name * @desc メニューコマンドの名前を指定します。(eval) * stringに変更したい場合は、名前を''で囲ってください。 * @default TextManager.equip * * @param Menu 20 Symbol * @desc メニューコマンドの記号です。メニューコマンドごとに独自のものとしてください。 * @default equip * * @param Menu 20 Show * @desc このメニューコマンドを表示するためのevalの状態です。 * @default this.needsCommand('equip') * * @param Menu 20 Enabled * @desc メニューコマンドを有効にしますか? (eval) * @default this.areMainCommandsEnabled() * * @param Menu 20 Ext * @desc メニューコマンドの拡張です。(eval) * @default * * @param Menu 20 Main Bind * @desc メニューコマンドによって有効になる機能です。(eval) * @default this.commandPersonal.bind(this) * * @param Menu 20 Actor Bind * @desc メニューコマンドによりアクターを選択した際、有効になる機能です。 * @default SceneManager.push(Scene_Equip) * * @param ---Menu 21--- * @default * * @param Menu 21 Name * @desc メニューコマンドの名前を指定します。(eval) * stringに変更したい場合は、名前を''で囲ってください。 * @default * * @param Menu 21 Symbol * @desc メニューコマンドの記号です。メニューコマンドごとに独自のものとしてください。 * @default * * @param Menu 21 Show * @desc このメニューコマンドを表示するためのevalの状態です。 * @default * * @param Menu 21 Enabled * @desc メニューコマンドを有効にしますか? (eval) * @default * * @param Menu 21 Ext * @desc メニューコマンドの拡張です。(eval) * @default * * @param Menu 21 Main Bind * @desc メニューコマンドによって有効になる機能です。(eval) * @default * * @param Menu 21 Actor Bind * @desc メニューコマンドによりアクターを選択した際、有効になる機能です。 * @default * * @param ---Menu 22--- * @default * * @param Menu 22 Name * @desc メニューコマンドの名前を指定します。(eval) * stringに変更したい場合は、名前を''で囲ってください。 * @default * * @param Menu 22 Symbol * @desc メニューコマンドの記号です。メニューコマンドごとに独自のものとしてください。 * @default * * @param Menu 22 Show * @desc このメニューコマンドを表示するためのevalの状態です。 * @default * * @param Menu 22 Enabled * @desc メニューコマンドを有効にしますか? (eval) * @default * * @param Menu 22 Ext * @desc メニューコマンドの拡張です。(eval) * @default * * @param Menu 22 Main Bind * @desc メニューコマンドによって有効になる機能です。(eval) * @default * * @param Menu 22 Actor Bind * @desc メニューコマンドによりアクターを選択した際、有効になる機能です。 * @default * * @param ---Menu 23--- * @default * * @param Menu 23 Name * @desc メニューコマンドの名前を指定します。(eval) * stringに変更したい場合は、名前を''で囲ってください。 * @default * * @param Menu 23 Symbol * @desc メニューコマンドの記号です。メニューコマンドごとに独自のものとしてください。 * @default * * @param Menu 23 Show * @desc このメニューコマンドを表示するためのevalの状態です。 * @default * * @param Menu 23 Enabled * @desc メニューコマンドを有効にしますか? (eval) * @default * * @param Menu 23 Ext * @desc メニューコマンドの拡張です。(eval) * @default * * @param Menu 23 Main Bind * @desc メニューコマンドによって有効になる機能です。(eval) * @default * * @param Menu 23 Actor Bind * @desc メニューコマンドによりアクターを選択した際、有効になる機能です。 * @default * * @param ---Menu 24--- * @default * * @param Menu 24 Name * @desc メニューコマンドの名前を指定します。(eval) * stringに変更したい場合は、名前を''で囲ってください。 * @default * * @param Menu 24 Symbol * @desc メニューコマンドの記号です。メニューコマンドごとに独自のものとしてください。 * @default * * @param Menu 24 Show * @desc このメニューコマンドを表示するためのevalの状態です。 * @default * * @param Menu 24 Enabled * @desc メニューコマンドを有効にしますか? (eval) * @default * * @param Menu 24 Ext * @desc メニューコマンドの拡張です。(eval) * @default * * @param Menu 24 Main Bind * @desc メニューコマンドによって有効になる機能です。(eval) * @default * * @param Menu 24 Actor Bind * @desc メニューコマンドによりアクターを選択した際、有効になる機能です。 * @default * * @param ---Menu 25--- * @default * * @param Menu 25 Name * @desc メニューコマンドの名前を指定します。(eval) * stringに変更したい場合は、名前を''で囲ってください。 * @default Yanfly.Param.CCCCmdName * * @param Menu 25 Symbol * @desc メニューコマンドの記号です。メニューコマンドごとに独自のものとしてください。 * @default class * * @param Menu 25 Show * @desc このメニューコマンドを表示するためのevalの状態です。 * @default Imported.YEP_ClassChangeCore && $gameSystem.isShowClass() * * @param Menu 25 Enabled * @desc メニューコマンドを有効にしますか? (eval) * @default $gameSystem.isEnableClass() && this.areMainCommandsEnabled() * * @param Menu 25 Ext * @desc メニューコマンドの拡張です。(eval) * @default * * @param Menu 25 Main Bind * @desc メニューコマンドによって有効になる機能です。(eval) * @default this.commandPersonal.bind(this) * * @param Menu 25 Actor Bind * @desc メニューコマンドによりアクターを選択した際、有効になる機能です。 * @default SceneManager.push(Scene_Class) * * @param ---Menu 26--- * @default * * @param Menu 26 Name * @desc メニューコマンドの名前を指定します。(eval) * stringに変更したい場合は、名前を''で囲ってください。 * @default * * @param Menu 26 Symbol * @desc メニューコマンドの記号です。メニューコマンドごとに独自のものとしてください。 * @default * * @param Menu 26 Show * @desc このメニューコマンドを表示するためのevalの状態です。 * @default * * @param Menu 26 Enabled * @desc メニューコマンドを有効にしますか? (eval) * @default * * @param Menu 26 Ext * @desc メニューコマンドの拡張です。(eval) * @default * * @param Menu 26 Main Bind * @desc メニューコマンドによって有効になる機能です。(eval) * @default * * @param Menu 26 Actor Bind * @desc メニューコマンドによりアクターを選択した際、有効になる機能です。 * @default * * @param ---Menu 27--- * @default * * @param Menu 27 Name * @desc メニューコマンドの名前を指定します。(eval) * stringに変更したい場合は、名前を''で囲ってください。 * @default * * @param Menu 27 Symbol * @desc メニューコマンドの記号です。メニューコマンドごとに独自のものとしてください。 * @default * * @param Menu 27 Show * @desc このメニューコマンドを表示するためのevalの状態です。 * @default * * @param Menu 27 Enabled * @desc メニューコマンドを有効にしますか? (eval) * @default * * @param Menu 27 Ext * @desc メニューコマンドの拡張です。(eval) * @default * * @param Menu 27 Main Bind * @desc メニューコマンドによって有効になる機能です。(eval) * @default * * @param Menu 27 Actor Bind * @desc メニューコマンドによりアクターを選択した際、有効になる機能です。 * @default * * @param ---Menu 28--- * @default * * @param Menu 28 Name * @desc メニューコマンドの名前を指定します。(eval) * stringに変更したい場合は、名前を''で囲ってください。 * @default * * @param Menu 28 Symbol * @desc メニューコマンドの記号です。メニューコマンドごとに独自のものとしてください。 * @default * * @param Menu 28 Show * @desc このメニューコマンドを表示するためのevalの状態です。 * @default * * @param Menu 28 Enabled * @desc メニューコマンドを有効にしますか? (eval) * @default * * @param Menu 28 Ext * @desc メニューコマンドの拡張です。(eval) * @default * * @param Menu 28 Main Bind * @desc メニューコマンドによって有効になる機能です。(eval) * @default * * @param Menu 28 Actor Bind * @desc メニューコマンドによりアクターを選択した際、有効になる機能です。 * @default * * @param ---Menu 29--- * @default * * @param Menu 29 Name * @desc メニューコマンドの名前を指定します。(eval) * stringに変更したい場合は、名前を''で囲ってください。 * @default * * @param Menu 29 Symbol * @desc メニューコマンドの記号です。メニューコマンドごとに独自のものとしてください。 * @default * * @param Menu 29 Show * @desc このメニューコマンドを表示するためのevalの状態です。 * @default * * @param Menu 29 Enabled * @desc メニューコマンドを有効にしますか? (eval) * @default * * @param Menu 29 Ext * @desc メニューコマンドの拡張です。(eval) * @default * * @param Menu 29 Main Bind * @desc メニューコマンドによって有効になる機能です。(eval) * @default * * @param Menu 29 Actor Bind * @desc メニューコマンドによりアクターを選択した際、有効になる機能です。 * @default * * @param ---Menu 30--- * @default * * @param Menu 30 Name * @desc メニューコマンドの名前を指定します。(eval) * stringに変更したい場合は、名前を''で囲ってください。 * @default * * @param Menu 30 Symbol * @desc メニューコマンドの記号です。メニューコマンドごとに独自のものとしてください。 * @default * * @param Menu 30 Show * @desc このメニューコマンドを表示するためのevalの状態です。 * @default * * @param Menu 30 Enabled * @desc メニューコマンドを有効にしますか? (eval) * @default * * @param Menu 30 Ext * @desc メニューコマンドの拡張です。(eval) * @default * * @param Menu 30 Main Bind * @desc メニューコマンドによって有効になる機能です。(eval) * @default * * @param Menu 30 Actor Bind * @desc メニューコマンドによりアクターを選択した際、有効になる機能です。 * @default * * @param ---Menu 31--- * @default * * @param Menu 31 Name * @desc メニューコマンドの名前を指定します。(eval) * stringに変更したい場合は、名前を''で囲ってください。 * @default * * @param Menu 31 Symbol * @desc メニューコマンドの記号です。メニューコマンドごとに独自のものとしてください。 * @default * * @param Menu 31 Show * @desc このメニューコマンドを表示するためのevalの状態です。 * @default * * @param Menu 31 Enabled * @desc メニューコマンドを有効にしますか? (eval) * @default * * @param Menu 31 Ext * @desc メニューコマンドの拡張です。(eval) * @default * * @param Menu 31 Main Bind * @desc メニューコマンドによって有効になる機能です。(eval) * @default * * @param Menu 31 Actor Bind * @desc メニューコマンドによりアクターを選択した際、有効になる機能です。 * @default * * @param ---Menu 32--- * @default * * @param Menu 32 Name * @desc メニューコマンドの名前を指定します。(eval) * stringに変更したい場合は、名前を''で囲ってください。 * @default * * @param Menu 32 Symbol * @desc メニューコマンドの記号です。メニューコマンドごとに独自のものとしてください。 * @default * * @param Menu 32 Show * @desc このメニューコマンドを表示するためのevalの状態です。 * @default * * @param Menu 32 Enabled * @desc メニューコマンドを有効にしますか? (eval) * @default * * @param Menu 32 Ext * @desc メニューコマンドの拡張です。(eval) * @default * * @param Menu 32 Main Bind * @desc メニューコマンドによって有効になる機能です。(eval) * @default * * @param Menu 32 Actor Bind * @desc メニューコマンドによりアクターを選択した際、有効になる機能です。 * @default * * @param ---Menu 33--- * @default * * @param Menu 33 Name * @desc メニューコマンドの名前を指定します。(eval) * stringに変更したい場合は、名前を''で囲ってください。 * @default * * @param Menu 33 Symbol * @desc メニューコマンドの記号です。メニューコマンドごとに独自のものとしてください。 * @default * * @param Menu 33 Show * @desc このメニューコマンドを表示するためのevalの状態です。 * @default * * @param Menu 33 Enabled * @desc メニューコマンドを有効にしますか? (eval) * @default * * @param Menu 33 Ext * @desc メニューコマンドの拡張です。(eval) * @default * * @param Menu 33 Main Bind * @desc メニューコマンドによって有効になる機能です。(eval) * @default * * @param Menu 33 Actor Bind * @desc メニューコマンドによりアクターを選択した際、有効になる機能です。 * @default * * @param ---Menu 34--- * @default * * @param Menu 34 Name * @desc メニューコマンドの名前を指定します。(eval) * stringに変更したい場合は、名前を''で囲ってください。 * @default * * @param Menu 34 Symbol * @desc メニューコマンドの記号です。メニューコマンドごとに独自のものとしてください。 * @default * * @param Menu 34 Show * @desc このメニューコマンドを表示するためのevalの状態です。 * @default * * @param Menu 34 Enabled * @desc メニューコマンドを有効にしますか? (eval) * @default * * @param Menu 34 Ext * @desc メニューコマンドの拡張です。(eval) * @default * * @param Menu 34 Main Bind * @desc メニューコマンドによって有効になる機能です。(eval) * @default * * @param Menu 34 Actor Bind * @desc メニューコマンドによりアクターを選択した際、有効になる機能です。 * @default * * @param ---Menu 35--- * @default * * @param Menu 35 Name * @desc メニューコマンドの名前を指定します。(eval) * stringに変更したい場合は、名前を''で囲ってください。 * @default * * @param Menu 35 Symbol * @desc メニューコマンドの記号です。メニューコマンドごとに独自のものとしてください。 * @default * * @param Menu 35 Show * @desc このメニューコマンドを表示するためのevalの状態です。 * @default * * @param Menu 35 Enabled * @desc メニューコマンドを有効にしますか? (eval) * @default * * @param Menu 35 Ext * @desc メニューコマンドの拡張です。(eval) * @default * * @param Menu 35 Main Bind * @desc メニューコマンドによって有効になる機能です。(eval) * @default * * @param Menu 35 Actor Bind * @desc メニューコマンドによりアクターを選択した際、有効になる機能です。 * @default * * @param ---Menu 36--- * @default * * @param Menu 36 Name * @desc メニューコマンドの名前を指定します。(eval) * stringに変更したい場合は、名前を''で囲ってください。 * @default * * @param Menu 36 Symbol * @desc メニューコマンドの記号です。メニューコマンドごとに独自のものとしてください。 * @default * * @param Menu 36 Show * @desc このメニューコマンドを表示するためのevalの状態です。 * @default * * @param Menu 36 Enabled * @desc メニューコマンドを有効にしますか? (eval) * @default * * @param Menu 36 Ext * @desc メニューコマンドの拡張です。(eval) * @default * * @param Menu 36 Main Bind * @desc メニューコマンドによって有効になる機能です。(eval) * @default * * @param Menu 36 Actor Bind * @desc メニューコマンドによりアクターを選択した際、有効になる機能です。 * @default * * @param ---Menu 37--- * @default * * @param Menu 37 Name * @desc メニューコマンドの名前を指定します。(eval) * stringに変更したい場合は、名前を''で囲ってください。 * @default * * @param Menu 37 Symbol * @desc メニューコマンドの記号です。メニューコマンドごとに独自のものとしてください。 * @default * * @param Menu 37 Show * @desc このメニューコマンドを表示するためのevalの状態です。 * @default * * @param Menu 37 Enabled * @desc メニューコマンドを有効にしますか? (eval) * @default * * @param Menu 37 Ext * @desc メニューコマンドの拡張です。(eval) * @default * * @param Menu 37 Main Bind * @desc メニューコマンドによって有効になる機能です。(eval) * @default * * @param Menu 37 Actor Bind * @desc メニューコマンドによりアクターを選択した際、有効になる機能です。 * @default * * @param ---Menu 38--- * @default * * @param Menu 38 Name * @desc メニューコマンドの名前を指定します。(eval) * stringに変更したい場合は、名前を''で囲ってください。 * @default * * @param Menu 38 Symbol * @desc メニューコマンドの記号です。メニューコマンドごとに独自のものとしてください。 * @default * * @param Menu 38 Show * @desc このメニューコマンドを表示するためのevalの状態です。 * @default * * @param Menu 38 Enabled * @desc メニューコマンドを有効にしますか? (eval) * @default * * @param Menu 38 Ext * @desc メニューコマンドの拡張です。(eval) * @default * * @param Menu 38 Main Bind * @desc メニューコマンドによって有効になる機能です。(eval) * @default * * @param Menu 38 Actor Bind * @desc メニューコマンドによりアクターを選択した際、有効になる機能です。 * @default * * @param ---Menu 39--- * @default * * @param Menu 39 Name * @desc メニューコマンドの名前を指定します。(eval) * stringに変更したい場合は、名前を''で囲ってください。 * @default * * @param Menu 39 Symbol * @desc メニューコマンドの記号です。メニューコマンドごとに独自のものとしてください。 * @default * * @param Menu 39 Show * @desc このメニューコマンドを表示するためのevalの状態です。 * @default * * @param Menu 39 Enabled * @desc メニューコマンドを有効にしますか? (eval) * @default * * @param Menu 39 Ext * @desc メニューコマンドの拡張です。(eval) * @default * * @param Menu 39 Main Bind * @desc メニューコマンドによって有効になる機能です。(eval) * @default * * @param Menu 39 Actor Bind * @desc メニューコマンドによりアクターを選択した際、有効になる機能です。 * @default * * @param ---Menu 40--- * @default * * @param Menu 40 Name * @desc メニューコマンドの名前を指定します。(eval) * stringに変更したい場合は、名前を''で囲ってください。 * @default * * @param Menu 40 Symbol * @desc メニューコマンドの記号です。メニューコマンドごとに独自のものとしてください。 * @default * * @param Menu 40 Show * @desc このメニューコマンドを表示するためのevalの状態です。 * @default * * @param Menu 40 Enabled * @desc メニューコマンドを有効にしますか? (eval) * @default * * @param Menu 40 Ext * @desc メニューコマンドの拡張です。(eval) * @default * * @param Menu 40 Main Bind * @desc メニューコマンドによって有効になる機能です。(eval) * @default * * @param Menu 40 Actor Bind * @desc メニューコマンドによりアクターを選択した際、有効になる機能です。 * @default * * @param ---Menu 41--- * @default * * @param Menu 41 Name * @desc メニューコマンドの名前を指定します。(eval) * stringに変更したい場合は、名前を''で囲ってください。 * @default * * @param Menu 41 Symbol * @desc メニューコマンドの記号です。メニューコマンドごとに独自のものとしてください。 * @default * * @param Menu 41 Show * @desc このメニューコマンドを表示するためのevalの状態です。 * @default * * @param Menu 41 Enabled * @desc メニューコマンドを有効にしますか? (eval) * @default * * @param Menu 41 Ext * @desc メニューコマンドの拡張です。(eval) * @default * * @param Menu 41 Main Bind * @desc メニューコマンドによって有効になる機能です。(eval) * @default * * @param Menu 41 Actor Bind * @desc メニューコマンドによりアクターを選択した際、有効になる機能です。 * @default * * @param ---Menu 42--- * @default * * @param Menu 42 Name * @desc メニューコマンドの名前を指定します。(eval) * stringに変更したい場合は、名前を''で囲ってください。 * @default * * @param Menu 42 Symbol * @desc メニューコマンドの記号です。メニューコマンドごとに独自のものとしてください。 * @default * * @param Menu 42 Show * @desc このメニューコマンドを表示するためのevalの状態です。 * @default * * @param Menu 42 Enabled * @desc メニューコマンドを有効にしますか? (eval) * @default * * @param Menu 42 Ext * @desc メニューコマンドの拡張です。(eval) * @default * * @param Menu 42 Main Bind * @desc メニューコマンドによって有効になる機能です。(eval) * @default * * @param Menu 42 Actor Bind * @desc メニューコマンドによりアクターを選択した際、有効になる機能です。 * @default * * @param ---Menu 43--- * @default * * @param Menu 43 Name * @desc メニューコマンドの名前を指定します。(eval) * stringに変更したい場合は、名前を''で囲ってください。 * @default * * @param Menu 43 Symbol * @desc メニューコマンドの記号です。メニューコマンドごとに独自のものとしてください。 * @default * * @param Menu 43 Show * @desc このメニューコマンドを表示するためのevalの状態です。 * @default * * @param Menu 43 Enabled * @desc メニューコマンドを有効にしますか? (eval) * @default * * @param Menu 43 Ext * @desc メニューコマンドの拡張です。(eval) * @default * * @param Menu 43 Main Bind * @desc メニューコマンドによって有効になる機能です。(eval) * @default * * @param Menu 43 Actor Bind * @desc メニューコマンドによりアクターを選択した際、有効になる機能です。 * @default * * @param ---Menu 44--- * @default * * @param Menu 44 Name * @desc メニューコマンドの名前を指定します。(eval) * stringに変更したい場合は、名前を''で囲ってください。 * @default * * @param Menu 44 Symbol * @desc メニューコマンドの記号です。メニューコマンドごとに独自のものとしてください。 * @default * * @param Menu 44 Show * @desc このメニューコマンドを表示するためのevalの状態です。 * @default * * @param Menu 44 Enabled * @desc メニューコマンドを有効にしますか? (eval) * @default * * @param Menu 44 Ext * @desc メニューコマンドの拡張です。(eval) * @default * * @param Menu 44 Main Bind * @desc メニューコマンドによって有効になる機能です。(eval) * @default * * @param Menu 44 Actor Bind * @desc メニューコマンドによりアクターを選択した際、有効になる機能です。 * @default * * @param ---Menu 45--- * @default * * @param Menu 45 Name * @desc メニューコマンドの名前を指定します。(eval) * stringに変更したい場合は、名前を''で囲ってください。 * @default * * @param Menu 45 Symbol * @desc メニューコマンドの記号です。メニューコマンドごとに独自のものとしてください。 * @default * * @param Menu 45 Show * @desc このメニューコマンドを表示するためのevalの状態です。 * @default * * @param Menu 45 Enabled * @desc メニューコマンドを有効にしますか? (eval) * @default * * @param Menu 45 Ext * @desc メニューコマンドの拡張です。(eval) * @default * * @param Menu 45 Main Bind * @desc メニューコマンドによって有効になる機能です。(eval) * @default * * @param Menu 45 Actor Bind * @desc メニューコマンドによりアクターを選択した際、有効になる機能です。 * @default * * @param ---Menu 46--- * @default * * @param Menu 46 Name * @desc メニューコマンドの名前を指定します。(eval) * stringに変更したい場合は、名前を''で囲ってください。 * @default * * @param Menu 46 Symbol * @desc メニューコマンドの記号です。メニューコマンドごとに独自のものとしてください。 * @default * * @param Menu 46 Show * @desc このメニューコマンドを表示するためのevalの状態です。 * @default * * @param Menu 46 Enabled * @desc メニューコマンドを有効にしますか? (eval) * @default * * @param Menu 46 Ext * @desc メニューコマンドの拡張です。(eval) * @default * * @param Menu 46 Main Bind * @desc メニューコマンドによって有効になる機能です。(eval) * @default * * @param Menu 46 Actor Bind * @desc メニューコマンドによりアクターを選択した際、有効になる機能です。 * @default * * @param ---Menu 47--- * @default * * @param Menu 47 Name * @desc メニューコマンドの名前を指定します。(eval) * stringに変更したい場合は、名前を''で囲ってください。 * @default * * @param Menu 47 Symbol * @desc メニューコマンドの記号です。メニューコマンドごとに独自のものとしてください。 * @default * * @param Menu 47 Show * @desc このメニューコマンドを表示するためのevalの状態です。 * @default * * @param Menu 47 Enabled * @desc メニューコマンドを有効にしますか? (eval) * @default * * @param Menu 47 Ext * @desc メニューコマンドの拡張です。(eval) * @default * * @param Menu 47 Main Bind * @desc メニューコマンドによって有効になる機能です。(eval) * @default * * @param Menu 47 Actor Bind * @desc メニューコマンドによりアクターを選択した際、有効になる機能です。 * @default * * @param ---Menu 48--- * @default * * @param Menu 48 Name * @desc メニューコマンドの名前を指定します。(eval) * stringに変更したい場合は、名前を''で囲ってください。 * @default * * @param Menu 48 Symbol * @desc メニューコマンドの記号です。メニューコマンドごとに独自のものとしてください。 * @default * * @param Menu 48 Show * @desc このメニューコマンドを表示するためのevalの状態です。 * @default * * @param Menu 48 Enabled * @desc メニューコマンドを有効にしますか? (eval) * @default * * @param Menu 48 Ext * @desc メニューコマンドの拡張です。(eval) * @default * * @param Menu 48 Main Bind * @desc メニューコマンドによって有効になる機能です。(eval) * @default * * @param Menu 48 Actor Bind * @desc メニューコマンドによりアクターを選択した際、有効になる機能です。 * @default * * @param ---Menu 49--- * @default * * @param Menu 49 Name * @desc メニューコマンドの名前を指定します。(eval) * stringに変更したい場合は、名前を''で囲ってください。 * @default * * @param Menu 49 Symbol * @desc メニューコマンドの記号です。メニューコマンドごとに独自のものとしてください。 * @default * * @param Menu 49 Show * @desc このメニューコマンドを表示するためのevalの状態です。 * @default * * @param Menu 49 Enabled * @desc メニューコマンドを有効にしますか? (eval) * @default * * @param Menu 49 Ext * @desc メニューコマンドの拡張です。(eval) * @default * * @param Menu 49 Main Bind * @desc メニューコマンドによって有効になる機能です。(eval) * @default * * @param Menu 49 Actor Bind * @desc メニューコマンドによりアクターを選択した際、有効になる機能です。 * @default * * @param ---Menu 50--- * @default * * @param Menu 50 Name * @desc メニューコマンドの名前を指定します。(eval) * stringに変更したい場合は、名前を''で囲ってください。 * @default TextManager.status * * @param Menu 50 Symbol * @desc メニューコマンドの記号です。メニューコマンドごとに独自のものとしてください。 * @default status * * @param Menu 50 Show * @desc このメニューコマンドを表示するためのevalの状態です。 * @default this.needsCommand('status') * * @param Menu 50 Enabled * @desc メニューコマンドを有効にしますか? (eval) * @default this.areMainCommandsEnabled() * * @param Menu 50 Ext * @desc メニューコマンドの拡張です。(eval) * @default * * @param Menu 50 Main Bind * @desc メニューコマンドによって有効になる機能です。(eval) * @default this.commandPersonal.bind(this) * * @param Menu 50 Actor Bind * @desc メニューコマンドによりアクターを選択した際、有効になる機能です。 * @default SceneManager.push(Scene_Status) * * @param ---Menu 51--- * @default * * @param Menu 51 Name * @desc メニューコマンドの名前を指定します。(eval) * stringに変更したい場合は、名前を''で囲ってください。 * @default * * @param Menu 51 Symbol * @desc メニューコマンドの記号です。メニューコマンドごとに独自のものとしてください。 * @default * * @param Menu 51 Show * @desc このメニューコマンドを表示するためのevalの状態です。 * @default * * @param Menu 51 Enabled * @desc メニューコマンドを有効にしますか? (eval) * @default * * @param Menu 51 Ext * @desc メニューコマンドの拡張です。(eval) * @default * * @param Menu 51 Main Bind * @desc メニューコマンドによって有効になる機能です。(eval) * @default * * @param Menu 51 Actor Bind * @desc メニューコマンドによりアクターを選択した際、有効になる機能です。 * @default * * @param ---Menu 52--- * @default * * @param Menu 52 Name * @desc メニューコマンドの名前を指定します。(eval) * stringに変更したい場合は、名前を''で囲ってください。 * @default * * @param Menu 52 Symbol * @desc メニューコマンドの記号です。メニューコマンドごとに独自のものとしてください。 * @default * * @param Menu 52 Show * @desc このメニューコマンドを表示するためのevalの状態です。 * @default * * @param Menu 52 Enabled * @desc メニューコマンドを有効にしますか? (eval) * @default * * @param Menu 52 Ext * @desc メニューコマンドの拡張です。(eval) * @default * * @param Menu 52 Main Bind * @desc メニューコマンドによって有効になる機能です。(eval) * @default * * @param Menu 52 Actor Bind * @desc メニューコマンドによりアクターを選択した際、有効になる機能です。 * @default * * @param ---Menu 53--- * @default * * @param Menu 53 Name * @desc メニューコマンドの名前を指定します。(eval) * stringに変更したい場合は、名前を''で囲ってください。 * @default * * @param Menu 53 Symbol * @desc メニューコマンドの記号です。メニューコマンドごとに独自のものとしてください。 * @default * * @param Menu 53 Show * @desc このメニューコマンドを表示するためのevalの状態です。 * @default * * @param Menu 53 Enabled * @desc メニューコマンドを有効にしますか? (eval) * @default * * @param Menu 53 Ext * @desc メニューコマンドの拡張です。(eval) * @default * * @param Menu 53 Main Bind * @desc メニューコマンドによって有効になる機能です。(eval) * @default * * @param Menu 53 Actor Bind * @desc メニューコマンドによりアクターを選択した際、有効になる機能です。 * @default * * @param ---Menu 54--- * @default * * @param Menu 54 Name * @desc メニューコマンドの名前を指定します。(eval) * stringに変更したい場合は、名前を''で囲ってください。 * @default * * @param Menu 54 Symbol * @desc メニューコマンドの記号です。メニューコマンドごとに独自のものとしてください。 * @default * * @param Menu 54 Show * @desc このメニューコマンドを表示するためのevalの状態です。 * @default * * @param Menu 54 Enabled * @desc メニューコマンドを有効にしますか? (eval) * @default * * @param Menu 54 Ext * @desc メニューコマンドの拡張です。(eval) * @default * * @param Menu 54 Main Bind * @desc メニューコマンドによって有効になる機能です。(eval) * @default * * @param Menu 54 Actor Bind * @desc メニューコマンドによりアクターを選択した際、有効になる機能です。 * @default * * @param ---Menu 55--- * @default * * @param Menu 55 Name * @desc メニューコマンドの名前を指定します。(eval) * stringに変更したい場合は、名前を''で囲ってください。 * @default TextManager.formation * * @param Menu 55 Symbol * @desc メニューコマンドの記号です。メニューコマンドごとに独自のものとしてください。 * @default formation * * @param Menu 55 Show * @desc このメニューコマンドを表示するためのevalの状態です。 * @default this.needsCommand('formation') * * @param Menu 55 Enabled * @desc メニューコマンドを有効にしますか? (eval) * @default this.isFormationEnabled() * * @param Menu 55 Ext * @desc メニューコマンドの拡張です。(eval) * @default * * @param Menu 55 Main Bind * @desc メニューコマンドによって有効になる機能です。(eval) * @default this.commandFormation.bind(this) * * @param Menu 55 Actor Bind * @desc メニューコマンドによりアクターを選択した際、有効になる機能です。 * @default * * @param ---Menu 56--- * @default * * @param Menu 56 Name * @desc メニューコマンドの名前を指定します。(eval) * stringに変更したい場合は、名前を''で囲ってください。 * @default * * @param Menu 56 Symbol * @desc メニューコマンドの記号です。メニューコマンドごとに独自のものとしてください。 * @default * * @param Menu 56 Show * @desc このメニューコマンドを表示するためのevalの状態です。 * @default * * @param Menu 56 Enabled * @desc メニューコマンドを有効にしますか? (eval) * @default * * @param Menu 56 Ext * @desc メニューコマンドの拡張です。(eval) * @default * * @param Menu 56 Main Bind * @desc メニューコマンドによって有効になる機能です。(eval) * @default * * @param Menu 56 Actor Bind * @desc メニューコマンドによりアクターを選択した際、有効になる機能です。 * @default * * @param ---Menu 57--- * @default * * @param Menu 57 Name * @desc メニューコマンドの名前を指定します。(eval) * stringに変更したい場合は、名前を''で囲ってください。 * @default * * @param Menu 57 Symbol * @desc メニューコマンドの記号です。メニューコマンドごとに独自のものとしてください。 * @default * * @param Menu 57 Show * @desc このメニューコマンドを表示するためのevalの状態です。 * @default * * @param Menu 57 Enabled * @desc メニューコマンドを有効にしますか? (eval) * @default * * @param Menu 57 Ext * @desc メニューコマンドの拡張です。(eval) * @default * * @param Menu 57 Main Bind * @desc メニューコマンドによって有効になる機能です。(eval) * @default * * @param Menu 57 Actor Bind * @desc メニューコマンドによりアクターを選択した際、有効になる機能です。 * @default * * @param ---Menu 58--- * @default * * @param Menu 58 Name * @desc メニューコマンドの名前を指定します。(eval) * stringに変更したい場合は、名前を''で囲ってください。 * @default * * @param Menu 58 Symbol * @desc メニューコマンドの記号です。メニューコマンドごとに独自のものとしてください。 * @default * * @param Menu 58 Show * @desc このメニューコマンドを表示するためのevalの状態です。 * @default * * @param Menu 58 Enabled * @desc メニューコマンドを有効にしますか? (eval) * @default * * @param Menu 58 Ext * @desc メニューコマンドの拡張です。(eval) * @default * * @param Menu 58 Main Bind * @desc メニューコマンドによって有効になる機能です。(eval) * @default * * @param Menu 58 Actor Bind * @desc メニューコマンドによりアクターを選択した際、有効になる機能です。 * @default * * @param ---Menu 59--- * @default * * @param Menu 59 Name * @desc メニューコマンドの名前を指定します。(eval) * stringに変更したい場合は、名前を''で囲ってください。 * @default * * @param Menu 59 Symbol * @desc メニューコマンドの記号です。メニューコマンドごとに独自のものとしてください。 * @default * * @param Menu 59 Show * @desc このメニューコマンドを表示するためのevalの状態です。 * @default * * @param Menu 59 Enabled * @desc メニューコマンドを有効にしますか? (eval) * @default * * @param Menu 59 Ext * @desc メニューコマンドの拡張です。(eval) * @default * * @param Menu 59 Main Bind * @desc メニューコマンドによって有効になる機能です。(eval) * @default * * @param Menu 59 Actor Bind * @desc メニューコマンドによりアクターを選択した際、有効になる機能です。 * @default * * @param ---Menu 60--- * @default * * @param Menu 60 Name * @desc メニューコマンドの名前を指定します。(eval) * stringに変更したい場合は、名前を''で囲ってください。 * @default * * @param Menu 60 Symbol * @desc メニューコマンドの記号です。メニューコマンドごとに独自のものとしてください。 * @default * * @param Menu 60 Show * @desc このメニューコマンドを表示するためのevalの状態です。 * @default * * @param Menu 60 Enabled * @desc メニューコマンドを有効にしますか? (eval) * @default * * @param Menu 60 Ext * @desc メニューコマンドの拡張です。(eval) * @default * * @param Menu 60 Main Bind * @desc メニューコマンドによって有効になる機能です。(eval) * @default * * @param Menu 60 Actor Bind * @desc メニューコマンドによりアクターを選択した際、有効になる機能です。 * @default * * @param ---Menu 61--- * @default * * @param Menu 61 Name * @desc メニューコマンドの名前を指定します。(eval) * stringに変更したい場合は、名前を''で囲ってください。 * @default * * @param Menu 61 Symbol * @desc メニューコマンドの記号です。メニューコマンドごとに独自のものとしてください。 * @default * * @param Menu 61 Show * @desc このメニューコマンドを表示するためのevalの状態です。 * @default * * @param Menu 61 Enabled * @desc メニューコマンドを有効にしますか? (eval) * @default * * @param Menu 61 Ext * @desc メニューコマンドの拡張です。(eval) * @default * * @param Menu 61 Main Bind * @desc メニューコマンドによって有効になる機能です。(eval) * @default * * @param Menu 61 Actor Bind * @desc メニューコマンドによりアクターを選択した際、有効になる機能です。 * @default * * @param ---Menu 62--- * @default * * @param Menu 62 Name * @desc メニューコマンドの名前を指定します。(eval) * stringに変更したい場合は、名前を''で囲ってください。 * @default * * @param Menu 62 Symbol * @desc メニューコマンドの記号です。メニューコマンドごとに独自のものとしてください。 * @default * * @param Menu 62 Show * @desc このメニューコマンドを表示するためのevalの状態です。 * @default * * @param Menu 62 Enabled * @desc メニューコマンドを有効にしますか? (eval) * @default * * @param Menu 62 Ext * @desc メニューコマンドの拡張です。(eval) * @default * * @param Menu 62 Main Bind * @desc メニューコマンドによって有効になる機能です。(eval) * @default * * @param Menu 62 Actor Bind * @desc メニューコマンドによりアクターを選択した際、有効になる機能です。 * @default * * @param ---Menu 63--- * @default * * @param Menu 63 Name * @desc メニューコマンドの名前を指定します。(eval) * stringに変更したい場合は、名前を''で囲ってください。 * @default * * @param Menu 63 Symbol * @desc メニューコマンドの記号です。メニューコマンドごとに独自のものとしてください。 * @default * * @param Menu 63 Show * @desc このメニューコマンドを表示するためのevalの状態です。 * @default * * @param Menu 63 Enabled * @desc メニューコマンドを有効にしますか? (eval) * @default * * @param Menu 63 Ext * @desc メニューコマンドの拡張です。(eval) * @default * * @param Menu 63 Main Bind * @desc メニューコマンドによって有効になる機能です。(eval) * @default * * @param Menu 63 Actor Bind * @desc メニューコマンドによりアクターを選択した際、有効になる機能です。 * @default * * @param ---Menu 64--- * @default * * @param Menu 64 Name * @desc メニューコマンドの名前を指定します。(eval) * stringに変更したい場合は、名前を''で囲ってください。 * @default * * @param Menu 64 Symbol * @desc メニューコマンドの記号です。メニューコマンドごとに独自のものとしてください。 * @default * * @param Menu 64 Show * @desc このメニューコマンドを表示するためのevalの状態です。 * @default * * @param Menu 64 Enabled * @desc メニューコマンドを有効にしますか? (eval) * @default * * @param Menu 64 Ext * @desc メニューコマンドの拡張です。(eval) * @default * * @param Menu 64 Main Bind * @desc メニューコマンドによって有効になる機能です。(eval) * @default * * @param Menu 64 Actor Bind * @desc メニューコマンドによりアクターを選択した際、有効になる機能です。 * @default * * @param ---Menu 65--- * @default * * @param Menu 65 Name * @desc メニューコマンドの名前を指定します。(eval) * stringに変更したい場合は、名前を''で囲ってください。 * @default * * @param Menu 65 Symbol * @desc メニューコマンドの記号です。メニューコマンドごとに独自のものとしてください。 * @default * * @param Menu 65 Show * @desc このメニューコマンドを表示するためのevalの状態です。 * @default * * @param Menu 65 Enabled * @desc メニューコマンドを有効にしますか? (eval) * @default * * @param Menu 65 Ext * @desc メニューコマンドの拡張です。(eval) * @default * * @param Menu 65 Main Bind * @desc メニューコマンドによって有効になる機能です。(eval) * @default * * @param Menu 65 Actor Bind * @desc メニューコマンドによりアクターを選択した際、有効になる機能です。 * @default * * @param ---Menu 66--- * @default * * @param Menu 66 Name * @desc メニューコマンドの名前を指定します。(eval) * stringに変更したい場合は、名前を''で囲ってください。 * @default * * @param Menu 66 Symbol * @desc メニューコマンドの記号です。メニューコマンドごとに独自のものとしてください。 * @default * * @param Menu 66 Show * @desc このメニューコマンドを表示するためのevalの状態です。 * @default * * @param Menu 66 Enabled * @desc メニューコマンドを有効にしますか? (eval) * @default * * @param Menu 66 Ext * @desc メニューコマンドの拡張です。(eval) * @default * * @param Menu 66 Main Bind * @desc メニューコマンドによって有効になる機能です。(eval) * @default * * @param Menu 66 Actor Bind * @desc メニューコマンドによりアクターを選択した際、有効になる機能です。 * @default * * @param ---Menu 67--- * @default * * @param Menu 67 Name * @desc メニューコマンドの名前を指定します。(eval) * stringに変更したい場合は、名前を''で囲ってください。 * @default * * @param Menu 67 Symbol * @desc メニューコマンドの記号です。メニューコマンドごとに独自のものとしてください。 * @default * * @param Menu 67 Show * @desc このメニューコマンドを表示するためのevalの状態です。 * @default * * @param Menu 67 Enabled * @desc メニューコマンドを有効にしますか? (eval) * @default * * @param Menu 67 Ext * @desc メニューコマンドの拡張です。(eval) * @default * * @param Menu 67 Main Bind * @desc メニューコマンドによって有効になる機能です。(eval) * @default * * @param Menu 67 Actor Bind * @desc メニューコマンドによりアクターを選択した際、有効になる機能です。 * @default * * @param ---Menu 68--- * @default * * @param Menu 68 Name * @desc メニューコマンドの名前を指定します。(eval) * stringに変更したい場合は、名前を''で囲ってください。 * @default * * @param Menu 68 Symbol * @desc メニューコマンドの記号です。メニューコマンドごとに独自のものとしてください。 * @default * * @param Menu 68 Show * @desc このメニューコマンドを表示するためのevalの状態です。 * @default * * @param Menu 68 Enabled * @desc メニューコマンドを有効にしますか? (eval) * @default * * @param Menu 68 Ext * @desc メニューコマンドの拡張です。(eval) * @default * * @param Menu 68 Main Bind * @desc メニューコマンドによって有効になる機能です。(eval) * @default * * @param Menu 68 Actor Bind * @desc メニューコマンドによりアクターを選択した際、有効になる機能です。 * @default * * @param ---Menu 69--- * @default * * @param Menu 69 Name * @desc メニューコマンドの名前を指定します。(eval) * stringに変更したい場合は、名前を''で囲ってください。 * @default * * @param Menu 69 Symbol * @desc メニューコマンドの記号です。メニューコマンドごとに独自のものとしてください。 * @default * * @param Menu 69 Show * @desc このメニューコマンドを表示するためのevalの状態です。 * @default * * @param Menu 69 Enabled * @desc メニューコマンドを有効にしますか? (eval) * @default * * @param Menu 69 Ext * @desc メニューコマンドの拡張です。(eval) * @default * * @param Menu 69 Main Bind * @desc メニューコマンドによって有効になる機能です。(eval) * @default * * @param Menu 69 Actor Bind * @desc メニューコマンドによりアクターを選択した際、有効になる機能です。 * @default * * @param ---Menu 70--- * @default * * @param Menu 70 Name * @desc メニューコマンドの名前を指定します。(eval) * stringに変更したい場合は、名前を''で囲ってください。 * @default * * @param Menu 70 Symbol * @desc メニューコマンドの記号です。メニューコマンドごとに独自のものとしてください。 * @default * * @param Menu 70 Show * @desc このメニューコマンドを表示するためのevalの状態です。 * @default * * @param Menu 70 Enabled * @desc メニューコマンドを有効にしますか? (eval) * @default * * @param Menu 70 Ext * @desc メニューコマンドの拡張です。(eval) * @default * * @param Menu 70 Main Bind * @desc メニューコマンドによって有効になる機能です。(eval) * @default * * @param Menu 70 Actor Bind * @desc メニューコマンドによりアクターを選択した際、有効になる機能です。 * @default * * @param ---Menu 71--- * @default * * @param Menu 71 Name * @desc メニューコマンドの名前を指定します。(eval) * stringに変更したい場合は、名前を''で囲ってください。 * @default * * @param Menu 71 Symbol * @desc メニューコマンドの記号です。メニューコマンドごとに独自のものとしてください。 * @default * * @param Menu 71 Show * @desc このメニューコマンドを表示するためのevalの状態です。 * @default * * @param Menu 71 Enabled * @desc メニューコマンドを有効にしますか? (eval) * @default * * @param Menu 71 Ext * @desc メニューコマンドの拡張です。(eval) * @default * * @param Menu 71 Main Bind * @desc メニューコマンドによって有効になる機能です。(eval) * @default * * @param Menu 71 Actor Bind * @desc メニューコマンドによりアクターを選択した際、有効になる機能です。 * @default * * @param ---Menu 72--- * @default * * @param Menu 72 Name * @desc メニューコマンドの名前を指定します。(eval) * stringに変更したい場合は、名前を''で囲ってください。 * @default * * @param Menu 72 Symbol * @desc メニューコマンドの記号です。メニューコマンドごとに独自のものとしてください。 * @default * * @param Menu 72 Show * @desc このメニューコマンドを表示するためのevalの状態です。 * @default * * @param Menu 72 Enabled * @desc メニューコマンドを有効にしますか? (eval) * @default * * @param Menu 72 Ext * @desc メニューコマンドの拡張です。(eval) * @default * * @param Menu 72 Main Bind * @desc メニューコマンドによって有効になる機能です。(eval) * @default * * @param Menu 72 Actor Bind * @desc メニューコマンドによりアクターを選択した際、有効になる機能です。 * @default * * @param ---Menu 73--- * @default * * @param Menu 73 Name * @desc メニューコマンドの名前を指定します。(eval) * stringに変更したい場合は、名前を''で囲ってください。 * @default * * @param Menu 73 Symbol * @desc メニューコマンドの記号です。メニューコマンドごとに独自のものとしてください。 * @default * * @param Menu 73 Show * @desc このメニューコマンドを表示するためのevalの状態です。 * @default * * @param Menu 73 Enabled * @desc メニューコマンドを有効にしますか? (eval) * @default * * @param Menu 73 Ext * @desc メニューコマンドの拡張です。(eval) * @default * * @param Menu 73 Main Bind * @desc メニューコマンドによって有効になる機能です。(eval) * @default * * @param Menu 73 Actor Bind * @desc メニューコマンドによりアクターを選択した際、有効になる機能です。 * @default * * @param ---Menu 74--- * @default * * @param Menu 74 Name * @desc メニューコマンドの名前を指定します。(eval) * stringに変更したい場合は、名前を''で囲ってください。 * @default * * @param Menu 74 Symbol * @desc メニューコマンドの記号です。メニューコマンドごとに独自のものとしてください。 * @default * * @param Menu 74 Show * @desc このメニューコマンドを表示するためのevalの状態です。 * @default * * @param Menu 74 Enabled * @desc メニューコマンドを有効にしますか? (eval) * @default * * @param Menu 74 Ext * @desc メニューコマンドの拡張です。(eval) * @default * * @param Menu 74 Main Bind * @desc メニューコマンドによって有効になる機能です。(eval) * @default * * @param Menu 74 Actor Bind * @desc メニューコマンドによりアクターを選択した際、有効になる機能です。 * @default * * @param ---Menu 75--- * @default * * @param Menu 75 Name * @desc メニューコマンドの名前を指定します。(eval) * stringに変更したい場合は、名前を''で囲ってください。 * @default * * @param Menu 75 Symbol * @desc メニューコマンドの記号です。メニューコマンドごとに独自のものとしてください。 * @default * * @param Menu 75 Show * @desc このメニューコマンドを表示するためのevalの状態です。 * @default * * @param Menu 75 Enabled * @desc メニューコマンドを有効にしますか? (eval) * @default * * @param Menu 75 Ext * @desc メニューコマンドの拡張です。(eval) * @default * * @param Menu 75 Main Bind * @desc メニューコマンドによって有効になる機能です。(eval) * @default * * @param Menu 75 Actor Bind * @desc メニューコマンドによりアクターを選択した際、有効になる機能です。 * @default * * @param ---Menu 76--- * @default * * @param Menu 76 Name * @desc メニューコマンドの名前を指定します。(eval) * stringに変更したい場合は、名前を''で囲ってください。 * @default * * @param Menu 76 Symbol * @desc メニューコマンドの記号です。メニューコマンドごとに独自のものとしてください。 * @default * * @param Menu 76 Show * @desc このメニューコマンドを表示するためのevalの状態です。 * @default * * @param Menu 76 Enabled * @desc メニューコマンドを有効にしますか? (eval) * @default * * @param Menu 76 Ext * @desc メニューコマンドの拡張です。(eval) * @default * * @param Menu 76 Main Bind * @desc メニューコマンドによって有効になる機能です。(eval) * @default * * @param Menu 76 Actor Bind * @desc メニューコマンドによりアクターを選択した際、有効になる機能です。 * @default * * @param ---Menu 77--- * @default * * @param Menu 77 Name * @desc メニューコマンドの名前を指定します。(eval) * stringに変更したい場合は、名前を''で囲ってください。 * @default * * @param Menu 77 Symbol * @desc メニューコマンドの記号です。メニューコマンドごとに独自のものとしてください。 * @default * * @param Menu 77 Show * @desc このメニューコマンドを表示するためのevalの状態です。 * @default * * @param Menu 77 Enabled * @desc メニューコマンドを有効にしますか? (eval) * @default * * @param Menu 77 Ext * @desc メニューコマンドの拡張です。(eval) * @default * * @param Menu 77 Main Bind * @desc メニューコマンドによって有効になる機能です。(eval) * @default * * @param Menu 77 Actor Bind * @desc メニューコマンドによりアクターを選択した際、有効になる機能です。 * @default * * @param ---Menu 78--- * @default * * @param Menu 78 Name * @desc メニューコマンドの名前を指定します。(eval) * stringに変更したい場合は、名前を''で囲ってください。 * @default * * @param Menu 78 Symbol * @desc メニューコマンドの記号です。メニューコマンドごとに独自のものとしてください。 * @default * * @param Menu 78 Show * @desc このメニューコマンドを表示するためのevalの状態です。 * @default * * @param Menu 78 Enabled * @desc メニューコマンドを有効にしますか? (eval) * @default * * @param Menu 78 Ext * @desc メニューコマンドの拡張です。(eval) * @default * * @param Menu 78 Main Bind * @desc メニューコマンドによって有効になる機能です。(eval) * @default * * @param Menu 78 Actor Bind * @desc メニューコマンドによりアクターを選択した際、有効になる機能です。 * @default * * @param ---Menu 79--- * @default * * @param Menu 79 Name * @desc メニューコマンドの名前を指定します。(eval) * stringに変更したい場合は、名前を''で囲ってください。 * @default * * @param Menu 79 Symbol * @desc メニューコマンドの記号です。メニューコマンドごとに独自のものとしてください。 * @default * * @param Menu 79 Show * @desc このメニューコマンドを表示するためのevalの状態です。 * @default * * @param Menu 79 Enabled * @desc メニューコマンドを有効にしますか? (eval) * @default * * @param Menu 79 Ext * @desc メニューコマンドの拡張です。(eval) * @default * * @param Menu 79 Main Bind * @desc メニューコマンドによって有効になる機能です。(eval) * @default * * @param Menu 79 Actor Bind * @desc メニューコマンドによりアクターを選択した際、有効になる機能です。 * @default * * @param ---Menu 80--- * @default * * @param Menu 80 Name * @desc メニューコマンドの名前を指定します。(eval) * stringに変更したい場合は、名前を''で囲ってください。 * @default * * @param Menu 80 Symbol * @desc メニューコマンドの記号です。メニューコマンドごとに独自のものとしてください。 * @default * * @param Menu 80 Show * @desc このメニューコマンドを表示するためのevalの状態です。 * @default * * @param Menu 80 Enabled * @desc メニューコマンドを有効にしますか? (eval) * @default * * @param Menu 80 Ext * @desc メニューコマンドの拡張です。(eval) * @default * * @param Menu 80 Main Bind * @desc メニューコマンドによって有効になる機能です。(eval) * @default * * @param Menu 80 Actor Bind * @desc メニューコマンドによりアクターを選択した際、有効になる機能です。 * @default * * @param ---Menu 81--- * @default * * @param Menu 81 Name * @desc メニューコマンドの名前を指定します。(eval) * stringに変更したい場合は、名前を''で囲ってください。 * @default 'Common Event 1' * * @param Menu 81 Symbol * @desc メニューコマンドの記号です。メニューコマンドごとに独自のものとしてください。 * @default common event * * @param Menu 81 Show * @desc このメニューコマンドを表示するためのevalの状態です。 * @default false * * @param Menu 81 Enabled * @desc メニューコマンドを有効にしますか? (eval) * @default true * * @param Menu 81 Ext * @desc メニューコマンドの拡張です。(eval) * @default 1 * * @param Menu 81 Main Bind * @desc メニューコマンドによって有効になる機能です。(eval) * @default this.callCommonEvent.bind(this) * * @param Menu 81 Actor Bind * @desc メニューコマンドによりアクターを選択した際、有効になる機能です。 * @default * * @param ---Menu 82--- * @default * * @param Menu 82 Name * @desc メニューコマンドの名前を指定します。(eval) * stringに変更したい場合は、名前を''で囲ってください。 * @default 'Common Event 2' * * @param Menu 82 Symbol * @desc メニューコマンドの記号です。メニューコマンドごとに独自のものとしてください。 * @default common event * * @param Menu 82 Show * @desc このメニューコマンドを表示するためのevalの状態です。 * @default false * * @param Menu 82 Enabled * @desc メニューコマンドを有効にしますか? (eval) * @default true * * @param Menu 82 Ext * @desc メニューコマンドの拡張です。(eval) * @default 2 * * @param Menu 82 Main Bind * @desc メニューコマンドによって有効になる機能です。(eval) * @default this.callCommonEvent.bind(this) * * @param Menu 82 Actor Bind * @desc メニューコマンドによりアクターを選択した際、有効になる機能です。 * @default * * @param ---Menu 83--- * @default * * @param Menu 83 Name * @desc メニューコマンドの名前を指定します。(eval) * stringに変更したい場合は、名前を''で囲ってください。 * @default 'Common Event 3' * * @param Menu 83 Symbol * @desc メニューコマンドの記号です。メニューコマンドごとに独自のものとしてください。 * @default common event * * @param Menu 83 Show * @desc このメニューコマンドを表示するためのevalの状態です。 * @default false * * @param Menu 83 Enabled * @desc メニューコマンドを有効にしますか? (eval) * @default true * * @param Menu 83 Ext * @desc メニューコマンドの拡張です。(eval) * @default 3 * * @param Menu 83 Main Bind * @desc メニューコマンドによって有効になる機能です。(eval) * @default this.callCommonEvent.bind(this) * * @param Menu 83 Actor Bind * @desc メニューコマンドによりアクターを選択した際、有効になる機能です。 * @default * * @param ---Menu 84--- * @default * * @param Menu 84 Name * @desc メニューコマンドの名前を指定します。(eval) * stringに変更したい場合は、名前を''で囲ってください。 * @default * * @param Menu 84 Symbol * @desc メニューコマンドの記号です。メニューコマンドごとに独自のものとしてください。 * @default * * @param Menu 84 Show * @desc このメニューコマンドを表示するためのevalの状態です。 * @default * * @param Menu 84 Enabled * @desc メニューコマンドを有効にしますか? (eval) * @default * * @param Menu 84 Ext * @desc メニューコマンドの拡張です。(eval) * @default * * @param Menu 84 Main Bind * @desc メニューコマンドによって有効になる機能です。(eval) * @default * * @param Menu 84 Actor Bind * @desc メニューコマンドによりアクターを選択した際、有効になる機能です。 * @default * * @param ---Menu 85--- * @default * * @param Menu 85 Name * @desc メニューコマンドの名前を指定します。(eval) * stringに変更したい場合は、名前を''で囲ってください。 * @default * * @param Menu 85 Symbol * @desc メニューコマンドの記号です。メニューコマンドごとに独自のものとしてください。 * @default * * @param Menu 85 Show * @desc このメニューコマンドを表示するためのevalの状態です。 * @default * * @param Menu 85 Enabled * @desc メニューコマンドを有効にしますか? (eval) * @default * * @param Menu 85 Ext * @desc メニューコマンドの拡張です。(eval) * @default * * @param Menu 85 Main Bind * @desc メニューコマンドによって有効になる機能です。(eval) * @default * * @param Menu 85 Actor Bind * @desc メニューコマンドによりアクターを選択した際、有効になる機能です。 * @default * * @param ---Menu 86--- * @default * * @param Menu 86 Name * @desc メニューコマンドの名前を指定します。(eval) * stringに変更したい場合は、名前を''で囲ってください。 * @default * * @param Menu 86 Symbol * @desc メニューコマンドの記号です。メニューコマンドごとに独自のものとしてください。 * @default * * @param Menu 86 Show * @desc このメニューコマンドを表示するためのevalの状態です。 * @default * * @param Menu 86 Enabled * @desc メニューコマンドを有効にしますか? (eval) * @default * * @param Menu 86 Ext * @desc メニューコマンドの拡張です。(eval) * @default * * @param Menu 86 Main Bind * @desc メニューコマンドによって有効になる機能です。(eval) * @default * * @param Menu 86 Actor Bind * @desc メニューコマンドによりアクターを選択した際、有効になる機能です。 * @default * * @param ---Menu 87--- * @default * * @param Menu 87 Name * @desc メニューコマンドの名前を指定します。(eval) * stringに変更したい場合は、名前を''で囲ってください。 * @default * * @param Menu 87 Symbol * @desc メニューコマンドの記号です。メニューコマンドごとに独自のものとしてください。 * @default * * @param Menu 87 Show * @desc このメニューコマンドを表示するためのevalの状態です。 * @default * * @param Menu 87 Enabled * @desc メニューコマンドを有効にしますか? (eval) * @default * * @param Menu 87 Ext * @desc メニューコマンドの拡張です。(eval) * @default * * @param Menu 87 Main Bind * @desc メニューコマンドによって有効になる機能です。(eval) * @default * * @param Menu 87 Actor Bind * @desc メニューコマンドによりアクターを選択した際、有効になる機能です。 * @default * * @param ---Menu 88--- * @default * * @param Menu 88 Name * @desc メニューコマンドの名前を指定します。(eval) * stringに変更したい場合は、名前を''で囲ってください。 * @default * * @param Menu 88 Symbol * @desc メニューコマンドの記号です。メニューコマンドごとに独自のものとしてください。 * @default * * @param Menu 88 Show * @desc このメニューコマンドを表示するためのevalの状態です。 * @default * * @param Menu 88 Enabled * @desc メニューコマンドを有効にしますか? (eval) * @default * * @param Menu 88 Ext * @desc メニューコマンドの拡張です。(eval) * @default * * @param Menu 88 Main Bind * @desc メニューコマンドによって有効になる機能です。(eval) * @default * * @param Menu 88 Actor Bind * @desc メニューコマンドによりアクターを選択した際、有効になる機能です。 * @default * * @param ---Menu 89--- * @default * * @param Menu 89 Name * @desc メニューコマンドの名前を指定します。(eval) * stringに変更したい場合は、名前を''で囲ってください。 * @default * * @param Menu 89 Symbol * @desc メニューコマンドの記号です。メニューコマンドごとに独自のものとしてください。 * @default * * @param Menu 89 Show * @desc このメニューコマンドを表示するためのevalの状態です。 * @default * * @param Menu 89 Enabled * @desc メニューコマンドを有効にしますか? (eval) * @default * * @param Menu 89 Ext * @desc メニューコマンドの拡張です。(eval) * @default * * @param Menu 89 Main Bind * @desc メニューコマンドによって有効になる機能です。(eval) * @default * * @param Menu 89 Actor Bind * @desc メニューコマンドによりアクターを選択した際、有効になる機能です。 * @default * * @param ---Menu 90--- * @default * * @param Menu 90 Name * @desc メニューコマンドの名前を指定します。(eval) * stringに変更したい場合は、名前を''で囲ってください。 * @default TextManager.options * * @param Menu 90 Symbol * @desc メニューコマンドの記号です。メニューコマンドごとに独自のものとしてください。 * @default options * * @param Menu 90 Show * @desc このメニューコマンドを表示するためのevalの状態です。 * @default this.needsCommand('options') * * @param Menu 90 Enabled * @desc メニューコマンドを有効にしますか? (eval) * @default this.isOptionsEnabled() * * @param Menu 90 Ext * @desc メニューコマンドの拡張です。(eval) * @default * * @param Menu 90 Main Bind * @desc メニューコマンドによって有効になる機能です。(eval) * @default this.commandOptions.bind(this) * * @param Menu 90 Actor Bind * @desc メニューコマンドによりアクターを選択した際、有効になる機能です。 * @default * * @param ---Menu 91--- * @default * * @param Menu 91 Name * @desc メニューコマンドの名前を指定します。(eval) * stringに変更したい場合は、名前を''で囲ってください。 * @default * * @param Menu 91 Symbol * @desc メニューコマンドの記号です。メニューコマンドごとに独自のものとしてください。 * @default * * @param Menu 91 Show * @desc このメニューコマンドを表示するためのevalの状態です。 * @default * * @param Menu 91 Enabled * @desc メニューコマンドを有効にしますか? (eval) * @default * * @param Menu 91 Ext * @desc メニューコマンドの拡張です。(eval) * @default * * @param Menu 91 Main Bind * @desc メニューコマンドによって有効になる機能です。(eval) * @default * * @param Menu 91 Actor Bind * @desc メニューコマンドによりアクターを選択した際、有効になる機能です。 * @default * * @param ---Menu 92--- * @default * * @param Menu 92 Name * @desc メニューコマンドの名前を指定します。(eval) * stringに変更したい場合は、名前を''で囲ってください。 * @default * * @param Menu 92 Symbol * @desc メニューコマンドの記号です。メニューコマンドごとに独自のものとしてください。 * @default * * @param Menu 92 Show * @desc このメニューコマンドを表示するためのevalの状態です。 * @default * * @param Menu 92 Enabled * @desc メニューコマンドを有効にしますか? (eval) * @default * * @param Menu 92 Ext * @desc メニューコマンドの拡張です。(eval) * @default * * @param Menu 92 Main Bind * @desc メニューコマンドによって有効になる機能です。(eval) * @default * * @param Menu 92 Actor Bind * @desc メニューコマンドによりアクターを選択した際、有効になる機能です。 * @default * * @param ---Menu 93--- * @default * * @param Menu 93 Name * @desc メニューコマンドの名前を指定します。(eval) * stringに変更したい場合は、名前を''で囲ってください。 * @default * * @param Menu 93 Symbol * @desc メニューコマンドの記号です。メニューコマンドごとに独自のものとしてください。 * @default * * @param Menu 93 Show * @desc このメニューコマンドを表示するためのevalの状態です。 * @default * * @param Menu 93 Enabled * @desc メニューコマンドを有効にしますか? (eval) * @default * * @param Menu 93 Ext * @desc メニューコマンドの拡張です。(eval) * @default * * @param Menu 93 Main Bind * @desc メニューコマンドによって有効になる機能です。(eval) * @default * * @param Menu 93 Actor Bind * @desc メニューコマンドによりアクターを選択した際、有効になる機能です。 * @default * * @param ---Menu 94--- * @default * * @param Menu 94 Name * @desc メニューコマンドの名前を指定します。(eval) * stringに変更したい場合は、名前を''で囲ってください。 * @default * * @param Menu 94 Symbol * @desc メニューコマンドの記号です。メニューコマンドごとに独自のものとしてください。 * @default * * @param Menu 94 Show * @desc このメニューコマンドを表示するためのevalの状態です。 * @default * * @param Menu 94 Enabled * @desc メニューコマンドを有効にしますか? (eval) * @default * * @param Menu 94 Ext * @desc メニューコマンドの拡張です。(eval) * @default * * @param Menu 94 Main Bind * @desc メニューコマンドによって有効になる機能です。(eval) * @default * * @param Menu 94 Actor Bind * @desc メニューコマンドによりアクターを選択した際、有効になる機能です。 * @default * * @param ---Menu 95--- * @default * * @param Menu 95 Name * @desc メニューコマンドの名前を指定します。(eval) * stringに変更したい場合は、名前を''で囲ってください。 * @default TextManager.save * * @param Menu 95 Symbol * @desc メニューコマンドの記号です。メニューコマンドごとに独自のものとしてください。 * @default save * * @param Menu 95 Show * @desc このメニューコマンドを表示するためのevalの状態です。 * @default this.needsCommand('save') * * @param Menu 95 Enabled * @desc メニューコマンドを有効にしますか? (eval) * @default this.isSaveEnabled() * * @param Menu 95 Ext * @desc メニューコマンドの拡張です。(eval) * @default * * @param Menu 95 Main Bind * @desc メニューコマンドによって有効になる機能です。(eval) * @default this.commandSave.bind(this) * * @param Menu 95 Actor Bind * @desc メニューコマンドによりアクターを選択した際、有効になる機能です。 * @default * * @param ---Menu 96--- * @default * * @param Menu 96 Name * @desc メニューコマンドの名前を指定します。(eval) * stringに変更したい場合は、名前を''で囲ってください。 * @default * * @param Menu 96 Symbol * @desc メニューコマンドの記号です。メニューコマンドごとに独自のものとしてください。 * @default * * @param Menu 96 Show * @desc このメニューコマンドを表示するためのevalの状態です。 * @default * * @param Menu 96 Enabled * @desc メニューコマンドを有効にしますか? (eval) * @default * * @param Menu 96 Ext * @desc メニューコマンドの拡張です。(eval) * @default * * @param Menu 96 Main Bind * @desc メニューコマンドによって有効になる機能です。(eval) * @default * * @param Menu 96 Actor Bind * @desc メニューコマンドによりアクターを選択した際、有効になる機能です。 * @default * * @param ---Menu 97--- * @default * * @param Menu 97 Name * @desc メニューコマンドの名前を指定します。(eval) * stringに変更したい場合は、名前を''で囲ってください。 * @default * * @param Menu 97 Symbol * @desc メニューコマンドの記号です。メニューコマンドごとに独自のものとしてください。 * @default * * @param Menu 97 Show * @desc このメニューコマンドを表示するためのevalの状態です。 * @default * * @param Menu 97 Enabled * @desc メニューコマンドを有効にしますか? (eval) * @default * * @param Menu 97 Ext * @desc メニューコマンドの拡張です。(eval) * @default * * @param Menu 97 Main Bind * @desc メニューコマンドによって有効になる機能です。(eval) * @default * * @param Menu 97 Actor Bind * @desc メニューコマンドによりアクターを選択した際、有効になる機能です。 * @default * * @param ---Menu 98--- * @default * * @param Menu 98 Name * @desc メニューコマンドの名前を指定します。(eval) * stringに変更したい場合は、名前を''で囲ってください。 * @default * * @param Menu 98 Symbol * @desc メニューコマンドの記号です。メニューコマンドごとに独自のものとしてください。 * @default * * @param Menu 98 Show * @desc このメニューコマンドを表示するためのevalの状態です。 * @default * * @param Menu 98 Enabled * @desc メニューコマンドを有効にしますか? (eval) * @default * * @param Menu 98 Ext * @desc メニューコマンドの拡張です。(eval) * @default * * @param Menu 98 Main Bind * @desc メニューコマンドによって有効になる機能です。(eval) * @default * * @param Menu 98 Actor Bind * @desc メニューコマンドによりアクターを選択した際、有効になる機能です。 * @default * * @param ---Menu 99--- * @default * * @param Menu 99 Name * @desc メニューコマンドの名前を指定します。(eval) * stringに変更したい場合は、名前を''で囲ってください。 * @default 'Debug' * * @param Menu 99 Symbol * @desc メニューコマンドの記号です。メニューコマンドごとに独自のものとしてください。 * @default debug * * @param Menu 99 Show * @desc このメニューコマンドを表示するためのevalの状態です。 * @default $gameTemp.isPlaytest() * * @param Menu 99 Enabled * @desc メニューコマンドを有効にしますか? (eval) * @default true * * @param Menu 99 Ext * @desc メニューコマンドの拡張です。(eval) * @default * * @param Menu 99 Main Bind * @desc メニューコマンドによって有効になる機能です。(eval) * @default this.commandDebug.bind(this) * * @param Menu 99 Actor Bind * @desc メニューコマンドによりアクターを選択した際、有効になる機能です。 * @default * * @param ---Menu 100--- * @default * * @param Menu 100 Name * @desc メニューコマンドの名前を指定します。(eval) * stringに変更したい場合は、名前を''で囲ってください。 * @default TextManager.gameEnd * * @param Menu 100 Symbol * @desc メニューコマンドの記号です。メニューコマンドごとに独自のものとしてください。 * @default gameEnd * * @param Menu 100 Show * @desc このメニューコマンドを表示するためのevalの状態です。 * @default true * * @param Menu 100 Enabled * @desc メニューコマンドを有効にしますか? (eval) * @default this.isGameEndEnabled() * * @param Menu 100 Ext * @desc メニューコマンドの拡張です。(eval) * @default * * @param Menu 100 Main Bind * @desc メニューコマンドによって有効になる機能です。(eval) * @default this.commandGameEnd.bind(this) * * @param Menu 100 Actor Bind * @desc メニューコマンドによりアクターを選択した際、有効になる機能です。 * @default * * @help * ============================================================================ * Introduction * ============================================================================ * * ソースコードを触らずにメニューコマンドの様々な要素を変更したい方は、 * このプラグインを使ってください。 * このプラグインは主に、メニュー生成プロセスを、プラグインマネージャーの * パラメータへ移植します。メニューコマンドのマネジメントプロセスを、 * より明瞭なものにすることができます。 * * ============================================================================ * How to Use This Plugin 使用方法 * ============================================================================ * * パラメータは様々なパートに分かれており、それぞれのパートが、メニューコマンド * がどのように働くかを決定しています。下記にそれぞれの役割を記載します。 * * Name * - メインメニューでの、コマンドの表示方法を表しています。これはevalで、 * すなわちコード方式です。コマンドをそのまま表示したければ、''で囲んでください。 * * Symbol * - コマンド識別子です。各コマンドは独自のシンボルを持っており、お互いに * 干渉を起こさないようになっています。その一方で、同時の機能実行が許容される * のであれば、シンボルは共通のものでも問題はありません。 * * Show * - メインメニューにコマンドを表示させるか決定することができます。 * 常に表示させたい時には、trueと打ち込むだけでOKです。 * * Enabled * - コマンドが有効かどうかを決定することができます。 * コマンド自体は表示されていても、それを選択できるか否かはここで変更できます。 * 常に有効にしたい時には、trueと打ち込むだけでOKです。 * * Ext * - 「エクステンション(拡張)」の略で、使い勝手の良い第二のコマンドを提供します。 * 拡張値に対象が関連付けられていなければ、コマンドに直接的な影響を * 与えることは有りません。コマンドの大多数は、この拡張値を必要としません。 * * Main Bind * - メインメニューからこのコマンドが直接選択された時に、実行される機能です。 * このコマンドに紐づく機能へは、Scene_Menuからアクセスする必要があります。 * アクターを最初に選択し、'this.commandItem.bind(this)' と打ち込んでください。 * (このとき '' はつけないでください) * * Actor Bind * - このコマンドを選択したあと、アクターを選択した際に実行される機能です。 * アクターの選択が不要なメニューコマンドに関しては、この機能は不要です。 * * ============================================================================ * Examples 例 * ============================================================================ * * 下記の例は、メインメニューでコマンドが表示される方法を追加/変更する * いくつかの例です。 * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * * Name: TextManager.item * Symbol: item * Show: this.needsCommand('item') * Enabled: this.areMainCommandsEnabled() * Ext: * Main Bind: this.commandItem.bind(this) * Actor Bind: * * アイテムコマンドは上記の例を使って作成されます。'TextManager.item' は、 * コマンド名がどのように表示されるかを表します。データベースの * テキストマネージャから 'item' に対して、任意の名前を挿入します。 * シンボル 'Item' は、アイテムコマンドの独自の識別子として用いられます。 * コマンドを表示させるために'needsCommand'を実行し、それを確認します。 * この'needsCommand'機能は、アイテムをそこに表示させたいかどうかという * データベースと紐づけられています。このコマンドを有効にするために、 * メインコマンドが有効かどうかを確認し、それは現在のパーティにアクターが * 居るかいないかに関連付けられます。そして最終的には、アイテム項目が * 選択された時、'this.commandItem.bind(this)' が実行されます。 * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * * Name: TextManager.skill * Symbol: skill * Show: this.needsCommand('skill') * Enabled: this.areMainCommandsEnabled() * Ext: * Main Bind: this.commandPersonal.bind(this) * Actor Bind: SceneManager.push(Scene_Skill) * * アイテムコマンドは上記の例を使って作成されます。 'TextManager.skill' は、 * コマンド名がどのように表示されるかを表します。データベースの * テキストマネージャから 'Skill' に対して、任意の名前を挿入します * シンボル 'Skill' は、アイテムコマンドの独自の識別子として用いられます。 * コマンドを表示させるために'needsCommand'を実行し、それを確認します。 * この'needsCommand'機能は、スキルオプションを表示させたいかどうかという * データベースと紐づけられています。このコマンドを有効にするために、 * メインコマンドが有効かどうかを確認し、それは現在のパーティにアクターが * 居るかいないかに関連付けられます。この時、メインのBindコマンドは * 'this.commandPersonal.bind(this)'を代わりに用いて、アクター選択に進みます。 * プレイヤーがアクターを選んだ時、'SceneManager.push(Scene_Skill)' が実行され * プレイヤーを Scene_Skill へ飛ばし、アクターのスキルを管理させます。 * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * * Name: 'Common Event 1' * Symbol: common event * Show: false * Enabled: true * Ext: 1 * Main Bind: this.callCommonEvent.bind(this) * Actor Bind: * * プラグインのデフォルトで含まれているカスタマイズコマンドです。 * このコマンドの名前は 'Common Event 1'ですが、パラメータ設定内で * ''内を変更することで好きなように変更することができます。 * シンボルは全てのコモンイベントに対する識別子となります。 * しかしデフォルトではこのコモンイベントはメインメニューには表示されません。 * もし表示させたい場合は、表示オプションを true にすれば表示されます。 * Enabledオプションが 'true'であるため、プレイヤーは常にコマンドを選択できます。 * Extはどのコモンイベントが再生されるか決定します。例えば、Extの値が 1 のとき * このコマンドが選択された際、「コモンイベント1」が再生されることになります。 * コマンドオプションに対するメインバインドは'this.callCommonEvent.bind(this)' * で、これがコモンイベントを実行します。 * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ //============================================================================= //============================================================================= // Parameter Variables //============================================================================= Yanfly.Parameters = PluginManager.parameters('YEP_MainMenuManager'); Yanfly.Param = Yanfly.Param || {}; Yanfly.Param.MMMCmdAlign = String(Yanfly.Parameters['Command Alignment']); Yanfly.Param.MMMCmdPosition = String(Yanfly.Parameters['Command Position']); Yanfly.Param.MMMCmdCols = String(Yanfly.Parameters['Command Columns']); Yanfly.Param.MMMCmdRows = String(Yanfly.Parameters['Command Rows']); Yanfly.Param.MMMCmdWidth = String(Yanfly.Parameters['Command Width']); Yanfly.MMM.Name = {}; Yanfly.MMM.Symbol = {}; Yanfly.MMM.Show = {}; Yanfly.MMM.Enabled = {}; Yanfly.MMM.Ext = {}; Yanfly.MMM.MainBind = {}; Yanfly.MMM.ActorBind = {}; for (Yanfly.i = 1; Yanfly.i <= 100; ++Yanfly.i) { Yanfly.line = "String(Yanfly.Parameters['Menu " + Yanfly.i + " Name'])"; Yanfly.MMM.Name[Yanfly.i] = eval(Yanfly.line); Yanfly.line = "String(Yanfly.Parameters['Menu " + Yanfly.i + " Symbol'])"; Yanfly.MMM.Symbol[Yanfly.i] = eval(Yanfly.line); Yanfly.line = "String(Yanfly.Parameters['Menu " + Yanfly.i + " Show'])"; Yanfly.MMM.Show[Yanfly.i] = eval(Yanfly.line); Yanfly.line = "String(Yanfly.Parameters['Menu " + Yanfly.i + " Enabled'])"; Yanfly.MMM.Enabled[Yanfly.i] = eval(Yanfly.line); Yanfly.line = "String(Yanfly.Parameters['Menu " + Yanfly.i + " Ext'])"; Yanfly.MMM.Ext[Yanfly.i] = eval(Yanfly.line); Yanfly.line = "String(Yanfly.Parameters['Menu " + Yanfly.i + " Main Bind'])"; Yanfly.MMM.MainBind[Yanfly.i] = eval(Yanfly.line); Yanfly.line = "String(Yanfly.Parameters['Menu " + Yanfly.i + " Actor Bind'])"; Yanfly.MMM.ActorBind[Yanfly.i] = eval(Yanfly.line); }; //============================================================================= // Window_MenuCommand //============================================================================= Window_MenuCommand.prototype.makeCommandList = function () { for (var i = 1; i <= 100; ++i) { this.createCommand(i); } }; Window_MenuCommand.prototype.addMainCommands = function () { }; Window_MenuCommand.prototype.addFormationCommand = function () { }; Window_MenuCommand.prototype.addOriginalCommands = function () { }; Window_MenuCommand.prototype.addOptionsCommand = function () { }; Window_MenuCommand.prototype.addSaveCommand = function () { }; Window_MenuCommand.prototype.addGameEndCommand = function () { }; Window_MenuCommand.prototype.createCommand = function (i) { var show = Yanfly.MMM.Show[i]; if (show === '') return; if (!eval(show)) return; var name = Yanfly.MMM.Name[i]; if (name === '') return; name = eval(name); var symbol = Yanfly.MMM.Symbol[i]; if (symbol === '') return; var enabled = eval(Yanfly.MMM.Enabled[i]); if (enabled === '') enabled = true; var ext = eval(Yanfly.MMM.Ext[i]); this.addCommand(name, symbol, enabled, ext); this.addSymbolBridge(symbol); }; Window_MenuCommand.prototype.addSymbolBridge = function (symbol) { if (symbol === 'item') this.addMainCommands(); if (symbol === 'formation') this.addFormationCommand(); if (symbol === 'formation') this.addOriginalCommands(); if (symbol === 'options') this.addOptionsCommand(); if (symbol === 'save') this.addSaveCommand(); if (symbol === 'gameEnd') this.addGameEndCommand(); }; Window_MenuCommand.prototype.itemTextAlign = function () { return Yanfly.Param.MMMCmdAlign; }; Window_MenuCommand.prototype.windowWidth = function () { return eval(Yanfly.Param.MMMCmdWidth); }; Window_MenuCommand.prototype.maxCols = function () { return eval(Yanfly.Param.MMMCmdCols); }; Window_MenuCommand.prototype.numVisibleRows = function () { return eval(Yanfly.Param.MMMCmdRows); }; //============================================================================= // Window_MenuStatus //============================================================================= Yanfly.MMM.Window_MenuStatus_initialize = Window_MenuStatus.prototype.initialize; Window_MenuStatus.prototype.initialize = function (wx, wy) { this._initX = wx; Yanfly.MMM.Window_MenuStatus_initialize.call(this, wx, wy); }; Window_MenuStatus.prototype.windowWidth = function () { return Graphics.boxWidth - this._initX; }; //============================================================================= // Scene_Menu //============================================================================= Yanfly.MMM.Scene_Menu_create = Scene_Menu.prototype.create; Scene_Menu.prototype.create = function () { Yanfly.MMM.Scene_Menu_create.call(this); this.repositionWindows(); }; Scene_Menu.prototype.createCommandWindow = function () { this._commandWindow = new Window_MenuCommand(0, 0); this.createCommandWindowBinds(); this._commandWindow.setHandler('cancel', this.popScene.bind(this)); this.addWindow(this._commandWindow); }; Scene_Menu.prototype.createCommandWindowBinds = function () { this._actorBinds = {}; for (var i = 1; i <= 100; ++i) { var symbol = Yanfly.MMM.Symbol[i]; if (symbol === '') continue; var bind = Yanfly.MMM.MainBind[i]; if (bind === '') continue; eval("this._commandWindow.setHandler('" + symbol + "', " + bind + ")"); var actorBind = Yanfly.MMM.ActorBind[i]; if (actorBind === '') continue; this._actorBinds[symbol] = actorBind; } }; Scene_Menu.prototype.repositionWindows = function () { if (Yanfly.Param.MMMCmdPosition === 'right') { this._commandWindow.x = Graphics.boxWidth - this._commandWindow.width; this._goldWindow.x = Graphics.boxWidth - this._goldWindow.width; this._statusWindow.x = 0; } else if (Yanfly.Param.MMMCmdPosition === 'left') { this._commandWindow.x = 0; this._goldWindow.x = 0; this._statusWindow.x = this._commandWindow.width; } }; Scene_Menu.prototype.onPersonalOk = function () { var symbol = this._commandWindow.currentSymbol(); var actorBind = this._actorBinds[symbol]; if (!actorBind) return; eval(actorBind); }; Scene_Menu.prototype.callCommonEvent = function () { var ext = this._commandWindow.currentExt(); $gameTemp.reserveCommonEvent(parseInt(ext)); this.popScene(); }; Scene_Menu.prototype.commandDebug = function () { SceneManager.push(Scene_Debug); }; //============================================================================= // End of File //=============================================================================
dazed/translations
www/js/plugins/YEP_MainMenuManager.js
JavaScript
unknown
210,921
//============================================================================= // Yanfly Engine Plugins - Message Core // YEP_MessageCore.js //============================================================================= var Imported = Imported || {}; Imported.YEP_MessageCore = true; var Yanfly = Yanfly || {}; Yanfly.Message = Yanfly.Message || {}; Yanfly.Message.version = 1.19; //============================================================================= /*:ja * @plugindesc v1.19 文章の表示方法や機能を変更できます。 * @author Yanfly Engine Plugins * * @param ---一般--- * @text ---一般--- * @default * * @param Default Rows * @parent ---一般--- * @type number * @min 0 * @text 文章ウィンドウの行数 * @desc デフォルト:4 * @default 4 * * @param Default Width * @parent ---一般--- * @text 文章ウィンドウの幅 * @desc ピクセル数。デフォルト:Graphics.boxWidth * @default Graphics.boxWidth * * @param Face Indent * @parent ---一般--- * @text 顔画像使用時のインデント値 * @desc デフォルト:Window_Base._faceWidth + 24 * @default Window_Base._faceWidth + 24 * * @param Fast Forward Key * @parent ---一般--- * @text 早送りキー * @default pagedown * * @param Enable Fast Forward * @parent ---一般--- * @type boolean * @on 有効 * @off 無効 * @text 早送りキー有効化 * @desc 無効:false / 有効:true * @default true * * @param Word Wrapping * @parent ---一般--- * @type boolean * @on 有効 * @off 無効 * @text ワードラップ有効化(2バイト文字は非機能) * @desc 無効:false / 有効:true * @default false * * @param Description Wrap * @parent ---一般--- * @type boolean * @on 有効 * @off 無効 * @text 詳細欄のワードラップ有効化(2バイト文字は非機能) * @desc 無効:false / 有効:true * @default false * * @param Word Wrap Space * @parent ---一般--- * @type boolean * @on 有効 * @off 無効 * @text 手動改行を有効化 * @desc 無効:false / 有効:true * @default false * * @param Tight Wrap * @parent ---一般--- * @type boolean * @on 有効 * @off 無効 * @text 顔画像使用時にタイトラップ * @desc 無効:false / 有効:true * @default false * * @param ---フォント--- * @text ---フォント--- * @default * * @param Font Name * @parent ---フォント--- * @text 文章ウィンドウのフォント * @desc デフォルト:GameFont * @default GameFont * * @param Font Name CH * @parent ---フォント--- * @text 中国語のデフォルトフォント * @desc デフォルト:SimHei, Heiti TC, sans-serif * @default SimHei, Heiti TC, sans-serif * * @param Font Name KR * @parent ---フォント--- * @text 韓国語のデフォルトフォント * @desc デフォルト:Dotum, AppleGothic, sans-serif * @default Dotum, AppleGothic, sans-serif * * @param Font Size * @parent ---フォント--- * @type number * @min 1 * @text 文章ウィンドウのフォントサイズ * @desc デフォルト:28 * @default 28 * * @param Font Size Change * @parent ---フォント--- * @type number * @min 1 * @text サイズ変更 * @desc \{ と \} が使われた際、このフォントサイズを適用。デフォルト:12 * @default 12 * * @param Font Changed Max * @parent ---フォント--- * @type number * @min 1 * @text 最大フォントサイズ * @desc \{ による最大サイズ。デフォルト:96 * @default 96 * * @param Font Changed Min * @parent ---フォント--- * @type number * @min 1 * @text 最小フォントサイズ * @desc \{ による最小サイズ。デフォルト:12 * @default 12 * * @param Font Outline * @parent ---フォント--- * @type number * @min 0 * @text アウトライン幅 * @desc デフォルト:4 * @default 4 * * @param Maintain Font * @parent ---フォント--- * @type boolean * @on 維持 * @off 非維持 * @text フォント維持 * @desc フォント名/サイズを変更時、次の文章で維持 * 非維持:false / 維持:true * @default false * * @param ---名前ボックス--- * @text ---名前ボックス--- * @default * * @param Name Box Buffer X * @parent ---名前ボックス--- * @type number * @min -9007 * @max 9007 * @text X軸位置 * @default -28 * * @param Name Box Buffer Y * @parent ---名前ボックス--- * @type number * @min -9007 * @max 9007 * @text Y軸位置 * @default 0 * * @param Name Box Padding * @parent ---名前ボックス--- * @text ボックス幅 * @default this.standardPadding() * 4 * * @param Name Box Color * @parent ---名前ボックス--- * @type number * @min 0 * @max 31 * @text テキスト色 * @default 0 * * @param Name Box Clear * @parent ---名前ボックス--- * @type boolean * @on 透明化 * @off 通常 * @text 透明化 * @desc 通常:false / 透明化:true * @default false * * @param Name Box Added Text * @parent ---名前ボックス--- * @text 追加テキスト * @desc 名前ボックスに自動的に追加されるテキスト。自動的にカラー設定をしたい場合などに使われます。 * @default \c[6] * * @param Name Box Auto Close * @parent ---名前ボックス--- * @type boolean * @on 閉じる * @off 閉じない * @text 自動クローズ * @desc 名前ボックスに別の名前が表示される時、文章ウィンドウを閉じる。閉じる:true / 閉じない:false * @default false * * @help * 翻訳:ムノクラ * https://fungamemake.com/ * https://twitter.com/munokura/ * * =========================================================================== * 導入 * =========================================================================== * * RPGツクールMVでは文章システムが強化されましたが、 * このプラグインを使えば、更にアイテム・武器・防具・衣装の名前や、 * アイコンの制御文字の変換を容易に行なうことができます。 * * またこのスクリプトでは、ゲーム中に文章ウィンドウのサイズを最適化したり * セパレートフォントや、テキストの早送り機能を提供します。 * * =========================================================================== * ワードラップ * =========================================================================== * * ※ワードラップ機能は2バイト文字では動作しません。 * * ワードラップ機能は、文章システム上で使うことができます。 * プラグインコマンドを用いて、有効/無効の切り替えを行ってください。 * ワードラップを使うことで、文章ウィンドウ外へはみ出た文章を、 * 自動的に次の行に折り返します。この際、エディターの改行入力は無効化され、 * プラグインによる改行が優先されます。 * * <br>もしくは<line break>という制御文字を使って、改行を行います。 * 新しい行を始めたい部分の前、もしくは後にこのコードを入力してください。 * * ワードラップ機能は、文章ウィンドウ向けの機能ですが、 * アイテム詳細など、それ以外の部分にもこの機能を用いたい場合、 * そのテキストの先頭に<WordWrap>と挿入すれば、利用することができます。 * * =========================================================================== * 制御文字 * =========================================================================== * * 文章に特定の制御文字を使用し、 * 次のコードに置き換えることができます。 * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * * Text Code Function * \V[n] n 番目の変数の値と置き換えられます。 * \N[n] n 番目のアクター名と置き換えられます。 * \P[n] n 番目のパーティメンバー名と置き換えられます。 * \G 所持金と置き換えられます。 * \C[n] 続くテキストを、n 番目のカラーで表示します。 * \I[n] n 番目のアイコンを表示します。 * \{ テキストサイズを一段階大きくします。 * \} テキストサイズを一段階小さくします。 * \\ \のキャラクターと置き換えられます。 * \$ 所持金ウィンドウを開きます。 * \. 1/4 秒の間をあけます。 * \| 1 秒の間をあけます。 * \! ボタンインプットを待ちます。 * \> 同じラインの残りのテキストを一気に表示します。 * \< 上記のエフェクトをキャンセルします。 * \^ テキスト表示後にインプットを待たなくなります。 * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * * Wait: Effect: * \w[x] - x フレーム分の間をあけます (60フレーム = 1秒) * 文章ウィンドウ限定の機能です。 * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * * NameWindow: Effect: * \n<x> - 左揃えで x の文字列で名前ボックスを作成します。 *注 * \nc<x> - 中央揃えで x の文字列で名前ボックスを作成します。 *注 * \nr<x> - 右揃えで x の文字列で名前ボックスを作成します。 *注 * * *注:文章ウィンドウのみに有効 * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * * Line Break Effect: * <br> - ワードラップモードで改行を行います。 * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * * Position: Effect: * \px[x] - テキストのx方向の位置を指定 * \py[x] - テキストのy方向の位置を指定 * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * * Outline: Effect: * \oc[x] - アウトラインの色を x にします。 * \ow[x] - アウトラインの幅を x にします。 * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * * Font: Effect: * \fr - 全てのフォント変更をリセットします。 * \fs[x] - フォントサイズを x に変更します。 * \fn<x> - フォント名を x に変更します。 * \fb - ボールド設定を切り替えます。 * \fi - イタリック設定を切り替えます。 * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * * Actor: Effect: * \af[x] - アクター x の顔を表示します。(注) * \ac[x] - アクターの職業名を表示します。 * \an[x] - アクターのニックネームを表示します。 * * *注:文章ウィンドウのみで有効 * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * * Party: Effect: * \pf[x] - パーティメンバー x の顔を表示します。*注 * \pc[x] - パーティメンバー x の職業名を表示します。 * \pn[x] - パーティメンバー x のニックネームを表示します。 * * *注:文章ウィンドウのみで有効 * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * * Names: Effect: * \nc[x] - 職業 x の名前を表示します。 * \ni[x] - アイテム x の名前を表示します。 * \nw[x] - 武器 x の名前を表示します。 * \na[x] - 防具 x の名前を表示します。 * \ns[x] - スキル x の名前を表示します。 * \nt[x] - ステート x の名前を表示します。 * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * * Icon Names: Effect: * \nc[x] - 職業 x の名前を表示します。 * \ni[x] - アイテム x の名前を表示します。 * \nw[x] - 武器 x の名前を表示します。 * \na[x] - 防具 x の名前を表示します。 * \ns[x] - スキル x の名前を表示します。 * \nt[x] - ステート x の名前を表示します。 * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * * これらはスクリプトと共に加えられた制御文字です。これらのコードは、 * 文章ウィンドウにのみ働くものであることに気を付けてください。 * またそれ以外にも、ヘルプの詳細、アクタープロフィールなどにも有効です。 * * =========================================================================== * プラグインコマンド * =========================================================================== * * イベントエディタを通して下記のプラグインコマンドを用いることで、文章 * システムの様々な要素を変更することができます。 * * プラグインコマンド * MessageRows 6 * - 表示される文章の列を6にします。 * もし[文章の表示]を継続的に使っている場合、 * 行の上限に到達するまで、 * あとに続く文章を表示し続けます。 * それ以降の文章については、 * 重複回避のためにカットされます。 * * MessageWidth 400 * - 文章ウィンドウの幅を400ピクセルに変更します。 * 右側に寄りすぎている文字は、 * 適宜カットされ調整が行われます。 * * EnableWordWrap * - ワードラップを有効にします。 * 文がウィンドウサイズを超えてしまった時に、自動的に次の行に進みます。 * 改行する際は '\br'を挿入してください。 * * DisableWordWrap * - ワードラップを無効にします。 * エディタ内で新しい文が始まった地点で、自動的に改行されます。 * * EnableFastForward * - 文章内の早送りキーを有効にします。 * * DisableFastForward * - 文章内の早送りキーを無効にします。 * * =========================================================================== * Changelog * =========================================================================== * * Version 1.19: * - Updated for RPG Maker MV version 1.5.0. * * Version 1.18: * - Added new plugin parameters: 'Font Name CH' and 'Font Name KR'. * * Version 1.17: * - Compatibility update with Message Macros for 'Name Box Auto Close' * option. * * Version 1.16: * - Added 'Tight Wrap' plugin parameter as a word wrap option to make the * word wrap tighter when using faces. * * Version 1.15: * - Added a failsafe where if the name box window would be off the screen, it * will automatically reposition itself to under the main message window. * * Version 1.14: * - Added 'Name Box Close' plugin parameter. If this is enabled, the message * window will check for the Name Window speaker each time a follow up message * occurs. If the name in the currently Name Window matches the name in the * following Name Window, the message window will remain open. If it doesn't, * the Name Window will close and reopen to indicate a new speaker. * * Version 1.13: * - Added 'Maintain Font' plugin parameter under the Font category. This will * allow you to use text codes \fn<x> and \fs[x] to permanently change the * font of your messages until you use it again. \fr will reset them to the * plugin's default parameter settings. * * Version 1.12: * - 'Word Wrap Space' parameter no longer leaves a space at the beginning of * each message. * * Version 1.11: * - Added 'Font Outline' parameter for the plugin parameters. This adjusts * the font outline width used by default for only message fonts. * * Version 1.10: * - Updated the Message Row system for Extended Message Pack 1's Autosizing * feature to work with extended heights. * * Version 1.09: * - Replaced 'Fast Forward' parameter with the 'Fast Forward Key' parameter * and 'Enable Fast Forward' parameter. Two new Plugin Commands are added. * They are 'EnableFastForward' and 'DisableFastForward' for control over when * fast forwarding is allowed as to not cause timed cutscenes to desynch. * * Version 1.08: * - Fixed a bug regarding Input Number positioning when the Message Window's * position was middle. * * Version 1.07: * - Added 'Word Wrap Space' for word wrap users. This parameter will leave a * space behind for those who want a space left behind. * * Version 1.06: * - Fixed a bug that would cause masking problems with mobile devices. * * Version 1.05: * - Fixed a bug that would cause the namebox window to appear distorted. * * Version 1.04: * - Fixed a bug that captured too many text codes with the namebox window. * - Timed Name Window's closing speed with main window's closing speed. * * Verison 1.03: * - Fixed a bug with textcodes that messed up wordwrapping. * - Fixed a bug with font reset, italic, and bold textcodes. * * Version 1.02: * - Namebox Window's overlap feature that's in every MV window is now * disabled to allow for overlapping with main message window. * - Updated window positioning for Branch Choices, Number Input, and Item * Selection windows. * * Version 1.01: * - Added 'Description Wrap' into the parameters to allow for all item * descriptions to be automatically processed with word wrapping. * * Version 1.00: * - Finished plugin! */ /*: * @plugindesc v1.19 Adds more features to the Message Window to customized * the way your messages appear and functions. * @author Yanfly Engine Plugins * * @param ---General--- * @default * * @param Default Rows * @parent ---General--- * @type number * @min 0 * @desc This is default amount of rows the message box will have. * Default: 4 * @default 4 * * @param Default Width * @parent ---General--- * @desc This is default width for the message box in pixels. * Default: Graphics.boxWidth * @default Graphics.boxWidth * * @param Face Indent * @parent ---General--- * @desc If using a face graphic, this is how much text indents by. * Default: Window_Base._faceWidth + 24 * @default Window_Base._faceWidth + 24 * * @param Fast Forward Key * @parent ---General--- * @type combo * @option tab * @option shift * @option control * @option pageup * @option pagedown * @desc This is the key used for fast forwarding. * @default pagedown * * @param Enable Fast Forward * @parent ---General--- * @type boolean * @on YES * @off NO * @desc Enable fast forward button for your messages by default? * NO - false YES - true * @default true * * @param Word Wrapping * @parent ---General--- * @type boolean * @on YES * @off NO * @desc Use this to enable or disable word wrapping by default. * OFF - false ON - true * @default false * * @param Description Wrap * @parent ---General--- * @type boolean * @on YES * @off NO * @desc Enable or disable word wrapping for descriptions. * OFF - false ON - true * @default false * * @param Word Wrap Space * @parent ---General--- * @type boolean * @on YES * @off NO * @desc Insert a space with manual line breaks? * NO - false YES - true * @default false * * @param Tight Wrap * @parent ---General--- * @type boolean * @on YES * @off NO * @desc If true and using a face for the message, the message will * wrap tighter. NO - false YES - true * @default false * * @param ---Font--- * @default * * @param Font Name * @parent ---Font--- * @desc This is the default font used for the Message Window. * Default: GameFont * @default GameFont * * @param Font Name CH * @parent ---Font--- * @desc This is the default font used for the Message Window for Chinese. * Default: SimHei, Heiti TC, sans-serif * @default SimHei, Heiti TC, sans-serif * * @param Font Name KR * @parent ---Font--- * @desc This is the default font used for the Message Window for Korean. * Default: Dotum, AppleGothic, sans-serif * @default Dotum, AppleGothic, sans-serif * * @param Font Size * @parent ---Font--- * @type number * @min 1 * @desc This is the default font size used for the Message Window. * Default: 28 * @default 28 * * @param Font Size Change * @parent ---Font--- * @type number * @min 1 * @desc Whenever \{ and \} are used, they adjust by this value. * Default: 12 * @default 12 * * @param Font Changed Max * @parent ---Font--- * @type number * @min 1 * @desc This is the maximum size achieved by \{. * Default: 96 * @default 96 * * @param Font Changed Min * @parent ---Font--- * @type number * @min 1 * @desc This is the minimum size achieved by \{. * Default: 12 * @default 12 * * @param Font Outline * @parent ---Font--- * @type number * @min 0 * @desc This is the default font outline width for messages. * Default: 4 * @default 4 * * @param Maintain Font * @parent ---Font--- * @type boolean * @on YES * @off NO * @desc When changing the font name or size, maintain for following * messages. NO - false YES - true * @default false * * @param ---Name Box--- * @default * * @param Name Box Buffer X * @parent ---Name Box--- * @type number * @desc This is the buffer for the x location of the Name Box. * @default -28 * * @param Name Box Buffer Y * @parent ---Name Box--- * @type number * @desc This is the buffer for the y location of the Name Box. * @default 0 * * @param Name Box Padding * @parent ---Name Box--- * @desc This is the value for the padding of the Name Box. * @default this.standardPadding() * 4 * * @param Name Box Color * @parent ---Name Box--- * @type number * @min 0 * @max 31 * @desc This is the text color used for the Name Box. * @default 0 * * @param Name Box Clear * @parent ---Name Box--- * @type boolean * @on YES * @off NO * @desc Do you wish for the Name Box window to be clear? * NO - false YES - true * @default false * * @param Name Box Added Text * @parent ---Name Box--- * @desc This text is always added whenever the name box is used. * This can be used to automatically set up colors. * @default \c[6] * * @param Name Box Auto Close * @parent ---Name Box--- * @type boolean * @on YES * @off NO * @desc Close the message window each time the namebox displays a * different name? YES - true NO - false * @default false * * @help * ============================================================================ * Introduction * ============================================================================ * * While RPG Maker MV Ace certainly improved the message system a whole lot, it * wouldn't hurt to add in a few more features, such as name windows, * converting textcodes to write out the icons and/or names of items, weapons, * armours, and* more in quicker fashion. This script also gives the developer * the ability to adjust the size of the message window during the game, give * it a separate font, and to give the player a text fast-forward feature. * * ============================================================================ * Word Wrapping * ============================================================================ * * Word wrapping is now possible through the message system. You can enable and * disable Word wrap using Plugin Commands. While using word wrap, if the word * is to extend past the message window's area, it will automatically go to the * following line. That said, word wrap will disable the editor's line breaks * and will require you to use the ones provided by the plugin: * * <br> or <line break> is text code to apply a line break. Use this before or * after a part in which you wish to start a new line. * * Keep in mind word wrapping is mostly for message windows. However, in other * places that you'd like to see word wrapping, such as item descriptions, * insert <WordWrap> at the beginning of the text to enable it. * * ============================================================================ * Text Codes * ============================================================================ * * By using certain text codes in your messages, you can have the game replace * them with the following: * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * * Text Code Function * \V[n] Replaced by the value of the nth variable. * \N[n] Replaced by the name of the nth actor. * \P[n] Replaced by the name of the nth party member. * \G Replaced by the currency unit. * \C[n] Draw the subsequent text in the nth color. * \I[n] Draw the nth icon. * \{ Increases the text size by one step. * \} Decreases the text size by one step. * \\ Replaced with the backslash character. * \$ Opens the gold window. * \. Waits 1/4th seconds. * \| Waits 1 second. * \! Waits for button input. * \> Display remaining text on same line all at once. * \< Cancel the effect that displays text all at once. * \^ Do not wait for input after displaying text. * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * * Wait: Effect: * \w[x] - Waits x frames (60 frames = 1 second). Message window only. * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * * NameWindow: Effect: * \n<x> - Creates a name box with x string. Left side. *Note * \nc<x> - Creates a name box with x string. Centered. *Note * \nr<x> - Creates a name box with x string. Right side. *Note * * *Note: Works for message window only. * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * * Line Break Effect: * <br> - If using word wrap mode, this will cause a line break. * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * * Position: Effect: * \px[x] - Sets x position of text to x. * \py[x] - Sets y position of text to y. * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * * Outline: Effect: * \oc[x] - Sets outline colour to x. * \ow[x] - Sets outline width to x. * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * * Font: Effect: * \fr - Resets all font changes. * \fs[x] - Changes font size to x. * \fn<x> - Changes font name to x. * \fb - Toggles font boldness. * \fi - Toggles font italic. * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * * Actor: Effect: * \af[x] - Shows face of actor x. *Note * \ac[x] - Writes out actor's class name. * \an[x] - Writes out actor's nickname. * * *Note: Works for message window only. * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * * Party: Effect: * \pf[x] - Shows face of party member x. *Note * \pc[x] - Writes out party member x's class name. * \pn[x] - Writes out party member x's nickname. * * *Note: Works for message window only. * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * * Names: Effect: * \nc[x] - Writes out class x's name. * \ni[x] - Writes out item x's name. * \nw[x] - Writes out weapon x's name. * \na[x] - Writes out armour x's name. * \ns[x] - Writes out skill x's name. * \nt[x] - Writes out state x's name. * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * * Icon Names: Effect: * \ii[x] - Writes out item x's name including icon. * \iw[x] - Writes out weapon x's name including icon. * \ia[x] - Writes out armour x's name including icon. * \is[x] - Writes out skill x's name including icon. * \it[x] - Writes out state x's name including icon. * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * * And those are the text codes added with this script. Keep in mind that some * of these text codes only work for the Message Window. Otherwise, they'll * work for help descriptions, actor biographies, and others. * * ============================================================================ * Plugin Commands * ============================================================================ * * The following are some plugin commands you can use through the Event Editor * to change various aspects about the Message system. * * Plugin Comand * MessageRows 6 * - Changes the Message Rows displayed to 6. If you are using continuous * Show Text events, this will continue displaying the following lines's * texts until it hits the row limit. Anything after that is cut off until * the next message starts to avoid accidental overlap. * * MessageWidth 400 * - Changes the Message Window Width to 400 pixels. This will cut off any * words that are shown too far to the right so adjust accordingly! * * EnableWordWrap * - Enables wordwrapping. If a word extends past the window size, it will * automatically move onto the next line. Keep in mind, you will need to use * \br to perform line breaks. * * DisableWordWrap * - This disables wordwrapping. Line breaks will be automatic at points * where a new line is started in the editor. * * EnableFastForward * - Enables Fast Forward key from working with messages. * * DisableFastForward * - Disables Fast Forward key from working with messages. * * ============================================================================ * Changelog * ============================================================================ * * Version 1.19: * - Updated for RPG Maker MV version 1.5.0. * * Version 1.18: * - Added new plugin parameters: 'Font Name CH' and 'Font Name KR'. * * Version 1.17: * - Compatibility update with Message Macros for 'Name Box Auto Close' option. * * Version 1.16: * - Added 'Tight Wrap' plugin parameter as a word wrap option to make the * word wrap tighter when using faces. * * Version 1.15: * - Added a failsafe where if the name box window would be off the screen, it * will automatically reposition itself to under the main message window. * * Version 1.14: * - Added 'Name Box Close' plugin parameter. If this is enabled, the message * window will check for the Name Window speaker each time a follow up message * occurs. If the name in the currently Name Window matches the name in the * following Name Window, the message window will remain open. If it doesn't, * the Name Window will close and reopen to indicate a new speaker. * * Version 1.13: * - Added 'Maintain Font' plugin parameter under the Font category. This will * allow you to use text codes \fn<x> and \fs[x] to permanently change the font * of your messages until you use it again. \fr will reset them to the plugin's * default parameter settings. * * Version 1.12: * - 'Word Wrap Space' parameter no longer leaves a space at the beginning of * each message. * * Version 1.11: * - Added 'Font Outline' parameter for the plugin parameters. This adjusts the * font outline width used by default for only message fonts. * * Version 1.10: * - Updated the Message Row system for Extended Message Pack 1's Autosizing * feature to work with extended heights. * * Version 1.09: * - Replaced 'Fast Forward' parameter with the 'Fast Forward Key' parameter * and 'Enable Fast Forward' parameter. Two new Plugin Commands are added. They * are 'EnableFastForward' and 'DisableFastForward' for control over when fast * forwarding is allowed as to not cause timed cutscenes to desynch. * * Version 1.08: * - Fixed a bug regarding Input Number positioning when the Message Window's * position was middle. * * Version 1.07: * - Added 'Word Wrap Space' for word wrap users. This parameter will leave a * space behind for those who want a space left behind. * * Version 1.06: * - Fixed a bug that would cause masking problems with mobile devices. * * Version 1.05: * - Fixed a bug that would cause the namebox window to appear distorted. * * Version 1.04: * - Fixed a bug that captured too many text codes with the namebox window. * - Timed Name Window's closing speed with main window's closing speed. * * Verison 1.03: * - Fixed a bug with textcodes that messed up wordwrapping. * - Fixed a bug with font reset, italic, and bold textcodes. * * Version 1.02: * - Namebox Window's overlap feature that's in every MV window is now disabled * to allow for overlapping with main message window. * - Updated window positioning for Branch Choices, Number Input, and Item * Selection windows. * * Version 1.01: * - Added 'Description Wrap' into the parameters to allow for all item * descriptions to be automatically processed with word wrapping. * * Version 1.00: * - Finished plugin! */ //============================================================================= //============================================================================= // Parameter Variables //============================================================================= Yanfly.Parameters = PluginManager.parameters('YEP_MessageCore'); Yanfly.Param = Yanfly.Param || {}; Yanfly.Param.MSGDefaultRows = String(Yanfly.Parameters['Default Rows']); Yanfly.Param.MSGDefaultWidth = String(Yanfly.Parameters['Default Width']); Yanfly.Param.MSGFaceIndent = String(Yanfly.Parameters['Face Indent']); Yanfly.Param.MSGFastForwardKey = String(Yanfly.Parameters['Fast Forward Key']); Yanfly.Param.MSGFFOn = eval(String(Yanfly.Parameters['Enable Fast Forward'])); Yanfly.Param.MSGWordWrap = String(Yanfly.Parameters['Word Wrapping']); Yanfly.Param.MSGWordWrap = eval(Yanfly.Param.MSGWordWrap); Yanfly.Param.MSGDescWrap = String(Yanfly.Parameters['Description Wrap']); Yanfly.Param.MSGWrapSpace = eval(String(Yanfly.Parameters['Word Wrap Space'])); Yanfly.Param.MSGTightWrap = eval(String(Yanfly.Parameters['Tight Wrap'])); Yanfly.Param.MSGFontName = String(Yanfly.Parameters['Font Name']); Yanfly.Param.MSGCNFontName = String(Yanfly.Parameters['Font Name CH']); Yanfly.Param.MSGKRFontName = String(Yanfly.Parameters['Font Name KR']); Yanfly.Param.MSGFontSize = Number(Yanfly.Parameters['Font Size']); Yanfly.Param.MSGFontSizeChange = String(Yanfly.Parameters['Font Size Change']); Yanfly.Param.MSGFontChangeMax = String(Yanfly.Parameters['Font Changed Max']); Yanfly.Param.MSGFontChangeMin = String(Yanfly.Parameters['Font Changed Min']); Yanfly.Param.MSGFontOutline = Number(Yanfly.Parameters['Font Outline']); Yanfly.Param.MSGFontMaintain = eval(String(Yanfly.Parameters['Maintain Font'])); Yanfly.Param.MSGNameBoxBufferX = String(Yanfly.Parameters['Name Box Buffer X']); Yanfly.Param.MSGNameBoxBufferY = String(Yanfly.Parameters['Name Box Buffer Y']); Yanfly.Param.MSGNameBoxPadding = String(Yanfly.Parameters['Name Box Padding']); Yanfly.Param.MSGNameBoxColor = Number(Yanfly.Parameters['Name Box Color']); Yanfly.Param.MSGNameBoxClear = String(Yanfly.Parameters['Name Box Clear']); Yanfly.Param.MSGNameBoxText = String(Yanfly.Parameters['Name Box Added Text']); Yanfly.Param.MSGNameBoxClose = String(Yanfly.Parameters['Name Box Auto Close']); Yanfly.Param.MSGNameBoxClose = eval(Yanfly.Param.MSGNameBoxClose); //============================================================================= // Bitmap //============================================================================= Yanfly.Message.Bitmap_initialize = Bitmap.prototype.initialize; Bitmap.prototype.initialize = function (width, height) { Yanfly.Message.Bitmap_initialize.call(this, width, height); this.fontBold = false; }; Yanfly.Message.Bitmap_makeFontNameText = Bitmap.prototype._makeFontNameText; Bitmap.prototype._makeFontNameText = function () { if (this.fontBold) return 'Bold ' + this.fontSize + 'px ' + this.fontFace; return Yanfly.Message.Bitmap_makeFontNameText.call(this); }; //============================================================================= // Game_System //============================================================================= Yanfly.Message.Game_System_initialize = Game_System.prototype.initialize; Game_System.prototype.initialize = function () { Yanfly.Message.Game_System_initialize.call(this); this.initMessageSystem(); this.initMessageFontSettings(); }; Game_System.prototype.initMessageSystem = function () { this._wordWrap = Yanfly.Param.MSGWordWrap; this._fastForward = Yanfly.Param.MSGFFOn; }; Game_System.prototype.initMessageFontSettings = function () { if ($dataSystem.locale.match(/^zh/)) { this._msgFontName = Yanfly.Param.MSGCNFontName; } else if ($dataSystem.locale.match(/^ko/)) { this._msgFontName = Yanfly.Param.MSGKRFontName; } else { this._msgFontName = Yanfly.Param.MSGFontName; } this._msgFontSize = Yanfly.Param.MSGFontSize; this._msgFontOutline = Yanfly.Param.MSGFontOutline; }; Game_System.prototype.messageRows = function () { var rows = eval(this._messageRows) || eval(Yanfly.Param.MSGDefaultRows); return Math.max(1, Number(rows)); }; Game_System.prototype.messageWidth = function () { return eval(this._messageWidth) || eval(Yanfly.Param.MSGDefaultWidth); }; Game_System.prototype.wordWrap = function () { if (this._wordWrap === undefined) this.initMessageSystem(); return this._wordWrap; }; Game_System.prototype.setWordWrap = function (state) { if (this._wordWrap === undefined) this.initMessageSystem(); this._wordWrap = state; }; Game_System.prototype.isFastFowardEnabled = function () { if (this._fastForward === undefined) this.initMessageSystem(); return this._fastForward; }; Game_System.prototype.setFastFoward = function (state) { if (this._fastForward === undefined) this.initMessageSystem(); this._fastForward = state; }; Game_System.prototype.getMessageFontName = function () { if (this._msgFontName === undefined) this.initMessageFontSettings(); return this._msgFontName; }; Game_System.prototype.setMessageFontName = function (value) { if (this._msgFontName === undefined) this.initMessageFontSettings(); this._msgFontName = value; }; Game_System.prototype.getMessageFontSize = function () { if (this._msgFontSize === undefined) this.initMessageFontSettings(); return this._msgFontSize; }; Game_System.prototype.setMessageFontSize = function (value) { if (this._msgFontSize === undefined) this.initMessageFontSettings(); this._msgFontSize = value; }; Game_System.prototype.getMessageFontOutline = function () { if (this._msgFontOutline === undefined) this.initMessageFontSettings(); return this._msgFontOutline; }; Game_System.prototype.setMessageFontOutline = function (value) { if (this._msgFontOutline === undefined) this.initMessageFontSettings(); this._msgFontOutline = value; }; //============================================================================= // Game_Message //============================================================================= Game_Message.prototype.addText = function (text) { if ($gameSystem.wordWrap()) text = '<WordWrap>' + text; this.add(text); }; //============================================================================= // Game_Interpreter //============================================================================= Yanfly.Message.Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand; Game_Interpreter.prototype.pluginCommand = function (command, args) { Yanfly.Message.Game_Interpreter_pluginCommand.call(this, command, args); if (command === 'MessageRows') $gameSystem._messageRows = args[0]; if (command === 'MessageWidth') $gameSystem._messageWidth = args[0]; if (command === 'EnableWordWrap') $gameSystem.setWordWrap(true); if (command === 'DisableWordWrap') $gameSystem.setWordWrap(false); if (command === 'EnableFastForward') $gameSystem.setFastFoward(true); if (command === 'DisableFastForward') $gameSystem.setFastFoward(false); }; Game_Interpreter.prototype.command101 = function () { if (!$gameMessage.isBusy()) { $gameMessage.setFaceImage(this._params[0], this._params[1]); $gameMessage.setBackground(this._params[2]); $gameMessage.setPositionType(this._params[3]); while (this.isContinueMessageString()) { this._index++; if (this._list[this._index].code === 401) { $gameMessage.addText(this.currentCommand().parameters[0]); } if ($gameMessage._texts.length >= $gameSystem.messageRows()) break; } switch (this.nextEventCode()) { case 102: this._index++; this.setupChoices(this.currentCommand().parameters); break; case 103: this._index++; this.setupNumInput(this.currentCommand().parameters); break; case 104: this._index++; this.setupItemChoice(this.currentCommand().parameters); break; } this._index++; this.setWaitMode('message'); } return false; }; Game_Interpreter.prototype.isContinueMessageString = function () { if (this.nextEventCode() === 101 && $gameSystem.messageRows() > 4) { return true; } else { return this.nextEventCode() === 401; } }; //============================================================================= // Window_Base //============================================================================= Yanfly.Message.Window_Base_resetFontSettings = Window_Base.prototype.resetFontSettings; Window_Base.prototype.resetFontSettings = function () { Yanfly.Message.Window_Base_resetFontSettings.call(this); this.contents.fontBold = false; this.contents.fontItalic = false; this.contents.outlineColor = 'rgba(0, 0, 0, 0.5)'; this.contents.outlineWidth = $gameSystem.getMessageFontOutline(); }; Window_Base.prototype.textWidthEx = function (text) { return this.drawTextEx(text, 0, this.contents.height + this.lineHeight()); }; Yanfly.Message.Window_Base_convertEscapeCharacters = Window_Base.prototype.convertEscapeCharacters; Window_Base.prototype.convertEscapeCharacters = function (text) { text = this.setWordWrap(text); text = Yanfly.Message.Window_Base_convertEscapeCharacters.call(this, text); text = this.convertExtraEscapeCharacters(text); return text; }; Window_Base.prototype.setWordWrap = function (text) { this._wordWrap = false; if (text.match(/<(?:WordWrap)>/i)) { this._wordWrap = true; text = text.replace(/<(?:WordWrap)>/gi, ''); } if (this._wordWrap) { var replace = Yanfly.Param.MSGWrapSpace ? ' ' : ''; text = text.replace(/[\n\r]+/g, replace); } if (this._wordWrap) { text = text.replace(/<(?:BR|line break)>/gi, '\n'); } else { text = text.replace(/<(?:BR|line break)>/gi, ''); } return text; }; Window_Base.prototype.convertExtraEscapeCharacters = function (text) { // Font Codes text = text.replace(/\x1bFR/gi, '\x1bMSGCORE[0]'); text = text.replace(/\x1bFB/gi, '\x1bMSGCORE[1]'); text = text.replace(/\x1bFI/gi, '\x1bMSGCORE[2]'); // \AC[n] text = text.replace(/\x1bAC\[(\d+)\]/gi, function () { return this.actorClassName(parseInt(arguments[1])); }.bind(this)); // \AN[n] text = text.replace(/\x1bAN\[(\d+)\]/gi, function () { return this.actorNickname(parseInt(arguments[1])); }.bind(this)); // \PC[n] text = text.replace(/\x1bPC\[(\d+)\]/gi, function () { return this.partyClassName(parseInt(arguments[1])); }.bind(this)); // \PN[n] text = text.replace(/\x1bPN\[(\d+)\]/gi, function () { return this.partyNickname(parseInt(arguments[1])); }.bind(this)); // \NC[n] text = text.replace(/\x1bNC\[(\d+)\]/gi, function () { return $dataClasses[parseInt(arguments[1])].name; }.bind(this)); // \NI[n] text = text.replace(/\x1bNI\[(\d+)\]/gi, function () { return $dataItems[parseInt(arguments[1])].name; }.bind(this)); // \NW[n] text = text.replace(/\x1bNW\[(\d+)\]/gi, function () { return $dataWeapons[parseInt(arguments[1])].name; }.bind(this)); // \NA[n] text = text.replace(/\x1bNA\[(\d+)\]/gi, function () { return $dataArmors[parseInt(arguments[1])].name; }.bind(this)); // \NE[n] text = text.replace(/\x1bNE\[(\d+)\]/gi, function () { return $dataEnemies[parseInt(arguments[1])].name; }.bind(this)); // \NS[n] text = text.replace(/\x1bNS\[(\d+)\]/gi, function () { return $dataSkills[parseInt(arguments[1])].name; }.bind(this)); // \NT[n] text = text.replace(/\x1bNT\[(\d+)\]/gi, function () { return $dataStates[parseInt(arguments[1])].name; }.bind(this)); // \II[n] text = text.replace(/\x1bII\[(\d+)\]/gi, function () { return this.escapeIconItem(arguments[1], $dataItems); }.bind(this)); // \IW[n] text = text.replace(/\x1bIW\[(\d+)\]/gi, function () { return this.escapeIconItem(arguments[1], $dataWeapons); }.bind(this)); // \IA[n] text = text.replace(/\x1bIA\[(\d+)\]/gi, function () { return this.escapeIconItem(arguments[1], $dataArmors); }.bind(this)); // \IS[n] text = text.replace(/\x1bIS\[(\d+)\]/gi, function () { return this.escapeIconItem(arguments[1], $dataSkills); }.bind(this)); // \IT[n] text = text.replace(/\x1bIT\[(\d+)\]/gi, function () { return this.escapeIconItem(arguments[1], $dataStates); }.bind(this)); // Finish return text; }; Window_Base.prototype.actorClassName = function (n) { var actor = n >= 1 ? $gameActors.actor(n) : null; return actor ? actor.currentClass().name : ''; }; Window_Base.prototype.actorNickname = function (n) { var actor = n >= 1 ? $gameActors.actor(n) : null; return actor ? actor.nickname() : ''; }; Window_Base.prototype.partyClassName = function (n) { var actor = n >= 1 ? $gameParty.members()[n - 1] : null; return actor ? actor.currentClass().name : ''; }; Window_Base.prototype.partyNickname = function (n) { var actor = n >= 1 ? $gameParty.members()[n - 1] : null; return actor ? actor.nickname() : ''; }; Window_Base.prototype.escapeIconItem = function (n, database) { return '\x1bI[' + database[n].iconIndex + ']' + database[n].name; }; Window_Base.prototype.obtainEscapeString = function (textState) { var arr = /^\<(.*?)\>/.exec(textState.text.slice(textState.index)); if (arr) { textState.index += arr[0].length; return String(arr[0].slice(1, arr[0].length - 1)); } else { return ''; } }; Yanfly.Message.Window_Base_processEscapeCharacter = Window_Base.prototype.processEscapeCharacter; Window_Base.prototype.processEscapeCharacter = function (code, textState) { switch (code) { case 'MSGCORE': var id = this.obtainEscapeParam(textState); if (id === 0) { $gameSystem.initMessageFontSettings(); this.resetFontSettings(); } if (id === 1) this.contents.fontBold = !this.contents.fontBold; if (id === 2) this.contents.fontItalic = !this.contents.fontItalic; break; case 'FS': var size = this.obtainEscapeParam(textState); this.contents.fontSize = size; if (Yanfly.Param.MSGFontMaintain) $gameSystem.setMessageFontSize(size); break; case 'FN': var name = this.obtainEscapeString(textState); this.contents.fontFace = name; if (Yanfly.Param.MSGFontMaintain) $gameSystem.setMessageFontName(name); break; case 'OC': var id = this.obtainEscapeParam(textState); this.contents.outlineColor = this.textColor(id); break; case 'OW': this.contents.outlineWidth = this.obtainEscapeParam(textState); break; case 'PX': textState.x = this.obtainEscapeParam(textState); break; case 'PY': textState.y = this.obtainEscapeParam(textState); break; default: Yanfly.Message.Window_Base_processEscapeCharacter.call(this, code, textState); break; } }; Window_Base.prototype.makeFontBigger = function () { var size = this.contents.fontSize + eval(Yanfly.Param.MSGFontSizeChange); this.contents.fontSize = Math.min(size, Yanfly.Param.MSGFontChangeMax); }; Window_Base.prototype.makeFontSmaller = function () { var size = this.contents.fontSize - eval(Yanfly.Param.MSGFontSizeChange); this.contents.fontSize = Math.max(size, Yanfly.Param.MSGFontChangeMin); }; Yanfly.Message.Window_Base_processNormalCharacter = Window_Base.prototype.processNormalCharacter; Window_Base.prototype.processNormalCharacter = function (textState) { if (this.checkWordWrap(textState)) return this.processNewLine(textState); Yanfly.Message.Window_Base_processNormalCharacter.call(this, textState); }; Window_Base.prototype.checkWordWrap = function (textState) { if (!textState) return false; if (!this._wordWrap) return false; if (textState.text[textState.index] === ' ') { var nextSpace = textState.text.indexOf(' ', textState.index + 1); var nextBreak = textState.text.indexOf('\n', textState.index + 1); if (nextSpace < 0) nextSpace = textState.text.length + 1; if (nextBreak > 0) nextSpace = Math.min(nextSpace, nextBreak); var word = textState.text.substring(textState.index, nextSpace); var size = this.textWidthExCheck(word); } return (size + textState.x > this.wordwrapWidth()); }; Window_Base.prototype.wordwrapWidth = function () { return this.contents.width; }; Window_Base.prototype.saveCurrentWindowSettings = function () { this._saveFontFace = this.contents.fontFace; this._saveFontSize = this.contents.fontSize; this._savetextColor = this.contents.textColor; this._saveFontBold = this.contents.fontBold; this._saveFontItalic = this.contents.fontItalic; this._saveOutlineColor = this.contents.outlineColor; this._saveOutlineWidth = this.contents.outlineWidth; }; Window_Base.prototype.restoreCurrentWindowSettings = function () { this.contents.fontFace = this._saveFontFace; this.contents.fontSize = this._saveFontSize; this.contents.textColor = this._savetextColor; this.contents.fontBold = this._saveFontBold; this.contents.fontItalic = this._saveFontItalic; this.contents.outlineColor = this._saveOutlineColor; this.contents.outlineWidth = this._saveOutlineWidth; }; Window_Base.prototype.clearCurrentWindowSettings = function () { this._saveFontFace = undefined; this._saveFontSize = undefined; this._savetextColor = undefined; this._saveFontBold = undefined; this._saveFontItalic = undefined; this._saveOutlineColor = undefined; this._saveOutlineWidth = undefined; }; Window_Base.prototype.textWidthExCheck = function (text) { var setting = this._wordWrap; this._wordWrap = false; this.saveCurrentWindowSettings(); this._checkWordWrapMode = true; var value = this.drawTextEx(text, 0, this.contents.height); this._checkWordWrapMode = false; this.restoreCurrentWindowSettings(); this.clearCurrentWindowSettings(); this._wordWrap = setting; return value; }; //============================================================================= // Window_Help //============================================================================= Yanfly.Message.Window_Help_setItem = Window_Help.prototype.setItem; Window_Help.prototype.setItem = function (item) { if (eval(Yanfly.Param.MSGDescWrap)) { this.setText(item ? '<WordWrap>' + item.description : ''); } else { Yanfly.Message.Window_Help_setItem.call(this, item); } }; //============================================================================= // Window_ChoiceList //============================================================================= Window_ChoiceList.prototype.standardFontFace = function () { return $gameSystem.getMessageFontName(); }; Window_ChoiceList.prototype.standardFontSize = function () { return $gameSystem.getMessageFontSize(); }; Yanfly.Message.Window_ChoiceList_updatePlacement = Window_ChoiceList.prototype.updatePlacement; Window_ChoiceList.prototype.updatePlacement = function () { Yanfly.Message.Window_ChoiceList_updatePlacement.call(this); var messagePosType = $gameMessage.positionType(); if (messagePosType === 0) { this.y = this._messageWindow.height; } else if (messagePosType === 2) { this.y = Graphics.boxHeight - this._messageWindow.height - this.height; } }; //============================================================================= // Window_NumberInput //============================================================================= Yanfly.Message.Window_NumberInput_updatePlacement = Window_NumberInput.prototype.updatePlacement; Window_NumberInput.prototype.updatePlacement = function () { Yanfly.Message.Window_NumberInput_updatePlacement.call(this); var messageY = this._messageWindow.y; var messagePosType = $gameMessage.positionType(); if (messagePosType === 0) { this.y = this._messageWindow.height; } else if (messagePosType === 1) { if (messageY >= Graphics.boxHeight / 2) { this.y = messageY - this.height; } else { this.y = messageY + this._messageWindow.height; } } else if (messagePosType === 2) { this.y = Graphics.boxHeight - this._messageWindow.height - this.height; } }; //============================================================================= // Window_EventItem //============================================================================= Yanfly.Message.Window_EventItem_updatePlacement = Window_EventItem.prototype.updatePlacement; Window_EventItem.prototype.updatePlacement = function () { Yanfly.Message.Window_EventItem_updatePlacement.call(this); var messagePosType = $gameMessage.positionType(); if (messagePosType === 0) { this.y = Graphics.boxHeight - this.height; } else if (messagePosType === 2) { this.y = 0; } }; //============================================================================= // Window_ScrollText //============================================================================= Window_ScrollText.prototype.standardFontFace = function () { return $gameSystem.getMessageFontName(); }; Window_ScrollText.prototype.standardFontSize = function () { return $gameSystem.getMessageFontSize(); }; //============================================================================= // Window_NameBox //============================================================================= Yanfly.DisableWebGLMask = false; function Window_NameBox() { this.initialize.apply(this, arguments); } Window_NameBox.prototype = Object.create(Window_Base.prototype); Window_NameBox.prototype.constructor = Window_NameBox; Window_NameBox.prototype.initialize = function (parentWindow) { this._parentWindow = parentWindow; Window_Base.prototype.initialize.call(this, 0, 0, 240, this.windowHeight()); this._text = ''; this._lastNameText = ''; this._openness = 0; this._closeCounter = 0; this.deactivate(); if (eval(Yanfly.Param.MSGNameBoxClear)) { this.backOpacity = 0; this.opacity = 0; } this.hide(); }; Window_NameBox.prototype.windowWidth = function () { this.resetFontSettings(); var dw = this.textWidthEx(this._text); dw += this.padding * 2; var width = dw + eval(Yanfly.Param.MSGNameBoxPadding) return Math.ceil(width); }; Window_NameBox.prototype.textWidthEx = function (text) { return this.drawTextEx(text, 0, this.contents.height); }; Window_NameBox.prototype.calcNormalCharacter = function (textState) { return this.textWidth(textState.text[textState.index++]); }; Window_NameBox.prototype.windowHeight = function () { return this.fittingHeight(1); }; Window_NameBox.prototype.standardFontFace = function () { return $gameSystem.getMessageFontName(); }; Window_NameBox.prototype.standardFontSize = function () { return $gameSystem.getMessageFontSize(); }; Window_NameBox.prototype.update = function () { Window_Base.prototype.update.call(this); if (this.active) return; if (this.isClosed()) return; if (this.isClosing()) return; if (this._closeCounter-- > 0) return; if (this._parentWindow.isClosing()) { this._openness = this._parentWindow.openness; } this.close(); }; Window_NameBox.prototype.refresh = function (text, position) { this.show(); this._lastNameText = text; this._text = Yanfly.Param.MSGNameBoxText + text; this._position = position; this.width = this.windowWidth(); this.createContents(); this.contents.clear(); this.resetFontSettings(); this.changeTextColor(this.textColor(Yanfly.Param.MSGNameBoxColor)); var padding = eval(Yanfly.Param.MSGNameBoxPadding) / 2; this.drawTextEx(this._text, padding, 0, this.contents.width); this._parentWindow.adjustWindowSettings(); this._parentWindow.updatePlacement(); this.adjustPositionX(); this.adjustPositionY(); this.open(); this.activate(); this._closeCounter = 4; return ''; }; Window_NameBox.prototype.adjustPositionX = function () { if (this._position === 1) { this.x = this._parentWindow.x; this.x += eval(Yanfly.Param.MSGNameBoxBufferX); } else if (this._position === 2) { this.x = this._parentWindow.x; this.x += this._parentWindow.width * 3 / 10; this.x -= this.width / 2; } else if (this._position === 3) { this.x = this._parentWindow.x; this.x += this._parentWindow.width / 2; this.x -= this.width / 2; } else if (this._position === 4) { this.x = this._parentWindow.x; this.x += this._parentWindow.width * 7 / 10; this.x -= this.width / 2; } else { this.x = this._parentWindow.x + this._parentWindow.width; this.x -= this.width; this.x -= eval(Yanfly.Param.MSGNameBoxBufferX); } this.x = this.x.clamp(0, Graphics.boxWidth - this.width); }; Window_NameBox.prototype.adjustPositionY = function () { if ($gameMessage.positionType() === 0) { this.y = this._parentWindow.y + this._parentWindow.height; this.y -= eval(Yanfly.Param.MSGNameBoxBufferY); } else { this.y = this._parentWindow.y; this.y -= this.height; this.y += eval(Yanfly.Param.MSGNameBoxBufferY); } if (this.y < 0) { this.y = this._parentWindow.y + this._parentWindow.height; this.y -= eval(Yanfly.Param.MSGNameBoxBufferY); } }; //============================================================================= // Window_Message //============================================================================= Yanfly.Message.Window_Message_createSubWindows = Window_Message.prototype.createSubWindows; Window_Message.prototype.createSubWindows = function () { Yanfly.Message.Window_Message_createSubWindows.call(this); this._nameWindow = new Window_NameBox(this); Yanfly.nameWindow = this._nameWindow; var scene = SceneManager._scene; scene.addChild(this._nameWindow); }; Window_Message.prototype.numVisibleRows = function () { return $gameSystem.messageRows(); }; Window_Message.prototype.windowWidth = function () { return $gameSystem.messageWidth(); }; Window_Message.prototype.wordwrapWidth = function () { if (Yanfly.Param.MSGTightWrap && $gameMessage.faceName() !== '') { return this.contents.width - this.newLineX(); } return Window_Base.prototype.wordwrapWidth.call(this); }; Window_Message.prototype.adjustWindowSettings = function () { this.width = this.windowWidth(); this.height = Math.min(this.windowHeight(), Graphics.boxHeight); if (Math.abs(Graphics.boxHeight - this.height) < this.lineHeight()) { this.height = Graphics.boxHeight; } this.createContents(); this.x = (Graphics.boxWidth - this.width) / 2; }; Yanfly.Message.Window_Message_startMessage = Window_Message.prototype.startMessage; Window_Message.prototype.startMessage = function () { this._nameWindow.deactivate(); Yanfly.Message.Window_Message_startMessage.call(this); }; Yanfly.Message.Window_Message_terminateMessage = Window_Message.prototype.terminateMessage; Window_Message.prototype.terminateMessage = function () { this._nameWindow.deactivate(); Yanfly.Message.Window_Message_terminateMessage.call(this); }; Yanfly.Message.Window_Message_newPage = Window_Message.prototype.newPage; Window_Message.prototype.newPage = function (textState) { this.adjustWindowSettings(); Yanfly.Message.Window_Message_newPage.call(this, textState); }; Window_Message.prototype.standardFontFace = function () { return $gameSystem.getMessageFontName(); }; Window_Message.prototype.standardFontSize = function () { return $gameSystem.getMessageFontSize(); }; Window_Message.prototype.newLineX = function () { if ($gameMessage.faceName() === '') { return 0; } else { return eval(Yanfly.Param.MSGFaceIndent); } }; Window_Message.prototype.isFastForward = function () { if (!$gameSystem.isFastFowardEnabled()) return false; return Input.isPressed(Yanfly.Param.MSGFastForwardKey); }; Yanfly.Message.Window_Message_updateInput = Window_Message.prototype.updateInput; Window_Message.prototype.updateInput = function () { if (this.pause && this.isFastForward()) { if (!this._textState) { this.pause = false; this.terminateMessage(); } } return Yanfly.Message.Window_Message_updateInput.call(this); }; Yanfly.Message.Window_Message_updateShowFast = Window_Message.prototype.updateShowFast; Window_Message.prototype.updateShowFast = function () { if (this.isFastForward()) this._showFast = true; Yanfly.Message.Window_Message_updateShowFast.call(this); }; Yanfly.Message.Window_Message_updateWait = Window_Message.prototype.updateWait; Window_Message.prototype.updateWait = function () { if (this.isFastForward()) return false; return Yanfly.Message.Window_Message_updateWait.call(this); }; Yanfly.Message.Window_Message_startWait = Window_Message.prototype.startWait; Window_Message.prototype.startWait = function (count) { if (this._checkWordWrapMode) return; Yanfly.Message.Window_Message_startWait.call(this, count); if (this.isFastForward()) this._waitCount = 0; }; Yanfly.Message.Window_Message_startPause = Window_Message.prototype.startPause; Window_Message.prototype.startPause = function () { if (this._checkWordWrapMode) return; Yanfly.Message.Window_Message_startPause.call(this); }; Window_Message.prototype.convertEscapeCharacters = function (text) { text = Window_Base.prototype.convertEscapeCharacters.call(this, text); text = this.convertNameBox(text); text = this.convertMessageCharacters(text); return text; }; Window_Message.prototype.convertNameBox = function (text) { text = text.replace(/\x1bN\<(.*?)\>/gi, function () { return Yanfly.nameWindow.refresh(arguments[1], 1); }, this); text = text.replace(/\x1bN1\<(.*?)\>/gi, function () { return Yanfly.nameWindow.refresh(arguments[1], 1); }, this); text = text.replace(/\x1bN2\<(.*?)\>/gi, function () { return Yanfly.nameWindow.refresh(arguments[1], 2); }, this); text = text.replace(/\x1bN3\<(.*?)\>/gi, function () { return Yanfly.nameWindow.refresh(arguments[1], 3); }, this); text = text.replace(/\x1bNC\<(.*?)\>/gi, function () { return Yanfly.nameWindow.refresh(arguments[1], 3); }, this); text = text.replace(/\x1bN4\<(.*?)\>/gi, function () { return Yanfly.nameWindow.refresh(arguments[1], 4); }, this); text = text.replace(/\x1bN5\<(.*?)\>/gi, function () { return Yanfly.nameWindow.refresh(arguments[1], 5); }, this); text = text.replace(/\x1bNR\<(.*?)\>/gi, function () { return Yanfly.nameWindow.refresh(arguments[1], 5); }, this); return text; }; Window_Message.prototype.convertMessageCharacters = function (text) { text = text.replace(/\x1bAF\[(\d+)\]/gi, function () { var i = parseInt(arguments[1]); return this.convertActorFace($gameActors.actor(i)); }.bind(this)); text = text.replace(/\x1bPF\[(\d+)\]/gi, function () { var i = parseInt(arguments[1]); return this.convertActorFace($gameParty.members()[i - 1]); }.bind(this)); return text; }; Window_Message.prototype.convertActorFace = function (actor) { $gameMessage.setFaceImage(actor.faceName(), actor.faceIndex()); return ''; }; Yanfly.Message.Window_Message_processEscapeCharacter = Window_Message.prototype.processEscapeCharacter; Window_Message.prototype.processEscapeCharacter = function (code, textState) { switch (code) { case '!': if (!this.isFastForward()) this.startPause(); break; case 'W': this.startWait(this.obtainEscapeParam(textState)); default: Yanfly.Message.Window_Message_processEscapeCharacter.call(this, code, textState); break; } }; if (Yanfly.Param.MSGNameBoxClose) { Yanfly.Message.Window_Message_doesContinue = Window_Message.prototype.doesContinue; Window_Message.prototype.doesContinue = function () { var value = Yanfly.Message.Window_Message_doesContinue.call(this); if (!value) return false; if (this.hasDifferentNameBoxText()) { return false; } return true; }; Window_Message.prototype.hasDifferentNameBoxText = function () { var texts = $gameMessage._texts; var length = texts.length; var open = this._nameWindow.isOpen(); for (var i = 0; i < length; ++i) { var text = texts[i]; if (text.length <= 0) continue; if (Yanfly.MsgMacro) { text = this.convertMacroText(text); text = text.replace(/\x1b/gi, '\\'); } if (text.match(/\\(?:N|N1|N2|N3|N4|N5|NC|NR)<(.*)>/i)) { var name = String(RegExp.$1); } else if (text.match(/\\(?:ND|ND1|ND2|ND3|ND4|ND5|NDC|NDR)<(.*)>/i)) { var name = String(RegExp.$1); } else if (text.match(/\\(?:NT|NT1|NT2|NT3|NT4|NT5|NTC|NTR)<(.*)>/i)) { var name = String(RegExp.$1); } if (name) { name = name.replace(/\\V\[(\d+)\]/gi, function () { return $gameVariables.value(parseInt(arguments[1])); }.bind(this)); name = name.replace(/\\V\[(\d+)\]/gi, function () { return $gameVariables.value(parseInt(arguments[1])); }.bind(this)); name = name.replace(/\\N\[(\d+)\]/gi, function () { return this.actorName(parseInt(arguments[1])); }.bind(this)); name = name.replace(/\\P\[(\d+)\]/gi, function () { return this.partyMemberName(parseInt(arguments[1])); }.bind(this)); name = name.replace(/\\/gi, '\x1b'); } if (name && !open) return true; if (name && name !== this._nameWindow._lastNameText) { return true; } } if (open && !name) return true; return false; }; } // Yanfly.Param.MSGNameBoxClose //============================================================================= // End of File //=============================================================================
dazed/translations
www/js/plugins/YEP_MessageCore.js
JavaScript
unknown
66,598
//============================================================================ // YKNR_SaveThumbnail.js - ver.1.2.0 // --------------------------------------------------------------------------- // Copyright (c) 2019 Yakinori // This software is released under the MIT License. // http://opensource.org/licenses/mit-license.php //============================================================================ /*: * =========================================================================== * @plugindesc セーブファイルにサムネイル用の画像を保存し、 * セーブ/ロード画面でファイル毎にサムネイルを表示する * @author 焼きノリ * =========================================================================== * * @param AutoSnapForThumbnail * @text サムネイルの自動生成 * @desc マップ画面からメニュー画面に切り替えたタイミングで * サムネイル用の画像を撮影するかを設定します。 * @type boolean * @default true * * @param FastLoadingData * @text 読み込み速度高速化 * @desc セーブ/ロード画面に入ったときやファイルリストを * スクロールしたときの読み込み速度を改善します。 * @type boolean * @default true * * @param SnapSettings * @text サムネイルの保存設定 * @desc 階層分けのために用意したパラメータなので、 * ここには何も設定しないでください。 * * @param ThumbQuality * @text 画質の設定 * @desc 保存するサムネイルの画質を設定します。 * 値が小さいほどデータサイズを小さくできます。 * @type number * @min 0 * @max 100 * @default 90 * @parent SnapSettings * * @param ThumbSaveWidth * @text サイズの設定:幅 * @desc 保存するサムネイルの幅を設定します。 * 値が小さいほどデータサイズを小さくできます。 * @type number * @min 0 * @default 122 * @parent SnapSettings * * @param ThumbSaveHeight * @text サイズの設定:高さ * @desc 保存するサムネイルの高さを設定します。 * 値が小さいほどデータサイズを小さくできます。 * @type number * @min 0 * @default 94 * @parent SnapSettings * * @param ShowInSavefileList * @text ファイルリスト内に表示 * @desc リストの項目にサムネイルを表示するか設定します。 * @type boolean * @on 表示する * @off 表示しない * @default true * * @param ThumbItemPosX * @text サムネイルのX座標 * @desc 描画するX座標をJavascriptで設定します。 * rect = 項目の範囲, width = サムネイル幅 * @type string * @default rect.x + rect.width - width; * @parent ShowInSavefileList * * @param ThumbItemPosY * @text サムネイルのY座標 * @desc 描画するY座標をJavascriptで設定します。 * rect = 項目の範囲, height = サムネイル高さ * @type string * @default rect.y + 5 * @parent ShowInSavefileList * * @param ThumbItemScale * @text サムネイルのスケール値 * @desc 描画するスケールを設定します。 * 「サムネイルの保存設定」で設定した幅/高さを 1 とします。 * @type number * @min 0 * @decimals 2 * @default 1.00 * @parent ShowInSavefileList * * @param OtherWindowClass * @text 別ウィンドウの表示設定 * @desc 別ウィンドウにサムネイルを表示したいときに設定します。 * 対象となるウィンドウクラス名を記入します。 * @type string * @default * * @param ThumbOWPosX * @text サムネイルのX座標 * @desc 別ウィンドウに描画するX座標をJavascriptで設定します。 * rect = ウィンドウ内の範囲, width = サムネイル幅 * @type string * @default rect.x + rect.width - width; * @parent OtherWindowClass * * @param ThumbOWPosY * @text サムネイルのY座標 * @desc 別ウィンドウに描画するY座標をJavascriptで設定します。 * rect = ウィンドウ内の範囲, height = サムネイル高さ * @type string * @default rect.y + 5 * @parent OtherWindowClass * * @param ThumbOWScale * @text サムネイルのスケール値 * @desc 別ウィンドウに描画するスケールを設定します。 * 「サムネイルの保存設定」で設定した幅/高さを 1 とします。 * @type number * @min 0 * @decimals 2 * @default 1.00 * @parent OtherWindowClass * * @help * =========================================================================== *【!注意!】 * ※ツクールMV本体のバージョンが 1.6.1 未満の場合、動作できません。 * =========================================================================== *【機能紹介】 * セーブデータにマップの現在地の画像をサムネイルとして保存し、 * セーブ画面/ロード画面のリストにそのサムネイルを表示する機能を追加します。 * * サムネイル撮影のタイミングは、メニュー画面を開くときに自動に撮影されます。 * * community-1.3 の「オートセーブ機能」でセーブされたデータには、 * サムネイルは表示しない仕様となっています。 * * --------------------------------------------------------------------------- *【パラメータ説明】 * ・「サムネイルの自動生成」 * false にした場合、サムネイルの撮影は手動で行うことになります。 * イベントコマンドの「スクリプト」から以下を呼び出してください。 * ------------------------------------- * SceneManager.snapForThumbnail(); * ------------------------------------- * * ・「画質の設定」「サイズの設定:幅」「サイズの設定:高さ」 * 保存するデータサイズに関わる設定です。 * サイズを大きく画質を良くすれば、サムネイルの品質は良くなりますが、 * データが肥大化するので注意が必要です。 * * ・「ファイルリスト内に表示」 * デフォルトのリストのウィンドウ内にサムネイルを表示します。 * ここに表示する必要性が無ければ false にしてください。 * * ・「別ウィンドウの表示設定」 * ファイルリスト内ではなく、他プラグインによって追加された * 任意のウィンドウに表示することも可能です。 * 表示したいウィンドウのクラス名を設定することで表示できます。 * 例えば、Window_Help と設定すると * ヘルプウィンドウ内に選択中のセーブデータのサムネイルが表示されます。 * (SceneManager._scene._listWindow を参照しているため、 * これが存在しない場合は正常に動作しません。) * * --------------------------------------------------------------------------- *【更新履歴】 * [2019/01/04] [1.0.0] 公開 * [2019/12/02] [1.1.0] 「ファイルリスト内に表示」、「別ウィンドウの表示設定」 * が機能していない問題の修正 * [2020/05/28] [1.1.1] デプロイメント時に「画像の暗号化」にチェックを入れて * 出力されたゲームでサムネイル表示時にエラーが出ていた問題の修正 * [2021/02/16] [1.1.2] Window_SavefileListでのサムネイルのコンテナ数の調整 * [2021/02/18] [1.2.0] サムネイル表示処理の修正。「読み込み速度高速化」を追加 * * =========================================================================== * [Blog] : http://mata-tuku.ldblog.jp/ * [Twitter]: https://twitter.com/Noritake0424 * [Github] : https://github.com/Yakinori0424/RPGMakerMVPlugins * --------------------------------------------------------------------------- * 本プラグインは MITライセンス のもとで配布されています。 * 利用はどうぞご自由に。 * http://opensource.org/licenses/mit-license.php */ (function () { 'use strict'; //------------------------------------------------------------------------ /** * 対象のオブジェクト上の関数を別の関数に差し替えます. * * @method monkeyPatch * @param {Object} target 対象のオブジェクト * @param {String} methodName オーバーライドする関数名 * @param {Function} newMethod 新しい関数を返す関数 */ function monkeyPatch(target, methodName, newMethod) { target[methodName] = newMethod(target[methodName]); }; //------------------------------------------------------------------------ /** * Jsonをパースし, プロパティの値を変換して返す * * @method jsonParamsParse * @param {String} json JSON文字列 * @return {Object} パース後のオブジェクト */ function jsonParamsParse(json) { return JSON.parse(json, parseRevive); }; function parseRevive(key, value) { if (key === '') { return value; } try { return JSON.parse(value, parseRevive); } catch (e) { return value; } }; /** * Jsonをパースして変換後, 配列ならば連想配列に変換して返す * * @method jsonParamsParse * @param {String} json JSON文字列 * @param {String} keyName 連想配列のキーとする要素のあるプロパティ名 * @param {String} valueName 連想配列の値とする要素のあるプロパティ名 * @return {Object} パース後の連想配列 */ function parseArrayToHash(json, keyName, valueName) { let hash = {}; const array = jsonParamsParse(json); if (Array.isArray(array)) { for (let i = 0, l = array.length; i < l; i++) { const key = array[i][keyName]; if (key && key !== '') { hash[key] = array[i][valueName] || null; } } } return hash; }; //------------------------------------------------------------------------ // パラメータを受け取る. const pluginName = 'YKNR_SaveThumbnail'; const parameters = PluginManager.parameters(pluginName); const isAutoSnap = parameters['AutoSnapForThumbnail'] === 'true'; const isFastLoadingData = parameters['FastLoadingData'] === 'true'; const thumbQuality = parseInt(parameters['ThumbQuality']); const thumbSaveWidth = parseInt(parameters['ThumbSaveWidth']); const thumbSaveHeight = parseInt(parameters['ThumbSaveHeight']); const isShowInList = parameters['ShowInSavefileList'] === 'true'; const thumbItemPosX = parameters['ThumbItemPosX'] || '0'; const thumbItemPosY = parameters['ThumbItemPosY'] || '0'; const thumbItemScale = parseFloat(parameters['ThumbItemScale']); const otherWindowClass = parameters['OtherWindowClass']; const thumbOtherPosX = parameters['ThumbOWPosX'] || '0'; const thumbOtherPosY = parameters['ThumbOWPosY'] || '0'; const thumbOtherScale = parseFloat(parameters['ThumbOWScale']); //------------------------------------------------------------------------ /** * セーブデータのサムネイルで使用するユニークなキーを返します * * @param {number} savefileId セーブファイルのID * @return {string} */ function generateThumbUniqueKey(savefileId) { if (DataManager.isThisGameFile(savefileId)) { const info = DataManager.loadSavefileInfo(savefileId); return savefileId + ':' + info.timestamp; } return undefined; }; //------------------------------------------------------------------------ /** * Takes a snapshot of the game screen and returns a new bitmap object.\ * 出力するビットマップの幅と高さを指定できるよう, Bitmap.snap を元に拡張しています.\ * 幅/高さが未指定の場合は, 従来のように Graphics.width, Graphics.height となります.\ * また, 出力前の元々の幅と高さをさらに指定することで,\ * その値を元にビットマップの幅と高さに合わせて拡大率を調整します.\ * こちらの指定がない場合は, ビットマップの幅と高さと同値となり, 拡大率を変えません. * * @static * @param {Stage} stage The stage object * @param {number} dw 出力するビットマップの幅 * @param {number} dh 出力するビットマップの高さ * @param {number} cw 元の幅 * @param {number} ch 元の高さ * @return {Bitmap} リサイズされたビットマップ */ Bitmap.snap2 = function (stage, dw = Graphics.width, dh = Graphics.height, cw = dw, ch = dh) { const bitmap = new Bitmap(dw, dh); if (stage) { const context = bitmap._context; const renderTexture = PIXI.RenderTexture.create(dw, dh); const last_sx = stage.scale.x; const last_sy = stage.scale.y; stage.scale.x = dw / cw; stage.scale.y = dh / ch; Graphics._renderer.render(stage, renderTexture); stage.worldTransform.identity(); stage.scale.x = last_sx; stage.scale.y = last_sy; let canvas = null; if (Graphics.isWebGL()) { canvas = Graphics._renderer.extract.canvas(renderTexture); } else { canvas = renderTexture.baseTexture._canvasRenderTarget.canvas; } context.drawImage(canvas, 0, 0); renderTexture.destroy({ destroyBase: true }); bitmap._setDirty(); } return bitmap; }; //------------------------------------------------------------------------ monkeyPatch(Decrypter, 'checkImgIgnore', function ($) { return function (url) { // Base64形式なら暗号化の対象外にする if (url.includes('data:image/jpeg;base64')) { return true; } return $.call(this, url); }; }); //------------------------------------------------------------------------ /** * セーブファイルがこのゲームの何番目のものか取得します. * * @param {Object} info セーブデータ * @return {number} */ DataManager.getSavefileId = function (info) { const globalInfo = this.loadGlobalInfo(); if (globalInfo) { for (let id = 1, l = globalInfo.length; id < l; id++) { if (this.isThisGameFile(id)) { if (this.isEqualSavefile(info, globalInfo[id])) { return id; } } } } return -1; }; /** * セーブファイルが同じものか判定します. * * @param {Object} a セーブデータA * @param {Object} b セーブデータB * @return {boolean} */ DataManager.isEqualSavefile = function (a, b) { // NOTE : thumbnailは長くなりがちなので比較しなくてよいかなという判断 return (a.globalId === b.globalId && a.title === b.title && a.timestamp === b.timestamp && a.playtime === b.playtime // && a.thumbnail === b.thumbnail && a.characters.equals(b.characters) && a.faces.equals(b.faces) ); }; //------------------------------------------------------------------------ /** * Base64形式用のキャッシュキーを返します.\ * データURIは長くなるので, ユニークなキーを指定して代用します. * * @param {number|string} cacheKey 任意のキー * @param {number} hue 色相 * @return {string} */ ImageManager._generateBase64CacheKey = function (cacheKey, hue) { return 'Base64:' + cacheKey + ':' + hue; }; /** * ビットマップをjpgのBase64形式文字列に変換します * * @param {Bitmap} bitmap ビットマップ * @return {string} Base64形式の文字列を返します */ ImageManager.toBase64 = function (bitmap) { const minetype = 'image/jpeg'; const quality = thumbQuality / 100; return bitmap._canvas.toDataURL(minetype, quality); }; /** * Base64形式の文字列からビットマップをロードします.\ * キャッシュに対応しています. * * @param {string} src Base64形式の文字列 * @param {number|string} cacheKey キャッシュに使用する任意のキー * @param {number} hue 色相 * @return {Bitmap} */ ImageManager.loadBase64Bitmap = function (src, cacheKey, hue = 0) { const b64cacheKey = this._generateBase64CacheKey(cacheKey, hue); let bitmap = this._imageCache.get(b64cacheKey); if (!bitmap) { bitmap = Bitmap.load(src); if (this._callCreationHook) { // community-1.3 の プログレスバー 対応 this._callCreationHook(bitmap); } bitmap.addLoadListener(function () { bitmap.rotateHue(hue); }); this._imageCache.add(b64cacheKey, bitmap); } else if (!bitmap.isReady()) { bitmap.decode(); } return bitmap; }; /** * Base64形式の文字列からビットマップをリクエストします.\ * キャッシュに対応しています. * * @param {string} src Base64形式の文字列 * @param {number|string} cacheKey キャッシュに使用する任意のキー * @param {number} hue 色相 * @return {Bitmap} */ ImageManager.requestBase64Bitmap = function (src, cacheKey, hue = 0) { const b64cacheKey = this._generateBase64CacheKey(cacheKey, hue); let bitmap = this._imageCache.get(b64cacheKey); if (!bitmap) { bitmap = Bitmap.request(src); if (this._callCreationHook) { // community-1.3 の プログレスバー 対応 this._callCreationHook(bitmap); } bitmap.addLoadListener(function () { bitmap.rotateHue(hue); }); this._imageCache.add(b64cacheKey, bitmap); this._requestQueue.enqueue(b64cacheKey, bitmap); } else { this._requestQueue.raisePriority(b64cacheKey); } return bitmap; }; //------------------------------------------------------------------------ /** * セーブファイルからサムネイルをロードします. * * @param {number} savefileId セーブファイルのID * @param {object} info セーブデータ * @param {number} hue 色相 * @return {Bitmap} */ ImageManager.loadThumbnail = function (savefileId, info, hue) { const cacheKey = generateThumbUniqueKey(savefileId); if (info && info.thumbnail && cacheKey) { return ImageManager.loadBase64Bitmap(info.thumbnail, cacheKey, hue); } return this.loadEmptyBitmap(); }; /** * セーブファイルからサムネイルをリクエストします. * * @param {number} savefileId セーブファイルのID * @param {object} info セーブデータ * @param {number} hue 色相 * @return {Bitmap} */ ImageManager.requestThumbnail = function (savefileId, info, hue) { const cacheKey = generateThumbUniqueKey(savefileId); if (info && info.thumbnail && cacheKey) { return this.requestBase64Bitmap(info.thumbnail, cacheKey, hue); } return this.loadEmptyBitmap(); }; /** * セーブ/ロード画面用のサムネイル読み込み中のビットマップを返します. * * @param {number} width * @param {number} height * @return {Bitmap} */ ImageManager.loadBusyThumbBitmap = function (width, height) { const cacheKey = 'busyThumb:' + width + '_' + height; let empty = this._imageCache.get(cacheKey); if (!empty) { empty = new Bitmap(width, height); empty.fillAll('#000000'); this._imageCache.add(cacheKey, empty); } return empty; }; /** * サムネイルの自動撮影を行うか判定. * * @return {boolean} */ SceneManager.isAutoSnapForThumbnail = function () { if (!isAutoSnap || !$gameSystem.isSaveEnabled()) { return false; } // 現在のシーンがマップ画面以外であれば false. if (!this._scene || this._scene.constructor !== Scene_Map) { return false; } // 次のシーンが指定のいずれかであれば true. //const scenes = [Scene_Menu, Scene_Load, Scene_Save]; const scenes = [Scene_Menu]; return scenes.some((scene) => this.isNextScene(scene)); }; monkeyPatch(SceneManager, 'snapForBackground', function ($) { return function () { $.call(this); if (this.isAutoSnapForThumbnail()) { this.snapForThumbnail(); } }; }); /** * マップ画面を指定のサイズのビットマップを保存します. */ SceneManager.snapForThumbnail = function () { if (this._scene) { const cw = Graphics.width; const ch = Graphics.height; this._thumbnailBitmap = Bitmap.snap2(this._scene, thumbSaveWidth, thumbSaveHeight, cw, ch); } }; /** * サムネイルのビットマップを削除します. */ SceneManager.clearThumbnail = function () { this._thumbnailBitmap = null; }; /** * サムネイル用に保存したビットマップのBase64形式の文字列を返します. * * @return {string} */ SceneManager.thumbnailBase64 = function () { if (this._thumbnailBitmap) { return ImageManager.toBase64(this._thumbnailBitmap); } return ''; }; monkeyPatch(DataManager, 'makeSavefileInfo', function ($) { return function () { let info = $.call(this); info.thumbnail = SceneManager.thumbnailBase64(); if (!info.thumbnail) { delete info.thumbnail; } return info; }; }); monkeyPatch(DataManager, 'loadSavefileImages', function ($) { return function (info) { $.call(this, info); if (info.thumbnail) { ImageManager.requestThumbnail(info); } }; }); //------------------------------------------------------------------------ /** * Base64形式の文字列データから画像を読み込んで描画する. * * @param {string} src Base64形式の文字列 * @param {number|string} cacheKey キャッシュに使用する任意のキー * @param {number} x 描画 X 座標 * @param {number} y 描画 Y 座標 * @param {number} width 描画する幅 * @param {number} height 描画する高さ * @param {Function} onDrawAfter 描画後の処理 */ Window_Base.prototype.drawBase64Data = function (src, cacheKey, x, y, width = 0, height = 0, onDrawAfter = null) { const bitmap = ImageManager.loadBase64Bitmap(src, cacheKey); const lastOpacity = this.contents.paintOpacity; if (!bitmap.isReady() && width > 0 && height > 0) { this.contents.fillRect(x, y, width, height, '#000000'); } bitmap.addLoadListener(() => { this._onLoadBase64Data(bitmap, x, y, lastOpacity, width, height, onDrawAfter); }); }; /** * drawBase64Data のイベントリスナー関数. * * @param {Bitmap} bitmap Base64形式から生成されたビットマップ * @param {number} x 描画 X 座標 * @param {number} y 描画 Y 座標 * @param {number} lastOpacity 描画前の透明度 * @param {number} width 描画する幅 * @param {number} height 描画する高さ * @param {Function} onDrawAfter 描画後の処理 */ Window_Base.prototype._onLoadBase64Data = function (bitmap, x, y, lastOpacity, width, height, onDrawAfter = null) { const bw = bitmap.width; const bh = bitmap.height; width = width || bw; height = height || bh; //const lastOpacity = this.contents.paintOpacity; this.contents.paintOpacity = lastOpacity; this.contents.blt(bitmap, 0, 0, bw, bh, x, y, width, height); if (onDrawAfter) { onDrawAfter(); } //this.contents.paintOpacity = lastOpacity; }; /** * Base64形式の文字列データから画像を読み込んで描画する.\ * 読み込みの遅延により描画が遅れると, 高速スクロールさせることで\ * 描画位置や透明度がずれることがあるのでその対策込みで再定義. * * @param {string} src Base64形式の文字列 * @param {number|string} cacheKey キャッシュに使用する任意のキー * @param {number} x 描画 X 座標 * @param {number} y 描画 Y 座標 * @param {number} width 描画する幅 * @param {number} height 描画する高さ * @param {Function} onDrawAfter 描画後の処理 */ Window_Selectable.prototype.drawBase64Data = function (src, cacheKey, x, y, width = 0, height = 0, onDrawAfter = null) { const bitmap = ImageManager.loadBase64Bitmap(src, cacheKey); const lastOpacity = this.contents.paintOpacity; const lastTopRow = this.topRow(); const lastLeftCol = Math.floor(this._scrollX / this.itemWidth()); if (!bitmap.isReady() && width > 0 && height > 0) { this.contents.fillRect(x, y, width, height, '#000000'); } bitmap.addLoadListener(() => { if (this.topRow() !== lastTopRow || Math.floor(this._scrollX / this.itemWidth()) !== lastLeftCol) { return; } this._onLoadBase64Data(bitmap, x, y, lastOpacity, width, height, onDrawAfter); }); }; //------------------------------------------------------------------------ // Scene_File 上での DataManager.loadGlobalInfo の実行回数を減らすための対応 if (isFastLoadingData) { /** @type {Object[]} */ let _globalInfo; monkeyPatch(DataManager, 'loadGlobalInfo', function ($) { return function () { return _globalInfo ? _globalInfo : $.call(this); }; }); monkeyPatch(Scene_File.prototype, 'initialize', function ($) { return function () { _globalInfo = DataManager.loadGlobalInfo(); $.call(this); }; }); monkeyPatch(Scene_File.prototype, 'terminate', function ($) { return function () { $.call(this); _globalInfo = null; }; }); } //------------------------------------------------------------------------ // リストウィンドウ内に, サムネイル表示を行う処理を追加します if (isShowInList) { Window_SavefileList.prototype.thumbnailX = eval('(function(rect, width) { return %1; });'.format(thumbItemPosX)); Window_SavefileList.prototype.thumbnailY = eval('(function(rect, height) { return %1; });'.format(thumbItemPosY)); monkeyPatch(Window_SavefileList.prototype, 'initialize', function ($) { return function (x, y, width, height) { $.call(this, x, y, width, height); this.createThumbnail(); }; }); Window_SavefileList.prototype.createThumbnail = function () { const contentsIndex = this.children.indexOf(this._windowContentsSprite); this._thumbContainer = new PIXI.Container(); this.addChildAt(this._thumbContainer, contentsIndex); let thumb; let maxVisibleRows = this.maxItems(); //let maxVisibleRows = this.maxVisibleItems(); for (let i = 0, l = maxVisibleRows; i < l; i++) { thumb = new Sprite(); thumb.scale.x = thumbItemScale; thumb.scale.y = thumbItemScale; thumb.bitmap = null; thumb.visible = false; this._thumbContainer.addChild(thumb); } this.refreshThumbnailParts(); }; monkeyPatch(Window_SavefileList.prototype, '_refreshContents', function ($) { return function () { $.call(this); this.refreshThumbnailParts(); }; }); Window_SavefileList.prototype.refreshThumbnailParts = function () { if (this._thumbContainer) { this._thumbContainer.x = this.padding; this._thumbContainer.y = this.padding; } }; Window_SavefileList.prototype.bottomIndex = function () { return this.topIndex() + this.maxPageItems() - 1; }; monkeyPatch(Window_SavefileList.prototype, 'refresh', function ($) { return function () { this.clearThumbnail(); $.call(this); }; }); Window_SavefileList.prototype.clearThumbnail = function () { const thumbs = this._thumbContainer.children; let thumb; for (let i = 0, l = thumbs.length; i < l; i++) { thumb = thumbs[i]; thumb.bitmap = null; thumb.visible = false; } }; monkeyPatch(Window_SavefileList.prototype, 'drawContents', function ($) { return function (info, rect, valid) { $.call(this, info, rect, valid); let thumbRect = new Rectangle(); thumbRect.width = Math.floor(thumbSaveWidth * thumbItemScale); thumbRect.height = Math.floor(thumbSaveHeight * thumbItemScale); thumbRect.x = this.thumbnailX(rect, thumbRect.width); thumbRect.y = this.thumbnailY(rect, thumbRect.height); this.drawThumbnail(info, thumbRect, valid); }; }); /** * サムネイルを描画する * * @param {Object} info セーブファイルのインフォデータ * @param {Rectangle} thumbRect * @param {boolean} valid */ Window_SavefileList.prototype.drawThumbnail = function (info, thumbRect, valid) { const savefileId = DataManager.getSavefileId(info); const listIndex = savefileId - 1; if (savefileId > 0 && info.thumbnail) { let sprite = this._thumbContainer.children[listIndex]; sprite.visible = true; sprite.x = thumbRect.x; sprite.y = thumbRect.y; const thunmbBitmap = ImageManager.loadThumbnail(savefileId, info); if (!thunmbBitmap.isReady()) { // 読み込み終わるまで別のビットマップを表示 const empty = ImageManager.loadBusyThumbBitmap(thumbRect.width, thumbRect.height); sprite.bitmap = empty; } thunmbBitmap.addLoadListener(() => { // 読み込み終わったときにリスト表示範囲内であれば描画 if (this.topIndex() <= listIndex && this.bottomIndex() >= listIndex) { sprite.visible = true; sprite.bitmap = thunmbBitmap; sprite.bitmap.paintOpacity = valid ? 255 : this.translucentOpacity(); } else { sprite.visible = false; } }); } }; } // 任意のウィンドウに, サムネイル表示を行う処理を追加します if (otherWindowClass) { /** @type {Window_Base} */ const AnyWindowClass = eval(otherWindowClass); if (!AnyWindowClass || !AnyWindowClass.prototype || !(AnyWindowClass.prototype instanceof Window_Base)) { throw new Error(AnyWindowClass + ': This is not a class extended \'Window_Base\' class'); } AnyWindowClass.prototype._thumbnailX = eval('(function(rect, width) { return %1; });'.format(thumbOtherPosX)); AnyWindowClass.prototype._thumbnailY = eval('(function(rect, height) { return %1; });'.format(thumbOtherPosY)); monkeyPatch(AnyWindowClass.prototype, 'initialize', function ($) { return function () { $.call(this, ...arguments); if (SceneManager._scene instanceof Scene_File) { this._createThumbnail(); } }; }); AnyWindowClass.prototype._createThumbnail = function () { const contentsIndex = this.children.indexOf(this._windowContentsSprite); this._thumbContainer = new PIXI.Container(); this.addChildAt(this._thumbContainer, contentsIndex); this._thumbSprite = new Sprite(); this._thumbSprite.scale.x = thumbItemScale; this._thumbSprite.scale.y = thumbItemScale; this._thumbSprite.bitmap = null; this._thumbSprite.visible = false; this._thumbContainer.addChild(this._thumbSprite); // contents からはみ出ないためのマスクをつける this._maskGraphic = new PIXI.Graphics(); this._thumbContainer.addChild(this._maskGraphic); this._thumbContainer.mask = this._maskGraphic; this._refreshThumbnailParts(); }; monkeyPatch(AnyWindowClass.prototype, '_refreshContents', function ($) { return function () { $.call(this); this._refreshThumbnailParts(); }; }); AnyWindowClass.prototype._refreshThumbnailParts = function () { if (this._thumbContainer) { this._thumbContainer.x = this.padding; this._thumbContainer.y = this.padding; } if (this._maskGraphic) { this._maskGraphic.clear(); this._maskGraphic.beginFill('#000000'); this._maskGraphic.drawRect(0, 0, this.contentsWidth(), this.contentsHeight()); this._maskGraphic.endFill(); } }; monkeyPatch(AnyWindowClass.prototype, 'update', function ($) { return function () { if ($) { $.call(this); } if (SceneManager._scene instanceof Scene_File) { this._updateThumbnail(); } }; }); AnyWindowClass.prototype._updateThumbnail = function () { /** @type {Window_SavefileList} */ const list = SceneManager._scene._listWindow; if (list) { const savefileId = list.index() + 1; if (savefileId !== this._savefileId) { this._savefileId = savefileId; const rect = new Rectangle(0, 0, this.contentsWidth(), this.contentsHeight()); let thumbRect = new Rectangle(); thumbRect.width = Math.floor(thumbSaveWidth * thumbOtherScale); thumbRect.height = Math.floor(thumbSaveHeight * thumbOtherScale); thumbRect.x = this._thumbnailX(rect, thumbRect.width); thumbRect.y = this._thumbnailY(rect, thumbRect.height); this._drawThumbnail(thumbRect); } } }; AnyWindowClass.prototype._drawThumbnail = function (thumbRect) { const savefileId = this._savefileId; const info = DataManager.loadSavefileInfo(savefileId); if (this._savefileId > 0 && info && info.thumbnail) { const valid = DataManager.isThisGameFile(savefileId); this._thumbSprite.visible = true; this._thumbSprite.x = thumbRect.x; this._thumbSprite.y = thumbRect.y; const thunmbBitmap = ImageManager.loadThumbnail(savefileId, info); if (!thunmbBitmap.isReady()) { // 読み込み終わるまで別のビットマップを表示 const empty = ImageManager.loadBusyThumbBitmap(thumbRect.width, thumbRect.height); this._thumbSprite.bitmap = empty; } thunmbBitmap.addLoadListener(() => { // 読み込み終わって位置が変わっていないなら描画 if (savefileId === this._savefileId) { this._thumbSprite.bitmap = thunmbBitmap; this._thumbSprite.bitmap.paintOpacity = valid ? 255 : this.translucentOpacity(); } }); } else { this._thumbSprite.visible = false; this._thumbSprite.bitmap = null; } }; } //------------------------------------------------------------------------ // community-1.3 の オートセーブ 対応 if (DataManager.autoSaveGame) { monkeyPatch(DataManager, 'autoSaveGame', function ($) { return function () { if (this._autoSaveFileId !== 0 && !this.isEventTest() && $gameSystem.isSaveEnabled()) { SceneManager.clearThumbnail(); } $.call(this); }; }); } })();
dazed/translations
www/js/plugins/YKNR_SaveThumbnail.js
JavaScript
unknown
38,141
//============================================================================= // ダッシュ禁止プラグイン // dashBan.js // Copyright (c) 2018 村人A //============================================================================= /*:ja * @plugindesc ダッシュを禁止するプラグインです * @author 村人A * * @help * ======================================= *  * バージョン管理 * 2019/3/7 バージョン1.01 リリース *  セーブ・ロード後もダッシュ禁止・許可が反映されているようにしました。 * 2018/1/2 バージョン1.00 リリース *  * ======================================= *  * プレイヤーのダッシュをコマンドで禁止するプラグインです * ダッシュが許可されているマップに移動してもダッシュ禁止は * 継続されます。 * * プラグインコマンド: * ダッシュ禁止 # ダッシュを禁止 * ダッシュ許可 # ダッシュを許可 */ (function () { villaA_dashBan = false; var _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand; Game_Interpreter.prototype.pluginCommand = function (command, args) { _Game_Interpreter_pluginCommand.call(this, command, args); if (command === 'ダッシュ禁止') { $gamePlayer.villaA_dashBan = true; } if (command === 'ダッシュ許可') { $gamePlayer.villaA_dashBan = false; } }; Game_Player.prototype.isDashing = function () { if ($gamePlayer.villaA_dashBan) { return false; } else { return this._dashing; } }; })();
dazed/translations
www/js/plugins/dashBan.js
JavaScript
unknown
1,618
//============================================================================== // dsPassiveSkill.js // Copyright (c) 2015 - 2019 DOURAKU // Released under the MIT License. // http://opensource.org/licenses/mit-license.php //============================================================================== /*: * @plugindesc パッシブスキルを実装するプラグイン ver1.12.0 * @author 道楽 * * @param Show Battle * @desc パッシブスキルを戦闘中に表示するか * (true なら表示する / false なら表示しない) * @default true * @type boolean * * @param Show Battle Switch ID * @desc 戦闘中のパッシブスキル表示を制御するスイッチのID * (0なら「Show Battle」の設定に従う) * @default 0 * @type number * * @help * このプラグインは以下のメモタグの設定ができます。 * * ----------------------------------------------------------------------------- * スキルに設定するメモタグ * * -------- * ・装備できる武器の種類を追加(Equip Weapon) * <passiveEWPN[武器タイプ]> * [武器タイプ] - 武器タイプの番号を2桁の数値で設定する。(数字) * * -------- * ・装備できる防具の種類を追加(Equip Armor) * <passiveEARM[防具タイプ]> * [防具タイプ] - 防具タイプの番号を2桁の数値で設定する。(数字) * * -------- * ・特定の通常能力値をアップ(Parameter Boost) * <passivePBST[能力値番号]:[上昇量(%)]> * [能力値番号] - 上昇させる通常能力値の番号を1桁の数値で設定する。(数字) * 0 - HP * 1 - MP * 2 - 攻撃力 * 3 - 防御力 * 4 - 魔法力 * 5 - 魔法防御 * 6 - 敏捷性 * 7 - 運 * [上昇量(%)] - 能力値の上昇量。 * %ありなら倍率、なしなら直値となる。(数字) * 装備なし状態の能力値に対しての倍率がかかる。 * * -------- * ・一定の条件下において、特定の通常能力値をアップ(Parameter Boost Ex) * <passivePBSTEX[能力値番号]:[上昇量(%)],[参照する条件],[判定する値]> * [能力値番号] - passivePBST参照 * [上昇量(%)] - passivePBST参照 * [参照する条件] - 効果を発揮する条件を以下の中から設定する。(文字列) * HPUP - HPが特定の値以上の場合に効果を発揮 * HPLW - HPが特定の値以下の場合に効果を発揮 * MPUP - MPが特定の値以上の場合に効果を発揮 * MPLW - MPが特定の値以下の場合に効果を発揮 * TPUP - TPが特定の値以上の場合に効果を発揮 * TPLW - TPが特定の値以下の場合に効果を発揮 * STAT - 特定のステートを受けている場合に効果を発揮 * [判定する値] - 条件の判定に使用するパーセンテージ。(数字) * STATの場合はステート番号。(数字) * * 例) HP50%以下で攻撃力が50%アップするスキルを作成する場合 * <passivePBSTEX2:50%,HPUP,50> * * -------- * ・特定の追加能力値をアップ(XParameter Boost) * <passiveXPBST[能力値番号]:[上昇量]> * [能力値番号] - 上昇させる追加能力値の番号を1桁の数値で設定する。(数字) * 0 - 命中率 * 1 - 回避率 * 2 - 会心率 * 3 - 会心回避率 * 4 - 魔法回避率 * 5 - 魔法反射率 * 6 - 反撃率 * 7 - HP再生率 * 8 - MP再生率 * 9 - TP再生率 * [上昇量] - 能力値の上昇量。(数字) * * -------- * ・一定の条件下において、特定の追加能力値をアップ(XParameter Boost Ex) * <passiveXPBSTEX[能力値番号]:[上昇量],[参照する条件],[判定する値]> * [能力値番号] - passiveXPBST参照 * [上昇量] - passiveXPBST参照 * [参照する条件] - passivePBSTEX参照 * [判定する値] - passivePBSTEX参照 * * 例) MP最大時にHPが5%再生するスキルを作成する場合 * <passiveXPBSTEX7:5,MPUP,100> * * -------- * ・特定の特殊能力値をアップ(SParameter Boost) * <passiveSPBST[能力値番号]:[上昇量]> * [能力値番号] - 上昇させる特殊能力値の番号を1桁の数値で設定する。(数字) * 0 - 狙われ率 * 1 - 防御効果率 * 2 - 回復効果率 * 3 - 薬の知識率 * 4 - MP消費率 * 5 - TPチャージ率 * 6 - 物理ダメージ率 * 7 - 魔法ダメージ率 * 8 - 床ダメージ率 * 9 - 経験値獲得率 * [上昇量] - 能力値の上昇量。(数字) * * -------- * ・一定の条件下において、特定の追加能力値をアップ(XParameter Boost Ex) * <passiveSPBSTEX[能力値番号]:[上昇量],[参照する条件],[判定する値]> * [能力値番号] - passiveSPBST参照 * [上昇量] - passiveSPBST参照 * [参照する条件] - passivePBSTEX参照 * [判定する値] - passivePBSTEX参照 * * 例) TPが50%以上の時に狙われやすくするスキルを作成する場合 * <passiveSPBSTEX0:50,TPUP,50> * * -------- * ※更新に伴い非推奨 (passivePBSTEXを使用してください) * ・一定のHP以下の場合のみ特定の通常能力値をアップ(Indomitable) * <passiveINDM[能力値番号]:[HP残量率],[上昇量(%)]> * [能力値番号] - passivePBST参照 * [HP残量率] - 効果が発揮されるHPの残量率を%で設定する。(数字) * [上昇量(%)] - 能力値の上昇量。 * %ありなら倍率、なしなら直値となる。(数字) * 装備なし状態の能力値に対しての倍率がかかる。 * * -------- * ※更新に伴い非推奨 (passiveXPBSTEXを使用してください) * ・一定のHP以下の場合のみ特定の追加能力値をアップ(XIndomitable) * <passiveXINDM[能力値番号]:[HP残量率],[上昇量]> * [能力値番号] - passiveXPBST参照 * [HP残量率] - 効果が発揮されるHPの残量率を%で設定する。(数字) * [上昇量] - 能力値の上昇量。(数字) * * -------- * ※更新に伴い非推奨 (passiveSPBSTEXを使用してください) * ・一定のHP以下の場合のみ特定の特殊能力値をアップ(SIndomitable) * <passiveSINDM[能力値番号]:[HP残量率],[上昇量]> * [能力値番号] - passiveSPBST参照 * [HP残量率] - 効果が発揮されるHPの残量率を%で設定する。(数字) * [上昇量] - 能力値の上昇量。(数字) * * -------- * ・属性有効度を設定(Element Rate) * <passiveELEM[属性番号]:[倍率]> * [属性番号] - 有効度を設定する属性の番号を2桁の数値で設定する。(数字) * [有効度] - 有効度を表すパーセンテージ。(数字) * 職業等で設定されている属性有効度に乗算されます。 * * -------- * ・属性有効度を設定の加算バージョン(Element Rate Add Ver) * <passiveELEM_ADD[属性番号]:[倍率]> * [属性番号] - 有効度を設定する属性の番号を2桁の数値で設定する。(数字) * [有効度] - 有効度を表すパーセンテージ。(数字) * 職業等で設定されている属性有効度に加算されます。 * * -------- * ・ステート有効度を設定(State Rate) * <passiveSTAT[ステート番号]:[有効度]> * [ステート番号] - 耐性を上昇させるステートの番号を4桁の数値で設定する。(数字) * [有効度] - 有効度を表すパーセンテージ。(数字) * 職業等で設定されているステート有効度に乗算されます。 * * -------- * ・ステート有効度を設定の加算バージョン(State Rate Add Ver) * <passiveSTAT_ADD[ステート番号]:[有効度]> * [ステート番号] - 耐性を上昇させるステートの番号を4桁の数値で設定する。(数字) * [有効度] - 有効度を表すパーセンテージ。(数字) * 職業等で設定されているステート有効度に加算されます。 * * -------- * ・無効化できるステートを追加(State Regist) * <passiveSTREG[ステート番号]> * [ステート番号] - 無効化できるステートの番号を4桁の数値で設定する。(数字) * * -------- * ・攻撃時ステートを設定(Attack State) * <passiveATKST[ステート番号]:[付与率]> * [ステート番号] - 攻撃時に付与するステートの番号を4桁の数値で設定する。(数字) * [付与率] - 付与率を表すパーセンテージ。(数字) * 職業等で設定されているステート付与率に加算されます。 * * -------- * ・スキルタイプ追加(Add Skill Type) * <passiveAST[スキルタイプ番号]> * [スキルタイプ番号] - スキルタイプの番号を2桁の数値で設定する。(数字) * * -------- * ・武器装備時の通常能力値の上昇量をアップ(Weapon Mastery) * <passiveWPNM[武器タイプ]:[上昇量(%)]> * [武器タイプ] - 武器タイプの番号を2桁の数値で設定する。(数字) * [上昇量(%)] - 装備時の能力値の上昇量。 * %ありなら倍率、なしなら直値となる。(数字) * * -------- * ・武器装備時の追加能力値の上昇量をアップ(Weapon MasteryX) * <passiveWPNMX[武器タイプ]:[上昇量(%)]> * [武器タイプ] - 武器タイプの番号を2桁の数値で設定する。(数字) * [上昇量(%)] - 装備時の能力値の上昇量。 * %ありなら倍率、なしなら直値となる。(数字) * * -------- * ・武器装備時の特殊能力値の上昇量をアップ(Weapon MasteryS) * <passiveWPNMS[武器タイプ]:[上昇量(%)]> * [武器タイプ] - 武器タイプの番号を2桁の数値で設定する。(数字) * [上昇量(%)] - 装備時の能力値の上昇量。 * %ありなら倍率、なしなら直値となる。(数字) * (倍率は100%を基準として計算されます) * * -------- * ・武器装備時に特定の通常能力値をアップ(Weapon Parameter Boost) * <passiveWPBST[武器タイプ]_[能力値番号]:[上昇量]> * [武器タイプ] - 武器タイプの番号を2桁の数値で設定する。(数字) * [能力値番号] - 上昇させる通常能力値の番号を1桁の数値で設定する。(数字) * 0 - HP * 1 - MP * 2 - 攻撃力 * 3 - 防御力 * 4 - 魔法力 * 5 - 魔法防御 * 6 - 敏捷性 * 7 - 運 * [上昇量] - 装備時の能力値の上昇量。(数字) * * -------- * ・武器装備時に特定の追加能力値をアップ(Weapon XParameter Boost) * <passiveWXPBST[武器タイプ]_[能力値番号]:[上昇量]> * [武器タイプ] - 武器タイプの番号を2桁の数値で設定する。(数字) * [能力値番号] - 上昇させる追加能力値の番号を1桁の数値で設定する。(数字) * 0 - 命中率 * 1 - 回避率 * 2 - 会心率 * 3 - 会心回避率 * 4 - 魔法回避率 * 5 - 魔法反射率 * 6 - 反撃率 * 7 - HP再生率 * 8 - MP再生率 * 9 - TP再生率 * [上昇量] - 装備時の能力値の上昇量。(数字) * * -------- * ・武器装備時に特定の特殊能力値をアップ(Weapon SParameter Boost) * <passiveWSPBST[武器タイプ]_[能力値番号]:[上昇量]> * [武器タイプ] - 武器タイプの番号を2桁の数値で設定する。(数字) * [能力値番号] - 上昇させる特殊能力値の番号を1桁の数値で設定する。(数字) * 0 - 狙われ率 * 1 - 防御効果率 * 2 - 回復効果率 * 3 - 薬の知識率 * 4 - MP消費率 * 5 - TPチャージ率 * 6 - 物理ダメージ率 * 7 - 魔法ダメージ率 * 8 - 床ダメージ率 * 9 - 経験値獲得率 * [上昇量] - 装備時の能力値の上昇量。(数字) * * -------- * ・防具装備時の通常能力値をアップ(Armor Mastery) * <passiveARMM[防具タイプ]:[上昇量(%)]> * [防具タイプ] - 防具タイプの番号を2桁の数値で設定する。(数字) * [上昇量(%)] - 装備時の能力値の上昇量。 * %ありなら倍率、なしなら直値となる。(数字) * * -------- * ・防具装備時の追加能力値の上昇量をアップ(Armor MasteryX) * <passiveARMMX[防具タイプ]:[上昇量(%)]> * [防具タイプ] - 防具タイプの番号を2桁の数値で設定する。(数字) * [上昇量(%)] - 装備時の能力値の上昇量。 * %ありなら倍率、なしなら直値となる。(数字) * * -------- * ・防具装備時の特殊能力値の上昇量をアップ(Armor MasteryS) * <passiveARMMS[防具タイプ]:[上昇量(%)]> * [防具タイプ] - 防具タイプの番号を2桁の数値で設定する。(数字) * [上昇量(%)] - 装備時の能力値の上昇量。 * %ありなら倍率、なしなら直値となる。(数字) * (倍率は100%を基準として計算されます) * * -------- * ・防具装備時に特定の通常能力値をアップ(Armor Parameter Boost) * <passiveAPBST[防具タイプ]_[能力値番号]:[上昇量]> * [防具タイプ] - 防具タイプの番号を2桁の数値で設定する。(数字) * [能力値番号] - 上昇させる通常能力値の番号を1桁の数値で設定する。(数字) * 0 - HP * 1 - MP * 2 - 攻撃力 * 3 - 防御力 * 4 - 魔法力 * 5 - 魔法防御 * 6 - 敏捷性 * 7 - 運 * [上昇量] - 装備時の能力値の上昇量。(数字) * * -------- * ・防具装備時に特定の追加能力値をアップ(Armor XParameter Boost) * <passiveAXPBST[防具タイプ]_[能力値番号]:[上昇量]> * [防具タイプ] - 防具タイプの番号を2桁の数値で設定する。(数字) * [能力値番号] - 上昇させる追加能力値の番号を1桁の数値で設定する。(数字) * 0 - 命中率 * 1 - 回避率 * 2 - 会心率 * 3 - 会心回避率 * 4 - 魔法回避率 * 5 - 魔法反射率 * 6 - 反撃率 * 7 - HP再生率 * 8 - MP再生率 * 9 - TP再生率 * [上昇量] - 装備時の能力値の上昇量。(数字) * * -------- * ・防具装備時に特定の特殊能力値をアップ(Armor SParameter Boost) * <passiveASPBST[防具タイプ]_[能力値番号]:[上昇量]> * [防具タイプ] - 防具タイプの番号を2桁の数値で設定する。(数字) * [能力値番号] - 上昇させる特殊能力値の番号を1桁の数値で設定する。(数字) * 0 - 狙われ率 * 1 - 防御効果率 * 2 - 回復効果率 * 3 - 薬の知識率 * 4 - MP消費率 * 5 - TPチャージ率 * 6 - 物理ダメージ率 * 7 - 魔法ダメージ率 * 8 - 床ダメージ率 * 9 - 経験値獲得率 * [上昇量] - 装備時の能力値の上昇量。(数字) * * -------- * ・攻撃追加回数を追加する(Attack Times Add) * <passiveATADD:[追加量]> * [追加量] - 攻撃回数を設定する。(数字) * * -------- * ・先制攻撃率をアップ(Preemptive) * <passivePREE:[上昇量]> * [上昇量] - 先制攻撃率のアップ率を%で設定する。(数字) * * -------- * ・不意打ち率をダウン(Anti Surprise) * <passiveASUP:[下降量]> * [下降量] - 不意打ち率のダウン率を%で設定する。(数字) * * -------- * ・二刀流を有効にする(Dual Wield) * <passiveDUAL> * * -------- * ・行動回数を追加する(Action Plus) * <passiveAPLUS:[追加確率]> * [追加確率(%)] - 行動を追加する確率を表すパーセンテージ。(数字) * * -------- * ・自動戦闘を有効にする(Auto Battle) * <passiveAUTO> * * -------- * ・防御を有効にする(Guard) * <passiveGUARD> * * -------- * ・身代わり状態にする(Substitute) * <passiveSUBS> * * -------- * ・TP持ち越しを有効にする(Preserve Tp) * <passivePRETP> * */ var Imported = Imported || {}; Imported.dsPassiveSkill = true; (function (exports) { 'use strict'; exports.Param = (function () { var ret = {}; var parameters = PluginManager.parameters('dsPassiveSkill'); ret.ShowBattle = Boolean(parameters['Show Battle'] === 'true' || false); ret.ShowBattleSwitchId = Number(parameters['Show Battle Switch ID']); return ret; })(); //-------------------------------------------------------------------------- /** Utility */ function Utility() { } Utility.calcParamBoost = function (baseParam, metaData) { var ret = 0; var re = /([-]?\d+)(%?)/i; var match = re.exec(metaData); if (match) { if (match[2] === '%') { var rate = Number(match[1]) * 0.01; ret = Math.floor(baseParam * rate); } else { ret = Number(match[1]); } } return ret; }; Utility.calcXParamBoost = function (metaData) { var ret = 0; var re = /([-]?\d+)/i; var match = re.exec(metaData); if (match) { ret = Number(match[1]) * 0.01; } return ret; }; Utility.calcSParamBoost = function (metaData) { var ret = 0; var re = /([-]?\d+)/i; var match = re.exec(metaData); if (match) { ret = Number(match[1]) * 0.01; } return ret; }; Utility.calcMastery = function (baseParam, metaData) { var ret = 0; var re = /([-]?\d+)(%?)/i; var match = re.exec(metaData); if (match) { if (match[2] === '%') { var rate = Number(match[1]) * 0.01; ret = Math.floor(baseParam * rate); } else { ret = Number(match[1]); } } return ret; }; Utility.calcMasteryX = function (baseParam, metaData) { var ret = 0; var re = /([-]?\d+)(%?)/i; var match = re.exec(metaData); if (match) { if (match[2] === '%') { var rate = Number(match[1]) * 0.01; ret = baseParam * rate; } else { ret = Number(match[1]); } } return ret; }; Utility.calcMasteryS = function (baseParam, metaData) { var ret = 0; var re = /([-]?\d+)(%?)/i; var match = re.exec(metaData); if (match) { if (match[2] === '%') { var rate = Number(match[1]) * 0.01; ret = (baseParam - 1.0) * rate; } else { ret = Number(match[1]); } } return ret; }; //-------------------------------------------------------------------------- /** Game_Actor */ var _Game_Actor_initMembers = Game_Actor.prototype.initMembers; Game_Actor.prototype.refreshSkillTypes = function () { _Game_Actor_initMembers.call(this); this._psSkillTypes = []; }; Game_Actor.prototype.refreshSkillTypes = function () { this._psSkillTypes = []; var skillTypesMax = $dataSystem.skillTypes.length; for (var ii = 1; ii < skillTypesMax; ii++) { var tag = 'passiveAST' + ('00' + ii).slice(-2); var find = false; this.iteratePassiveSkill(tag, function (metaData) { find = true; }); if (find) { this._psSkillTypes.push(ii); } } }; var _Game_Actor_refresh = Game_Actor.prototype.refresh; Game_Actor.prototype.refresh = function () { _Game_Actor_refresh.call(this); this.refreshSkillTypes(); }; var _Game_Actor_learnSkill = Game_Actor.prototype.learnSkill; Game_Actor.prototype.learnSkill = function (skillId) { var lastDualWield = this.isDualWield(); _Game_Actor_learnSkill.call(this, skillId); if (lastDualWield !== this.isDualWield()) { this.refresh(); } this.refreshSkillTypes(); }; Game_Actor.prototype.iteratePassiveSkill = function (metaName, callback) { this.skills().forEach(function (skill) { if (skill.meta[metaName]) { callback(skill.meta[metaName]); } }); }; Game_Actor.prototype.evaluateCondition = function (condition, value) { var ret = false; switch (condition) { case 'HPUP': ret = (this.hpRate() >= value * 0.01) ? true : false; break; case 'HPLW': ret = (this.hpRate() <= value * 0.01) ? true : false; break; case 'MPUP': ret = (this.mpRate() >= value * 0.01) ? true : false; break; case 'MPLW': ret = (this.mpRate() <= value * 0.01) ? true : false; break; case 'TPUP': ret = (this.tpRate() >= value * 0.01) ? true : false; break; case 'TPLW': ret = (this.tpRate() <= value * 0.01) ? true : false; break; case 'STAT': ret = this.isStateAffected(value); break; } return ret; }; Game_Actor.prototype.itemTraitsWithId = function (item, code, dataId) { return item.traits.filter(function (trait) { return trait.code === code && trait.dataId === dataId; }); }; Game_Actor.prototype.itemTraitsSum = function (item, code, id) { return this.itemTraitsWithId(item, code, id).reduce(function (r, trait) { return r + trait.value; }, 0); }; var _Game_Actor_paramBase = Game_Actor.prototype.paramBase; Game_Actor.prototype.paramBaseDirect = function (paramId) { return _Game_Actor_paramBase.call(this, paramId); }; Game_Actor.prototype.paramBaseBoost = function (paramId) { var baseParam = this.paramBaseDirect(paramId); var ret = 0; var tagPBST = 'passivePBST' + ('0' + paramId).slice(-1); this.iteratePassiveSkill(tagPBST, function (metaData) { ret += Utility.calcParamBoost(baseParam, metaData); }); var tagPBSTEX = 'passivePBSTEX' + ('0' + paramId).slice(-1); this.iteratePassiveSkill(tagPBSTEX, function (metaData) { var splitData = metaData.split(','); if (this.evaluateCondition(splitData[1], Number(splitData[2]))) { ret += Utility.calcParamBoost(baseParam, splitData[0]); } }.bind(this)); var tagINDM = 'passiveINDM' + ('0' + paramId).slice(-1); this.iteratePassiveSkill(tagINDM, function (metaData) { var re = /(\d+)\,([-]?\d+)(%?)/i; var match = re.exec(metaData); if (match) { if (this.hpRate() <= Number(match[1]) * 0.01) { if (match[3] === '%') { var rate = Number(match[2]) * 0.01; ret += Math.floor(baseParam * rate); } else { ret += Number(match[2]); } } } }.bind(this)); return ret; }; Game_Actor.prototype.paramBase = function (paramId) { var ret = this.paramBaseDirect(paramId); ret += this.paramBaseBoost(paramId); return ret; }; var _Game_Actor_paramPlus = Game_Actor.prototype.paramPlus; Game_Actor.prototype.paramPlusDirect = function (paramId) { return _Game_Actor_paramPlus.call(this, paramId); }; Game_Actor.prototype.paramPlusBoost = function (paramId) { var ret = 0; this.equips().forEach(function (item) { if (item) { if (DataManager.isWeapon(item)) { if (item.params[paramId] > 0) { var tagWPNM = 'passiveWPNM' + ('00' + item.wtypeId).slice(-2); this.iteratePassiveSkill(tagWPNM, function (metaData) { ret += Utility.calcMastery(item.params[paramId], metaData); }); } var tagWPBST = 'passiveWPBST' + ('00' + item.wtypeId).slice(-2) + '_' + paramId; this.iteratePassiveSkill(tagWPBST, function (metaData) { ret += Number(metaData); }); } else if (DataManager.isArmor(item)) { if (item.params[paramId] > 0) { var tagARMM = 'passiveARMM' + ('00' + item.atypeId).slice(-2); this.iteratePassiveSkill(tagARMM, function (metaData) { ret += Utility.calcMastery(item.params[paramId], metaData); }); } var tagAPBST = 'passiveAPBST' + ('00' + item.atypeId).slice(-2) + '_' + paramId; this.iteratePassiveSkill(tagAPBST, function (metaData) { ret += Number(metaData); }); } } }, this); return ret; }; Game_Actor.prototype.paramPlus = function (paramId) { var ret = this.paramPlusDirect(paramId); ret += this.paramPlusBoost(paramId); return ret; }; var _Game_Actor_xparam = Game_Actor.prototype.xparam; Game_Actor.prototype.xparamDirect = function (xparamId) { return _Game_Actor_xparam.call(this, xparamId); }; Game_Actor.prototype.xparam = function (xparamId) { var ret = this.xparamDirect(xparamId); var tagPBST = 'passiveXPBST' + ('0' + xparamId).slice(-1); this.iteratePassiveSkill(tagPBST, function (metaData) { ret += Utility.calcXParamBoost(metaData); }); var tagPBSTEX = 'passiveXPBSTEX' + ('0' + xparamId).slice(-1); this.iteratePassiveSkill(tagPBSTEX, function (metaData) { var splitData = metaData.split(','); if (this.evaluateCondition(splitData[1], Number(splitData[2]))) { ret += Utility.calcXParamBoost(splitData[0]); } }.bind(this)); var tagINDM = 'passiveXINDM' + ('0' + xparamId).slice(-1); this.iteratePassiveSkill(tagINDM, function (metaData) { var re = /(\d+)\,([-]?\d+)/i; var match = re.exec(metaData); if (match) { if (this.hpRate() <= Number(match[1]) * 0.01) { ret += Number(match[2]) * 0.01; } } }.bind(this)); this.equips().forEach(function (item) { if (item) { var value = this.itemTraitsSum(item, Game_BattlerBase.TRAIT_XPARAM, xparamId); if (DataManager.isWeapon(item)) { if (value > 0) { var tagWPNMX = 'passiveWPNMX' + ('00' + item.wtypeId).slice(-2); this.iteratePassiveSkill(tagWPNMX, function (metaData) { ret += Utility.calcMasteryX(value, metaData); }); } var tagWPBST = 'passiveWXPBST' + ('00' + item.wtypeId).slice(-2) + '_' + xparamId; this.iteratePassiveSkill(tagWPBST, function (metaData) { ret += Number(metaData) * 0.01; }); } else if (DataManager.isArmor(item)) { if (value > 0) { var tagARMMX = 'passiveARMMX' + ('00' + item.atypeId).slice(-2); this.iteratePassiveSkill(tagARMMX, function (metaData) { ret += Utility.calcMasteryX(value, metaData); }); } var tagAPBST = 'passiveAXPBST' + ('00' + item.atypeId).slice(-2) + '_' + xparamId; this.iteratePassiveSkill(tagAPBST, function (metaData) { ret += Number(metaData) * 0.01; }); } } }, this); return ret; }; var _Game_Actor_sparam = Game_Actor.prototype.sparam; Game_Actor.prototype.sparamDirect = function (sparamId) { return _Game_Actor_sparam.call(this, sparamId); }; Game_Actor.prototype.sparam = function (sparamId) { var ret = this.sparamDirect(sparamId); var tagPBST = 'passiveSPBST' + ('0' + sparamId).slice(-1); this.iteratePassiveSkill(tagPBST, function (metaData) { ret += Utility.calcSParamBoost(metaData); }); var tagPBSTEX = 'passiveSPBSTEX' + ('0' + sparamId).slice(-1); this.iteratePassiveSkill(tagPBSTEX, function (metaData) { var splitData = metaData.split(','); if (this.evaluateCondition(splitData[1], Number(splitData[2]))) { ret += Utility.calcSParamBoost(splitData[0]); } }.bind(this)); var tagINDM = 'passiveSINDM' + ('0' + sparamId).slice(-1); this.iteratePassiveSkill(tagINDM, function (metaData) { var re = /(\d+)\,([-]?\d+)/i; var match = re.exec(metaData); if (match) { if (this.hpRate() <= Number(match[1]) * 0.01) { ret += Number(match[2]) * 0.01; } } }.bind(this)); this.equips().forEach(function (item) { if (item) { var value = this.itemTraitsSum(item, Game_BattlerBase.TRAIT_SPARAM, sparamId); if (DataManager.isWeapon(item)) { if (value > 0) { var tagWPNMS = 'passiveWPNMS' + ('00' + item.wtypeId).slice(-2); this.iteratePassiveSkill(tagWPNMS, function (metaData) { ret += Utility.calcMasteryS(value, metaData); }); } var tagWPBST = 'passiveWSPBST' + ('00' + item.wtypeId).slice(-2) + '_' + sparamId; this.iteratePassiveSkill(tagWPBST, function (metaData) { ret += Number(metaData) * 0.01; }); } else if (DataManager.isArmor(item)) { if (value > 0) { var tagARMMS = 'passiveARMMS' + ('00' + item.atypeId).slice(-2); this.iteratePassiveSkill(tagARMMS, function (metaData) { ret += Utility.calcMasteryS(value, metaData); }); } var tagAPBST = 'passiveASPBST' + ('00' + item.atypeId).slice(-2) + '_' + sparamId; this.iteratePassiveSkill(tagAPBST, function (metaData) { ret += Number(metaData) * 0.01; }); } } }, this); return ret; }; var _Game_Actor_elementRate = Game_Actor.prototype.elementRate; Game_Actor.prototype.elementRate = function (elementId) { var ret = _Game_Actor_elementRate.call(this, elementId); var tag = 'passiveELEM' + ('00' + elementId).slice(-2); this.iteratePassiveSkill(tag, function (metaData) { ret *= Number(metaData) * 0.01; }); ret += this.addElementRate(elementId); return Math.max(ret, 0); }; Game_Actor.prototype.addElementRate = function (elementId) { var ret = 0; var tag = 'passiveELEM_ADD' + ('00' + elementId).slice(-2); this.iteratePassiveSkill(tag, function (metaData) { ret += Number(metaData) * 0.01; }); return ret; }; var _Game_Actor_stateRate = Game_Actor.prototype.stateRate; Game_Actor.prototype.stateRate = function (stateId) { var ret = _Game_Actor_stateRate.call(this, stateId); var tag = 'passiveSTAT' + ('0000' + stateId).slice(-4); this.iteratePassiveSkill(tag, function (metaData) { ret *= Number(metaData) * 0.01; }); ret += this.addStateRate(stateId); return Math.max(ret, 0); }; Game_Actor.prototype.addStateRate = function (stateId) { var ret = 0; var tag = 'passiveSTAT_ADD' + ('0000' + stateId).slice(-4); this.iteratePassiveSkill(tag, function (metaData) { ret += Number(metaData) * 0.01; }); return ret; }; var _Game_Actor_stateResistSet = Game_Actor.prototype.stateResistSet; Game_Actor.prototype.stateResistSet = function () { var ret = _Game_Actor_stateResistSet.call(this); var num = $dataStates.length; for (var ii = 1; ii < num; ii++) { var tag = 'passiveSTREG' + ('0000' + ii).slice(-4); this.iteratePassiveSkill(tag, function (metaData) { if (!ret.contains(ii)) { ret.push(ii); } }); } return ret; }; var _Game_Actor_attackStates = Game_Actor.prototype.attackStates; Game_Actor.prototype.attackStates = function () { var ret = _Game_Actor_attackStates.call(this); var num = $dataStates.length; for (var ii = 1; ii < num; ii++) { var tag = 'passiveATKST' + ('0000' + ii).slice(-4); this.iteratePassiveSkill(tag, function (metaData) { if (!ret.contains(ii)) { ret.push(ii); } }); } return ret; }; var _Game_Actor_attackStatesRate = Game_Actor.prototype.attackStatesRate; Game_Actor.prototype.attackStatesRate = function (stateId) { var ret = _Game_Actor_attackStatesRate.call(this, stateId); var tag = 'passiveATKST' + ('0000' + stateId).slice(-4); this.iteratePassiveSkill(tag, function (metaData) { var re = /([-]?\d+)/i; var match = re.exec(metaData); if (match) { ret += Number(match[1]) * 0.01; } }); return ret; }; var _Game_Actor_attackTimesAdd = Game_Actor.prototype.attackTimesAdd; Game_Actor.prototype.attackTimesAdd = function () { var ret = _Game_Actor_attackTimesAdd.call(this); var tag = 'passiveATADD'; this.iteratePassiveSkill(tag, function (metaData) { ret += Number(metaData); }); return ret; }; var _Game_Actor_addedSkillTypes = Game_Actor.prototype.addedSkillTypes; Game_Actor.prototype.addedSkillTypes = function () { var ret = _Game_Actor_addedSkillTypes.call(this); if (this._psSkillTypes) { this._psSkillTypes.forEach(function (stype) { if (ret.indexOf(stype) < 0) { ret.push(stype); } }); } return ret; }; var _Game_Actor_isEquipWtypeOk = Game_Actor.prototype.isEquipWtypeOk; Game_Actor.prototype.isEquipWtypeOk = function (wtypeId) { var ret = _Game_Actor_isEquipWtypeOk.call(this, wtypeId); var tag = 'passiveEWPN' + ('00' + wtypeId).slice(-2); this.iteratePassiveSkill(tag, function (metaData) { ret = true; }); return ret; }; var _Game_Actor_isEquipAtypeOk = Game_Actor.prototype.isEquipAtypeOk; Game_Actor.prototype.isEquipAtypeOk = function (atypeId) { var ret = _Game_Actor_isEquipAtypeOk.call(this, atypeId); var tag = 'passiveEARM' + ('00' + atypeId).slice(-2); this.iteratePassiveSkill(tag, function (metaData) { ret = true; }); return ret; }; var _Game_Actor_isDualWield = Game_Actor.prototype.isDualWield; Game_BattlerBase.prototype.isDualWield = function () { var ret = _Game_Actor_isDualWield.call(this); var tag = 'passiveDUAL'; this.iteratePassiveSkill(tag, function (metaData) { ret = true; }); return ret; }; var _Game_Actor_actionPlusSet = Game_Actor.prototype.actionPlusSet; Game_Actor.prototype.actionPlusSet = function () { var ret = _Game_Actor_actionPlusSet.call(this); var tag = 'passiveAPLUS'; this.iteratePassiveSkill(tag, function (metaData) { var re = /(\d+)/i; var match = re.exec(metaData); if (match) { ret.push(Number(match[1]) * 0.01); } }); return ret; }; var _Game_Actor_isAutoBattle = Game_Actor.prototype.isAutoBattle; Game_Actor.prototype.isAutoBattle = function () { var ret = _Game_Actor_isAutoBattle.call(this); var tag = 'passiveAUTO'; this.iteratePassiveSkill(tag, function (metaData) { ret = true; }); return ret; }; var _Game_Actor_isGuard = Game_Actor.prototype.isGuard; Game_Actor.prototype.isGuard = function () { var ret = _Game_Actor_isGuard.call(this); if (this.canMove()) { var tag = 'passiveGUARD'; this.iteratePassiveSkill(tag, function (metaData) { ret = true; }); } return ret; }; var _Game_Actor_isSubstitute = Game_Actor.prototype.isSubstitute; Game_Actor.prototype.isSubstitute = function () { var ret = _Game_Actor_isSubstitute.call(this); if (this.canMove()) { var tag = 'passiveSUBS'; this.iteratePassiveSkill(tag, function (metaData) { ret = true; }); } return ret; }; var _Game_Actor_isPreserveTp = Game_Actor.prototype.isPreserveTp; Game_Actor.prototype.isPreserveTp = function (flagId) { var ret = _Game_Actor_isPreserveTp.call(this); var tag = 'passivePRETP'; this.iteratePassiveSkill(tag, function (metaData) { ret = true; }); return ret; }; //-------------------------------------------------------------------------- /** Game_Party */ var _Game_Party_ratePreemptive = Game_Party.prototype.ratePreemptive; Game_Party.prototype.ratePreemptive = function (troopAgi) { var rate = _Game_Party_ratePreemptive.call(this, troopAgi); this.battleMembers().some(function (actor) { actor.iteratePassiveSkill('passivePREE', function (metaData) { rate += Number(metaData) * 0.01; }); }); return rate.clamp(0.0, 1.0); }; var _Game_Party_rateSurprise = Game_Party.prototype.rateSurprise; Game_Party.prototype.rateSurprise = function (troopAgi) { var rate = _Game_Party_rateSurprise.call(this, troopAgi); this.battleMembers().some(function (actor) { actor.iteratePassiveSkill('passiveASUP', function (metaData) { rate -= Number(metaData) * 0.01 * rate; }); }); return rate.clamp(0.0, 1.0); }; //-------------------------------------------------------------------------- /** Window_BattleSkill */ var _Window_BattleSkill_includes = Window_BattleSkill.prototype.includes; Window_BattleSkill.prototype.includes = function (item) { if (!this.showPassiveSkill()) { if (item) { var re = /<passive/; if (re.test(item.note)) { return false; } } } return _Window_BattleSkill_includes.call(this, item); }; Window_BattleSkill.prototype.showPassiveSkill = function () { if (exports.Param.ShowBattleSwitchId > 0) { return $gameSwitches.value(exports.Param.ShowBattleSwitchId); } else { return exports.Param.ShowBattle; } }; }((this.dsPassiveSkill = this.dsPassiveSkill || {})));
dazed/translations
www/js/plugins/dsPassiveSkill.js
JavaScript
unknown
36,973
(function () { //================ // Copyright (c) 2016 Ponidog /ぽに犬 // This plugin is released under the MIT License. // http://opensource.org/licenses/mit-license.php //=============== //バックログを表示するプラグインですばい。 //メッセージウィンドウに渡すtextを別途保存してそれを表示させてます。 // という基本機能の上に色々ぶっこんでいます。 // // //コメント文の癖でif(条件式){  }//if(条件式) //という風に}の後ろにその始まった条件式をコメントしてます。 //自分的にデバックしやすい形という事で。 // // version //* ver1.05 (2019/5/23) メッセージが隠れてる状態でもバックログを右クリックで呼び出す。 //* ver1.04 (2019/3/26) プラグインコマンド BackLogDirectAdd text 直接バックログに文字textを追加する。画像テキストなどログに反映されないテキストをどうにかしたいときにつかう。 //* ver1.03 (2019/02/27) バックログ上下ボタンのでっかいのをログ呼び出し中に表示。スマホ想定。 //* ver1.02 (2019/01/10) ルビプラグインの処理の修正。 //* ver1.01 (2018/12/16) メッセージ送りにスペースキーとリターンボタンの検知を追加。(他のマルチプルウィンドウスクリプトプラグインででうまく行ってない為) //* ver1.00 (2018/0906) プラグイン機能を使わないようにするコマンドを追加。他メッセージ系プラグイン導入時にyepメッセージコアのネームボックスが消えない問題への対処。 //* ver0.94 (2018.8/26) 会話中にコモンイベント連動機能。指定の顔アイコンが来たらスイッチをonにする機能を新設。 //* コモンイベントのスイッチトリガの並列処理と併せて使ってください。イベント先でスイッチをオフにすること。 //* //* ver0.93 (2018.1/26) よしだとものりさんの報告を元に戦闘時にバックログを使おうとするとエラーがでる問題を対応 //* ver0.92 (2017.3/18) 新しいfont適用版でタグの残骸が半角の□で表示されるようになってたのでそれを削除。 //* ver0.91 (2017. 2/25) スマホで長押しが右クリック判定になってメッセージが隠れまくるので //* スマホ時は画面の3/5より下の長押しでは隠れないようにした。画面上の方で長押しすると隠れる。 //* //* ルビ振りプラグイン (riru氏のプラグイン。\r[本文,ルビ] の制御文字)でログにルビなし本文のみを追加するようにした。 //* その関係で半角,と[なにか文字]を同一行テキストに使ってる場合は後半丸ごと消えてしまうので全角の、を使ってもらいたい。 //* //* ver0.9 (2016. 10/6) 最大ログ保存数を設定可能にした。デフォルトは無制限。 // あとBackをBuckで一部書いてたのでそれをBackに統一というどうでも良い修正がされた。 //* ver 0.8 (2016. 10/4) 顔画像なしの地の文が混ざるとわかりづらいのでその対応策を追加 //* ver 0.7 (2016. 10/3) Yepメッセージコアのネームボックスをログに反映できるようにした関係で色々機能追加。 //* ver 0.6 (2016. 9/30)右クリックでメッセージウィンドウを隠す処理を追加。 //* ver 0.5 (2016. 9/28)ページの無限遡りをカット。制御文字の\!等がログに残るのを削除。 //* 特殊な制御文字を追加していた場合はGame_Message.prototype.convertEscapeCharactersに適宜追加 //* ・ページ毎に空行1つ追加して見やすくしたり。 //* ver 0.4 (2016. 3/31)制御文字に対応させた。 //* ver0.3 (2016. 3/25)とりあえず出した /*: * @plugindesc バックログ及びメッセージ周りの補填関係 * @author ponidog http://ponidog.sakura.ne.jp/ * https://ci-en.jp/creator/666 * @desc バックログ ver1.05 (2019. 5/23) * * @param nBackLogDisplayLine * @desc 表示行数 * @default 12 * @param nBackLogLimitMax * @desc 最大保存ログ行数。0以下で無制限 * @default -1 * @param nBackLogButtonUp * @desc ページアップボタンのピクチャID * @default 0 * @param nBackLogButtonDown * @desc ページダウンボタンのピクチャID * @default 0 * @param nBackLogButtonHide * @desc ウィンドウを隠すボタンのピクチャID * @default 0 * @param bPoniBKlog_RClickHideON * @desc 右クリックでメッセージウィンドウを隠す機能を使う。プラグインの競合を受けやすいので導入時に注意。 * @type boolean * @on Yes * @off No * @default 0 * @param bBackLogNameOn_forYepMessageCore * @desc Yepプラグインの名前欄をログに追加 true/false * @type boolean * @on Yes * @off No * @default true * @param sBackLogTitle * @desc ログのタイトル。ログは  ####LOG 1/16 Page## のように表示されます * @default ###LOG * @param sBackLogTitlePage * @desc ログのタイトルの末尾 * @default Page## * @param sBackLogNameOn_Flame * @desc ログの名前欄の先頭文字 * @default ● * @param sBackLogNameOn_Flame2 * @desc ログの名前欄の文字末尾 * @default   * @param sBackLogNoFaceSymbol * @desc 名前欄なしメッセージのログ表示 * @default ★ * @param sBackLogNoFaceSpace * @desc 顔画像がない場合、ログ各行の頭に付ける文字。空白など入れると見やすい。 * @default * * @param bHideMessageCall_In_SwitchNum * @desc 右クリックでメッセージを隠した時にonになるスイッチ番号。例えば特定のピクチャを消したい時やSEを鳴らしたい時に使います。 * コモンイベントの並列処理でスイッチのトリガー監視で別途設定してください。(該当コモンイベントでスイッチをoffにしないとループしますよ) * @default 0 * * @param bHideMessageCall_Out_SwitchNum * @desc 右クリックでメッセージを隠した後、戻る際にonになるスイッチ番号 * @default 0 * * @param nAnimeOnSwitchNum * @desc 会話キャラにコモンイベントを連動させる時のスイッチ番号。スイッチ番号がON状態の時に発動します。 * ※予約スイッチ番号。使わないスイッチ番号を指定してください。(機能を使わないなら不要です) * @default 0 * @param nButton_1 * @desc ボタンのピクチャID。 このピクチャ番号をクリックした時に対応するスイッチをonにします。(メッセージ表示中も反応します) * @default 0 * @param nButton_switch_1 * @desc ボタンのピクチャIDに対応したスイッチ番号 * @default 0 * @param nButton_2 * @desc ボタンのピクチャID * @default 0 * @param nButton_switch_2 * @desc ボタンのピクチャIDに対応したスイッチ番号 * @default 0 * @param nButton_3 * @desc ボタンのピクチャID * @default 0 * @param nButton_switch_3 * @desc ボタンのピクチャIDに対応したスイッチ番号 * @default 0 * @param nButton_4 * @desc ボタンのピクチャID * @default 0 * @param nButton_switch_4 * @desc ボタンのピクチャIDに対応したスイッチ番号 * @default 0 //#add_btn * @param nButton_5 * @desc ボタンのピクチャID * @default 0 * @param nButton_switch_5 * @desc ボタンのピクチャIDに対応したスイッチ番号 * @default 0 * @param nButton_6 * @desc ボタンのピクチャID * @default 0 * @param nButton_switch_6 * @desc ボタンのピクチャIDに対応したスイッチ番号 * @default 0 * * * @param nButton_7 * @desc ボタンのピクチャID * @default 0 * @param nButton_switch_7 * @desc ボタンのピクチャIDに対応したスイッチ番号 * @default 0 * * @param nButton_8 * @desc ボタンのピクチャID * @default 0 * @param nButton_switch_8 * @desc ボタンのピクチャIDに対応したスイッチ番号 * @default 0 * * * * @help *■■■■■■■■■■■■■■ * 概要 *■■■■■■■■■■■■■■ * メッセージ表示中にPageUpかマウスホイールを上に回すことでバックログが表示される * プラグインです。 * 移動中等で呼ぶ場合は別途イベントで設定してください。 * 開発中のゲームに特化して作ってるのを公開してるので癖があります。 * * ノベル系ゲームに便利な以下の機能もついています。 * ・右クリックでメッセージウィンドウを隠します。この状態でもう一度右クリックでバックログを呼べます。 * またマウスホイールを下に回すことでメッセージを進めます。 *   (右クリックでメッセージを隠した際に指定スイッチをonすることもできます。SEを鳴らしたい時などに使えます) * * ・メッセージ表示中にマウスホイールを下に回すとメッセージ送り。(クリックと同等) * * ・ネームボックスの自動呼出し。 * 設定した顔アイコンに連動して表示されます。(YepMessageCore必須) * ・コモンイベントの連動補助。 * メッセージに設定した顔アイコンが来るとスイッチがONになります。 * 別途コモンイベントのスイッチ並列処理をすることで表現が楽になります。 * (例:ピクチャ番号100を立ち絵指定にしてキャラセリフで絵を切り替える等) * ・ピクチャにスイッチ番号の指定可。 * メッセージ表示中及びメニュー選択肢表示中にピクチャボタンを使いたい時に使います。 * よくあるセーブデータ呼び出しやコンフィグに使ったり、キャラをクリックした * りする時に使ってください。 * スイッチのオフはイベント側で制御してください。 * コモンイベントの並列処理で呼び出し後、同コモンイベントの先頭にスイッチのオフをいれます。(そうしないと無限ループします) *  なおMVの仕様としてメッセージ中や選択肢中にコモンイベントを呼び出ししても、 * コモンイベントで設定したメッセージや選択肢は読み込みされません。 *   SEやピクチャの表示などに限られます。 *■■■■■■■■■■■■■■ *■■■■■■■■■■■■■■ * プラグインコマンド *■■■■■■■■■■■■■■ *■■■■ *■■■■プラグイン使用のオンオフ■■■■ * STGゲーム等、メッセージを表示しない処理の重いスクリプトの時にはオフにしてみてく * ださい。 * 会話の時だけ使用する方法が軽いです。 *-------------------------------------- *▼プラグインコマンド * poni_1 または poniBackLogON * このプラグインの処理を使用する。デフォルトはONです。 * poni_2 または poniBackLogOFF * このプラグインの処理を使用しない * poni_BackLogUseCheck ?Swicth * 現在の使用状態をスイッチ番号?に渡す。 *--- *■■■■■■■■ *■■■■ *■■■■ネームボックスの設定 *メッセージの顔アイコンに設定したネームボックスが自動で呼び出しされます。 *これで毎回タグをつける必要がなくなります。(yepmessagecoreの機能 \n<名前> ) * リスト登録は スクリプト中のas_NameListImg配列を直接変更してください。 * 検索用文字 ##NameBox * * [タグ\n<名前>が文中にある場合 > スクリプトコマンド NameBoxSet > 顔画像リスト登録] *  左が優先してネームボックスに表示されます * ゲーム中にころころと変更したい場合はそうすると良いでしょう。 * なおリスト登録では2つ名の呼び出しにも対応してます。 *-------------------------------------- *▼プラグインコマンド * NameBoxSet なまえ *   YepMessageCore必須:名前欄に なまえを表示。リセットするまで。 * NameBoxReset *   YepMessageCore必須:なまえ をリセットします。 * *■■■■■■■■ *■■■■ *■■■■キャラとスイッチ連動 * メッセージに指定した顔アイコンが使われるとスイッチをONにします。 * 立ち絵を呼んだり天候を変更させたり色々応用が効きます。 * 直接スクリプト中の as_NameListImgSwitch 配列に顔アイコン名とスイッチ番号を設定 * してください。 * 検索用文字 ##CharaSwitches * * 設定のコツ * コモンイベントのトリガーを並列処理でスイッチ指定して使います。。 * そのコモンイベント内でスイッチをオフにしないと永久ループするので注意してく * ださい。 * *-------------------------------------- *▼プラグインコマンド * poni_17 or poniBacklog_CharaCommonON * 会話中にコモンイベントを連動させる合図です。 * 顔アイコンのリストに対応したスイッチがonになります。 * このon/offをすることで細かいシーンの制御ができます。 * (1枚絵中のイベントシーンでその間、立ち絵は呼びたくない時など) *   * poni_18 or poni_17off or poniBacklog_CharaCommonOFF *    poni_17をオフにします。 * ※内部処理的には予約したスイッチ番号nAnimeOnSwitchNumId をオン・オフするコマンドですので * プラグインコマンドではなく直接スイッチをオン・オフしても構いません。 *■■■■■■■■ *■■■■ *■■■■バックログ機能の呼び出し * デフォルト状態はメッセージ表示中のみにPageUpとマウスホイールでバックログを呼び * 出せます。 * 会話終了後には呼べません。 * 以下を別途マップイベントの並列処理などで設定する必要があります。 * * 設定例 * ◆条件:スクリプト:Input.isTriggered('pageup') ||TouchInput._wheelY <0 *   ◆プラグインコマンド:BackLogStart * * ----- * バックログボタンをプラグインで追加した場合は自分でピクチャをマップに追加してください。 * *-------------------------------------- *▼プラグインコマンド * BackLogStart *   バックログを開始。 * BackLogUp *   ページアップ。 * BackLogDown *   ページダウン。 * * BackLogLimitMax *   最大保存ログ行数を変更する。0以下で無制限保存。 *   \V[n]の変数も使える。例:BackLogLimitMax \V[1] * * BackLogDirectAdd * メッセージに表示してないテキストを直接バックログにわたす。 * 例:BackLogDirectAdd てすとてすと * *BackLog_RhideON *BackLog_RhideOFF * 右クリックでメッセージを隠す機能をオンオフする *■■■■■■■■■■■■■■■■■■■■■■■■■■■■ * その他 *■■■■■■■■■■■■■■ * * Rubi_riru.js のルビプラグインの制御文字に対応してます。 \r[文字,ルビ] * ログには文字(ルビ)と表示されます。 * その関係で文中に半角の,が使われているとログがおかしくなります。 *------------ * ◆バックログ中に他のプラグインの制御文字が表示される場合の処置 * * 他のプラグイン等の制御文字がログに残る場合は * 中段ぐらいにある Game_Message.prototype.convertEscapeCharactersに追記してくだ * さい。 * (検索用文字##add_Seigyo) *---------------- * ◆ピクチャボタンを増やしたい * * 指定のピクチャを押すとスイッチがオンになる機能があります。 * ボタンをコピペして数字ふやして無制限に追加できます。 *  メニューセレクト、会話中でも有効です。 * パラメータとスクリプトの追加コピペが必要です。検索『 #add_btn 』の場所をみて * ください。 *  なおツクールの仕様として会話中にコモンイベント先で別のメッセージを表示させることはできません。 * 効果音やピクチャ等の表現ができます。 *----- * ネームボックスのタグはYEPネームタグの\n<名前>に対応してますが * 他のプラグインで使うネームタグを追加したい場合は *『 #nameTag 』 で検索して出て来る箇所をいじってみてください。 * *----- * MultipleWindowSkinSystemと併用する際はウィンドウを隠す機能が使えません。 * ログは見ることができます。 * メッセージウィンドウの上に来るように表示ログ数を調整してください。 * * <改造> * b_USE_MultipleWindowSkinSystemの各Window_Messageプロトタイプをスキップするプラグイン命令を追加して * かつメニュー呼び出しの位置を画面外に飛ばすことで対応できます。 * (ウィンドウが多重に同一位置に存在するようになる為、デフォルト以外を飛ばす処理) * *----- * 使用に関してはMIT準拠です。 * 成人向けの使用も問題ありません。 * 成人向け同人ゲームの場合はツイッターのフォローがあると嬉しいです。 *■■■■■■■■■■■■■■ *パラメーター *■■■■■■■■■■■■■■ *nBackLogDisplayLine * 表示桁数 * *nBackLogLimitMax * 最大保存ログ行数。0以下で無制限。 * デフォルトは無制限の設定。なお毎回ロード時にログはリセットされる。 * *nBackLogButtonUp *  ページアップボタンのピクチャID *nBackLogButtonDown * ページダウンボタンのピクチャID *nBackLogButtonDown * メッセージウィンドウを隠すボタンのピクチャID *bBackLogNameOn_forYepMessageCore * Yepプラグインの名前欄をログに追加。デフォルトはtrue (true/false) * *sBackLogNameOn_Flame * ログの名前欄の先頭文字。デフォルトは● * sBackLogNameOn_Flame2 * ログの名前欄の文字末尾。デフォルトは空欄。 * * sBackLogNoFaceSymbol * 名前欄なしメッセージのログ表示。 * いわゆる地の文の開始合図にも使える。デフォルトは★ * sBackLogNoFaceSpace * 顔画像がない場合、ログ各行の頭に付ける文字。空白など入れるとよい。 * デフォルトでスペース入れたら駄目だったので自前で入れてくだされ。 *  ※名前欄と顔画像なしの場合はsBackLogNoFaceSymbolと併せて適用される。 * * nAnimeOnSwitchNum * キャラ会話にアニメやら人物を半透明化などのコモンイベントを連動させたいとき * に使う合図のスイッチ番号。 * (途中でセーブ&ロードを挟んでも状態が保持されるようにした) * 各キャラのコモンイベント呼び出しは別途リストに対応スイッチ番号を入力すること。 *■■■■■■■■■■■■■■ *■■■ * 一部競合するプラグインは別途条件式を付け足してくだされ。 * 下の方にある上書きする関数が競合原因でごわすよ。 * */ "use strict"; var pluginName = 'ponidog_BackLog'; // //========================================================== var parameters = PluginManager.parameters('ponidog_BackLog_utf8'); //表示する行数。最初は小さい数字でテストすると良い var nBackLogDisplayLine = Number(parameters['nBackLogDisplayLine'] || 18); //最大ログ保持数。マイナス値は無制限。 var nBackLogLimitMax = Number(parameters['nBackLogLimitMax'] || -1); //ボタンピクチャの番号。プラグイン管理からか右の0を書き換え。 var nBackLogButtonUpId = Number(parameters['nBackLogButtonUp'] || 0); var nBackLogButtonDownId = Number(parameters['nBackLogButtonDown'] || 0); var nBackLogButtonHideId = Number(parameters['nBackLogButtonHide'] || 0); var bButtonON = false; var bBuckLogONOFF = true; var sBackLogButtonBig = String(parameters['sBackLogButtonBig'] || ""); var nBackLogButtonUpBigId = Number(parameters['nBackLogButtonUpBig'] || 0); var nBackLogButtonDownBigId = Number(parameters['nBackLogButtonDownBig'] || 0); var bHideMessageCall_In_SwitchNum = Number(parameters['bHideMessageCall_In_SwitchNum'] || 0); var bHideMessageCall_Out_SwitchNum = Number(parameters['bHideMessageCall_Out_SwitchNum'] || 0); var bHideMessageNow = 0; //------------------------------------------------ //#add_btn //スイッチ連動ボタンピクチャの番号。プラグイン管理からか右の0を書き換え。 // ▼               ▼ var nButton_1 = Number(parameters['nButton_1'] || 0); var nButton_2 = Number(parameters['nButton_2'] || 0); var nButton_3 = Number(parameters['nButton_3'] || 0); var nButton_4 = Number(parameters['nButton_4'] || 0); var nButton_5 = Number(parameters['nButton_5'] || 0); var nButton_6 = Number(parameters['nButton_6'] || 0); var nButton_7 = Number(parameters['nButton_7'] || 0); var nButton_8 = Number(parameters['nButton_8'] || 0); //同対応のスイッチ番号#add_btn //  ▼                  ▼ var nButton_switch_1 = Number(parameters['nButton_switch_1'] || 0); var nButton_switch_2 = Number(parameters['nButton_switch_2'] || 0); var nButton_switch_3 = Number(parameters['nButton_switch_3'] || 0); var nButton_switch_4 = Number(parameters['nButton_switch_4'] || 0); var nButton_switch_5 = Number(parameters['nButton_switch_5'] || 0); var nButton_switch_6 = Number(parameters['nButton_switch_6'] || 0); var nButton_switch_7 = Number(parameters['nButton_switch_7'] || 0); var nButton_switch_8 = Number(parameters['nButton_switch_8'] || 0); //------------------------------------------------ var sBackLogTitle = String(parameters['sBackLogTitle'] || '##Log'); var sBackLogTitlePage = String(parameters['sBackLogTitlePage'] || ' Page ##'); //Yepメッセージコアのネームボックスを反映 //インスタンス名は ._nameWindow らしい。 var bPoniBKlog_RClickHideON = eval(parameters['bPoniBKlog_RClickHideON'] || 'false'); //bPoniBKlog_RClickHideON = Boolean(bPoniBKlog_RClickHideON); //console.log("parameters['bPoniBKlog_RClickHideON']"+parameters['bPoniBKlog_RClickHideON']); var bBackLogNameOn = eval(parameters['bBackLogNameOn_forYepMessageCore'] || 'false'); var sBackLogNameFlame = String(parameters['sBackLogNameOn_Flame'] || '●'); var sBackLogNameFlame2 = String(parameters['sBackLogNameOn_Flame2'] || ''); var BitmapRext = ""; //顔画像なしの時のバックログ処理。 //名前付き会話文の後の地の文章がわかりづらいので差別化する。 var sBackLogNoFaceSymbol = String(parameters['sBackLogNoFaceSymbol'] || ''); var sBackLogNoFaceSpace = String(parameters['sBackLogNoFaceSpace'] || ''); //========================================================== //========================================================== // oはオブジェクトの接頭辞のつもりで付けてみた。 var oBackLog = new BackLog(); var an_BackLog = []; var an_BackLogNowText = []; //========================================================== //キャラ会話にコモンイベント連動させるときの合図。 //不要な時までオート呼び出しは煩わしいので。 var nAnimeOnSwitchNumId = Number(parameters['nAnimeOnSwitchNum'] || 0); //■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ //■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ //■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ //■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ // // 名前リストの入力欄 //■■■■ ■■■■■■■■■ //"画像名","対応するネームボックスに表示する名前", //のセットで入力。画像名は拡張子不要。 //"Actor1","荒ぶるヒポポタマス", //"Actor2","nickname=4", // //という風に記述をする。 //改行は挟んでも良いけど最後の""に,を付けないようにきをつける。 //"nickname=番号"を入れると 二つ名+キャラ名 が表示される。 //番号はその二つ名のアクター番号。 //二つ名の変更は$gameActors.actor(番号).setNickname("変更名")でゲーム内で可能なので //かなり融通の利く形のはず。 // // ##NameBox //サンプル的に入ってる中身は消して使ってください。 var as_NameListImg = [ "chuky-king", "コボルトキング", "chuky-green", "小さな緑", "Face-hvel", "伝説の暇人", "Face-chucky-red", "コボルトキング", "teatacle", "触手どん", "shadowone", "nickname=1" ]; //配列なので,の区切りに注意。 //["img","なまえ",]; って最後の行に,を付けるとエラーでる。 //["img","なまえ"]; が正解。 //■■■■ ■■■■■■■■■ //■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ //■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ //■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ // // スイッチリストの入力欄 //■■■■ ■■■■■■■■■ //サンプル的に入ってる中身は消して使ってください。 //メッセージの顔アイコンの名前が一致するとスイッチをオンにする。 // 0はスイッチを使用しない // ##CharaSwitches var as_NameListImgSwitch = [ "chuky-king", 0, "chuky-green", 0, "shadowone", 0, "yeid", "43" ]; //■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ //========================================================== //========================================================== //============================================================================= // Game_Interpreter //============================================================================= var _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand; Game_Interpreter.prototype.pluginCommand = function (command, args) { _Game_Interpreter_pluginCommand.call(this, command, args); if ((command) === 'BackLogStart') { //oBackLogButton.initialize(); oBackLog._nBackLogPage++; oBackLog.BackLog_Call(); } if ((command) === 'BackLogUp') { oBackLog._BackLogBusy = true; Input.update(); TouchInput.update(); oBackLog._nBackLogPage++; oBackLog.BackLog_Call(); } if ((command) === 'BackLogDown') { oBackLog._BackLogBusy = true; Input.update(); TouchInput.update(); oBackLog._nBackLogPage--; oBackLog.BackLog_Call(); } if ((command) === 'BackLogLimitMax') { var _TempLog = args[0]; //console.log(_TempLog); // 変数\V[n]ぶっこみに対応させる。 var bCheck = _TempLog.match(/\\V\[/g); if (bCheck) { _TempLog = _TempLog.replace(/\\V\[/gi, ''); _TempLog = _TempLog.replace(/\]/gi, ''); _TempLog = $gameVariables.value(parseInt(_TempLog)); }//if(_TempLog.match(/\\V\[/gi) nBackLogLimitMax = parseInt(_TempLog); if (nBackLogLimitMax) an_BackLog = an_BackLog.splice(-nBackLogLimitMax); } if ((command) === 'NameBoxSet') { oBackLog.sNameBoxSet_ponidogBackLog = args[0];// } if ((command) === 'NameBoxClear' || (command) === 'NameBoxReset') { oBackLog.sNameBoxSet_ponidogBackLog = ""; } if ((command) === 'BackLogDirectAdd') { var _text = args[0];// oBackLog.BackLog_addDirect(_text); console.log("■バックログ:" + _text); } if ((command) === 'poni_1' || (command) === 'poniBackLogON') { bBuckLogONOFF = true; } if ((command) === 'poni_2' || (command) === 'poniBackLogOFF') { bBuckLogONOFF = false; } if ((command) === 'poni_BackLogUseCheck') { var n = args[0];// $gameSwitches.setValue(n, bBuckLogONOFF); } if ((command) === 'BackLog_RhideON') { bPoniBKlog_RClickHideON = true; } if ((command) === 'BackLog_RhideOFF') { bPoniBKlog_RClickHideON = false; } /* if ( (command) === 'poni_3' ||(command) === 'poniBackLogMessageFrame') { var _TempLog=args[0]; //console.log(_TempLog); // 変数\V[n]ぶっこみに対応させる。 var bCheck=_TempLog.match(/\\V\[/g); if(bCheck){ _TempLog =_TempLog.replace(/\\V\[/gi,''); _TempLog =_TempLog.replace(/\]/gi,''); _TempLog =$gameVariables.value( parseInt(_TempLog) ); }//if(_TempLog.match(/\\V\[/gi) var nMessageNum=parseInt(_TempLog); var faceName="neko", faceIndex=1, x=0, y=0, width=68, height=68; $gameScreen.drawFaceOnPicture(nMessageNum,faceName, faceIndex, x, y, width, height); } */ if ((command) === 'poniBacklog_CharaCommonON' || (command) === 'poni_17') { $gameSwitches.setValue(nAnimeOnSwitchNumId, true);// } if ((command) === 'poniBacklog_CharaCommonOFF' || (command) === 'poni_18' || (command) === 'poni_17off') { $gameSwitches.setValue(nAnimeOnSwitchNumId, false);// } } //■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ // バックログの処理 //========================================================== // メッセージウィンドウに渡すtextを保存して // それを表示させるのがこのプラグインの目的となる。 // やってる事は // ・ログ配列にテキストを追加保存 // ・画面に重ねるレイヤーを作ってそれにログ載せ //========================================================== //■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ //上書き //各行 Game_Message.prototype.add = function (text) { //通常メッセージをウィンドウの配列へ渡す this._texts.push(text); var sNameSet = ""; //画像リストから現在の顔画像を検索 var nNameSerch = as_NameListImg.indexOf(this._faceName); // var nNameSerchSwitch = as_NameListImgSwitch.indexOf(this._faceName); //console.log("nNameSerch "+nNameSerch); //あれば名前をセットする。 if (nNameSerch >= 0) { sNameSet = as_NameListImg[nNameSerch + 1]; //画像リストにニックネームを入れた場合の対応 //直接変数ぶっこんだら無理だったので強引に解決した。 if (sNameSet.match("nickname=")) { var _nActor = sNameSet.split("nickname=", 2); sNameSet = $gameActors.actor(parseInt(_nActor[1])).nickname() + $gameActors.actor(parseInt(_nActor[1])).name(); }//if(sNameSet.match("nickname=")){ }//if(nNameSerch>=0){ //同様にコモンイベント連動のスイッチ番号のセット if (nNameSerchSwitch >= 0) { var _switchNumActorCommon = as_NameListImgSwitch[nNameSerchSwitch + 1]; if (_switchNumActorCommon > 0 && $gameSwitches.value(nAnimeOnSwitchNumId) == true) $gameSwitches.setValue(_switchNumActorCommon, true);// }//if(nNameSerchSwitch>=0){ //スクリプトコマンドで名前指定があればそちらを優先する。 if (oBackLog.sNameBoxSet_ponidogBackLog.length > 0) sNameSet = oBackLog.sNameBoxSet_ponidogBackLog; //Yepメッセージコアのネームボックスを使用する場合の処理。 //現在の配列のindexを返す。 //this._texts.indexでは所得できなかったので一致する文字列を検索。 var _count = this._texts.indexOf(text); //#nameTag //ネームボックスがある場合。\n<> \nc<> \nr<> var list = text.match(/\\n\<(.*)\>/g || /\\nc\<(.*)\>/g || /\\nr\<(.*)\>/g); //プラグインコマンドでネームボックスが指定されている場合の表示 //なお文中で指定されてる場合はそちらを優先。 //#nameTag if (!list && _count == 0 && sNameSet.length > 0) { this._texts[0] = "\\n<" + sNameSet + ">" + this._texts[0]; }//!list // //■ //バックログに名前を反映する処理 if (bBackLogNameOn) { var sNameSetFull = ""; //名前表示 if (!list && _count == 0 && sNameSet.length > 0) { sNameSetFull = sBackLogNameFlame + sNameSet + sBackLogNameFlame2; }// //名前欄が空欄の場合 if (!list && _count == 0 && sNameSet.length == 0) { sNameSetFull = sBackLogNoFaceSymbol; }// //#nameTag if (list) { var sName = list[0]; sName = sName.replace(/\\nc\</g, ''); sName = sName.replace(/\\nr\</g, ''); sName = sName.replace(/\\n\</g, ''); sName = sName.replace(/\>/g, ''); sNameSet = sName; sNameSetFull = sBackLogNameFlame + sName + sBackLogNameFlame2; }//if(list) //前回表示した名前と違っていれば表示する。 //地の文のみに適用。会話文が地の文みたいに見えちゃったので。 if (_count == 0 && sNameSet.length == 0) { if (oBackLog.sNameBoxPrev_ponidogBackLog != sNameSetFull) { oBackLog.BackLog_add(sNameSetFull); oBackLog.sNameBoxPrev_ponidogBackLog = sNameSetFull; }//if }//if(sNameSet.length==0) if (_count == 0 && sNameSet.length > 0) { oBackLog.BackLog_add(sNameSetFull); oBackLog.sNameBoxPrev_ponidogBackLog = sNameSetFull; }//if(sNameSet.length>0){ }//if(bBackLogNameOn //制御文字の処理 var _text = this.convertEscapeCharacters(text); //顔画像なしの場合空行を入れて差別化する var sTextSpace = ""; if ($gameMessage.faceName() == "") sTextSpace = sBackLogNoFaceSpace; //バックログに文字列を渡す //an_BackLog.push( sTextSpace + _text); oBackLog.BackLog_add(sTextSpace + _text); }; //■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ //■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ //適度に空行を入れたい Game_Message.prototype.setBackground = function (background) { //an_BackLog.push(" ");//■なんかでも良いかもね oBackLog.BackLog_add(" "); this._background = background; }; //■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ //■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ //=============== //追加制御文字 //========= //制御文字は //str.replace(pattern, replacement[, flags]) //を用いている。flags=arguments[1] // 1 番目の括弧でキャプチャされたサブマッチの文字列を挿入とのこと。 Game_Message.prototype.convertEscapeCharacters = function (text) { // .replace(/■/g,□) という命令である。スラッシュ内の文字を置き換え。 // \\は\一文字を示してるいつもの。 //前半はデフォルトのソースをコピペ。 text = text.replace(/\\/g, '\x1b'); text = text.replace(/\x1b\x1b/g, '\\'); text = text.replace(/\x1bV\[(\d+)\]/gi, function () { return $gameVariables.value(parseInt(arguments[1])); }.bind(this)); text = text.replace(/\x1bV\[(\d+)\]/gi, function () { return $gameVariables.value(parseInt(arguments[1])); }.bind(this)); text = text.replace(/\x1bN\[(\d+)\]/gi, function () { return this.actorName(parseInt(arguments[1])); }.bind(this)); text = text.replace(/\x1bP\[(\d+)\]/gi, function () { return this.partyMemberName(parseInt(arguments[1])); }.bind(this)); text = text.replace(/\x1bG/gi, TextManager.currencyUnit); //後半。 //バックログに\!の!だけ残るのでそれを消す。また類似の命令があれば追加 //\x1bは前半に変換された\である。 text = text.replace(/\x1bC\[(\d+)\]/gi, '\x1b'); text = text.replace(/\x1bI\[(\d+)\]/gi, '\x1b'); text = text.replace(/\x1baf\[(\d+)\]/gi, '\x1b'); text = text.replace(/\x1b!/g, '\x1b'); text = text.replace(/\x1b>/g, '\x1b'); text = text.replace(/\x1b</g, '\x1b'); text = text.replace(/\x1bN/g, '\x1b'); text = text.replace(/\x1bWC/g, '\x1b');//\WC text = text.replace(/\x1bP/g, '\x1b');//\P text = text.replace(/\x1bLeft/g, '\x1b');//\Left text = text.replace(/\x1bVS/g, '\x1b');//\VS text = text.replace(/\x1bPS/g, '\x1b');//\PS text = text.replace(/\x1bEC/g, '\x1b');//\EC text = text.replace(/\x1bAT/g, '\x1b');//\AT text = text.replace(/\x1bWAT/g, '\x1b');//\WAT text = text.replace(/\x1bUL/g, '\x1b');//\UL text = text.replace(/\x1bCC/g, '\x1b');//\CC //そのまま使えない文字は\を追加する。 text = text.replace(/\x1b\|/g, '\x1b'); text = text.replace(/\x1b\^/g, '\x1b'); text = text.replace(/\x1b\./g, '\x1b'); text = text.replace(/\x1b\{/g, '\x1b'); text = text.replace(/\x1b\}/g, '\x1b'); text = text.replace(/\x1b\$/g, '\x1b'); text = text.replace(/\x1b\#/g, '\x1b');// //YEPメッセージコアのサブウィンドウのネームボックスがある場合の処理 //名前欄を別途改行表示するので、この場では消す。 //文頭にネームボックスタグがあるとは限らないので。 text = text.replace(/\x1bnc\<(.*)\>/g, '\x1b'); text = text.replace(/\x1bnr\<(.*)\>/g, '\x1b'); text = text.replace(/\x1bn\<(.*)\>/g, '\x1b'); //---------- //##add_Seigyo //追加で制御文字がある場合はここらへんに追加記述をします //例えば\! なら text = text.replace(/\x1b!/g, '\x1b'); と記述します // | などそのまま使えない記号の場合は\を頭に付けます。 // \|を消したい場合は text = text.replace(/\x1b\|/g, '\x1b'); と記述します。 //ルビプラグインの処理。 //\r[本文,ルビ]の処理 //本文(ルビ)の形で表示することにした。ver1.02から //以前のverでは1行に複数のルビがあると対応が厳しかったため。 if (text.search(/\x1br\[/gi) >= 0) { //fix ver1.02 条件の追加 text = text.replace(/\x1br\[/gi, '\x1b'); text = text.replace(/\,/gi, '('); text = text.replace(/\]/gi, ')'); // text = text.replace(/\,(\D+)\]/gi, '\x1b'); } //新しいfontで\x1bが半角の□で表示されるようになってたのでそれを削除。 text = text.replace(/\x1b/gi, ''); return text; }; //■■■■■■■■ //■■■■■■■■ //■■■■■■■■ //========================================================== // data // ============ function BackLog() { } BackLog.prototype.initialize = function () { this._BackLogBusy = 0; this._nBackLogPage = null; this._MessageHide = false; this._sNameBoxSet_ponidogBackLog = ""; this._sNameBoxPrev_ponidogBackLog = ""; }; BackLog.prototype.BackLogBusy = function () { return this._BackLogBusy; }; BackLog.prototype.MassageHide = function () { this._MessageHide = true; return this._MessageHide; }; BackLog.prototype.MassageShow = function () { this._MessageHide = false; return this._MessageHide; }; BackLog.prototype.MassageShowNow = function () { return !this._MessageHide; }; BackLog.prototype.nBackLogPage = function () { return this._nBackLogPage; }; BackLog.prototype.sNameBoxSet_ponidogBackLog = function () { return this._sNameBoxSet_ponidogBackLog; }; BackLog.prototype.sNameBoxPrev_ponidogBackLog = function () { return this._sNameBoxPrev_ponidogBackLog; }; //------ BackLog.prototype.BackLog_add = function (text) { //console.log(nBackLogLimitMax); //上限ログ数 if (nBackLogLimitMax > 0) { if (an_BackLog.length >= nBackLogLimitMax) an_BackLog.shift(); }//nBackLogLimitMax>0 an_BackLog.push(text); // this._texts.push(text); }; BackLog.prototype.BackLog_isBusy = function () { return this._BackLogBusy; } //========================================================== //メッセージに表示せずにバックログに追加したい場合に使う BackLog.prototype.BackLog_addDirect = function (text) { oBackLog.BackLog_add(text); }; //========================================================== // //========================================================== //■■■■■■■■■■■■■■■■■■■■■■■■■■■ BackLog.prototype.BackLog_Call = function () { if (this._nBackLogPage < 0 || !this._nBackLogPage) this._nBackLogPage = 0; if (this._nBackLogPage == null) this._nBackLogPage = 0; // this.MassageHide(); an_BackLogNowText.delete; an_BackLogNowText = []; var sBackLog = an_BackLog; var nBackLogPage = this._nBackLogPage; // if (this._nBackLogPage <= 0) { // this.MassageShow(); this._BackLogBusy = false; return; } var nBackLogLineNum = nBackLogDisplayLine;// this._BackLogBusy = true; if (sBackLog.length > 0) { var nStart = sBackLog.length - nBackLogLineNum * (nBackLogPage); if (nStart <= 0 || nStart == null) { nStart = 0; //ページ遡りの上限 nBackLogPage = sBackLog.length % nBackLogLineNum == 0 ? parseInt(sBackLog.length / nBackLogLineNum) : parseInt(sBackLog.length / nBackLogLineNum) + 1; this._nBackLogPage = nBackLogPage; } var nBackLogPageMAX = sBackLog.length % nBackLogLineNum == 0 ? parseInt(sBackLog.length / nBackLogLineNum) : parseInt(sBackLog.length / nBackLogLineNum) + 1; var nLast = nStart + nBackLogLineNum //sBackLog.length - nBackLogLineNum*(nBackLogPage); var nPageNow = parseInt(sBackLog.length / nBackLogLineNum) - nBackLogPage + 2; //ログのタイトル。(ページ/ページマックス) の表示。変更したい場合は変えてね。 an_BackLogNowText[0] = sBackLogTitle + " " + Number(nPageNow) + "/" + nBackLogPageMAX + sBackLogTitlePage; //ログ内容 var j = 1; for (var i = nStart; i < nLast; i++) { if (sBackLog[i]) an_BackLogNowText[j] = sBackLog[i]; if (!sBackLog[i]) an_BackLogNowText[j] = ""; j++; }//for }//if (sBackLog.length > 0) { return; };// //■■■■■■■■■■■■■■■■■■■■■■■■■■■ //■■■■■■■■■■■■■■■■■■■■■■■■■■■ //========================================================== //========================================================== //========================================================== //========================================================== // Sp //========================================================== function Buck_logSp() { this.initialize.apply(this, arguments); } Buck_logSp.prototype = Object.create(Sprite.prototype); Buck_logSp.prototype.constructor = Buck_logSp; Buck_logSp.prototype.initialize = function () { Sprite.prototype.initialize.call(this); this.createBitmap(); this.update(); }; Buck_logSp.prototype.createBitmap = function () { this.bitmap = new Bitmap(Graphics.width, Graphics.height); this.bitmap.fontSize = 32; }; Buck_logSp.prototype.update = function () { Sprite.prototype.update.call(this); this.updateBitmap(); this.updateVisibility(); }; Buck_logSp.prototype.updateBitmap = function () { this.redraw(); }; Buck_logSp.prototype.redraw = function () { var width = this.bitmap.width; var height = this.bitmap.height; //drawTextのyは以下で計算する。 //var ty = y + lineHeight - (lineHeight - this.fontSize * 0.7) / 2; // = y+ lineHeight/2 -0.7*this.fontSize/2 this.bitmap.clear(); var _s_rgba = "rgba(0,0,0,0.5)"; this.bitmap.fillAll(_s_rgba); //バックログ上下エリアを追加 this.bitmap.fillRect(width - 120, height - 180, 70, 70, '#FFDDDD'); this.bitmap.fillRect(width - 115, height - 100, 70, 70, '#FFFFFF'); this.bitmap.drawText("Up", width - 120, height - 180, 70, 70, 'Left'); var i, nLast = 0; if (an_BackLogNowText) nLast = an_BackLogNowText.length - 1;// 0から入るので if (an_BackLogNowText == null) return; for (i = 0; i <= nLast; i++) { var text = this.BackLogText(i); this.bitmap.drawText(text, 10, 10 - height / 2 + 0.7 * this.bitmap.fontSize + this.bitmap.fontSize * i, width, height, 'Left'); }//for }; Buck_logSp.prototype.BackLogText = function (i) { var sText = an_BackLogNowText[i]; if (sText == null) sText = ""; return sText; }; Buck_logSp.prototype.updateVisibility = function () { this.visible = false; if (oBackLog._BackLogBusy) this.visible = true; }; //========表示====== //Spriteset_Base Spriteset_Base.prototype.createBackLog = function () { this._BackLog = new Buck_logSp(); this.addChild(this._BackLog); }; var _Spriteset_Base_prototype_createUpperLayer = Spriteset_Base.prototype.createUpperLayer; Spriteset_Base.prototype.createUpperLayer = function () { _Spriteset_Base_prototype_createUpperLayer.call(this); this.createBackLog(); }; var _Spriteset_Base_prototype_createSpriteset = Spriteset_Base.prototype.createSpriteset; Spriteset_Base.prototype.createSpriteset = function () { _Spriteset_Base_prototype_createSpriteset.call(this); this.createBackLog(); }; //========================================================== var _Spriteset_Base_prototype_update = Spriteset_Base.prototype.update; Spriteset_Base.prototype.update = function () { _Spriteset_Base_prototype_update.call(this); if (this._BackLog) this._BackLog.redraw();//fix 20180908 }; //============== //■■■■■■■■■■■■■■■■■■■■■■■■■■■■ /* Game_Screen.prototype.drawFaceOnPicture = function(pictureId,faceName, faceIndex, x, y, width, height) { if($gameScreen.picture(pictureId)==null)return 0; width = width ||68// Window_Base._faceWidth; height = height ||68;// Window_Base._faceHeight; var Facebitmap = ImageManager.loadFace(faceName); var pw = 68;//Window_Base._faceWidth; var ph = 68;//Window_Base._faceHeight; var sw = Math.min(width, pw); var sh = Math.min(height, ph); var dx = Math.floor(x + Math.max(width - pw, 0) / 2); var dy = Math.floor(y + Math.max(height - ph, 0) / 2); var dw = Facebitmap.dw || sw; var dh = Facebitmap.dh || sh; var sx = faceIndex % 4 * pw + (pw - sw) / 2; var sy = Math.floor(faceIndex / 4) * ph + (ph - sh) / 2; //this.Bitmap.blt(bitmap, sx, sy, sw, sh, dx, dy); //childrenはSpriteオブジェクトらしい //console.log(SceneManager._scene._spriteset._pictureContainer.children[pictureId-1].bitmap._context); //debugger; SceneManager._scene._spriteset._pictureContainer.children[pictureId-1].bitmap._context.drawImage(Facebitmap,sx, sy, sw, sh, dx, dy, dw, dh); }; */ //========================================================== //■■■■■■■■■■■■■■■■■■■■■■■■■■■■ //■■■■■■■■■■■■■■■■■■■■■■■■■■■■ //■■■■■■■■■■■■■■■■■■■■■■■■■■■■ // メッセージ中のキー操作関係 // //================▼右クリックとマウスホイールの監視項目================================ //=======================1)=======Window_Message.prototype.updateWait ============================ //=======================2)=======Window_Message.prototype.updateInput ============================ //========================================================== //=================の2つの関数を使っている。========================================= //●目的効果 //クリック待ち中のウィンドウを消す。 //バックログ実行中ならばウィンドウを全てハイドする //またメッセージウィンドウを右クリックで隠す処理も追加した。 //トリアコンタン氏のスクリプトを参考にした。 //なおMultipleWindowSkinSystem.jsとは相性が悪く、メッセージを隠す処理ができない。 //========================================================== //====マウスホイールはともかく右クリックの監視が他のプラグインとの間で問題になりやすいようだ。======== //========================================================== //■■■■■■■■■■■■■■ //■■■■■ Window_Message //■■■■■ var _Window_Message_updateWait = Window_Message.prototype.updateWait; Window_Message.prototype.updateWait = function () { _Window_Message_updateWait.call(this); //バックログの使用が許可されてない場合はすぐ戻る。 if (!bBuckLogONOFF) { return _Window_Message_updateWait.call(this); } //各種バタンを押した場合の処置 if (TouchInput.isTriggered()) { if (oBackLog.ButtonPress(nBackLogButtonDownId) || oBackLog.ButtonPress(nBackLogButtonUpId)) { bButtonON = true; return false; } ////#add_btn //ボタン追加したかったらコピペして数字▼を変更 if (oBackLog.ButtonPress(nButton_1)) { bButtonON = true; return false; } if (oBackLog.ButtonPress(nButton_2)) { bButtonON = true; return false; } if (oBackLog.ButtonPress(nButton_3)) { bButtonON = true; return false; } if (oBackLog.ButtonPress(nButton_4)) { bButtonON = true; return false; } if (oBackLog.ButtonPress(nButton_5)) { bButtonON = true; return false; } if (oBackLog.ButtonPress(nButton_6)) { bButtonON = true; return false; } if (oBackLog.ButtonPress(nButton_7)) { bButtonON = true; return false; } if (oBackLog.ButtonPress(nButton_8)) { bButtonON = true; return false; } }//if (TouchInput.isTriggered () if (oBackLog._BackLogBusy) { this.hide(); this.subWindows().forEach(function (subWindow) { subWindow.hide(); }); // oBackLog.nameboxHideBackLogScript(); //クリック if (TouchInput.isTriggered() || TouchInput.isCancelled()) { //============================= //バックログがアクティブ中のUp downエリアを押した場合の処理 if (oBackLog.ButtonPressUpDownRect('Upkey')) { TouchInput.clear(); Input.update(); oBackLog._nBackLogPage++; oBackLog.BackLog_Call(); return false;//クリックの反応は悪くなる return true; } if (oBackLog.ButtonPressUpDownRect('Downkey')) { TouchInput.clear(); Input.update(); oBackLog._nBackLogPage--; oBackLog.BackLog_Call(); return true; }//pagedownn //============================= //バックログ中または右クリックのハイド状態からメッセージウィンドウを見えるように戻す TouchInput.clear(); Input.clear(); this.show(); this.subWindows().forEach(function (subWindow) { subWindow.show(); }); oBackLog._BackLogBusy = false; oBackLog._nBackLogPage = 0; if (bHideMessageNow == 1) $gameSwitches.setValue(bHideMessageCall_Out_SwitchNum, true), bHideMessageNow = 0;//ver1.05 }//if (TouchInput.isTriggered () ||TouchInput.isCancelled() ){ }// if (oBackLog._BackLogBusy) //▼ここから▼バックログが非アクティブ状態の時の処理 else { /* //右クリックを押した時に通常のメッセージウィンドウを消去する。 if(TouchInput.isCancelled() && oBackLog.IsSmahoRClick() && bPoniBKlog_RClickHideON ){ TouchInput.clear () ; Input.clear () ; if (this.visible) { this.hide(); this.subWindows().forEach(function(subWindow) { subWindow.hide(); }); this._nameWindow.deactivate(); // oBackLog.nameboxHideBackLogScript(); } else { this.show(); this.subWindows().forEach(function(subWindow) { subWindow.show();}); } return false; }//if (TouchInput.isCancelled()&& oBackLog.IsSmahoRClick() && bPoniBKlog_RClickHideON) */ //------------------- //メッセージウィンドウが隠れている場合、クリックでも復帰するように処理 if (!this.visible) { //左クリックは常にメッセージウィンドウを見えるように戻す if (TouchInput.isTriggered()) { //0905-a TouchInput.clear () ; Input.clear () ; this.show(); this.subWindows().forEach(function (subWindow) { subWindow.show(); }); if (bHideMessageNow == 1) $gameSwitches.setValue(bHideMessageCall_Out_SwitchNum, true), bHideMessageNow = 0;//ver1.05 }//if (TouchInput.isTriggered () ){ //ついでページダウンで戻った際もウィンドウを復帰表示 if (Input.isTriggered('pagedown') || TouchInput._wheelY > 0) { TouchInput.clear(); Input.clear(); this.show(); this.subWindows().forEach(function (subWindow) { subWindow.show(); }); }// }//if (!this.visible) }// if (!oBackLog._BackLogBusy)else return _Window_Message_updateWait.call(this); }; //■■■■■■■■■■■■■■■ //----------//---------- //■■■■■■■■■■■■■■■ //----------   選択肢またはメッセージ表示後のクリック待ち状態 //----------//---------- //----------//---------- //基本は上書きでの処理にしてる。 // _Window_Message_updateInput.call(this); を追記すれば他のプラグインとの併用処理になる。 //------------- var _Window_Message_updateInput = Window_Message.prototype.updateInput; Window_Message.prototype.updateInput = function () { //このプラグインを処理しない時はここで戻る。 if (!bBuckLogONOFF) { if (oBackLog._BackLogBusy) { oBackLog._BackLogBusy = false; oBackLog._nBackLogPage = 0; }//バックログ表示中に進めた場合に起こる return _Window_Message_updateInput.call(this); }// /* //選択を切り替えした場合の処置。ないと選択選べない。 if (this.isAnySubWindowActive()) { return true; } */ //ボタンを押して呼び出しした場合のチェック if (TouchInput.isTriggered()) { //メッセージを隠す //隠すボタンを押した場合の処理 if (oBackLog.ButtonPress(nBackLogButtonHideId)) { if (this.visible) { this.hide(); this.subWindows().forEach(function (subWindow) { subWindow.hide(); }); bHideMessageNow = 1; $gameSwitches.setValue(bHideMessageCall_In_SwitchNum, true);//ver1.05 } else { this.show(); this.subWindows().forEach(function (subWindow) { subWindow.show(); }); if (bHideMessageNow == 1) $gameSwitches.setValue(bHideMessageCall_Out_SwitchNum, true), bHideMessageNow = 0;//ver1.05 } }//隠すボタンを押した場合の処理--ここまで // console.log(this._choiceWindow.hitTest()); //これは駄目だった。常にー1なので参照していない //console.log(this); //会話中にスイッチをオンにするボタン。 //#add_btn //ボタン追加したかったらコピペして数字▼を変更 ここも ▼ if (oBackLog.ButtonPress(nButton_1)) { $gameSwitches.setValue(nButton_switch_1, true);// return true; }// if (oBackLog.ButtonPress(nButton_2)) { $gameSwitches.setValue(nButton_switch_2, true);// return true; }// if (oBackLog.ButtonPress(nButton_3)) { $gameSwitches.setValue(nButton_switch_3, true);// return true; }// if (oBackLog.ButtonPress(nButton_4)) { $gameSwitches.setValue(nButton_switch_4, true);// return true; }// if (oBackLog.ButtonPress(nButton_5)) { $gameSwitches.setValue(nButton_switch_5, true);// return true; }// if (oBackLog.ButtonPress(nButton_6)) { $gameSwitches.setValue(nButton_switch_6, true);// return true; }// if (oBackLog.ButtonPress(nButton_7)) { $gameSwitches.setValue(nButton_switch_7, true);// return true; }// if (oBackLog.ButtonPress(nButton_8)) { $gameSwitches.setValue(nButton_switch_8, true);// return true; }// //追加ボタンの処理はここまで。 //バックログ開始のボタンを押した時の処理。 if (oBackLog.ButtonPress(nBackLogButtonDownId) || oBackLog.ButtonPress(nBackLogButtonUpId)) { if (oBackLog.ButtonPress(nBackLogButtonDownId)) oBackLog._nBackLogPage--; if (oBackLog.ButtonPress(nBackLogButtonUpId)) oBackLog._nBackLogPage++; TouchInput.clear(); Input.clear(); oBackLog.BackLog_Call(); return false; return true; }//if(oBackLog.ButtonPress(nBackLogButtonDownId)||oBackLog.ButtonPress(nBackLogButtonUpId) ){ }//if(TouchInput.isTriggered()&&bButtonON) //メッセージが隠れてる状態での右クリックでもバックログを呼び出す ver1.05 add if (!oBackLog._BackLogBusy && !this.visible && TouchInput.isCancelled() && oBackLog.IsSmahoRClick) { // debugger; TouchInput.clear(); Input.clear(); oBackLog._nBackLogPage++; oBackLog.BackLog_Call(); return true; } //バックログを表示中の処理 if (oBackLog._BackLogBusy) { //遡る if (Input.isTriggered('pageup') || TouchInput._wheelY < 0) { TouchInput.clear(); Input.update(); oBackLog._nBackLogPage++; oBackLog.BackLog_Call(); return false;//クリックの反応は悪くなる return true; }//pageup //進める if (Input.isTriggered('pagedown') || TouchInput._wheelY > 0) { TouchInput.clear(); Input.update(); oBackLog._nBackLogPage--; oBackLog.BackLog_Call(); return true; }//pagedownn //ページマイナスで閉じる。 if (oBackLog._nBackLogPage <= 0) { //console.log("■1189\n"); oBackLog._BackLogBusy = false; oBackLog._nBackLogPage = 0; TouchInput.clear(); Input.clear(); this.pause = false; // this.terminateMessage(); //メッセージウィンドウを表示させる。 this.show(); this.subWindows().forEach(function (subWindow) { subWindow.show(); }); return false; }// //クリック等でもバックログを閉じる。 if (this.isTriggered() || TouchInput.isCancelled() && oBackLog.IsSmahoRClick()) { if (oBackLog._BackLogBusy && oBackLog.ButtonPressUpDownRect('Upkey')) return true; if (oBackLog._BackLogBusy && oBackLog.ButtonPressUpDownRect('Downkey')) return true; TouchInput.clear(); Input.clear(); oBackLog._BackLogBusy = false; oBackLog._nBackLogPage = 0; //メッセージウィンドウを表示させる。 this.show(); this.subWindows().forEach(function (subWindow) { subWindow.show(); }); oBackLog._nBackLogPage = 0; return false; }//if (this.isTriggered()) return true; }//oBackLog._BackLogBusy //メッセージのクリックを待たない場合の処理 if (!this.pause) { //右クリック隠す機能使わない時の特殊な処理。常に表示する。 //メッセージウィンドウがなんらかの原因で隠れていても表示する。 if (!bPoniBKlog_RClickHideON && !oBackLog._BackLogBusy) { this.show(); } //メニュー表示中はここを使っているので表示させるべき。 if ($gameMessage._choices.length > 0) { this.show(); this.subWindows().forEach(function (subWindow) { subWindow.show(); }); } }// if (!this.pause ) // if (this.pause) { //右クリックを押した時に通常のメッセージウィンドウを消去する。 if (TouchInput.isCancelled() && oBackLog.IsSmahoRClick() && bPoniBKlog_RClickHideON) { if (oBackLog._BackLogBusy && oBackLog.ButtonPressUpDownRect('Upkey')) return true; if (oBackLog._BackLogBusy && oBackLog.ButtonPressUpDownRect('Downkey')) return true; // TouchInput.clear () ; // Input.clear () ; Input.update(); /* //multipleWindowsystemの機能オンオフによる設定 if( typeof oBackLog._BackLogBusy=="undefined" ){ this.hide(); this.subWindows().forEach( function(subWindow) { subWindow.hide(); } ); this.nameboxHideBackLogScript(); return true; } console.log("oBackLog._BackLogBusy "+oBackLog._BackLogBusy); */ if (this.visible) { this.hide(); this.subWindows().forEach(function (subWindow) { subWindow.hide(); }); this.nameboxHideBackLogScript(); $gameSwitches.setValue(bHideMessageCall_In_SwitchNum, true);//ver1.05 bHideMessageNow = 1; //this._nameWindow.close(); } else { this.show(); this.subWindows().forEach(function (subWindow) { subWindow.show(); }); this.nameboxShowBackLogScript(); if (bHideMessageNow == 1) $gameSwitches.setValue(bHideMessageCall_Out_SwitchNum, true), bHideMessageNow = 0;//ver1.05 } return true; }//if (TouchInput.isCancelled()&& oBackLog.IsSmahoRClick() && bPoniBKlog_RClickHideON) //backlog-call if (Input.isTriggered('pageup') && !oBackLog._BackLogBusy || TouchInput._wheelY < 0 && !oBackLog._BackLogBusy) { Input.update(); oBackLog._nBackLogPage++; oBackLog.BackLog_Call(); return true; }// Input if (this.isTriggered() && oBackLog._BackLogBusy) { if (oBackLog._BackLogBusy && oBackLog.ButtonPressUpDownRect('Upkey')) return true; if (oBackLog._BackLogBusy && oBackLog.ButtonPressUpDownRect('Downkey')) return true; TouchInput.clear(); Input.clear(); //メッセージウィンドウを表示させる。 this.show(); this.subWindows().forEach(function (subWindow) { subWindow.show(); }); if (bHideMessageNow == 1) $gameSwitches.setValue(bHideMessageCall_Out_SwitchNum, true), bHideMessageNow = 0;//ver1.05 return true; }// Input //通常のメッセージ処理 if (this.isTriggered() || TouchInput.isLongPressed() || TouchInput._wheelY > 0 || Input.isPressed('ok')) {//ver1.01 fix this.show(); this.subWindows().forEach(function (subWindow) { subWindow.show(); }); Input.update(); this.pause = false; if (!this._textState) { this.terminateMessage(); } }//if (this.isTriggered()) return true; }//if (this.pause) if (this.isAnySubWindowActive()) { // this.HideMultiChoiceListBackLogScript(); return true; }//選択を切り替えした場合の処置。ないと選択選べない。 return false; }; //================▲クリックの監視項目ここまで================================ //-------------- //■■■■■■■■■■■■■■■■■■■■■■■■■■■■ //-------------------------------------------------- //==============Window_NameBox // 名前欄が空欄の時にも表示されるのを防ぐ為の処置 //========= /* //YEPメッセージコアはこのプラグインにほぼ必須だが他のウィンドウメッセージを追加するプラグインを導入すると //ウィンドウを新規追加した際にメッセージコアのネームボックスも新規で作られる。 //その為本来は表示されない空のネームボックスが画面上に出現してしまうようだ。 //SceneManager._scene. のchildrenにaddするのでそこで作られたウィンドウを処理しなければならない。 //複数のウィンドウを追加するプラグインではその数分増加する。 // */ if (Imported.YEP_MessageCore) { var _Window_NameBox_prototype_update = Window_NameBox.prototype.update; Window_NameBox.prototype.update = function () { _Window_NameBox_prototype_update.call(this); /* if(this._lastNameText==null ||this._lastNameText==""){ var nBoxlength= parseInt(SceneManager._scene.children.length); for(var i=1;i<=nBoxlength;i++){ var sNameBox=SceneManager._scene.children[i-1]._lastNameText; if(sNameBox!="" || sNameBox==null )this._lastNameText=sNameBox if(sNameBox==null){this._lastNameText="";} }//for }// */ /* if(this._lastNameText==null ||this._lastNameText==""){this.opacity = 0;} else{ this.backOpacity = 200;} */ if (this._parentWindow.isOpening()) { //console.log("OPENgNow"); var nBoxlength = parseInt(SceneManager._scene.children.length); for (var i = 1; i <= nBoxlength; i++) { var sNameBox = SceneManager._scene.children[i - 1]._lastNameText; if (SceneManager._scene.children[i - 1]._lastNameText = "") SceneManager._scene.children[i - 1].active = false; }//for /* this.opacity = 200; this.backOpacity = 200; if(this.x==0 && this.y==0)this.opacity = 0; */ } if (this._parentWindow.isClosing()) { //console.log("ClosingNow"); var nBoxlength = parseInt(SceneManager._scene.children.length); for (var i = 1; i <= nBoxlength; i++) { SceneManager._scene.children[i - 1]._lastNameText = ""; SceneManager._scene.children[i - 1]._text = ""; SceneManager._scene.children[i - 1].active = false; //this.opacity = 0; }//for // this._lastNameText="";this.opacity = 0; } this.opacity = 200; this.backOpacity = 200; if (this.x == 0 && this.y == 0) this.opacity = 0; if (this._parentWindow.visible == false) { this.visible = false; } else { this.visible = true; } }; }//if (Imported.YEP_MessageCore) { //--------------------- // //右クリック時のYEPネームボックス処理 //multipleWindowプラグイン等でウィンドウが増えてしまった場合 //ページアップ等と違ってそのままでは名前欄が隠れないようだ。 //(メッセージウィンドウの書き換え処理の後waitが入ってないので親ウィンドウの状態を取れてないらしい) //YEPネームボックスが追加された特徴がある配列にアクセスして //親ウィンドウが存在するならばネームボックスの座標を画面外に飛ばす。 //visibleをfalseにする処理はMultipleWindowプラグインでは元々上に重ねてるらしく意味がなくなってるらしい。 Window_Message.prototype.nameboxHideBackLogScript = function () { if (!Imported.YEP_MessageCore) return; var nBoxlength = parseInt(SceneManager._scene.children.length); for (var i = 1; i <= nBoxlength; i++) { if (this._nameWindow.parent.children[i - 1] != null) {//fix ver1.03a [i]になってたので[i-1]へ。右クリックでネームボックスが残るバグはこれ if (SceneManager._scene.children[i - 1]._parentWindow) { this._nameWindow.parent.children[i - 1].y = -720; } }//!null }//for //this._nameWindow.y=-300; }; Window_Message.prototype.nameboxShowBackLogScript = function () { if (!Imported.YEP_MessageCore) return; var nBoxlength = parseInt(SceneManager._scene.children.length); for (var i = 1; i <= nBoxlength; i++) { if (this._nameWindow.parent.children[i] != null) { if (SceneManager._scene.children[i - 1]._parentWindow) { if (this._nameWindow.parent.children[i - 1]._text != "") { this._nameWindow.parent.children[i - 1].y = 468; } } } }//for }; //■■■■■■■■■■■■■■■■■■■■■■■■■■■■ // Game_Message.prototype.actorName //■■■■■■■■■ //直接$gameActorsをreturnしたら駄目っぽかったので //トリアコンタン氏のスクリプトを参考にした。 Game_Message.prototype.actorName = function (n) { var actor = n >= 1 ? $gameActors.actor(n) : null; return actor ? actor.name() : ''; }; Game_Message.prototype.partyMemberName = function (n) { var actor = n >= 1 ? $gameParty.members()[n - 1] : null; return actor ? actor.name() : ''; }; //=================== /* //■■■■■■■■■■■■■■■■■■■■■■■■■■ Window_Message.prototype.update = function() { this.checkToNotClose(); Window_Base.prototype.update.call(this); while (!this.isOpening() && !this.isClosing()) { //console.log(this.subWindows()); if (this.updateWait()) { return; } else if (this.updateLoading()) { return; } else if (this.updateInput()) {//メッセージを進める処理が終わりにある。 return; } else if (this.updateMessage()) { return; } else if (this.canStart()) { this.startMessage(); } else { this.startInput(); return; } } }; //メッセージウィンドウ場所 Window_Message.prototype.updatePlacement = function() { this._positionType = $gameMessage.positionType(); this.y = this._positionType * (Graphics.boxHeight - this.height) / 2; this._goldWindow.y = this.y > 0 ? 0 : Graphics.boxHeight - this._goldWindow.height; // if(this._positionType === 2) this.y -= 150; //console.log("Graphics.boxHeight=" + Graphics.boxHeight)x }; */ //■■■■■■■■■■■■■■■■■■■■■■■■■■■■ //■■■■■■■■■■■■■■■■■■■■■■■■■■■■ //クリック判定 //■■■■■■■■■■■■■■■■■■■■■■■■■■■■ //タッチパネルのスマホの場合は長押しで右クリック動作になるので //画面下部では右クリックでもウィンドウをスキップさせるようにする。 BackLog.prototype.IsSmahoRClick = function () { var ua = window.navigator.userAgent.toLowerCase(); var sTablet = "false"; if (ua.indexOf('windows') > 0) sTablet = "[PC]"; if (ua.indexOf('iPhone') > 0 || ua.indexOf('iPod') > 0 || ua.indexOf('Android') > 0 && ua.indexOf('Mobile') > 0) { sTablet = "[SmaFo]"; } else if (ua.indexOf('iPad') > 0 || ua.indexOf('Android') > 0) { sTablet = "[Pad]"; } //スマホだった場合の処理。画面の3/5より下でクリックされているかどうかを確認する。 //下なら右クリック処理を無効にする。 if (sTablet != "[PC]") { var ty = TouchInput.y; if (3 * Graphics.height / 5 <= ty) { return false; } }// return true; }// //■■■■■■■■■■■■■■■■■■■■■■■■■■■■ //ボタン押したかどうか。 //マウスカーソルの位置がピクチャの範囲内にあるか調べる。 //メッセージ表示中でも判定が行えるようにしている。 BackLog.prototype.ButtonPress = function (picID) { if ($gameScreen.picture(picID) == null) return 0; if ($gameScreen.picture(picID)._visible == false) return 0; var tx = TouchInput.x; var ty = TouchInput.y; var nPictureId = picID - 1; //配列の[0]に1番を入れて順に格納してるのでアクセスする際にずれを訂正しておく。 //ver0.93 fix 配列がマイナスになるとエラーになるので戻す。 if (picID <= 0) return; // var nButtonW, nButtonH; var w = parseInt(SceneManager._scene._spriteset._pictureContainer.children[nPictureId].width);// var h = parseInt(SceneManager._scene._spriteset._pictureContainer.children[nPictureId].height);// nButtonW = w; nButtonH = h; var nButton_X = parseInt($gameScreen.picture(picID)._x); var nButton_Y = parseInt($gameScreen.picture(picID)._y); var nButton_w = parseInt(nButtonW * $gameScreen.picture(picID)._scaleX / 100); var nButton_h = parseInt(nButtonH * $gameScreen.picture(picID)._scaleY / 100); //中心座標ならずれる if ($gameScreen.picture(picID)._origin == 1) { nButton_X = nButton_X - w / 2; nButton_Y = nButton_Y - h / 2; }// //if((tx >= nButton_X) && (tx <= nButton_X+nButton_w) && (ty >= nButton_Y) && (ty <= nButton_Y+nButton_h)){ TouchInput.clear () ;Input.clear () ; } return (tx >= nButton_X) && (tx <= nButton_X + nButton_w) && (ty >= nButton_Y) && (ty <= nButton_Y + nButton_h); }; //------------- //バックログアクティブ中にアップダウンの範囲を押したかどうか。 BackLog.prototype.ButtonPressUpDownRect = function (BitmapRext) { // if(!oBackLog._BackLogBusy) return 0; // if(!TouchInput.isTriggered() )return 0; var tx = TouchInput.x; var ty = TouchInput.y; var nButton_X = SceneManager._screenWidth - 120; var nButton_Y = SceneManager._screenHeight - 180; if (tx <= nButton_X) return 0; if (ty <= nButton_Y) return 0; var nButton_w = 70; var nButton_h = 70; //エリア内にあるかどうか判定 if (BitmapRext == "Downkey") { nButton_X = SceneManager._screenWidth - 115; nButton_Y = SceneManager._screenHeight - 100; } var bResult = (tx >= nButton_X) && (tx <= nButton_X + nButton_w) && (ty >= nButton_Y) && (ty <= nButton_Y + nButton_h); // console.log(BitmapRext+"="+bResult+" tx"+tx+",ty"+ty+"\n"); return (tx >= nButton_X) && (tx <= nButton_X + nButton_w) && (ty >= nButton_Y) && (ty <= nButton_Y + nButton_h); } /* var bChoiceOnMultipleWindow=false; //選択肢 Window_Message.prototype.HideMultiChoiceListBackLogScript = function() { if (!Imported.MultipleWindowSkinSystem)return; // SceneManager._scene._multipleMessageWindow.get('test-2').close(); //if(bChoiceOnMultipleWindow)this._choiceWindow.close(); //選択肢を閉じる // console.log(this); // console.log(this._choiceWindow); //debugger; //this._choiceWindow; // this._choiceWindow.parent.children.MultipleWindow_ChoiceList.SETTINGS._opacity=0; // this._choiceWindow.parent.children[14]._opacity=0; //console.log(SceneManager._scene._multipleMessageWindow.get('test-2')); // debugger; }; */ })();
dazed/translations
www/js/plugins/ponidog_BackLog_utf8.js
JavaScript
unknown
84,077
//============================================================================= // アイテム最大所持個数指定プラグイン // setItemMax.js // Copyright (c) 2018 村人A //============================================================================= /*:ja * @plugindesc アイテムの最大所持個数をアイテムIdごとに指定できます。 * @author 村人A * * @help * * アイテムのメモ欄に「itemMaxNum:個数」と入力することによりそのアイテムのデフォルトの最大所持数を設定することが出来ます。 * コマンド例 * itemMaxNum:1010 #入力したアイテムの最大所持数を1010個に設定 * * アイテムの所持上限数をゲーム中に変更したい場合は「アイテム上限設定変更」とプラグインコマンドを入力後、指定したいアイテムidと最大所持数を入力 * 別のアイテムも変更したい場合続けて入力してください * デフォルトの最大所持数(99個)を変更したい場合はidを0と入力し、その後に個数を指定してください。 * * プラグインコマンド例: * アイテム上限設定変更 3 35 * #アイテムidが3のアイテムの最大所持数を35個に設定 * アイテム上限設定変更 1 20 4 8 7 15 9 100 0 200 * #idが1のアイテムの最大個数を20個に、idが4のアイテムの最大個数を8個に以下、7を15、9を100、デフォルトの最大個数を200個に変更 * * 変更したときにアイテムの所持数が指定した最大所持数より多かった場合、自動的に最大所数に直されます。 * * 値の優先度としては * プラグインコマンドによる変更 > データベースでの指定 > 変更したデフォルトの最大個数 > デフォルトの最大個数(99個) * となります。 */ (function () { villaA_itemIdMaxArray = []; villaA_itemSeachNum = 1; villaA_itemMaxNum = 2; var _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand; Game_Interpreter.prototype.pluginCommand = function (command, args) { _Game_Interpreter_pluginCommand.call(this, command, args); if (command === 'アイテム上限設定変更') { for (var i = 0; i < args.length; i += 2) { villaA_itemIdMaxArray.push([args[i], args[i + 1]]); if (String(args[i + 1]).length > villaA_itemMaxNum) { villaA_itemMaxNum = String(args[i + 1]).length; } } for (var i = 1; i < $dataItems.length; i++) { if (villaA_itemSeachNum < String($gameParty.maxItems($dataItems[i])).length) { villaA_itemSeachNum = String($gameParty.maxItems($dataItems[i])).length; } } villaA_itemMaxNum = villaA_itemSeachNum; villaA_itemSeachNum = 1; for (var i = 1; i < $dataItems.length; i++) { if ($gameParty.numItems($dataItems[i]) > $gameParty.maxItems($dataItems[i])) { $gameParty.loseItem($dataItems[i], $gameParty.numItems($dataItems[i])) $gameParty.gainItem($dataItems[i], parseInt($gameParty.maxItems($dataItems[i]))) } if (villaA_itemIdMaxArray[villaA_itemIdMaxArray.length - 1][0] == 0) { if ($gameParty.numItems($dataItems[i]) > villaA_itemIdMaxArray[villaA_itemIdMaxArray.length - 1][1]) { $gameParty.loseItem($dataItems[i], $gameParty.numItems($dataItems[i])) $gameParty.gainItem($dataItems[i], parseInt($gameParty.maxItems($dataItems[i]))) } } } } } var _Game_Party_gainItem = Game_Party.prototype.gainItem; Game_Party.prototype.gainItem = function (item, amount, includeEquip) { _Game_Party_gainItem.call(this, item, amount, includeEquip); for (var i = 1; i < $dataItems.length; i++) { if (villaA_itemSeachNum < String(this.maxItems($dataItems[i])).length) { villaA_itemSeachNum = String(this.maxItems($dataItems[i])).length; } } villaA_itemMaxNum = villaA_itemSeachNum; villaA_itemSeachNum = 1; }; Game_Party.prototype.maxItems = function (item) { for (var i = 0; i < villaA_itemIdMaxArray.length; i++) { if (villaA_itemIdMaxArray[i][0] == item.id) { return villaA_itemIdMaxArray[i][1] } } if (item.note != "") { var itemNoteArray = [] itemNoteArray = item.note.split(/\r\n|\r|\n/); for (var i = 0; i < itemNoteArray.length; i++) { if (itemNoteArray[i].indexOf('itemMaxNum') != -1) { var MaxNum = itemNoteArray[i].split(":"); return parseInt(MaxNum[1]); } } } for (var i = 0; i < villaA_itemIdMaxArray.length; i++) { if (villaA_itemIdMaxArray[i][0] == 0) { return villaA_itemIdMaxArray[i][1] } } return 99; }; Window_ItemList.prototype.drawItem = function (index) { var item = this._data[index]; if (item) { var textWid1 = "0"; var textWid2 = ""; for (var i = 1; i <= villaA_itemMaxNum; i++) { textWid1 += 0; textWid2 += 0; } var numberWidth = this.numberWidth(textWid1); var rect = this.itemRect(index); rect.width -= this.textPadding(); this.changePaintOpacity(this.isEnabled(item)); this.drawItemName(item, rect.x, rect.y, rect.width - numberWidth); this.drawItemNumber(item, rect.x, rect.y, rect.width, textWid2); this.changePaintOpacity(1); } }; Window_ItemList.prototype.numberWidth = function (textWid) { return this.textWidth(textWid); }; Window_ItemList.prototype.drawItemNumber = function (item, x, y, width, textWid) { if (this.needsNumber()) { this.drawText(':', x, y, width - this.textWidth(textWid), 'right'); this.drawText($gameParty.numItems(item), x, y, width, 'right'); } }; })();
dazed/translations
www/js/plugins/setItemMax.js
JavaScript
unknown
5,605
--------------------------------------------------------
dazed/translations
www/js/plugins/アクションRPG関連.js
JavaScript
unknown
56
--------------------------------------------------------
dazed/translations
www/js/plugins/システム関連.js
JavaScript
unknown
56
--------------------------------------------------------
dazed/translations
www/js/plugins/セーブ関連.js
JavaScript
unknown
56
--------------------------------------------------------
dazed/translations
www/js/plugins/メッセージ関連.js
JavaScript
unknown
56
--------------------------------------------------------
dazed/translations
www/js/plugins/便利機能.js
JavaScript
unknown
56
--------------------------------------------------------
dazed/translations
www/js/plugins/動作改善.js
JavaScript
unknown
56
//============================================================================= // rpg_core.js v1.6.2 //============================================================================= //----------------------------------------------------------------------------- /** * This is not a class, but contains some methods that will be added to the * standard Javascript objects. * * @class JsExtensions */ function JsExtensions() { throw new Error('This is not a class'); } /** * Returns a number whose value is limited to the given range. * * @method Number.prototype.clamp * @param {Number} min The lower boundary * @param {Number} max The upper boundary * @return {Number} A number in the range (min, max) */ Number.prototype.clamp = function (min, max) { return Math.min(Math.max(this, min), max); }; /** * Returns a modulo value which is always positive. * * @method Number.prototype.mod * @param {Number} n The divisor * @return {Number} A modulo value */ Number.prototype.mod = function (n) { return ((this % n) + n) % n; }; /** * Replaces %1, %2 and so on in the string to the arguments. * * @method String.prototype.format * @param {Any} ...args The objects to format * @return {String} A formatted string */ String.prototype.format = function () { var args = arguments; return this.replace(/%([0-9]+)/g, function (s, n) { return args[Number(n) - 1]; }); }; /** * Makes a number string with leading zeros. * * @method String.prototype.padZero * @param {Number} length The length of the output string * @return {String} A string with leading zeros */ String.prototype.padZero = function (length) { var s = this; while (s.length < length) { s = '0' + s; } return s; }; /** * Makes a number string with leading zeros. * * @method Number.prototype.padZero * @param {Number} length The length of the output string * @return {String} A string with leading zeros */ Number.prototype.padZero = function (length) { return String(this).padZero(length); }; Object.defineProperties(Array.prototype, { /** * Checks whether the two arrays are same. * * @method Array.prototype.equals * @param {Array} array The array to compare to * @return {Boolean} True if the two arrays are same */ equals: { enumerable: false, value: function (array) { if (!array || this.length !== array.length) { return false; } for (var i = 0; i < this.length; i++) { if (this[i] instanceof Array && array[i] instanceof Array) { if (!this[i].equals(array[i])) { return false; } } else if (this[i] !== array[i]) { return false; } } return true; } }, /** * Makes a shallow copy of the array. * * @method Array.prototype.clone * @return {Array} A shallow copy of the array */ clone: { enumerable: false, value: function () { return this.slice(0); } }, /** * Checks whether the array contains a given element. * * @method Array.prototype.contains * @param {Any} element The element to search for * @return {Boolean} True if the array contains a given element */ contains: { enumerable: false, value: function (element) { return this.indexOf(element) >= 0; } } }); /** * Checks whether the string contains a given string. * * @method String.prototype.contains * @param {String} string The string to search for * @return {Boolean} True if the string contains a given string */ String.prototype.contains = function (string) { return this.indexOf(string) >= 0; }; /** * Generates a random integer in the range (0, max-1). * * @static * @method Math.randomInt * @param {Number} max The upper boundary (excluded) * @return {Number} A random integer */ Math.randomInt = function (max) { return Math.floor(max * Math.random()); }; //----------------------------------------------------------------------------- /** * The static class that defines utility methods. * * @class Utils */ function Utils() { throw new Error('This is a static class'); } /** * The name of the RPG Maker. 'MV' in the current version. * * @static * @property RPGMAKER_NAME * @type String * @final */ Utils.RPGMAKER_NAME = 'MV'; /** * The version of the RPG Maker. * * @static * @property RPGMAKER_VERSION * @type String * @final */ Utils.RPGMAKER_VERSION = "1.6.1"; /** * Checks whether the option is in the query string. * * @static * @method isOptionValid * @param {String} name The option name * @return {Boolean} True if the option is in the query string */ Utils.isOptionValid = function (name) { if (location.search.slice(1).split('&').contains(name)) { return 1; }; if (typeof nw !== "undefined" && nw.App.argv.length > 0 && nw.App.argv[0].split('&').contains(name)) { return 1; }; return 0; }; /** * Checks whether the platform is NW.js. * * @static * @method isNwjs * @return {Boolean} True if the platform is NW.js */ Utils.isNwjs = function () { return typeof require === 'function' && typeof process === 'object'; }; /** * Checks whether the platform is a mobile device. * * @static * @method isMobileDevice * @return {Boolean} True if the platform is a mobile device */ Utils.isMobileDevice = function () { var r = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i; return !!navigator.userAgent.match(r); }; /** * Checks whether the browser is Mobile Safari. * * @static * @method isMobileSafari * @return {Boolean} True if the browser is Mobile Safari */ Utils.isMobileSafari = function () { var agent = navigator.userAgent; return !!(agent.match(/iPhone|iPad|iPod/) && agent.match(/AppleWebKit/) && !agent.match('CriOS')); }; /** * Checks whether the browser is Android Chrome. * * @static * @method isAndroidChrome * @return {Boolean} True if the browser is Android Chrome */ Utils.isAndroidChrome = function () { var agent = navigator.userAgent; return !!(agent.match(/Android/) && agent.match(/Chrome/)); }; /** * Checks whether the browser can read files in the game folder. * * @static * @method canReadGameFiles * @return {Boolean} True if the browser can read files in the game folder */ Utils.canReadGameFiles = function () { var scripts = document.getElementsByTagName('script'); var lastScript = scripts[scripts.length - 1]; var xhr = new XMLHttpRequest(); try { xhr.open('GET', lastScript.src); xhr.overrideMimeType('text/javascript'); xhr.send(); return true; } catch (e) { return false; } }; /** * Makes a CSS color string from RGB values. * * @static * @method rgbToCssColor * @param {Number} r The red value in the range (0, 255) * @param {Number} g The green value in the range (0, 255) * @param {Number} b The blue value in the range (0, 255) * @return {String} CSS color string */ Utils.rgbToCssColor = function (r, g, b) { r = Math.round(r); g = Math.round(g); b = Math.round(b); return 'rgb(' + r + ',' + g + ',' + b + ')'; }; Utils._id = 1; Utils.generateRuntimeId = function () { return Utils._id++; }; Utils._supportPassiveEvent = null; /** * Test this browser support passive event feature * * @static * @method isSupportPassiveEvent * @return {Boolean} this browser support passive event or not */ Utils.isSupportPassiveEvent = function () { if (typeof Utils._supportPassiveEvent === "boolean") { return Utils._supportPassiveEvent; } // test support passive event // https://github.com/WICG/EventListenerOptions/blob/gh-pages/explainer.md#feature-detection var passive = false; var options = Object.defineProperty({}, "passive", { get: function () { passive = true; } }); window.addEventListener("test", null, options); Utils._supportPassiveEvent = passive; return passive; } //----------------------------------------------------------------------------- /** * The resource class. Allows to be collected as a garbage if not use for some time or ticks * * @class CacheEntry * @constructor * @param {ResourceManager} resource manager * @param {string} key, url of the resource * @param {string} item - Bitmap, HTML5Audio, WebAudio - whatever you want to store in the cache */ function CacheEntry(cache, key, item) { this.cache = cache; this.key = key; this.item = item; this.cached = false; this.touchTicks = 0; this.touchSeconds = 0; this.ttlTicks = 0; this.ttlSeconds = 0; this.freedByTTL = false; } /** * frees the resource */ CacheEntry.prototype.free = function (byTTL) { this.freedByTTL = byTTL || false; if (this.cached) { this.cached = false; delete this.cache._inner[this.key]; } }; /** * Allocates the resource * @returns {CacheEntry} */ CacheEntry.prototype.allocate = function () { if (!this.cached) { this.cache._inner[this.key] = this; this.cached = true; } this.touch(); return this; }; /** * Sets the time to live * @param {number} ticks TTL in ticks, 0 if not set * @param {number} time TTL in seconds, 0 if not set * @returns {CacheEntry} */ CacheEntry.prototype.setTimeToLive = function (ticks, seconds) { this.ttlTicks = ticks || 0; this.ttlSeconds = seconds || 0; return this; }; CacheEntry.prototype.isStillAlive = function () { var cache = this.cache; return ((this.ttlTicks == 0) || (this.touchTicks + this.ttlTicks < cache.updateTicks)) && ((this.ttlSeconds == 0) || (this.touchSeconds + this.ttlSeconds < cache.updateSeconds)); }; /** * makes sure that resource wont freed by Time To Live * if resource was already freed by TTL, put it in cache again */ CacheEntry.prototype.touch = function () { var cache = this.cache; if (this.cached) { this.touchTicks = cache.updateTicks; this.touchSeconds = cache.updateSeconds; } else if (this.freedByTTL) { this.freedByTTL = false; if (!cache._inner[this.key]) { cache._inner[this.key] = this; } } }; /** * Cache for images, audio, or any other kind of resource * @param manager * @constructor */ function CacheMap(manager) { this.manager = manager; this._inner = {}; this._lastRemovedEntries = {}; this.updateTicks = 0; this.lastCheckTTL = 0; this.delayCheckTTL = 100.0; this.updateSeconds = Date.now(); } /** * checks ttl of all elements and removes dead ones */ CacheMap.prototype.checkTTL = function () { var cache = this._inner; var temp = this._lastRemovedEntries; if (!temp) { temp = []; this._lastRemovedEntries = temp; } for (var key in cache) { var entry = cache[key]; if (!entry.isStillAlive()) { temp.push(entry); } } for (var i = 0; i < temp.length; i++) { temp[i].free(true); } temp.length = 0; }; /** * cache item * @param key url of cache element * @returns {*|null} */ CacheMap.prototype.getItem = function (key) { var entry = this._inner[key]; if (entry) { return entry.item; } return null; }; CacheMap.prototype.clear = function () { var keys = Object.keys(this._inner); for (var i = 0; i < keys.length; i++) { this._inner[keys[i]].free(); } }; CacheMap.prototype.setItem = function (key, item) { return new CacheEntry(this, key, item).allocate(); }; CacheMap.prototype.update = function (ticks, delta) { this.updateTicks += ticks; this.updateSeconds += delta; if (this.updateSeconds >= this.delayCheckTTL + this.lastCheckTTL) { this.lastCheckTTL = this.updateSeconds; this.checkTTL(); } }; function ImageCache() { this.initialize.apply(this, arguments); } ImageCache.limit = 10 * 1000 * 1000; ImageCache.prototype.initialize = function () { this._items = {}; }; ImageCache.prototype.add = function (key, value) { this._items[key] = { bitmap: value, touch: Date.now(), key: key }; this._truncateCache(); }; ImageCache.prototype.get = function (key) { if (this._items[key]) { var item = this._items[key]; item.touch = Date.now(); return item.bitmap; } return null; }; ImageCache.prototype.reserve = function (key, value, reservationId) { if (!this._items[key]) { this._items[key] = { bitmap: value, touch: Date.now(), key: key }; } this._items[key].reservationId = reservationId; }; ImageCache.prototype.releaseReservation = function (reservationId) { var items = this._items; Object.keys(items) .map(function (key) { return items[key]; }) .forEach(function (item) { if (item.reservationId === reservationId) { delete item.reservationId; } }); }; ImageCache.prototype._truncateCache = function () { var items = this._items; var sizeLeft = ImageCache.limit; Object.keys(items).map(function (key) { return items[key]; }).sort(function (a, b) { return b.touch - a.touch; }).forEach(function (item) { if (sizeLeft > 0 || this._mustBeHeld(item)) { var bitmap = item.bitmap; sizeLeft -= bitmap.width * bitmap.height; } else { delete items[item.key]; } }.bind(this)); }; ImageCache.prototype._mustBeHeld = function (item) { // request only is weak so It's purgeable if (item.bitmap.isRequestOnly()) return false; // reserved item must be held if (item.reservationId) return true; // not ready bitmap must be held (because of checking isReady()) if (!item.bitmap.isReady()) return true; // then the item may purgeable return false; }; ImageCache.prototype.isReady = function () { var items = this._items; return !Object.keys(items).some(function (key) { return !items[key].bitmap.isRequestOnly() && !items[key].bitmap.isReady(); }); }; ImageCache.prototype.getErrorBitmap = function () { var items = this._items; var bitmap = null; if (Object.keys(items).some(function (key) { if (items[key].bitmap.isError()) { bitmap = items[key].bitmap; return true; } return false; })) { return bitmap; } return null; }; function RequestQueue() { this.initialize.apply(this, arguments); } RequestQueue.prototype.initialize = function () { this._queue = []; }; RequestQueue.prototype.enqueue = function (key, value) { this._queue.push({ key: key, value: value, }); }; RequestQueue.prototype.update = function () { if (this._queue.length === 0) return; var top = this._queue[0]; if (top.value.isRequestReady()) { this._queue.shift(); if (this._queue.length !== 0) { this._queue[0].value.startRequest(); } } else { top.value.startRequest(); } }; RequestQueue.prototype.raisePriority = function (key) { for (var n = 0; n < this._queue.length; n++) { var item = this._queue[n]; if (item.key === key) { this._queue.splice(n, 1); this._queue.unshift(item); break; } } }; RequestQueue.prototype.clear = function () { this._queue.splice(0); }; //----------------------------------------------------------------------------- /** * The point class. * * @class Point * @constructor * @param {Number} x The x coordinate * @param {Number} y The y coordinate */ function Point() { this.initialize.apply(this, arguments); } Point.prototype = Object.create(PIXI.Point.prototype); Point.prototype.constructor = Point; Point.prototype.initialize = function (x, y) { PIXI.Point.call(this, x, y); }; /** * The x coordinate. * * @property x * @type Number */ /** * The y coordinate. * * @property y * @type Number */ //----------------------------------------------------------------------------- /** * The rectangle class. * * @class Rectangle * @constructor * @param {Number} x The x coordinate for the upper-left corner * @param {Number} y The y coordinate for the upper-left corner * @param {Number} width The width of the rectangle * @param {Number} height The height of the rectangle */ function Rectangle() { this.initialize.apply(this, arguments); } Rectangle.prototype = Object.create(PIXI.Rectangle.prototype); Rectangle.prototype.constructor = Rectangle; Rectangle.prototype.initialize = function (x, y, width, height) { PIXI.Rectangle.call(this, x, y, width, height); }; /** * @static * @property emptyRectangle * @type Rectangle * @private */ Rectangle.emptyRectangle = new Rectangle(0, 0, 0, 0); /** * The x coordinate for the upper-left corner. * * @property x * @type Number */ /** * The y coordinate for the upper-left corner. * * @property y * @type Number */ /** * The width of the rectangle. * * @property width * @type Number */ /** * The height of the rectangle. * * @property height * @type Number */ //----------------------------------------------------------------------------- /** * The basic object that represents an image. * * @class Bitmap * @constructor * @param {Number} width The width of the bitmap * @param {Number} height The height of the bitmap */ function Bitmap() { this.initialize.apply(this, arguments); } //for iOS. img consumes memory. so reuse it. Bitmap._reuseImages = []; /** * Bitmap states(Bitmap._loadingState): * * none: * Empty Bitmap * * pending: * Url requested, but pending to load until startRequest called * * purged: * Url request completed and purged. * * requesting: * Requesting supplied URI now. * * requestCompleted: * Request completed * * decrypting: * requesting encrypted data from supplied URI or decrypting it. * * decryptCompleted: * Decrypt completed * * loaded: * loaded. isReady() === true, so It's usable. * * error: * error occurred * */ Bitmap.prototype._createCanvas = function (width, height) { this.__canvas = this.__canvas || document.createElement('canvas'); this.__context = this.__canvas.getContext('2d'); this.__canvas.width = Math.max(width || 0, 1); this.__canvas.height = Math.max(height || 0, 1); if (this._image) { var w = Math.max(this._image.width || 0, 1); var h = Math.max(this._image.height || 0, 1); this.__canvas.width = w; this.__canvas.height = h; this._createBaseTexture(this._canvas); this.__context.drawImage(this._image, 0, 0); } this._setDirty(); }; Bitmap.prototype._createBaseTexture = function (source) { this.__baseTexture = new PIXI.BaseTexture(source); this.__baseTexture.mipmap = false; this.__baseTexture.width = source.width; this.__baseTexture.height = source.height; if (this._smooth) { this._baseTexture.scaleMode = PIXI.SCALE_MODES.LINEAR; } else { this._baseTexture.scaleMode = PIXI.SCALE_MODES.NEAREST; } }; Bitmap.prototype._clearImgInstance = function () { this._image.src = ""; this._image.onload = null; this._image.onerror = null; this._errorListener = null; this._loadListener = null; Bitmap._reuseImages.push(this._image); this._image = null; }; // //We don't want to waste memory, so creating canvas is deferred. // Object.defineProperties(Bitmap.prototype, { _canvas: { get: function () { if (!this.__canvas) this._createCanvas(); return this.__canvas; } }, _context: { get: function () { if (!this.__context) this._createCanvas(); return this.__context; } }, _baseTexture: { get: function () { if (!this.__baseTexture) this._createBaseTexture(this._image || this.__canvas); return this.__baseTexture; } } }); Bitmap.prototype._renewCanvas = function () { var newImage = this._image; if (newImage && this.__canvas && (this.__canvas.width < newImage.width || this.__canvas.height < newImage.height)) { this._createCanvas(); } }; Bitmap.prototype.initialize = function (width, height) { if (!this._defer) { this._createCanvas(width, height); } this._image = null; this._url = ''; this._paintOpacity = 255; this._smooth = false; this._loadListeners = []; this._loadingState = 'none'; this._decodeAfterRequest = false; /** * Cache entry, for images. In all cases _url is the same as cacheEntry.key * @type CacheEntry */ this.cacheEntry = null; /** * The face name of the font. * * @property fontFace * @type String */ this.fontFace = 'GameFont'; /** * The size of the font in pixels. * * @property fontSize * @type Number */ this.fontSize = 28; /** * Whether the font is italic. * * @property fontItalic * @type Boolean */ this.fontItalic = false; /** * The color of the text in CSS format. * * @property textColor * @type String */ this.textColor = '#ffffff'; /** * The color of the outline of the text in CSS format. * * @property outlineColor * @type String */ this.outlineColor = 'rgba(0, 0, 0, 0.5)'; /** * The width of the outline of the text. * * @property outlineWidth * @type Number */ this.outlineWidth = 4; }; /** * Loads a image file and returns a new bitmap object. * * @static * @method load * @param {String} url The image url of the texture * @return Bitmap */ Bitmap.load = function (url) { var bitmap = Object.create(Bitmap.prototype); bitmap._defer = true; bitmap.initialize(); bitmap._decodeAfterRequest = true; bitmap._requestImage(url); return bitmap; }; /** * Takes a snapshot of the game screen and returns a new bitmap object. * * @static * @method snap * @param {Stage} stage The stage object * @return Bitmap */ Bitmap.snap = function (stage) { var width = Graphics.width; var height = Graphics.height; var bitmap = new Bitmap(width, height); var context = bitmap._context; var renderTexture = PIXI.RenderTexture.create(width, height); if (stage) { Graphics._renderer.render(stage, renderTexture); stage.worldTransform.identity(); var canvas = null; if (Graphics.isWebGL()) { canvas = Graphics._renderer.extract.canvas(renderTexture); } else { canvas = renderTexture.baseTexture._canvasRenderTarget.canvas; } context.drawImage(canvas, 0, 0); } else { } renderTexture.destroy({ destroyBase: true }); bitmap._setDirty(); return bitmap; }; /** * Checks whether the bitmap is ready to render. * * @method isReady * @return {Boolean} True if the bitmap is ready to render */ Bitmap.prototype.isReady = function () { return this._loadingState === 'loaded' || this._loadingState === 'none'; }; /** * Checks whether a loading error has occurred. * * @method isError * @return {Boolean} True if a loading error has occurred */ Bitmap.prototype.isError = function () { return this._loadingState === 'error'; }; /** * touch the resource * @method touch */ Bitmap.prototype.touch = function () { if (this.cacheEntry) { this.cacheEntry.touch(); } }; /** * [read-only] The url of the image file. * * @property url * @type String */ Object.defineProperty(Bitmap.prototype, 'url', { get: function () { return this._url; }, configurable: true }); /** * [read-only] The base texture that holds the image. * * @property baseTexture * @type PIXI.BaseTexture */ Object.defineProperty(Bitmap.prototype, 'baseTexture', { get: function () { return this._baseTexture; }, configurable: true }); /** * [read-only] The bitmap canvas. * * @property canvas * @type HTMLCanvasElement */ Object.defineProperty(Bitmap.prototype, 'canvas', { get: function () { return this._canvas; }, configurable: true }); /** * [read-only] The 2d context of the bitmap canvas. * * @property context * @type CanvasRenderingContext2D */ Object.defineProperty(Bitmap.prototype, 'context', { get: function () { return this._context; }, configurable: true }); /** * [read-only] The width of the bitmap. * * @property width * @type Number */ Object.defineProperty(Bitmap.prototype, 'width', { get: function () { if (this.isReady()) { return this._image ? this._image.width : this._canvas.width; } return 0; }, configurable: true }); /** * [read-only] The height of the bitmap. * * @property height * @type Number */ Object.defineProperty(Bitmap.prototype, 'height', { get: function () { if (this.isReady()) { return this._image ? this._image.height : this._canvas.height; } return 0; }, configurable: true }); /** * [read-only] The rectangle of the bitmap. * * @property rect * @type Rectangle */ Object.defineProperty(Bitmap.prototype, 'rect', { get: function () { return new Rectangle(0, 0, this.width, this.height); }, configurable: true }); /** * Whether the smooth scaling is applied. * * @property smooth * @type Boolean */ Object.defineProperty(Bitmap.prototype, 'smooth', { get: function () { return this._smooth; }, set: function (value) { if (this._smooth !== value) { this._smooth = value; if (this.__baseTexture) { if (this._smooth) { this._baseTexture.scaleMode = PIXI.SCALE_MODES.LINEAR; } else { this._baseTexture.scaleMode = PIXI.SCALE_MODES.NEAREST; } } } }, configurable: true }); /** * The opacity of the drawing object in the range (0, 255). * * @property paintOpacity * @type Number */ Object.defineProperty(Bitmap.prototype, 'paintOpacity', { get: function () { return this._paintOpacity; }, set: function (value) { if (this._paintOpacity !== value) { this._paintOpacity = value; this._context.globalAlpha = this._paintOpacity / 255; } }, configurable: true }); /** * Resizes the bitmap. * * @method resize * @param {Number} width The new width of the bitmap * @param {Number} height The new height of the bitmap */ Bitmap.prototype.resize = function (width, height) { width = Math.max(width || 0, 1); height = Math.max(height || 0, 1); this._canvas.width = width; this._canvas.height = height; this._baseTexture.width = width; this._baseTexture.height = height; }; /** * Performs a block transfer. * * @method blt * @param {Bitmap} source The bitmap to draw * @param {Number} sx The x coordinate in the source * @param {Number} sy The y coordinate in the source * @param {Number} sw The width of the source image * @param {Number} sh The height of the source image * @param {Number} dx The x coordinate in the destination * @param {Number} dy The y coordinate in the destination * @param {Number} [dw=sw] The width to draw the image in the destination * @param {Number} [dh=sh] The height to draw the image in the destination */ Bitmap.prototype.blt = function (source, sx, sy, sw, sh, dx, dy, dw, dh) { dw = dw || sw; dh = dh || sh; if (sx >= 0 && sy >= 0 && sw > 0 && sh > 0 && dw > 0 && dh > 0 && sx + sw <= source.width && sy + sh <= source.height) { this._context.globalCompositeOperation = 'source-over'; this._context.drawImage(source._canvas, sx, sy, sw, sh, dx, dy, dw, dh); this._setDirty(); } }; /** * Performs a block transfer, using assumption that original image was not modified (no hue) * * @method blt * @param {Bitmap} source The bitmap to draw * @param {Number} sx The x coordinate in the source * @param {Number} sy The y coordinate in the source * @param {Number} sw The width of the source image * @param {Number} sh The height of the source image * @param {Number} dx The x coordinate in the destination * @param {Number} dy The y coordinate in the destination * @param {Number} [dw=sw] The width to draw the image in the destination * @param {Number} [dh=sh] The height to draw the image in the destination */ Bitmap.prototype.bltImage = function (source, sx, sy, sw, sh, dx, dy, dw, dh) { dw = dw || sw; dh = dh || sh; if (sx >= 0 && sy >= 0 && sw > 0 && sh > 0 && dw > 0 && dh > 0 && sx + sw <= source.width && sy + sh <= source.height) { this._context.globalCompositeOperation = 'source-over'; this._context.drawImage(source._image, sx, sy, sw, sh, dx, dy, dw, dh); this._setDirty(); } }; /** * Returns pixel color at the specified point. * * @method getPixel * @param {Number} x The x coordinate of the pixel in the bitmap * @param {Number} y The y coordinate of the pixel in the bitmap * @return {String} The pixel color (hex format) */ Bitmap.prototype.getPixel = function (x, y) { var data = this._context.getImageData(x, y, 1, 1).data; var result = '#'; for (var i = 0; i < 3; i++) { result += data[i].toString(16).padZero(2); } return result; }; /** * Returns alpha pixel value at the specified point. * * @method getAlphaPixel * @param {Number} x The x coordinate of the pixel in the bitmap * @param {Number} y The y coordinate of the pixel in the bitmap * @return {String} The alpha value */ Bitmap.prototype.getAlphaPixel = function (x, y) { var data = this._context.getImageData(x, y, 1, 1).data; return data[3]; }; /** * Clears the specified rectangle. * * @method clearRect * @param {Number} x The x coordinate for the upper-left corner * @param {Number} y The y coordinate for the upper-left corner * @param {Number} width The width of the rectangle to clear * @param {Number} height The height of the rectangle to clear */ Bitmap.prototype.clearRect = function (x, y, width, height) { this._context.clearRect(x, y, width, height); this._setDirty(); }; /** * Clears the entire bitmap. * * @method clear */ Bitmap.prototype.clear = function () { this.clearRect(0, 0, this.width, this.height); }; /** * Fills the specified rectangle. * * @method fillRect * @param {Number} x The x coordinate for the upper-left corner * @param {Number} y The y coordinate for the upper-left corner * @param {Number} width The width of the rectangle to fill * @param {Number} height The height of the rectangle to fill * @param {String} color The color of the rectangle in CSS format */ Bitmap.prototype.fillRect = function (x, y, width, height, color) { var context = this._context; context.save(); context.fillStyle = color; context.fillRect(x, y, width, height); context.restore(); this._setDirty(); }; /** * Fills the entire bitmap. * * @method fillAll * @param {String} color The color of the rectangle in CSS format */ Bitmap.prototype.fillAll = function (color) { this.fillRect(0, 0, this.width, this.height, color); }; /** * Draws the rectangle with a gradation. * * @method gradientFillRect * @param {Number} x The x coordinate for the upper-left corner * @param {Number} y The y coordinate for the upper-left corner * @param {Number} width The width of the rectangle to fill * @param {Number} height The height of the rectangle to fill * @param {String} color1 The gradient starting color * @param {String} color2 The gradient ending color * @param {Boolean} vertical Wether the gradient should be draw as vertical or not */ Bitmap.prototype.gradientFillRect = function (x, y, width, height, color1, color2, vertical) { var context = this._context; var grad; if (vertical) { grad = context.createLinearGradient(x, y, x, y + height); } else { grad = context.createLinearGradient(x, y, x + width, y); } grad.addColorStop(0, color1); grad.addColorStop(1, color2); context.save(); context.fillStyle = grad; context.fillRect(x, y, width, height); context.restore(); this._setDirty(); }; /** * Draw a bitmap in the shape of a circle * * @method drawCircle * @param {Number} x The x coordinate based on the circle center * @param {Number} y The y coordinate based on the circle center * @param {Number} radius The radius of the circle * @param {String} color The color of the circle in CSS format */ Bitmap.prototype.drawCircle = function (x, y, radius, color) { var context = this._context; context.save(); context.fillStyle = color; context.beginPath(); context.arc(x, y, radius, 0, Math.PI * 2, false); context.fill(); context.restore(); this._setDirty(); }; /** * Draws the outline text to the bitmap. * * @method drawText * @param {String} text The text that will be drawn * @param {Number} x The x coordinate for the left of the text * @param {Number} y The y coordinate for the top of the text * @param {Number} maxWidth The maximum allowed width of the text * @param {Number} lineHeight The height of the text line * @param {String} align The alignment of the text */ Bitmap.prototype.drawText = function (text, x, y, maxWidth, lineHeight, align) { // Note: Firefox has a bug with textBaseline: Bug 737852 // So we use 'alphabetic' here. if (text !== undefined) { var tx = x; var ty = y + lineHeight - (lineHeight - this.fontSize * 0.7) / 2; var context = this._context; var alpha = context.globalAlpha; maxWidth = maxWidth || 0xffffffff; if (align === 'center') { tx += maxWidth / 2; } if (align === 'right') { tx += maxWidth; } context.save(); context.font = this._makeFontNameText(); context.textAlign = align; context.textBaseline = 'alphabetic'; context.globalAlpha = 1; this._drawTextOutline(text, tx, ty, maxWidth); context.globalAlpha = alpha; this._drawTextBody(text, tx, ty, maxWidth); context.restore(); this._setDirty(); } }; /** * Returns the width of the specified text. * * @method measureTextWidth * @param {String} text The text to be measured * @return {Number} The width of the text in pixels */ Bitmap.prototype.measureTextWidth = function (text) { var context = this._context; context.save(); context.font = this._makeFontNameText(); var width = context.measureText(text).width; context.restore(); return width; }; /** * Changes the color tone of the entire bitmap. * * @method adjustTone * @param {Number} r The red strength in the range (-255, 255) * @param {Number} g The green strength in the range (-255, 255) * @param {Number} b The blue strength in the range (-255, 255) */ Bitmap.prototype.adjustTone = function (r, g, b) { if ((r || g || b) && this.width > 0 && this.height > 0) { var context = this._context; var imageData = context.getImageData(0, 0, this.width, this.height); var pixels = imageData.data; for (var i = 0; i < pixels.length; i += 4) { pixels[i + 0] += r; pixels[i + 1] += g; pixels[i + 2] += b; } context.putImageData(imageData, 0, 0); this._setDirty(); } }; /** * Rotates the hue of the entire bitmap. * * @method rotateHue * @param {Number} offset The hue offset in 360 degrees */ Bitmap.prototype.rotateHue = function (offset) { function rgbToHsl(r, g, b) { var cmin = Math.min(r, g, b); var cmax = Math.max(r, g, b); var h = 0; var s = 0; var l = (cmin + cmax) / 2; var delta = cmax - cmin; if (delta > 0) { if (r === cmax) { h = 60 * (((g - b) / delta + 6) % 6); } else if (g === cmax) { h = 60 * ((b - r) / delta + 2); } else { h = 60 * ((r - g) / delta + 4); } s = delta / (255 - Math.abs(2 * l - 255)); } return [h, s, l]; } function hslToRgb(h, s, l) { var c = (255 - Math.abs(2 * l - 255)) * s; var x = c * (1 - Math.abs((h / 60) % 2 - 1)); var m = l - c / 2; var cm = c + m; var xm = x + m; if (h < 60) { return [cm, xm, m]; } else if (h < 120) { return [xm, cm, m]; } else if (h < 180) { return [m, cm, xm]; } else if (h < 240) { return [m, xm, cm]; } else if (h < 300) { return [xm, m, cm]; } else { return [cm, m, xm]; } } if (offset && this.width > 0 && this.height > 0) { offset = ((offset % 360) + 360) % 360; var context = this._context; var imageData = context.getImageData(0, 0, this.width, this.height); var pixels = imageData.data; for (var i = 0; i < pixels.length; i += 4) { var hsl = rgbToHsl(pixels[i + 0], pixels[i + 1], pixels[i + 2]); var h = (hsl[0] + offset) % 360; var s = hsl[1]; var l = hsl[2]; var rgb = hslToRgb(h, s, l); pixels[i + 0] = rgb[0]; pixels[i + 1] = rgb[1]; pixels[i + 2] = rgb[2]; } context.putImageData(imageData, 0, 0); this._setDirty(); } }; /** * Applies a blur effect to the bitmap. * * @method blur */ Bitmap.prototype.blur = function () { for (var i = 0; i < 2; i++) { var w = this.width; var h = this.height; var canvas = this._canvas; var context = this._context; var tempCanvas = document.createElement('canvas'); var tempContext = tempCanvas.getContext('2d'); tempCanvas.width = w + 2; tempCanvas.height = h + 2; tempContext.drawImage(canvas, 0, 0, w, h, 1, 1, w, h); tempContext.drawImage(canvas, 0, 0, w, 1, 1, 0, w, 1); tempContext.drawImage(canvas, 0, 0, 1, h, 0, 1, 1, h); tempContext.drawImage(canvas, 0, h - 1, w, 1, 1, h + 1, w, 1); tempContext.drawImage(canvas, w - 1, 0, 1, h, w + 1, 1, 1, h); context.save(); context.fillStyle = 'black'; context.fillRect(0, 0, w, h); context.globalCompositeOperation = 'lighter'; context.globalAlpha = 1 / 9; for (var y = 0; y < 3; y++) { for (var x = 0; x < 3; x++) { context.drawImage(tempCanvas, x, y, w, h, 0, 0, w, h); } } context.restore(); } this._setDirty(); }; /** * Add a callback function that will be called when the bitmap is loaded. * * @method addLoadListener * @param {Function} listner The callback function */ Bitmap.prototype.addLoadListener = function (listner) { if (!this.isReady()) { this._loadListeners.push(listner); } else { listner(this); } }; /** * @method _makeFontNameText * @private */ Bitmap.prototype._makeFontNameText = function () { return (this.fontItalic ? 'Italic ' : '') + this.fontSize + 'px ' + this.fontFace; }; /** * @method _drawTextOutline * @param {String} text * @param {Number} tx * @param {Number} ty * @param {Number} maxWidth * @private */ Bitmap.prototype._drawTextOutline = function (text, tx, ty, maxWidth) { var context = this._context; context.strokeStyle = this.outlineColor; context.lineWidth = this.outlineWidth; context.lineJoin = 'round'; context.strokeText(text, tx, ty, maxWidth); }; /** * @method _drawTextBody * @param {String} text * @param {Number} tx * @param {Number} ty * @param {Number} maxWidth * @private */ Bitmap.prototype._drawTextBody = function (text, tx, ty, maxWidth) { var context = this._context; context.fillStyle = this.textColor; context.fillText(text, tx, ty, maxWidth); }; /** * @method _onLoad * @private */ Bitmap.prototype._onLoad = function () { this._image.removeEventListener('load', this._loadListener); this._image.removeEventListener('error', this._errorListener); this._renewCanvas(); switch (this._loadingState) { case 'requesting': this._loadingState = 'requestCompleted'; if (this._decodeAfterRequest) { this.decode(); } else { this._loadingState = 'purged'; this._clearImgInstance(); } break; case 'decrypting': window.URL.revokeObjectURL(this._image.src); this._loadingState = 'decryptCompleted'; if (this._decodeAfterRequest) { this.decode(); } else { this._loadingState = 'purged'; this._clearImgInstance(); } break; } }; Bitmap.prototype.decode = function () { switch (this._loadingState) { case 'requestCompleted': case 'decryptCompleted': this._loadingState = 'loaded'; if (!this.__canvas) this._createBaseTexture(this._image); this._setDirty(); this._callLoadListeners(); break; case 'requesting': case 'decrypting': this._decodeAfterRequest = true; if (!this._loader) { this._loader = ResourceHandler.createLoader(this._url, this._requestImage.bind(this, this._url), this._onError.bind(this)); this._image.removeEventListener('error', this._errorListener); this._image.addEventListener('error', this._errorListener = this._loader); } break; case 'pending': case 'purged': case 'error': this._decodeAfterRequest = true; this._requestImage(this._url); break; } }; /** * @method _callLoadListeners * @private */ Bitmap.prototype._callLoadListeners = function () { while (this._loadListeners.length > 0) { var listener = this._loadListeners.shift(); listener(this); } }; /** * @method _onError * @private */ Bitmap.prototype._onError = function () { this._image.removeEventListener('load', this._loadListener); this._image.removeEventListener('error', this._errorListener); this._loadingState = 'error'; }; /** * @method _setDirty * @private */ Bitmap.prototype._setDirty = function () { this._dirty = true; }; /** * updates texture is bitmap was dirty * @method checkDirty */ Bitmap.prototype.checkDirty = function () { if (this._dirty) { this._baseTexture.update(); this._dirty = false; } }; Bitmap.request = function (url) { var bitmap = Object.create(Bitmap.prototype); bitmap._defer = true; bitmap.initialize(); bitmap._url = url; bitmap._loadingState = 'pending'; return bitmap; }; Bitmap.prototype._requestImage = function (url) { if (Bitmap._reuseImages.length !== 0) { this._image = Bitmap._reuseImages.pop(); } else { this._image = new Image(); } if (this._decodeAfterRequest && !this._loader) { this._loader = ResourceHandler.createLoader(url, this._requestImage.bind(this, url), this._onError.bind(this)); } this._image = new Image(); this._url = url; this._loadingState = 'requesting'; if (!Decrypter.checkImgIgnore(url) && Decrypter.hasEncryptedImages) { this._loadingState = 'decrypting'; Decrypter.decryptImg(url, this); } else { this._image.src = url; this._image.addEventListener('load', this._loadListener = Bitmap.prototype._onLoad.bind(this)); this._image.addEventListener('error', this._errorListener = this._loader || Bitmap.prototype._onError.bind(this)); } }; Bitmap.prototype.isRequestOnly = function () { return !(this._decodeAfterRequest || this.isReady()); }; Bitmap.prototype.isRequestReady = function () { return this._loadingState !== 'pending' && this._loadingState !== 'requesting' && this._loadingState !== 'decrypting'; }; Bitmap.prototype.startRequest = function () { if (this._loadingState === 'pending') { this._decodeAfterRequest = false; this._requestImage(this._url); } }; //----------------------------------------------------------------------------- /** * The static class that carries out graphics processing. * * @class Graphics */ function Graphics() { throw new Error('This is a static class'); } Graphics._cssFontLoading = document.fonts && document.fonts.ready; Graphics._fontLoaded = null; Graphics._videoVolume = 1; /** * Initializes the graphics system. * * @static * @method initialize * @param {Number} width The width of the game screen * @param {Number} height The height of the game screen * @param {String} type The type of the renderer. * 'canvas', 'webgl', or 'auto'. */ Graphics.initialize = function (width, height, type) { this._width = width || 800; this._height = height || 600; this._rendererType = type || 'auto'; this._boxWidth = this._width; this._boxHeight = this._height; this._scale = 1; this._realScale = 1; this._errorShowed = false; this._errorPrinter = null; this._canvas = null; this._video = null; this._videoUnlocked = false; this._videoLoading = false; this._upperCanvas = null; this._renderer = null; this._fpsMeter = null; this._modeBox = null; this._skipCount = 0; this._maxSkip = 3; this._rendered = false; this._loadingImage = null; this._loadingCount = 0; this._fpsMeterToggled = false; this._stretchEnabled = this._defaultStretchMode(); this._canUseDifferenceBlend = false; this._canUseSaturationBlend = false; this._hiddenCanvas = null; this._testCanvasBlendModes(); this._modifyExistingElements(); this._updateRealScale(); this._createAllElements(); this._disableTextSelection(); this._disableContextMenu(); this._setupEventHandlers(); this._setupCssFontLoading(); }; Graphics._setupCssFontLoading = function () { if (Graphics._cssFontLoading) { document.fonts.ready.then(function (fonts) { Graphics._fontLoaded = fonts; }).catch(function (error) { SceneManager.onError(error); }); } }; Graphics.canUseCssFontLoading = function () { return !!this._cssFontLoading; }; /** * The total frame count of the game screen. * * @static * @property frameCount * @type Number */ Graphics.frameCount = 0; /** * The alias of PIXI.blendModes.NORMAL. * * @static * @property BLEND_NORMAL * @type Number * @final */ Graphics.BLEND_NORMAL = 0; /** * The alias of PIXI.blendModes.ADD. * * @static * @property BLEND_ADD * @type Number * @final */ Graphics.BLEND_ADD = 1; /** * The alias of PIXI.blendModes.MULTIPLY. * * @static * @property BLEND_MULTIPLY * @type Number * @final */ Graphics.BLEND_MULTIPLY = 2; /** * The alias of PIXI.blendModes.SCREEN. * * @static * @property BLEND_SCREEN * @type Number * @final */ Graphics.BLEND_SCREEN = 3; /** * Marks the beginning of each frame for FPSMeter. * * @static * @method tickStart */ Graphics.tickStart = function () { if (this._fpsMeter) { this._fpsMeter.tickStart(); } }; /** * Marks the end of each frame for FPSMeter. * * @static * @method tickEnd */ Graphics.tickEnd = function () { if (this._fpsMeter && this._rendered) { this._fpsMeter.tick(); } }; /** * Renders the stage to the game screen. * * @static * @method render * @param {Stage} stage The stage object to be rendered */ Graphics.render = function (stage) { if (this._skipCount === 0) { var startTime = Date.now(); if (stage) { this._renderer.render(stage); if (this._renderer.gl && this._renderer.gl.flush) { this._renderer.gl.flush(); } } var endTime = Date.now(); var elapsed = endTime - startTime; this._skipCount = Math.min(Math.floor(elapsed / 15), this._maxSkip); this._rendered = true; } else { this._skipCount--; this._rendered = false; } this.frameCount++; }; /** * Checks whether the renderer type is WebGL. * * @static * @method isWebGL * @return {Boolean} True if the renderer type is WebGL */ Graphics.isWebGL = function () { return this._renderer && this._renderer.type === PIXI.RENDERER_TYPE.WEBGL; }; /** * Checks whether the current browser supports WebGL. * * @static * @method hasWebGL * @return {Boolean} True if the current browser supports WebGL. */ Graphics.hasWebGL = function () { try { var canvas = document.createElement('canvas'); return !!(canvas.getContext('webgl') || canvas.getContext('experimental-webgl')); } catch (e) { return false; } }; /** * Checks whether the canvas blend mode 'difference' is supported. * * @static * @method canUseDifferenceBlend * @return {Boolean} True if the canvas blend mode 'difference' is supported */ Graphics.canUseDifferenceBlend = function () { return this._canUseDifferenceBlend; }; /** * Checks whether the canvas blend mode 'saturation' is supported. * * @static * @method canUseSaturationBlend * @return {Boolean} True if the canvas blend mode 'saturation' is supported */ Graphics.canUseSaturationBlend = function () { return this._canUseSaturationBlend; }; /** * Sets the source of the "Now Loading" image. * * @static * @method setLoadingImage */ Graphics.setLoadingImage = function (src) { this._loadingImage = new Image(); this._loadingImage.src = src; }; /** * Initializes the counter for displaying the "Now Loading" image. * * @static * @method startLoading */ Graphics.startLoading = function () { this._loadingCount = 0; }; /** * Increments the loading counter and displays the "Now Loading" image if necessary. * * @static * @method updateLoading */ Graphics.updateLoading = function () { this._loadingCount++; this._paintUpperCanvas(); this._upperCanvas.style.opacity = 1; }; /** * Erases the "Now Loading" image. * * @static * @method endLoading */ Graphics.endLoading = function () { this._clearUpperCanvas(); this._upperCanvas.style.opacity = 0; }; /** * Displays the loading error text to the screen. * * @static * @method printLoadingError * @param {String} url The url of the resource failed to load */ Graphics.printLoadingError = function (url) { if (this._errorPrinter && !this._errorShowed) { this._errorPrinter.innerHTML = this._makeErrorHtml('Loading Error', 'Failed to load: ' + url); var button = document.createElement('button'); button.innerHTML = 'Retry'; button.style.fontSize = '24px'; button.style.color = '#ffffff'; button.style.backgroundColor = '#000000'; button.onmousedown = button.ontouchstart = function (event) { ResourceHandler.retry(); event.stopPropagation(); }; this._errorPrinter.appendChild(button); this._loadingCount = -Infinity; } }; /** * Erases the loading error text. * * @static * @method eraseLoadingError */ Graphics.eraseLoadingError = function () { if (this._errorPrinter && !this._errorShowed) { this._errorPrinter.innerHTML = ''; this.startLoading(); } }; /** * Displays the error text to the screen. * * @static * @method printError * @param {String} name The name of the error * @param {String} message The message of the error */ Graphics.printError = function (name, message) { this._errorShowed = true; if (this._errorPrinter) { this._errorPrinter.innerHTML = this._makeErrorHtml(name, message); } this._applyCanvasFilter(); this._clearUpperCanvas(); }; /** * Shows the FPSMeter element. * * @static * @method showFps */ Graphics.showFps = function () { if (this._fpsMeter) { this._fpsMeter.show(); this._modeBox.style.opacity = 1; } }; /** * Hides the FPSMeter element. * * @static * @method hideFps */ Graphics.hideFps = function () { if (this._fpsMeter) { this._fpsMeter.hide(); this._modeBox.style.opacity = 0; } }; /** * Loads a font file. * * @static * @method loadFont * @param {String} name The face name of the font * @param {String} url The url of the font file */ Graphics.loadFont = function (name, url) { var style = document.createElement('style'); var head = document.getElementsByTagName('head'); var rule = '@font-face { font-family: "' + name + '"; src: url("' + url + '"); }'; style.type = 'text/css'; head.item(0).appendChild(style); style.sheet.insertRule(rule, 0); this._createFontLoader(name); }; /** * Checks whether the font file is loaded. * * @static * @method isFontLoaded * @param {String} name The face name of the font * @return {Boolean} True if the font file is loaded */ Graphics.isFontLoaded = function (name) { if (Graphics._cssFontLoading) { if (Graphics._fontLoaded) { return Graphics._fontLoaded.check('10px "' + name + '"'); } return false; } else { if (!this._hiddenCanvas) { this._hiddenCanvas = document.createElement('canvas'); } var context = this._hiddenCanvas.getContext('2d'); var text = 'abcdefghijklmnopqrstuvwxyz'; var width1, width2; context.font = '40px ' + name + ', sans-serif'; width1 = context.measureText(text).width; context.font = '40px sans-serif'; width2 = context.measureText(text).width; return width1 !== width2; } }; /** * Starts playback of a video. * * @static * @method playVideo * @param {String} src */ Graphics.playVideo = function (src) { this._videoLoader = ResourceHandler.createLoader(null, this._playVideo.bind(this, src), this._onVideoError.bind(this)); this._playVideo(src); }; /** * @static * @method _playVideo * @param {String} src * @private */ Graphics._playVideo = function (src) { this._video.src = src; this._video.onloadeddata = this._onVideoLoad.bind(this); this._video.onerror = this._videoLoader; this._video.onended = this._onVideoEnd.bind(this); this._video.load(); this._videoLoading = true; }; /** * Checks whether the video is playing. * * @static * @method isVideoPlaying * @return {Boolean} True if the video is playing */ Graphics.isVideoPlaying = function () { return this._videoLoading || this._isVideoVisible(); }; /** * Checks whether the browser can play the specified video type. * * @static * @method canPlayVideoType * @param {String} type The video type to test support for * @return {Boolean} True if the browser can play the specified video type */ Graphics.canPlayVideoType = function (type) { return this._video && this._video.canPlayType(type); }; /** * Sets volume of a video. * * @static * @method setVideoVolume * @param {Number} value */ Graphics.setVideoVolume = function (value) { this._videoVolume = value; if (this._video) { this._video.volume = this._videoVolume; } }; /** * Converts an x coordinate on the page to the corresponding * x coordinate on the canvas area. * * @static * @method pageToCanvasX * @param {Number} x The x coordinate on the page to be converted * @return {Number} The x coordinate on the canvas area */ Graphics.pageToCanvasX = function (x) { if (this._canvas) { var left = this._canvas.offsetLeft; return Math.round((x - left) / this._realScale); } else { return 0; } }; /** * Converts a y coordinate on the page to the corresponding * y coordinate on the canvas area. * * @static * @method pageToCanvasY * @param {Number} y The y coordinate on the page to be converted * @return {Number} The y coordinate on the canvas area */ Graphics.pageToCanvasY = function (y) { if (this._canvas) { var top = this._canvas.offsetTop; return Math.round((y - top) / this._realScale); } else { return 0; } }; /** * Checks whether the specified point is inside the game canvas area. * * @static * @method isInsideCanvas * @param {Number} x The x coordinate on the canvas area * @param {Number} y The y coordinate on the canvas area * @return {Boolean} True if the specified point is inside the game canvas area */ Graphics.isInsideCanvas = function (x, y) { return (x >= 0 && x < this._width && y >= 0 && y < this._height); }; /** * Calls pixi.js garbage collector */ Graphics.callGC = function () { if (Graphics.isWebGL()) { Graphics._renderer.textureGC.run(); } }; /** * The width of the game screen. * * @static * @property width * @type Number */ Object.defineProperty(Graphics, 'width', { get: function () { return this._width; }, set: function (value) { if (this._width !== value) { this._width = value; this._updateAllElements(); } }, configurable: true }); /** * The height of the game screen. * * @static * @property height * @type Number */ Object.defineProperty(Graphics, 'height', { get: function () { return this._height; }, set: function (value) { if (this._height !== value) { this._height = value; this._updateAllElements(); } }, configurable: true }); /** * The width of the window display area. * * @static * @property boxWidth * @type Number */ Object.defineProperty(Graphics, 'boxWidth', { get: function () { return this._boxWidth; }, set: function (value) { this._boxWidth = value; }, configurable: true }); /** * The height of the window display area. * * @static * @property boxHeight * @type Number */ Object.defineProperty(Graphics, 'boxHeight', { get: function () { return this._boxHeight; }, set: function (value) { this._boxHeight = value; }, configurable: true }); /** * The zoom scale of the game screen. * * @static * @property scale * @type Number */ Object.defineProperty(Graphics, 'scale', { get: function () { return this._scale; }, set: function (value) { if (this._scale !== value) { this._scale = value; this._updateAllElements(); } }, configurable: true }); /** * @static * @method _createAllElements * @private */ Graphics._createAllElements = function () { this._createErrorPrinter(); this._createCanvas(); this._createVideo(); this._createUpperCanvas(); this._createRenderer(); this._createFPSMeter(); this._createModeBox(); this._createGameFontLoader(); }; /** * @static * @method _updateAllElements * @private */ Graphics._updateAllElements = function () { this._updateRealScale(); this._updateErrorPrinter(); this._updateCanvas(); this._updateVideo(); this._updateUpperCanvas(); this._updateRenderer(); this._paintUpperCanvas(); }; /** * @static * @method _updateRealScale * @private */ Graphics._updateRealScale = function () { if (this._stretchEnabled) { var h = window.innerWidth / this._width; var v = window.innerHeight / this._height; if (h >= 1 && h - 0.01 <= 1) h = 1; if (v >= 1 && v - 0.01 <= 1) v = 1; this._realScale = Math.min(h, v); } else { this._realScale = this._scale; } }; /** * @static * @method _makeErrorHtml * @param {String} name * @param {String} message * @return {String} * @private */ Graphics._makeErrorHtml = function (name, message) { return ('<font color="yellow"><b>' + name + '</b></font><br>' + '<font color="white">' + message + '</font><br>'); }; /** * @static * @method _defaultStretchMode * @private */ Graphics._defaultStretchMode = function () { return Utils.isNwjs() || Utils.isMobileDevice(); }; /** * @static * @method _testCanvasBlendModes * @private */ Graphics._testCanvasBlendModes = function () { var canvas, context, imageData1, imageData2; canvas = document.createElement('canvas'); canvas.width = 1; canvas.height = 1; context = canvas.getContext('2d'); context.globalCompositeOperation = 'source-over'; context.fillStyle = 'white'; context.fillRect(0, 0, 1, 1); context.globalCompositeOperation = 'difference'; context.fillStyle = 'white'; context.fillRect(0, 0, 1, 1); imageData1 = context.getImageData(0, 0, 1, 1); context.globalCompositeOperation = 'source-over'; context.fillStyle = 'black'; context.fillRect(0, 0, 1, 1); context.globalCompositeOperation = 'saturation'; context.fillStyle = 'white'; context.fillRect(0, 0, 1, 1); imageData2 = context.getImageData(0, 0, 1, 1); this._canUseDifferenceBlend = imageData1.data[0] === 0; this._canUseSaturationBlend = imageData2.data[0] === 0; }; /** * @static * @method _modifyExistingElements * @private */ Graphics._modifyExistingElements = function () { var elements = document.getElementsByTagName('*'); for (var i = 0; i < elements.length; i++) { if (elements[i].style.zIndex > 0) { elements[i].style.zIndex = 0; } } }; /** * @static * @method _createErrorPrinter * @private */ Graphics._createErrorPrinter = function () { this._errorPrinter = document.createElement('p'); this._errorPrinter.id = 'ErrorPrinter'; this._updateErrorPrinter(); document.body.appendChild(this._errorPrinter); }; /** * @static * @method _updateErrorPrinter * @private */ Graphics._updateErrorPrinter = function () { this._errorPrinter.width = this._width * 0.9; this._errorPrinter.height = 40; this._errorPrinter.style.textAlign = 'center'; this._errorPrinter.style.textShadow = '1px 1px 3px #000'; this._errorPrinter.style.fontSize = '20px'; this._errorPrinter.style.zIndex = 99; this._centerElement(this._errorPrinter); }; /** * @static * @method _createCanvas * @private */ Graphics._createCanvas = function () { this._canvas = document.createElement('canvas'); this._canvas.id = 'GameCanvas'; this._updateCanvas(); document.body.appendChild(this._canvas); }; /** * @static * @method _updateCanvas * @private */ Graphics._updateCanvas = function () { this._canvas.width = this._width; this._canvas.height = this._height; this._canvas.style.zIndex = 1; this._centerElement(this._canvas); }; /** * @static * @method _createVideo * @private */ Graphics._createVideo = function () { this._video = document.createElement('video'); this._video.id = 'GameVideo'; this._video.style.opacity = 0; this._video.setAttribute('playsinline', ''); this._video.volume = this._videoVolume; this._updateVideo(); makeVideoPlayableInline(this._video); document.body.appendChild(this._video); }; /** * @static * @method _updateVideo * @private */ Graphics._updateVideo = function () { this._video.width = this._width; this._video.height = this._height; this._video.style.zIndex = 2; this._centerElement(this._video); }; /** * @static * @method _createUpperCanvas * @private */ Graphics._createUpperCanvas = function () { this._upperCanvas = document.createElement('canvas'); this._upperCanvas.id = 'UpperCanvas'; this._updateUpperCanvas(); document.body.appendChild(this._upperCanvas); }; /** * @static * @method _updateUpperCanvas * @private */ Graphics._updateUpperCanvas = function () { this._upperCanvas.width = this._width; this._upperCanvas.height = this._height; this._upperCanvas.style.zIndex = 3; this._centerElement(this._upperCanvas); }; /** * @static * @method _clearUpperCanvas * @private */ Graphics._clearUpperCanvas = function () { var context = this._upperCanvas.getContext('2d'); context.clearRect(0, 0, this._width, this._height); }; /** * @static * @method _paintUpperCanvas * @private */ Graphics._paintUpperCanvas = function () { this._clearUpperCanvas(); if (this._loadingImage && this._loadingCount >= 20) { var context = this._upperCanvas.getContext('2d'); var dx = (this._width - this._loadingImage.width) / 2; var dy = (this._height - this._loadingImage.height) / 2; var alpha = ((this._loadingCount - 20) / 30).clamp(0, 1); context.save(); context.globalAlpha = alpha; context.drawImage(this._loadingImage, dx, dy); context.restore(); } }; /** * @static * @method _createRenderer * @private */ Graphics._createRenderer = function () { PIXI.dontSayHello = true; var width = this._width; var height = this._height; var options = { view: this._canvas }; try { switch (this._rendererType) { case 'canvas': this._renderer = new PIXI.CanvasRenderer(width, height, options); break; case 'webgl': this._renderer = new PIXI.WebGLRenderer(width, height, options); break; default: this._renderer = PIXI.autoDetectRenderer(width, height, options); break; } if (this._renderer && this._renderer.textureGC) this._renderer.textureGC.maxIdle = 1; } catch (e) { this._renderer = null; } }; /** * @static * @method _updateRenderer * @private */ Graphics._updateRenderer = function () { if (this._renderer) { this._renderer.resize(this._width, this._height); } }; /** * @static * @method _createFPSMeter * @private */ Graphics._createFPSMeter = function () { var options = { graph: 1, decimals: 0, theme: 'transparent', toggleOn: null }; this._fpsMeter = new FPSMeter(options); this._fpsMeter.hide(); }; /** * @static * @method _createModeBox * @private */ Graphics._createModeBox = function () { var box = document.createElement('div'); box.id = 'modeTextBack'; box.style.position = 'absolute'; box.style.left = '5px'; box.style.top = '5px'; box.style.width = '119px'; box.style.height = '58px'; box.style.background = 'rgba(0,0,0,0.2)'; box.style.zIndex = 9; box.style.opacity = 0; var text = document.createElement('div'); text.id = 'modeText'; text.style.position = 'absolute'; text.style.left = '0px'; text.style.top = '41px'; text.style.width = '119px'; text.style.fontSize = '12px'; text.style.fontFamily = 'monospace'; text.style.color = 'white'; text.style.textAlign = 'center'; text.style.textShadow = '1px 1px 0 rgba(0,0,0,0.5)'; text.innerHTML = this.isWebGL() ? 'WebGL mode' : 'Canvas mode'; document.body.appendChild(box); box.appendChild(text); this._modeBox = box; }; /** * @static * @method _createGameFontLoader * @private */ Graphics._createGameFontLoader = function () { this._createFontLoader('GameFont'); }; /** * @static * @method _createFontLoader * @param {String} name * @private */ Graphics._createFontLoader = function (name) { var div = document.createElement('div'); var text = document.createTextNode('.'); div.style.fontFamily = name; div.style.fontSize = '0px'; div.style.color = 'transparent'; div.style.position = 'absolute'; div.style.margin = 'auto'; div.style.top = '0px'; div.style.left = '0px'; div.style.width = '1px'; div.style.height = '1px'; div.appendChild(text); document.body.appendChild(div); }; /** * @static * @method _centerElement * @param {HTMLElement} element * @private */ Graphics._centerElement = function (element) { var width = element.width * this._realScale; var height = element.height * this._realScale; element.style.position = 'absolute'; element.style.margin = 'auto'; element.style.top = 0; element.style.left = 0; element.style.right = 0; element.style.bottom = 0; element.style.width = width + 'px'; element.style.height = height + 'px'; }; /** * @static * @method _disableTextSelection * @private */ Graphics._disableTextSelection = function () { var body = document.body; body.style.userSelect = 'none'; body.style.webkitUserSelect = 'none'; body.style.msUserSelect = 'none'; body.style.mozUserSelect = 'none'; }; /** * @static * @method _disableContextMenu * @private */ Graphics._disableContextMenu = function () { var elements = document.body.getElementsByTagName('*'); var oncontextmenu = function () { return false; }; for (var i = 0; i < elements.length; i++) { elements[i].oncontextmenu = oncontextmenu; } }; /** * @static * @method _applyCanvasFilter * @private */ Graphics._applyCanvasFilter = function () { if (this._canvas) { this._canvas.style.opacity = 0.5; this._canvas.style.filter = 'blur(8px)'; this._canvas.style.webkitFilter = 'blur(8px)'; } }; /** * @static * @method _onVideoLoad * @private */ Graphics._onVideoLoad = function () { this._video.play(); this._updateVisibility(true); this._videoLoading = false; }; /** * @static * @method _onVideoError * @private */ Graphics._onVideoError = function () { this._updateVisibility(false); this._videoLoading = false; }; /** * @static * @method _onVideoEnd * @private */ Graphics._onVideoEnd = function () { this._updateVisibility(false); }; /** * @static * @method _updateVisibility * @param {Boolean} videoVisible * @private */ Graphics._updateVisibility = function (videoVisible) { this._video.style.opacity = videoVisible ? 1 : 0; this._canvas.style.opacity = videoVisible ? 0 : 1; }; /** * @static * @method _isVideoVisible * @return {Boolean} * @private */ Graphics._isVideoVisible = function () { return this._video.style.opacity > 0; }; /** * @static * @method _setupEventHandlers * @private */ Graphics._setupEventHandlers = function () { window.addEventListener('resize', this._onWindowResize.bind(this)); document.addEventListener('keydown', this._onKeyDown.bind(this)); document.addEventListener('keydown', this._onTouchEnd.bind(this)); document.addEventListener('mousedown', this._onTouchEnd.bind(this)); document.addEventListener('touchend', this._onTouchEnd.bind(this)); }; /** * @static * @method _onWindowResize * @private */ Graphics._onWindowResize = function () { this._updateAllElements(); }; /** * @static * @method _onKeyDown * @param {KeyboardEvent} event * @private */ Graphics._onKeyDown = function (event) { if (!event.ctrlKey && !event.altKey) { switch (event.keyCode) { case 113: // F2 event.preventDefault(); this._switchFPSMeter(); break; case 114: // F3 event.preventDefault(); this._switchStretchMode(); break; case 115: // F4 event.preventDefault(); this._switchFullScreen(); break; } } }; /** * @static * @method _onTouchEnd * @param {TouchEvent} event * @private */ Graphics._onTouchEnd = function (event) { if (!this._videoUnlocked) { this._video.play(); this._videoUnlocked = true; } if (this._isVideoVisible() && this._video.paused) { this._video.play(); } }; /** * @static * @method _switchFPSMeter * @private */ Graphics._switchFPSMeter = function () { if (this._fpsMeter.isPaused) { this.showFps(); this._fpsMeter.showFps(); this._fpsMeterToggled = false; } else if (!this._fpsMeterToggled) { this._fpsMeter.showDuration(); this._fpsMeterToggled = true; } else { this.hideFps(); } }; /** * @static * @method _switchStretchMode * @return {Boolean} * @private */ Graphics._switchStretchMode = function () { this._stretchEnabled = !this._stretchEnabled; this._updateAllElements(); }; /** * @static * @method _switchFullScreen * @private */ Graphics._switchFullScreen = function () { if (this._isFullScreen()) { this._requestFullScreen(); } else { this._cancelFullScreen(); } }; /** * @static * @method _isFullScreen * @return {Boolean} * @private */ Graphics._isFullScreen = function () { return ((document.fullScreenElement && document.fullScreenElement !== null) || (!document.mozFullScreen && !document.webkitFullscreenElement && !document.msFullscreenElement)); }; /** * @static * @method _requestFullScreen * @private */ Graphics._requestFullScreen = function () { var element = document.body; if (element.requestFullScreen) { element.requestFullScreen(); } else if (element.mozRequestFullScreen) { element.mozRequestFullScreen(); } else if (element.webkitRequestFullScreen) { element.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT); } else if (element.msRequestFullscreen) { element.msRequestFullscreen(); } }; /** * @static * @method _cancelFullScreen * @private */ Graphics._cancelFullScreen = function () { if (document.cancelFullScreen) { document.cancelFullScreen(); } else if (document.mozCancelFullScreen) { document.mozCancelFullScreen(); } else if (document.webkitCancelFullScreen) { document.webkitCancelFullScreen(); } else if (document.msExitFullscreen) { document.msExitFullscreen(); } }; //----------------------------------------------------------------------------- /** * The static class that handles input data from the keyboard and gamepads. * * @class Input */ function Input() { throw new Error('This is a static class'); } /** * Initializes the input system. * * @static * @method initialize */ Input.initialize = function () { this.clear(); this._wrapNwjsAlert(); this._setupEventHandlers(); }; /** * The wait time of the key repeat in frames. * * @static * @property keyRepeatWait * @type Number */ Input.keyRepeatWait = 24; /** * The interval of the key repeat in frames. * * @static * @property keyRepeatInterval * @type Number */ Input.keyRepeatInterval = 6; /** * A hash table to convert from a virtual key code to a mapped key name. * * @static * @property keyMapper * @type Object */ Input.keyMapper = { 9: 'tab', // tab 13: 'ok', // enter 16: 'shift', // shift 17: 'control', // control 18: 'control', // alt 27: 'escape', // escape 32: 'ok', // space 33: 'pageup', // pageup 34: 'pagedown', // pagedown 37: 'left', // left arrow 38: 'up', // up arrow 39: 'right', // right arrow 40: 'down', // down arrow 45: 'escape', // insert 81: 'pageup', // Q 87: 'pagedown', // W 88: 'escape', // X 90: 'ok', // Z 96: 'escape', // numpad 0 98: 'down', // numpad 2 100: 'left', // numpad 4 102: 'right', // numpad 6 104: 'up', // numpad 8 120: 'debug' // F9 }; /** * A hash table to convert from a gamepad button to a mapped key name. * * @static * @property gamepadMapper * @type Object */ Input.gamepadMapper = { 0: 'ok', // A 1: 'cancel', // B 2: 'shift', // X 3: 'menu', // Y 4: 'pageup', // LB 5: 'pagedown', // RB 12: 'up', // D-pad up 13: 'down', // D-pad down 14: 'left', // D-pad left 15: 'right', // D-pad right }; /** * Clears all the input data. * * @static * @method clear */ Input.clear = function () { this._currentState = {}; this._previousState = {}; this._gamepadStates = []; this._latestButton = null; this._pressedTime = 0; this._dir4 = 0; this._dir8 = 0; this._preferredAxis = ''; this._date = 0; }; /** * Updates the input data. * * @static * @method update */ Input.update = function () { this._pollGamepads(); if (this._currentState[this._latestButton]) { this._pressedTime++; } else { this._latestButton = null; } for (var name in this._currentState) { if (this._currentState[name] && !this._previousState[name]) { this._latestButton = name; this._pressedTime = 0; this._date = Date.now(); } this._previousState[name] = this._currentState[name]; } this._updateDirection(); }; /** * Checks whether a key is currently pressed down. * * @static * @method isPressed * @param {String} keyName The mapped name of the key * @return {Boolean} True if the key is pressed */ Input.isPressed = function (keyName) { if (this._isEscapeCompatible(keyName) && this.isPressed('escape')) { return true; } else { return !!this._currentState[keyName]; } }; /** * Checks whether a key is just pressed. * * @static * @method isTriggered * @param {String} keyName The mapped name of the key * @return {Boolean} True if the key is triggered */ Input.isTriggered = function (keyName) { if (this._isEscapeCompatible(keyName) && this.isTriggered('escape')) { return true; } else { return this._latestButton === keyName && this._pressedTime === 0; } }; /** * Checks whether a key is just pressed or a key repeat occurred. * * @static * @method isRepeated * @param {String} keyName The mapped name of the key * @return {Boolean} True if the key is repeated */ Input.isRepeated = function (keyName) { if (this._isEscapeCompatible(keyName) && this.isRepeated('escape')) { return true; } else { return (this._latestButton === keyName && (this._pressedTime === 0 || (this._pressedTime >= this.keyRepeatWait && this._pressedTime % this.keyRepeatInterval === 0))); } }; /** * Checks whether a key is kept depressed. * * @static * @method isLongPressed * @param {String} keyName The mapped name of the key * @return {Boolean} True if the key is long-pressed */ Input.isLongPressed = function (keyName) { if (this._isEscapeCompatible(keyName) && this.isLongPressed('escape')) { return true; } else { return (this._latestButton === keyName && this._pressedTime >= this.keyRepeatWait); } }; /** * [read-only] The four direction value as a number of the numpad, or 0 for neutral. * * @static * @property dir4 * @type Number */ Object.defineProperty(Input, 'dir4', { get: function () { return this._dir4; }, configurable: true }); /** * [read-only] The eight direction value as a number of the numpad, or 0 for neutral. * * @static * @property dir8 * @type Number */ Object.defineProperty(Input, 'dir8', { get: function () { return this._dir8; }, configurable: true }); /** * [read-only] The time of the last input in milliseconds. * * @static * @property date * @type Number */ Object.defineProperty(Input, 'date', { get: function () { return this._date; }, configurable: true }); /** * @static * @method _wrapNwjsAlert * @private */ Input._wrapNwjsAlert = function () { if (Utils.isNwjs()) { var _alert = window.alert; window.alert = function () { var gui = require('nw.gui'); var win = gui.Window.get(); _alert.apply(this, arguments); win.focus(); Input.clear(); }; } }; /** * @static * @method _setupEventHandlers * @private */ Input._setupEventHandlers = function () { document.addEventListener('keydown', this._onKeyDown.bind(this)); document.addEventListener('keyup', this._onKeyUp.bind(this)); window.addEventListener('blur', this._onLostFocus.bind(this)); }; /** * @static * @method _onKeyDown * @param {KeyboardEvent} event * @private */ Input._onKeyDown = function (event) { if (this._shouldPreventDefault(event.keyCode)) { event.preventDefault(); } if (event.keyCode === 144) { // Numlock this.clear(); } var buttonName = this.keyMapper[event.keyCode]; if (ResourceHandler.exists() && buttonName === 'ok') { ResourceHandler.retry(); } else if (buttonName) { this._currentState[buttonName] = true; } }; /** * @static * @method _shouldPreventDefault * @param {Number} keyCode * @private */ Input._shouldPreventDefault = function (keyCode) { switch (keyCode) { case 8: // backspace case 33: // pageup case 34: // pagedown case 37: // left arrow case 38: // up arrow case 39: // right arrow case 40: // down arrow return true; } return false; }; /** * @static * @method _onKeyUp * @param {KeyboardEvent} event * @private */ Input._onKeyUp = function (event) { var buttonName = this.keyMapper[event.keyCode]; if (buttonName) { this._currentState[buttonName] = false; } if (event.keyCode === 0) { // For QtWebEngine on OS X this.clear(); } }; /** * @static * @method _onLostFocus * @private */ Input._onLostFocus = function () { this.clear(); }; /** * @static * @method _pollGamepads * @private */ Input._pollGamepads = function () { if (navigator.getGamepads) { var gamepads = navigator.getGamepads(); if (gamepads) { for (var i = 0; i < gamepads.length; i++) { var gamepad = gamepads[i]; if (gamepad && gamepad.connected) { this._updateGamepadState(gamepad); } } } } }; /** * @static * @method _updateGamepadState * @param {Gamepad} gamepad * @param {Number} index * @private */ Input._updateGamepadState = function (gamepad) { var lastState = this._gamepadStates[gamepad.index] || []; var newState = []; var buttons = gamepad.buttons; var axes = gamepad.axes; var threshold = 0.5; newState[12] = false; newState[13] = false; newState[14] = false; newState[15] = false; for (var i = 0; i < buttons.length; i++) { newState[i] = buttons[i].pressed; } if (axes[1] < -threshold) { newState[12] = true; // up } else if (axes[1] > threshold) { newState[13] = true; // down } if (axes[0] < -threshold) { newState[14] = true; // left } else if (axes[0] > threshold) { newState[15] = true; // right } for (var j = 0; j < newState.length; j++) { if (newState[j] !== lastState[j]) { var buttonName = this.gamepadMapper[j]; if (buttonName) { this._currentState[buttonName] = newState[j]; } } } this._gamepadStates[gamepad.index] = newState; }; /** * @static * @method _updateDirection * @private */ Input._updateDirection = function () { var x = this._signX(); var y = this._signY(); this._dir8 = this._makeNumpadDirection(x, y); if (x !== 0 && y !== 0) { if (this._preferredAxis === 'x') { y = 0; } else { x = 0; } } else if (x !== 0) { this._preferredAxis = 'y'; } else if (y !== 0) { this._preferredAxis = 'x'; } this._dir4 = this._makeNumpadDirection(x, y); }; /** * @static * @method _signX * @private */ Input._signX = function () { var x = 0; if (this.isPressed('left')) { x--; } if (this.isPressed('right')) { x++; } return x; }; /** * @static * @method _signY * @private */ Input._signY = function () { var y = 0; if (this.isPressed('up')) { y--; } if (this.isPressed('down')) { y++; } return y; }; /** * @static * @method _makeNumpadDirection * @param {Number} x * @param {Number} y * @return {Number} * @private */ Input._makeNumpadDirection = function (x, y) { if (x !== 0 || y !== 0) { return 5 - y * 3 + x; } return 0; }; /** * @static * @method _isEscapeCompatible * @param {String} keyName * @return {Boolean} * @private */ Input._isEscapeCompatible = function (keyName) { return keyName === 'cancel' || keyName === 'menu'; }; //----------------------------------------------------------------------------- /** * The static class that handles input data from the mouse and touchscreen. * * @class TouchInput */ function TouchInput() { throw new Error('This is a static class'); } /** * Initializes the touch system. * * @static * @method initialize */ TouchInput.initialize = function () { this.clear(); this._setupEventHandlers(); }; /** * The wait time of the pseudo key repeat in frames. * * @static * @property keyRepeatWait * @type Number */ TouchInput.keyRepeatWait = 24; /** * The interval of the pseudo key repeat in frames. * * @static * @property keyRepeatInterval * @type Number */ TouchInput.keyRepeatInterval = 6; /** * Clears all the touch data. * * @static * @method clear */ TouchInput.clear = function () { this._mousePressed = false; this._screenPressed = false; this._pressedTime = 0; this._events = {}; this._events.triggered = false; this._events.cancelled = false; this._events.moved = false; this._events.released = false; this._events.wheelX = 0; this._events.wheelY = 0; this._triggered = false; this._cancelled = false; this._moved = false; this._released = false; this._wheelX = 0; this._wheelY = 0; this._x = 0; this._y = 0; this._date = 0; }; /** * Updates the touch data. * * @static * @method update */ TouchInput.update = function () { this._triggered = this._events.triggered; this._cancelled = this._events.cancelled; this._moved = this._events.moved; this._released = this._events.released; this._wheelX = this._events.wheelX; this._wheelY = this._events.wheelY; this._events.triggered = false; this._events.cancelled = false; this._events.moved = false; this._events.released = false; this._events.wheelX = 0; this._events.wheelY = 0; if (this.isPressed()) { this._pressedTime++; } }; /** * Checks whether the mouse button or touchscreen is currently pressed down. * * @static * @method isPressed * @return {Boolean} True if the mouse button or touchscreen is pressed */ TouchInput.isPressed = function () { return this._mousePressed || this._screenPressed; }; /** * Checks whether the left mouse button or touchscreen is just pressed. * * @static * @method isTriggered * @return {Boolean} True if the mouse button or touchscreen is triggered */ TouchInput.isTriggered = function () { return this._triggered; }; /** * Checks whether the left mouse button or touchscreen is just pressed * or a pseudo key repeat occurred. * * @static * @method isRepeated * @return {Boolean} True if the mouse button or touchscreen is repeated */ TouchInput.isRepeated = function () { return (this.isPressed() && (this._triggered || (this._pressedTime >= this.keyRepeatWait && this._pressedTime % this.keyRepeatInterval === 0))); }; /** * Checks whether the left mouse button or touchscreen is kept depressed. * * @static * @method isLongPressed * @return {Boolean} True if the left mouse button or touchscreen is long-pressed */ TouchInput.isLongPressed = function () { return this.isPressed() && this._pressedTime >= this.keyRepeatWait; }; /** * Checks whether the right mouse button is just pressed. * * @static * @method isCancelled * @return {Boolean} True if the right mouse button is just pressed */ TouchInput.isCancelled = function () { return this._cancelled; }; /** * Checks whether the mouse or a finger on the touchscreen is moved. * * @static * @method isMoved * @return {Boolean} True if the mouse or a finger on the touchscreen is moved */ TouchInput.isMoved = function () { return this._moved; }; /** * Checks whether the left mouse button or touchscreen is released. * * @static * @method isReleased * @return {Boolean} True if the mouse button or touchscreen is released */ TouchInput.isReleased = function () { return this._released; }; /** * [read-only] The horizontal scroll amount. * * @static * @property wheelX * @type Number */ Object.defineProperty(TouchInput, 'wheelX', { get: function () { return this._wheelX; }, configurable: true }); /** * [read-only] The vertical scroll amount. * * @static * @property wheelY * @type Number */ Object.defineProperty(TouchInput, 'wheelY', { get: function () { return this._wheelY; }, configurable: true }); /** * [read-only] The x coordinate on the canvas area of the latest touch event. * * @static * @property x * @type Number */ Object.defineProperty(TouchInput, 'x', { get: function () { return this._x; }, configurable: true }); /** * [read-only] The y coordinate on the canvas area of the latest touch event. * * @static * @property y * @type Number */ Object.defineProperty(TouchInput, 'y', { get: function () { return this._y; }, configurable: true }); /** * [read-only] The time of the last input in milliseconds. * * @static * @property date * @type Number */ Object.defineProperty(TouchInput, 'date', { get: function () { return this._date; }, configurable: true }); /** * @static * @method _setupEventHandlers * @private */ TouchInput._setupEventHandlers = function () { var isSupportPassive = Utils.isSupportPassiveEvent(); document.addEventListener('mousedown', this._onMouseDown.bind(this)); document.addEventListener('mousemove', this._onMouseMove.bind(this)); document.addEventListener('mouseup', this._onMouseUp.bind(this)); document.addEventListener('wheel', this._onWheel.bind(this)); document.addEventListener('touchstart', this._onTouchStart.bind(this), isSupportPassive ? { passive: false } : false); document.addEventListener('touchmove', this._onTouchMove.bind(this), isSupportPassive ? { passive: false } : false); document.addEventListener('touchend', this._onTouchEnd.bind(this)); document.addEventListener('touchcancel', this._onTouchCancel.bind(this)); document.addEventListener('pointerdown', this._onPointerDown.bind(this)); }; /** * @static * @method _onMouseDown * @param {MouseEvent} event * @private */ TouchInput._onMouseDown = function (event) { if (event.button === 0) { this._onLeftButtonDown(event); } else if (event.button === 1) { this._onMiddleButtonDown(event); } else if (event.button === 2) { this._onRightButtonDown(event); } }; /** * @static * @method _onLeftButtonDown * @param {MouseEvent} event * @private */ TouchInput._onLeftButtonDown = function (event) { var x = Graphics.pageToCanvasX(event.pageX); var y = Graphics.pageToCanvasY(event.pageY); if (Graphics.isInsideCanvas(x, y)) { this._mousePressed = true; this._pressedTime = 0; this._onTrigger(x, y); } }; /** * @static * @method _onMiddleButtonDown * @param {MouseEvent} event * @private */ TouchInput._onMiddleButtonDown = function (event) { }; /** * @static * @method _onRightButtonDown * @param {MouseEvent} event * @private */ TouchInput._onRightButtonDown = function (event) { var x = Graphics.pageToCanvasX(event.pageX); var y = Graphics.pageToCanvasY(event.pageY); if (Graphics.isInsideCanvas(x, y)) { this._onCancel(x, y); } }; /** * @static * @method _onMouseMove * @param {MouseEvent} event * @private */ TouchInput._onMouseMove = function (event) { if (this._mousePressed) { var x = Graphics.pageToCanvasX(event.pageX); var y = Graphics.pageToCanvasY(event.pageY); this._onMove(x, y); } }; /** * @static * @method _onMouseUp * @param {MouseEvent} event * @private */ TouchInput._onMouseUp = function (event) { if (event.button === 0) { var x = Graphics.pageToCanvasX(event.pageX); var y = Graphics.pageToCanvasY(event.pageY); this._mousePressed = false; this._onRelease(x, y); } }; /** * @static * @method _onWheel * @param {WheelEvent} event * @private */ TouchInput._onWheel = function (event) { this._events.wheelX += event.deltaX; this._events.wheelY += event.deltaY; event.preventDefault(); }; /** * @static * @method _onTouchStart * @param {TouchEvent} event * @private */ TouchInput._onTouchStart = function (event) { for (var i = 0; i < event.changedTouches.length; i++) { var touch = event.changedTouches[i]; var x = Graphics.pageToCanvasX(touch.pageX); var y = Graphics.pageToCanvasY(touch.pageY); if (Graphics.isInsideCanvas(x, y)) { this._screenPressed = true; this._pressedTime = 0; if (event.touches.length >= 2) { this._onCancel(x, y); } else { this._onTrigger(x, y); } event.preventDefault(); } } if (window.cordova || window.navigator.standalone) { event.preventDefault(); } }; /** * @static * @method _onTouchMove * @param {TouchEvent} event * @private */ TouchInput._onTouchMove = function (event) { for (var i = 0; i < event.changedTouches.length; i++) { var touch = event.changedTouches[i]; var x = Graphics.pageToCanvasX(touch.pageX); var y = Graphics.pageToCanvasY(touch.pageY); this._onMove(x, y); } }; /** * @static * @method _onTouchEnd * @param {TouchEvent} event * @private */ TouchInput._onTouchEnd = function (event) { for (var i = 0; i < event.changedTouches.length; i++) { var touch = event.changedTouches[i]; var x = Graphics.pageToCanvasX(touch.pageX); var y = Graphics.pageToCanvasY(touch.pageY); this._screenPressed = false; this._onRelease(x, y); } }; /** * @static * @method _onTouchCancel * @param {TouchEvent} event * @private */ TouchInput._onTouchCancel = function (event) { this._screenPressed = false; }; /** * @static * @method _onPointerDown * @param {PointerEvent} event * @private */ TouchInput._onPointerDown = function (event) { if (event.pointerType === 'touch' && !event.isPrimary) { var x = Graphics.pageToCanvasX(event.pageX); var y = Graphics.pageToCanvasY(event.pageY); if (Graphics.isInsideCanvas(x, y)) { // For Microsoft Edge this._onCancel(x, y); event.preventDefault(); } } }; /** * @static * @method _onTrigger * @param {Number} x * @param {Number} y * @private */ TouchInput._onTrigger = function (x, y) { this._events.triggered = true; this._x = x; this._y = y; this._date = Date.now(); }; /** * @static * @method _onCancel * @param {Number} x * @param {Number} y * @private */ TouchInput._onCancel = function (x, y) { this._events.cancelled = true; this._x = x; this._y = y; }; /** * @static * @method _onMove * @param {Number} x * @param {Number} y * @private */ TouchInput._onMove = function (x, y) { this._events.moved = true; this._x = x; this._y = y; }; /** * @static * @method _onRelease * @param {Number} x * @param {Number} y * @private */ TouchInput._onRelease = function (x, y) { this._events.released = true; this._x = x; this._y = y; }; //----------------------------------------------------------------------------- /** * The basic object that is rendered to the game screen. * * @class Sprite * @constructor * @param {Bitmap} bitmap The image for the sprite */ function Sprite() { this.initialize.apply(this, arguments); } Sprite.prototype = Object.create(PIXI.Sprite.prototype); Sprite.prototype.constructor = Sprite; Sprite.voidFilter = new PIXI.filters.VoidFilter(); Sprite.prototype.initialize = function (bitmap) { var texture = new PIXI.Texture(new PIXI.BaseTexture()); PIXI.Sprite.call(this, texture); this._bitmap = null; this._frame = new Rectangle(); this._realFrame = new Rectangle(); this._blendColor = [0, 0, 0, 0]; this._colorTone = [0, 0, 0, 0]; this._canvas = null; this._context = null; this._tintTexture = null; /** * use heavy renderer that will reduce border artifacts and apply advanced blendModes * @type {boolean} * @private */ this._isPicture = false; this.spriteId = Sprite._counter++; this.opaque = false; this.bitmap = bitmap; }; // Number of the created objects. Sprite._counter = 0; /** * The image for the sprite. * * @property bitmap * @type Bitmap */ Object.defineProperty(Sprite.prototype, 'bitmap', { get: function () { return this._bitmap; }, set: function (value) { if (this._bitmap !== value) { this._bitmap = value; if (value) { this._refreshFrame = true; value.addLoadListener(this._onBitmapLoad.bind(this)); } else { this._refreshFrame = false; this.texture.frame = Rectangle.emptyRectangle; } } }, configurable: true }); /** * The width of the sprite without the scale. * * @property width * @type Number */ Object.defineProperty(Sprite.prototype, 'width', { get: function () { return this._frame.width; }, set: function (value) { this._frame.width = value; this._refresh(); }, configurable: true }); /** * The height of the sprite without the scale. * * @property height * @type Number */ Object.defineProperty(Sprite.prototype, 'height', { get: function () { return this._frame.height; }, set: function (value) { this._frame.height = value; this._refresh(); }, configurable: true }); /** * The opacity of the sprite (0 to 255). * * @property opacity * @type Number */ Object.defineProperty(Sprite.prototype, 'opacity', { get: function () { return this.alpha * 255; }, set: function (value) { this.alpha = value.clamp(0, 255) / 255; }, configurable: true }); /** * Updates the sprite for each frame. * * @method update */ Sprite.prototype.update = function () { this.children.forEach(function (child) { if (child.update) { child.update(); } }); }; /** * Sets the x and y at once. * * @method move * @param {Number} x The x coordinate of the sprite * @param {Number} y The y coordinate of the sprite */ Sprite.prototype.move = function (x, y) { this.x = x; this.y = y; }; /** * Sets the rectagle of the bitmap that the sprite displays. * * @method setFrame * @param {Number} x The x coordinate of the frame * @param {Number} y The y coordinate of the frame * @param {Number} width The width of the frame * @param {Number} height The height of the frame */ Sprite.prototype.setFrame = function (x, y, width, height) { this._refreshFrame = false; var frame = this._frame; if (x !== frame.x || y !== frame.y || width !== frame.width || height !== frame.height) { frame.x = x; frame.y = y; frame.width = width; frame.height = height; this._refresh(); } }; /** * Gets the blend color for the sprite. * * @method getBlendColor * @return {Array} The blend color [r, g, b, a] */ Sprite.prototype.getBlendColor = function () { return this._blendColor.clone(); }; /** * Sets the blend color for the sprite. * * @method setBlendColor * @param {Array} color The blend color [r, g, b, a] */ Sprite.prototype.setBlendColor = function (color) { if (!(color instanceof Array)) { throw new Error('Argument must be an array'); } if (!this._blendColor.equals(color)) { this._blendColor = color.clone(); this._refresh(); } }; /** * Gets the color tone for the sprite. * * @method getColorTone * @return {Array} The color tone [r, g, b, gray] */ Sprite.prototype.getColorTone = function () { return this._colorTone.clone(); }; /** * Sets the color tone for the sprite. * * @method setColorTone * @param {Array} tone The color tone [r, g, b, gray] */ Sprite.prototype.setColorTone = function (tone) { if (!(tone instanceof Array)) { throw new Error('Argument must be an array'); } if (!this._colorTone.equals(tone)) { this._colorTone = tone.clone(); this._refresh(); } }; /** * @method _onBitmapLoad * @private */ Sprite.prototype._onBitmapLoad = function (bitmapLoaded) { if (bitmapLoaded === this._bitmap) { if (this._refreshFrame && this._bitmap) { this._refreshFrame = false; this._frame.width = this._bitmap.width; this._frame.height = this._bitmap.height; } } this._refresh(); }; /** * @method _refresh * @private */ Sprite.prototype._refresh = function () { var frameX = Math.floor(this._frame.x); var frameY = Math.floor(this._frame.y); var frameW = Math.floor(this._frame.width); var frameH = Math.floor(this._frame.height); var bitmapW = this._bitmap ? this._bitmap.width : 0; var bitmapH = this._bitmap ? this._bitmap.height : 0; var realX = frameX.clamp(0, bitmapW); var realY = frameY.clamp(0, bitmapH); var realW = (frameW - realX + frameX).clamp(0, bitmapW - realX); var realH = (frameH - realY + frameY).clamp(0, bitmapH - realY); this._realFrame.x = realX; this._realFrame.y = realY; this._realFrame.width = realW; this._realFrame.height = realH; this.pivot.x = frameX - realX; this.pivot.y = frameY - realY; if (realW > 0 && realH > 0) { if (this._needsTint()) { this._createTinter(realW, realH); this._executeTint(realX, realY, realW, realH); this._tintTexture.update(); this.texture.baseTexture = this._tintTexture; this.texture.frame = new Rectangle(0, 0, realW, realH); } else { if (this._bitmap) { this.texture.baseTexture = this._bitmap.baseTexture; } this.texture.frame = this._realFrame; } } else if (this._bitmap) { this.texture.frame = Rectangle.emptyRectangle; } else { this.texture.baseTexture.width = Math.max(this.texture.baseTexture.width, this._frame.x + this._frame.width); this.texture.baseTexture.height = Math.max(this.texture.baseTexture.height, this._frame.y + this._frame.height); this.texture.frame = this._frame; } this.texture._updateID++; }; /** * @method _isInBitmapRect * @param {Number} x * @param {Number} y * @param {Number} w * @param {Number} h * @return {Boolean} * @private */ Sprite.prototype._isInBitmapRect = function (x, y, w, h) { return (this._bitmap && x + w > 0 && y + h > 0 && x < this._bitmap.width && y < this._bitmap.height); }; /** * @method _needsTint * @return {Boolean} * @private */ Sprite.prototype._needsTint = function () { var tone = this._colorTone; return tone[0] || tone[1] || tone[2] || tone[3] || this._blendColor[3] > 0; }; /** * @method _createTinter * @param {Number} w * @param {Number} h * @private */ Sprite.prototype._createTinter = function (w, h) { if (!this._canvas) { this._canvas = document.createElement('canvas'); this._context = this._canvas.getContext('2d'); } this._canvas.width = w; this._canvas.height = h; if (!this._tintTexture) { this._tintTexture = new PIXI.BaseTexture(this._canvas); } this._tintTexture.width = w; this._tintTexture.height = h; this._tintTexture.scaleMode = this._bitmap.baseTexture.scaleMode; }; /** * @method _executeTint * @param {Number} x * @param {Number} y * @param {Number} w * @param {Number} h * @private */ Sprite.prototype._executeTint = function (x, y, w, h) { var context = this._context; var tone = this._colorTone; var color = this._blendColor; context.globalCompositeOperation = 'copy'; context.drawImage(this._bitmap.canvas, x, y, w, h, 0, 0, w, h); if (Graphics.canUseSaturationBlend()) { var gray = Math.max(0, tone[3]); context.globalCompositeOperation = 'saturation'; context.fillStyle = 'rgba(255,255,255,' + gray / 255 + ')'; context.fillRect(0, 0, w, h); } var r1 = Math.max(0, tone[0]); var g1 = Math.max(0, tone[1]); var b1 = Math.max(0, tone[2]); context.globalCompositeOperation = 'lighter'; context.fillStyle = Utils.rgbToCssColor(r1, g1, b1); context.fillRect(0, 0, w, h); if (Graphics.canUseDifferenceBlend()) { context.globalCompositeOperation = 'difference'; context.fillStyle = 'white'; context.fillRect(0, 0, w, h); var r2 = Math.max(0, -tone[0]); var g2 = Math.max(0, -tone[1]); var b2 = Math.max(0, -tone[2]); context.globalCompositeOperation = 'lighter'; context.fillStyle = Utils.rgbToCssColor(r2, g2, b2); context.fillRect(0, 0, w, h); context.globalCompositeOperation = 'difference'; context.fillStyle = 'white'; context.fillRect(0, 0, w, h); } var r3 = Math.max(0, color[0]); var g3 = Math.max(0, color[1]); var b3 = Math.max(0, color[2]); var a3 = Math.max(0, color[3]); context.globalCompositeOperation = 'source-atop'; context.fillStyle = Utils.rgbToCssColor(r3, g3, b3); context.globalAlpha = a3 / 255; context.fillRect(0, 0, w, h); context.globalCompositeOperation = 'destination-in'; context.globalAlpha = 1; context.drawImage(this._bitmap.canvas, x, y, w, h, 0, 0, w, h); }; Sprite.prototype._renderCanvas_PIXI = PIXI.Sprite.prototype._renderCanvas; Sprite.prototype._renderWebGL_PIXI = PIXI.Sprite.prototype._renderWebGL; /** * @method _renderCanvas * @param {Object} renderer * @private */ Sprite.prototype._renderCanvas = function (renderer) { if (this.bitmap) { this.bitmap.touch(); } if (this.bitmap && !this.bitmap.isReady()) { return; } if (this.texture.frame.width > 0 && this.texture.frame.height > 0) { this._renderCanvas_PIXI(renderer); } }; /** * checks if we need to speed up custom blendmodes * @param renderer * @private */ Sprite.prototype._speedUpCustomBlendModes = function (renderer) { var picture = renderer.plugins.picture; var blend = this.blendMode; if (renderer.renderingToScreen && renderer._activeRenderTarget.root) { if (picture.drawModes[blend]) { var stage = renderer._lastObjectRendered; var f = stage._filters; if (!f || !f[0]) { setTimeout(function () { var f = stage._filters; if (!f || !f[0]) { stage.filters = [Sprite.voidFilter]; stage.filterArea = new PIXI.Rectangle(0, 0, Graphics.width, Graphics.height); } }, 0); } } } }; /** * @method _renderWebGL * @param {Object} renderer * @private */ Sprite.prototype._renderWebGL = function (renderer) { if (this.bitmap) { this.bitmap.touch(); } if (this.bitmap && !this.bitmap.isReady()) { return; } if (this.texture.frame.width > 0 && this.texture.frame.height > 0) { if (this._bitmap) { this._bitmap.checkDirty(); } //copy of pixi-v4 internal code this.calculateVertices(); if (this.pluginName === 'sprite' && this._isPicture) { // use heavy renderer, which reduces artifacts and applies corrent blendMode, // but does not use multitexture optimization this._speedUpCustomBlendModes(renderer); renderer.setObjectRenderer(renderer.plugins.picture); renderer.plugins.picture.render(this); } else { // use pixi super-speed renderer renderer.setObjectRenderer(renderer.plugins[this.pluginName]); renderer.plugins[this.pluginName].render(this); } } }; // The important members from Pixi.js /** * The visibility of the sprite. * * @property visible * @type Boolean */ /** * The x coordinate of the sprite. * * @property x * @type Number */ /** * The y coordinate of the sprite. * * @property y * @type Number */ /** * The origin point of the sprite. (0,0) to (1,1). * * @property anchor * @type Point */ /** * The scale factor of the sprite. * * @property scale * @type Point */ /** * The rotation of the sprite in radians. * * @property rotation * @type Number */ /** * The blend mode to be applied to the sprite. * * @property blendMode * @type Number */ /** * Sets the filters for the sprite. * * @property filters * @type Array */ /** * [read-only] The array of children of the sprite. * * @property children * @type Array */ /** * [read-only] The object that contains the sprite. * * @property parent * @type Object */ /** * Adds a child to the container. * * @method addChild * @param {Object} child The child to add * @return {Object} The child that was added */ /** * Adds a child to the container at a specified index. * * @method addChildAt * @param {Object} child The child to add * @param {Number} index The index to place the child in * @return {Object} The child that was added */ /** * Removes a child from the container. * * @method removeChild * @param {Object} child The child to remove * @return {Object} The child that was removed */ /** * Removes a child from the specified index position. * * @method removeChildAt * @param {Number} index The index to get the child from * @return {Object} The child that was removed */ //----------------------------------------------------------------------------- /** * The tilemap which displays 2D tile-based game map. * * @class Tilemap * @constructor */ function Tilemap() { this.initialize.apply(this, arguments); } Tilemap.prototype = Object.create(PIXI.Container.prototype); Tilemap.prototype.constructor = Tilemap; Tilemap.prototype.initialize = function () { PIXI.Container.call(this); this._margin = 20; this._width = Graphics.width + this._margin * 2; this._height = Graphics.height + this._margin * 2; this._tileWidth = 48; this._tileHeight = 48; this._mapWidth = 0; this._mapHeight = 0; this._mapData = null; this._layerWidth = 0; this._layerHeight = 0; this._lastTiles = []; /** * The bitmaps used as a tileset. * * @property bitmaps * @type Array */ this.bitmaps = []; /** * The origin point of the tilemap for scrolling. * * @property origin * @type Point */ this.origin = new Point(); /** * The tileset flags. * * @property flags * @type Array */ this.flags = []; /** * The animation count for autotiles. * * @property animationCount * @type Number */ this.animationCount = 0; /** * Whether the tilemap loops horizontal. * * @property horizontalWrap * @type Boolean */ this.horizontalWrap = false; /** * Whether the tilemap loops vertical. * * @property verticalWrap * @type Boolean */ this.verticalWrap = false; this._createLayers(); this.refresh(); }; /** * The width of the screen in pixels. * * @property width * @type Number */ Object.defineProperty(Tilemap.prototype, 'width', { get: function () { return this._width; }, set: function (value) { if (this._width !== value) { this._width = value; this._createLayers(); } } }); /** * The height of the screen in pixels. * * @property height * @type Number */ Object.defineProperty(Tilemap.prototype, 'height', { get: function () { return this._height; }, set: function (value) { if (this._height !== value) { this._height = value; this._createLayers(); } } }); /** * The width of a tile in pixels. * * @property tileWidth * @type Number */ Object.defineProperty(Tilemap.prototype, 'tileWidth', { get: function () { return this._tileWidth; }, set: function (value) { if (this._tileWidth !== value) { this._tileWidth = value; this._createLayers(); } } }); /** * The height of a tile in pixels. * * @property tileHeight * @type Number */ Object.defineProperty(Tilemap.prototype, 'tileHeight', { get: function () { return this._tileHeight; }, set: function (value) { if (this._tileHeight !== value) { this._tileHeight = value; this._createLayers(); } } }); /** * Sets the tilemap data. * * @method setData * @param {Number} width The width of the map in number of tiles * @param {Number} height The height of the map in number of tiles * @param {Array} data The one dimensional array for the map data */ Tilemap.prototype.setData = function (width, height, data) { this._mapWidth = width; this._mapHeight = height; this._mapData = data; }; /** * Checks whether the tileset is ready to render. * * @method isReady * @type Boolean * @return {Boolean} True if the tilemap is ready */ Tilemap.prototype.isReady = function () { for (var i = 0; i < this.bitmaps.length; i++) { if (this.bitmaps[i] && !this.bitmaps[i].isReady()) { return false; } } return true; }; /** * Updates the tilemap for each frame. * * @method update */ Tilemap.prototype.update = function () { this.animationCount++; this.animationFrame = Math.floor(this.animationCount / 30); this.children.forEach(function (child) { if (child.update) { child.update(); } }); for (var i = 0; i < this.bitmaps.length; i++) { if (this.bitmaps[i]) { this.bitmaps[i].touch(); } } }; /** * Forces to repaint the entire tilemap. * * @method refresh */ Tilemap.prototype.refresh = function () { this._lastTiles.length = 0; }; /** * Forces to refresh the tileset * * @method refresh */ Tilemap.prototype.refreshTileset = function () { }; /** * @method updateTransform * @private */ Tilemap.prototype.updateTransform = function () { var ox = Math.floor(this.origin.x); var oy = Math.floor(this.origin.y); var startX = Math.floor((ox - this._margin) / this._tileWidth); var startY = Math.floor((oy - this._margin) / this._tileHeight); this._updateLayerPositions(startX, startY); if (this._needsRepaint || this._lastAnimationFrame !== this.animationFrame || this._lastStartX !== startX || this._lastStartY !== startY) { this._frameUpdated = this._lastAnimationFrame !== this.animationFrame; this._lastAnimationFrame = this.animationFrame; this._lastStartX = startX; this._lastStartY = startY; this._paintAllTiles(startX, startY); this._needsRepaint = false; } this._sortChildren(); PIXI.Container.prototype.updateTransform.call(this); }; /** * @method _createLayers * @private */ Tilemap.prototype._createLayers = function () { var width = this._width; var height = this._height; var margin = this._margin; var tileCols = Math.ceil(width / this._tileWidth) + 1; var tileRows = Math.ceil(height / this._tileHeight) + 1; var layerWidth = tileCols * this._tileWidth; var layerHeight = tileRows * this._tileHeight; this._lowerBitmap = new Bitmap(layerWidth, layerHeight); this._upperBitmap = new Bitmap(layerWidth, layerHeight); this._layerWidth = layerWidth; this._layerHeight = layerHeight; /* * Z coordinate: * * 0 : Lower tiles * 1 : Lower characters * 3 : Normal characters * 4 : Upper tiles * 5 : Upper characters * 6 : Airship shadow * 7 : Balloon * 8 : Animation * 9 : Destination */ this._lowerLayer = new Sprite(); this._lowerLayer.move(-margin, -margin, width, height); this._lowerLayer.z = 0; this._upperLayer = new Sprite(); this._upperLayer.move(-margin, -margin, width, height); this._upperLayer.z = 4; for (var i = 0; i < 4; i++) { this._lowerLayer.addChild(new Sprite(this._lowerBitmap)); this._upperLayer.addChild(new Sprite(this._upperBitmap)); } this.addChild(this._lowerLayer); this.addChild(this._upperLayer); }; /** * @method _updateLayerPositions * @param {Number} startX * @param {Number} startY * @private */ Tilemap.prototype._updateLayerPositions = function (startX, startY) { var m = this._margin; var ox = Math.floor(this.origin.x); var oy = Math.floor(this.origin.y); var x2 = (ox - m).mod(this._layerWidth); var y2 = (oy - m).mod(this._layerHeight); var w1 = this._layerWidth - x2; var h1 = this._layerHeight - y2; var w2 = this._width - w1; var h2 = this._height - h1; for (var i = 0; i < 2; i++) { var children; if (i === 0) { children = this._lowerLayer.children; } else { children = this._upperLayer.children; } children[0].move(0, 0, w1, h1); children[0].setFrame(x2, y2, w1, h1); children[1].move(w1, 0, w2, h1); children[1].setFrame(0, y2, w2, h1); children[2].move(0, h1, w1, h2); children[2].setFrame(x2, 0, w1, h2); children[3].move(w1, h1, w2, h2); children[3].setFrame(0, 0, w2, h2); } }; /** * @method _paintAllTiles * @param {Number} startX * @param {Number} startY * @private */ Tilemap.prototype._paintAllTiles = function (startX, startY) { var tileCols = Math.ceil(this._width / this._tileWidth) + 1; var tileRows = Math.ceil(this._height / this._tileHeight) + 1; for (var y = 0; y < tileRows; y++) { for (var x = 0; x < tileCols; x++) { this._paintTiles(startX, startY, x, y); } } }; /** * @method _paintTiles * @param {Number} startX * @param {Number} startY * @param {Number} x * @param {Number} y * @private */ Tilemap.prototype._paintTiles = function (startX, startY, x, y) { var tableEdgeVirtualId = 10000; var mx = startX + x; var my = startY + y; var dx = (mx * this._tileWidth).mod(this._layerWidth); var dy = (my * this._tileHeight).mod(this._layerHeight); var lx = dx / this._tileWidth; var ly = dy / this._tileHeight; var tileId0 = this._readMapData(mx, my, 0); var tileId1 = this._readMapData(mx, my, 1); var tileId2 = this._readMapData(mx, my, 2); var tileId3 = this._readMapData(mx, my, 3); var shadowBits = this._readMapData(mx, my, 4); var upperTileId1 = this._readMapData(mx, my - 1, 1); var lowerTiles = []; var upperTiles = []; if (this._isHigherTile(tileId0)) { upperTiles.push(tileId0); } else { lowerTiles.push(tileId0); } if (this._isHigherTile(tileId1)) { upperTiles.push(tileId1); } else { lowerTiles.push(tileId1); } lowerTiles.push(-shadowBits); if (this._isTableTile(upperTileId1) && !this._isTableTile(tileId1)) { if (!Tilemap.isShadowingTile(tileId0)) { lowerTiles.push(tableEdgeVirtualId + upperTileId1); } } if (this._isOverpassPosition(mx, my)) { upperTiles.push(tileId2); upperTiles.push(tileId3); } else { if (this._isHigherTile(tileId2)) { upperTiles.push(tileId2); } else { lowerTiles.push(tileId2); } if (this._isHigherTile(tileId3)) { upperTiles.push(tileId3); } else { lowerTiles.push(tileId3); } } var lastLowerTiles = this._readLastTiles(0, lx, ly); if (!lowerTiles.equals(lastLowerTiles) || (Tilemap.isTileA1(tileId0) && this._frameUpdated)) { this._lowerBitmap.clearRect(dx, dy, this._tileWidth, this._tileHeight); for (var i = 0; i < lowerTiles.length; i++) { var lowerTileId = lowerTiles[i]; if (lowerTileId < 0) { this._drawShadow(this._lowerBitmap, shadowBits, dx, dy); } else if (lowerTileId >= tableEdgeVirtualId) { this._drawTableEdge(this._lowerBitmap, upperTileId1, dx, dy); } else { this._drawTile(this._lowerBitmap, lowerTileId, dx, dy); } } this._writeLastTiles(0, lx, ly, lowerTiles); } var lastUpperTiles = this._readLastTiles(1, lx, ly); if (!upperTiles.equals(lastUpperTiles)) { this._upperBitmap.clearRect(dx, dy, this._tileWidth, this._tileHeight); for (var j = 0; j < upperTiles.length; j++) { this._drawTile(this._upperBitmap, upperTiles[j], dx, dy); } this._writeLastTiles(1, lx, ly, upperTiles); } }; /** * @method _readLastTiles * @param {Number} i * @param {Number} x * @param {Number} y * @private */ Tilemap.prototype._readLastTiles = function (i, x, y) { var array1 = this._lastTiles[i]; if (array1) { var array2 = array1[y]; if (array2) { var tiles = array2[x]; if (tiles) { return tiles; } } } return []; }; /** * @method _writeLastTiles * @param {Number} i * @param {Number} x * @param {Number} y * @param {Array} tiles * @private */ Tilemap.prototype._writeLastTiles = function (i, x, y, tiles) { var array1 = this._lastTiles[i]; if (!array1) { array1 = this._lastTiles[i] = []; } var array2 = array1[y]; if (!array2) { array2 = array1[y] = []; } array2[x] = tiles; }; /** * @method _drawTile * @param {Bitmap} bitmap * @param {Number} tileId * @param {Number} dx * @param {Number} dy * @private */ Tilemap.prototype._drawTile = function (bitmap, tileId, dx, dy) { if (Tilemap.isVisibleTile(tileId)) { if (Tilemap.isAutotile(tileId)) { this._drawAutotile(bitmap, tileId, dx, dy); } else { this._drawNormalTile(bitmap, tileId, dx, dy); } } }; /** * @method _drawNormalTile * @param {Bitmap} bitmap * @param {Number} tileId * @param {Number} dx * @param {Number} dy * @private */ Tilemap.prototype._drawNormalTile = function (bitmap, tileId, dx, dy) { var setNumber = 0; if (Tilemap.isTileA5(tileId)) { setNumber = 4; } else { setNumber = 5 + Math.floor(tileId / 256); } var w = this._tileWidth; var h = this._tileHeight; var sx = (Math.floor(tileId / 128) % 2 * 8 + tileId % 8) * w; var sy = (Math.floor(tileId % 256 / 8) % 16) * h; var source = this.bitmaps[setNumber]; if (source) { bitmap.bltImage(source, sx, sy, w, h, dx, dy, w, h); } }; /** * @method _drawAutotile * @param {Bitmap} bitmap * @param {Number} tileId * @param {Number} dx * @param {Number} dy * @private */ Tilemap.prototype._drawAutotile = function (bitmap, tileId, dx, dy) { var autotileTable = Tilemap.FLOOR_AUTOTILE_TABLE; var kind = Tilemap.getAutotileKind(tileId); var shape = Tilemap.getAutotileShape(tileId); var tx = kind % 8; var ty = Math.floor(kind / 8); var bx = 0; var by = 0; var setNumber = 0; var isTable = false; if (Tilemap.isTileA1(tileId)) { var waterSurfaceIndex = [0, 1, 2, 1][this.animationFrame % 4]; setNumber = 0; if (kind === 0) { bx = waterSurfaceIndex * 2; by = 0; } else if (kind === 1) { bx = waterSurfaceIndex * 2; by = 3; } else if (kind === 2) { bx = 6; by = 0; } else if (kind === 3) { bx = 6; by = 3; } else { bx = Math.floor(tx / 4) * 8; by = ty * 6 + Math.floor(tx / 2) % 2 * 3; if (kind % 2 === 0) { bx += waterSurfaceIndex * 2; } else { bx += 6; autotileTable = Tilemap.WATERFALL_AUTOTILE_TABLE; by += this.animationFrame % 3; } } } else if (Tilemap.isTileA2(tileId)) { setNumber = 1; bx = tx * 2; by = (ty - 2) * 3; isTable = this._isTableTile(tileId); } else if (Tilemap.isTileA3(tileId)) { setNumber = 2; bx = tx * 2; by = (ty - 6) * 2; autotileTable = Tilemap.WALL_AUTOTILE_TABLE; } else if (Tilemap.isTileA4(tileId)) { setNumber = 3; bx = tx * 2; by = Math.floor((ty - 10) * 2.5 + (ty % 2 === 1 ? 0.5 : 0)); if (ty % 2 === 1) { autotileTable = Tilemap.WALL_AUTOTILE_TABLE; } } var table = autotileTable[shape]; var source = this.bitmaps[setNumber]; if (table && source) { var w1 = this._tileWidth / 2; var h1 = this._tileHeight / 2; for (var i = 0; i < 4; i++) { var qsx = table[i][0]; var qsy = table[i][1]; var sx1 = (bx * 2 + qsx) * w1; var sy1 = (by * 2 + qsy) * h1; var dx1 = dx + (i % 2) * w1; var dy1 = dy + Math.floor(i / 2) * h1; if (isTable && (qsy === 1 || qsy === 5)) { var qsx2 = qsx; var qsy2 = 3; if (qsy === 1) { qsx2 = [0, 3, 2, 1][qsx]; } var sx2 = (bx * 2 + qsx2) * w1; var sy2 = (by * 2 + qsy2) * h1; bitmap.bltImage(source, sx2, sy2, w1, h1, dx1, dy1, w1, h1); dy1 += h1 / 2; bitmap.bltImage(source, sx1, sy1, w1, h1 / 2, dx1, dy1, w1, h1 / 2); } else { bitmap.bltImage(source, sx1, sy1, w1, h1, dx1, dy1, w1, h1); } } } }; /** * @method _drawTableEdge * @param {Bitmap} bitmap * @param {Number} tileId * @param {Number} dx * @param {Number} dy * @private */ Tilemap.prototype._drawTableEdge = function (bitmap, tileId, dx, dy) { if (Tilemap.isTileA2(tileId)) { var autotileTable = Tilemap.FLOOR_AUTOTILE_TABLE; var kind = Tilemap.getAutotileKind(tileId); var shape = Tilemap.getAutotileShape(tileId); var tx = kind % 8; var ty = Math.floor(kind / 8); var setNumber = 1; var bx = tx * 2; var by = (ty - 2) * 3; var table = autotileTable[shape]; if (table) { var source = this.bitmaps[setNumber]; var w1 = this._tileWidth / 2; var h1 = this._tileHeight / 2; for (var i = 0; i < 2; i++) { var qsx = table[2 + i][0]; var qsy = table[2 + i][1]; var sx1 = (bx * 2 + qsx) * w1; var sy1 = (by * 2 + qsy) * h1 + h1 / 2; var dx1 = dx + (i % 2) * w1; var dy1 = dy + Math.floor(i / 2) * h1; bitmap.bltImage(source, sx1, sy1, w1, h1 / 2, dx1, dy1, w1, h1 / 2); } } } }; /** * @method _drawShadow * @param {Bitmap} bitmap * @param {Number} shadowBits * @param {Number} dx * @param {Number} dy * @private */ Tilemap.prototype._drawShadow = function (bitmap, shadowBits, dx, dy) { if (shadowBits & 0x0f) { var w1 = this._tileWidth / 2; var h1 = this._tileHeight / 2; var color = 'rgba(0,0,0,0.5)'; for (var i = 0; i < 4; i++) { if (shadowBits & (1 << i)) { var dx1 = dx + (i % 2) * w1; var dy1 = dy + Math.floor(i / 2) * h1; bitmap.fillRect(dx1, dy1, w1, h1, color); } } } }; /** * @method _readMapData * @param {Number} x * @param {Number} y * @param {Number} z * @return {Number} * @private */ Tilemap.prototype._readMapData = function (x, y, z) { if (this._mapData) { var width = this._mapWidth; var height = this._mapHeight; if (this.horizontalWrap) { x = x.mod(width); } if (this.verticalWrap) { y = y.mod(height); } if (x >= 0 && x < width && y >= 0 && y < height) { return this._mapData[(z * height + y) * width + x] || 0; } else { return 0; } } else { return 0; } }; /** * @method _isHigherTile * @param {Number} tileId * @return {Boolean} * @private */ Tilemap.prototype._isHigherTile = function (tileId) { return this.flags[tileId] & 0x10; }; /** * @method _isTableTile * @param {Number} tileId * @return {Boolean} * @private */ Tilemap.prototype._isTableTile = function (tileId) { return Tilemap.isTileA2(tileId) && (this.flags[tileId] & 0x80); }; /** * @method _isOverpassPosition * @param {Number} mx * @param {Number} my * @return {Boolean} * @private */ Tilemap.prototype._isOverpassPosition = function (mx, my) { return false; }; /** * @method _sortChildren * @private */ Tilemap.prototype._sortChildren = function () { this.children.sort(this._compareChildOrder.bind(this)); }; /** * @method _compareChildOrder * @param {Object} a * @param {Object} b * @private */ Tilemap.prototype._compareChildOrder = function (a, b) { if (a.z !== b.z) { return a.z - b.z; } else if (a.y !== b.y) { return a.y - b.y; } else { return a.spriteId - b.spriteId; } }; // Tile type checkers Tilemap.TILE_ID_B = 0; Tilemap.TILE_ID_C = 256; Tilemap.TILE_ID_D = 512; Tilemap.TILE_ID_E = 768; Tilemap.TILE_ID_A5 = 1536; Tilemap.TILE_ID_A1 = 2048; Tilemap.TILE_ID_A2 = 2816; Tilemap.TILE_ID_A3 = 4352; Tilemap.TILE_ID_A4 = 5888; Tilemap.TILE_ID_MAX = 8192; Tilemap.isVisibleTile = function (tileId) { return tileId > 0 && tileId < this.TILE_ID_MAX; }; Tilemap.isAutotile = function (tileId) { return tileId >= this.TILE_ID_A1; }; Tilemap.getAutotileKind = function (tileId) { return Math.floor((tileId - this.TILE_ID_A1) / 48); }; Tilemap.getAutotileShape = function (tileId) { return (tileId - this.TILE_ID_A1) % 48; }; Tilemap.makeAutotileId = function (kind, shape) { return this.TILE_ID_A1 + kind * 48 + shape; }; Tilemap.isSameKindTile = function (tileID1, tileID2) { if (this.isAutotile(tileID1) && this.isAutotile(tileID2)) { return this.getAutotileKind(tileID1) === this.getAutotileKind(tileID2); } else { return tileID1 === tileID2; } }; Tilemap.isTileA1 = function (tileId) { return tileId >= this.TILE_ID_A1 && tileId < this.TILE_ID_A2; }; Tilemap.isTileA2 = function (tileId) { return tileId >= this.TILE_ID_A2 && tileId < this.TILE_ID_A3; }; Tilemap.isTileA3 = function (tileId) { return tileId >= this.TILE_ID_A3 && tileId < this.TILE_ID_A4; }; Tilemap.isTileA4 = function (tileId) { return tileId >= this.TILE_ID_A4 && tileId < this.TILE_ID_MAX; }; Tilemap.isTileA5 = function (tileId) { return tileId >= this.TILE_ID_A5 && tileId < this.TILE_ID_A1; }; Tilemap.isWaterTile = function (tileId) { if (this.isTileA1(tileId)) { return !(tileId >= this.TILE_ID_A1 + 96 && tileId < this.TILE_ID_A1 + 192); } else { return false; } }; Tilemap.isWaterfallTile = function (tileId) { if (tileId >= this.TILE_ID_A1 + 192 && tileId < this.TILE_ID_A2) { return this.getAutotileKind(tileId) % 2 === 1; } else { return false; } }; Tilemap.isGroundTile = function (tileId) { return this.isTileA1(tileId) || this.isTileA2(tileId) || this.isTileA5(tileId); }; Tilemap.isShadowingTile = function (tileId) { return this.isTileA3(tileId) || this.isTileA4(tileId); }; Tilemap.isRoofTile = function (tileId) { return this.isTileA3(tileId) && this.getAutotileKind(tileId) % 16 < 8; }; Tilemap.isWallTopTile = function (tileId) { return this.isTileA4(tileId) && this.getAutotileKind(tileId) % 16 < 8; }; Tilemap.isWallSideTile = function (tileId) { return (this.isTileA3(tileId) || this.isTileA4(tileId)) && this.getAutotileKind(tileId) % 16 >= 8; }; Tilemap.isWallTile = function (tileId) { return this.isWallTopTile(tileId) || this.isWallSideTile(tileId); }; Tilemap.isFloorTypeAutotile = function (tileId) { return (this.isTileA1(tileId) && !this.isWaterfallTile(tileId)) || this.isTileA2(tileId) || this.isWallTopTile(tileId); }; Tilemap.isWallTypeAutotile = function (tileId) { return this.isRoofTile(tileId) || this.isWallSideTile(tileId); }; Tilemap.isWaterfallTypeAutotile = function (tileId) { return this.isWaterfallTile(tileId); }; // Autotile shape number to coordinates of tileset images Tilemap.FLOOR_AUTOTILE_TABLE = [ [[2, 4], [1, 4], [2, 3], [1, 3]], [[2, 0], [1, 4], [2, 3], [1, 3]], [[2, 4], [3, 0], [2, 3], [1, 3]], [[2, 0], [3, 0], [2, 3], [1, 3]], [[2, 4], [1, 4], [2, 3], [3, 1]], [[2, 0], [1, 4], [2, 3], [3, 1]], [[2, 4], [3, 0], [2, 3], [3, 1]], [[2, 0], [3, 0], [2, 3], [3, 1]], [[2, 4], [1, 4], [2, 1], [1, 3]], [[2, 0], [1, 4], [2, 1], [1, 3]], [[2, 4], [3, 0], [2, 1], [1, 3]], [[2, 0], [3, 0], [2, 1], [1, 3]], [[2, 4], [1, 4], [2, 1], [3, 1]], [[2, 0], [1, 4], [2, 1], [3, 1]], [[2, 4], [3, 0], [2, 1], [3, 1]], [[2, 0], [3, 0], [2, 1], [3, 1]], [[0, 4], [1, 4], [0, 3], [1, 3]], [[0, 4], [3, 0], [0, 3], [1, 3]], [[0, 4], [1, 4], [0, 3], [3, 1]], [[0, 4], [3, 0], [0, 3], [3, 1]], [[2, 2], [1, 2], [2, 3], [1, 3]], [[2, 2], [1, 2], [2, 3], [3, 1]], [[2, 2], [1, 2], [2, 1], [1, 3]], [[2, 2], [1, 2], [2, 1], [3, 1]], [[2, 4], [3, 4], [2, 3], [3, 3]], [[2, 4], [3, 4], [2, 1], [3, 3]], [[2, 0], [3, 4], [2, 3], [3, 3]], [[2, 0], [3, 4], [2, 1], [3, 3]], [[2, 4], [1, 4], [2, 5], [1, 5]], [[2, 0], [1, 4], [2, 5], [1, 5]], [[2, 4], [3, 0], [2, 5], [1, 5]], [[2, 0], [3, 0], [2, 5], [1, 5]], [[0, 4], [3, 4], [0, 3], [3, 3]], [[2, 2], [1, 2], [2, 5], [1, 5]], [[0, 2], [1, 2], [0, 3], [1, 3]], [[0, 2], [1, 2], [0, 3], [3, 1]], [[2, 2], [3, 2], [2, 3], [3, 3]], [[2, 2], [3, 2], [2, 1], [3, 3]], [[2, 4], [3, 4], [2, 5], [3, 5]], [[2, 0], [3, 4], [2, 5], [3, 5]], [[0, 4], [1, 4], [0, 5], [1, 5]], [[0, 4], [3, 0], [0, 5], [1, 5]], [[0, 2], [3, 2], [0, 3], [3, 3]], [[0, 2], [1, 2], [0, 5], [1, 5]], [[0, 4], [3, 4], [0, 5], [3, 5]], [[2, 2], [3, 2], [2, 5], [3, 5]], [[0, 2], [3, 2], [0, 5], [3, 5]], [[0, 0], [1, 0], [0, 1], [1, 1]] ]; Tilemap.WALL_AUTOTILE_TABLE = [ [[2, 2], [1, 2], [2, 1], [1, 1]], [[0, 2], [1, 2], [0, 1], [1, 1]], [[2, 0], [1, 0], [2, 1], [1, 1]], [[0, 0], [1, 0], [0, 1], [1, 1]], [[2, 2], [3, 2], [2, 1], [3, 1]], [[0, 2], [3, 2], [0, 1], [3, 1]], [[2, 0], [3, 0], [2, 1], [3, 1]], [[0, 0], [3, 0], [0, 1], [3, 1]], [[2, 2], [1, 2], [2, 3], [1, 3]], [[0, 2], [1, 2], [0, 3], [1, 3]], [[2, 0], [1, 0], [2, 3], [1, 3]], [[0, 0], [1, 0], [0, 3], [1, 3]], [[2, 2], [3, 2], [2, 3], [3, 3]], [[0, 2], [3, 2], [0, 3], [3, 3]], [[2, 0], [3, 0], [2, 3], [3, 3]], [[0, 0], [3, 0], [0, 3], [3, 3]] ]; Tilemap.WATERFALL_AUTOTILE_TABLE = [ [[2, 0], [1, 0], [2, 1], [1, 1]], [[0, 0], [1, 0], [0, 1], [1, 1]], [[2, 0], [3, 0], [2, 1], [3, 1]], [[0, 0], [3, 0], [0, 1], [3, 1]] ]; // The important members from Pixi.js /** * [read-only] The array of children of the tilemap. * * @property children * @type Array */ /** * [read-only] The object that contains the tilemap. * * @property parent * @type Object */ /** * Adds a child to the container. * * @method addChild * @param {Object} child The child to add * @return {Object} The child that was added */ /** * Adds a child to the container at a specified index. * * @method addChildAt * @param {Object} child The child to add * @param {Number} index The index to place the child in * @return {Object} The child that was added */ /** * Removes a child from the container. * * @method removeChild * @param {Object} child The child to remove * @return {Object} The child that was removed */ /** * Removes a child from the specified index position. * * @method removeChildAt * @param {Number} index The index to get the child from * @return {Object} The child that was removed */ //----------------------------------------------------------------------------- /** * The tilemap which displays 2D tile-based game map using shaders * * @class Tilemap * @constructor */ function ShaderTilemap() { Tilemap.apply(this, arguments); this.roundPixels = true; } ShaderTilemap.prototype = Object.create(Tilemap.prototype); ShaderTilemap.prototype.constructor = ShaderTilemap; // we need this constant for some platforms (Samsung S4, S5, Tab4, HTC One H8) PIXI.glCore.VertexArrayObject.FORCE_NATIVE = true; PIXI.settings.GC_MODE = PIXI.GC_MODES.AUTO; PIXI.tilemap.TileRenderer.SCALE_MODE = PIXI.SCALE_MODES.NEAREST; PIXI.tilemap.TileRenderer.DO_CLEAR = true; /** * Uploads animation state in renderer * * @method _hackRenderer * @private */ ShaderTilemap.prototype._hackRenderer = function (renderer) { var af = this.animationFrame % 4; if (af == 3) af = 1; renderer.plugins.tilemap.tileAnim[0] = af * this._tileWidth; renderer.plugins.tilemap.tileAnim[1] = (this.animationFrame % 3) * this._tileHeight; return renderer; }; /** * PIXI render method * * @method renderCanvas * @param {Object} pixi renderer */ ShaderTilemap.prototype.renderCanvas = function (renderer) { this._hackRenderer(renderer); PIXI.Container.prototype.renderCanvas.call(this, renderer); }; /** * PIXI render method * * @method renderWebGL * @param {Object} pixi renderer */ ShaderTilemap.prototype.renderWebGL = function (renderer) { this._hackRenderer(renderer); PIXI.Container.prototype.renderWebGL.call(this, renderer); }; /** * Forces to repaint the entire tilemap AND update bitmaps list if needed * * @method refresh */ ShaderTilemap.prototype.refresh = function () { if (this._lastBitmapLength !== this.bitmaps.length) { this._lastBitmapLength = this.bitmaps.length; this.refreshTileset(); }; this._needsRepaint = true; }; /** * Call after you update tileset * * @method updateBitmaps */ ShaderTilemap.prototype.refreshTileset = function () { var bitmaps = this.bitmaps.map(function (x) { return x._baseTexture ? new PIXI.Texture(x._baseTexture) : x; }); this.lowerLayer.setBitmaps(bitmaps); this.upperLayer.setBitmaps(bitmaps); }; /** * @method updateTransform * @private */ ShaderTilemap.prototype.updateTransform = function () { if (this.roundPixels) { var ox = Math.floor(this.origin.x); var oy = Math.floor(this.origin.y); } else { ox = this.origin.x; oy = this.origin.y; } var startX = Math.floor((ox - this._margin) / this._tileWidth); var startY = Math.floor((oy - this._margin) / this._tileHeight); this._updateLayerPositions(startX, startY); if (this._needsRepaint || this._lastStartX !== startX || this._lastStartY !== startY) { this._lastStartX = startX; this._lastStartY = startY; this._paintAllTiles(startX, startY); this._needsRepaint = false; } this._sortChildren(); PIXI.Container.prototype.updateTransform.call(this); }; /** * @method _createLayers * @private */ ShaderTilemap.prototype._createLayers = function () { var width = this._width; var height = this._height; var margin = this._margin; var tileCols = Math.ceil(width / this._tileWidth) + 1; var tileRows = Math.ceil(height / this._tileHeight) + 1; var layerWidth = this._layerWidth = tileCols * this._tileWidth; var layerHeight = this._layerHeight = tileRows * this._tileHeight; this._needsRepaint = true; if (!this.lowerZLayer) { //@hackerham: create layers only in initialization. Doesn't depend on width/height this.addChild(this.lowerZLayer = new PIXI.tilemap.ZLayer(this, 0)); this.addChild(this.upperZLayer = new PIXI.tilemap.ZLayer(this, 4)); var parameters = PluginManager.parameters('ShaderTilemap'); var useSquareShader = Number(parameters.hasOwnProperty('squareShader') ? parameters['squareShader'] : 0); this.lowerZLayer.addChild(this.lowerLayer = new PIXI.tilemap.CompositeRectTileLayer(0, [], useSquareShader)); this.lowerLayer.shadowColor = new Float32Array([0.0, 0.0, 0.0, 0.5]); this.upperZLayer.addChild(this.upperLayer = new PIXI.tilemap.CompositeRectTileLayer(4, [], useSquareShader)); } }; /** * @method _updateLayerPositions * @param {Number} startX * @param {Number} startY * @private */ ShaderTilemap.prototype._updateLayerPositions = function (startX, startY) { if (this.roundPixels) { var ox = Math.floor(this.origin.x); var oy = Math.floor(this.origin.y); } else { ox = this.origin.x; oy = this.origin.y; } this.lowerZLayer.position.x = startX * this._tileWidth - ox; this.lowerZLayer.position.y = startY * this._tileHeight - oy; this.upperZLayer.position.x = startX * this._tileWidth - ox; this.upperZLayer.position.y = startY * this._tileHeight - oy; }; /** * @method _paintAllTiles * @param {Number} startX * @param {Number} startY * @private */ ShaderTilemap.prototype._paintAllTiles = function (startX, startY) { this.lowerZLayer.clear(); this.upperZLayer.clear(); var tileCols = Math.ceil(this._width / this._tileWidth) + 1; var tileRows = Math.ceil(this._height / this._tileHeight) + 1; for (var y = 0; y < tileRows; y++) { for (var x = 0; x < tileCols; x++) { this._paintTiles(startX, startY, x, y); } } }; /** * @method _paintTiles * @param {Number} startX * @param {Number} startY * @param {Number} x * @param {Number} y * @private */ ShaderTilemap.prototype._paintTiles = function (startX, startY, x, y) { var mx = startX + x; var my = startY + y; var dx = x * this._tileWidth, dy = y * this._tileHeight; var tileId0 = this._readMapData(mx, my, 0); var tileId1 = this._readMapData(mx, my, 1); var tileId2 = this._readMapData(mx, my, 2); var tileId3 = this._readMapData(mx, my, 3); var shadowBits = this._readMapData(mx, my, 4); var upperTileId1 = this._readMapData(mx, my - 1, 1); var lowerLayer = this.lowerLayer.children[0]; var upperLayer = this.upperLayer.children[0]; if (this._isHigherTile(tileId0)) { this._drawTile(upperLayer, tileId0, dx, dy); } else { this._drawTile(lowerLayer, tileId0, dx, dy); } if (this._isHigherTile(tileId1)) { this._drawTile(upperLayer, tileId1, dx, dy); } else { this._drawTile(lowerLayer, tileId1, dx, dy); } this._drawShadow(lowerLayer, shadowBits, dx, dy); if (this._isTableTile(upperTileId1) && !this._isTableTile(tileId1)) { if (!Tilemap.isShadowingTile(tileId0)) { this._drawTableEdge(lowerLayer, upperTileId1, dx, dy); } } if (this._isOverpassPosition(mx, my)) { this._drawTile(upperLayer, tileId2, dx, dy); this._drawTile(upperLayer, tileId3, dx, dy); } else { if (this._isHigherTile(tileId2)) { this._drawTile(upperLayer, tileId2, dx, dy); } else { this._drawTile(lowerLayer, tileId2, dx, dy); } if (this._isHigherTile(tileId3)) { this._drawTile(upperLayer, tileId3, dx, dy); } else { this._drawTile(lowerLayer, tileId3, dx, dy); } } }; /** * @method _drawTile * @param {Array} layers * @param {Number} tileId * @param {Number} dx * @param {Number} dy * @private */ ShaderTilemap.prototype._drawTile = function (layer, tileId, dx, dy) { if (Tilemap.isVisibleTile(tileId)) { if (Tilemap.isAutotile(tileId)) { this._drawAutotile(layer, tileId, dx, dy); } else { this._drawNormalTile(layer, tileId, dx, dy); } } }; /** * @method _drawNormalTile * @param {Array} layers * @param {Number} tileId * @param {Number} dx * @param {Number} dy * @private */ ShaderTilemap.prototype._drawNormalTile = function (layer, tileId, dx, dy) { var setNumber = 0; if (Tilemap.isTileA5(tileId)) { setNumber = 4; } else { setNumber = 5 + Math.floor(tileId / 256); } var w = this._tileWidth; var h = this._tileHeight; var sx = (Math.floor(tileId / 128) % 2 * 8 + tileId % 8) * w; var sy = (Math.floor(tileId % 256 / 8) % 16) * h; layer.addRect(setNumber, sx, sy, dx, dy, w, h); }; /** * @method _drawAutotile * @param {Array} layers * @param {Number} tileId * @param {Number} dx * @param {Number} dy * @private */ ShaderTilemap.prototype._drawAutotile = function (layer, tileId, dx, dy) { var autotileTable = Tilemap.FLOOR_AUTOTILE_TABLE; var kind = Tilemap.getAutotileKind(tileId); var shape = Tilemap.getAutotileShape(tileId); var tx = kind % 8; var ty = Math.floor(kind / 8); var bx = 0; var by = 0; var setNumber = 0; var isTable = false; var animX = 0, animY = 0; if (Tilemap.isTileA1(tileId)) { setNumber = 0; if (kind === 0) { animX = 2; by = 0; } else if (kind === 1) { animX = 2; by = 3; } else if (kind === 2) { bx = 6; by = 0; } else if (kind === 3) { bx = 6; by = 3; } else { bx = Math.floor(tx / 4) * 8; by = ty * 6 + Math.floor(tx / 2) % 2 * 3; if (kind % 2 === 0) { animX = 2; } else { bx += 6; autotileTable = Tilemap.WATERFALL_AUTOTILE_TABLE; animY = 1; } } } else if (Tilemap.isTileA2(tileId)) { setNumber = 1; bx = tx * 2; by = (ty - 2) * 3; isTable = this._isTableTile(tileId); } else if (Tilemap.isTileA3(tileId)) { setNumber = 2; bx = tx * 2; by = (ty - 6) * 2; autotileTable = Tilemap.WALL_AUTOTILE_TABLE; } else if (Tilemap.isTileA4(tileId)) { setNumber = 3; bx = tx * 2; by = Math.floor((ty - 10) * 2.5 + (ty % 2 === 1 ? 0.5 : 0)); if (ty % 2 === 1) { autotileTable = Tilemap.WALL_AUTOTILE_TABLE; } } var table = autotileTable[shape]; var w1 = this._tileWidth / 2; var h1 = this._tileHeight / 2; for (var i = 0; i < 4; i++) { var qsx = table[i][0]; var qsy = table[i][1]; var sx1 = (bx * 2 + qsx) * w1; var sy1 = (by * 2 + qsy) * h1; var dx1 = dx + (i % 2) * w1; var dy1 = dy + Math.floor(i / 2) * h1; if (isTable && (qsy === 1 || qsy === 5)) { var qsx2 = qsx; var qsy2 = 3; if (qsy === 1) { //qsx2 = [0, 3, 2, 1][qsx]; qsx2 = (4 - qsx) % 4; } var sx2 = (bx * 2 + qsx2) * w1; var sy2 = (by * 2 + qsy2) * h1; layer.addRect(setNumber, sx2, sy2, dx1, dy1, w1, h1, animX, animY); layer.addRect(setNumber, sx1, sy1, dx1, dy1 + h1 / 2, w1, h1 / 2, animX, animY); } else { layer.addRect(setNumber, sx1, sy1, dx1, dy1, w1, h1, animX, animY); } } }; /** * @method _drawTableEdge * @param {Array} layers * @param {Number} tileId * @param {Number} dx * @param {Number} dy * @private */ ShaderTilemap.prototype._drawTableEdge = function (layer, tileId, dx, dy) { if (Tilemap.isTileA2(tileId)) { var autotileTable = Tilemap.FLOOR_AUTOTILE_TABLE; var kind = Tilemap.getAutotileKind(tileId); var shape = Tilemap.getAutotileShape(tileId); var tx = kind % 8; var ty = Math.floor(kind / 8); var setNumber = 1; var bx = tx * 2; var by = (ty - 2) * 3; var table = autotileTable[shape]; var w1 = this._tileWidth / 2; var h1 = this._tileHeight / 2; for (var i = 0; i < 2; i++) { var qsx = table[2 + i][0]; var qsy = table[2 + i][1]; var sx1 = (bx * 2 + qsx) * w1; var sy1 = (by * 2 + qsy) * h1 + h1 / 2; var dx1 = dx + (i % 2) * w1; var dy1 = dy + Math.floor(i / 2) * h1; layer.addRect(setNumber, sx1, sy1, dx1, dy1, w1, h1 / 2); } } }; /** * @method _drawShadow * @param {Number} shadowBits * @param {Number} dx * @param {Number} dy * @private */ ShaderTilemap.prototype._drawShadow = function (layer, shadowBits, dx, dy) { if (shadowBits & 0x0f) { var w1 = this._tileWidth / 2; var h1 = this._tileHeight / 2; for (var i = 0; i < 4; i++) { if (shadowBits & (1 << i)) { var dx1 = dx + (i % 2) * w1; var dy1 = dy + Math.floor(i / 2) * h1; layer.addRect(-1, 0, 0, dx1, dy1, w1, h1); } } } }; //----------------------------------------------------------------------------- /** * The sprite object for a tiling image. * * @class TilingSprite * @constructor * @param {Bitmap} bitmap The image for the tiling sprite */ function TilingSprite() { this.initialize.apply(this, arguments); } TilingSprite.prototype = Object.create(PIXI.extras.PictureTilingSprite.prototype); TilingSprite.prototype.constructor = TilingSprite; TilingSprite.prototype.initialize = function (bitmap) { var texture = new PIXI.Texture(new PIXI.BaseTexture()); PIXI.extras.PictureTilingSprite.call(this, texture); this._bitmap = null; this._width = 0; this._height = 0; this._frame = new Rectangle(); this.spriteId = Sprite._counter++; /** * The origin point of the tiling sprite for scrolling. * * @property origin * @type Point */ this.origin = new Point(); this.bitmap = bitmap; }; TilingSprite.prototype._renderCanvas_PIXI = PIXI.extras.PictureTilingSprite.prototype._renderCanvas; TilingSprite.prototype._renderWebGL_PIXI = PIXI.extras.PictureTilingSprite.prototype._renderWebGL; /** * @method _renderCanvas * @param {Object} renderer * @private */ TilingSprite.prototype._renderCanvas = function (renderer) { if (this._bitmap) { this._bitmap.touch(); } if (this.texture.frame.width > 0 && this.texture.frame.height > 0) { this._renderCanvas_PIXI(renderer); } }; /** * @method _renderWebGL * @param {Object} renderer * @private */ TilingSprite.prototype._renderWebGL = function (renderer) { if (this._bitmap) { this._bitmap.touch(); } if (this.texture.frame.width > 0 && this.texture.frame.height > 0) { if (this._bitmap) { this._bitmap.checkDirty(); } this._renderWebGL_PIXI(renderer); } }; /** * The image for the tiling sprite. * * @property bitmap * @type Bitmap */ Object.defineProperty(TilingSprite.prototype, 'bitmap', { get: function () { return this._bitmap; }, set: function (value) { if (this._bitmap !== value) { this._bitmap = value; if (this._bitmap) { this._bitmap.addLoadListener(this._onBitmapLoad.bind(this)); } else { this.texture.frame = Rectangle.emptyRectangle; } } }, configurable: true }); /** * The opacity of the tiling sprite (0 to 255). * * @property opacity * @type Number */ Object.defineProperty(TilingSprite.prototype, 'opacity', { get: function () { return this.alpha * 255; }, set: function (value) { this.alpha = value.clamp(0, 255) / 255; }, configurable: true }); /** * Updates the tiling sprite for each frame. * * @method update */ TilingSprite.prototype.update = function () { this.children.forEach(function (child) { if (child.update) { child.update(); } }); }; /** * Sets the x, y, width, and height all at once. * * @method move * @param {Number} x The x coordinate of the tiling sprite * @param {Number} y The y coordinate of the tiling sprite * @param {Number} width The width of the tiling sprite * @param {Number} height The height of the tiling sprite */ TilingSprite.prototype.move = function (x, y, width, height) { this.x = x || 0; this.y = y || 0; this._width = width || 0; this._height = height || 0; }; /** * Specifies the region of the image that the tiling sprite will use. * * @method setFrame * @param {Number} x The x coordinate of the frame * @param {Number} y The y coordinate of the frame * @param {Number} width The width of the frame * @param {Number} height The height of the frame */ TilingSprite.prototype.setFrame = function (x, y, width, height) { this._frame.x = x; this._frame.y = y; this._frame.width = width; this._frame.height = height; this._refresh(); }; /** * @method updateTransform * @private */ TilingSprite.prototype.updateTransform = function () { this.tilePosition.x = Math.round(-this.origin.x); this.tilePosition.y = Math.round(-this.origin.y); this.updateTransformTS(); }; TilingSprite.prototype.updateTransformTS = PIXI.extras.TilingSprite.prototype.updateTransform; /** * @method _onBitmapLoad * @private */ TilingSprite.prototype._onBitmapLoad = function () { this.texture.baseTexture = this._bitmap.baseTexture; this._refresh(); }; /** * @method _refresh * @private */ TilingSprite.prototype._refresh = function () { var frame = this._frame.clone(); if (frame.width === 0 && frame.height === 0 && this._bitmap) { frame.width = this._bitmap.width; frame.height = this._bitmap.height; } this.texture.frame = frame; this.texture._updateID++; this.tilingTexture = null; }; TilingSprite.prototype._speedUpCustomBlendModes = Sprite.prototype._speedUpCustomBlendModes; /** * @method _renderWebGL * @param {Object} renderer * @private */ TilingSprite.prototype._renderWebGL = function (renderer) { if (this._bitmap) { this._bitmap.touch(); this._bitmap.checkDirty(); } this._speedUpCustomBlendModes(renderer); this._renderWebGL_PIXI(renderer); }; // The important members from Pixi.js /** * The visibility of the tiling sprite. * * @property visible * @type Boolean */ /** * The x coordinate of the tiling sprite. * * @property x * @type Number */ /** * The y coordinate of the tiling sprite. * * @property y * @type Number */ //----------------------------------------------------------------------------- /** * The sprite which covers the entire game screen. * * @class ScreenSprite * @constructor */ function ScreenSprite() { this.initialize.apply(this, arguments); } ScreenSprite.prototype = Object.create(PIXI.Container.prototype); ScreenSprite.prototype.constructor = ScreenSprite; ScreenSprite.prototype.initialize = function () { PIXI.Container.call(this); this._graphics = new PIXI.Graphics(); this.addChild(this._graphics); this.opacity = 0; this._red = -1; this._green = -1; this._blue = -1; this._colorText = ''; this.setBlack(); }; /** * The opacity of the sprite (0 to 255). * * @property opacity * @type Number */ Object.defineProperty(ScreenSprite.prototype, 'opacity', { get: function () { return this.alpha * 255; }, set: function (value) { this.alpha = value.clamp(0, 255) / 255; }, configurable: true }); ScreenSprite.YEPWarned = false; ScreenSprite.warnYep = function () { if (!ScreenSprite.YEPWarned) { console.log("Deprecation warning. Please update YEP_CoreEngine. ScreenSprite is not a sprite, it has graphics inside."); ScreenSprite.YEPWarned = true; } }; Object.defineProperty(ScreenSprite.prototype, 'anchor', { get: function () { ScreenSprite.warnYep(); this.scale.x = 1; this.scale.y = 1; return { x: 0, y: 0 }; }, set: function (value) { this.alpha = value.clamp(0, 255) / 255; }, configurable: true }); Object.defineProperty(ScreenSprite.prototype, 'blendMode', { get: function () { return this._graphics.blendMode; }, set: function (value) { this._graphics.blendMode = value; }, configurable: true }); /** * Sets black to the color of the screen sprite. * * @method setBlack */ ScreenSprite.prototype.setBlack = function () { this.setColor(0, 0, 0); }; /** * Sets white to the color of the screen sprite. * * @method setWhite */ ScreenSprite.prototype.setWhite = function () { this.setColor(255, 255, 255); }; /** * Sets the color of the screen sprite by values. * * @method setColor * @param {Number} r The red value in the range (0, 255) * @param {Number} g The green value in the range (0, 255) * @param {Number} b The blue value in the range (0, 255) */ ScreenSprite.prototype.setColor = function (r, g, b) { if (this._red !== r || this._green !== g || this._blue !== b) { r = Math.round(r || 0).clamp(0, 255); g = Math.round(g || 0).clamp(0, 255); b = Math.round(b || 0).clamp(0, 255); this._red = r; this._green = g; this._blue = b; this._colorText = Utils.rgbToCssColor(r, g, b); var graphics = this._graphics; graphics.clear(); var intColor = (r << 16) | (g << 8) | b; graphics.beginFill(intColor, 1); //whole screen with zoom. BWAHAHAHAHA graphics.drawRect(-Graphics.width * 5, -Graphics.height * 5, Graphics.width * 10, Graphics.height * 10); } }; //----------------------------------------------------------------------------- /** * The window in the game. * * @class Window * @constructor */ function Window() { this.initialize.apply(this, arguments); } Window.prototype = Object.create(PIXI.Container.prototype); Window.prototype.constructor = Window; Window.prototype.initialize = function () { PIXI.Container.call(this); this._isWindow = true; this._windowskin = null; this._width = 0; this._height = 0; this._cursorRect = new Rectangle(); this._openness = 255; this._animationCount = 0; this._padding = 18; this._margin = 4; this._colorTone = [0, 0, 0]; this._windowSpriteContainer = null; this._windowBackSprite = null; this._windowCursorSprite = null; this._windowFrameSprite = null; this._windowContentsSprite = null; this._windowArrowSprites = []; this._windowPauseSignSprite = null; this._createAllParts(); /** * The origin point of the window for scrolling. * * @property origin * @type Point */ this.origin = new Point(); /** * The active state for the window. * * @property active * @type Boolean */ this.active = true; /** * The visibility of the down scroll arrow. * * @property downArrowVisible * @type Boolean */ this.downArrowVisible = false; /** * The visibility of the up scroll arrow. * * @property upArrowVisible * @type Boolean */ this.upArrowVisible = false; /** * The visibility of the pause sign. * * @property pause * @type Boolean */ this.pause = false; }; /** * The image used as a window skin. * * @property windowskin * @type Bitmap */ Object.defineProperty(Window.prototype, 'windowskin', { get: function () { return this._windowskin; }, set: function (value) { if (this._windowskin !== value) { this._windowskin = value; this._windowskin.addLoadListener(this._onWindowskinLoad.bind(this)); } }, configurable: true }); /** * The bitmap used for the window contents. * * @property contents * @type Bitmap */ Object.defineProperty(Window.prototype, 'contents', { get: function () { return this._windowContentsSprite.bitmap; }, set: function (value) { this._windowContentsSprite.bitmap = value; }, configurable: true }); /** * The width of the window in pixels. * * @property width * @type Number */ Object.defineProperty(Window.prototype, 'width', { get: function () { return this._width; }, set: function (value) { this._width = value; this._refreshAllParts(); }, configurable: true }); /** * The height of the window in pixels. * * @property height * @type Number */ Object.defineProperty(Window.prototype, 'height', { get: function () { return this._height; }, set: function (value) { this._height = value; this._refreshAllParts(); }, configurable: true }); /** * The size of the padding between the frame and contents. * * @property padding * @type Number */ Object.defineProperty(Window.prototype, 'padding', { get: function () { return this._padding; }, set: function (value) { this._padding = value; this._refreshAllParts(); }, configurable: true }); /** * The size of the margin for the window background. * * @property margin * @type Number */ Object.defineProperty(Window.prototype, 'margin', { get: function () { return this._margin; }, set: function (value) { this._margin = value; this._refreshAllParts(); }, configurable: true }); /** * The opacity of the window without contents (0 to 255). * * @property opacity * @type Number */ Object.defineProperty(Window.prototype, 'opacity', { get: function () { return this._windowSpriteContainer.alpha * 255; }, set: function (value) { this._windowSpriteContainer.alpha = value.clamp(0, 255) / 255; }, configurable: true }); /** * The opacity of the window background (0 to 255). * * @property backOpacity * @type Number */ Object.defineProperty(Window.prototype, 'backOpacity', { get: function () { return this._windowBackSprite.alpha * 255; }, set: function (value) { this._windowBackSprite.alpha = value.clamp(0, 255) / 255; }, configurable: true }); /** * The opacity of the window contents (0 to 255). * * @property contentsOpacity * @type Number */ Object.defineProperty(Window.prototype, 'contentsOpacity', { get: function () { return this._windowContentsSprite.alpha * 255; }, set: function (value) { this._windowContentsSprite.alpha = value.clamp(0, 255) / 255; }, configurable: true }); /** * The openness of the window (0 to 255). * * @property openness * @type Number */ Object.defineProperty(Window.prototype, 'openness', { get: function () { return this._openness; }, set: function (value) { if (this._openness !== value) { this._openness = value.clamp(0, 255); this._windowSpriteContainer.scale.y = this._openness / 255; this._windowSpriteContainer.y = this.height / 2 * (1 - this._openness / 255); } }, configurable: true }); /** * Updates the window for each frame. * * @method update */ Window.prototype.update = function () { if (this.active) { this._animationCount++; } this.children.forEach(function (child) { if (child.update) { child.update(); } }); }; /** * Sets the x, y, width, and height all at once. * * @method move * @param {Number} x The x coordinate of the window * @param {Number} y The y coordinate of the window * @param {Number} width The width of the window * @param {Number} height The height of the window */ Window.prototype.move = function (x, y, width, height) { this.x = x || 0; this.y = y || 0; if (this._width !== width || this._height !== height) { this._width = width || 0; this._height = height || 0; this._refreshAllParts(); } }; /** * Returns true if the window is completely open (openness == 255). * * @method isOpen */ Window.prototype.isOpen = function () { return this._openness >= 255; }; /** * Returns true if the window is completely closed (openness == 0). * * @method isClosed */ Window.prototype.isClosed = function () { return this._openness <= 0; }; /** * Sets the position of the command cursor. * * @method setCursorRect * @param {Number} x The x coordinate of the cursor * @param {Number} y The y coordinate of the cursor * @param {Number} width The width of the cursor * @param {Number} height The height of the cursor */ Window.prototype.setCursorRect = function (x, y, width, height) { var cx = Math.floor(x || 0); var cy = Math.floor(y || 0); var cw = Math.floor(width || 0); var ch = Math.floor(height || 0); var rect = this._cursorRect; if (rect.x !== cx || rect.y !== cy || rect.width !== cw || rect.height !== ch) { this._cursorRect.x = cx; this._cursorRect.y = cy; this._cursorRect.width = cw; this._cursorRect.height = ch; this._refreshCursor(); } }; /** * Changes the color of the background. * * @method setTone * @param {Number} r The red value in the range (-255, 255) * @param {Number} g The green value in the range (-255, 255) * @param {Number} b The blue value in the range (-255, 255) */ Window.prototype.setTone = function (r, g, b) { var tone = this._colorTone; if (r !== tone[0] || g !== tone[1] || b !== tone[2]) { this._colorTone = [r, g, b]; this._refreshBack(); } }; /** * Adds a child between the background and contents. * * @method addChildToBack * @param {Object} child The child to add * @return {Object} The child that was added */ Window.prototype.addChildToBack = function (child) { var containerIndex = this.children.indexOf(this._windowSpriteContainer); return this.addChildAt(child, containerIndex + 1); }; /** * @method updateTransform * @private */ Window.prototype.updateTransform = function () { this._updateCursor(); this._updateArrows(); this._updatePauseSign(); this._updateContents(); PIXI.Container.prototype.updateTransform.call(this); }; /** * @method _createAllParts * @private */ Window.prototype._createAllParts = function () { this._windowSpriteContainer = new PIXI.Container(); this._windowBackSprite = new Sprite(); this._windowCursorSprite = new Sprite(); this._windowFrameSprite = new Sprite(); this._windowContentsSprite = new Sprite(); this._downArrowSprite = new Sprite(); this._upArrowSprite = new Sprite(); this._windowPauseSignSprite = new Sprite(); this._windowBackSprite.bitmap = new Bitmap(1, 1); this._windowBackSprite.alpha = 192 / 255; this.addChild(this._windowSpriteContainer); this._windowSpriteContainer.addChild(this._windowBackSprite); this._windowSpriteContainer.addChild(this._windowFrameSprite); this.addChild(this._windowCursorSprite); this.addChild(this._windowContentsSprite); this.addChild(this._downArrowSprite); this.addChild(this._upArrowSprite); this.addChild(this._windowPauseSignSprite); }; /** * @method _onWindowskinLoad * @private */ Window.prototype._onWindowskinLoad = function () { this._refreshAllParts(); }; /** * @method _refreshAllParts * @private */ Window.prototype._refreshAllParts = function () { this._refreshBack(); this._refreshFrame(); this._refreshCursor(); this._refreshContents(); this._refreshArrows(); this._refreshPauseSign(); }; /** * @method _refreshBack * @private */ Window.prototype._refreshBack = function () { var m = this._margin; var w = this._width - m * 2; var h = this._height - m * 2; var bitmap = new Bitmap(w, h); this._windowBackSprite.bitmap = bitmap; this._windowBackSprite.setFrame(0, 0, w, h); this._windowBackSprite.move(m, m); if (w > 0 && h > 0 && this._windowskin) { var p = 96; bitmap.blt(this._windowskin, 0, 0, p, p, 0, 0, w, h); for (var y = 0; y < h; y += p) { for (var x = 0; x < w; x += p) { bitmap.blt(this._windowskin, 0, p, p, p, x, y, p, p); } } var tone = this._colorTone; bitmap.adjustTone(tone[0], tone[1], tone[2]); } }; /** * @method _refreshFrame * @private */ Window.prototype._refreshFrame = function () { var w = this._width; var h = this._height; var m = 24; var bitmap = new Bitmap(w, h); this._windowFrameSprite.bitmap = bitmap; this._windowFrameSprite.setFrame(0, 0, w, h); if (w > 0 && h > 0 && this._windowskin) { var skin = this._windowskin; var p = 96; var q = 96; bitmap.blt(skin, p + m, 0 + 0, p - m * 2, m, m, 0, w - m * 2, m); bitmap.blt(skin, p + m, 0 + q - m, p - m * 2, m, m, h - m, w - m * 2, m); bitmap.blt(skin, p + 0, 0 + m, m, p - m * 2, 0, m, m, h - m * 2); bitmap.blt(skin, p + q - m, 0 + m, m, p - m * 2, w - m, m, m, h - m * 2); bitmap.blt(skin, p + 0, 0 + 0, m, m, 0, 0, m, m); bitmap.blt(skin, p + q - m, 0 + 0, m, m, w - m, 0, m, m); bitmap.blt(skin, p + 0, 0 + q - m, m, m, 0, h - m, m, m); bitmap.blt(skin, p + q - m, 0 + q - m, m, m, w - m, h - m, m, m); } }; /** * @method _refreshCursor * @private */ Window.prototype._refreshCursor = function () { var pad = this._padding; var x = this._cursorRect.x + pad - this.origin.x; var y = this._cursorRect.y + pad - this.origin.y; var w = this._cursorRect.width; var h = this._cursorRect.height; var m = 4; var x2 = Math.max(x, pad); var y2 = Math.max(y, pad); var ox = x - x2; var oy = y - y2; var w2 = Math.min(w, this._width - pad - x2); var h2 = Math.min(h, this._height - pad - y2); var bitmap = new Bitmap(w2, h2); this._windowCursorSprite.bitmap = bitmap; this._windowCursorSprite.setFrame(0, 0, w2, h2); this._windowCursorSprite.move(x2, y2); if (w > 0 && h > 0 && this._windowskin) { var skin = this._windowskin; var p = 96; var q = 48; bitmap.blt(skin, p + m, p + m, q - m * 2, q - m * 2, ox + m, oy + m, w - m * 2, h - m * 2); bitmap.blt(skin, p + m, p + 0, q - m * 2, m, ox + m, oy + 0, w - m * 2, m); bitmap.blt(skin, p + m, p + q - m, q - m * 2, m, ox + m, oy + h - m, w - m * 2, m); bitmap.blt(skin, p + 0, p + m, m, q - m * 2, ox + 0, oy + m, m, h - m * 2); bitmap.blt(skin, p + q - m, p + m, m, q - m * 2, ox + w - m, oy + m, m, h - m * 2); bitmap.blt(skin, p + 0, p + 0, m, m, ox + 0, oy + 0, m, m); bitmap.blt(skin, p + q - m, p + 0, m, m, ox + w - m, oy + 0, m, m); bitmap.blt(skin, p + 0, p + q - m, m, m, ox + 0, oy + h - m, m, m); bitmap.blt(skin, p + q - m, p + q - m, m, m, ox + w - m, oy + h - m, m, m); } }; /** * @method _refreshContents * @private */ Window.prototype._refreshContents = function () { this._windowContentsSprite.move(this.padding, this.padding); }; /** * @method _refreshArrows * @private */ Window.prototype._refreshArrows = function () { var w = this._width; var h = this._height; var p = 24; var q = p / 2; var sx = 96 + p; var sy = 0 + p; this._downArrowSprite.bitmap = this._windowskin; this._downArrowSprite.anchor.x = 0.5; this._downArrowSprite.anchor.y = 0.5; this._downArrowSprite.setFrame(sx + q, sy + q + p, p, q); this._downArrowSprite.move(w / 2, h - q); this._upArrowSprite.bitmap = this._windowskin; this._upArrowSprite.anchor.x = 0.5; this._upArrowSprite.anchor.y = 0.5; this._upArrowSprite.setFrame(sx + q, sy, p, q); this._upArrowSprite.move(w / 2, q); }; /** * @method _refreshPauseSign * @private */ Window.prototype._refreshPauseSign = function () { var sx = 144; var sy = 96; var p = 24; this._windowPauseSignSprite.bitmap = this._windowskin; this._windowPauseSignSprite.anchor.x = 0.5; this._windowPauseSignSprite.anchor.y = 1; this._windowPauseSignSprite.move(this._width / 2, this._height); this._windowPauseSignSprite.setFrame(sx, sy, p, p); this._windowPauseSignSprite.alpha = 0; }; /** * @method _updateCursor * @private */ Window.prototype._updateCursor = function () { var blinkCount = this._animationCount % 40; var cursorOpacity = this.contentsOpacity; if (this.active) { if (blinkCount < 20) { cursorOpacity -= blinkCount * 8; } else { cursorOpacity -= (40 - blinkCount) * 8; } } this._windowCursorSprite.alpha = cursorOpacity / 255; this._windowCursorSprite.visible = this.isOpen(); }; /** * @method _updateContents * @private */ Window.prototype._updateContents = function () { var w = this._width - this._padding * 2; var h = this._height - this._padding * 2; if (w > 0 && h > 0) { this._windowContentsSprite.setFrame(this.origin.x, this.origin.y, w, h); this._windowContentsSprite.visible = this.isOpen(); } else { this._windowContentsSprite.visible = false; } }; /** * @method _updateArrows * @private */ Window.prototype._updateArrows = function () { this._downArrowSprite.visible = this.isOpen() && this.downArrowVisible; this._upArrowSprite.visible = this.isOpen() && this.upArrowVisible; }; /** * @method _updatePauseSign * @private */ Window.prototype._updatePauseSign = function () { var sprite = this._windowPauseSignSprite; var x = Math.floor(this._animationCount / 16) % 2; var y = Math.floor(this._animationCount / 16 / 2) % 2; var sx = 144; var sy = 96; var p = 24; if (!this.pause) { sprite.alpha = 0; } else if (sprite.alpha < 1) { sprite.alpha = Math.min(sprite.alpha + 0.1, 1); } sprite.setFrame(sx + x * p, sy + y * p, p, p); sprite.visible = this.isOpen(); }; // The important members from Pixi.js /** * The visibility of the window. * * @property visible * @type Boolean */ /** * The x coordinate of the window. * * @property x * @type Number */ /** * The y coordinate of the window. * * @property y * @type Number */ /** * [read-only] The array of children of the window. * * @property children * @type Array */ /** * [read-only] The object that contains the window. * * @property parent * @type Object */ /** * Adds a child to the container. * * @method addChild * @param {Object} child The child to add * @return {Object} The child that was added */ /** * Adds a child to the container at a specified index. * * @method addChildAt * @param {Object} child The child to add * @param {Number} index The index to place the child in * @return {Object} The child that was added */ /** * Removes a child from the container. * * @method removeChild * @param {Object} child The child to remove * @return {Object} The child that was removed */ /** * Removes a child from the specified index position. * * @method removeChildAt * @param {Number} index The index to get the child from * @return {Object} The child that was removed */ //----------------------------------------------------------------------------- /** * The layer which contains game windows. * * @class WindowLayer * @constructor */ function WindowLayer() { this.initialize.apply(this, arguments); } WindowLayer.prototype = Object.create(PIXI.Container.prototype); WindowLayer.prototype.constructor = WindowLayer; WindowLayer.prototype.initialize = function () { PIXI.Container.call(this); this._width = 0; this._height = 0; this._tempCanvas = null; this._translationMatrix = [1, 0, 0, 0, 1, 0, 0, 0, 1]; this._windowMask = new PIXI.Graphics(); this._windowMask.beginFill(0xffffff, 1); this._windowMask.drawRect(0, 0, 0, 0); this._windowMask.endFill(); this._windowRect = this._windowMask.graphicsData[0].shape; this._renderSprite = null; this.filterArea = new PIXI.Rectangle(); this.filters = [WindowLayer.voidFilter]; //temporary fix for memory leak bug this.on('removed', this.onRemoveAsAChild); }; WindowLayer.prototype.onRemoveAsAChild = function () { this.removeChildren(); } WindowLayer.voidFilter = new PIXI.filters.VoidFilter(); /** * The width of the window layer in pixels. * * @property width * @type Number */ Object.defineProperty(WindowLayer.prototype, 'width', { get: function () { return this._width; }, set: function (value) { this._width = value; }, configurable: true }); /** * The height of the window layer in pixels. * * @property height * @type Number */ Object.defineProperty(WindowLayer.prototype, 'height', { get: function () { return this._height; }, set: function (value) { this._height = value; }, configurable: true }); /** * Sets the x, y, width, and height all at once. * * @method move * @param {Number} x The x coordinate of the window layer * @param {Number} y The y coordinate of the window layer * @param {Number} width The width of the window layer * @param {Number} height The height of the window layer */ WindowLayer.prototype.move = function (x, y, width, height) { this.x = x; this.y = y; this.width = width; this.height = height; }; /** * Updates the window layer for each frame. * * @method update */ WindowLayer.prototype.update = function () { this.children.forEach(function (child) { if (child.update) { child.update(); } }); }; /** * @method _renderCanvas * @param {Object} renderSession * @private */ WindowLayer.prototype.renderCanvas = function (renderer) { if (!this.visible || !this.renderable) { return; } if (!this._tempCanvas) { this._tempCanvas = document.createElement('canvas'); } this._tempCanvas.width = Graphics.width; this._tempCanvas.height = Graphics.height; var realCanvasContext = renderer.context; var context = this._tempCanvas.getContext('2d'); context.save(); context.clearRect(0, 0, Graphics.width, Graphics.height); context.beginPath(); context.rect(this.x, this.y, this.width, this.height); context.closePath(); context.clip(); renderer.context = context; for (var i = 0; i < this.children.length; i++) { var child = this.children[i]; if (child._isWindow && child.visible && child.openness > 0) { this._canvasClearWindowRect(renderer, child); context.save(); child.renderCanvas(renderer); context.restore(); } } context.restore(); renderer.context = realCanvasContext; renderer.context.setTransform(1, 0, 0, 1, 0, 0); renderer.context.globalCompositeOperation = 'source-over'; renderer.context.globalAlpha = 1; renderer.context.drawImage(this._tempCanvas, 0, 0); for (var j = 0; j < this.children.length; j++) { if (!this.children[j]._isWindow) { this.children[j].renderCanvas(renderer); } } }; /** * @method _canvasClearWindowRect * @param {Object} renderSession * @param {Window} window * @private */ WindowLayer.prototype._canvasClearWindowRect = function (renderSession, window) { var rx = this.x + window.x; var ry = this.y + window.y + window.height / 2 * (1 - window._openness / 255); var rw = window.width; var rh = window.height * window._openness / 255; renderSession.context.clearRect(rx, ry, rw, rh); }; /** * @method _renderWebGL * @param {Object} renderSession * @private */ WindowLayer.prototype.renderWebGL = function (renderer) { if (!this.visible || !this.renderable) { return; } if (this.children.length == 0) { return; } renderer.flush(); this.filterArea.copy(this); renderer.filterManager.pushFilter(this, this.filters); renderer.currentRenderer.start(); var shift = new PIXI.Point(); var rt = renderer._activeRenderTarget; var projectionMatrix = rt.projectionMatrix; shift.x = Math.round((projectionMatrix.tx + 1) / 2 * rt.sourceFrame.width); shift.y = Math.round((projectionMatrix.ty + 1) / 2 * rt.sourceFrame.height); for (var i = 0; i < this.children.length; i++) { var child = this.children[i]; if (child._isWindow && child.visible && child.openness > 0) { this._maskWindow(child, shift); renderer.maskManager.pushScissorMask(this, this._windowMask); renderer.clear(); renderer.maskManager.popScissorMask(); renderer.currentRenderer.start(); child.renderWebGL(renderer); renderer.currentRenderer.flush(); } } renderer.flush(); renderer.filterManager.popFilter(); renderer.maskManager.popScissorMask(); for (var j = 0; j < this.children.length; j++) { if (!this.children[j]._isWindow) { this.children[j].renderWebGL(renderer); } } }; /** * @method _maskWindow * @param {Window} window * @private */ WindowLayer.prototype._maskWindow = function (window, shift) { this._windowMask._currentBounds = null; this._windowMask.boundsDirty = true; var rect = this._windowRect; rect.x = this.x + shift.x + window.x; rect.y = this.x + shift.y + window.y + window.height / 2 * (1 - window._openness / 255); rect.width = window.width; rect.height = window.height * window._openness / 255; }; // The important members from Pixi.js /** * The x coordinate of the window layer. * * @property x * @type Number */ /** * The y coordinate of the window layer. * * @property y * @type Number */ /** * [read-only] The array of children of the window layer. * * @property children * @type Array */ /** * [read-only] The object that contains the window layer. * * @property parent * @type Object */ /** * Adds a child to the container. * * @method addChild * @param {Object} child The child to add * @return {Object} The child that was added */ /** * Adds a child to the container at a specified index. * * @method addChildAt * @param {Object} child The child to add * @param {Number} index The index to place the child in * @return {Object} The child that was added */ /** * Removes a child from the container. * * @method removeChild * @param {Object} child The child to remove * @return {Object} The child that was removed */ /** * Removes a child from the specified index position. * * @method removeChildAt * @param {Number} index The index to get the child from * @return {Object} The child that was removed */ //----------------------------------------------------------------------------- /** * The weather effect which displays rain, storm, or snow. * * @class Weather * @constructor */ function Weather() { this.initialize.apply(this, arguments); } Weather.prototype = Object.create(PIXI.Container.prototype); Weather.prototype.constructor = Weather; Weather.prototype.initialize = function () { PIXI.Container.call(this); this._width = Graphics.width; this._height = Graphics.height; this._sprites = []; this._createBitmaps(); this._createDimmer(); /** * The type of the weather in ['none', 'rain', 'storm', 'snow']. * * @property type * @type String */ this.type = 'none'; /** * The power of the weather in the range (0, 9). * * @property power * @type Number */ this.power = 0; /** * The origin point of the weather for scrolling. * * @property origin * @type Point */ this.origin = new Point(); }; /** * Updates the weather for each frame. * * @method update */ Weather.prototype.update = function () { this._updateDimmer(); this._updateAllSprites(); }; /** * @method _createBitmaps * @private */ Weather.prototype._createBitmaps = function () { this._rainBitmap = new Bitmap(1, 60); this._rainBitmap.fillAll('white'); this._stormBitmap = new Bitmap(2, 100); this._stormBitmap.fillAll('white'); this._snowBitmap = new Bitmap(9, 9); this._snowBitmap.drawCircle(4, 4, 4, 'white'); }; /** * @method _createDimmer * @private */ Weather.prototype._createDimmer = function () { this._dimmerSprite = new ScreenSprite(); this._dimmerSprite.setColor(80, 80, 80); this.addChild(this._dimmerSprite); }; /** * @method _updateDimmer * @private */ Weather.prototype._updateDimmer = function () { this._dimmerSprite.opacity = Math.floor(this.power * 6); }; /** * @method _updateAllSprites * @private */ Weather.prototype._updateAllSprites = function () { var maxSprites = Math.floor(this.power * 10); while (this._sprites.length < maxSprites) { this._addSprite(); } while (this._sprites.length > maxSprites) { this._removeSprite(); } this._sprites.forEach(function (sprite) { this._updateSprite(sprite); sprite.x = sprite.ax - this.origin.x; sprite.y = sprite.ay - this.origin.y; }, this); }; /** * @method _addSprite * @private */ Weather.prototype._addSprite = function () { var sprite = new Sprite(this.viewport); sprite.opacity = 0; this._sprites.push(sprite); this.addChild(sprite); }; /** * @method _removeSprite * @private */ Weather.prototype._removeSprite = function () { this.removeChild(this._sprites.pop()); }; /** * @method _updateSprite * @param {Sprite} sprite * @private */ Weather.prototype._updateSprite = function (sprite) { switch (this.type) { case 'rain': this._updateRainSprite(sprite); break; case 'storm': this._updateStormSprite(sprite); break; case 'snow': this._updateSnowSprite(sprite); break; } if (sprite.opacity < 40) { this._rebornSprite(sprite); } }; /** * @method _updateRainSprite * @param {Sprite} sprite * @private */ Weather.prototype._updateRainSprite = function (sprite) { sprite.bitmap = this._rainBitmap; sprite.rotation = Math.PI / 16; sprite.ax -= 6 * Math.sin(sprite.rotation); sprite.ay += 6 * Math.cos(sprite.rotation); sprite.opacity -= 6; }; /** * @method _updateStormSprite * @param {Sprite} sprite * @private */ Weather.prototype._updateStormSprite = function (sprite) { sprite.bitmap = this._stormBitmap; sprite.rotation = Math.PI / 8; sprite.ax -= 8 * Math.sin(sprite.rotation); sprite.ay += 8 * Math.cos(sprite.rotation); sprite.opacity -= 8; }; /** * @method _updateSnowSprite * @param {Sprite} sprite * @private */ Weather.prototype._updateSnowSprite = function (sprite) { sprite.bitmap = this._snowBitmap; sprite.rotation = Math.PI / 16; sprite.ax -= 3 * Math.sin(sprite.rotation); sprite.ay += 3 * Math.cos(sprite.rotation); sprite.opacity -= 3; }; /** * @method _rebornSprite * @param {Sprite} sprite * @private */ Weather.prototype._rebornSprite = function (sprite) { sprite.ax = Math.randomInt(Graphics.width + 100) - 100 + this.origin.x; sprite.ay = Math.randomInt(Graphics.height + 200) - 200 + this.origin.y; sprite.opacity = 160 + Math.randomInt(60); }; //----------------------------------------------------------------------------- /** * The color matrix filter for WebGL. * * @class ToneFilter * @extends PIXI.Filter * @constructor */ function ToneFilter() { PIXI.filters.ColorMatrixFilter.call(this); } ToneFilter.prototype = Object.create(PIXI.filters.ColorMatrixFilter.prototype); ToneFilter.prototype.constructor = ToneFilter; /** * Changes the hue. * * @method adjustHue * @param {Number} value The hue value in the range (-360, 360) */ ToneFilter.prototype.adjustHue = function (value) { this.hue(value, true); }; /** * Changes the saturation. * * @method adjustSaturation * @param {Number} value The saturation value in the range (-255, 255) */ ToneFilter.prototype.adjustSaturation = function (value) { value = (value || 0).clamp(-255, 255) / 255; this.saturate(value, true); }; /** * Changes the tone. * * @method adjustTone * @param {Number} r The red strength in the range (-255, 255) * @param {Number} g The green strength in the range (-255, 255) * @param {Number} b The blue strength in the range (-255, 255) */ ToneFilter.prototype.adjustTone = function (r, g, b) { r = (r || 0).clamp(-255, 255) / 255; g = (g || 0).clamp(-255, 255) / 255; b = (b || 0).clamp(-255, 255) / 255; if (r !== 0 || g !== 0 || b !== 0) { var matrix = [ 1, 0, 0, r, 0, 0, 1, 0, g, 0, 0, 0, 1, b, 0, 0, 0, 0, 1, 0 ]; this._loadMatrix(matrix, true); } }; //----------------------------------------------------------------------------- /** * The sprite which changes the screen color in 2D canvas mode. * * @class ToneSprite * @constructor */ function ToneSprite() { this.initialize.apply(this, arguments); } ToneSprite.prototype = Object.create(PIXI.Container.prototype); ToneSprite.prototype.constructor = ToneSprite; ToneSprite.prototype.initialize = function () { PIXI.Container.call(this); this.clear(); }; /** * Clears the tone. * * @method reset */ ToneSprite.prototype.clear = function () { this._red = 0; this._green = 0; this._blue = 0; this._gray = 0; }; /** * Sets the tone. * * @method setTone * @param {Number} r The red strength in the range (-255, 255) * @param {Number} g The green strength in the range (-255, 255) * @param {Number} b The blue strength in the range (-255, 255) * @param {Number} gray The grayscale level in the range (0, 255) */ ToneSprite.prototype.setTone = function (r, g, b, gray) { this._red = Math.round(r || 0).clamp(-255, 255); this._green = Math.round(g || 0).clamp(-255, 255); this._blue = Math.round(b || 0).clamp(-255, 255); this._gray = Math.round(gray || 0).clamp(0, 255); }; /** * @method _renderCanvas * @param {Object} renderSession * @private */ ToneSprite.prototype._renderCanvas = function (renderer) { if (this.visible) { var context = renderer.context; var t = this.worldTransform; var r = renderer.resolution; var width = Graphics.width; var height = Graphics.height; context.save(); context.setTransform(t.a, t.b, t.c, t.d, t.tx * r, t.ty * r); if (Graphics.canUseSaturationBlend() && this._gray > 0) { context.globalCompositeOperation = 'saturation'; context.globalAlpha = this._gray / 255; context.fillStyle = '#ffffff'; context.fillRect(0, 0, width, height); } context.globalAlpha = 1; var r1 = Math.max(0, this._red); var g1 = Math.max(0, this._green); var b1 = Math.max(0, this._blue); if (r1 || g1 || b1) { context.globalCompositeOperation = 'lighter'; context.fillStyle = Utils.rgbToCssColor(r1, g1, b1); context.fillRect(0, 0, width, height); } if (Graphics.canUseDifferenceBlend()) { var r2 = Math.max(0, -this._red); var g2 = Math.max(0, -this._green); var b2 = Math.max(0, -this._blue); if (r2 || g2 || b2) { context.globalCompositeOperation = 'difference'; context.fillStyle = '#ffffff'; context.fillRect(0, 0, width, height); context.globalCompositeOperation = 'lighter'; context.fillStyle = Utils.rgbToCssColor(r2, g2, b2); context.fillRect(0, 0, width, height); context.globalCompositeOperation = 'difference'; context.fillStyle = '#ffffff'; context.fillRect(0, 0, width, height); } } context.restore(); } }; /** * @method _renderWebGL * @param {Object} renderSession * @private */ ToneSprite.prototype._renderWebGL = function (renderer) { // Not supported }; //----------------------------------------------------------------------------- /** * The root object of the display tree. * * @class Stage * @constructor */ function Stage() { this.initialize.apply(this, arguments); } Stage.prototype = Object.create(PIXI.Container.prototype); Stage.prototype.constructor = Stage; Stage.prototype.initialize = function () { PIXI.Container.call(this); // The interactive flag causes a memory leak. this.interactive = false; }; /** * [read-only] The array of children of the stage. * * @property children * @type Array */ /** * Adds a child to the container. * * @method addChild * @param {Object} child The child to add * @return {Object} The child that was added */ /** * Adds a child to the container at a specified index. * * @method addChildAt * @param {Object} child The child to add * @param {Number} index The index to place the child in * @return {Object} The child that was added */ /** * Removes a child from the container. * * @method removeChild * @param {Object} child The child to remove * @return {Object} The child that was removed */ /** * Removes a child from the specified index position. * * @method removeChildAt * @param {Number} index The index to get the child from * @return {Object} The child that was removed */ //----------------------------------------------------------------------------- /** * The audio object of Web Audio API. * * @class WebAudio * @constructor * @param {String} url The url of the audio file */ function WebAudio() { this.initialize.apply(this, arguments); } WebAudio._standAlone = (function (top) { return !top.ResourceHandler; })(this); WebAudio.prototype.initialize = function (url) { if (!WebAudio._initialized) { WebAudio.initialize(); } this.clear(); if (!WebAudio._standAlone) { this._loader = ResourceHandler.createLoader(url, this._load.bind(this, url), function () { this._hasError = true; }.bind(this)); } this._load(url); this._url = url; }; WebAudio._masterVolume = 1; WebAudio._context = null; WebAudio._masterGainNode = null; WebAudio._initialized = false; WebAudio._unlocked = false; /** * Initializes the audio system. * * @static * @method initialize * @param {Boolean} noAudio Flag for the no-audio mode * @return {Boolean} True if the audio system is available */ WebAudio.initialize = function (noAudio) { if (!this._initialized) { if (!noAudio) { this._createContext(); this._detectCodecs(); this._createMasterGainNode(); this._setupEventHandlers(); } this._initialized = true; } return !!this._context; }; /** * Checks whether the browser can play ogg files. * * @static * @method canPlayOgg * @return {Boolean} True if the browser can play ogg files */ WebAudio.canPlayOgg = function () { if (!this._initialized) { this.initialize(); } return !!this._canPlayOgg; }; /** * Checks whether the browser can play m4a files. * * @static * @method canPlayM4a * @return {Boolean} True if the browser can play m4a files */ WebAudio.canPlayM4a = function () { if (!this._initialized) { this.initialize(); } return !!this._canPlayM4a; }; /** * Sets the master volume of the all audio. * * @static * @method setMasterVolume * @param {Number} value Master volume (min: 0, max: 1) */ WebAudio.setMasterVolume = function (value) { this._masterVolume = value; if (this._masterGainNode) { this._masterGainNode.gain.setValueAtTime(this._masterVolume, this._context.currentTime); } }; /** * @static * @method _createContext * @private */ WebAudio._createContext = function () { try { if (typeof AudioContext !== 'undefined') { this._context = new AudioContext(); } else if (typeof webkitAudioContext !== 'undefined') { this._context = new webkitAudioContext(); } } catch (e) { this._context = null; } }; /** * @static * @method _detectCodecs * @private */ WebAudio._detectCodecs = function () { var audio = document.createElement('audio'); if (audio.canPlayType) { this._canPlayOgg = audio.canPlayType('audio/ogg'); this._canPlayM4a = audio.canPlayType('audio/mp4'); } }; /** * @static * @method _createMasterGainNode * @private */ WebAudio._createMasterGainNode = function () { var context = WebAudio._context; if (context) { this._masterGainNode = context.createGain(); this._masterGainNode.gain.setValueAtTime(this._masterVolume, context.currentTime); this._masterGainNode.connect(context.destination); } }; /** * @static * @method _setupEventHandlers * @private */ WebAudio._setupEventHandlers = function () { var resumeHandler = function () { var context = WebAudio._context; if (context && context.state === "suspended" && typeof context.resume === "function") { context.resume().then(function () { WebAudio._onTouchStart(); }) } else { WebAudio._onTouchStart(); } }; document.addEventListener("keydown", resumeHandler); document.addEventListener("mousedown", resumeHandler); document.addEventListener("touchend", resumeHandler); document.addEventListener('touchstart', this._onTouchStart.bind(this)); document.addEventListener('visibilitychange', this._onVisibilityChange.bind(this)); }; /** * @static * @method _onTouchStart * @private */ WebAudio._onTouchStart = function () { var context = WebAudio._context; if (context && !this._unlocked) { // Unlock Web Audio on iOS var node = context.createBufferSource(); node.start(0); this._unlocked = true; } }; /** * @static * @method _onVisibilityChange * @private */ WebAudio._onVisibilityChange = function () { if (document.visibilityState === 'hidden') { this._onHide(); } else { this._onShow(); } }; /** * @static * @method _onHide * @private */ WebAudio._onHide = function () { if (this._shouldMuteOnHide()) { this._fadeOut(1); } }; /** * @static * @method _onShow * @private */ WebAudio._onShow = function () { if (this._shouldMuteOnHide()) { this._fadeIn(0.5); } }; /** * @static * @method _shouldMuteOnHide * @private */ WebAudio._shouldMuteOnHide = function () { return Utils.isMobileDevice(); }; /** * @static * @method _fadeIn * @param {Number} duration * @private */ WebAudio._fadeIn = function (duration) { if (this._masterGainNode) { var gain = this._masterGainNode.gain; var currentTime = WebAudio._context.currentTime; gain.setValueAtTime(0, currentTime); gain.linearRampToValueAtTime(this._masterVolume, currentTime + duration); } }; /** * @static * @method _fadeOut * @param {Number} duration * @private */ WebAudio._fadeOut = function (duration) { if (this._masterGainNode) { var gain = this._masterGainNode.gain; var currentTime = WebAudio._context.currentTime; gain.setValueAtTime(this._masterVolume, currentTime); gain.linearRampToValueAtTime(0, currentTime + duration); } }; /** * Clears the audio data. * * @method clear */ WebAudio.prototype.clear = function () { this.stop(); this._buffer = null; this._sourceNode = null; this._gainNode = null; this._pannerNode = null; this._totalTime = 0; this._sampleRate = 0; this._loopStart = 0; this._loopLength = 0; this._startTime = 0; this._volume = 1; this._pitch = 1; this._pan = 0; this._endTimer = null; this._loadListeners = []; this._stopListeners = []; this._hasError = false; this._autoPlay = false; }; /** * [read-only] The url of the audio file. * * @property url * @type String */ Object.defineProperty(WebAudio.prototype, 'url', { get: function () { return this._url; }, configurable: true }); /** * The volume of the audio. * * @property volume * @type Number */ Object.defineProperty(WebAudio.prototype, 'volume', { get: function () { return this._volume; }, set: function (value) { this._volume = value; if (this._gainNode) { this._gainNode.gain.setValueAtTime(this._volume, WebAudio._context.currentTime); } }, configurable: true }); /** * The pitch of the audio. * * @property pitch * @type Number */ Object.defineProperty(WebAudio.prototype, 'pitch', { get: function () { return this._pitch; }, set: function (value) { if (this._pitch !== value) { this._pitch = value; if (this.isPlaying()) { this.play(this._sourceNode.loop, 0); } } }, configurable: true }); /** * The pan of the audio. * * @property pan * @type Number */ Object.defineProperty(WebAudio.prototype, 'pan', { get: function () { return this._pan; }, set: function (value) { this._pan = value; this._updatePanner(); }, configurable: true }); /** * Checks whether the audio data is ready to play. * * @method isReady * @return {Boolean} True if the audio data is ready to play */ WebAudio.prototype.isReady = function () { return !!this._buffer; }; /** * Checks whether a loading error has occurred. * * @method isError * @return {Boolean} True if a loading error has occurred */ WebAudio.prototype.isError = function () { return this._hasError; }; /** * Checks whether the audio is playing. * * @method isPlaying * @return {Boolean} True if the audio is playing */ WebAudio.prototype.isPlaying = function () { return !!this._sourceNode; }; /** * Plays the audio. * * @method play * @param {Boolean} loop Whether the audio data play in a loop * @param {Number} offset The start position to play in seconds */ WebAudio.prototype.play = function (loop, offset) { if (this.isReady()) { offset = offset || 0; this._startPlaying(loop, offset); } else if (WebAudio._context) { this._autoPlay = true; this.addLoadListener(function () { if (this._autoPlay) { this.play(loop, offset); } }.bind(this)); } }; /** * Stops the audio. * * @method stop */ WebAudio.prototype.stop = function () { this._autoPlay = false; this._removeEndTimer(); this._removeNodes(); if (this._stopListeners) { while (this._stopListeners.length > 0) { var listner = this._stopListeners.shift(); listner(); } } }; /** * Performs the audio fade-in. * * @method fadeIn * @param {Number} duration Fade-in time in seconds */ WebAudio.prototype.fadeIn = function (duration) { if (this.isReady()) { if (this._gainNode) { var gain = this._gainNode.gain; var currentTime = WebAudio._context.currentTime; gain.setValueAtTime(0, currentTime); gain.linearRampToValueAtTime(this._volume, currentTime + duration); } } else if (this._autoPlay) { this.addLoadListener(function () { this.fadeIn(duration); }.bind(this)); } }; /** * Performs the audio fade-out. * * @method fadeOut * @param {Number} duration Fade-out time in seconds */ WebAudio.prototype.fadeOut = function (duration) { if (this._gainNode) { var gain = this._gainNode.gain; var currentTime = WebAudio._context.currentTime; gain.setValueAtTime(this._volume, currentTime); gain.linearRampToValueAtTime(0, currentTime + duration); } this._autoPlay = false; }; /** * Gets the seek position of the audio. * * @method seek */ WebAudio.prototype.seek = function () { if (WebAudio._context) { var pos = (WebAudio._context.currentTime - this._startTime) * this._pitch; if (this._loopLength > 0) { while (pos >= this._loopStart + this._loopLength) { pos -= this._loopLength; } } return pos; } else { return 0; } }; /** * Add a callback function that will be called when the audio data is loaded. * * @method addLoadListener * @param {Function} listner The callback function */ WebAudio.prototype.addLoadListener = function (listner) { this._loadListeners.push(listner); }; /** * Add a callback function that will be called when the playback is stopped. * * @method addStopListener * @param {Function} listner The callback function */ WebAudio.prototype.addStopListener = function (listner) { this._stopListeners.push(listner); }; /** * @method _load * @param {String} url * @private */ WebAudio.prototype._load = function (url) { if (WebAudio._context) { var xhr = new XMLHttpRequest(); if (Decrypter.hasEncryptedAudio) url = Decrypter.extToEncryptExt(url); xhr.open('GET', url); xhr.responseType = 'arraybuffer'; xhr.onload = function () { if (xhr.status < 400) { this._onXhrLoad(xhr); } }.bind(this); xhr.onerror = this._loader || function () { this._hasError = true; }.bind(this); xhr.send(); } }; /** * @method _onXhrLoad * @param {XMLHttpRequest} xhr * @private */ WebAudio.prototype._onXhrLoad = function (xhr) { var array = xhr.response; if (Decrypter.hasEncryptedAudio) array = Decrypter.decryptArrayBuffer(array); this._readLoopComments(new Uint8Array(array)); WebAudio._context.decodeAudioData(array, function (buffer) { this._buffer = buffer; this._totalTime = buffer.duration; if (this._loopLength > 0 && this._sampleRate > 0) { this._loopStart /= this._sampleRate; this._loopLength /= this._sampleRate; } else { this._loopStart = 0; this._loopLength = this._totalTime; } this._onLoad(); }.bind(this)); }; /** * @method _startPlaying * @param {Boolean} loop * @param {Number} offset * @private */ WebAudio.prototype._startPlaying = function (loop, offset) { if (this._loopLength > 0) { while (offset >= this._loopStart + this._loopLength) { offset -= this._loopLength; } } this._removeEndTimer(); this._removeNodes(); this._createNodes(); this._connectNodes(); this._sourceNode.loop = loop; this._sourceNode.start(0, offset); this._startTime = WebAudio._context.currentTime - offset / this._pitch; this._createEndTimer(); }; /** * @method _createNodes * @private */ WebAudio.prototype._createNodes = function () { var context = WebAudio._context; this._sourceNode = context.createBufferSource(); this._sourceNode.buffer = this._buffer; this._sourceNode.loopStart = this._loopStart; this._sourceNode.loopEnd = this._loopStart + this._loopLength; this._sourceNode.playbackRate.setValueAtTime(this._pitch, context.currentTime); this._gainNode = context.createGain(); this._gainNode.gain.setValueAtTime(this._volume, context.currentTime); this._pannerNode = context.createPanner(); this._pannerNode.panningModel = 'equalpower'; this._updatePanner(); }; /** * @method _connectNodes * @private */ WebAudio.prototype._connectNodes = function () { this._sourceNode.connect(this._gainNode); this._gainNode.connect(this._pannerNode); this._pannerNode.connect(WebAudio._masterGainNode); }; /** * @method _removeNodes * @private */ WebAudio.prototype._removeNodes = function () { if (this._sourceNode) { this._sourceNode.stop(0); this._sourceNode = null; this._gainNode = null; this._pannerNode = null; } }; /** * @method _createEndTimer * @private */ WebAudio.prototype._createEndTimer = function () { if (this._sourceNode && !this._sourceNode.loop) { var endTime = this._startTime + this._totalTime / this._pitch; var delay = endTime - WebAudio._context.currentTime; this._endTimer = setTimeout(function () { this.stop(); }.bind(this), delay * 1000); } }; /** * @method _removeEndTimer * @private */ WebAudio.prototype._removeEndTimer = function () { if (this._endTimer) { clearTimeout(this._endTimer); this._endTimer = null; } }; /** * @method _updatePanner * @private */ WebAudio.prototype._updatePanner = function () { if (this._pannerNode) { var x = this._pan; var z = 1 - Math.abs(x); this._pannerNode.setPosition(x, 0, z); } }; /** * @method _onLoad * @private */ WebAudio.prototype._onLoad = function () { while (this._loadListeners.length > 0) { var listner = this._loadListeners.shift(); listner(); } }; /** * @method _readLoopComments * @param {Uint8Array} array * @private */ WebAudio.prototype._readLoopComments = function (array) { this._readOgg(array); this._readMp4(array); }; /** * @method _readOgg * @param {Uint8Array} array * @private */ WebAudio.prototype._readOgg = function (array) { var index = 0; while (index < array.length) { if (this._readFourCharacters(array, index) === 'OggS') { index += 26; var vorbisHeaderFound = false; var numSegments = array[index++]; var segments = []; for (var i = 0; i < numSegments; i++) { segments.push(array[index++]); } for (i = 0; i < numSegments; i++) { if (this._readFourCharacters(array, index + 1) === 'vorb') { var headerType = array[index]; if (headerType === 1) { this._sampleRate = this._readLittleEndian(array, index + 12); } else if (headerType === 3) { this._readMetaData(array, index, segments[i]); } vorbisHeaderFound = true; } index += segments[i]; } if (!vorbisHeaderFound) { break; } } else { break; } } }; /** * @method _readMp4 * @param {Uint8Array} array * @private */ WebAudio.prototype._readMp4 = function (array) { if (this._readFourCharacters(array, 4) === 'ftyp') { var index = 0; while (index < array.length) { var size = this._readBigEndian(array, index); var name = this._readFourCharacters(array, index + 4); if (name === 'moov') { index += 8; } else { if (name === 'mvhd') { this._sampleRate = this._readBigEndian(array, index + 20); } if (name === 'udta' || name === 'meta') { this._readMetaData(array, index, size); } index += size; if (size <= 1) { break; } } } } }; /** * @method _readMetaData * @param {Uint8Array} array * @param {Number} index * @param {Number} size * @private */ WebAudio.prototype._readMetaData = function (array, index, size) { for (var i = index; i < index + size - 10; i++) { if (this._readFourCharacters(array, i) === 'LOOP') { var text = ''; while (array[i] > 0) { text += String.fromCharCode(array[i++]); } if (text.match(/LOOPSTART=([0-9]+)/)) { this._loopStart = parseInt(RegExp.$1); } if (text.match(/LOOPLENGTH=([0-9]+)/)) { this._loopLength = parseInt(RegExp.$1); } if (text == 'LOOPSTART' || text == 'LOOPLENGTH') { var text2 = ''; i += 16; while (array[i] > 0) { text2 += String.fromCharCode(array[i++]); } if (text == 'LOOPSTART') { this._loopStart = parseInt(text2); } else { this._loopLength = parseInt(text2); } } } } }; /** * @method _readLittleEndian * @param {Uint8Array} array * @param {Number} index * @private */ WebAudio.prototype._readLittleEndian = function (array, index) { return (array[index + 3] * 0x1000000 + array[index + 2] * 0x10000 + array[index + 1] * 0x100 + array[index + 0]); }; /** * @method _readBigEndian * @param {Uint8Array} array * @param {Number} index * @private */ WebAudio.prototype._readBigEndian = function (array, index) { return (array[index + 0] * 0x1000000 + array[index + 1] * 0x10000 + array[index + 2] * 0x100 + array[index + 3]); }; /** * @method _readFourCharacters * @param {Uint8Array} array * @param {Number} index * @private */ WebAudio.prototype._readFourCharacters = function (array, index) { var string = ''; for (var i = 0; i < 4; i++) { string += String.fromCharCode(array[index + i]); } return string; }; //----------------------------------------------------------------------------- /** * The static class that handles HTML5 Audio. * * @class Html5Audio * @constructor */ function Html5Audio() { throw new Error('This is a static class'); } Html5Audio._initialized = false; Html5Audio._unlocked = false; Html5Audio._audioElement = null; Html5Audio._gainTweenInterval = null; Html5Audio._tweenGain = 0; Html5Audio._tweenTargetGain = 0; Html5Audio._tweenGainStep = 0; Html5Audio._staticSePath = null; /** * Sets up the Html5 Audio. * * @static * @method setup * @param {String} url The url of the audio file */ Html5Audio.setup = function (url) { if (!this._initialized) { this.initialize(); } this.clear(); if (Decrypter.hasEncryptedAudio && this._audioElement.src) { window.URL.revokeObjectURL(this._audioElement.src); } this._url = url; }; /** * Initializes the audio system. * * @static * @method initialize * @return {Boolean} True if the audio system is available */ Html5Audio.initialize = function () { if (!this._initialized) { if (!this._audioElement) { try { this._audioElement = new Audio(); } catch (e) { this._audioElement = null; } } if (!!this._audioElement) this._setupEventHandlers(); this._initialized = true; } return !!this._audioElement; }; /** * @static * @method _setupEventHandlers * @private */ Html5Audio._setupEventHandlers = function () { document.addEventListener('touchstart', this._onTouchStart.bind(this)); document.addEventListener('visibilitychange', this._onVisibilityChange.bind(this)); this._audioElement.addEventListener("loadeddata", this._onLoadedData.bind(this)); this._audioElement.addEventListener("error", this._onError.bind(this)); this._audioElement.addEventListener("ended", this._onEnded.bind(this)); }; /** * @static * @method _onTouchStart * @private */ Html5Audio._onTouchStart = function () { if (this._audioElement && !this._unlocked) { if (this._isLoading) { this._load(this._url); this._unlocked = true; } else { if (this._staticSePath) { this._audioElement.src = this._staticSePath; this._audioElement.volume = 0; this._audioElement.loop = false; this._audioElement.play(); this._unlocked = true; } } } }; /** * @static * @method _onVisibilityChange * @private */ Html5Audio._onVisibilityChange = function () { if (document.visibilityState === 'hidden') { this._onHide(); } else { this._onShow(); } }; /** * @static * @method _onLoadedData * @private */ Html5Audio._onLoadedData = function () { this._buffered = true; if (this._unlocked) this._onLoad(); }; /** * @static * @method _onError * @private */ Html5Audio._onError = function () { this._hasError = true; }; /** * @static * @method _onEnded * @private */ Html5Audio._onEnded = function () { if (!this._audioElement.loop) { this.stop(); } }; /** * @static * @method _onHide * @private */ Html5Audio._onHide = function () { this._audioElement.volume = 0; this._tweenGain = 0; }; /** * @static * @method _onShow * @private */ Html5Audio._onShow = function () { this.fadeIn(0.5); }; /** * Clears the audio data. * * @static * @method clear */ Html5Audio.clear = function () { this.stop(); this._volume = 1; this._loadListeners = []; this._hasError = false; this._autoPlay = false; this._isLoading = false; this._buffered = false; }; /** * Set the URL of static se. * * @static * @param {String} url */ Html5Audio.setStaticSe = function (url) { if (!this._initialized) { this.initialize(); this.clear(); } this._staticSePath = url; }; /** * [read-only] The url of the audio file. * * @property url * @type String */ Object.defineProperty(Html5Audio, 'url', { get: function () { return Html5Audio._url; }, configurable: true }); /** * The volume of the audio. * * @property volume * @type Number */ Object.defineProperty(Html5Audio, 'volume', { get: function () { return Html5Audio._volume; }.bind(this), set: function (value) { Html5Audio._volume = value; if (Html5Audio._audioElement) { Html5Audio._audioElement.volume = this._volume; } }, configurable: true }); /** * Checks whether the audio data is ready to play. * * @static * @method isReady * @return {Boolean} True if the audio data is ready to play */ Html5Audio.isReady = function () { return this._buffered; }; /** * Checks whether a loading error has occurred. * * @static * @method isError * @return {Boolean} True if a loading error has occurred */ Html5Audio.isError = function () { return this._hasError; }; /** * Checks whether the audio is playing. * * @static * @method isPlaying * @return {Boolean} True if the audio is playing */ Html5Audio.isPlaying = function () { return !this._audioElement.paused; }; /** * Plays the audio. * * @static * @method play * @param {Boolean} loop Whether the audio data play in a loop * @param {Number} offset The start position to play in seconds */ Html5Audio.play = function (loop, offset) { if (this.isReady()) { offset = offset || 0; this._startPlaying(loop, offset); } else if (Html5Audio._audioElement) { this._autoPlay = true; this.addLoadListener(function () { if (this._autoPlay) { this.play(loop, offset); if (this._gainTweenInterval) { clearInterval(this._gainTweenInterval); this._gainTweenInterval = null; } } }.bind(this)); if (!this._isLoading) this._load(this._url); } }; /** * Stops the audio. * * @static * @method stop */ Html5Audio.stop = function () { if (this._audioElement) this._audioElement.pause(); this._autoPlay = false; if (this._tweenInterval) { clearInterval(this._tweenInterval); this._tweenInterval = null; this._audioElement.volume = 0; } }; /** * Performs the audio fade-in. * * @static * @method fadeIn * @param {Number} duration Fade-in time in seconds */ Html5Audio.fadeIn = function (duration) { if (this.isReady()) { if (this._audioElement) { this._tweenTargetGain = this._volume; this._tweenGain = 0; this._startGainTween(duration); } } else if (this._autoPlay) { this.addLoadListener(function () { this.fadeIn(duration); }.bind(this)); } }; /** * Performs the audio fade-out. * * @static * @method fadeOut * @param {Number} duration Fade-out time in seconds */ Html5Audio.fadeOut = function (duration) { if (this._audioElement) { this._tweenTargetGain = 0; this._tweenGain = this._volume; this._startGainTween(duration); } }; /** * Gets the seek position of the audio. * * @static * @method seek */ Html5Audio.seek = function () { if (this._audioElement) { return this._audioElement.currentTime; } else { return 0; } }; /** * Add a callback function that will be called when the audio data is loaded. * * @static * @method addLoadListener * @param {Function} listner The callback function */ Html5Audio.addLoadListener = function (listner) { this._loadListeners.push(listner); }; /** * @static * @method _load * @param {String} url * @private */ Html5Audio._load = function (url) { if (this._audioElement) { this._isLoading = true; this._audioElement.src = url; this._audioElement.load(); } }; /** * @static * @method _startPlaying * @param {Boolean} loop * @param {Number} offset * @private */ Html5Audio._startPlaying = function (loop, offset) { this._audioElement.loop = loop; if (this._gainTweenInterval) { clearInterval(this._gainTweenInterval); this._gainTweenInterval = null; } if (this._audioElement) { this._audioElement.volume = this._volume; this._audioElement.currentTime = offset; this._audioElement.play(); } }; /** * @static * @method _onLoad * @private */ Html5Audio._onLoad = function () { this._isLoading = false; while (this._loadListeners.length > 0) { var listener = this._loadListeners.shift(); listener(); } }; /** * @static * @method _startGainTween * @params {Number} duration * @private */ Html5Audio._startGainTween = function (duration) { this._audioElement.volume = this._tweenGain; if (this._gainTweenInterval) { clearInterval(this._gainTweenInterval); this._gainTweenInterval = null; } this._tweenGainStep = (this._tweenTargetGain - this._tweenGain) / (60 * duration); this._gainTweenInterval = setInterval(function () { Html5Audio._applyTweenValue(Html5Audio._tweenTargetGain); }, 1000 / 60); }; /** * @static * @method _applyTweenValue * @param {Number} volume * @private */ Html5Audio._applyTweenValue = function (volume) { Html5Audio._tweenGain += Html5Audio._tweenGainStep; if (Html5Audio._tweenGain < 0 && Html5Audio._tweenGainStep < 0) { Html5Audio._tweenGain = 0; } else if (Html5Audio._tweenGain > volume && Html5Audio._tweenGainStep > 0) { Html5Audio._tweenGain = volume; } if (Math.abs(Html5Audio._tweenTargetGain - Html5Audio._tweenGain) < 0.01) { Html5Audio._tweenGain = Html5Audio._tweenTargetGain; clearInterval(Html5Audio._gainTweenInterval); Html5Audio._gainTweenInterval = null; } Html5Audio._audioElement.volume = Html5Audio._tweenGain; }; //----------------------------------------------------------------------------- /** * The static class that handles JSON with object information. * * @class JsonEx */ function JsonEx() { throw new Error('This is a static class'); } /** * The maximum depth of objects. * * @static * @property maxDepth * @type Number * @default 100 */ JsonEx.maxDepth = 100; JsonEx._id = 1; JsonEx._generateId = function () { return JsonEx._id++; }; /** * Converts an object to a JSON string with object information. * * @static * @method stringify * @param {Object} object The object to be converted * @return {String} The JSON string */ JsonEx.stringify = function (object) { var circular = []; JsonEx._id = 1; var json = JSON.stringify(this._encode(object, circular, 0)); this._cleanMetadata(object); this._restoreCircularReference(circular); return json; }; JsonEx._restoreCircularReference = function (circulars) { circulars.forEach(function (circular) { var key = circular[0]; var value = circular[1]; var content = circular[2]; value[key] = content; }); }; /** * Parses a JSON string and reconstructs the corresponding object. * * @static * @method parse * @param {String} json The JSON string * @return {Object} The reconstructed object */ JsonEx.parse = function (json) { var circular = []; var registry = {}; var contents = this._decode(JSON.parse(json), circular, registry); this._cleanMetadata(contents); this._linkCircularReference(contents, circular, registry); return contents; }; JsonEx._linkCircularReference = function (contents, circulars, registry) { circulars.forEach(function (circular) { var key = circular[0]; var value = circular[1]; var id = circular[2]; value[key] = registry[id]; }); }; JsonEx._cleanMetadata = function (object) { if (!object) return; delete object['@']; delete object['@c']; if (typeof object === 'object') { Object.keys(object).forEach(function (key) { var value = object[key]; if (typeof value === 'object') { JsonEx._cleanMetadata(value); } }); } }; /** * Makes a deep copy of the specified object. * * @static * @method makeDeepCopy * @param {Object} object The object to be copied * @return {Object} The copied object */ JsonEx.makeDeepCopy = function (object) { return this.parse(this.stringify(object)); }; /** * @static * @method _encode * @param {Object} value * @param {Array} circular * @param {Number} depth * @return {Object} * @private */ JsonEx._encode = function (value, circular, depth) { depth = depth || 0; if (++depth >= this.maxDepth) { throw new Error('Object too deep'); } var type = Object.prototype.toString.call(value); if (type === '[object Object]' || type === '[object Array]') { value['@c'] = JsonEx._generateId(); var constructorName = this._getConstructorName(value); if (constructorName !== 'Object' && constructorName !== 'Array') { value['@'] = constructorName; } for (var key in value) { if (value.hasOwnProperty(key) && !key.match(/^@./)) { if (value[key] && typeof value[key] === 'object') { if (value[key]['@c']) { circular.push([key, value, value[key]]); value[key] = { '@r': value[key]['@c'] }; } else { value[key] = this._encode(value[key], circular, depth + 1); if (value[key] instanceof Array) { //wrap array circular.push([key, value, value[key]]); value[key] = { '@c': value[key]['@c'], '@a': value[key] }; } } } else { value[key] = this._encode(value[key], circular, depth + 1); } } } } depth--; return value; }; /** * @static * @method _decode * @param {Object} value * @param {Array} circular * @param {Object} registry * @return {Object} * @private */ JsonEx._decode = function (value, circular, registry) { var type = Object.prototype.toString.call(value); if (type === '[object Object]' || type === '[object Array]') { registry[value['@c']] = value; if (value['@']) { var constructor = window[value['@']]; if (constructor) { value = this._resetPrototype(value, constructor.prototype); } } for (var key in value) { if (value.hasOwnProperty(key)) { if (value[key] && value[key]['@a']) { //object is array wrapper var body = value[key]['@a']; body['@c'] = value[key]['@c']; value[key] = body; } if (value[key] && value[key]['@r']) { //object is reference circular.push([key, value, value[key]['@r']]) } value[key] = this._decode(value[key], circular, registry); } } } return value; }; /** * @static * @method _getConstructorName * @param {Object} value * @return {String} * @private */ JsonEx._getConstructorName = function (value) { var name = value.constructor.name; if (name === undefined) { var func = /^\s*function\s*([A-Za-z0-9_$]*)/; name = func.exec(value.constructor)[1]; } return name; }; /** * @static * @method _resetPrototype * @param {Object} value * @param {Object} prototype * @return {Object} * @private */ JsonEx._resetPrototype = function (value, prototype) { if (Object.setPrototypeOf !== undefined) { Object.setPrototypeOf(value, prototype); } else if ('__proto__' in value) { value.__proto__ = prototype; } else { var newValue = Object.create(prototype); for (var key in value) { if (value.hasOwnProperty(key)) { newValue[key] = value[key]; } } value = newValue; } return value; }; function Decrypter() { throw new Error('This is a static class'); } Decrypter.hasEncryptedImages = false; Decrypter.hasEncryptedAudio = false; Decrypter._requestImgFile = []; Decrypter._headerlength = 16; Decrypter._xhrOk = 400; Decrypter._encryptionKey = ""; Decrypter._ignoreList = [ "img/system/Window.png" ]; Decrypter.SIGNATURE = "5250474d56000000"; Decrypter.VER = "000301"; Decrypter.REMAIN = "0000000000"; Decrypter.checkImgIgnore = function (url) { for (var cnt = 0; cnt < this._ignoreList.length; cnt++) { if (url === this._ignoreList[cnt]) return true; } return false; }; Decrypter.decryptImg = function (url, bitmap) { url = this.extToEncryptExt(url); var requestFile = new XMLHttpRequest(); requestFile.open("GET", url); requestFile.responseType = "arraybuffer"; requestFile.send(); requestFile.onload = function () { if (this.status < Decrypter._xhrOk) { var arrayBuffer = Decrypter.decryptArrayBuffer(requestFile.response); bitmap._image.src = Decrypter.createBlobUrl(arrayBuffer); bitmap._image.addEventListener('load', bitmap._loadListener = Bitmap.prototype._onLoad.bind(bitmap)); bitmap._image.addEventListener('error', bitmap._errorListener = bitmap._loader || Bitmap.prototype._onError.bind(bitmap)); } }; requestFile.onerror = function () { if (bitmap._loader) { bitmap._loader(); } else { bitmap._onError(); } }; }; Decrypter.decryptHTML5Audio = function (url, bgm, pos) { var requestFile = new XMLHttpRequest(); requestFile.open("GET", url); requestFile.responseType = "arraybuffer"; requestFile.send(); requestFile.onload = function () { if (this.status < Decrypter._xhrOk) { var arrayBuffer = Decrypter.decryptArrayBuffer(requestFile.response); var url = Decrypter.createBlobUrl(arrayBuffer); AudioManager.createDecryptBuffer(url, bgm, pos); } }; }; Decrypter.cutArrayHeader = function (arrayBuffer, length) { return arrayBuffer.slice(length); }; Decrypter.decryptArrayBuffer = function (arrayBuffer) { if (!arrayBuffer) return null; var header = new Uint8Array(arrayBuffer, 0, this._headerlength); var i; var ref = this.SIGNATURE + this.VER + this.REMAIN; var refBytes = new Uint8Array(16); for (i = 0; i < this._headerlength; i++) { refBytes[i] = parseInt("0x" + ref.substr(i * 2, 2), 16); } for (i = 0; i < this._headerlength; i++) { if (header[i] !== refBytes[i]) { throw new Error("Header is wrong"); } } arrayBuffer = this.cutArrayHeader(arrayBuffer, Decrypter._headerlength); var view = new DataView(arrayBuffer); this.readEncryptionkey(); if (arrayBuffer) { var byteArray = new Uint8Array(arrayBuffer); for (i = 0; i < this._headerlength; i++) { byteArray[i] = byteArray[i] ^ parseInt(Decrypter._encryptionKey[i], 16); view.setUint8(i, byteArray[i]); } } return arrayBuffer; }; Decrypter.createBlobUrl = function (arrayBuffer) { var blob = new Blob([arrayBuffer]); return window.URL.createObjectURL(blob); }; Decrypter.extToEncryptExt = function (url) { var ext = url.split('.').pop(); var encryptedExt = ext; if (ext === "ogg") encryptedExt = ".rpgmvo"; else if (ext === "m4a") encryptedExt = ".rpgmvm"; else if (ext === "png") encryptedExt = ".rpgmvp"; else encryptedExt = ext; return url.slice(0, url.lastIndexOf(ext) - 1) + encryptedExt; }; Decrypter.readEncryptionkey = function () { this._encryptionKey = $dataSystem.encryptionKey.split(/(.{2})/).filter(Boolean); }; //----------------------------------------------------------------------------- /** * The static class that handles resource loading. * * @class ResourceHandler */ function ResourceHandler() { throw new Error('This is a static class'); } ResourceHandler._reloaders = []; ResourceHandler._defaultRetryInterval = [500, 1000, 3000]; ResourceHandler.createLoader = function (url, retryMethod, resignMethod, retryInterval) { retryInterval = retryInterval || this._defaultRetryInterval; var reloaders = this._reloaders; var retryCount = 0; return function () { if (retryCount < retryInterval.length) { setTimeout(retryMethod, retryInterval[retryCount]); retryCount++; } else { if (resignMethod) { resignMethod(); } if (url) { if (reloaders.length === 0) { Graphics.printLoadingError(url); SceneManager.stop(); } reloaders.push(function () { retryCount = 0; retryMethod(); }); } } }; }; ResourceHandler.exists = function () { return this._reloaders.length > 0; }; ResourceHandler.retry = function () { if (this._reloaders.length > 0) { Graphics.eraseLoadingError(); SceneManager.resume(); this._reloaders.forEach(function (reloader) { reloader(); }); this._reloaders.length = 0; } };
dazed/translations
www/js/rpg_core.js
JavaScript
unknown
236,568
//============================================================================= // rpg_managers.js v1.6.2 //============================================================================= //----------------------------------------------------------------------------- // DataManager // // The static class that manages the database and game objects. function DataManager() { throw new Error('This is a static class'); } var $dataActors = null; var $dataClasses = null; var $dataSkills = null; var $dataItems = null; var $dataWeapons = null; var $dataArmors = null; var $dataEnemies = null; var $dataTroops = null; var $dataStates = null; var $dataAnimations = null; var $dataTilesets = null; var $dataCommonEvents = null; var $dataSystem = null; var $dataMapInfos = null; var $dataMap = null; var $gameTemp = null; var $gameSystem = null; var $gameScreen = null; var $gameTimer = null; var $gameMessage = null; var $gameSwitches = null; var $gameVariables = null; var $gameSelfSwitches = null; var $gameActors = null; var $gameParty = null; var $gameTroop = null; var $gameMap = null; var $gamePlayer = null; var $testEvent = null; DataManager._globalId = 'RPGMV'; DataManager._lastAccessedId = 1; DataManager._errorUrl = null; DataManager._databaseFiles = [ { name: '$dataActors', src: 'Actors.json' }, { name: '$dataClasses', src: 'Classes.json' }, { name: '$dataSkills', src: 'Skills.json' }, { name: '$dataItems', src: 'Items.json' }, { name: '$dataWeapons', src: 'Weapons.json' }, { name: '$dataArmors', src: 'Armors.json' }, { name: '$dataEnemies', src: 'Enemies.json' }, { name: '$dataTroops', src: 'Troops.json' }, { name: '$dataStates', src: 'States.json' }, { name: '$dataAnimations', src: 'Animations.json' }, { name: '$dataTilesets', src: 'Tilesets.json' }, { name: '$dataCommonEvents', src: 'CommonEvents.json' }, { name: '$dataSystem', src: 'System.json' }, { name: '$dataMapInfos', src: 'MapInfos.json' } ]; DataManager.loadDatabase = function () { var test = this.isBattleTest() || this.isEventTest(); var prefix = test ? 'Test_' : ''; for (var i = 0; i < this._databaseFiles.length; i++) { var name = this._databaseFiles[i].name; var src = this._databaseFiles[i].src; this.loadDataFile(name, prefix + src); } if (this.isEventTest()) { this.loadDataFile('$testEvent', prefix + 'Event.json'); } }; DataManager.loadDataFile = function (name, src) { var xhr = new XMLHttpRequest(); var url = 'data/' + src; xhr.open('GET', url); xhr.overrideMimeType('application/json'); xhr.onload = function () { if (xhr.status < 400) { window[name] = JSON.parse(xhr.responseText); DataManager.onLoad(window[name]); } }; xhr.onerror = this._mapLoader || function () { DataManager._errorUrl = DataManager._errorUrl || url; }; window[name] = null; xhr.send(); }; DataManager.isDatabaseLoaded = function () { this.checkError(); for (var i = 0; i < this._databaseFiles.length; i++) { if (!window[this._databaseFiles[i].name]) { return false; } } return true; }; DataManager.loadMapData = function (mapId) { if (mapId > 0) { var filename = 'Map%1.json'.format(mapId.padZero(3)); this._mapLoader = ResourceHandler.createLoader('data/' + filename, this.loadDataFile.bind(this, '$dataMap', filename)); this.loadDataFile('$dataMap', filename); } else { this.makeEmptyMap(); } }; DataManager.makeEmptyMap = function () { $dataMap = {}; $dataMap.data = []; $dataMap.events = []; $dataMap.width = 100; $dataMap.height = 100; $dataMap.scrollType = 3; }; DataManager.isMapLoaded = function () { this.checkError(); return !!$dataMap; }; DataManager.onLoad = function (object) { var array; if (object === $dataMap) { this.extractMetadata(object); array = object.events; } else { array = object; } if (Array.isArray(array)) { for (var i = 0; i < array.length; i++) { var data = array[i]; if (data && data.note !== undefined) { this.extractMetadata(data); } } } if (object === $dataSystem) { Decrypter.hasEncryptedImages = !!object.hasEncryptedImages; Decrypter.hasEncryptedAudio = !!object.hasEncryptedAudio; Scene_Boot.loadSystemImages(); } }; DataManager.extractMetadata = function (data) { var re = /<([^<>:]+)(:?)([^>]*)>/g; data.meta = {}; for (; ;) { var match = re.exec(data.note); if (match) { if (match[2] === ':') { data.meta[match[1]] = match[3]; } else { data.meta[match[1]] = true; } } else { break; } } }; DataManager.checkError = function () { if (DataManager._errorUrl) { throw new Error('Failed to load: ' + DataManager._errorUrl); } }; DataManager.isBattleTest = function () { return Utils.isOptionValid('btest'); }; DataManager.isEventTest = function () { return Utils.isOptionValid('etest'); }; DataManager.isSkill = function (item) { return item && $dataSkills.contains(item); }; DataManager.isItem = function (item) { return item && $dataItems.contains(item); }; DataManager.isWeapon = function (item) { return item && $dataWeapons.contains(item); }; DataManager.isArmor = function (item) { return item && $dataArmors.contains(item); }; DataManager.createGameObjects = function () { $gameTemp = new Game_Temp(); $gameSystem = new Game_System(); $gameScreen = new Game_Screen(); $gameTimer = new Game_Timer(); $gameMessage = new Game_Message(); $gameSwitches = new Game_Switches(); $gameVariables = new Game_Variables(); $gameSelfSwitches = new Game_SelfSwitches(); $gameActors = new Game_Actors(); $gameParty = new Game_Party(); $gameTroop = new Game_Troop(); $gameMap = new Game_Map(); $gamePlayer = new Game_Player(); }; DataManager.setupNewGame = function () { this.createGameObjects(); this.selectSavefileForNewGame(); $gameParty.setupStartingMembers(); $gamePlayer.reserveTransfer($dataSystem.startMapId, $dataSystem.startX, $dataSystem.startY); Graphics.frameCount = 0; }; DataManager.setupBattleTest = function () { this.createGameObjects(); $gameParty.setupBattleTest(); BattleManager.setup($dataSystem.testTroopId, true, false); BattleManager.setBattleTest(true); BattleManager.playBattleBgm(); }; DataManager.setupEventTest = function () { this.createGameObjects(); this.selectSavefileForNewGame(); $gameParty.setupStartingMembers(); $gamePlayer.reserveTransfer(-1, 8, 6); $gamePlayer.setTransparent(false); }; DataManager.loadGlobalInfo = function () { var json; try { json = StorageManager.load(0); } catch (e) { console.error(e); return []; } if (json) { var globalInfo = JSON.parse(json); for (var i = 1; i <= this.maxSavefiles(); i++) { if (!StorageManager.exists(i)) { delete globalInfo[i]; } } return globalInfo; } else { return []; } }; DataManager.saveGlobalInfo = function (info) { StorageManager.save(0, JSON.stringify(info)); }; DataManager.isThisGameFile = function (savefileId) { var globalInfo = this.loadGlobalInfo(); if (globalInfo && globalInfo[savefileId]) { if (StorageManager.isLocalMode()) { return true; } else { var savefile = globalInfo[savefileId]; return (savefile.globalId === this._globalId && savefile.title === $dataSystem.gameTitle); } } else { return false; } }; DataManager.isAnySavefileExists = function () { var globalInfo = this.loadGlobalInfo(); if (globalInfo) { for (var i = 1; i < globalInfo.length; i++) { if (this.isThisGameFile(i)) { return true; } } } return false; }; DataManager.latestSavefileId = function () { var globalInfo = this.loadGlobalInfo(); var savefileId = 1; var timestamp = 0; if (globalInfo) { for (var i = 1; i < globalInfo.length; i++) { if (this.isThisGameFile(i) && globalInfo[i].timestamp > timestamp) { timestamp = globalInfo[i].timestamp; savefileId = i; } } } return savefileId; }; DataManager.loadAllSavefileImages = function () { var globalInfo = this.loadGlobalInfo(); if (globalInfo) { for (var i = 1; i < globalInfo.length; i++) { if (this.isThisGameFile(i)) { var info = globalInfo[i]; this.loadSavefileImages(info); } } } }; DataManager.loadSavefileImages = function (info) { if (info.characters) { for (var i = 0; i < info.characters.length; i++) { ImageManager.reserveCharacter(info.characters[i][0]); } } if (info.faces) { for (var j = 0; j < info.faces.length; j++) { ImageManager.reserveFace(info.faces[j][0]); } } }; DataManager.maxSavefiles = function () { return 20; }; DataManager.saveGame = function (savefileId) { try { StorageManager.backup(savefileId); return this.saveGameWithoutRescue(savefileId); } catch (e) { console.error(e); try { StorageManager.remove(savefileId); StorageManager.restoreBackup(savefileId); } catch (e2) { } return false; } }; DataManager.loadGame = function (savefileId) { try { return this.loadGameWithoutRescue(savefileId); } catch (e) { console.error(e); return false; } }; DataManager.loadSavefileInfo = function (savefileId) { var globalInfo = this.loadGlobalInfo(); return (globalInfo && globalInfo[savefileId]) ? globalInfo[savefileId] : null; }; DataManager.lastAccessedSavefileId = function () { return this._lastAccessedId; }; DataManager.saveGameWithoutRescue = function (savefileId) { var json = JsonEx.stringify(this.makeSaveContents()); if (json.length >= 200000) { console.warn('Save data too big!'); } StorageManager.save(savefileId, json); this._lastAccessedId = savefileId; var globalInfo = this.loadGlobalInfo() || []; globalInfo[savefileId] = this.makeSavefileInfo(); this.saveGlobalInfo(globalInfo); return true; }; DataManager.loadGameWithoutRescue = function (savefileId) { var globalInfo = this.loadGlobalInfo(); if (this.isThisGameFile(savefileId)) { var json = StorageManager.load(savefileId); this.createGameObjects(); this.extractSaveContents(JsonEx.parse(json)); this._lastAccessedId = savefileId; return true; } else { return false; } }; DataManager.selectSavefileForNewGame = function () { var globalInfo = this.loadGlobalInfo(); this._lastAccessedId = 1; if (globalInfo) { var numSavefiles = Math.max(0, globalInfo.length - 1); if (numSavefiles < this.maxSavefiles()) { this._lastAccessedId = numSavefiles + 1; } else { var timestamp = Number.MAX_VALUE; for (var i = 1; i < globalInfo.length; i++) { if (!globalInfo[i]) { this._lastAccessedId = i; break; } if (globalInfo[i].timestamp < timestamp) { timestamp = globalInfo[i].timestamp; this._lastAccessedId = i; } } } } }; DataManager.makeSavefileInfo = function () { var info = {}; info.globalId = this._globalId; info.title = $dataSystem.gameTitle; info.characters = $gameParty.charactersForSavefile(); info.faces = $gameParty.facesForSavefile(); info.playtime = $gameSystem.playtimeText(); info.timestamp = Date.now(); return info; }; DataManager.makeSaveContents = function () { // A save data does not contain $gameTemp, $gameMessage, and $gameTroop. var contents = {}; contents.system = $gameSystem; contents.screen = $gameScreen; contents.timer = $gameTimer; contents.switches = $gameSwitches; contents.variables = $gameVariables; contents.selfSwitches = $gameSelfSwitches; contents.actors = $gameActors; contents.party = $gameParty; contents.map = $gameMap; contents.player = $gamePlayer; return contents; }; DataManager.extractSaveContents = function (contents) { $gameSystem = contents.system; $gameScreen = contents.screen; $gameTimer = contents.timer; $gameSwitches = contents.switches; $gameVariables = contents.variables; $gameSelfSwitches = contents.selfSwitches; $gameActors = contents.actors; $gameParty = contents.party; $gameMap = contents.map; $gamePlayer = contents.player; }; //----------------------------------------------------------------------------- // ConfigManager // // The static class that manages the configuration data. function ConfigManager() { throw new Error('This is a static class'); } ConfigManager.alwaysDash = false; ConfigManager.commandRemember = false; Object.defineProperty(ConfigManager, 'bgmVolume', { get: function () { return AudioManager._bgmVolume; }, set: function (value) { AudioManager.bgmVolume = value; }, configurable: true }); Object.defineProperty(ConfigManager, 'bgsVolume', { get: function () { return AudioManager.bgsVolume; }, set: function (value) { AudioManager.bgsVolume = value; }, configurable: true }); Object.defineProperty(ConfigManager, 'meVolume', { get: function () { return AudioManager.meVolume; }, set: function (value) { AudioManager.meVolume = value; }, configurable: true }); Object.defineProperty(ConfigManager, 'seVolume', { get: function () { return AudioManager.seVolume; }, set: function (value) { AudioManager.seVolume = value; }, configurable: true }); ConfigManager.load = function () { var json; var config = {}; try { json = StorageManager.load(-1); } catch (e) { console.error(e); } if (json) { config = JSON.parse(json); } this.applyData(config); }; ConfigManager.save = function () { StorageManager.save(-1, JSON.stringify(this.makeData())); }; ConfigManager.makeData = function () { var config = {}; config.alwaysDash = this.alwaysDash; config.commandRemember = this.commandRemember; config.bgmVolume = this.bgmVolume; config.bgsVolume = this.bgsVolume; config.meVolume = this.meVolume; config.seVolume = this.seVolume; return config; }; ConfigManager.applyData = function (config) { this.alwaysDash = this.readFlag(config, 'alwaysDash'); this.commandRemember = this.readFlag(config, 'commandRemember'); this.bgmVolume = this.readVolume(config, 'bgmVolume'); this.bgsVolume = this.readVolume(config, 'bgsVolume'); this.meVolume = this.readVolume(config, 'meVolume'); this.seVolume = this.readVolume(config, 'seVolume'); }; ConfigManager.readFlag = function (config, name) { return !!config[name]; }; ConfigManager.readVolume = function (config, name) { var value = config[name]; if (value !== undefined) { return Number(value).clamp(0, 100); } else { return 100; } }; //----------------------------------------------------------------------------- // StorageManager // // The static class that manages storage for saving game data. function StorageManager() { throw new Error('This is a static class'); } StorageManager.save = function (savefileId, json) { if (this.isLocalMode()) { this.saveToLocalFile(savefileId, json); } else { this.saveToWebStorage(savefileId, json); } }; StorageManager.load = function (savefileId) { if (this.isLocalMode()) { return this.loadFromLocalFile(savefileId); } else { return this.loadFromWebStorage(savefileId); } }; StorageManager.exists = function (savefileId) { if (this.isLocalMode()) { return this.localFileExists(savefileId); } else { return this.webStorageExists(savefileId); } }; StorageManager.remove = function (savefileId) { if (this.isLocalMode()) { this.removeLocalFile(savefileId); } else { this.removeWebStorage(savefileId); } }; StorageManager.backup = function (savefileId) { if (this.exists(savefileId)) { if (this.isLocalMode()) { var data = this.loadFromLocalFile(savefileId); var compressed = LZString.compressToBase64(data); var fs = require('fs'); var dirPath = this.localFileDirectoryPath(); var filePath = this.localFilePath(savefileId) + ".bak"; if (!fs.existsSync(dirPath)) { fs.mkdirSync(dirPath); } fs.writeFileSync(filePath, compressed); } else { var data = this.loadFromWebStorage(savefileId); var compressed = LZString.compressToBase64(data); var key = this.webStorageKey(savefileId) + "bak"; localStorage.setItem(key, compressed); } } }; StorageManager.backupExists = function (savefileId) { if (this.isLocalMode()) { return this.localFileBackupExists(savefileId); } else { return this.webStorageBackupExists(savefileId); } }; StorageManager.cleanBackup = function (savefileId) { if (this.backupExists(savefileId)) { if (this.isLocalMode()) { var fs = require('fs'); var dirPath = this.localFileDirectoryPath(); var filePath = this.localFilePath(savefileId); fs.unlinkSync(filePath + ".bak"); } else { var key = this.webStorageKey(savefileId); localStorage.removeItem(key + "bak"); } } }; StorageManager.restoreBackup = function (savefileId) { if (this.backupExists(savefileId)) { if (this.isLocalMode()) { var data = this.loadFromLocalBackupFile(savefileId); var compressed = LZString.compressToBase64(data); var fs = require('fs'); var dirPath = this.localFileDirectoryPath(); var filePath = this.localFilePath(savefileId); if (!fs.existsSync(dirPath)) { fs.mkdirSync(dirPath); } fs.writeFileSync(filePath, compressed); fs.unlinkSync(filePath + ".bak"); } else { var data = this.loadFromWebStorageBackup(savefileId); var compressed = LZString.compressToBase64(data); var key = this.webStorageKey(savefileId); localStorage.setItem(key, compressed); localStorage.removeItem(key + "bak"); } } }; StorageManager.isLocalMode = function () { return Utils.isNwjs(); }; StorageManager.saveToLocalFile = function (savefileId, json) { var data = LZString.compressToBase64(json); var fs = require('fs'); var dirPath = this.localFileDirectoryPath(); var filePath = this.localFilePath(savefileId); if (!fs.existsSync(dirPath)) { fs.mkdirSync(dirPath); } fs.writeFileSync(filePath, data); }; StorageManager.loadFromLocalFile = function (savefileId) { var data = null; var fs = require('fs'); var filePath = this.localFilePath(savefileId); if (fs.existsSync(filePath)) { data = fs.readFileSync(filePath, { encoding: 'utf8' }); } return LZString.decompressFromBase64(data); }; StorageManager.loadFromLocalBackupFile = function (savefileId) { var data = null; var fs = require('fs'); var filePath = this.localFilePath(savefileId) + ".bak"; if (fs.existsSync(filePath)) { data = fs.readFileSync(filePath, { encoding: 'utf8' }); } return LZString.decompressFromBase64(data); }; StorageManager.localFileBackupExists = function (savefileId) { var fs = require('fs'); return fs.existsSync(this.localFilePath(savefileId) + ".bak"); }; StorageManager.localFileExists = function (savefileId) { var fs = require('fs'); return fs.existsSync(this.localFilePath(savefileId)); }; StorageManager.removeLocalFile = function (savefileId) { var fs = require('fs'); var filePath = this.localFilePath(savefileId); if (fs.existsSync(filePath)) { fs.unlinkSync(filePath); } }; StorageManager.saveToWebStorage = function (savefileId, json) { var key = this.webStorageKey(savefileId); var data = LZString.compressToBase64(json); localStorage.setItem(key, data); }; StorageManager.loadFromWebStorage = function (savefileId) { var key = this.webStorageKey(savefileId); var data = localStorage.getItem(key); return LZString.decompressFromBase64(data); }; StorageManager.loadFromWebStorageBackup = function (savefileId) { var key = this.webStorageKey(savefileId) + "bak"; var data = localStorage.getItem(key); return LZString.decompressFromBase64(data); }; StorageManager.webStorageBackupExists = function (savefileId) { var key = this.webStorageKey(savefileId) + "bak"; return !!localStorage.getItem(key); }; StorageManager.webStorageExists = function (savefileId) { var key = this.webStorageKey(savefileId); return !!localStorage.getItem(key); }; StorageManager.removeWebStorage = function (savefileId) { var key = this.webStorageKey(savefileId); localStorage.removeItem(key); }; StorageManager.localFileDirectoryPath = function () { var path = require('path'); var base = path.dirname(process.mainModule.filename); return path.join(base, 'save/'); }; StorageManager.localFilePath = function (savefileId) { var name; if (savefileId < 0) { name = 'config.rpgsave'; } else if (savefileId === 0) { name = 'global.rpgsave'; } else { name = 'file%1.rpgsave'.format(savefileId); } return this.localFileDirectoryPath() + name; }; StorageManager.webStorageKey = function (savefileId) { if (savefileId < 0) { return 'RPG Config'; } else if (savefileId === 0) { return 'RPG Global'; } else { return 'RPG File%1'.format(savefileId); } }; //----------------------------------------------------------------------------- // ImageManager // // The static class that loads images, creates bitmap objects and retains them. function ImageManager() { throw new Error('This is a static class'); } ImageManager.cache = new CacheMap(ImageManager); ImageManager._imageCache = new ImageCache(); ImageManager._requestQueue = new RequestQueue(); ImageManager._systemReservationId = Utils.generateRuntimeId(); ImageManager._generateCacheKey = function (path, hue) { return path + ':' + hue; }; ImageManager.loadAnimation = function (filename, hue) { return this.loadBitmap('img/animations/', filename, hue, true); }; ImageManager.loadBattleback1 = function (filename, hue) { return this.loadBitmap('img/battlebacks1/', filename, hue, true); }; ImageManager.loadBattleback2 = function (filename, hue) { return this.loadBitmap('img/battlebacks2/', filename, hue, true); }; ImageManager.loadEnemy = function (filename, hue) { return this.loadBitmap('img/enemies/', filename, hue, true); }; ImageManager.loadCharacter = function (filename, hue) { return this.loadBitmap('img/characters/', filename, hue, false); }; ImageManager.loadFace = function (filename, hue) { return this.loadBitmap('img/faces/', filename, hue, true); }; ImageManager.loadParallax = function (filename, hue) { return this.loadBitmap('img/parallaxes/', filename, hue, true); }; ImageManager.loadPicture = function (filename, hue) { return this.loadBitmap('img/pictures/', filename, hue, true); }; ImageManager.loadSvActor = function (filename, hue) { return this.loadBitmap('img/sv_actors/', filename, hue, false); }; ImageManager.loadSvEnemy = function (filename, hue) { return this.loadBitmap('img/sv_enemies/', filename, hue, true); }; ImageManager.loadSystem = function (filename, hue) { return this.loadBitmap('img/system/', filename, hue, false); }; ImageManager.loadTileset = function (filename, hue) { return this.loadBitmap('img/tilesets/', filename, hue, false); }; ImageManager.loadTitle1 = function (filename, hue) { return this.loadBitmap('img/titles1/', filename, hue, true); }; ImageManager.loadTitle2 = function (filename, hue) { return this.loadBitmap('img/titles2/', filename, hue, true); }; ImageManager.loadBitmap = function (folder, filename, hue, smooth) { if (filename) { var path = folder + encodeURIComponent(filename) + '.png'; var bitmap = this.loadNormalBitmap(path, hue || 0); bitmap.smooth = smooth; return bitmap; } else { return this.loadEmptyBitmap(); } }; ImageManager.loadEmptyBitmap = function () { var empty = this._imageCache.get('empty'); if (!empty) { empty = new Bitmap(); this._imageCache.add('empty', empty); this._imageCache.reserve('empty', empty, this._systemReservationId); } return empty; }; ImageManager.loadNormalBitmap = function (path, hue) { var key = this._generateCacheKey(path, hue); var bitmap = this._imageCache.get(key); if (!bitmap) { bitmap = Bitmap.load(decodeURIComponent(path)); bitmap.addLoadListener(function () { bitmap.rotateHue(hue); }); this._imageCache.add(key, bitmap); } else if (!bitmap.isReady()) { bitmap.decode(); } return bitmap; }; ImageManager.clear = function () { this._imageCache = new ImageCache(); }; ImageManager.isReady = function () { return this._imageCache.isReady(); }; ImageManager.isObjectCharacter = function (filename) { var sign = filename.match(/^[\!\$]+/); return sign && sign[0].contains('!'); }; ImageManager.isBigCharacter = function (filename) { var sign = filename.match(/^[\!\$]+/); return sign && sign[0].contains('$'); }; ImageManager.isZeroParallax = function (filename) { return filename.charAt(0) === '!'; }; ImageManager.reserveAnimation = function (filename, hue, reservationId) { return this.reserveBitmap('img/animations/', filename, hue, true, reservationId); }; ImageManager.reserveBattleback1 = function (filename, hue, reservationId) { return this.reserveBitmap('img/battlebacks1/', filename, hue, true, reservationId); }; ImageManager.reserveBattleback2 = function (filename, hue, reservationId) { return this.reserveBitmap('img/battlebacks2/', filename, hue, true, reservationId); }; ImageManager.reserveEnemy = function (filename, hue, reservationId) { return this.reserveBitmap('img/enemies/', filename, hue, true, reservationId); }; ImageManager.reserveCharacter = function (filename, hue, reservationId) { return this.reserveBitmap('img/characters/', filename, hue, false, reservationId); }; ImageManager.reserveFace = function (filename, hue, reservationId) { return this.reserveBitmap('img/faces/', filename, hue, true, reservationId); }; ImageManager.reserveParallax = function (filename, hue, reservationId) { return this.reserveBitmap('img/parallaxes/', filename, hue, true, reservationId); }; ImageManager.reservePicture = function (filename, hue, reservationId) { return this.reserveBitmap('img/pictures/', filename, hue, true, reservationId); }; ImageManager.reserveSvActor = function (filename, hue, reservationId) { return this.reserveBitmap('img/sv_actors/', filename, hue, false, reservationId); }; ImageManager.reserveSvEnemy = function (filename, hue, reservationId) { return this.reserveBitmap('img/sv_enemies/', filename, hue, true, reservationId); }; ImageManager.reserveSystem = function (filename, hue, reservationId) { return this.reserveBitmap('img/system/', filename, hue, false, reservationId || this._systemReservationId); }; ImageManager.reserveTileset = function (filename, hue, reservationId) { return this.reserveBitmap('img/tilesets/', filename, hue, false, reservationId); }; ImageManager.reserveTitle1 = function (filename, hue, reservationId) { return this.reserveBitmap('img/titles1/', filename, hue, true, reservationId); }; ImageManager.reserveTitle2 = function (filename, hue, reservationId) { return this.reserveBitmap('img/titles2/', filename, hue, true, reservationId); }; ImageManager.reserveBitmap = function (folder, filename, hue, smooth, reservationId) { if (filename) { var path = folder + encodeURIComponent(filename) + '.png'; var bitmap = this.reserveNormalBitmap(path, hue || 0, reservationId || this._defaultReservationId); bitmap.smooth = smooth; return bitmap; } else { return this.loadEmptyBitmap(); } }; ImageManager.reserveNormalBitmap = function (path, hue, reservationId) { var bitmap = this.loadNormalBitmap(path, hue); this._imageCache.reserve(this._generateCacheKey(path, hue), bitmap, reservationId); return bitmap; }; ImageManager.releaseReservation = function (reservationId) { this._imageCache.releaseReservation(reservationId); }; ImageManager.setDefaultReservationId = function (reservationId) { this._defaultReservationId = reservationId; }; ImageManager.requestAnimation = function (filename, hue) { return this.requestBitmap('img/animations/', filename, hue, true); }; ImageManager.requestBattleback1 = function (filename, hue) { return this.requestBitmap('img/battlebacks1/', filename, hue, true); }; ImageManager.requestBattleback2 = function (filename, hue) { return this.requestBitmap('img/battlebacks2/', filename, hue, true); }; ImageManager.requestEnemy = function (filename, hue) { return this.requestBitmap('img/enemies/', filename, hue, true); }; ImageManager.requestCharacter = function (filename, hue) { return this.requestBitmap('img/characters/', filename, hue, false); }; ImageManager.requestFace = function (filename, hue) { return this.requestBitmap('img/faces/', filename, hue, true); }; ImageManager.requestParallax = function (filename, hue) { return this.requestBitmap('img/parallaxes/', filename, hue, true); }; ImageManager.requestPicture = function (filename, hue) { return this.requestBitmap('img/pictures/', filename, hue, true); }; ImageManager.requestSvActor = function (filename, hue) { return this.requestBitmap('img/sv_actors/', filename, hue, false); }; ImageManager.requestSvEnemy = function (filename, hue) { return this.requestBitmap('img/sv_enemies/', filename, hue, true); }; ImageManager.requestSystem = function (filename, hue) { return this.requestBitmap('img/system/', filename, hue, false); }; ImageManager.requestTileset = function (filename, hue) { return this.requestBitmap('img/tilesets/', filename, hue, false); }; ImageManager.requestTitle1 = function (filename, hue) { return this.requestBitmap('img/titles1/', filename, hue, true); }; ImageManager.requestTitle2 = function (filename, hue) { return this.requestBitmap('img/titles2/', filename, hue, true); }; ImageManager.requestBitmap = function (folder, filename, hue, smooth) { if (filename) { var path = folder + encodeURIComponent(filename) + '.png'; var bitmap = this.requestNormalBitmap(path, hue || 0); bitmap.smooth = smooth; return bitmap; } else { return this.loadEmptyBitmap(); } }; ImageManager.requestNormalBitmap = function (path, hue) { var key = this._generateCacheKey(path, hue); var bitmap = this._imageCache.get(key); if (!bitmap) { bitmap = Bitmap.request(path); bitmap.addLoadListener(function () { bitmap.rotateHue(hue); }); this._imageCache.add(key, bitmap); this._requestQueue.enqueue(key, bitmap); } else { this._requestQueue.raisePriority(key); } return bitmap; }; ImageManager.update = function () { this._requestQueue.update(); }; ImageManager.clearRequest = function () { this._requestQueue.clear(); }; //----------------------------------------------------------------------------- // AudioManager // // The static class that handles BGM, BGS, ME and SE. function AudioManager() { throw new Error('This is a static class'); } AudioManager._masterVolume = 1; // (min: 0, max: 1) AudioManager._bgmVolume = 100; AudioManager._bgsVolume = 100; AudioManager._meVolume = 100; AudioManager._seVolume = 100; AudioManager._currentBgm = null; AudioManager._currentBgs = null; AudioManager._bgmBuffer = null; AudioManager._bgsBuffer = null; AudioManager._meBuffer = null; AudioManager._seBuffers = []; AudioManager._staticBuffers = []; AudioManager._replayFadeTime = 0.5; AudioManager._path = 'audio/'; AudioManager._blobUrl = null; Object.defineProperty(AudioManager, 'masterVolume', { get: function () { return this._masterVolume; }, set: function (value) { this._masterVolume = value; WebAudio.setMasterVolume(this._masterVolume); Graphics.setVideoVolume(this._masterVolume); }, configurable: true }); Object.defineProperty(AudioManager, 'bgmVolume', { get: function () { return this._bgmVolume; }, set: function (value) { this._bgmVolume = value; this.updateBgmParameters(this._currentBgm); }, configurable: true }); Object.defineProperty(AudioManager, 'bgsVolume', { get: function () { return this._bgsVolume; }, set: function (value) { this._bgsVolume = value; this.updateBgsParameters(this._currentBgs); }, configurable: true }); Object.defineProperty(AudioManager, 'meVolume', { get: function () { return this._meVolume; }, set: function (value) { this._meVolume = value; this.updateMeParameters(this._currentMe); }, configurable: true }); Object.defineProperty(AudioManager, 'seVolume', { get: function () { return this._seVolume; }, set: function (value) { this._seVolume = value; }, configurable: true }); AudioManager.playBgm = function (bgm, pos) { if (this.isCurrentBgm(bgm)) { this.updateBgmParameters(bgm); } else { this.stopBgm(); if (bgm.name) { if (Decrypter.hasEncryptedAudio && this.shouldUseHtml5Audio()) { this.playEncryptedBgm(bgm, pos); } else { this._bgmBuffer = this.createBuffer('bgm', bgm.name); this.updateBgmParameters(bgm); if (!this._meBuffer) { this._bgmBuffer.play(true, pos || 0); } } } } this.updateCurrentBgm(bgm, pos); }; AudioManager.playEncryptedBgm = function (bgm, pos) { var ext = this.audioFileExt(); var url = this._path + 'bgm/' + encodeURIComponent(bgm.name) + ext; url = Decrypter.extToEncryptExt(url); Decrypter.decryptHTML5Audio(url, bgm, pos); }; AudioManager.createDecryptBuffer = function (url, bgm, pos) { this._blobUrl = url; this._bgmBuffer = this.createBuffer('bgm', bgm.name); this.updateBgmParameters(bgm); if (!this._meBuffer) { this._bgmBuffer.play(true, pos || 0); } this.updateCurrentBgm(bgm, pos); }; AudioManager.replayBgm = function (bgm) { if (this.isCurrentBgm(bgm)) { this.updateBgmParameters(bgm); } else { this.playBgm(bgm, bgm.pos); if (this._bgmBuffer) { this._bgmBuffer.fadeIn(this._replayFadeTime); } } }; AudioManager.isCurrentBgm = function (bgm) { return (this._currentBgm && this._bgmBuffer && this._currentBgm.name === bgm.name); }; AudioManager.updateBgmParameters = function (bgm) { this.updateBufferParameters(this._bgmBuffer, this._bgmVolume, bgm); }; AudioManager.updateCurrentBgm = function (bgm, pos) { this._currentBgm = { name: bgm.name, volume: bgm.volume, pitch: bgm.pitch, pan: bgm.pan, pos: pos }; }; AudioManager.stopBgm = function () { if (this._bgmBuffer) { this._bgmBuffer.stop(); this._bgmBuffer = null; this._currentBgm = null; } }; AudioManager.fadeOutBgm = function (duration) { if (this._bgmBuffer && this._currentBgm) { this._bgmBuffer.fadeOut(duration); this._currentBgm = null; } }; AudioManager.fadeInBgm = function (duration) { if (this._bgmBuffer && this._currentBgm) { this._bgmBuffer.fadeIn(duration); } }; AudioManager.playBgs = function (bgs, pos) { if (this.isCurrentBgs(bgs)) { this.updateBgsParameters(bgs); } else { this.stopBgs(); if (bgs.name) { this._bgsBuffer = this.createBuffer('bgs', bgs.name); this.updateBgsParameters(bgs); this._bgsBuffer.play(true, pos || 0); } } this.updateCurrentBgs(bgs, pos); }; AudioManager.replayBgs = function (bgs) { if (this.isCurrentBgs(bgs)) { this.updateBgsParameters(bgs); } else { this.playBgs(bgs, bgs.pos); if (this._bgsBuffer) { this._bgsBuffer.fadeIn(this._replayFadeTime); } } }; AudioManager.isCurrentBgs = function (bgs) { return (this._currentBgs && this._bgsBuffer && this._currentBgs.name === bgs.name); }; AudioManager.updateBgsParameters = function (bgs) { this.updateBufferParameters(this._bgsBuffer, this._bgsVolume, bgs); }; AudioManager.updateCurrentBgs = function (bgs, pos) { this._currentBgs = { name: bgs.name, volume: bgs.volume, pitch: bgs.pitch, pan: bgs.pan, pos: pos }; }; AudioManager.stopBgs = function () { if (this._bgsBuffer) { this._bgsBuffer.stop(); this._bgsBuffer = null; this._currentBgs = null; } }; AudioManager.fadeOutBgs = function (duration) { if (this._bgsBuffer && this._currentBgs) { this._bgsBuffer.fadeOut(duration); this._currentBgs = null; } }; AudioManager.fadeInBgs = function (duration) { if (this._bgsBuffer && this._currentBgs) { this._bgsBuffer.fadeIn(duration); } }; AudioManager.playMe = function (me) { this.stopMe(); if (me.name) { if (this._bgmBuffer && this._currentBgm) { this._currentBgm.pos = this._bgmBuffer.seek(); this._bgmBuffer.stop(); } this._meBuffer = this.createBuffer('me', me.name); this.updateMeParameters(me); this._meBuffer.play(false); this._meBuffer.addStopListener(this.stopMe.bind(this)); } }; AudioManager.updateMeParameters = function (me) { this.updateBufferParameters(this._meBuffer, this._meVolume, me); }; AudioManager.fadeOutMe = function (duration) { if (this._meBuffer) { this._meBuffer.fadeOut(duration); } }; AudioManager.stopMe = function () { if (this._meBuffer) { this._meBuffer.stop(); this._meBuffer = null; if (this._bgmBuffer && this._currentBgm && !this._bgmBuffer.isPlaying()) { this._bgmBuffer.play(true, this._currentBgm.pos); this._bgmBuffer.fadeIn(this._replayFadeTime); } } }; AudioManager.playSe = function (se) { if (se.name) { this._seBuffers = this._seBuffers.filter(function (audio) { return audio.isPlaying(); }); var buffer = this.createBuffer('se', se.name); this.updateSeParameters(buffer, se); buffer.play(false); this._seBuffers.push(buffer); } }; AudioManager.updateSeParameters = function (buffer, se) { this.updateBufferParameters(buffer, this._seVolume, se); }; AudioManager.stopSe = function () { this._seBuffers.forEach(function (buffer) { buffer.stop(); }); this._seBuffers = []; }; AudioManager.playStaticSe = function (se) { if (se.name) { this.loadStaticSe(se); for (var i = 0; i < this._staticBuffers.length; i++) { var buffer = this._staticBuffers[i]; if (buffer._reservedSeName === se.name) { buffer.stop(); this.updateSeParameters(buffer, se); buffer.play(false); break; } } } }; AudioManager.loadStaticSe = function (se) { if (se.name && !this.isStaticSe(se)) { var buffer = this.createBuffer('se', se.name); buffer._reservedSeName = se.name; this._staticBuffers.push(buffer); if (this.shouldUseHtml5Audio()) { Html5Audio.setStaticSe(buffer._url); } } }; AudioManager.isStaticSe = function (se) { for (var i = 0; i < this._staticBuffers.length; i++) { var buffer = this._staticBuffers[i]; if (buffer._reservedSeName === se.name) { return true; } } return false; }; AudioManager.stopAll = function () { this.stopMe(); this.stopBgm(); this.stopBgs(); this.stopSe(); }; AudioManager.saveBgm = function () { if (this._currentBgm) { var bgm = this._currentBgm; return { name: bgm.name, volume: bgm.volume, pitch: bgm.pitch, pan: bgm.pan, pos: this._bgmBuffer ? this._bgmBuffer.seek() : 0 }; } else { return this.makeEmptyAudioObject(); } }; AudioManager.saveBgs = function () { if (this._currentBgs) { var bgs = this._currentBgs; return { name: bgs.name, volume: bgs.volume, pitch: bgs.pitch, pan: bgs.pan, pos: this._bgsBuffer ? this._bgsBuffer.seek() : 0 }; } else { return this.makeEmptyAudioObject(); } }; AudioManager.makeEmptyAudioObject = function () { return { name: '', volume: 0, pitch: 0 }; }; AudioManager.createBuffer = function (folder, name) { var ext = this.audioFileExt(); var url = this._path + folder + '/' + encodeURIComponent(name) + ext; if (this.shouldUseHtml5Audio() && folder === 'bgm') { if (this._blobUrl) Html5Audio.setup(this._blobUrl); else Html5Audio.setup(url); return Html5Audio; } else { return new WebAudio(url); } }; AudioManager.updateBufferParameters = function (buffer, configVolume, audio) { if (buffer && audio) { buffer.volume = configVolume * (audio.volume || 0) / 10000; buffer.pitch = (audio.pitch || 0) / 100; buffer.pan = (audio.pan || 0) / 100; } }; AudioManager.audioFileExt = function () { if (WebAudio.canPlayOgg() && !Utils.isMobileDevice()) { return '.ogg'; } else { return '.m4a'; } }; AudioManager.shouldUseHtml5Audio = function () { // The only case where we wanted html5audio was android/ no encrypt // Atsuma-ru asked to force webaudio there too, so just return false for ALL // return Utils.isAndroidChrome() && !Decrypter.hasEncryptedAudio; return false; }; AudioManager.checkErrors = function () { this.checkWebAudioError(this._bgmBuffer); this.checkWebAudioError(this._bgsBuffer); this.checkWebAudioError(this._meBuffer); this._seBuffers.forEach(function (buffer) { this.checkWebAudioError(buffer); }.bind(this)); this._staticBuffers.forEach(function (buffer) { this.checkWebAudioError(buffer); }.bind(this)); }; AudioManager.checkWebAudioError = function (webAudio) { if (webAudio && webAudio.isError()) { throw new Error('Failed to load: ' + webAudio.url); } }; //----------------------------------------------------------------------------- // SoundManager // // The static class that plays sound effects defined in the database. function SoundManager() { throw new Error('This is a static class'); } SoundManager.preloadImportantSounds = function () { this.loadSystemSound(0); this.loadSystemSound(1); this.loadSystemSound(2); this.loadSystemSound(3); }; SoundManager.loadSystemSound = function (n) { if ($dataSystem) { AudioManager.loadStaticSe($dataSystem.sounds[n]); } }; SoundManager.playSystemSound = function (n) { if ($dataSystem) { AudioManager.playStaticSe($dataSystem.sounds[n]); } }; SoundManager.playCursor = function () { this.playSystemSound(0); }; SoundManager.playOk = function () { this.playSystemSound(1); }; SoundManager.playCancel = function () { this.playSystemSound(2); }; SoundManager.playBuzzer = function () { this.playSystemSound(3); }; SoundManager.playEquip = function () { this.playSystemSound(4); }; SoundManager.playSave = function () { this.playSystemSound(5); }; SoundManager.playLoad = function () { this.playSystemSound(6); }; SoundManager.playBattleStart = function () { this.playSystemSound(7); }; SoundManager.playEscape = function () { this.playSystemSound(8); }; SoundManager.playEnemyAttack = function () { this.playSystemSound(9); }; SoundManager.playEnemyDamage = function () { this.playSystemSound(10); }; SoundManager.playEnemyCollapse = function () { this.playSystemSound(11); }; SoundManager.playBossCollapse1 = function () { this.playSystemSound(12); }; SoundManager.playBossCollapse2 = function () { this.playSystemSound(13); }; SoundManager.playActorDamage = function () { this.playSystemSound(14); }; SoundManager.playActorCollapse = function () { this.playSystemSound(15); }; SoundManager.playRecovery = function () { this.playSystemSound(16); }; SoundManager.playMiss = function () { this.playSystemSound(17); }; SoundManager.playEvasion = function () { this.playSystemSound(18); }; SoundManager.playMagicEvasion = function () { this.playSystemSound(19); }; SoundManager.playReflection = function () { this.playSystemSound(20); }; SoundManager.playShop = function () { this.playSystemSound(21); }; SoundManager.playUseItem = function () { this.playSystemSound(22); }; SoundManager.playUseSkill = function () { this.playSystemSound(23); }; //----------------------------------------------------------------------------- // TextManager // // The static class that handles terms and messages. function TextManager() { throw new Error('This is a static class'); } TextManager.basic = function (basicId) { return $dataSystem.terms.basic[basicId] || ''; }; TextManager.param = function (paramId) { return $dataSystem.terms.params[paramId] || ''; }; TextManager.command = function (commandId) { return $dataSystem.terms.commands[commandId] || ''; }; TextManager.message = function (messageId) { return $dataSystem.terms.messages[messageId] || ''; }; TextManager.getter = function (method, param) { return { get: function () { return this[method](param); }, configurable: true }; }; Object.defineProperty(TextManager, 'currencyUnit', { get: function () { return $dataSystem.currencyUnit; }, configurable: true }); Object.defineProperties(TextManager, { level: TextManager.getter('basic', 0), levelA: TextManager.getter('basic', 1), hp: TextManager.getter('basic', 2), hpA: TextManager.getter('basic', 3), mp: TextManager.getter('basic', 4), mpA: TextManager.getter('basic', 5), tp: TextManager.getter('basic', 6), tpA: TextManager.getter('basic', 7), exp: TextManager.getter('basic', 8), expA: TextManager.getter('basic', 9), fight: TextManager.getter('command', 0), escape: TextManager.getter('command', 1), attack: TextManager.getter('command', 2), guard: TextManager.getter('command', 3), item: TextManager.getter('command', 4), skill: TextManager.getter('command', 5), equip: TextManager.getter('command', 6), status: TextManager.getter('command', 7), formation: TextManager.getter('command', 8), save: TextManager.getter('command', 9), gameEnd: TextManager.getter('command', 10), options: TextManager.getter('command', 11), weapon: TextManager.getter('command', 12), armor: TextManager.getter('command', 13), keyItem: TextManager.getter('command', 14), equip2: TextManager.getter('command', 15), optimize: TextManager.getter('command', 16), clear: TextManager.getter('command', 17), newGame: TextManager.getter('command', 18), continue_: TextManager.getter('command', 19), toTitle: TextManager.getter('command', 21), cancel: TextManager.getter('command', 22), buy: TextManager.getter('command', 24), sell: TextManager.getter('command', 25), alwaysDash: TextManager.getter('message', 'alwaysDash'), commandRemember: TextManager.getter('message', 'commandRemember'), bgmVolume: TextManager.getter('message', 'bgmVolume'), bgsVolume: TextManager.getter('message', 'bgsVolume'), meVolume: TextManager.getter('message', 'meVolume'), seVolume: TextManager.getter('message', 'seVolume'), possession: TextManager.getter('message', 'possession'), expTotal: TextManager.getter('message', 'expTotal'), expNext: TextManager.getter('message', 'expNext'), saveMessage: TextManager.getter('message', 'saveMessage'), loadMessage: TextManager.getter('message', 'loadMessage'), file: TextManager.getter('message', 'file'), partyName: TextManager.getter('message', 'partyName'), emerge: TextManager.getter('message', 'emerge'), preemptive: TextManager.getter('message', 'preemptive'), surprise: TextManager.getter('message', 'surprise'), escapeStart: TextManager.getter('message', 'escapeStart'), escapeFailure: TextManager.getter('message', 'escapeFailure'), victory: TextManager.getter('message', 'victory'), defeat: TextManager.getter('message', 'defeat'), obtainExp: TextManager.getter('message', 'obtainExp'), obtainGold: TextManager.getter('message', 'obtainGold'), obtainItem: TextManager.getter('message', 'obtainItem'), levelUp: TextManager.getter('message', 'levelUp'), obtainSkill: TextManager.getter('message', 'obtainSkill'), useItem: TextManager.getter('message', 'useItem'), criticalToEnemy: TextManager.getter('message', 'criticalToEnemy'), criticalToActor: TextManager.getter('message', 'criticalToActor'), actorDamage: TextManager.getter('message', 'actorDamage'), actorRecovery: TextManager.getter('message', 'actorRecovery'), actorGain: TextManager.getter('message', 'actorGain'), actorLoss: TextManager.getter('message', 'actorLoss'), actorDrain: TextManager.getter('message', 'actorDrain'), actorNoDamage: TextManager.getter('message', 'actorNoDamage'), actorNoHit: TextManager.getter('message', 'actorNoHit'), enemyDamage: TextManager.getter('message', 'enemyDamage'), enemyRecovery: TextManager.getter('message', 'enemyRecovery'), enemyGain: TextManager.getter('message', 'enemyGain'), enemyLoss: TextManager.getter('message', 'enemyLoss'), enemyDrain: TextManager.getter('message', 'enemyDrain'), enemyNoDamage: TextManager.getter('message', 'enemyNoDamage'), enemyNoHit: TextManager.getter('message', 'enemyNoHit'), evasion: TextManager.getter('message', 'evasion'), magicEvasion: TextManager.getter('message', 'magicEvasion'), magicReflection: TextManager.getter('message', 'magicReflection'), counterAttack: TextManager.getter('message', 'counterAttack'), substitute: TextManager.getter('message', 'substitute'), buffAdd: TextManager.getter('message', 'buffAdd'), debuffAdd: TextManager.getter('message', 'debuffAdd'), buffRemove: TextManager.getter('message', 'buffRemove'), actionFailure: TextManager.getter('message', 'actionFailure'), }); //----------------------------------------------------------------------------- // SceneManager // // The static class that manages scene transitions. function SceneManager() { throw new Error('This is a static class'); } /* * Gets the current time in ms without on iOS Safari. * @private */ SceneManager._getTimeInMsWithoutMobileSafari = function () { return performance.now(); }; SceneManager._scene = null; SceneManager._nextScene = null; SceneManager._stack = []; SceneManager._stopped = false; SceneManager._sceneStarted = false; SceneManager._exiting = false; SceneManager._previousClass = null; SceneManager._backgroundBitmap = null; SceneManager._screenWidth = 816; SceneManager._screenHeight = 624; SceneManager._boxWidth = 816; SceneManager._boxHeight = 624; SceneManager._deltaTime = 1.0 / 60.0; if (!Utils.isMobileSafari()) SceneManager._currentTime = SceneManager._getTimeInMsWithoutMobileSafari(); SceneManager._accumulator = 0.0; SceneManager.run = function (sceneClass) { try { this.initialize(); this.goto(sceneClass); this.requestUpdate(); } catch (e) { this.catchException(e); } }; SceneManager.initialize = function () { this.initGraphics(); this.checkFileAccess(); this.initAudio(); this.initInput(); this.initNwjs(); this.checkPluginErrors(); this.setupErrorHandlers(); }; SceneManager.initGraphics = function () { var type = this.preferableRendererType(); Graphics.initialize(this._screenWidth, this._screenHeight, type); Graphics.boxWidth = this._boxWidth; Graphics.boxHeight = this._boxHeight; Graphics.setLoadingImage('img/system/Loading.png'); if (Utils.isOptionValid('showfps')) { Graphics.showFps(); } if (type === 'webgl') { this.checkWebGL(); } }; SceneManager.preferableRendererType = function () { if (Utils.isOptionValid('canvas')) { return 'canvas'; } else if (Utils.isOptionValid('webgl')) { return 'webgl'; } else { return 'auto'; } }; SceneManager.shouldUseCanvasRenderer = function () { return Utils.isMobileDevice(); }; SceneManager.checkWebGL = function () { if (!Graphics.hasWebGL()) { throw new Error('Your browser does not support WebGL.'); } }; SceneManager.checkFileAccess = function () { if (!Utils.canReadGameFiles()) { throw new Error('Your browser does not allow to read local files.'); } }; SceneManager.initAudio = function () { var noAudio = Utils.isOptionValid('noaudio'); if (!WebAudio.initialize(noAudio) && !noAudio) { throw new Error('Your browser does not support Web Audio API.'); } }; SceneManager.initInput = function () { Input.initialize(); TouchInput.initialize(); }; SceneManager.initNwjs = function () { if (Utils.isNwjs()) { var gui = require('nw.gui'); var win = gui.Window.get(); if (process.platform === 'darwin' && !win.menu) { var menubar = new gui.Menu({ type: 'menubar' }); var option = { hideEdit: true, hideWindow: true }; menubar.createMacBuiltin('Game', option); win.menu = menubar; } } }; SceneManager.checkPluginErrors = function () { PluginManager.checkErrors(); }; SceneManager.setupErrorHandlers = function () { window.addEventListener('error', this.onError.bind(this)); document.addEventListener('keydown', this.onKeyDown.bind(this)); }; SceneManager.requestUpdate = function () { if (!this._stopped) { requestAnimationFrame(this.update.bind(this)); } }; SceneManager.update = function () { try { this.tickStart(); if (Utils.isMobileSafari()) { this.updateInputData(); } this.updateManagers(); this.updateMain(); this.tickEnd(); } catch (e) { this.catchException(e); } }; SceneManager.terminate = function () { window.close(); }; SceneManager.onError = function (e) { console.error(e.message); console.error(e.filename, e.lineno); try { this.stop(); Graphics.printError('Error', e.message); AudioManager.stopAll(); } catch (e2) { } }; SceneManager.onKeyDown = function (event) { if (!event.ctrlKey && !event.altKey) { switch (event.keyCode) { case 116: // F5 if (Utils.isNwjs()) { location.reload(); } break; case 119: // F8 if (Utils.isNwjs() && Utils.isOptionValid('test')) { require('nw.gui').Window.get().showDevTools(); } break; } } }; SceneManager.catchException = function (e) { if (e instanceof Error) { Graphics.printError(e.name, e.message); console.error(e.stack); } else { Graphics.printError('UnknownError', e); } AudioManager.stopAll(); this.stop(); }; SceneManager.tickStart = function () { Graphics.tickStart(); }; SceneManager.tickEnd = function () { Graphics.tickEnd(); }; SceneManager.updateInputData = function () { Input.update(); TouchInput.update(); }; SceneManager.updateMain = function () { if (Utils.isMobileSafari()) { this.changeScene(); this.updateScene(); } else { var newTime = this._getTimeInMsWithoutMobileSafari(); var fTime = (newTime - this._currentTime) / 1000; if (fTime > 0.25) fTime = 0.25; this._currentTime = newTime; this._accumulator += fTime; while (this._accumulator >= this._deltaTime) { this.updateInputData(); this.changeScene(); this.updateScene(); this._accumulator -= this._deltaTime; } } this.renderScene(); this.requestUpdate(); }; SceneManager.updateManagers = function () { ImageManager.update(); }; SceneManager.changeScene = function () { if (this.isSceneChanging() && !this.isCurrentSceneBusy()) { if (this._scene) { this._scene.terminate(); this._scene.detachReservation(); this._previousClass = this._scene.constructor; } this._scene = this._nextScene; if (this._scene) { this._scene.attachReservation(); this._scene.create(); this._nextScene = null; this._sceneStarted = false; this.onSceneCreate(); } if (this._exiting) { this.terminate(); } } }; SceneManager.updateScene = function () { if (this._scene) { if (!this._sceneStarted && this._scene.isReady()) { this._scene.start(); this._sceneStarted = true; this.onSceneStart(); } if (this.isCurrentSceneStarted()) { this._scene.update(); } } }; SceneManager.renderScene = function () { if (this.isCurrentSceneStarted()) { Graphics.render(this._scene); } else if (this._scene) { this.onSceneLoading(); } }; SceneManager.onSceneCreate = function () { Graphics.startLoading(); }; SceneManager.onSceneStart = function () { Graphics.endLoading(); }; SceneManager.onSceneLoading = function () { Graphics.updateLoading(); }; SceneManager.isSceneChanging = function () { return this._exiting || !!this._nextScene; }; SceneManager.isCurrentSceneBusy = function () { return this._scene && this._scene.isBusy(); }; SceneManager.isCurrentSceneStarted = function () { return this._scene && this._sceneStarted; }; SceneManager.isNextScene = function (sceneClass) { return this._nextScene && this._nextScene.constructor === sceneClass; }; SceneManager.isPreviousScene = function (sceneClass) { return this._previousClass === sceneClass; }; SceneManager.goto = function (sceneClass) { if (sceneClass) { this._nextScene = new sceneClass(); } if (this._scene) { this._scene.stop(); } }; SceneManager.push = function (sceneClass) { this._stack.push(this._scene.constructor); this.goto(sceneClass); }; SceneManager.pop = function () { if (this._stack.length > 0) { this.goto(this._stack.pop()); } else { this.exit(); } }; SceneManager.exit = function () { this.goto(null); this._exiting = true; }; SceneManager.clearStack = function () { this._stack = []; }; SceneManager.stop = function () { this._stopped = true; }; SceneManager.prepareNextScene = function () { this._nextScene.prepare.apply(this._nextScene, arguments); }; SceneManager.snap = function () { return Bitmap.snap(this._scene); }; SceneManager.snapForBackground = function () { this._backgroundBitmap = this.snap(); this._backgroundBitmap.blur(); }; SceneManager.backgroundBitmap = function () { return this._backgroundBitmap; }; SceneManager.resume = function () { this._stopped = false; this.requestUpdate(); if (!Utils.isMobileSafari()) { this._currentTime = this._getTimeInMsWithoutMobileSafari(); this._accumulator = 0; } }; //----------------------------------------------------------------------------- // BattleManager // // The static class that manages battle progress. function BattleManager() { throw new Error('This is a static class'); } BattleManager.setup = function (troopId, canEscape, canLose) { this.initMembers(); this._canEscape = canEscape; this._canLose = canLose; $gameTroop.setup(troopId); $gameScreen.onBattleStart(); this.makeEscapeRatio(); }; BattleManager.initMembers = function () { this._phase = 'init'; this._canEscape = false; this._canLose = false; this._battleTest = false; this._eventCallback = null; this._preemptive = false; this._surprise = false; this._actorIndex = -1; this._actionForcedBattler = null; this._mapBgm = null; this._mapBgs = null; this._actionBattlers = []; this._subject = null; this._action = null; this._targets = []; this._logWindow = null; this._statusWindow = null; this._spriteset = null; this._escapeRatio = 0; this._escaped = false; this._rewards = {}; this._turnForced = false; }; BattleManager.isBattleTest = function () { return this._battleTest; }; BattleManager.setBattleTest = function (battleTest) { this._battleTest = battleTest; }; BattleManager.setEventCallback = function (callback) { this._eventCallback = callback; }; BattleManager.setLogWindow = function (logWindow) { this._logWindow = logWindow; }; BattleManager.setStatusWindow = function (statusWindow) { this._statusWindow = statusWindow; }; BattleManager.setSpriteset = function (spriteset) { this._spriteset = spriteset; }; BattleManager.onEncounter = function () { this._preemptive = (Math.random() < this.ratePreemptive()); this._surprise = (Math.random() < this.rateSurprise() && !this._preemptive); }; BattleManager.ratePreemptive = function () { return $gameParty.ratePreemptive($gameTroop.agility()); }; BattleManager.rateSurprise = function () { return $gameParty.rateSurprise($gameTroop.agility()); }; BattleManager.saveBgmAndBgs = function () { this._mapBgm = AudioManager.saveBgm(); this._mapBgs = AudioManager.saveBgs(); }; BattleManager.playBattleBgm = function () { AudioManager.playBgm($gameSystem.battleBgm()); AudioManager.stopBgs(); }; BattleManager.playVictoryMe = function () { AudioManager.playMe($gameSystem.victoryMe()); }; BattleManager.playDefeatMe = function () { AudioManager.playMe($gameSystem.defeatMe()); }; BattleManager.replayBgmAndBgs = function () { if (this._mapBgm) { AudioManager.replayBgm(this._mapBgm); } else { AudioManager.stopBgm(); } if (this._mapBgs) { AudioManager.replayBgs(this._mapBgs); } }; BattleManager.makeEscapeRatio = function () { this._escapeRatio = 0.5 * $gameParty.agility() / $gameTroop.agility(); }; BattleManager.update = function () { if (!this.isBusy() && !this.updateEvent()) { switch (this._phase) { case 'start': this.startInput(); break; case 'turn': this.updateTurn(); break; case 'action': this.updateAction(); break; case 'turnEnd': this.updateTurnEnd(); break; case 'battleEnd': this.updateBattleEnd(); break; } } }; BattleManager.updateEvent = function () { switch (this._phase) { case 'start': case 'turn': case 'turnEnd': if (this.isActionForced()) { this.processForcedAction(); return true; } else { return this.updateEventMain(); } } return this.checkAbort(); }; BattleManager.updateEventMain = function () { $gameTroop.updateInterpreter(); $gameParty.requestMotionRefresh(); if ($gameTroop.isEventRunning() || this.checkBattleEnd()) { return true; } $gameTroop.setupBattleEvent(); if ($gameTroop.isEventRunning() || SceneManager.isSceneChanging()) { return true; } return false; }; BattleManager.isBusy = function () { return ($gameMessage.isBusy() || this._spriteset.isBusy() || this._logWindow.isBusy()); }; BattleManager.isInputting = function () { return this._phase === 'input'; }; BattleManager.isInTurn = function () { return this._phase === 'turn'; }; BattleManager.isTurnEnd = function () { return this._phase === 'turnEnd'; }; BattleManager.isAborting = function () { return this._phase === 'aborting'; }; BattleManager.isBattleEnd = function () { return this._phase === 'battleEnd'; }; BattleManager.canEscape = function () { return this._canEscape; }; BattleManager.canLose = function () { return this._canLose; }; BattleManager.isEscaped = function () { return this._escaped; }; BattleManager.actor = function () { return this._actorIndex >= 0 ? $gameParty.members()[this._actorIndex] : null; }; BattleManager.clearActor = function () { this.changeActor(-1, ''); }; BattleManager.changeActor = function (newActorIndex, lastActorActionState) { var lastActor = this.actor(); this._actorIndex = newActorIndex; var newActor = this.actor(); if (lastActor) { lastActor.setActionState(lastActorActionState); } if (newActor) { newActor.setActionState('inputting'); } }; BattleManager.startBattle = function () { this._phase = 'start'; $gameSystem.onBattleStart(); $gameParty.onBattleStart(); $gameTroop.onBattleStart(); this.displayStartMessages(); }; BattleManager.displayStartMessages = function () { $gameTroop.enemyNames().forEach(function (name) { $gameMessage.add(TextManager.emerge.format(name)); }); if (this._preemptive) { $gameMessage.add(TextManager.preemptive.format($gameParty.name())); } else if (this._surprise) { $gameMessage.add(TextManager.surprise.format($gameParty.name())); } }; BattleManager.startInput = function () { this._phase = 'input'; $gameParty.makeActions(); $gameTroop.makeActions(); this.clearActor(); if (this._surprise || !$gameParty.canInput()) { this.startTurn(); } }; BattleManager.inputtingAction = function () { return this.actor() ? this.actor().inputtingAction() : null; }; BattleManager.selectNextCommand = function () { do { if (!this.actor() || !this.actor().selectNextCommand()) { this.changeActor(this._actorIndex + 1, 'waiting'); if (this._actorIndex >= $gameParty.size()) { this.startTurn(); break; } } } while (!this.actor().canInput()); }; BattleManager.selectPreviousCommand = function () { do { if (!this.actor() || !this.actor().selectPreviousCommand()) { this.changeActor(this._actorIndex - 1, 'undecided'); if (this._actorIndex < 0) { return; } } } while (!this.actor().canInput()); }; BattleManager.refreshStatus = function () { this._statusWindow.refresh(); }; BattleManager.startTurn = function () { this._phase = 'turn'; this.clearActor(); $gameTroop.increaseTurn(); this.makeActionOrders(); $gameParty.requestMotionRefresh(); this._logWindow.startTurn(); }; BattleManager.updateTurn = function () { $gameParty.requestMotionRefresh(); if (!this._subject) { this._subject = this.getNextSubject(); } if (this._subject) { this.processTurn(); } else { this.endTurn(); } }; BattleManager.processTurn = function () { var subject = this._subject; var action = subject.currentAction(); if (action) { action.prepare(); if (action.isValid()) { this.startAction(); } subject.removeCurrentAction(); } else { subject.onAllActionsEnd(); this.refreshStatus(); this._logWindow.displayAutoAffectedStatus(subject); this._logWindow.displayCurrentState(subject); this._logWindow.displayRegeneration(subject); this._subject = this.getNextSubject(); } }; BattleManager.endTurn = function () { this._phase = 'turnEnd'; this._preemptive = false; this._surprise = false; this.allBattleMembers().forEach(function (battler) { battler.onTurnEnd(); this.refreshStatus(); this._logWindow.displayAutoAffectedStatus(battler); this._logWindow.displayRegeneration(battler); }, this); if (this.isForcedTurn()) { this._turnForced = false; } }; BattleManager.isForcedTurn = function () { return this._turnForced; }; BattleManager.updateTurnEnd = function () { this.startInput(); }; BattleManager.getNextSubject = function () { for (; ;) { var battler = this._actionBattlers.shift(); if (!battler) { return null; } if (battler.isBattleMember() && battler.isAlive()) { return battler; } } }; BattleManager.allBattleMembers = function () { return $gameParty.members().concat($gameTroop.members()); }; BattleManager.makeActionOrders = function () { var battlers = []; if (!this._surprise) { battlers = battlers.concat($gameParty.members()); } if (!this._preemptive) { battlers = battlers.concat($gameTroop.members()); } battlers.forEach(function (battler) { battler.makeSpeed(); }); battlers.sort(function (a, b) { return b.speed() - a.speed(); }); this._actionBattlers = battlers; }; BattleManager.startAction = function () { var subject = this._subject; var action = subject.currentAction(); var targets = action.makeTargets(); this._phase = 'action'; this._action = action; this._targets = targets; subject.useItem(action.item()); this._action.applyGlobal(); this.refreshStatus(); this._logWindow.startAction(subject, action, targets); }; BattleManager.updateAction = function () { var target = this._targets.shift(); if (target) { this.invokeAction(this._subject, target); } else { this.endAction(); } }; BattleManager.endAction = function () { this._logWindow.endAction(this._subject); this._phase = 'turn'; }; BattleManager.invokeAction = function (subject, target) { this._logWindow.push('pushBaseLine'); if (Math.random() < this._action.itemCnt(target)) { this.invokeCounterAttack(subject, target); } else if (Math.random() < this._action.itemMrf(target)) { this.invokeMagicReflection(subject, target); } else { this.invokeNormalAction(subject, target); } subject.setLastTarget(target); this._logWindow.push('popBaseLine'); this.refreshStatus(); }; BattleManager.invokeNormalAction = function (subject, target) { var realTarget = this.applySubstitute(target); this._action.apply(realTarget); this._logWindow.displayActionResults(subject, realTarget); }; BattleManager.invokeCounterAttack = function (subject, target) { var action = new Game_Action(target); action.setAttack(); action.apply(subject); this._logWindow.displayCounter(target); this._logWindow.displayActionResults(target, subject); }; BattleManager.invokeMagicReflection = function (subject, target) { this._action._reflectionTarget = target; this._logWindow.displayReflection(target); this._action.apply(subject); this._logWindow.displayActionResults(target, subject); }; BattleManager.applySubstitute = function (target) { if (this.checkSubstitute(target)) { var substitute = target.friendsUnit().substituteBattler(); if (substitute && target !== substitute) { this._logWindow.displaySubstitute(substitute, target); return substitute; } } return target; }; BattleManager.checkSubstitute = function (target) { return target.isDying() && !this._action.isCertainHit(); }; BattleManager.isActionForced = function () { return !!this._actionForcedBattler; }; BattleManager.forceAction = function (battler) { this._actionForcedBattler = battler; var index = this._actionBattlers.indexOf(battler); if (index >= 0) { this._actionBattlers.splice(index, 1); } }; BattleManager.processForcedAction = function () { if (this._actionForcedBattler) { this._turnForced = true; this._subject = this._actionForcedBattler; this._actionForcedBattler = null; this.startAction(); this._subject.removeCurrentAction(); } }; BattleManager.abort = function () { this._phase = 'aborting'; }; BattleManager.checkBattleEnd = function () { if (this._phase) { if (this.checkAbort()) { return true; } else if ($gameParty.isAllDead()) { this.processDefeat(); return true; } else if ($gameTroop.isAllDead()) { this.processVictory(); return true; } } return false; }; BattleManager.checkAbort = function () { if ($gameParty.isEmpty() || this.isAborting()) { SoundManager.playEscape(); this._escaped = true; this.processAbort(); } return false; }; BattleManager.processVictory = function () { $gameParty.removeBattleStates(); $gameParty.performVictory(); this.playVictoryMe(); this.replayBgmAndBgs(); this.makeRewards(); this.displayVictoryMessage(); this.displayRewards(); this.gainRewards(); this.endBattle(0); }; BattleManager.processEscape = function () { $gameParty.performEscape(); SoundManager.playEscape(); var success = this._preemptive ? true : (Math.random() < this._escapeRatio); if (success) { this.displayEscapeSuccessMessage(); this._escaped = true; this.processAbort(); } else { this.displayEscapeFailureMessage(); this._escapeRatio += 0.1; $gameParty.clearActions(); this.startTurn(); } return success; }; BattleManager.processAbort = function () { $gameParty.removeBattleStates(); this.replayBgmAndBgs(); this.endBattle(1); }; BattleManager.processDefeat = function () { this.displayDefeatMessage(); this.playDefeatMe(); if (this._canLose) { this.replayBgmAndBgs(); } else { AudioManager.stopBgm(); } this.endBattle(2); }; BattleManager.endBattle = function (result) { this._phase = 'battleEnd'; if (this._eventCallback) { this._eventCallback(result); } if (result === 0) { $gameSystem.onBattleWin(); } else if (this._escaped) { $gameSystem.onBattleEscape(); } }; BattleManager.updateBattleEnd = function () { if (this.isBattleTest()) { AudioManager.stopBgm(); SceneManager.exit(); } else if (!this._escaped && $gameParty.isAllDead()) { if (this._canLose) { $gameParty.reviveBattleMembers(); SceneManager.pop(); } else { SceneManager.goto(Scene_Gameover); } } else { SceneManager.pop(); } this._phase = null; }; BattleManager.makeRewards = function () { this._rewards = {}; this._rewards.gold = $gameTroop.goldTotal(); this._rewards.exp = $gameTroop.expTotal(); this._rewards.items = $gameTroop.makeDropItems(); }; BattleManager.displayVictoryMessage = function () { $gameMessage.add(TextManager.victory.format($gameParty.name())); }; BattleManager.displayDefeatMessage = function () { $gameMessage.add(TextManager.defeat.format($gameParty.name())); }; BattleManager.displayEscapeSuccessMessage = function () { $gameMessage.add(TextManager.escapeStart.format($gameParty.name())); }; BattleManager.displayEscapeFailureMessage = function () { $gameMessage.add(TextManager.escapeStart.format($gameParty.name())); $gameMessage.add('\\.' + TextManager.escapeFailure); }; BattleManager.displayRewards = function () { this.displayExp(); this.displayGold(); this.displayDropItems(); }; BattleManager.displayExp = function () { var exp = this._rewards.exp; if (exp > 0) { var text = TextManager.obtainExp.format(exp, TextManager.exp); $gameMessage.add('\\.' + text); } }; BattleManager.displayGold = function () { var gold = this._rewards.gold; if (gold > 0) { $gameMessage.add('\\.' + TextManager.obtainGold.format(gold)); } }; BattleManager.displayDropItems = function () { var items = this._rewards.items; if (items.length > 0) { $gameMessage.newPage(); items.forEach(function (item) { $gameMessage.add(TextManager.obtainItem.format(item.name)); }); } }; BattleManager.gainRewards = function () { this.gainExp(); this.gainGold(); this.gainDropItems(); }; BattleManager.gainExp = function () { var exp = this._rewards.exp; $gameParty.allMembers().forEach(function (actor) { actor.gainExp(exp); }); }; BattleManager.gainGold = function () { $gameParty.gainGold(this._rewards.gold); }; BattleManager.gainDropItems = function () { var items = this._rewards.items; items.forEach(function (item) { $gameParty.gainItem(item, 1); }); }; //----------------------------------------------------------------------------- // PluginManager // // The static class that manages the plugins. function PluginManager() { throw new Error('This is a static class'); } PluginManager._path = 'js/plugins/'; PluginManager._scripts = []; PluginManager._errorUrls = []; PluginManager._parameters = {}; PluginManager.setup = function (plugins) { plugins.forEach(function (plugin) { if (plugin.status && !this._scripts.contains(plugin.name)) { this.setParameters(plugin.name, plugin.parameters); this.loadScript(plugin.name + '.js'); this._scripts.push(plugin.name); } }, this); }; PluginManager.checkErrors = function () { var url = this._errorUrls.shift(); if (url) { throw new Error('Failed to load: ' + url); } }; PluginManager.parameters = function (name) { return this._parameters[name.toLowerCase()] || {}; }; PluginManager.setParameters = function (name, parameters) { this._parameters[name.toLowerCase()] = parameters; }; PluginManager.loadScript = function (name) { var url = this._path + name; var script = document.createElement('script'); script.type = 'text/javascript'; script.src = url; script.async = false; script.onerror = this.onError.bind(this); script._url = url; document.body.appendChild(script); }; PluginManager.onError = function (e) { this._errorUrls.push(e.target._url); };
dazed/translations
www/js/rpg_managers.js
JavaScript
unknown
80,281
//============================================================================= // rpg_objects.js v1.6.2 //============================================================================= //----------------------------------------------------------------------------- // Game_Temp // // The game object class for temporary data that is not included in save data. function Game_Temp() { this.initialize.apply(this, arguments); } Game_Temp.prototype.initialize = function () { this._isPlaytest = Utils.isOptionValid('test'); this._commonEventId = 0; this._destinationX = null; this._destinationY = null; }; Game_Temp.prototype.isPlaytest = function () { return this._isPlaytest; }; Game_Temp.prototype.reserveCommonEvent = function (commonEventId) { this._commonEventId = commonEventId; }; Game_Temp.prototype.clearCommonEvent = function () { this._commonEventId = 0; }; Game_Temp.prototype.isCommonEventReserved = function () { return this._commonEventId > 0; }; Game_Temp.prototype.reservedCommonEvent = function () { return $dataCommonEvents[this._commonEventId]; }; Game_Temp.prototype.setDestination = function (x, y) { this._destinationX = x; this._destinationY = y; }; Game_Temp.prototype.clearDestination = function () { this._destinationX = null; this._destinationY = null; }; Game_Temp.prototype.isDestinationValid = function () { return this._destinationX !== null; }; Game_Temp.prototype.destinationX = function () { return this._destinationX; }; Game_Temp.prototype.destinationY = function () { return this._destinationY; }; //----------------------------------------------------------------------------- // Game_System // // The game object class for the system data. function Game_System() { this.initialize.apply(this, arguments); } Game_System.prototype.initialize = function () { this._saveEnabled = true; this._menuEnabled = true; this._encounterEnabled = true; this._formationEnabled = true; this._battleCount = 0; this._winCount = 0; this._escapeCount = 0; this._saveCount = 0; this._versionId = 0; this._framesOnSave = 0; this._bgmOnSave = null; this._bgsOnSave = null; this._windowTone = null; this._battleBgm = null; this._victoryMe = null; this._defeatMe = null; this._savedBgm = null; this._walkingBgm = null; }; Game_System.prototype.isJapanese = function () { return $dataSystem.locale.match(/^ja/); }; Game_System.prototype.isChinese = function () { return $dataSystem.locale.match(/^zh/); }; Game_System.prototype.isKorean = function () { return $dataSystem.locale.match(/^ko/); }; Game_System.prototype.isCJK = function () { return $dataSystem.locale.match(/^(ja|zh|ko)/); }; Game_System.prototype.isRussian = function () { return $dataSystem.locale.match(/^ru/); }; Game_System.prototype.isSideView = function () { return $dataSystem.optSideView; }; Game_System.prototype.isSaveEnabled = function () { return this._saveEnabled; }; Game_System.prototype.disableSave = function () { this._saveEnabled = false; }; Game_System.prototype.enableSave = function () { this._saveEnabled = true; }; Game_System.prototype.isMenuEnabled = function () { return this._menuEnabled; }; Game_System.prototype.disableMenu = function () { this._menuEnabled = false; }; Game_System.prototype.enableMenu = function () { this._menuEnabled = true; }; Game_System.prototype.isEncounterEnabled = function () { return this._encounterEnabled; }; Game_System.prototype.disableEncounter = function () { this._encounterEnabled = false; }; Game_System.prototype.enableEncounter = function () { this._encounterEnabled = true; }; Game_System.prototype.isFormationEnabled = function () { return this._formationEnabled; }; Game_System.prototype.disableFormation = function () { this._formationEnabled = false; }; Game_System.prototype.enableFormation = function () { this._formationEnabled = true; }; Game_System.prototype.battleCount = function () { return this._battleCount; }; Game_System.prototype.winCount = function () { return this._winCount; }; Game_System.prototype.escapeCount = function () { return this._escapeCount; }; Game_System.prototype.saveCount = function () { return this._saveCount; }; Game_System.prototype.versionId = function () { return this._versionId; }; Game_System.prototype.windowTone = function () { return this._windowTone || $dataSystem.windowTone; }; Game_System.prototype.setWindowTone = function (value) { this._windowTone = value; }; Game_System.prototype.battleBgm = function () { return this._battleBgm || $dataSystem.battleBgm; }; Game_System.prototype.setBattleBgm = function (value) { this._battleBgm = value; }; Game_System.prototype.victoryMe = function () { return this._victoryMe || $dataSystem.victoryMe; }; Game_System.prototype.setVictoryMe = function (value) { this._victoryMe = value; }; Game_System.prototype.defeatMe = function () { return this._defeatMe || $dataSystem.defeatMe; }; Game_System.prototype.setDefeatMe = function (value) { this._defeatMe = value; }; Game_System.prototype.onBattleStart = function () { this._battleCount++; }; Game_System.prototype.onBattleWin = function () { this._winCount++; }; Game_System.prototype.onBattleEscape = function () { this._escapeCount++; }; Game_System.prototype.onBeforeSave = function () { this._saveCount++; this._versionId = $dataSystem.versionId; this._framesOnSave = Graphics.frameCount; this._bgmOnSave = AudioManager.saveBgm(); this._bgsOnSave = AudioManager.saveBgs(); }; Game_System.prototype.onAfterLoad = function () { Graphics.frameCount = this._framesOnSave; AudioManager.playBgm(this._bgmOnSave); AudioManager.playBgs(this._bgsOnSave); }; Game_System.prototype.playtime = function () { return Math.floor(Graphics.frameCount / 60); }; Game_System.prototype.playtimeText = function () { var hour = Math.floor(this.playtime() / 60 / 60); var min = Math.floor(this.playtime() / 60) % 60; var sec = this.playtime() % 60; return hour.padZero(2) + ':' + min.padZero(2) + ':' + sec.padZero(2); }; Game_System.prototype.saveBgm = function () { this._savedBgm = AudioManager.saveBgm(); }; Game_System.prototype.replayBgm = function () { if (this._savedBgm) { AudioManager.replayBgm(this._savedBgm); } }; Game_System.prototype.saveWalkingBgm = function () { this._walkingBgm = AudioManager.saveBgm(); }; Game_System.prototype.replayWalkingBgm = function () { if (this._walkingBgm) { AudioManager.playBgm(this._walkingBgm); } }; Game_System.prototype.saveWalkingBgm2 = function () { this._walkingBgm = $dataMap.bgm; }; //----------------------------------------------------------------------------- // Game_Timer // // The game object class for the timer. function Game_Timer() { this.initialize.apply(this, arguments); } Game_Timer.prototype.initialize = function () { this._frames = 0; this._working = false; }; Game_Timer.prototype.update = function (sceneActive) { if (sceneActive && this._working && this._frames > 0) { this._frames--; if (this._frames === 0) { this.onExpire(); } } }; Game_Timer.prototype.start = function (count) { this._frames = count; this._working = true; }; Game_Timer.prototype.stop = function () { this._working = false; }; Game_Timer.prototype.isWorking = function () { return this._working; }; Game_Timer.prototype.seconds = function () { return Math.floor(this._frames / 60); }; Game_Timer.prototype.onExpire = function () { BattleManager.abort(); }; //----------------------------------------------------------------------------- // Game_Message // // The game object class for the state of the message window that displays text // or selections, etc. function Game_Message() { this.initialize.apply(this, arguments); } Game_Message.prototype.initialize = function () { this.clear(); }; Game_Message.prototype.clear = function () { this._texts = []; this._choices = []; this._faceName = ''; this._faceIndex = 0; this._background = 0; this._positionType = 2; this._choiceDefaultType = 0; this._choiceCancelType = 0; this._choiceBackground = 0; this._choicePositionType = 2; this._numInputVariableId = 0; this._numInputMaxDigits = 0; this._itemChoiceVariableId = 0; this._itemChoiceItypeId = 0; this._scrollMode = false; this._scrollSpeed = 2; this._scrollNoFast = false; this._choiceCallback = null; }; Game_Message.prototype.choices = function () { return this._choices; }; Game_Message.prototype.faceName = function () { return this._faceName; }; Game_Message.prototype.faceIndex = function () { return this._faceIndex; }; Game_Message.prototype.background = function () { return this._background; }; Game_Message.prototype.positionType = function () { return this._positionType; }; Game_Message.prototype.choiceDefaultType = function () { return this._choiceDefaultType; }; Game_Message.prototype.choiceCancelType = function () { return this._choiceCancelType; }; Game_Message.prototype.choiceBackground = function () { return this._choiceBackground; }; Game_Message.prototype.choicePositionType = function () { return this._choicePositionType; }; Game_Message.prototype.numInputVariableId = function () { return this._numInputVariableId; }; Game_Message.prototype.numInputMaxDigits = function () { return this._numInputMaxDigits; }; Game_Message.prototype.itemChoiceVariableId = function () { return this._itemChoiceVariableId; }; Game_Message.prototype.itemChoiceItypeId = function () { return this._itemChoiceItypeId; }; Game_Message.prototype.scrollMode = function () { return this._scrollMode; }; Game_Message.prototype.scrollSpeed = function () { return this._scrollSpeed; }; Game_Message.prototype.scrollNoFast = function () { return this._scrollNoFast; }; Game_Message.prototype.add = function (text) { this._texts.push(text); }; Game_Message.prototype.setFaceImage = function (faceName, faceIndex) { this._faceName = faceName; this._faceIndex = faceIndex; }; Game_Message.prototype.setBackground = function (background) { this._background = background; }; Game_Message.prototype.setPositionType = function (positionType) { this._positionType = positionType; }; Game_Message.prototype.setChoices = function (choices, defaultType, cancelType) { this._choices = choices; this._choiceDefaultType = defaultType; this._choiceCancelType = cancelType; }; Game_Message.prototype.setChoiceBackground = function (background) { this._choiceBackground = background; }; Game_Message.prototype.setChoicePositionType = function (positionType) { this._choicePositionType = positionType; }; Game_Message.prototype.setNumberInput = function (variableId, maxDigits) { this._numInputVariableId = variableId; this._numInputMaxDigits = maxDigits; }; Game_Message.prototype.setItemChoice = function (variableId, itemType) { this._itemChoiceVariableId = variableId; this._itemChoiceItypeId = itemType; }; Game_Message.prototype.setScroll = function (speed, noFast) { this._scrollMode = true; this._scrollSpeed = speed; this._scrollNoFast = noFast; }; Game_Message.prototype.setChoiceCallback = function (callback) { this._choiceCallback = callback; }; Game_Message.prototype.onChoice = function (n) { if (this._choiceCallback) { this._choiceCallback(n); this._choiceCallback = null; } }; Game_Message.prototype.hasText = function () { return this._texts.length > 0; }; Game_Message.prototype.isChoice = function () { return this._choices.length > 0; }; Game_Message.prototype.isNumberInput = function () { return this._numInputVariableId > 0; }; Game_Message.prototype.isItemChoice = function () { return this._itemChoiceVariableId > 0; }; Game_Message.prototype.isBusy = function () { return (this.hasText() || this.isChoice() || this.isNumberInput() || this.isItemChoice()); }; Game_Message.prototype.newPage = function () { if (this._texts.length > 0) { this._texts[this._texts.length - 1] += '\f'; } }; Game_Message.prototype.allText = function () { return this._texts.join('\n'); }; //----------------------------------------------------------------------------- // Game_Switches // // The game object class for switches. function Game_Switches() { this.initialize.apply(this, arguments); } Game_Switches.prototype.initialize = function () { this.clear(); }; Game_Switches.prototype.clear = function () { this._data = []; }; Game_Switches.prototype.value = function (switchId) { return !!this._data[switchId]; }; Game_Switches.prototype.setValue = function (switchId, value) { if (switchId > 0 && switchId < $dataSystem.switches.length) { this._data[switchId] = value; this.onChange(); } }; Game_Switches.prototype.onChange = function () { $gameMap.requestRefresh(); }; //----------------------------------------------------------------------------- // Game_Variables // // The game object class for variables. function Game_Variables() { this.initialize.apply(this, arguments); } Game_Variables.prototype.initialize = function () { this.clear(); }; Game_Variables.prototype.clear = function () { this._data = []; }; Game_Variables.prototype.value = function (variableId) { return this._data[variableId] || 0; }; Game_Variables.prototype.setValue = function (variableId, value) { if (variableId > 0 && variableId < $dataSystem.variables.length) { if (typeof value === 'number') { value = Math.floor(value); } this._data[variableId] = value; this.onChange(); } }; Game_Variables.prototype.onChange = function () { $gameMap.requestRefresh(); }; //----------------------------------------------------------------------------- // Game_SelfSwitches // // The game object class for self switches. function Game_SelfSwitches() { this.initialize.apply(this, arguments); } Game_SelfSwitches.prototype.initialize = function () { this.clear(); }; Game_SelfSwitches.prototype.clear = function () { this._data = {}; }; Game_SelfSwitches.prototype.value = function (key) { return !!this._data[key]; }; Game_SelfSwitches.prototype.setValue = function (key, value) { if (value) { this._data[key] = true; } else { delete this._data[key]; } this.onChange(); }; Game_SelfSwitches.prototype.onChange = function () { $gameMap.requestRefresh(); }; //----------------------------------------------------------------------------- // Game_Screen // // The game object class for screen effect data, such as changes in color tone // and flashes. function Game_Screen() { this.initialize.apply(this, arguments); } Game_Screen.prototype.initialize = function () { this.clear(); }; Game_Screen.prototype.clear = function () { this.clearFade(); this.clearTone(); this.clearFlash(); this.clearShake(); this.clearZoom(); this.clearWeather(); this.clearPictures(); }; Game_Screen.prototype.onBattleStart = function () { this.clearFade(); this.clearFlash(); this.clearShake(); this.clearZoom(); this.eraseBattlePictures(); }; Game_Screen.prototype.brightness = function () { return this._brightness; }; Game_Screen.prototype.tone = function () { return this._tone; }; Game_Screen.prototype.flashColor = function () { return this._flashColor; }; Game_Screen.prototype.shake = function () { return this._shake; }; Game_Screen.prototype.zoomX = function () { return this._zoomX; }; Game_Screen.prototype.zoomY = function () { return this._zoomY; }; Game_Screen.prototype.zoomScale = function () { return this._zoomScale; }; Game_Screen.prototype.weatherType = function () { return this._weatherType; }; Game_Screen.prototype.weatherPower = function () { return this._weatherPower; }; Game_Screen.prototype.picture = function (pictureId) { var realPictureId = this.realPictureId(pictureId); return this._pictures[realPictureId]; }; Game_Screen.prototype.realPictureId = function (pictureId) { if ($gameParty.inBattle()) { return pictureId + this.maxPictures(); } else { return pictureId; } }; Game_Screen.prototype.clearFade = function () { this._brightness = 255; this._fadeOutDuration = 0; this._fadeInDuration = 0; }; Game_Screen.prototype.clearTone = function () { this._tone = [0, 0, 0, 0]; this._toneTarget = [0, 0, 0, 0]; this._toneDuration = 0; }; Game_Screen.prototype.clearFlash = function () { this._flashColor = [0, 0, 0, 0]; this._flashDuration = 0; }; Game_Screen.prototype.clearShake = function () { this._shakePower = 0; this._shakeSpeed = 0; this._shakeDuration = 0; this._shakeDirection = 1; this._shake = 0; }; Game_Screen.prototype.clearZoom = function () { this._zoomX = 0; this._zoomY = 0; this._zoomScale = 1; this._zoomScaleTarget = 1; this._zoomDuration = 0; }; Game_Screen.prototype.clearWeather = function () { this._weatherType = 'none'; this._weatherPower = 0; this._weatherPowerTarget = 0; this._weatherDuration = 0; }; Game_Screen.prototype.clearPictures = function () { this._pictures = []; }; Game_Screen.prototype.eraseBattlePictures = function () { this._pictures = this._pictures.slice(0, this.maxPictures() + 1); }; Game_Screen.prototype.maxPictures = function () { return 100; }; Game_Screen.prototype.startFadeOut = function (duration) { this._fadeOutDuration = duration; this._fadeInDuration = 0; }; Game_Screen.prototype.startFadeIn = function (duration) { this._fadeInDuration = duration; this._fadeOutDuration = 0; }; Game_Screen.prototype.startTint = function (tone, duration) { this._toneTarget = tone.clone(); this._toneDuration = duration; if (this._toneDuration === 0) { this._tone = this._toneTarget.clone(); } }; Game_Screen.prototype.startFlash = function (color, duration) { this._flashColor = color.clone(); this._flashDuration = duration; }; Game_Screen.prototype.startShake = function (power, speed, duration) { this._shakePower = power; this._shakeSpeed = speed; this._shakeDuration = duration; }; Game_Screen.prototype.startZoom = function (x, y, scale, duration) { this._zoomX = x; this._zoomY = y; this._zoomScaleTarget = scale; this._zoomDuration = duration; }; Game_Screen.prototype.setZoom = function (x, y, scale) { this._zoomX = x; this._zoomY = y; this._zoomScale = scale; }; Game_Screen.prototype.changeWeather = function (type, power, duration) { if (type !== 'none' || duration === 0) { this._weatherType = type; } this._weatherPowerTarget = type === 'none' ? 0 : power; this._weatherDuration = duration; if (duration === 0) { this._weatherPower = this._weatherPowerTarget; } }; Game_Screen.prototype.update = function () { this.updateFadeOut(); this.updateFadeIn(); this.updateTone(); this.updateFlash(); this.updateShake(); this.updateZoom(); this.updateWeather(); this.updatePictures(); }; Game_Screen.prototype.updateFadeOut = function () { if (this._fadeOutDuration > 0) { var d = this._fadeOutDuration; this._brightness = (this._brightness * (d - 1)) / d; this._fadeOutDuration--; } }; Game_Screen.prototype.updateFadeIn = function () { if (this._fadeInDuration > 0) { var d = this._fadeInDuration; this._brightness = (this._brightness * (d - 1) + 255) / d; this._fadeInDuration--; } }; Game_Screen.prototype.updateTone = function () { if (this._toneDuration > 0) { var d = this._toneDuration; for (var i = 0; i < 4; i++) { this._tone[i] = (this._tone[i] * (d - 1) + this._toneTarget[i]) / d; } this._toneDuration--; } }; Game_Screen.prototype.updateFlash = function () { if (this._flashDuration > 0) { var d = this._flashDuration; this._flashColor[3] *= (d - 1) / d; this._flashDuration--; } }; Game_Screen.prototype.updateShake = function () { if (this._shakeDuration > 0 || this._shake !== 0) { var delta = (this._shakePower * this._shakeSpeed * this._shakeDirection) / 10; if (this._shakeDuration <= 1 && this._shake * (this._shake + delta) < 0) { this._shake = 0; } else { this._shake += delta; } if (this._shake > this._shakePower * 2) { this._shakeDirection = -1; } if (this._shake < - this._shakePower * 2) { this._shakeDirection = 1; } this._shakeDuration--; } }; Game_Screen.prototype.updateZoom = function () { if (this._zoomDuration > 0) { var d = this._zoomDuration; var t = this._zoomScaleTarget; this._zoomScale = (this._zoomScale * (d - 1) + t) / d; this._zoomDuration--; } }; Game_Screen.prototype.updateWeather = function () { if (this._weatherDuration > 0) { var d = this._weatherDuration; var t = this._weatherPowerTarget; this._weatherPower = (this._weatherPower * (d - 1) + t) / d; this._weatherDuration--; if (this._weatherDuration === 0 && this._weatherPowerTarget === 0) { this._weatherType = 'none'; } } }; Game_Screen.prototype.updatePictures = function () { this._pictures.forEach(function (picture) { if (picture) { picture.update(); } }); }; Game_Screen.prototype.startFlashForDamage = function () { this.startFlash([255, 0, 0, 128], 8); }; Game_Screen.prototype.showPicture = function (pictureId, name, origin, x, y, scaleX, scaleY, opacity, blendMode) { var realPictureId = this.realPictureId(pictureId); var picture = new Game_Picture(); picture.show(name, origin, x, y, scaleX, scaleY, opacity, blendMode); this._pictures[realPictureId] = picture; }; Game_Screen.prototype.movePicture = function (pictureId, origin, x, y, scaleX, scaleY, opacity, blendMode, duration) { var picture = this.picture(pictureId); if (picture) { picture.move(origin, x, y, scaleX, scaleY, opacity, blendMode, duration); } }; Game_Screen.prototype.rotatePicture = function (pictureId, speed) { var picture = this.picture(pictureId); if (picture) { picture.rotate(speed); } }; Game_Screen.prototype.tintPicture = function (pictureId, tone, duration) { var picture = this.picture(pictureId); if (picture) { picture.tint(tone, duration); } }; Game_Screen.prototype.erasePicture = function (pictureId) { var realPictureId = this.realPictureId(pictureId); this._pictures[realPictureId] = null; }; //----------------------------------------------------------------------------- // Game_Picture // // The game object class for a picture. function Game_Picture() { this.initialize.apply(this, arguments); } Game_Picture.prototype.initialize = function () { this.initBasic(); this.initTarget(); this.initTone(); this.initRotation(); }; Game_Picture.prototype.name = function () { return this._name; }; Game_Picture.prototype.origin = function () { return this._origin; }; Game_Picture.prototype.x = function () { return this._x; }; Game_Picture.prototype.y = function () { return this._y; }; Game_Picture.prototype.scaleX = function () { return this._scaleX; }; Game_Picture.prototype.scaleY = function () { return this._scaleY; }; Game_Picture.prototype.opacity = function () { return this._opacity; }; Game_Picture.prototype.blendMode = function () { return this._blendMode; }; Game_Picture.prototype.tone = function () { return this._tone; }; Game_Picture.prototype.angle = function () { return this._angle; }; Game_Picture.prototype.initBasic = function () { this._name = ''; this._origin = 0; this._x = 0; this._y = 0; this._scaleX = 100; this._scaleY = 100; this._opacity = 255; this._blendMode = 0; }; Game_Picture.prototype.initTarget = function () { this._targetX = this._x; this._targetY = this._y; this._targetScaleX = this._scaleX; this._targetScaleY = this._scaleY; this._targetOpacity = this._opacity; this._duration = 0; }; Game_Picture.prototype.initTone = function () { this._tone = null; this._toneTarget = null; this._toneDuration = 0; }; Game_Picture.prototype.initRotation = function () { this._angle = 0; this._rotationSpeed = 0; }; Game_Picture.prototype.show = function (name, origin, x, y, scaleX, scaleY, opacity, blendMode) { this._name = name; this._origin = origin; this._x = x; this._y = y; this._scaleX = scaleX; this._scaleY = scaleY; this._opacity = opacity; this._blendMode = blendMode; this.initTarget(); this.initTone(); this.initRotation(); }; Game_Picture.prototype.move = function (origin, x, y, scaleX, scaleY, opacity, blendMode, duration) { this._origin = origin; this._targetX = x; this._targetY = y; this._targetScaleX = scaleX; this._targetScaleY = scaleY; this._targetOpacity = opacity; this._blendMode = blendMode; this._duration = duration; }; Game_Picture.prototype.rotate = function (speed) { this._rotationSpeed = speed; }; Game_Picture.prototype.tint = function (tone, duration) { if (!this._tone) { this._tone = [0, 0, 0, 0]; } this._toneTarget = tone.clone(); this._toneDuration = duration; if (this._toneDuration === 0) { this._tone = this._toneTarget.clone(); } }; Game_Picture.prototype.erase = function () { this._name = ''; this._origin = 0; this.initTarget(); this.initTone(); this.initRotation(); }; Game_Picture.prototype.update = function () { this.updateMove(); this.updateTone(); this.updateRotation(); }; Game_Picture.prototype.updateMove = function () { if (this._duration > 0) { var d = this._duration; this._x = (this._x * (d - 1) + this._targetX) / d; this._y = (this._y * (d - 1) + this._targetY) / d; this._scaleX = (this._scaleX * (d - 1) + this._targetScaleX) / d; this._scaleY = (this._scaleY * (d - 1) + this._targetScaleY) / d; this._opacity = (this._opacity * (d - 1) + this._targetOpacity) / d; this._duration--; } }; Game_Picture.prototype.updateTone = function () { if (this._toneDuration > 0) { var d = this._toneDuration; for (var i = 0; i < 4; i++) { this._tone[i] = (this._tone[i] * (d - 1) + this._toneTarget[i]) / d; } this._toneDuration--; } }; Game_Picture.prototype.updateRotation = function () { if (this._rotationSpeed !== 0) { this._angle += this._rotationSpeed / 2; } }; //----------------------------------------------------------------------------- // Game_Item // // The game object class for handling skills, items, weapons, and armor. It is // required because save data should not include the database object itself. function Game_Item() { this.initialize.apply(this, arguments); } Game_Item.prototype.initialize = function (item) { this._dataClass = ''; this._itemId = 0; if (item) { this.setObject(item); } }; Game_Item.prototype.isSkill = function () { return this._dataClass === 'skill'; }; Game_Item.prototype.isItem = function () { return this._dataClass === 'item'; }; Game_Item.prototype.isUsableItem = function () { return this.isSkill() || this.isItem(); }; Game_Item.prototype.isWeapon = function () { return this._dataClass === 'weapon'; }; Game_Item.prototype.isArmor = function () { return this._dataClass === 'armor'; }; Game_Item.prototype.isEquipItem = function () { return this.isWeapon() || this.isArmor(); }; Game_Item.prototype.isNull = function () { return this._dataClass === ''; }; Game_Item.prototype.itemId = function () { return this._itemId; }; Game_Item.prototype.object = function () { if (this.isSkill()) { return $dataSkills[this._itemId]; } else if (this.isItem()) { return $dataItems[this._itemId]; } else if (this.isWeapon()) { return $dataWeapons[this._itemId]; } else if (this.isArmor()) { return $dataArmors[this._itemId]; } else { return null; } }; Game_Item.prototype.setObject = function (item) { if (DataManager.isSkill(item)) { this._dataClass = 'skill'; } else if (DataManager.isItem(item)) { this._dataClass = 'item'; } else if (DataManager.isWeapon(item)) { this._dataClass = 'weapon'; } else if (DataManager.isArmor(item)) { this._dataClass = 'armor'; } else { this._dataClass = ''; } this._itemId = item ? item.id : 0; }; Game_Item.prototype.setEquip = function (isWeapon, itemId) { this._dataClass = isWeapon ? 'weapon' : 'armor'; this._itemId = itemId; }; //----------------------------------------------------------------------------- // Game_Action // // The game object class for a battle action. function Game_Action() { this.initialize.apply(this, arguments); } Game_Action.EFFECT_RECOVER_HP = 11; Game_Action.EFFECT_RECOVER_MP = 12; Game_Action.EFFECT_GAIN_TP = 13; Game_Action.EFFECT_ADD_STATE = 21; Game_Action.EFFECT_REMOVE_STATE = 22; Game_Action.EFFECT_ADD_BUFF = 31; Game_Action.EFFECT_ADD_DEBUFF = 32; Game_Action.EFFECT_REMOVE_BUFF = 33; Game_Action.EFFECT_REMOVE_DEBUFF = 34; Game_Action.EFFECT_SPECIAL = 41; Game_Action.EFFECT_GROW = 42; Game_Action.EFFECT_LEARN_SKILL = 43; Game_Action.EFFECT_COMMON_EVENT = 44; Game_Action.SPECIAL_EFFECT_ESCAPE = 0; Game_Action.HITTYPE_CERTAIN = 0; Game_Action.HITTYPE_PHYSICAL = 1; Game_Action.HITTYPE_MAGICAL = 2; Game_Action.prototype.initialize = function (subject, forcing) { this._subjectActorId = 0; this._subjectEnemyIndex = -1; this._forcing = forcing || false; this.setSubject(subject); this.clear(); }; Game_Action.prototype.clear = function () { this._item = new Game_Item(); this._targetIndex = -1; }; Game_Action.prototype.setSubject = function (subject) { if (subject.isActor()) { this._subjectActorId = subject.actorId(); this._subjectEnemyIndex = -1; } else { this._subjectEnemyIndex = subject.index(); this._subjectActorId = 0; } }; Game_Action.prototype.subject = function () { if (this._subjectActorId > 0) { return $gameActors.actor(this._subjectActorId); } else { return $gameTroop.members()[this._subjectEnemyIndex]; } }; Game_Action.prototype.friendsUnit = function () { return this.subject().friendsUnit(); }; Game_Action.prototype.opponentsUnit = function () { return this.subject().opponentsUnit(); }; Game_Action.prototype.setEnemyAction = function (action) { if (action) { this.setSkill(action.skillId); } else { this.clear(); } }; Game_Action.prototype.setAttack = function () { this.setSkill(this.subject().attackSkillId()); }; Game_Action.prototype.setGuard = function () { this.setSkill(this.subject().guardSkillId()); }; Game_Action.prototype.setSkill = function (skillId) { this._item.setObject($dataSkills[skillId]); }; Game_Action.prototype.setItem = function (itemId) { this._item.setObject($dataItems[itemId]); }; Game_Action.prototype.setItemObject = function (object) { this._item.setObject(object); }; Game_Action.prototype.setTarget = function (targetIndex) { this._targetIndex = targetIndex; }; Game_Action.prototype.item = function () { return this._item.object(); }; Game_Action.prototype.isSkill = function () { return this._item.isSkill(); }; Game_Action.prototype.isItem = function () { return this._item.isItem(); }; Game_Action.prototype.numRepeats = function () { var repeats = this.item().repeats; if (this.isAttack()) { repeats += this.subject().attackTimesAdd(); } return Math.floor(repeats); }; Game_Action.prototype.checkItemScope = function (list) { return list.contains(this.item().scope); }; Game_Action.prototype.isForOpponent = function () { return this.checkItemScope([1, 2, 3, 4, 5, 6]); }; Game_Action.prototype.isForFriend = function () { return this.checkItemScope([7, 8, 9, 10, 11]); }; Game_Action.prototype.isForDeadFriend = function () { return this.checkItemScope([9, 10]); }; Game_Action.prototype.isForUser = function () { return this.checkItemScope([11]); }; Game_Action.prototype.isForOne = function () { return this.checkItemScope([1, 3, 7, 9, 11]); }; Game_Action.prototype.isForRandom = function () { return this.checkItemScope([3, 4, 5, 6]); }; Game_Action.prototype.isForAll = function () { return this.checkItemScope([2, 8, 10]); }; Game_Action.prototype.needsSelection = function () { return this.checkItemScope([1, 7, 9]); }; Game_Action.prototype.numTargets = function () { return this.isForRandom() ? this.item().scope - 2 : 0; }; Game_Action.prototype.checkDamageType = function (list) { return list.contains(this.item().damage.type); }; Game_Action.prototype.isHpEffect = function () { return this.checkDamageType([1, 3, 5]); }; Game_Action.prototype.isMpEffect = function () { return this.checkDamageType([2, 4, 6]); }; Game_Action.prototype.isDamage = function () { return this.checkDamageType([1, 2]); }; Game_Action.prototype.isRecover = function () { return this.checkDamageType([3, 4]); }; Game_Action.prototype.isDrain = function () { return this.checkDamageType([5, 6]); }; Game_Action.prototype.isHpRecover = function () { return this.checkDamageType([3]); }; Game_Action.prototype.isMpRecover = function () { return this.checkDamageType([4]); }; Game_Action.prototype.isCertainHit = function () { return this.item().hitType === Game_Action.HITTYPE_CERTAIN; }; Game_Action.prototype.isPhysical = function () { return this.item().hitType === Game_Action.HITTYPE_PHYSICAL; }; Game_Action.prototype.isMagical = function () { return this.item().hitType === Game_Action.HITTYPE_MAGICAL; }; Game_Action.prototype.isAttack = function () { return this.item() === $dataSkills[this.subject().attackSkillId()]; }; Game_Action.prototype.isGuard = function () { return this.item() === $dataSkills[this.subject().guardSkillId()]; }; Game_Action.prototype.isMagicSkill = function () { if (this.isSkill()) { return $dataSystem.magicSkills.contains(this.item().stypeId); } else { return false; } }; Game_Action.prototype.decideRandomTarget = function () { var target; if (this.isForDeadFriend()) { target = this.friendsUnit().randomDeadTarget(); } else if (this.isForFriend()) { target = this.friendsUnit().randomTarget(); } else { target = this.opponentsUnit().randomTarget(); } if (target) { this._targetIndex = target.index(); } else { this.clear(); } }; Game_Action.prototype.setConfusion = function () { this.setAttack(); }; Game_Action.prototype.prepare = function () { if (this.subject().isConfused() && !this._forcing) { this.setConfusion(); } }; Game_Action.prototype.isValid = function () { return (this._forcing && this.item()) || this.subject().canUse(this.item()); }; Game_Action.prototype.speed = function () { var agi = this.subject().agi; var speed = agi + Math.randomInt(Math.floor(5 + agi / 4)); if (this.item()) { speed += this.item().speed; } if (this.isAttack()) { speed += this.subject().attackSpeed(); } return speed; }; Game_Action.prototype.makeTargets = function () { var targets = []; if (!this._forcing && this.subject().isConfused()) { targets = [this.confusionTarget()]; } else if (this.isForOpponent()) { targets = this.targetsForOpponents(); } else if (this.isForFriend()) { targets = this.targetsForFriends(); } return this.repeatTargets(targets); }; Game_Action.prototype.repeatTargets = function (targets) { var repeatedTargets = []; var repeats = this.numRepeats(); for (var i = 0; i < targets.length; i++) { var target = targets[i]; if (target) { for (var j = 0; j < repeats; j++) { repeatedTargets.push(target); } } } return repeatedTargets; }; Game_Action.prototype.confusionTarget = function () { switch (this.subject().confusionLevel()) { case 1: return this.opponentsUnit().randomTarget(); case 2: if (Math.randomInt(2) === 0) { return this.opponentsUnit().randomTarget(); } return this.friendsUnit().randomTarget(); default: return this.friendsUnit().randomTarget(); } }; Game_Action.prototype.targetsForOpponents = function () { var targets = []; var unit = this.opponentsUnit(); if (this.isForRandom()) { for (var i = 0; i < this.numTargets(); i++) { targets.push(unit.randomTarget()); } } else if (this.isForOne()) { if (this._targetIndex < 0) { targets.push(unit.randomTarget()); } else { targets.push(unit.smoothTarget(this._targetIndex)); } } else { targets = unit.aliveMembers(); } return targets; }; Game_Action.prototype.targetsForFriends = function () { var targets = []; var unit = this.friendsUnit(); if (this.isForUser()) { return [this.subject()]; } else if (this.isForDeadFriend()) { if (this.isForOne()) { targets.push(unit.smoothDeadTarget(this._targetIndex)); } else { targets = unit.deadMembers(); } } else if (this.isForOne()) { if (this._targetIndex < 0) { targets.push(unit.randomTarget()); } else { targets.push(unit.smoothTarget(this._targetIndex)); } } else { targets = unit.aliveMembers(); } return targets; }; Game_Action.prototype.evaluate = function () { var value = 0; this.itemTargetCandidates().forEach(function (target) { var targetValue = this.evaluateWithTarget(target); if (this.isForAll()) { value += targetValue; } else if (targetValue > value) { value = targetValue; this._targetIndex = target.index(); } }, this); value *= this.numRepeats(); if (value > 0) { value += Math.random(); } return value; }; Game_Action.prototype.itemTargetCandidates = function () { if (!this.isValid()) { return []; } else if (this.isForOpponent()) { return this.opponentsUnit().aliveMembers(); } else if (this.isForUser()) { return [this.subject()]; } else if (this.isForDeadFriend()) { return this.friendsUnit().deadMembers(); } else { return this.friendsUnit().aliveMembers(); } }; Game_Action.prototype.evaluateWithTarget = function (target) { if (this.isHpEffect()) { var value = this.makeDamageValue(target, false); if (this.isForOpponent()) { return value / Math.max(target.hp, 1); } else { var recovery = Math.min(-value, target.mhp - target.hp); return recovery / target.mhp; } } }; Game_Action.prototype.testApply = function (target) { return (this.isForDeadFriend() === target.isDead() && ($gameParty.inBattle() || this.isForOpponent() || (this.isHpRecover() && target.hp < target.mhp) || (this.isMpRecover() && target.mp < target.mmp) || (this.hasItemAnyValidEffects(target)))); }; Game_Action.prototype.hasItemAnyValidEffects = function (target) { return this.item().effects.some(function (effect) { return this.testItemEffect(target, effect); }, this); }; Game_Action.prototype.testItemEffect = function (target, effect) { switch (effect.code) { case Game_Action.EFFECT_RECOVER_HP: return target.hp < target.mhp || effect.value1 < 0 || effect.value2 < 0; case Game_Action.EFFECT_RECOVER_MP: return target.mp < target.mmp || effect.value1 < 0 || effect.value2 < 0; case Game_Action.EFFECT_ADD_STATE: return !target.isStateAffected(effect.dataId); case Game_Action.EFFECT_REMOVE_STATE: return target.isStateAffected(effect.dataId); case Game_Action.EFFECT_ADD_BUFF: return !target.isMaxBuffAffected(effect.dataId); case Game_Action.EFFECT_ADD_DEBUFF: return !target.isMaxDebuffAffected(effect.dataId); case Game_Action.EFFECT_REMOVE_BUFF: return target.isBuffAffected(effect.dataId); case Game_Action.EFFECT_REMOVE_DEBUFF: return target.isDebuffAffected(effect.dataId); case Game_Action.EFFECT_LEARN_SKILL: return target.isActor() && !target.isLearnedSkill(effect.dataId); default: return true; } }; Game_Action.prototype.itemCnt = function (target) { if (this.isPhysical() && target.canMove()) { return target.cnt; } else { return 0; } }; Game_Action.prototype.itemMrf = function (target) { if (this.isMagical()) { return target.mrf; } else { return 0; } }; Game_Action.prototype.itemHit = function (target) { if (this.isPhysical()) { return this.item().successRate * 0.01 * this.subject().hit; } else { return this.item().successRate * 0.01; } }; Game_Action.prototype.itemEva = function (target) { if (this.isPhysical()) { return target.eva; } else if (this.isMagical()) { return target.mev; } else { return 0; } }; Game_Action.prototype.itemCri = function (target) { return this.item().damage.critical ? this.subject().cri * (1 - target.cev) : 0; }; Game_Action.prototype.apply = function (target) { var result = target.result(); this.subject().clearResult(); result.clear(); result.used = this.testApply(target); result.missed = (result.used && Math.random() >= this.itemHit(target)); result.evaded = (!result.missed && Math.random() < this.itemEva(target)); result.physical = this.isPhysical(); result.drain = this.isDrain(); if (result.isHit()) { if (this.item().damage.type > 0) { result.critical = (Math.random() < this.itemCri(target)); var value = this.makeDamageValue(target, result.critical); this.executeDamage(target, value); } this.item().effects.forEach(function (effect) { this.applyItemEffect(target, effect); }, this); this.applyItemUserEffect(target); } }; Game_Action.prototype.makeDamageValue = function (target, critical) { var item = this.item(); var baseValue = this.evalDamageFormula(target); var value = baseValue * this.calcElementRate(target); if (this.isPhysical()) { value *= target.pdr; } if (this.isMagical()) { value *= target.mdr; } if (baseValue < 0) { value *= target.rec; } if (critical) { value = this.applyCritical(value); } value = this.applyVariance(value, item.damage.variance); value = this.applyGuard(value, target); value = Math.round(value); return value; }; Game_Action.prototype.evalDamageFormula = function (target) { try { var item = this.item(); var a = this.subject(); var b = target; var v = $gameVariables._data; var sign = ([3, 4].contains(item.damage.type) ? -1 : 1); var value = Math.max(eval(item.damage.formula), 0) * sign; if (isNaN(value)) value = 0; return value; } catch (e) { return 0; } }; Game_Action.prototype.calcElementRate = function (target) { if (this.item().damage.elementId < 0) { return this.elementsMaxRate(target, this.subject().attackElements()); } else { return target.elementRate(this.item().damage.elementId); } }; Game_Action.prototype.elementsMaxRate = function (target, elements) { if (elements.length > 0) { return Math.max.apply(null, elements.map(function (elementId) { return target.elementRate(elementId); }, this)); } else { return 1; } }; Game_Action.prototype.applyCritical = function (damage) { return damage * 3; }; Game_Action.prototype.applyVariance = function (damage, variance) { var amp = Math.floor(Math.max(Math.abs(damage) * variance / 100, 0)); var v = Math.randomInt(amp + 1) + Math.randomInt(amp + 1) - amp; return damage >= 0 ? damage + v : damage - v; }; Game_Action.prototype.applyGuard = function (damage, target) { return damage / (damage > 0 && target.isGuard() ? 2 * target.grd : 1); }; Game_Action.prototype.executeDamage = function (target, value) { var result = target.result(); if (value === 0) { result.critical = false; } if (this.isHpEffect()) { this.executeHpDamage(target, value); } if (this.isMpEffect()) { this.executeMpDamage(target, value); } }; Game_Action.prototype.executeHpDamage = function (target, value) { if (this.isDrain()) { value = Math.min(target.hp, value); } this.makeSuccess(target); target.gainHp(-value); if (value > 0) { target.onDamage(value); } this.gainDrainedHp(value); }; Game_Action.prototype.executeMpDamage = function (target, value) { if (!this.isMpRecover()) { value = Math.min(target.mp, value); } if (value !== 0) { this.makeSuccess(target); } target.gainMp(-value); this.gainDrainedMp(value); }; Game_Action.prototype.gainDrainedHp = function (value) { if (this.isDrain()) { var gainTarget = this.subject(); if (this._reflectionTarget !== undefined) { gainTarget = this._reflectionTarget; } gainTarget.gainHp(value); } }; Game_Action.prototype.gainDrainedMp = function (value) { if (this.isDrain()) { var gainTarget = this.subject(); if (this._reflectionTarget !== undefined) { gainTarget = this._reflectionTarget; } gainTarget.gainMp(value); } }; Game_Action.prototype.applyItemEffect = function (target, effect) { switch (effect.code) { case Game_Action.EFFECT_RECOVER_HP: this.itemEffectRecoverHp(target, effect); break; case Game_Action.EFFECT_RECOVER_MP: this.itemEffectRecoverMp(target, effect); break; case Game_Action.EFFECT_GAIN_TP: this.itemEffectGainTp(target, effect); break; case Game_Action.EFFECT_ADD_STATE: this.itemEffectAddState(target, effect); break; case Game_Action.EFFECT_REMOVE_STATE: this.itemEffectRemoveState(target, effect); break; case Game_Action.EFFECT_ADD_BUFF: this.itemEffectAddBuff(target, effect); break; case Game_Action.EFFECT_ADD_DEBUFF: this.itemEffectAddDebuff(target, effect); break; case Game_Action.EFFECT_REMOVE_BUFF: this.itemEffectRemoveBuff(target, effect); break; case Game_Action.EFFECT_REMOVE_DEBUFF: this.itemEffectRemoveDebuff(target, effect); break; case Game_Action.EFFECT_SPECIAL: this.itemEffectSpecial(target, effect); break; case Game_Action.EFFECT_GROW: this.itemEffectGrow(target, effect); break; case Game_Action.EFFECT_LEARN_SKILL: this.itemEffectLearnSkill(target, effect); break; case Game_Action.EFFECT_COMMON_EVENT: this.itemEffectCommonEvent(target, effect); break; } }; Game_Action.prototype.itemEffectRecoverHp = function (target, effect) { var value = (target.mhp * effect.value1 + effect.value2) * target.rec; if (this.isItem()) { value *= this.subject().pha; } value = Math.floor(value); if (value !== 0) { target.gainHp(value); this.makeSuccess(target); } }; Game_Action.prototype.itemEffectRecoverMp = function (target, effect) { var value = (target.mmp * effect.value1 + effect.value2) * target.rec; if (this.isItem()) { value *= this.subject().pha; } value = Math.floor(value); if (value !== 0) { target.gainMp(value); this.makeSuccess(target); } }; Game_Action.prototype.itemEffectGainTp = function (target, effect) { var value = Math.floor(effect.value1); if (value !== 0) { target.gainTp(value); this.makeSuccess(target); } }; Game_Action.prototype.itemEffectAddState = function (target, effect) { if (effect.dataId === 0) { this.itemEffectAddAttackState(target, effect); } else { this.itemEffectAddNormalState(target, effect); } }; Game_Action.prototype.itemEffectAddAttackState = function (target, effect) { this.subject().attackStates().forEach(function (stateId) { var chance = effect.value1; chance *= target.stateRate(stateId); chance *= this.subject().attackStatesRate(stateId); chance *= this.lukEffectRate(target); if (Math.random() < chance) { target.addState(stateId); this.makeSuccess(target); } }.bind(this), target); }; Game_Action.prototype.itemEffectAddNormalState = function (target, effect) { var chance = effect.value1; if (!this.isCertainHit()) { chance *= target.stateRate(effect.dataId); chance *= this.lukEffectRate(target); } if (Math.random() < chance) { target.addState(effect.dataId); this.makeSuccess(target); } }; Game_Action.prototype.itemEffectRemoveState = function (target, effect) { var chance = effect.value1; if (Math.random() < chance) { target.removeState(effect.dataId); this.makeSuccess(target); } }; Game_Action.prototype.itemEffectAddBuff = function (target, effect) { target.addBuff(effect.dataId, effect.value1); this.makeSuccess(target); }; Game_Action.prototype.itemEffectAddDebuff = function (target, effect) { var chance = target.debuffRate(effect.dataId) * this.lukEffectRate(target); if (Math.random() < chance) { target.addDebuff(effect.dataId, effect.value1); this.makeSuccess(target); } }; Game_Action.prototype.itemEffectRemoveBuff = function (target, effect) { if (target.isBuffAffected(effect.dataId)) { target.removeBuff(effect.dataId); this.makeSuccess(target); } }; Game_Action.prototype.itemEffectRemoveDebuff = function (target, effect) { if (target.isDebuffAffected(effect.dataId)) { target.removeBuff(effect.dataId); this.makeSuccess(target); } }; Game_Action.prototype.itemEffectSpecial = function (target, effect) { if (effect.dataId === Game_Action.SPECIAL_EFFECT_ESCAPE) { target.escape(); this.makeSuccess(target); } }; Game_Action.prototype.itemEffectGrow = function (target, effect) { target.addParam(effect.dataId, Math.floor(effect.value1)); this.makeSuccess(target); }; Game_Action.prototype.itemEffectLearnSkill = function (target, effect) { if (target.isActor()) { target.learnSkill(effect.dataId); this.makeSuccess(target); } }; Game_Action.prototype.itemEffectCommonEvent = function (target, effect) { }; Game_Action.prototype.makeSuccess = function (target) { target.result().success = true; }; Game_Action.prototype.applyItemUserEffect = function (target) { var value = Math.floor(this.item().tpGain * this.subject().tcr); this.subject().gainSilentTp(value); }; Game_Action.prototype.lukEffectRate = function (target) { return Math.max(1.0 + (this.subject().luk - target.luk) * 0.001, 0.0); }; Game_Action.prototype.applyGlobal = function () { this.item().effects.forEach(function (effect) { if (effect.code === Game_Action.EFFECT_COMMON_EVENT) { $gameTemp.reserveCommonEvent(effect.dataId); } }, this); }; //----------------------------------------------------------------------------- // Game_ActionResult // // The game object class for a result of a battle action. For convinience, all // member variables in this class are public. function Game_ActionResult() { this.initialize.apply(this, arguments); } Game_ActionResult.prototype.initialize = function () { this.clear(); }; Game_ActionResult.prototype.clear = function () { this.used = false; this.missed = false; this.evaded = false; this.physical = false; this.drain = false; this.critical = false; this.success = false; this.hpAffected = false; this.hpDamage = 0; this.mpDamage = 0; this.tpDamage = 0; this.addedStates = []; this.removedStates = []; this.addedBuffs = []; this.addedDebuffs = []; this.removedBuffs = []; }; Game_ActionResult.prototype.addedStateObjects = function () { return this.addedStates.map(function (id) { return $dataStates[id]; }); }; Game_ActionResult.prototype.removedStateObjects = function () { return this.removedStates.map(function (id) { return $dataStates[id]; }); }; Game_ActionResult.prototype.isStatusAffected = function () { return (this.addedStates.length > 0 || this.removedStates.length > 0 || this.addedBuffs.length > 0 || this.addedDebuffs.length > 0 || this.removedBuffs.length > 0); }; Game_ActionResult.prototype.isHit = function () { return this.used && !this.missed && !this.evaded; }; Game_ActionResult.prototype.isStateAdded = function (stateId) { return this.addedStates.contains(stateId); }; Game_ActionResult.prototype.pushAddedState = function (stateId) { if (!this.isStateAdded(stateId)) { this.addedStates.push(stateId); } }; Game_ActionResult.prototype.isStateRemoved = function (stateId) { return this.removedStates.contains(stateId); }; Game_ActionResult.prototype.pushRemovedState = function (stateId) { if (!this.isStateRemoved(stateId)) { this.removedStates.push(stateId); } }; Game_ActionResult.prototype.isBuffAdded = function (paramId) { return this.addedBuffs.contains(paramId); }; Game_ActionResult.prototype.pushAddedBuff = function (paramId) { if (!this.isBuffAdded(paramId)) { this.addedBuffs.push(paramId); } }; Game_ActionResult.prototype.isDebuffAdded = function (paramId) { return this.addedDebuffs.contains(paramId); }; Game_ActionResult.prototype.pushAddedDebuff = function (paramId) { if (!this.isDebuffAdded(paramId)) { this.addedDebuffs.push(paramId); } }; Game_ActionResult.prototype.isBuffRemoved = function (paramId) { return this.removedBuffs.contains(paramId); }; Game_ActionResult.prototype.pushRemovedBuff = function (paramId) { if (!this.isBuffRemoved(paramId)) { this.removedBuffs.push(paramId); } }; //----------------------------------------------------------------------------- // Game_BattlerBase // // The superclass of Game_Battler. It mainly contains parameters calculation. function Game_BattlerBase() { this.initialize.apply(this, arguments); } Game_BattlerBase.TRAIT_ELEMENT_RATE = 11; Game_BattlerBase.TRAIT_DEBUFF_RATE = 12; Game_BattlerBase.TRAIT_STATE_RATE = 13; Game_BattlerBase.TRAIT_STATE_RESIST = 14; Game_BattlerBase.TRAIT_PARAM = 21; Game_BattlerBase.TRAIT_XPARAM = 22; Game_BattlerBase.TRAIT_SPARAM = 23; Game_BattlerBase.TRAIT_ATTACK_ELEMENT = 31; Game_BattlerBase.TRAIT_ATTACK_STATE = 32; Game_BattlerBase.TRAIT_ATTACK_SPEED = 33; Game_BattlerBase.TRAIT_ATTACK_TIMES = 34; Game_BattlerBase.TRAIT_STYPE_ADD = 41; Game_BattlerBase.TRAIT_STYPE_SEAL = 42; Game_BattlerBase.TRAIT_SKILL_ADD = 43; Game_BattlerBase.TRAIT_SKILL_SEAL = 44; Game_BattlerBase.TRAIT_EQUIP_WTYPE = 51; Game_BattlerBase.TRAIT_EQUIP_ATYPE = 52; Game_BattlerBase.TRAIT_EQUIP_LOCK = 53; Game_BattlerBase.TRAIT_EQUIP_SEAL = 54; Game_BattlerBase.TRAIT_SLOT_TYPE = 55; Game_BattlerBase.TRAIT_ACTION_PLUS = 61; Game_BattlerBase.TRAIT_SPECIAL_FLAG = 62; Game_BattlerBase.TRAIT_COLLAPSE_TYPE = 63; Game_BattlerBase.TRAIT_PARTY_ABILITY = 64; Game_BattlerBase.FLAG_ID_AUTO_BATTLE = 0; Game_BattlerBase.FLAG_ID_GUARD = 1; Game_BattlerBase.FLAG_ID_SUBSTITUTE = 2; Game_BattlerBase.FLAG_ID_PRESERVE_TP = 3; Game_BattlerBase.ICON_BUFF_START = 32; Game_BattlerBase.ICON_DEBUFF_START = 48; Object.defineProperties(Game_BattlerBase.prototype, { // Hit Points hp: { get: function () { return this._hp; }, configurable: true }, // Magic Points mp: { get: function () { return this._mp; }, configurable: true }, // Tactical Points tp: { get: function () { return this._tp; }, configurable: true }, // Maximum Hit Points mhp: { get: function () { return this.param(0); }, configurable: true }, // Maximum Magic Points mmp: { get: function () { return this.param(1); }, configurable: true }, // ATtacK power atk: { get: function () { return this.param(2); }, configurable: true }, // DEFense power def: { get: function () { return this.param(3); }, configurable: true }, // Magic ATtack power mat: { get: function () { return this.param(4); }, configurable: true }, // Magic DeFense power mdf: { get: function () { return this.param(5); }, configurable: true }, // AGIlity agi: { get: function () { return this.param(6); }, configurable: true }, // LUcK luk: { get: function () { return this.param(7); }, configurable: true }, // HIT rate hit: { get: function () { return this.xparam(0); }, configurable: true }, // EVAsion rate eva: { get: function () { return this.xparam(1); }, configurable: true }, // CRItical rate cri: { get: function () { return this.xparam(2); }, configurable: true }, // Critical EVasion rate cev: { get: function () { return this.xparam(3); }, configurable: true }, // Magic EVasion rate mev: { get: function () { return this.xparam(4); }, configurable: true }, // Magic ReFlection rate mrf: { get: function () { return this.xparam(5); }, configurable: true }, // CouNTer attack rate cnt: { get: function () { return this.xparam(6); }, configurable: true }, // Hp ReGeneration rate hrg: { get: function () { return this.xparam(7); }, configurable: true }, // Mp ReGeneration rate mrg: { get: function () { return this.xparam(8); }, configurable: true }, // Tp ReGeneration rate trg: { get: function () { return this.xparam(9); }, configurable: true }, // TarGet Rate tgr: { get: function () { return this.sparam(0); }, configurable: true }, // GuaRD effect rate grd: { get: function () { return this.sparam(1); }, configurable: true }, // RECovery effect rate rec: { get: function () { return this.sparam(2); }, configurable: true }, // PHArmacology pha: { get: function () { return this.sparam(3); }, configurable: true }, // Mp Cost Rate mcr: { get: function () { return this.sparam(4); }, configurable: true }, // Tp Charge Rate tcr: { get: function () { return this.sparam(5); }, configurable: true }, // Physical Damage Rate pdr: { get: function () { return this.sparam(6); }, configurable: true }, // Magical Damage Rate mdr: { get: function () { return this.sparam(7); }, configurable: true }, // Floor Damage Rate fdr: { get: function () { return this.sparam(8); }, configurable: true }, // EXperience Rate exr: { get: function () { return this.sparam(9); }, configurable: true } }); Game_BattlerBase.prototype.initialize = function () { this.initMembers(); }; Game_BattlerBase.prototype.initMembers = function () { this._hp = 1; this._mp = 0; this._tp = 0; this._hidden = false; this.clearParamPlus(); this.clearStates(); this.clearBuffs(); }; Game_BattlerBase.prototype.clearParamPlus = function () { this._paramPlus = [0, 0, 0, 0, 0, 0, 0, 0]; }; Game_BattlerBase.prototype.clearStates = function () { this._states = []; this._stateTurns = {}; }; Game_BattlerBase.prototype.eraseState = function (stateId) { var index = this._states.indexOf(stateId); if (index >= 0) { this._states.splice(index, 1); } delete this._stateTurns[stateId]; }; Game_BattlerBase.prototype.isStateAffected = function (stateId) { return this._states.contains(stateId); }; Game_BattlerBase.prototype.isDeathStateAffected = function () { return this.isStateAffected(this.deathStateId()); }; Game_BattlerBase.prototype.deathStateId = function () { return 1; }; Game_BattlerBase.prototype.resetStateCounts = function (stateId) { var state = $dataStates[stateId]; var variance = 1 + Math.max(state.maxTurns - state.minTurns, 0); this._stateTurns[stateId] = state.minTurns + Math.randomInt(variance); }; Game_BattlerBase.prototype.isStateExpired = function (stateId) { return this._stateTurns[stateId] === 0; }; Game_BattlerBase.prototype.updateStateTurns = function () { this._states.forEach(function (stateId) { if (this._stateTurns[stateId] > 0) { this._stateTurns[stateId]--; } }, this); }; Game_BattlerBase.prototype.clearBuffs = function () { this._buffs = [0, 0, 0, 0, 0, 0, 0, 0]; this._buffTurns = [0, 0, 0, 0, 0, 0, 0, 0]; }; Game_BattlerBase.prototype.eraseBuff = function (paramId) { this._buffs[paramId] = 0; this._buffTurns[paramId] = 0; }; Game_BattlerBase.prototype.buffLength = function () { return this._buffs.length; }; Game_BattlerBase.prototype.buff = function (paramId) { return this._buffs[paramId]; }; Game_BattlerBase.prototype.isBuffAffected = function (paramId) { return this._buffs[paramId] > 0; }; Game_BattlerBase.prototype.isDebuffAffected = function (paramId) { return this._buffs[paramId] < 0; }; Game_BattlerBase.prototype.isBuffOrDebuffAffected = function (paramId) { return this._buffs[paramId] !== 0; }; Game_BattlerBase.prototype.isMaxBuffAffected = function (paramId) { return this._buffs[paramId] === 2; }; Game_BattlerBase.prototype.isMaxDebuffAffected = function (paramId) { return this._buffs[paramId] === -2; }; Game_BattlerBase.prototype.increaseBuff = function (paramId) { if (!this.isMaxBuffAffected(paramId)) { this._buffs[paramId]++; } }; Game_BattlerBase.prototype.decreaseBuff = function (paramId) { if (!this.isMaxDebuffAffected(paramId)) { this._buffs[paramId]--; } }; Game_BattlerBase.prototype.overwriteBuffTurns = function (paramId, turns) { if (this._buffTurns[paramId] < turns) { this._buffTurns[paramId] = turns; } }; Game_BattlerBase.prototype.isBuffExpired = function (paramId) { return this._buffTurns[paramId] === 0; }; Game_BattlerBase.prototype.updateBuffTurns = function () { for (var i = 0; i < this._buffTurns.length; i++) { if (this._buffTurns[i] > 0) { this._buffTurns[i]--; } } }; Game_BattlerBase.prototype.die = function () { this._hp = 0; this.clearStates(); this.clearBuffs(); }; Game_BattlerBase.prototype.revive = function () { if (this._hp === 0) { this._hp = 1; } }; Game_BattlerBase.prototype.states = function () { return this._states.map(function (id) { return $dataStates[id]; }); }; Game_BattlerBase.prototype.stateIcons = function () { return this.states().map(function (state) { return state.iconIndex; }).filter(function (iconIndex) { return iconIndex > 0; }); }; Game_BattlerBase.prototype.buffIcons = function () { var icons = []; for (var i = 0; i < this._buffs.length; i++) { if (this._buffs[i] !== 0) { icons.push(this.buffIconIndex(this._buffs[i], i)); } } return icons; }; Game_BattlerBase.prototype.buffIconIndex = function (buffLevel, paramId) { if (buffLevel > 0) { return Game_BattlerBase.ICON_BUFF_START + (buffLevel - 1) * 8 + paramId; } else if (buffLevel < 0) { return Game_BattlerBase.ICON_DEBUFF_START + (-buffLevel - 1) * 8 + paramId; } else { return 0; } }; Game_BattlerBase.prototype.allIcons = function () { return this.stateIcons().concat(this.buffIcons()); }; Game_BattlerBase.prototype.traitObjects = function () { // Returns an array of the all objects having traits. States only here. return this.states(); }; Game_BattlerBase.prototype.allTraits = function () { return this.traitObjects().reduce(function (r, obj) { return r.concat(obj.traits); }, []); }; Game_BattlerBase.prototype.traits = function (code) { return this.allTraits().filter(function (trait) { return trait.code === code; }); }; Game_BattlerBase.prototype.traitsWithId = function (code, id) { return this.allTraits().filter(function (trait) { return trait.code === code && trait.dataId === id; }); }; Game_BattlerBase.prototype.traitsPi = function (code, id) { return this.traitsWithId(code, id).reduce(function (r, trait) { return r * trait.value; }, 1); }; Game_BattlerBase.prototype.traitsSum = function (code, id) { return this.traitsWithId(code, id).reduce(function (r, trait) { return r + trait.value; }, 0); }; Game_BattlerBase.prototype.traitsSumAll = function (code) { return this.traits(code).reduce(function (r, trait) { return r + trait.value; }, 0); }; Game_BattlerBase.prototype.traitsSet = function (code) { return this.traits(code).reduce(function (r, trait) { return r.concat(trait.dataId); }, []); }; Game_BattlerBase.prototype.paramBase = function (paramId) { return 0; }; Game_BattlerBase.prototype.paramPlus = function (paramId) { return this._paramPlus[paramId]; }; Game_BattlerBase.prototype.paramMin = function (paramId) { if (paramId === 1) { return 0; // MMP } else { return 1; } }; Game_BattlerBase.prototype.paramMax = function (paramId) { if (paramId === 0) { return 999999; // MHP } else if (paramId === 1) { return 9999; // MMP } else { return 999; } }; Game_BattlerBase.prototype.paramRate = function (paramId) { return this.traitsPi(Game_BattlerBase.TRAIT_PARAM, paramId); }; Game_BattlerBase.prototype.paramBuffRate = function (paramId) { return this._buffs[paramId] * 0.25 + 1.0; }; Game_BattlerBase.prototype.param = function (paramId) { var value = this.paramBase(paramId) + this.paramPlus(paramId); value *= this.paramRate(paramId) * this.paramBuffRate(paramId); var maxValue = this.paramMax(paramId); var minValue = this.paramMin(paramId); return Math.round(value.clamp(minValue, maxValue)); }; Game_BattlerBase.prototype.xparam = function (xparamId) { return this.traitsSum(Game_BattlerBase.TRAIT_XPARAM, xparamId); }; Game_BattlerBase.prototype.sparam = function (sparamId) { return this.traitsPi(Game_BattlerBase.TRAIT_SPARAM, sparamId); }; Game_BattlerBase.prototype.elementRate = function (elementId) { return this.traitsPi(Game_BattlerBase.TRAIT_ELEMENT_RATE, elementId); }; Game_BattlerBase.prototype.debuffRate = function (paramId) { return this.traitsPi(Game_BattlerBase.TRAIT_DEBUFF_RATE, paramId); }; Game_BattlerBase.prototype.stateRate = function (stateId) { return this.traitsPi(Game_BattlerBase.TRAIT_STATE_RATE, stateId); }; Game_BattlerBase.prototype.stateResistSet = function () { return this.traitsSet(Game_BattlerBase.TRAIT_STATE_RESIST); }; Game_BattlerBase.prototype.isStateResist = function (stateId) { return this.stateResistSet().contains(stateId); }; Game_BattlerBase.prototype.attackElements = function () { return this.traitsSet(Game_BattlerBase.TRAIT_ATTACK_ELEMENT); }; Game_BattlerBase.prototype.attackStates = function () { return this.traitsSet(Game_BattlerBase.TRAIT_ATTACK_STATE); }; Game_BattlerBase.prototype.attackStatesRate = function (stateId) { return this.traitsSum(Game_BattlerBase.TRAIT_ATTACK_STATE, stateId); }; Game_BattlerBase.prototype.attackSpeed = function () { return this.traitsSumAll(Game_BattlerBase.TRAIT_ATTACK_SPEED); }; Game_BattlerBase.prototype.attackTimesAdd = function () { return Math.max(this.traitsSumAll(Game_BattlerBase.TRAIT_ATTACK_TIMES), 0); }; Game_BattlerBase.prototype.addedSkillTypes = function () { return this.traitsSet(Game_BattlerBase.TRAIT_STYPE_ADD); }; Game_BattlerBase.prototype.isSkillTypeSealed = function (stypeId) { return this.traitsSet(Game_BattlerBase.TRAIT_STYPE_SEAL).contains(stypeId); }; Game_BattlerBase.prototype.addedSkills = function () { return this.traitsSet(Game_BattlerBase.TRAIT_SKILL_ADD); }; Game_BattlerBase.prototype.isSkillSealed = function (skillId) { return this.traitsSet(Game_BattlerBase.TRAIT_SKILL_SEAL).contains(skillId); }; Game_BattlerBase.prototype.isEquipWtypeOk = function (wtypeId) { return this.traitsSet(Game_BattlerBase.TRAIT_EQUIP_WTYPE).contains(wtypeId); }; Game_BattlerBase.prototype.isEquipAtypeOk = function (atypeId) { return this.traitsSet(Game_BattlerBase.TRAIT_EQUIP_ATYPE).contains(atypeId); }; Game_BattlerBase.prototype.isEquipTypeLocked = function (etypeId) { return this.traitsSet(Game_BattlerBase.TRAIT_EQUIP_LOCK).contains(etypeId); }; Game_BattlerBase.prototype.isEquipTypeSealed = function (etypeId) { return this.traitsSet(Game_BattlerBase.TRAIT_EQUIP_SEAL).contains(etypeId); }; Game_BattlerBase.prototype.slotType = function () { var set = this.traitsSet(Game_BattlerBase.TRAIT_SLOT_TYPE); return set.length > 0 ? Math.max.apply(null, set) : 0; }; Game_BattlerBase.prototype.isDualWield = function () { return this.slotType() === 1; }; Game_BattlerBase.prototype.actionPlusSet = function () { return this.traits(Game_BattlerBase.TRAIT_ACTION_PLUS).map(function (trait) { return trait.value; }); }; Game_BattlerBase.prototype.specialFlag = function (flagId) { return this.traits(Game_BattlerBase.TRAIT_SPECIAL_FLAG).some(function (trait) { return trait.dataId === flagId; }); }; Game_BattlerBase.prototype.collapseType = function () { var set = this.traitsSet(Game_BattlerBase.TRAIT_COLLAPSE_TYPE); return set.length > 0 ? Math.max.apply(null, set) : 0; }; Game_BattlerBase.prototype.partyAbility = function (abilityId) { return this.traits(Game_BattlerBase.TRAIT_PARTY_ABILITY).some(function (trait) { return trait.dataId === abilityId; }); }; Game_BattlerBase.prototype.isAutoBattle = function () { return this.specialFlag(Game_BattlerBase.FLAG_ID_AUTO_BATTLE); }; Game_BattlerBase.prototype.isGuard = function () { return this.specialFlag(Game_BattlerBase.FLAG_ID_GUARD) && this.canMove(); }; Game_BattlerBase.prototype.isSubstitute = function () { return this.specialFlag(Game_BattlerBase.FLAG_ID_SUBSTITUTE) && this.canMove(); }; Game_BattlerBase.prototype.isPreserveTp = function () { return this.specialFlag(Game_BattlerBase.FLAG_ID_PRESERVE_TP); }; Game_BattlerBase.prototype.addParam = function (paramId, value) { this._paramPlus[paramId] += value; this.refresh(); }; Game_BattlerBase.prototype.setHp = function (hp) { this._hp = hp; this.refresh(); }; Game_BattlerBase.prototype.setMp = function (mp) { this._mp = mp; this.refresh(); }; Game_BattlerBase.prototype.setTp = function (tp) { this._tp = tp; this.refresh(); }; Game_BattlerBase.prototype.maxTp = function () { return 100; }; Game_BattlerBase.prototype.refresh = function () { this.stateResistSet().forEach(function (stateId) { this.eraseState(stateId); }, this); this._hp = this._hp.clamp(0, this.mhp); this._mp = this._mp.clamp(0, this.mmp); this._tp = this._tp.clamp(0, this.maxTp()); }; Game_BattlerBase.prototype.recoverAll = function () { this.clearStates(); this._hp = this.mhp; this._mp = this.mmp; }; Game_BattlerBase.prototype.hpRate = function () { return this.hp / this.mhp; }; Game_BattlerBase.prototype.mpRate = function () { return this.mmp > 0 ? this.mp / this.mmp : 0; }; Game_BattlerBase.prototype.tpRate = function () { return this.tp / this.maxTp(); }; Game_BattlerBase.prototype.hide = function () { this._hidden = true; }; Game_BattlerBase.prototype.appear = function () { this._hidden = false; }; Game_BattlerBase.prototype.isHidden = function () { return this._hidden; }; Game_BattlerBase.prototype.isAppeared = function () { return !this.isHidden(); }; Game_BattlerBase.prototype.isDead = function () { return this.isAppeared() && this.isDeathStateAffected(); }; Game_BattlerBase.prototype.isAlive = function () { return this.isAppeared() && !this.isDeathStateAffected(); }; Game_BattlerBase.prototype.isDying = function () { return this.isAlive() && this._hp < this.mhp / 4; }; Game_BattlerBase.prototype.isRestricted = function () { return this.isAppeared() && this.restriction() > 0; }; Game_BattlerBase.prototype.canInput = function () { return this.isAppeared() && !this.isRestricted() && !this.isAutoBattle(); }; Game_BattlerBase.prototype.canMove = function () { return this.isAppeared() && this.restriction() < 4; }; Game_BattlerBase.prototype.isConfused = function () { return this.isAppeared() && this.restriction() >= 1 && this.restriction() <= 3; }; Game_BattlerBase.prototype.confusionLevel = function () { return this.isConfused() ? this.restriction() : 0; }; Game_BattlerBase.prototype.isActor = function () { return false; }; Game_BattlerBase.prototype.isEnemy = function () { return false; }; Game_BattlerBase.prototype.sortStates = function () { this._states.sort(function (a, b) { var p1 = $dataStates[a].priority; var p2 = $dataStates[b].priority; if (p1 !== p2) { return p2 - p1; } return a - b; }); }; Game_BattlerBase.prototype.restriction = function () { return Math.max.apply(null, this.states().map(function (state) { return state.restriction; }).concat(0)); }; Game_BattlerBase.prototype.addNewState = function (stateId) { if (stateId === this.deathStateId()) { this.die(); } var restricted = this.isRestricted(); this._states.push(stateId); this.sortStates(); if (!restricted && this.isRestricted()) { this.onRestrict(); } }; Game_BattlerBase.prototype.onRestrict = function () { }; Game_BattlerBase.prototype.mostImportantStateText = function () { var states = this.states(); for (var i = 0; i < states.length; i++) { if (states[i].message3) { return states[i].message3; } } return ''; }; Game_BattlerBase.prototype.stateMotionIndex = function () { var states = this.states(); if (states.length > 0) { return states[0].motion; } else { return 0; } }; Game_BattlerBase.prototype.stateOverlayIndex = function () { var states = this.states(); if (states.length > 0) { return states[0].overlay; } else { return 0; } }; Game_BattlerBase.prototype.isSkillWtypeOk = function (skill) { return true; }; Game_BattlerBase.prototype.skillMpCost = function (skill) { return Math.floor(skill.mpCost * this.mcr); }; Game_BattlerBase.prototype.skillTpCost = function (skill) { return skill.tpCost; }; Game_BattlerBase.prototype.canPaySkillCost = function (skill) { return this._tp >= this.skillTpCost(skill) && this._mp >= this.skillMpCost(skill); }; Game_BattlerBase.prototype.paySkillCost = function (skill) { this._mp -= this.skillMpCost(skill); this._tp -= this.skillTpCost(skill); }; Game_BattlerBase.prototype.isOccasionOk = function (item) { if ($gameParty.inBattle()) { return item.occasion === 0 || item.occasion === 1; } else { return item.occasion === 0 || item.occasion === 2; } }; Game_BattlerBase.prototype.meetsUsableItemConditions = function (item) { return this.canMove() && this.isOccasionOk(item); }; Game_BattlerBase.prototype.meetsSkillConditions = function (skill) { return (this.meetsUsableItemConditions(skill) && this.isSkillWtypeOk(skill) && this.canPaySkillCost(skill) && !this.isSkillSealed(skill.id) && !this.isSkillTypeSealed(skill.stypeId)); }; Game_BattlerBase.prototype.meetsItemConditions = function (item) { return this.meetsUsableItemConditions(item) && $gameParty.hasItem(item); }; Game_BattlerBase.prototype.canUse = function (item) { if (!item) { return false; } else if (DataManager.isSkill(item)) { return this.meetsSkillConditions(item); } else if (DataManager.isItem(item)) { return this.meetsItemConditions(item); } else { return false; } }; Game_BattlerBase.prototype.canEquip = function (item) { if (!item) { return false; } else if (DataManager.isWeapon(item)) { return this.canEquipWeapon(item); } else if (DataManager.isArmor(item)) { return this.canEquipArmor(item); } else { return false; } }; Game_BattlerBase.prototype.canEquipWeapon = function (item) { return this.isEquipWtypeOk(item.wtypeId) && !this.isEquipTypeSealed(item.etypeId); }; Game_BattlerBase.prototype.canEquipArmor = function (item) { return this.isEquipAtypeOk(item.atypeId) && !this.isEquipTypeSealed(item.etypeId); }; Game_BattlerBase.prototype.attackSkillId = function () { return 1; }; Game_BattlerBase.prototype.guardSkillId = function () { return 2; }; Game_BattlerBase.prototype.canAttack = function () { return this.canUse($dataSkills[this.attackSkillId()]); }; Game_BattlerBase.prototype.canGuard = function () { return this.canUse($dataSkills[this.guardSkillId()]); }; //----------------------------------------------------------------------------- // Game_Battler // // The superclass of Game_Actor and Game_Enemy. It contains methods for sprites // and actions. function Game_Battler() { this.initialize.apply(this, arguments); } Game_Battler.prototype = Object.create(Game_BattlerBase.prototype); Game_Battler.prototype.constructor = Game_Battler; Game_Battler.prototype.initialize = function () { Game_BattlerBase.prototype.initialize.call(this); }; Game_Battler.prototype.initMembers = function () { Game_BattlerBase.prototype.initMembers.call(this); this._actions = []; this._speed = 0; this._result = new Game_ActionResult(); this._actionState = ''; this._lastTargetIndex = 0; this._animations = []; this._damagePopup = false; this._effectType = null; this._motionType = null; this._weaponImageId = 0; this._motionRefresh = false; this._selected = false; }; Game_Battler.prototype.clearAnimations = function () { this._animations = []; }; Game_Battler.prototype.clearDamagePopup = function () { this._damagePopup = false; }; Game_Battler.prototype.clearWeaponAnimation = function () { this._weaponImageId = 0; }; Game_Battler.prototype.clearEffect = function () { this._effectType = null; }; Game_Battler.prototype.clearMotion = function () { this._motionType = null; this._motionRefresh = false; }; Game_Battler.prototype.requestEffect = function (effectType) { this._effectType = effectType; }; Game_Battler.prototype.requestMotion = function (motionType) { this._motionType = motionType; }; Game_Battler.prototype.requestMotionRefresh = function () { this._motionRefresh = true; }; Game_Battler.prototype.select = function () { this._selected = true; }; Game_Battler.prototype.deselect = function () { this._selected = false; }; Game_Battler.prototype.isAnimationRequested = function () { return this._animations.length > 0; }; Game_Battler.prototype.isDamagePopupRequested = function () { return this._damagePopup; }; Game_Battler.prototype.isEffectRequested = function () { return !!this._effectType; }; Game_Battler.prototype.isMotionRequested = function () { return !!this._motionType; }; Game_Battler.prototype.isWeaponAnimationRequested = function () { return this._weaponImageId > 0; }; Game_Battler.prototype.isMotionRefreshRequested = function () { return this._motionRefresh; }; Game_Battler.prototype.isSelected = function () { return this._selected; }; Game_Battler.prototype.effectType = function () { return this._effectType; }; Game_Battler.prototype.motionType = function () { return this._motionType; }; Game_Battler.prototype.weaponImageId = function () { return this._weaponImageId; }; Game_Battler.prototype.shiftAnimation = function () { return this._animations.shift(); }; Game_Battler.prototype.startAnimation = function (animationId, mirror, delay) { var data = { animationId: animationId, mirror: mirror, delay: delay }; this._animations.push(data); }; Game_Battler.prototype.startDamagePopup = function () { this._damagePopup = true; }; Game_Battler.prototype.startWeaponAnimation = function (weaponImageId) { this._weaponImageId = weaponImageId; }; Game_Battler.prototype.action = function (index) { return this._actions[index]; }; Game_Battler.prototype.setAction = function (index, action) { this._actions[index] = action; }; Game_Battler.prototype.numActions = function () { return this._actions.length; }; Game_Battler.prototype.clearActions = function () { this._actions = []; }; Game_Battler.prototype.result = function () { return this._result; }; Game_Battler.prototype.clearResult = function () { this._result.clear(); }; Game_Battler.prototype.refresh = function () { Game_BattlerBase.prototype.refresh.call(this); if (this.hp === 0) { this.addState(this.deathStateId()); } else { this.removeState(this.deathStateId()); } }; Game_Battler.prototype.addState = function (stateId) { if (this.isStateAddable(stateId)) { if (!this.isStateAffected(stateId)) { this.addNewState(stateId); this.refresh(); } this.resetStateCounts(stateId); this._result.pushAddedState(stateId); } }; Game_Battler.prototype.isStateAddable = function (stateId) { return (this.isAlive() && $dataStates[stateId] && !this.isStateResist(stateId) && !this._result.isStateRemoved(stateId) && !this.isStateRestrict(stateId)); }; Game_Battler.prototype.isStateRestrict = function (stateId) { return $dataStates[stateId].removeByRestriction && this.isRestricted(); }; Game_Battler.prototype.onRestrict = function () { Game_BattlerBase.prototype.onRestrict.call(this); this.clearActions(); this.states().forEach(function (state) { if (state.removeByRestriction) { this.removeState(state.id); } }, this); }; Game_Battler.prototype.removeState = function (stateId) { if (this.isStateAffected(stateId)) { if (stateId === this.deathStateId()) { this.revive(); } this.eraseState(stateId); this.refresh(); this._result.pushRemovedState(stateId); } }; Game_Battler.prototype.escape = function () { if ($gameParty.inBattle()) { this.hide(); } this.clearActions(); this.clearStates(); SoundManager.playEscape(); }; Game_Battler.prototype.addBuff = function (paramId, turns) { if (this.isAlive()) { this.increaseBuff(paramId); if (this.isBuffAffected(paramId)) { this.overwriteBuffTurns(paramId, turns); } this._result.pushAddedBuff(paramId); this.refresh(); } }; Game_Battler.prototype.addDebuff = function (paramId, turns) { if (this.isAlive()) { this.decreaseBuff(paramId); if (this.isDebuffAffected(paramId)) { this.overwriteBuffTurns(paramId, turns); } this._result.pushAddedDebuff(paramId); this.refresh(); } }; Game_Battler.prototype.removeBuff = function (paramId) { if (this.isAlive() && this.isBuffOrDebuffAffected(paramId)) { this.eraseBuff(paramId); this._result.pushRemovedBuff(paramId); this.refresh(); } }; Game_Battler.prototype.removeBattleStates = function () { this.states().forEach(function (state) { if (state.removeAtBattleEnd) { this.removeState(state.id); } }, this); }; Game_Battler.prototype.removeAllBuffs = function () { for (var i = 0; i < this.buffLength(); i++) { this.removeBuff(i); } }; Game_Battler.prototype.removeStatesAuto = function (timing) { this.states().forEach(function (state) { if (this.isStateExpired(state.id) && state.autoRemovalTiming === timing) { this.removeState(state.id); } }, this); }; Game_Battler.prototype.removeBuffsAuto = function () { for (var i = 0; i < this.buffLength(); i++) { if (this.isBuffExpired(i)) { this.removeBuff(i); } } }; Game_Battler.prototype.removeStatesByDamage = function () { this.states().forEach(function (state) { if (state.removeByDamage && Math.randomInt(100) < state.chanceByDamage) { this.removeState(state.id); } }, this); }; Game_Battler.prototype.makeActionTimes = function () { return this.actionPlusSet().reduce(function (r, p) { return Math.random() < p ? r + 1 : r; }, 1); }; Game_Battler.prototype.makeActions = function () { this.clearActions(); if (this.canMove()) { var actionTimes = this.makeActionTimes(); this._actions = []; for (var i = 0; i < actionTimes; i++) { this._actions.push(new Game_Action(this)); } } }; Game_Battler.prototype.speed = function () { return this._speed; }; Game_Battler.prototype.makeSpeed = function () { this._speed = Math.min.apply(null, this._actions.map(function (action) { return action.speed(); })) || 0; }; Game_Battler.prototype.currentAction = function () { return this._actions[0]; }; Game_Battler.prototype.removeCurrentAction = function () { this._actions.shift(); }; Game_Battler.prototype.setLastTarget = function (target) { if (target) { this._lastTargetIndex = target.index(); } else { this._lastTargetIndex = 0; } }; Game_Battler.prototype.forceAction = function (skillId, targetIndex) { this.clearActions(); var action = new Game_Action(this, true); action.setSkill(skillId); if (targetIndex === -2) { action.setTarget(this._lastTargetIndex); } else if (targetIndex === -1) { action.decideRandomTarget(); } else { action.setTarget(targetIndex); } this._actions.push(action); }; Game_Battler.prototype.useItem = function (item) { if (DataManager.isSkill(item)) { this.paySkillCost(item); } else if (DataManager.isItem(item)) { this.consumeItem(item); } }; Game_Battler.prototype.consumeItem = function (item) { $gameParty.consumeItem(item); }; Game_Battler.prototype.gainHp = function (value) { this._result.hpDamage = -value; this._result.hpAffected = true; this.setHp(this.hp + value); }; Game_Battler.prototype.gainMp = function (value) { this._result.mpDamage = -value; this.setMp(this.mp + value); }; Game_Battler.prototype.gainTp = function (value) { this._result.tpDamage = -value; this.setTp(this.tp + value); }; Game_Battler.prototype.gainSilentTp = function (value) { this.setTp(this.tp + value); }; Game_Battler.prototype.initTp = function () { this.setTp(Math.randomInt(25)); }; Game_Battler.prototype.clearTp = function () { this.setTp(0); }; Game_Battler.prototype.chargeTpByDamage = function (damageRate) { var value = Math.floor(50 * damageRate * this.tcr); this.gainSilentTp(value); }; Game_Battler.prototype.regenerateHp = function () { var value = Math.floor(this.mhp * this.hrg); value = Math.max(value, -this.maxSlipDamage()); if (value !== 0) { this.gainHp(value); } }; Game_Battler.prototype.maxSlipDamage = function () { return $dataSystem.optSlipDeath ? this.hp : Math.max(this.hp - 1, 0); }; Game_Battler.prototype.regenerateMp = function () { var value = Math.floor(this.mmp * this.mrg); if (value !== 0) { this.gainMp(value); } }; Game_Battler.prototype.regenerateTp = function () { var value = Math.floor(100 * this.trg); this.gainSilentTp(value); }; Game_Battler.prototype.regenerateAll = function () { if (this.isAlive()) { this.regenerateHp(); this.regenerateMp(); this.regenerateTp(); } }; Game_Battler.prototype.onBattleStart = function () { this.setActionState('undecided'); this.clearMotion(); if (!this.isPreserveTp()) { this.initTp(); } }; Game_Battler.prototype.onAllActionsEnd = function () { this.clearResult(); this.removeStatesAuto(1); this.removeBuffsAuto(); }; Game_Battler.prototype.onTurnEnd = function () { this.clearResult(); this.regenerateAll(); if (!BattleManager.isForcedTurn()) { this.updateStateTurns(); this.updateBuffTurns(); } this.removeStatesAuto(2); }; Game_Battler.prototype.onBattleEnd = function () { this.clearResult(); this.removeBattleStates(); this.removeAllBuffs(); this.clearActions(); if (!this.isPreserveTp()) { this.clearTp(); } this.appear(); }; Game_Battler.prototype.onDamage = function (value) { this.removeStatesByDamage(); this.chargeTpByDamage(value / this.mhp); }; Game_Battler.prototype.setActionState = function (actionState) { this._actionState = actionState; this.requestMotionRefresh(); }; Game_Battler.prototype.isUndecided = function () { return this._actionState === 'undecided'; }; Game_Battler.prototype.isInputting = function () { return this._actionState === 'inputting'; }; Game_Battler.prototype.isWaiting = function () { return this._actionState === 'waiting'; }; Game_Battler.prototype.isActing = function () { return this._actionState === 'acting'; }; Game_Battler.prototype.isChanting = function () { if (this.isWaiting()) { return this._actions.some(function (action) { return action.isMagicSkill(); }); } return false; }; Game_Battler.prototype.isGuardWaiting = function () { if (this.isWaiting()) { return this._actions.some(function (action) { return action.isGuard(); }); } return false; }; Game_Battler.prototype.performActionStart = function (action) { if (!action.isGuard()) { this.setActionState('acting'); } }; Game_Battler.prototype.performAction = function (action) { }; Game_Battler.prototype.performActionEnd = function () { this.setActionState('done'); }; Game_Battler.prototype.performDamage = function () { }; Game_Battler.prototype.performMiss = function () { SoundManager.playMiss(); }; Game_Battler.prototype.performRecovery = function () { SoundManager.playRecovery(); }; Game_Battler.prototype.performEvasion = function () { SoundManager.playEvasion(); }; Game_Battler.prototype.performMagicEvasion = function () { SoundManager.playMagicEvasion(); }; Game_Battler.prototype.performCounter = function () { SoundManager.playEvasion(); }; Game_Battler.prototype.performReflection = function () { SoundManager.playReflection(); }; Game_Battler.prototype.performSubstitute = function (target) { }; Game_Battler.prototype.performCollapse = function () { }; //----------------------------------------------------------------------------- // Game_Actor // // The game object class for an actor. function Game_Actor() { this.initialize.apply(this, arguments); } Game_Actor.prototype = Object.create(Game_Battler.prototype); Game_Actor.prototype.constructor = Game_Actor; Object.defineProperty(Game_Actor.prototype, 'level', { get: function () { return this._level; }, configurable: true }); Game_Actor.prototype.initialize = function (actorId) { Game_Battler.prototype.initialize.call(this); this.setup(actorId); }; Game_Actor.prototype.initMembers = function () { Game_Battler.prototype.initMembers.call(this); this._actorId = 0; this._name = ''; this._nickname = ''; this._classId = 0; this._level = 0; this._characterName = ''; this._characterIndex = 0; this._faceName = ''; this._faceIndex = 0; this._battlerName = ''; this._exp = {}; this._skills = []; this._equips = []; this._actionInputIndex = 0; this._lastMenuSkill = new Game_Item(); this._lastBattleSkill = new Game_Item(); this._lastCommandSymbol = ''; }; Game_Actor.prototype.setup = function (actorId) { var actor = $dataActors[actorId]; this._actorId = actorId; this._name = actor.name; this._nickname = actor.nickname; this._profile = actor.profile; this._classId = actor.classId; this._level = actor.initialLevel; this.initImages(); this.initExp(); this.initSkills(); this.initEquips(actor.equips); this.clearParamPlus(); this.recoverAll(); }; Game_Actor.prototype.actorId = function () { return this._actorId; }; Game_Actor.prototype.actor = function () { return $dataActors[this._actorId]; }; Game_Actor.prototype.name = function () { return this._name; }; Game_Actor.prototype.setName = function (name) { this._name = name; }; Game_Actor.prototype.nickname = function () { return this._nickname; }; Game_Actor.prototype.setNickname = function (nickname) { this._nickname = nickname; }; Game_Actor.prototype.profile = function () { return this._profile; }; Game_Actor.prototype.setProfile = function (profile) { this._profile = profile; }; Game_Actor.prototype.characterName = function () { return this._characterName; }; Game_Actor.prototype.characterIndex = function () { return this._characterIndex; }; Game_Actor.prototype.faceName = function () { return this._faceName; }; Game_Actor.prototype.faceIndex = function () { return this._faceIndex; }; Game_Actor.prototype.battlerName = function () { return this._battlerName; }; Game_Actor.prototype.clearStates = function () { Game_Battler.prototype.clearStates.call(this); this._stateSteps = {}; }; Game_Actor.prototype.eraseState = function (stateId) { Game_Battler.prototype.eraseState.call(this, stateId); delete this._stateSteps[stateId]; }; Game_Actor.prototype.resetStateCounts = function (stateId) { Game_Battler.prototype.resetStateCounts.call(this, stateId); this._stateSteps[stateId] = $dataStates[stateId].stepsToRemove; }; Game_Actor.prototype.initImages = function () { var actor = this.actor(); this._characterName = actor.characterName; this._characterIndex = actor.characterIndex; this._faceName = actor.faceName; this._faceIndex = actor.faceIndex; this._battlerName = actor.battlerName; }; Game_Actor.prototype.expForLevel = function (level) { var c = this.currentClass(); var basis = c.expParams[0]; var extra = c.expParams[1]; var acc_a = c.expParams[2]; var acc_b = c.expParams[3]; return Math.round(basis * (Math.pow(level - 1, 0.9 + acc_a / 250)) * level * (level + 1) / (6 + Math.pow(level, 2) / 50 / acc_b) + (level - 1) * extra); }; Game_Actor.prototype.initExp = function () { this._exp[this._classId] = this.currentLevelExp(); }; Game_Actor.prototype.currentExp = function () { return this._exp[this._classId]; }; Game_Actor.prototype.currentLevelExp = function () { return this.expForLevel(this._level); }; Game_Actor.prototype.nextLevelExp = function () { return this.expForLevel(this._level + 1); }; Game_Actor.prototype.nextRequiredExp = function () { return this.nextLevelExp() - this.currentExp(); }; Game_Actor.prototype.maxLevel = function () { return this.actor().maxLevel; }; Game_Actor.prototype.isMaxLevel = function () { return this._level >= this.maxLevel(); }; Game_Actor.prototype.initSkills = function () { this._skills = []; this.currentClass().learnings.forEach(function (learning) { if (learning.level <= this._level) { this.learnSkill(learning.skillId); } }, this); }; Game_Actor.prototype.initEquips = function (equips) { var slots = this.equipSlots(); var maxSlots = slots.length; this._equips = []; for (var i = 0; i < maxSlots; i++) { this._equips[i] = new Game_Item(); } for (var j = 0; j < equips.length; j++) { if (j < maxSlots) { this._equips[j].setEquip(slots[j] === 1, equips[j]); } } this.releaseUnequippableItems(true); this.refresh(); }; Game_Actor.prototype.equipSlots = function () { var slots = []; for (var i = 1; i < $dataSystem.equipTypes.length; i++) { slots.push(i); } if (slots.length >= 2 && this.isDualWield()) { slots[1] = 1; } return slots; }; Game_Actor.prototype.equips = function () { return this._equips.map(function (item) { return item.object(); }); }; Game_Actor.prototype.weapons = function () { return this.equips().filter(function (item) { return item && DataManager.isWeapon(item); }); }; Game_Actor.prototype.armors = function () { return this.equips().filter(function (item) { return item && DataManager.isArmor(item); }); }; Game_Actor.prototype.hasWeapon = function (weapon) { return this.weapons().contains(weapon); }; Game_Actor.prototype.hasArmor = function (armor) { return this.armors().contains(armor); }; Game_Actor.prototype.isEquipChangeOk = function (slotId) { return (!this.isEquipTypeLocked(this.equipSlots()[slotId]) && !this.isEquipTypeSealed(this.equipSlots()[slotId])); }; Game_Actor.prototype.changeEquip = function (slotId, item) { if (this.tradeItemWithParty(item, this.equips()[slotId]) && (!item || this.equipSlots()[slotId] === item.etypeId)) { this._equips[slotId].setObject(item); this.refresh(); } }; Game_Actor.prototype.forceChangeEquip = function (slotId, item) { this._equips[slotId].setObject(item); this.releaseUnequippableItems(true); this.refresh(); }; Game_Actor.prototype.tradeItemWithParty = function (newItem, oldItem) { if (newItem && !$gameParty.hasItem(newItem)) { return false; } else { $gameParty.gainItem(oldItem, 1); $gameParty.loseItem(newItem, 1); return true; } }; Game_Actor.prototype.changeEquipById = function (etypeId, itemId) { var slotId = etypeId - 1; if (this.equipSlots()[slotId] === 1) { this.changeEquip(slotId, $dataWeapons[itemId]); } else { this.changeEquip(slotId, $dataArmors[itemId]); } }; Game_Actor.prototype.isEquipped = function (item) { return this.equips().contains(item); }; Game_Actor.prototype.discardEquip = function (item) { var slotId = this.equips().indexOf(item); if (slotId >= 0) { this._equips[slotId].setObject(null); } }; Game_Actor.prototype.releaseUnequippableItems = function (forcing) { for (; ;) { var slots = this.equipSlots(); var equips = this.equips(); var changed = false; for (var i = 0; i < equips.length; i++) { var item = equips[i]; if (item && (!this.canEquip(item) || item.etypeId !== slots[i])) { if (!forcing) { this.tradeItemWithParty(null, item); } this._equips[i].setObject(null); changed = true; } } if (!changed) { break; } } }; Game_Actor.prototype.clearEquipments = function () { var maxSlots = this.equipSlots().length; for (var i = 0; i < maxSlots; i++) { if (this.isEquipChangeOk(i)) { this.changeEquip(i, null); } } }; Game_Actor.prototype.optimizeEquipments = function () { var maxSlots = this.equipSlots().length; this.clearEquipments(); for (var i = 0; i < maxSlots; i++) { if (this.isEquipChangeOk(i)) { this.changeEquip(i, this.bestEquipItem(i)); } } }; Game_Actor.prototype.bestEquipItem = function (slotId) { var etypeId = this.equipSlots()[slotId]; var items = $gameParty.equipItems().filter(function (item) { return item.etypeId === etypeId && this.canEquip(item); }, this); var bestItem = null; var bestPerformance = -1000; for (var i = 0; i < items.length; i++) { var performance = this.calcEquipItemPerformance(items[i]); if (performance > bestPerformance) { bestPerformance = performance; bestItem = items[i]; } } return bestItem; }; Game_Actor.prototype.calcEquipItemPerformance = function (item) { return item.params.reduce(function (a, b) { return a + b; }); }; Game_Actor.prototype.isSkillWtypeOk = function (skill) { var wtypeId1 = skill.requiredWtypeId1; var wtypeId2 = skill.requiredWtypeId2; if ((wtypeId1 === 0 && wtypeId2 === 0) || (wtypeId1 > 0 && this.isWtypeEquipped(wtypeId1)) || (wtypeId2 > 0 && this.isWtypeEquipped(wtypeId2))) { return true; } else { return false; } }; Game_Actor.prototype.isWtypeEquipped = function (wtypeId) { return this.weapons().some(function (weapon) { return weapon.wtypeId === wtypeId; }); }; Game_Actor.prototype.refresh = function () { this.releaseUnequippableItems(false); Game_Battler.prototype.refresh.call(this); }; Game_Actor.prototype.isActor = function () { return true; }; Game_Actor.prototype.friendsUnit = function () { return $gameParty; }; Game_Actor.prototype.opponentsUnit = function () { return $gameTroop; }; Game_Actor.prototype.index = function () { return $gameParty.members().indexOf(this); }; Game_Actor.prototype.isBattleMember = function () { return $gameParty.battleMembers().contains(this); }; Game_Actor.prototype.isFormationChangeOk = function () { return true; }; Game_Actor.prototype.currentClass = function () { return $dataClasses[this._classId]; }; Game_Actor.prototype.isClass = function (gameClass) { return gameClass && this._classId === gameClass.id; }; Game_Actor.prototype.skills = function () { var list = []; this._skills.concat(this.addedSkills()).forEach(function (id) { if (!list.contains($dataSkills[id])) { list.push($dataSkills[id]); } }); return list; }; Game_Actor.prototype.usableSkills = function () { return this.skills().filter(function (skill) { return this.canUse(skill); }, this); }; Game_Actor.prototype.traitObjects = function () { var objects = Game_Battler.prototype.traitObjects.call(this); objects = objects.concat([this.actor(), this.currentClass()]); var equips = this.equips(); for (var i = 0; i < equips.length; i++) { var item = equips[i]; if (item) { objects.push(item); } } return objects; }; Game_Actor.prototype.attackElements = function () { var set = Game_Battler.prototype.attackElements.call(this); if (this.hasNoWeapons() && !set.contains(this.bareHandsElementId())) { set.push(this.bareHandsElementId()); } return set; }; Game_Actor.prototype.hasNoWeapons = function () { return this.weapons().length === 0; }; Game_Actor.prototype.bareHandsElementId = function () { return 1; }; Game_Actor.prototype.paramMax = function (paramId) { if (paramId === 0) { return 9999; // MHP } return Game_Battler.prototype.paramMax.call(this, paramId); }; Game_Actor.prototype.paramBase = function (paramId) { return this.currentClass().params[paramId][this._level]; }; Game_Actor.prototype.paramPlus = function (paramId) { var value = Game_Battler.prototype.paramPlus.call(this, paramId); var equips = this.equips(); for (var i = 0; i < equips.length; i++) { var item = equips[i]; if (item) { value += item.params[paramId]; } } return value; }; Game_Actor.prototype.attackAnimationId1 = function () { if (this.hasNoWeapons()) { return this.bareHandsAnimationId(); } else { var weapons = this.weapons(); return weapons[0] ? weapons[0].animationId : 0; } }; Game_Actor.prototype.attackAnimationId2 = function () { var weapons = this.weapons(); return weapons[1] ? weapons[1].animationId : 0; }; Game_Actor.prototype.bareHandsAnimationId = function () { return 1; }; Game_Actor.prototype.changeExp = function (exp, show) { this._exp[this._classId] = Math.max(exp, 0); var lastLevel = this._level; var lastSkills = this.skills(); while (!this.isMaxLevel() && this.currentExp() >= this.nextLevelExp()) { this.levelUp(); } while (this.currentExp() < this.currentLevelExp()) { this.levelDown(); } if (show && this._level > lastLevel) { this.displayLevelUp(this.findNewSkills(lastSkills)); } this.refresh(); }; Game_Actor.prototype.levelUp = function () { this._level++; this.currentClass().learnings.forEach(function (learning) { if (learning.level === this._level) { this.learnSkill(learning.skillId); } }, this); }; Game_Actor.prototype.levelDown = function () { this._level--; }; Game_Actor.prototype.findNewSkills = function (lastSkills) { var newSkills = this.skills(); for (var i = 0; i < lastSkills.length; i++) { var index = newSkills.indexOf(lastSkills[i]); if (index >= 0) { newSkills.splice(index, 1); } } return newSkills; }; Game_Actor.prototype.displayLevelUp = function (newSkills) { var text = TextManager.levelUp.format(this._name, TextManager.level, this._level); $gameMessage.newPage(); $gameMessage.add(text); newSkills.forEach(function (skill) { $gameMessage.add(TextManager.obtainSkill.format(skill.name)); }); }; Game_Actor.prototype.gainExp = function (exp) { var newExp = this.currentExp() + Math.round(exp * this.finalExpRate()); this.changeExp(newExp, this.shouldDisplayLevelUp()); }; Game_Actor.prototype.finalExpRate = function () { return this.exr * (this.isBattleMember() ? 1 : this.benchMembersExpRate()); }; Game_Actor.prototype.benchMembersExpRate = function () { return $dataSystem.optExtraExp ? 1 : 0; }; Game_Actor.prototype.shouldDisplayLevelUp = function () { return true; }; Game_Actor.prototype.changeLevel = function (level, show) { level = level.clamp(1, this.maxLevel()); this.changeExp(this.expForLevel(level), show); }; Game_Actor.prototype.learnSkill = function (skillId) { if (!this.isLearnedSkill(skillId)) { this._skills.push(skillId); this._skills.sort(function (a, b) { return a - b; }); } }; Game_Actor.prototype.forgetSkill = function (skillId) { var index = this._skills.indexOf(skillId); if (index >= 0) { this._skills.splice(index, 1); } }; Game_Actor.prototype.isLearnedSkill = function (skillId) { return this._skills.contains(skillId); }; Game_Actor.prototype.hasSkill = function (skillId) { return this.skills().contains($dataSkills[skillId]); }; Game_Actor.prototype.changeClass = function (classId, keepExp) { if (keepExp) { this._exp[classId] = this.currentExp(); } this._classId = classId; this.changeExp(this._exp[this._classId] || 0, false); this.refresh(); }; Game_Actor.prototype.setCharacterImage = function (characterName, characterIndex) { this._characterName = characterName; this._characterIndex = characterIndex; }; Game_Actor.prototype.setFaceImage = function (faceName, faceIndex) { this._faceName = faceName; this._faceIndex = faceIndex; }; Game_Actor.prototype.setBattlerImage = function (battlerName) { this._battlerName = battlerName; }; Game_Actor.prototype.isSpriteVisible = function () { return $gameSystem.isSideView(); }; Game_Actor.prototype.startAnimation = function (animationId, mirror, delay) { mirror = !mirror; Game_Battler.prototype.startAnimation.call(this, animationId, mirror, delay); }; Game_Actor.prototype.performActionStart = function (action) { Game_Battler.prototype.performActionStart.call(this, action); }; Game_Actor.prototype.performAction = function (action) { Game_Battler.prototype.performAction.call(this, action); if (action.isAttack()) { this.performAttack(); } else if (action.isGuard()) { this.requestMotion('guard'); } else if (action.isMagicSkill()) { this.requestMotion('spell'); } else if (action.isSkill()) { this.requestMotion('skill'); } else if (action.isItem()) { this.requestMotion('item'); } }; Game_Actor.prototype.performActionEnd = function () { Game_Battler.prototype.performActionEnd.call(this); }; Game_Actor.prototype.performAttack = function () { var weapons = this.weapons(); var wtypeId = weapons[0] ? weapons[0].wtypeId : 0; var attackMotion = $dataSystem.attackMotions[wtypeId]; if (attackMotion) { if (attackMotion.type === 0) { this.requestMotion('thrust'); } else if (attackMotion.type === 1) { this.requestMotion('swing'); } else if (attackMotion.type === 2) { this.requestMotion('missile'); } this.startWeaponAnimation(attackMotion.weaponImageId); } }; Game_Actor.prototype.performDamage = function () { Game_Battler.prototype.performDamage.call(this); if (this.isSpriteVisible()) { this.requestMotion('damage'); } else { $gameScreen.startShake(5, 5, 10); } SoundManager.playActorDamage(); }; Game_Actor.prototype.performEvasion = function () { Game_Battler.prototype.performEvasion.call(this); this.requestMotion('evade'); }; Game_Actor.prototype.performMagicEvasion = function () { Game_Battler.prototype.performMagicEvasion.call(this); this.requestMotion('evade'); }; Game_Actor.prototype.performCounter = function () { Game_Battler.prototype.performCounter.call(this); this.performAttack(); }; Game_Actor.prototype.performCollapse = function () { Game_Battler.prototype.performCollapse.call(this); if ($gameParty.inBattle()) { SoundManager.playActorCollapse(); } }; Game_Actor.prototype.performVictory = function () { if (this.canMove()) { this.requestMotion('victory'); } }; Game_Actor.prototype.performEscape = function () { if (this.canMove()) { this.requestMotion('escape'); } }; Game_Actor.prototype.makeActionList = function () { var list = []; var action = new Game_Action(this); action.setAttack(); list.push(action); this.usableSkills().forEach(function (skill) { action = new Game_Action(this); action.setSkill(skill.id); list.push(action); }, this); return list; }; Game_Actor.prototype.makeAutoBattleActions = function () { for (var i = 0; i < this.numActions(); i++) { var list = this.makeActionList(); var maxValue = Number.MIN_VALUE; for (var j = 0; j < list.length; j++) { var value = list[j].evaluate(); if (value > maxValue) { maxValue = value; this.setAction(i, list[j]); } } } this.setActionState('waiting'); }; Game_Actor.prototype.makeConfusionActions = function () { for (var i = 0; i < this.numActions(); i++) { this.action(i).setConfusion(); } this.setActionState('waiting'); }; Game_Actor.prototype.makeActions = function () { Game_Battler.prototype.makeActions.call(this); if (this.numActions() > 0) { this.setActionState('undecided'); } else { this.setActionState('waiting'); } if (this.isAutoBattle()) { this.makeAutoBattleActions(); } else if (this.isConfused()) { this.makeConfusionActions(); } }; Game_Actor.prototype.onPlayerWalk = function () { this.clearResult(); this.checkFloorEffect(); if ($gamePlayer.isNormal()) { this.turnEndOnMap(); this.states().forEach(function (state) { this.updateStateSteps(state); }, this); this.showAddedStates(); this.showRemovedStates(); } }; Game_Actor.prototype.updateStateSteps = function (state) { if (state.removeByWalking) { if (this._stateSteps[state.id] > 0) { if (--this._stateSteps[state.id] === 0) { this.removeState(state.id); } } } }; Game_Actor.prototype.showAddedStates = function () { this.result().addedStateObjects().forEach(function (state) { if (state.message1) { $gameMessage.add(this._name + state.message1); } }, this); }; Game_Actor.prototype.showRemovedStates = function () { this.result().removedStateObjects().forEach(function (state) { if (state.message4) { $gameMessage.add(this._name + state.message4); } }, this); }; Game_Actor.prototype.stepsForTurn = function () { return 20; }; Game_Actor.prototype.turnEndOnMap = function () { if ($gameParty.steps() % this.stepsForTurn() === 0) { this.onTurnEnd(); if (this.result().hpDamage > 0) { this.performMapDamage(); } } }; Game_Actor.prototype.checkFloorEffect = function () { if ($gamePlayer.isOnDamageFloor()) { this.executeFloorDamage(); } }; Game_Actor.prototype.executeFloorDamage = function () { var damage = Math.floor(this.basicFloorDamage() * this.fdr); damage = Math.min(damage, this.maxFloorDamage()); this.gainHp(-damage); if (damage > 0) { this.performMapDamage(); } }; Game_Actor.prototype.basicFloorDamage = function () { return 10; }; Game_Actor.prototype.maxFloorDamage = function () { return $dataSystem.optFloorDeath ? this.hp : Math.max(this.hp - 1, 0); }; Game_Actor.prototype.performMapDamage = function () { if (!$gameParty.inBattle()) { $gameScreen.startFlashForDamage(); } }; Game_Actor.prototype.clearActions = function () { Game_Battler.prototype.clearActions.call(this); this._actionInputIndex = 0; }; Game_Actor.prototype.inputtingAction = function () { return this.action(this._actionInputIndex); }; Game_Actor.prototype.selectNextCommand = function () { if (this._actionInputIndex < this.numActions() - 1) { this._actionInputIndex++; return true; } else { return false; } }; Game_Actor.prototype.selectPreviousCommand = function () { if (this._actionInputIndex > 0) { this._actionInputIndex--; return true; } else { return false; } }; Game_Actor.prototype.lastMenuSkill = function () { return this._lastMenuSkill.object(); }; Game_Actor.prototype.setLastMenuSkill = function (skill) { this._lastMenuSkill.setObject(skill); }; Game_Actor.prototype.lastBattleSkill = function () { return this._lastBattleSkill.object(); }; Game_Actor.prototype.setLastBattleSkill = function (skill) { this._lastBattleSkill.setObject(skill); }; Game_Actor.prototype.lastCommandSymbol = function () { return this._lastCommandSymbol; }; Game_Actor.prototype.setLastCommandSymbol = function (symbol) { this._lastCommandSymbol = symbol; }; Game_Actor.prototype.testEscape = function (item) { return item.effects.some(function (effect, index, ar) { return effect && effect.code === Game_Action.EFFECT_SPECIAL; }); }; Game_Actor.prototype.meetsUsableItemConditions = function (item) { if ($gameParty.inBattle() && !BattleManager.canEscape() && this.testEscape(item)) { return false; } return Game_BattlerBase.prototype.meetsUsableItemConditions.call(this, item); }; //----------------------------------------------------------------------------- // Game_Enemy // // The game object class for an enemy. function Game_Enemy() { this.initialize.apply(this, arguments); } Game_Enemy.prototype = Object.create(Game_Battler.prototype); Game_Enemy.prototype.constructor = Game_Enemy; Game_Enemy.prototype.initialize = function (enemyId, x, y) { Game_Battler.prototype.initialize.call(this); this.setup(enemyId, x, y); }; Game_Enemy.prototype.initMembers = function () { Game_Battler.prototype.initMembers.call(this); this._enemyId = 0; this._letter = ''; this._plural = false; this._screenX = 0; this._screenY = 0; }; Game_Enemy.prototype.setup = function (enemyId, x, y) { this._enemyId = enemyId; this._screenX = x; this._screenY = y; this.recoverAll(); }; Game_Enemy.prototype.isEnemy = function () { return true; }; Game_Enemy.prototype.friendsUnit = function () { return $gameTroop; }; Game_Enemy.prototype.opponentsUnit = function () { return $gameParty; }; Game_Enemy.prototype.index = function () { return $gameTroop.members().indexOf(this); }; Game_Enemy.prototype.isBattleMember = function () { return this.index() >= 0; }; Game_Enemy.prototype.enemyId = function () { return this._enemyId; }; Game_Enemy.prototype.enemy = function () { return $dataEnemies[this._enemyId]; }; Game_Enemy.prototype.traitObjects = function () { return Game_Battler.prototype.traitObjects.call(this).concat(this.enemy()); }; Game_Enemy.prototype.paramBase = function (paramId) { return this.enemy().params[paramId]; }; Game_Enemy.prototype.exp = function () { return this.enemy().exp; }; Game_Enemy.prototype.gold = function () { return this.enemy().gold; }; Game_Enemy.prototype.makeDropItems = function () { return this.enemy().dropItems.reduce(function (r, di) { if (di.kind > 0 && Math.random() * di.denominator < this.dropItemRate()) { return r.concat(this.itemObject(di.kind, di.dataId)); } else { return r; } }.bind(this), []); }; Game_Enemy.prototype.dropItemRate = function () { return $gameParty.hasDropItemDouble() ? 2 : 1; }; Game_Enemy.prototype.itemObject = function (kind, dataId) { if (kind === 1) { return $dataItems[dataId]; } else if (kind === 2) { return $dataWeapons[dataId]; } else if (kind === 3) { return $dataArmors[dataId]; } else { return null; } }; Game_Enemy.prototype.isSpriteVisible = function () { return true; }; Game_Enemy.prototype.screenX = function () { return this._screenX; }; Game_Enemy.prototype.screenY = function () { return this._screenY; }; Game_Enemy.prototype.battlerName = function () { return this.enemy().battlerName; }; Game_Enemy.prototype.battlerHue = function () { return this.enemy().battlerHue; }; Game_Enemy.prototype.originalName = function () { return this.enemy().name; }; Game_Enemy.prototype.name = function () { return this.originalName() + (this._plural ? this._letter : ''); }; Game_Enemy.prototype.isLetterEmpty = function () { return this._letter === ''; }; Game_Enemy.prototype.setLetter = function (letter) { this._letter = letter; }; Game_Enemy.prototype.setPlural = function (plural) { this._plural = plural; }; Game_Enemy.prototype.performActionStart = function (action) { Game_Battler.prototype.performActionStart.call(this, action); this.requestEffect('whiten'); }; Game_Enemy.prototype.performAction = function (action) { Game_Battler.prototype.performAction.call(this, action); }; Game_Enemy.prototype.performActionEnd = function () { Game_Battler.prototype.performActionEnd.call(this); }; Game_Enemy.prototype.performDamage = function () { Game_Battler.prototype.performDamage.call(this); SoundManager.playEnemyDamage(); this.requestEffect('blink'); }; Game_Enemy.prototype.performCollapse = function () { Game_Battler.prototype.performCollapse.call(this); switch (this.collapseType()) { case 0: this.requestEffect('collapse'); SoundManager.playEnemyCollapse(); break; case 1: this.requestEffect('bossCollapse'); SoundManager.playBossCollapse1(); break; case 2: this.requestEffect('instantCollapse'); break; } }; Game_Enemy.prototype.transform = function (enemyId) { var name = this.originalName(); this._enemyId = enemyId; if (this.originalName() !== name) { this._letter = ''; this._plural = false; } this.refresh(); if (this.numActions() > 0) { this.makeActions(); } }; Game_Enemy.prototype.meetsCondition = function (action) { var param1 = action.conditionParam1; var param2 = action.conditionParam2; switch (action.conditionType) { case 1: return this.meetsTurnCondition(param1, param2); case 2: return this.meetsHpCondition(param1, param2); case 3: return this.meetsMpCondition(param1, param2); case 4: return this.meetsStateCondition(param1); case 5: return this.meetsPartyLevelCondition(param1); case 6: return this.meetsSwitchCondition(param1); default: return true; } }; Game_Enemy.prototype.meetsTurnCondition = function (param1, param2) { var n = $gameTroop.turnCount(); if (param2 === 0) { return n === param1; } else { return n > 0 && n >= param1 && n % param2 === param1 % param2; } }; Game_Enemy.prototype.meetsHpCondition = function (param1, param2) { return this.hpRate() >= param1 && this.hpRate() <= param2; }; Game_Enemy.prototype.meetsMpCondition = function (param1, param2) { return this.mpRate() >= param1 && this.mpRate() <= param2; }; Game_Enemy.prototype.meetsStateCondition = function (param) { return this.isStateAffected(param); }; Game_Enemy.prototype.meetsPartyLevelCondition = function (param) { return $gameParty.highestLevel() >= param; }; Game_Enemy.prototype.meetsSwitchCondition = function (param) { return $gameSwitches.value(param); }; Game_Enemy.prototype.isActionValid = function (action) { return this.meetsCondition(action) && this.canUse($dataSkills[action.skillId]); }; Game_Enemy.prototype.selectAction = function (actionList, ratingZero) { var sum = actionList.reduce(function (r, a) { return r + a.rating - ratingZero; }, 0); if (sum > 0) { var value = Math.randomInt(sum); for (var i = 0; i < actionList.length; i++) { var action = actionList[i]; value -= action.rating - ratingZero; if (value < 0) { return action; } } } else { return null; } }; Game_Enemy.prototype.selectAllActions = function (actionList) { var ratingMax = Math.max.apply(null, actionList.map(function (a) { return a.rating; })); var ratingZero = ratingMax - 3; actionList = actionList.filter(function (a) { return a.rating > ratingZero; }); for (var i = 0; i < this.numActions(); i++) { this.action(i).setEnemyAction(this.selectAction(actionList, ratingZero)); } }; Game_Enemy.prototype.makeActions = function () { Game_Battler.prototype.makeActions.call(this); if (this.numActions() > 0) { var actionList = this.enemy().actions.filter(function (a) { return this.isActionValid(a); }, this); if (actionList.length > 0) { this.selectAllActions(actionList); } } this.setActionState('waiting'); }; //----------------------------------------------------------------------------- // Game_Actors // // The wrapper class for an actor array. function Game_Actors() { this.initialize.apply(this, arguments); } Game_Actors.prototype.initialize = function () { this._data = []; }; Game_Actors.prototype.actor = function (actorId) { if ($dataActors[actorId]) { if (!this._data[actorId]) { this._data[actorId] = new Game_Actor(actorId); } return this._data[actorId]; } return null; }; //----------------------------------------------------------------------------- // Game_Unit // // The superclass of Game_Party and Game_Troop. function Game_Unit() { this.initialize.apply(this, arguments); } Game_Unit.prototype.initialize = function () { this._inBattle = false; }; Game_Unit.prototype.inBattle = function () { return this._inBattle; }; Game_Unit.prototype.members = function () { return []; }; Game_Unit.prototype.aliveMembers = function () { return this.members().filter(function (member) { return member.isAlive(); }); }; Game_Unit.prototype.deadMembers = function () { return this.members().filter(function (member) { return member.isDead(); }); }; Game_Unit.prototype.movableMembers = function () { return this.members().filter(function (member) { return member.canMove(); }); }; Game_Unit.prototype.clearActions = function () { return this.members().forEach(function (member) { return member.clearActions(); }); }; Game_Unit.prototype.agility = function () { var members = this.members(); if (members.length === 0) { return 1; } var sum = members.reduce(function (r, member) { return r + member.agi; }, 0); return sum / members.length; }; Game_Unit.prototype.tgrSum = function () { return this.aliveMembers().reduce(function (r, member) { return r + member.tgr; }, 0); }; Game_Unit.prototype.randomTarget = function () { var tgrRand = Math.random() * this.tgrSum(); var target = null; this.aliveMembers().forEach(function (member) { tgrRand -= member.tgr; if (tgrRand <= 0 && !target) { target = member; } }); return target; }; Game_Unit.prototype.randomDeadTarget = function () { var members = this.deadMembers(); if (members.length === 0) { return null; } return members[Math.floor(Math.random() * members.length)]; }; Game_Unit.prototype.smoothTarget = function (index) { if (index < 0) { index = 0; } var member = this.members()[index]; return (member && member.isAlive()) ? member : this.aliveMembers()[0]; }; Game_Unit.prototype.smoothDeadTarget = function (index) { if (index < 0) { index = 0; } var member = this.members()[index]; return (member && member.isDead()) ? member : this.deadMembers()[0]; }; Game_Unit.prototype.clearResults = function () { this.members().forEach(function (member) { member.clearResult(); }); }; Game_Unit.prototype.onBattleStart = function () { this.members().forEach(function (member) { member.onBattleStart(); }); this._inBattle = true; }; Game_Unit.prototype.onBattleEnd = function () { this._inBattle = false; this.members().forEach(function (member) { member.onBattleEnd(); }); }; Game_Unit.prototype.makeActions = function () { this.members().forEach(function (member) { member.makeActions(); }); }; Game_Unit.prototype.select = function (activeMember) { this.members().forEach(function (member) { if (member === activeMember) { member.select(); } else { member.deselect(); } }); }; Game_Unit.prototype.isAllDead = function () { return this.aliveMembers().length === 0; }; Game_Unit.prototype.substituteBattler = function () { var members = this.members(); for (var i = 0; i < members.length; i++) { if (members[i].isSubstitute()) { return members[i]; } } }; //----------------------------------------------------------------------------- // Game_Party // // The game object class for the party. Information such as gold and items is // included. function Game_Party() { this.initialize.apply(this, arguments); } Game_Party.prototype = Object.create(Game_Unit.prototype); Game_Party.prototype.constructor = Game_Party; Game_Party.ABILITY_ENCOUNTER_HALF = 0; Game_Party.ABILITY_ENCOUNTER_NONE = 1; Game_Party.ABILITY_CANCEL_SURPRISE = 2; Game_Party.ABILITY_RAISE_PREEMPTIVE = 3; Game_Party.ABILITY_GOLD_DOUBLE = 4; Game_Party.ABILITY_DROP_ITEM_DOUBLE = 5; Game_Party.prototype.initialize = function () { Game_Unit.prototype.initialize.call(this); this._gold = 0; this._steps = 0; this._lastItem = new Game_Item(); this._menuActorId = 0; this._targetActorId = 0; this._actors = []; this.initAllItems(); }; Game_Party.prototype.initAllItems = function () { this._items = {}; this._weapons = {}; this._armors = {}; }; Game_Party.prototype.exists = function () { return this._actors.length > 0; }; Game_Party.prototype.size = function () { return this.members().length; }; Game_Party.prototype.isEmpty = function () { return this.size() === 0; }; Game_Party.prototype.members = function () { return this.inBattle() ? this.battleMembers() : this.allMembers(); }; Game_Party.prototype.allMembers = function () { return this._actors.map(function (id) { return $gameActors.actor(id); }); }; Game_Party.prototype.battleMembers = function () { return this.allMembers().slice(0, this.maxBattleMembers()).filter(function (actor) { return actor.isAppeared(); }); }; Game_Party.prototype.maxBattleMembers = function () { return 4; }; Game_Party.prototype.leader = function () { return this.battleMembers()[0]; }; Game_Party.prototype.reviveBattleMembers = function () { this.battleMembers().forEach(function (actor) { if (actor.isDead()) { actor.setHp(1); } }); }; Game_Party.prototype.items = function () { var list = []; for (var id in this._items) { list.push($dataItems[id]); } return list; }; Game_Party.prototype.weapons = function () { var list = []; for (var id in this._weapons) { list.push($dataWeapons[id]); } return list; }; Game_Party.prototype.armors = function () { var list = []; for (var id in this._armors) { list.push($dataArmors[id]); } return list; }; Game_Party.prototype.equipItems = function () { return this.weapons().concat(this.armors()); }; Game_Party.prototype.allItems = function () { return this.items().concat(this.equipItems()); }; Game_Party.prototype.itemContainer = function (item) { if (!item) { return null; } else if (DataManager.isItem(item)) { return this._items; } else if (DataManager.isWeapon(item)) { return this._weapons; } else if (DataManager.isArmor(item)) { return this._armors; } else { return null; } }; Game_Party.prototype.setupStartingMembers = function () { this._actors = []; $dataSystem.partyMembers.forEach(function (actorId) { if ($gameActors.actor(actorId)) { this._actors.push(actorId); } }, this); }; Game_Party.prototype.name = function () { var numBattleMembers = this.battleMembers().length; if (numBattleMembers === 0) { return ''; } else if (numBattleMembers === 1) { return this.leader().name(); } else { return TextManager.partyName.format(this.leader().name()); } }; Game_Party.prototype.setupBattleTest = function () { this.setupBattleTestMembers(); this.setupBattleTestItems(); }; Game_Party.prototype.setupBattleTestMembers = function () { $dataSystem.testBattlers.forEach(function (battler) { var actor = $gameActors.actor(battler.actorId); if (actor) { actor.changeLevel(battler.level, false); actor.initEquips(battler.equips); actor.recoverAll(); this.addActor(battler.actorId); } }, this); }; Game_Party.prototype.setupBattleTestItems = function () { $dataItems.forEach(function (item) { if (item && item.name.length > 0) { this.gainItem(item, this.maxItems(item)); } }, this); }; Game_Party.prototype.highestLevel = function () { return Math.max.apply(null, this.members().map(function (actor) { return actor.level; })); }; Game_Party.prototype.addActor = function (actorId) { if (!this._actors.contains(actorId)) { this._actors.push(actorId); $gamePlayer.refresh(); $gameMap.requestRefresh(); } }; Game_Party.prototype.removeActor = function (actorId) { if (this._actors.contains(actorId)) { this._actors.splice(this._actors.indexOf(actorId), 1); $gamePlayer.refresh(); $gameMap.requestRefresh(); } }; Game_Party.prototype.gold = function () { return this._gold; }; Game_Party.prototype.gainGold = function (amount) { this._gold = (this._gold + amount).clamp(0, this.maxGold()); }; Game_Party.prototype.loseGold = function (amount) { this.gainGold(-amount); }; Game_Party.prototype.maxGold = function () { return 99999999; }; Game_Party.prototype.steps = function () { return this._steps; }; Game_Party.prototype.increaseSteps = function () { this._steps++; }; Game_Party.prototype.numItems = function (item) { var container = this.itemContainer(item); return container ? container[item.id] || 0 : 0; }; Game_Party.prototype.maxItems = function (item) { return 99; }; Game_Party.prototype.hasMaxItems = function (item) { return this.numItems(item) >= this.maxItems(item); }; Game_Party.prototype.hasItem = function (item, includeEquip) { if (includeEquip === undefined) { includeEquip = false; } if (this.numItems(item) > 0) { return true; } else if (includeEquip && this.isAnyMemberEquipped(item)) { return true; } else { return false; } }; Game_Party.prototype.isAnyMemberEquipped = function (item) { return this.members().some(function (actor) { return actor.equips().contains(item); }); }; Game_Party.prototype.gainItem = function (item, amount, includeEquip) { var container = this.itemContainer(item); if (container) { var lastNumber = this.numItems(item); var newNumber = lastNumber + amount; container[item.id] = newNumber.clamp(0, this.maxItems(item)); if (container[item.id] === 0) { delete container[item.id]; } if (includeEquip && newNumber < 0) { this.discardMembersEquip(item, -newNumber); } $gameMap.requestRefresh(); } }; Game_Party.prototype.discardMembersEquip = function (item, amount) { var n = amount; this.members().forEach(function (actor) { while (n > 0 && actor.isEquipped(item)) { actor.discardEquip(item); n--; } }); }; Game_Party.prototype.loseItem = function (item, amount, includeEquip) { this.gainItem(item, -amount, includeEquip); }; Game_Party.prototype.consumeItem = function (item) { if (DataManager.isItem(item) && item.consumable) { this.loseItem(item, 1); } }; Game_Party.prototype.canUse = function (item) { return this.members().some(function (actor) { return actor.canUse(item); }); }; Game_Party.prototype.canInput = function () { return this.members().some(function (actor) { return actor.canInput(); }); }; Game_Party.prototype.isAllDead = function () { if (Game_Unit.prototype.isAllDead.call(this)) { return this.inBattle() || !this.isEmpty(); } else { return false; } }; Game_Party.prototype.onPlayerWalk = function () { this.members().forEach(function (actor) { return actor.onPlayerWalk(); }); }; Game_Party.prototype.menuActor = function () { var actor = $gameActors.actor(this._menuActorId); if (!this.members().contains(actor)) { actor = this.members()[0]; } return actor; }; Game_Party.prototype.setMenuActor = function (actor) { this._menuActorId = actor.actorId(); }; Game_Party.prototype.makeMenuActorNext = function () { var index = this.members().indexOf(this.menuActor()); if (index >= 0) { index = (index + 1) % this.members().length; this.setMenuActor(this.members()[index]); } else { this.setMenuActor(this.members()[0]); } }; Game_Party.prototype.makeMenuActorPrevious = function () { var index = this.members().indexOf(this.menuActor()); if (index >= 0) { index = (index + this.members().length - 1) % this.members().length; this.setMenuActor(this.members()[index]); } else { this.setMenuActor(this.members()[0]); } }; Game_Party.prototype.targetActor = function () { var actor = $gameActors.actor(this._targetActorId); if (!this.members().contains(actor)) { actor = this.members()[0]; } return actor; }; Game_Party.prototype.setTargetActor = function (actor) { this._targetActorId = actor.actorId(); }; Game_Party.prototype.lastItem = function () { return this._lastItem.object(); }; Game_Party.prototype.setLastItem = function (item) { this._lastItem.setObject(item); }; Game_Party.prototype.swapOrder = function (index1, index2) { var temp = this._actors[index1]; this._actors[index1] = this._actors[index2]; this._actors[index2] = temp; $gamePlayer.refresh(); }; Game_Party.prototype.charactersForSavefile = function () { return this.battleMembers().map(function (actor) { return [actor.characterName(), actor.characterIndex()]; }); }; Game_Party.prototype.facesForSavefile = function () { return this.battleMembers().map(function (actor) { return [actor.faceName(), actor.faceIndex()]; }); }; Game_Party.prototype.partyAbility = function (abilityId) { return this.battleMembers().some(function (actor) { return actor.partyAbility(abilityId); }); }; Game_Party.prototype.hasEncounterHalf = function () { return this.partyAbility(Game_Party.ABILITY_ENCOUNTER_HALF); }; Game_Party.prototype.hasEncounterNone = function () { return this.partyAbility(Game_Party.ABILITY_ENCOUNTER_NONE); }; Game_Party.prototype.hasCancelSurprise = function () { return this.partyAbility(Game_Party.ABILITY_CANCEL_SURPRISE); }; Game_Party.prototype.hasRaisePreemptive = function () { return this.partyAbility(Game_Party.ABILITY_RAISE_PREEMPTIVE); }; Game_Party.prototype.hasGoldDouble = function () { return this.partyAbility(Game_Party.ABILITY_GOLD_DOUBLE); }; Game_Party.prototype.hasDropItemDouble = function () { return this.partyAbility(Game_Party.ABILITY_DROP_ITEM_DOUBLE); }; Game_Party.prototype.ratePreemptive = function (troopAgi) { var rate = this.agility() >= troopAgi ? 0.05 : 0.03; if (this.hasRaisePreemptive()) { rate *= 4; } return rate; }; Game_Party.prototype.rateSurprise = function (troopAgi) { var rate = this.agility() >= troopAgi ? 0.03 : 0.05; if (this.hasCancelSurprise()) { rate = 0; } return rate; }; Game_Party.prototype.performVictory = function () { this.members().forEach(function (actor) { actor.performVictory(); }); }; Game_Party.prototype.performEscape = function () { this.members().forEach(function (actor) { actor.performEscape(); }); }; Game_Party.prototype.removeBattleStates = function () { this.members().forEach(function (actor) { actor.removeBattleStates(); }); }; Game_Party.prototype.requestMotionRefresh = function () { this.members().forEach(function (actor) { actor.requestMotionRefresh(); }); }; //----------------------------------------------------------------------------- // Game_Troop // // The game object class for a troop and the battle-related data. function Game_Troop() { this.initialize.apply(this, arguments); } Game_Troop.prototype = Object.create(Game_Unit.prototype); Game_Troop.prototype.constructor = Game_Troop; Game_Troop.LETTER_TABLE_HALF = [ ' A', ' B', ' C', ' D', ' E', ' F', ' G', ' H', ' I', ' J', ' K', ' L', ' M', ' N', ' O', ' P', ' Q', ' R', ' S', ' T', ' U', ' V', ' W', ' X', ' Y', ' Z' ]; Game_Troop.LETTER_TABLE_FULL = [ 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' ]; Game_Troop.prototype.initialize = function () { Game_Unit.prototype.initialize.call(this); this._interpreter = new Game_Interpreter(); this.clear(); }; Game_Troop.prototype.isEventRunning = function () { return this._interpreter.isRunning(); }; Game_Troop.prototype.updateInterpreter = function () { this._interpreter.update(); }; Game_Troop.prototype.turnCount = function () { return this._turnCount; }; Game_Troop.prototype.members = function () { return this._enemies; }; Game_Troop.prototype.clear = function () { this._interpreter.clear(); this._troopId = 0; this._eventFlags = {}; this._enemies = []; this._turnCount = 0; this._namesCount = {}; }; Game_Troop.prototype.troop = function () { return $dataTroops[this._troopId]; }; Game_Troop.prototype.setup = function (troopId) { this.clear(); this._troopId = troopId; this._enemies = []; this.troop().members.forEach(function (member) { if ($dataEnemies[member.enemyId]) { var enemyId = member.enemyId; var x = member.x; var y = member.y; var enemy = new Game_Enemy(enemyId, x, y); if (member.hidden) { enemy.hide(); } this._enemies.push(enemy); } }, this); this.makeUniqueNames(); }; Game_Troop.prototype.makeUniqueNames = function () { var table = this.letterTable(); this.members().forEach(function (enemy) { if (enemy.isAlive() && enemy.isLetterEmpty()) { var name = enemy.originalName(); var n = this._namesCount[name] || 0; enemy.setLetter(table[n % table.length]); this._namesCount[name] = n + 1; } }, this); this.members().forEach(function (enemy) { var name = enemy.originalName(); if (this._namesCount[name] >= 2) { enemy.setPlural(true); } }, this); }; Game_Troop.prototype.letterTable = function () { return $gameSystem.isCJK() ? Game_Troop.LETTER_TABLE_FULL : Game_Troop.LETTER_TABLE_HALF; }; Game_Troop.prototype.enemyNames = function () { var names = []; this.members().forEach(function (enemy) { var name = enemy.originalName(); if (enemy.isAlive() && !names.contains(name)) { names.push(name); } }); return names; }; Game_Troop.prototype.meetsConditions = function (page) { var c = page.conditions; if (!c.turnEnding && !c.turnValid && !c.enemyValid && !c.actorValid && !c.switchValid) { return false; // Conditions not set } if (c.turnEnding) { if (!BattleManager.isTurnEnd()) { return false; } } if (c.turnValid) { var n = this._turnCount; var a = c.turnA; var b = c.turnB; if ((b === 0 && n !== a)) { return false; } if ((b > 0 && (n < 1 || n < a || n % b !== a % b))) { return false; } } if (c.enemyValid) { var enemy = $gameTroop.members()[c.enemyIndex]; if (!enemy || enemy.hpRate() * 100 > c.enemyHp) { return false; } } if (c.actorValid) { var actor = $gameActors.actor(c.actorId); if (!actor || actor.hpRate() * 100 > c.actorHp) { return false; } } if (c.switchValid) { if (!$gameSwitches.value(c.switchId)) { return false; } } return true; }; Game_Troop.prototype.setupBattleEvent = function () { if (!this._interpreter.isRunning()) { if (this._interpreter.setupReservedCommonEvent()) { return; } var pages = this.troop().pages; for (var i = 0; i < pages.length; i++) { var page = pages[i]; if (this.meetsConditions(page) && !this._eventFlags[i]) { this._interpreter.setup(page.list); if (page.span <= 1) { this._eventFlags[i] = true; } break; } } } }; Game_Troop.prototype.increaseTurn = function () { var pages = this.troop().pages; for (var i = 0; i < pages.length; i++) { var page = pages[i]; if (page.span === 1) { this._eventFlags[i] = false; } } this._turnCount++; }; Game_Troop.prototype.expTotal = function () { return this.deadMembers().reduce(function (r, enemy) { return r + enemy.exp(); }, 0); }; Game_Troop.prototype.goldTotal = function () { return this.deadMembers().reduce(function (r, enemy) { return r + enemy.gold(); }, 0) * this.goldRate(); }; Game_Troop.prototype.goldRate = function () { return $gameParty.hasGoldDouble() ? 2 : 1; }; Game_Troop.prototype.makeDropItems = function () { return this.deadMembers().reduce(function (r, enemy) { return r.concat(enemy.makeDropItems()); }, []); }; //----------------------------------------------------------------------------- // Game_Map // // The game object class for a map. It contains scrolling and passage // determination functions. function Game_Map() { this.initialize.apply(this, arguments); } Game_Map.prototype.initialize = function () { this._interpreter = new Game_Interpreter(); this._mapId = 0; this._tilesetId = 0; this._events = []; this._commonEvents = []; this._vehicles = []; this._displayX = 0; this._displayY = 0; this._nameDisplay = true; this._scrollDirection = 2; this._scrollRest = 0; this._scrollSpeed = 4; this._parallaxName = ''; this._parallaxZero = false; this._parallaxLoopX = false; this._parallaxLoopY = false; this._parallaxSx = 0; this._parallaxSy = 0; this._parallaxX = 0; this._parallaxY = 0; this._battleback1Name = null; this._battleback2Name = null; this.createVehicles(); }; Game_Map.prototype.setup = function (mapId) { if (!$dataMap) { throw new Error('The map data is not available'); } this._mapId = mapId; this._tilesetId = $dataMap.tilesetId; this._displayX = 0; this._displayY = 0; this.refereshVehicles(); this.setupEvents(); this.setupScroll(); this.setupParallax(); this.setupBattleback(); this._needsRefresh = false; }; Game_Map.prototype.isEventRunning = function () { return this._interpreter.isRunning() || this.isAnyEventStarting(); }; Game_Map.prototype.tileWidth = function () { return 48; }; Game_Map.prototype.tileHeight = function () { return 48; }; Game_Map.prototype.mapId = function () { return this._mapId; }; Game_Map.prototype.tilesetId = function () { return this._tilesetId; }; Game_Map.prototype.displayX = function () { return this._displayX; }; Game_Map.prototype.displayY = function () { return this._displayY; }; Game_Map.prototype.parallaxName = function () { return this._parallaxName; }; Game_Map.prototype.battleback1Name = function () { return this._battleback1Name; }; Game_Map.prototype.battleback2Name = function () { return this._battleback2Name; }; Game_Map.prototype.requestRefresh = function (mapId) { this._needsRefresh = true; }; Game_Map.prototype.isNameDisplayEnabled = function () { return this._nameDisplay; }; Game_Map.prototype.disableNameDisplay = function () { this._nameDisplay = false; }; Game_Map.prototype.enableNameDisplay = function () { this._nameDisplay = true; }; Game_Map.prototype.createVehicles = function () { this._vehicles = []; this._vehicles[0] = new Game_Vehicle('boat'); this._vehicles[1] = new Game_Vehicle('ship'); this._vehicles[2] = new Game_Vehicle('airship'); }; Game_Map.prototype.refereshVehicles = function () { this._vehicles.forEach(function (vehicle) { vehicle.refresh(); }); }; Game_Map.prototype.vehicles = function () { return this._vehicles; }; Game_Map.prototype.vehicle = function (type) { if (type === 0 || type === 'boat') { return this.boat(); } else if (type === 1 || type === 'ship') { return this.ship(); } else if (type === 2 || type === 'airship') { return this.airship(); } else { return null; } }; Game_Map.prototype.boat = function () { return this._vehicles[0]; }; Game_Map.prototype.ship = function () { return this._vehicles[1]; }; Game_Map.prototype.airship = function () { return this._vehicles[2]; }; Game_Map.prototype.setupEvents = function () { this._events = []; for (var i = 0; i < $dataMap.events.length; i++) { if ($dataMap.events[i]) { this._events[i] = new Game_Event(this._mapId, i); } } this._commonEvents = this.parallelCommonEvents().map(function (commonEvent) { return new Game_CommonEvent(commonEvent.id); }); this.refreshTileEvents(); }; Game_Map.prototype.events = function () { return this._events.filter(function (event) { return !!event; }); }; Game_Map.prototype.event = function (eventId) { return this._events[eventId]; }; Game_Map.prototype.eraseEvent = function (eventId) { this._events[eventId].erase(); }; Game_Map.prototype.parallelCommonEvents = function () { return $dataCommonEvents.filter(function (commonEvent) { return commonEvent && commonEvent.trigger === 2; }); }; Game_Map.prototype.setupScroll = function () { this._scrollDirection = 2; this._scrollRest = 0; this._scrollSpeed = 4; }; Game_Map.prototype.setupParallax = function () { this._parallaxName = $dataMap.parallaxName || ''; this._parallaxZero = ImageManager.isZeroParallax(this._parallaxName); this._parallaxLoopX = $dataMap.parallaxLoopX; this._parallaxLoopY = $dataMap.parallaxLoopY; this._parallaxSx = $dataMap.parallaxSx; this._parallaxSy = $dataMap.parallaxSy; this._parallaxX = 0; this._parallaxY = 0; }; Game_Map.prototype.setupBattleback = function () { if ($dataMap.specifyBattleback) { this._battleback1Name = $dataMap.battleback1Name; this._battleback2Name = $dataMap.battleback2Name; } else { this._battleback1Name = null; this._battleback2Name = null; } }; Game_Map.prototype.setDisplayPos = function (x, y) { if (this.isLoopHorizontal()) { this._displayX = x.mod(this.width()); this._parallaxX = x; } else { var endX = this.width() - this.screenTileX(); this._displayX = endX < 0 ? endX / 2 : x.clamp(0, endX); this._parallaxX = this._displayX; } if (this.isLoopVertical()) { this._displayY = y.mod(this.height()); this._parallaxY = y; } else { var endY = this.height() - this.screenTileY(); this._displayY = endY < 0 ? endY / 2 : y.clamp(0, endY); this._parallaxY = this._displayY; } }; Game_Map.prototype.parallaxOx = function () { if (this._parallaxZero) { return this._parallaxX * this.tileWidth(); } else if (this._parallaxLoopX) { return this._parallaxX * this.tileWidth() / 2; } else { return 0; } }; Game_Map.prototype.parallaxOy = function () { if (this._parallaxZero) { return this._parallaxY * this.tileHeight(); } else if (this._parallaxLoopY) { return this._parallaxY * this.tileHeight() / 2; } else { return 0; } }; Game_Map.prototype.tileset = function () { return $dataTilesets[this._tilesetId]; }; Game_Map.prototype.tilesetFlags = function () { var tileset = this.tileset(); if (tileset) { return tileset.flags; } else { return []; } }; Game_Map.prototype.displayName = function () { return $dataMap.displayName; }; Game_Map.prototype.width = function () { return $dataMap.width; }; Game_Map.prototype.height = function () { return $dataMap.height; }; Game_Map.prototype.data = function () { return $dataMap.data; }; Game_Map.prototype.isLoopHorizontal = function () { return $dataMap.scrollType === 2 || $dataMap.scrollType === 3; }; Game_Map.prototype.isLoopVertical = function () { return $dataMap.scrollType === 1 || $dataMap.scrollType === 3; }; Game_Map.prototype.isDashDisabled = function () { return $dataMap.disableDashing; }; Game_Map.prototype.encounterList = function () { return $dataMap.encounterList; }; Game_Map.prototype.encounterStep = function () { return $dataMap.encounterStep; }; Game_Map.prototype.isOverworld = function () { return this.tileset() && this.tileset().mode === 0; }; Game_Map.prototype.screenTileX = function () { return Graphics.width / this.tileWidth(); }; Game_Map.prototype.screenTileY = function () { return Graphics.height / this.tileHeight(); }; Game_Map.prototype.adjustX = function (x) { if (this.isLoopHorizontal() && x < this._displayX - (this.width() - this.screenTileX()) / 2) { return x - this._displayX + $dataMap.width; } else { return x - this._displayX; } }; Game_Map.prototype.adjustY = function (y) { if (this.isLoopVertical() && y < this._displayY - (this.height() - this.screenTileY()) / 2) { return y - this._displayY + $dataMap.height; } else { return y - this._displayY; } }; Game_Map.prototype.roundX = function (x) { return this.isLoopHorizontal() ? x.mod(this.width()) : x; }; Game_Map.prototype.roundY = function (y) { return this.isLoopVertical() ? y.mod(this.height()) : y; }; Game_Map.prototype.xWithDirection = function (x, d) { return x + (d === 6 ? 1 : d === 4 ? -1 : 0); }; Game_Map.prototype.yWithDirection = function (y, d) { return y + (d === 2 ? 1 : d === 8 ? -1 : 0); }; Game_Map.prototype.roundXWithDirection = function (x, d) { return this.roundX(x + (d === 6 ? 1 : d === 4 ? -1 : 0)); }; Game_Map.prototype.roundYWithDirection = function (y, d) { return this.roundY(y + (d === 2 ? 1 : d === 8 ? -1 : 0)); }; Game_Map.prototype.deltaX = function (x1, x2) { var result = x1 - x2; if (this.isLoopHorizontal() && Math.abs(result) > this.width() / 2) { if (result < 0) { result += this.width(); } else { result -= this.width(); } } return result; }; Game_Map.prototype.deltaY = function (y1, y2) { var result = y1 - y2; if (this.isLoopVertical() && Math.abs(result) > this.height() / 2) { if (result < 0) { result += this.height(); } else { result -= this.height(); } } return result; }; Game_Map.prototype.distance = function (x1, y1, x2, y2) { return Math.abs(this.deltaX(x1, x2)) + Math.abs(this.deltaY(y1, y2)); }; Game_Map.prototype.canvasToMapX = function (x) { var tileWidth = this.tileWidth(); var originX = this._displayX * tileWidth; var mapX = Math.floor((originX + x) / tileWidth); return this.roundX(mapX); }; Game_Map.prototype.canvasToMapY = function (y) { var tileHeight = this.tileHeight(); var originY = this._displayY * tileHeight; var mapY = Math.floor((originY + y) / tileHeight); return this.roundY(mapY); }; Game_Map.prototype.autoplay = function () { if ($dataMap.autoplayBgm) { if ($gamePlayer.isInVehicle()) { $gameSystem.saveWalkingBgm2(); } else { AudioManager.playBgm($dataMap.bgm); } } if ($dataMap.autoplayBgs) { AudioManager.playBgs($dataMap.bgs); } }; Game_Map.prototype.refreshIfNeeded = function () { if (this._needsRefresh) { this.refresh(); } }; Game_Map.prototype.refresh = function () { this.events().forEach(function (event) { event.refresh(); }); this._commonEvents.forEach(function (event) { event.refresh(); }); this.refreshTileEvents(); this._needsRefresh = false; }; Game_Map.prototype.refreshTileEvents = function () { this.tileEvents = this.events().filter(function (event) { return event.isTile(); }); }; Game_Map.prototype.eventsXy = function (x, y) { return this.events().filter(function (event) { return event.pos(x, y); }); }; Game_Map.prototype.eventsXyNt = function (x, y) { return this.events().filter(function (event) { return event.posNt(x, y); }); }; Game_Map.prototype.tileEventsXy = function (x, y) { return this.tileEvents.filter(function (event) { return event.posNt(x, y); }); }; Game_Map.prototype.eventIdXy = function (x, y) { var list = this.eventsXy(x, y); return list.length === 0 ? 0 : list[0].eventId(); }; Game_Map.prototype.scrollDown = function (distance) { if (this.isLoopVertical()) { this._displayY += distance; this._displayY %= $dataMap.height; if (this._parallaxLoopY) { this._parallaxY += distance; } } else if (this.height() >= this.screenTileY()) { var lastY = this._displayY; this._displayY = Math.min(this._displayY + distance, this.height() - this.screenTileY()); this._parallaxY += this._displayY - lastY; } }; Game_Map.prototype.scrollLeft = function (distance) { if (this.isLoopHorizontal()) { this._displayX += $dataMap.width - distance; this._displayX %= $dataMap.width; if (this._parallaxLoopX) { this._parallaxX -= distance; } } else if (this.width() >= this.screenTileX()) { var lastX = this._displayX; this._displayX = Math.max(this._displayX - distance, 0); this._parallaxX += this._displayX - lastX; } }; Game_Map.prototype.scrollRight = function (distance) { if (this.isLoopHorizontal()) { this._displayX += distance; this._displayX %= $dataMap.width; if (this._parallaxLoopX) { this._parallaxX += distance; } } else if (this.width() >= this.screenTileX()) { var lastX = this._displayX; this._displayX = Math.min(this._displayX + distance, this.width() - this.screenTileX()); this._parallaxX += this._displayX - lastX; } }; Game_Map.prototype.scrollUp = function (distance) { if (this.isLoopVertical()) { this._displayY += $dataMap.height - distance; this._displayY %= $dataMap.height; if (this._parallaxLoopY) { this._parallaxY -= distance; } } else if (this.height() >= this.screenTileY()) { var lastY = this._displayY; this._displayY = Math.max(this._displayY - distance, 0); this._parallaxY += this._displayY - lastY; } }; Game_Map.prototype.isValid = function (x, y) { return x >= 0 && x < this.width() && y >= 0 && y < this.height(); }; Game_Map.prototype.checkPassage = function (x, y, bit) { var flags = this.tilesetFlags(); var tiles = this.allTiles(x, y); for (var i = 0; i < tiles.length; i++) { var flag = flags[tiles[i]]; if ((flag & 0x10) !== 0) // [*] No effect on passage continue; if ((flag & bit) === 0) // [o] Passable return true; if ((flag & bit) === bit) // [x] Impassable return false; } return false; }; Game_Map.prototype.tileId = function (x, y, z) { var width = $dataMap.width; var height = $dataMap.height; return $dataMap.data[(z * height + y) * width + x] || 0; }; Game_Map.prototype.layeredTiles = function (x, y) { var tiles = []; for (var i = 0; i < 4; i++) { tiles.push(this.tileId(x, y, 3 - i)); } return tiles; }; Game_Map.prototype.allTiles = function (x, y) { var tiles = this.tileEventsXy(x, y).map(function (event) { return event.tileId(); }); return tiles.concat(this.layeredTiles(x, y)); }; Game_Map.prototype.autotileType = function (x, y, z) { var tileId = this.tileId(x, y, z); return tileId >= 2048 ? Math.floor((tileId - 2048) / 48) : -1; }; Game_Map.prototype.isPassable = function (x, y, d) { return this.checkPassage(x, y, (1 << (d / 2 - 1)) & 0x0f); }; Game_Map.prototype.isBoatPassable = function (x, y) { return this.checkPassage(x, y, 0x0200); }; Game_Map.prototype.isShipPassable = function (x, y) { return this.checkPassage(x, y, 0x0400); }; Game_Map.prototype.isAirshipLandOk = function (x, y) { return this.checkPassage(x, y, 0x0800) && this.checkPassage(x, y, 0x0f); }; Game_Map.prototype.checkLayeredTilesFlags = function (x, y, bit) { var flags = this.tilesetFlags(); return this.layeredTiles(x, y).some(function (tileId) { return (flags[tileId] & bit) !== 0; }); }; Game_Map.prototype.isLadder = function (x, y) { return this.isValid(x, y) && this.checkLayeredTilesFlags(x, y, 0x20); }; Game_Map.prototype.isBush = function (x, y) { return this.isValid(x, y) && this.checkLayeredTilesFlags(x, y, 0x40); }; Game_Map.prototype.isCounter = function (x, y) { return this.isValid(x, y) && this.checkLayeredTilesFlags(x, y, 0x80); }; Game_Map.prototype.isDamageFloor = function (x, y) { return this.isValid(x, y) && this.checkLayeredTilesFlags(x, y, 0x100); }; Game_Map.prototype.terrainTag = function (x, y) { if (this.isValid(x, y)) { var flags = this.tilesetFlags(); var tiles = this.layeredTiles(x, y); for (var i = 0; i < tiles.length; i++) { var tag = flags[tiles[i]] >> 12; if (tag > 0) { return tag; } } } return 0; }; Game_Map.prototype.regionId = function (x, y) { return this.isValid(x, y) ? this.tileId(x, y, 5) : 0; }; Game_Map.prototype.startScroll = function (direction, distance, speed) { this._scrollDirection = direction; this._scrollRest = distance; this._scrollSpeed = speed; }; Game_Map.prototype.isScrolling = function () { return this._scrollRest > 0; }; Game_Map.prototype.update = function (sceneActive) { this.refreshIfNeeded(); if (sceneActive) { this.updateInterpreter(); } this.updateScroll(); this.updateEvents(); this.updateVehicles(); this.updateParallax(); }; Game_Map.prototype.updateScroll = function () { if (this.isScrolling()) { var lastX = this._displayX; var lastY = this._displayY; this.doScroll(this._scrollDirection, this.scrollDistance()); if (this._displayX === lastX && this._displayY === lastY) { this._scrollRest = 0; } else { this._scrollRest -= this.scrollDistance(); } } }; Game_Map.prototype.scrollDistance = function () { return Math.pow(2, this._scrollSpeed) / 256; }; Game_Map.prototype.doScroll = function (direction, distance) { switch (direction) { case 2: this.scrollDown(distance); break; case 4: this.scrollLeft(distance); break; case 6: this.scrollRight(distance); break; case 8: this.scrollUp(distance); break; } }; Game_Map.prototype.updateEvents = function () { this.events().forEach(function (event) { event.update(); }); this._commonEvents.forEach(function (event) { event.update(); }); }; Game_Map.prototype.updateVehicles = function () { this._vehicles.forEach(function (vehicle) { vehicle.update(); }); }; Game_Map.prototype.updateParallax = function () { if (this._parallaxLoopX) { this._parallaxX += this._parallaxSx / this.tileWidth() / 2; } if (this._parallaxLoopY) { this._parallaxY += this._parallaxSy / this.tileHeight() / 2; } }; Game_Map.prototype.changeTileset = function (tilesetId) { this._tilesetId = tilesetId; this.refresh(); }; Game_Map.prototype.changeBattleback = function (battleback1Name, battleback2Name) { this._battleback1Name = battleback1Name; this._battleback2Name = battleback2Name; }; Game_Map.prototype.changeParallax = function (name, loopX, loopY, sx, sy) { this._parallaxName = name; this._parallaxZero = ImageManager.isZeroParallax(this._parallaxName); if (this._parallaxLoopX && !loopX) { this._parallaxX = 0; } if (this._parallaxLoopY && !loopY) { this._parallaxY = 0; } this._parallaxLoopX = loopX; this._parallaxLoopY = loopY; this._parallaxSx = sx; this._parallaxSy = sy; }; Game_Map.prototype.updateInterpreter = function () { for (; ;) { this._interpreter.update(); if (this._interpreter.isRunning()) { return; } if (this._interpreter.eventId() > 0) { this.unlockEvent(this._interpreter.eventId()); this._interpreter.clear(); } if (!this.setupStartingEvent()) { return; } } }; Game_Map.prototype.unlockEvent = function (eventId) { if (this._events[eventId]) { this._events[eventId].unlock(); } }; Game_Map.prototype.setupStartingEvent = function () { this.refreshIfNeeded(); if (this._interpreter.setupReservedCommonEvent()) { return true; } if (this.setupTestEvent()) { return true; } if (this.setupStartingMapEvent()) { return true; } if (this.setupAutorunCommonEvent()) { return true; } return false; }; Game_Map.prototype.setupTestEvent = function () { if ($testEvent) { this._interpreter.setup($testEvent, 0); $testEvent = null; return true; } return false; }; Game_Map.prototype.setupStartingMapEvent = function () { var events = this.events(); for (var i = 0; i < events.length; i++) { var event = events[i]; if (event.isStarting()) { event.clearStartingFlag(); this._interpreter.setup(event.list(), event.eventId()); return true; } } return false; }; Game_Map.prototype.setupAutorunCommonEvent = function () { for (var i = 0; i < $dataCommonEvents.length; i++) { var event = $dataCommonEvents[i]; if (event && event.trigger === 1 && $gameSwitches.value(event.switchId)) { this._interpreter.setup(event.list); return true; } } return false; }; Game_Map.prototype.isAnyEventStarting = function () { return this.events().some(function (event) { return event.isStarting(); }); }; //----------------------------------------------------------------------------- // Game_CommonEvent // // The game object class for a common event. It contains functionality for // running parallel process events. function Game_CommonEvent() { this.initialize.apply(this, arguments); } Game_CommonEvent.prototype.initialize = function (commonEventId) { this._commonEventId = commonEventId; this.refresh(); }; Game_CommonEvent.prototype.event = function () { return $dataCommonEvents[this._commonEventId]; }; Game_CommonEvent.prototype.list = function () { return this.event().list; }; Game_CommonEvent.prototype.refresh = function () { if (this.isActive()) { if (!this._interpreter) { this._interpreter = new Game_Interpreter(); } } else { this._interpreter = null; } }; Game_CommonEvent.prototype.isActive = function () { var event = this.event(); return event.trigger === 2 && $gameSwitches.value(event.switchId); }; Game_CommonEvent.prototype.update = function () { if (this._interpreter) { if (!this._interpreter.isRunning()) { this._interpreter.setup(this.list()); } this._interpreter.update(); } }; //----------------------------------------------------------------------------- // Game_CharacterBase // // The superclass of Game_Character. It handles basic information, such as // coordinates and images, shared by all characters. function Game_CharacterBase() { this.initialize.apply(this, arguments); } Object.defineProperties(Game_CharacterBase.prototype, { x: { get: function () { return this._x; }, configurable: true }, y: { get: function () { return this._y; }, configurable: true } }); Game_CharacterBase.prototype.initialize = function () { this.initMembers(); }; Game_CharacterBase.prototype.initMembers = function () { this._x = 0; this._y = 0; this._realX = 0; this._realY = 0; this._moveSpeed = 4; this._moveFrequency = 6; this._opacity = 255; this._blendMode = 0; this._direction = 2; this._pattern = 1; this._priorityType = 1; this._tileId = 0; this._characterName = ''; this._characterIndex = 0; this._isObjectCharacter = false; this._walkAnime = true; this._stepAnime = false; this._directionFix = false; this._through = false; this._transparent = false; this._bushDepth = 0; this._animationId = 0; this._balloonId = 0; this._animationPlaying = false; this._balloonPlaying = false; this._animationCount = 0; this._stopCount = 0; this._jumpCount = 0; this._jumpPeak = 0; this._movementSuccess = true; }; Game_CharacterBase.prototype.pos = function (x, y) { return this._x === x && this._y === y; }; Game_CharacterBase.prototype.posNt = function (x, y) { // No through return this.pos(x, y) && !this.isThrough(); }; Game_CharacterBase.prototype.moveSpeed = function () { return this._moveSpeed; }; Game_CharacterBase.prototype.setMoveSpeed = function (moveSpeed) { this._moveSpeed = moveSpeed; }; Game_CharacterBase.prototype.moveFrequency = function () { return this._moveFrequency; }; Game_CharacterBase.prototype.setMoveFrequency = function (moveFrequency) { this._moveFrequency = moveFrequency; }; Game_CharacterBase.prototype.opacity = function () { return this._opacity; }; Game_CharacterBase.prototype.setOpacity = function (opacity) { this._opacity = opacity; }; Game_CharacterBase.prototype.blendMode = function () { return this._blendMode; }; Game_CharacterBase.prototype.setBlendMode = function (blendMode) { this._blendMode = blendMode; }; Game_CharacterBase.prototype.isNormalPriority = function () { return this._priorityType === 1; }; Game_CharacterBase.prototype.setPriorityType = function (priorityType) { this._priorityType = priorityType; }; Game_CharacterBase.prototype.isMoving = function () { return this._realX !== this._x || this._realY !== this._y; }; Game_CharacterBase.prototype.isJumping = function () { return this._jumpCount > 0; }; Game_CharacterBase.prototype.jumpHeight = function () { return (this._jumpPeak * this._jumpPeak - Math.pow(Math.abs(this._jumpCount - this._jumpPeak), 2)) / 2; }; Game_CharacterBase.prototype.isStopping = function () { return !this.isMoving() && !this.isJumping(); }; Game_CharacterBase.prototype.checkStop = function (threshold) { return this._stopCount > threshold; }; Game_CharacterBase.prototype.resetStopCount = function () { this._stopCount = 0; }; Game_CharacterBase.prototype.realMoveSpeed = function () { return this._moveSpeed + (this.isDashing() ? 1 : 0); }; Game_CharacterBase.prototype.distancePerFrame = function () { return Math.pow(2, this.realMoveSpeed()) / 256; }; Game_CharacterBase.prototype.isDashing = function () { return false; }; Game_CharacterBase.prototype.isDebugThrough = function () { return false; }; Game_CharacterBase.prototype.straighten = function () { if (this.hasWalkAnime() || this.hasStepAnime()) { this._pattern = 1; } this._animationCount = 0; }; Game_CharacterBase.prototype.reverseDir = function (d) { return 10 - d; }; Game_CharacterBase.prototype.canPass = function (x, y, d) { var x2 = $gameMap.roundXWithDirection(x, d); var y2 = $gameMap.roundYWithDirection(y, d); if (!$gameMap.isValid(x2, y2)) { return false; } if (this.isThrough() || this.isDebugThrough()) { return true; } if (!this.isMapPassable(x, y, d)) { return false; } if (this.isCollidedWithCharacters(x2, y2)) { return false; } return true; }; Game_CharacterBase.prototype.canPassDiagonally = function (x, y, horz, vert) { var x2 = $gameMap.roundXWithDirection(x, horz); var y2 = $gameMap.roundYWithDirection(y, vert); if (this.canPass(x, y, vert) && this.canPass(x, y2, horz)) { return true; } if (this.canPass(x, y, horz) && this.canPass(x2, y, vert)) { return true; } return false; }; Game_CharacterBase.prototype.isMapPassable = function (x, y, d) { var x2 = $gameMap.roundXWithDirection(x, d); var y2 = $gameMap.roundYWithDirection(y, d); var d2 = this.reverseDir(d); return $gameMap.isPassable(x, y, d) && $gameMap.isPassable(x2, y2, d2); }; Game_CharacterBase.prototype.isCollidedWithCharacters = function (x, y) { return this.isCollidedWithEvents(x, y) || this.isCollidedWithVehicles(x, y); }; Game_CharacterBase.prototype.isCollidedWithEvents = function (x, y) { var events = $gameMap.eventsXyNt(x, y); return events.some(function (event) { return event.isNormalPriority(); }); }; Game_CharacterBase.prototype.isCollidedWithVehicles = function (x, y) { return $gameMap.boat().posNt(x, y) || $gameMap.ship().posNt(x, y); }; Game_CharacterBase.prototype.setPosition = function (x, y) { this._x = Math.round(x); this._y = Math.round(y); this._realX = x; this._realY = y; }; Game_CharacterBase.prototype.copyPosition = function (character) { this._x = character._x; this._y = character._y; this._realX = character._realX; this._realY = character._realY; this._direction = character._direction; }; Game_CharacterBase.prototype.locate = function (x, y) { this.setPosition(x, y); this.straighten(); this.refreshBushDepth(); }; Game_CharacterBase.prototype.direction = function () { return this._direction; }; Game_CharacterBase.prototype.setDirection = function (d) { if (!this.isDirectionFixed() && d) { this._direction = d; } this.resetStopCount(); }; Game_CharacterBase.prototype.isTile = function () { return this._tileId > 0 && this._priorityType === 0; }; Game_CharacterBase.prototype.isObjectCharacter = function () { return this._isObjectCharacter; }; Game_CharacterBase.prototype.shiftY = function () { return this.isObjectCharacter() ? 0 : 6; }; Game_CharacterBase.prototype.scrolledX = function () { return $gameMap.adjustX(this._realX); }; Game_CharacterBase.prototype.scrolledY = function () { return $gameMap.adjustY(this._realY); }; Game_CharacterBase.prototype.screenX = function () { var tw = $gameMap.tileWidth(); return Math.round(this.scrolledX() * tw + tw / 2); }; Game_CharacterBase.prototype.screenY = function () { var th = $gameMap.tileHeight(); return Math.round(this.scrolledY() * th + th - this.shiftY() - this.jumpHeight()); }; Game_CharacterBase.prototype.screenZ = function () { return this._priorityType * 2 + 1; }; Game_CharacterBase.prototype.isNearTheScreen = function () { var gw = Graphics.width; var gh = Graphics.height; var tw = $gameMap.tileWidth(); var th = $gameMap.tileHeight(); var px = this.scrolledX() * tw + tw / 2 - gw / 2; var py = this.scrolledY() * th + th / 2 - gh / 2; return px >= -gw && px <= gw && py >= -gh && py <= gh; }; Game_CharacterBase.prototype.update = function () { if (this.isStopping()) { this.updateStop(); } if (this.isJumping()) { this.updateJump(); } else if (this.isMoving()) { this.updateMove(); } this.updateAnimation(); }; Game_CharacterBase.prototype.updateStop = function () { this._stopCount++; }; Game_CharacterBase.prototype.updateJump = function () { this._jumpCount--; this._realX = (this._realX * this._jumpCount + this._x) / (this._jumpCount + 1.0); this._realY = (this._realY * this._jumpCount + this._y) / (this._jumpCount + 1.0); this.refreshBushDepth(); if (this._jumpCount === 0) { this._realX = this._x = $gameMap.roundX(this._x); this._realY = this._y = $gameMap.roundY(this._y); } }; Game_CharacterBase.prototype.updateMove = function () { if (this._x < this._realX) { this._realX = Math.max(this._realX - this.distancePerFrame(), this._x); } if (this._x > this._realX) { this._realX = Math.min(this._realX + this.distancePerFrame(), this._x); } if (this._y < this._realY) { this._realY = Math.max(this._realY - this.distancePerFrame(), this._y); } if (this._y > this._realY) { this._realY = Math.min(this._realY + this.distancePerFrame(), this._y); } if (!this.isMoving()) { this.refreshBushDepth(); } }; Game_CharacterBase.prototype.updateAnimation = function () { this.updateAnimationCount(); if (this._animationCount >= this.animationWait()) { this.updatePattern(); this._animationCount = 0; } }; Game_CharacterBase.prototype.animationWait = function () { return (9 - this.realMoveSpeed()) * 3; }; Game_CharacterBase.prototype.updateAnimationCount = function () { if (this.isMoving() && this.hasWalkAnime()) { this._animationCount += 1.5; } else if (this.hasStepAnime() || !this.isOriginalPattern()) { this._animationCount++; } }; Game_CharacterBase.prototype.updatePattern = function () { if (!this.hasStepAnime() && this._stopCount > 0) { this.resetPattern(); } else { this._pattern = (this._pattern + 1) % this.maxPattern(); } }; Game_CharacterBase.prototype.maxPattern = function () { return 4; }; Game_CharacterBase.prototype.pattern = function () { return this._pattern < 3 ? this._pattern : 1; }; Game_CharacterBase.prototype.setPattern = function (pattern) { this._pattern = pattern; }; Game_CharacterBase.prototype.isOriginalPattern = function () { return this.pattern() === 1; }; Game_CharacterBase.prototype.resetPattern = function () { this.setPattern(1); }; Game_CharacterBase.prototype.refreshBushDepth = function () { if (this.isNormalPriority() && !this.isObjectCharacter() && this.isOnBush() && !this.isJumping()) { if (!this.isMoving()) { this._bushDepth = 12; } } else { this._bushDepth = 0; } }; Game_CharacterBase.prototype.isOnLadder = function () { return $gameMap.isLadder(this._x, this._y); }; Game_CharacterBase.prototype.isOnBush = function () { return $gameMap.isBush(this._x, this._y); }; Game_CharacterBase.prototype.terrainTag = function () { return $gameMap.terrainTag(this._x, this._y); }; Game_CharacterBase.prototype.regionId = function () { return $gameMap.regionId(this._x, this._y); }; Game_CharacterBase.prototype.increaseSteps = function () { if (this.isOnLadder()) { this.setDirection(8); } this.resetStopCount(); this.refreshBushDepth(); }; Game_CharacterBase.prototype.tileId = function () { return this._tileId; }; Game_CharacterBase.prototype.characterName = function () { return this._characterName; }; Game_CharacterBase.prototype.characterIndex = function () { return this._characterIndex; }; Game_CharacterBase.prototype.setImage = function (characterName, characterIndex) { this._tileId = 0; this._characterName = characterName; this._characterIndex = characterIndex; this._isObjectCharacter = ImageManager.isObjectCharacter(characterName); }; Game_CharacterBase.prototype.setTileImage = function (tileId) { this._tileId = tileId; this._characterName = ''; this._characterIndex = 0; this._isObjectCharacter = true; }; Game_CharacterBase.prototype.checkEventTriggerTouchFront = function (d) { var x2 = $gameMap.roundXWithDirection(this._x, d); var y2 = $gameMap.roundYWithDirection(this._y, d); this.checkEventTriggerTouch(x2, y2); }; Game_CharacterBase.prototype.checkEventTriggerTouch = function (x, y) { return false; }; Game_CharacterBase.prototype.isMovementSucceeded = function (x, y) { return this._movementSuccess; }; Game_CharacterBase.prototype.setMovementSuccess = function (success) { this._movementSuccess = success; }; Game_CharacterBase.prototype.moveStraight = function (d) { this.setMovementSuccess(this.canPass(this._x, this._y, d)); if (this.isMovementSucceeded()) { this.setDirection(d); this._x = $gameMap.roundXWithDirection(this._x, d); this._y = $gameMap.roundYWithDirection(this._y, d); this._realX = $gameMap.xWithDirection(this._x, this.reverseDir(d)); this._realY = $gameMap.yWithDirection(this._y, this.reverseDir(d)); this.increaseSteps(); } else { this.setDirection(d); this.checkEventTriggerTouchFront(d); } }; Game_CharacterBase.prototype.moveDiagonally = function (horz, vert) { this.setMovementSuccess(this.canPassDiagonally(this._x, this._y, horz, vert)); if (this.isMovementSucceeded()) { this._x = $gameMap.roundXWithDirection(this._x, horz); this._y = $gameMap.roundYWithDirection(this._y, vert); this._realX = $gameMap.xWithDirection(this._x, this.reverseDir(horz)); this._realY = $gameMap.yWithDirection(this._y, this.reverseDir(vert)); this.increaseSteps(); } if (this._direction === this.reverseDir(horz)) { this.setDirection(horz); } if (this._direction === this.reverseDir(vert)) { this.setDirection(vert); } }; Game_CharacterBase.prototype.jump = function (xPlus, yPlus) { if (Math.abs(xPlus) > Math.abs(yPlus)) { if (xPlus !== 0) { this.setDirection(xPlus < 0 ? 4 : 6); } } else { if (yPlus !== 0) { this.setDirection(yPlus < 0 ? 8 : 2); } } this._x += xPlus; this._y += yPlus; var distance = Math.round(Math.sqrt(xPlus * xPlus + yPlus * yPlus)); this._jumpPeak = 10 + distance - this._moveSpeed; this._jumpCount = this._jumpPeak * 2; this.resetStopCount(); this.straighten(); }; Game_CharacterBase.prototype.hasWalkAnime = function () { return this._walkAnime; }; Game_CharacterBase.prototype.setWalkAnime = function (walkAnime) { this._walkAnime = walkAnime; }; Game_CharacterBase.prototype.hasStepAnime = function () { return this._stepAnime; }; Game_CharacterBase.prototype.setStepAnime = function (stepAnime) { this._stepAnime = stepAnime; }; Game_CharacterBase.prototype.isDirectionFixed = function () { return this._directionFix; }; Game_CharacterBase.prototype.setDirectionFix = function (directionFix) { this._directionFix = directionFix; }; Game_CharacterBase.prototype.isThrough = function () { return this._through; }; Game_CharacterBase.prototype.setThrough = function (through) { this._through = through; }; Game_CharacterBase.prototype.isTransparent = function () { return this._transparent; }; Game_CharacterBase.prototype.bushDepth = function () { return this._bushDepth; }; Game_CharacterBase.prototype.setTransparent = function (transparent) { this._transparent = transparent; }; Game_CharacterBase.prototype.requestAnimation = function (animationId) { this._animationId = animationId; }; Game_CharacterBase.prototype.requestBalloon = function (balloonId) { this._balloonId = balloonId; }; Game_CharacterBase.prototype.animationId = function () { return this._animationId; }; Game_CharacterBase.prototype.balloonId = function () { return this._balloonId; }; Game_CharacterBase.prototype.startAnimation = function () { this._animationId = 0; this._animationPlaying = true; }; Game_CharacterBase.prototype.startBalloon = function () { this._balloonId = 0; this._balloonPlaying = true; }; Game_CharacterBase.prototype.isAnimationPlaying = function () { return this._animationId > 0 || this._animationPlaying; }; Game_CharacterBase.prototype.isBalloonPlaying = function () { return this._balloonId > 0 || this._balloonPlaying; }; Game_CharacterBase.prototype.endAnimation = function () { this._animationPlaying = false; }; Game_CharacterBase.prototype.endBalloon = function () { this._balloonPlaying = false; }; //----------------------------------------------------------------------------- // Game_Character // // The superclass of Game_Player, Game_Follower, GameVehicle, and Game_Event. function Game_Character() { this.initialize.apply(this, arguments); } Game_Character.prototype = Object.create(Game_CharacterBase.prototype); Game_Character.prototype.constructor = Game_Character; Game_Character.ROUTE_END = 0; Game_Character.ROUTE_MOVE_DOWN = 1; Game_Character.ROUTE_MOVE_LEFT = 2; Game_Character.ROUTE_MOVE_RIGHT = 3; Game_Character.ROUTE_MOVE_UP = 4; Game_Character.ROUTE_MOVE_LOWER_L = 5; Game_Character.ROUTE_MOVE_LOWER_R = 6; Game_Character.ROUTE_MOVE_UPPER_L = 7; Game_Character.ROUTE_MOVE_UPPER_R = 8; Game_Character.ROUTE_MOVE_RANDOM = 9; Game_Character.ROUTE_MOVE_TOWARD = 10; Game_Character.ROUTE_MOVE_AWAY = 11; Game_Character.ROUTE_MOVE_FORWARD = 12; Game_Character.ROUTE_MOVE_BACKWARD = 13; Game_Character.ROUTE_JUMP = 14; Game_Character.ROUTE_WAIT = 15; Game_Character.ROUTE_TURN_DOWN = 16; Game_Character.ROUTE_TURN_LEFT = 17; Game_Character.ROUTE_TURN_RIGHT = 18; Game_Character.ROUTE_TURN_UP = 19; Game_Character.ROUTE_TURN_90D_R = 20; Game_Character.ROUTE_TURN_90D_L = 21; Game_Character.ROUTE_TURN_180D = 22; Game_Character.ROUTE_TURN_90D_R_L = 23; Game_Character.ROUTE_TURN_RANDOM = 24; Game_Character.ROUTE_TURN_TOWARD = 25; Game_Character.ROUTE_TURN_AWAY = 26; Game_Character.ROUTE_SWITCH_ON = 27; Game_Character.ROUTE_SWITCH_OFF = 28; Game_Character.ROUTE_CHANGE_SPEED = 29; Game_Character.ROUTE_CHANGE_FREQ = 30; Game_Character.ROUTE_WALK_ANIME_ON = 31; Game_Character.ROUTE_WALK_ANIME_OFF = 32; Game_Character.ROUTE_STEP_ANIME_ON = 33; Game_Character.ROUTE_STEP_ANIME_OFF = 34; Game_Character.ROUTE_DIR_FIX_ON = 35; Game_Character.ROUTE_DIR_FIX_OFF = 36; Game_Character.ROUTE_THROUGH_ON = 37; Game_Character.ROUTE_THROUGH_OFF = 38; Game_Character.ROUTE_TRANSPARENT_ON = 39; Game_Character.ROUTE_TRANSPARENT_OFF = 40; Game_Character.ROUTE_CHANGE_IMAGE = 41; Game_Character.ROUTE_CHANGE_OPACITY = 42; Game_Character.ROUTE_CHANGE_BLEND_MODE = 43; Game_Character.ROUTE_PLAY_SE = 44; Game_Character.ROUTE_SCRIPT = 45; Game_Character.prototype.initialize = function () { Game_CharacterBase.prototype.initialize.call(this); }; Game_Character.prototype.initMembers = function () { Game_CharacterBase.prototype.initMembers.call(this); this._moveRouteForcing = false; this._moveRoute = null; this._moveRouteIndex = 0; this._originalMoveRoute = null; this._originalMoveRouteIndex = 0; this._waitCount = 0; }; Game_Character.prototype.memorizeMoveRoute = function () { this._originalMoveRoute = this._moveRoute; this._originalMoveRouteIndex = this._moveRouteIndex; }; Game_Character.prototype.restoreMoveRoute = function () { this._moveRoute = this._originalMoveRoute; this._moveRouteIndex = this._originalMoveRouteIndex; this._originalMoveRoute = null; }; Game_Character.prototype.isMoveRouteForcing = function () { return this._moveRouteForcing; }; Game_Character.prototype.setMoveRoute = function (moveRoute) { this._moveRoute = moveRoute; this._moveRouteIndex = 0; this._moveRouteForcing = false; }; Game_Character.prototype.forceMoveRoute = function (moveRoute) { if (!this._originalMoveRoute) { this.memorizeMoveRoute(); } this._moveRoute = moveRoute; this._moveRouteIndex = 0; this._moveRouteForcing = true; this._waitCount = 0; }; Game_Character.prototype.updateStop = function () { Game_CharacterBase.prototype.updateStop.call(this); if (this._moveRouteForcing) { this.updateRoutineMove(); } }; Game_Character.prototype.updateRoutineMove = function () { if (this._waitCount > 0) { this._waitCount--; } else { this.setMovementSuccess(true); var command = this._moveRoute.list[this._moveRouteIndex]; if (command) { this.processMoveCommand(command); this.advanceMoveRouteIndex(); } } }; Game_Character.prototype.processMoveCommand = function (command) { var gc = Game_Character; var params = command.parameters; switch (command.code) { case gc.ROUTE_END: this.processRouteEnd(); break; case gc.ROUTE_MOVE_DOWN: this.moveStraight(2); break; case gc.ROUTE_MOVE_LEFT: this.moveStraight(4); break; case gc.ROUTE_MOVE_RIGHT: this.moveStraight(6); break; case gc.ROUTE_MOVE_UP: this.moveStraight(8); break; case gc.ROUTE_MOVE_LOWER_L: this.moveDiagonally(4, 2); break; case gc.ROUTE_MOVE_LOWER_R: this.moveDiagonally(6, 2); break; case gc.ROUTE_MOVE_UPPER_L: this.moveDiagonally(4, 8); break; case gc.ROUTE_MOVE_UPPER_R: this.moveDiagonally(6, 8); break; case gc.ROUTE_MOVE_RANDOM: this.moveRandom(); break; case gc.ROUTE_MOVE_TOWARD: this.moveTowardPlayer(); break; case gc.ROUTE_MOVE_AWAY: this.moveAwayFromPlayer(); break; case gc.ROUTE_MOVE_FORWARD: this.moveForward(); break; case gc.ROUTE_MOVE_BACKWARD: this.moveBackward(); break; case gc.ROUTE_JUMP: this.jump(params[0], params[1]); break; case gc.ROUTE_WAIT: this._waitCount = params[0] - 1; break; case gc.ROUTE_TURN_DOWN: this.setDirection(2); break; case gc.ROUTE_TURN_LEFT: this.setDirection(4); break; case gc.ROUTE_TURN_RIGHT: this.setDirection(6); break; case gc.ROUTE_TURN_UP: this.setDirection(8); break; case gc.ROUTE_TURN_90D_R: this.turnRight90(); break; case gc.ROUTE_TURN_90D_L: this.turnLeft90(); break; case gc.ROUTE_TURN_180D: this.turn180(); break; case gc.ROUTE_TURN_90D_R_L: this.turnRightOrLeft90(); break; case gc.ROUTE_TURN_RANDOM: this.turnRandom(); break; case gc.ROUTE_TURN_TOWARD: this.turnTowardPlayer(); break; case gc.ROUTE_TURN_AWAY: this.turnAwayFromPlayer(); break; case gc.ROUTE_SWITCH_ON: $gameSwitches.setValue(params[0], true); break; case gc.ROUTE_SWITCH_OFF: $gameSwitches.setValue(params[0], false); break; case gc.ROUTE_CHANGE_SPEED: this.setMoveSpeed(params[0]); break; case gc.ROUTE_CHANGE_FREQ: this.setMoveFrequency(params[0]); break; case gc.ROUTE_WALK_ANIME_ON: this.setWalkAnime(true); break; case gc.ROUTE_WALK_ANIME_OFF: this.setWalkAnime(false); break; case gc.ROUTE_STEP_ANIME_ON: this.setStepAnime(true); break; case gc.ROUTE_STEP_ANIME_OFF: this.setStepAnime(false); break; case gc.ROUTE_DIR_FIX_ON: this.setDirectionFix(true); break; case gc.ROUTE_DIR_FIX_OFF: this.setDirectionFix(false); break; case gc.ROUTE_THROUGH_ON: this.setThrough(true); break; case gc.ROUTE_THROUGH_OFF: this.setThrough(false); break; case gc.ROUTE_TRANSPARENT_ON: this.setTransparent(true); break; case gc.ROUTE_TRANSPARENT_OFF: this.setTransparent(false); break; case gc.ROUTE_CHANGE_IMAGE: this.setImage(params[0], params[1]); break; case gc.ROUTE_CHANGE_OPACITY: this.setOpacity(params[0]); break; case gc.ROUTE_CHANGE_BLEND_MODE: this.setBlendMode(params[0]); break; case gc.ROUTE_PLAY_SE: AudioManager.playSe(params[0]); break; case gc.ROUTE_SCRIPT: eval(params[0]); break; } }; Game_Character.prototype.deltaXFrom = function (x) { return $gameMap.deltaX(this.x, x); }; Game_Character.prototype.deltaYFrom = function (y) { return $gameMap.deltaY(this.y, y); }; Game_Character.prototype.moveRandom = function () { var d = 2 + Math.randomInt(4) * 2; if (this.canPass(this.x, this.y, d)) { this.moveStraight(d); } }; Game_Character.prototype.moveTowardCharacter = function (character) { var sx = this.deltaXFrom(character.x); var sy = this.deltaYFrom(character.y); if (Math.abs(sx) > Math.abs(sy)) { this.moveStraight(sx > 0 ? 4 : 6); if (!this.isMovementSucceeded() && sy !== 0) { this.moveStraight(sy > 0 ? 8 : 2); } } else if (sy !== 0) { this.moveStraight(sy > 0 ? 8 : 2); if (!this.isMovementSucceeded() && sx !== 0) { this.moveStraight(sx > 0 ? 4 : 6); } } }; Game_Character.prototype.moveAwayFromCharacter = function (character) { var sx = this.deltaXFrom(character.x); var sy = this.deltaYFrom(character.y); if (Math.abs(sx) > Math.abs(sy)) { this.moveStraight(sx > 0 ? 6 : 4); if (!this.isMovementSucceeded() && sy !== 0) { this.moveStraight(sy > 0 ? 2 : 8); } } else if (sy !== 0) { this.moveStraight(sy > 0 ? 2 : 8); if (!this.isMovementSucceeded() && sx !== 0) { this.moveStraight(sx > 0 ? 6 : 4); } } }; Game_Character.prototype.turnTowardCharacter = function (character) { var sx = this.deltaXFrom(character.x); var sy = this.deltaYFrom(character.y); if (Math.abs(sx) > Math.abs(sy)) { this.setDirection(sx > 0 ? 4 : 6); } else if (sy !== 0) { this.setDirection(sy > 0 ? 8 : 2); } }; Game_Character.prototype.turnAwayFromCharacter = function (character) { var sx = this.deltaXFrom(character.x); var sy = this.deltaYFrom(character.y); if (Math.abs(sx) > Math.abs(sy)) { this.setDirection(sx > 0 ? 6 : 4); } else if (sy !== 0) { this.setDirection(sy > 0 ? 2 : 8); } }; Game_Character.prototype.turnTowardPlayer = function () { this.turnTowardCharacter($gamePlayer); }; Game_Character.prototype.turnAwayFromPlayer = function () { this.turnAwayFromCharacter($gamePlayer); }; Game_Character.prototype.moveTowardPlayer = function () { this.moveTowardCharacter($gamePlayer); }; Game_Character.prototype.moveAwayFromPlayer = function () { this.moveAwayFromCharacter($gamePlayer); }; Game_Character.prototype.moveForward = function () { this.moveStraight(this.direction()); }; Game_Character.prototype.moveBackward = function () { var lastDirectionFix = this.isDirectionFixed(); this.setDirectionFix(true); this.moveStraight(this.reverseDir(this.direction())); this.setDirectionFix(lastDirectionFix); }; Game_Character.prototype.processRouteEnd = function () { if (this._moveRoute.repeat) { this._moveRouteIndex = -1; } else if (this._moveRouteForcing) { this._moveRouteForcing = false; this.restoreMoveRoute(); } }; Game_Character.prototype.advanceMoveRouteIndex = function () { var moveRoute = this._moveRoute; if (moveRoute && (this.isMovementSucceeded() || moveRoute.skippable)) { var numCommands = moveRoute.list.length - 1; this._moveRouteIndex++; if (moveRoute.repeat && this._moveRouteIndex >= numCommands) { this._moveRouteIndex = 0; } } }; Game_Character.prototype.turnRight90 = function () { switch (this.direction()) { case 2: this.setDirection(4); break; case 4: this.setDirection(8); break; case 6: this.setDirection(2); break; case 8: this.setDirection(6); break; } }; Game_Character.prototype.turnLeft90 = function () { switch (this.direction()) { case 2: this.setDirection(6); break; case 4: this.setDirection(2); break; case 6: this.setDirection(8); break; case 8: this.setDirection(4); break; } }; Game_Character.prototype.turn180 = function () { this.setDirection(this.reverseDir(this.direction())); }; Game_Character.prototype.turnRightOrLeft90 = function () { switch (Math.randomInt(2)) { case 0: this.turnRight90(); break; case 1: this.turnLeft90(); break; } }; Game_Character.prototype.turnRandom = function () { this.setDirection(2 + Math.randomInt(4) * 2); }; Game_Character.prototype.swap = function (character) { var newX = character.x; var newY = character.y; character.locate(this.x, this.y); this.locate(newX, newY); }; Game_Character.prototype.findDirectionTo = function (goalX, goalY) { var searchLimit = this.searchLimit(); var mapWidth = $gameMap.width(); var nodeList = []; var openList = []; var closedList = []; var start = {}; var best = start; if (this.x === goalX && this.y === goalY) { return 0; } start.parent = null; start.x = this.x; start.y = this.y; start.g = 0; start.f = $gameMap.distance(start.x, start.y, goalX, goalY); nodeList.push(start); openList.push(start.y * mapWidth + start.x); while (nodeList.length > 0) { var bestIndex = 0; for (var i = 0; i < nodeList.length; i++) { if (nodeList[i].f < nodeList[bestIndex].f) { bestIndex = i; } } var current = nodeList[bestIndex]; var x1 = current.x; var y1 = current.y; var pos1 = y1 * mapWidth + x1; var g1 = current.g; nodeList.splice(bestIndex, 1); openList.splice(openList.indexOf(pos1), 1); closedList.push(pos1); if (current.x === goalX && current.y === goalY) { best = current; break; } if (g1 >= searchLimit) { continue; } for (var j = 0; j < 4; j++) { var direction = 2 + j * 2; var x2 = $gameMap.roundXWithDirection(x1, direction); var y2 = $gameMap.roundYWithDirection(y1, direction); var pos2 = y2 * mapWidth + x2; if (closedList.contains(pos2)) { continue; } if (!this.canPass(x1, y1, direction)) { continue; } var g2 = g1 + 1; var index2 = openList.indexOf(pos2); if (index2 < 0 || g2 < nodeList[index2].g) { var neighbor; if (index2 >= 0) { neighbor = nodeList[index2]; } else { neighbor = {}; nodeList.push(neighbor); openList.push(pos2); } neighbor.parent = current; neighbor.x = x2; neighbor.y = y2; neighbor.g = g2; neighbor.f = g2 + $gameMap.distance(x2, y2, goalX, goalY); if (!best || neighbor.f - neighbor.g < best.f - best.g) { best = neighbor; } } } } var node = best; while (node.parent && node.parent !== start) { node = node.parent; } var deltaX1 = $gameMap.deltaX(node.x, start.x); var deltaY1 = $gameMap.deltaY(node.y, start.y); if (deltaY1 > 0) { return 2; } else if (deltaX1 < 0) { return 4; } else if (deltaX1 > 0) { return 6; } else if (deltaY1 < 0) { return 8; } var deltaX2 = this.deltaXFrom(goalX); var deltaY2 = this.deltaYFrom(goalY); if (Math.abs(deltaX2) > Math.abs(deltaY2)) { return deltaX2 > 0 ? 4 : 6; } else if (deltaY2 !== 0) { return deltaY2 > 0 ? 8 : 2; } return 0; }; Game_Character.prototype.searchLimit = function () { return 12; }; //----------------------------------------------------------------------------- // Game_Player // // The game object class for the player. It contains event starting // determinants and map scrolling functions. function Game_Player() { this.initialize.apply(this, arguments); } Game_Player.prototype = Object.create(Game_Character.prototype); Game_Player.prototype.constructor = Game_Player; Game_Player.prototype.initialize = function () { Game_Character.prototype.initialize.call(this); this.setTransparent($dataSystem.optTransparent); }; Game_Player.prototype.initMembers = function () { Game_Character.prototype.initMembers.call(this); this._vehicleType = 'walk'; this._vehicleGettingOn = false; this._vehicleGettingOff = false; this._dashing = false; this._needsMapReload = false; this._transferring = false; this._newMapId = 0; this._newX = 0; this._newY = 0; this._newDirection = 0; this._fadeType = 0; this._followers = new Game_Followers(); this._encounterCount = 0; }; Game_Player.prototype.clearTransferInfo = function () { this._transferring = false; this._newMapId = 0; this._newX = 0; this._newY = 0; this._newDirection = 0; }; Game_Player.prototype.followers = function () { return this._followers; }; Game_Player.prototype.refresh = function () { var actor = $gameParty.leader(); var characterName = actor ? actor.characterName() : ''; var characterIndex = actor ? actor.characterIndex() : 0; this.setImage(characterName, characterIndex); this._followers.refresh(); }; Game_Player.prototype.isStopping = function () { if (this._vehicleGettingOn || this._vehicleGettingOff) { return false; } return Game_Character.prototype.isStopping.call(this); }; Game_Player.prototype.reserveTransfer = function (mapId, x, y, d, fadeType) { this._transferring = true; this._newMapId = mapId; this._newX = x; this._newY = y; this._newDirection = d; this._fadeType = fadeType; }; Game_Player.prototype.requestMapReload = function () { this._needsMapReload = true; }; Game_Player.prototype.isTransferring = function () { return this._transferring; }; Game_Player.prototype.newMapId = function () { return this._newMapId; }; Game_Player.prototype.fadeType = function () { return this._fadeType; }; Game_Player.prototype.performTransfer = function () { if (this.isTransferring()) { this.setDirection(this._newDirection); if (this._newMapId !== $gameMap.mapId() || this._needsMapReload) { $gameMap.setup(this._newMapId); this._needsMapReload = false; } this.locate(this._newX, this._newY); this.refresh(); this.clearTransferInfo(); } }; Game_Player.prototype.isMapPassable = function (x, y, d) { var vehicle = this.vehicle(); if (vehicle) { return vehicle.isMapPassable(x, y, d); } else { return Game_Character.prototype.isMapPassable.call(this, x, y, d); } }; Game_Player.prototype.vehicle = function () { return $gameMap.vehicle(this._vehicleType); }; Game_Player.prototype.isInBoat = function () { return this._vehicleType === 'boat'; }; Game_Player.prototype.isInShip = function () { return this._vehicleType === 'ship'; }; Game_Player.prototype.isInAirship = function () { return this._vehicleType === 'airship'; }; Game_Player.prototype.isInVehicle = function () { return this.isInBoat() || this.isInShip() || this.isInAirship(); }; Game_Player.prototype.isNormal = function () { return this._vehicleType === 'walk' && !this.isMoveRouteForcing(); }; Game_Player.prototype.isDashing = function () { return this._dashing; }; Game_Player.prototype.isDebugThrough = function () { return Input.isPressed('control') && $gameTemp.isPlaytest(); }; Game_Player.prototype.isCollided = function (x, y) { if (this.isThrough()) { return false; } else { return this.pos(x, y) || this._followers.isSomeoneCollided(x, y); } }; Game_Player.prototype.centerX = function () { return (Graphics.width / $gameMap.tileWidth() - 1) / 2.0; }; Game_Player.prototype.centerY = function () { return (Graphics.height / $gameMap.tileHeight() - 1) / 2.0; }; Game_Player.prototype.center = function (x, y) { return $gameMap.setDisplayPos(x - this.centerX(), y - this.centerY()); }; Game_Player.prototype.locate = function (x, y) { Game_Character.prototype.locate.call(this, x, y); this.center(x, y); this.makeEncounterCount(); if (this.isInVehicle()) { this.vehicle().refresh(); } this._followers.synchronize(x, y, this.direction()); }; Game_Player.prototype.increaseSteps = function () { Game_Character.prototype.increaseSteps.call(this); if (this.isNormal()) { $gameParty.increaseSteps(); } }; Game_Player.prototype.makeEncounterCount = function () { var n = $gameMap.encounterStep(); this._encounterCount = Math.randomInt(n) + Math.randomInt(n) + 1; }; Game_Player.prototype.makeEncounterTroopId = function () { var encounterList = []; var weightSum = 0; $gameMap.encounterList().forEach(function (encounter) { if (this.meetsEncounterConditions(encounter)) { encounterList.push(encounter); weightSum += encounter.weight; } }, this); if (weightSum > 0) { var value = Math.randomInt(weightSum); for (var i = 0; i < encounterList.length; i++) { value -= encounterList[i].weight; if (value < 0) { return encounterList[i].troopId; } } } return 0; }; Game_Player.prototype.meetsEncounterConditions = function (encounter) { return (encounter.regionSet.length === 0 || encounter.regionSet.contains(this.regionId())); }; Game_Player.prototype.executeEncounter = function () { if (!$gameMap.isEventRunning() && this._encounterCount <= 0) { this.makeEncounterCount(); var troopId = this.makeEncounterTroopId(); if ($dataTroops[troopId]) { BattleManager.setup(troopId, true, false); BattleManager.onEncounter(); return true; } else { return false; } } else { return false; } }; Game_Player.prototype.startMapEvent = function (x, y, triggers, normal) { if (!$gameMap.isEventRunning()) { $gameMap.eventsXy(x, y).forEach(function (event) { if (event.isTriggerIn(triggers) && event.isNormalPriority() === normal) { event.start(); } }); } }; Game_Player.prototype.moveByInput = function () { if (!this.isMoving() && this.canMove()) { var direction = this.getInputDirection(); if (direction > 0) { $gameTemp.clearDestination(); } else if ($gameTemp.isDestinationValid()) { var x = $gameTemp.destinationX(); var y = $gameTemp.destinationY(); direction = this.findDirectionTo(x, y); } if (direction > 0) { this.executeMove(direction); } } }; Game_Player.prototype.canMove = function () { if ($gameMap.isEventRunning() || $gameMessage.isBusy()) { return false; } if (this.isMoveRouteForcing() || this.areFollowersGathering()) { return false; } if (this._vehicleGettingOn || this._vehicleGettingOff) { return false; } if (this.isInVehicle() && !this.vehicle().canMove()) { return false; } return true; }; Game_Player.prototype.getInputDirection = function () { return Input.dir4; }; Game_Player.prototype.executeMove = function (direction) { this.moveStraight(direction); }; Game_Player.prototype.update = function (sceneActive) { var lastScrolledX = this.scrolledX(); var lastScrolledY = this.scrolledY(); var wasMoving = this.isMoving(); this.updateDashing(); if (sceneActive) { this.moveByInput(); } Game_Character.prototype.update.call(this); this.updateScroll(lastScrolledX, lastScrolledY); this.updateVehicle(); if (!this.isMoving()) { this.updateNonmoving(wasMoving); } this._followers.update(); }; Game_Player.prototype.updateDashing = function () { if (this.isMoving()) { return; } if (this.canMove() && !this.isInVehicle() && !$gameMap.isDashDisabled()) { this._dashing = this.isDashButtonPressed() || $gameTemp.isDestinationValid(); } else { this._dashing = false; } }; Game_Player.prototype.isDashButtonPressed = function () { var shift = Input.isPressed('shift'); if (ConfigManager.alwaysDash) { return !shift; } else { return shift; } }; Game_Player.prototype.updateScroll = function (lastScrolledX, lastScrolledY) { var x1 = lastScrolledX; var y1 = lastScrolledY; var x2 = this.scrolledX(); var y2 = this.scrolledY(); if (y2 > y1 && y2 > this.centerY()) { $gameMap.scrollDown(y2 - y1); } if (x2 < x1 && x2 < this.centerX()) { $gameMap.scrollLeft(x1 - x2); } if (x2 > x1 && x2 > this.centerX()) { $gameMap.scrollRight(x2 - x1); } if (y2 < y1 && y2 < this.centerY()) { $gameMap.scrollUp(y1 - y2); } }; Game_Player.prototype.updateVehicle = function () { if (this.isInVehicle() && !this.areFollowersGathering()) { if (this._vehicleGettingOn) { this.updateVehicleGetOn(); } else if (this._vehicleGettingOff) { this.updateVehicleGetOff(); } else { this.vehicle().syncWithPlayer(); } } }; Game_Player.prototype.updateVehicleGetOn = function () { if (!this.areFollowersGathering() && !this.isMoving()) { this.setDirection(this.vehicle().direction()); this.setMoveSpeed(this.vehicle().moveSpeed()); this._vehicleGettingOn = false; this.setTransparent(true); if (this.isInAirship()) { this.setThrough(true); } this.vehicle().getOn(); } }; Game_Player.prototype.updateVehicleGetOff = function () { if (!this.areFollowersGathering() && this.vehicle().isLowest()) { this._vehicleGettingOff = false; this._vehicleType = 'walk'; this.setTransparent(false); } }; Game_Player.prototype.updateNonmoving = function (wasMoving) { if (!$gameMap.isEventRunning()) { if (wasMoving) { $gameParty.onPlayerWalk(); this.checkEventTriggerHere([1, 2]); if ($gameMap.setupStartingEvent()) { return; } } if (this.triggerAction()) { return; } if (wasMoving) { this.updateEncounterCount(); } else { $gameTemp.clearDestination(); } } }; Game_Player.prototype.triggerAction = function () { if (this.canMove()) { if (this.triggerButtonAction()) { return true; } if (this.triggerTouchAction()) { return true; } } return false; }; Game_Player.prototype.triggerButtonAction = function () { if (Input.isTriggered('ok')) { if (this.getOnOffVehicle()) { return true; } this.checkEventTriggerHere([0]); if ($gameMap.setupStartingEvent()) { return true; } this.checkEventTriggerThere([0, 1, 2]); if ($gameMap.setupStartingEvent()) { return true; } } return false; }; Game_Player.prototype.triggerTouchAction = function () { if ($gameTemp.isDestinationValid()) { var direction = this.direction(); var x1 = this.x; var y1 = this.y; var x2 = $gameMap.roundXWithDirection(x1, direction); var y2 = $gameMap.roundYWithDirection(y1, direction); var x3 = $gameMap.roundXWithDirection(x2, direction); var y3 = $gameMap.roundYWithDirection(y2, direction); var destX = $gameTemp.destinationX(); var destY = $gameTemp.destinationY(); if (destX === x1 && destY === y1) { return this.triggerTouchActionD1(x1, y1); } else if (destX === x2 && destY === y2) { return this.triggerTouchActionD2(x2, y2); } else if (destX === x3 && destY === y3) { return this.triggerTouchActionD3(x2, y2); } } return false; }; Game_Player.prototype.triggerTouchActionD1 = function (x1, y1) { if ($gameMap.airship().pos(x1, y1)) { if (TouchInput.isTriggered() && this.getOnOffVehicle()) { return true; } } this.checkEventTriggerHere([0]); return $gameMap.setupStartingEvent(); }; Game_Player.prototype.triggerTouchActionD2 = function (x2, y2) { if ($gameMap.boat().pos(x2, y2) || $gameMap.ship().pos(x2, y2)) { if (TouchInput.isTriggered() && this.getOnVehicle()) { return true; } } if (this.isInBoat() || this.isInShip()) { if (TouchInput.isTriggered() && this.getOffVehicle()) { return true; } } this.checkEventTriggerThere([0, 1, 2]); return $gameMap.setupStartingEvent(); }; Game_Player.prototype.triggerTouchActionD3 = function (x2, y2) { if ($gameMap.isCounter(x2, y2)) { this.checkEventTriggerThere([0, 1, 2]); } return $gameMap.setupStartingEvent(); }; Game_Player.prototype.updateEncounterCount = function () { if (this.canEncounter()) { this._encounterCount -= this.encounterProgressValue(); } }; Game_Player.prototype.canEncounter = function () { return (!$gameParty.hasEncounterNone() && $gameSystem.isEncounterEnabled() && !this.isInAirship() && !this.isMoveRouteForcing() && !this.isDebugThrough()); }; Game_Player.prototype.encounterProgressValue = function () { var value = $gameMap.isBush(this.x, this.y) ? 2 : 1; if ($gameParty.hasEncounterHalf()) { value *= 0.5; } if (this.isInShip()) { value *= 0.5; } return value; }; Game_Player.prototype.checkEventTriggerHere = function (triggers) { if (this.canStartLocalEvents()) { this.startMapEvent(this.x, this.y, triggers, false); } }; Game_Player.prototype.checkEventTriggerThere = function (triggers) { if (this.canStartLocalEvents()) { var direction = this.direction(); var x1 = this.x; var y1 = this.y; var x2 = $gameMap.roundXWithDirection(x1, direction); var y2 = $gameMap.roundYWithDirection(y1, direction); this.startMapEvent(x2, y2, triggers, true); if (!$gameMap.isAnyEventStarting() && $gameMap.isCounter(x2, y2)) { var x3 = $gameMap.roundXWithDirection(x2, direction); var y3 = $gameMap.roundYWithDirection(y2, direction); this.startMapEvent(x3, y3, triggers, true); } } }; Game_Player.prototype.checkEventTriggerTouch = function (x, y) { if (this.canStartLocalEvents()) { this.startMapEvent(x, y, [1, 2], true); } }; Game_Player.prototype.canStartLocalEvents = function () { return !this.isInAirship(); }; Game_Player.prototype.getOnOffVehicle = function () { if (this.isInVehicle()) { return this.getOffVehicle(); } else { return this.getOnVehicle(); } }; Game_Player.prototype.getOnVehicle = function () { var direction = this.direction(); var x1 = this.x; var y1 = this.y; var x2 = $gameMap.roundXWithDirection(x1, direction); var y2 = $gameMap.roundYWithDirection(y1, direction); if ($gameMap.airship().pos(x1, y1)) { this._vehicleType = 'airship'; } else if ($gameMap.ship().pos(x2, y2)) { this._vehicleType = 'ship'; } else if ($gameMap.boat().pos(x2, y2)) { this._vehicleType = 'boat'; } if (this.isInVehicle()) { this._vehicleGettingOn = true; if (!this.isInAirship()) { this.forceMoveForward(); } this.gatherFollowers(); } return this._vehicleGettingOn; }; Game_Player.prototype.getOffVehicle = function () { if (this.vehicle().isLandOk(this.x, this.y, this.direction())) { if (this.isInAirship()) { this.setDirection(2); } this._followers.synchronize(this.x, this.y, this.direction()); this.vehicle().getOff(); if (!this.isInAirship()) { this.forceMoveForward(); this.setTransparent(false); } this._vehicleGettingOff = true; this.setMoveSpeed(4); this.setThrough(false); this.makeEncounterCount(); this.gatherFollowers(); } return this._vehicleGettingOff; }; Game_Player.prototype.forceMoveForward = function () { this.setThrough(true); this.moveForward(); this.setThrough(false); }; Game_Player.prototype.isOnDamageFloor = function () { return $gameMap.isDamageFloor(this.x, this.y) && !this.isInAirship(); }; Game_Player.prototype.moveStraight = function (d) { if (this.canPass(this.x, this.y, d)) { this._followers.updateMove(); } Game_Character.prototype.moveStraight.call(this, d); }; Game_Player.prototype.moveDiagonally = function (horz, vert) { if (this.canPassDiagonally(this.x, this.y, horz, vert)) { this._followers.updateMove(); } Game_Character.prototype.moveDiagonally.call(this, horz, vert); }; Game_Player.prototype.jump = function (xPlus, yPlus) { Game_Character.prototype.jump.call(this, xPlus, yPlus); this._followers.jumpAll(); }; Game_Player.prototype.showFollowers = function () { this._followers.show(); }; Game_Player.prototype.hideFollowers = function () { this._followers.hide(); }; Game_Player.prototype.gatherFollowers = function () { this._followers.gather(); }; Game_Player.prototype.areFollowersGathering = function () { return this._followers.areGathering(); }; Game_Player.prototype.areFollowersGathered = function () { return this._followers.areGathered(); }; //----------------------------------------------------------------------------- // Game_Follower // // The game object class for a follower. A follower is an allied character, // other than the front character, displayed in the party. function Game_Follower() { this.initialize.apply(this, arguments); } Game_Follower.prototype = Object.create(Game_Character.prototype); Game_Follower.prototype.constructor = Game_Follower; Game_Follower.prototype.initialize = function (memberIndex) { Game_Character.prototype.initialize.call(this); this._memberIndex = memberIndex; this.setTransparent($dataSystem.optTransparent); this.setThrough(true); }; Game_Follower.prototype.refresh = function () { var characterName = this.isVisible() ? this.actor().characterName() : ''; var characterIndex = this.isVisible() ? this.actor().characterIndex() : 0; this.setImage(characterName, characterIndex); }; Game_Follower.prototype.actor = function () { return $gameParty.battleMembers()[this._memberIndex]; }; Game_Follower.prototype.isVisible = function () { return this.actor() && $gamePlayer.followers().isVisible(); }; Game_Follower.prototype.update = function () { Game_Character.prototype.update.call(this); this.setMoveSpeed($gamePlayer.realMoveSpeed()); this.setOpacity($gamePlayer.opacity()); this.setBlendMode($gamePlayer.blendMode()); this.setWalkAnime($gamePlayer.hasWalkAnime()); this.setStepAnime($gamePlayer.hasStepAnime()); this.setDirectionFix($gamePlayer.isDirectionFixed()); this.setTransparent($gamePlayer.isTransparent()); }; Game_Follower.prototype.chaseCharacter = function (character) { var sx = this.deltaXFrom(character.x); var sy = this.deltaYFrom(character.y); if (sx !== 0 && sy !== 0) { this.moveDiagonally(sx > 0 ? 4 : 6, sy > 0 ? 8 : 2); } else if (sx !== 0) { this.moveStraight(sx > 0 ? 4 : 6); } else if (sy !== 0) { this.moveStraight(sy > 0 ? 8 : 2); } this.setMoveSpeed($gamePlayer.realMoveSpeed()); }; //----------------------------------------------------------------------------- // Game_Followers // // The wrapper class for a follower array. function Game_Followers() { this.initialize.apply(this, arguments); } Game_Followers.prototype.initialize = function () { this._visible = $dataSystem.optFollowers; this._gathering = false; this._data = []; for (var i = 1; i < $gameParty.maxBattleMembers(); i++) { this._data.push(new Game_Follower(i)); } }; Game_Followers.prototype.isVisible = function () { return this._visible; }; Game_Followers.prototype.show = function () { this._visible = true; }; Game_Followers.prototype.hide = function () { this._visible = false; }; Game_Followers.prototype.follower = function (index) { return this._data[index]; }; Game_Followers.prototype.forEach = function (callback, thisObject) { this._data.forEach(callback, thisObject); }; Game_Followers.prototype.reverseEach = function (callback, thisObject) { this._data.reverse(); this._data.forEach(callback, thisObject); this._data.reverse(); }; Game_Followers.prototype.refresh = function () { this.forEach(function (follower) { return follower.refresh(); }, this); }; Game_Followers.prototype.update = function () { if (this.areGathering()) { if (!this.areMoving()) { this.updateMove(); } if (this.areGathered()) { this._gathering = false; } } this.forEach(function (follower) { follower.update(); }, this); }; Game_Followers.prototype.updateMove = function () { for (var i = this._data.length - 1; i >= 0; i--) { var precedingCharacter = (i > 0 ? this._data[i - 1] : $gamePlayer); this._data[i].chaseCharacter(precedingCharacter); } }; Game_Followers.prototype.jumpAll = function () { if ($gamePlayer.isJumping()) { for (var i = 0; i < this._data.length; i++) { var follower = this._data[i]; var sx = $gamePlayer.deltaXFrom(follower.x); var sy = $gamePlayer.deltaYFrom(follower.y); follower.jump(sx, sy); } } }; Game_Followers.prototype.synchronize = function (x, y, d) { this.forEach(function (follower) { follower.locate(x, y); follower.setDirection(d); }, this); }; Game_Followers.prototype.gather = function () { this._gathering = true; }; Game_Followers.prototype.areGathering = function () { return this._gathering; }; Game_Followers.prototype.visibleFollowers = function () { return this._data.filter(function (follower) { return follower.isVisible(); }, this); }; Game_Followers.prototype.areMoving = function () { return this.visibleFollowers().some(function (follower) { return follower.isMoving(); }, this); }; Game_Followers.prototype.areGathered = function () { return this.visibleFollowers().every(function (follower) { return !follower.isMoving() && follower.pos($gamePlayer.x, $gamePlayer.y); }, this); }; Game_Followers.prototype.isSomeoneCollided = function (x, y) { return this.visibleFollowers().some(function (follower) { return follower.pos(x, y); }, this); }; //----------------------------------------------------------------------------- // Game_Vehicle // // The game object class for a vehicle. function Game_Vehicle() { this.initialize.apply(this, arguments); } Game_Vehicle.prototype = Object.create(Game_Character.prototype); Game_Vehicle.prototype.constructor = Game_Vehicle; Game_Vehicle.prototype.initialize = function (type) { Game_Character.prototype.initialize.call(this); this._type = type; this.resetDirection(); this.initMoveSpeed(); this.loadSystemSettings(); }; Game_Vehicle.prototype.initMembers = function () { Game_Character.prototype.initMembers.call(this); this._type = ''; this._mapId = 0; this._altitude = 0; this._driving = false; this._bgm = null; }; Game_Vehicle.prototype.isBoat = function () { return this._type === 'boat'; }; Game_Vehicle.prototype.isShip = function () { return this._type === 'ship'; }; Game_Vehicle.prototype.isAirship = function () { return this._type === 'airship'; }; Game_Vehicle.prototype.resetDirection = function () { this.setDirection(4); }; Game_Vehicle.prototype.initMoveSpeed = function () { if (this.isBoat()) { this.setMoveSpeed(4); } else if (this.isShip()) { this.setMoveSpeed(5); } else if (this.isAirship()) { this.setMoveSpeed(6); } }; Game_Vehicle.prototype.vehicle = function () { if (this.isBoat()) { return $dataSystem.boat; } else if (this.isShip()) { return $dataSystem.ship; } else if (this.isAirship()) { return $dataSystem.airship; } else { return null; } }; Game_Vehicle.prototype.loadSystemSettings = function () { var vehicle = this.vehicle(); this._mapId = vehicle.startMapId; this.setPosition(vehicle.startX, vehicle.startY); this.setImage(vehicle.characterName, vehicle.characterIndex); }; Game_Vehicle.prototype.refresh = function () { if (this._driving) { this._mapId = $gameMap.mapId(); this.syncWithPlayer(); } else if (this._mapId === $gameMap.mapId()) { this.locate(this.x, this.y); } if (this.isAirship()) { this.setPriorityType(this._driving ? 2 : 0); } else { this.setPriorityType(1); } this.setWalkAnime(this._driving); this.setStepAnime(this._driving); this.setTransparent(this._mapId !== $gameMap.mapId()); }; Game_Vehicle.prototype.setLocation = function (mapId, x, y) { this._mapId = mapId; this.setPosition(x, y); this.refresh(); }; Game_Vehicle.prototype.pos = function (x, y) { if (this._mapId === $gameMap.mapId()) { return Game_Character.prototype.pos.call(this, x, y); } else { return false; } }; Game_Vehicle.prototype.isMapPassable = function (x, y, d) { var x2 = $gameMap.roundXWithDirection(x, d); var y2 = $gameMap.roundYWithDirection(y, d); if (this.isBoat()) { return $gameMap.isBoatPassable(x2, y2); } else if (this.isShip()) { return $gameMap.isShipPassable(x2, y2); } else if (this.isAirship()) { return true; } else { return false; } }; Game_Vehicle.prototype.getOn = function () { this._driving = true; this.setWalkAnime(true); this.setStepAnime(true); $gameSystem.saveWalkingBgm(); this.playBgm(); }; Game_Vehicle.prototype.getOff = function () { this._driving = false; this.setWalkAnime(false); this.setStepAnime(false); this.resetDirection(); $gameSystem.replayWalkingBgm(); }; Game_Vehicle.prototype.setBgm = function (bgm) { this._bgm = bgm; }; Game_Vehicle.prototype.playBgm = function () { AudioManager.playBgm(this._bgm || this.vehicle().bgm); }; Game_Vehicle.prototype.syncWithPlayer = function () { this.copyPosition($gamePlayer); this.refreshBushDepth(); }; Game_Vehicle.prototype.screenY = function () { return Game_Character.prototype.screenY.call(this) - this._altitude; }; Game_Vehicle.prototype.shadowX = function () { return this.screenX(); }; Game_Vehicle.prototype.shadowY = function () { return this.screenY() + this._altitude; }; Game_Vehicle.prototype.shadowOpacity = function () { return 255 * this._altitude / this.maxAltitude(); }; Game_Vehicle.prototype.canMove = function () { if (this.isAirship()) { return this.isHighest(); } else { return true; } }; Game_Vehicle.prototype.update = function () { Game_Character.prototype.update.call(this); if (this.isAirship()) { this.updateAirship(); } }; Game_Vehicle.prototype.updateAirship = function () { this.updateAirshipAltitude(); this.setStepAnime(this.isHighest()); this.setPriorityType(this.isLowest() ? 0 : 2); }; Game_Vehicle.prototype.updateAirshipAltitude = function () { if (this._driving && !this.isHighest()) { this._altitude++; } if (!this._driving && !this.isLowest()) { this._altitude--; } }; Game_Vehicle.prototype.maxAltitude = function () { return 48; }; Game_Vehicle.prototype.isLowest = function () { return this._altitude <= 0; }; Game_Vehicle.prototype.isHighest = function () { return this._altitude >= this.maxAltitude(); }; Game_Vehicle.prototype.isTakeoffOk = function () { return $gamePlayer.areFollowersGathered(); }; Game_Vehicle.prototype.isLandOk = function (x, y, d) { if (this.isAirship()) { if (!$gameMap.isAirshipLandOk(x, y)) { return false; } if ($gameMap.eventsXy(x, y).length > 0) { return false; } } else { var x2 = $gameMap.roundXWithDirection(x, d); var y2 = $gameMap.roundYWithDirection(y, d); if (!$gameMap.isValid(x2, y2)) { return false; } if (!$gameMap.isPassable(x2, y2, this.reverseDir(d))) { return false; } if (this.isCollidedWithCharacters(x2, y2)) { return false; } } return true; }; //----------------------------------------------------------------------------- // Game_Event // // The game object class for an event. It contains functionality for event page // switching and running parallel process events. function Game_Event() { this.initialize.apply(this, arguments); } Game_Event.prototype = Object.create(Game_Character.prototype); Game_Event.prototype.constructor = Game_Event; Game_Event.prototype.initialize = function (mapId, eventId) { Game_Character.prototype.initialize.call(this); this._mapId = mapId; this._eventId = eventId; this.locate(this.event().x, this.event().y); this.refresh(); }; Game_Event.prototype.initMembers = function () { Game_Character.prototype.initMembers.call(this); this._moveType = 0; this._trigger = 0; this._starting = false; this._erased = false; this._pageIndex = -2; this._originalPattern = 1; this._originalDirection = 2; this._prelockDirection = 0; this._locked = false; }; Game_Event.prototype.eventId = function () { return this._eventId; }; Game_Event.prototype.event = function () { return $dataMap.events[this._eventId]; }; Game_Event.prototype.page = function () { return this.event().pages[this._pageIndex]; }; Game_Event.prototype.list = function () { return this.page().list; }; Game_Event.prototype.isCollidedWithCharacters = function (x, y) { return (Game_Character.prototype.isCollidedWithCharacters.call(this, x, y) || this.isCollidedWithPlayerCharacters(x, y)); }; Game_Event.prototype.isCollidedWithEvents = function (x, y) { var events = $gameMap.eventsXyNt(x, y); return events.length > 0; }; Game_Event.prototype.isCollidedWithPlayerCharacters = function (x, y) { return this.isNormalPriority() && $gamePlayer.isCollided(x, y); }; Game_Event.prototype.lock = function () { if (!this._locked) { this._prelockDirection = this.direction(); this.turnTowardPlayer(); this._locked = true; } }; Game_Event.prototype.unlock = function () { if (this._locked) { this._locked = false; this.setDirection(this._prelockDirection); } }; Game_Event.prototype.updateStop = function () { if (this._locked) { this.resetStopCount(); } Game_Character.prototype.updateStop.call(this); if (!this.isMoveRouteForcing()) { this.updateSelfMovement(); } }; Game_Event.prototype.updateSelfMovement = function () { if (!this._locked && this.isNearTheScreen() && this.checkStop(this.stopCountThreshold())) { switch (this._moveType) { case 1: this.moveTypeRandom(); break; case 2: this.moveTypeTowardPlayer(); break; case 3: this.moveTypeCustom(); break; } } }; Game_Event.prototype.stopCountThreshold = function () { return 30 * (5 - this.moveFrequency()); }; Game_Event.prototype.moveTypeRandom = function () { switch (Math.randomInt(6)) { case 0: case 1: this.moveRandom(); break; case 2: case 3: case 4: this.moveForward(); break; case 5: this.resetStopCount(); break; } }; Game_Event.prototype.moveTypeTowardPlayer = function () { if (this.isNearThePlayer()) { switch (Math.randomInt(6)) { case 0: case 1: case 2: case 3: this.moveTowardPlayer(); break; case 4: this.moveRandom(); break; case 5: this.moveForward(); break; } } else { this.moveRandom(); } }; Game_Event.prototype.isNearThePlayer = function () { var sx = Math.abs(this.deltaXFrom($gamePlayer.x)); var sy = Math.abs(this.deltaYFrom($gamePlayer.y)); return sx + sy < 20; }; Game_Event.prototype.moveTypeCustom = function () { this.updateRoutineMove(); }; Game_Event.prototype.isStarting = function () { return this._starting; }; Game_Event.prototype.clearStartingFlag = function () { this._starting = false; }; Game_Event.prototype.isTriggerIn = function (triggers) { return triggers.contains(this._trigger); }; Game_Event.prototype.start = function () { var list = this.list(); if (list && list.length > 1) { this._starting = true; if (this.isTriggerIn([0, 1, 2])) { this.lock(); } } }; Game_Event.prototype.erase = function () { this._erased = true; this.refresh(); }; Game_Event.prototype.refresh = function () { var newPageIndex = this._erased ? -1 : this.findProperPageIndex(); if (this._pageIndex !== newPageIndex) { this._pageIndex = newPageIndex; this.setupPage(); } }; Game_Event.prototype.findProperPageIndex = function () { var pages = this.event().pages; for (var i = pages.length - 1; i >= 0; i--) { var page = pages[i]; if (this.meetsConditions(page)) { return i; } } return -1; }; Game_Event.prototype.meetsConditions = function (page) { var c = page.conditions; if (c.switch1Valid) { if (!$gameSwitches.value(c.switch1Id)) { return false; } } if (c.switch2Valid) { if (!$gameSwitches.value(c.switch2Id)) { return false; } } if (c.variableValid) { if ($gameVariables.value(c.variableId) < c.variableValue) { return false; } } if (c.selfSwitchValid) { var key = [this._mapId, this._eventId, c.selfSwitchCh]; if ($gameSelfSwitches.value(key) !== true) { return false; } } if (c.itemValid) { var item = $dataItems[c.itemId]; if (!$gameParty.hasItem(item)) { return false; } } if (c.actorValid) { var actor = $gameActors.actor(c.actorId); if (!$gameParty.members().contains(actor)) { return false; } } return true; }; Game_Event.prototype.setupPage = function () { if (this._pageIndex >= 0) { this.setupPageSettings(); } else { this.clearPageSettings(); } this.refreshBushDepth(); this.clearStartingFlag(); this.checkEventTriggerAuto(); }; Game_Event.prototype.clearPageSettings = function () { this.setImage('', 0); this._moveType = 0; this._trigger = null; this._interpreter = null; this.setThrough(true); }; Game_Event.prototype.setupPageSettings = function () { var page = this.page(); var image = page.image; if (image.tileId > 0) { this.setTileImage(image.tileId); } else { this.setImage(image.characterName, image.characterIndex); } if (this._originalDirection !== image.direction) { this._originalDirection = image.direction; this._prelockDirection = 0; this.setDirectionFix(false); this.setDirection(image.direction); } if (this._originalPattern !== image.pattern) { this._originalPattern = image.pattern; this.setPattern(image.pattern); } this.setMoveSpeed(page.moveSpeed); this.setMoveFrequency(page.moveFrequency); this.setPriorityType(page.priorityType); this.setWalkAnime(page.walkAnime); this.setStepAnime(page.stepAnime); this.setDirectionFix(page.directionFix); this.setThrough(page.through); this.setMoveRoute(page.moveRoute); this._moveType = page.moveType; this._trigger = page.trigger; if (this._trigger === 4) { this._interpreter = new Game_Interpreter(); } else { this._interpreter = null; } }; Game_Event.prototype.isOriginalPattern = function () { return this.pattern() === this._originalPattern; }; Game_Event.prototype.resetPattern = function () { this.setPattern(this._originalPattern); }; Game_Event.prototype.checkEventTriggerTouch = function (x, y) { if (!$gameMap.isEventRunning()) { if (this._trigger === 2 && $gamePlayer.pos(x, y)) { if (!this.isJumping() && this.isNormalPriority()) { this.start(); } } } }; Game_Event.prototype.checkEventTriggerAuto = function () { if (this._trigger === 3) { this.start(); } }; Game_Event.prototype.update = function () { Game_Character.prototype.update.call(this); this.checkEventTriggerAuto(); this.updateParallel(); }; Game_Event.prototype.updateParallel = function () { if (this._interpreter) { if (!this._interpreter.isRunning()) { this._interpreter.setup(this.list(), this._eventId); } this._interpreter.update(); } }; Game_Event.prototype.locate = function (x, y) { Game_Character.prototype.locate.call(this, x, y); this._prelockDirection = 0; }; Game_Event.prototype.forceMoveRoute = function (moveRoute) { Game_Character.prototype.forceMoveRoute.call(this, moveRoute); this._prelockDirection = 0; }; //----------------------------------------------------------------------------- // Game_Interpreter // // The interpreter for running event commands. function Game_Interpreter() { this.initialize.apply(this, arguments); } Game_Interpreter.prototype.initialize = function (depth) { this._depth = depth || 0; this.checkOverflow(); this.clear(); this._branch = {}; this._params = []; this._indent = 0; this._frameCount = 0; this._freezeChecker = 0; }; Game_Interpreter.prototype.checkOverflow = function () { if (this._depth >= 100) { throw new Error('Common event calls exceeded the limit'); } }; Game_Interpreter.prototype.clear = function () { this._mapId = 0; this._eventId = 0; this._list = null; this._index = 0; this._waitCount = 0; this._waitMode = ''; this._comments = ''; this._character = null; this._childInterpreter = null; }; Game_Interpreter.prototype.setup = function (list, eventId) { this.clear(); this._mapId = $gameMap.mapId(); this._eventId = eventId || 0; this._list = list; Game_Interpreter.requestImages(list); }; Game_Interpreter.prototype.eventId = function () { return this._eventId; }; Game_Interpreter.prototype.isOnCurrentMap = function () { return this._mapId === $gameMap.mapId(); }; Game_Interpreter.prototype.setupReservedCommonEvent = function () { if ($gameTemp.isCommonEventReserved()) { this.setup($gameTemp.reservedCommonEvent().list); $gameTemp.clearCommonEvent(); return true; } else { return false; } }; Game_Interpreter.prototype.isRunning = function () { return !!this._list; }; Game_Interpreter.prototype.update = function () { while (this.isRunning()) { if (this.updateChild() || this.updateWait()) { break; } if (SceneManager.isSceneChanging()) { break; } if (!this.executeCommand()) { break; } if (this.checkFreeze()) { break; } } }; Game_Interpreter.prototype.updateChild = function () { if (this._childInterpreter) { this._childInterpreter.update(); if (this._childInterpreter.isRunning()) { return true; } else { this._childInterpreter = null; } } return false; }; Game_Interpreter.prototype.updateWait = function () { return this.updateWaitCount() || this.updateWaitMode(); }; Game_Interpreter.prototype.updateWaitCount = function () { if (this._waitCount > 0) { this._waitCount--; return true; } return false; }; Game_Interpreter.prototype.updateWaitMode = function () { var waiting = false; switch (this._waitMode) { case 'message': waiting = $gameMessage.isBusy(); break; case 'transfer': waiting = $gamePlayer.isTransferring(); break; case 'scroll': waiting = $gameMap.isScrolling(); break; case 'route': waiting = this._character.isMoveRouteForcing(); break; case 'animation': waiting = this._character.isAnimationPlaying(); break; case 'balloon': waiting = this._character.isBalloonPlaying(); break; case 'gather': waiting = $gamePlayer.areFollowersGathering(); break; case 'action': waiting = BattleManager.isActionForced(); break; case 'video': waiting = Graphics.isVideoPlaying(); break; case 'image': waiting = !ImageManager.isReady(); break; } if (!waiting) { this._waitMode = ''; } return waiting; }; Game_Interpreter.prototype.setWaitMode = function (waitMode) { this._waitMode = waitMode; }; Game_Interpreter.prototype.wait = function (duration) { this._waitCount = duration; }; Game_Interpreter.prototype.fadeSpeed = function () { return 24; }; Game_Interpreter.prototype.executeCommand = function () { var command = this.currentCommand(); if (command) { this._params = command.parameters; this._indent = command.indent; var methodName = 'command' + command.code; if (typeof this[methodName] === 'function') { if (!this[methodName]()) { return false; } } this._index++; } else { this.terminate(); } return true; }; Game_Interpreter.prototype.checkFreeze = function () { if (this._frameCount !== Graphics.frameCount) { this._frameCount = Graphics.frameCount; this._freezeChecker = 0; } if (this._freezeChecker++ >= 100000) { return true; } else { return false; } }; Game_Interpreter.prototype.terminate = function () { this._list = null; this._comments = ''; }; Game_Interpreter.prototype.skipBranch = function () { while (this._list[this._index + 1].indent > this._indent) { this._index++; } }; Game_Interpreter.prototype.currentCommand = function () { return this._list[this._index]; }; Game_Interpreter.prototype.nextEventCode = function () { var command = this._list[this._index + 1]; if (command) { return command.code; } else { return 0; } }; Game_Interpreter.prototype.iterateActorId = function (param, callback) { if (param === 0) { $gameParty.members().forEach(callback); } else { var actor = $gameActors.actor(param); if (actor) { callback(actor); } } }; Game_Interpreter.prototype.iterateActorEx = function (param1, param2, callback) { if (param1 === 0) { this.iterateActorId(param2, callback); } else { this.iterateActorId($gameVariables.value(param2), callback); } }; Game_Interpreter.prototype.iterateActorIndex = function (param, callback) { if (param < 0) { $gameParty.members().forEach(callback); } else { var actor = $gameParty.members()[param]; if (actor) { callback(actor); } } }; Game_Interpreter.prototype.iterateEnemyIndex = function (param, callback) { if (param < 0) { $gameTroop.members().forEach(callback); } else { var enemy = $gameTroop.members()[param]; if (enemy) { callback(enemy); } } }; Game_Interpreter.prototype.iterateBattler = function (param1, param2, callback) { if ($gameParty.inBattle()) { if (param1 === 0) { this.iterateEnemyIndex(param2, callback); } else { this.iterateActorId(param2, callback); } } }; Game_Interpreter.prototype.character = function (param) { if ($gameParty.inBattle()) { return null; } else if (param < 0) { return $gamePlayer; } else if (this.isOnCurrentMap()) { return $gameMap.event(param > 0 ? param : this._eventId); } else { return null; } }; Game_Interpreter.prototype.operateValue = function (operation, operandType, operand) { var value = operandType === 0 ? operand : $gameVariables.value(operand); return operation === 0 ? value : -value; }; Game_Interpreter.prototype.changeHp = function (target, value, allowDeath) { if (target.isAlive()) { if (!allowDeath && target.hp <= -value) { value = 1 - target.hp; } target.gainHp(value); if (target.isDead()) { target.performCollapse(); } } }; // Show Text Game_Interpreter.prototype.command101 = function () { if (!$gameMessage.isBusy()) { $gameMessage.setFaceImage(this._params[0], this._params[1]); $gameMessage.setBackground(this._params[2]); $gameMessage.setPositionType(this._params[3]); while (this.nextEventCode() === 401) { // Text data this._index++; $gameMessage.add(this.currentCommand().parameters[0]); } switch (this.nextEventCode()) { case 102: // Show Choices this._index++; this.setupChoices(this.currentCommand().parameters); break; case 103: // Input Number this._index++; this.setupNumInput(this.currentCommand().parameters); break; case 104: // Select Item this._index++; this.setupItemChoice(this.currentCommand().parameters); break; } this._index++; this.setWaitMode('message'); } return false; }; // Show Choices Game_Interpreter.prototype.command102 = function () { if (!$gameMessage.isBusy()) { this.setupChoices(this._params); this._index++; this.setWaitMode('message'); } return false; }; Game_Interpreter.prototype.setupChoices = function (params) { var choices = params[0].clone(); var cancelType = params[1]; var defaultType = params.length > 2 ? params[2] : 0; var positionType = params.length > 3 ? params[3] : 2; var background = params.length > 4 ? params[4] : 0; if (cancelType >= choices.length) { cancelType = -2; } $gameMessage.setChoices(choices, defaultType, cancelType); $gameMessage.setChoiceBackground(background); $gameMessage.setChoicePositionType(positionType); $gameMessage.setChoiceCallback(function (n) { this._branch[this._indent] = n; }.bind(this)); }; // When [**] Game_Interpreter.prototype.command402 = function () { if (this._branch[this._indent] !== this._params[0]) { this.skipBranch(); } return true; }; // When Cancel Game_Interpreter.prototype.command403 = function () { if (this._branch[this._indent] >= 0) { this.skipBranch(); } return true; }; // Input Number Game_Interpreter.prototype.command103 = function () { if (!$gameMessage.isBusy()) { this.setupNumInput(this._params); this._index++; this.setWaitMode('message'); } return false; }; Game_Interpreter.prototype.setupNumInput = function (params) { $gameMessage.setNumberInput(params[0], params[1]); }; // Select Item Game_Interpreter.prototype.command104 = function () { if (!$gameMessage.isBusy()) { this.setupItemChoice(this._params); this._index++; this.setWaitMode('message'); } return false; }; Game_Interpreter.prototype.setupItemChoice = function (params) { $gameMessage.setItemChoice(params[0], params[1] || 2); }; // Show Scrolling Text Game_Interpreter.prototype.command105 = function () { if (!$gameMessage.isBusy()) { $gameMessage.setScroll(this._params[0], this._params[1]); while (this.nextEventCode() === 405) { this._index++; $gameMessage.add(this.currentCommand().parameters[0]); } this._index++; this.setWaitMode('message'); } return false; }; // Comment Game_Interpreter.prototype.command108 = function () { this._comments = [this._params[0]]; while (this.nextEventCode() === 408) { this._index++; this._comments.push(this.currentCommand().parameters[0]); } return true; }; // Conditional Branch Game_Interpreter.prototype.command111 = function () { var result = false; switch (this._params[0]) { case 0: // Switch result = ($gameSwitches.value(this._params[1]) === (this._params[2] === 0)); break; case 1: // Variable var value1 = $gameVariables.value(this._params[1]); var value2; if (this._params[2] === 0) { value2 = this._params[3]; } else { value2 = $gameVariables.value(this._params[3]); } switch (this._params[4]) { case 0: // Equal to result = (value1 === value2); break; case 1: // Greater than or Equal to result = (value1 >= value2); break; case 2: // Less than or Equal to result = (value1 <= value2); break; case 3: // Greater than result = (value1 > value2); break; case 4: // Less than result = (value1 < value2); break; case 5: // Not Equal to result = (value1 !== value2); break; } break; case 2: // Self Switch if (this._eventId > 0) { var key = [this._mapId, this._eventId, this._params[1]]; result = ($gameSelfSwitches.value(key) === (this._params[2] === 0)); } break; case 3: // Timer if ($gameTimer.isWorking()) { if (this._params[2] === 0) { result = ($gameTimer.seconds() >= this._params[1]); } else { result = ($gameTimer.seconds() <= this._params[1]); } } break; case 4: // Actor var actor = $gameActors.actor(this._params[1]); if (actor) { var n = this._params[3]; switch (this._params[2]) { case 0: // In the Party result = $gameParty.members().contains(actor); break; case 1: // Name result = (actor.name() === n); break; case 2: // Class result = actor.isClass($dataClasses[n]); break; case 3: // Skill result = actor.hasSkill(n); break; case 4: // Weapon result = actor.hasWeapon($dataWeapons[n]); break; case 5: // Armor result = actor.hasArmor($dataArmors[n]); break; case 6: // State result = actor.isStateAffected(n); break; } } break; case 5: // Enemy var enemy = $gameTroop.members()[this._params[1]]; if (enemy) { switch (this._params[2]) { case 0: // Appeared result = enemy.isAlive(); break; case 1: // State result = enemy.isStateAffected(this._params[3]); break; } } break; case 6: // Character var character = this.character(this._params[1]); if (character) { result = (character.direction() === this._params[2]); } break; case 7: // Gold switch (this._params[2]) { case 0: // Greater than or equal to result = ($gameParty.gold() >= this._params[1]); break; case 1: // Less than or equal to result = ($gameParty.gold() <= this._params[1]); break; case 2: // Less than result = ($gameParty.gold() < this._params[1]); break; } break; case 8: // Item result = $gameParty.hasItem($dataItems[this._params[1]]); break; case 9: // Weapon result = $gameParty.hasItem($dataWeapons[this._params[1]], this._params[2]); break; case 10: // Armor result = $gameParty.hasItem($dataArmors[this._params[1]], this._params[2]); break; case 11: // Button result = Input.isPressed(this._params[1]); break; case 12: // Script result = !!eval(this._params[1]); break; case 13: // Vehicle result = ($gamePlayer.vehicle() === $gameMap.vehicle(this._params[1])); break; } this._branch[this._indent] = result; if (this._branch[this._indent] === false) { this.skipBranch(); } return true; }; // Else Game_Interpreter.prototype.command411 = function () { if (this._branch[this._indent] !== false) { this.skipBranch(); } return true; }; // Loop Game_Interpreter.prototype.command112 = function () { return true; }; // Repeat Above Game_Interpreter.prototype.command413 = function () { do { this._index--; } while (this.currentCommand().indent !== this._indent); return true; }; // Break Loop Game_Interpreter.prototype.command113 = function () { var depth = 0; while (this._index < this._list.length - 1) { this._index++; var command = this.currentCommand(); if (command.code === 112) depth++; if (command.code === 413) { if (depth > 0) depth--; else break; } } return true; }; // Exit Event Processing Game_Interpreter.prototype.command115 = function () { this._index = this._list.length; return true; }; // Common Event Game_Interpreter.prototype.command117 = function () { var commonEvent = $dataCommonEvents[this._params[0]]; if (commonEvent) { var eventId = this.isOnCurrentMap() ? this._eventId : 0; this.setupChild(commonEvent.list, eventId); } return true; }; Game_Interpreter.prototype.setupChild = function (list, eventId) { this._childInterpreter = new Game_Interpreter(this._depth + 1); this._childInterpreter.setup(list, eventId); }; // Label Game_Interpreter.prototype.command118 = function () { return true; }; // Jump to Label Game_Interpreter.prototype.command119 = function () { var labelName = this._params[0]; for (var i = 0; i < this._list.length; i++) { var command = this._list[i]; if (command.code === 118 && command.parameters[0] === labelName) { this.jumpTo(i); return; } } return true; }; Game_Interpreter.prototype.jumpTo = function (index) { var lastIndex = this._index; var startIndex = Math.min(index, lastIndex); var endIndex = Math.max(index, lastIndex); var indent = this._indent; for (var i = startIndex; i <= endIndex; i++) { var newIndent = this._list[i].indent; if (newIndent !== indent) { this._branch[indent] = null; indent = newIndent; } } this._index = index; }; // Control Switches Game_Interpreter.prototype.command121 = function () { for (var i = this._params[0]; i <= this._params[1]; i++) { $gameSwitches.setValue(i, this._params[2] === 0); } return true; }; // Control Variables Game_Interpreter.prototype.command122 = function () { var value = 0; switch (this._params[3]) { // Operand case 0: // Constant value = this._params[4]; break; case 1: // Variable value = $gameVariables.value(this._params[4]); break; case 2: // Random value = this._params[5] - this._params[4] + 1; for (var i = this._params[0]; i <= this._params[1]; i++) { this.operateVariable(i, this._params[2], this._params[4] + Math.randomInt(value)); } return true; break; case 3: // Game Data value = this.gameDataOperand(this._params[4], this._params[5], this._params[6]); break; case 4: // Script value = eval(this._params[4]); break; } for (var i = this._params[0]; i <= this._params[1]; i++) { this.operateVariable(i, this._params[2], value); } return true; }; Game_Interpreter.prototype.gameDataOperand = function (type, param1, param2) { switch (type) { case 0: // Item return $gameParty.numItems($dataItems[param1]); case 1: // Weapon return $gameParty.numItems($dataWeapons[param1]); case 2: // Armor return $gameParty.numItems($dataArmors[param1]); case 3: // Actor var actor = $gameActors.actor(param1); if (actor) { switch (param2) { case 0: // Level return actor.level; case 1: // EXP return actor.currentExp(); case 2: // HP return actor.hp; case 3: // MP return actor.mp; default: // Parameter if (param2 >= 4 && param2 <= 11) { return actor.param(param2 - 4); } } } break; case 4: // Enemy var enemy = $gameTroop.members()[param1]; if (enemy) { switch (param2) { case 0: // HP return enemy.hp; case 1: // MP return enemy.mp; default: // Parameter if (param2 >= 2 && param2 <= 9) { return enemy.param(param2 - 2); } } } break; case 5: // Character var character = this.character(param1); if (character) { switch (param2) { case 0: // Map X return character.x; case 1: // Map Y return character.y; case 2: // Direction return character.direction(); case 3: // Screen X return character.screenX(); case 4: // Screen Y return character.screenY(); } } break; case 6: // Party actor = $gameParty.members()[param1]; return actor ? actor.actorId() : 0; case 7: // Other switch (param1) { case 0: // Map ID return $gameMap.mapId(); case 1: // Party Members return $gameParty.size(); case 2: // Gold return $gameParty.gold(); case 3: // Steps return $gameParty.steps(); case 4: // Play Time return $gameSystem.playtime(); case 5: // Timer return $gameTimer.seconds(); case 6: // Save Count return $gameSystem.saveCount(); case 7: // Battle Count return $gameSystem.battleCount(); case 8: // Win Count return $gameSystem.winCount(); case 9: // Escape Count return $gameSystem.escapeCount(); } break; } return 0; }; Game_Interpreter.prototype.operateVariable = function (variableId, operationType, value) { try { var oldValue = $gameVariables.value(variableId); switch (operationType) { case 0: // Set $gameVariables.setValue(variableId, oldValue = value); break; case 1: // Add $gameVariables.setValue(variableId, oldValue + value); break; case 2: // Sub $gameVariables.setValue(variableId, oldValue - value); break; case 3: // Mul $gameVariables.setValue(variableId, oldValue * value); break; case 4: // Div $gameVariables.setValue(variableId, oldValue / value); break; case 5: // Mod $gameVariables.setValue(variableId, oldValue % value); break; } } catch (e) { $gameVariables.setValue(variableId, 0); } }; // Control Self Switch Game_Interpreter.prototype.command123 = function () { if (this._eventId > 0) { var key = [this._mapId, this._eventId, this._params[0]]; $gameSelfSwitches.setValue(key, this._params[1] === 0); } return true; }; // Control Timer Game_Interpreter.prototype.command124 = function () { if (this._params[0] === 0) { // Start $gameTimer.start(this._params[1] * 60); } else { // Stop $gameTimer.stop(); } return true; }; // Change Gold Game_Interpreter.prototype.command125 = function () { var value = this.operateValue(this._params[0], this._params[1], this._params[2]); $gameParty.gainGold(value); return true; }; // Change Items Game_Interpreter.prototype.command126 = function () { var value = this.operateValue(this._params[1], this._params[2], this._params[3]); $gameParty.gainItem($dataItems[this._params[0]], value); return true; }; // Change Weapons Game_Interpreter.prototype.command127 = function () { var value = this.operateValue(this._params[1], this._params[2], this._params[3]); $gameParty.gainItem($dataWeapons[this._params[0]], value, this._params[4]); return true; }; // Change Armors Game_Interpreter.prototype.command128 = function () { var value = this.operateValue(this._params[1], this._params[2], this._params[3]); $gameParty.gainItem($dataArmors[this._params[0]], value, this._params[4]); return true; }; // Change Party Member Game_Interpreter.prototype.command129 = function () { var actor = $gameActors.actor(this._params[0]); if (actor) { if (this._params[1] === 0) { // Add if (this._params[2]) { // Initialize $gameActors.actor(this._params[0]).setup(this._params[0]); } $gameParty.addActor(this._params[0]); } else { // Remove $gameParty.removeActor(this._params[0]); } } return true; }; // Change Battle BGM Game_Interpreter.prototype.command132 = function () { $gameSystem.setBattleBgm(this._params[0]); return true; }; // Change Victory ME Game_Interpreter.prototype.command133 = function () { $gameSystem.setVictoryMe(this._params[0]); return true; }; // Change Save Access Game_Interpreter.prototype.command134 = function () { if (this._params[0] === 0) { $gameSystem.disableSave(); } else { $gameSystem.enableSave(); } return true; }; // Change Menu Access Game_Interpreter.prototype.command135 = function () { if (this._params[0] === 0) { $gameSystem.disableMenu(); } else { $gameSystem.enableMenu(); } return true; }; // Change Encounter Disable Game_Interpreter.prototype.command136 = function () { if (this._params[0] === 0) { $gameSystem.disableEncounter(); } else { $gameSystem.enableEncounter(); } $gamePlayer.makeEncounterCount(); return true; }; // Change Formation Access Game_Interpreter.prototype.command137 = function () { if (this._params[0] === 0) { $gameSystem.disableFormation(); } else { $gameSystem.enableFormation(); } return true; }; // Change Window Color Game_Interpreter.prototype.command138 = function () { $gameSystem.setWindowTone(this._params[0]); return true; }; // Change Defeat ME Game_Interpreter.prototype.command139 = function () { $gameSystem.setDefeatMe(this._params[0]); return true; }; // Change Vehicle BGM Game_Interpreter.prototype.command140 = function () { var vehicle = $gameMap.vehicle(this._params[0]); if (vehicle) { vehicle.setBgm(this._params[1]); } return true; }; // Transfer Player Game_Interpreter.prototype.command201 = function () { if (!$gameParty.inBattle() && !$gameMessage.isBusy()) { var mapId, x, y; if (this._params[0] === 0) { // Direct designation mapId = this._params[1]; x = this._params[2]; y = this._params[3]; } else { // Designation with variables mapId = $gameVariables.value(this._params[1]); x = $gameVariables.value(this._params[2]); y = $gameVariables.value(this._params[3]); } $gamePlayer.reserveTransfer(mapId, x, y, this._params[4], this._params[5]); this.setWaitMode('transfer'); this._index++; } return false; }; // Set Vehicle Location Game_Interpreter.prototype.command202 = function () { var mapId, x, y; if (this._params[1] === 0) { // Direct designation mapId = this._params[2]; x = this._params[3]; y = this._params[4]; } else { // Designation with variables mapId = $gameVariables.value(this._params[2]); x = $gameVariables.value(this._params[3]); y = $gameVariables.value(this._params[4]); } var vehicle = $gameMap.vehicle(this._params[0]); if (vehicle) { vehicle.setLocation(mapId, x, y); } return true; }; // Set Event Location Game_Interpreter.prototype.command203 = function () { var character = this.character(this._params[0]); if (character) { if (this._params[1] === 0) { // Direct designation character.locate(this._params[2], this._params[3]); } else if (this._params[1] === 1) { // Designation with variables var x = $gameVariables.value(this._params[2]); var y = $gameVariables.value(this._params[3]); character.locate(x, y); } else { // Exchange with another event var character2 = this.character(this._params[2]); if (character2) { character.swap(character2); } } if (this._params[4] > 0) { character.setDirection(this._params[4]); } } return true; }; // Scroll Map Game_Interpreter.prototype.command204 = function () { if (!$gameParty.inBattle()) { if ($gameMap.isScrolling()) { this.setWaitMode('scroll'); return false; } $gameMap.startScroll(this._params[0], this._params[1], this._params[2]); } return true; }; // Set Movement Route Game_Interpreter.prototype.command205 = function () { $gameMap.refreshIfNeeded(); this._character = this.character(this._params[0]); if (this._character) { this._character.forceMoveRoute(this._params[1]); if (this._params[1].wait) { this.setWaitMode('route'); } } return true; }; // Getting On and Off Vehicles Game_Interpreter.prototype.command206 = function () { $gamePlayer.getOnOffVehicle(); return true; }; // Change Transparency Game_Interpreter.prototype.command211 = function () { $gamePlayer.setTransparent(this._params[0] === 0); return true; }; // Show Animation Game_Interpreter.prototype.command212 = function () { this._character = this.character(this._params[0]); if (this._character) { this._character.requestAnimation(this._params[1]); if (this._params[2]) { this.setWaitMode('animation'); } } return true; }; // Show Balloon Icon Game_Interpreter.prototype.command213 = function () { this._character = this.character(this._params[0]); if (this._character) { this._character.requestBalloon(this._params[1]); if (this._params[2]) { this.setWaitMode('balloon'); } } return true; }; // Erase Event Game_Interpreter.prototype.command214 = function () { if (this.isOnCurrentMap() && this._eventId > 0) { $gameMap.eraseEvent(this._eventId); } return true; }; // Change Player Followers Game_Interpreter.prototype.command216 = function () { if (this._params[0] === 0) { $gamePlayer.showFollowers(); } else { $gamePlayer.hideFollowers(); } $gamePlayer.refresh(); return true; }; // Gather Followers Game_Interpreter.prototype.command217 = function () { if (!$gameParty.inBattle()) { $gamePlayer.gatherFollowers(); this.setWaitMode('gather'); } return true; }; // Fadeout Screen Game_Interpreter.prototype.command221 = function () { if (!$gameMessage.isBusy()) { $gameScreen.startFadeOut(this.fadeSpeed()); this.wait(this.fadeSpeed()); this._index++; } return false; }; // Fadein Screen Game_Interpreter.prototype.command222 = function () { if (!$gameMessage.isBusy()) { $gameScreen.startFadeIn(this.fadeSpeed()); this.wait(this.fadeSpeed()); this._index++; } return false; }; // Tint Screen Game_Interpreter.prototype.command223 = function () { $gameScreen.startTint(this._params[0], this._params[1]); if (this._params[2]) { this.wait(this._params[1]); } return true; }; // Flash Screen Game_Interpreter.prototype.command224 = function () { $gameScreen.startFlash(this._params[0], this._params[1]); if (this._params[2]) { this.wait(this._params[1]); } return true; }; // Shake Screen Game_Interpreter.prototype.command225 = function () { $gameScreen.startShake(this._params[0], this._params[1], this._params[2]); if (this._params[3]) { this.wait(this._params[2]); } return true; }; // Wait Game_Interpreter.prototype.command230 = function () { this.wait(this._params[0]); return true; }; // Show Picture Game_Interpreter.prototype.command231 = function () { var x, y; if (this._params[3] === 0) { // Direct designation x = this._params[4]; y = this._params[5]; } else { // Designation with variables x = $gameVariables.value(this._params[4]); y = $gameVariables.value(this._params[5]); } $gameScreen.showPicture(this._params[0], this._params[1], this._params[2], x, y, this._params[6], this._params[7], this._params[8], this._params[9]); return true; }; // Move Picture Game_Interpreter.prototype.command232 = function () { var x, y; if (this._params[3] === 0) { // Direct designation x = this._params[4]; y = this._params[5]; } else { // Designation with variables x = $gameVariables.value(this._params[4]); y = $gameVariables.value(this._params[5]); } $gameScreen.movePicture(this._params[0], this._params[2], x, y, this._params[6], this._params[7], this._params[8], this._params[9], this._params[10]); if (this._params[11]) { this.wait(this._params[10]); } return true; }; // Rotate Picture Game_Interpreter.prototype.command233 = function () { $gameScreen.rotatePicture(this._params[0], this._params[1]); return true; }; // Tint Picture Game_Interpreter.prototype.command234 = function () { $gameScreen.tintPicture(this._params[0], this._params[1], this._params[2]); if (this._params[3]) { this.wait(this._params[2]); } return true; }; // Erase Picture Game_Interpreter.prototype.command235 = function () { $gameScreen.erasePicture(this._params[0]); return true; }; // Set Weather Effect Game_Interpreter.prototype.command236 = function () { if (!$gameParty.inBattle()) { $gameScreen.changeWeather(this._params[0], this._params[1], this._params[2]); if (this._params[3]) { this.wait(this._params[2]); } } return true; }; // Play BGM Game_Interpreter.prototype.command241 = function () { AudioManager.playBgm(this._params[0]); return true; }; // Fadeout BGM Game_Interpreter.prototype.command242 = function () { AudioManager.fadeOutBgm(this._params[0]); return true; }; // Save BGM Game_Interpreter.prototype.command243 = function () { $gameSystem.saveBgm(); return true; }; // Resume BGM Game_Interpreter.prototype.command244 = function () { $gameSystem.replayBgm(); return true; }; // Play BGS Game_Interpreter.prototype.command245 = function () { AudioManager.playBgs(this._params[0]); return true; }; // Fadeout BGS Game_Interpreter.prototype.command246 = function () { AudioManager.fadeOutBgs(this._params[0]); return true; }; // Play ME Game_Interpreter.prototype.command249 = function () { AudioManager.playMe(this._params[0]); return true; }; // Play SE Game_Interpreter.prototype.command250 = function () { AudioManager.playSe(this._params[0]); return true; }; // Stop SE Game_Interpreter.prototype.command251 = function () { AudioManager.stopSe(); return true; }; // Play Movie Game_Interpreter.prototype.command261 = function () { if (!$gameMessage.isBusy()) { var name = this._params[0]; if (name.length > 0) { var ext = this.videoFileExt(); Graphics.playVideo('movies/' + name + ext); this.setWaitMode('video'); } this._index++; } return false; }; Game_Interpreter.prototype.videoFileExt = function () { if (Graphics.canPlayVideoType('video/webm') && !Utils.isMobileDevice()) { return '.webm'; } else { return '.mp4'; } }; // Change Map Name Display Game_Interpreter.prototype.command281 = function () { if (this._params[0] === 0) { $gameMap.enableNameDisplay(); } else { $gameMap.disableNameDisplay(); } return true; }; // Change Tileset Game_Interpreter.prototype.command282 = function () { var tileset = $dataTilesets[this._params[0]]; if (!this._imageReservationId) { this._imageReservationId = Utils.generateRuntimeId(); } var allReady = tileset.tilesetNames.map(function (tilesetName) { return ImageManager.reserveTileset(tilesetName, 0, this._imageReservationId); }, this).every(function (bitmap) { return bitmap.isReady(); }); if (allReady) { $gameMap.changeTileset(this._params[0]); ImageManager.releaseReservation(this._imageReservationId); this._imageReservationId = null; return true; } else { return false; } }; // Change Battle Back Game_Interpreter.prototype.command283 = function () { $gameMap.changeBattleback(this._params[0], this._params[1]); return true; }; // Change Parallax Game_Interpreter.prototype.command284 = function () { $gameMap.changeParallax(this._params[0], this._params[1], this._params[2], this._params[3], this._params[4]); return true; }; // Get Location Info Game_Interpreter.prototype.command285 = function () { var x, y, value; if (this._params[2] === 0) { // Direct designation x = this._params[3]; y = this._params[4]; } else { // Designation with variables x = $gameVariables.value(this._params[3]); y = $gameVariables.value(this._params[4]); } switch (this._params[1]) { case 0: // Terrain Tag value = $gameMap.terrainTag(x, y); break; case 1: // Event ID value = $gameMap.eventIdXy(x, y); break; case 2: // Tile ID (Layer 1) case 3: // Tile ID (Layer 2) case 4: // Tile ID (Layer 3) case 5: // Tile ID (Layer 4) value = $gameMap.tileId(x, y, this._params[1] - 2); break; default: // Region ID value = $gameMap.regionId(x, y); break; } $gameVariables.setValue(this._params[0], value); return true; }; // Battle Processing Game_Interpreter.prototype.command301 = function () { if (!$gameParty.inBattle()) { var troopId; if (this._params[0] === 0) { // Direct designation troopId = this._params[1]; } else if (this._params[0] === 1) { // Designation with a variable troopId = $gameVariables.value(this._params[1]); } else { // Same as Random Encounter troopId = $gamePlayer.makeEncounterTroopId(); } if ($dataTroops[troopId]) { BattleManager.setup(troopId, this._params[2], this._params[3]); BattleManager.setEventCallback(function (n) { this._branch[this._indent] = n; }.bind(this)); $gamePlayer.makeEncounterCount(); SceneManager.push(Scene_Battle); } } return true; }; // If Win Game_Interpreter.prototype.command601 = function () { if (this._branch[this._indent] !== 0) { this.skipBranch(); } return true; }; // If Escape Game_Interpreter.prototype.command602 = function () { if (this._branch[this._indent] !== 1) { this.skipBranch(); } return true; }; // If Lose Game_Interpreter.prototype.command603 = function () { if (this._branch[this._indent] !== 2) { this.skipBranch(); } return true; }; // Shop Processing Game_Interpreter.prototype.command302 = function () { if (!$gameParty.inBattle()) { var goods = [this._params]; while (this.nextEventCode() === 605) { this._index++; goods.push(this.currentCommand().parameters); } SceneManager.push(Scene_Shop); SceneManager.prepareNextScene(goods, this._params[4]); } return true; }; // Name Input Processing Game_Interpreter.prototype.command303 = function () { if (!$gameParty.inBattle()) { if ($dataActors[this._params[0]]) { SceneManager.push(Scene_Name); SceneManager.prepareNextScene(this._params[0], this._params[1]); } } return true; }; // Change HP Game_Interpreter.prototype.command311 = function () { var value = this.operateValue(this._params[2], this._params[3], this._params[4]); this.iterateActorEx(this._params[0], this._params[1], function (actor) { this.changeHp(actor, value, this._params[5]); }.bind(this)); return true; }; // Change MP Game_Interpreter.prototype.command312 = function () { var value = this.operateValue(this._params[2], this._params[3], this._params[4]); this.iterateActorEx(this._params[0], this._params[1], function (actor) { actor.gainMp(value); }.bind(this)); return true; }; // Change TP Game_Interpreter.prototype.command326 = function () { var value = this.operateValue(this._params[2], this._params[3], this._params[4]); this.iterateActorEx(this._params[0], this._params[1], function (actor) { actor.gainTp(value); }.bind(this)); return true; }; // Change State Game_Interpreter.prototype.command313 = function () { this.iterateActorEx(this._params[0], this._params[1], function (actor) { var alreadyDead = actor.isDead(); if (this._params[2] === 0) { actor.addState(this._params[3]); } else { actor.removeState(this._params[3]); } if (actor.isDead() && !alreadyDead) { actor.performCollapse(); } actor.clearResult(); }.bind(this)); return true; }; // Recover All Game_Interpreter.prototype.command314 = function () { this.iterateActorEx(this._params[0], this._params[1], function (actor) { actor.recoverAll(); }.bind(this)); return true; }; // Change EXP Game_Interpreter.prototype.command315 = function () { var value = this.operateValue(this._params[2], this._params[3], this._params[4]); this.iterateActorEx(this._params[0], this._params[1], function (actor) { actor.changeExp(actor.currentExp() + value, this._params[5]); }.bind(this)); return true; }; // Change Level Game_Interpreter.prototype.command316 = function () { var value = this.operateValue(this._params[2], this._params[3], this._params[4]); this.iterateActorEx(this._params[0], this._params[1], function (actor) { actor.changeLevel(actor.level + value, this._params[5]); }.bind(this)); return true; }; // Change Parameter Game_Interpreter.prototype.command317 = function () { var value = this.operateValue(this._params[3], this._params[4], this._params[5]); this.iterateActorEx(this._params[0], this._params[1], function (actor) { actor.addParam(this._params[2], value); }.bind(this)); return true; }; // Change Skill Game_Interpreter.prototype.command318 = function () { this.iterateActorEx(this._params[0], this._params[1], function (actor) { if (this._params[2] === 0) { actor.learnSkill(this._params[3]); } else { actor.forgetSkill(this._params[3]); } }.bind(this)); return true; }; // Change Equipment Game_Interpreter.prototype.command319 = function () { var actor = $gameActors.actor(this._params[0]); if (actor) { actor.changeEquipById(this._params[1], this._params[2]); } return true; }; // Change Name Game_Interpreter.prototype.command320 = function () { var actor = $gameActors.actor(this._params[0]); if (actor) { actor.setName(this._params[1]); } return true; }; // Change Class Game_Interpreter.prototype.command321 = function () { var actor = $gameActors.actor(this._params[0]); if (actor && $dataClasses[this._params[1]]) { actor.changeClass(this._params[1], this._params[2]); } return true; }; // Change Actor Images Game_Interpreter.prototype.command322 = function () { var actor = $gameActors.actor(this._params[0]); if (actor) { actor.setCharacterImage(this._params[1], this._params[2]); actor.setFaceImage(this._params[3], this._params[4]); actor.setBattlerImage(this._params[5]); } $gamePlayer.refresh(); return true; }; // Change Vehicle Image Game_Interpreter.prototype.command323 = function () { var vehicle = $gameMap.vehicle(this._params[0]); if (vehicle) { vehicle.setImage(this._params[1], this._params[2]); } return true; }; // Change Nickname Game_Interpreter.prototype.command324 = function () { var actor = $gameActors.actor(this._params[0]); if (actor) { actor.setNickname(this._params[1]); } return true; }; // Change Profile Game_Interpreter.prototype.command325 = function () { var actor = $gameActors.actor(this._params[0]); if (actor) { actor.setProfile(this._params[1]); } return true; }; // Change Enemy HP Game_Interpreter.prototype.command331 = function () { var value = this.operateValue(this._params[1], this._params[2], this._params[3]); this.iterateEnemyIndex(this._params[0], function (enemy) { this.changeHp(enemy, value, this._params[4]); }.bind(this)); return true; }; // Change Enemy MP Game_Interpreter.prototype.command332 = function () { var value = this.operateValue(this._params[1], this._params[2], this._params[3]); this.iterateEnemyIndex(this._params[0], function (enemy) { enemy.gainMp(value); }.bind(this)); return true; }; // Change Enemy TP Game_Interpreter.prototype.command342 = function () { var value = this.operateValue(this._params[1], this._params[2], this._params[3]); this.iterateEnemyIndex(this._params[0], function (enemy) { enemy.gainTp(value); }.bind(this)); return true; }; // Change Enemy State Game_Interpreter.prototype.command333 = function () { this.iterateEnemyIndex(this._params[0], function (enemy) { var alreadyDead = enemy.isDead(); if (this._params[1] === 0) { enemy.addState(this._params[2]); } else { enemy.removeState(this._params[2]); } if (enemy.isDead() && !alreadyDead) { enemy.performCollapse(); } enemy.clearResult(); }.bind(this)); return true; }; // Enemy Recover All Game_Interpreter.prototype.command334 = function () { this.iterateEnemyIndex(this._params[0], function (enemy) { enemy.recoverAll(); }.bind(this)); return true; }; // Enemy Appear Game_Interpreter.prototype.command335 = function () { this.iterateEnemyIndex(this._params[0], function (enemy) { enemy.appear(); $gameTroop.makeUniqueNames(); }.bind(this)); return true; }; // Enemy Transform Game_Interpreter.prototype.command336 = function () { this.iterateEnemyIndex(this._params[0], function (enemy) { enemy.transform(this._params[1]); $gameTroop.makeUniqueNames(); }.bind(this)); return true; }; // Show Battle Animation Game_Interpreter.prototype.command337 = function () { if (this._params[2] == true) { this.iterateEnemyIndex(-1, function (enemy) { if (enemy.isAlive()) { enemy.startAnimation(this._params[1], false, 0); } }.bind(this)); } else { this.iterateEnemyIndex(this._params[0], function (enemy) { if (enemy.isAlive()) { enemy.startAnimation(this._params[1], false, 0); } }.bind(this)); } return true; }; // Force Action Game_Interpreter.prototype.command339 = function () { this.iterateBattler(this._params[0], this._params[1], function (battler) { if (!battler.isDeathStateAffected()) { battler.forceAction(this._params[2], this._params[3]); BattleManager.forceAction(battler); this.setWaitMode('action'); } }.bind(this)); return true; }; // Abort Battle Game_Interpreter.prototype.command340 = function () { BattleManager.abort(); return true; }; // Open Menu Screen Game_Interpreter.prototype.command351 = function () { if (!$gameParty.inBattle()) { SceneManager.push(Scene_Menu); Window_MenuCommand.initCommandPosition(); } return true; }; // Open Save Screen Game_Interpreter.prototype.command352 = function () { if (!$gameParty.inBattle()) { SceneManager.push(Scene_Save); } return true; }; // Game Over Game_Interpreter.prototype.command353 = function () { SceneManager.goto(Scene_Gameover); return true; }; // Return to Title Screen Game_Interpreter.prototype.command354 = function () { SceneManager.goto(Scene_Title); return true; }; // Script Game_Interpreter.prototype.command355 = function () { var script = this.currentCommand().parameters[0] + '\n'; while (this.nextEventCode() === 655) { this._index++; script += this.currentCommand().parameters[0] + '\n'; } eval(script); return true; }; // Plugin Command Game_Interpreter.prototype.command356 = function () { var args = this._params[0].split(" "); var command = args.shift(); this.pluginCommand(command, args); return true; }; Game_Interpreter.prototype.pluginCommand = function (command, args) { // to be overridden by plugins }; Game_Interpreter.requestImages = function (list, commonList) { if (!list) return; list.forEach(function (command) { var params = command.parameters; switch (command.code) { // Show Text case 101: ImageManager.requestFace(params[0]); break; // Common Event case 117: var commonEvent = $dataCommonEvents[params[0]]; if (commonEvent) { if (!commonList) { commonList = []; } if (!commonList.contains(params[0])) { commonList.push(params[0]); Game_Interpreter.requestImages(commonEvent.list, commonList); } } break; // Change Party Member case 129: var actor = $gameActors.actor(params[0]); if (actor && params[1] === 0) { var name = actor.characterName(); ImageManager.requestCharacter(name); } break; // Set Movement Route case 205: if (params[1]) { params[1].list.forEach(function (command) { var params = command.parameters; if (command.code === Game_Character.ROUTE_CHANGE_IMAGE) { ImageManager.requestCharacter(params[0]); } }); } break; // Show Animation, Show Battle Animation case 212: case 337: if (params[1]) { var animation = $dataAnimations[params[1]]; var name1 = animation.animation1Name; var name2 = animation.animation2Name; var hue1 = animation.animation1Hue; var hue2 = animation.animation2Hue; ImageManager.requestAnimation(name1, hue1); ImageManager.requestAnimation(name2, hue2); } break; // Change Player Followers case 216: if (params[0] === 0) { $gamePlayer.followers().forEach(function (follower) { var name = follower.characterName(); ImageManager.requestCharacter(name); }); } break; // Show Picture case 231: ImageManager.requestPicture(params[1]); break; // Change Tileset case 282: var tileset = $dataTilesets[params[0]]; tileset.tilesetNames.forEach(function (tilesetName) { ImageManager.requestTileset(tilesetName); }); break; // Change Battle Back case 283: if ($gameParty.inBattle()) { ImageManager.requestBattleback1(params[0]); ImageManager.requestBattleback2(params[1]); } break; // Change Parallax case 284: if (!$gameParty.inBattle()) { ImageManager.requestParallax(params[0]); } break; // Change Actor Images case 322: ImageManager.requestCharacter(params[1]); ImageManager.requestFace(params[3]); ImageManager.requestSvActor(params[5]); break; // Change Vehicle Image case 323: var vehicle = $gameMap.vehicle(params[0]); if (vehicle) { ImageManager.requestCharacter(params[1]); } break; // Enemy Transform case 336: var enemy = $dataEnemies[params[1]]; var name = enemy.battlerName; var hue = enemy.battlerHue; if ($gameSystem.isSideView()) { ImageManager.requestSvEnemy(name, hue); } else { ImageManager.requestEnemy(name, hue); } break; } }); };
dazed/translations
www/js/rpg_objects.js
JavaScript
unknown
296,587
//============================================================================= // rpg_scenes.js v1.6.2 //============================================================================= //============================================================================= /** * The Superclass of all scene within the game. * * @class Scene_Base * @constructor * @extends Stage */ function Scene_Base() { this.initialize.apply(this, arguments); } Scene_Base.prototype = Object.create(Stage.prototype); Scene_Base.prototype.constructor = Scene_Base; /** * Create a instance of Scene_Base. * * @instance * @memberof Scene_Base */ Scene_Base.prototype.initialize = function () { Stage.prototype.initialize.call(this); this._active = false; this._fadeSign = 0; this._fadeDuration = 0; this._fadeSprite = null; this._imageReservationId = Utils.generateRuntimeId(); }; /** * Attach a reservation to the reserve queue. * * @method attachReservation * @instance * @memberof Scene_Base */ Scene_Base.prototype.attachReservation = function () { ImageManager.setDefaultReservationId(this._imageReservationId); }; /** * Remove the reservation from the Reserve queue. * * @method detachReservation * @instance * @memberof Scene_Base */ Scene_Base.prototype.detachReservation = function () { ImageManager.releaseReservation(this._imageReservationId); }; /** * Create the components and add them to the rendering process. * * @method create * @instance * @memberof Scene_Base */ Scene_Base.prototype.create = function () { }; /** * Returns whether the scene is active or not. * * @method isActive * @instance * @memberof Scene_Base * @return {Boolean} return true if the scene is active */ Scene_Base.prototype.isActive = function () { return this._active; }; /** * Return whether the scene is ready to start or not. * * @method isReady * @instance * @memberof Scene_Base * @return {Boolean} Return true if the scene is ready to start */ Scene_Base.prototype.isReady = function () { return ImageManager.isReady(); }; /** * Start the scene processing. * * @method start * @instance * @memberof Scene_Base */ Scene_Base.prototype.start = function () { this._active = true; }; /** * Update the scene processing each new frame. * * @method update * @instance * @memberof Scene_Base */ Scene_Base.prototype.update = function () { this.updateFade(); this.updateChildren(); }; /** * Stop the scene processing. * * @method stop * @instance * @memberof Scene_Base */ Scene_Base.prototype.stop = function () { this._active = false; }; /** * Return whether the scene is busy or not. * * @method isBusy * @instance * @memberof Scene_Base * @return {Boolean} Return true if the scene is currently busy */ Scene_Base.prototype.isBusy = function () { return this._fadeDuration > 0; }; /** * Terminate the scene before switching to a another scene. * * @method terminate * @instance * @memberof Scene_Base */ Scene_Base.prototype.terminate = function () { }; /** * Create the layer for the windows children * and add it to the rendering process. * * @method createWindowLayer * @instance * @memberof Scene_Base */ Scene_Base.prototype.createWindowLayer = function () { var width = Graphics.boxWidth; var height = Graphics.boxHeight; var x = (Graphics.width - width) / 2; var y = (Graphics.height - height) / 2; this._windowLayer = new WindowLayer(); this._windowLayer.move(x, y, width, height); this.addChild(this._windowLayer); }; /** * Add the children window to the windowLayer processing. * * @method addWindow * @instance * @memberof Scene_Base */ Scene_Base.prototype.addWindow = function (window) { this._windowLayer.addChild(window); }; /** * Request a fadeIn screen process. * * @method startFadeIn * @param {Number} [duration=30] The time the process will take for fadeIn the screen * @param {Boolean} [white=false] If true the fadein will be process with a white color else it's will be black * * @instance * @memberof Scene_Base */ Scene_Base.prototype.startFadeIn = function (duration, white) { this.createFadeSprite(white); this._fadeSign = 1; this._fadeDuration = duration || 30; this._fadeSprite.opacity = 255; }; /** * Request a fadeOut screen process. * * @method startFadeOut * @param {Number} [duration=30] The time the process will take for fadeOut the screen * @param {Boolean} [white=false] If true the fadeOut will be process with a white color else it's will be black * * @instance * @memberof Scene_Base */ Scene_Base.prototype.startFadeOut = function (duration, white) { this.createFadeSprite(white); this._fadeSign = -1; this._fadeDuration = duration || 30; this._fadeSprite.opacity = 0; }; /** * Create a Screen sprite for the fadein and fadeOut purpose and * add it to the rendering process. * * @method createFadeSprite * @instance * @memberof Scene_Base */ Scene_Base.prototype.createFadeSprite = function (white) { if (!this._fadeSprite) { this._fadeSprite = new ScreenSprite(); this.addChild(this._fadeSprite); } if (white) { this._fadeSprite.setWhite(); } else { this._fadeSprite.setBlack(); } }; /** * Update the screen fade processing. * * @method updateFade * @instance * @memberof Scene_Base */ Scene_Base.prototype.updateFade = function () { if (this._fadeDuration > 0) { var d = this._fadeDuration; if (this._fadeSign > 0) { this._fadeSprite.opacity -= this._fadeSprite.opacity / d; } else { this._fadeSprite.opacity += (255 - this._fadeSprite.opacity) / d; } this._fadeDuration--; } }; /** * Update the children of the scene EACH frame. * * @method updateChildren * @instance * @memberof Scene_Base */ Scene_Base.prototype.updateChildren = function () { this.children.forEach(function (child) { if (child.update) { child.update(); } }); }; /** * Pop the scene from the stack array and switch to the * previous scene. * * @method popScene * @instance * @memberof Scene_Base */ Scene_Base.prototype.popScene = function () { SceneManager.pop(); }; /** * Check whether the game should be triggering a gameover. * * @method checkGameover * @instance * @memberof Scene_Base */ Scene_Base.prototype.checkGameover = function () { if ($gameParty.isAllDead()) { SceneManager.goto(Scene_Gameover); } }; /** * Slowly fade out all the visual and audio of the scene. * * @method fadeOutAll * @instance * @memberof Scene_Base */ Scene_Base.prototype.fadeOutAll = function () { var time = this.slowFadeSpeed() / 60; AudioManager.fadeOutBgm(time); AudioManager.fadeOutBgs(time); AudioManager.fadeOutMe(time); this.startFadeOut(this.slowFadeSpeed()); }; /** * Return the screen fade speed value. * * @method fadeSpeed * @instance * @memberof Scene_Base * @return {Number} Return the fade speed */ Scene_Base.prototype.fadeSpeed = function () { return 24; }; /** * Return a slow screen fade speed value. * * @method slowFadeSpeed * @instance * @memberof Scene_Base * @return {Number} Return the fade speed */ Scene_Base.prototype.slowFadeSpeed = function () { return this.fadeSpeed() * 2; }; //----------------------------------------------------------------------------- // Scene_Boot // // The scene class for initializing the entire game. function Scene_Boot() { this.initialize.apply(this, arguments); } Scene_Boot.prototype = Object.create(Scene_Base.prototype); Scene_Boot.prototype.constructor = Scene_Boot; Scene_Boot.prototype.initialize = function () { Scene_Base.prototype.initialize.call(this); this._startDate = Date.now(); }; Scene_Boot.prototype.create = function () { Scene_Base.prototype.create.call(this); DataManager.loadDatabase(); ConfigManager.load(); this.loadSystemWindowImage(); }; Scene_Boot.prototype.loadSystemWindowImage = function () { ImageManager.reserveSystem('Window'); }; Scene_Boot.loadSystemImages = function () { ImageManager.reserveSystem('IconSet'); ImageManager.reserveSystem('Balloon'); ImageManager.reserveSystem('Shadow1'); ImageManager.reserveSystem('Shadow2'); ImageManager.reserveSystem('Damage'); ImageManager.reserveSystem('States'); ImageManager.reserveSystem('Weapons1'); ImageManager.reserveSystem('Weapons2'); ImageManager.reserveSystem('Weapons3'); ImageManager.reserveSystem('ButtonSet'); }; Scene_Boot.prototype.isReady = function () { if (Scene_Base.prototype.isReady.call(this)) { return DataManager.isDatabaseLoaded() && this.isGameFontLoaded(); } else { return false; } }; Scene_Boot.prototype.isGameFontLoaded = function () { if (Graphics.isFontLoaded('GameFont')) { return true; } else if (!Graphics.canUseCssFontLoading()) { var elapsed = Date.now() - this._startDate; if (elapsed >= 60000) { throw new Error('Failed to load GameFont'); } } }; Scene_Boot.prototype.start = function () { Scene_Base.prototype.start.call(this); SoundManager.preloadImportantSounds(); if (DataManager.isBattleTest()) { DataManager.setupBattleTest(); SceneManager.goto(Scene_Battle); } else if (DataManager.isEventTest()) { DataManager.setupEventTest(); SceneManager.goto(Scene_Map); } else { this.checkPlayerLocation(); DataManager.setupNewGame(); SceneManager.goto(Scene_Title); Window_TitleCommand.initCommandPosition(); } this.updateDocumentTitle(); }; Scene_Boot.prototype.updateDocumentTitle = function () { document.title = $dataSystem.gameTitle; }; Scene_Boot.prototype.checkPlayerLocation = function () { if ($dataSystem.startMapId === 0) { throw new Error('Player\'s starting position is not set'); } }; //----------------------------------------------------------------------------- // Scene_Title // // The scene class of the title screen. function Scene_Title() { this.initialize.apply(this, arguments); } Scene_Title.prototype = Object.create(Scene_Base.prototype); Scene_Title.prototype.constructor = Scene_Title; Scene_Title.prototype.initialize = function () { Scene_Base.prototype.initialize.call(this); }; Scene_Title.prototype.create = function () { Scene_Base.prototype.create.call(this); this.createBackground(); this.createForeground(); this.createWindowLayer(); this.createCommandWindow(); }; Scene_Title.prototype.start = function () { Scene_Base.prototype.start.call(this); SceneManager.clearStack(); this.centerSprite(this._backSprite1); this.centerSprite(this._backSprite2); this.playTitleMusic(); this.startFadeIn(this.fadeSpeed(), false); }; Scene_Title.prototype.update = function () { if (!this.isBusy()) { this._commandWindow.open(); } Scene_Base.prototype.update.call(this); }; Scene_Title.prototype.isBusy = function () { return this._commandWindow.isClosing() || Scene_Base.prototype.isBusy.call(this); }; Scene_Title.prototype.terminate = function () { Scene_Base.prototype.terminate.call(this); SceneManager.snapForBackground(); }; Scene_Title.prototype.createBackground = function () { this._backSprite1 = new Sprite(ImageManager.loadTitle1($dataSystem.title1Name)); this._backSprite2 = new Sprite(ImageManager.loadTitle2($dataSystem.title2Name)); this.addChild(this._backSprite1); this.addChild(this._backSprite2); }; Scene_Title.prototype.createForeground = function () { this._gameTitleSprite = new Sprite(new Bitmap(Graphics.width, Graphics.height)); this.addChild(this._gameTitleSprite); if ($dataSystem.optDrawTitle) { this.drawGameTitle(); } }; Scene_Title.prototype.drawGameTitle = function () { var x = 20; var y = Graphics.height / 4; var maxWidth = Graphics.width - x * 2; var text = $dataSystem.gameTitle; this._gameTitleSprite.bitmap.outlineColor = 'black'; this._gameTitleSprite.bitmap.outlineWidth = 8; this._gameTitleSprite.bitmap.fontSize = 72; this._gameTitleSprite.bitmap.drawText(text, x, y, maxWidth, 48, 'center'); }; Scene_Title.prototype.centerSprite = function (sprite) { sprite.x = Graphics.width / 2; sprite.y = Graphics.height / 2; sprite.anchor.x = 0.5; sprite.anchor.y = 0.5; }; Scene_Title.prototype.createCommandWindow = function () { this._commandWindow = new Window_TitleCommand(); this._commandWindow.setHandler('newGame', this.commandNewGame.bind(this)); this._commandWindow.setHandler('continue', this.commandContinue.bind(this)); this._commandWindow.setHandler('options', this.commandOptions.bind(this)); this.addWindow(this._commandWindow); }; Scene_Title.prototype.commandNewGame = function () { DataManager.setupNewGame(); this._commandWindow.close(); this.fadeOutAll(); SceneManager.goto(Scene_Map); }; Scene_Title.prototype.commandContinue = function () { this._commandWindow.close(); SceneManager.push(Scene_Load); }; Scene_Title.prototype.commandOptions = function () { this._commandWindow.close(); SceneManager.push(Scene_Options); }; Scene_Title.prototype.playTitleMusic = function () { AudioManager.playBgm($dataSystem.titleBgm); AudioManager.stopBgs(); AudioManager.stopMe(); }; //----------------------------------------------------------------------------- // Scene_Map // // The scene class of the map screen. function Scene_Map() { this.initialize.apply(this, arguments); } Scene_Map.prototype = Object.create(Scene_Base.prototype); Scene_Map.prototype.constructor = Scene_Map; Scene_Map.prototype.initialize = function () { Scene_Base.prototype.initialize.call(this); this._waitCount = 0; this._encounterEffectDuration = 0; this._mapLoaded = false; this._touchCount = 0; }; Scene_Map.prototype.create = function () { Scene_Base.prototype.create.call(this); this._transfer = $gamePlayer.isTransferring(); var mapId = this._transfer ? $gamePlayer.newMapId() : $gameMap.mapId(); DataManager.loadMapData(mapId); }; Scene_Map.prototype.isReady = function () { if (!this._mapLoaded && DataManager.isMapLoaded()) { this.onMapLoaded(); this._mapLoaded = true; } return this._mapLoaded && Scene_Base.prototype.isReady.call(this); }; Scene_Map.prototype.onMapLoaded = function () { if (this._transfer) { $gamePlayer.performTransfer(); } this.createDisplayObjects(); }; Scene_Map.prototype.start = function () { Scene_Base.prototype.start.call(this); SceneManager.clearStack(); if (this._transfer) { this.fadeInForTransfer(); this._mapNameWindow.open(); $gameMap.autoplay(); } else if (this.needsFadeIn()) { this.startFadeIn(this.fadeSpeed(), false); } this.menuCalling = false; }; Scene_Map.prototype.update = function () { this.updateDestination(); this.updateMainMultiply(); if (this.isSceneChangeOk()) { this.updateScene(); } else if (SceneManager.isNextScene(Scene_Battle)) { this.updateEncounterEffect(); } this.updateWaitCount(); Scene_Base.prototype.update.call(this); }; Scene_Map.prototype.updateMainMultiply = function () { this.updateMain(); if (this.isFastForward()) { this.updateMain(); } }; Scene_Map.prototype.updateMain = function () { var active = this.isActive(); $gameMap.update(active); $gamePlayer.update(active); $gameTimer.update(active); $gameScreen.update(); }; Scene_Map.prototype.isFastForward = function () { return ($gameMap.isEventRunning() && !SceneManager.isSceneChanging() && (Input.isLongPressed('ok') || TouchInput.isLongPressed())); }; Scene_Map.prototype.stop = function () { Scene_Base.prototype.stop.call(this); $gamePlayer.straighten(); this._mapNameWindow.close(); if (this.needsSlowFadeOut()) { this.startFadeOut(this.slowFadeSpeed(), false); } else if (SceneManager.isNextScene(Scene_Map)) { this.fadeOutForTransfer(); } else if (SceneManager.isNextScene(Scene_Battle)) { this.launchBattle(); } }; Scene_Map.prototype.isBusy = function () { return ((this._messageWindow && this._messageWindow.isClosing()) || this._waitCount > 0 || this._encounterEffectDuration > 0 || Scene_Base.prototype.isBusy.call(this)); }; Scene_Map.prototype.terminate = function () { Scene_Base.prototype.terminate.call(this); if (!SceneManager.isNextScene(Scene_Battle)) { this._spriteset.update(); this._mapNameWindow.hide(); SceneManager.snapForBackground(); } else { ImageManager.clearRequest(); } if (SceneManager.isNextScene(Scene_Map)) { ImageManager.clearRequest(); } $gameScreen.clearZoom(); this.removeChild(this._fadeSprite); this.removeChild(this._mapNameWindow); this.removeChild(this._windowLayer); this.removeChild(this._spriteset); }; Scene_Map.prototype.needsFadeIn = function () { return (SceneManager.isPreviousScene(Scene_Battle) || SceneManager.isPreviousScene(Scene_Load)); }; Scene_Map.prototype.needsSlowFadeOut = function () { return (SceneManager.isNextScene(Scene_Title) || SceneManager.isNextScene(Scene_Gameover)); }; Scene_Map.prototype.updateWaitCount = function () { if (this._waitCount > 0) { this._waitCount--; return true; } return false; }; Scene_Map.prototype.updateDestination = function () { if (this.isMapTouchOk()) { this.processMapTouch(); } else { $gameTemp.clearDestination(); this._touchCount = 0; } }; Scene_Map.prototype.isMapTouchOk = function () { return this.isActive() && $gamePlayer.canMove(); }; Scene_Map.prototype.processMapTouch = function () { if (TouchInput.isTriggered() || this._touchCount > 0) { if (TouchInput.isPressed()) { if (this._touchCount === 0 || this._touchCount >= 15) { var x = $gameMap.canvasToMapX(TouchInput.x); var y = $gameMap.canvasToMapY(TouchInput.y); $gameTemp.setDestination(x, y); } this._touchCount++; } else { this._touchCount = 0; } } }; Scene_Map.prototype.isSceneChangeOk = function () { return this.isActive() && !$gameMessage.isBusy(); }; Scene_Map.prototype.updateScene = function () { this.checkGameover(); if (!SceneManager.isSceneChanging()) { this.updateTransferPlayer(); } if (!SceneManager.isSceneChanging()) { this.updateEncounter(); } if (!SceneManager.isSceneChanging()) { this.updateCallMenu(); } if (!SceneManager.isSceneChanging()) { this.updateCallDebug(); } }; Scene_Map.prototype.createDisplayObjects = function () { this.createSpriteset(); this.createMapNameWindow(); this.createWindowLayer(); this.createAllWindows(); }; Scene_Map.prototype.createSpriteset = function () { this._spriteset = new Spriteset_Map(); this.addChild(this._spriteset); }; Scene_Map.prototype.createAllWindows = function () { this.createMessageWindow(); this.createScrollTextWindow(); }; Scene_Map.prototype.createMapNameWindow = function () { this._mapNameWindow = new Window_MapName(); this.addChild(this._mapNameWindow); }; Scene_Map.prototype.createMessageWindow = function () { this._messageWindow = new Window_Message(); this.addWindow(this._messageWindow); this._messageWindow.subWindows().forEach(function (window) { this.addWindow(window); }, this); }; Scene_Map.prototype.createScrollTextWindow = function () { this._scrollTextWindow = new Window_ScrollText(); this.addWindow(this._scrollTextWindow); }; Scene_Map.prototype.updateTransferPlayer = function () { if ($gamePlayer.isTransferring()) { SceneManager.goto(Scene_Map); } }; Scene_Map.prototype.updateEncounter = function () { if ($gamePlayer.executeEncounter()) { SceneManager.push(Scene_Battle); } }; Scene_Map.prototype.updateCallMenu = function () { if (this.isMenuEnabled()) { if (this.isMenuCalled()) { this.menuCalling = true; } if (this.menuCalling && !$gamePlayer.isMoving()) { this.callMenu(); } } else { this.menuCalling = false; } }; Scene_Map.prototype.isMenuEnabled = function () { return $gameSystem.isMenuEnabled() && !$gameMap.isEventRunning(); }; Scene_Map.prototype.isMenuCalled = function () { return Input.isTriggered('menu') || TouchInput.isCancelled(); }; Scene_Map.prototype.callMenu = function () { SoundManager.playOk(); SceneManager.push(Scene_Menu); Window_MenuCommand.initCommandPosition(); $gameTemp.clearDestination(); this._mapNameWindow.hide(); this._waitCount = 2; }; Scene_Map.prototype.updateCallDebug = function () { if (this.isDebugCalled()) { SceneManager.push(Scene_Debug); } }; Scene_Map.prototype.isDebugCalled = function () { return Input.isTriggered('debug') && $gameTemp.isPlaytest(); }; Scene_Map.prototype.fadeInForTransfer = function () { var fadeType = $gamePlayer.fadeType(); switch (fadeType) { case 0: case 1: this.startFadeIn(this.fadeSpeed(), fadeType === 1); break; } }; Scene_Map.prototype.fadeOutForTransfer = function () { var fadeType = $gamePlayer.fadeType(); switch (fadeType) { case 0: case 1: this.startFadeOut(this.fadeSpeed(), fadeType === 1); break; } }; Scene_Map.prototype.launchBattle = function () { BattleManager.saveBgmAndBgs(); this.stopAudioOnBattleStart(); SoundManager.playBattleStart(); this.startEncounterEffect(); this._mapNameWindow.hide(); }; Scene_Map.prototype.stopAudioOnBattleStart = function () { if (!AudioManager.isCurrentBgm($gameSystem.battleBgm())) { AudioManager.stopBgm(); } AudioManager.stopBgs(); AudioManager.stopMe(); AudioManager.stopSe(); }; Scene_Map.prototype.startEncounterEffect = function () { this._spriteset.hideCharacters(); this._encounterEffectDuration = this.encounterEffectSpeed(); }; Scene_Map.prototype.updateEncounterEffect = function () { if (this._encounterEffectDuration > 0) { this._encounterEffectDuration--; var speed = this.encounterEffectSpeed(); var n = speed - this._encounterEffectDuration; var p = n / speed; var q = ((p - 1) * 20 * p + 5) * p + 1; var zoomX = $gamePlayer.screenX(); var zoomY = $gamePlayer.screenY() - 24; if (n === 2) { $gameScreen.setZoom(zoomX, zoomY, 1); this.snapForBattleBackground(); this.startFlashForEncounter(speed / 2); } $gameScreen.setZoom(zoomX, zoomY, q); if (n === Math.floor(speed / 6)) { this.startFlashForEncounter(speed / 2); } if (n === Math.floor(speed / 2)) { BattleManager.playBattleBgm(); this.startFadeOut(this.fadeSpeed()); } } }; Scene_Map.prototype.snapForBattleBackground = function () { this._windowLayer.visible = false; SceneManager.snapForBackground(); this._windowLayer.visible = true; }; Scene_Map.prototype.startFlashForEncounter = function (duration) { var color = [255, 255, 255, 255]; $gameScreen.startFlash(color, duration); }; Scene_Map.prototype.encounterEffectSpeed = function () { return 60; }; //----------------------------------------------------------------------------- // Scene_MenuBase // // The superclass of all the menu-type scenes. function Scene_MenuBase() { this.initialize.apply(this, arguments); } Scene_MenuBase.prototype = Object.create(Scene_Base.prototype); Scene_MenuBase.prototype.constructor = Scene_MenuBase; Scene_MenuBase.prototype.initialize = function () { Scene_Base.prototype.initialize.call(this); }; Scene_MenuBase.prototype.create = function () { Scene_Base.prototype.create.call(this); this.createBackground(); this.updateActor(); this.createWindowLayer(); }; Scene_MenuBase.prototype.actor = function () { return this._actor; }; Scene_MenuBase.prototype.updateActor = function () { this._actor = $gameParty.menuActor(); }; Scene_MenuBase.prototype.createBackground = function () { this._backgroundSprite = new Sprite(); this._backgroundSprite.bitmap = SceneManager.backgroundBitmap(); this.addChild(this._backgroundSprite); }; Scene_MenuBase.prototype.setBackgroundOpacity = function (opacity) { this._backgroundSprite.opacity = opacity; }; Scene_MenuBase.prototype.createHelpWindow = function () { this._helpWindow = new Window_Help(); this.addWindow(this._helpWindow); }; Scene_MenuBase.prototype.nextActor = function () { $gameParty.makeMenuActorNext(); this.updateActor(); this.onActorChange(); }; Scene_MenuBase.prototype.previousActor = function () { $gameParty.makeMenuActorPrevious(); this.updateActor(); this.onActorChange(); }; Scene_MenuBase.prototype.onActorChange = function () { }; //----------------------------------------------------------------------------- // Scene_Menu // // The scene class of the menu screen. function Scene_Menu() { this.initialize.apply(this, arguments); } Scene_Menu.prototype = Object.create(Scene_MenuBase.prototype); Scene_Menu.prototype.constructor = Scene_Menu; Scene_Menu.prototype.initialize = function () { Scene_MenuBase.prototype.initialize.call(this); }; Scene_Menu.prototype.create = function () { Scene_MenuBase.prototype.create.call(this); this.createCommandWindow(); this.createGoldWindow(); this.createStatusWindow(); }; Scene_Menu.prototype.start = function () { Scene_MenuBase.prototype.start.call(this); this._statusWindow.refresh(); }; Scene_Menu.prototype.createCommandWindow = function () { this._commandWindow = new Window_MenuCommand(0, 0); this._commandWindow.setHandler('item', this.commandItem.bind(this)); this._commandWindow.setHandler('skill', this.commandPersonal.bind(this)); this._commandWindow.setHandler('equip', this.commandPersonal.bind(this)); this._commandWindow.setHandler('status', this.commandPersonal.bind(this)); this._commandWindow.setHandler('formation', this.commandFormation.bind(this)); this._commandWindow.setHandler('options', this.commandOptions.bind(this)); this._commandWindow.setHandler('save', this.commandSave.bind(this)); this._commandWindow.setHandler('gameEnd', this.commandGameEnd.bind(this)); this._commandWindow.setHandler('cancel', this.popScene.bind(this)); this.addWindow(this._commandWindow); }; Scene_Menu.prototype.createGoldWindow = function () { this._goldWindow = new Window_Gold(0, 0); this._goldWindow.y = Graphics.boxHeight - this._goldWindow.height; this.addWindow(this._goldWindow); }; Scene_Menu.prototype.createStatusWindow = function () { this._statusWindow = new Window_MenuStatus(this._commandWindow.width, 0); this._statusWindow.reserveFaceImages(); this.addWindow(this._statusWindow); }; Scene_Menu.prototype.commandItem = function () { SceneManager.push(Scene_Item); }; Scene_Menu.prototype.commandPersonal = function () { this._statusWindow.setFormationMode(false); this._statusWindow.selectLast(); this._statusWindow.activate(); this._statusWindow.setHandler('ok', this.onPersonalOk.bind(this)); this._statusWindow.setHandler('cancel', this.onPersonalCancel.bind(this)); }; Scene_Menu.prototype.commandFormation = function () { this._statusWindow.setFormationMode(true); this._statusWindow.selectLast(); this._statusWindow.activate(); this._statusWindow.setHandler('ok', this.onFormationOk.bind(this)); this._statusWindow.setHandler('cancel', this.onFormationCancel.bind(this)); }; Scene_Menu.prototype.commandOptions = function () { SceneManager.push(Scene_Options); }; Scene_Menu.prototype.commandSave = function () { SceneManager.push(Scene_Save); }; Scene_Menu.prototype.commandGameEnd = function () { SceneManager.push(Scene_GameEnd); }; Scene_Menu.prototype.onPersonalOk = function () { switch (this._commandWindow.currentSymbol()) { case 'skill': SceneManager.push(Scene_Skill); break; case 'equip': SceneManager.push(Scene_Equip); break; case 'status': SceneManager.push(Scene_Status); break; } }; Scene_Menu.prototype.onPersonalCancel = function () { this._statusWindow.deselect(); this._commandWindow.activate(); }; Scene_Menu.prototype.onFormationOk = function () { var index = this._statusWindow.index(); var actor = $gameParty.members()[index]; var pendingIndex = this._statusWindow.pendingIndex(); if (pendingIndex >= 0) { $gameParty.swapOrder(index, pendingIndex); this._statusWindow.setPendingIndex(-1); this._statusWindow.redrawItem(index); } else { this._statusWindow.setPendingIndex(index); } this._statusWindow.activate(); }; Scene_Menu.prototype.onFormationCancel = function () { if (this._statusWindow.pendingIndex() >= 0) { this._statusWindow.setPendingIndex(-1); this._statusWindow.activate(); } else { this._statusWindow.deselect(); this._commandWindow.activate(); } }; //----------------------------------------------------------------------------- // Scene_ItemBase // // The superclass of Scene_Item and Scene_Skill. function Scene_ItemBase() { this.initialize.apply(this, arguments); } Scene_ItemBase.prototype = Object.create(Scene_MenuBase.prototype); Scene_ItemBase.prototype.constructor = Scene_ItemBase; Scene_ItemBase.prototype.initialize = function () { Scene_MenuBase.prototype.initialize.call(this); }; Scene_ItemBase.prototype.create = function () { Scene_MenuBase.prototype.create.call(this); }; Scene_ItemBase.prototype.createActorWindow = function () { this._actorWindow = new Window_MenuActor(); this._actorWindow.setHandler('ok', this.onActorOk.bind(this)); this._actorWindow.setHandler('cancel', this.onActorCancel.bind(this)); this.addWindow(this._actorWindow); }; Scene_ItemBase.prototype.item = function () { return this._itemWindow.item(); }; Scene_ItemBase.prototype.user = function () { return null; }; Scene_ItemBase.prototype.isCursorLeft = function () { return this._itemWindow.index() % 2 === 0; }; Scene_ItemBase.prototype.showSubWindow = function (window) { window.x = this.isCursorLeft() ? Graphics.boxWidth - window.width : 0; window.show(); window.activate(); }; Scene_ItemBase.prototype.hideSubWindow = function (window) { window.hide(); window.deactivate(); this.activateItemWindow(); }; Scene_ItemBase.prototype.onActorOk = function () { if (this.canUse()) { this.useItem(); } else { SoundManager.playBuzzer(); } }; Scene_ItemBase.prototype.onActorCancel = function () { this.hideSubWindow(this._actorWindow); }; Scene_ItemBase.prototype.determineItem = function () { var action = new Game_Action(this.user()); var item = this.item(); action.setItemObject(item); if (action.isForFriend()) { this.showSubWindow(this._actorWindow); this._actorWindow.selectForItem(this.item()); } else { this.useItem(); this.activateItemWindow(); } }; Scene_ItemBase.prototype.useItem = function () { this.playSeForItem(); this.user().useItem(this.item()); this.applyItem(); this.checkCommonEvent(); this.checkGameover(); this._actorWindow.refresh(); }; Scene_ItemBase.prototype.activateItemWindow = function () { this._itemWindow.refresh(); this._itemWindow.activate(); }; Scene_ItemBase.prototype.itemTargetActors = function () { var action = new Game_Action(this.user()); action.setItemObject(this.item()); if (!action.isForFriend()) { return []; } else if (action.isForAll()) { return $gameParty.members(); } else { return [$gameParty.members()[this._actorWindow.index()]]; } }; Scene_ItemBase.prototype.canUse = function () { return this.user().canUse(this.item()) && this.isItemEffectsValid(); }; Scene_ItemBase.prototype.isItemEffectsValid = function () { var action = new Game_Action(this.user()); action.setItemObject(this.item()); return this.itemTargetActors().some(function (target) { return action.testApply(target); }, this); }; Scene_ItemBase.prototype.applyItem = function () { var action = new Game_Action(this.user()); action.setItemObject(this.item()); this.itemTargetActors().forEach(function (target) { for (var i = 0; i < action.numRepeats(); i++) { action.apply(target); } }, this); action.applyGlobal(); }; Scene_ItemBase.prototype.checkCommonEvent = function () { if ($gameTemp.isCommonEventReserved()) { SceneManager.goto(Scene_Map); } }; //----------------------------------------------------------------------------- // Scene_Item // // The scene class of the item screen. function Scene_Item() { this.initialize.apply(this, arguments); } Scene_Item.prototype = Object.create(Scene_ItemBase.prototype); Scene_Item.prototype.constructor = Scene_Item; Scene_Item.prototype.initialize = function () { Scene_ItemBase.prototype.initialize.call(this); }; Scene_Item.prototype.create = function () { Scene_ItemBase.prototype.create.call(this); this.createHelpWindow(); this.createCategoryWindow(); this.createItemWindow(); this.createActorWindow(); }; Scene_Item.prototype.createCategoryWindow = function () { this._categoryWindow = new Window_ItemCategory(); this._categoryWindow.setHelpWindow(this._helpWindow); this._categoryWindow.y = this._helpWindow.height; this._categoryWindow.setHandler('ok', this.onCategoryOk.bind(this)); this._categoryWindow.setHandler('cancel', this.popScene.bind(this)); this.addWindow(this._categoryWindow); }; Scene_Item.prototype.createItemWindow = function () { var wy = this._categoryWindow.y + this._categoryWindow.height; var wh = Graphics.boxHeight - wy; this._itemWindow = new Window_ItemList(0, wy, Graphics.boxWidth, wh); this._itemWindow.setHelpWindow(this._helpWindow); this._itemWindow.setHandler('ok', this.onItemOk.bind(this)); this._itemWindow.setHandler('cancel', this.onItemCancel.bind(this)); this.addWindow(this._itemWindow); this._categoryWindow.setItemWindow(this._itemWindow); }; Scene_Item.prototype.user = function () { var members = $gameParty.movableMembers(); var bestActor = members[0]; var bestPha = 0; for (var i = 0; i < members.length; i++) { if (members[i].pha > bestPha) { bestPha = members[i].pha; bestActor = members[i]; } } return bestActor; }; Scene_Item.prototype.onCategoryOk = function () { this._itemWindow.activate(); this._itemWindow.selectLast(); }; Scene_Item.prototype.onItemOk = function () { $gameParty.setLastItem(this.item()); this.determineItem(); }; Scene_Item.prototype.onItemCancel = function () { this._itemWindow.deselect(); this._categoryWindow.activate(); }; Scene_Item.prototype.playSeForItem = function () { SoundManager.playUseItem(); }; Scene_Item.prototype.useItem = function () { Scene_ItemBase.prototype.useItem.call(this); this._itemWindow.redrawCurrentItem(); }; //----------------------------------------------------------------------------- // Scene_Skill // // The scene class of the skill screen. function Scene_Skill() { this.initialize.apply(this, arguments); } Scene_Skill.prototype = Object.create(Scene_ItemBase.prototype); Scene_Skill.prototype.constructor = Scene_Skill; Scene_Skill.prototype.initialize = function () { Scene_ItemBase.prototype.initialize.call(this); }; Scene_Skill.prototype.create = function () { Scene_ItemBase.prototype.create.call(this); this.createHelpWindow(); this.createSkillTypeWindow(); this.createStatusWindow(); this.createItemWindow(); this.createActorWindow(); }; Scene_Skill.prototype.start = function () { Scene_ItemBase.prototype.start.call(this); this.refreshActor(); }; Scene_Skill.prototype.createSkillTypeWindow = function () { var wy = this._helpWindow.height; this._skillTypeWindow = new Window_SkillType(0, wy); this._skillTypeWindow.setHelpWindow(this._helpWindow); this._skillTypeWindow.setHandler('skill', this.commandSkill.bind(this)); this._skillTypeWindow.setHandler('cancel', this.popScene.bind(this)); this._skillTypeWindow.setHandler('pagedown', this.nextActor.bind(this)); this._skillTypeWindow.setHandler('pageup', this.previousActor.bind(this)); this.addWindow(this._skillTypeWindow); }; Scene_Skill.prototype.createStatusWindow = function () { var wx = this._skillTypeWindow.width; var wy = this._helpWindow.height; var ww = Graphics.boxWidth - wx; var wh = this._skillTypeWindow.height; this._statusWindow = new Window_SkillStatus(wx, wy, ww, wh); this._statusWindow.reserveFaceImages(); this.addWindow(this._statusWindow); }; Scene_Skill.prototype.createItemWindow = function () { var wx = 0; var wy = this._statusWindow.y + this._statusWindow.height; var ww = Graphics.boxWidth; var wh = Graphics.boxHeight - wy; this._itemWindow = new Window_SkillList(wx, wy, ww, wh); this._itemWindow.setHelpWindow(this._helpWindow); this._itemWindow.setHandler('ok', this.onItemOk.bind(this)); this._itemWindow.setHandler('cancel', this.onItemCancel.bind(this)); this._skillTypeWindow.setSkillWindow(this._itemWindow); this.addWindow(this._itemWindow); }; Scene_Skill.prototype.refreshActor = function () { var actor = this.actor(); this._skillTypeWindow.setActor(actor); this._statusWindow.setActor(actor); this._itemWindow.setActor(actor); }; Scene_Skill.prototype.user = function () { return this.actor(); }; Scene_Skill.prototype.commandSkill = function () { this._itemWindow.activate(); this._itemWindow.selectLast(); }; Scene_Skill.prototype.onItemOk = function () { this.actor().setLastMenuSkill(this.item()); this.determineItem(); }; Scene_Skill.prototype.onItemCancel = function () { this._itemWindow.deselect(); this._skillTypeWindow.activate(); }; Scene_Skill.prototype.playSeForItem = function () { SoundManager.playUseSkill(); }; Scene_Skill.prototype.useItem = function () { Scene_ItemBase.prototype.useItem.call(this); this._statusWindow.refresh(); this._itemWindow.refresh(); }; Scene_Skill.prototype.onActorChange = function () { this.refreshActor(); this._skillTypeWindow.activate(); }; //----------------------------------------------------------------------------- // Scene_Equip // // The scene class of the equipment screen. function Scene_Equip() { this.initialize.apply(this, arguments); } Scene_Equip.prototype = Object.create(Scene_MenuBase.prototype); Scene_Equip.prototype.constructor = Scene_Equip; Scene_Equip.prototype.initialize = function () { Scene_MenuBase.prototype.initialize.call(this); }; Scene_Equip.prototype.create = function () { Scene_MenuBase.prototype.create.call(this); this.createHelpWindow(); this.createStatusWindow(); this.createCommandWindow(); this.createSlotWindow(); this.createItemWindow(); this.refreshActor(); }; Scene_Equip.prototype.createStatusWindow = function () { this._statusWindow = new Window_EquipStatus(0, this._helpWindow.height); this.addWindow(this._statusWindow); }; Scene_Equip.prototype.createCommandWindow = function () { var wx = this._statusWindow.width; var wy = this._helpWindow.height; var ww = Graphics.boxWidth - this._statusWindow.width; this._commandWindow = new Window_EquipCommand(wx, wy, ww); this._commandWindow.setHelpWindow(this._helpWindow); this._commandWindow.setHandler('equip', this.commandEquip.bind(this)); this._commandWindow.setHandler('optimize', this.commandOptimize.bind(this)); this._commandWindow.setHandler('clear', this.commandClear.bind(this)); this._commandWindow.setHandler('cancel', this.popScene.bind(this)); this._commandWindow.setHandler('pagedown', this.nextActor.bind(this)); this._commandWindow.setHandler('pageup', this.previousActor.bind(this)); this.addWindow(this._commandWindow); }; Scene_Equip.prototype.createSlotWindow = function () { var wx = this._statusWindow.width; var wy = this._commandWindow.y + this._commandWindow.height; var ww = Graphics.boxWidth - this._statusWindow.width; var wh = this._statusWindow.height - this._commandWindow.height; this._slotWindow = new Window_EquipSlot(wx, wy, ww, wh); this._slotWindow.setHelpWindow(this._helpWindow); this._slotWindow.setStatusWindow(this._statusWindow); this._slotWindow.setHandler('ok', this.onSlotOk.bind(this)); this._slotWindow.setHandler('cancel', this.onSlotCancel.bind(this)); this.addWindow(this._slotWindow); }; Scene_Equip.prototype.createItemWindow = function () { var wx = 0; var wy = this._statusWindow.y + this._statusWindow.height; var ww = Graphics.boxWidth; var wh = Graphics.boxHeight - wy; this._itemWindow = new Window_EquipItem(wx, wy, ww, wh); this._itemWindow.setHelpWindow(this._helpWindow); this._itemWindow.setStatusWindow(this._statusWindow); this._itemWindow.setHandler('ok', this.onItemOk.bind(this)); this._itemWindow.setHandler('cancel', this.onItemCancel.bind(this)); this._slotWindow.setItemWindow(this._itemWindow); this.addWindow(this._itemWindow); }; Scene_Equip.prototype.refreshActor = function () { var actor = this.actor(); this._statusWindow.setActor(actor); this._slotWindow.setActor(actor); this._itemWindow.setActor(actor); }; Scene_Equip.prototype.commandEquip = function () { this._slotWindow.activate(); this._slotWindow.select(0); }; Scene_Equip.prototype.commandOptimize = function () { SoundManager.playEquip(); this.actor().optimizeEquipments(); this._statusWindow.refresh(); this._slotWindow.refresh(); this._commandWindow.activate(); }; Scene_Equip.prototype.commandClear = function () { SoundManager.playEquip(); this.actor().clearEquipments(); this._statusWindow.refresh(); this._slotWindow.refresh(); this._commandWindow.activate(); }; Scene_Equip.prototype.onSlotOk = function () { this._itemWindow.activate(); this._itemWindow.select(0); }; Scene_Equip.prototype.onSlotCancel = function () { this._slotWindow.deselect(); this._commandWindow.activate(); }; Scene_Equip.prototype.onItemOk = function () { SoundManager.playEquip(); this.actor().changeEquip(this._slotWindow.index(), this._itemWindow.item()); this._slotWindow.activate(); this._slotWindow.refresh(); this._itemWindow.deselect(); this._itemWindow.refresh(); this._statusWindow.refresh(); }; Scene_Equip.prototype.onItemCancel = function () { this._slotWindow.activate(); this._itemWindow.deselect(); }; Scene_Equip.prototype.onActorChange = function () { this.refreshActor(); this._commandWindow.activate(); }; //----------------------------------------------------------------------------- // Scene_Status // // The scene class of the status screen. function Scene_Status() { this.initialize.apply(this, arguments); } Scene_Status.prototype = Object.create(Scene_MenuBase.prototype); Scene_Status.prototype.constructor = Scene_Status; Scene_Status.prototype.initialize = function () { Scene_MenuBase.prototype.initialize.call(this); }; Scene_Status.prototype.create = function () { Scene_MenuBase.prototype.create.call(this); this._statusWindow = new Window_Status(); this._statusWindow.setHandler('cancel', this.popScene.bind(this)); this._statusWindow.setHandler('pagedown', this.nextActor.bind(this)); this._statusWindow.setHandler('pageup', this.previousActor.bind(this)); this._statusWindow.reserveFaceImages(); this.addWindow(this._statusWindow); }; Scene_Status.prototype.start = function () { Scene_MenuBase.prototype.start.call(this); this.refreshActor(); }; Scene_Status.prototype.refreshActor = function () { var actor = this.actor(); this._statusWindow.setActor(actor); }; Scene_Status.prototype.onActorChange = function () { this.refreshActor(); this._statusWindow.activate(); }; //----------------------------------------------------------------------------- // Scene_Options // // The scene class of the options screen. function Scene_Options() { this.initialize.apply(this, arguments); } Scene_Options.prototype = Object.create(Scene_MenuBase.prototype); Scene_Options.prototype.constructor = Scene_Options; Scene_Options.prototype.initialize = function () { Scene_MenuBase.prototype.initialize.call(this); }; Scene_Options.prototype.create = function () { Scene_MenuBase.prototype.create.call(this); this.createOptionsWindow(); }; Scene_Options.prototype.terminate = function () { Scene_MenuBase.prototype.terminate.call(this); ConfigManager.save(); }; Scene_Options.prototype.createOptionsWindow = function () { this._optionsWindow = new Window_Options(); this._optionsWindow.setHandler('cancel', this.popScene.bind(this)); this.addWindow(this._optionsWindow); }; //----------------------------------------------------------------------------- // Scene_File // // The superclass of Scene_Save and Scene_Load. function Scene_File() { this.initialize.apply(this, arguments); } Scene_File.prototype = Object.create(Scene_MenuBase.prototype); Scene_File.prototype.constructor = Scene_File; Scene_File.prototype.initialize = function () { Scene_MenuBase.prototype.initialize.call(this); }; Scene_File.prototype.create = function () { Scene_MenuBase.prototype.create.call(this); DataManager.loadAllSavefileImages(); this.createHelpWindow(); this.createListWindow(); }; Scene_File.prototype.start = function () { Scene_MenuBase.prototype.start.call(this); this._listWindow.refresh(); }; Scene_File.prototype.savefileId = function () { return this._listWindow.index() + 1; }; Scene_File.prototype.createHelpWindow = function () { this._helpWindow = new Window_Help(1); this._helpWindow.setText(this.helpWindowText()); this.addWindow(this._helpWindow); }; Scene_File.prototype.createListWindow = function () { var x = 0; var y = this._helpWindow.height; var width = Graphics.boxWidth; var height = Graphics.boxHeight - y; this._listWindow = new Window_SavefileList(x, y, width, height); this._listWindow.setHandler('ok', this.onSavefileOk.bind(this)); this._listWindow.setHandler('cancel', this.popScene.bind(this)); this._listWindow.select(this.firstSavefileIndex()); this._listWindow.setTopRow(this.firstSavefileIndex() - 2); this._listWindow.setMode(this.mode()); this._listWindow.refresh(); this.addWindow(this._listWindow); }; Scene_File.prototype.mode = function () { return null; }; Scene_File.prototype.activateListWindow = function () { this._listWindow.activate(); }; Scene_File.prototype.helpWindowText = function () { return ''; }; Scene_File.prototype.firstSavefileIndex = function () { return 0; }; Scene_File.prototype.onSavefileOk = function () { }; //----------------------------------------------------------------------------- // Scene_Save // // The scene class of the save screen. function Scene_Save() { this.initialize.apply(this, arguments); } Scene_Save.prototype = Object.create(Scene_File.prototype); Scene_Save.prototype.constructor = Scene_Save; Scene_Save.prototype.initialize = function () { Scene_File.prototype.initialize.call(this); }; Scene_Save.prototype.mode = function () { return 'save'; }; Scene_Save.prototype.helpWindowText = function () { return TextManager.saveMessage; }; Scene_Save.prototype.firstSavefileIndex = function () { return DataManager.lastAccessedSavefileId() - 1; }; Scene_Save.prototype.onSavefileOk = function () { Scene_File.prototype.onSavefileOk.call(this); $gameSystem.onBeforeSave(); if (DataManager.saveGame(this.savefileId())) { this.onSaveSuccess(); } else { this.onSaveFailure(); } }; Scene_Save.prototype.onSaveSuccess = function () { SoundManager.playSave(); StorageManager.cleanBackup(this.savefileId()); this.popScene(); }; Scene_Save.prototype.onSaveFailure = function () { SoundManager.playBuzzer(); this.activateListWindow(); }; //----------------------------------------------------------------------------- // Scene_Load // // The scene class of the load screen. function Scene_Load() { this.initialize.apply(this, arguments); } Scene_Load.prototype = Object.create(Scene_File.prototype); Scene_Load.prototype.constructor = Scene_Load; Scene_Load.prototype.initialize = function () { Scene_File.prototype.initialize.call(this); this._loadSuccess = false; }; Scene_Load.prototype.terminate = function () { Scene_File.prototype.terminate.call(this); if (this._loadSuccess) { $gameSystem.onAfterLoad(); } }; Scene_Load.prototype.mode = function () { return 'load'; }; Scene_Load.prototype.helpWindowText = function () { return TextManager.loadMessage; }; Scene_Load.prototype.firstSavefileIndex = function () { return DataManager.latestSavefileId() - 1; }; Scene_Load.prototype.onSavefileOk = function () { Scene_File.prototype.onSavefileOk.call(this); if (DataManager.loadGame(this.savefileId())) { this.onLoadSuccess(); } else { this.onLoadFailure(); } }; Scene_Load.prototype.onLoadSuccess = function () { SoundManager.playLoad(); this.fadeOutAll(); this.reloadMapIfUpdated(); SceneManager.goto(Scene_Map); this._loadSuccess = true; }; Scene_Load.prototype.onLoadFailure = function () { SoundManager.playBuzzer(); this.activateListWindow(); }; Scene_Load.prototype.reloadMapIfUpdated = function () { if ($gameSystem.versionId() !== $dataSystem.versionId) { $gamePlayer.reserveTransfer($gameMap.mapId(), $gamePlayer.x, $gamePlayer.y); $gamePlayer.requestMapReload(); } }; //----------------------------------------------------------------------------- // Scene_GameEnd // // The scene class of the game end screen. function Scene_GameEnd() { this.initialize.apply(this, arguments); } Scene_GameEnd.prototype = Object.create(Scene_MenuBase.prototype); Scene_GameEnd.prototype.constructor = Scene_GameEnd; Scene_GameEnd.prototype.initialize = function () { Scene_MenuBase.prototype.initialize.call(this); }; Scene_GameEnd.prototype.create = function () { Scene_MenuBase.prototype.create.call(this); this.createCommandWindow(); }; Scene_GameEnd.prototype.stop = function () { Scene_MenuBase.prototype.stop.call(this); this._commandWindow.close(); }; Scene_GameEnd.prototype.createBackground = function () { Scene_MenuBase.prototype.createBackground.call(this); this.setBackgroundOpacity(128); }; Scene_GameEnd.prototype.createCommandWindow = function () { this._commandWindow = new Window_GameEnd(); this._commandWindow.setHandler('toTitle', this.commandToTitle.bind(this)); this._commandWindow.setHandler('cancel', this.popScene.bind(this)); this.addWindow(this._commandWindow); }; Scene_GameEnd.prototype.commandToTitle = function () { this.fadeOutAll(); SceneManager.goto(Scene_Title); }; //----------------------------------------------------------------------------- // Scene_Shop // // The scene class of the shop screen. function Scene_Shop() { this.initialize.apply(this, arguments); } Scene_Shop.prototype = Object.create(Scene_MenuBase.prototype); Scene_Shop.prototype.constructor = Scene_Shop; Scene_Shop.prototype.initialize = function () { Scene_MenuBase.prototype.initialize.call(this); }; Scene_Shop.prototype.prepare = function (goods, purchaseOnly) { this._goods = goods; this._purchaseOnly = purchaseOnly; this._item = null; }; Scene_Shop.prototype.create = function () { Scene_MenuBase.prototype.create.call(this); this.createHelpWindow(); this.createGoldWindow(); this.createCommandWindow(); this.createDummyWindow(); this.createNumberWindow(); this.createStatusWindow(); this.createBuyWindow(); this.createCategoryWindow(); this.createSellWindow(); }; Scene_Shop.prototype.createGoldWindow = function () { this._goldWindow = new Window_Gold(0, this._helpWindow.height); this._goldWindow.x = Graphics.boxWidth - this._goldWindow.width; this.addWindow(this._goldWindow); }; Scene_Shop.prototype.createCommandWindow = function () { this._commandWindow = new Window_ShopCommand(this._goldWindow.x, this._purchaseOnly); this._commandWindow.y = this._helpWindow.height; this._commandWindow.setHandler('buy', this.commandBuy.bind(this)); this._commandWindow.setHandler('sell', this.commandSell.bind(this)); this._commandWindow.setHandler('cancel', this.popScene.bind(this)); this.addWindow(this._commandWindow); }; Scene_Shop.prototype.createDummyWindow = function () { var wy = this._commandWindow.y + this._commandWindow.height; var wh = Graphics.boxHeight - wy; this._dummyWindow = new Window_Base(0, wy, Graphics.boxWidth, wh); this.addWindow(this._dummyWindow); }; Scene_Shop.prototype.createNumberWindow = function () { var wy = this._dummyWindow.y; var wh = this._dummyWindow.height; this._numberWindow = new Window_ShopNumber(0, wy, wh); this._numberWindow.hide(); this._numberWindow.setHandler('ok', this.onNumberOk.bind(this)); this._numberWindow.setHandler('cancel', this.onNumberCancel.bind(this)); this.addWindow(this._numberWindow); }; Scene_Shop.prototype.createStatusWindow = function () { var wx = this._numberWindow.width; var wy = this._dummyWindow.y; var ww = Graphics.boxWidth - wx; var wh = this._dummyWindow.height; this._statusWindow = new Window_ShopStatus(wx, wy, ww, wh); this._statusWindow.hide(); this.addWindow(this._statusWindow); }; Scene_Shop.prototype.createBuyWindow = function () { var wy = this._dummyWindow.y; var wh = this._dummyWindow.height; this._buyWindow = new Window_ShopBuy(0, wy, wh, this._goods); this._buyWindow.setHelpWindow(this._helpWindow); this._buyWindow.setStatusWindow(this._statusWindow); this._buyWindow.hide(); this._buyWindow.setHandler('ok', this.onBuyOk.bind(this)); this._buyWindow.setHandler('cancel', this.onBuyCancel.bind(this)); this.addWindow(this._buyWindow); }; Scene_Shop.prototype.createCategoryWindow = function () { this._categoryWindow = new Window_ItemCategory(); this._categoryWindow.setHelpWindow(this._helpWindow); this._categoryWindow.y = this._dummyWindow.y; this._categoryWindow.hide(); this._categoryWindow.deactivate(); this._categoryWindow.setHandler('ok', this.onCategoryOk.bind(this)); this._categoryWindow.setHandler('cancel', this.onCategoryCancel.bind(this)); this.addWindow(this._categoryWindow); }; Scene_Shop.prototype.createSellWindow = function () { var wy = this._categoryWindow.y + this._categoryWindow.height; var wh = Graphics.boxHeight - wy; this._sellWindow = new Window_ShopSell(0, wy, Graphics.boxWidth, wh); this._sellWindow.setHelpWindow(this._helpWindow); this._sellWindow.hide(); this._sellWindow.setHandler('ok', this.onSellOk.bind(this)); this._sellWindow.setHandler('cancel', this.onSellCancel.bind(this)); this._categoryWindow.setItemWindow(this._sellWindow); this.addWindow(this._sellWindow); }; Scene_Shop.prototype.activateBuyWindow = function () { this._buyWindow.setMoney(this.money()); this._buyWindow.show(); this._buyWindow.activate(); this._statusWindow.show(); }; Scene_Shop.prototype.activateSellWindow = function () { this._categoryWindow.show(); this._sellWindow.refresh(); this._sellWindow.show(); this._sellWindow.activate(); this._statusWindow.hide(); }; Scene_Shop.prototype.commandBuy = function () { this._dummyWindow.hide(); this.activateBuyWindow(); }; Scene_Shop.prototype.commandSell = function () { this._dummyWindow.hide(); this._categoryWindow.show(); this._categoryWindow.activate(); this._sellWindow.show(); this._sellWindow.deselect(); this._sellWindow.refresh(); }; Scene_Shop.prototype.onBuyOk = function () { this._item = this._buyWindow.item(); this._buyWindow.hide(); this._numberWindow.setup(this._item, this.maxBuy(), this.buyingPrice()); this._numberWindow.setCurrencyUnit(this.currencyUnit()); this._numberWindow.show(); this._numberWindow.activate(); }; Scene_Shop.prototype.onBuyCancel = function () { this._commandWindow.activate(); this._dummyWindow.show(); this._buyWindow.hide(); this._statusWindow.hide(); this._statusWindow.setItem(null); this._helpWindow.clear(); }; Scene_Shop.prototype.onCategoryOk = function () { this.activateSellWindow(); this._sellWindow.select(0); }; Scene_Shop.prototype.onCategoryCancel = function () { this._commandWindow.activate(); this._dummyWindow.show(); this._categoryWindow.hide(); this._sellWindow.hide(); }; Scene_Shop.prototype.onSellOk = function () { this._item = this._sellWindow.item(); this._categoryWindow.hide(); this._sellWindow.hide(); this._numberWindow.setup(this._item, this.maxSell(), this.sellingPrice()); this._numberWindow.setCurrencyUnit(this.currencyUnit()); this._numberWindow.show(); this._numberWindow.activate(); this._statusWindow.setItem(this._item); this._statusWindow.show(); }; Scene_Shop.prototype.onSellCancel = function () { this._sellWindow.deselect(); this._categoryWindow.activate(); this._statusWindow.setItem(null); this._helpWindow.clear(); }; Scene_Shop.prototype.onNumberOk = function () { SoundManager.playShop(); switch (this._commandWindow.currentSymbol()) { case 'buy': this.doBuy(this._numberWindow.number()); break; case 'sell': this.doSell(this._numberWindow.number()); break; } this.endNumberInput(); this._goldWindow.refresh(); this._statusWindow.refresh(); }; Scene_Shop.prototype.onNumberCancel = function () { SoundManager.playCancel(); this.endNumberInput(); }; Scene_Shop.prototype.doBuy = function (number) { $gameParty.loseGold(number * this.buyingPrice()); $gameParty.gainItem(this._item, number); }; Scene_Shop.prototype.doSell = function (number) { $gameParty.gainGold(number * this.sellingPrice()); $gameParty.loseItem(this._item, number); }; Scene_Shop.prototype.endNumberInput = function () { this._numberWindow.hide(); switch (this._commandWindow.currentSymbol()) { case 'buy': this.activateBuyWindow(); break; case 'sell': this.activateSellWindow(); break; } }; Scene_Shop.prototype.maxBuy = function () { var max = $gameParty.maxItems(this._item) - $gameParty.numItems(this._item); var price = this.buyingPrice(); if (price > 0) { return Math.min(max, Math.floor(this.money() / price)); } else { return max; } }; Scene_Shop.prototype.maxSell = function () { return $gameParty.numItems(this._item); }; Scene_Shop.prototype.money = function () { return this._goldWindow.value(); }; Scene_Shop.prototype.currencyUnit = function () { return this._goldWindow.currencyUnit(); }; Scene_Shop.prototype.buyingPrice = function () { return this._buyWindow.price(this._item); }; Scene_Shop.prototype.sellingPrice = function () { return Math.floor(this._item.price / 2); }; //----------------------------------------------------------------------------- // Scene_Name // // The scene class of the name input screen. function Scene_Name() { this.initialize.apply(this, arguments); } Scene_Name.prototype = Object.create(Scene_MenuBase.prototype); Scene_Name.prototype.constructor = Scene_Name; Scene_Name.prototype.initialize = function () { Scene_MenuBase.prototype.initialize.call(this); }; Scene_Name.prototype.prepare = function (actorId, maxLength) { this._actorId = actorId; this._maxLength = maxLength; }; Scene_Name.prototype.create = function () { Scene_MenuBase.prototype.create.call(this); this._actor = $gameActors.actor(this._actorId); this.createEditWindow(); this.createInputWindow(); }; Scene_Name.prototype.start = function () { Scene_MenuBase.prototype.start.call(this); this._editWindow.refresh(); }; Scene_Name.prototype.createEditWindow = function () { this._editWindow = new Window_NameEdit(this._actor, this._maxLength); this.addWindow(this._editWindow); }; Scene_Name.prototype.createInputWindow = function () { this._inputWindow = new Window_NameInput(this._editWindow); this._inputWindow.setHandler('ok', this.onInputOk.bind(this)); this.addWindow(this._inputWindow); }; Scene_Name.prototype.onInputOk = function () { this._actor.setName(this._editWindow.name()); this.popScene(); }; //----------------------------------------------------------------------------- // Scene_Debug // // The scene class of the debug screen. function Scene_Debug() { this.initialize.apply(this, arguments); } Scene_Debug.prototype = Object.create(Scene_MenuBase.prototype); Scene_Debug.prototype.constructor = Scene_Debug; Scene_Debug.prototype.initialize = function () { Scene_MenuBase.prototype.initialize.call(this); }; Scene_Debug.prototype.create = function () { Scene_MenuBase.prototype.create.call(this); this.createRangeWindow(); this.createEditWindow(); this.createDebugHelpWindow(); }; Scene_Debug.prototype.createRangeWindow = function () { this._rangeWindow = new Window_DebugRange(0, 0); this._rangeWindow.setHandler('ok', this.onRangeOk.bind(this)); this._rangeWindow.setHandler('cancel', this.popScene.bind(this)); this.addWindow(this._rangeWindow); }; Scene_Debug.prototype.createEditWindow = function () { var wx = this._rangeWindow.width; var ww = Graphics.boxWidth - wx; this._editWindow = new Window_DebugEdit(wx, 0, ww); this._editWindow.setHandler('cancel', this.onEditCancel.bind(this)); this._rangeWindow.setEditWindow(this._editWindow); this.addWindow(this._editWindow); }; Scene_Debug.prototype.createDebugHelpWindow = function () { var wx = this._editWindow.x; var wy = this._editWindow.height; var ww = this._editWindow.width; var wh = Graphics.boxHeight - wy; this._debugHelpWindow = new Window_Base(wx, wy, ww, wh); this.addWindow(this._debugHelpWindow); }; Scene_Debug.prototype.onRangeOk = function () { this._editWindow.activate(); this._editWindow.select(0); this.refreshHelpWindow(); }; Scene_Debug.prototype.onEditCancel = function () { this._rangeWindow.activate(); this._editWindow.deselect(); this.refreshHelpWindow(); }; Scene_Debug.prototype.refreshHelpWindow = function () { this._debugHelpWindow.contents.clear(); if (this._editWindow.active) { this._debugHelpWindow.drawTextEx(this.helpText(), 4, 0); } }; Scene_Debug.prototype.helpText = function () { if (this._rangeWindow.mode() === 'switch') { return 'Enter : ON / OFF'; } else { return ('Left : -1\n' + 'Right : +1\n' + 'Pageup : -10\n' + 'Pagedown : +10'); } }; //----------------------------------------------------------------------------- // Scene_Battle // // The scene class of the battle screen. function Scene_Battle() { this.initialize.apply(this, arguments); } Scene_Battle.prototype = Object.create(Scene_Base.prototype); Scene_Battle.prototype.constructor = Scene_Battle; Scene_Battle.prototype.initialize = function () { Scene_Base.prototype.initialize.call(this); }; Scene_Battle.prototype.create = function () { Scene_Base.prototype.create.call(this); this.createDisplayObjects(); }; Scene_Battle.prototype.start = function () { Scene_Base.prototype.start.call(this); this.startFadeIn(this.fadeSpeed(), false); BattleManager.playBattleBgm(); BattleManager.startBattle(); }; Scene_Battle.prototype.update = function () { var active = this.isActive(); $gameTimer.update(active); $gameScreen.update(); this.updateStatusWindow(); this.updateWindowPositions(); if (active && !this.isBusy()) { this.updateBattleProcess(); } Scene_Base.prototype.update.call(this); }; Scene_Battle.prototype.updateBattleProcess = function () { if (!this.isAnyInputWindowActive() || BattleManager.isAborting() || BattleManager.isBattleEnd()) { BattleManager.update(); this.changeInputWindow(); } }; Scene_Battle.prototype.isAnyInputWindowActive = function () { return (this._partyCommandWindow.active || this._actorCommandWindow.active || this._skillWindow.active || this._itemWindow.active || this._actorWindow.active || this._enemyWindow.active); }; Scene_Battle.prototype.changeInputWindow = function () { if (BattleManager.isInputting()) { if (BattleManager.actor()) { this.startActorCommandSelection(); } else { this.startPartyCommandSelection(); } } else { this.endCommandSelection(); } }; Scene_Battle.prototype.stop = function () { Scene_Base.prototype.stop.call(this); if (this.needsSlowFadeOut()) { this.startFadeOut(this.slowFadeSpeed(), false); } else { this.startFadeOut(this.fadeSpeed(), false); } this._statusWindow.close(); this._partyCommandWindow.close(); this._actorCommandWindow.close(); }; Scene_Battle.prototype.terminate = function () { Scene_Base.prototype.terminate.call(this); $gameParty.onBattleEnd(); $gameTroop.onBattleEnd(); AudioManager.stopMe(); ImageManager.clearRequest(); }; Scene_Battle.prototype.needsSlowFadeOut = function () { return (SceneManager.isNextScene(Scene_Title) || SceneManager.isNextScene(Scene_Gameover)); }; Scene_Battle.prototype.updateStatusWindow = function () { if ($gameMessage.isBusy()) { this._statusWindow.close(); this._partyCommandWindow.close(); this._actorCommandWindow.close(); } else if (this.isActive() && !this._messageWindow.isClosing()) { this._statusWindow.open(); } }; Scene_Battle.prototype.updateWindowPositions = function () { var statusX = 0; if (BattleManager.isInputting()) { statusX = this._partyCommandWindow.width; } else { statusX = this._partyCommandWindow.width / 2; } if (this._statusWindow.x < statusX) { this._statusWindow.x += 16; if (this._statusWindow.x > statusX) { this._statusWindow.x = statusX; } } if (this._statusWindow.x > statusX) { this._statusWindow.x -= 16; if (this._statusWindow.x < statusX) { this._statusWindow.x = statusX; } } }; Scene_Battle.prototype.createDisplayObjects = function () { this.createSpriteset(); this.createWindowLayer(); this.createAllWindows(); BattleManager.setLogWindow(this._logWindow); BattleManager.setStatusWindow(this._statusWindow); BattleManager.setSpriteset(this._spriteset); this._logWindow.setSpriteset(this._spriteset); }; Scene_Battle.prototype.createSpriteset = function () { this._spriteset = new Spriteset_Battle(); this.addChild(this._spriteset); }; Scene_Battle.prototype.createAllWindows = function () { this.createLogWindow(); this.createStatusWindow(); this.createPartyCommandWindow(); this.createActorCommandWindow(); this.createHelpWindow(); this.createSkillWindow(); this.createItemWindow(); this.createActorWindow(); this.createEnemyWindow(); this.createMessageWindow(); this.createScrollTextWindow(); }; Scene_Battle.prototype.createLogWindow = function () { this._logWindow = new Window_BattleLog(); this.addWindow(this._logWindow); }; Scene_Battle.prototype.createStatusWindow = function () { this._statusWindow = new Window_BattleStatus(); this.addWindow(this._statusWindow); }; Scene_Battle.prototype.createPartyCommandWindow = function () { this._partyCommandWindow = new Window_PartyCommand(); this._partyCommandWindow.setHandler('fight', this.commandFight.bind(this)); this._partyCommandWindow.setHandler('escape', this.commandEscape.bind(this)); this._partyCommandWindow.deselect(); this.addWindow(this._partyCommandWindow); }; Scene_Battle.prototype.createActorCommandWindow = function () { this._actorCommandWindow = new Window_ActorCommand(); this._actorCommandWindow.setHandler('attack', this.commandAttack.bind(this)); this._actorCommandWindow.setHandler('skill', this.commandSkill.bind(this)); this._actorCommandWindow.setHandler('guard', this.commandGuard.bind(this)); this._actorCommandWindow.setHandler('item', this.commandItem.bind(this)); this._actorCommandWindow.setHandler('cancel', this.selectPreviousCommand.bind(this)); this.addWindow(this._actorCommandWindow); }; Scene_Battle.prototype.createHelpWindow = function () { this._helpWindow = new Window_Help(); this._helpWindow.visible = false; this.addWindow(this._helpWindow); }; Scene_Battle.prototype.createSkillWindow = function () { var wy = this._helpWindow.y + this._helpWindow.height; var wh = this._statusWindow.y - wy; this._skillWindow = new Window_BattleSkill(0, wy, Graphics.boxWidth, wh); this._skillWindow.setHelpWindow(this._helpWindow); this._skillWindow.setHandler('ok', this.onSkillOk.bind(this)); this._skillWindow.setHandler('cancel', this.onSkillCancel.bind(this)); this.addWindow(this._skillWindow); }; Scene_Battle.prototype.createItemWindow = function () { var wy = this._helpWindow.y + this._helpWindow.height; var wh = this._statusWindow.y - wy; this._itemWindow = new Window_BattleItem(0, wy, Graphics.boxWidth, wh); this._itemWindow.setHelpWindow(this._helpWindow); this._itemWindow.setHandler('ok', this.onItemOk.bind(this)); this._itemWindow.setHandler('cancel', this.onItemCancel.bind(this)); this.addWindow(this._itemWindow); }; Scene_Battle.prototype.createActorWindow = function () { this._actorWindow = new Window_BattleActor(0, this._statusWindow.y); this._actorWindow.setHandler('ok', this.onActorOk.bind(this)); this._actorWindow.setHandler('cancel', this.onActorCancel.bind(this)); this.addWindow(this._actorWindow); }; Scene_Battle.prototype.createEnemyWindow = function () { this._enemyWindow = new Window_BattleEnemy(0, this._statusWindow.y); this._enemyWindow.x = Graphics.boxWidth - this._enemyWindow.width; this._enemyWindow.setHandler('ok', this.onEnemyOk.bind(this)); this._enemyWindow.setHandler('cancel', this.onEnemyCancel.bind(this)); this.addWindow(this._enemyWindow); }; Scene_Battle.prototype.createMessageWindow = function () { this._messageWindow = new Window_Message(); this.addWindow(this._messageWindow); this._messageWindow.subWindows().forEach(function (window) { this.addWindow(window); }, this); }; Scene_Battle.prototype.createScrollTextWindow = function () { this._scrollTextWindow = new Window_ScrollText(); this.addWindow(this._scrollTextWindow); }; Scene_Battle.prototype.refreshStatus = function () { this._statusWindow.refresh(); }; Scene_Battle.prototype.startPartyCommandSelection = function () { this.refreshStatus(); this._statusWindow.deselect(); this._statusWindow.open(); this._actorCommandWindow.close(); this._partyCommandWindow.setup(); }; Scene_Battle.prototype.commandFight = function () { this.selectNextCommand(); }; Scene_Battle.prototype.commandEscape = function () { BattleManager.processEscape(); this.changeInputWindow(); }; Scene_Battle.prototype.startActorCommandSelection = function () { this._statusWindow.select(BattleManager.actor().index()); this._partyCommandWindow.close(); this._actorCommandWindow.setup(BattleManager.actor()); }; Scene_Battle.prototype.commandAttack = function () { BattleManager.inputtingAction().setAttack(); this.selectEnemySelection(); }; Scene_Battle.prototype.commandSkill = function () { this._skillWindow.setActor(BattleManager.actor()); this._skillWindow.setStypeId(this._actorCommandWindow.currentExt()); this._skillWindow.refresh(); this._skillWindow.show(); this._skillWindow.activate(); }; Scene_Battle.prototype.commandGuard = function () { BattleManager.inputtingAction().setGuard(); this.selectNextCommand(); }; Scene_Battle.prototype.commandItem = function () { this._itemWindow.refresh(); this._itemWindow.show(); this._itemWindow.activate(); }; Scene_Battle.prototype.selectNextCommand = function () { BattleManager.selectNextCommand(); this.changeInputWindow(); }; Scene_Battle.prototype.selectPreviousCommand = function () { BattleManager.selectPreviousCommand(); this.changeInputWindow(); }; Scene_Battle.prototype.selectActorSelection = function () { this._actorWindow.refresh(); this._actorWindow.show(); this._actorWindow.activate(); }; Scene_Battle.prototype.onActorOk = function () { var action = BattleManager.inputtingAction(); action.setTarget(this._actorWindow.index()); this._actorWindow.hide(); this._skillWindow.hide(); this._itemWindow.hide(); this.selectNextCommand(); }; Scene_Battle.prototype.onActorCancel = function () { this._actorWindow.hide(); switch (this._actorCommandWindow.currentSymbol()) { case 'skill': this._skillWindow.show(); this._skillWindow.activate(); break; case 'item': this._itemWindow.show(); this._itemWindow.activate(); break; } }; Scene_Battle.prototype.selectEnemySelection = function () { this._enemyWindow.refresh(); this._enemyWindow.show(); this._enemyWindow.select(0); this._enemyWindow.activate(); }; Scene_Battle.prototype.onEnemyOk = function () { var action = BattleManager.inputtingAction(); action.setTarget(this._enemyWindow.enemyIndex()); this._enemyWindow.hide(); this._skillWindow.hide(); this._itemWindow.hide(); this.selectNextCommand(); }; Scene_Battle.prototype.onEnemyCancel = function () { this._enemyWindow.hide(); switch (this._actorCommandWindow.currentSymbol()) { case 'attack': this._actorCommandWindow.activate(); break; case 'skill': this._skillWindow.show(); this._skillWindow.activate(); break; case 'item': this._itemWindow.show(); this._itemWindow.activate(); break; } }; Scene_Battle.prototype.onSkillOk = function () { var skill = this._skillWindow.item(); var action = BattleManager.inputtingAction(); action.setSkill(skill.id); BattleManager.actor().setLastBattleSkill(skill); this.onSelectAction(); }; Scene_Battle.prototype.onSkillCancel = function () { this._skillWindow.hide(); this._actorCommandWindow.activate(); }; Scene_Battle.prototype.onItemOk = function () { var item = this._itemWindow.item(); var action = BattleManager.inputtingAction(); action.setItem(item.id); $gameParty.setLastItem(item); this.onSelectAction(); }; Scene_Battle.prototype.onItemCancel = function () { this._itemWindow.hide(); this._actorCommandWindow.activate(); }; Scene_Battle.prototype.onSelectAction = function () { var action = BattleManager.inputtingAction(); this._skillWindow.hide(); this._itemWindow.hide(); if (!action.needsSelection()) { this.selectNextCommand(); } else if (action.isForOpponent()) { this.selectEnemySelection(); } else { this.selectActorSelection(); } }; Scene_Battle.prototype.endCommandSelection = function () { this._partyCommandWindow.close(); this._actorCommandWindow.close(); this._statusWindow.deselect(); }; //----------------------------------------------------------------------------- // Scene_Gameover // // The scene class of the game over screen. function Scene_Gameover() { this.initialize.apply(this, arguments); } Scene_Gameover.prototype = Object.create(Scene_Base.prototype); Scene_Gameover.prototype.constructor = Scene_Gameover; Scene_Gameover.prototype.initialize = function () { Scene_Base.prototype.initialize.call(this); }; Scene_Gameover.prototype.create = function () { Scene_Base.prototype.create.call(this); this.playGameoverMusic(); this.createBackground(); }; Scene_Gameover.prototype.start = function () { Scene_Base.prototype.start.call(this); this.startFadeIn(this.slowFadeSpeed(), false); }; Scene_Gameover.prototype.update = function () { if (this.isActive() && !this.isBusy() && this.isTriggered()) { this.gotoTitle(); } Scene_Base.prototype.update.call(this); }; Scene_Gameover.prototype.stop = function () { Scene_Base.prototype.stop.call(this); this.fadeOutAll(); }; Scene_Gameover.prototype.terminate = function () { Scene_Base.prototype.terminate.call(this); AudioManager.stopAll(); }; Scene_Gameover.prototype.playGameoverMusic = function () { AudioManager.stopBgm(); AudioManager.stopBgs(); AudioManager.playMe($dataSystem.gameoverMe); }; Scene_Gameover.prototype.createBackground = function () { this._backSprite = new Sprite(); this._backSprite.bitmap = ImageManager.loadSystem('GameOver'); this.addChild(this._backSprite); }; Scene_Gameover.prototype.isTriggered = function () { return Input.isTriggered('ok') || TouchInput.isTriggered(); }; Scene_Gameover.prototype.gotoTitle = function () { SceneManager.goto(Scene_Title); };
dazed/translations
www/js/rpg_scenes.js
JavaScript
unknown
79,033