SC: Initial commit

This commit is contained in:
OleSTEEP 2024-09-23 01:10:28 +03:00
parent 8f6ad3d730
commit 6e535b06c7
407 changed files with 176567 additions and 2 deletions

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,638 @@
//=============================================================================
// TDS Map Character Tag
// Version: 1.0
//=============================================================================
// Add to Imported List
var Imported = Imported || {} ; Imported.TDS_MapCharacterTag = true;
// Initialize Alias Object
var _TDS_ = _TDS_ || {} ; _TDS_.MapCharacterTag = _TDS_.MapCharacterTag || {};
//=============================================================================
/*:
* @plugindesc
* Shortcut for tag system
*
* @author TDS
*
*
* @param Common Event ID
* @desc ID of the common event to run after tagging.
* @default 1
*
* @param Selected Variable ID
* @desc ID of the variable to set selected tagged actor ID.
* @default 1
*
*
* @param Disable Switch ID
* @desc ID of the switch used to disable the tagging system.
* @default 1
*
*
*/
//=============================================================================
// Node.js path
var path = require('path');
// Get Parameters
var parameters = PluginManager.parameters("Map_Character_Tag");
// Initialize Parameters
_TDS_.MapCharacterTag.params = {};
_TDS_.MapCharacterTag.params.commonEventID = Number(parameters['Common Event ID'] || 1);
_TDS_.MapCharacterTag.params.selectedVariableID = Number(parameters['Selected Variable ID'] || 1);
_TDS_.MapCharacterTag.params.disableSwitchID = Number(parameters['Disable Switch ID'] || 1);
//=============================================================================
// ** Input
//-----------------------------------------------------------------------------
// The static class that handles input data from the keyboard and gamepads.
//=============================================================================
// Set Key Mapper A Key
Input.keyMapper[65] = 'tag';
//=============================================================================
// ** Scene_Map
//-----------------------------------------------------------------------------
// The scene class of the map screen.
//=============================================================================
// Alias Listing
//=============================================================================
_TDS_.MapCharacterTag.Game_Player_canMove = Game_Player.prototype.canMove;
_TDS_.MapCharacterTag.Game_Player_canStartLocalEvents = Game_Player.prototype.canStartLocalEvents;
//=============================================================================
// * Can Use Map Character Tag
//=============================================================================
Game_Player.prototype.canUseCharacterTag = function() {
// Get Scene
const scene = SceneManager._scene;
// If scene exists and has can use character tag function return it
if (scene && scene.canUseCharacterTag) { return scene.canUseCharacterTag(); };
return false;
};
//=============================================================================
// * Determine if player can start local events
//=============================================================================
Game_Player.prototype.canStartLocalEvents = function() {
// If Map Character tag is visible
if (SceneManager._scene._mapCharacterTag.opacity > 0) { return false; };
// Return Original Function
return _TDS_.MapCharacterTag.Game_Player_canStartLocalEvents.call(this);
};
//=============================================================================
// * Can Move
//=============================================================================
Game_Player.prototype.canMove = function() {
// Input A is being pressed
let scene = SceneManager._scene;
let isTagging = scene._mapCharacterTag ? scene._mapCharacterTag.opacity > 0 : false;
if (!!isTagging) { return false; };
// return Original Function
return _TDS_.MapCharacterTag.Game_Player_canMove.call(this);
};
//=============================================================================
// ** Scene_Map
//-----------------------------------------------------------------------------
// The scene class of the map screen.
//=============================================================================
// Alias Listing
//=============================================================================
_TDS_.MapCharacterTag.Scene_Map_createDisplayObjects = Scene_Map.prototype.createDisplayObjects;
_TDS_.MapCharacterTag.Scene_Map_update = Scene_Map.prototype.update;
_TDS_.MapCharacterTag.Scene_Map_terminate = Scene_Map.prototype.terminate;
//=============================================================================
// * Create Display Objects
//=============================================================================
Scene_Map.prototype.createDisplayObjects = function() {
// Run Original Function
_TDS_.MapCharacterTag.Scene_Map_createDisplayObjects.call(this);
// Create Map Character Tag
this.createMapCharacterTag();
};
//=============================================================================
// * Terminate
//=============================================================================
Scene_Map.prototype.terminate = function() {
// Hide Map Character Tag
this._mapCharacterTag.visible = false;
// Run Original Function
_TDS_.MapCharacterTag.Scene_Map_terminate.call(this);
};
//=============================================================================
// * Frame Update
//=============================================================================
Scene_Map.prototype.update = function() {
// Run Original Function
_TDS_.MapCharacterTag.Scene_Map_update.call(this);
// Update Character Tag
this.updateCharacterTagInput();
};
//=============================================================================
// * Create Map Character Tag
//=============================================================================
Scene_Map.prototype.createMapCharacterTag = function() {
// Create Map Character Tag Sprite
this._mapCharacterTag = new Sprite_MapCharacterTag();
this.addChild(this._mapCharacterTag);
};
//=============================================================================
// * Determine if Character Tag can be used
//=============================================================================
Scene_Map.prototype.canUseCharacterTag = function() {
// If Event is running return false
if ($gameMap.isEventRunning()) { return false; };
// If Party size is 1 or less
if ($gameParty.size() <= 1) { return false;};
// If Disable Switch is on return false
if ($gameSwitches.value(_TDS_.MapCharacterTag.params.disableSwitchID)) { return false; }
let scene = SceneManager._scene;
let isProcessingAnyMovement = !!$gamePlayer.isMoving() || !!$gamePlayer.followers().areMoving() || Input.isPressed("left") || Input.isPressed("right") || Input.isPressed("up") || Input.isPressed("down");
if (!!isProcessingAnyMovement) {return false;}
// Return true by default
return true;
};
//=============================================================================
// * Update Character Tag
//=============================================================================
Scene_Map.prototype.updateCharacterTagInput = function() {
// If Input Trigger A
if (Input.isTriggered('tag')) {
// If Can use Character Tag
if (this.canUseCharacterTag()) {
// Get Tag
var tag = this._mapCharacterTag;
// If Tag is Finished
if (tag._finished) {
// Show Tag
tag.show();
};
};
};
};
//=============================================================================
// ** Sprite_MapCharacterTag
//-----------------------------------------------------------------------------
// Ring Menu for Omori's tag system on the map.
//=============================================================================
function Sprite_MapCharacterTag() { this.initialize.apply(this, arguments);}
Sprite_MapCharacterTag.prototype = Object.create(Sprite.prototype);
Sprite_MapCharacterTag.prototype.constructor = Sprite_MapCharacterTag;
//=============================================================================
// * Initialize Object
//=============================================================================
Sprite_MapCharacterTag.prototype.initialize = function() {
// Super Call
Sprite.prototype.initialize.call(this);
// Initialize Settings
this.initSettings();
// Create Background
this.createBackground();
// Create Party Sprites
this.createPartySprites();
};
//=============================================================================
// * Create Background
//=============================================================================
Sprite_MapCharacterTag.prototype.createBackground = function() {
// Create Background
this._backgroundSprite = new Sprite();
this.addChild(this._backgroundSprite);
};
//=============================================================================
// * Initialize Settings
//=============================================================================
Sprite_MapCharacterTag.prototype.initSettings = function() {
// Amount of Frames for Startup Animation
this._startUpFrames = 13;
// Animation Frames for Movement Animation
this._movingFrames = 10;
// Radius of the ring
this._ringRadius = 160;
// Animation Steps
this._steps = -1;
// Set Center X & Y Valeus
this._centerX = Graphics.width / 2;
this._centerY = (Graphics.height / 2) - 10;
// Animation Type (Start, Wait, Move Right, Move Left)
this._anim = '';
// Set Index to
this._index = 0;
// Set Opacity to 0
this.opacity = 0;
// Set Released To false
this._released = false;
// Finished Flag
this._finished = true;
};
//=============================================================================
// * Create Party Sprites
//=============================================================================
Sprite_MapCharacterTag.prototype.createPartySprites = function() {
// Initialize Party Sprites
this._partySprites = [];
// Create Party Sprites Container
this._partySpritesContainer = new Sprite()
this._partySpritesContainer.opacity = 0;
this.addChild(this._partySpritesContainer);
// Iterate
for (var i = 0; i < 4; i++) {
var sprite = new Sprite_MapCharacterTagFace();
let text = LanguageManager.getMessageData("XX_BLUE.Map_Character_Tag").leader
sprite.setText(text);
sprite.x = this._centerX;
sprite.y = this._centerY;
this._partySprites[i] = sprite;
this._partySpritesContainer.addChild(sprite)
};
// Create Leader Sprite
this._leaderSprite = new Sprite_MapCharacterTagFace();
this._leaderSprite.x = this._centerX;
this._leaderSprite.y = this._centerY;
this._leaderSprite.showText();
let tagtext = LanguageManager.getMessageData("XX_BLUE.Map_Character_Tag").tag_who
this._leaderSprite.setText(tagtext)
this.addChild(this._leaderSprite);
// Refresh Party Sprites
this.refreshPartySprites();
};
//=============================================================================
// * Refresh Party Sprites
//=============================================================================
Sprite_MapCharacterTag.prototype.refreshPartySprites = function() {
for (var i = 0; i < this._partySprites.length; i++) {
// Get Sprite
var sprite = this._partySprites[i];
// Get Actor
var actor = $gameParty.members()[i];
sprite._faceSprite.actor = actor;
// Set Visibility
sprite.visible = actor !== undefined;
};
// Set Leader Sprite Face Sprite
this._leaderSprite._faceSprite.actor = $gameParty.leader();
};
//=============================================================================
// * Reset Party Sprites
//=============================================================================
Sprite_MapCharacterTag.prototype.resetPartySprites = function() {
for (var i = 0; i < this._partySprites.length; i++) {
// Get Sprite
var sprite = this._partySprites[i];
sprite.x = this._centerX;
sprite.y = this._centerY;
};
};
//=============================================================================
// * Activate & Deactivate
//=============================================================================
Sprite_MapCharacterTag.prototype.activate = function() { this._active = true; };
Sprite_MapCharacterTag.prototype.deactivate = function() { this._active = false; };
//=============================================================================
// * Determine if Animating
//=============================================================================
Sprite_MapCharacterTag.prototype.isAnimating = function() { return this._steps > -1; };
//=============================================================================
// * Determine if Inputs can be made
//=============================================================================
Sprite_MapCharacterTag.prototype.isInputable = function() {
if (this.isAnimating()) { return false; };
if (this._released) { return false; };
return true;
};
//=============================================================================
// * Get Max Items
//=============================================================================
Sprite_MapCharacterTag.prototype.maxItems = function() { return $gameParty.size(); };
//=============================================================================
// * Frame Update
//=============================================================================
Sprite_MapCharacterTag.prototype.update = function() {
// Super Call
Sprite.prototype.update.call(this);
// Update Animations
this.updateAnimations();
// Update Input
this.updateInput()
};
//=============================================================================
// * Move Left
//=============================================================================
Sprite_MapCharacterTag.prototype.moveLeft = function() {
// Set Steps
this._steps = this._movingFrames;
// Set Max
var max = this.maxItems();
// Set Index
this._index = (this._index - 1 + max) % max;
// Set Animation
this._anim = 'moveLeft';
};
//=============================================================================
// * Move Right
//=============================================================================
Sprite_MapCharacterTag.prototype.moveRight = function() {
// Set Steps
this._steps = this._movingFrames;
// Set Index
this._index = (this._index + 1) % this.maxItems();
// Set Animation
this._anim = 'moveRight'
};
//=============================================================================
// * Show
//=============================================================================
Sprite_MapCharacterTag.prototype.show = function() {
// Set Index to
this._index = 0;
// Refresh Party Sprites
this.refreshPartySprites();
// Reset Party Sprites
this.resetPartySprites();
// Snap Background Bitmap
SceneManager.snapForBackground(false);
// Set Background Bitmap
this._backgroundSprite.bitmap = SceneManager.backgroundBitmap();
this._backgroundSprite.opacity = 0;
this._backgroundSprite.blur = new PIXI.filters.BlurFilter();
this._backgroundSprite.filters = [this._backgroundSprite.blur];
this._backgroundSprite.blur.blur = 1;
this._backgroundSprite.blur.padding = 0;
// Set Party Sprites container Opacity
this._partySpritesContainer.opacity = 0;
// Start Startup Animation
this.startStartupAnim();
// Set Released To false
this._released = false;
// Finished Flag
this._finished = false;
};
//=============================================================================
// * Update Animations
//=============================================================================
Sprite_MapCharacterTag.prototype.onFinish = function() {
this._anim = null;
this._steps = -1;
this._backgroundSprite.bitmap = null;
this._released = false;
// Finished Flag
this._finished = true;
// If Index is more than 0
if (this._index > 0) {
// Get Actor ID
var actorId = $gameParty.members()[this._index].actorId();
// Set Actor ID Variable
$gameVariables.setValue(_TDS_.MapCharacterTag.params.selectedVariableID, actorId);
// Reserve Common Event
$gameTemp.reserveCommonEvent(_TDS_.MapCharacterTag.params.commonEventID);
};
// Reset Index
this._index = 0;
};
//=============================================================================
// * Update Animations
//=============================================================================
Sprite_MapCharacterTag.prototype.updateAnimations = function() {
// Set Release Flag
if (!this._released) {
// Set Active Flag
this._active = Input.isPressed('tag');
if (!this._active) {
this._released = true;
return;
};
} else if (!this._finished && this._released) {
// If Not Active
this.opacity -= 30;
// If Opacity is 0 or less set showing to false
if (this.opacity <= 0) {
// On Finish
this.onFinish();
};
return;
};
// If Steps is more than -1
if (!this._released && this._steps > -1) {
// Animation Switch Case
switch (this._anim) {
case 'start':
this.updateStartupAnim();
break;
case 'moveLeft':
this.updateMoveAnim(1);
break;
case 'moveRight':
this.updateMoveAnim(0)
break;
default:
// statements_def
break;
};
}
};
//=============================================================================
// * Update Input
//=============================================================================
Sprite_MapCharacterTag.prototype.updateInput = function() {
// If Inputable
if (this.isInputable()) {
// Left Input
if (Input.isRepeated('left')) { this.moveLeft(); };
// Right Input
if (Input.isRepeated('right')) { this.moveRight(); };
};
};
//=============================================================================
// * Start Startup Animation
//=============================================================================
Sprite_MapCharacterTag.prototype.startStartupAnim = function() {
// Animation Steps
this._steps = this._startUpFrames;
// Set Animation Type
this._anim = 'start';
};
//=============================================================================
// * Update Startup Animation
//=============================================================================
Sprite_MapCharacterTag.prototype.updateStartupAnim = function() {
// If Opacity is not at max
if (this.opacity < 255) {
// Increase Opacity
this.opacity += 60;
this._backgroundSprite.opacity += 60;
return;
}
var max = this.maxItems();
var d1 = 2.0 * Math.PI / max;
var d2 = 1.0 * Math.PI / this._startUpFrames;
var r = this._ringRadius - 1.0 * this._ringRadius * this._steps / this._startUpFrames;
for (var i = 0; i < max; i++) {
// Get Sprite
var sprite = this._partySprites[i];
var d = d1 * i + d2 * this._steps;
sprite.x = this._centerX + (r * Math.sin(d));
sprite.y = this._centerY - (r * Math.cos(d));
sprite.hideText();
sprite._faceSprite.deactivate();
};
// If Steps are more than 0
if (this._steps > 0) {
// Set party container opacity
this._partySpritesContainer.opacity = (this._partySpritesContainer.opacity * (this._steps - 1) + 255) / this._steps;
};
// Decrease Steps
this._steps--;
// If Animation is over
if (this._steps < 0) { this.updateWaitAnim(); };
};
//=============================================================================
// * Update Wait Animation
//=============================================================================
Sprite_MapCharacterTag.prototype.updateWaitAnim = function() {
var max = this.maxItems();
var d = 2.0 * Math.PI / max;
// Go Through Sprites
for (var i = 0; i < max; i++) {
// Get Sprite
var sprite = this._partySprites[i];
var j = i - this._index;
sprite.x = (this._centerX + (this._ringRadius * Math.sin(d * j)));
sprite.y = this._centerY - ((this._ringRadius * Math.cos(d * j)))
if (i === this._index) {
sprite.showText();
sprite._faceSprite.activate();
} else {
sprite._faceSprite.deactivate();
sprite.hideText();
}
};
};
//=============================================================================
// * Update Move Animation
//=============================================================================
Sprite_MapCharacterTag.prototype.updateMoveAnim = function(mode) {
var max = this.maxItems();
var d1 = 2.0 * Math.PI / max;
var d2 = d1 / this._movingFrames;
if (mode !== 0) { d2 *= -1; };
for (var i = 0; i < max; i++) {
// Get Sprite
var sprite = this._partySprites[i];
var j = i - this._index;
var d = d1 * j + d2 * this._steps;
sprite.x = (this._centerX + (this._ringRadius * Math.sin(d)));
sprite.y = this._centerY - ((this._ringRadius * Math.cos(d)))
sprite.hideText();
};
// Decrease Steps
this._steps--;
// If Animation is over
if (this._steps < 0) { this.updateWaitAnim(); };
};
//=============================================================================
// ** Sprite_MapCharacterTagFace
//-----------------------------------------------------------------------------
// Animated Face Sprite for menus.
//=============================================================================
function Sprite_MapCharacterTagFace() { this.initialize.apply(this, arguments);}
Sprite_MapCharacterTagFace.prototype = Object.create(Sprite.prototype);
Sprite_MapCharacterTagFace.prototype.constructor = Sprite_MapCharacterTagFace;
//=============================================================================
// * Initialize Object
//=============================================================================
Sprite_MapCharacterTagFace.prototype.initialize = function() {
// Super Call
Sprite.prototype.initialize.call(this);
// Set Center Position
this.anchor.set(0.5, 0.5);
// Create Sprites
this.createBackgroundSprite();
this.createTextSprite();
this.createFaceSprite();
// Hide Text
this.hideText();
};
//=============================================================================
// * Create Background Sprite
//=============================================================================
Sprite_MapCharacterTagFace.prototype.createBackgroundSprite = function() {
var bitmap = new Bitmap(110, 110 + 34)
bitmap.fillAll('rgba(0, 0, 0, 1)')
bitmap.fillRect(1, 1, bitmap.width - 2, bitmap.height - 2, 'rgba(255, 255, 255, 1)')
bitmap.fillRect(4, 4, bitmap.width - 8, 105, 'rgba(0, 0, 0, 1)')
bitmap.fillRect(0, 113, bitmap.width, 1, 'rgba(0, 0, 0, 1)')
bitmap.fillRect(4, 117, bitmap.width - 8, 22, 'rgba(0, 0, 0, 1)')
this._backgroundSprite = new Sprite(bitmap);
this._backgroundSprite.x = -(bitmap.width / 2);
this._backgroundSprite.y = -(110 / 2);
this.addChild(this._backgroundSprite);
};
//=============================================================================
// * Create Text Sprite
//=============================================================================
Sprite_MapCharacterTagFace.prototype.createTextSprite = function() {
var bitmap = new Bitmap(110, 32);
this._textSprite = new Sprite(bitmap);
this._textSprite.anchor.set(0.5, 0);
this._textSprite.y = (144 / 2) - 16;
this.addChild(this._textSprite);
};
//=============================================================================
// * Create Face Sprite
//=============================================================================
Sprite_MapCharacterTagFace.prototype.createFaceSprite = function() {
// Create Face Sprite
this._faceSprite = new Sprite_OmoMenuStatusFace();
this._faceSprite.anchor.set(0.5, 0.5)
this._faceSprite.actor = $gameParty.members()[0];
this._faceSprite.deactivate();
this.addChild(this._faceSprite);
this._faceMask = new Sprite(new Bitmap(110,110))
this._faceMask.x = -(110 / 2) + 2;
this._faceMask.y = -(110 / 2) + 2;
let white = 'rgba(255, 255, 255, 1)';
this._faceMask.bitmap.fillRect(0,0,106,2, white)
this._faceMask.bitmap.fillRect(104,0,2,106, white)
this.addChild(this._faceMask);
};
//=============================================================================
// * Activate & Deactivate
//=============================================================================
Sprite_MapCharacterTagFace.prototype.activate = function() { this._active = true; };
Sprite_MapCharacterTagFace.prototype.deactivate = function() { this._active = false; };
//=============================================================================
// * Show Text
//=============================================================================
Sprite_MapCharacterTagFace.prototype.setText = function(text) {
var bitmap = this._textSprite.bitmap;
bitmap.fontSize = LanguageManager.getMessageData("XX_BLUE.Sprite_MapCharacterTagFace").setText_fontsize;
bitmap.drawText(text, 0, 0, bitmap.width, bitmap.height, 'center');
};
//=============================================================================
// * Show Text
//=============================================================================
Sprite_MapCharacterTagFace.prototype.showText = function() {
this._backgroundSprite.setFrame(0, 0, 110, this._backgroundSprite.bitmap.height);
this._textSprite.visible = true;
};
//=============================================================================
// * Hide Text
//=============================================================================
Sprite_MapCharacterTagFace.prototype.hideText = function() {
this._backgroundSprite.setFrame(0, 0, 110, 114);
this._textSprite.visible = false;
};

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,707 @@
//=============================================================================
// TDS Omori Bestiary
// Version: 1.0
//=============================================================================
// Add to Imported List
var Imported = Imported || {} ; Imported.TDS_OmoriBestiary = true;
// Initialize Alias Object
var _TDS_ = _TDS_ || {} ; _TDS_.OmoriBestiary = _TDS_.OmoriBestiary || {};
//=============================================================================
/*:
* @plugindesc
* Bestiary for Omori.
*
* @author TDS
*
*/
//=============================================================================
//=============================================================================
// ** Game_Party
//-----------------------------------------------------------------------------
// The game object class for the party. Information such as gold and items is
// included.
//=============================================================================
// Alias Listing
//=============================================================================
_TDS_.OmoriBestiary.Game_Party_initialize = Game_Party.prototype.initialize;
//=============================================================================
// * Object Initialize
//=============================================================================
Game_Party.prototype.initialize = function() {
// Run Original Function
_TDS_.OmoriBestiary.Game_Party_initialize.call(this);
// Create List of Defeated Enemies
this._defeatedEnemies = [];
};
//=============================================================================
// * Add Defeated Enemy
//=============================================================================
Game_Party.prototype.addDefeatedEnemy = function(id) {
// Of Defeated Enemies array does not contain ID
if (!this._defeatedEnemies.contains(id)) {
// Add ID to defeated enemies array
this._defeatedEnemies.push(id);
};
let allEnemies = Object.keys(LanguageManager.getTextData('Bestiary', 'Information')).map(Number);
if(allEnemies.every(enemyId => this._defeatedEnemies.contains(enemyId))) {
$gameSystem.unlockAchievement("FOES_FILED"); // Unlock complete bestiary achievement;
}
};
//=============================================================================
// ** Game_Enemy
//-----------------------------------------------------------------------------
// The game object class for an enemy.
//=============================================================================
// Alias Listing
//=============================================================================
_TDS_.OmoriBestiary.Game_Enemy_die = Game_Enemy.prototype.die;
_TDS_.OmoriBestiary.Game_Enemy_appear = Game_Enemy.prototype.appear;
_TDS_.OmoriBestiary.Game_Enemy_onBattleStart = Game_Enemy.prototype.onBattleStart
//=============================================================================
// * Die
//=============================================================================
Game_Enemy.prototype.die = function() {
// Run Original Fucntion
_TDS_.OmoriBestiary.Game_Enemy_die.call(this);
// Add Defeated Enemy
$gameParty.addDefeatedEnemy(this.baseId());
};
//=============================================================================
// * Appear
//=============================================================================
Game_Enemy.prototype.appear = function() {
// Run Original Function
_TDS_.OmoriBestiary.Game_Enemy_appear.call(this);
// Add Defeated Enemy
$gameParty.addDefeatedEnemy(this.baseId());
};
//=============================================================================
// * On battle start processing
//=============================================================================
Game_Enemy.prototype.onBattleStart = function() {
// Run Original Function
_TDS_.OmoriBestiary.Game_Enemy_onBattleStart.call(this);
// If enemy has appeared
if (this.isAppeared()) {
// Add Defeated Enemy
$gameParty.addDefeatedEnemy(this.baseId());
};
};
//=============================================================================
// ** Scene_OmoriBestiary
//-----------------------------------------------------------------------------
// This scene is used to show the bestiary.
//=============================================================================
function Scene_OmoriBestiary() { this.initialize.apply(this, arguments);}
Scene_OmoriBestiary.prototype = Object.create(Scene_BaseEX.prototype);
Scene_OmoriBestiary.prototype.constructor = Scene_OmoriBestiary;
//=============================================================================
// * Object Initialization
//=============================================================================
Scene_OmoriBestiary.prototype.initialize = function() {
// Set Image reservation id
this._imageReservationId = 'bestiary';
// Create Enemy Object
this._enemy = new Game_Enemy(1, 0, 0);
// Super Call
Scene_BaseEX.prototype.initialize.call(this);
};
//=============================================================================
// * Initialize Atlas Lists
//=============================================================================
Scene_OmoriBestiary.prototype.initAtlastLists = function() {
// Super Call
Scene_BaseEX.prototype.initAtlastLists.call(this);
// // Go Through List of Entries
// for (let [id, obj] of Object.entries(LanguageManager.getTextData('Bestiary', 'Information'))) {
// // Reserve Battleback
// ImageManager.reserveBattleback1(obj.background.name, 0, this._imageReservationId);
// // Get Filename
// var name = $dataEnemies[Number(id)].sideviewBattler[0];
// // If name
// if (name) { ImageManager.reserveSvActor(name, 0, this._imageReservationId); };
// }
};
//=============================================================================
// * Start
//=============================================================================
Scene_OmoriBestiary.prototype.start = function() {
// Super Call
Scene_BaseEX.prototype.start.call(this);
// Start Fade in
this.startFadeIn(this.slowFadeSpeed(), false);
};
//=============================================================================
// * Create
//=============================================================================
Scene_OmoriBestiary.prototype.create = function() {
// Super Call
Scene_BaseEX.prototype.create.call(this);
this.createEnemyWindow();
this.createEnemyNameWindow();
this.createEnemyListWindow();
// Create Enemy Text Window
this._enemyTextWindow = new Window_OmoBestiaryEnemyText();
this._enemyTextWindow.y = Graphics.height - this._enemyTextWindow.height
this._enemyTextWindow.x = Graphics.width - this._enemyTextWindow.width;
this._enemyTextWindow.visible = false;
this.addChild(this._enemyTextWindow)
this.onListChangeUpdate();
};
//=============================================================================
// * Create Enemy Window
//=============================================================================
Scene_OmoriBestiary.prototype.createEnemyWindow = function() {
// Create Enemy Window
this._enemyWindow = new Window_OmoBestiaryEnemy(this._enemy);
this.addChild(this._enemyWindow);
};
//=============================================================================
// * Create Enemy Name Window
//=============================================================================
Scene_OmoriBestiary.prototype.createEnemyNameWindow = function() {
// Create Enemy Name Window
this._enemyNameWindow = new Window_OmoBestiaryEnemyName();
this._enemyNameWindow.x = Graphics.width - this._enemyNameWindow.width;
this.addChild(this._enemyNameWindow)
};
//=============================================================================
// * Create Enemy List Window
//=============================================================================
Scene_OmoriBestiary.prototype.createEnemyListWindow = function() {
// Create Enemy List Window
this._enemyListWindow = new Window_OmoBestiaryEnemyList();
this._enemyListWindow.x = Graphics.width - this._enemyListWindow.width;
this._enemyListWindow.y = Graphics.height - this._enemyListWindow.height;
this._enemyListWindow.setHandler('ok', this.onEnemyListOk.bind(this))
this._enemyListWindow.setHandler('cancel', this.popScene.bind(this))
this._enemyListWindow._onCursorChangeFunct = this.onListChangeUpdate.bind(this);
this.addChild(this._enemyListWindow);
};
//=============================================================================
// * Frame Update
//=============================================================================
Scene_OmoriBestiary.prototype.update = function() {
// Super Call
Scene_BaseEX.prototype.update.call(this);
// If Enemy Text Window is visible
if (this._enemyTextWindow.visible) {
if (Input.isTriggered('cancel')) {
SoundManager.playCancel();
this._enemyListWindow._onCursorChangeFunct = undefined;
this._enemyListWindow.activate();
this._enemyTextWindow.visible = false;
this._enemyListWindow._onCursorChangeFunct = this.onListChangeUpdate.bind(this);
return;
}
if (Input.isTriggered('left')) {
this._enemyListWindow.selectPreviousEnemy();
this.onListChangeUpdate();
this.onEnemyListOk();
};
if (Input.isTriggered('right')) {
this._enemyListWindow.selectNextEnemy();
this.onListChangeUpdate();
this.onEnemyListOk()
};
};
};
//=============================================================================
// * On List Change Update
//=============================================================================
Scene_OmoriBestiary.prototype.onListChangeUpdate = function() {
// Get Enemy ID
var enemyId = this._enemyListWindow.enemyId();
// Get Enemy Sprite
var enemySprite = this._enemyWindow._enemySprite;
// If the enemy ID is more than 0
if (enemyId > 0) {
this._enemyWindow.clearOpacity();
enemySprite.removeChildren();
// If enemy ID has changed transform
this._enemy.transform(enemyId);
// Get Data
var data = LanguageManager.getTextData('Bestiary', 'Information')[enemyId];
// Get Background Data
var background = data.background;
// Draw Name
this._enemyNameWindow.drawName(this._enemyListWindow.enemyName(data));
// Set Home Position
enemySprite.setHome(data.position.x, data.position.y)
// Set Enemy Sprite to visible
enemySprite.visible = true;
// Start Enemy Sprite Motion
enemySprite.startMotion("other");
// Update Enemy Sprite
enemySprite.update();
// Set Background
this._enemyWindow.setBackground(background.name, background.x, background.y)
} else {
// Make Enemy Sprite invisible
enemySprite.setHome(-Graphics.width, -Graphics.height)
// Draw Name
this._enemyNameWindow.drawName(LanguageManager.getTextData('Bestiary', 'EmptyEnemyName'))
// Set Background
this._enemyWindow.setBackground(null);
};
};
//=============================================================================
// * [OK] Enemy List
//=============================================================================
Scene_OmoriBestiary.prototype.onEnemyListOk = function() {
// Get Enemy ID
var enemyId = this._enemyListWindow.enemyId();
// Get Data
var data = LanguageManager.getTextData('Bestiary', 'Information')[enemyId];
// Make Enemy Text Window Visible
this._enemyTextWindow.visible = true;
// Get Lines
var lines = data.text.split(/[\r\n]/g);
// Get Conditional Text
var conditionalText = data.conditionalText;
// If Conditional Text Exists
if (conditionalText) {
// Go through conditional text
for (var i = 0; i < conditionalText.length; i++) {
// Get text Data
var textData = conditionalText[i];
// Check if all switches are active
if (textData.switchIds.every(function(id) { return $gameSwitches.value(id); })){
// Get Line Index
var lineIndex = textData.line === null ? lines.length : textData.line;
// Get Extra Lines
var extraLines = textData.text.split(/[\r\n]/g);
// Add extra lines to main lines array
lines.splice(lineIndex, 0, ...extraLines)
};
};
}
// Draw Lines
this._enemyTextWindow.drawLines(lines);
// Get Character
var character = this._enemyTextWindow._enemyCharacter;
let sprite = this._enemyTextWindow._characterSprite;
// If Character Data Exists
if (data.character) {
// Set Character Image
character.setImage(data.character.name, data.character.index);
} else {
// Set Character Image to nothing
character.setImage('', 0);
};
// Update Sprite
sprite.update()
// Update Character
this._enemyTextWindow.updateCharacter();
this._enemyTextWindow._characterSprite.update();
};
//=============================================================================
// ** Window_OmoBestiaryEnemy
//-----------------------------------------------------------------------------
// This window is used to show the enemy and the background for it.
//=============================================================================
function Window_OmoBestiaryEnemy() { this.initialize.apply(this, arguments); }
Window_OmoBestiaryEnemy.prototype = Object.create(Window_Base.prototype);
Window_OmoBestiaryEnemy.prototype.constructor = Window_OmoBestiaryEnemy;
//=============================================================================
// * Object Initialization
//=============================================================================
Window_OmoBestiaryEnemy.prototype.initialize = function(enemy) {
// Super Call
Window_Base.prototype.initialize.call(this, 0, 0, Graphics.width / 2, Graphics.height);
// Get Enemy Object
this._enemy = enemy
// Create Cover Mask
this.createCoverMask();
// Create Background Sprite
this.createBackgroundSprite();
// Create Enemy Sprite
this.createEnemySprite();
};
//=============================================================================
// * Standard Padding
//=============================================================================
Window_OmoBestiaryEnemy.prototype.standardPadding = function() { return 5; }
Window_OmoBestiaryEnemy.prototype.isUsingCustomCursorRectSprite = function() { return true; }
Window_OmoBestiaryEnemy.prototype.customCursorRectYOffset = function() { return -7; }
//=============================================================================
// * Refresh Arrows
//=============================================================================
Window_OmoBestiaryEnemy.prototype._refreshArrows = function() { };
//=============================================================================
// * Create Cover Mask
//=============================================================================
Window_OmoBestiaryEnemy.prototype.createCoverMask = function() {
// Get Padding
var padding = this.standardPadding();
// Face Mask
this._coverMask = new PIXI.Graphics();
this._coverMask.beginFill(0xFFF);
this._coverMask.drawRect(padding, padding, this.width - (padding * 2), this.height - (padding * 2));
this._coverMask.endFill();
this.addChild(this._coverMask)
};
//=============================================================================
// * Create Background Sprite
//=============================================================================
Window_OmoBestiaryEnemy.prototype.createBackgroundSprite = function() {
// Create Background Sprite
this._backgroundSprite = new Sprite(ImageManager.loadBattleback1('battleback_vf_default'));
this._backgroundSprite.mask = this._coverMask;
this.addChild(this._backgroundSprite);
};
//=============================================================================
// * Create Enemy Sprite
//=============================================================================
Window_OmoBestiaryEnemy.prototype.createEnemySprite = function() {
// Create Background Sprite
this._enemySprite = new Sprite_Enemy(this._enemy);
this._enemySprite.mask = this._coverMask;
this._enemySprite.createShadowSprite = function() { this._shadowSprite = new Sprite(); }
this._enemySprite.getCurrentMotion = function() {
let other = this._enemy.getSideviewMotion("other");
if(!other) {return this._enemy.getSideviewMotion("walk")}
return other;
}
this.addChild(this._enemySprite);
};
//=============================================================================
// * Set Background
//=============================================================================
Window_OmoBestiaryEnemy.prototype.setBackground = function(name = null, x = 0, y = 0) {
// If name
if (name) {
// Set Background Bitmap
this._backgroundSprite.bitmap = ImageManager.loadBattleback1(name)
this._backgroundSprite.x = x;
this._backgroundSprite.y = y;
} else {
// Set Background Bitmap to null
this._backgroundSprite.bitmap = null;
}
this._opDelay = 6;
};
//=============================================================================
// * Clear Opacity
//=============================================================================
Window_OmoBestiaryEnemy.prototype.clearOpacity = function() {
this._enemySprite.opacity = 0;
this._backgroundSprite.opacity = 0;
}
//=============================================================================
// * Update Opacity
//=============================================================================
Window_OmoBestiaryEnemy.prototype.updateBEOpacity = function() {
if(this._enemySprite.opacity >= 255 && this._backgroundSprite.opacity >= 255) {return;}
this._enemySprite.opacity = Math.min(this._enemySprite.opacity + 8, 255);
this._backgroundSprite.opacity = Math.min(this._backgroundSprite.opacity + 8, 255);
}
//=============================================================================
// * Main Update Method
//=============================================================================
Window_OmoBestiaryEnemy.prototype.update = function() {
Window_Base.prototype.update.call(this);
if(--this._opDelay > 0) {return;}
this.updateBEOpacity();
}
//=============================================================================
// ** Window_OmoBestiaryEnemyName
//-----------------------------------------------------------------------------
// This window is used to show the enemy name as a header
//=============================================================================
function Window_OmoBestiaryEnemyName() { this.initialize.apply(this, arguments); }
Window_OmoBestiaryEnemyName.prototype = Object.create(Window_Base.prototype);
Window_OmoBestiaryEnemyName.prototype.constructor = Window_OmoBestiaryEnemyName;
//=============================================================================
// * Object Initialization
//=============================================================================
Window_OmoBestiaryEnemyName.prototype.initialize = function() {
// Super Call
Window_Base.prototype.initialize.call(this, 0, 0, Graphics.width / 2, 48);
};
//=============================================================================
// * Standard Padding
//=============================================================================
Window_OmoBestiaryEnemyName.prototype.standardPadding = function() { return 4; }
//=============================================================================
// * Draw Name
//=============================================================================
Window_OmoBestiaryEnemyName.prototype.drawName = function(name) {
// Clear Contents
this.contents.clear()
// Draw Name
this.contents.drawText(name, 15, 0, this.contents.width - 30, this.contents.height);
};
//=============================================================================
// ** Window_OmoBestiaryEnemyText
//-----------------------------------------------------------------------------
// This window is used to show the enemy information text.
//=============================================================================
function Window_OmoBestiaryEnemyText() { this.initialize.apply(this, arguments); }
Window_OmoBestiaryEnemyText.prototype = Object.create(Window_Base.prototype);
Window_OmoBestiaryEnemyText.prototype.constructor = Window_OmoBestiaryEnemyText;
//=============================================================================
// * Object Initialization
//=============================================================================
Window_OmoBestiaryEnemyText.prototype.initialize = function() {
// Super Call
Window_Base.prototype.initialize.call(this, 0, 0, Graphics.width / 2, Graphics.height - 48);
// Create Character
this.createCharacter();
};
//=============================================================================
// * Create Character
//=============================================================================
Window_OmoBestiaryEnemyText.prototype.createCharacter = function() {
// Create Character Object
this._enemyCharacter = new Game_Character();
// Set Character Image Properties
this._enemyCharacter.setImage('', 0)
this._enemyCharacter.setWalkAnime(true)
this._enemyCharacter.setStepAnime(true)
// Create Sprite Character
this._characterSprite = new Sprite_Character(this._enemyCharacter);
this._characterSprite.updatePosition = function() {};
this.addChild(this._characterSprite);
};
//=============================================================================
// * Draw Information
//=============================================================================
Window_OmoBestiaryEnemyText.prototype.drawInformation = function(information) {
// Clear Contents
this.contents.clear();
// Get Lines
var lines = information.split(/[\r\n]/g);
// Go Through Lines
for (var i = 0; i < lines.length; i++) {
// Draw Line
this.drawText(lines[i], 0, -10 + (i * 24), this.contents.width, 24);
};
};
//=============================================================================
// * Draw Information
//=============================================================================
Window_OmoBestiaryEnemyText.prototype.drawLines = function(lines) {
// Clear Contents
this.contents.clear();
// Go Through Lines
for (var i = 0; i < lines.length; i++) {
// Draw Line
this.drawText(lines[i], 0, -8 + (i * 28), this.contents.width, 24);
};
};
//=============================================================================
// * Frame Update
//=============================================================================
Window_OmoBestiaryEnemyText.prototype.update = function() {
// Super Call
Window_Base.prototype.update.call(this);
// Update Character
this.updateCharacter();
};
//=============================================================================
// * Update Character
//=============================================================================
Window_OmoBestiaryEnemyText.prototype.updateCharacter = function() {
// Update Character
this._enemyCharacter.update();
// Get Sprite
var sprite = this._characterSprite;
// Set Sprite Position
sprite.x = this.width - (sprite._frame.width / 2) - 10;
sprite.y = this.height - 10;
};
//=============================================================================
// ** Window_OmoBestiaryEnemyList
//-----------------------------------------------------------------------------
// This window is used to show a list of enemy names.
//=============================================================================
function Window_OmoBestiaryEnemyList() { this.initialize.apply(this, arguments); }
Window_OmoBestiaryEnemyList.prototype = Object.create(Window_Command.prototype);
Window_OmoBestiaryEnemyList.prototype.constructor = Window_OmoBestiaryEnemyList;
//=============================================================================
// * Object Initialization
//=============================================================================
Window_OmoBestiaryEnemyList.prototype.initialize = function() {
// Get Entries for Sorted Bestiary list
this._sortedBestiaryList = Object.entries(LanguageManager.getTextData('Bestiary', 'Information'));
// Sort list
this._sortedBestiaryList.sort(function(a, b) {
var indexA = a[1].listIndex === undefined ? Number(a[0]) : a[1].listIndex
var indexB = b[1].listIndex === undefined ? Number(b[0]) : b[1].listIndex
return indexA - indexB
});
// Super Call
Window_Command.prototype.initialize.call(this, 0, 0);
};
//=============================================================================
// * Settings
//=============================================================================
Window_OmoBestiaryEnemyList.prototype.windowWidth = function() { return Graphics.width / 2; };
Window_OmoBestiaryEnemyList.prototype.windowHeight = function() { return Graphics.height - 48; };
Window_OmoBestiaryEnemyList.prototype.isUsingCustomCursorRectSprite = function() { return true; };
Window_OmoBestiaryEnemyList.prototype.customCursorRectXOffset = function() { return 14; }
Window_OmoBestiaryEnemyList.prototype.customCursorRectYOffset = function() { return 0; }
Window_OmoBestiaryEnemyList.prototype.customCursorRectTextXOffset = function() { return 30; }
Window_OmoBestiaryEnemyList.prototype.customCursorRectTextYOffset = function() { return -7; }
Window_OmoBestiaryEnemyList.prototype.customCursorRectTextWidthOffset = function() { return 0; }
Window_OmoBestiaryEnemyList.prototype.customCursorRectBitmapName = function() { return 'cursor_menu'; }
//=============================================================================
// * Get Enemy ID
//=============================================================================
Window_OmoBestiaryEnemyList.prototype.enemyId = function(index = this._index) {
return this._list[index].ext;
};
//=============================================================================
// * Select Next Enemy
//=============================================================================
Window_OmoBestiaryEnemyList.prototype.selectNextEnemy = function() {
// Get Starting Index
var index = (this.index() + 1)
if(index >= this.maxItems()) {
index = 0;
}
var selected = false;
// Go Through Items
for (var i = index; i < this.maxItems(); i++) {
// If item has a valid ID
if (this._list[i].ext !== 0) {
// audio
AudioManager.playSe({name: "SE_turn_page", pan: 0, pitch: 100, volume: 90});
// Select it
this.select(i);
selected = true;
break;
};
};
if(!!selected) {return;}
};
//=============================================================================
// * Select Previous Enemy
//=============================================================================
Window_OmoBestiaryEnemyList.prototype.selectPreviousEnemy = function() {
// Get Starting Index
var index = (this.index() - 1) < 0 ? this.maxItems() - 1 : this.index() - 1;
// Go Through Items
for (var i = index; i >= 0; i--) {
// If item has a valid Id
if (this._list[i].ext !== 0) {
// audio
AudioManager.playSe({name: "SE_turn_page", pan: 0, pitch: 100, volume: 90});
// Select it
this.select(i);
break;
};
};
};
//=============================================================================
// * Make Command List
//=============================================================================
Window_OmoBestiaryEnemyList.prototype.makeCommandList = function() {
// Get List
var list = $gameParty._defeatedEnemies;
// Go Through List of Entries
for (let [id, obj] of this._sortedBestiaryList) {
// Get Index
var index = Number(id);
// If Defeated Enemy list contains id
if (list.contains(index)) {
// Add Command
this.addCommand(this.enemyName(obj), 'ok', true, index)
} else {
// Add Empty Command
this.addCommand('------------------------------', 'nothing', false, 0)
};
};
};
//=============================================================================
// * Get Enemy Name
//=============================================================================
Window_OmoBestiaryEnemyList.prototype.enemyName = function(obj) {
// If object has conditional names
if (obj.conditionalNames) {
// Get Names
const names = obj.conditionalNames
// Go Through Names
for (var i = 0; i < names.length; i++) {
// Get Data
const data = names[i];
// Check Switches
let switches = data.switches.every(arr => $gameSwitches.value(arr[0]) === arr[1])
if (switches) {
return data.name;
};
};
};
// Return default name
return obj.name
};
//=============================================================================
// * Draw Item
//=============================================================================
Window_OmoBestiaryEnemyList.prototype.drawItem = function(index) {
var rect = this.itemRectForText(index);
var align = this.itemTextAlign();
this.resetTextColor();
this.changePaintOpacity(true);
this.drawText(this.commandName(index), rect.x, rect.y, rect.width - rect.x, align);
};
//=============================================================================
// * Refresh Arrows
//=============================================================================
Window_OmoBestiaryEnemyList.prototype._refreshArrows = function() {
// Run Original Function
Window_Command.prototype._refreshArrows.call(this);
var w = this._width;
var h = this._height;
var p = 28;
var q = p/2;
this._downArrowSprite.move(w - q, h - q);
this._upArrowSprite.move(w - q, q);
};
//=============================================================================
// * Call Update Help
//=============================================================================
Window_OmoBestiaryEnemyList.prototype.callUpdateHelp = function() {
// Super Call
Window_Command.prototype.callUpdateHelp.call(this);
// If active
if (this.active) {
// If On Cursor Change Function Exists
if (this._onCursorChangeFunct) { this._onCursorChangeFunct(); };
};
};

