chore: init

This commit is contained in:
2024-12-28 16:33:21 -08:00
parent 0e6e5cfc96
commit 8739d9feff
1312 changed files with 82617 additions and 1 deletions

105
js/plugins/AltMenuScreen.js Normal file
View File

@@ -0,0 +1,105 @@
//=============================================================================
// RPG Maker MZ - Alternative Menu Screen
//=============================================================================
/*:
* @target MZ
* @plugindesc Alternative menu screen layout.
* @author Yoji Ojima
*
* @help AltMenuScreen.js
*
* This plugin changes the layout of the menu screen.
* It puts the commands on the top and the status on the bottom.
*
* It does not provide plugin commands.
*/
/*:ja
* @target MZ
* @plugindesc メニュー画面のレイアウトを変更します。
* @author Yoji Ojima
*
* @help AltMenuScreen.js
*
* このプラグインは、メニュー画面のレイアウトを変更します。
* コマンドを上側に、ステータスを下側に配置します。
*
* プラグインコマンドはありません。
*/
(() => {
Scene_MenuBase.prototype.commandWindowHeight = function() {
return this.calcWindowHeight(2, true);
};
Scene_MenuBase.prototype.goldWindowHeight = function() {
return this.calcWindowHeight(1, true);
};
Scene_Menu.prototype.commandWindowRect = function() {
const ww = Graphics.boxWidth;
const wh = this.commandWindowHeight();
const wx = 0;
const wy = this.mainAreaTop();
return new Rectangle(wx, wy, ww, wh);
};
Scene_Menu.prototype.statusWindowRect = function() {
const h1 = this.commandWindowHeight();
const h2 = this.goldWindowHeight();
const ww = Graphics.boxWidth;
const wh = this.mainAreaHeight() - h1 - h2;
const wx = 0;
const wy = this.mainAreaTop() + this.commandWindowHeight();
return new Rectangle(wx, wy, ww, wh);
};
Scene_ItemBase.prototype.actorWindowRect = function() {
const rect = Scene_Menu.prototype.statusWindowRect();
rect.y = this.mainAreaBottom() - rect.height;
return rect;
};
Window_MenuCommand.prototype.maxCols = function() {
return 4;
};
Window_MenuCommand.prototype.numVisibleRows = function() {
return 2;
};
Window_MenuStatus.prototype.maxCols = function() {
return 4;
};
Window_MenuStatus.prototype.numVisibleRows = function() {
return 1;
};
Window_MenuStatus.prototype.drawItemImage = function(index) {
const actor = this.actor(index);
const rect = this.itemRectWithPadding(index);
const w = Math.min(rect.width, 144);
const h = Math.min(rect.height, 144);
const lineHeight = this.lineHeight();
this.changePaintOpacity(actor.isBattleMember());
this.drawActorFace(actor, rect.x, rect.y + lineHeight * 2, w, h);
this.changePaintOpacity(true);
};
Window_MenuStatus.prototype.drawItemStatus = function(index) {
const actor = this.actor(index);
const rect = this.itemRectWithPadding(index);
const x = rect.x;
const y = rect.y;
const width = rect.width;
const bottom = y + rect.height;
const lineHeight = this.lineHeight();
this.drawActorName(actor, x, y + lineHeight * 0, width);
this.drawActorLevel(actor, x, y + lineHeight * 1, width);
this.drawActorClass(actor, x, bottom - lineHeight * 4, width);
this.placeBasicGauges(actor, x, bottom - lineHeight * 3, width);
this.drawActorIcons(actor, x, bottom - lineHeight * 1, width);
};
})();

126
js/plugins/AltSaveScreen.js Normal file
View File

