/**
* Суперкласс для всех окон в игре
* The superclass of all windows within the game
*
* @class Window_Base
* @augments Window
*/
function Window_Base() {
this.initialize.apply(this, arguments);
}
Window_Base.prototype = Object.create(Window.prototype);
Window_Base.prototype.constructor = Window_Base;
/**
* Инициализирует объект класса
*
* initialize
* @param {Number} x - Координата X
* @param {Number} y - Координата Y
* @param {Number} width - Ширина окна
* @param {Number} height - Высота окна
*/
Window_Base.prototype.initialize = function(x, y, width, height) {
};
/**
* Ширина иконки
*
* @private
* @type {Number}
*/
Window_Base._iconWidth = 32;
/**
* Высота иконки
*
* @private
* @type {Number}
*/
Window_Base._iconHeight = 32;
/**
* Ширина портрета
*
* @private
* @type {Number}
*/
Window_Base._faceWidth = 144;
/**
* Высота портрета
*
* @private
* @type {Number}
*/
Window_Base._faceHeight = 144;
/**
* Возвращает высоту строки
*
* lineHeight
* @returns {Number} Высота строки
*/
Window_Base.prototype.lineHeight = function() {
};
/**
* Возвращает стандартное название шрифта
*
* standardFontFace
* @returns {String} Название шрифта
*/
Window_Base.prototype.standardFontFace = function() {
};
/**
* Возвращает стандартный размер шрифта
*
* standardFontSize
* @returns {Number} Размер шрифта
*/
Window_Base.prototype.standardFontSize = function() {
};
/**
* Возвращает отступ контента внутри окна
*
* standardPadding
* @returns {Number} Отступ контента внутри окна
*/
Window_Base.prototype.standardPadding = function() {
};
/**
* Возвращает отступ для текста
*
* textPadding
* @returns {Number} Отступ для текста
*/
Window_Base.prototype.textPadding = function() {
};
/**
* Возвращает стандартную прозрачность заднего фона окна
*
* standardBackOpacity
* @returns {Number} Прозрачность заднего фона окна
*/
Window_Base.prototype.standardBackOpacity = function() {
};
/**
* Загружает обложку окна
*
* loadWindowskin
*/
Window_Base.prototype.loadWindowskin = function() {
};
/**
* Обновляет отступ контента
*
* updatePadding
*/
Window_Base.prototype.updatePadding = function() {
};
/**
* Обновляет прозрачность заднего фона окна
*
* updateBackOpacity
*/
Window_Base.prototype.updateBackOpacity = function() {
};
/**
* Возвращает ширину контента
*
* contentsWidth
* @returns {Number} Ширина контента
*/
Window_Base.prototype.contentsWidth = function() {
};
/**
* Возвращает высоту контента
*
* contentsHeight
* @returns {Number} Высота контента
*/
Window_Base.prototype.contentsHeight = function() {
};
/**
* Возвращает высоту окна по количеству строк
*
* fittingHeight
* @param {Number} numLines - Количество строк
* @returns {Number} Высота окна
*/
Window_Base.prototype.fittingHeight = function(numLines) {
};
/**
* Обновляет тон окна
*
* updateTone
*/
Window_Base.prototype.updateTone = function() {
};
/**
* Создает контент
*
* createContents
*/
Window_Base.prototype.createContents = function() {
};
/**
* Сбрасывает параметры шрифта у контента
*
* resetFontSettings
*/
Window_Base.prototype.resetFontSettings = function() {
};
/**
* Сбрасывает цвет текста у контента
*
* resetTextColor
*/
Window_Base.prototype.resetTextColor = function() {
};
/**
* Обновляет окно
*
* update
*/
Window_Base.prototype.update = function() {
};
/**
* Обновляет открытие окна
*
* updateOpen
*/
Window_Base.prototype.updateOpen = function() {
};
/**
* Обновляет закрытие окна
*
* updateClose
*/
Window_Base.prototype.updateClose = function() {
};
/**
* Открывает окно
*
* open
*/
Window_Base.prototype.open = function() {
};
/**
* Закрывает окно
*
* close
*/
Window_Base.prototype.close = function() {
};
/**
* Возвращает true, если окно открывается
*
* isOpening
* @returns {Boolean} Окно открывается
*/
Window_Base.prototype.isOpening = function() {
};
/**
* Возвращает true, если окно закрывается
*
* isClosing
* @returns {Boolean} Окно закрывается
*/
Window_Base.prototype.isClosing = function() {
};
/**
* Показывает окно
*
* show
*/
Window_Base.prototype.show = function() {
};
/**
* Скрывает окно
*
* hide
*/
Window_Base.prototype.hide = function() {
};
/**
* Активирует окно
*
* activate
*/
Window_Base.prototype.activate = function() {
};
/**
* Деактивирует окно
*
* deactivate
*/
Window_Base.prototype.deactivate = function() {
};
/**
* Возвращает цвет текста в формате hex из обложки окна
*
* textColor
* @param {Number} n - Номер цвета
* @returns {String} Цвет текста
*/
Window_Base.prototype.textColor = function(n) {
};
/**
* Возвращает цвет текста из обложки под номером 0
*
* normalColor
* @returns {String} Цвет текста
*/
Window_Base.prototype.normalColor = function() {
};
/**
* Возвращает цвет текста из обложки под номером 16
*
* systemColor
* @returns {String} Цвет текста
*/
Window_Base.prototype.systemColor = function() {
};
/**
* Возвращает цвет текста из обложки под номером 17
*
* crisisColor
* @returns {String} Цвет текста
*/
Window_Base.prototype.crisisColor = function() {
};
/**
* Возвращает цвет текста из обложки под номером 18
*
* deathColor
* @returns {String} Цвет текста
*/
Window_Base.prototype.deathColor = function() {
};
/**
* Возвращает цвет текста из обложки под номером 19
*
* gaugeBackColor
* @returns {String} Цвет текста
*/
Window_Base.prototype.gaugeBackColor = function() {
};
/**
* Возвращает цвет текста из обложки под номером 20
*
* hpGaugeColor1
* @returns {String} Цвет текста
*/
Window_Base.prototype.hpGaugeColor1 = function() {
};
/**
* Возвращает цвет текста из обложки под номером 21
*
* hpGaugeColor2
* @returns {String} Цвет текста
*/
Window_Base.prototype.hpGaugeColor2 = function() {
};
/**
* Возвращает цвет текста из обложки под номером 22
*
* mpGaugeColor1
* @returns {String} Цвет текста
*/
Window_Base.prototype.mpGaugeColor1 = function() {
};
/**
* Возвращает цвет текста из обложки под номером 23
*
* mpGaugeColor2
* @returns {String} Цвет текста
*/
Window_Base.prototype.mpGaugeColor2 = function() {
};
/**
* Возвращает цвет текста из обложки под номером 23
*
* mpCostColor
* @returns {String} Цвет текста
*/
Window_Base.prototype.mpCostColor;
/**
* Возвращает цвет текста из обложки под номером 24
*
* powerUpColor
* @returns {String} Цвет текста
*/
Window_Base.prototype.powerUpColor;
/**
* Возвращает цвет текста из обложки под номером 25
*
* powerDownColor
* @returns {String} Цвет текста
*/
Window_Base.prototype.powerDownColor;
/**
* Возвращает цвет текста из обложки под номером 28
*
* tpGaugeColor1
* @returns {String} Цвет текста
*/
Window_Base.prototype.tpGaugeColor1;
/**
* Возвращает цвет текста из обложки под номером 29
*
* tpGaugeColor2
* @returns {String} Цвет текста
*/
Window_Base.prototype.tpGaugeColor2;
/**
* Возвращает цвет текста из обложки под номером 29
*
* tpCostColor
* @returns {String} Цвет текста
*/
Window_Base.prototype.tpCostColor;
/**
* Возвращает цвет ожидания в формате hex
*
* pendingColor
* @returns {String} Цвет в формате hex
*/
Window_Base.prototype.pendingColor;
/**
* Возвращает значение полупрозрачности
*
* translucentOpacity
* @returns {Number} Значение полупрозрачности
*/
Window_Base.prototype.translucentOpacity;
/**
* Меняет цвет текста
*
* changeTextColor
* @param {String} color - Цвет текста в формате hex
*/
Window_Base.prototype.changeTextColor;
/**
* Меняет прозрачность рисования
*
* changePaintOpacity
* @param {Boolean} enabled - Включить полную непрозрачность
*/
Window_Base.prototype.changePaintOpacity;
/**
* Рисует текст
*
* drawText
* @param {String} text - Рисуемый текст
* @param {Number} x - Координата X
* @param {Number} y - Координата Y
* @param {Number} maxWidth - Максимальная ширина
* @param {String} align - Выравнивание текста
*/
Window_Base.prototype.drawText;
/**
* Возвращает ширину текста
*
* textWidth
* @param {String} text - Текст
* @returns {Number} Ширина текста
*/
Window_Base.prototype.textWidth;
/**
* Рисует текст, обрабатывая специальные символы
* Возвращает ширину нарисованного текста
*
* drawTextEx
* @param {String} text - Рисуемый текст
* @param {Number} x - Координата X
* @param {Number} y - Координата Y
* @returns {Number} Ширина нарисованного текста
*/
Window_Base.prototype.drawTextEx;
/**
* Конвертирует специальные символы в тексте
*
* convertEscapeCharacters
* @param {String} text - Текст
* @returns {String}
*/
Window_Base.prototype.convertEscapeCharacters;
/**
* Возвращает имя персонажа
*
* actorName
* @param {Number} n - ID персонажа
* @returns {String} Имя персонажа
*/
Window_Base.prototype.actorName;
/**
* Возвращает имя персонажа
*
* partyMemberName
* @param {Number} n - Номер персонажа в партии
* @returns {String} Имя персонажа
*/
Window_Base.prototype.partyMemberName;
Window_Base.prototype.processCharacter = function(textState) {
switch (textState.text[textState.index]) {
case '\n':
this.processNewLine(textState);
break;
case '\f':
this.processNewPage(textState);
break;
case '\x1b':
this.processEscapeCharacter(this.obtainEscapeCode(textState), textState);
break;
default:
this.processNormalCharacter(textState);
break;
}
};
Window_Base.prototype.processNormalCharacter = function(textState) {
var c = textState.text[textState.index++];
var w = this.textWidth(c);
this.contents.drawText(c, textState.x, textState.y, w * 2, textState.height);
textState.x += w;
};
Window_Base.prototype.processNewLine = function(textState) {
textState.x = textState.left;
textState.y += textState.height;
textState.height = this.calcTextHeight(textState, false);
textState.index++;
};
Window_Base.prototype.processNewPage = function(textState) {
textState.index++;
};
Window_Base.prototype.obtainEscapeCode = function(textState) {
textState.index++;
var regExp = /^[\$\.\|\^!><\{\}\\]|^[A-Z]+/i;
var arr = regExp.exec(textState.text.slice(textState.index));
if (arr) {
textState.index += arr[0].length;
return arr[0].toUpperCase();
} else {
return '';
}
};
Window_Base.prototype.obtainEscapeParam = function(textState) {
var arr = /^\[\d+\]/.exec(textState.text.slice(textState.index));
if (arr) {
textState.index += arr[0].length;
return parseInt(arr[0].slice(1));
} else {
return '';
}
};
Window_Base.prototype.processEscapeCharacter = function(code, textState) {
switch (code) {
case 'C':
this.changeTextColor(this.textColor(this.obtainEscapeParam(textState)));
break;
case 'I':
this.processDrawIcon(this.obtainEscapeParam(textState), textState);
break;
case '{':
this.makeFontBigger();
break;
case '}':
this.makeFontSmaller();
break;
}
};
Window_Base.prototype.processDrawIcon = function(iconIndex, textState) {
this.drawIcon(iconIndex, textState.x + 2, textState.y + 2);
textState.x += Window_Base._iconWidth + 4;
};
Window_Base.prototype.makeFontBigger = function() {
if (this.contents.fontSize <= 96) {
this.contents.fontSize += 12;
}
};
Window_Base.prototype.makeFontSmaller = function() {
if (this.contents.fontSize >= 24) {
this.contents.fontSize -= 12;
}
};
Window_Base.prototype.calcTextHeight = function(textState, all) {
var lastFontSize = this.contents.fontSize;
var textHeight = 0;
var lines = textState.text.slice(textState.index).split('\n');
var maxLines = all ? lines.length : 1;
for (var i = 0; i < maxLines; i++) {
var maxFontSize = this.contents.fontSize;
var regExp = /\x1b[\{\}]/g;
for (;;) {
var array = regExp.exec(lines[i]);
if (array) {
if (array[0] === '\x1b{') {
this.makeFontBigger();
}
if (array[0] === '\x1b}') {
this.makeFontSmaller();
}
if (maxFontSize < this.contents.fontSize) {
maxFontSize = this.contents.fontSize;
}
} else {
break;
}
}
textHeight += maxFontSize + 8;
}
this.contents.fontSize = lastFontSize;
return textHeight;
};
/**
* Рисует иконку
*
* drawIcon
* @param {Number} iconIndex - Номер иконки
* @param {Number} x - Координата X
* @param {Number} y - Координата Y
*/
Window_Base.prototype.drawIcon;
/**
* Рисует портрет персонажа
*
* drawFace
* @param {String} faceName - Название портрета
* @param {Number} faceIndex - Номер портрета
* @param {Number} x - Координата X
* @param {Number} y - Координата Y
* @param {Number} width - Ширина портрета
* @param {Number} height - Высота портрета
*/
Window_Base.prototype.drawFace;
Window_Base.prototype.drawCharacter = function(characterName, characterIndex, x, y) {
var bitmap = ImageManager.loadCharacter(characterName);
var big = ImageManager.isBigCharacter(characterName);
var pw = bitmap.width / (big ? 3 : 12);
var ph = bitmap.height / (big ? 4 : 8);
var n = characterIndex;
var sx = (n % 4 * 3 + 1) * pw;
var sy = (Math.floor(n / 4) * 4) * ph;
this.contents.blt(bitmap, sx, sy, pw, ph, x - pw / 2, y - ph);
};
Window_Base.prototype.drawGauge = function(x, y, width, rate, color1, color2) {
var fillW = Math.floor(width * rate);
var gaugeY = y + this.lineHeight() - 8;
this.contents.fillRect(x, gaugeY, width, 6, this.gaugeBackColor());
this.contents.gradientFillRect(x, gaugeY, fillW, 6, color1, color2);
};
Window_Base.prototype.hpColor = function(actor) {
if (actor.isDead()) {
return this.deathColor();
} else if (actor.isDying()) {
return this.crisisColor();
} else {
return this.normalColor();
}
};
Window_Base.prototype.mpColor = function(actor) {
return this.normalColor();
};
Window_Base.prototype.tpColor = function(actor) {
return this.normalColor();
};
Window_Base.prototype.drawActorCharacter = function(actor, x, y) {
this.drawCharacter(actor.characterName(), actor.characterIndex(), x, y);
};
/**
* Рисует портрет персонажа
*
* drawActorFace
* @param {Game_Actor} actor - Персонаж
* @param {Number} x - Координата X
* @param {Number} y - Координата Y
* @param {Number} width - Ширина портрета
* @param {Number} height - Высота портрета
*/
Window_Base.prototype.drawActorFace;
/**
* Рисует имя персонажа
*
* drawActorName
* @param {Game_Actor} actor - Персонаж
* @param {Number} x - Координата X
* @param {Number} y - Координата Y
* @param {Number} width - Ширина
*/
Window_Base.prototype.drawActorName;
Window_Base.prototype.drawActorClass = function(actor, x, y, width) {
width = width || 168;
this.resetTextColor();
this.drawText(actor.currentClass().name, x, y, width);
};
Window_Base.prototype.drawActorNickname = function(actor, x, y, width) {
width = width || 270;
this.resetTextColor();
this.drawText(actor.nickname(), x, y, width);
};
Window_Base.prototype.drawActorLevel = function(actor, x, y) {
this.changeTextColor(this.systemColor());
this.drawText(TextManager.levelA, x, y, 48);
this.resetTextColor();
this.drawText(actor.level, x + 84, y, 36, 'right');
};
Window_Base.prototype.drawActorIcons = function(actor, x, y, width) {
width = width || 144;
var icons = actor.allIcons().slice(0, Math.floor(width / Window_Base._iconWidth));
for (var i = 0; i < icons.length; i++) {
this.drawIcon(icons[i], x + Window_Base._iconWidth * i, y + 2);
}
};
/**
* Рисует текущее и максимальное значения
*
* @param {Number} current - Текущее значение
* @param {Number} max - Максимальное значение
* @param {Number} x - Координата X
* @param {Number} y - Координата Y
* @param {Number} width - Ширина
* @param {String} color1 - Цвет текущего значения
* @param {String} color2 - Цвет максимального значения
*/
Window_Base.prototype.drawCurrentAndMax;
Window_Base.prototype.drawActorHp = function(actor, x, y, width) {
width = width || 186;
var color1 = this.hpGaugeColor1();
var color2 = this.hpGaugeColor2();
this.drawGauge(x, y, width, actor.hpRate(), color1, color2);
this.changeTextColor(this.systemColor());
this.drawText(TextManager.hpA, x, y, 44);
this.drawCurrentAndMax(actor.hp, actor.mhp, x, y, width,
this.hpColor(actor), this.normalColor());
};
Window_Base.prototype.drawActorMp = function(actor, x, y, width) {
width = width || 186;
var color1 = this.mpGaugeColor1();
var color2 = this.mpGaugeColor2();
this.drawGauge(x, y, width, actor.mpRate(), color1, color2);
this.changeTextColor(this.systemColor());
this.drawText(TextManager.mpA, x, y, 44);
this.drawCurrentAndMax(actor.mp, actor.mmp, x, y, width,
this.mpColor(actor), this.normalColor());
};
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(actor.tp, x + width - 64, y, 64, 'right');
};
Window_Base.prototype.drawActorSimpleStatus = function(actor, x, y, width) {
var lineHeight = this.lineHeight();
var x2 = x + 180;
var width2 = Math.min(200, width - 180 - 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);
this.drawActorHp(actor, x2, y + lineHeight * 1, width2);
this.drawActorMp(actor, x2, y + lineHeight * 2, width2);
};
Window_Base.prototype.drawItemName = function(item, x, y, width) {
width = width || 312;
if (item) {
var iconBoxWidth = Window_Base._iconWidth + 4;
this.resetTextColor();
this.drawIcon(item.iconIndex, x + 2, y + 2);
this.drawText(item.name, x + iconBoxWidth, y, width - iconBoxWidth);
}
};
Window_Base.prototype.drawCurrencyValue = function(value, unit, x, y, width) {
var unitWidth = Math.min(80, this.textWidth(unit));
this.resetTextColor();
this.drawText(value, x, y, width - unitWidth - 6, 'right');
this.changeTextColor(this.systemColor());
this.drawText(unit, x + width - unitWidth, y, unitWidth, 'right');
};
Window_Base.prototype.paramchangeTextColor = function(change) {
if (change > 0) {
return this.powerUpColor();
} else if (change < 0) {
return this.powerDownColor();
} else {
return this.normalColor();
}
};
Window_Base.prototype.setBackgroundType = function(type) {
if (type === 0) {
this.opacity = 255;
} else {
this.opacity = 0;
}
if (type === 1) {
this.showBackgroundDimmer();
} else {
this.hideBackgroundDimmer();
}
};
Window_Base.prototype.showBackgroundDimmer = function() {
if (!this._dimmerSprite) {
this._dimmerSprite = new Sprite();
this._dimmerSprite.bitmap = new Bitmap(0, 0);
this.addChildToBack(this._dimmerSprite);
}
var bitmap = this._dimmerSprite.bitmap;
if (bitmap.width !== this.width || bitmap.height !== this.height) {
this.refreshDimmerBitmap();
}
this._dimmerSprite.visible = true;
this.updateBackgroundDimmer();
};
Window_Base.prototype.hideBackgroundDimmer = function() {
if (this._dimmerSprite) {
this._dimmerSprite.visible = false;
}
};
Window_Base.prototype.updateBackgroundDimmer = function() {
if (this._dimmerSprite) {
this._dimmerSprite.opacity = this.openness;
}
};
Window_Base.prototype.refreshDimmerBitmap = function() {
if (this._dimmerSprite) {
var bitmap = this._dimmerSprite.bitmap;
var w = this.width;
var h = this.height;
var m = this.padding;
var c1 = this.dimColor1();
var c2 = this.dimColor2();
bitmap.resize(w, h);
bitmap.gradientFillRect(0, 0, w, m, c2, c1, true);
bitmap.fillRect(0, m, w, h - m * 2, c1);
bitmap.gradientFillRect(0, h - m, w, m, c1, c2, true);
this._dimmerSprite.setFrame(0, 0, w, h);
}
};
Window_Base.prototype.dimColor1 = function() {
return 'rgba(0, 0, 0, 0.6)';
};
Window_Base.prototype.dimColor2 = function() {
return 'rgba(0, 0, 0, 0)';
};
Window_Base.prototype.canvasToLocalX = function(x) {
var node = this;
while (node) {
x -= node.x;
node = node.parent;
}
return x;
};
Window_Base.prototype.canvasToLocalY = function(y) {
var node = this;
while (node) {
y -= node.y;
node = node.parent;
}
return y;
};
/**
* Класс окна с перемещающимся курсором и функциями прокрутки
* The window class with cursor movement and scroll functions
*
* @class Window_Selectable
* @augments Window_Base
*/
function Window_Selectable() {
this.initialize.apply(this, arguments);
}
Window_Selectable.prototype = Object.create(Window_Base.prototype);
Window_Selectable.prototype.constructor = Window_Selectable;
/**
* Инициализирует объект класса
*
* initialize
* @param {Number} x - Координата X
* @param {Number} y - Координата Y
* @param {Number} width - Ширина окна
* @param {Number} height - Высота окна
*/
Window_Selectable.prototype.initialize;
/**
* Возвращает номер текущей команды
*
* index
* @returns {Number} Номер текущей команды
*/
Window_Selectable.prototype.index;
Window_Selectable.prototype.cursorFixed = function() {
return this._cursorFixed;
};
Window_Selectable.prototype.setCursorFixed = function(cursorFixed) {
this._cursorFixed = cursorFixed;
};
Window_Selectable.prototype.cursorAll = function() {
return this._cursorAll;
};
Window_Selectable.prototype.setCursorAll = function(cursorAll) {
this._cursorAll = cursorAll;
};
/**
* Возвращает максимальное количество столбцов
*
* maxCols
* @returns {Number} Максимальное количество столбцов
*/
Window_Selectable.prototype.maxCols;
Window_Selectable.prototype.maxItems = function() {
return 0;
};
Window_Selectable.prototype.spacing = function() {
return 12;
};
/**
* Возвращает ширину команды
*
* itemWidth
* @returns {Number} Ширина команды
*/
Window_Selectable.prototype.itemWidth;
/**
* Возвращает высоту команды
*
* itemHeight
* @returns {Number} Высота команды
*/
Window_Selectable.prototype.itemHeight;
/**
* Возвращает максимальное количество рядов
*
* maxRows
* @returns {Number} Максимальное количество рядов
*/
Window_Selectable.prototype.maxRows;
/**
* Активирует окно
*
* activate
*/
Window_Selectable.prototype.activate;
/**
* Деактивирует окно
*
* deactivate
*/
Window_Selectable.prototype.deactivate;
/**
* Выбирает команду
*
* select
* @param {Number} index - Номер команды
*/
Window_Selectable.prototype.select;
Window_Selectable.prototype.deselect = function() {
this.select(-1);
};
Window_Selectable.prototype.reselect = function() {
this.select(this._index);
};
Window_Selectable.prototype.row = function() {
return Math.floor(this.index() / this.maxCols());
};
Window_Selectable.prototype.topRow = function() {
return Math.floor(this._scrollY / this.itemHeight());
};
Window_Selectable.prototype.maxTopRow = function() {
return Math.max(0, this.maxRows() - this.maxPageRows());
};
Window_Selectable.prototype.setTopRow = function(row) {
var scrollY = row.clamp(0, this.maxTopRow()) * this.itemHeight();
if (this._scrollY !== scrollY) {
this._scrollY = scrollY;
this.refresh();
this.updateCursor();
}
};
Window_Selectable.prototype.resetScroll = function() {
this.setTopRow(0);
};
Window_Selectable.prototype.maxPageRows = function() {
var pageHeight = this.height - this.padding * 2;
return Math.floor(pageHeight / this.itemHeight());
};
Window_Selectable.prototype.maxPageItems = function() {
return this.maxPageRows() * this.maxCols();
};
Window_Selectable.prototype.isHorizontal = function() {
return this.maxPageRows() === 1;
};
Window_Selectable.prototype.bottomRow = function() {
return Math.max(0, this.topRow() + this.maxPageRows() - 1);
};
Window_Selectable.prototype.setBottomRow = function(row) {
this.setTopRow(row - (this.maxPageRows() - 1));
};
Window_Selectable.prototype.topIndex = function() {
return this.topRow() * this.maxCols();
};
Window_Selectable.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;
rect.y = Math.floor(index / maxCols) * rect.height - this._scrollY;
return rect;
};
Window_Selectable.prototype.itemRectForText = function(index) {
var rect = this.itemRect(index);
rect.x += this.textPadding();
rect.width -= this.textPadding() * 2;
return rect;
};
Window_Selectable.prototype.setHelpWindow = function(helpWindow) {
this._helpWindow = helpWindow;
this.callUpdateHelp();
};
/**
* Показывает окно помощи
*
* showHelpWindow
*/
Window_Selectable.prototype.showHelpWindow;
/**
* Скрывает окно помощи
*
* hideHelpWindow
*/
Window_Selectable.prototype.hideHelpWindow;
Window_Selectable.prototype.setHandler = function(symbol, method) {
this._handlers[symbol] = method;
};
Window_Selectable.prototype.isHandled = function(symbol) {
return !!this._handlers[symbol];
};
Window_Selectable.prototype.callHandler = function(symbol) {
if (this.isHandled(symbol)) {
this._handlers[symbol]();
}
};
/**
* Возвращает true, если окно открыто и активно
*
* isOpenAndActive
* @returns {Boolean} Окно открыто и активно
*/
Window_Selectable.prototype.isOpenAndActive;
Window_Selectable.prototype.isCursorMovable = function() {
return (this.isOpenAndActive() && !this._cursorFixed &&
!this._cursorAll && this.maxItems() > 0);
};
Window_Selectable.prototype.cursorDown = function(wrap) {
var index = this.index();
var maxItems = this.maxItems();
var maxCols = this.maxCols();
if (index < maxItems - maxCols || (wrap && maxCols === 1)) {
this.select((index + maxCols) % maxItems);
}
};
Window_Selectable.prototype.cursorUp = function(wrap) {
var index = this.index();
var maxItems = this.maxItems();
var maxCols = this.maxCols();
if (index >= maxCols || (wrap && maxCols === 1)) {
this.select((index - maxCols + maxItems) % maxItems);
}
};
Window_Selectable.prototype.cursorRight = function(wrap) {
var index = this.index();
var maxItems = this.maxItems();
var maxCols = this.maxCols();
if (maxCols >= 2 && (index < maxItems - 1 || (wrap && this.isHorizontal()))) {
this.select((index + 1) % maxItems);
}
};
Window_Selectable.prototype.cursorLeft = function(wrap) {
var index = this.index();
var maxItems = this.maxItems();
var maxCols = this.maxCols();
if (maxCols >= 2 && (index > 0 || (wrap && this.isHorizontal()))) {
this.select((index - 1 + maxItems) % maxItems);
}
};
Window_Selectable.prototype.cursorPagedown = function() {
var index = this.index();
var maxItems = this.maxItems();
if (this.topRow() + this.maxPageRows() < this.maxRows()) {
this.setTopRow(this.topRow() + this.maxPageRows());
this.select(Math.min(index + this.maxPageItems(), maxItems - 1));
}
};
Window_Selectable.prototype.cursorPageup = function() {
var index = this.index();
if (this.topRow() > 0) {
this.setTopRow(this.topRow() - this.maxPageRows());
this.select(Math.max(index - this.maxPageItems(), 0));
}
};
Window_Selectable.prototype.scrollDown = function() {
if (this.topRow() + 1 < this.maxRows()) {
this.setTopRow(this.topRow() + 1);
}
};
Window_Selectable.prototype.scrollUp = function() {
if (this.topRow() > 0) {
this.setTopRow(this.topRow() - 1);
}
};
/**
* Обновляет окно
*
* update
*/
Window_Selectable.prototype.update;
/**
* Обновляет стрелки окна
*
* updateArrows
*/
Window_Selectable.prototype.updateArrows;
Window_Selectable.prototype.processCursorMove = function() {
if (this.isCursorMovable()) {
var lastIndex = this.index();
if (Input.isRepeated('down')) {
this.cursorDown(Input.isTriggered('down'));
}
if (Input.isRepeated('up')) {
this.cursorUp(Input.isTriggered('up'));
}
if (Input.isRepeated('right')) {
this.cursorRight(Input.isTriggered('right'));
}
if (Input.isRepeated('left')) {
this.cursorLeft(Input.isTriggered('left'));
}
if (!this.isHandled('pagedown') && Input.isTriggered('pagedown')) {
this.cursorPagedown();
}
if (!this.isHandled('pageup') && Input.isTriggered('pageup')) {
this.cursorPageup();
}
if (this.index() !== lastIndex) {
SoundManager.playCursor();
}
}
};
Window_Selectable.prototype.processHandling = function() {
if (this.isOpenAndActive()) {
if (this.isOkEnabled() && this.isOkTriggered()) {
this.processOk();
} else if (this.isCancelEnabled() && this.isCancelTriggered()) {
this.processCancel();
} else if (this.isHandled('pagedown') && Input.isTriggered('pagedown')) {
this.processPagedown();
} else if (this.isHandled('pageup') && Input.isTriggered('pageup')) {
this.processPageup();
}
}
};
Window_Selectable.prototype.processWheel = function() {
if (this.isOpenAndActive()) {
var threshold = 20;
if (TouchInput.wheelY >= threshold) {
this.scrollDown();
}
if (TouchInput.wheelY <= -threshold) {
this.scrollUp();
}
}
};
Window_Selectable.prototype.processTouch = function() {
if (this.isOpenAndActive()) {
if (TouchInput.isTriggered() && this.isTouchedInsideFrame()) {
this._touching = true;
this.onTouch(true);
} else if (TouchInput.isCancelled()) {
if (this.isCancelEnabled()) {
this.processCancel();
}
}
if (this._touching) {
if (TouchInput.isPressed()) {
this.onTouch(false);
} else {
this._touching = false;
}
}
} else {
this._touching = false;
}
};
Window_Selectable.prototype.isTouchedInsideFrame = function() {
var x = this.canvasToLocalX(TouchInput.x);
var y = this.canvasToLocalY(TouchInput.y);
return x >= 0 && y >= 0 && x < this.width && y < this.height;
};
Window_Selectable.prototype.onTouch = function(triggered) {
var lastIndex = this.index();
var x = this.canvasToLocalX(TouchInput.x);
var y = this.canvasToLocalY(TouchInput.y);
var hitIndex = this.hitTest(x, y);
if (hitIndex >= 0) {
if (hitIndex === this.index()) {
if (triggered && this.isTouchOkEnabled()) {
this.processOk();
}
} else if (this.isCursorMovable()) {
this.select(hitIndex);
}
} else if (this._stayCount >= 10) {
if (y < this.padding) {
this.cursorUp();
} else if (y >= this.height - this.padding) {
this.cursorDown();
}
}
if (this.index() !== lastIndex) {
SoundManager.playCursor();
}
};
Window_Selectable.prototype.hitTest = function(x, y) {
if (this.isContentsArea(x, y)) {
var cx = x - this.padding;
var cy = y - this.padding;
var topIndex = this.topIndex();
for (var i = 0; i < this.maxPageItems(); i++) {
var index = topIndex + i;
if (index < this.maxItems()) {
var rect = this.itemRect(index);
var right = rect.x + rect.width;
var bottom = rect.y + rect.height;
if (cx >= rect.x && cy >= rect.y && cx < right && cy < bottom) {
return index;
}
}
}
}
return -1;
};
Window_Selectable.prototype.isContentsArea = function(x, y) {
var left = this.padding;
var top = this.padding;
var right = this.width - this.padding;
var bottom = this.height - this.padding;
return (x >= left && y >= top && x < right && y < bottom);
};
Window_Selectable.prototype.isTouchOkEnabled = function() {
return this.isOkEnabled();
};
Window_Selectable.prototype.isOkEnabled = function() {
return this.isHandled('ok');
};
Window_Selectable.prototype.isCancelEnabled = function() {
return this.isHandled('cancel');
};
Window_Selectable.prototype.isOkTriggered = function() {
return Input.isRepeated('ok');
};
Window_Selectable.prototype.isCancelTriggered = function() {
return Input.isRepeated('cancel');
};
Window_Selectable.prototype.processOk = function() {
if (this.isCurrentItemEnabled()) {
this.playOkSound();
this.updateInputData();
this.deactivate();
this.callOkHandler();
} else {
this.playBuzzerSound();
}
};
Window_Selectable.prototype.playOkSound = function() {
SoundManager.playOk();
};
Window_Selectable.prototype.playBuzzerSound = function() {
SoundManager.playBuzzer();
};
Window_Selectable.prototype.callOkHandler = function() {
this.callHandler('ok');
};
Window_Selectable.prototype.processCancel = function() {
SoundManager.playCancel();
this.updateInputData();
this.deactivate();
this.callCancelHandler();
};
Window_Selectable.prototype.callCancelHandler = function() {
this.callHandler('cancel');
};
Window_Selectable.prototype.processPageup = function() {
SoundManager.playCursor();
this.updateInputData();
this.deactivate();
this.callHandler('pageup');
};
Window_Selectable.prototype.processPagedown = function() {
SoundManager.playCursor();
this.updateInputData();
this.deactivate();
this.callHandler('pagedown');
};
Window_Selectable.prototype.updateInputData = function() {
Input.update();
TouchInput.update();
};
Window_Selectable.prototype.updateCursor = function() {
if (this._cursorAll) {
var allRowsHeight = this.maxRows() * this.itemHeight();
this.setCursorRect(0, 0, this.contents.width, allRowsHeight);
this.setTopRow(0);
} else if (this.isCursorVisible()) {
var rect = this.itemRect(this.index());
this.setCursorRect(rect.x, rect.y, rect.width, rect.height);
} else {
this.setCursorRect(0, 0, 0, 0);
}
};
Window_Selectable.prototype.isCursorVisible = function() {
var row = this.row();
return row >= this.topRow() && row <= this.bottomRow();
};
Window_Selectable.prototype.ensureCursorVisible = function() {
var row = this.row();
if (row < this.topRow()) {
this.setTopRow(row);
} else if (row > this.bottomRow()) {
this.setBottomRow(row);
}
};
Window_Selectable.prototype.callUpdateHelp = function() {
if (this.active && this._helpWindow) {
this.updateHelp();
}
};
Window_Selectable.prototype.updateHelp = function() {
this._helpWindow.clear();
};
Window_Selectable.prototype.setHelpWindowItem = function(item) {
if (this._helpWindow) {
this._helpWindow.setItem(item);
}
};
Window_Selectable.prototype.isCurrentItemEnabled = function() {
return true;
};
Window_Selectable.prototype.drawAllItems = function() {
var topIndex = this.topIndex();
for (var i = 0; i < this.maxPageItems(); i++) {
var index = topIndex + i;
if (index < this.maxItems()) {
this.drawItem(index);
}
}
};
/**
* Рисует команду
*
* drawItem
* @param {Number} index - Номер команды
*/
Window_Selectable.prototype.drawItem;
Window_Selectable.prototype.clearItem = function(index) {
var rect = this.itemRect(index);
this.contents.clearRect(rect.x, rect.y, rect.width, rect.height);
};
/**
* Перерисовывает команду
*
* redrawItem
* @param {Number} index - Номер команды
*/
Window_Selectable.prototype.redrawItem;
/**
* Перерисовывает текущую команду
*
* redrawCurrentItem
*/
Window_Selectable.prototype.redrawCurrentItem;
/**
* Перерисовывает окно
*
* refresh
*/
Window_Selectable.prototype.refresh;
/**
* Суперкласс окон с выбором команд
* The superclass of windows for selecting a command
*
* @class Window_Command
* @augments Window_Selectable
*/
function Window_Command() {
this.initialize.apply(this, arguments);
}
Window_Command.prototype = Object.create(Window_Selectable.prototype);
Window_Command.prototype.constructor = Window_Command;
/**
* Инициализирует объект класса
*
* initialize
* @param {Number} x - Координата X
* @param {Number} y - Координата Y
*/
Window_Command.prototype.initialize;
/**
* Возвращает ширину окна
*
* windowWidth
* @returns {Number} Ширина окна
*/
Window_Command.prototype.windowWidth;
/**
* Возвращает высоту окна
*
* windowHeight
* @returns {Number} Высота окна
*/
Window_Command.prototype.windowHeight;
/**
* Возвращает количество видимых рядов
*
* numVisibleRows
* @returns {Number} Количество видимых рядов
*/
Window_Command.prototype.numVisibleRows;
/**
* Возвращает количество команд
*
* maxItems
* @returns {Number} Количество команд
*/
Window_Command.prototype.maxItems;
/**
* Очищает список команд
*
* clearCommandList
*/
Window_Command.prototype.clearCommandList;
/**
* Создает список команд
*
* makeCommandList
*/
Window_Command.prototype.makeCommandList;
/**
* Добавляет команду в список
*
* addCommand
* @param {String} name - Название команды
* @param {String} symbol - Символ команды
* @param {Boolean} [enabled] - Активность команды
* @param [ext] - Дополнительные данные команды
*/
Window_Command.prototype.addCommand;
/**
* Возвращает название команды
*
* commandName
* @param {Number} index - Номер команды
* @returns {String} Название команды
*/
Window_Command.prototype.commandName;
/**
* Возвращает символ команды
*
* commandSymbol
* @param {Number} index - Номер команды
* @returns {String} Символ команды
*/
Window_Command.prototype.commandSymbol;
/**
* Возвращает true, если команда активна
*
* isCommandEnabled
* @param {Number} index - Номер команды
* @returns {Boolean} Команда активна
*/
Window_Command.prototype.isCommandEnabled;
/**
* Возвращает объект текущей команды
*
* currentData
* @returns {Object | null} Объект текущей команды
*/
Window_Command.prototype.currentData;
/**
* Возвращает true, если текущая команда активна
*
* isCurrentItemEnabled
* @returns {Boolean} Текущая команда активна
*/
Window_Command.prototype.isCurrentItemEnabled;
/**
* Возвращает символ текущей команды
*
* currentSymbol
* @returns {* | null} Символ текущей команды
*/
Window_Command.prototype.currentSymbol;
/**
* Возвращает дополнительные данные о текущей команде
*
* currentExt
* @returns {* | null} Дополнительные данные текущей команды
*/
Window_Command.prototype.currentExt;
/**
* Находит команду по символу
* Возвращает номер команды
*
* findSymbol
* @param {String} symbol - Символ команды
* @returns {Number} Номер команды
*/
Window_Command.prototype.findSymbol;
/**
* Выбирает команду по символу
*
* selectSymbol
* @param {String} symbol - Символ команды
*/
Window_Command.prototype.selectSymbol;
/**
* Находит команду по дополнительной информации
* Возвращает номер команды
*
* findExt
* @param ext - Дополнительная информация
* @returns {Number} Номер команды
*/
Window_Command.prototype.findExt;
/**
* Выбирает команду по дополнительной информации
*
* selectExt
* @param ext - Символ команды
*/
Window_Command.prototype.selectExt;
/**
* Рисует команду
*
* drawItem
* @param {Number} index - Номер команды
*/
Window_Command.prototype.drawItem;
/**
* Возвращает выравнивание текста команд
*
* itemTextAlign
* @returns {String} Выравнивание текста команд
*/
Window_Command.prototype.itemTextAlign;
/**
* Возвращает true, если на команду можно нажимать
*
* isOkEnabled
* @returns {Boolean} На команду можно нажимать
*/
Window_Command.prototype.isOkEnabled;
/**
* Вызывает обработчик нажатия на команду
*
* callOkHandler
*/
Window_Command.prototype.callOkHandler;
/**
* Перерисовывает окно
*
* refresh
*/
Window_Command.prototype.refresh;
/**
* Окно с горизонтальным выбором команд
* The command window for the horizontal selection format
*
* @class Window_HorzCommand
* @augments Window_Command
*/
function Window_HorzCommand() {
this.initialize.apply(this, arguments);
}
Window_HorzCommand.prototype = Object.create(Window_Command.prototype);
Window_HorzCommand.prototype.constructor = Window_HorzCommand;
/**
* Инициализирует объект класса
*
* initialize
* @param {Number} x - Координата X
* @param {Number} y - Координата Y
*/
Window_HorzCommand.prototype.initialize;
/**
* Возвращает количество видимых рядов
*
* numVisibleRows
* @returns {Number} Количество видимых рядов
*/
Window_HorzCommand.prototype.numVisibleRows;
/**
* Возвращает максимальное количество столбцов
*
* maxCols
* @returns {Number} Максимальное количество столбцов
*/
Window_HorzCommand.prototype.maxCols;
/**
* Возвращает выравнивание текста команд
*
* itemTextAlign
* @returns {String} Выравнивание текста команд
*/
Window_HorzCommand.prototype.itemTextAlign;
/**
* Окно для отображения описания выбранного предмета
* The window for displaying the description of the selected item
*
* @class Window_Help
* @augments Window_Base
*/
function Window_Help() {
this.initialize.apply(this, arguments);
}
Window_Help.prototype = Object.create(Window_Base.prototype);
Window_Help.prototype.constructor = Window_Help;
/**
* Инициализирует объект класса
*
* initialize
* @param {Number} numLines - Количество рядов
*/
Window_Help.prototype.initialize;
/**
* Устанавливает текст
*
* setText
* @param {String} text - Текст
*/
Window_Help.prototype.setText;
/**
* Очищает текст
*
* clear
*/
Window_Help.prototype.clear;
/**
* Устанавливает текст из описания предмета
*
* setItem
* @param {Object} item - Предмет
*/
Window_Help.prototype.setItem;
/**
* Перерисовывает окно
*
* refresh
*/
Window_Help.prototype.refresh;
/**
* Окно для отображения золота партии
* The window for displaying the party's gold
*
* @class Window_Gold
* @augments Window_Base
*/
function Window_Gold() {
this.initialize.apply(this, arguments);
}
Window_Gold.prototype = Object.create(Window_Base.prototype);
Window_Gold.prototype.constructor = Window_Gold;
/**
* Инициализирует объект класса
*
* initialize
* @param {Number} x - Координата X
* @param {Number} y - Координата Y
*/
Window_Gold.prototype.initialize;
/**
* Возвращает ширину окна
*
* windowWidth
* @returns {Number} Ширина окна
*/
Window_Gold.prototype.windowWidth;
/**
* Возвращает высоту окна
*
* windowHeight
* @returns {Number} Высота окна
*/
Window_Gold.prototype.windowHeight;
/**
* Перерисовывает окно
*
* refresh
*/
Window_Gold.prototype.refresh;
/**
* Возвращает количество золота
*
* value
* @returns {Number}
*/
Window_Gold.prototype.value;
/**
* Возвращает название валюты
*
* currencyUnit
* @returns {String} Название валюты
*/
Window_Gold.prototype.currencyUnit;
/**
* Открывает окно
*
* open
*/
Window_Gold.prototype.open;
/**
* Окно для выбора команды на экране меню
* The window for selecting a command on the menu screen
*
* @class Window_MenuCommand
* @augments Window_Command
*/
function Window_MenuCommand() {
this.initialize.apply(this, arguments);
}
Window_MenuCommand.prototype = Object.create(Window_Command.prototype);
Window_MenuCommand.prototype.constructor = Window_MenuCommand;
/**
* Инициализирует объект класса
*
* initialize
* @param {Number} x - Координата X
* @param {Number} y - Координата Y
*/
Window_MenuCommand.prototype.initialize;
Window_MenuCommand._lastCommandSymbol = null;
Window_MenuCommand.initCommandPosition = function() {
this._lastCommandSymbol = null;
};
/**
* Возвращает ширину окна
*
* windowWidth
* @returns {Number} Ширина окна
*/
Window_MenuCommand.prototype.windowWidth;
/**
* Возвращает количество видимых рядов
*
* numVisibleRows
* @returns {Number} Количество видимых рядов
*/
Window_MenuCommand.prototype.numVisibleRows;
/**
* Создает список команд
*
* makeCommandList
*/
Window_MenuCommand.prototype.makeCommandList;
/**
* Добавляет команды: предметы, навыки, экипировка, статус
*
* addMainCommands
*/
Window_MenuCommand.prototype.addMainCommands;
/**
* Добавляет команду построения
*
* addFormationCommand
*/
Window_MenuCommand.prototype.addFormationCommand;
/**
* Добавляет пользовательские команды
*
* addOriginalCommands
*/
Window_MenuCommand.prototype.addOriginalCommands;
/**
* Добавляет команду опций
*
* addOptionsCommand
*/
Window_MenuCommand.prototype.addOptionsCommand;
/**
* Добавляет команду сохранения
*
* addSaveCommand
*/
Window_MenuCommand.prototype.addSaveCommand;
/**
* Добавляет команду завершения игры
*
* addGameEndCommand
*/
Window_MenuCommand.prototype.addGameEndCommand;
/**
* Возвращает true, если команду нужно добавить в список
*
* needsCommand
* @param {String} name - Название команды
* @returns {Boolean} Команду нужно добавить в список
*/
Window_MenuCommand.prototype.needsCommand;
Window_MenuCommand.prototype.areMainCommandsEnabled = function() {
return $gameParty.exists();
};
/**
* Возвращает true, если команда построения доступна
*
* isFormationEnabled
* @returns {Boolean} Команда построения доступна
*/
Window_MenuCommand.prototype.isFormationEnabled;
/**
* Возвращает true, если команда опций доступна
*
* isOptionsEnabled
* @returns {Boolean} Команда опций доступна
*/
Window_MenuCommand.prototype.isOptionsEnabled;
/**
* Возвращает true, если команда сохранения доступна
*
* isSaveEnabled
* @returns {Boolean} Команда сохранения доступна
*/
Window_MenuCommand.prototype.isSaveEnabled;
/**
* Возвращает true, если команда завершения игры доступна
*
* isGameEndEnabled
* @returns {Boolean} Команда завершения игры доступна
*/
Window_MenuCommand.prototype.isGameEndEnabled;
Window_MenuCommand.prototype.processOk = function() {
Window_MenuCommand._lastCommandSymbol = this.currentSymbol();
Window_Command.prototype.processOk.call(this);
};
Window_MenuCommand.prototype.selectLast = function() {
this.selectSymbol(Window_MenuCommand._lastCommandSymbol);
};
/**
* Окно для отображения статуса персонажа партии на экране меню
* The window for displaying party member status on the menu screen
*
* @class Window_MenuStatus
* @augments Window_Selectable
*/
function Window_MenuStatus() {
this.initialize.apply(this, arguments);
}
Window_MenuStatus.prototype = Object.create(Window_Selectable.prototype);
Window_MenuStatus.prototype.constructor = Window_MenuStatus;
/**
* Инициализирует объект класса
*
* initialize
* @param {Number} x - Координата X
* @param {Number} y - Координата Y
*/
Window_MenuStatus.prototype.initialize;
/**
* Возвращает ширину окна
*
* windowWidth
* @returns {Number} Ширина окна
*/
Window_MenuStatus.prototype.windowWidth;
/**
* Возвращает высоту окна
*
* windowHeight
* @returns {Number} Высота окна
*/
Window_MenuStatus.prototype.windowHeight;
Window_MenuStatus.prototype.maxItems = function() {
return $gameParty.size();
};
/**
* Возвращает высоту команды
*
* itemHeight
* @returns {Number} Высота команды
*/
Window_MenuStatus.prototype.itemHeight;
/**
* Возвращает количество видимых рядов
*
* numVisibleRows
* @returns {Number} Количество видимых рядов
*/
Window_MenuStatus.prototype.numVisibleRows;
Window_MenuStatus.prototype.loadImages = function() {
$gameParty.members().forEach(function(actor) {
ImageManager.loadFace(actor.faceName());
}, this);
};
Window_MenuStatus.prototype.drawItem = function(index) {
this.drawItemBackground(index);
this.drawItemImage(index);
this.drawItemStatus(index);
};
Window_MenuStatus.prototype.drawItemBackground = function(index) {
if (index === this._pendingIndex) {
var rect = this.itemRect(index);
var color = this.pendingColor();
this.changePaintOpacity(false);
this.contents.fillRect(rect.x, rect.y, rect.width, rect.height, color);
this.changePaintOpacity(true);
}
};
Window_MenuStatus.prototype.drawItemImage = function(index) {
var actor = $gameParty.members()[index];
var rect = this.itemRect(index);
this.changePaintOpacity(actor.isBattleMember());
this.drawActorFace(actor, rect.x + 1, rect.y + 1, Window_Base._faceWidth, Window_Base._faceHeight);
this.changePaintOpacity(true);
};
Window_MenuStatus.prototype.drawItemStatus = function(index) {
var actor = $gameParty.members()[index];
var rect = this.itemRect(index);
var x = rect.x + 162;
var y = rect.y + rect.height / 2 - this.lineHeight() * 1.5;
var width = rect.width - x - this.textPadding();
this.drawActorSimpleStatus(actor, x, y, width);
};
Window_MenuStatus.prototype.processOk = function() {
Window_Selectable.prototype.processOk.call(this);
$gameParty.setMenuActor($gameParty.members()[this.index()]);
};
Window_MenuStatus.prototype.isCurrentItemEnabled = function() {
if (this._formationMode) {
var actor = $gameParty.members()[this.index()];
return actor && actor.isFormationChangeOk();
} else {
return true;
}
};
Window_MenuStatus.prototype.selectLast = function() {
this.select($gameParty.menuActor().index() || 0);
};
Window_MenuStatus.prototype.formationMode = function() {
return this._formationMode;
};
Window_MenuStatus.prototype.setFormationMode = function(formationMode) {
this._formationMode = formationMode;
};
Window_MenuStatus.prototype.pendingIndex = function() {
return this._pendingIndex;
};
Window_MenuStatus.prototype.setPendingIndex = function(index) {
var lastPendingIndex = this._pendingIndex;
this._pendingIndex = index;
this.redrawItem(this._pendingIndex);
this.redrawItem(lastPendingIndex);
};
/**
* Окно для выбора персонажа в сценах вещей и навыков
* The window for selecting a target actor on the item and skill screens
*
* @class Window_MenuActor
* @augments Window_MenuStatus
*/
function Window_MenuActor() {
this.initialize.apply(this, arguments);
}
Window_MenuActor.prototype = Object.create(Window_MenuStatus.prototype);
Window_MenuActor.prototype.constructor = Window_MenuActor;
/**
* Инициализирует объект класса
*
* initialize
*/
Window_MenuActor.prototype.initialize;
Window_MenuActor.prototype.processOk = function() {
if (!this.cursorAll()) {
$gameParty.setTargetActor($gameParty.members()[this.index()]);
}
this.callOkHandler();
};
Window_MenuActor.prototype.selectLast = function() {
this.select($gameParty.targetActor().index() || 0);
};
Window_MenuActor.prototype.selectForItem = function(item) {
var actor = $gameParty.menuActor();
var action = new Game_Action(actor);
action.setItemObject(item);
this.setCursorFixed(false);
this.setCursorAll(false);
if (action.isForUser()) {
if (DataManager.isSkill(item)) {
this.setCursorFixed(true);
this.select(actor.index());
} else {
this.selectLast();
}
} else if (action.isForAll()) {
this.setCursorAll(true);
this.select(0);
} else {
this.selectLast();
}
};
/**
* Окно для выбора категории в сценах вещей и магазина
* The window for selecting a category of items on the item and shop screens
*
* @class Window_ItemCategory
* @augments Window_HorzCommand
*/
function Window_ItemCategory() {
this.initialize.apply(this, arguments);
}
Window_ItemCategory.prototype = Object.create(Window_HorzCommand.prototype);
Window_ItemCategory.prototype.constructor = Window_ItemCategory;
/**
* Инициализирует объект класса
*
* initialize
*/
Window_ItemCategory.prototype.initialize;
/**
* Возвращает ширину окна
*
* windowWidth
* @returns {Number} Ширина окна
*/
Window_ItemCategory.prototype.windowWidth;
/**
* Возвращает максимальное количество столбцов
*
* maxCols
* @returns {Number} Максимальное количество столбцов
*/
Window_ItemCategory.prototype.maxCols;
/**
* Обновляет окно
*
* update
*/
Window_ItemCategory.prototype.update;
/**
* Создает список команд
*
* makeCommandList
*/
Window_ItemCategory.prototype.makeCommandList;
/**
* Устанавливает окно с предметами
*
* setItemWindow
* @param {Window_ItemList} itemWindow - Окно с предметами
*/
Window_ItemCategory.prototype.setItemWindow;
/**
* Окно для выбора предмета в сцене вещей
* The window for selecting an item on the item screen
*
* @class Window_ItemList
* @augments Window_Selectable
*/
function Window_ItemList() {
this.initialize.apply(this, arguments);
}
Window_ItemList.prototype = Object.create(Window_Selectable.prototype);
Window_ItemList.prototype.constructor = Window_ItemList;
/**
* Инициализирует объект класса
*
* initialize
* @param {Number} x - Координата X
* @param {Number} y - Координата Y
* @param {Number} width - Ширина окна
* @param {Number} height - Высота окна
*/
Window_ItemList.prototype.initialize;
Window_ItemList.prototype.setCategory = function(category) {
if (this._category !== category) {
this._category = category;
this.refresh();
this.resetScroll();
}
};
/**
* Возвращает максимальное количество столбцов
*
* maxCols
* @returns {Number} Максимальное количество столбцов
*/
Window_ItemList.prototype.maxCols;
Window_ItemList.prototype.spacing = function() {
return 48;
};
Window_ItemList.prototype.maxItems = function() {
return this._data ? this._data.length : 1;
};
Window_ItemList.prototype.item = function() {
var index = this.index();
return this._data && index >= 0 ? this._data[index] : null;
};
Window_ItemList.prototype.isCurrentItemEnabled = function() {
return this.isEnabled(this.item());
};
Window_ItemList.prototype.includes = function(item) {
switch (this._category) {
case 'item':
return DataManager.isItem(item) && item.itypeId === 1;
case 'weapon':
return DataManager.isWeapon(item);
case 'armor':
return DataManager.isArmor(item);
case 'keyItem':
return DataManager.isItem(item) && item.itypeId === 2;
default:
return false;
}
};
Window_ItemList.prototype.needsNumber = function() {
return true;
};
Window_ItemList.prototype.isEnabled = function(item) {
return $gameParty.canUse(item);
};
Window_ItemList.prototype.makeItemList = function() {
this._data = $gameParty.allItems().filter(function(item) {
return this.includes(item);
}, this);
if (this.includes(null)) {
this._data.push(null);
}
};
Window_ItemList.prototype.selectLast = function() {
var index = this._data.indexOf($gameParty.lastItem());
this.select(index >= 0 ? index : 0);
};
Window_ItemList.prototype.drawItem = function(index) {
var item = this._data[index];
if (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.drawItemNumber(item, rect.x, rect.y, rect.width);
this.changePaintOpacity(1);
}
};
Window_ItemList.prototype.numberWidth = function() {
return this.textWidth('000');
};
Window_ItemList.prototype.drawItemNumber = function(item, x, y, width) {
if (this.needsNumber()) {
this.drawText(':', x, y, width - this.textWidth('00'), 'right');
this.drawText($gameParty.numItems(item), x, y, width, 'right');
}
};
/**
* Обновляет предмет в окне помощи
*
* updateHelp
*/
Window_ItemList.prototype.updateHelp;
/**
* Перерисовывает окно
*
* refresh
*/
Window_ItemList.prototype.refresh;
/**
* Окно для выбора типа навыка на экране навыков
* The window for selecting a skill type on the skill screen
*
* @class Window_SkillType
* @augments Window_Command
*/
function Window_SkillType() {
this.initialize.apply(this, arguments);
}
Window_SkillType.prototype = Object.create(Window_Command.prototype);
Window_SkillType.prototype.constructor = Window_SkillType;
/**
* Инициализирует объект класса
*
* initialize
* @param {Number} x - Координата X
* @param {Number} y - Координата Y
*/
Window_SkillType.prototype.initialize;
/**
* Возвращает ширину окна
*
* windowWidth
* @returns {Number} Ширина окна
*/
Window_SkillType.prototype.windowWidth;
Window_SkillType.prototype.setActor = function(actor) {
if (this._actor !== actor) {
this._actor = actor;
this.refresh();
this.selectLast();
}
};
/**
* Возвращает количество видимых рядов
*
* numVisibleRows
* @returns {Number} Количество видимых рядов
*/
Window_SkillType.prototype.numVisibleRows;
/**
* Создает список команд
*
* makeCommandList
*/
Window_SkillType.prototype.makeCommandList;
/**
* Обновляет окно
*
* update
*/
Window_SkillType.prototype.update;
Window_SkillType.prototype.setSkillWindow = function(skillWindow) {
this._skillWindow = skillWindow;
this.update();
};
Window_SkillType.prototype.selectLast = function() {
var skill = this._actor.lastMenuSkill();
if (skill) {
this.selectExt(skill.stypeId);
} else {
this.select(0);
}
};
/**
* Окно для отображения статуса навыка персонажа на экране навыков
* The window for displaying the skill user's status on the skill screen
*
* @class Window_SkillStatus
* @augments Window_Base
*/
function Window_SkillStatus() {
this.initialize.apply(this, arguments);
}
Window_SkillStatus.prototype = Object.create(Window_Base.prototype);
Window_SkillStatus.prototype.constructor = Window_SkillStatus;
/**
* Инициализирует объект класса
*
* initialize
* @param {Number} x - Координата X
* @param {Number} y - Координата Y
* @param {Number} width - Ширина окна
* @param {Number} height - Высота окна
*/
Window_SkillStatus.prototype.initialize;
Window_SkillStatus.prototype.setActor = function(actor) {
if (this._actor !== actor) {
this._actor = actor;
this.refresh();
}
};
/**
* Перерисовывает окно
*
* refresh
*/
Window_SkillStatus.prototype.refresh;
/**
* Окно для выбора навыка на экране навыков
* The window for selecting a skill on the skill screen
*
* @class Window_SkillList
* @augments Window_Selectable
*/
function Window_SkillList() {
this.initialize.apply(this, arguments);
}
Window_SkillList.prototype = Object.create(Window_Selectable.prototype);
Window_SkillList.prototype.constructor = Window_SkillList;
/**
* Инициализирует объект класса
*
* initialize
* @param {Number} x - Координата X
* @param {Number} y - Координата Y
* @param {Number} width - Ширина окна
* @param {Number} height - Высота окна
*/
Window_SkillList.prototype.initialize;
Window_SkillList.prototype.setActor = function(actor) {
if (this._actor !== actor) {
this._actor = actor;
this.refresh();
this.resetScroll();
}
};
Window_SkillList.prototype.setStypeId = function(stypeId) {
if (this._stypeId !== stypeId) {
this._stypeId = stypeId;
this.refresh();
this.resetScroll();
}
};
/**
* Возвращает максимальное количество столбцов
*
* maxCols
* @returns {Number} Максимальное количество столбцов
*/
Window_SkillList.prototype.maxCols;
Window_SkillList.prototype.spacing = function() {
return 48;
};
Window_SkillList.prototype.maxItems = function() {
return this._data ? this._data.length : 1;
};
Window_SkillList.prototype.item = function() {
return this._data && this.index() >= 0 ? this._data[this.index()] : null;
};
Window_SkillList.prototype.isCurrentItemEnabled = function() {
return this.isEnabled(this._data[this.index()]);
};
Window_SkillList.prototype.includes = function(item) {
return item && item.stypeId === this._stypeId;
};
Window_SkillList.prototype.isEnabled = function(item) {
return this._actor && this._actor.canUse(item);
};
Window_SkillList.prototype.makeItemList = function() {
if (this._actor) {
this._data = this._actor.skills().filter(function(item) {
return this.includes(item);
}, this);
} else {
this._data = [];
}
};
Window_SkillList.prototype.selectLast = function() {
var skill;
if ($gameParty.inBattle()) {
skill = this._actor.lastBattleSkill();
} else {
skill = this._actor.lastMenuSkill();
}
var index = this._data.indexOf(skill);
this.select(index >= 0 ? index : 0);
};
Window_SkillList.prototype.drawItem = function(index) {
var skill = this._data[index];
if (skill) {
var costWidth = this.costWidth();
var rect = this.itemRect(index);
rect.width -= this.textPadding();
this.changePaintOpacity(this.isEnabled(skill));
this.drawItemName(skill, rect.x, rect.y, rect.width - costWidth);
this.drawSkillCost(skill, rect.x, rect.y, rect.width);
this.changePaintOpacity(1);
}
};
Window_SkillList.prototype.costWidth = function() {
return this.textWidth('000');
};
Window_SkillList.prototype.drawSkillCost = function(skill, x, y, width) {
if (this._actor.skillTpCost(skill) > 0) {
this.changeTextColor(this.tpCostColor());
this.drawText(this._actor.skillTpCost(skill), x, y, width, 'right');
} else if (this._actor.skillMpCost(skill) > 0) {
this.changeTextColor(this.mpCostColor());
this.drawText(this._actor.skillMpCost(skill), x, y, width, 'right');
}
};
Window_SkillList.prototype.updateHelp = function() {
this.setHelpWindowItem(this.item());
};
/**
* Перерисовывает окно
*
* refresh
*/
Window_SkillList.prototype.refresh;
/**
* Окно для отображения изменений параметров на экране экипировки
* The window for displaying parameter changes on the equipment screen
*
* @class Window_EquipStatus
* @augments Window_Base
*/
function Window_EquipStatus() {
this.initialize.apply(this, arguments);
}
Window_EquipStatus.prototype = Object.create(Window_Base.prototype);
Window_EquipStatus.prototype.constructor = Window_EquipStatus;
/**
* Инициализирует объект класса
*
* initialize
* @param {Number} x - Координата X
* @param {Number} y - Координата Y
*/
Window_EquipStatus.prototype.initialize;
/**
* Возвращает ширину окна
*
* windowWidth
* @returns {Number} Ширина окна
*/
Window_EquipStatus.prototype.windowWidth;
/**
* Возвращает высоту окна
*
* windowHeight
* @returns {Number} Высота окна
*/
Window_EquipStatus.prototype.windowHeight;
/**
* Возвращает количество видимых рядов
*
* numVisibleRows
* @returns {Number} Количество видимых рядов
*/
Window_EquipStatus.prototype.numVisibleRows;
Window_EquipStatus.prototype.setActor = function(actor) {
if (this._actor !== actor) {
this._actor = actor;
this.refresh();
}
};
/**
* Перерисовывает окно
*
* refresh
*/
Window_EquipStatus.prototype.refresh;
Window_EquipStatus.prototype.setTempActor = function(tempActor) {
if (this._tempActor !== tempActor) {
this._tempActor = tempActor;
this.refresh();
}
};
Window_EquipStatus.prototype.drawItem = function(x, y, paramId) {
this.drawParamName(x + this.textPadding(), y, paramId);
if (this._actor) {
this.drawCurrentParam(x + 140, y, paramId);
}
this.drawRightArrow(x + 188, y);
if (this._tempActor) {
this.drawNewParam(x + 222, y, paramId);
}
};
Window_EquipStatus.prototype.drawParamName = function(x, y, paramId) {
this.changeTextColor(this.systemColor());
this.drawText(TextManager.param(paramId), x, y, 120);
};
Window_EquipStatus.prototype.drawCurrentParam = function(x, y, paramId) {
this.resetTextColor();
this.drawText(this._actor.param(paramId), x, y, 48, 'right');
};
Window_EquipStatus.prototype.drawRightArrow = function(x, y) {
this.changeTextColor(this.systemColor());
this.drawText('\u2192', x, y, 32, 'center');
};
Window_EquipStatus.prototype.drawNewParam = function(x, y, paramId) {
var newValue = this._tempActor.param(paramId);
var diffvalue = newValue - this._actor.param(paramId);
this.changeTextColor(this.paramchangeTextColor(diffvalue));
this.drawText(newValue, x, y, 48, 'right');
};
/**
* Окно для выбора команды на экране экипировки
* The window for selecting a command on the equipment screen
*
* @class Window_EquipCommand
* @augments Window_HorzCommand
*/
function Window_EquipCommand() {
this.initialize.apply(this, arguments);
}
Window_EquipCommand.prototype = Object.create(Window_HorzCommand.prototype);
Window_EquipCommand.prototype.constructor = Window_EquipCommand;
/**
* Инициализирует объект класса
*
* initialize
* @param {Number} x - Координата X
* @param {Number} y - Координата Y
* @param {Number} width - Ширина окна
*/
Window_EquipCommand.prototype.initialize;
/**
* Возвращает ширину окна
*
* windowWidth
* @returns {Number} Ширина окна
*/
Window_EquipCommand.prototype.windowWidth;
/**
* Возвращает максимальное количество столбцов
*
* maxCols
* @returns {Number} Максимальное количество столбцов
*/
Window_EquipCommand.prototype.maxCols;
/**
* Создает список команд
*
* makeCommandList
*/
Window_EquipCommand.prototype.makeCommandList;
/**
* Окно для выбора слота экипировки на экране экипировки
* The window for selecting an equipment slot on the equipment screen
*
* @class Window_EquipSlot
* @augments Window_Selectable
*/
function Window_EquipSlot() {
this.initialize.apply(this, arguments);
}
Window_EquipSlot.prototype = Object.create(Window_Selectable.prototype);
Window_EquipSlot.prototype.constructor = Window_EquipSlot;
/**
* Инициализирует объект класса
*
* initialize
* @param {Number} x - Координата X
* @param {Number} y - Координата Y
* @param {Number} width - Ширина окна
* @param {Number} height - Высота окна
*/
Window_EquipSlot.prototype.initialize;
Window_EquipSlot.prototype.setActor = function(actor) {
if (this._actor !== actor) {
this._actor = actor;
this.refresh();
}
};
/**
* Обновляет окно
*
* update
*/
Window_EquipSlot.prototype.update;
Window_EquipSlot.prototype.maxItems = function() {
return this._actor ? this._actor.equipSlots().length : 0;
};
Window_EquipSlot.prototype.item = function() {
return this._actor ? this._actor.equips()[this.index()] : null;
};
Window_EquipSlot.prototype.drawItem = function(index) {
if (this._actor) {
var rect = this.itemRectForText(index);
this.changeTextColor(this.systemColor());
this.changePaintOpacity(this.isEnabled(index));
this.drawText(this.slotName(index), rect.x, rect.y, 138, this.lineHeight());
this.drawItemName(this._actor.equips()[index], rect.x + 138, rect.y);
this.changePaintOpacity(true);
}
};
Window_EquipSlot.prototype.slotName = function(index) {
var slots = this._actor.equipSlots();
return this._actor ? $dataSystem.equipTypes[slots[index]] : '';
};
Window_EquipSlot.prototype.isEnabled = function(index) {
return this._actor ? this._actor.isEquipChangeOk(index) : false;
};
Window_EquipSlot.prototype.isCurrentItemEnabled = function() {
return this.isEnabled(this.index());
};
Window_EquipSlot.prototype.setStatusWindow = function(statusWindow) {
this._statusWindow = statusWindow;
this.callUpdateHelp();
};
Window_EquipSlot.prototype.setItemWindow = function(itemWindow) {
this._itemWindow = itemWindow;
this.update();
};
Window_EquipSlot.prototype.updateHelp = function() {
Window_Selectable.prototype.updateHelp.call(this);
this.setHelpWindowItem(this.item());
if (this._statusWindow) {
this._statusWindow.setTempActor(null);
}
};
/**
* Окно для выбора предмета экипировки на экране экипировки
* The window for selecting an equipment item on the equipment screen
*
* @class Window_EquipItem
* @augments Window_ItemList
*/
function Window_EquipItem() {
this.initialize.apply(this, arguments);
}
Window_EquipItem.prototype = Object.create(Window_ItemList.prototype);
Window_EquipItem.prototype.constructor = Window_EquipItem;
/**
* Инициализирует объект класса
*
* initialize
* @param {Number} x - Координата X
* @param {Number} y - Координата Y
* @param {Number} width - Ширина окна
* @param {Number} height - Высота окна
*/
Window_EquipItem.prototype.initialize;
Window_EquipItem.prototype.setActor = function(actor) {
if (this._actor !== actor) {
this._actor = actor;
this.refresh();
this.resetScroll();
}
};
Window_EquipItem.prototype.setSlotId = function(slotId) {
if (this._slotId !== slotId) {
this._slotId = slotId;
this.refresh();
this.resetScroll();
}
};
Window_EquipItem.prototype.includes = function(item) {
if (item === null) {
return true;
}
if (this._slotId < 0 || item.etypeId !== this._actor.equipSlots()[this._slotId]) {
return false;
}
return this._actor.canEquip(item);
};
Window_EquipItem.prototype.isEnabled = function(item) {
return true;
};
Window_EquipItem.prototype.selectLast = function() {
};
Window_EquipItem.prototype.setStatusWindow = function(statusWindow) {
this._statusWindow = statusWindow;
this.callUpdateHelp();
};
Window_EquipItem.prototype.updateHelp = function() {
Window_ItemList.prototype.updateHelp.call(this);
if (this._actor && this._statusWindow) {
var actor = JsonEx.makeDeepCopy(this._actor);
actor.forceChangeEquip(this._slotId, this.item());
this._statusWindow.setTempActor(actor);
}
};
Window_EquipItem.prototype.playOkSound = function() {
};
/**
* Окно для отображения статуса на экране статуса
* The window for displaying full status on the status screen
*
* @class Window_Status
* @augments Window_Selectable
*/
function Window_Status() {
this.initialize.apply(this, arguments);
}
Window_Status.prototype = Object.create(Window_Selectable.prototype);
Window_Status.prototype.constructor = Window_Status;
/**
* Инициализирует объект класса
*
* initialize
*/
Window_Status.prototype.initialize;
Window_Status.prototype.setActor = function(actor) {
if (this._actor !== actor) {
this._actor = actor;
this.refresh();
}
};
/**
* Перерисовывает окно
*
* refresh
*/
Window_Status.prototype.refresh;
Window_Status.prototype.drawBlock1 = function(y) {
this.drawActorName(this._actor, 6, y);
this.drawActorClass(this._actor, 192, y);
this.drawActorNickname(this._actor, 432, y);
};
Window_Status.prototype.drawBlock2 = function(y) {
this.drawActorFace(this._actor, 12, y);
this.drawBasicInfo(204, y);
this.drawExpInfo(456, y);
};
Window_Status.prototype.drawBlock3 = function(y) {
this.drawParameters(48, y);
this.drawEquipments(432, y);
};
Window_Status.prototype.drawBlock4 = function(y) {
this.drawProfile(6, y);
};
Window_Status.prototype.drawHorzLine = function(y) {
var lineY = y + this.lineHeight() / 2 - 1;
this.contents.paintOpacity = 48;
this.contents.fillRect(0, lineY, this.contentsWidth(), 2, this.lineColor());
this.contents.paintOpacity = 255;
};
Window_Status.prototype.lineColor = function() {
return this.normalColor();
};
Window_Status.prototype.drawBasicInfo = function(x, y) {
var lineHeight = this.lineHeight();
this.drawActorLevel(this._actor, x, y + lineHeight * 0);
this.drawActorIcons(this._actor, x, y + lineHeight * 1);
this.drawActorHp(this._actor, x, y + lineHeight * 2);
this.drawActorMp(this._actor, x, y + lineHeight * 3);
};
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();
this.drawText(this._actor.param(paramId), x + 160, y2, 60, '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 = '-------';
}
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_Status.prototype.drawEquipments = function(x, y) {
var equips = this._actor.equips();
var count = Math.min(equips.length, this.maxEquipmentLines());
for (var i = 0; i < count; i++) {
this.drawItemName(equips[i], x, y + this.lineHeight() * i);
}
};
Window_Status.prototype.drawProfile = function(x, y) {
this.drawTextEx(this._actor.profile(), x, y);
};
Window_Status.prototype.maxEquipmentLines = function() {
return 6;
};
/**
* Окно для изменения различных настроек на экране опций
* The window for changing various settings on the options screen
*
* @class Window_Options
* @augments Window_Command
*/
function Window_Options() {
this.initialize.apply(this, arguments);
}
Window_Options.prototype = Object.create(Window_Command.prototype);
Window_Options.prototype.constructor = Window_Options;
/**
* Инициализирует объект класса
*
* initialize
*/
Window_Options.prototype.initialize;
/**
* Возвращает ширину окна
*
* windowWidth
* @returns {Number} Ширина окна
*/
Window_Options.prototype.windowWidth;
/**
* Возвращает высоту окна
*
* windowHeight
* @returns {Number} Высота окна
*/
Window_Options.prototype.windowHeight;
/**
* Обновляет расположение окна
*
* updatePlacement
*/
Window_Options.prototype.updatePlacement;
/**
* Создает список команд
*
* makeCommandList
*/
Window_Options.prototype.makeCommandList;
Window_Options.prototype.addGeneralOptions = function() {
this.addCommand(TextManager.alwaysDash, 'alwaysDash');
this.addCommand(TextManager.commandRemember, 'commandRemember');
};
Window_Options.prototype.addVolumeOptions = function() {
this.addCommand(TextManager.bgmVolume, 'bgmVolume');
this.addCommand(TextManager.bgsVolume, 'bgsVolume');
this.addCommand(TextManager.meVolume, 'meVolume');
this.addCommand(TextManager.seVolume, 'seVolume');
};
Window_Options.prototype.drawItem = function(index) {
var rect = this.itemRectForText(index);
var statusWidth = this.statusWidth();
var titleWidth = rect.width - statusWidth;
this.resetTextColor();
this.changePaintOpacity(this.isCommandEnabled(index));
this.drawText(this.commandName(index), rect.x, rect.y, titleWidth, 'left');
this.drawText(this.statusText(index), titleWidth, rect.y, statusWidth, 'right');
};
Window_Options.prototype.statusWidth = function() {
return 120;
};
Window_Options.prototype.statusText = function(index) {
var symbol = this.commandSymbol(index);
var value = this.getConfigValue(symbol);
if (this.isVolumeSymbol(symbol)) {
return this.volumeStatusText(value);
} else {
return this.booleanStatusText(value);
}
};
Window_Options.prototype.isVolumeSymbol = function(symbol) {
return symbol.contains('Volume');
};
Window_Options.prototype.booleanStatusText = function(value) {
return value ? 'ON' : 'OFF';
};
Window_Options.prototype.volumeStatusText = function(value) {
return value + '%';
};
Window_Options.prototype.processOk = function() {
var index = this.index();
var symbol = this.commandSymbol(index);
var value = this.getConfigValue(symbol);
if (this.isVolumeSymbol(symbol)) {
value += this.volumeOffset();
if (value > 100) {
value = 0;
}
value = value.clamp(0, 100);
this.changeValue(symbol, value);
} else {
this.changeValue(symbol, !value);
}
};
Window_Options.prototype.cursorRight = function(wrap) {
var index = this.index();
var symbol = this.commandSymbol(index);
var value = this.getConfigValue(symbol);
if (this.isVolumeSymbol(symbol)) {
value += this.volumeOffset();
value = value.clamp(0, 100);
this.changeValue(symbol, value);
} else {
this.changeValue(symbol, true);
}
};
Window_Options.prototype.cursorLeft = function(wrap) {
var index = this.index();
var symbol = this.commandSymbol(index);
var value = this.getConfigValue(symbol);
if (this.isVolumeSymbol(symbol)) {
value -= this.volumeOffset();
value = value.clamp(0, 100);
this.changeValue(symbol, value);
} else {
this.changeValue(symbol, false);
}
};
Window_Options.prototype.volumeOffset = function() {
return 20;
};
Window_Options.prototype.changeValue = function(symbol, value) {
var lastValue = this.getConfigValue(symbol);
if (lastValue !== value) {
this.setConfigValue(symbol, value);
this.redrawItem(this.findSymbol(symbol));
SoundManager.playCursor();
}
};
Window_Options.prototype.getConfigValue = function(symbol) {
return ConfigManager[symbol];
};
Window_Options.prototype.setConfigValue = function(symbol, volume) {
ConfigManager[symbol] = volume;
};
/**
* Окно для выбора файла сохранения на экранах сохранения и загрузки
* The window for selecting a save file on the save and load screens
*
* @class Window_SavefileList
* @augments Window_Selectable
*/
function Window_SavefileList() {
this.initialize.apply(this, arguments);
}
Window_SavefileList.prototype = Object.create(Window_Selectable.prototype);
Window_SavefileList.prototype.constructor = Window_SavefileList;
/**
* Инициализирует объект класса
*
* initialize
* @param {Number} x - Координата X
* @param {Number} y - Координата Y
* @param {Number} width - Ширина окна
* @param {Number} height - Высота окна
*/
Window_SavefileList.prototype.initialize;
Window_SavefileList.prototype.setMode = function(mode) {
this._mode = mode;
};
Window_SavefileList.prototype.maxItems = function() {
return DataManager.maxSavefiles();
};
Window_SavefileList.prototype.maxVisibleItems = function() {
return 5;
};
Window_SavefileList.prototype.itemHeight = function() {
var innerHeight = this.height - this.padding * 2;
return Math.floor(innerHeight / this.maxVisibleItems());
};
Window_SavefileList.prototype.drawItem = function(index) {
var id = index + 1;
var valid = DataManager.isThisGameFile(id);
var info = DataManager.loadSavefileInfo(id);
var rect = this.itemRectForText(index);
this.resetTextColor();
if (this._mode === 'load') {
this.changePaintOpacity(valid);
}
this.drawFileId(id, rect.x, rect.y);
if (info) {
this.changePaintOpacity(valid);
this.drawContents(info, rect, valid);
this.changePaintOpacity(true);
}
};
Window_SavefileList.prototype.drawFileId = function(id, x, y) {
this.drawText(TextManager.file + ' ' + id, x, y, 180);
};
Window_SavefileList.prototype.drawContents = function(info, rect, valid) {
var bottom = rect.y + rect.height;
if (rect.width >= 420) {
this.drawGameTitle(info, rect.x + 192, rect.y, rect.width - 192);
if (valid) {
this.drawPartyCharacters(info, rect.x + 220, bottom - 4);
}
}
var lineHeight = this.lineHeight();
var y2 = bottom - lineHeight;
if (y2 >= lineHeight) {
this.drawPlaytime(info, rect.x, y2, rect.width);
}
};
Window_SavefileList.prototype.drawGameTitle = function(info, x, y, width) {
if (info.title) {
this.drawText(info.title, x, y, width);
}
};
Window_SavefileList.prototype.drawPartyCharacters = function(info, x, y) {
if (info.characters) {
for (var i = 0; i < info.characters.length; i++) {
var data = info.characters[i];
this.drawCharacter(data[0], data[1], x + i * 48, y);
}
}
};
Window_SavefileList.prototype.drawPlaytime = function(info, x, y, width) {
if (info.playtime) {
this.drawText(info.playtime, x, y, width, 'right');
}
};
Window_SavefileList.prototype.playOkSound = function() {
};
/**
* Окно выбора команды покупки / продажи на экране магазина
* The window for selecting buy/sell on the shop screen
*
* @class Window_ShopCommand
* @augments Window_HorzCommand
*/
function Window_ShopCommand() {
this.initialize.apply(this, arguments);
}
Window_ShopCommand.prototype = Object.create(Window_HorzCommand.prototype);
Window_ShopCommand.prototype.constructor = Window_ShopCommand;
Window_ShopCommand.prototype.initialize = function(width, purchaseOnly) {
this._windowWidth = width;
this._purchaseOnly = purchaseOnly;
Window_HorzCommand.prototype.initialize.call(this, 0, 0);
};
/**
* Возвращает ширину окна
*
* windowWidth
* @returns {Number} Ширина окна
*/
Window_ShopCommand.prototype.windowWidth;
/**
* Возвращает максимальное количество столбцов
*
* maxCols
* @returns {Number} Максимальное количество столбцов
*/
Window_ShopCommand.prototype.maxCols;
/**
* Создает список команд
*
* makeCommandList
*/
Window_ShopCommand.prototype.makeCommandList;
/**
* Окно для выбора предмета для покупки на экране магазина
* The window for selecting an item to buy on the shop screen
*
* @class Window_ShopBuy
* @augments Window_Selectable
*/
function Window_ShopBuy() {
this.initialize.apply(this, arguments);
}
Window_ShopBuy.prototype = Object.create(Window_Selectable.prototype);
Window_ShopBuy.prototype.constructor = Window_ShopBuy;
Window_ShopBuy.prototype.initialize = function(x, y, height, shopGoods) {
var width = this.windowWidth();
Window_Selectable.prototype.initialize.call(this, x, y, width, height);
this._shopGoods = shopGoods;
this._money = 0;
this.refresh();
this.select(0);
};
/**
* Возвращает ширину окна
*
* windowWidth
* @returns {Number} Ширина окна
*/
Window_ShopBuy.prototype.windowWidth;
Window_ShopBuy.prototype.maxItems = function() {
return this._data ? this._data.length : 1;
};
Window_ShopBuy.prototype.item = function() {
return this._data[this.index()];
};
Window_ShopBuy.prototype.setMoney = function(money) {
this._money = money;
this.refresh();
};
Window_ShopBuy.prototype.isCurrentItemEnabled = function() {
return this.isEnabled(this._data[this.index()]);
};
Window_ShopBuy.prototype.price = function(item) {
return this._price[this._data.indexOf(item)] || 0;
};
Window_ShopBuy.prototype.isEnabled = function(item) {
return (item && this.price(item) <= this._money &&
!$gameParty.hasMaxItems(item));
};
/**
* Перерисовывает окно
*
* refresh
*/
Window_ShopBuy.prototype.refresh;
Window_ShopBuy.prototype.makeItemList = function() {
this._data = [];
this._price = [];
this._shopGoods.forEach(function(goods) {
var item = null;
switch (goods[0]) {
case 0:
item = $dataItems[goods[1]];
break;
case 1:
item = $dataWeapons[goods[1]];
break;
case 2:
item = $dataArmors[goods[1]];
break;
}
if (item) {
this._data.push(item);
this._price.push(goods[2] === 0 ? item.price : goods[3]);
}
}, this);
};
Window_ShopBuy.prototype.drawItem = function(index) {
var item = this._data[index];
var rect = this.itemRect(index);
var priceWidth = 96;
rect.width -= this.textPadding();
this.changePaintOpacity(this.isEnabled(item));
this.drawItemName(item, rect.x, rect.y, rect.width - priceWidth);
this.drawText(this.price(item), rect.x + rect.width - priceWidth,
rect.y, priceWidth, 'right');
this.changePaintOpacity(true);
};
Window_ShopBuy.prototype.setStatusWindow = function(statusWindow) {
this._statusWindow = statusWindow;
this.callUpdateHelp();
};
Window_ShopBuy.prototype.updateHelp = function() {
this.setHelpWindowItem(this.item());
if (this._statusWindow) {
this._statusWindow.setItem(this.item());
}
};
/**
* Окно для выбора предмета для продажи на экране магазина
* The window for selecting an item to sell on the shop screen
*
* @class Window_ShopSell
* @augments Window_ItemList
*/
function Window_ShopSell() {
this.initialize.apply(this, arguments);
}
Window_ShopSell.prototype = Object.create(Window_ItemList.prototype);
Window_ShopSell.prototype.constructor = Window_ShopSell;
/**
* Инициализирует объект класса
*
* initialize
* @param {Number} x - Координата X
* @param {Number} y - Координата Y
* @param {Number} width - Ширина окна
* @param {Number} height - Высота окна
*/
Window_ShopSell.prototype.initialize;
Window_ShopSell.prototype.isEnabled = function(item) {
return item && item.price > 0;
};
/**
* Окно для ввода количества предметов для покупки или продажи на экране магазина
* The window for inputting quantity of items to buy or sell on the shop screen
*
* @class Window_ShopNumber
* @augments Window_Selectable
*/
function Window_ShopNumber() {
this.initialize.apply(this, arguments);
}
Window_ShopNumber.prototype = Object.create(Window_Selectable.prototype);
Window_ShopNumber.prototype.constructor = Window_ShopNumber;
/**
* Инициализирует объект класса
*
* initialize
* @param {Number} x - Координата X
* @param {Number} y - Координата Y
* @param {Number} height - Высота окна
*/
Window_ShopNumber.prototype.initialize;
/**
* Возвращает ширину окна
*
* windowWidth
* @returns {Number} Ширина окна
*/
Window_ShopNumber.prototype.windowWidth;
Window_ShopNumber.prototype.number = function() {
return this._number;
};
Window_ShopNumber.prototype.setup = function(item, max, price) {
this._item = item;
this._max = Math.floor(max);
this._price = price;
this._number = 1;
this.placeButtons();
this.updateButtonsVisiblity();
this.refresh();
};
Window_ShopNumber.prototype.setCurrencyUnit = function(currencyUnit) {
this._currencyUnit = currencyUnit;
this.refresh();
};
Window_ShopNumber.prototype.createButtons = function() {
var bitmap = ImageManager.loadSystem('ButtonSet');
var buttonWidth = 48;
var buttonHeight = 48;
this._buttons = [];
for (var i = 0; i < 5; i++) {
var button = new Sprite_Button();
var x = buttonWidth * i;
var w = buttonWidth * (i === 4 ? 2 : 1);
button.bitmap = bitmap;
button.setColdFrame(x, 0, w, buttonHeight);
button.setHotFrame(x, buttonHeight, w, buttonHeight);
button.visible = false;
this._buttons.push(button);
this.addChild(button);
}
this._buttons[0].setClickHandler(this.onButtonDown2.bind(this));
this._buttons[1].setClickHandler(this.onButtonDown.bind(this));
this._buttons[2].setClickHandler(this.onButtonUp.bind(this));
this._buttons[3].setClickHandler(this.onButtonUp2.bind(this));
this._buttons[4].setClickHandler(this.onButtonOk.bind(this));
};
Window_ShopNumber.prototype.placeButtons = function() {
var numButtons = this._buttons.length;
var spacing = 16;
var totalWidth = -spacing;
for (var i = 0; i < numButtons; i++) {
totalWidth += this._buttons[i].width + spacing;
}
var x = (this.width - totalWidth) / 2;
for (var j = 0; j < numButtons; j++) {
var button = this._buttons[j];
button.x = x;
button.y = this.buttonY();
x += button.width + spacing;
}
};
Window_ShopNumber.prototype.updateButtonsVisiblity = function() {
if (TouchInput.date > Input.date) {
this.showButtons();
} else {
this.hideButtons();
}
};
Window_ShopNumber.prototype.showButtons = function() {
for (var i = 0; i < this._buttons.length; i++) {
this._buttons[i].visible = true;
}
};
Window_ShopNumber.prototype.hideButtons = function() {
for (var i = 0; i < this._buttons.length; i++) {
this._buttons[i].visible = false;
}
};
/**
* Перерисовывает окно
*
* refresh
*/
Window_ShopNumber.prototype.refresh;
Window_ShopNumber.prototype.drawMultiplicationSign = function() {
var sign = '\u00d7';
var width = this.textWidth(sign);
var x = this.cursorX() - width * 2;
var y = this.itemY();
this.resetTextColor();
this.drawText(sign, x, y, width);
};
Window_ShopNumber.prototype.drawNumber = function() {
var x = this.cursorX();
var y = this.itemY();
var width = this.cursorWidth() - this.textPadding();
this.resetTextColor();
this.drawText(this._number, x, y, width, 'right');
};
Window_ShopNumber.prototype.drawTotalPrice = function() {
var total = this._price * this._number;
var width = this.contentsWidth() - this.textPadding();
this.drawCurrencyValue(total, this._currencyUnit, 0, this.priceY(), width);
};
Window_ShopNumber.prototype.itemY = function() {
return Math.round(this.contentsHeight() / 2 - this.lineHeight() * 1.5);
};
Window_ShopNumber.prototype.priceY = function() {
return Math.round(this.contentsHeight() / 2 + this.lineHeight() / 2);
};
Window_ShopNumber.prototype.buttonY = function() {
return Math.round(this.priceY() + this.lineHeight() * 2.5);
};
Window_ShopNumber.prototype.cursorWidth = function() {
var digitWidth = this.textWidth('0');
return this.maxDigits() * digitWidth + this.textPadding() * 2;
};
Window_ShopNumber.prototype.cursorX = function() {
return this.contentsWidth() - this.cursorWidth() - this.textPadding();
};
Window_ShopNumber.prototype.maxDigits = function() {
return 2;
};
/**
* Обновляет окно
*
* update
*/
Window_ShopNumber.prototype.update;
Window_ShopNumber.prototype.isOkTriggered = function() {
return Input.isTriggered('ok');
};
Window_ShopNumber.prototype.playOkSound = function() {
};
Window_ShopNumber.prototype.processNumberChange = function() {
if (this.isOpenAndActive()) {
if (Input.isRepeated('right')) {
this.changeNumber(1);
}
if (Input.isRepeated('left')) {
this.changeNumber(-1);
}
if (Input.isRepeated('up')) {
this.changeNumber(10);
}
if (Input.isRepeated('down')) {
this.changeNumber(-10);
}
}
};
Window_ShopNumber.prototype.changeNumber = function(amount) {
var lastNumber = this._number;
this._number = (this._number + amount).clamp(1, this._max);
if (this._number !== lastNumber) {
SoundManager.playCursor();
this.refresh();
}
};
Window_ShopNumber.prototype.updateCursor = function() {
this.setCursorRect(this.cursorX(), this.itemY(),
this.cursorWidth(), this.lineHeight());
};
Window_ShopNumber.prototype.onButtonUp = function() {
this.changeNumber(1);
};
Window_ShopNumber.prototype.onButtonUp2 = function() {
this.changeNumber(10);
};
Window_ShopNumber.prototype.onButtonDown = function() {
this.changeNumber(-1);
};
Window_ShopNumber.prototype.onButtonDown2 = function() {
this.changeNumber(-10);
};
Window_ShopNumber.prototype.onButtonOk = function() {
this.processOk();
};
/**
* Окно для отображения количества предметов, имеющихся у персонажа на экране магазина
* The window for displaying number of items in possession and the actor's equipment on the shop screen
*
* @class Window_ShopStatus
* @augments Window_Base
*/
function Window_ShopStatus() {
this.initialize.apply(this, arguments);
}
Window_ShopStatus.prototype = Object.create(Window_Base.prototype);
Window_ShopStatus.prototype.constructor = Window_ShopStatus;
/**
* Инициализирует объект класса
*
* initialize
* @param {Number} x - Координата X
* @param {Number} y - Координата Y
* @param {Number} width - Ширина окна
* @param {Number} height - Высота окна
*/
Window_ShopStatus.prototype.initialize;
/**
* Перерисовывает окно
*
* refresh
*/
Window_ShopStatus.prototype.refresh;
Window_ShopStatus.prototype.setItem = function(item) {
this._item = item;
this.refresh();
};
Window_ShopStatus.prototype.isEquipItem = function() {
return DataManager.isWeapon(this._item) || DataManager.isArmor(this._item);
};
Window_ShopStatus.prototype.drawPossession = function(x, y) {
var width = this.contents.width - this.textPadding() - x;
var possessionWidth = this.textWidth('0000');
this.changeTextColor(this.systemColor());
this.drawText(TextManager.possession, x, y, width - possessionWidth);
this.resetTextColor();
this.drawText($gameParty.numItems(this._item), x, y, width, 'right');
};
Window_ShopStatus.prototype.drawEquipInfo = function(x, y) {
var members = this.statusMembers();
for (var i = 0; i < members.length; i++) {
this.drawActorEquipInfo(x, y + this.lineHeight() * (i * 2.4), members[i]);
}
};
Window_ShopStatus.prototype.statusMembers = function() {
var start = this._pageIndex * this.pageSize();
var end = start + this.pageSize();
return $gameParty.members().slice(start, end);
};
Window_ShopStatus.prototype.pageSize = function() {
return 4;
};
Window_ShopStatus.prototype.maxPages = function() {
return Math.floor(($gameParty.size() + this.pageSize() - 1) / this.pageSize());
};
Window_ShopStatus.prototype.drawActorEquipInfo = function(x, y, actor) {
var enabled = actor.canEquip(this._item);
this.changePaintOpacity(enabled);
this.resetTextColor();
this.drawText(actor.name(), x, y, 168);
var item1 = this.currentEquippedItem(actor, this._item.etypeId);
if (enabled) {
this.drawActorParamChange(x, y, actor, item1);
}
this.drawItemName(item1, x, y + this.lineHeight());
this.changePaintOpacity(true);
};
Window_ShopStatus.prototype.drawActorParamChange = function(x, y, actor, item1) {
var width = this.contents.width - this.textPadding() - x;
var paramId = this.paramId();
var change = this._item.params[paramId] - (item1 ? item1.params[paramId] : 0);
this.changeTextColor(this.paramchangeTextColor(change));
this.drawText((change > 0 ? '+' : '') + change, x, y, width, 'right');
};
Window_ShopStatus.prototype.paramId = function() {
return DataManager.isWeapon(this._item) ? 2 : 3;
};
Window_ShopStatus.prototype.currentEquippedItem = function(actor, etypeId) {
var list = [];
var equips = actor.equips();
var slots = actor.equipSlots();
for (var i = 0; i < slots.length; i++) {
if (slots[i] === etypeId) {
list.push(equips[i]);
}
}
var paramId = this.paramId();
var worstParam = Number.MAX_VALUE;
var worstItem = null;
for (var j = 0; j < list.length; j++) {
if (list[j] && list[j].params[paramId] < worstParam) {
worstParam = list[j].params[paramId];
worstItem = list[j];
}
}
return worstItem;
};
/**
* Обновляет окно
*
* update
*/
Window_ShopStatus.prototype.update;
Window_ShopStatus.prototype.updatePage = function() {
if (this.isPageChangeEnabled() && this.isPageChangeRequested()) {
this.changePage();
}
};
Window_ShopStatus.prototype.isPageChangeEnabled = function() {
return this.visible && this.maxPages() >= 2;
};
Window_ShopStatus.prototype.isPageChangeRequested = function() {
if (Input.isTriggered('shift')) {
return true;
}
if (TouchInput.isTriggered() && this.isTouchedInsideFrame()) {
return true;
}
return false;
};
Window_ShopStatus.prototype.isTouchedInsideFrame = function() {
var x = this.canvasToLocalX(TouchInput.x);
var y = this.canvasToLocalY(TouchInput.y);
return x >= 0 && y >= 0 && x < this.width && y < this.height;
};
Window_ShopStatus.prototype.changePage = function() {
this._pageIndex = (this._pageIndex + 1) % this.maxPages();
this.refresh();
SoundManager.playCursor();
};
/**
* Окно для редактирования имени персонажа на экране ввода имени
* The window for editing an actor's name on the name input screen
*
* @class Window_NameEdit
* @augments Window_Base
*/
function Window_NameEdit() {
this.initialize.apply(this, arguments);
}
Window_NameEdit.prototype = Object.create(Window_Base.prototype);
Window_NameEdit.prototype.constructor = Window_NameEdit;
Window_NameEdit.prototype.initialize = function(actor, maxLength) {
var width = this.windowWidth();
var height = this.windowHeight();
var x = (Graphics.boxWidth - width) / 2;
var y = (Graphics.boxHeight - (height + this.fittingHeight(9) + 8)) / 2;
Window_Base.prototype.initialize.call(this, x, y, width, height);
this._actor = actor;
this._name = actor.name().slice(0, this._maxLength);
this._index = this._name.length;
this._maxLength = maxLength;
this._defaultName = this._name;
this.deactivate();
this.refresh();
ImageManager.loadFace(actor.faceName());
};
/**
* Возвращает ширину окна
*
* windowWidth
* @returns {Number} Ширина окна
*/
Window_NameEdit.prototype.windowWidth = function() {
};
/**
* Возвращает высоту окна
*
* windowHeight
* @returns {Number} Высота окна
*/
Window_NameEdit.prototype.windowHeight = function() {
};
Window_NameEdit.prototype.name = function() {
return this._name;
};
Window_NameEdit.prototype.restoreDefault = function() {
this._name = this._defaultName;
this._index = this._name.length;
this.refresh();
return this._name.length > 0;
};
Window_NameEdit.prototype.add = function(ch) {
if (this._index < this._maxLength) {
this._name += ch;
this._index++;
this.refresh();
return true;
} else {
return false;
}
};
Window_NameEdit.prototype.back = function() {
if (this._index > 0) {
this._index--;
this._name = this._name.slice(0, this._index);
this.refresh();
return true;
} else {
return false;
}
};
Window_NameEdit.prototype.faceWidth = function() {
return 144;
};
Window_NameEdit.prototype.charWidth = function() {
var text = $gameSystem.isJapanese() ? '\uff21' : 'A';
return this.textWidth(text);
};
Window_NameEdit.prototype.left = function() {
var nameCenter = (this.contentsWidth() + this.faceWidth()) / 2;
var nameWidth = (this._maxLength + 1) * this.charWidth();
return Math.min(nameCenter - nameWidth / 2, this.contentsWidth() - nameWidth);
};
Window_NameEdit.prototype.itemRect = function(index) {
return {
x: this.left() + index * this.charWidth(),
y: 54,
width: this.charWidth(),
height: this.lineHeight()
};
};
Window_NameEdit.prototype.underlineRect = function(index) {
var rect = this.itemRect(index);
rect.x++;
rect.y += rect.height - 4;
rect.width -= 2;
rect.height = 2;
return rect;
};
Window_NameEdit.prototype.underlineColor = function() {
return this.normalColor();
};
Window_NameEdit.prototype.drawUnderline = function(index) {
var rect = this.underlineRect(index);
var color = this.underlineColor();
this.contents.paintOpacity = 48;
this.contents.fillRect(rect.x, rect.y, rect.width, rect.height, color);
this.contents.paintOpacity = 255;
};
Window_NameEdit.prototype.drawChar = function(index) {
var rect = this.itemRect(index);
this.resetTextColor();
this.drawText(this._name[index] || '', rect.x, rect.y);
};
/**
* Перерисовывает окно
*
* refresh
*/
Window_NameEdit.prototype.refresh;
//-----------------------------------------------------------------------------
// Window_NameInput
//
// The window for selecting text characters on the name input screen.
function Window_NameInput() {
this.initialize.apply(this, arguments);
}
Window_NameInput.prototype = Object.create(Window_Selectable.prototype);
Window_NameInput.prototype.constructor = Window_NameInput;
/**
* Первая часть латинской раскладки
*
* @type {string[]}
*/
Window_NameInput.LATIN1 =
[ 'A','B','C','D','E', 'a','b','c','d','e',
'F','G','H','I','J', 'f','g','h','i','j',
'K','L','M','N','O', 'k','l','m','n','o',
'P','Q','R','S','T', 'p','q','r','s','t',
'U','V','W','X','Y', 'u','v','w','x','y',
'Z','[',']','^','_', 'z','{','}','|','~',
'0','1','2','3','4', '!','#','$','%','&',
'5','6','7','8','9', '(',')','*','+','-',
'/','=','@','<','>', ':',';',' ','Page','OK' ];
/**
* Вторая часть латинской раскладки
*
* @type {string[]}
*/
Window_NameInput.LATIN2 =
[ 'Á','É','Í','Ó','Ú', 'á','é','í','ó','ú',
'À','È','Ì','Ò','Ù', 'à','è','ì','ò','ù',
'Â','Ê','Î','Ô','Û', 'â','ê','î','ô','û',
'Ä','Ë','Ï','Ö','Ü', 'ä','ë','ï','ö','ü',
'Ā','Ē','Ī','Ō','Ū', 'ā','ē','ī','ō','ū',
'Ã','Å','Æ','Ç','Ð', 'ã','å','æ','ç','ð',
'Ñ','Õ','Ø','Š','Ŵ', 'ñ','õ','ø','š','ŵ',
'Ý','Ŷ','Ÿ','Ž','Þ', 'ý','ÿ','ŷ','ž','þ',
'IJ','Œ','ij','œ','ß', '«','»',' ','Page','OK' ];
/**
* Русская раскладка
*
* @type {string[]}
*/
Window_NameInput.RUSSIA =
[ 'А','Б','В','Г','Д', 'а','б','в','г','д',
'Е','Ё','Ж','З','И', 'е','ё','ж','з','и',
'Й','К','Л','М','Н', 'й','к','л','м','н',
'О','П','Р','С','Т', 'о','п','р','с','т',
'У','Ф','Х','Ц','Ч', 'у','ф','х','ц','ч',
'Ш','Щ','Ъ','Ы','Ь', 'ш','щ','ъ','ы','ь',
'Э','Ю','Я','^','_', 'э','ю','я','%','&',
'0','1','2','3','4', '(',')','*','+','-',
'5','6','7','8','9', ':',';',' ','','OK' ];
/**
* Первая часть японской расладки
*
* @type {string[]}
*/
Window_NameInput.JAPAN1 =
[ 'あ','い','う','え','お', 'が','ぎ','ぐ','げ','ご',
'か','き','く','け','こ', 'ざ','じ','ず','ぜ','ぞ',
'さ','し','す','せ','そ', 'だ','ぢ','づ','で','ど',
'た','ち','つ','て','と', 'ば','び','ぶ','べ','ぼ',
'な','に','ぬ','ね','の', 'ぱ','ぴ','ぷ','ぺ','ぽ',
'は','ひ','ふ','へ','ほ', 'ぁ','ぃ','ぅ','ぇ','ぉ',
'ま','み','む','め','も', 'っ','ゃ','ゅ','ょ','ゎ',
'や','ゆ','よ','わ','ん', 'ー','~','・','=','☆',
'ら','り','る','れ','ろ', 'ゔ','を',' ','カナ','決定' ];
/**
* Вторая часть японской расладки
*
* @type {string[]}
*/
Window_NameInput.JAPAN2 =
[ 'ア','イ','ウ','エ','オ', 'ガ','ギ','グ','ゲ','ゴ',
'カ','キ','ク','ケ','コ', 'ザ','ジ','ズ','ゼ','ゾ',
'サ','シ','ス','セ','ソ', 'ダ','ヂ','ヅ','デ','ド',
'タ','チ','ツ','テ','ト', 'バ','ビ','ブ','ベ','ボ',
'ナ','ニ','ヌ','ネ','ノ', 'パ','ピ','プ','ペ','ポ',
'ハ','ヒ','フ','ヘ','ホ', 'ァ','ィ','ゥ','ェ','ォ',
'マ','ミ','ム','メ','モ', 'ッ','ャ','ュ','ョ','ヮ',
'ヤ','ユ','ヨ','ワ','ン', 'ー','~','・','=','☆',
'ラ','リ','ル','レ','ロ', 'ヴ','ヲ',' ','英数','決定' ];
/**
* Третья часть японской расладки
*
* @type {string[]}
*/
Window_NameInput.JAPAN3 =
[ 'A','B','C','D','E', 'a','b','c','d','e',
'F','G','H','I','J', 'f','g','h','i','j',
'K','L','M','N','O', 'k','l','m','n','o',
'P','Q','R','S','T', 'p','q','r','s','t',
'U','V','W','X','Y', 'u','v','w','x','y',
'Z','[',']','^','_', 'z','{','}','|','~',
'0','1','2','3','4', '!','#','$','%','&',
'5','6','7','8','9', '(',')','*','+','-',
'/','=','@','<','>', ':',';',' ','かな','決定' ];
Window_NameInput.prototype.initialize = function(editWindow) {
var x = editWindow.x;
var y = editWindow.y + editWindow.height + 8;
var width = editWindow.width;
var height = this.windowHeight();
Window_Selectable.prototype.initialize.call(this, x, y, width, height);
this._editWindow = editWindow;
this._page = 0;
this._index = 0;
this.refresh();
this.updateCursor();
this.activate();
};
/**
* Возвращает высоту окна
*
* windowHeight
* @returns {Number} Высота окна
*/
Window_NameInput.prototype.windowHeight;
Window_NameInput.prototype.table = function() {
if ($gameSystem.isJapanese()) {
return [Window_NameInput.JAPAN1,
Window_NameInput.JAPAN2,
Window_NameInput.JAPAN3];
} else if ($gameSystem.isRussian()) {
return [Window_NameInput.RUSSIA];
} else {
return [Window_NameInput.LATIN1,
Window_NameInput.LATIN2];
}
};
/**
* Возвращает максимальное количество столбцов
*
* maxCols
* @returns {Number} Максимальное количество столбцов
*/
Window_NameInput.prototype.maxCols;
Window_NameInput.prototype.maxItems = function() {
return 90;
};
Window_NameInput.prototype.character = function() {
return this._index < 88 ? this.table()[this._page][this._index] : '';
};
Window_NameInput.prototype.isPageChange = function() {
return this._index === 88;
};
Window_NameInput.prototype.isOk = function() {
return this._index === 89;
};
Window_NameInput.prototype.itemRect = function(index) {
return {
x: index % 10 * 42 + Math.floor(index % 10 / 5) * 24,
y: Math.floor(index / 10) * this.lineHeight(),
width: 42,
height: this.lineHeight()
};
};
/**
* Перерисовывает окно
*
* refresh
*/
Window_NameInput.prototype.refresh;
Window_NameInput.prototype.updateCursor = function() {
var rect = this.itemRect(this._index);
this.setCursorRect(rect.x, rect.y, rect.width, rect.height);
};
Window_NameInput.prototype.isCursorMovable = function() {
return this.active;
};
Window_NameInput.prototype.cursorDown = function(wrap) {
if (this._index < 80 || wrap) {
this._index = (this._index + 10) % 90;
}
};
Window_NameInput.prototype.cursorUp = function(wrap) {
if (this._index >= 10 || wrap) {
this._index = (this._index + 80) % 90;
}
};
Window_NameInput.prototype.cursorRight = function(wrap) {
if (this._index % 10 < 9) {
this._index++;
} else if (wrap) {
this._index -= 9;
}
};
Window_NameInput.prototype.cursorLeft = function(wrap) {
if (this._index % 10 > 0) {
this._index--;
} else if (wrap) {
this._index += 9;
}
};
Window_NameInput.prototype.cursorPagedown = function() {
this._page = (this._page + 1) % this.table().length;
this.refresh();
};
Window_NameInput.prototype.cursorPageup = function() {
this._page = (this._page + this.table().length - 1) % this.table().length;
this.refresh();
};
Window_NameInput.prototype.processCursorMove = function() {
var lastPage = this._page;
Window_Selectable.prototype.processCursorMove.call(this);
this.updateCursor();
if (this._page !== lastPage) {
SoundManager.playCursor();
}
};
Window_NameInput.prototype.processHandling = function() {
if (this.isOpen() && this.active) {
if (Input.isTriggered('shift')) {
this.processJump();
}
if (Input.isRepeated('cancel')) {
this.processBack();
}
if (Input.isRepeated('ok')) {
this.processOk();
}
}
};
Window_NameInput.prototype.isCancelEnabled = function() {
return true;
};
Window_NameInput.prototype.processCancel = function() {
this.processBack();
};
Window_NameInput.prototype.processJump = function() {
if (this._index !== 89) {
this._index = 89;
SoundManager.playCursor();
}
};
Window_NameInput.prototype.processBack = function() {
if (this._editWindow.back()) {
SoundManager.playCancel();
}
};
Window_NameInput.prototype.processOk = function() {
if (this.character()) {
this.onNameAdd();
} else if (this.isPageChange()) {
SoundManager.playOk();
this.cursorPagedown();
} else if (this.isOk()) {
this.onNameOk();
}
};
Window_NameInput.prototype.onNameAdd = function() {
if (this._editWindow.add(this.character())) {
SoundManager.playOk();
} else {
SoundManager.playBuzzer();
}
};
Window_NameInput.prototype.onNameOk = function() {
if (this._editWindow.name() === '') {
if (this._editWindow.restoreDefault()) {
SoundManager.playOk();
} else {
SoundManager.playBuzzer();
}
} else {
SoundManager.playOk();
this.callOkHandler();
}
};
//-----------------------------------------------------------------------------
// Window_ChoiceList
//
// The window used for the event command [Show Choices].
function Window_ChoiceList() {
this.initialize.apply(this, arguments);
}
Window_ChoiceList.prototype = Object.create(Window_Command.prototype);
Window_ChoiceList.prototype.constructor = Window_ChoiceList;
Window_ChoiceList.prototype.initialize = function(messageWindow) {
this._messageWindow = messageWindow;
Window_Command.prototype.initialize.call(this, 0, 0);
this.openness = 0;
this.deactivate();
this._background = 0;
};
Window_ChoiceList.prototype.start = function() {
this.updatePlacement();
this.updateBackground();
this.refresh();
this.selectDefault();
this.open();
this.activate();
};
Window_ChoiceList.prototype.selectDefault = function() {
this.select($gameMessage.choiceDefaultType());
};
/**
* Обновляет расположение окна
*
* updatePlacement
*/
Window_ChoiceList.prototype.updatePlacement;
Window_ChoiceList.prototype.updateBackground = function() {
this._background = $gameMessage.choiceBackground();
this.setBackgroundType(this._background);
};
/**
* Возвращает ширину окна
*
* windowWidth
* @returns {Number} Ширина окна
*/
Window_ChoiceList.prototype.windowWidth;
/**
* Возвращает количество видимых рядов
*
* numVisibleRows
* @returns {Number} Количество видимых рядов
*/
Window_ChoiceList.prototype.numVisibleRows;
Window_ChoiceList.prototype.maxChoiceWidth = function() {
var maxWidth = 96;
var choices = $gameMessage.choices();
for (var i = 0; i < choices.length; i++) {
var choiceWidth = this.textWidthEx(choices[i]) + this.textPadding() * 2;
if (maxWidth < choiceWidth) {
maxWidth = choiceWidth;
}
}
return maxWidth;
};
Window_ChoiceList.prototype.textWidthEx = function(text) {
return this.drawTextEx(text, 0, this.contents.height);
};
Window_ChoiceList.prototype.contentsHeight = function() {
return this.maxItems() * this.itemHeight();
};
/**
* Создает список команд
*
* makeCommandList
*/
Window_ChoiceList.prototype.makeCommandList;
Window_ChoiceList.prototype.drawItem = function(index) {
var rect = this.itemRectForText(index);
this.drawTextEx(this.commandName(index), rect.x, rect.y);
};
Window_ChoiceList.prototype.isCancelEnabled = function() {
return $gameMessage.choiceCancelType() !== -1;
};
Window_ChoiceList.prototype.isOkTriggered = function() {
return Input.isTriggered('ok');
};
Window_ChoiceList.prototype.callOkHandler = function() {
$gameMessage.onChoice(this.index());
this._messageWindow.terminateMessage();
this.close();
};
Window_ChoiceList.prototype.callCancelHandler = function() {
$gameMessage.onChoice($gameMessage.choiceCancelType());
this._messageWindow.terminateMessage();
this.close();
};
//-----------------------------------------------------------------------------
// Window_NumberInput
//
// The window used for the event command [Input Number].
function Window_NumberInput() {
this.initialize.apply(this, arguments);
}
Window_NumberInput.prototype = Object.create(Window_Selectable.prototype);
Window_NumberInput.prototype.constructor = Window_NumberInput;
Window_NumberInput.prototype.initialize = function(messageWindow) {
this._messageWindow = messageWindow;
Window_Selectable.prototype.initialize.call(this, 0, 0, 0, 0);
this._number = 0;
this._maxDigits = 1;
this.openness = 0;
this.createButtons();
this.deactivate();
};
Window_NumberInput.prototype.start = function() {
this._maxDigits = $gameMessage.numInputMaxDigits();
this._number = $gameVariables.value($gameMessage.numInputVariableId());
this._number = this._number.clamp(0, Math.pow(10, this._maxDigits) - 1);
this.updatePlacement();
this.placeButtons();
this.updateButtonsVisiblity();
this.createContents();
this.refresh();
this.open();
this.activate();
this.select(0);
};
/**
* Обновляет расположение окна
*
* updatePlacement
*/
Window_NumberInput.prototype.updatePlacement;
/**
* Возвращает ширину окна
*
* windowWidth
* @returns {Number} Ширина окна
*/
Window_NumberInput.prototype.windowWidth;
/**
* Возвращает высоту окна
*
* windowHeight
* @returns {Number} Высота окна
*/
Window_NumberInput.prototype.windowHeight;
/**
* Возвращает максимальное количество столбцов
*
* maxCols
* @returns {Number} Максимальное количество столбцов
*/
Window_NumberInput.prototype.maxCols;
Window_NumberInput.prototype.maxItems = function() {
return this._maxDigits;
};
Window_NumberInput.prototype.spacing = function() {
return 0;
};
/**
* Возвращает ширину команды
*
* itemWidth
* @returns {Number} Ширина команды
*/
Window_NumberInput.prototype.itemWidth;
/**
* Создает спрайты кнопок
*
* createButtons
*/
Window_NumberInput.prototype.createButtons;
Window_NumberInput.prototype.placeButtons = function() {
var numButtons = this._buttons.length;
var spacing = 16;
var totalWidth = -spacing;
for (var i = 0; i < numButtons; i++) {
totalWidth += this._buttons[i].width + spacing;
}
var x = (this.width - totalWidth) / 2;
for (var j = 0; j < numButtons; j++) {
var button = this._buttons[j];
button.x = x;
button.y = this.buttonY();
x += button.width + spacing;
}
};
Window_NumberInput.prototype.updateButtonsVisiblity = function() {
if (TouchInput.date > Input.date) {
this.showButtons();
} else {
this.hideButtons();
}
};
Window_NumberInput.prototype.showButtons = function() {
for (var i = 0; i < this._buttons.length; i++) {
this._buttons[i].visible = true;
}
};
Window_NumberInput.prototype.hideButtons = function() {
for (var i = 0; i < this._buttons.length; i++) {
this._buttons[i].visible = false;
}
};
Window_NumberInput.prototype.buttonY = function() {
var spacing = 8;
if (this._messageWindow.y >= Graphics.boxHeight / 2) {
return 0 - this._buttons[0].height - spacing;
} else {
return this.height + spacing;
}
};
/**
* Обновляет окно
*
* update
*/
Window_NumberInput.prototype.update;
Window_NumberInput.prototype.processDigitChange = function() {
if (this.isOpenAndActive()) {
if (Input.isRepeated('up')) {
this.changeDigit(true);
} else if (Input.isRepeated('down')) {
this.changeDigit(false);
}
}
};
Window_NumberInput.prototype.changeDigit = function(up) {
var index = this.index();
var place = Math.pow(10, this._maxDigits - 1 - index);
var n = Math.floor(this._number / place) % 10;
this._number -= n * place;
if (up) {
n = (n + 1) % 10;
} else {
n = (n + 9) % 10;
}
this._number += n * place;
this.refresh();
SoundManager.playCursor();
};
Window_NumberInput.prototype.isTouchOkEnabled = function() {
return false;
};
Window_NumberInput.prototype.isOkEnabled = function() {
return true;
};
Window_NumberInput.prototype.isCancelEnabled = function() {
return false;
};
Window_NumberInput.prototype.isOkTriggered = function() {
return Input.isTriggered('ok');
};
Window_NumberInput.prototype.processOk = function() {
SoundManager.playOk();
$gameVariables.setValue($gameMessage.numInputVariableId(), this._number);
this._messageWindow.terminateMessage();
this.updateInputData();
this.deactivate();
this.close();
};
Window_NumberInput.prototype.drawItem = function(index) {
var rect = this.itemRect(index);
var align = 'center';
var s = this._number.padZero(this._maxDigits);
var c = s.slice(index, index + 1);
this.resetTextColor();
this.drawText(c, rect.x, rect.y, rect.width, align);
};
Window_NumberInput.prototype.onButtonUp = function() {
this.changeDigit(true);
};
Window_NumberInput.prototype.onButtonDown = function() {
this.changeDigit(false);
};
Window_NumberInput.prototype.onButtonOk = function() {
this.processOk();
this.hideButtons();
};
//-----------------------------------------------------------------------------
// Window_EventItem
//
// The window used for the event command [Select Item].
function Window_EventItem() {
this.initialize.apply(this, arguments);
}
Window_EventItem.prototype = Object.create(Window_ItemList.prototype);
Window_EventItem.prototype.constructor = Window_EventItem;
Window_EventItem.prototype.initialize = function(messageWindow) {
this._messageWindow = messageWindow;
var width = Graphics.boxWidth;
var height = this.windowHeight();
Window_ItemList.prototype.initialize.call(this, 0, 0, width, height);
this.openness = 0;
this.deactivate();
this.setHandler('ok', this.onOk.bind(this));
this.setHandler('cancel', this.onCancel.bind(this));
};
/**
* Возвращает высоту окна
*
* windowHeight
* @returns {Number} Высота окна
*/
Window_EventItem.prototype.windowHeight;
/**
* Возвращает количество видимых рядов
*
* numVisibleRows
* @returns {Number} Количество видимых рядов
*/
Window_EventItem.prototype.numVisibleRows;
Window_EventItem.prototype.start = function() {
this.refresh();
this.updatePlacement();
this.select(0);
this.open();
this.activate();
};
/**
* Обновляет расположение окна
*
* updatePlacement
*/
Window_EventItem.prototype.updatePlacement;
Window_EventItem.prototype.includes = function(item) {
var itypeId = $gameMessage.itemChoiceItypeId();
return DataManager.isItem(item) && item.itypeId === itypeId;
};
Window_EventItem.prototype.isEnabled = function(item) {
return true;
};
Window_EventItem.prototype.onOk = function() {
var item = this.item();
var itemId = item ? item.id : 0;
$gameVariables.setValue($gameMessage.itemChoiceVariableId(), itemId);
this._messageWindow.terminateMessage();
this.close();
};
Window_EventItem.prototype.onCancel = function() {
$gameVariables.setValue($gameMessage.itemChoiceVariableId(), 0);
this._messageWindow.terminateMessage();
this.close();
};
//-----------------------------------------------------------------------------
// Window_Message
//
// The window for displaying text messages.
function Window_Message() {
this.initialize.apply(this, arguments);
}
Window_Message.prototype = Object.create(Window_Base.prototype);
Window_Message.prototype.constructor = Window_Message;
/**
* Инициализирует объект класса
*
* initialize
*/
Window_Message.prototype.initialize;
Window_Message.prototype.initMembers = function() {
this._background = 0;
this._positionType = 2;
this._waitCount = 0;
this._faceBitmap = null;
this._textState = null;
this.clearFlags();
};
Window_Message.prototype.subWindows = function() {
return [this._goldWindow, this._choiceWindow,
this._numberWindow, this._itemWindow];
};
Window_Message.prototype.createSubWindows = function() {
this._goldWindow = new Window_Gold(0, 0);
this._goldWindow.x = Graphics.boxWidth - this._goldWindow.width;
this._goldWindow.openness = 0;
this._choiceWindow = new Window_ChoiceList(this);
this._numberWindow = new Window_NumberInput(this);
this._itemWindow = new Window_EventItem(this);
};
/**
* Возвращает ширину окна
*
* windowWidth
* @returns {Number} Ширина окна
*/
Window_Message.prototype.windowWidth;
/**
* Возвращает высоту окна
*
* windowHeight
* @returns {Number} Высота окна
*/
Window_Message.prototype.windowHeight;
Window_Message.prototype.clearFlags = function() {
this._showFast = false;
this._lineShowFast = false;
this._pauseSkip = false;
};
/**
* Возвращает количество видимых рядов
*
* numVisibleRows
* @returns {Number} Количество видимых рядов
*/
Window_Message.prototype.numVisibleRows;
/**
* Обновляет окно
*
* update
*/
Window_Message.prototype.update;
Window_Message.prototype.checkToNotClose = function() {
if (this.isClosing() && this.isOpen()) {
if (this.doesContinue()) {
this.open();
}
}
};
Window_Message.prototype.canStart = function() {
return $gameMessage.hasText() && !$gameMessage.scrollMode();
};
Window_Message.prototype.startMessage = function() {
this._textState = {};
this._textState.index = 0;
this._textState.text = this.convertEscapeCharacters($gameMessage.allText());
this.newPage(this._textState);
this.updatePlacement();
this.updateBackground();
this.open();
};
/**
* Обновляет расположение окна
*
* updatePlacement
*/
Window_Message.prototype.updatePlacement;
Window_Message.prototype.updateBackground = function() {
this._background = $gameMessage.background();
this.setBackgroundType(this._background);
};
Window_Message.prototype.terminateMessage = function() {
this.close();
this._goldWindow.close();
$gameMessage.clear();
};
Window_Message.prototype.updateWait = function() {
if (this._waitCount > 0) {
this._waitCount--;
return true;
} else {
return false;
}
};
Window_Message.prototype.updateLoading = function() {
if (this._faceBitmap) {
if (ImageManager.isReady()) {
this.drawMessageFace();
this._faceBitmap = null;
return false;
} else {
return true;
}
} else {
return false;
}
};
Window_Message.prototype.updateInput = function() {
if (this.isAnySubWindowActive()) {
return true;
}
if (this.pause) {
if (this.isTriggered()) {
Input.update();
this.pause = false;
if (!this._textState) {
this.terminateMessage();
}
}
return true;
}
return false;
};
Window_Message.prototype.isAnySubWindowActive = function() {
return (this._choiceWindow.active ||
this._numberWindow.active ||
this._itemWindow.active);
};
Window_Message.prototype.updateMessage = function() {
if (this._textState) {
while (!this.isEndOfText(this._textState)) {
if (this.needsNewPage(this._textState)) {
this.newPage(this._textState);
}
this.updateShowFast();
this.processCharacter(this._textState);
if (!this._showFast && !this._lineShowFast) {
break;
}
if (this.pause || this._waitCount > 0) {
break;
}
}
if (this.isEndOfText(this._textState)) {
this.onEndOfText();
}
return true;
} else {
return false;
}
};
Window_Message.prototype.onEndOfText = function() {
if (!this.startInput()) {
if (!this._pauseSkip) {
this.startPause();
} else {
this.terminateMessage();
}
}
this._textState = null;
};
Window_Message.prototype.startInput = function() {
if ($gameMessage.isChoice()) {
this._choiceWindow.start();
return true;
} else if ($gameMessage.isNumberInput()) {
this._numberWindow.start();
return true;
} else if ($gameMessage.isItemChoice()) {
this._itemWindow.start();
return true;
} else {
return false;
}
};
Window_Message.prototype.isTriggered = function() {
return (Input.isRepeated('ok') || Input.isRepeated('cancel') ||
TouchInput.isRepeated());
};
Window_Message.prototype.doesContinue = function() {
return ($gameMessage.hasText() && !$gameMessage.scrollMode() &&
!this.areSettingsChanged());
};
Window_Message.prototype.areSettingsChanged = function() {
return (this._background !== $gameMessage.background() ||
this._positionType !== $gameMessage.positionType());
};
Window_Message.prototype.updateShowFast = function() {
if (this.isTriggered()) {
this._showFast = true;
}
};
Window_Message.prototype.newPage = function(textState) {
this.contents.clear();
this.resetFontSettings();
this.clearFlags();
this.loadMessageFace();
textState.x = this.newLineX();
textState.y = 0;
textState.left = this.newLineX();
textState.height = this.calcTextHeight(textState, false);
};
Window_Message.prototype.loadMessageFace = function() {
this._faceBitmap = ImageManager.loadFace($gameMessage.faceName());
};
Window_Message.prototype.drawMessageFace = function() {
this.drawFace($gameMessage.faceName(), $gameMessage.faceIndex(), 0, 0);
};
Window_Message.prototype.newLineX = function() {
return $gameMessage.faceName() === '' ? 0 : 168;
};
Window_Message.prototype.processNewLine = function(textState) {
this._lineShowFast = false;
Window_Base.prototype.processNewLine.call(this, textState);
if (this.needsNewPage(textState)) {
this.startPause();
}
};
Window_Message.prototype.processNewPage = function(textState) {
Window_Base.prototype.processNewPage.call(this, textState);
if (textState.text[textState.index] === '\n') {
textState.index++;
}
textState.y = this.contents.height;
this.startPause();
};
Window_Message.prototype.isEndOfText = function(textState) {
return textState.index >= textState.text.length;
};
Window_Message.prototype.needsNewPage = function(textState) {
return (!this.isEndOfText(textState) &&
textState.y + textState.height > this.contents.height);
};
Window_Message.prototype.processEscapeCharacter = function(code, textState) {
switch (code) {
case '$':
this._goldWindow.open();
break;
case '.':
this.startWait(15);
break;
case '|':
this.startWait(60);
break;
case '!':
this.startPause();
break;
case '>':
this._lineShowFast = true;
break;
case '<':
this._lineShowFast = false;
break;
case '^':
this._pauseSkip = true;
break;
default:
Window_Base.prototype.processEscapeCharacter.call(this, code, textState);
break;
}
};
Window_Message.prototype.startWait = function(count) {
this._waitCount = count;
};
Window_Message.prototype.startPause = function() {
this.startWait(10);
this.pause = true;
};
//-----------------------------------------------------------------------------
// Window_ScrollText
//
// The window for displaying scrolling text. No frame is displayed, but it
// is handled as a window for convenience.
function Window_ScrollText() {
this.initialize.apply(this, arguments);
}
Window_ScrollText.prototype = Object.create(Window_Base.prototype);
Window_ScrollText.prototype.constructor = Window_ScrollText;
/**
* Инициализирует объект класса
*
* initialize
*/
Window_ScrollText.prototype.initialize;
/**
* Обновляет окно
*
* update
*/
Window_ScrollText.prototype.update;
Window_ScrollText.prototype.startMessage = function() {
this._text = $gameMessage.allText();
this.refresh();
this.show();
};
/**
* Перерисовывает окно
*
* refresh
*/
Window_ScrollText.prototype.refresh;
Window_ScrollText.prototype.contentsHeight = function() {
return Math.max(this._allTextHeight, 1);
};
Window_ScrollText.prototype.updateMessage = function() {
this.origin.y += this.scrollSpeed();
if (this.origin.y >= this.contents.height) {
this.terminateMessage();
}
};
Window_ScrollText.prototype.scrollSpeed = function() {
var speed = $gameMessage.scrollSpeed() / 2;
if (this.isFastForward()) {
speed *= this.fastForwardRate();
}
return speed;
};
Window_ScrollText.prototype.isFastForward = function() {
if ($gameMessage.scrollNoFast()) {
return false;
} else {
return (Input.isPressed('ok') || Input.isPressed('shift') ||
TouchInput.isPressed());
}
};
Window_ScrollText.prototype.fastForwardRate = function() {
return 3;
};
Window_ScrollText.prototype.terminateMessage = function() {
this._text = null;
$gameMessage.clear();
this.hide();
};
//-----------------------------------------------------------------------------
// Window_MapName
//
// The window for displaying the map name on the map screen.
function Window_MapName() {
this.initialize.apply(this, arguments);
}
Window_MapName.prototype = Object.create(Window_Base.prototype);
Window_MapName.prototype.constructor = Window_MapName;
/**
* Инициализирует объект класса
*
* initialize
*/
Window_MapName.prototype.initialize;
/**
* Возвращает ширину окна
*
* windowWidth
* @returns {Number} Ширина окна
*/
Window_MapName.prototype.windowWidth;
/**
* Возвращает высоту окна
*
* windowHeight
* @returns {Number} Высота окна
*/
Window_MapName.prototype.windowHeight;
/**
* Обновляет окно
*
* update
*/
Window_MapName.prototype.update;
Window_MapName.prototype.updateFadeIn = function() {
this.contentsOpacity += 16;
};
Window_MapName.prototype.updateFadeOut = function() {
this.contentsOpacity -= 16;
};
/**
* Открывает окно
*
* open
*/
Window_MapName.prototype.open;
/**
* Закрывает окно
*
* close
*/
Window_MapName.prototype.close;
/**
* Перерисовывает окно
*
* refresh
*/
Window_MapName.prototype.refresh;
Window_MapName.prototype.drawBackground = function(x, y, width, height) {
var color1 = this.dimColor1();
var color2 = this.dimColor2();
this.contents.gradientFillRect(x, y, width / 2, height, color2, color1);
this.contents.gradientFillRect(x + width / 2, y, width / 2, height, color1, color2);
};
//-----------------------------------------------------------------------------
// Window_BattleLog
//
// The window for displaying battle progress. No frame is displayed, but it is
// handled as a window for convenience.
function Window_BattleLog() {
this.initialize.apply(this, arguments);
}
Window_BattleLog.prototype = Object.create(Window_Selectable.prototype);
Window_BattleLog.prototype.constructor = Window_BattleLog;
/**
* Инициализирует объект класса
*
* initialize
*/
Window_BattleLog.prototype.initialize;
Window_BattleLog.prototype.setSpriteset = function(spriteset) {
this._spriteset = spriteset;
};
/**
* Возвращает ширину окна
*
* windowWidth
* @returns {Number} Ширина окна
*/
Window_BattleLog.prototype.windowWidth;
/**
* Возвращает высоту окна
*
* windowHeight
* @returns {Number} Высота окна
*/
Window_BattleLog.prototype.windowHeight;
Window_BattleLog.prototype.maxLines = function() {
return 10;
};
Window_BattleLog.prototype.createBackBitmap = function() {
this._backBitmap = new Bitmap(this.width, this.height);
};
Window_BattleLog.prototype.createBackSprite = function() {
this._backSprite = new Sprite();
this._backSprite.bitmap = this._backBitmap;
this._backSprite.y = this.y;
this.addChildToBack(this._backSprite);
};
Window_BattleLog.prototype.numLines = function() {
return this._lines.length;
};
Window_BattleLog.prototype.messageSpeed = function() {
return 16;
};
Window_BattleLog.prototype.isBusy = function() {
return this._waitCount > 0 || this._waitMode || this._methods.length > 0;
};
/**
* Обновляет окно
*
* update
*/
Window_BattleLog.prototype.update;
Window_BattleLog.prototype.updateWait = function() {
return this.updateWaitCount() || this.updateWaitMode();
};
Window_BattleLog.prototype.updateWaitCount = function() {
if (this._waitCount > 0) {
this._waitCount -= this.isFastForward() ? 3 : 1;
if (this._waitCount < 0) {
this._waitCount = 0;
}
return true;
}
return false;
};
Window_BattleLog.prototype.updateWaitMode = function() {
var waiting = false;
switch (this._waitMode) {
case 'effect':
waiting = this._spriteset.isEffecting();
break;
case 'movement':
waiting = this._spriteset.isAnyoneMoving();
break;
}
if (!waiting) {
this._waitMode = '';
}
return waiting;
};
Window_BattleLog.prototype.setWaitMode = function(waitMode) {
this._waitMode = waitMode;
};
Window_BattleLog.prototype.callNextMethod = function() {
if (this._methods.length > 0) {
var method = this._methods.shift();
if (method.name && this[method.name]) {
this[method.name].apply(this, method.params);
} else {
throw new Error('Method not found: ' + method.name);
}
}
};
Window_BattleLog.prototype.isFastForward = function() {
return (Input.isLongPressed('ok') || Input.isPressed('shift') ||
TouchInput.isLongPressed());
};
Window_BattleLog.prototype.push = function(methodName) {
var methodArgs = Array.prototype.slice.call(arguments, 1);
this._methods.push({ name: methodName, params: methodArgs });
};
Window_BattleLog.prototype.clear = function() {
this._lines = [];
this._baseLineStack = [];
this.refresh();
};
Window_BattleLog.prototype.wait = function() {
this._waitCount = this.messageSpeed();
};
Window_BattleLog.prototype.waitForEffect = function() {
this.setWaitMode('effect');
};
Window_BattleLog.prototype.waitForMovement = function() {
this.setWaitMode('movement');
};
Window_BattleLog.prototype.addText = function(text) {
this._lines.push(text);
this.refresh();
this.wait();
};
Window_BattleLog.prototype.pushBaseLine = function() {
this._baseLineStack.push(this._lines.length);
};
Window_BattleLog.prototype.popBaseLine = function() {
var baseLine = this._baseLineStack.pop();
while (this._lines.length > baseLine) {
this._lines.pop();
}
};
Window_BattleLog.prototype.waitForNewLine = function() {
var baseLine = 0;
if (this._baseLineStack.length > 0) {
baseLine = this._baseLineStack[this._baseLineStack.length - 1];
}
if (this._lines.length > baseLine) {
this.wait();
}
};
Window_BattleLog.prototype.popupDamage = function(target) {
target.startDamagePopup();
};
Window_BattleLog.prototype.performActionStart = function(subject, action) {
subject.performActionStart(action);
};
Window_BattleLog.prototype.performAction = function(subject, action) {
subject.performAction(action);
};
Window_BattleLog.prototype.performActionEnd = function(subject) {
subject.performActionEnd();
};
Window_BattleLog.prototype.performDamage = function(target) {
target.performDamage();
};
Window_BattleLog.prototype.performMiss = function(target) {
target.performMiss();
};
Window_BattleLog.prototype.performRecovery = function(target) {
target.performRecovery();
};
Window_BattleLog.prototype.performEvasion = function(target) {
target.performEvasion();
};
Window_BattleLog.prototype.performMagicEvasion = function(target) {
target.performMagicEvasion();
};
Window_BattleLog.prototype.performCounter = function(target) {
target.performCounter();
};
Window_BattleLog.prototype.performReflection = function(target) {
target.performReflection();
};
Window_BattleLog.prototype.performSubstitute = function(substitute, target) {
substitute.performSubstitute(target);
};
Window_BattleLog.prototype.performCollapse = function(target) {
target.performCollapse();
};
Window_BattleLog.prototype.showAnimation = function(subject, targets, animationId) {
if (animationId < 0) {
this.showAttackAnimation(subject, targets);
} else {
this.showNormalAnimation(targets, animationId);
}
};
Window_BattleLog.prototype.showAttackAnimation = function(subject, targets) {
if (subject.isActor()) {
this.showActorAttackAnimation(subject, targets);
} else {
this.showEnemyAttackAnimation(subject, targets);
}
};
Window_BattleLog.prototype.showActorAttackAnimation = function(subject, targets) {
this.showNormalAnimation(targets, subject.attackAnimationId1(), false);
this.showNormalAnimation(targets, subject.attackAnimationId2(), true);
};
Window_BattleLog.prototype.showEnemyAttackAnimation = function(subject, targets) {
SoundManager.playEnemyAttack();
};
Window_BattleLog.prototype.showNormalAnimation = function(targets, animationId, mirror) {
var animation = $dataAnimations[animationId];
if (animation) {
var delay = this.animationBaseDelay();
var nextDelay = this.animationNextDelay();
targets.forEach(function(target) {
target.startAnimation(animationId, mirror, delay);
delay += nextDelay;
});
}
};
Window_BattleLog.prototype.animationBaseDelay = function() {
return 8;
};
Window_BattleLog.prototype.animationNextDelay = function() {
return 12;
};
/**
* Перерисовывает окно
*
* refresh
*/
Window_BattleLog.prototype.refresh;
Window_BattleLog.prototype.drawBackground = function() {
var rect = this.backRect();
var color = this.backColor();
this._backBitmap.clear();
this._backBitmap.paintOpacity = this.backPaintOpacity();
this._backBitmap.fillRect(rect.x, rect.y, rect.width, rect.height, color);
this._backBitmap.paintOpacity = 255;
};
Window_BattleLog.prototype.backRect = function() {
return {
x: 0,
y: this.padding,
width: this.width,
height: this.numLines() * this.lineHeight()
};
};
Window_BattleLog.prototype.backColor = function() {
return '#000000';
};
Window_BattleLog.prototype.backPaintOpacity = function() {
return 64;
};
Window_BattleLog.prototype.drawLineText = function(index) {
var rect = this.itemRectForText(index);
this.contents.clearRect(rect.x, rect.y, rect.width, rect.height);
this.drawTextEx(this._lines[index], rect.x, rect.y, rect.width);
};
Window_BattleLog.prototype.startTurn = function() {
this.push('wait');
};
Window_BattleLog.prototype.startAction = function(subject, action, targets) {
var item = action.item();
this.push('performActionStart', subject, action);
this.push('waitForMovement');
this.push('performAction', subject, action);
this.push('showAnimation', subject, targets.clone(), item.animationId);
this.displayAction(subject, item);
};
Window_BattleLog.prototype.endAction = function(subject) {
this.push('waitForNewLine');
this.push('clear');
this.push('performActionEnd', subject);
};
Window_BattleLog.prototype.displayCurrentState = function(subject) {
var stateText = subject.mostImportantStateText();
if (stateText) {
this.push('addText', subject.name() + stateText);
this.push('wait');
this.push('clear');
}
};
Window_BattleLog.prototype.displayRegeneration = function(subject) {
this.push('popupDamage', subject);
};
Window_BattleLog.prototype.displayAction = function(subject, item) {
var numMethods = this._methods.length;
if (DataManager.isSkill(item)) {
if (item.message1) {
this.push('addText', subject.name() + item.message1.format(item.name));
}
if (item.message2) {
this.push('addText', item.message2.format(item.name));
}
} else {
this.push('addText', TextManager.useItem.format(subject.name(), item.name));
}
if (this._methods.length === numMethods) {
this.push('wait');
}
};
Window_BattleLog.prototype.displayCounter = function(target) {
this.push('performCounter', target);
this.push('addText', TextManager.counterAttack.format(target.name()));
};
Window_BattleLog.prototype.displayReflection = function(target) {
this.push('performReflection', target);
this.push('addText', TextManager.magicReflection.format(target.name()));
};
Window_BattleLog.prototype.displaySubstitute = function(substitute, target) {
var substName = substitute.name();
this.push('performSubstitute', substitute, target);
this.push('addText', TextManager.substitute.format(substName, target.name()));
};
Window_BattleLog.prototype.displayActionResults = function(subject, target) {
if (target.result().used) {
this.push('pushBaseLine');
this.displayCritical(target);
this.push('popupDamage', target);
this.push('popupDamage', subject);
this.displayDamage(target);
this.displayAffectedStatus(target);
this.displayFailure(target);
this.push('waitForNewLine');
this.push('popBaseLine');
}
};
Window_BattleLog.prototype.displayFailure = function(target) {
if (target.result().isHit() && !target.result().success) {
this.push('addText', TextManager.actionFailure.format(target.name()));
}
};
Window_BattleLog.prototype.displayCritical = function(target) {
if (target.result().critical) {
if (target.isActor()) {
this.push('addText', TextManager.criticalToActor);
} else {
this.push('addText', TextManager.criticalToEnemy);
}
}
};
Window_BattleLog.prototype.displayDamage = function(target) {
if (target.result().missed) {
this.displayMiss(target);
} else if (target.result().evaded) {
this.displayEvasion(target);
} else {
this.displayHpDamage(target);
this.displayMpDamage(target);
this.displayTpDamage(target);
}
};
Window_BattleLog.prototype.displayMiss = function(target) {
var fmt;
if (target.result().physical) {
fmt = target.isActor() ? TextManager.actorNoHit : TextManager.enemyNoHit;
this.push('performMiss', target);
} else {
fmt = TextManager.actionFailure;
}
this.push('addText', fmt.format(target.name()));
};
Window_BattleLog.prototype.displayEvasion = function(target) {
var fmt;
if (target.result().physical) {
fmt = TextManager.evasion;
this.push('performEvasion', target);
} else {
fmt = TextManager.magicEvasion;
this.push('performMagicEvasion', target);
}
this.push('addText', fmt.format(target.name()));
};
Window_BattleLog.prototype.displayHpDamage = function(target) {
if (target.result().hpAffected) {
if (target.result().hpDamage > 0 && !target.result().drain) {
this.push('performDamage', target);
}
if (target.result().hpDamage < 0) {
this.push('performRecovery', target);
}
this.push('addText', this.makeHpDamageText(target));
}
};
Window_BattleLog.prototype.displayMpDamage = function(target) {
if (target.isAlive() && target.result().mpDamage !== 0) {
if (target.result().mpDamage < 0) {
this.push('performRecovery', target);
}
this.push('addText', this.makeMpDamageText(target));
}
};
Window_BattleLog.prototype.displayTpDamage = function(target) {
if (target.isAlive() && target.result().tpDamage !== 0) {
if (target.result().tpDamage < 0) {
this.push('performRecovery', target);
}
this.push('addText', this.makeTpDamageText(target));
}
};
Window_BattleLog.prototype.displayAffectedStatus = function(target) {
if (target.result().isStatusAffected()) {
this.push('pushBaseLine');
this.displayChangedStates(target);
this.displayChangedBuffs(target);
this.push('waitForNewLine');
this.push('popBaseLine');
}
};
Window_BattleLog.prototype.displayAutoAffectedStatus = function(target) {
if (target.result().isStatusAffected()) {
this.displayAffectedStatus(target, null);
this.push('clear');
}
};
Window_BattleLog.prototype.displayChangedStates = function(target) {
this.displayAddedStates(target);
this.displayRemovedStates(target);
};
Window_BattleLog.prototype.displayAddedStates = function(target) {
target.result().addedStateObjects().forEach(function(state) {
var stateMsg = target.isActor() ? state.message1 : state.message2;
if (state.id === target.deathStateId()) {
this.push('performCollapse', target);
}
if (stateMsg) {
this.push('popBaseLine');
this.push('pushBaseLine');
this.push('addText', target.name() + stateMsg);
this.push('waitForEffect');
}
}, this);
};
Window_BattleLog.prototype.displayRemovedStates = function(target) {
target.result().removedStateObjects().forEach(function(state) {
if (state.message4) {
this.push('popBaseLine');
this.push('pushBaseLine');
this.push('addText', target.name() + state.message4);
}
}, this);
};
Window_BattleLog.prototype.displayChangedBuffs = function(target) {
var result = target.result();
this.displayBuffs(target, result.addedBuffs, TextManager.buffAdd);
this.displayBuffs(target, result.addedDebuffs, TextManager.debuffAdd);
this.displayBuffs(target, result.removedBuffs, TextManager.buffRemove);
};
Window_BattleLog.prototype.displayBuffs = function(target, buffs, fmt) {
buffs.forEach(function(paramId) {
this.push('popBaseLine');
this.push('pushBaseLine');
this.push('addText', fmt.format(target.name(), TextManager.param(paramId)));
}, this);
};
Window_BattleLog.prototype.makeHpDamageText = function(target) {
var result = target.result();
var damage = result.hpDamage;
var isActor = target.isActor();
var fmt;
if (damage > 0 && result.drain) {
fmt = isActor ? TextManager.actorDrain : TextManager.enemyDrain;
return fmt.format(target.name(), TextManager.hp, damage);
} else if (damage > 0) {
fmt = isActor ? TextManager.actorDamage : TextManager.enemyDamage;
return fmt.format(target.name(), damage);
} else if (damage < 0) {
fmt = isActor ? TextManager.actorRecovery : TextManager.enemyRecovery;
return fmt.format(target.name(), TextManager.hp, -damage);
} else {
fmt = isActor ? TextManager.actorNoDamage : TextManager.enemyNoDamage;
return fmt.format(target.name());
}
};
Window_BattleLog.prototype.makeMpDamageText = function(target) {
var result = target.result();
var damage = result.mpDamage;
var isActor = target.isActor();
var fmt;
if (damage > 0 && result.drain) {
fmt = isActor ? TextManager.actorDrain : TextManager.enemyDrain;
return fmt.format(target.name(), TextManager.mp, damage);
} else if (damage > 0) {
fmt = isActor ? TextManager.actorLoss : TextManager.enemyLoss;
return fmt.format(target.name(), TextManager.mp, damage);
} else if (damage < 0) {
fmt = isActor ? TextManager.actorRecovery : TextManager.enemyRecovery;
return fmt.format(target.name(), TextManager.mp, -damage);
} else {
return '';
}
};
Window_BattleLog.prototype.makeTpDamageText = function(target) {
var result = target.result();
var damage = result.tpDamage;
var isActor = target.isActor();
var fmt;
if (damage > 0) {
fmt = isActor ? TextManager.actorLoss : TextManager.enemyLoss;
return fmt.format(target.name(), TextManager.tp, damage);
} else if (damage < 0) {
fmt = isActor ? TextManager.actorGain : TextManager.enemyGain;
return fmt.format(target.name(), TextManager.tp, -damage);
} else {
return '';
}
};
//-----------------------------------------------------------------------------
// Window_PartyCommand
//
// The window for selecting whether to fight or escape on the battle screen.
function Window_PartyCommand() {
this.initialize.apply(this, arguments);
}
Window_PartyCommand.prototype = Object.create(Window_Command.prototype);
Window_PartyCommand.prototype.constructor = Window_PartyCommand;
/**
* Инициализирует объект класса
*
* initialize
*/
Window_PartyCommand.prototype.initialize;
/**
* Возвращает ширину окна
*
* windowWidth
* @returns {Number} Ширина окна
*/
Window_PartyCommand.prototype.windowWidth;
/**
* Возвращает количество видимых рядов
*
* numVisibleRows
* @returns {Number} Количество видимых рядов
*/
Window_PartyCommand.prototype.numVisibleRows;
/**
* Создает список команд
*
* makeCommandList
*/
Window_PartyCommand.prototype.makeCommandList;
Window_PartyCommand.prototype.setup = function() {
this.clearCommandList();
this.makeCommandList();
this.refresh();
this.select(0);
this.activate();
this.open();
};
//-----------------------------------------------------------------------------
// Window_ActorCommand
//
// The window for selecting an actor's action on the battle screen.
function Window_ActorCommand() {
this.initialize.apply(this, arguments);
}
Window_ActorCommand.prototype = Object.create(Window_Command.prototype);
Window_ActorCommand.prototype.constructor = Window_ActorCommand;
/**
* Инициализирует объект класса
*
* initialize
*/
Window_ActorCommand.prototype.initialize;
/**
* Возвращает ширину окна
*
* windowWidth
* @returns {Number} Ширина окна
*/
Window_ActorCommand.prototype.windowWidth;
/**
* Возвращает количество видимых рядов
*
* numVisibleRows
* @returns {Number} Количество видимых рядов
*/
Window_ActorCommand.prototype.numVisibleRows;
/**
* Создает список команд
*
* makeCommandList
*/
Window_ActorCommand.prototype.makeCommandList;
Window_ActorCommand.prototype.addAttackCommand = function() {
this.addCommand(TextManager.attack, 'attack', this._actor.canAttack());
};
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_ActorCommand.prototype.addGuardCommand = function() {
this.addCommand(TextManager.guard, 'guard', this._actor.canGuard());
};
Window_ActorCommand.prototype.addItemCommand = function() {
this.addCommand(TextManager.item, 'item');
};
Window_ActorCommand.prototype.setup = function(actor) {
this._actor = actor;
this.clearCommandList();
this.makeCommandList();
this.refresh();
this.selectLast();
this.activate();
this.open();
};
Window_ActorCommand.prototype.processOk = function() {
if (this._actor) {
if (ConfigManager.commandRemember) {
this._actor.setLastCommandSymbol(this.currentSymbol());
} else {
this._actor.setLastCommandSymbol('');
}
}
Window_Command.prototype.processOk.call(this);
};
Window_ActorCommand.prototype.selectLast = function() {
this.select(0);
if (this._actor && ConfigManager.commandRemember) {
var symbol = this._actor.lastCommandSymbol();
this.selectSymbol(symbol);
if (symbol === 'skill') {
var skill = this._actor.lastBattleSkill();
if (skill) {
this.selectExt(skill.stypeId);
}
}
}
};
//-----------------------------------------------------------------------------
// Window_BattleStatus
//
// The window for displaying the status of party members on the battle screen.
function Window_BattleStatus() {
this.initialize.apply(this, arguments);
}
Window_BattleStatus.prototype = Object.create(Window_Selectable.prototype);
Window_BattleStatus.prototype.constructor = Window_BattleStatus;
/**
* Инициализирует объект класса
*
* initialize
*/
Window_BattleStatus.prototype.initialize;
/**
* Возвращает ширину окна
*
* windowWidth
* @returns {Number} Ширина окна
*/
Window_BattleStatus.prototype.windowWidth;
/**
* Возвращает высоту окна
*
* windowHeight
* @returns {Number} Высота окна
*/
Window_BattleStatus.prototype.windowHeight;
/**
* Возвращает количество видимых рядов
*
* numVisibleRows
* @returns {Number} Количество видимых рядов
*/
Window_BattleStatus.prototype.numVisibleRows;
Window_BattleStatus.prototype.maxItems = function() {
return $gameParty.battleMembers().length;
};
/**
* Перерисовывает окно
*
* refresh
*/
Window_BattleStatus.prototype.refresh;
Window_BattleStatus.prototype.drawItem = function(index) {
var actor = $gameParty.battleMembers()[index];
this.drawBasicArea(this.basicAreaRect(index), actor);
this.drawGaugeArea(this.gaugeAreaRect(index), actor);
};
Window_BattleStatus.prototype.basicAreaRect = function(index) {
var rect = this.itemRectForText(index);
rect.width -= this.gaugeAreaWidth() + 15;
return rect;
};
Window_BattleStatus.prototype.gaugeAreaRect = function(index) {
var rect = this.itemRectForText(index);
rect.x += rect.width - this.gaugeAreaWidth();
rect.width = this.gaugeAreaWidth();
return rect;
};
Window_BattleStatus.prototype.gaugeAreaWidth = function() {
return 330;
};
Window_BattleStatus.prototype.drawBasicArea = function(rect, actor) {
this.drawActorName(actor, rect.x + 0, rect.y, 150);
this.drawActorIcons(actor, rect.x + 156, rect.y, rect.width - 156);
};
Window_BattleStatus.prototype.drawGaugeArea = function(rect, actor) {
if ($dataSystem.optDisplayTp) {
this.drawGaugeAreaWithTp(rect, actor);
} else {
this.drawGaugeAreaWithoutTp(rect, actor);
}
};
Window_BattleStatus.prototype.drawGaugeAreaWithTp = function(rect, actor) {
this.drawActorHp(actor, rect.x + 0, rect.y, 108);
this.drawActorMp(actor, rect.x + 123, rect.y, 96);
this.drawActorTp(actor, rect.x + 234, rect.y, 96);
};
Window_BattleStatus.prototype.drawGaugeAreaWithoutTp = function(rect, actor) {
this.drawActorHp(actor, rect.x + 0, rect.y, 201);
this.drawActorMp(actor, rect.x + 216, rect.y, 114);
};
//-----------------------------------------------------------------------------
// Window_BattleActor
//
// The window for selecting a target actor on the battle screen.
function Window_BattleActor() {
this.initialize.apply(this, arguments);
}
Window_BattleActor.prototype = Object.create(Window_BattleStatus.prototype);
Window_BattleActor.prototype.constructor = Window_BattleActor;
/**
* Инициализирует объект класса
*
* initialize
* @param {Number} x - Координата X
* @param {Number} y - Координата Y
*/
Window_BattleActor.prototype.initialize;
/**
* Показывает окно
*
* show
*/
Window_BattleActor.prototype.show;
/**
* Скрывает окно
*
* hide
*/
Window_BattleActor.prototype.hide;
Window_BattleActor.prototype.select = function(index) {
Window_BattleStatus.prototype.select.call(this, index);
$gameParty.select(this.actor());
};
Window_BattleActor.prototype.actor = function() {
return $gameParty.members()[this.index()];
};
//-----------------------------------------------------------------------------
// Window_BattleEnemy
//
// The window for selecting a target enemy on the battle screen.
function Window_BattleEnemy() {
this.initialize.apply(this, arguments);
}
Window_BattleEnemy.prototype = Object.create(Window_Selectable.prototype);
Window_BattleEnemy.prototype.constructor = Window_BattleEnemy;
/**
* Инициализирует объект класса
*
* initialize
* @param {Number} x - Координата X
* @param {Number} y - Координата Y
*/
Window_BattleEnemy.prototype.initialize;
/**
* Возвращает ширину окна
*
* windowWidth
* @returns {Number} Ширина окна
*/
Window_BattleEnemy.prototype.windowWidth;
/**
* Возвращает высоту окна
*
* windowHeight
* @returns {Number} Высота окна
*/
Window_BattleEnemy.prototype.windowHeight;
/**
* Возвращает количество видимых рядов
*
* numVisibleRows
* @returns {Number} Количество видимых рядов
*/
Window_BattleEnemy.prototype.numVisibleRows;
/**
* Возвращает максимальное количество столбцов
*
* maxCols
* @returns {Number} Максимальное количество столбцов
*/
Window_BattleEnemy.prototype.maxCols;
Window_BattleEnemy.prototype.maxItems = function() {
return this._enemies.length;
};
Window_BattleEnemy.prototype.enemy = function() {
return this._enemies[this.index()];
};
Window_BattleEnemy.prototype.enemyIndex = function() {
var enemy = this.enemy();
return enemy ? enemy.index() : -1;
};
Window_BattleEnemy.prototype.drawItem = function(index) {
this.resetTextColor();
var name = this._enemies[index].name();
var rect = this.itemRectForText(index);
this.drawText(name, rect.x, rect.y, rect.width);
};
/**
* Показывает окно
*
* show
*/
Window_BattleEnemy.prototype.show;
/**
* Скрывает окно
*
* hide
*/
Window_BattleEnemy.prototype.hide;
/**
* Перерисовывает окно
*
* refresh
*/
Window_BattleEnemy.prototype.refresh;
Window_BattleEnemy.prototype.select = function(index) {
Window_Selectable.prototype.select.call(this, index);
$gameTroop.select(this.enemy());
};
//-----------------------------------------------------------------------------
// Window_BattleSkill
//
// The window for selecting a skill to use on the battle screen.
function Window_BattleSkill() {
this.initialize.apply(this, arguments);
}
Window_BattleSkill.prototype = Object.create(Window_SkillList.prototype);
Window_BattleSkill.prototype.constructor = Window_BattleSkill;
/**
* Инициализирует объект класса
*
* initialize
* @param {Number} x - Координата X
* @param {Number} y - Координата Y
* @param {Number} width - Ширина окна
* @param {Number} height - Высота окна
*/
Window_BattleSkill.prototype.initialize;
/**
* Показывает окно
*
* show
*/
Window_BattleSkill.prototype.show;
/**
* Скрывает окно
*
* hide
*/
Window_BattleSkill.prototype.hide;
//-----------------------------------------------------------------------------
// Window_BattleItem
//
// The window for selecting an item to use on the battle screen.
function Window_BattleItem() {
this.initialize.apply(this, arguments);
}
Window_BattleItem.prototype = Object.create(Window_ItemList.prototype);
Window_BattleItem.prototype.constructor = Window_BattleItem;
/**
* Инициализирует объект класса
*
* initialize
* @param {Number} x - Координата X
* @param {Number} y - Координата Y
* @param {Number} width - Ширина окна
* @param {Number} height - Высота окна
*/
Window_BattleItem.prototype.initialize;
Window_BattleItem.prototype.includes = function(item) {
return $gameParty.canUse(item);
};
/**
* Показывает окно
*
* show
*/
Window_BattleItem.prototype.show;
/**
* Скрывает окно
*
* hide
*/
Window_BattleItem.prototype.hide;
//-----------------------------------------------------------------------------
// Window_TitleCommand
//
// The window for selecting New Game/Continue on the title screen.
function Window_TitleCommand() {
this.initialize.apply(this, arguments);
}
Window_TitleCommand.prototype = Object.create(Window_Command.prototype);
Window_TitleCommand.prototype.constructor = Window_TitleCommand;
/**
* Инициализирует объект класса
*
* initialize
*/
Window_TitleCommand.prototype.initialize;
Window_TitleCommand._lastCommandSymbol = null;
Window_TitleCommand.initCommandPosition = function() {
this._lastCommandSymbol = null;
};
/**
* Возвращает ширину окна
*
* windowWidth
* @returns {Number} Ширина окна
*/
Window_TitleCommand.prototype.windowWidth;
/**
* Обновляет расположение окна
*
* updatePlacement
*/
Window_TitleCommand.prototype.updatePlacement;
/**
* Создает список команд
*
* makeCommandList
*/
Window_TitleCommand.prototype.makeCommandList;
Window_TitleCommand.prototype.isContinueEnabled = function() {
return DataManager.isAnySavefileExists();
};
Window_TitleCommand.prototype.processOk = function() {
Window_TitleCommand._lastCommandSymbol = this.currentSymbol();
Window_Command.prototype.processOk.call(this);
};
Window_TitleCommand.prototype.selectLast = function() {
if (Window_TitleCommand._lastCommandSymbol) {
this.selectSymbol(Window_TitleCommand._lastCommandSymbol);
} else if (this.isContinueEnabled()) {
this.selectSymbol('continue');
}
};
//-----------------------------------------------------------------------------
// Window_GameEnd
//
// The window for selecting "Go to Title" on the game end screen.
function Window_GameEnd() {
this.initialize.apply(this, arguments);
}
Window_GameEnd.prototype = Object.create(Window_Command.prototype);
Window_GameEnd.prototype.constructor = Window_GameEnd;
/**
* Инициализирует объект класса
*
* initialize
*/
Window_GameEnd.prototype.initialize;
/**
* Возвращает ширину окна
*
* windowWidth
* @returns {Number} Ширина окна
*/
Window_GameEnd.prototype.windowWidth;
/**
* Обновляет расположение окна
*
* updatePlacement
*/
Window_GameEnd.prototype.updatePlacement;
/**
* Создает список команд
*
* makeCommandList
*/
Window_GameEnd.prototype.makeCommandList;
//-----------------------------------------------------------------------------
// Window_DebugRange
//
// The window for selecting a block of switches/variables on the debug screen.
function Window_DebugRange() {
this.initialize.apply(this, arguments);
}
Window_DebugRange.prototype = Object.create(Window_Selectable.prototype);
Window_DebugRange.prototype.constructor = Window_DebugRange;
Window_DebugRange.lastTopRow = 0;
Window_DebugRange.lastIndex = 0;
/**
* Инициализирует объект класса
*
* initialize
* @param {Number} x - Координата X
* @param {Number} y - Координата Y
*/
Window_DebugRange.prototype.initialize;
/**
* Возвращает ширину окна
*
* windowWidth
* @returns {Number} Ширина окна
*/
Window_DebugRange.prototype.windowWidth;
/**
* Возвращает высоту окна
*
* windowHeight
* @returns {Number} Высота окна
*/
Window_DebugRange.prototype.windowHeight;
Window_DebugRange.prototype.maxItems = function() {
return this._maxSwitches + this._maxVariables;
};
/**
* Обновляет окно
*
* update
*/
Window_DebugRange.prototype.update;
Window_DebugRange.prototype.mode = function() {
return this.index() < this._maxSwitches ? 'switch' : 'variable';
};
Window_DebugRange.prototype.topId = function() {
var index = this.index();
if (index < this._maxSwitches) {
return index * 10 + 1;
} else {
return (index - this._maxSwitches) * 10 + 1;
}
};
/**
* Перерисовывает окно
*
* refresh
*/
Window_DebugRange.prototype.refresh;
Window_DebugRange.prototype.drawItem = function(index) {
var rect = this.itemRectForText(index);
var start;
var text;
if (index < this._maxSwitches) {
start = index * 10 + 1;
text = 'S';
} else {
start = (index - this._maxSwitches) * 10 + 1;
text = 'V';
}
var end = start + 9;
text += ' [' + start.padZero(4) + '-' + end.padZero(4) + ']';
this.drawText(text, rect.x, rect.y, rect.width);
};
Window_DebugRange.prototype.isCancelTriggered = function() {
return (Window_Selectable.prototype.isCancelTriggered() ||
Input.isTriggered('debug'));
};
Window_DebugRange.prototype.processCancel = function() {
Window_Selectable.prototype.processCancel.call(this);
Window_DebugRange.lastTopRow = this.topRow();
Window_DebugRange.lastIndex = this.index();
};
Window_DebugRange.prototype.setEditWindow = function(editWindow) {
this._editWindow = editWindow;
this.update();
};
//-----------------------------------------------------------------------------
// Window_DebugEdit
//
// The window for displaying switches and variables on the debug screen.
function Window_DebugEdit() {
this.initialize.apply(this, arguments);
}
Window_DebugEdit.prototype = Object.create(Window_Selectable.prototype);
Window_DebugEdit.prototype.constructor = Window_DebugEdit;
/**
* Инициализирует объект класса
*
* initialize
* @param {Number} x - Координата X
* @param {Number} y - Координата Y
* @param {Number} width - Ширина окна
*/
Window_DebugEdit.prototype.initialize;
Window_DebugEdit.prototype.maxItems = function() {
return 10;
};
/**
* Перерисовывает окно
*
* refresh
*/
Window_DebugEdit.prototype.refresh;
Window_DebugEdit.prototype.drawItem = function(index) {
var dataId = this._topId + index;
var idText = dataId.padZero(4) + ':';
var idWidth = this.textWidth(idText);
var statusWidth = this.textWidth('-00000000');
var name = this.itemName(dataId);
var status = this.itemStatus(dataId);
var rect = this.itemRectForText(index);
this.resetTextColor();
this.drawText(idText, rect.x, rect.y, rect.width);
rect.x += idWidth;
rect.width -= idWidth + statusWidth;
this.drawText(name, rect.x, rect.y, rect.width);
this.drawText(status, rect.x + rect.width, rect.y, statusWidth, 'right');
};
Window_DebugEdit.prototype.itemName = function(dataId) {
if (this._mode === 'switch') {
return $dataSystem.switches[dataId];
} else {
return $dataSystem.variables[dataId];
}
};
Window_DebugEdit.prototype.itemStatus = function(dataId) {
if (this._mode === 'switch') {
return $gameSwitches.value(dataId) ? '[ON]' : '[OFF]';
} else {
return String($gameVariables.value(dataId));
}
};
Window_DebugEdit.prototype.setMode = function(mode) {
if (this._mode !== mode) {
this._mode = mode;
this.refresh();
}
};
Window_DebugEdit.prototype.setTopId = function(id) {
if (this._topId !== id) {
this._topId = id;
this.refresh();
}
};
Window_DebugEdit.prototype.currentId = function() {
return this._topId + this.index();
};
/**
* Обновляет окно
*
* update
*/
Window_DebugEdit.prototype.update;
/**
* Обновляет значение переключателя
*
* updateSwitch
*/
Window_DebugEdit.prototype.updateSwitch;
/**
* Обновляет значение переменной
*
* updateVariable
*/
Window_DebugEdit.prototype.updateVariable;