View file

@ -0,0 +1,290 @@
//=============================================================================
// TDS Omori BlackLetter Map
// Version: 1.5
//=============================================================================
// Add to Imported List
var Imported = Imported || {} ; Imported.TDS_OmoriBlackLetterMap = true;
// Initialize Alias Object
var _TDS_ = _TDS_ || {} ; _TDS_.OmoriBlackLetterMap = _TDS_.OmoriBlackLetterMap || {};
//=============================================================================
/*:
* @plugindesc
* This plugin shows the Omori Black Letter map.
*
* @author TDS
*
*/
//=============================================================================
// ImageManager.loadSystem('blackletter_bg');
// ImageManager.loadSystem('blackLetter_map_atlas');
//=============================================================================
// ** Input
//-----------------------------------------------------------------------------
// The static class that handles input data from the keyboard and gamepads.
//=============================================================================
// * Key Mapper Keys
//=============================================================================
// Input.keyMapper['81'] = 'q';
// //=============================================================================
// // ** Scene_Map
// //-----------------------------------------------------------------------------
// // The scene class of the map screen.
// //=============================================================================
// // Alias Listing
// //=============================================================================
// _TDS_.OmoriBlackLetterMap.Scene_Map_updateScene = Scene_Map.prototype.updateScene;
// //=============================================================================
// // * Update Scene
// //=============================================================================
// Scene_Map.prototype.updateScene = function() {
// // Run Original Function
// _TDS_.OmoriBlackLetterMap.Scene_Map_updateScene.call(this);
// if (!SceneManager.isSceneChanging()) {
// this.updateCallBlackLetterMap();
// };
// };
// //=============================================================================
// // * Update Call Black Letter Map
// //=============================================================================
// Scene_Map.prototype.updateCallBlackLetterMap = function() {
// // If Q Is triggered
// if (Input.isTriggered('pageup')) {
// // If Disable switch is off
// if (!$gameSwitches.value(18)) {
// // Go to Black Letter Map Scene
// SceneManager.push(Scene_OmoriBlackLetterMap);
// };
// };
// };
_TDS_.OmoriBlackLetterMap.Scene_Map_needsFadeIn = Scene_Map.prototype.needsFadeIn;
Scene_Map.prototype.needsFadeIn = function() {
return (_TDS_.OmoriBlackLetterMap.Scene_Map_needsFadeIn.call(this) || SceneManager.isPreviousScene(Scene_OmoriBlackLetterMap));
};
//=============================================================================
// ** Scene_OmoriBlackLetterMap
//-----------------------------------------------------------------------------
// This scene shows the Black Letter map
//=============================================================================
function Scene_OmoriBlackLetterMap() { this.initialize.apply(this, arguments);}
Scene_OmoriBlackLetterMap.prototype = Object.create(Scene_Base.prototype);
Scene_OmoriBlackLetterMap.prototype.constructor = Scene_OmoriBlackLetterMap;
//=============================================================================
// * Object Initialization
//=============================================================================
Scene_OmoriBlackLetterMap.prototype.initialize = function() {
// Super Call
Scene_Base.prototype.initialize.call(this);
};
//=============================================================================
// * Initialize Atlas Lists
//=============================================================================
Scene_OmoriBlackLetterMap.prototype.initAtlastLists = function() {
// Run Original Function
Scene_Base.prototype.initAtlastLists.call(this);
// Add Required Atlas
// this.addRequiredAtlas('blackletter_bg');
this.addRequiredAtlas('blackLetter_map_atlas');
};
//=============================================================================
// * Create
//=============================================================================
Scene_OmoriBlackLetterMap.prototype.create = function() {
// Super Call
Scene_Base.prototype.create.call(this);
// Create Map Sprite
this._mapSprite = new Sprite_OmoBlackLetterMap();
this.addChild(this._mapSprite);
};
Scene_OmoriBlackLetterMap.prototype.start = function() {
Scene_Base.prototype.start.call(this);
this.startFadeIn(this.slowFadeSpeed());
};
//=============================================================================
// * Frame Update
//=============================================================================
Scene_OmoriBlackLetterMap.prototype.update = function() {
// Super Call
Scene_Base.prototype.update.call(this);
// If Cancel or Q is pressed
if (Input.isTriggered('cancel') || Input.isTriggered('q')) {
// If not busy
if (!this.isBusy()) {
// Play Cancel Sound
// SoundManager.playCancel();
// Pop Scene
this.popScene();
};
};
};
//=============================================================================
// ** Sprite_OmoBlackLetterMap
//-----------------------------------------------------------------------------
// This sprite is used to display the black letter map.
//=============================================================================
function Sprite_OmoBlackLetterMap() { this.initialize.apply(this, arguments);}
Sprite_OmoBlackLetterMap.prototype = Object.create(Sprite.prototype);
Sprite_OmoBlackLetterMap.prototype.constructor = Sprite_OmoBlackLetterMap;
//=============================================================================
// * Initialize Object
//=============================================================================
Sprite_OmoBlackLetterMap.prototype.initialize = function() {
// Super Call
Sprite.prototype.initialize.call(this);
// Create Background Sprite
this.createBackgroundSprite();
// Create Overlay Sprites
this.createOverlaySprites();
// Create Text Counter Sprite
};
//=============================================================================
// * Create Background Sprite
//=============================================================================
Sprite_OmoBlackLetterMap.prototype.createBackgroundSprite = function() {
// Create Background Sprite
this._backgroundSprite = new Sprite(ImageManager.loadSystem('blackletter_bg'));
this.addChild(this._backgroundSprite);
};
//=============================================================================
// * Create Overlay Sprites
//=============================================================================
Sprite_OmoBlackLetterMap.prototype.createOverlaySprites = function() {
// Create Overlay Bitmap
var bitmap = new Bitmap(Graphics.width, Graphics.height);
// Get Background Bitmap
var bgBitmap = ImageManager.loadAtlas('blackLetter_map_atlas');
var bgBitmap50 = ImageManager.loadAtlas('blackLetter_map_50_atlas');
// Get Map Data
bgBitmap.addLoadListener(() => {
bgBitmap50.addLoadListener(() => {
var mapData = [
{name: '焚火虫森林', namePos: new Point(80, 195), rect: new Rectangle(0, 0, 193, 139), pos: new Point(111, 103), blackSwitchId: 23, nameSwitchId: 30, blackSwitch50Id: 900 },
// {name: 'Forgotten Pier', namePos: new Point(200, 27), rect: new Rectangle(194, 0, 155, 120), pos: new Point(225, 52), blackSwitchId: 21, nameSwitchId: 29 },
{name: '风车森林', namePos: new Point(440, 240), rect: new Rectangle(350, 0, 99, 107), pos: new Point(471, 128), blackSwitchId: 24, nameSwitchId: 31, blackSwitch50Id: 901 },
{name: '树苗鼹鼠村', namePos: new Point(25, 340), rect: new Rectangle(450, 0, 94, 80), pos: new Point(54, 267), blackSwitchId: 25, nameSwitchId: 32, blackSwitch50Id: 902 },
{name: '辽阔森林', namePos: new Point(250, 300), rect: new Rectangle(0, 124, 640, 201), pos: new Point(-2, 143), blackSwitchId: 26, nameSwitchId: 33, blackSwitch50Id: 903 },
{name: '深井', namePos: new Point(450, 355), rect: new Rectangle(0, 326, 418, 113), pos: new Point(119, 366), blackSwitchId: 27, nameSwitchId: 34, blackSwitch50Id: 904 },
{name: '橙子绿洲', namePos: new Point(20, 55), rect: new Rectangle(545, 0, 122, 102), pos: new Point(31, 85), blackSwitchId: 28, nameSwitchId: 35, blackSwitch50Id: 905 },
{name: '异世界', namePos: new Point(450, 75), rect: new Rectangle(419, 326, 140, 209), pos: new Point(390, 21), blackSwitchId: 29, nameSwitchId: 36, blackSwitch50Id: 906 },
]
// Initialize Name Windows Array
this._nameWindows = [];
// Create Container for Name Windows
this._nameWindowsContainer = new Sprite();
// Go Through Map Data
for (var i = 0; i < mapData.length; i++) {
// Get Data
var data = mapData[i];
// Get Rect & Position
var rect = data.rect, pos = data.pos;
var test = Math.randomInt(100) > 50;
// If Black switch ID is not on
/*if (!$gameSwitches.value(data.blackSwitchId)) {
if (!$gameSwitches.value(data.blackSwitch50Id)) {
// Draw Black onto Bitmap
bitmap.blt(bgBitmap50, rect.x, rect.y, rect.width, rect.height, pos.x, pos.y);
} else {
}
};*/
//if(!!$gameSwitches.value(data.blackSwitchId)) {bitmap.blt(bgBitmap, rect.x, rect.y, rect.width, rect.height, pos.x, pos.y);}
//else if(!!$gameSwitches.value(data.blackSwitch50Id)) {bitmap.blt(bgBitmap50, rect.x, rect.y, rect.width, rect.height, pos.x, pos.y);}
if(!!$gameSwitches.value(data.blackSwitch50Id)) {bitmap.blt(bgBitmap, rect.x, rect.y, rect.width, rect.height, pos.x, pos.y);}
else {
if(!$gameSwitches.value(data.blackSwitchId)) {
bitmap.blt(bgBitmap50, rect.x, rect.y, rect.width, rect.height, pos.x, pos.y);
}
}
// Get Name Position
var namePos = data.namePos;
var name = $gameSwitches.value(data.nameSwitchId) ? data.name : "???"
// Create Window
var win = new Window_OmoBlackLetterMapName(name);
// Set Window Position
win.x = namePos.x; win.y = namePos.y;
this._nameWindows.push(win);
this._nameWindowsContainer.addChild(win);
};
// Create Black Overlay Sprite
this._blackOverlay = new Sprite(bitmap);
this.addChild(this._blackOverlay)
// Add Name Window container as a child
this.addChild(this._nameWindowsContainer);
this.createTextCounterSprite();
})
})
};
//=============================================================================
// * Create Text Counter Sprite
//=============================================================================
Sprite_OmoBlackLetterMap.prototype.createTextCounterSprite = function() {
// Get Background Bitmap
var bgBitmap = ImageManager.loadAtlas('blackLetter_map_atlas');
// Create Bitmap
var bitmap = new Bitmap(200, 40);
bitmap.blt(bgBitmap, 450, 81, 39, 37, 5, 10);
bitmap.textColor = '#000000';
bitmap.outlineColor = 'rgba(255, 255, 255, 1)'
bitmap.outlineWidth = 3;
bitmap.drawText('%1/%2'.format($gameVariables.value(19), 26), 48, 0, 70, 55);
this._textCounterSprite = new Sprite(bitmap);
this._textCounterSprite.y = Graphics.height - 50;
this.addChild(this._textCounterSprite);
};
//=============================================================================
// ** Window_OmoBlackLetterMapName
//-----------------------------------------------------------------------------
// The window for displaying the name of a map section in the black letter map.
//=============================================================================
function Window_OmoBlackLetterMapName() { this.initialize.apply(this, arguments); }
Window_OmoBlackLetterMapName.prototype = Object.create(Window_Base.prototype);
Window_OmoBlackLetterMapName.prototype.constructor = Window_OmoBlackLetterMapName;
//=============================================================================
// * Object Initialization
//=============================================================================
Window_OmoBlackLetterMapName.prototype.initialize = function(name) {
// Set Name
this._name = name;
// Super Call
Window_Base.prototype.initialize.call(this, 0, 0, 300, 38);
this.refresh();
};
//=============================================================================
// * Settings
//=============================================================================
Window_OmoBlackLetterMapName.prototype.standardPadding = function() { return 4; };
Window_OmoBlackLetterMapName.prototype.windowWidth = function() { return Graphics.width; };
//=============================================================================
// * Refresh
//=============================================================================
Window_OmoBlackLetterMapName.prototype.refresh = function() {
// Clear Contents
this.contents.clear();
// Get Text Width
var textWidth = this.textWidth(this._name);
// Adjust Width
this.width = textWidth + (this._name === "???" ? 24 : this.padding*2);
this.contents.fontSize = 18;
// Draw Name
this.drawText(this._name, 0, -5, this.contentsWidth(), 'center');
};

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,745 @@
//=============================================================================
// TDS Omori Quest Menu
// Version: 1.3
//=============================================================================
// Add to Imported List
var Imported = Imported || {} ; Imported.TDS_QuestMenu = true;
// Initialize Alias Object
var _TDS_ = _TDS_ || {} ; _TDS_.QuestMenu = _TDS_.QuestMenu || {};
//=============================================================================
/*:
* @plugindesc
* Quest Menu for OMORI.
*
* @author TDS
*
* @param Opening Message
* @desc The Message to show when the quest menu is called.
* @default ""
*
*
* @param World Variable ID
* @desc ID of the variable used to track the current world.
* @default 1
*
* @help
* ============================================================================
* * Script Calls
* ============================================================================
*
* Use this script call to call the quest menu.
*
* this.callQuestMenu();
*
*
*
* Use this script call to add a quest.
*
* this.addQuest(ID);
*
* ID
* ^ Id of the quest.
*
* Example:
*
* this.addQuest('Quest4');
*
*
*
* Use this script call to remove a quest.
*
* this.removeQuest(ID);
*
* ID
* ^ Id of the quest.
*
* Example:
*
* this.removeQuest('Quest4');
*
*
*
* Use this script call to set the complete state of a quest.
*
* this.setQuestCompleteState(ID, STATE);
*
* ID
* ^ Id of the quest.
*
* STATE
* ^ State of the quest. (true/false) (Optiona: Defaults to true)
*
* Example:
*
* this.setQuestCompleteState('Quest1');
*
* this.setQuestCompleteState('Quest4', true);
*
* this.setQuestCompleteState('Quest5', false);
*
*
* Use this script call to set a quest's message index.
*
* this.setQuestMessageIndex(ID, INDEX);
*
* ID
* ^ Id of the quest.
*
* INDEX
* ^ Index value.
*
* Example:
*
* this.setQuestMessageIndex('Quest4', 1);
*
*/
//=============================================================================
// Node.js path
var path = require('path');
// Get Parameters
var parameters = PluginManager.parameters("Omori Quest Menu");
// Initialize Parameters
_TDS_.QuestMenu.params = {};
_TDS_.QuestMenu.params.worldVariableID = Number(parameters['World Variable ID'] || 1);
_TDS_.QuestMenu.params.openingMessage = String(parameters['Opening Message'] || '');
//=============================================================================
// ** DataManager
//-----------------------------------------------------------------------------
// The game object class for the party. Information such as gold and items is
// included.
//=============================================================================
// Alias Listing
//=============================================================================
_TDS_.QuestMenu.DataManager_loadDatabase = DataManager.loadDatabase;
//=============================================================================
// * Load Database
//=============================================================================
DataManager.loadDatabase = function() {
// Run Original Function
_TDS_.QuestMenu.DataManager_loadDatabase.call(this);
var path = require('path');
var fs = require('fs');
var yaml = require('./js/libs/js-yaml-master')
// Load Quests
window['$dataQuests'] = jsyaml.load(fs.readFileSync('data/Quests.yaml', 'utf8'));
};
//=============================================================================
// ** Game_Party
//-----------------------------------------------------------------------------
// The game object class for the party. Information such as gold and items is
// included.
//=============================================================================
// Alias Listing
//=============================================================================
_TDS_.QuestMenu.Game_Party_initialize = Game_Party.prototype.initialize;
//=============================================================================
// * Object Initialization
//=============================================================================
Game_Party.prototype.initialize = function() {
// Run Original Function
_TDS_.QuestMenu.Game_Party_initialize.call(this);
// Initialize Quest List
this._questList = [];
// Quest Stand By Message
this._questStandByMessage = null;
};
//=============================================================================
// * Set Stand By Message
//=============================================================================
Game_Party.prototype.setQuestStandByMessage = function(message) {
this._questStandByMessage = message;
};
//=============================================================================
// * Add Quest
//=============================================================================
Game_Party.prototype.addQuest = function(id, data = {}) {
// If You don't have quest already
if (!this.hasQuest(id, false)) {
// Get World
var world = $dataQuests.quests[id].world;
// Create Quest Object
var quest = {id: id, messageIndex: 0, world: world, complete: false};
// Assign Data to Quest
Object.assign(quest, data);
// Add Quest to Quest List
this._questList.push(quest)
// Return Added Quest
return quest;
};
// Return False
return false;
};
//=============================================================================
// * Remove Quest
//=============================================================================
Game_Party.prototype.removeQuest = function(id) {
// Get List of Quests to remove
var list = this._questList.filter(function(quest) { return quest.id === id; } )
// Go Through List
for (var i = 0; i < list.length; i++) {
// Get Index of Quest to remove
var index = this._questList.indexOf(list[i]);
// Remove Quest
if (index >= 0) { this._questList.splice(index, 1); };
};
};
//=============================================================================
// * Determine if you have quest already
//=============================================================================
Game_Party.prototype.hasQuest = function(id, completed = true) {
return this._questList.some(function(quest) { return quest.id === id });
};
//=============================================================================
// * Get Completed Quest List
//=============================================================================
Game_Party.prototype.completedQuestList = function(world = 0) {
return this._questList.filter(function(quest) { return quest.complete && quest.world === world; });
};
//=============================================================================
// * Get Incomplete Quest List
//=============================================================================
Game_Party.prototype.incompleteQuestList = function(world = 0) {
return this._questList.filter(function(quest) { return !quest.complete && quest.world === world; });
};
//=============================================================================
// * Set Quest Complete State
//=============================================================================
Game_Party.prototype.setQuestCompleteState = function(id, state = true) {
for (var i = 0; i < this._questList.length; i++) {
var quest = this._questList[i];
if (quest.id === id) { quest.complete = state; };
};
};
//=============================================================================
// * Set Quest Message Index
//=============================================================================
Game_Party.prototype.setQuestMessageIndex = function(id, index) {
// Get Quest
var quest = this._questList.find(function(q) { return q.id === id; });
// Set Quest Message Index
if (quest) { quest.messageIndex = index; };
};
//=============================================================================
// ** Game_Interpreter
//-----------------------------------------------------------------------------
// The interpreter for running event commands.
//=============================================================================
// * Call Quest Menu
//=============================================================================
Game_Interpreter.prototype.callQuestMenu = function() {
SceneManager.push(Scene_OmoriQuest);
};
//=============================================================================
// * Add Quest
//=============================================================================
Game_Interpreter.prototype.addQuest = function(id, data) {
$gameParty.addQuest(id, data);
};
//=============================================================================
// * Remove Quest
//=============================================================================
Game_Interpreter.prototype.removeQuest = function(id) {
$gameParty.removeQuest(id);
};
//=============================================================================
// * Set Quest Complete State
//=============================================================================
Game_Interpreter.prototype.setQuestCompleteState = function(id, state) {
$gameParty.setQuestCompleteState(id, state);
};
//=============================================================================
// * Set Quest Message Index
//=============================================================================
Game_Interpreter.prototype.setQuestMessageIndex = function(id, index) {
$gameParty.setQuestMessageIndex(id, index);
};
//=============================================================================
// ** Scene_OmoriQuest
//-----------------------------------------------------------------------------
// Base Class for Omori Menu Scenes
//=============================================================================
function Scene_OmoriQuest() { this.initialize.apply(this, arguments); }
Scene_OmoriQuest.prototype = Object.create(Scene_Base.prototype);
Scene_OmoriQuest.prototype.constructor = Scene_OmoriQuest;
//=============================================================================
// * Object Initialization
//=============================================================================
Scene_OmoriQuest.prototype.initialize = function() {
// Super Call
Scene_Base.prototype.initialize.call(this);
// Update Window Cursors Flag
this._updateWindowCursors = false;
};
//=============================================================================
// * Create
//=============================================================================
Scene_OmoriQuest.prototype.create = function() {
// Super Call
Scene_Base.prototype.create.call(this);
// Create Background
this.createBackground();
// Create Quest Windows
this.createQuestWindows();
// Create Message Window
this.createMessageWindow();
};
//=============================================================================
// * Create Background
//=============================================================================
Scene_OmoriQuest.prototype.start = function() {
// Super Call
Scene_Base.prototype.start.call(this);
// If there's an opening message
if (_TDS_.QuestMenu.params.openingMessage.length > 0) {
// Set Starting Message
$gameMessage.showLanguageMessage(_TDS_.QuestMenu.params.openingMessage);
};
// Set Update Wait Cursors Flag to true
this._updateWindowCursors = true;
this._questListWindow.updateCustomCursorRectSprite();
this._questTypesWindows.updateCustomCursorRectSprite();
};
//=============================================================================
// * Create Background
//=============================================================================
Scene_OmoriQuest.prototype.createBackground = function() {
this._backgroundSprite = new Sprite();
this._backgroundSprite.bitmap = SceneManager.backgroundBitmap();
this.addChild(this._backgroundSprite);
};
//=============================================================================
// * Create Quest Windows
//=============================================================================
Scene_OmoriQuest.prototype.createQuestWindows = function() {
// Create Quest Header Window
this._questHeaderWindow = new Window_OmoriQuestHeader()
this.addChild(this._questHeaderWindow);
// Create Quest Types Window
this._questTypesWindows = new Window_OmoriQuestTypes();
this._questTypesWindows.y = this._questHeaderWindow.y + this._questHeaderWindow.height + 2;
this._questTypesWindows.setHandler('ok', this.onQuestTypesOk.bind(this));
this._questTypesWindows.setHandler('cancel', this.popScene.bind(this));
this.addChild(this._questTypesWindows);
// Create Quest List Window
this._questListWindow = new Window_OmoriQuestList();
this._questListWindow.x = this._questTypesWindows.x + this._questTypesWindows.width + 2;
this._questListWindow.y = this._questTypesWindows.y;
this._questListWindow.setHandler('ok', this.onQuestListOk.bind(this));
this._questListWindow.setHandler('cancel', this.onQuestListCancel.bind(this));
this.addChild(this._questListWindow);
// Set Quest List Window
this._questTypesWindows._questlistWindow = this._questListWindow;
this._questTypesWindows.callUpdateHelp();
};
//=============================================================================
// * Create Message Window
//=============================================================================
Scene_OmoriQuest.prototype.createMessageWindow = function() {
this._messageWindow = new Window_OmoriQuestMessage();
this.addChild(this._messageWindow);
this._messageWindow.subWindows().forEach(function(window) {
this.addChild(window);
}, this);
// Add Facebox Window Container as a Child
this.addChild(this._messageWindow._faceBoxWindowContainer);
};
//=============================================================================
// * [OK] Quest Type
//=============================================================================
Scene_OmoriQuest.prototype.onQuestTypesOk = function() {
this._questListWindow.select(0);
this._questListWindow.activate();
};
//=============================================================================
// * [OK] Quest List
//=============================================================================
Scene_OmoriQuest.prototype.onQuestListOk = function() {
this._questListWindow.activate();
this._messageWindow._setStandbyMessage = true;
// Get Messages
var messages = this._questListWindow.selectedQuestMessages();
$gameMessage.showLanguageMessage(messages[0]);
// Clear Message List
this._messageWindow.clearMessageList();
for (var i = 1; i < messages.length; i++) {
this._messageWindow.addMessage(messages[i]);
};
// Set Update Wait Cursors Flag to true
this._updateWindowCursors = true;
this._questListWindow.updateCustomCursorRectSprite();
this._questTypesWindows.updateCustomCursorRectSprite();
};
//=============================================================================
// * [Cancel] Quest List
//=============================================================================
Scene_OmoriQuest.prototype.onQuestListCancel = function() {
// Activate Quest Types Window
this._questTypesWindows.activate();
this._questListWindow.deselect();
};
//=============================================================================
// * Frame Update
//=============================================================================
Scene_OmoriQuest.prototype.update = function() {
// Super Call
Scene_Base.prototype.update.call(this);
if (this._updateWindowCursors && !$gameMessage.isBusy()) {
this._updateWindowCursors = false;
this._questListWindow.updateCustomCursorRectSprite();
this._questTypesWindows.updateCustomCursorRectSprite();
};
// if (Input.isTriggered('control')) {
// }
};
//=============================================================================
// ** Window_OmoriQuestHeader
//-----------------------------------------------------------------------------
// This window displays the quest list header.
//=============================================================================
function Window_OmoriQuestHeader() { this.initialize.apply(this, arguments); }
Window_OmoriQuestHeader.prototype = Object.create(Window_Base.prototype);
Window_OmoriQuestHeader.prototype.constructor = Window_OmoriQuestHeader;
//=============================================================================
// * Initialize Object
//=============================================================================
Window_OmoriQuestHeader.prototype.initialize = function() {
// Super Call
Window_Base.prototype.initialize.call(this, 12, 12, this.windowWidth(), this.windowHeight());
// // Close Window
// this.openness = 0;
// Draw Contents
this.refresh();
};
//=============================================================================
// * Settings
//=============================================================================
Window_OmoriQuestHeader.prototype.standardPadding = function() { return 0; };
Window_OmoriQuestHeader.prototype.windowWidth = function() { return 164; };
Window_OmoriQuestHeader.prototype.windowHeight = function() { return 44; };
//=============================================================================
// * Refresh
//=============================================================================
Window_OmoriQuestHeader.prototype.refresh = function() {
// Clear Contents
this.contents.clear();
// Draw Header
this.contents.drawText(LanguageManager.getPluginText('questMenu', 'header'), 0, 0, this.contents.width, this.contents.height, 'center');
};
//=============================================================================
// ** Window_OmoriQuestTypes
//-----------------------------------------------------------------------------
// This window displays quest types (Completed, Incomplete).
//=============================================================================
function Window_OmoriQuestTypes() { this.initialize.apply(this, arguments); }
Window_OmoriQuestTypes.prototype = Object.create(Window_Command.prototype);
Window_OmoriQuestTypes.prototype.constructor = Window_OmoriQuestTypes;
//=============================================================================
// * Initialize Object
//=============================================================================
Window_OmoriQuestTypes.prototype.initialize = function() {
// Super Call
Window_Command.prototype.initialize.call(this, 12, 0);
this.activate();
this.select(0);
};
//=============================================================================
// * Settings
//=============================================================================
Window_OmoriQuestTypes.prototype.isUsingCustomCursorRectSprite = function() { return true; };
Window_OmoriQuestTypes.prototype.windowWidth = function() { return 184; };
Window_OmoriQuestTypes.prototype.windowHeight = function() { return 81; };
Window_OmoriQuestTypes.prototype.standardPadding = function() { return 8; };
Window_OmoriQuestTypes.prototype.customCursorRectTextXOffset = function() { return 35; };
Window_OmoriQuestTypes.prototype.customCursorRectXOffset = function() { return 10; };
Window_OmoriQuestTypes.prototype.lineHeight = function() { return 28; };
Window_OmoriQuestTypes.prototype.standardFontSize = function() { return 22; }; //24
//=============================================================================
// * Get Current World
//=============================================================================
Window_OmoriQuestTypes.prototype.currentWorld = function() {
return $gameVariables.value(_TDS_.QuestMenu.params.worldVariableID);
};
//=============================================================================
// * Make Command List
//=============================================================================
Window_OmoriQuestTypes.prototype.makeCommandList = function() {
var world = this.currentWorld();
let questStates = LanguageManager.getPluginText('questMenu', 'questStates');
this.addCommand(questStates[0], 'incomplete', $gameParty.incompleteQuestList(world).length > 0 );
this.addCommand(questStates[1], 'complete', $gameParty.completedQuestList(world).length > 0);
};
//=============================================================================
// * Draw Item
//=============================================================================
Window_OmoriQuestTypes.prototype.drawItem = function(index) {
// Get Item Rect
var rect = this.itemRectForText(index);
var align = this.itemTextAlign();
this.resetTextColor();
// Set Text Color
this.changeTextColor(index === 1 ? 'rgba(0, 161, 4, 1)' : 'rgba(228, 50, 14, 1)');
this.changePaintOpacity(this.isCommandEnabled(index));
this.drawText(this.commandName(index), rect.x, rect.y, rect.width, align);
};
//=============================================================================
// * Call Update Help
//=============================================================================
Window_OmoriQuestTypes.prototype.callUpdateHelp = function() {
// Run Original Function
Window_Command.prototype.callUpdateHelp.call(this);
// if Quest List Window Exists
if (this._questlistWindow) {
var world = this.currentWorld();
// Get List
var list = this.index() === 0 ? $gameParty.incompleteQuestList(world) : $gameParty.completedQuestList(world);
// Set Quest List
this._questlistWindow.setQuestList(list);
};
};
//=============================================================================
// * Process Cursor Move
//=============================================================================
Window_OmoriQuestTypes.prototype.processCursorMove = function() {
// If a message is displaying
if ($gameMessage.isBusy()) { return;};
// Run Original Function
Window_Command.prototype.processCursorMove.call(this);
};
//=============================================================================
// * Process Handling
//=============================================================================
Window_OmoriQuestTypes.prototype.processHandling = function() {
// If a message is displaying
if ($gameMessage.isBusy()) { return;};
// Run Original Function
Window_Command.prototype.processHandling.call(this);
};
//=============================================================================
// * Update Custom Cursor Rect Sprite
//=============================================================================
Window_OmoriQuestTypes.prototype.updateCustomCursorRectSprite = function(sprite, index) {
// Set Sprite
sprite = this._customCursorRectSprite;
// If Custom Rect Sprite Exists
if (sprite && $gameMessage.isBusy()) {
// Set Sprite Tone Color
sprite.setColorTone([-80, -80, -80, 255]);
// Set Sprite active flag
sprite._active = false;
return;
};
// Run Original Function
Window_Command.prototype.updateCustomCursorRectSprite.call(this, sprite, index);
};
//=============================================================================
// ** Window_OmoriQuestList
//-----------------------------------------------------------------------------
// This window displays the list of available and completed quests
//=============================================================================
function Window_OmoriQuestList() { this.initialize.apply(this, arguments); }
Window_OmoriQuestList.prototype = Object.create(Window_Command.prototype);
Window_OmoriQuestList.prototype.constructor = Window_OmoriQuestList;
//=============================================================================
// * Initialize Object
//=============================================================================
Window_OmoriQuestList.prototype.initialize = function() {
// Quest List
this._questList = [];
// Super Call
Window_Command.prototype.initialize.call(this, 12, 0);
// this.openness = 0;
this.deactivate();
this.deselect();
};
//=============================================================================
// * Settings
//=============================================================================
Window_OmoriQuestList.prototype.isUsingCustomCursorRectSprite = function() { return true; };
Window_OmoriQuestList.prototype.windowWidth = function() { return 360 };
Window_OmoriQuestList.prototype.windowHeight = function() { return 177; };
Window_OmoriQuestList.prototype.standardPadding = function() { return 8; };
Window_OmoriQuestList.prototype.customCursorRectTextXOffset = function() { return 35; };
Window_OmoriQuestList.prototype.lineHeight = function() { return 25; };
Window_OmoriQuestList.prototype.standardFontSize = function() { return 22; };
//=============================================================================
// * Set Quest List
//=============================================================================
Window_OmoriQuestList.prototype.setQuestList = function(list) {
// Set List
this._questList = list;
// Refresh
this.refresh();
// Reset Scroll
this.resetScroll();
};
//=============================================================================
// * Get Selected Quest Messages
//=============================================================================
Window_OmoriQuestList.prototype.selectedQuestMessages = function(index = this._index) {
// Get Quest
var quest = this._questList[index];
// Return Quest
return $dataQuests.quests[quest.id].text[quest.messageIndex];
};
//=============================================================================
// * Make Command List
//=============================================================================
Window_OmoriQuestList.prototype.makeCommandList = function() {
// Get Language
var language = LanguageManager._language;
// Go Through Quest List
for (var i = 0; i < this._questList.length; i++) {
// Get Quest
var quest = this._questList[i];
// Get Data
const loc = LanguageManager.getMessageData("XX_BLUE.Quest_Names")[quest.id]
var data = $dataQuests.quests[quest.id];
const questname = !loc ? data.name[language] : loc
this.addCommand(questname, 'quest', true, quest)
};
};
//=============================================================================
// * Draw Item
//=============================================================================
Window_OmoriQuestList.prototype.drawItem = function(index) {
// Run Original Function
Window_Command.prototype.drawItem.call(this, index);
// Get Item Rect
var rect = this.itemRect(index);
};
//=============================================================================
// * Refresh Arrows
//=============================================================================
Window_OmoriQuestList.prototype._refreshArrows = function() {
// Super Call
Window_Command.prototype._refreshArrows.call(this);
var w = this._width;
var h = this._height;
var p = 24;
var q = (p/2) + 5;
this._downArrowSprite.move(w - q, h - q);
this._upArrowSprite.move(w - q, q);
};
//=============================================================================
// * Process Cursor Move
//=============================================================================
Window_OmoriQuestList.prototype.processCursorMove = function() {
// If a message is displaying
if ($gameMessage.isBusy()) { return;};
// Run Original Function
Window_Command.prototype.processCursorMove.call(this);
};
//=============================================================================
// * Process Handling
//=============================================================================
Window_OmoriQuestList.prototype.processHandling = function() {
// If a message is displaying
if ($gameMessage.isBusy()) { return;};
// Run Original Function
Window_Command.prototype.processHandling.call(this);
};
//=============================================================================
// * Update Custom Cursor Rect Sprite
//=============================================================================
Window_OmoriQuestList.prototype.updateCustomCursorRectSprite = function(sprite, index) {
// Set Sprite
sprite = this._customCursorRectSprite;
// If Custom Rect Sprite Exists
if (sprite && $gameMessage.isBusy()) {
// Set Sprite Tone Color
sprite.setColorTone([-80, -80, -80, 255]);
// Set Sprite active flag
sprite._active = false;
return;
};
// Run Original Function
Window_Command.prototype.updateCustomCursorRectSprite.call(this, sprite, index);
};
//=============================================================================
// ** Window_OmoriQuestMessage
//-----------------------------------------------------------------------------
// This window displays quest message dialogue.
//=============================================================================
function Window_OmoriQuestMessage() { this.initialize.apply(this, arguments); }
Window_OmoriQuestMessage.prototype = Object.create(Window_Message.prototype);
Window_OmoriQuestMessage.prototype.constructor = Window_OmoriQuestMessage;
//=============================================================================
// * Initialize Object
//=============================================================================
Window_OmoriQuestMessage.prototype.initialize = function() {
// Clear Message List
this.clearMessageList();
// Set Standby Message Flag
this._setStandbyMessage = false;
// Super Call
Window_Message.prototype.initialize.call(this);
};
//=============================================================================
// * Clear Message List
//=============================================================================
Window_OmoriQuestMessage.prototype.clearMessageList = function() {
this._messageList = [];
};
//=============================================================================
// * Clear Message List
//=============================================================================
Window_OmoriQuestMessage.prototype.addMessage = function(message) {
this._messageList.push(message);
};
//=============================================================================
// * Set Stand By Message
//=============================================================================
Window_OmoriQuestMessage.prototype.setStandByMessage = function() { this._setStandbyMessage = true; }
//=============================================================================
// * Terminate Message
//=============================================================================
Window_OmoriQuestMessage.prototype.terminateMessage = function() {
// Clear Game Message
$gameMessage.clear();
// If Message List Length is more than 0
if (this._messageList.length > 0) {
// Get Message
var message = this._messageList.shift();
// Show Language Message
$gameMessage.showLanguageMessage(message);
return;
};
// If set Standy Message Flag is true
if (this._setStandbyMessage) {
// If Stand By Message for Quests Exist
if ($gameParty._questStandByMessage) {
// Set Quest Standby Message
$gameMessage.showLanguageMessage($gameParty._questStandByMessage);
}
// Set Standby Message to false
this._setStandbyMessage = false;
};
};