@@ -0,0 +1,126 @@
//=============================================================================
// RPG Maker MZ - Alternative Save Screen
//=============================================================================
/*:
* @target MZ
* @plugindesc Alternative save/load screen layout.
* @author Yoji Ojima
*
* @help AltSaveScreen.js
*
* This plugin changes the layout of the save/load screen.
* It puts the file list on the top and the details on the bottom.
*
* It does not provide plugin commands.
*/
/*:ja
* @target MZ
* @plugindesc セーブ/ロード画面のレイアウトを変更します。
* @author Yoji Ojima
*
* @help AltSaveScreen.js
*
* このプラグインは、セーブ/ロード画面のレイアウトを変更します。
* ファイル一覧を上側に、詳細を下側に配置します。
*
* プラグインコマンドはありません。
*/
(() => {
const _Scene_File_create = Scene_File.prototype.create;
Scene_File.prototype.create = function() {
_Scene_File_create.apply(this, arguments);
this._listWindow.height = this._listWindow.fittingHeight(3);
const x = 0;
const y = this._listWindow.y + this._listWindow.height;
const width = Graphics.boxWidth;
const height = Graphics.boxHeight - y;
const rect = new Rectangle(x, y, width, height);
const statusWindow = new Window_SavefileStatus(rect);
this._listWindow.mzkp_statusWindow = statusWindow;
this.addWindow(statusWindow);
};
const _Scene_File_start = Scene_File.prototype.start;
Scene_File.prototype.start = function() {
_Scene_File_start.apply(this, arguments);
this._listWindow.ensureCursorVisible();
this._listWindow.callUpdateHelp();
};
Window_SavefileList.prototype.windowWidth = function() {
return Graphics.boxWidth;
};
Window_SavefileList.prototype.maxCols = function() {
return 4;
};
Window_SavefileList.prototype.itemHeight = function() {
return this.lineHeight() * 2 + 16;
};
const _Window_SavefileList_callUpdateHelp =
Window_SavefileList.prototype.callUpdateHelp;
Window_SavefileList.prototype.callUpdateHelp = function() {
_Window_SavefileList_callUpdateHelp.apply(this, arguments);
if (this.active && this.mzkp_statusWindow) {
this.mzkp_statusWindow.setSavefileId(this.savefileId());
}
};
function Window_SavefileStatus() {
this.initialize.apply(this, arguments);
}
Window_SavefileStatus.prototype = Object.create(Window_Base.prototype);
Window_SavefileStatus.prototype.constructor = Window_SavefileStatus;
Window_SavefileStatus.prototype.initialize = function(rect) {
Window_Base.prototype.initialize.call(this, rect);
this._savefileId = 1;
};
Window_SavefileStatus.prototype.setSavefileId = function(id) {
this._savefileId = id;
this.refresh();
};
Window_SavefileStatus.prototype.refresh = function() {
const info = DataManager.savefileInfo(this._savefileId);
const rect = this.contents.rect;
this.contents.clear();
this.resetTextColor();
this.drawTitle(this._savefileId, rect.x, rect.y);
if (info) {
this.drawContents(info, rect);
}
};
Window_SavefileStatus.prototype.drawTitle = function(savefileId, x, y) {
if (savefileId === 0) {
this.drawText(TextManager.autosave, x, y, 180);
} else {
this.drawText(TextManager.file + " " + savefileId, x, y, 180);
}
};
Window_SavefileStatus.prototype.drawContents = function(info, rect) {
const bottom = rect.y + rect.height;
const playtimeY = bottom - this.lineHeight();
this.drawText(info.title, rect.x + 192, rect.y, rect.width - 192);
this.drawPartyfaces(info.faces, rect.x, bottom - 144);
this.drawText(info.playtime, rect.x, playtimeY, rect.width, "right");
};
Window_SavefileStatus.prototype.drawPartyfaces = function(faces, x, y) {
if (faces) {
for (let i = 0; i < faces.length; i++) {
const data = faces[i];
this.drawFace(data[0], data[1], x + i * 150, y);
}
}
};
})();

106
js/plugins/ButtonPicture.js Normal file
View File

@@ -0,0 +1,106 @@
//=============================================================================
// RPG Maker MZ - Button Picture
//=============================================================================
/*:
* @target MZ
* @plugindesc Makes a picture clickable.
* @author Yoji Ojima
*
* @help ButtonPicture.js
*
* This plugin provides a command to call a common event when a picture is
* clicked.
*
* Use it in the following procedure.
* 1. Execute "Show Picture" to display your button image.
* 2. Call the plugin command "Set Button Picture".
*
* @command set
* @text Set Button Picture
* @desc Makes the specified picture clickable.
*
* @arg pictureId
* @type number
* @min 1
* @max 100
* @default 1
* @text Picture Number
* @desc Control number of the picture.
*
* @arg commonEventId
* @type common_event
* @default 1
* @text Common Event
* @desc Common event to call when the picture is clicked.
*/
/*:ja
* @target MZ
* @plugindesc ピクチャをクリック可能にします。
* @author Yoji Ojima
*
* @help ButtonPicture.js
*
* このプラグインは、ピクチャのクリック時にコモンイベントを呼び出すコマンドを
* 提供します。
*
* 次の手順で使用してください。
* 1. 「ピクチャの表示」を実行して、ボタン画像を表示します。
* 2. プラグインコマンド「ボタンピクチャの設定」を呼び出します。
*
* @command set
* @text ボタンピクチャの設定
* @desc 指定したピクチャをクリック可能にします。
*
* @arg pictureId
* @type number
* @min 1
* @max 100
* @default 1
* @text ピクチャ番号
* @desc ピクチャの管理番号です。
*
* @arg commonEventId
* @type common_event
* @default 1
* @text コモンイベント
* @desc ピクチャがクリックされた時に呼び出すコモンイベントです。
*/
(() => {
const pluginName = "ButtonPicture";
PluginManager.registerCommand(pluginName, "set", args => {
const pictureId = Number(args.pictureId);
const commonEventId = Number(args.commonEventId);
const picture = $gameScreen.picture(pictureId);
if (picture) {
picture.mzkp_commonEventId = commonEventId;
}
});
Sprite_Picture.prototype.isClickEnabled = function() {
const picture = this.picture();
return picture && picture.mzkp_commonEventId && !$gameMessage.isBusy();
};
Sprite_Picture.prototype.onClick = function() {
$gameTemp.reserveCommonEvent(this.picture().mzkp_commonEventId);
};
Spriteset_Base.prototype.mzkp_isAnyPicturePressed = function() {
return this._pictureContainer.children.some(sprite =>
sprite.isPressed()
);
};
const _Scene_Map_isAnyButtonPressed =
Scene_Map.prototype.isAnyButtonPressed;
Scene_Map.prototype.isAnyButtonPressed = function() {
return (
_Scene_Map_isAnyButtonPressed.apply(this, arguments) ||
this._spriteset.mzkp_isAnyPicturePressed()
);
};
})();