View file

@ -0,0 +1,783 @@
//=============================================================================
// TDS Message Save & Load
// Version: 1.0
//=============================================================================
// Add to Imported List
var Imported = Imported || {} ; Imported.TDS_OmoriSaveLoad = true;
// Initialize Alias Object
var _TDS_ = _TDS_ || {} ; _TDS_.OmoriSaveLoad = _TDS_.OmoriSaveLoad || {};
//=============================================================================
/*:
* @author TDS
* @plugindesc
* Combo Skills port from ACE.
*
*
*/
//=============================================================================
Game_Actor.prototype.faceSaveLoad = function() {
var actor = this.actor();
// When changing these the .png should not be required.
switch (actor.id) {
case 1: // Omori
return "01_OMORI_BATTLE";
case 2: // Aubrey
return "02_AUBREY_BATTLE";
case 3: // Kel
return "03_KEL_BATTLE";
case 4: // Hero
return "04_HERO_BATTLE";
case 8: // Omori
return "01_FA_OMORI_BATTLE";
case 9: // Aubrey
return "02_FA_AUBREY_BATTLE";
case 10: // Kel
return "03_FA_KEL_BATTLE";
case 11: // Hero
return "04_FA_HERO_BATTLE";
default:
return "default_face_image_here"; // if ther is one?
}
};
Game_Actor.prototype.faceSaveLoadIndex = function() {
var actor = this.actor();
// When changing these the .png should not be required.
switch (actor.id) {
case 1: // Omori
return 0;
case 2: // Aubrey
return 0;
case 3: // Kel
return 0;
case 4: // Hero
return 0;
default:
return 0;
}
};
//=============================================================================
// ** DataManager
//-----------------------------------------------------------------------------
// The static class that manages the database and game objects.
//=============================================================================
// Alias Listing
//=============================================================================
_TDS_.OmoriSaveLoad.DataManager_makeSavefileInfo = DataManager.makeSavefileInfo;
//=============================================================================
// * Make Save File Information
//=============================================================================
DataManager.makeSavefileInfo = function() {
// Get Original Info
var info = _TDS_.OmoriSaveLoad.DataManager_makeSavefileInfo.call(this);
// Get Leader
var actor = $gameParty.leader();
info.actorData = {name: actor.name(), level: actor.level, faceName: actor.faceSaveLoad(), faceIndex: actor.faceSaveLoadIndex()};
info.chapter = $gameVariables.value(23);
info.location = $gameMap.displayName();
// Return Info
return info;
};
//=============================================================================
// ** Game_Interpreter
//-----------------------------------------------------------------------------
// The interpreter for running event commands.
//=============================================================================
// * Call Save Menu
//=============================================================================
Game_Interpreter.prototype.callSaveMenu = function(save = true, load = true) {
// Call Save Menu
SceneManager.push(Scene_OmoriFile);
SceneManager._nextScene.setup(save, load);
};
//=============================================================================
// ** Scene_OmoriFile
//-----------------------------------------------------------------------------
// This scene is used to handle saving & loading.
//=============================================================================
function Scene_OmoriFile() { this.initialize.apply(this, arguments); }
Scene_OmoriFile.prototype = Object.create(Scene_Base.prototype);
Scene_OmoriFile.prototype.constructor = Scene_OmoriFile;
//=============================================================================
// * Object Initialization
//=============================================================================
Scene_OmoriFile.prototype.initialize = function() {
this._imageReservationId = 'file';
// Super Call
Scene_Base.prototype.initialize.call(this);
// Save Index
this._saveIndex = -1;
// If Can Select Flag is true
this._canSelect = false;
// Set Load Success Flag
this._loadSuccess = false;
// Set Save & Load Flags
this._canSave = true; this._canLoad = true;
};
//=============================================================================
// * Initialize Atlas Lists
//=============================================================================
Scene_OmoriFile.prototype.initAtlastLists = function() {
// Super Call
Scene_Base.prototype.initAtlastLists.call(this);
};
//=============================================================================
// * Load Reserved Bitmaps
//=============================================================================
Scene_OmoriFile.prototype.loadReservedBitmaps = function() {
// Super Call
Scene_Base.prototype.loadReservedBitmaps.call(this);
// Go through save files
for (var i = 1; i < 5; i++) {
// Get Save Info
const info = DataManager.loadSavefileInfo(i);
// If Information Exists
if (info) {
// Get Actor Data
const actor = info.actorData;
// Reserve Face Image
ImageManager.reserveFace(actor.faceName, actor.faceIndex, this._imageReservationId);
};
}
ImageManager.reserveSystem('faceset_states', 0, this._imageReservationId);
ImageManager.reserveParallax('polaroidBG_BS_sky', 0, this._imageReservationId);
};
//=============================================================================
// * Terminate
//=============================================================================
Scene_OmoriFile.prototype.setup = function(save, load) {
// Set Save & Load Flags
this._canSave = save; this._canLoad = load;
};
//=============================================================================
// * Terminate
//=============================================================================
Scene_OmoriFile.prototype.terminate = function() {
Scene_Base.prototype.terminate.call(this);
if (this._loadSuccess) {
$gameSystem.onAfterLoad();
};
};
//=============================================================================
// * Create
//=============================================================================
Scene_OmoriFile.prototype.create = function() {
// Super Call
Scene_Base.prototype.create.call(this);
// Create Background
this.createBackground();
this.createCommandWindow();
this.createfileWindows();
// Create Prompt Window
this.createPromptWindow();
};
//=============================================================================
// * Create Background
//=============================================================================
Scene_OmoriFile.prototype.createBackground = function() {
// Create Background Sprite
this._backgroundSprite = new TilingSprite();
this._backgroundSprite.bitmap = ImageManager.loadParallax('SAVE_MENU_BG');
this._backgroundSprite.move(0, 0, Graphics.width, Graphics.height);
this.addChild(this._backgroundSprite);
// let centerWidth = 42
// let bitmap = new Bitmap(Graphics.width, Graphics.height);
// bitmap.fillRect(0, 0, centerWidth, bitmap.height, 'rgba(255, 0, 0, 1)');
// bitmap.fillRect(bitmap.width - centerWidth, 0, centerWidth, bitmap.height, 'rgba(255, 0, 0, 1)');
// this._centerSprite = new Sprite(bitmap);
// this.addChild(this._centerSprite);
};
//=============================================================================
// * Create Command Window
//=============================================================================
Scene_OmoriFile.prototype.createCommandWindow = function() {
// Create Command Window
this._commandWindow = new Window_OmoriFileCommand();
this._commandWindow.setupFile(this._canSave, this._canLoad);
this._commandWindow.setHandler('ok', this.onCommandWindowOk.bind(this));
this._commandWindow.setHandler('cancel', this.onCommandWindowCancel.bind(this));
this.addChild(this._commandWindow);
};
//=============================================================================
// * Create File Windows
//=============================================================================
Scene_OmoriFile.prototype.createfileWindows = function() {
// Initialize File Windows Array
this._fileWindows = [];
let sx = this._commandWindow.x + this._commandWindow.width + 1;
// Iterate 3 times
for (var i = 0; i < 6; i++) {
// Create Window
var win = new Window_OmoriFileInformation(i);
win.x = sx;
win.y = 28 + (i * (win.height + 1))
// Set Window
this._fileWindows[i] = win;
this.addChild(win);
};
};
//=============================================================================
// * Create Prompt Window
//=============================================================================
Scene_OmoriFile.prototype.createPromptWindow = function() {
// Create Prompt Window
this._promptWindow = new Window_OmoriFilePrompt();
// Set Handlers
this._promptWindow.setHandler('ok', this.onPromptWindowOk.bind(this));
this._promptWindow.setHandler('cancel', this.onPromptWindowCancel.bind(this));
this._promptWindow.close();
this._promptWindow.openness = 0;
this._promptWindow.deactivate();
this.addChild(this._promptWindow);
};
//=============================================================================
// * Frame Update
//=============================================================================
Scene_OmoriFile.prototype.update = function() {
// Super Call
Scene_Base.prototype.update.call(this);
// Update Background
this.updateBackground();
// Update Select Input
if (this._canSelect) { this.updateSelectInput(); };
// if (Input.isTriggered('control')) {
// // this.onSavefileOk();
// for (var i = 0; i < this._fileWindows.length; i++) {
// // Set Window
// this._fileWindows[i].refresh();
// };
// };
};
//=============================================================================
// * Get Save File ID
//=============================================================================
Scene_OmoriFile.prototype.savefileId = function() { return this._saveIndex + 1; };
//=============================================================================
// * Check if out of bounds
//=============================================================================
Scene_OmoriFile.prototype.isOutOfBounds = function() {
let index = this._saveIndex;
let win = this._fileWindows[index];
if(win.y + win.height > Graphics.boxHeight) {return -28}
if(index === 0) {
if(win.y < 28) {return 28}
}
if(win.y < 0) {return 28}
return 0;
}
//=============================================================================
// * Update Save Index Cursor
//=============================================================================
Scene_OmoriFile.prototype.updateSaveIndexCursor = function() {
// Go Through File Windows
for (var i = 0; i < this._fileWindows.length; i++) {
// Get Window
var win = this._fileWindows[i];
// Set Selected STate
this._saveIndex === i ? win.select() : win.deselect();
};
};
//=============================================================================
// * Update Background
//=============================================================================
Scene_OmoriFile.prototype.updateBackground = function() {
this._backgroundSprite.origin.y += 1;
};
//=============================================================================
// * Update Select Background
//=============================================================================
Scene_OmoriFile.prototype.updateSelectInput = function() {
// If Ok
if (Input.isTriggered('ok')) {
// Call On Select Input Ok
this.onSelectInputOk();
return;
};
// If Cancel
if (Input.isTriggered('cancel')) {
// Play Cancel Sound
SoundManager.playCancel();
// On Select Input Cancel
this.onSelectInputCancel();
return;
};
// If Input Is repeated Up
if (Input.isRepeated('up')) {
// Play Cursor
SoundManager.playCursor();
// If Save index is 0
if (this._saveIndex === 0) {
// Set Save Index at the end
this._saveIndex = this._fileWindows.length-1;
} else {
// Decrease Save Index
this._saveIndex = (this._saveIndex - 1) % this._fileWindows.length;
}
// Update Save Index Cursor
this.updateSaveIndexCursor();
return;
};
// If Input Is repeated Down
if (Input.isRepeated('down')) {
// Play Cursor
SoundManager.playCursor();
// Increase Save Index
this._saveIndex = (this._saveIndex + 1) % this._fileWindows.length;
// Update Save Index Cursor
this.updateSaveIndexCursor();
return;
};
this.updatePlacement();
};
Scene_OmoriFile.prototype.updatePlacement = function() {
if(this._saveIndex < 0) {return;}
let bounds = this.isOutOfBounds();
if(!bounds) {return;}
for(let win of this._fileWindows) {
win.y += bounds;
}
}
//=============================================================================
// * On Command Window Ok
//=============================================================================
Scene_OmoriFile.prototype.onCommandWindowOk = function() {
// Set Can select Flag to true
this._canSelect = true;
// Set Save Index to 0
let latestFile = !!this._canSave ? DataManager.lastAccessedSavefileId() : DataManager.latestSavefileId();
let maxSavefiles = 6;
this._saveIndex = (latestFile - 1) % maxSavefiles;
// Update Save Index Cursor
this.updateSaveIndexCursor();
};
//=============================================================================
// * On Command Window Cancel
//=============================================================================
Scene_OmoriFile.prototype.onCommandWindowCancel = function() {
// If Previous scene is title screen
var isTitleScreen = SceneManager.isPreviousScene(Scene_OmoriTitleScreen);
// Pop Scene
this.popScene();
// If Previous scene is tile scene
if (isTitleScreen) {
// Prepare Title Scene
SceneManager._nextScene.prepare(1);
}
};
//=============================================================================
// * On Select Input Ok
//=============================================================================
Scene_OmoriFile.prototype.onSelectInputOk = function() {
// Get Index
var index = this._commandWindow.index();
// Get Save File ID
var saveFileid = this.savefileId();
// If Save
if (index === 0) {
// If File Exists
if (StorageManager.exists(saveFileid)) {
// Show Prompt Window
this.showPromptWindow(LanguageManager.getMessageData("XX_BLUE.Omori_Save_Load").overwrite_file);
// Set Can select Flag to false
this._canSelect = false;
} else {
// Save The Game
this.saveGame();
};
} else {
// If File Exists
if (StorageManager.exists(saveFileid)) {
// Show Prompt Window
this.showPromptWindow(LanguageManager.getMessageData("XX_BLUE.Omori_Save_Load").load_file);
// Set Can select Flag to false
this._canSelect = false;
} else {
// Play Buzzer Sound
SoundManager.playBuzzer();
};
};
};
//=============================================================================
// * On Select Input Cancel
//=============================================================================
Scene_OmoriFile.prototype.onSelectInputCancel = function() {
// Set Can select Flag to false
this._canSelect = false;
// Set Save Index to -1
this._saveIndex = -1;
// Update Save Index Cursor
this.updateSaveIndexCursor();
// Activate Command Window
this._commandWindow.activate();
};
//=============================================================================
// * Show Prompt Window
//=============================================================================
Scene_OmoriFile.prototype.showPromptWindow = function(text) {
// Set Prompt Window Text
this._promptWindow.setPromptText(text);
// Show Prompt Window
this._promptWindow.open();
this._promptWindow.select(1);
this._promptWindow.activate();
};
//=============================================================================
// * On Prompt Window Ok
//=============================================================================
Scene_OmoriFile.prototype.onPromptWindowOk = function() {
// Get Index
var index = this._commandWindow.index();
// If Save
if (index === 0) {
// Save The Game
this.saveGame();
// Close Prompt Window
this._promptWindow.close();
this._promptWindow.deactivate();
// Set Can select Flag to true
this._canSelect = true;
} else {
// Load Game
this.loadGame();
};
};
//=============================================================================
// * On Prompt Window Cancel
//=============================================================================
Scene_OmoriFile.prototype.onPromptWindowCancel = function() {
// Close Prompt Window
this._promptWindow.close();
this._promptWindow.deactivate();
// Set Can select Flag to true
this._canSelect = true;
};
//=============================================================================
// * Save Game
//=============================================================================
Scene_OmoriFile.prototype.saveGame = function() {
// On Before Save
$gameSystem.onBeforeSave();
// Get Save File ID
var saveFileid = this.savefileId();
// Get File Window
var fileWindow = this._fileWindows[this._saveIndex];
// Save Game
if (DataManager.saveGame(saveFileid)) {
SoundManager.playSave();
StorageManager.cleanBackup(saveFileid);
fileWindow.refresh();
} else {
SoundManager.playBuzzer();
};
// Deactivate Prompt Window
this._promptWindow.deactivate();
this._promptWindow.close();
// Set Can select Flag to false
this._canSelect = true;
// Update Save Index Cursor
this.updateSaveIndexCursor();
};
//=============================================================================
// * Load Game
//=============================================================================
Scene_OmoriFile.prototype.loadGame = function() {
if (DataManager.loadGame(this.savefileId())) {
SoundManager.playLoad();
this.fadeOutAll();
// Reload Map if Updated
if ($gameSystem.versionId() !== $dataSystem.versionId) {
$gamePlayer.reserveTransfer($gameMap.mapId(), $gamePlayer.x, $gamePlayer.y);
$gamePlayer.requestMapReload();
};
SceneManager.goto(Scene_Map);
this._loadSuccess = true;
// Close Prompt Window
this._promptWindow.close();
this._promptWindow.deactivate();
} else {
// Play Buzzer
SoundManager.playBuzzer();
// Close Prompt Window
this._promptWindow.close();
this._promptWindow.deactivate();
// Set Can select Flag to true
this._canSelect = true;
};
};
//=============================================================================
// ** Window_OmoriFileInformation
//-----------------------------------------------------------------------------
// The window for showing picture items for sorting
//=============================================================================
function Window_OmoriFileInformation() { this.initialize.apply(this, arguments); };
Window_OmoriFileInformation.prototype = Object.create(Window_Base.prototype);
Window_OmoriFileInformation.prototype.constructor = Window_OmoriFileInformation;
//=============================================================================
// * Object Initialization
//=============================================================================
Window_OmoriFileInformation.prototype.initialize = function(index) {
// Set Index
this._index = index;
// Super Call
Window_Base.prototype.initialize.call(this, 0, 0, this.windowWidth(), this.windowHeight());
// Create Cursor Sprite
this.createCursorSprite();
// Refresh
this.refresh();
// Deselect
this.deselect();
};
//=============================================================================
// * Settings
//=============================================================================
Window_OmoriFileInformation.prototype.standardPadding = function() { return 4}
Window_OmoriFileInformation.prototype.windowWidth = function () { return 382 + 54; };
Window_OmoriFileInformation.prototype.windowHeight = function() { return 142; }
//=============================================================================
// * Create Cursor Sprite
//=============================================================================
Window_OmoriFileInformation.prototype.createCursorSprite = function() {
// Create Cursor Sprite
this._cursorSprite = new Sprite_WindowCustomCursor();
this._cursorSprite.x = 10//-32;
this._cursorSprite.y = 20;
this.addChild(this._cursorSprite);
};
//=============================================================================
// * Select
//=============================================================================
Window_OmoriFileInformation.prototype.select = function() {
this._cursorSprite.visible = true;
this.contentsOpacity = 255;
};
//=============================================================================
// * Deselect
//=============================================================================
Window_OmoriFileInformation.prototype.deselect = function() {
this._cursorSprite.visible = false;
this.contentsOpacity = 100;
};
//=============================================================================
// * Refresh
//=============================================================================
Window_OmoriFileInformation.prototype.refresh = function() {
// Clear Contents
this.contents.clear();
// Get Color
var color = 'rgba(255, 255, 255, 1)';
// Get ID
var id = this._index + 1;
var valid = DataManager.isThisGameFile(id);
var info = DataManager.loadSavefileInfo(id);
// Draw Lines
this.contents.fillRect(0, 29, this.contents.width, 3, color);
for (var i = 0; i < 3; i++) {
var y = 55 + (i * 25)
this.contents.fillRect(113, y, this.contents.width - 117, 1, color);
};
// Draw File
this.contents.fontSize = LanguageManager.getMessageData("XX_BLUE.Window_OmoriFileInformation").refresh_contents_fontsize;
this.contents.drawText(LanguageManager.getMessageData("XX_BLUE.Omori_Save_Load").file.format(id), 10 + 30, 4, 100, this.contents.fontSize); //10 + 30, -5, 100
// If Valid
if (valid) {
const loc_position = LanguageManager.getMessageData("XX_BLUE.Window_OmoriFileInformation").refresh_drawText_position;
this.contents.drawText(info.chapter, loc_position[0], loc_position[1], this.contents.width, this.contents.fontSize);
this.contents.fontSize = 28;
let backBitmap = ImageManager.loadSystem('faceset_states');
let width = backBitmap.width / 4;
let height = backBitmap.height / 5;
// this.contents.blt(backBitmap, 0, 0, width, height, 0, 34, width + 10, height);
this.contents.blt(backBitmap, 0, 0, width, height, 1, 33);
// Get Actor
var actor = info.actorData
// Draw Actor Face
let bit = ImageManager.loadFace(actor.faceName);
bit.addLoadListener(() => this.drawFace(actor.faceName, actor.faceIndex, -2, this.contents.height - Window_Base._faceHeight + 7, Window_Base._faceWidth, height - 2));
// Draw Actor Name
this.contents.fontSize = 20;
this.contents.drawText(actor.name, 118, 30, 100, 24);
// Draw Level
this.contents.drawText(LanguageManager.getMessageData("XX_BLUE.Omori_Save_Load").level, 290 +25, 30, 100, 24); //290 + 55, 30, 100, 24
this.contents.drawText(actor.level, 290 + 55, 30, 70, 24, 'right');
// Draw Total PlayTime
this.contents.drawText(LanguageManager.getMessageData("XX_BLUE.Omori_Save_Load").playtime, 118, 55, 200, 24);
this.contents.drawText(info.playtime, 295 + 34, 55, 100, 24);
// Draw Location 295 + 55, 55, 100, 24
this.contents.drawText(LanguageManager.getMessageData("XX_BLUE.Omori_Save_Load").location, 118, 80, 200, 24);
this.contents.drawText(info.location, 205, 80, 210, 24, 'right');
};
// Draw Border
this.contents.fillRect(102, 32, 3, 102, 'rgba(255, 255, 255, 1)')
this.contents.fillRect(0, 29, 108, 3, 'rgba(255, 255, 255, 1)')
};
//=============================================================================
// ** Window_OmoriFileCommand
//-----------------------------------------------------------------------------
// The window for selecting a command on the menu screen.
//=============================================================================
function Window_OmoriFileCommand() { this.initialize.apply(this, arguments); }
Window_OmoriFileCommand.prototype = Object.create(Window_Command.prototype);
Window_OmoriFileCommand.prototype.constructor = Window_OmoriFileCommand;
//=============================================================================
// * Object Initialization
//=============================================================================
Window_OmoriFileCommand.prototype.initialize = function() {
// Super Call
Window_Command.prototype.initialize.call(this, 42, 28);
// Setup File
this.setupFile(true, true);
};
//=============================================================================
// * Settings
//=============================================================================
Window_OmoriFileCommand.prototype.isUsingCustomCursorRectSprite = function() { return true; };
Window_OmoriFileCommand.prototype.lineHeight = function () { return 24; };
Window_OmoriFileCommand.prototype.windowWidth = function () { return 119; };
Window_OmoriFileCommand.prototype.windowHeight = function () { return 64; };
Window_OmoriFileCommand.prototype.standardPadding = function () { return 4; };
Window_OmoriFileCommand.prototype.numVisibleRows = function () { return 2; };
Window_OmoriFileCommand.prototype.maxCols = function () { return 1; };
Window_OmoriFileCommand.prototype.customCursorRectYOffset = function() { return 5; }
Window_OmoriFileCommand.prototype.customCursorRectTextXOffset = function() { return 40; }
//=============================================================================
// * Setup File
//=============================================================================
Window_OmoriFileCommand.prototype.setupFile = function (save, load) {
// Set Save & Load Flags
this._canSave = save; this._canLoad = load;
if(!!this._canSave) {this.select(0);}
else if(!!this._canLoad) {this.select(1)}
// Refresh
this.refresh();
};
//=============================================================================
// * Make Command List
//=============================================================================
Window_OmoriFileCommand.prototype.makeCommandList = function () {
this.addCommand("保存", 'save', this._canSave);
this.addCommand("加载", 'load', this._canLoad);
};
//=============================================================================
// ** Window_OmoriFilePrompt
//-----------------------------------------------------------------------------
// The window for selecting a command on the menu screen.
//=============================================================================
function Window_OmoriFilePrompt() { this.initialize.apply(this, arguments); }
Window_OmoriFilePrompt.prototype = Object.create(Window_Command.prototype);
Window_OmoriFilePrompt.prototype.constructor = Window_OmoriFilePrompt;
//=============================================================================
// * Object Initialization
//=============================================================================
Window_OmoriFilePrompt.prototype.initialize = function() {
// Super Call
Window_Command.prototype.initialize.call(this, 0, 0);
// Center Window
this.x = (Graphics.width - this.width) / 2;
this.y = (Graphics.height - this.height) / 2;
// Create Cover Sprite
this.createCoverSprite();
};
//=============================================================================
// * Create Background
//=============================================================================
Window_OmoriFilePrompt.prototype.createCoverSprite = function() {
var bitmap = new Bitmap(Graphics.width, Graphics.height);
bitmap.fillAll('rgba(0, 0, 0, 0.5)')
this._coverSprite = new Sprite(bitmap);
this._coverSprite.x = -this.x;
this._coverSprite.y = -this.y;
this.addChildAt(this._coverSprite, 0);
};
//=============================================================================
// * Openness
//=============================================================================
Object.defineProperty(Window.prototype, 'openness', {
get: function() { return this._openness; },
set: function(value) {
if (this._openness !== value) {
this._openness = value.clamp(0, 255);
this._windowSpriteContainer.scale.y = this._openness / 255;
this._windowSpriteContainer.y = this.height / 2 * (1 - this._openness / 255);
if (this._coverSprite) { this._coverSprite.opacity = this._openness; };
}
},
configurable: true
});
//=============================================================================
// * Settings
//=============================================================================
Window_OmoriFilePrompt.prototype.isUsingCustomCursorRectSprite = function() { return true; };
Window_OmoriFilePrompt.prototype.lineHeight = function () { return 22; };
Window_OmoriFilePrompt.prototype.windowWidth = function () { return 220; };
Window_OmoriFilePrompt.prototype.windowHeight = function () { return 70 + 20; };
Window_OmoriFilePrompt.prototype.standardPadding = function () { return 4; };
Window_OmoriFilePrompt.prototype.numVisibleRows = function () { return 2; };
Window_OmoriFilePrompt.prototype.maxCols = function () { return 1; };
Window_OmoriFilePrompt.prototype.customCursorRectXOffset = function() { return 50; }
Window_OmoriFilePrompt.prototype.customCursorRectYOffset = function() { return 33; }
Window_OmoriFilePrompt.prototype.customCursorRectTextXOffset = function() { return 80; }
Window_OmoriFilePrompt.prototype.customCursorRectTextYOffset = function() { return 28; }
//=============================================================================
// * Setup File
//=============================================================================
Window_OmoriFilePrompt.prototype.setPromptText = function (text) {
// Set Prompt Text
this._promptText = text;
// Refresh Contents
this.refresh();
};
//=============================================================================
// * Make Command List
//=============================================================================
Window_OmoriFilePrompt.prototype.makeCommandList = function () {
this.addCommand("是", 'ok');
this.addCommand("否", 'cancel');
};
//=============================================================================
// * Refresh
//=============================================================================
Window_OmoriFilePrompt.prototype.refresh = function () {
// Super Call
Window_Command.prototype.refresh.call(this);
this.contents.drawText(this._promptText, 0, 0, this.contents.width, 24, 'center');
}

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,594 @@
//=============================================================================
// TDS Language Processor
// Version: 1.5
//=============================================================================
// Add to Imported List
var Imported = Imported || {} ; Imported.TDS_TextLanguageProcessor = true;
// Initialize Alias Object
var _TDS_ = _TDS_ || {} ; _TDS_.TextLanguageProcessor = _TDS_.TextLanguageProcessor || {};
//=============================================================================
/*:
* @plugindesc
* This plugin allows you to use YAML files for multiple language purposes.
*
* @author TDS
*
*
* @param Default Language
* @desc Default language of the game.
* @default en
*
* @help
* ============================================================================
* * Script calls
* ============================================================================
*
* To manually set the current language use the following in a
* script call:
*
* LanguageManager.setLanguage(LANGUAGE, SAVE);
*
* LANGUAGE
* ^ Language name string.
*
* SAVE
* ^ true/false. If true it will save the language in the config
* file so it remembers it when the game is closed and reopened.
* (Optional. Defaults to True)
*
* Examples:
*
* LanguageManager.setLanguage('jp', false);
*
* LanguageManager.setLanguage('en');
*
*/
//=============================================================================
// Node.js path
var path = require('path');
// Get Parameters
var parameters = PluginManager.parameters("Text_Language_Processor");
// Initialize Parameters
_TDS_.TextLanguageProcessor.params = {};
_TDS_.TextLanguageProcessor.params.defaultLanguage = String(parameters['Default Language'] || 'en');
//=============================================================================
// ** LanguageManager
//-----------------------------------------------------------------------------
// Static class used for handling Language Text Processing.
//=============================================================================
function LanguageManager() { throw new Error('This is a static class'); };
//=============================================================================
// * Object Initialization
//=============================================================================
LanguageManager.initialize = function() {
// Current Language
this._language = this.defaultLanguage();
// Language Data Object
this._data = {};
// Load All Language Files
this.loadAllLanguageFiles();
};
//=============================================================================
// * Get Default Language
//=============================================================================
LanguageManager.defaultLanguage = function() { return _TDS_.TextLanguageProcessor.params.defaultLanguage; };
//=============================================================================
// * Get System Text
//=============================================================================
LanguageManager.setLanguage = function(language, save) {
// Set Default save State
if (save === undefined) { save = true; };
// Set Language
LanguageManager._language = language;
// If Save Flag
if (save) { ConfigManager.save(); };
};
//=============================================================================
// * Get Language Data
//=============================================================================
LanguageManager.languageData = function(language) {
// Set Default Language
if (language === undefined) { language = this._language; }
// Return Language Data
return this._data[language];
};
//=============================================================================
// * Get System Text
//=============================================================================
LanguageManager.getSystemText = function(type, name, language) {
// Set Default Language
if (language === undefined) { language = this._language; }
// Get Data
var data = this._data[language].text.System;
// If Data Exists
if (data) { return data.terms[type][name]; };
// Return Error
return "- ERROR -";
};
//=============================================================================
// * Get Plugin Text
//=============================================================================
LanguageManager.getPluginText = function(type, name, language = this._language) {
// Get Data
var data = this._data[language].text.System
// If Data Exists
if (data) { return data.plugins[type][name]; };
// Return Error
return " - ERROR -";
};
//=============================================================================
// * Get Input Keys Table
//=============================================================================
LanguageManager.getInputKeysTable = function() {
// Get Data
var data = this.languageData().text.System;
// Return Input Keys Table
return data.inputKeysTable ? data.inputKeysTable : [];
};
//=============================================================================
// * Get Input Keys Table
//=============================================================================
LanguageManager.getInputName = function(type, input, language = this._language) {
// Get Data
var data = this.languageData().text.System;
// If Data Exists
if (data) { return data.InputNames[type][input]; };
// Return Error
return " - ERROR -";
};
//=============================================================================
// * Get Text Data
//=============================================================================
LanguageManager.getTextData = function(file, name, language) {
// Set Default Language
if (language === undefined) { language = this._language; }
// Return Text Data
return this._data[language].text[file][name];
};
//=============================================================================
// * Get Message Data
//=============================================================================
LanguageManager.getMessageData = function(code, language) {
// Set Default Language
if (language === undefined) { language = this._language; }
// Get Commands
var cmd = code.split('.');
// Get Data
var data = this.getTextData(cmd[0], cmd[1], language);
// Return Data
return data;
};
LanguageManager.getDatabaseText = function(code, language) {
// Set Default Language
if (language === undefined) { language = this._language; }
// Get Data
var data = this._data[language].text.Database;
// If Data Exists
if (data) { return data[code]; };
// Return Error
return "- ERROR -";
};
//=============================================================================
// * Load Language Files
//=============================================================================
LanguageManager.loadLanguageFiles = function(language) {
var path = require('path');
var fs = require('fs');
var base = path.dirname(process.mainModule.filename);
// Get Folder
var folder = '/Languages/' + language + '/';
// Get FilePath
var filePath = base + folder;
// Get Directory List
var dirList = fs.readdirSync(filePath);
// Initialize Language Data
this._data[language] = { text: {} };
// Go Through Directory
for (var i = 0; i < dirList.length; i++) {
// Get Directory
var directory = dirList[i];
// Get Format
var format = path.extname(dirList[i]);
// Get Filename
var filename = path.basename(directory, format);
// If Format is yaml
if (format === '.yaml') {
// Get Language File Data
var data = jsyaml.load(fs.readFileSync(filePath + '/' + filename + format, 'utf8'));
// Set Language Text Data
this._data[language].text[filename] = data;
continue;
};
};
};
//=============================================================================
// * Load All Language Files
//=============================================================================
LanguageManager.loadAllLanguageFiles = function() {
var path = require('path');
var fs = require('fs');
var base = path.dirname(process.mainModule.filename);
// Get Folder
var folder = '/Languages/';
// Get FilePath
var filePath = base + folder;
// Get Directory List
var dirList = fs.readdirSync(filePath);
// Go Through Directory
for (var i = 0; i < dirList.length; i++) {
// Get Directory
var directory = dirList[i];
// Get Format
var format = path.extname(dirList[i]);
// Get Filename
var filename = path.basename(directory, format);
// Get Stat
var stat = fs.statSync(filePath + filename)
//If it's a directory
if (stat.isDirectory()) {
// Load Language Files
this.loadLanguageFiles(directory);
};
};
};
// Initialize Language Manager
//LanguageManager.initialize();
//=============================================================================
// ** ConfigManager
//-----------------------------------------------------------------------------
// The static class that manages the configuration data.
//=============================================================================
// Alias Listing
//=============================================================================
_TDS_.TextLanguageProcessor.ConfigManager_makeData = ConfigManager.makeData;
_TDS_.TextLanguageProcessor.ConfigManager_applyData = ConfigManager.applyData;
//=============================================================================
// * Make Data
//=============================================================================
/*ConfigManager.makeData = function() {
// Get Original Config Object
var config = _TDS_.TextLanguageProcessor.ConfigManager_makeData.call(this);
// Set Language
config.language = LanguageManager._language;
// Return config object
return config;
};
//=============================================================================
// * Apply Data
//=============================================================================
ConfigManager.applyData = function(config) {
// Run Original Function
_TDS_.TextLanguageProcessor.ConfigManager_applyData.call(this, config);
// Set Language
this.language = LanguageManager._language = config.language || LanguageManager.defaultLanguage();
};*/
//=============================================================================
// ** TextManager
//-----------------------------------------------------------------------------
// The static class that handles terms and messages.
//=============================================================================
// * Get System Text
//=============================================================================
TextManager.basic = function(basicId) { return LanguageManager.getSystemText('basic', basicId); };
TextManager.param = function(paramId) { return LanguageManager.getSystemText('param', paramId); };
TextManager.command = function(commandId) { return LanguageManager.getSystemText('command', commandId); };
TextManager.message = function(messageId) { return LanguageManager.getSystemText('message', messageId); };
TextManager.database = function(databaseId) { return LanguageManager.getDatabaseText(databaseId); };
//=============================================================================
// * Get Scene Text
//=============================================================================
TextManager.basic = function(basicId) { return LanguageManager.getSystemText('basic', basicId); };
//=============================================================================
// ** Game_Message
//-----------------------------------------------------------------------------
// The game object class for the state of the message window that displays text
// or selections, etc.
//=============================================================================
// * Show Language Message
//=============================================================================
Game_Message.prototype.showLanguageMessage = function(code) {
// Get Message Data
var data = LanguageManager.getMessageData(code);
var faceset = data.faceset || "";
var faceindex = data.faceindex || 0;
var background = data.background || 0;
var positionType = data.position === undefined ? 2 : data.position;
// Get Extra Faces
var extraFaces = data.extraFaces;
// If Data has Extra Faces
if (extraFaces) {
// Go Through Extra Fraces
for (var i = 0; i < extraFaces.length; i++) {
// Get Face Data
var face = extraFaces[i];
// Set Extra Face
this.setExtraFace(i, face.faceset, face.faceindex, this.makeFaceBackgroundColor(face.faceBackgroundColor,face.faceset, face.faceindex));
};
};
// Set Message Properties
this.setFaceImage(faceset, faceindex);
this.setBackground(background);
this.setPositionType(positionType);
this._faceBackgroundColor = this.makeFaceBackgroundColor(data.faceBackgroundColor, faceset, faceindex);
if (Imported && Imported.YEP_MessageCore) {
this.addText(data.text);
} else {
this.add(data.text);
};
};
//=============================================================================
// * Make Face Background Color
//=============================================================================
Game_Message.prototype.makeFaceBackgroundColor = function(color, name, index) {
// If Color Exists
if (color) {
if (color.match(/^rgba/)) { return color; }
if (color.match(/^#/)) { return color; }
};
// If Color Is for FaceName or Color is undefined
if (name && color === 'FaceName' || color === undefined) {
// Switch Case Name
switch (name) {
case '04_HERO_OW':
return '#52b9fc';
break;
};
};
// Return null (Clear Background)
return null;
};
Game_Message.prototype.setLanguageLabels = function(labels) {
if (!this._choiceLabels) this._choiceLabels = [];
this._choiceLabels = labels;
};
//=============================================================================
// ** Game_Interpreter
//-----------------------------------------------------------------------------
// The interpreter for running event commands.
//=============================================================================
// Alias Listing
//=============================================================================
_TDS_.TextLanguageProcessor.Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;
//=============================================================================
// * Plugin Command
//=============================================================================
Game_Interpreter.prototype.pluginCommand = function(command, args) {
// Command Switch Case
switch (command) {
case 'ShowMessage':
// Show Language Message
this.commandShowLanguageMessage(args[0]);
break;
case 'ChangeLanguage':
// Set Language
LanguageManager._language = args[0];
break;
case 'AddChoice':
this.addLanguageChoice(args[0],args[1]);
break;
case 'ShowChoices':
this.commandShowLanguageChoices(args[0]);
break;
};
// Return Original Function
return _TDS_.TextLanguageProcessor.Game_Interpreter_pluginCommand.call(this, command, args);
};
//=============================================================================
// * Show Language Message
//=============================================================================
Game_Interpreter.prototype.commandShowLanguageMessage = function (code) {
if (!$gameMessage.isBusy()) {
// Show Language Message
$gameMessage.showLanguageMessage(code);
// Next Event Code Switch Case
switch (this.nextEventCode()) {
case 102:
// Show Choices
this._index++;
this.setupChoices(this.currentCommand().parameters);
break;
case 103:
// Input Number
this._index++;
this.setupNumInput(this.currentCommand().parameters);
break;
case 104:
// Select Item
this._index++;
this.setupItemChoice(this.currentCommand().parameters);
break;
case 356:
var nextCommand = this._list[this._index + 1];
var parameters = nextCommand.parameters;
var pluginCommand = parameters[0].split(' ')[0];
var cancelType = parameters[0].split(' ')[1];
if (pluginCommand && pluginCommand === "ShowChoices") {
this._index++;
this.setupLanguageChoices(cancelType);
}
break;
};
// this._index++;
this.setWaitMode('message');
}
return false;
};
//=============================================================================
// * Show Choice
//=============================================================================
Game_Interpreter.prototype.addLanguageChoice = function(code,label) {
if (!this._choices) this._choices = [];
if (!this._choiceLabels) this._choiceLabels = [];
var data = LanguageManager.getMessageData(code);
this._choices.push(data.text);
this._choiceLabels.push(label);
};
Game_Interpreter.prototype.commandShowLanguageChoices = function(cancelType) {
if (!$gameMessage.isBusy()) {
this.setupLanguageChoices(parseInt(cancelType));
this._index++;
this.setWaitMode('message');
}
return false;
};
Game_Interpreter.prototype.commandLanguageJumpTo = function(label) {
for (var i = 0; i < this._list.length; i++) {
var command = this._list[i];
if (command.code === 118 && command.parameters[0] === label) {
this.jumpTo(i);
return;
}
}
return true;
};
Game_Interpreter.prototype.setupLanguageChoices = function(cancel) {
var choices = this._choices.clone();
var cancelType = cancel;
var defaultType = 0;
var positionType = 2;
var background = 0;
if (cancelType >= choices.length) {
cancelType = -2;
}
$gameMessage.setChoices(choices, defaultType, cancelType);
$gameMessage.setChoiceBackground(background);
$gameMessage.setChoicePositionType(positionType);
$gameMessage.setLanguageLabels(this._choiceLabels.clone());
$gameMessage.setChoiceCallback(function(n) {
if (n >= 0) {
this.commandLanguageJumpTo($gameMessage._choiceLabels[n]);
} else {
this._branch[this._indent] = n;
}
}.bind(this));
this._choices = [];
this._choiceLabels = [];
};
_TDS_.TextLanguageProcessor.Window_Base_drawTextEx = Window_Base.prototype.drawTextEx;
Window_Base.prototype.drawTextEx = function(text, x, y) {
if (!text) _TDS_.TextLanguageProcessor.Window_Base_drawTextEx.call(this, text, x, y);
var regex = /\{(.*?)\}/;
var result;
while ((result = regex.exec(text)) !== null) {
var dbString = TextManager.database(result[1]);
text = text.replace(result[0], dbString);
}
return _TDS_.TextLanguageProcessor.Window_Base_drawTextEx.call(this, text, x, y);
};
_TDS_.TextLanguageProcessor.Window_Base_drawActorName = Window_Base.prototype.drawActorName;
Window_Base.prototype.drawActorName = function(actor, x, y, width) {
if (!actor || !actor.name()) return _TDS_.TextLanguageProcessor.Window_Base_drawActorName.call(this, actor, x, y, width);
width = width || 168;
this.changeTextColor(this.hpColor(actor));
var regex = /\{(.*?)\}/;
var result;
var text = actor.name();
while ((result = regex.exec(text)) !== null) {
var dbString = TextManager.database(result[1]);
text = text.replace(result[0], dbString);
}
this.drawText(text, x, y, width);
};
_TDS_.TextLanguageProcessor.Window_Base_drawActorClass = Window_Base.prototype.drawActorClass;
Window_Base.prototype.drawActorClass = function(actor, x, y, width) {
if (!actor || !actor.currentClass().name) return _TDS_.TextLanguageProcessor.Window_Base_drawActorClass.call(this, actor,x, y, width);
width = width || 168;
this.resetTextColor();
var regex = /\{(.*?)\}/;
var result;
var text = actor.currentClass().name;
while ((result = regex.exec(text)) !== null) {
var dbString = TextManager.database(result[1]);
text = text.replace(result[0], dbString);
}
this.drawText(text, x, y, width);
};
_TDS_.TextLanguageProcessor.Window_Base_drawActorNickname = Window_Base.prototype.drawActorNickname;
Window_Base.prototype.drawActorNickname = function(actor, x, y, width) {
if (!actor || !actor.nickname()) return _TDS_.Window_Base_drawActorNickname.call(this, actor, x, y, width);
width = width || 270;
this.resetTextColor();
var regex = /\{(.*?)\}/;
var result;
var text = actor.nickname();
while ((result = regex.exec(text)) !== null) {
var dbString = TextManager.database(result[1]);
text = text.replace(result[0], dbString);
}
this.drawText(text, x, y, width);
};
_TDS_.TextLanguageProcessor.Window_Base_drawItemName = Window_Base.prototype.drawItemName;
Window_Base.prototype.drawItemName = function(item, x, y, width) {
if (!item || !item.name) return _TDS_.TextLanguageProcessor.Window_Base_drawItemName.call(this, 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);
var regex = /\{(.*?)\}/;
var result;
var text = item.name;
while ((result = regex.exec(text)) !== null) {
var dbString = TextManager.database(result[1]);
text = text.replace(result[0], dbString);
}
this.drawText(text, x + iconBoxWidth, y, width - iconBoxWidth);
}
};
_TDS_.TextLanguageProcessor.Game_Interpreter_requestImages = Game_Interpreter.prototype.requestImages;
Game_Interpreter.prototype.requestImages = function(list, commonList) {
if(!list) return;
list.forEach(function(command){
var params = command.parameters;
switch(command.code){
case 231:
var image = params[1].replace("_" + LanguageManager.defaultLanguage(), "_" + LanguageManager._language);
ImageManager.requestPicture(image);
break;
}
});
_TDS_.TextLanguageProcessor.Game_Interpreter_requestImages.call(this, list, commonList);
};
_TDS_.TextLanguageProcessor.Game_Interpreter_command231 = Game_Interpreter.prototype.command231;
Game_Interpreter.prototype.command231 = function() {
var x, y;
if (this._params[3] === 0) { // Direct designation
x = this._params[4];
y = this._params[5];
} else { // Designation with variables
x = $gameVariables.value(this._params[4]);
y = $gameVariables.value(this._params[5]);
}
var image = this._params[1].replace("_" + LanguageManager.defaultLanguage(), "_" + LanguageManager._language);
$gameScreen.showPicture(this._params[0], image, this._params[2],
x, y, this._params[6], this._params[7], this._params[8], this._params[9]);
return true;
};

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,246 @@
//-----------------------------------------------------------------------------
// OMORI Minigame - Hardware Organization
//-----------------------------------------------------------------------------
Game_Interpreter.prototype.initializeHardwareOrganizing = function() {
var shelf1 = [];
var shelf2 = [];
var shelf3 = [];
var shelf4 = [];
var shelf5 = [];
var shelf6 = [];
$gameSystem.shelves = [];
$gameSystem.shelves.push(shelf1);
$gameSystem.shelves.push(shelf2);
$gameSystem.shelves.push(shelf3);
$gameSystem.shelves.push(shelf4);
$gameSystem.shelves.push(shelf5);
$gameSystem.shelves.push(shelf6);
$gameSystem.products = [
0, 0, 0, 0, 0, 0, // DRILL
10, 10, 10, 10, 10, 10, // TAPE
3, 3, 3, 3, 3, 3, // SHOVEL
4, 4, 4, 4, 4, 4, // SAW
6, 6, 6, 6, 6, 6, // HAMMER
7, 7, 7, 7, 7, 7 // WRENCH
];
//console.log($gameSystem.shelves[5])
var curElement = $gameSystem.products.length;
var temp;
var randomizedLoc;
while (0 !== curElement) {
randomizedLoc = Math.min(Math.floor(Math.random() * curElement), $gameSystem.products.length - 1);
curElement -= 1;
temp = $gameSystem.products[curElement];
$gameSystem.products[curElement] = $gameSystem.products[randomizedLoc];
$gameSystem.products[randomizedLoc] = temp;
};
for (var i = 0; i < $gameSystem.shelves.length; i++) {
var shelf = $gameSystem.shelves[i];
for (var j = 0; j < 6; j++) {
shelf.push($gameSystem.products[0]);
$gameSystem.products.shift();
}
}
}
Game_Interpreter.prototype.placeTool = function() {
var shelf = $gameVariables.value(812);
for (var i = 0; i < $gameSystem.shelves[shelf].length; i++) {
if ($gameSystem.shelves[shelf][i] === -1) { // First empty space
// console.log($gameSystem.shelves[shelf][i]);
//
if ($gameVariables.value(815) === LanguageManager.getMessageData("farawaytown_extras_hardwareminigame.message_3").text) $gameSystem.shelves[shelf][i] = 0;
else if ($gameVariables.value(815) === LanguageManager.getMessageData("farawaytown_extras_hardwareminigame.message_4").text) $gameSystem.shelves[shelf][i] = 10;
else if ($gameVariables.value(815) === LanguageManager.getMessageData("farawaytown_extras_hardwareminigame.message_5").text) $gameSystem.shelves[shelf][i] = 3;
else if ($gameVariables.value(815) === LanguageManager.getMessageData("farawaytown_extras_hardwareminigame.message_6").text) $gameSystem.shelves[shelf][i] = 4;
else if ($gameVariables.value(815) === LanguageManager.getMessageData("farawaytown_extras_hardwareminigame.message_7").text) $gameSystem.shelves[shelf][i] = 6;
else if ($gameVariables.value(815) === LanguageManager.getMessageData("farawaytown_extras_hardwareminigame.message_8").text) $gameSystem.shelves[shelf][i] = 7;
break;
}
}
this.checkHardwareOrganization();
/*
console.log("Current Shelf: " + $gameVariables.value(812),
"Index: " + $gameVariables.value(814),
"Selected Item: " + $gameVariables.value(815),
"Currently Held Item: " + $gameVariables.value(813));*/
}
Game_Interpreter.prototype.replaceTool = function() {
var shelf = $gameVariables.value(812);
//
if ($gameVariables.value(813) === LanguageManager.getMessageData("farawaytown_extras_hardwareminigame.message_3").text) $gameSystem.shelves[shelf][$gameVariables.value(814)] = 0;
else if ($gameVariables.value(813) === LanguageManager.getMessageData("farawaytown_extras_hardwareminigame.message_4").text) $gameSystem.shelves[shelf][$gameVariables.value(814)] = 10;
else if ($gameVariables.value(813) === LanguageManager.getMessageData("farawaytown_extras_hardwareminigame.message_5").text) $gameSystem.shelves[shelf][$gameVariables.value(814)] = 3;
else if ($gameVariables.value(813) === LanguageManager.getMessageData("farawaytown_extras_hardwareminigame.message_6").text) $gameSystem.shelves[shelf][$gameVariables.value(814)] = 4;
else if ($gameVariables.value(813) === LanguageManager.getMessageData("farawaytown_extras_hardwareminigame.message_7").text) $gameSystem.shelves[shelf][$gameVariables.value(814)] = 6;
else if ($gameVariables.value(813) === LanguageManager.getMessageData("farawaytown_extras_hardwareminigame.message_8").text) $gameSystem.shelves[shelf][$gameVariables.value(814)] = 7;
this.checkHardwareOrganization();
/*console.log("REPLACING " + "Current Shelf: " + $gameVariables.value(812),
"Index: " + $gameVariables.value(814),
"Selected Item: " + $gameVariables.value(815),
"Currently Held Item: " + $gameVariables.value(813));*/
}
Game_Interpreter.prototype.returnTool = function() {
for (var shelf = 0; shelf < $gameSystem.shelves.length; shelf++) {
console.log(shelf);
for (var i = 0; i < $gameSystem.shelves[shelf].length; i++) {
if ($gameSystem.shelves[shelf][i] === -1) { // First empty space
// console.log($gameSystem.shelves[shelf][i]);
//
if ($gameVariables.value(815) === LanguageManager.getMessageData("farawaytown_extras_hardwareminigame.message_3").text) $gameSystem.shelves[shelf][i] = 0;
else if ($gameVariables.value(815) === LanguageManager.getMessageData("farawaytown_extras_hardwareminigame.message_4").text) $gameSystem.shelves[shelf][i] = 10;
else if ($gameVariables.value(815) === LanguageManager.getMessageData("farawaytown_extras_hardwareminigame.message_5").text) $gameSystem.shelves[shelf][i] = 3;
else if ($gameVariables.value(815) === LanguageManager.getMessageData("farawaytown_extras_hardwareminigame.message_6").text) $gameSystem.shelves[shelf][i] = 4;
else if ($gameVariables.value(815) === LanguageManager.getMessageData("farawaytown_extras_hardwareminigame.message_7").text) $gameSystem.shelves[shelf][i] = 6;
else if ($gameVariables.value(815) === LanguageManager.getMessageData("farawaytown_extras_hardwareminigame.message_8").text) $gameSystem.shelves[shelf][i] = 7;
break;
}
}
}
$gameVariables.setValue(813, -1);
$gameVariables.setValue(814, -1);
$gameVariables.setValue(815, 0);
}
var yin_GameInterpreter_setupChoicesShop = Game_Interpreter.prototype.setupChoices;
Game_Interpreter.prototype.setupChoices = function (params) {
if ($gameSwitches.value(804)) {
if (params[0][0] === "Hardware Shelf") {
var shelfNum = $gameVariables.value(812);
var shelfProducts = [];
for (var i = 0; i < $gameSystem.shelves[shelfNum].length; i++) {
if ($gameSystem.shelves[shelfNum][i] === -1) continue;
else if ($gameSystem.shelves[shelfNum][i] === 0) shelfProducts.push(LanguageManager.getMessageData("farawaytown_extras_hardwareminigame.message_3").text);
else if ($gameSystem.shelves[shelfNum][i] === 10) shelfProducts.push(LanguageManager.getMessageData("farawaytown_extras_hardwareminigame.message_4").text);
else if ($gameSystem.shelves[shelfNum][i] === 3) shelfProducts.push(LanguageManager.getMessageData("farawaytown_extras_hardwareminigame.message_5").text);
else if ($gameSystem.shelves[shelfNum][i] === 4) shelfProducts.push(LanguageManager.getMessageData("farawaytown_extras_hardwareminigame.message_6").text);
else if ($gameSystem.shelves[shelfNum][i] === 6) shelfProducts.push(LanguageManager.getMessageData("farawaytown_extras_hardwareminigame.message_7").text);
else if ($gameSystem.shelves[shelfNum][i] === 7) shelfProducts.push(LanguageManager.getMessageData("farawaytown_extras_hardwareminigame.message_8").text);
}
// for (var i = 0; i < $gameSystem.shelves[shelfNum].length; i++) {
// console.log("Shelf " + shelfNum + " Contents: " + this.getToolName($gameSystem.shelves[shelfNum][i]));
// }
// console.log("Shelf " + shelfNum + " Options List: " + shelfProducts);
shelfProducts.push(LanguageManager.getMessageData("farawaytown_extras_pizzaminigame.message_17").text);
}
var choices = shelfProducts ? shelfProducts : params[0].clone();
var cancelType = params[1];
var defaultType = params.length > 2 ? params[2] : 0;
var positionType = params.length > 3 ? params[3] : 2;
var background = params.length > 4 ? params[4] : 0;
// console.log(choices);
$gameMessage.setChoices(choices, defaultType, cancelType);
$gameMessage.setChoiceBackground(background);
$gameMessage.setChoicePositionType(positionType);
$gameMessage.setChoiceCallback(function (n) {
this._branch[this._indent] = n;
}.bind(this));
} else yin_GameInterpreter_setupChoicesShop.call(this, params);
};
Game_Interpreter.prototype.getToolName = function(id) {
// console.log(id);
if (id === -1) return "Nothing";
else if (id === 0) return LanguageManager.getMessageData("farawaytown_extras_hardwareminigame.message_3").text;
else if (id === 1) return LanguageManager.getMessageData("farawaytown_extras_hardwareminigame.message_4").text;
else if (id === 3) return LanguageManager.getMessageData("farawaytown_extras_hardwareminigame.message_5").text;
else if (id === 4) return LanguageManager.getMessageData("farawaytown_extras_hardwareminigame.message_6").text;
else if (id === 6) return LanguageManager.getMessageData("farawaytown_extras_hardwareminigame.message_7").text;
else if (id === 7) return LanguageManager.getMessageData("farawaytown_extras_hardwareminigame.message_8").text;
}
Game_Interpreter.prototype.checkHardwareOrganization = function() {
for (var i = 0; i < $gameSystem.shelves.length; i++) {
var shelf = $gameSystem.shelves[i];
if (i === 0) var rightfulProduct = 0;
if (i === 1) var rightfulProduct = 4;
if (i === 2) var rightfulProduct = 10;
if (i === 3) var rightfulProduct = 6;
if (i === 4) var rightfulProduct = 3;
if (i === 5) var rightfulProduct = 7;
for (var j = 0; j < shelf.length; j++) {
if (shelf[j] === rightfulProduct) {
// console.log("Shelf " + i + ", Item " + j + ": TRUE");
var result = true;
} else {
// console.log("Shelf " + i + ", Item " + j + ": FALSE");
var result = false;
j = shelf.length;
}
}
if (!result) {
break;
}
// console.log("Shelf " + i + result);
}
// console.log("Everything organized? " + result);
return result;
};
//=============================================================================
// New Game_Character function for tools display
//=============================================================================
Game_Character.prototype.getToolGraphic = function (shelfItem) {
if (shelfItem === 0) {
var x = 0;
var y = 0;
} else if (shelfItem === 10) {
var x = 1;
var y = 3;
} else if (shelfItem === 3) {
var x = 0;
var y = 1;
} else if (shelfItem === 4) {
var x = 1;
var y = 1;
} else if (shelfItem === 6) {
var x = 0;
var y = 2;
} else if (shelfItem === 7) {
var x = 1;
var y = 2;
}
return this.setCustomFrameXY(x, y);
}
//=============================================================================
// Changes specific to the hardware shop minigame
//=============================================================================
var yin_WindowChoiceList_callOkHandlerShop = Window_ChoiceList.prototype.callOkHandler;
Window_ChoiceList.prototype.callOkHandler = function () {
const loc_yes = LanguageManager.getMessageData("XX_GENERAL.message_4").text
const loc_no = LanguageManager.getMessageData("XX_GENERAL.message_5").text
const nevermind = LanguageManager.getMessageData("farawaytown_extras_pizzaminigame.message_17").text
if ($gameSwitches.value(804) && this._list[this.index()].name !== loc_yes && this._list[this.index()].name !== loc_no) {
if (this._list[this.index()].name === nevermind) {
$gameMap._interpreter.command115();
} else {
$gameVariables.setValue(814, this.index());
$gameVariables.setValue(815, this._list[this.index()].name);
}
}
yin_WindowChoiceList_callOkHandlerShop.call(this);
};
var yin_WindowChoiceList_numVisibleRowsHardware = Window_ChoiceList.prototype.numVisibleRows;
Window_ChoiceList.prototype.numVisibleRows = function () {
if ($gameSwitches.value(804)) {
var choices = $gameMessage.choices();
var numLines = choices.length > 7 ? 7 : choices.length;
return numLines;
}
return yin_WindowChoiceList_numVisibleRowsHardware.call(this);
};

View file

@ -0,0 +1,230 @@
//-----------------------------------------------------------------------------
// OMORI Minigame - Pizza Delivery
//-----------------------------------------------------------------------------
Game_Interpreter.prototype.initPizzaDelivery = function () {
ImageManager.loadPicture("PIZZA-Background");
ImageManager.loadAtlas("MN_PizzaItems");
$gameSystem._chosenHouses = [];
$gameSystem._checkedHouses = [];
var _pizzaHouse1 = this.generateHouse(1);
var _pizzaHouse2 = this.generateHouse(2);
var _pizzaHouse3 = this.generateHouse(3);
this._pizzaHouse1 = _pizzaHouse1;
this._pizzaHouse2 = _pizzaHouse2;
this._pizzaHouse3 = _pizzaHouse3;
// this.checkImages();
}
Game_Interpreter.prototype.checkImages = function () {
var houseText = this.houseHints();
for (var i = 1; i < 37; i++) {
// console.log(houseText[i]);
for (var j = 0; j < houseText[i].length; j++) {
// console.log(houseText[i][j]);
text = houseText[i][j];
text = text.split(" ");
for (var word = 0; word < text.length; word++) {
ImageManager.loadPicture('PIZZA-' + text[word]);
}
}
}
}
Game_Interpreter.prototype.houseHints = function () {
return LanguageManager.getMessageData("XX_BLUE.Yin_Pizza_Delivery").houseHints
}
Game_Interpreter.prototype.generateHouse = function (neighborhood) {
var neighborhoodHouses = {
1: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],
2: [13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24],
3: [25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36]
}
var houseHintsPt1 = this.houseHints();
var chosenHouse = $gameSystem.randomizeArray(neighborhoodHouses[neighborhood])[0];
while (!chosenHouse || $gameSystem._chosenHouses.contains(chosenHouse)) {
chosenHouse = $gameSystem.randomizeArray(neighborhoodHouses[neighborhood])[0];
}
// console.log(chosenHouse);
$gameSystem._chosenHouses.push(chosenHouse);
var wordPool = houseHintsPt1[chosenHouse];
$gameSystem.randomizeArray(wordPool);
var description1 = wordPool[0];
wordPool.splice(0, 1);
$gameSystem.randomizeArray(wordPool);
var description2 = wordPool[0];
wordPool.splice(0, 1);
$gameSystem.pizza = [description1, description2];
var partPool = LanguageManager.getMessageData("XX_BLUE.Yin_Pizza_Delivery").partPool.slice()
$gameSystem.randomizeArray(partPool);
var part = partPool[0];
//let desLink = LanguageManager.getMessageData("XX_BLUE.Yin_Pizza_Delivery").descriptionLink
var text = part.replace('{1}', $gameSystem.pizza[0]).replace('{2}', $gameSystem.pizza[1]);
// let theNo = LanguageManager.getMessageData("XX_BLUE.Yin_Pizza_Delivery").theNo
// if (text.contains(theNo[0])) {
// text = text.replace(theNo[0], theNo[1]);
// }
return text;
}
Game_Interpreter.prototype.showPizzaNote = function (text) {
AudioManager.playSe({name: 'GEN_mess_paper', volume: 100, pitch: 100})
if (text === 0) text = this._pizzaHouse1;
if (text === 1) text = this._pizzaHouse2;
if (text === 2) text = this._pizzaHouse3;
var note = SceneManager._scene._pizzaNote = new Window_PizzaDeliveryNote(text);
SceneManager._scene.addChild(note);
}
Game_Interpreter.prototype.correctHouse = function (houseID) {
if (houseID === $gameSystem._chosenHouses[$gameVariables.value(817)]) return true;
return false;
}
Game_Interpreter.prototype.checkedHouseAlready = function () {
if (!$gameSystem._checkedHouses.contains($gameVariables.value(822))) {
$gameSystem._checkedHouses.push($gameVariables.value(822));
return false;
}
return true;
}
Game_Interpreter.prototype.checkingCurrentHouse = function (houseID) {
$gameVariables.setValue(822, houseID);
}
//=============================================================================
//
//=============================================================================
Game_System.prototype.randomizeArray = function (array) {
if (!array) return;
var curElement = array.length;
var temp;
var randomizedLoc;
while (0 !== curElement) {
randomizedLoc = Math.floor(Math.random() * curElement);
curElement -= 1;
temp = array[curElement];
array[curElement] = array[randomizedLoc];
array[randomizedLoc] = temp;
};
return array;
}
//=============================================================================
//
//=============================================================================
function Window_PizzaDeliveryNote() {
this.initialize.apply(this, arguments);
}
Window_PizzaDeliveryNote.prototype = Object.create(Window_Base.prototype);
Window_PizzaDeliveryNote.prototype.constructor = Window_PizzaDeliveryNote;
Window_PizzaDeliveryNote.prototype.initialize = function (text) {
var x = (Graphics.boxWidth - this.windowWidth()) / 2;
var y = (Graphics.boxHeight - this.windowHeight()) / 3;
Window_Base.prototype.initialize.call(this, x, y, this.windowWidth(), this.windowHeight());
this.opacity = 0;
this.refresh(text);
};
Window_PizzaDeliveryNote.prototype.standardPadding = function () {
return 0;
}
Window_PizzaDeliveryNote.prototype.refresh = function (text) {
function rand(seed) {
var x = Math.sin(seed++) * 10000;
return x - Math.floor(x);
}
function randint(min, max, seed) {
min = Math.ceil(min);
max = Math.floor(max);
return Math.floor(rand(seed) * (max - min + 1)) + min;
}
this.contents.clear();
this.visible = true;
var bitmap = ImageManager.loadPicture('PIZZA-Background');
this.contents.blt(bitmap, 0, 0, bitmap.width, bitmap.height, 0, 0);
// console.log(text);
var nextX = 36;
var nextY = 20;
for (var i = 0; i < text.length; i++) {
var bitmap = ImageManager.loadPicture('PIZZA-' + text.charCodeAt(i));
if (nextX + bitmap.width > 648) {
nextX = 36 + randint(-30, -25, text.charCodeAt(i));
nextY += 56 + randint(0, 10, text.charCodeAt(i));
}
this.contents.blt(bitmap, 0, 0, bitmap.width, bitmap.height, nextX, nextY + randint(-10, 10, text.charCodeAt(i)));
nextX = nextX + bitmap.width + randint(-30, -25, text.charCodeAt(i)) + randint(0, 5, text.charCodeAt(i));
}
}
Window_PizzaDeliveryNote.prototype.update = function () {
Window_Base.prototype.update.call(this);
if (Input.isTriggered("ok")) {
this.closeNote();
}
}
Window_PizzaDeliveryNote.prototype.windowWidth = function () {
return Graphics.boxWidth - 20;
};
Window_PizzaDeliveryNote.prototype.windowHeight = function () {
return Graphics.boxHeight - 40;
};
Window_PizzaDeliveryNote.prototype.closeNote = function () {
this.close();
this.visible = false;
SceneManager._scene.removeChild(SceneManager._scene._pizzaNote);
}
var yin_updateCallMenu = Scene_Map.prototype.updateCallMenu;
Scene_Map.prototype.updateCallMenu = function () {
if ($gamePlayer.canMove() && this.isMenuCalled() && $gameSwitches.value(818)) {
if ((SceneManager._scene._pizzaNote && !SceneManager._scene._pizzaNote.visible)) {
SceneManager._scene._pizzaNote.closeNote();
$gameMap._interpreter.showPizzaNote($gameVariables.value(817));
return;
} else if (!SceneManager._scene._pizzaNote) {
$gameMap._interpreter.showPizzaNote($gameVariables.value(817));
}
} else {
yin_updateCallMenu.apply(this);
}
}
var yin_Pizza_moveByInput = Game_Player.prototype.moveByInput;
Game_Player.prototype.moveByInput = function () {
if (SceneManager._scene._pizzaNote && SceneManager._scene._pizzaNote.visible) return;
yin_Pizza_moveByInput.call(this);
};
Game_Character.prototype.getRandomNPCGraphic = function () {
this._opacity = 0;
this._characterName = $gameSystem.randomizeArray(["FA_PizzaPeople_01", "FA_PizzaPeople_02"])[0];
this._characterIndex = $gameSystem.randomizeArray([0, 1, 2, 3, 4, 5, 6, 7])[0];
var frame = 1;
this._direction = 2;
this._pattern = this._originalPattern = frame % 3;
this._priorityType = 2;
}