116
js/plugins/TextPicture.js Normal file
View File

@@ -0,0 +1,116 @@
//=============================================================================
// RPG Maker MZ - Text Picture
//=============================================================================
/*:
* @target MZ
* @plugindesc Displays text as a picture.
* @author Yoji Ojima
*
* @help TextPicture.js
*
* This plugin provides a command to show text as a picture.
*
* Use it in the following procedure.
* 1. Call the plugin command "Set Text Picture".
* 2. Execute "Show Picture" without specifying an image.
*
* @command set
* @text Set Text Picture
* @desc Sets text to display as a picture.
* After this, execute "Show Picture" without specifying an image.
*
* @arg text
* @type multiline_string
* @text Text
* @desc Text to display as a picture.
* Control characters are allowed.
*/
/*:ja
* @target MZ
* @plugindesc テキストをピクチャとして表示します。
* @author Yoji Ojima
*
* @help TextPicture.js
*
* このプラグインは、テキストをピクチャとして表示するコマンドを提供します。
*
* 次の手順で使用してください。
* 1. プラグインコマンド「テキストピクチャの設定」を呼び出します。
* 2. 画像を指定せずに「ピクチャの表示」を実行します。
*
* @command set
* @text テキストピクチャの設定
* @desc ピクチャとして表示するテキストを設定します。
* この後、画像を指定せずに「ピクチャの表示」を実行してください。
*
* @arg text
* @type multiline_string
* @text テキスト
* @desc ピクチャとして表示するテキストです。
* 制御文字が使用可能です。
*/
(() => {
const pluginName = "TextPicture";
let textPictureText = "";
PluginManager.registerCommand(pluginName, "set", args => {
textPictureText = String(args.text);
});
const _Game_Picture_show = Game_Picture.prototype.show;
Game_Picture.prototype.show = function() {
_Game_Picture_show.apply(this, arguments);
if (this._name === "" && textPictureText) {
this.mzkp_text = textPictureText;
this.mzkp_textChanged = true;
textPictureText = "";
}
};
const _Sprite_Picture_destroy = Sprite_Picture.prototype.destroy;
Sprite_Picture.prototype.destroy = function() {
destroyTextPictureBitmap(this.bitmap);
_Sprite_Picture_destroy.apply(this, arguments);
};
const _Sprite_Picture_updateBitmap = Sprite_Picture.prototype.updateBitmap;
Sprite_Picture.prototype.updateBitmap = function() {
_Sprite_Picture_updateBitmap.apply(this, arguments);
if (this.visible && this._pictureName === "") {
const picture = this.picture();
const text = picture ? picture.mzkp_text || "" : "";
const textChanged = picture && picture.mzkp_textChanged;
if (this.mzkp_text !== text || textChanged) {
this.mzkp_text = text;
destroyTextPictureBitmap(this.bitmap);
this.bitmap = createTextPictureBitmap(text);
picture.mzkp_textChanged = false;
}
} else {
this.mzkp_text = "";
}
};
function createTextPictureBitmap(text) {
const tempWindow = new Window_Base(new Rectangle());
const size = tempWindow.textSizeEx(text);
tempWindow.padding = 0;
tempWindow.move(0, 0, size.width, size.height);
tempWindow.createContents();
tempWindow.drawTextEx(text, 0, 0, 0);
const bitmap = tempWindow.contents;
tempWindow.contents = null;
tempWindow.destroy();
bitmap.mzkp_isTextPicture = true;
return bitmap;
}
function destroyTextPictureBitmap(bitmap) {
if (bitmap && bitmap.mzkp_isTextPicture) {
bitmap.destroy();
}
}
})();