View file

@ -0,0 +1,500 @@
//-----------------------------------------------------------------------------
// OMORI Fixes
//-----------------------------------------------------------------------------
//=============================================================================
// Longer fade after loading the game
//=============================================================================
Scene_Map.prototype.start = function() {
Scene_Base.prototype.start.call(this);
SceneManager.clearStack();
if (SceneManager.isPreviousScene(Scene_OmoriFile)) {
this.startFadeIn(this.fadeSpeed(), false);
} else if (this._transfer) {
this.fadeInForTransfer();
this._mapNameWindow.open();
$gameMap.autoplay();
} else if (this.needsFadeIn()) {
this.startFadeIn(this.fadeSpeed(), false);
}
this.menuCalling = false;
};
//-----------------------------------------------------------------------------
// Parallax Before Tiles on Load Fix (Overwritten)
//-----------------------------------------------------------------------------
Scene_Map.prototype.update = function() {
this.updateDestination();
this.updateMainMultiply();
if (this.isSceneChangeOk()) {
this.updateScene();
} else if (SceneManager.isNextScene(Scene_Battle)) {
this.updateEncounterEffect();
}
this.updateWaitCount();
Scene_Base.prototype.update.call(this);
if (!Yanfly._openedConsole) Yanfly.openConsole();
this.updateCharacterTagInput();
};
//-----------------------------------------------------------------------------
// Emotion Elements Not Being Applied To Attacks Fix (Some Overwrites)
//-----------------------------------------------------------------------------
Game_Action.prototype.calcElementRate = function(target) {
/*if (this.item().damage.elementId < 0) {
return this.elementsMaxRate(target, this.subject().attackElements());
} else {*/
// YIN Instead of bypassing the subject's attack element, we want to use it if they are inflicted with an emotion.
// If elementId == None or Normal Attack
if (this.item().damage.elementId < 1) {
// These are all base emotion states (non afraid)
var emotionStates = [6, 7, 8, 10, 11, 12, 14, 15, 16];
emotionStates = [...emotionStates, 119,120,121]; // Space Ex Boyfriend
emotionStates = [...emotionStates, 122,123,197]; // Sweetheart
emotionStates = [...emotionStates, 124,125,126]; // Unbread Twins
// Search states for emotion states
var emotionAfflicted;
this.subject()._states.forEach(function(stateId) {
// Do we have an emotion state on us?
if (emotionStates.contains(stateId)) {
emotionAfflicted = true;
}
}, this);
if (emotionAfflicted) {
return target.elementRate(this.subject().attackElements()[0]); // If so, that is our attack element
} else {
return target.elementRate(this.item().damage.elementId);
}
} else {
return target.elementRate(this.item().damage.elementId);
}
//}
};
//-----------------------------------------------------------------------------
// This allows an "effective/not effective" sound
//-----------------------------------------------------------------------------
Game_Action.prototype.apply = function(target) {
// Run Original Function
_TDS_.OmoriBattleSystem.Game_Action_apply.call(this, target);
// Get Result
let result = target.result();
// Check iff hit
let hit = result.isHit();
// If Hit
if (hit) {
// Get Element Rate
let elementRate = this.calcElementRate(target);
// Set elemental results
result.elementStrong = elementRate > 1;
result.elementWeak = elementRate < 1;
if (result.hpDamage > 0) {
if(!!result.critical) {
AudioManager.playSe({ name: "BA_CRITICAL_HIT", volume: 250, pitch: 100, pan: 0});
}
else if (result.elementStrong) {
AudioManager.playSe({ name: "se_impact_double", volume: 150, pitch: 100, pan: 0});
} else if (result.elementWeak){
AudioManager.playSe({ name: "se_impact_soft", volume: 150, pitch: 100, pan: 0});
} else {
SoundManager.playEnemyDamage();
}
}
};
// If Target is an enemy
if (target.isEnemy()) {
// Get Item
let item = this.item();
// If result was a hit
if (hit) {
// If scanning enemy
if (item && item.meta.ScanEnemy && target.canScan()) {
// Scan Enemy
$gameParty.addScannedEnemy(target.enemyId());
};
};
} else {
// If result was a hit
if (hit) {
// If HP damage is more than 0
if (result.hpDamage > 0) {
// Increase Stress Count
$gameParty.stressEnergyCount++;
};
};
};
}
Yanfly.SVE.Game_Enemy_performDamage = Game_Enemy.prototype.performDamage;
Game_Enemy.prototype.performDamage = function() {
if (!this.hasSVBattler()) {
return Yanfly.SVE.Game_Enemy_performDamage.call(this);
}
Game_Battler.prototype.performDamage.call(this);
if (this.isSpriteVisible()) {
this.requestMotion(this.damageMotion());
} else {
$gameScreen.startShake(5, 5, 10);
}
};
Game_Actor.prototype.performDamage = function() {
Game_Battler.prototype.performDamage.call(this);
if (this.isSpriteVisible()) {
this.requestMotion('damage');
} else {
$gameScreen.startShake(5, 5, 10);
}
};
//-----------------------------------------------------------------------------
// Bad Word Filter
//-----------------------------------------------------------------------------
var yinBadWords_init = Game_System.prototype.initialize;
Game_System.prototype.initialize = function() {
yinBadWords_init.call(this);
this._badWords = [ // Bad words should be all lowercase!
// Bad Words
"aids","anal","anus","areola","arse","ass","balls","bastard ","beaner","berk","biatch","bint","bitch",
"blow","bogan","boner","boob","boom","breast","butt","cancer","chav","chink","clit","cocaine","cock",
"coitus","commie","condom","coolie","coon","coomer","cracker","crap","crotch","cum","cunt","damn","ferro",
"dago","dick","dildo","dilf","dong","drug","dumb","dyke","enema","erect","eskimo","fag","feck","fuck",
"gay","gipsy","gfy","gook","gringo","gyp","hardon","heroin","herpes","hiv","hoe","hole","homo","honk",
"hooker","horny","hymen","idiot","incest","injun","jap","jerkoff","jew","jigger ","jiz ","jizz","jock",
"juggalo","kaffir","kafir","kigger","killer","kink","kkk","kock","koon","kotex","krap","kum","kunt",
"lesbian","lesbo","loli","lsd","lube","lynch","mammy","meth","mick","milf","molest","mom","mong","moron",
"muff","mulatto","muncher","munt","murder","muslim","nazi","negress ","negro","n1g","nlg","nig","nip",
"nlgger","noonan","nooner","nuke","nut","oral","orga","orgies","orgy","oriental","paddy","pakeha","paki",
"pansies","pansy","peni5","pen15","penis","perv","phuc","phuk","phuq","pi55","pimp","piss","playboy","pocha",
"pocho","pohm","polack","poon","poop","porn","pu55i","pu55y","pube","puss","pygmy","quashie","queef","queer",
"quim","racist","raghead","randy","rape","rapist","rectum","redneck","redskin","reefer","reestie","reject",
"retard","rigger","rimjob","root","rump","russki","savage","scag","scat","schizo","schlong","screw","scrotum",
"scrub","semen","sex","shag","shat","shit","skank","skum","slag","slant","slave","slut","smut","snatch","snot",
"sodom","spade","spaz","sperm","spooge","spunk","squaw","strip","stupid","suicide","syphilis","tampon","tard",
"teat","terrorist","teste","testicle","thot","tit","toilet","tramp","trannie","tranny","trojan","turd","twat","twink",
"urine","uterus","vagina","vaginal","vibrate","virgin","vomit","vulva","wank","weenie","weewee","wetback",
"whigger","whiskey","whitey","whore","wigger","willie","willy","wog","wop","wtf","wuss","xtc","xxx","yank",
"yid","zigabo",
// Names
"aubrey","basil","bundy","gacy","hector","hero","hitler","jawsum","jinping","kel","kimjong","little","mari",
"oj","osama","pluto","polly","putin","ripper","rococo","stalin","trump","zodiac",
// Foreign Language Bad Words
"puto","puta","cuck","mierda","pendejo","Nigga","Nibba","trap","perra","faggot","dilldoe","blacky","pniss",
"biden","omori","オーブリー","バジル","ヘクトール","ヒロ","ケル","マリ","プルート","ポリー","オモリ",
];
}
Window_OmoriInputLetters.prototype.onNameOk = function() {
// Get Text
var text = this._nameWindow.name();
// If Text Length is more than 0
if (text.length > 0) {
if(text.toLowerCase() === "omocat") {
$gameSystem.unlockAchievement("YOU_THINK_YOU_RE_CLEVER_HUH")
}
if (new RegExp($gameSystem._badWords.join("|")).test(text.toLowerCase())) { // YIN - Bad words check
this.playBuzzerSound();
return;
}
this.deactivate();
this.close();
this._nameWindow.close();
if (_TDS_.NameInput.params.nameVariableID > 0) {
$gameVariables.setValue(_TDS_.NameInput.params.nameVariableID, text);
};
} else {
this.playBuzzerSound();
};
};
//-----------------------------------------------------------------------------
// Title Screen Switch Check
//-----------------------------------------------------------------------------
DataManager.writeToFile = function(text, filename) {
var fs = require('fs');
var dirPath = StorageManager.localFileDirectoryPath();
if (!fs.existsSync(dirPath)) {
fs.mkdirSync(dirPath);
}
// console.log("Writing File: " + filename + " Text: " + text);
fs.writeFileSync(dirPath + '/' + filename, text);
}
DataManager.writeToFileAsync = function(text, filename, callback) {
var fs = require('fs');
var dirPath = StorageManager.localFileDirectoryPath();
if (!fs.existsSync(dirPath)) {
fs.mkdirSync(dirPath);
}
// console.log("Writing File: " + filename + " Text: " + text);
//fs.writeFileSync(dirPath + '/' + filename, text);
fs.writeFile(dirPath + '/' + filename, text, (err) => {
if(!!callback) {callback()}
})
}
DataManager.readFromFile = function(filename) {
var fs = require('fs');
var dirPath = StorageManager.localFileDirectoryPath();
if (!fs.existsSync(dirPath + '/' + filename)) {
return 0;
}
// console.log("Reading File: " + fs.readFileSync(dirPath + '/' + filename));
return fs.readFileSync(dirPath + '/' + filename, "utf-8");
}
Scene_OmoriFile.prototype.createWaitingWindow = function() {
let ww = Math.floor(Graphics.boxWidth/3);
let wh = Window_Base.prototype.lineHeight.call(this) + 16;
this._waitingWindow = new Window_Base(Math.ceil(Graphics.boxWidth / 2 - ww/2), Math.ceil(Graphics.boxHeight / 2 - wh/2));
this._waitingWindow.hide();
this.addChild(this._waitingWindow);
const MAX_TIME = 3;
this._waitingWindow.saveString = TextManager.message("saveWait");
this._waitingWindow.wait = MAX_TIME;
this._waitingWindow.refresh = function() {
if(this.wait > 0) {return this.wait--;}
this.saveString += ".";
this.contents.clear();
this.drawText(this.saveString,0,0,this.contents.width,"center");
this.wait = MAX_TIME;
if(this.saveString.contains("...")) {this.saveString.replace("...", "")}
}
this._waitingWindow.clear = function() {
this.saveString = TextManager.message("saveWait");
this.wait = MAX_TIME;
this.hide();
}
this._waitingWindow.update = function() {
Window_Base.prototype.update.call(this);
if(!this.visible) {return;}
this.refresh();
}
}
const _old_scene_OmoriFile_create = Scene_OmoriFile.prototype.create;
Scene_OmoriFile.prototype.create = function() {
_old_scene_OmoriFile_create.call(this);
this.createWaitingWindow(); // Create New Waiting Window
}
Scene_OmoriFile.prototype.backupSaveFile = function(callback) {
/*const fs = require("fs");
const ncp = require("ncp");
const pp = require("path")
const savePath = StorageManager.localFileDirectoryPath();
const destination_folder = pp.join(Permanent_Manager.dataFolder(), Permanent_Manager.determineOmoriFolder()); // Taking this from my Permanent Manager system;
ncp(savePath, destination_folder + "save", () => {
if(!!callback) {callback()}
})*/
callback();
}
Scene_OmoriFile.prototype.saveGame = function() {
// On Before Save
$gameSystem.onBeforeSave();
// Get Save File ID
var saveFileid = this.savefileId();
// Get File Window
var fileWindow = this._fileWindows[this._saveIndex];
// Save Game
this._promptWindow.deactivate();
this._promptWindow.close();
this._waitingWindow.show(); // Show Waiting Window;
if (DataManager.saveGame(saveFileid)) {
SoundManager.playSave();
StorageManager.cleanBackup(saveFileid);
var world;
if($gameSwitches.value(448) && $gameSwitches.value(447)) {
world = 449 // Special Flag When both the switches are on;
}
else if ($gameSwitches.value(448)) {
world = 448;
} else if ($gameSwitches.value(447)) {
world = 447;
} else if ($gameSwitches.value(446)) {
world = 446;
} else if ($gameSwitches.value(445)) {
world = 445;
} else if ($gameSwitches.value(444)) {
world = 444;
} else {
world = 0
}
DataManager.writeToFileAsync(world, "TITLEDATA", () => {
this.backupSaveFile(() => {
fileWindow.refresh();
// Deactivate Prompt Window
this._waitingWindow.clear();
// Set Can select Flag to false
this._canSelect = true;
// Update Save Index Cursor
this.updateSaveIndexCursor();
})
});
// console.log(world);
} else {
SoundManager.playBuzzer();
// Deactivate Prompt Window
this._promptWindow.deactivate();
this._promptWindow.close();
// Set Can select Flag to false
this._canSelect = true;
// Update Save Index Cursor
this.updateSaveIndexCursor();
};
};
//---------------------------------------------------------------------------
// Retry Audio Fix
//---------------------------------------------------------------------------
Scene_Gameover.prototype.updateRetryInput = function() {
// Get Input Data
const input = this._inputData;
// If Input is Active
if (input.active) {
// If Ok input is triggered
if (Input.isTriggered('ok')) {
input.active = false;
// Play Load sound
SoundManager.playLoad();
// Get Animation Object
const anim = this._animData;
if (input.index === 0) {
if (anim.phase == 3) {
anim.phase = 4;
};
} else {
anim.phase = 8;
this.fadeOutAll()
anim.delay = 70;
}
return;
};
if (Input.isRepeated('left')) {
SoundManager.playCursor();
input.index = Math.abs((input.index - 1) % input.max);
this.updateRetryInputCursorPosition(input.index);
return
};
if (Input.isRepeated('right')) {
SoundManager.playCursor();
input.index = (input.index + 1) % input.max;
this.updateRetryInputCursorPosition(input.index);
return
};
};
};
//---------------------------------------------------------------------------
// More Retry Fixes
//---------------------------------------------------------------------------
var yin_gameover_createRetryWindows = Scene_Gameover.prototype.createRetryWindows;
Scene_Gameover.prototype.createRetryWindows = function() {
this._retryQuestion = new Window_Base(0, 0, 0, 0);
this._retryQuestion.standardPadding = function() { return 4; };
this._retryQuestion.initialize(0, 0, Graphics.boxWidth, 32);
this._retryQuestion.contents.fontSize = 26;
this._retryQuestion.x = 0;
this._retryQuestion.y = 380 - 48;
this._retryQuestion.drawOpacity = 0;
this._retryQuestion.opacity = 0;
this._retryQuestion.textToDraw = this._isFinalBattle && this._finalBattlePhase >= 5 ? LanguageManager.getMessageData("XX_BLUE.Yin_Omori_Fixes").continue : LanguageManager.getMessageData("XX_BLUE.Yin_Omori_Fixes").retry;
this._retryQuestion.textDrawn = "";
this._retryQuestion.textIndex = -1;
this._retryQuestion.isTextComplete = function() {
return this.textDrawn === this.textToDraw;
}
this._retryQuestion.textDelay = 100;
// Making the text already visible;
this._retryQuestion.drawOpacity = 255;
this._retryQuestion.update = function(animPhase) {
if (animPhase == 2 || animPhase == 3) {
if(!!this.isTextComplete()) {return;}
if(this.textDelay > 0) {return this.textDelay--;}
if (!this.isTextComplete()) {
this.contents.clear();
this.textIndex = Math.min(this.textIndex + 1, this.textToDraw.length);
this.textDrawn += this.textToDraw[this.textIndex];
this.contents.paintOpacity = this.drawOpacity;
this.contents.drawText(this.textDrawn, 0, 0, this.contents.width, this.contents.height, 'center');
SoundManager.playMessageSound();
this.textDelay = 4;
}
} else if (animPhase == 4) {
this.contents.clear();
this.drawOpacity -= 4;
this.contents.paintOpacity = this.drawOpacity;
this.contents.drawText(this.textDrawn, 0, 0, this.contents.width, this.contents.height, 'center');
}
};
this.addChild(this._retryQuestion);
yin_gameover_createRetryWindows.call(this);
};
var yin_gameover_updatetransitionAnimation = Scene_Gameover.prototype.updateTransitionAnimation;
Scene_Gameover.prototype.updateTransitionAnimation = function() {
yin_gameover_updatetransitionAnimation.call(this);
let anim = this._animData;
switch (anim.phase) {
case 2:
case 3:
this._retryQuestion.update(anim.phase);
break;
case 4:
this._retryQuestion.update(anim.phase);
break;
}
}
//=============================================================================
// Black Letter Crash Title Screen Load
//=============================================================================
var yin_titlecrashload_initialize = Scene_Boot.prototype.start;
Scene_Boot.prototype.start = function(index) {
yin_titlecrashload_initialize.call(this);
if (StorageManager.exists(44)) {
// LOAD SAVE 44
if (DataManager.loadGame(44)) {
// AudioManager.playSe({name: 'SE_red_hands', volume: 100, pitch: 100})
this.fadeOutAll();
// Reload Map if Updated
if ($gameSystem.versionId() !== $dataSystem.versionId) {
$gamePlayer.reserveTransfer($gameMap.mapId(), $gamePlayer.x, $gamePlayer.y);
$gamePlayer.requestMapReload();
};
Graphics.frameCount = $gameSystem._framesOnSave || Graphics.frameCount;
SceneManager.goto(Scene_Map);
this._loadSuccess = true;
StorageManager.remove(44);
}
return;
}
}
//=============================================================================
// Cursor on continue when save games are available
//=============================================================================
var yin_titleContinue_create = Scene_OmoriTitleScreen.prototype.create;
Scene_OmoriTitleScreen.prototype.create = function() {
// Super Call
yin_titleContinue_create.call(this);
if (this._canContinue) {
this._commandIndex = 1;
}
// Update Command Window Selection
this.updateCommandWindowSelection();
};