2
This commit is contained in:
File diff suppressed because one or more lines are too long
113
js/plugins/BatchText.js
Normal file
113
js/plugins/BatchText.js
Normal file
@@ -0,0 +1,113 @@
|
||||
//===================
|
||||
// Batch Text for MV
|
||||
//===================
|
||||
|
||||
/*:
|
||||
* @plugindesc Allows you to implement sequenced dialogue through the use of batch input.
|
||||
* @author JGreene
|
||||
*
|
||||
* @param Variable
|
||||
* @desc The variable you want to reserve for this plugin's functions.
|
||||
* @default 1
|
||||
*
|
||||
* @param WindowPosition
|
||||
* @desc Set this to the position you'd like to use. Refer to help for info.
|
||||
* @default 2
|
||||
*
|
||||
* @param Separator
|
||||
* @desc Don't change this unless you know what you're doing!
|
||||
* @default |
|
||||
*
|
||||
* @help Requires YEP_MessageCore to function properly. It is also compatible
|
||||
with Galv's Message Background. Just place this below them in your load order.
|
||||
|
||||
Each time you use the plugin command, the next message in the sequence will
|
||||
be displayed. The parameters you set up will determine where the message
|
||||
displays.
|
||||
|
||||
Window Positions:
|
||||
0 = Top
|
||||
1 = Middle
|
||||
2 = Bottom
|
||||
|
||||
All text codes are supported, except those that use the symbol reserved for
|
||||
the separator. By default, use \. several times to make up for the loss of \|
|
||||
Or, change the separator if you feel comfortable doing so.
|
||||
|
||||
For long messages, insert <WordWrap> at the beginning of the message.
|
||||
|
||||
--- Important! ---
|
||||
Be sure to place your messages in the order they need to appear in
|
||||
your game! The plugin will do the rest! You can still use the engine's
|
||||
default Show Text command separate from this plugin as normal.
|
||||
|
||||
===== SETUP Instructions =====
|
||||
|
||||
1. Create a file in your project's data folder named messages.txt
|
||||
2. Input your text lines like so:
|
||||
This is line 1.
|
||||
|This is line 2!
|
||||
|This is line 3, right?
|
||||
|Etc.
|
||||
|
||||
Note: Pressing enter will make a new line, as well as <WordWrap>. Only use
|
||||
one or the other. With word wrap, put the whole message on one line. The
|
||||
separator | has to be the first character for each new message.
|
||||
|
||||
3. Load your plugin in the editor and set up your variable and position
|
||||
4. Use the plugin command batchtext in place of messages, and the plugin
|
||||
will automatically keep track of which to play next.
|
||||
|
||||
Keep in mind, this only works for direct sequences - much like a scripted
|
||||
play or movie. However, with careful planning, you can jump to and from
|
||||
sections in your script. Furthermore, your game will error and crash if
|
||||
you use the plugin command after all the messages in your file have been
|
||||
read through. Be careful!
|
||||
|
||||
---------- Advanced ------------------
|
||||
|
||||
If you want to go out of order at any point, I would advise copying your script
|
||||
into another file, numbering each message in order, and then dividing up
|
||||
the sections by NPC/event.
|
||||
|
||||
At that point, assign each NPC/event to the proper section. When you talk to
|
||||
them, be sure the first thing that happens is a Control Variable X = Y. Where
|
||||
X is your parameter variable, and Y is the line number that they should begin
|
||||
with. Just plan accordingly so they don't end up speaking someone else's lines
|
||||
(or crashing the game).
|
||||
|
||||
--------------------------------------
|
||||
|
||||
Have any questions? Contact me --> jgreene on rpgmakerweb
|
||||
|
||||
Enjoy!
|
||||
|
||||
*/
|
||||
|
||||
(function() {
|
||||
var parameters = PluginManager.parameters('BatchText');
|
||||
|
||||
var JG_Batch_aliasPluginCommand = Game_Interpreter.prototype.pluginCommand;
|
||||
|
||||
Game_Interpreter.prototype.pluginCommand = function(command, args)
|
||||
{
|
||||
JG_Batch_aliasPluginCommand.call(this,command,args);
|
||||
if (command == "batchtext")
|
||||
{
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open("GET","data/messages.txt",false);
|
||||
xhr.send(null);
|
||||
var fileContent = xhr.responseText;
|
||||
var x = parameters['Variable']
|
||||
var pos = parameters['WindowPosition']
|
||||
var dia = fileContent.split(parameters['Separator'])
|
||||
var index = $gameVariables.value(x)
|
||||
var msg = dia[index]
|
||||
$gameMessage.setPositionType(pos);
|
||||
$gameMessage.add(msg);
|
||||
this.setWaitMode('message');
|
||||
$gameVariables.setValue(x, index+1);
|
||||
}
|
||||
}
|
||||
|
||||
})();
|
||||
343
js/plugins/FROG_TriggerDistance.js
Normal file
343
js/plugins/FROG_TriggerDistance.js
Normal file
@@ -0,0 +1,343 @@
|
||||
//=============================================================================
|
||||
// Frogboy RMMV Plugin
|
||||
// FrogTriggerDistance.js
|
||||
//=============================================================================
|
||||
|
||||
var Imported = Imported || {};
|
||||
Imported.FROG_TriggerDistance = true;
|
||||
|
||||
var FROG = FROG || {};
|
||||
FROG.TriggerDistance = FROG.TriggerDistance || {};
|
||||
|
||||
//=============================================================================
|
||||
/*:
|
||||
* @plugindesc v1.21 Trigger Events at a distance based on Radius or X/Y Axis
|
||||
* @author Frogboy
|
||||
*
|
||||
* @help
|
||||
* TriggerDistance v1.21
|
||||
* Author Frogboy
|
||||
*
|
||||
* ============================================================================
|
||||
* Introduction
|
||||
* ============================================================================
|
||||
*
|
||||
* This plugin is mainly used to avoid duplicating the same Event multiple
|
||||
* times in order to cover more than one square. By specifying your parameters
|
||||
* in comment of an Event page, the Player Touch Trigger can be fired when
|
||||
* your Player is at a specified distance from the Event and/or on a certain
|
||||
* axis. I've also added functionality to list specific modes
|
||||
* of travel that will trigger an event. Now you can fly your airship to a
|
||||
* floating island but not walk or sail into it from the ground. Yay!
|
||||
*
|
||||
* This plugin now also supports Event Touch triggers at a distance. A moving
|
||||
* event with an Event Touch trigger will activate if it steps within range of
|
||||
* the Player.
|
||||
*
|
||||
* ============================================================================
|
||||
* How to Use
|
||||
* ============================================================================
|
||||
*
|
||||
* On an Event page that has a Player Touch trigger, create a Comment and enter
|
||||
* it in this format: <TriggerDistance: parameters>
|
||||
* Parameters are separated by a space.
|
||||
*
|
||||
* The following parameters are supported. Each one is immediately followed by
|
||||
* a number to specify the distance in squares/tiles that the Event sould fire.
|
||||
* r# - Radius (Any square within # of Event)
|
||||
* x# - X-Axis (Any square within # of Event on the X-Axis [left/right])
|
||||
* y# - Y-Axis (Any square within # of Event on the Y-Axis [up/down])
|
||||
* s# - Switch Binding (Will turn ON the specified Switch ID and not
|
||||
* fire again while the Switch is on)
|
||||
* combo - This tells the event to look for both Player and Event Touch
|
||||
* conditions.
|
||||
*
|
||||
* If both x# and y# are specified, the trigger range will form a square or
|
||||
* rectangular area as opposed to just covering the two axis.
|
||||
*
|
||||
* These can also be specified in the parameters to indicate which modes of
|
||||
* travel this event will fire for. If you specify none then an Event Touch
|
||||
* will always trigger.
|
||||
* walk - Tagged Event Touch will trigger if you are walking
|
||||
* boat - Tagged Event Touch will trigger if you are on your boat
|
||||
* ship - Tagged Event Touch will trigger if you are on your ship
|
||||
* airship - Tagged Event Touch will trigger if you are on your airship
|
||||
*
|
||||
* Examples:
|
||||
* X-Axis
|
||||
* <TriggerDistance: x5>
|
||||
* Will cover the Event square and 5 tiles to the left and right of it.
|
||||
* Great for spanning a hallway.
|
||||
* #####E#####
|
||||
*
|
||||
* Y-Axis
|
||||
* <TriggerDistance: y2>
|
||||
* Will cover the Event square and 2 tiles above and below of it.
|
||||
* #
|
||||
* #
|
||||
* E
|
||||
* #
|
||||
* #
|
||||
*
|
||||
* Radius
|
||||
* <TriggerDistance: r3>
|
||||
* Will cover the Event square and 3 tiles in all directions.
|
||||
* #
|
||||
* ###
|
||||
* #####
|
||||
* ###E###
|
||||
* #####
|
||||
* ###
|
||||
* #
|
||||
*
|
||||
* Rectangle
|
||||
* <TriggerDistance: x4 y2>
|
||||
* Will cover an area that spans 4 tiles along the x-axis and 2 tiles
|
||||
* along the y-axis.
|
||||
* #########
|
||||
* #########
|
||||
* ####E####
|
||||
* #########
|
||||
* #########
|
||||
*
|
||||
* <TriggerDistance: x999>
|
||||
* Will cover the the entire edge of the top or bottom of a map.
|
||||
* It doesn't have to be the top or bottom edge but that's what it is
|
||||
* typically used for. The number is set purposely large to cover any
|
||||
* size map.
|
||||
*
|
||||
* <TriggerDistance: y999>
|
||||
* Will cover the the entire edge of the left or right of a map.
|
||||
* It doesn't have to be the left or right edge but that's what it is
|
||||
* typically used for. The number is set purposely large to cover any
|
||||
* size map.
|
||||
*
|
||||
* Radius with Switch
|
||||
* <TriggerDistance: r2 s12>
|
||||
* Will cover the Event square and 2 tiles in all directions, will turn
|
||||
* on Switch ID 12 and not fire an Event Toouch again while Switch 12 is
|
||||
* ON.
|
||||
* #
|
||||
* ###
|
||||
* ##E##
|
||||
* ###
|
||||
* #
|
||||
*
|
||||
* Touch only fires when you are in your airship
|
||||
* <TriggerDistance: airship>
|
||||
* No radius, x or y specified so this only covers the event tile
|
||||
* E
|
||||
*
|
||||
* ============================================================================
|
||||
* Switch Property
|
||||
* ============================================================================
|
||||
*
|
||||
* The Switch property isn't all that useful any longer. It was a fix for
|
||||
* issues I had when this plugin used the Note Tag to specify parameters and
|
||||
* thus, didn't know which Event Page you were on. By entering the parameters
|
||||
* into Comments that are specific to the page the Event is currently on, I
|
||||
* don't really have a good use case for this any longer. I'm leaving it in
|
||||
* just in case you find one.
|
||||
*
|
||||
* ============================================================================
|
||||
* Terms of Use
|
||||
* ============================================================================
|
||||
*
|
||||
* This plugin can be used in commercial or non-commercial projects.
|
||||
* Credit Frogboy in your work
|
||||
*
|
||||
* ============================================================================
|
||||
* Changelog
|
||||
* ============================================================================
|
||||
*
|
||||
* Version 1.0 - Initial release
|
||||
* Version 1.1 - Parameters now use Comments instead of Note Tag.
|
||||
* Version 1.2 - Added ranged Event Touch Triggers. Bug fix. More Aliasing.
|
||||
* Rectangular cover when specifying both x# and y#.
|
||||
* Version 1.21 - Bug fix
|
||||
*
|
||||
*/
|
||||
//=============================================================================
|
||||
|
||||
(function() {
|
||||
// Setup Page Settings. Add _triggerDistance property.
|
||||
FROG.TriggerDistance.GameEventSetupPageSettings = Game_Event.prototype.setupPageSettings;
|
||||
Game_Event.prototype.setupPageSettings = function() {
|
||||
FROG.TriggerDistance.GameEventSetupPageSettings.call(this);
|
||||
this._triggerDistance = "";
|
||||
var page = this.page();
|
||||
|
||||
for (var i=0; i<page.list.length; i++) {
|
||||
if (page.list[i].code == 108) {
|
||||
var params = page.list[i].parameters[0];
|
||||
var triggerDistance = params.match(/<TriggerDistance:(.*)>/i);
|
||||
if (triggerDistance) {
|
||||
this._triggerDistance = triggerDistance[1];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Exception added, otherwise solid objects would require touch from a tile away.
|
||||
Game_Player.prototype.startMapEvent = function(x, y, triggers, normal) {
|
||||
if (!$gameMap.isEventRunning()) {
|
||||
$gameMap.eventsXy(x, y).forEach(function(event) {
|
||||
if (event.isTriggerIn(triggers) && (event.isNormalPriority() === normal || event._triggerDistance)) {
|
||||
event.start();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Check for Player Touch Trigger Distance
|
||||
FROG.TriggerDistance.GameMapEventXy = Game_Map.prototype.eventsXy;
|
||||
Game_Map.prototype.eventsXy = function(x, y) {
|
||||
var return_events = FROG.TriggerDistance.GameMapEventXy.call(this, x, y);
|
||||
|
||||
for (var i=0; i<this.events().length; i++) {
|
||||
var event = this.events()[i];
|
||||
if (event._triggerDistance && (event._trigger === 1 || (event._triggerDistance.indexOf("combo") > -1 && event._trigger === 2))) {
|
||||
return_events = return_events.concat(FROG.TriggerDistance.checkTriggerDistance(event, x, y));
|
||||
}
|
||||
else if (event._x == x && event._y == y) {
|
||||
if (!$gamePlayer.isInAirship()) {
|
||||
return_events.push(event);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return return_events;
|
||||
}
|
||||
|
||||
// Disable Airship restriction on activating events
|
||||
Game_Player.prototype.canStartLocalEvents = function() {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Check for Event Touch Trigger Distance but wait until the event stops moving to start it
|
||||
FROG.TriggerDistance.GameCharacterBaseMoveStraight = Game_CharacterBase.prototype.moveStraight;
|
||||
Game_CharacterBase.prototype.moveStraight = function (d) {
|
||||
FROG.TriggerDistance.GameCharacterBaseMoveStraight.call(this, d);
|
||||
|
||||
if (this._eventId && this.isMovementSucceeded() && this._triggerDistance &&
|
||||
(this._trigger === 2 || (this._triggerDistance.indexOf("combo") > -1 && this._trigger === 1)))
|
||||
{
|
||||
var return_events = FROG.TriggerDistance.checkTriggerDistance(this, $gamePlayer._x, $gamePlayer._y);
|
||||
for (var i=0; i<return_events.length; i++) {
|
||||
return_events[i]._triggerStart = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// When the event stops moving, start the Event Touch activation
|
||||
FROG.TriggerDistance.GameEventUpdateStop = Game_Event.prototype.updateStop;
|
||||
Game_Event.prototype.updateStop = function () {
|
||||
FROG.TriggerDistance.GameEventUpdateStop.call(this);
|
||||
if (!this.isMoving() && this._triggerStart) {
|
||||
this._triggerStart = false;
|
||||
this.start();
|
||||
}
|
||||
}
|
||||
|
||||
/** Returns events that are within the range of the Trigger Distance
|
||||
* @param {object} event - Game_Event object (required)
|
||||
* @param {number} x - X coordinate to check distance (required)
|
||||
* @param {number} y - Y coordinate to check distance (required)
|
||||
* @returns {array} Returns an array of events that fall within the specified distance
|
||||
*/
|
||||
FROG.TriggerDistance.checkTriggerDistance = function (event, x, y) {
|
||||
var return_events = [];
|
||||
var tdx = -1;
|
||||
var tdy = -1;
|
||||
var tdr = -1;
|
||||
var tdSwitch = 0;
|
||||
var bOk = false;
|
||||
var vehicle = $gamePlayer._vehicleType;
|
||||
var arr = (event._triggerDistance.includes(" ")) ?
|
||||
event._triggerDistance.toLowerCase().split(' ') :
|
||||
[event._triggerDistance.toLowerCase()];
|
||||
var block = (arr.indexOf("block") > -1);
|
||||
var walk = (arr.indexOf("walk") > -1);
|
||||
var boat = (arr.indexOf("boat") > -1);
|
||||
var ship = (arr.indexOf("ship") > -1);
|
||||
var airship = (arr.indexOf("airship") > -1);
|
||||
|
||||
for (var j=0; j<arr.length; j++) {
|
||||
var token = arr[j].trim();
|
||||
|
||||
if (token != "" && ["walk", "boat", "ship", "airship"].indexOf(token) === -1) {
|
||||
switch (token.charAt(0))
|
||||
{
|
||||
case 'r':
|
||||
tdr = parseInt(token.substr(1) || -1);
|
||||
bOk = true;
|
||||
break;
|
||||
case 'x':
|
||||
tdx = parseInt(token.substr(1) || -1);
|
||||
bOk = true;
|
||||
break;
|
||||
case 'y':
|
||||
tdy = parseInt(token.substr(1) || -1);
|
||||
bOk = true;
|
||||
break;
|
||||
case 's':
|
||||
tdSwitch = parseInt(token.substr(1) || 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If none specified then all apply
|
||||
if (!walk && !boat && !ship && !airship) {
|
||||
walk = boat = ship = airship = true;
|
||||
}
|
||||
|
||||
// If no Trigger Distance specified, assume Radius zero
|
||||
if (bOk == false) {
|
||||
tdr = 0;
|
||||
}
|
||||
|
||||
// Make sure travel mode is valid
|
||||
if (((walk == true && vehicle == "walk") || (boat == true && vehicle == "boat") ||
|
||||
(ship == true && vehicle == "ship") || (airship == true && vehicle == "airship")) &&
|
||||
(tdSwitch < 0 || !$gameSwitches.value(tdSwitch)))
|
||||
{
|
||||
var distance = Math.abs(event.deltaXFrom(x)) + Math.abs(event.deltaYFrom(y));
|
||||
|
||||
// Check Radius Trigger
|
||||
if (tdr > -1 && distance <= tdr) {
|
||||
if (tdSwitch > 0) {
|
||||
$gameSwitches.setValue(tdSwitch, true);
|
||||
}
|
||||
return_events.push(event);
|
||||
}
|
||||
|
||||
// If both x and y are specified, the trigger distance will cover a square or rectangle
|
||||
if (tdx > -1 && tdy > -1) {
|
||||
if (Math.abs(event.deltaXFrom(x)) <= tdx && Math.abs(event.deltaYFrom(y)) <= tdy) {
|
||||
return_events.push(event);
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Check X-Axis Trigger
|
||||
if (tdx > -1 && distance <= tdx && y === event.y) {
|
||||
if (tdSwitch > 0) {
|
||||
$gameSwitches.setValue(tdSwitch, true);
|
||||
}
|
||||
return_events.push(event);
|
||||
}
|
||||
|
||||
// Check Y-Axis Trigger
|
||||
if (tdy > -1 && distance <= tdy && x === event.x) {
|
||||
if (tdSwitch > 0) {
|
||||
$gameSwitches.setValue(tdSwitch, true);
|
||||
}
|
||||
return_events.push(event);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return return_events;
|
||||
}
|
||||
})();
|
||||
285
js/plugins/GALV_EventSpawnTimers.js
Normal file
285
js/plugins/GALV_EventSpawnTimers.js
Normal file
@@ -0,0 +1,285 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// Galv's Event Spawn Timers
|
||||
//-----------------------------------------------------------------------------
|
||||
// For: RPGMAKER MV
|
||||
// GALV_EventSpawnTimers.js
|
||||
//-----------------------------------------------------------------------------
|
||||
// 2016-07-20 - Version 1.2 - fixed a bug causing too many move route updates
|
||||
// 2016-03-26 - Version 1.1 - added script calls to modify timers. Fixed bugs.
|
||||
// 2016-03-25 - Version 1.0 - release
|
||||
//-----------------------------------------------------------------------------
|
||||
// Terms can be found at:
|
||||
// galvs-scripts.com
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
var Imported = Imported || {};
|
||||
Imported.Galv_EventSpawnTimers = true;
|
||||
|
||||
var Galv = Galv || {}; // Galv's main object
|
||||
Galv.EST = Galv.EST || {}; // Galv's stuff
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/*:
|
||||
* @plugindesc Enable psuedo-timers that can control event self-switches, switches and variables.
|
||||
*
|
||||
* @author Galv - galvs-scripts.com
|
||||
*
|
||||
* @help
|
||||
* Galv's Event Spawn Timers
|
||||
* ----------------------------------------------------------------------------
|
||||
* This plugin allows you to set multiple respawn timers for events and change
|
||||
* switches or self switches when their timer expires.
|
||||
*
|
||||
* Just simply creating an event timer doesn't do anything until you call a
|
||||
* script that checks if the timer is up and then modifies the switches in the
|
||||
* way you specify.
|
||||
*
|
||||
* The timer checks can be made in event move routes, which means the switch
|
||||
* effect activates once the player gets in range of the events. The reason for
|
||||
* doing this is to allow many timers to exist without causing lag due to many
|
||||
* countdowns running simultaneously.
|
||||
*
|
||||
* Timer checks can also be made using a script call any time you need to check
|
||||
* and activate the results of any event timer in the game.
|
||||
* ----------------------------------------------------------------------------
|
||||
*
|
||||
* ----------------------------------------------------------------------------
|
||||
* SCRIPT call for MOVE ROUTE
|
||||
* ----------------------------------------------------------------------------
|
||||
*
|
||||
* this.doTimer(switch,status,forceEnd);
|
||||
*
|
||||
* switch = the ID number of the switch OR letter in quotes for self switch
|
||||
* status = true to turn ON and false to turn OFF
|
||||
* forceEnd = true or false - when using this, timer activates and ends even
|
||||
* if it still had time left. You can leave this one out to not use.
|
||||
*
|
||||
* This is the command that checks if a timer is up and controls the specified
|
||||
* switch to turn on or off for the event the move route belongs to. The
|
||||
* frequency this check is done depends on the movement "Freq" of the event.
|
||||
* EXAMPLES:
|
||||
* this.doTimer("B",false); // turn self-switch B off once timer expires
|
||||
* this.doTimer(5,true); // turn switch 1 on once timer expires
|
||||
* this.doTimer("A",true,true); // turn switch 1 on forcibly NOW!
|
||||
* ----------------------------------------------------------------------------
|
||||
*
|
||||
* ----------------------------------------------------------------------------
|
||||
* SCRIPT calls for event commands
|
||||
* ----------------------------------------------------------------------------
|
||||
*
|
||||
* this.setSpawn(mapId,eventId,time);
|
||||
*
|
||||
* mapId = the map the event is on. Use 0 for the current map.
|
||||
* eventId = the event. Use 0 for the event the script call is in.
|
||||
* time = how many seconds until the timer is complete.
|
||||
*
|
||||
* This command will create a timer for an event. If it is used while a timer
|
||||
* exists for an event, the latest time will overwrite the old one.
|
||||
* EXAMPLES:
|
||||
* this.setSpawn(12,5,80); // set timer for event 5 on map 12 for 80 seconds
|
||||
* this.setSpawn(0,0,30); // set timer for this event, this map, 30 seconds
|
||||
* ----------------------------------------------------------------------------
|
||||
*
|
||||
* this.doTimer(mapId,eventId,switch,status,forceEnd);
|
||||
*
|
||||
* mapId = the map of the target event. Use 0 for the current map.
|
||||
* eventId = the target event. Use 0 for the event the script call is in.
|
||||
* switch = the ID number of the switch OR letter in quotes for self switch
|
||||
* status = true to turn ON and false to turn OFF
|
||||
* forceEnd = true or false - when using this, timer activates and ends even
|
||||
* if it still had time left. You can leave this one out to not use.
|
||||
*
|
||||
* This command checks if a timer is up for an event on specified map and turns
|
||||
* a switch or that event's self-switch on or off. This is used if you need to
|
||||
* check and activate an event's timer from anywhere in the game.
|
||||
* EXAMPLES:
|
||||
* this.doTimer(4,7,"C",false); // Map 4, event 7, self switch C off
|
||||
* this.doTimer(0,2,9,true); // This map, event 2, switch 9 on
|
||||
* this.doTimer(0,2,9,true,true); // This map, event 2, switch 9 on, end timer
|
||||
* ----------------------------------------------------------------------------
|
||||
*
|
||||
* this.doMapTimers(mapId,switch,status,forceEnd);
|
||||
*
|
||||
* mapId = the map the event is on. Use 0 for the current map.
|
||||
*
|
||||
* This commend does the same as the above doTimer command, except it does it
|
||||
* for all event timers currently running on the map.
|
||||
* EXAMPLE:
|
||||
* this.doMapTimers(2,"B",false); // turn self-switch B off when timer expires
|
||||
* // for all timer-events on map 2
|
||||
* ----------------------------------------------------------------------------
|
||||
*
|
||||
* this.purgeEventTimers(); // Remove ALL timers
|
||||
*
|
||||
* this.purgeEventTimers(mapId); // Remove all timers on map
|
||||
*
|
||||
* this.purgeEventTimers(mapId,eventId); // Remove specified event timer
|
||||
*
|
||||
* This command purges timers as above.
|
||||
* ----------------------------------------------------------------------------
|
||||
*
|
||||
* this.modEventTimers(mapId,eventId,amount); // mod specific timer
|
||||
*
|
||||
* this.modEventTimers(mapId,amount); // mod all timers on specified map
|
||||
*
|
||||
* this.modEventTimers(amount); // modify ALL timers
|
||||
*
|
||||
* mapId = the map of the target event. Use 0 for the current map.
|
||||
* eventId = the target event. Use 0 for the event the script call is in.
|
||||
* amount = change timer by this much. (negative reduce, positive increase)
|
||||
*
|
||||
* These commands change the time left on specified timers.
|
||||
* EXAMPLES
|
||||
* this.modEventTimers(2,7,-10); // decrease timer for map 2, event 7 by 10s
|
||||
* this.modEventTimers(0,2); // increase all timers for the current map by 2s
|
||||
* this.modEventTimers(-20); // decrease ALL timers by 20s
|
||||
* ----------------------------------------------------------------------------
|
||||
* SCRIPT for CONTROL VARIABLES
|
||||
* ----------------------------------------------------------------------------
|
||||
*
|
||||
* this.respawnTime(mapId,eventId);
|
||||
*
|
||||
* mapId = the map of the target event. Use 0 for the current map.
|
||||
* eventId = the target event. Use 0 for the event the script call is in.
|
||||
*
|
||||
* This command, used in Control Variables 'script' will return the amount of
|
||||
* seconds the event timer has remaining. It will return 0 if no timer exists.
|
||||
* ----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// CODE STUFFS
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
|
||||
(function() {
|
||||
|
||||
Galv.EST.x = PluginManager.parameters('Galv_EventSpawnTimers')['X'];
|
||||
|
||||
// Game_System
|
||||
//-----------------------------------------------------------------------------
|
||||
Galv.EST.Game_System_initialize = Game_System.prototype.initialize;
|
||||
Game_System.prototype.initialize = function() {
|
||||
this.purgeEventTimers();
|
||||
Galv.EST.Game_System_initialize.call(this);
|
||||
};
|
||||
|
||||
|
||||
Game_System.prototype.purgeEventTimers = function(mapId,eventId) {
|
||||
if (!mapId) { // Purge all
|
||||
this.eventTimers = {};
|
||||
} else if (!eventId) { // Purge map
|
||||
if (this.eventTimers) {
|
||||
delete(this.eventTimers[mapId]);
|
||||
};
|
||||
} else { // Purge event
|
||||
if (this.eventTimers && this.eventTimers[mapId]) {
|
||||
delete(this.eventTimers[mapId][eventId]);
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
// Game_Interpreter
|
||||
//-----------------------------------------------------------------------------
|
||||
Game_Interpreter.prototype.setSpawn = function(mapId,eventId,time) {
|
||||
if (mapId <= 0) mapId = this._mapId;
|
||||
if (eventId <= 0) eventId = this._eventId;
|
||||
$gameSystem.eventTimers[mapId] = $gameSystem.eventTimers[mapId] || {};
|
||||
$gameSystem.eventTimers[mapId][eventId] = $gameSystem.playtime() + time;
|
||||
};
|
||||
|
||||
Game_Interpreter.prototype.respawnTime = function(mapId,eventId) {
|
||||
if (mapId <= 0) mapId = this._mapId;
|
||||
if (eventId <= 0) eventId = this._eventId;
|
||||
|
||||
if ($gameSystem.eventTimers[mapId] && $gameSystem.eventTimers[mapId][eventId]) {
|
||||
return $gameSystem.eventTimers[mapId][eventId] - $gameSystem.playtime();
|
||||
} else {
|
||||
return 0;
|
||||
};
|
||||
};
|
||||
|
||||
Game_Interpreter.prototype.doTimer = function(mapId,eventId,s,status,force) {
|
||||
if (mapId <= 0) mapId = this._mapId;
|
||||
if (eventId <= 0) eventId = this._eventId;
|
||||
if ($gameSystem.eventTimers[mapId] && $gameSystem.eventTimers[mapId][eventId]) {
|
||||
if (force || $gameSystem.playtime() >= $gameSystem.eventTimers[mapId][eventId]) {
|
||||
if (isNaN(s)) { // If letter
|
||||
$gameSelfSwitches.setValue(mapId + "," + eventId + "," + s,status);
|
||||
} else { // If number
|
||||
$gameSwitches.setValue(s,status);
|
||||
};
|
||||
delete($gameSystem.eventTimers[mapId][eventId]);
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
Game_Interpreter.prototype.doMapTimers = function(mapId,s,status,force) {
|
||||
if (mapId <= 0) mapId = this._mapId;
|
||||
for (var e in $gameSystem.eventTimers[mapId]) {
|
||||
var eventId = e;
|
||||
this.doTimer(mapId,eventId,s,status,force);
|
||||
};
|
||||
};
|
||||
|
||||
Game_Interpreter.prototype.purgeEventTimers = function(mapId,eventId) {
|
||||
if (mapId != null && mapId <= 0) mapId = this._mapId;
|
||||
if (eventId != null && eventId <= 0) eventId = this._eventId;
|
||||
$gameSystem.purgeEventTimers(mapId,eventId);
|
||||
};
|
||||
|
||||
Game_Interpreter.prototype.modEventTimers = function(mapId,eventId,amount) {
|
||||
if (!eventId) { // all timers
|
||||
// mapId field used as amount
|
||||
amount = mapId;
|
||||
|
||||
if ($gameSystem.eventTimers) {
|
||||
for (var m in $gameSystem.eventTimers) {
|
||||
var map = $gameSystem.eventTimers[m];
|
||||
for (var e in map) {
|
||||
map[e] += amount;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
} else if (!amount) { // all on map
|
||||
// eventId field used as amount
|
||||
if (mapId != null && mapId <= 0) mapId = this._mapId;
|
||||
amount = eventId;
|
||||
if ($gameSystem.eventTimers[mapId]) {
|
||||
for (var e in $gameSystem.eventTimers[mapId]) {
|
||||
$gameSystem.eventTimers[mapId][e] += amount;
|
||||
};
|
||||
};
|
||||
|
||||
} else { // Singe event
|
||||
if (mapId != null && mapId <= 0) mapId = this._mapId;
|
||||
if (eventId != null && eventId <= 0) eventId = this._eventId;
|
||||
if ($gameSystem.eventTimers && $gameSystem.eventTimers[mapId]) {
|
||||
$gameSystem.eventTimers[mapId][eventId] += amount;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
// Game_Event
|
||||
//-----------------------------------------------------------------------------
|
||||
Game_Event.prototype.doTimer = function(s,status,force) {
|
||||
var mapId = $gameMap._mapId;
|
||||
var eventId = this._eventId;
|
||||
if ($gameSystem.eventTimers[mapId] && $gameSystem.eventTimers[mapId][eventId]) {
|
||||
if (force || $gameSystem.playtime() >= $gameSystem.eventTimers[mapId][eventId]) {
|
||||
if (isNaN(s)) { // If letter
|
||||
$gameSelfSwitches.setValue(mapId + "," + eventId + "," + s,status);
|
||||
} else { // If number
|
||||
$gameSwitches.setValue(s,status);
|
||||
};
|
||||
delete($gameSystem.eventTimers[mapId][eventId]);
|
||||
};
|
||||
};
|
||||
this.resetStopCount();
|
||||
};
|
||||
|
||||
|
||||
})();
|
||||
159
js/plugins/HIME_DisabledChoiceConditions.js
Normal file
159
js/plugins/HIME_DisabledChoiceConditions.js
Normal file
@@ -0,0 +1,159 @@
|
||||
/*:
|
||||
-------------------------------------------------------------------------
|
||||
@title Disabled Choice Conditions
|
||||
@author Hime --> HimeWorks (http://himeworks.com)
|
||||
@version 1.3
|
||||
@date Jan 5, 2016
|
||||
@filename HIME_DisabledChoiceConditions.js
|
||||
@url http://himeworks.com/2015/10/disabled-choice-conditions/
|
||||
|
||||
If you enjoy my work, consider supporting me on Patreon!
|
||||
|
||||
* https://www.patreon.com/himeworks
|
||||
|
||||
If you have any questions or concerns, you can contact me at any of
|
||||
the following sites:
|
||||
|
||||
* Main Website: http://himeworks.com
|
||||
* Facebook: https://www.facebook.com/himeworkscom/
|
||||
* Twitter: https://twitter.com/HimeWorks
|
||||
* Youtube: https://www.youtube.com/c/HimeWorks
|
||||
* Tumblr: http://himeworks.tumblr.com/
|
||||
-------------------------------------------------------------------------
|
||||
@plugindesc v1.4Allows you to disable individual choices in a set of options
|
||||
based on custom conditions
|
||||
@help
|
||||
-------------------------------------------------------------------------
|
||||
== Description ==
|
||||
|
||||
RPG Maker does not come with a way to disable individual choices from
|
||||
a list of choices. For example, if the player shouldn't be allowed to
|
||||
select a particular option, but you still want to show it, there's
|
||||
basically no way to do it.
|
||||
|
||||
This plugin provides an easy way for you to disable each choice based
|
||||
on your own custom conditions using tools that you are already
|
||||
familiar with!
|
||||
|
||||
== Terms of Use ==
|
||||
|
||||
- Free for use in non-commercial projects with credits
|
||||
- Contact me for commercial use
|
||||
|
||||
== Change Log ==
|
||||
|
||||
1.3 - Jan 5, 2016
|
||||
* Provided script call with interpreter scope
|
||||
1.2 - Nov 2, 2015
|
||||
* rewrote input methods. You can either use a script call, or a
|
||||
plugin command directly
|
||||
1.1 - Nov 1, 2015
|
||||
* added support for plugin/conditional pair
|
||||
1.0 - Oct 31, 2015
|
||||
* initial release
|
||||
|
||||
== Usage ==
|
||||
|
||||
There are two ways to disable a choice
|
||||
|
||||
1. Using a plugin command
|
||||
|
||||
To disable a choice, simply use the plugin command
|
||||
|
||||
disable_choice choiceNumber
|
||||
|
||||
Where the choiceNumber is the number of the choice that
|
||||
you wish to disable
|
||||
|
||||
Use conditional branches and any other event commands as needed
|
||||
to implement your logic.
|
||||
|
||||
2. Using a script call
|
||||
|
||||
this.disable_choice( choiceNumber, formula )
|
||||
|
||||
Where the choiceNumber is the number of the choice that
|
||||
you wish to disable, and the formula is a valid Javascript formula.
|
||||
|
||||
For example, to disable choice 3 if switch 4 is OFF, you can say
|
||||
|
||||
this.disable_choice(3, "$gameSwitches.value(4) === false")
|
||||
|
||||
-- When there are multiple sets of choices --
|
||||
|
||||
Disable conditions apply to the immediate set of choices, on the same
|
||||
indentation level.
|
||||
|
||||
As a rule of thumb, you should declare all disable conditions
|
||||
immediately before your choices. To avoid breaking up messages
|
||||
and choices, you can place the disable conditions before any
|
||||
messages as well.
|
||||
|
||||
-------------------------------------------------------------------------
|
||||
*/
|
||||
var Imported = Imported || {}
|
||||
var TH = TH || {};
|
||||
Imported.DisabledChoiceConditions = 1;
|
||||
TH.DisabledChoiceConditions = TH.DisabledChoiceConditions || {};
|
||||
|
||||
(function ($) {
|
||||
|
||||
$.Regex = /<disable[-_ ]choice:\s*(\d+)\s*>/i
|
||||
|
||||
/* store all indices that are disabled */
|
||||
var TH_DisableChoiceConditions_GameMessage_Clear = Game_Message.prototype.clear;
|
||||
Game_Message.prototype.clear = function() {
|
||||
TH_DisableChoiceConditions_GameMessage_Clear.call(this);
|
||||
this._DisabledChoiceConditions = {};
|
||||
};
|
||||
|
||||
/* Returns whether the specified choice is disabled */
|
||||
Game_Message.prototype.isChoiceDisabled = function(choiceNum) {
|
||||
return this._DisabledChoiceConditions[choiceNum];
|
||||
}
|
||||
|
||||
Game_Message.prototype.disableChoice = function(choiceNum, bool) {
|
||||
this._DisabledChoiceConditions[choiceNum] = bool;
|
||||
}
|
||||
|
||||
/* After setting up choices, go and disable any that should be disabled */
|
||||
var TH_DisableChoiceConditions_WindowChoiceList_MakeCommandList = Window_ChoiceList.prototype.makeCommandList;
|
||||
Window_ChoiceList.prototype.makeCommandList = function() {
|
||||
TH_DisableChoiceConditions_WindowChoiceList_MakeCommandList.call(this);
|
||||
for (var i = 0; i < this._list.length; i++) {
|
||||
if ($gameMessage.isChoiceDisabled(i)) {
|
||||
this._list[i].enabled = false;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/* Gray out disabled choices */
|
||||
var TH_DisableChoiceConditions_WindowChoiceList_DrawItem = Window_ChoiceList.prototype.drawItem
|
||||
Window_ChoiceList.prototype.drawItem = function(index) {
|
||||
this.changePaintOpacity(this.isCommandEnabled(index));
|
||||
TH_DisableChoiceConditions_WindowChoiceList_DrawItem.call(this, index);
|
||||
};
|
||||
|
||||
/* Use a plugin command*/
|
||||
var TH_DisabledChoiceConditions_GameInterpreterPluginCommand = Game_Interpreter.prototype.pluginCommand;
|
||||
Game_Interpreter.prototype.pluginCommand = function(command, args) {
|
||||
TH_DisabledChoiceConditions_GameInterpreterPluginCommand.call(this, command, args);
|
||||
if (command.toLowerCase() === "disable_choice") {
|
||||
var choiceNum = Math.floor(args[0] - 1);
|
||||
$gameMessage.disableChoice(choiceNum, true);
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
/* disable choice script call, with interpreter scope */
|
||||
Game_Interpreter.prototype.disable_choice = function(choiceNum, formula) {
|
||||
var num = Math.floor(choiceNum) - 1;
|
||||
$gameMessage.disableChoice(num, eval(formula));
|
||||
};
|
||||
|
||||
/* disable choice script call */
|
||||
disable_choice = function(choiceNum, formula) {
|
||||
var num = Math.floor(choiceNum) - 1;
|
||||
$gameMessage.disableChoice(num, eval(formula));
|
||||
};
|
||||
})(TH.DisabledChoiceConditions);
|
||||
103
js/plugins/JIF_MoveStaling.js
Normal file
103
js/plugins/JIF_MoveStaling.js
Normal file
@@ -0,0 +1,103 @@
|
||||
/*:
|
||||
* @plugindesc (v.1) Adds the move staling mechanic into your game
|
||||
* @author Jiffy
|
||||
*
|
||||
* @param damageDecreaseIncrement
|
||||
* @desc The increment damage is decreased by (Ex. For a 10% decrease -> .1)| Default:.1
|
||||
* @default .1
|
||||
*
|
||||
* @help
|
||||
* Jiffy's Move Staling Plugin
|
||||
* ===========================================================================
|
||||
* Inspired by the mechanic by the same name from the Super Smash Bros. Series,
|
||||
* staling will decrease the amount of damage a move does if it is used
|
||||
* repeatedly. This will discourage the spamming of the same move and will
|
||||
* add another layer of complexity to your combat system.
|
||||
* ===========================================================================
|
||||
* Parameter Explanation
|
||||
* ===========================================================================
|
||||
* damageDecreaseIncrement:
|
||||
* This parameter changes the increment of which your damage is decreased by.
|
||||
* For example: If I set this to .1, the damage will decrease by 10% each time
|
||||
* time it is used in a row.
|
||||
* ===========================================================================
|
||||
* Thanks for reading! If you have any questions regarding this plugin, feel
|
||||
* free to DM me on RPGMakerWeb!
|
||||
*
|
||||
* Thanks again
|
||||
* - Jiffy
|
||||
*/
|
||||
|
||||
//Param Setup
|
||||
var JIF = JIF || {};
|
||||
var params = PluginManager.parameters('JIF_MoveStaling');
|
||||
|
||||
JIF.modifier = String(params['damageDecreaseIncrement']);
|
||||
//
|
||||
|
||||
JIF.arr = [];
|
||||
JIF.tempCount = 0;
|
||||
|
||||
|
||||
Game_Action.prototype.makeDamageValue = function(target, critical) {
|
||||
var item = this.item();
|
||||
var baseValue = this.evalDamageFormula(target);
|
||||
var value = baseValue * this.calcElementRate(target);
|
||||
if (this.isPhysical()) {
|
||||
value *= target.pdr;
|
||||
}
|
||||
if (this.isMagical()) {
|
||||
value *= target.mdr;
|
||||
}
|
||||
if (baseValue < 0) {
|
||||
value *= target.rec;
|
||||
}
|
||||
if (critical) {
|
||||
value = this.applyCritical(value);
|
||||
}
|
||||
value = this.applyVariance(value, item.damage.variance);
|
||||
value = this.applyGuard(value, target);
|
||||
value = Math.round(value);
|
||||
if(JIF.arr.length > 2)
|
||||
{
|
||||
if(JIF.arr[JIF.arr.length - 2].item().name !== this.item().name)
|
||||
{
|
||||
JIF.tempCount = 0;
|
||||
for(var i = 0; i < JIF.arr.length; i++)
|
||||
{
|
||||
if(JIF.arr[i].item().name !== this.item().name) {
|
||||
JIF.arr = JIF.arr.slice(i, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
JIF.tempCount = 0;
|
||||
for(var i = 0; i < JIF.arr.length; i++)
|
||||
{
|
||||
if(JIF.arr[i].item().name === this.item().name)
|
||||
{
|
||||
JIF.tempCount++;
|
||||
}
|
||||
}
|
||||
//console.log(tempCount);
|
||||
//console.log(value - (value * (modifier * tempCount)));
|
||||
JIF.arr.push(this);
|
||||
return Math.floor(value - (value * (JIF.modifier * JIF.tempCount)));
|
||||
};
|
||||
|
||||
BattleManager.startAction = function() {
|
||||
var subject = this._subject;
|
||||
var action = subject.currentAction();
|
||||
var targets = action.makeTargets();
|
||||
//console.log(action);
|
||||
//console.log(subject);
|
||||
|
||||
|
||||
this._phase = 'action';
|
||||
this._action = action;
|
||||
this._targets = targets;
|
||||
subject.useItem(action.item());
|
||||
this._action.applyGlobal();
|
||||
this.refreshStatus();
|
||||
this._logWindow.startAction(subject, action, targets);
|
||||
};
|
||||
356
js/plugins/MOG_TrPopUpBattle.js
Normal file
356
js/plugins/MOG_TrPopUpBattle.js
Normal file
@@ -0,0 +1,356 @@
|
||||
//=============================================================================
|
||||
// MOG_TrPopUpBattle.js
|
||||
//=============================================================================
|
||||
|
||||
/*:
|
||||
* @plugindesc (v1.0) Apresenta os ícones dos tesouros após o inimigo morrer.
|
||||
* @author Moghunter
|
||||
*
|
||||
* @param Drop Item Real Time
|
||||
* @desc Ganhar o item em tempo real.
|
||||
* @default true
|
||||
*
|
||||
* @param Animation Type
|
||||
* @desc Tipo de animação.
|
||||
* 0 - Bouncing 1 - Floating
|
||||
* @default 0
|
||||
*
|
||||
* @param Fade Duration
|
||||
* @desc Tempo para fazer o item desaparecer.
|
||||
* @default 20
|
||||
*
|
||||
* @param Scale
|
||||
* @desc Tamanho do ícone do tesouro.
|
||||
* @default 0.8
|
||||
*
|
||||
* @help
|
||||
* =============================================================================
|
||||
* +++ MOG Treasure PopUp Battle (v1.0) +++
|
||||
* By Moghunter
|
||||
* https://atelierrgss.wordpress.com/
|
||||
* =============================================================================
|
||||
* Apresenta os ícones dos tesouros após o inimigo morrer.
|
||||
*
|
||||
*/
|
||||
|
||||
//=============================================================================
|
||||
// ** PLUGIN PARAMETERS
|
||||
//=============================================================================
|
||||
|
||||
//=============================================================================
|
||||
// ** PLUGIN PARAMETERS
|
||||
//=============================================================================
|
||||
var Imported = Imported || {};
|
||||
Imported.MOG_TrPopUpBattle = true;
|
||||
var Moghunter = Moghunter || {};
|
||||
|
||||
Moghunter.parameters = PluginManager.parameters('MOG_TrPopUpBattle');
|
||||
Moghunter.trPopup_animation = Number(Moghunter.parameters['Animation Type'] || 0);
|
||||
Moghunter.trPopup_scale = Number(Moghunter.parameters['Scale'] || 0.8);
|
||||
Moghunter.trPopup_fadeDuration = Number(Moghunter.parameters['Fade Duration'] || 20);
|
||||
Moghunter.trPopup_dropRealTime = String(Moghunter.parameters['Drop Item Real Time'] || 'false');
|
||||
|
||||
//=============================================================================
|
||||
// ** Game Temp
|
||||
//=============================================================================
|
||||
|
||||
//==============================
|
||||
// * Initialize
|
||||
//==============================
|
||||
var _mog_trPopBattle_tempInitialize = Game_Temp.prototype.initialize;
|
||||
Game_Temp.prototype.initialize = function() {
|
||||
_mog_trPopBattle_tempInitialize.call(this);
|
||||
this._trBatNeedPopUp = false;
|
||||
this._trBatRealTimeDrop = (Moghunter.trPopup_dropRealTime) == 'true' ? true : false;
|
||||
this._trBatDropLock = false;
|
||||
};
|
||||
|
||||
//=============================================================================
|
||||
// ** Game Enemy
|
||||
//=============================================================================
|
||||
var _mog_trPopBattle_gEnemy_initMembers = Game_Enemy.prototype.initMembers;
|
||||
Game_Enemy.prototype.initMembers = function() {
|
||||
_mog_trPopBattle_gEnemy_initMembers.call(this);
|
||||
this._treasure = {};
|
||||
this._treasure.needPopup = false;
|
||||
this._treasure.checked = false;
|
||||
this._treasure.item = [];
|
||||
};
|
||||
|
||||
//==============================
|
||||
// * make Drop Items
|
||||
//==============================
|
||||
Game_Enemy.prototype.makeDropItems = function() {
|
||||
if (this._treasure.checked) {
|
||||
return this._treasure.item;
|
||||
} else {
|
||||
return this.enemy().dropItems.reduce(function(r, di) {
|
||||
if (di.kind > 0 && Math.random() * di.denominator < this.dropItemRate()) {
|
||||
return r.concat(this.itemObject(di.kind, di.dataId));
|
||||
} else {
|
||||
return r;
|
||||
}
|
||||
}.bind(this), []);
|
||||
};
|
||||
};
|
||||
|
||||
//=============================================================================
|
||||
// ** Battle Manager
|
||||
//=============================================================================
|
||||
|
||||
//==============================
|
||||
// * gain Drip Items
|
||||
//==============================
|
||||
var _mog_BMangr_gainDropItems = BattleManager.gainDropItems;
|
||||
BattleManager.gainDropItems = function() {
|
||||
if ($gameTemp._trBatDropLock) {return};
|
||||
_mog_BMangr_gainDropItems.call(this);
|
||||
};
|
||||
|
||||
//=============================================================================
|
||||
// ** Scene Map
|
||||
//=============================================================================
|
||||
|
||||
//==============================
|
||||
// * Initialize
|
||||
//==============================
|
||||
var _mog_trPopup_scMap_initialize = Scene_Map.prototype.initialize;
|
||||
Scene_Map.prototype.initialize = function() {
|
||||
$gameTemp._trBatDropLock = false;
|
||||
_mog_trPopup_scMap_initialize.call(this)
|
||||
};
|
||||
|
||||
//=============================================================================
|
||||
// ** Sprite Enemy
|
||||
//=============================================================================
|
||||
|
||||
//==============================
|
||||
// * Update Collapse
|
||||
//==============================
|
||||
var _mog_trPopBattle_sprEnemy_updateCollapse = Sprite_Enemy.prototype.updateCollapse;
|
||||
Sprite_Enemy.prototype.updateCollapse = function() {
|
||||
_mog_trPopBattle_sprEnemy_updateCollapse.call(this);
|
||||
if (this._effectDuration === 0 && !this._enemy._treasure.checked) {this.checkTreasurePopup()};
|
||||
};
|
||||
|
||||
//==============================
|
||||
// * Update Boss Collapse
|
||||
//==============================
|
||||
var _mog_trPopBattle_sprEnemy_updateBossCollapse = Sprite_Enemy.prototype.updateBossCollapse;
|
||||
Sprite_Enemy.prototype.updateBossCollapse = function() {
|
||||
_mog_trPopBattle_sprEnemy_updateBossCollapse.call(this);
|
||||
if (this._effectDuration === 0 && !this._enemy._treasure.checked) {this.checkTreasurePopup()};
|
||||
};
|
||||
|
||||
//==============================
|
||||
// * Update Instant Collapse
|
||||
//==============================
|
||||
var _mog_trPopBattle_sprEnemy_updateInstantCollapse = Sprite_Enemy.prototype.updateInstantCollapse;
|
||||
Sprite_Enemy.prototype.updateInstantCollapse = function() {
|
||||
_mog_trPopBattle_sprEnemy_updateInstantCollapse.call(this);
|
||||
if (this._effectDuration === 0 && !this._enemy._treasure.checked) {this.checkTreasurePopup()};
|
||||
};
|
||||
|
||||
//==============================
|
||||
// * check Treasure Popup
|
||||
//==============================
|
||||
Sprite_Enemy.prototype.checkTreasurePopup = function() {
|
||||
this._enemy._treasure.item = this._enemy.makeDropItems();
|
||||
this._enemy._treasure.checked = true;
|
||||
if (this._enemy._treasure.item) {
|
||||
this._enemy._treasure.needPopup = true;
|
||||
$gameTemp._trBatNeedPopUp = true;
|
||||
};
|
||||
};
|
||||
|
||||
//=============================================================================
|
||||
// ** Spriteset Battle
|
||||
//=============================================================================
|
||||
|
||||
//==============================
|
||||
// * create Enemies
|
||||
//==============================
|
||||
var _mog_trPopupBat_sprBat_update = Spriteset_Battle.prototype.update;
|
||||
Spriteset_Battle.prototype.update = function() {
|
||||
_mog_trPopupBat_sprBat_update.call(this);
|
||||
if ($gameTemp._trBatNeedPopUp) {this.treasurePopupR()};
|
||||
};
|
||||
|
||||
//==============================
|
||||
// * create Enemies
|
||||
//==============================
|
||||
Spriteset_Battle.prototype.treasurePopupR = function() {
|
||||
$gameTemp._trBatNeedPopUp = false;
|
||||
if (!this._enemiesTreasure) {this._enemiesTreasure = []};
|
||||
for (var i = 0; i < this._enemySprites.length; i++) {
|
||||
if (this._enemySprites[i]._enemy && this._enemySprites[i]._enemy._treasure.needPopup) {
|
||||
this._enemySprites[i]._enemy._treasure.needPopup = false;
|
||||
this._enemiesTreasure[i] = new SpriteEnemyTrP(this._enemySprites[i]);
|
||||
this._enemiesTreasure[i].z = this._enemySprites[i].z ? this._enemySprites[i].z + 1 : 2;
|
||||
this._battleField.addChild(this._enemiesTreasure[i]);
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
//=============================================================================
|
||||
// * Sprite Enemy TrP
|
||||
//=============================================================================
|
||||
function SpriteEnemyTrP() {
|
||||
this.initialize.apply(this, arguments);
|
||||
};
|
||||
|
||||
SpriteEnemyTrP.prototype = Object.create(Sprite.prototype);
|
||||
SpriteEnemyTrP.prototype.constructor = SpriteEnemyTrP;
|
||||
|
||||
//==============================
|
||||
// * Initialize
|
||||
//==============================
|
||||
SpriteEnemyTrP.prototype.initialize = function(sprite) {
|
||||
Sprite.prototype.initialize.call(this);
|
||||
this._sprite = sprite;
|
||||
this._mode = Moghunter.trPopup_animation;
|
||||
this.visible = false;
|
||||
this._enemy = this._sprite._enemy;
|
||||
this.createIcon();
|
||||
if ($gameTemp._trBatRealTimeDrop) {
|
||||
$gameTemp._trBatDropLock = true;
|
||||
this.gainDropItems();
|
||||
};
|
||||
};
|
||||
|
||||
//==============================
|
||||
// * Initialize
|
||||
//==============================
|
||||
SpriteEnemyTrP.prototype.gainDropItems = function() {
|
||||
var items = this._enemy._treasure.item;
|
||||
items.forEach(function(item) {
|
||||
$gameParty.gainItem(item, 1);
|
||||
});
|
||||
};
|
||||
|
||||
//==============================
|
||||
// * create Icon
|
||||
//==============================
|
||||
SpriteEnemyTrP.prototype.createIcon = function() {
|
||||
this._iconImg = ImageManager.loadSystem("IconSet")
|
||||
this._icons = [];
|
||||
for (var i = 0; i < this._enemy._treasure.item.length; i++) {
|
||||
var item = this._enemy._treasure.item[i];
|
||||
if (item) {
|
||||
this._icons[i] = new Sprite(this._iconImg)
|
||||
this._icons[i].item = item;
|
||||
this._icons[i].index = i;
|
||||
this._icons[i].anchor.x = 0.5;
|
||||
this._icons[i].anchor.y = 1;
|
||||
this.refreshIcons(this._icons[i]);
|
||||
this.addChild(this._icons[i]);
|
||||
};
|
||||
};
|
||||
this._icons.sort(function(a, b){return b.intY-a.intY});
|
||||
this.children.sort(function(a, b){return b.intY-a.intY});
|
||||
for (var i = 0; i < this._icons.length; i++) {
|
||||
this.refreshWait(this._icons[i],i,this._icons.length);
|
||||
};
|
||||
};
|
||||
|
||||
//==============================
|
||||
// * refresh Wait
|
||||
//==============================
|
||||
SpriteEnemyTrP.prototype.refreshWait = function(sprite,index,maxv) {
|
||||
var mv = maxv * 20;
|
||||
var mvt = mv - (20 * index)
|
||||
sprite.wait = Moghunter.trPopup_fadeDuration + mvt;
|
||||
};
|
||||
|
||||
//==============================
|
||||
// * refresh Icons
|
||||
//==============================
|
||||
SpriteEnemyTrP.prototype.refreshIcons = function(sprite) {
|
||||
var w = Window_Base._iconWidth;
|
||||
var h = Window_Base._iconHeight;
|
||||
var iconindex = sprite.item.iconIndex;
|
||||
var sx = iconindex % 16 * w;
|
||||
var sy = Math.floor(iconindex / 16) * h;
|
||||
var hr = Math.randomInt(h);
|
||||
sprite.setFrame(sx,sy,w,h);
|
||||
sprite.intY = ((this._sprite.height / 3) + hr) - h;
|
||||
sprite.dr = 60;
|
||||
sprite.dy = 15;
|
||||
sprite.y = -40;
|
||||
sprite.ry = sprite.y + sprite.intY;
|
||||
var randx = (Math.random() * 0.5) + (sprite.index / 8);
|
||||
var rands = Math.randomInt(2);
|
||||
sprite.sx = rands === 0 ? randx : -randx;
|
||||
sprite.scale.x = Moghunter.trPopup_scale;
|
||||
sprite.scale.y = sprite.scale.x;
|
||||
};
|
||||
|
||||
//==============================
|
||||
// * Update Bounce
|
||||
//==============================
|
||||
SpriteEnemyTrP.prototype.updateBounce = function(sprite) {
|
||||
sprite.dy += 0.6;
|
||||
sprite.ry += sprite.dy;
|
||||
if (sprite.ry >= 0) {
|
||||
sprite.ry = 0;
|
||||
sprite.dy *= -0.7;
|
||||
};
|
||||
sprite.y = -sprite.intY + Math.round(sprite.ry);
|
||||
if (sprite.y < -sprite.intY) {sprite.x += sprite.sx};
|
||||
if (sprite.y === -sprite.intY) {this.updateFade(sprite)};
|
||||
};
|
||||
|
||||
//==============================
|
||||
// * Update Float
|
||||
//==============================
|
||||
SpriteEnemyTrP.prototype.updateFloat= function(sprite) {
|
||||
sprite.wait--;
|
||||
if (sprite.wait > 0) {return};
|
||||
sprite.y -= 3
|
||||
sprite.opacity -= 8;
|
||||
};
|
||||
|
||||
//==============================
|
||||
// * Update Animation
|
||||
//==============================
|
||||
SpriteEnemyTrP.prototype.updateAnimation= function(sprite) {
|
||||
if (this._mode === 1) {
|
||||
this.updateFloat(sprite);
|
||||
} else {
|
||||
this.updateBounce(sprite);
|
||||
};
|
||||
};
|
||||
|
||||
//==============================
|
||||
// * Update Fade
|
||||
//==============================
|
||||
SpriteEnemyTrP.prototype.updateFade = function(sprite) {
|
||||
sprite.wait--;
|
||||
if (sprite.wait > 0) {return};
|
||||
sprite.opacity -= 15;
|
||||
sprite.scale.x -= 0.05
|
||||
sprite.scale.y += 0.15
|
||||
};
|
||||
|
||||
//==============================
|
||||
// * Update Sprites
|
||||
//==============================
|
||||
SpriteEnemyTrP.prototype.updateSprites = function(sprite) {
|
||||
this.visible = true;
|
||||
this.updateAnimation(sprite);
|
||||
if (sprite.opacity <= 0) {sprite.visible = false};
|
||||
};
|
||||
|
||||
//==============================
|
||||
// * Update
|
||||
//==============================
|
||||
SpriteEnemyTrP.prototype.update = function() {
|
||||
Sprite.prototype.update.call(this);
|
||||
this.x = this._sprite.x;
|
||||
this.y = this._sprite.y;
|
||||
if (this._iconImg.isReady()) {
|
||||
for (var i = 0; i < this._icons.length; i++) {
|
||||
if (this._icons[i].visible) {this.updateSprites(this._icons[i])};
|
||||
};
|
||||
};
|
||||
};
|
||||
3853
js/plugins/SRD_HUDMaker.js
Normal file
3853
js/plugins/SRD_HUDMaker.js
Normal file
File diff suppressed because it is too large
Load Diff
3114
js/plugins/SRD_SuperToolsEngine.js
Normal file
3114
js/plugins/SRD_SuperToolsEngine.js
Normal file
File diff suppressed because it is too large
Load Diff
928
js/plugins/TDDP_MouseSystemEx.js
Normal file
928
js/plugins/TDDP_MouseSystemEx.js
Normal file
@@ -0,0 +1,928 @@
|
||||
//=============================================================================
|
||||
// TDDP_MouseSystemEx.js
|
||||
//=============================================================================
|
||||
|
||||
var Imported = Imported || {};
|
||||
Imported.TDDP_MouseSystemEx = "1.8.2";
|
||||
|
||||
//=============================================================================
|
||||
/*:
|
||||
* @plugindesc 1.8.2 Custom mouse cursors, highlight menu items on hover, custom event mouse interaction and much more! See Help. id:TDDP_MouseSystemEx
|
||||
*
|
||||
* @author Tor Damian Design / Galenmereth
|
||||
*
|
||||
* @param ---Custom Cursor---
|
||||
* @desc This is a heading, no need to touch it.
|
||||
* @default
|
||||
*
|
||||
* @param Use Custom Cursor?
|
||||
* @desc Whether you want to use a custom mouse cursor image.
|
||||
* true => ON false => OFF
|
||||
* @default false
|
||||
*
|
||||
* @param Custom Cursor Image
|
||||
* @desc The filename for the custom cursor. It looks for this in your project's Custom Cursor Folder.
|
||||
* @default default.png
|
||||
*
|
||||
* @param Custom Cursors Folder
|
||||
* @desc The folder you wish to store the custom cursors in. Must end with a forward slash. Default: img/cursors/
|
||||
* @default img/cursors/
|
||||
*
|
||||
* @param ---Auto Change Cursors---
|
||||
* @desc Options for automatically changing the mouse cursor when hovering over events with the given event commands in them.
|
||||
* @default
|
||||
*
|
||||
* @param Show Text Cursor
|
||||
* @desc Automatically show this custom cursor image when hovering over events with Show Text commands in them.
|
||||
*
|
||||
* @param Transfer Cursor
|
||||
* @desc Automatically show this custom cursor image when hovering over events with Transfer Player commands in them.
|
||||
*
|
||||
* @param Change Gold Cursor
|
||||
* @desc Automatically show this custom cursor image when hovering over events with Change Gold commands in them.
|
||||
*
|
||||
* @param Change Items Cursor
|
||||
* @desc Automatically show this custom cursor image when hovering over events with Change Items commands in them.
|
||||
*
|
||||
* @param Change Weapons Cursor
|
||||
* @desc Automatically show this custom cursor image when hovering over events with Change Weapons commands in them.
|
||||
*
|
||||
* @param Change Armors Cursor
|
||||
* @desc Automatically show this custom cursor image when hovering over events with Change Armors commands in them.
|
||||
*
|
||||
* @param Battle Processing Cursor
|
||||
* @desc Automatically show this cursor when hovering over events with Battle Processing commands in them.
|
||||
*
|
||||
* @param ---Auto Change Icons---
|
||||
* @desc Options for automatically showing an icon when hovering over events with the given event commands in them.
|
||||
* @default
|
||||
*
|
||||
* @param Show Text Icon
|
||||
* @desc Automatically show this icon when hovering over events with Show Text commands in them.
|
||||
*
|
||||
* @param Transfer Icon
|
||||
* @desc Automatically show this icon when hovering over events with Transfer Player commands in them.
|
||||
*
|
||||
* @param Change Gold Icon
|
||||
* @desc Automatically show this icon when hovering over events with Change Gold commands in them.
|
||||
*
|
||||
* @param Change Items Icon
|
||||
* @desc Automatically show this icon when hovering over events with Change Items commands in them.
|
||||
*
|
||||
* @param Change Weapons Icon
|
||||
* @desc Automatically show this icon when hovering over events with Change Weapons commands in them.
|
||||
*
|
||||
* @param Change Armors Icon
|
||||
* @desc Automatically show this icon when hovering over events with Change Armors commands in them.
|
||||
*
|
||||
* @param Battle Processing Icon
|
||||
* @desc Automatically show this icon when hovering over events with Battle Processing commands in them.
|
||||
*
|
||||
* @param ---Hover Select---
|
||||
* @desc This is a heading, no need to touch it.
|
||||
* @default
|
||||
*
|
||||
* @param Highlight On Hover
|
||||
* @desc Highlight menu items when hovering over them with the mouse.
|
||||
* true => ON false => OFF
|
||||
* @default false
|
||||
*
|
||||
* @param Hover SE Cooldown
|
||||
* @desc Audio cooldown (in frames) between playing Cursor SE when Highlight On Hover is set to true. Default 4.
|
||||
* @default 4
|
||||
*
|
||||
* @param ---Customizeable Notetags---
|
||||
* @desc These are options for activating events by mouse interaction instead of player character.
|
||||
* @default
|
||||
*
|
||||
* @param No Auto Cursor Notetag
|
||||
* @desc The notetag used to disable auto cursor switching on this event or event page.
|
||||
* @default no_auto_cursor!
|
||||
*
|
||||
* @param No Auto Icon Notetag
|
||||
* @desc The notetag used to disable auto icon switching on this event or event page.
|
||||
* @default no_auto_icon!
|
||||
*
|
||||
* @param Click Notetag
|
||||
* @desc The notetag used to trigger the event when it is clicked on.
|
||||
* Default: click_activate!
|
||||
* @default click_activate!
|
||||
*
|
||||
* @param Hover Notetag
|
||||
* @desc The notetag used to trigger the event when the mouse is over it.
|
||||
* Default: hover_activate!
|
||||
* @default hover_activate!
|
||||
*
|
||||
* @param Leave Notetag
|
||||
* @desc The notetag used to trigger the event when the mouse leaves it.
|
||||
* Default: leave_activate!
|
||||
* @default leave_activate!
|
||||
*
|
||||
* @param ---Mouse Icons---
|
||||
* @desc This is a heading, no need to touch it.
|
||||
* @default
|
||||
*
|
||||
* @param Hide Cursor
|
||||
* @desc Hide the default mouse cursor when an icon is shown.
|
||||
* true => ON false => OFF
|
||||
* @default false
|
||||
*
|
||||
* @param Icon Offset X
|
||||
* @desc The icon's offset from the mouse horizontally.
|
||||
* Default: 9
|
||||
* @default 9
|
||||
*
|
||||
* @param Icon Offset Y
|
||||
* @desc The icon's offset from the mouse vertically.
|
||||
* Default: 14
|
||||
* @default 14
|
||||
*
|
||||
* @param ---Mouse Icon Tags---
|
||||
* @desc This is a heading, no need to touch it.
|
||||
* @default
|
||||
*
|
||||
* @param Icon Tag 1
|
||||
* @desc Set up an icon tag shortcut to be used with the Mouse Hover Icons notetag. See plugin Help for more information.
|
||||
* @default quest: 191
|
||||
*
|
||||
* @param Icon Tag 2
|
||||
* @desc Set up an icon tag shortcut to be used with the Mouse Hover Icons notetag. See plugin Help for more information.
|
||||
* @default chest: 210
|
||||
*
|
||||
* @param Icon Tag 3
|
||||
* @desc Set up an icon tag shortcut to be used with the Mouse Hover Icons notetag. See plugin Help for more information.
|
||||
* @default door: 106
|
||||
*
|
||||
* @param Icon Tag 4
|
||||
* @desc Set up an icon tag shortcut to be used with the Mouse Hover Icons notetag. See plugin Help for more information.
|
||||
* @default world_map: 190
|
||||
*
|
||||
* @param Icon Tag 5
|
||||
* @desc Set up an icon tag shortcut to be used with the Mouse Hover Icons notetag. See plugin Help for more information.
|
||||
* @default potion: 176
|
||||
*
|
||||
* @param Icon Tag 6
|
||||
* @desc Set up an icon tag shortcut to be used with the Mouse Hover Icons notetag. See plugin Help for more information.
|
||||
* @default poison: 177
|
||||
*
|
||||
* @param Icon Tag 7
|
||||
* @desc Set up an icon tag shortcut to be used with the Mouse Hover Icons notetag. See plugin Help for more information.
|
||||
* @default four_leaf_clover: 182
|
||||
*
|
||||
* @param Icon Tag 8
|
||||
* @desc Set up an icon tag shortcut to be used with the Mouse Hover Icons notetag. See plugin Help for more information.
|
||||
* @default notebook: 187
|
||||
*
|
||||
* @param Icon Tag 9
|
||||
* @desc Set up an icon tag shortcut to be used with the Mouse Hover Icons notetag. See plugin Help for more information.
|
||||
* @default letter: 192
|
||||
*
|
||||
* @param Icon Tag 10
|
||||
* @desc Set up an icon tag shortcut to be used with the Mouse Hover Icons notetag. See plugin Help for more information.
|
||||
* @default key: 195
|
||||
*
|
||||
* @param Icon Tag 11
|
||||
* @desc Set up an icon tag shortcut to be used with the Mouse Hover Icons notetag. See plugin Help for more information.
|
||||
* @default key: 195
|
||||
*
|
||||
* @param Icon Tag 12
|
||||
* @desc Set up an icon tag shortcut to be used with the Mouse Hover Icons notetag. See plugin Help for more information.
|
||||
* @default key: 195
|
||||
*
|
||||
* @param Icon Tag 13
|
||||
* @desc Set up an icon tag shortcut to be used with the Mouse Hover Icons notetag. See plugin Help for more information.
|
||||
* @default key: 195
|
||||
*
|
||||
* @param Icon Tag 14
|
||||
* @desc Set up an icon tag shortcut to be used with the Mouse Hover Icons notetag. See plugin Help for more information.
|
||||
* @default key: 195
|
||||
*
|
||||
* @param Icon Tag 15
|
||||
* @desc Set up an icon tag shortcut to be used with the Mouse Hover Icons notetag. See plugin Help for more information.
|
||||
* @default key: 195
|
||||
*
|
||||
* @help =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
|
||||
* Information
|
||||
* =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
|
||||
* TDDP - MouseSystem is a collection of methods for modifying mouse-based
|
||||
* interaction in your games. You can set custom mouse cursors, show icons beside
|
||||
* the mouse when hovering over events, activate events by mouse, and more.
|
||||
*
|
||||
* For updates and easy to use documentation, please go to the plugin's website:
|
||||
* http://mvplugins.tordamian.com/?p=26
|
||||
*
|
||||
* There you can also download a PDF of the documentation for offline use, and
|
||||
* having the documentation in one cleanly presented place means you can always
|
||||
* be sure it's the most recent available.
|
||||
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
* Terms & Conditions
|
||||
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
* This plugin is free for both non-commercial and commercial use. Please see
|
||||
* http://mvplugins.tordamian.com/terms-of-use for the full terms of use.
|
||||
*
|
||||
* A big thank you to Degica for making this plugin free for commercial use for
|
||||
* everyone!
|
||||
*/
|
||||
//=============================================================================
|
||||
// All anonymous/helper functions are registered on this object for the convenience of other plugins.
|
||||
var TDDP_MouseSystemEx = {};
|
||||
(function($) {
|
||||
"use strict";
|
||||
/**
|
||||
* Return .png if no file extension present in filename
|
||||
*/
|
||||
$._ext = function(filename) {
|
||||
if (String(filename).split(".").length > 1) {
|
||||
return filename;
|
||||
} else {
|
||||
// Default filetype extension
|
||||
return filename + ".png";
|
||||
}
|
||||
}
|
||||
//=============================================================================
|
||||
// Setting up parameters
|
||||
//=============================================================================
|
||||
var parameters = $plugins.filter(function(p){return p.description.contains("id:TDDP_MouseSystemEx")})[0].parameters;
|
||||
// Auto change cursors
|
||||
$.showTextCursor = String(parameters['Show Text Cursor']) || false;
|
||||
$.changeGoldCursor = String(parameters['Change Gold Cursor']) || false;
|
||||
$.changeItemCursor = String(parameters['Change Items Cursor']) || false;
|
||||
$.changeWeaponCursor = String(parameters['Change Weapons Cursor']) || false;
|
||||
$.changeArmorCursor = String(parameters['Change Armors Cursor']) || false;
|
||||
$.transferPlayerCursor = String(parameters['Transfer Cursor']) || false;
|
||||
$.battleProcessingCursor = String(parameters['Battle Processing Cursor']) || false;
|
||||
// Auto change icons
|
||||
$.showTextIcon = String(parameters['Show Text Icon']) || false;
|
||||
$.changeGoldIcon = String(parameters['Change Gold Icon']) || false;
|
||||
$.changeItemIcon = String(parameters['Change Items Icon']) || false;
|
||||
$.changeWeaponIcon = String(parameters['Change Weapons Icon']) || false;
|
||||
$.changeArmorIcon = String(parameters['Change Armors Icon']) || false;
|
||||
$.transferPlayerIcon = String(parameters['Transfer Icon']) || false;
|
||||
$.battleProcessingIcon = String(parameters['Battle Processing Icon']) || false;
|
||||
// Settings
|
||||
$.highlightOnHover = Boolean(parameters['Highlight On Hover'] === 'true' || false);
|
||||
$.audioCooldownOnHover = Number(parameters['Hover SE Cooldown'] || 4)
|
||||
$.hideCursor = Boolean(parameters['Hide Cursor'] === 'true' || false);
|
||||
$.iconOffsetX = Number(parameters['Icon Offset X']) || 0;
|
||||
$.iconOffsetY = Number(parameters['Icon Offset Y']) || 0;
|
||||
$.noAutoCursorNotetag = String(parameters['No Auto Cursor Notetag']);
|
||||
$.noAutoIconNotetag = String(parameters['No Auto Icon Notetag']);
|
||||
$.clickToActivateNote = String(parameters['Click Notetag']);
|
||||
$.hoverToActivateNote = String(parameters['Hover Notetag']);
|
||||
$.leaveToActivateNote = String(parameters['Leave Notetag']);
|
||||
$.useCustomCursor = Boolean(parameters['Use Custom Cursor?'] === 'true' || false);
|
||||
$.cursorImage = $._ext(String(parameters['Custom Cursor Image']));
|
||||
$.defaultCursorImage = $.cursorImage;
|
||||
$.customCursorPath = String(parameters['Custom Cursors Folder']);
|
||||
|
||||
$._cursorFilenameInUse = null; // Helper to compare changes
|
||||
$._lastUpdateFrame = 0; // Last frame cursor got updated
|
||||
$._cssClassPrefix = "TDDP_customCursor_";
|
||||
$._indexFilename = "_index.json";
|
||||
|
||||
// Add all mouse icon tags
|
||||
$.mouseIconTags = {}
|
||||
for(var i = 1; i <= 15; ++i) {
|
||||
var tag = parameters['Icon Tag ' + i]
|
||||
if (!tag) continue;
|
||||
tag = tag.split(":");
|
||||
var key = tag[0];
|
||||
var val = tag[1].replace(' ', '');
|
||||
$.mouseIconTags[key] = val;
|
||||
}
|
||||
/**
|
||||
* Load and setup the custom cursor CSS additions
|
||||
*/
|
||||
$._loadAndSetupCustomCursorCSS = function() {
|
||||
var xhr = new XMLHttpRequest();
|
||||
var url = this.customCursorPath + this._indexFilename;
|
||||
xhr.open('GET', url);
|
||||
xhr.overrideMimeType('application/json');
|
||||
xhr.onload = function() {
|
||||
if (xhr.status < 400) {
|
||||
var dummyContainerElement = document.createElement('div');
|
||||
dummyContainerElement.id = "TDD_MS_CursorDummies";
|
||||
document.body.appendChild(dummyContainerElement);
|
||||
// Next we iterate the cached cursor list
|
||||
var classPrefix = this._cssClassPrefix;
|
||||
var cachedCursors = JSON.parse(xhr.responseText);
|
||||
for (var i=0, max=cachedCursors.length; i<max; i++) {
|
||||
var cursor = cachedCursors[i];
|
||||
var cursorName = cursor.split(".")[0];
|
||||
var ox = 0;
|
||||
cursorName = cursorName.replace(/_x(\d*)/g, function(m, p1) {
|
||||
if (p1) ox = p1;
|
||||
return "";
|
||||
});
|
||||
var oy = 0;
|
||||
cursorName = cursorName.replace(/_y(\d*)/, function(m, p1){
|
||||
if (p1) oy = p1;
|
||||
return "";
|
||||
});
|
||||
var cursorPath = this.customCursorPath + cursor;
|
||||
var sheet = window.document.styleSheets[0];
|
||||
sheet.insertRule('.' + classPrefix + cursorName + ' { cursor: url(../' + cursorPath + ')' + ox + ' ' + oy + ', default; }', sheet.cssRules.length);
|
||||
// To ensure all the cursors get prefetched by browsers, we create dummy divs to hold all the styles...
|
||||
var dummyLoaderElement = document.createElement('div');
|
||||
dummyLoaderElement.id = cursorName + "_dummy";
|
||||
dummyContainerElement.appendChild(dummyLoaderElement);
|
||||
dummyLoaderElement.className = classPrefix + cursorName;
|
||||
}
|
||||
}
|
||||
}.bind(this);
|
||||
xhr.onerror = function() {
|
||||
//
|
||||
};
|
||||
xhr.send();
|
||||
}
|
||||
/**
|
||||
* Pre-cache all custom cursors when in test mode
|
||||
*/
|
||||
// Check if playtest; if so, store file. If not, read stored
|
||||
$._precacheCustomCursors = function() {
|
||||
if (StorageManager.isLocalMode() && Utils.isOptionValid('test')) {
|
||||
var fs = require('fs');
|
||||
// Find that relative local path, using MV's own methods
|
||||
var path = window.location.pathname.replace(/\/[^\/]*$/, '/' + this.customCursorPath);
|
||||
if (path.match(/^\/([A-Z]\:)/)) {
|
||||
path = path.slice(1);
|
||||
}
|
||||
path = decodeURIComponent(path);
|
||||
// Check if cursors dir exists, make if not
|
||||
if (!fs.existsSync(path)) {
|
||||
alert('TDDP MouseSystemEx\nThe chosen cursor folder "' + this.customCursorPath + '" has been created for you. Please put any custom cursor image files in this folder.');
|
||||
fs.mkdirSync(path);
|
||||
}
|
||||
// Read dir
|
||||
var files = fs.readdirSync(path).filter(function(v) {
|
||||
if(v != this._indexFilename && v[1]) return v;
|
||||
}.bind(this));
|
||||
// Store in json
|
||||
fs.writeFile(path + this._indexFilename, JSON.stringify(files), 'utf8', this._loadAndSetupCustomCursorCSS.bind(this));
|
||||
} else {
|
||||
// Read stored file
|
||||
this._loadAndSetupCustomCursorCSS();
|
||||
}
|
||||
}.apply(TDDP_MouseSystemEx);
|
||||
//=============================================================================
|
||||
// Game_Interpreter - register plugin commands
|
||||
//=============================================================================
|
||||
/**
|
||||
* Alias and extend pluginCommand
|
||||
*/
|
||||
var Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;
|
||||
Game_Interpreter.prototype.pluginCommand = function(command, args) {
|
||||
Game_Interpreter_pluginCommand.call(this, command, args)
|
||||
if (command === 'SetCustomCursor') $._setCustomCursor(args[0]);
|
||||
if (command === 'ResetCustomCursor') $._resetCustomCursor();
|
||||
};
|
||||
//=============================================================================
|
||||
// Helper functions
|
||||
//=============================================================================
|
||||
/**
|
||||
* Get events at x and y coordinates. Separate function for compatibility
|
||||
*
|
||||
* @method _eventsXy
|
||||
* @param x {Number} Map X coordinate
|
||||
* @param y {Number} Map Y coordinate
|
||||
* @return {Array} of events at given coordinates
|
||||
*/
|
||||
$._eventsXy = function(x, y) {
|
||||
return $gameMap.eventsXy(x, y);
|
||||
}
|
||||
/**
|
||||
* Show custom cursor
|
||||
*/
|
||||
$._showCustomCursor = function(filename) {
|
||||
var filename = filename || this.cursorImage;
|
||||
document.body.className = this._cssClassPrefix + filename.split(".")[0];
|
||||
}
|
||||
/**
|
||||
* Set new default custom cursor
|
||||
*/
|
||||
$._setCustomCursor = function(filename) {
|
||||
this.cursorImage = filename;
|
||||
this._showCustomCursor(TouchInput.cursorImage);
|
||||
}
|
||||
/**
|
||||
* Reset custom cursor to parameter setting defaults
|
||||
*/
|
||||
$._resetCustomCursor = function() {
|
||||
this._setCustomCursor(this.defaultCursorImage);
|
||||
}
|
||||
/**
|
||||
* Show the mouse cursor
|
||||
*/
|
||||
$._showMouseCursor = function() {
|
||||
if (this.useCustomCursor) {
|
||||
this._showCustomCursor();
|
||||
} else {
|
||||
document.body.style.cursor = 'inherit';
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Hide the mouse cursor
|
||||
*/
|
||||
$._hideMouseCursor = function() {
|
||||
document.body.style.cursor = 'none';
|
||||
}
|
||||
/**
|
||||
* Return Comments from event page. Multiline comments require an additional check (408)
|
||||
*/
|
||||
$._filterComments = function(pageListObject) {
|
||||
var comments = (pageListObject.code == 108 || pageListObject.code == 408) ? true : false;
|
||||
return comments;
|
||||
}
|
||||
/**
|
||||
* Return Show Text messages from event page
|
||||
*/
|
||||
$._filterMessages = function(pageListObject) {
|
||||
return pageListObject.code == 401;
|
||||
}
|
||||
/**
|
||||
* Return Transfer Player events from event page
|
||||
*/
|
||||
$._filterTransferPlayer = function(pageListObject) {
|
||||
return pageListObject.code == 201;
|
||||
}
|
||||
/**
|
||||
* Return Battle Processing events from event page
|
||||
*/
|
||||
$._filterBattleProcess = function(pageListObject) {
|
||||
return pageListObject.code == 301;
|
||||
}
|
||||
/**
|
||||
* Return Change Gold events from event page
|
||||
*/
|
||||
$._filterChangeGold = function(pageListObject) {
|
||||
return pageListObject.code == 125;
|
||||
}
|
||||
/**
|
||||
* Return Change Items events from event page
|
||||
*/
|
||||
$._filterChangeItems = function(pageListObject) {
|
||||
return pageListObject.code == 126;
|
||||
}
|
||||
/**
|
||||
* Return Change Weapons events from event page
|
||||
*/
|
||||
$._filterChangeWeapons = function(pageListObject) {
|
||||
return pageListObject.code == 127;
|
||||
}
|
||||
/**
|
||||
* Return Change Armors events from event page
|
||||
*/
|
||||
$._filterChangeArmors = function(pageListObject) {
|
||||
return pageListObject.code == 128;
|
||||
}
|
||||
/**
|
||||
* Check if current scene is of the type Scene_Map
|
||||
*/
|
||||
$._isSceneMap = function() {
|
||||
return (SceneManager._scene instanceof Scene_Map);
|
||||
}
|
||||
/**
|
||||
* Find a given notetag either in a game_event's Note box or Comment box on current active page
|
||||
*/
|
||||
$._findInEventNotetags = function(game_event, notetag, onMatch) {
|
||||
if (!game_event.page()) return false;
|
||||
var comments = game_event.page().list.filter(this._filterComments);
|
||||
var result = null;
|
||||
var foundMatch = false;
|
||||
var matchInString = function(string) {
|
||||
result = string.match(notetag);
|
||||
if (result !== null) {
|
||||
foundMatch = true;
|
||||
}
|
||||
}
|
||||
// First see if there's a relevant page comment, has higher priority
|
||||
if (comments.length > 0) {
|
||||
comments.forEach(function(comment) {
|
||||
if (foundMatch) return;
|
||||
matchInString(comment.parameters[0]);
|
||||
})
|
||||
}
|
||||
// If nothing found in page comment, check Note box
|
||||
if (!foundMatch) {
|
||||
if (game_event.event().note) {
|
||||
matchInString(game_event.event().note);
|
||||
}
|
||||
}
|
||||
if (foundMatch){ onMatch.call(game_event, result); }
|
||||
}
|
||||
/**
|
||||
* Arrays of pairs of cursors/icons and filters to run to check if they should be used
|
||||
*/
|
||||
$.autoCursorFilters = [
|
||||
// The order is the priority; the first match stops further lookup
|
||||
[$.battleProcessingCursor, $._filterBattleProcess],
|
||||
[$.transferPlayerCursor, $._filterTransferPlayer],
|
||||
[$.changeGoldCursor, $._filterChangeGold],
|
||||
[$.changeItemCursor, $._filterChangeItems],
|
||||
[$.changeWeaponCursor, $._filterChangeWeapons],
|
||||
[$.changeArmorCursor, $._filterChangeArmors],
|
||||
[$.showTextCursor, $._filterMessages],
|
||||
];
|
||||
$.autoIconFilters = [
|
||||
// The order is the priority; the first match stops further lookup
|
||||
[$.battleProcessingIcon, $._filterBattleProcess],
|
||||
[$.transferPlayerIcon, $._filterTransferPlayer],
|
||||
[$.changeGoldIcon, $._filterChangeGold],
|
||||
[$.changeItemIcon, $._filterChangeItems],
|
||||
[$.changeWeaponIcon, $._filterChangeWeapons],
|
||||
[$.changeArmorIcon, $._filterChangeArmors],
|
||||
[$.showTextIcon, $._filterMessages],
|
||||
];
|
||||
/**
|
||||
* Function to check whether conditions are prime to check for events under the mouse
|
||||
*/
|
||||
$.conditionsValidForMouseHoverCheck = function() {
|
||||
return (SceneManager.isCurrentSceneStarted() && this._isSceneMap() &&
|
||||
$gameMap !== null &&
|
||||
$dataMap !== null &&
|
||||
!$gameMap._interpreter.isRunning());
|
||||
}
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// START - Highlight On Hover option
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
if ($.highlightOnHover){
|
||||
//=========================================================================
|
||||
// TouchInput modifications
|
||||
//=========================================================================
|
||||
/**
|
||||
* Removing the check for whether _mousePressed is active to facilitate hover events
|
||||
*/
|
||||
TouchInput._onMouseMove = function(event) {
|
||||
var x = Graphics.pageToCanvasX(event.pageX);
|
||||
var y = Graphics.pageToCanvasY(event.pageY);
|
||||
this._onMove(x, y);
|
||||
};
|
||||
//=========================================================================
|
||||
// Window_Selectable modifications
|
||||
//=========================================================================
|
||||
/**
|
||||
* Aliased update function, adds processMouseMoved() call
|
||||
*/
|
||||
var _Window_Selectable_update = Window_Selectable.prototype.update;
|
||||
Window_Selectable.prototype.update = function() {
|
||||
this.processMouseMoved();
|
||||
_Window_Selectable_update.call(this);
|
||||
};
|
||||
/**
|
||||
* Check if conditions are right for calling onTouch when using mouse movement (for hover activation)
|
||||
*/
|
||||
Window_Selectable.prototype.processMouseMoved = function() {
|
||||
if (this.isOpenAndActive() && TouchInput.isMoved() && this.cursorIsWithinWindow()) {
|
||||
this.onTouch(false);
|
||||
}
|
||||
};
|
||||
/**
|
||||
* Check if cursor is within window
|
||||
*/
|
||||
Window_Selectable.prototype.cursorIsWithinWindow = function() {
|
||||
var _x = this.canvasToLocalX(TouchInput.x);
|
||||
var _y = this.canvasToLocalY(TouchInput.y);
|
||||
if (_x > this.padding && _x <= this.width - this.padding) {
|
||||
if (_y > this.padding && _y < this.height - this.padding) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
// SoundManager modifications
|
||||
//=============================================================================
|
||||
/*
|
||||
* Static var to keep track of last played cursor SE frame
|
||||
*/
|
||||
SoundManager._lastPlayCursorFrame = 0;
|
||||
/**
|
||||
* Aliased function to add check for whether playCursor should play, based on cooldown setting
|
||||
*/
|
||||
var _SoundManager_playCursor = SoundManager.playCursor;
|
||||
SoundManager.playCursor = function() {
|
||||
var _canPlay = SoundManager._lastPlayCursorFrame > Graphics.frameCount
|
||||
|| Graphics.frameCount > SoundManager._lastPlayCursorFrame + $.audioCooldownOnHover;
|
||||
|
||||
if (_canPlay) {
|
||||
_SoundManager_playCursor.call(this);
|
||||
SoundManager._lastPlayCursorFrame = Graphics.frameCount;
|
||||
}
|
||||
};
|
||||
}
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// END - Highlight On Hover option
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//=============================================================================
|
||||
// TouchInput modifications
|
||||
//=============================================================================
|
||||
/**
|
||||
* Alias and extend initialize() with _setupCursorIconObject()
|
||||
*/
|
||||
var _TouchInput_initialize = TouchInput.initialize;
|
||||
TouchInput.initialize = function() {
|
||||
this._setupCursorIconObject();
|
||||
_TouchInput_initialize.call(this);
|
||||
};
|
||||
/**
|
||||
* Setup cursorIcon object
|
||||
*/
|
||||
TouchInput._setupCursorIconObject = function() {
|
||||
this.cursorIcon = new Sprite();
|
||||
this.cursorIcon.drawIcon = Window_Base.prototype.drawIcon;
|
||||
this.cursorIcon.bitmap = new Bitmap(Window_Base._iconWidth, Window_Base._iconHeight);
|
||||
this.cursorIcon.contents = this.cursorIcon.bitmap;
|
||||
this.cursorIcon.iconIndex = null;
|
||||
}
|
||||
/**
|
||||
* Alias and extend _onMouseMove() to use new function _checkCursorStatus()
|
||||
*/
|
||||
var _TouchInput_onMouseMove = TouchInput._onMouseMove;
|
||||
TouchInput._onMouseMove = function(event) {
|
||||
_TouchInput_onMouseMove.call(this, event);
|
||||
this._checkCursorStatus(event.pageX, event.pageY);
|
||||
};
|
||||
/**
|
||||
* Check cursor's status and whether to alter cursor
|
||||
* @method _checkCursorStatus
|
||||
* @param pageX {Number} Mouse page X coordinate
|
||||
* @param pageY {Number} Mouse page Y coordinate
|
||||
*/
|
||||
TouchInput._checkCursorStatus = function(pageX, pageY) {
|
||||
// Check for events under mouse and perform actions, and get event in result
|
||||
var overEvents = this._checkForEventUnderMouse(pageX, pageY);
|
||||
|
||||
// Update cursor icon position
|
||||
if (this.cursorIcon.iconIndex) {
|
||||
this.cursorIcon.x = Graphics.pageToCanvasX(pageX) +
|
||||
(this.cursorIcon.customOffsetX !== null ? this.cursorIcon.customOffsetX : $.iconOffsetX);
|
||||
this.cursorIcon.y = Graphics.pageToCanvasY(pageY) +
|
||||
(this.cursorIcon.customOffsetY !== null ? this.cursorIcon.customOffsetY : $.iconOffsetY);
|
||||
this.cursorIcon.visible = true;
|
||||
}
|
||||
|
||||
// Check if leave activate is to be triggered for a previously active event
|
||||
this._activeEvents = this._activeEvents || [];
|
||||
while (this._activeEvents.length > 0) {
|
||||
var activeEvent = this._activeEvents.shift();
|
||||
if (activeEvent.TDDP_MS.leaveActivate) {
|
||||
if (!overEvents || overEvents.length == 0 || overEvents.indexOf(activeEvent) == -1) {
|
||||
activeEvent.start();
|
||||
}
|
||||
}
|
||||
}
|
||||
// Reset active events if new over events
|
||||
this._activeEvents = overEvents || this._activeEvents;
|
||||
}
|
||||
/**
|
||||
* Alias and extend update() to store last event coords for checking if cursor has left an event
|
||||
*/
|
||||
var _TouchInput_update = TouchInput.update;
|
||||
TouchInput.update = function() {
|
||||
_TouchInput_update.call(this);
|
||||
if (this._lastEventPageX == this._curEventPageX && this._lastEventPageY == this._curEventPageY) {
|
||||
this._checkCursorStatus(this._lastEventPageX, this._lastEventPageY);
|
||||
}
|
||||
this._lastEventPageX = this._curEventPageX;
|
||||
this._lastEventPageY = this._curEventPageY;
|
||||
}
|
||||
/**
|
||||
* Perform check for event under mouse and perform functions depending on parsed notetag properties
|
||||
* @method _checkForEventUnderMouse
|
||||
* @param pageX {Number} Mouse page X coordinate
|
||||
* @param pageY {Number} Mouse page Y coordinate
|
||||
* @return {Array} of found events or {Boolean} false if none.
|
||||
*/
|
||||
TouchInput._checkForEventUnderMouse = function(pageX, pageY) {
|
||||
this._curEventPageX = pageX;
|
||||
this._curEventPageY = pageY;
|
||||
if ($.conditionsValidForMouseHoverCheck()) {
|
||||
var x = $gameMap.canvasToMapX(Graphics.pageToCanvasX(pageX));
|
||||
var y = $gameMap.canvasToMapY(Graphics.pageToCanvasY(pageY));
|
||||
var events = $._eventsXy(x, y);
|
||||
events.reverse().forEach(function(game_event) {
|
||||
if (game_event.TDDP_MS.hoverIcon) {
|
||||
TouchInput._updateCursorIcon(game_event.TDDP_MS.hoverIcon);
|
||||
if ($.hideCursor) $._hideMouseCursor();
|
||||
} else {
|
||||
TouchInput._hideCursorIcon();
|
||||
};
|
||||
if (game_event.TDDP_MS.hoverActivate && !$gameMessage.isBusy()) {
|
||||
game_event.start();
|
||||
};
|
||||
if (game_event.TDDP_MS.hideCursor) {
|
||||
$._hideMouseCursor();
|
||||
};
|
||||
if (game_event.TDDP_MS.customOffsetX && game_event.TDDP_MS.customOffsetY) {
|
||||
TouchInput.cursorIcon.customOffsetX = game_event.TDDP_MS.customOffsetX;
|
||||
TouchInput.cursorIcon.customOffsetY = game_event.TDDP_MS.customOffsetY;
|
||||
};
|
||||
if ($.useCustomCursor) {
|
||||
if (game_event.TDDP_MS.customCursor) {
|
||||
$._showCustomCursor(game_event.TDDP_MS.customCursor);
|
||||
} else {
|
||||
$._showCustomCursor();
|
||||
}
|
||||
};
|
||||
if (game_event.TDDP_MS.hoverSwitch) {
|
||||
var key = [$gameMap._mapId, game_event._eventId, game_event.TDDP_MS.hoverSwitch.key]
|
||||
$gameSelfSwitches.setValue(key, game_event.TDDP_MS.hoverSwitch.val === 'true')
|
||||
};
|
||||
});
|
||||
if (events && events.length > 0) return events;
|
||||
}
|
||||
// If no events found under cursor perform default actions
|
||||
TouchInput._hideCursorIcon();
|
||||
$._showMouseCursor();
|
||||
return false;
|
||||
};
|
||||
/**
|
||||
* Update the cursor icon
|
||||
* @method _updateCursorIcon
|
||||
* @param iconIndex {Number} The icon index to show next to the cursor
|
||||
*/
|
||||
TouchInput._updateCursorIcon = function(iconIndex) {
|
||||
if (this.cursorIcon.iconIndex != iconIndex) {
|
||||
this.cursorIcon.iconIndex = iconIndex;
|
||||
this.cursorIcon.contents.clear();
|
||||
this.cursorIcon.drawIcon(iconIndex, 0, 0);
|
||||
this.cursorIcon.visible = false;
|
||||
}
|
||||
};
|
||||
/**
|
||||
* Hide the cursor icon
|
||||
* @method _hideCursorIcon
|
||||
*/
|
||||
TouchInput._hideCursorIcon = function() {
|
||||
this.cursorIcon.iconIndex = null;
|
||||
this.cursorIcon.visible = false;
|
||||
this.cursorIcon.customOffsetX = null;
|
||||
this.cursorIcon.customOffsetY = null;
|
||||
}
|
||||
/**
|
||||
* Alias and extend _onTrigger() to only fire if we're not activating on click
|
||||
*/
|
||||
var _TouchInput_onTrigger = TouchInput._onTrigger;
|
||||
TouchInput._onTrigger = function(x, y) {
|
||||
if (TouchInput._activateClickEvents(x, y)) {
|
||||
$gameTemp.clearDestination(); // Invalidate destination
|
||||
} else {
|
||||
_TouchInput_onTrigger.call(this, x, y);
|
||||
}
|
||||
};
|
||||
/**
|
||||
* Activate click events if valid and return true if so
|
||||
* @method _activateClickEvents
|
||||
* @param x {Number} Map X coordinate
|
||||
* @param y {Number} Map Y coordinate
|
||||
*/
|
||||
TouchInput._activateClickEvents = function(x, y) {
|
||||
var found_click_event = false;
|
||||
if ($.conditionsValidForMouseHoverCheck()) {
|
||||
var x = $gameMap.canvasToMapX(x);
|
||||
var y = $gameMap.canvasToMapY(y);
|
||||
$._eventsXy(x, y).reverse().forEach(function(game_event) {
|
||||
if (game_event.TDDP_MS.clickActivate) {
|
||||
game_event.start();
|
||||
found_click_event = true;
|
||||
};
|
||||
if (game_event.TDDP_MS.clickSwitch) {
|
||||
var key = [$gameMap._mapId, game_event._eventId, game_event.TDDP_MS.clickSwitch.key]
|
||||
$gameSelfSwitches.setValue(key, game_event.TDDP_MS.clickSwitch.val === 'true');
|
||||
found_click_event = true;
|
||||
};
|
||||
});
|
||||
}
|
||||
return found_click_event;
|
||||
}
|
||||
//=============================================================================
|
||||
// Spriteset_Map modifications
|
||||
//=============================================================================
|
||||
/**
|
||||
* Alias and extend createScreenSprites() to also create cursor icon holder sprite
|
||||
*/
|
||||
var _Spriteset_Map_createScreenSprites = Spriteset_Map.prototype.createScreenSprites;
|
||||
Spriteset_Map.prototype.createScreenSprites = function() {
|
||||
_Spriteset_Map_createScreenSprites.call(this);
|
||||
this.createCursorIconSprite();
|
||||
};
|
||||
/**
|
||||
* Create a container sprite for the cursor icon
|
||||
*/
|
||||
Spriteset_Map.prototype.createCursorIconSprite = function() {
|
||||
this._cursorIconSprite = new Sprite();
|
||||
this._cursorIconSprite.setFrame(0, 0, Graphics.width, Graphics.height);
|
||||
this._cursorIconSprite.addChild(TouchInput.cursorIcon);
|
||||
this.addChild(this._cursorIconSprite);
|
||||
};
|
||||
//=============================================================================
|
||||
// Game_Event modifications
|
||||
//=============================================================================
|
||||
/**
|
||||
* Alias and extend setupPage() to also setup mouse system properties
|
||||
*/
|
||||
var _Game_Event_setupPage = Game_Event.prototype.setupPage;
|
||||
Game_Event.prototype.setupPage = function() {
|
||||
_Game_Event_setupPage.call(this);
|
||||
this.setupMouseSystemProperties();
|
||||
};
|
||||
/**
|
||||
* Setup mouse system properties on events, for storing notetag parsing on page updates
|
||||
*/
|
||||
Game_Event.prototype.setupMouseSystemProperties = function() {
|
||||
this.TDDP_MS = {};
|
||||
this.TDDP_MS.hoverIcon = false;
|
||||
this.TDDP_MS.allowAutoCursor = true;
|
||||
this.TDDP_MS.allowAutoIcon = true;
|
||||
this.TDDP_MS.clickActivate = false;
|
||||
this.TDDP_MS.hoverActivate = false;
|
||||
this.TDDP_MS.leaveActivate = false;
|
||||
this.TDDP_MS.hideCursor = false;
|
||||
this.TDDP_MS.customOffsetX = false;
|
||||
this.TDDP_MS.customOffsetY = false;
|
||||
this.TDDP_MS.customCursor = false;
|
||||
this.TDDP_MS.clickSwitch = false;
|
||||
this.TDDP_MS.hoverSwitch = false;
|
||||
$._findInEventNotetags(this, /hover_icon\s(.*?);/i, function(result) {
|
||||
if (!result) return;
|
||||
result = result[result.length - 1];
|
||||
if ($.mouseIconTags[result]) {
|
||||
result = $.mouseIconTags[result];
|
||||
}
|
||||
this.TDDP_MS.hoverIcon = Number(result);
|
||||
});
|
||||
$._findInEventNotetags(this, $.noAutoCursorNotetag, function() {
|
||||
this.TDDP_MS.allowAutoCursor = false;
|
||||
});
|
||||
$._findInEventNotetags(this, $.noAutoIconNotetag, function() {
|
||||
this.TDDP_MS.allowAutoIcon = false;
|
||||
});
|
||||
$._findInEventNotetags(this, $.clickToActivateNote, function() {
|
||||
this.TDDP_MS.clickActivate = true;
|
||||
});
|
||||
$._findInEventNotetags(this, $.hoverToActivateNote, function() {
|
||||
this.TDDP_MS.hoverActivate = true;
|
||||
});
|
||||
$._findInEventNotetags(this, $.leaveToActivateNote, function() {
|
||||
this.TDDP_MS.leaveActivate = true;
|
||||
});
|
||||
$._findInEventNotetags(this, 'hide_cursor!', function() {
|
||||
this.TDDP_MS.hideCursor = true;
|
||||
});
|
||||
$._findInEventNotetags(this, /icon_offset\s(.*?)\s(.*?);/i, function(result) {
|
||||
this.TDDP_MS.customOffsetX = Number(result[1]);
|
||||
this.TDDP_MS.customOffsetY = Number(result[2]);
|
||||
});
|
||||
$._findInEventNotetags(this, /hover_cursor\s(.*?);/i, function(result) {
|
||||
this.TDDP_MS.customCursor = result[result.length - 1];
|
||||
});
|
||||
$._findInEventNotetags(this, /click_switch\s(.*?)\s(.*?);/i, function(result) {
|
||||
this.TDDP_MS.clickSwitch = {};
|
||||
this.TDDP_MS.clickSwitch.key = String(result[1]);
|
||||
this.TDDP_MS.clickSwitch.val = String(result[2]);
|
||||
|
||||
});
|
||||
$._findInEventNotetags(this, /hover_switch\s(.*?)\s(.*?);/i, function(result) {
|
||||
this.TDDP_MS.hoverSwitch = {};
|
||||
this.TDDP_MS.hoverSwitch.key = String(result[1]);
|
||||
this.TDDP_MS.hoverSwitch.val = String(result[2]);
|
||||
});
|
||||
// If no active event page, there's no event commands to go through
|
||||
if (!this.page()) return;
|
||||
// Auto cursor checks, only if there's a page and allowed
|
||||
if (this.TDDP_MS.allowAutoCursor) {
|
||||
for (var i=0, max=$.autoCursorFilters.length; i < max; i++) {
|
||||
if (this.TDDP_MS.customCursor) break;
|
||||
var entry = $.autoCursorFilters[i];
|
||||
var cursor = entry[0];
|
||||
var filter = entry[1];
|
||||
if (typeof cursor == "string") {
|
||||
var matches = this.page().list.filter(filter);
|
||||
if (matches.length > 0) {
|
||||
this.TDDP_MS.customCursor = cursor;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// Auto icon checks
|
||||
if (this.TDDP_MS.allowAutoIcon) {
|
||||
for (var i=0, max=$.autoIconFilters.length; i < max; i++) {
|
||||
if (this.TDDP_MS.hoverIcon) break;
|
||||
var entry = $.autoIconFilters[i];
|
||||
var icon = entry[0];
|
||||
var filter = entry[1];
|
||||
if (typeof icon == "string") {
|
||||
var matches = this.page().list.filter(filter);
|
||||
if (matches.length > 0) {
|
||||
if (isNaN(icon)) {
|
||||
// Icon is a string, so let's look in Icon Tags
|
||||
icon = $.mouseIconTags[icon]
|
||||
}
|
||||
this.TDDP_MS.hoverIcon = Number(icon);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})(TDDP_MouseSystemEx);
|
||||
557
js/plugins/YEP_EventMiniLabel.js
Normal file
557
js/plugins/YEP_EventMiniLabel.js
Normal file
@@ -0,0 +1,557 @@
|
||||
//=============================================================================
|
||||
// Yanfly Engine Plugins - Event Mini Label
|
||||
// YEP_EventMiniLabel.js
|
||||
//=============================================================================
|
||||
|
||||
var Imported = Imported || {};
|
||||
Imported.YEP_EventMiniLabel = true;
|
||||
|
||||
var Yanfly = Yanfly || {};
|
||||
Yanfly.EML = Yanfly.EML || {};
|
||||
Yanfly.EML.version = 1.12
|
||||
|
||||
//=============================================================================
|
||||
/*:
|
||||
* @plugindesc v1.12 Creates miniature-sized labels over events to allow
|
||||
* you to insert whatever text you'd like in them.
|
||||
* @author Yanfly Engine Plugins
|
||||
*
|
||||
* @param Default Show
|
||||
* @desc Show mini labels by default?
|
||||
* @type boolean
|
||||
* @on YES
|
||||
* @off NO
|
||||
* NO - false YES - true
|
||||
* @default true
|
||||
*
|
||||
* @param Minimum Width
|
||||
* @type number
|
||||
* @min 1
|
||||
* @desc What is the minimum width in pixels for mini labels?
|
||||
* @default 136
|
||||
*
|
||||
* @param Font Size
|
||||
* @type number
|
||||
* @min 1
|
||||
* @desc What is the font size used for text inside a mini label?
|
||||
* Default: 28
|
||||
* @default 20
|
||||
*
|
||||
* @param X Buffer
|
||||
* @type number
|
||||
* @desc Alter the X position of the label by this much.
|
||||
* @default 0
|
||||
*
|
||||
* @param Y Buffer
|
||||
* @type number
|
||||
* @desc Alter the Y position of the label by this much.
|
||||
* @default 36
|
||||
*
|
||||
* @param Battle Transition
|
||||
* @type boolean
|
||||
* @on YES
|
||||
* @off NO
|
||||
* @desc Show Event Mini label during battle transition?
|
||||
* NO - false YES - true
|
||||
* @default false
|
||||
*
|
||||
* @help
|
||||
* ============================================================================
|
||||
* Introduction
|
||||
* ============================================================================
|
||||
*
|
||||
* This plugin lets you place text above the heads of various events using a
|
||||
* miniature label through a comment tag.
|
||||
*
|
||||
* ============================================================================
|
||||
* Comment Tags
|
||||
* ============================================================================
|
||||
*
|
||||
* Comment tags are 'notetags' used within the lines of an event's comments.
|
||||
* The reason I'm using the comment tags instead of the notetags is because
|
||||
* each page of an event can yield a different potential name.
|
||||
*
|
||||
* To use this, make a comment within the event you wish to make the mini
|
||||
* label for and insert the following:
|
||||
*
|
||||
* <Mini Label: text>
|
||||
* This will display the 'text' above the event. You can use text codes for
|
||||
* this comment tag and it will create dynamic messages.
|
||||
*
|
||||
* <Mini Label Font Size: x>
|
||||
* This will change the font size used for the mini label to x. If this tag
|
||||
* isn't used, the font size will be the default value in the parameters.
|
||||
*
|
||||
* <Mini Label X Buffer: +x>
|
||||
* <Mini Label X Buffer: -x>
|
||||
* This will adjust the X buffer for the mini label by x value. If this tag
|
||||
* isn't used, the X buffer will be the default value in the parameters.
|
||||
*
|
||||
* <Mini Label Y Buffer: +x>
|
||||
* <Mini Label Y Buffer: -x>
|
||||
* This will adjust the Y buffer for the mini label by x value. If this tag
|
||||
* isn't used, the Y buffer will be the default value in the parameters.
|
||||
*
|
||||
* <Always Show Mini Label>
|
||||
* This will make the mini label to always be shown, even when the plugin
|
||||
* command to hide mini labels is used.
|
||||
*
|
||||
* <Mini Label Range: x>
|
||||
* The player will have to be within x tiles of this event in order for the
|
||||
* mini label to appear visibly.
|
||||
*
|
||||
* <Mini Label Require Facing>
|
||||
* This will require the player to be facing the direction of the event in
|
||||
* order for the mini label to appear.
|
||||
*
|
||||
* ============================================================================
|
||||
* Plugin Commands
|
||||
* ============================================================================
|
||||
*
|
||||
* If you would like to shut off the Event Mini Label mid-game or turn it on,
|
||||
* you can use the following plugin commands:
|
||||
*
|
||||
* Plugin Command:
|
||||
*
|
||||
* HideMiniLabel
|
||||
* Hides all Event Mini Label.
|
||||
*
|
||||
* ShowMiniLabel
|
||||
* Shows all Event Mini Label.
|
||||
*
|
||||
* RefreshMiniLabel
|
||||
* Refreshes all Event Mini Labels on the map.
|
||||
*
|
||||
* ============================================================================
|
||||
* Changelog
|
||||
* ============================================================================
|
||||
*
|
||||
* Version 1.12:
|
||||
* - Updated for RPG Maker MV version 1.5.0.
|
||||
*
|
||||
* Version 1.11:
|
||||
* - Added 'Battle Transition' plugin parameter. Enabling this will allow you
|
||||
* to show the Event Mini Labels during the battle transition. Keeping it
|
||||
* disabled will hide them during the transition.
|
||||
*
|
||||
* Version 1.10:
|
||||
* - Mini Windows will now readjust their size to show at normal scale if the
|
||||
* map is zoomed in.
|
||||
*
|
||||
* Version 1.09:
|
||||
* - Fixed a bug that caused Mini Labels that started off as hidden to remain
|
||||
* hidden even after turning the Mini Labels on.
|
||||
*
|
||||
* Version 1.08:
|
||||
* - Added <Mini Label Require Facing> comment tag.
|
||||
* - Moved the priority of the Mini Labels to be later added to the spriteset
|
||||
* so they can stay on top of more effects.
|
||||
*
|
||||
* Version 1.07:
|
||||
* - Added more padding space so text doesn't get cut off.
|
||||
*
|
||||
* Version 1.06:
|
||||
* - Fixed a bug that caused some mini labels to show if the event was loaded
|
||||
* onto the map without any currently active pages.
|
||||
*
|
||||
* Version 1.05:
|
||||
* - Added 'X Buffer' plugin parameter and the <Mini Label X Buffer: +x> and
|
||||
* <Mini Label X Buffer: -x> comment tags to alter the X position of the event
|
||||
* mini label.
|
||||
*
|
||||
* Version 1.04:
|
||||
* - Added 'RefreshMiniLabel' plugin command to allow you to manually refresh
|
||||
* all mini labels on the map.
|
||||
*
|
||||
* Version 1.03:
|
||||
* - Optimized updating performance to reduce lag on maps with many events.
|
||||
*
|
||||
* Version 1.01:
|
||||
* - Fixed a bug that didn't update event labels under certain page conditions.
|
||||
* - Added <Mini Label Range: x> notetag.
|
||||
*
|
||||
* Version 1.00:
|
||||
* - Finished Plugin!
|
||||
*/
|
||||
//=============================================================================
|
||||
|
||||
//=============================================================================
|
||||
// Parameter Variables
|
||||
//=============================================================================
|
||||
|
||||
Yanfly.Parameters = PluginManager.parameters('YEP_EventMiniLabel');
|
||||
Yanfly.Param = Yanfly.Param || {};
|
||||
|
||||
Yanfly.Param.EMWDefaultShow = eval(String(Yanfly.Parameters['Default Show']));
|
||||
Yanfly.Param.EMWMinWidth = Number(Yanfly.Parameters['Minimum Width']);
|
||||
Yanfly.Param.EMWFontSize = Number(Yanfly.Parameters['Font Size']);
|
||||
Yanfly.Param.EMWBufferX = Number(Yanfly.Parameters['X Buffer']);
|
||||
Yanfly.Param.EMWBufferY = Number(Yanfly.Parameters['Y Buffer']);
|
||||
Yanfly.Param.EMWBatTran = eval(String(Yanfly.Parameters['Battle Transition']));
|
||||
|
||||
//=============================================================================
|
||||
// Game_System
|
||||
//=============================================================================
|
||||
|
||||
Yanfly.EML.Game_System_initialize = Game_System.prototype.initialize;
|
||||
Game_System.prototype.initialize = function() {
|
||||
Yanfly.EML.Game_System_initialize.call(this);
|
||||
this.initEventMiniLabel();
|
||||
};
|
||||
|
||||
Game_System.prototype.initEventMiniLabel = function() {
|
||||
this._showEventMiniLabel = Yanfly.Param.EMWDefaultShow;
|
||||
};
|
||||
|
||||
Game_System.prototype.isShowEventMiniLabel = function() {
|
||||
if (this._showEventMiniLabel === undefined) this.initEventMiniLabel();
|
||||
return this._showEventMiniLabel;
|
||||
};
|
||||
|
||||
Game_System.prototype.setEventMiniLabel = function(value) {
|
||||
this._showEventMiniLabel = value;
|
||||
Game_Interpreter.prototype.refreshEventMiniLabel.call(this);
|
||||
};
|
||||
|
||||
//=============================================================================
|
||||
// Game_Interpreter
|
||||
//=============================================================================
|
||||
|
||||
Yanfly.EML.Game_Interpreter_pluginCommand =
|
||||
Game_Interpreter.prototype.pluginCommand;
|
||||
Game_Interpreter.prototype.pluginCommand = function(command, args) {
|
||||
Yanfly.EML.Game_Interpreter_pluginCommand.call(this, command, args)
|
||||
if (command === 'HideMiniLabel') $gameSystem.setEventMiniLabel(false);
|
||||
if (command === 'ShowMiniLabel') $gameSystem.setEventMiniLabel(true);
|
||||
if (command === 'RefreshMiniLabel') this.refreshEventMiniLabel();
|
||||
};
|
||||
|
||||
Game_Interpreter.prototype.refreshEventMiniLabel = function() {
|
||||
if ($gameParty.inBattle()) return;
|
||||
var scene = SceneManager._scene;
|
||||
if (scene instanceof Scene_Map) {
|
||||
scene.refreshAllMiniLabels();
|
||||
}
|
||||
};
|
||||
|
||||
//=============================================================================
|
||||
// Window_EventMiniLabel
|
||||
//=============================================================================
|
||||
|
||||
function Window_EventMiniLabel() {
|
||||
this.initialize.apply(this, arguments);
|
||||
}
|
||||
|
||||
Window_EventMiniLabel.prototype = Object.create(Window_Base.prototype);
|
||||
Window_EventMiniLabel.prototype.constructor = Window_EventMiniLabel;
|
||||
|
||||
Window_EventMiniLabel.prototype.initialize = function() {
|
||||
this._bufferX = Yanfly.Param.EMWBufferX;
|
||||
this._bufferY = Yanfly.Param.EMWBufferY;
|
||||
this._fontSize = Yanfly.Param.EMWFontSize;
|
||||
this._alwaysShow = false;
|
||||
var width = Yanfly.Param.EMWMinWidth;
|
||||
var height = this.windowHeight();
|
||||
this._range = 500;
|
||||
this._reqFacing = false;
|
||||
Window_Base.prototype.initialize.call(this, 0, 0, width, height);
|
||||
this.opacity = 0;
|
||||
this.contentsOpacity = 0;
|
||||
this._character = null;
|
||||
this._page = 0;
|
||||
this._text = '';
|
||||
};
|
||||
|
||||
Window_EventMiniLabel.prototype.standardFontSize = function() {
|
||||
if (this._fontSize !== undefined) return this._fontSize;
|
||||
return Yanfly.Param.EMWFontSize;
|
||||
};
|
||||
|
||||
Window_EventMiniLabel.prototype.windowHeight = function() {
|
||||
var height = this.fittingHeight(1)
|
||||
height = Math.max(height, 36 + this.standardPadding() * 2);
|
||||
return height;
|
||||
};
|
||||
|
||||
Window_EventMiniLabel.prototype.lineHeight = function() {
|
||||
return this.standardFontSize() + 8;
|
||||
};
|
||||
|
||||
Window_EventMiniLabel.prototype.bufferX = function() {
|
||||
if (this._bufferX !== undefined) return this._bufferX;
|
||||
return Yanfly.Param.EMWBufferX;
|
||||
};
|
||||
|
||||
Window_EventMiniLabel.prototype.bufferY = function() {
|
||||
if (this._bufferY !== undefined) return this._bufferY;
|
||||
return Yanfly.Param.EMWBufferY;
|
||||
};
|
||||
|
||||
Window_EventMiniLabel.prototype.setCharacter = function(character) {
|
||||
this.setText('');
|
||||
this._character = character;
|
||||
if (character._eventId) this.gatherDisplayData();
|
||||
};
|
||||
|
||||
Window_EventMiniLabel.prototype.gatherDisplayData = function() {
|
||||
this._page = this._character.page();
|
||||
this._pageIndex = this._character._pageIndex;
|
||||
this._range = 500;
|
||||
this._bufferY = Yanfly.Param.EMWBufferY;
|
||||
this._fontSize = Yanfly.Param.EMWFontSize;
|
||||
this._alwaysShow = false;
|
||||
this._reqFacing = false;
|
||||
if (!this._character.page()) {
|
||||
return this.visible = false;
|
||||
}
|
||||
var list = this._character.list();
|
||||
var max = list.length;
|
||||
var comment = '';
|
||||
for (var i = 0; i < max; ++i) {
|
||||
var ev = list[i];
|
||||
if ([108, 408].contains(ev.code)) comment += ev.parameters[0] + '\n';
|
||||
}
|
||||
this.extractNotedata(comment);
|
||||
};
|
||||
|
||||
Window_EventMiniLabel.prototype.extractNotedata = function(comment) {
|
||||
if (comment === '') return;
|
||||
var tag1 = /<(?:MINI WINDOW|MINI LABEL):[ ](.*)>/i;
|
||||
var tag2 = /<(?:MINI WINDOW FONT SIZE|MINI LABEL FONT SIZE):[ ](\d+)>/i;
|
||||
var tag3 = /<(?:MINI WINDOW Y BUFFER|MINI LABEL Y BUFFER):[ ]([\+\-]\d+)>/i;
|
||||
var tag4 = /<(?:ALWAYS SHOW MINI WINDOW|ALWAYS SHOW MINI LABEL)>/i;
|
||||
var tag5 = /<(?:MINI WINDOW RANGE|MINI LABEL RANGE):[ ](\d+)>/i;
|
||||
var tag6 = /<(?:MINI WINDOW X BUFFER|MINI LABEL X BUFFER):[ ]([\+\-]\d+)>/i;
|
||||
var tag7 = /<(?:MINI WINDOW REQUIRE FACING|MINI LABEL REQUIRE FACING)>/i;
|
||||
var notedata = comment.split(/[\r\n]+/);
|
||||
var text = '';
|
||||
for (var i = 0; i < notedata.length; ++i) {
|
||||
var line = notedata[i];
|
||||
if (line.match(tag1)) {
|
||||
text = String(RegExp.$1);
|
||||
} else if (line.match(tag2)) {
|
||||
this._fontSize = parseInt(RegExp.$1);
|
||||
} else if (line.match(tag3)) {
|
||||
this._bufferY = parseInt(RegExp.$1);
|
||||
} else if (line.match(tag4)) {
|
||||
this._alwaysShow = true;
|
||||
} else if (line.match(tag5)) {
|
||||
this._range = parseInt(RegExp.$1);
|
||||
} else if (line.match(tag6)) {
|
||||
this._bufferX = parseInt(RegExp.$1);
|
||||
} else if (line.match(tag7)) {
|
||||
this._reqFacing = true;
|
||||
}
|
||||
}
|
||||
this.setText(text);
|
||||
if (this._text === '' || !$gameSystem.isShowEventMiniLabel()) {
|
||||
this.visible = false;
|
||||
this.contentsOpacity = 0;
|
||||
} else {
|
||||
this.visible = true;
|
||||
if (this._reqFacing) {
|
||||
this.contentsOpacity = 0;
|
||||
} else {
|
||||
this.contentsOpacity = 255;
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
Window_EventMiniLabel.prototype.setText = function(text) {
|
||||
if (this._text === text) return;
|
||||
this._text = text;
|
||||
this.refresh();
|
||||
};
|
||||
|
||||
Window_EventMiniLabel.prototype.refresh = function() {
|
||||
if (Imported.YEP_SelfSwVar) {
|
||||
$gameTemp.setSelfSwVarEvent(this._character._mapId, this._character._eventId);
|
||||
}
|
||||
this.contents.clear();
|
||||
var txWidth = this.textWidthEx(this._text);
|
||||
txWidth += this.textPadding() * 2;
|
||||
var width = txWidth;
|
||||
this.width = Math.max(width, Yanfly.Param.EMWMinWidth);
|
||||
this.width += this.standardPadding() * 2;
|
||||
this.height = this.windowHeight();
|
||||
this.createContents();
|
||||
var wx = (this.contents.width - txWidth) / 2;
|
||||
var wy = 0;
|
||||
this.drawTextEx(this._text, wx + this.textPadding(), wy);
|
||||
if (Imported.YEP_SelfSwVar) $gameTemp.clearSelfSwVarEvent();
|
||||
};
|
||||
|
||||
Window_EventMiniLabel.prototype.forceRefresh = function() {
|
||||
this.refresh();
|
||||
this.updateOpacity();
|
||||
};
|
||||
|
||||
Window_EventMiniLabel.prototype.textWidthEx = function(text) {
|
||||
return this.drawTextEx(text, 0, this.contents.height);
|
||||
};
|
||||
|
||||
Window_EventMiniLabel.prototype.update = function() {
|
||||
Window_Base.prototype.update.call(this);
|
||||
if (!this._character) return;
|
||||
if (!this._character._eventId) return;
|
||||
this.updatePage();
|
||||
if (this._text === '') return;
|
||||
this.updateOpacity();
|
||||
};
|
||||
|
||||
Window_EventMiniLabel.prototype.updatePage = function() {
|
||||
if (this._pageIndex === this._character._pageIndex) return;
|
||||
this._pageIndex = this._character._pageIndex;
|
||||
this.contents.clear();
|
||||
this._text = '';
|
||||
this.gatherDisplayData();
|
||||
};
|
||||
|
||||
Window_EventMiniLabel.prototype.updateOpacity = function() {
|
||||
if (this.showMiniLabel()) {
|
||||
this.show();
|
||||
} else {
|
||||
this.hide();
|
||||
}
|
||||
};
|
||||
|
||||
Window_EventMiniLabel.prototype.show = function() {
|
||||
if (this.contentsOpacity >= 255) return;
|
||||
this.contentsOpacity += 16;
|
||||
this.visible = true;
|
||||
};
|
||||
|
||||
Window_EventMiniLabel.prototype.hide = function() {
|
||||
if (this.contentsOpacity <= 0) {
|
||||
if (this.visible) this.visible = false;
|
||||
return;
|
||||
}
|
||||
this.contentsOpacity -= 16;
|
||||
};
|
||||
|
||||
Window_EventMiniLabel.prototype.showMiniLabel = function() {
|
||||
if (this._alwaysShow) return true;
|
||||
if (!this.withinRange()) return false;
|
||||
if (!this.meetsFacingRequirements()) return false;
|
||||
if (!Yanfly.Param.EMWBatTran) {
|
||||
if (SceneManager._scene._encounterEffectDuration > 0) {
|
||||
this.contentsOpacity = 0;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return $gameSystem.isShowEventMiniLabel();
|
||||
};
|
||||
|
||||
Window_EventMiniLabel.prototype.withinRange = function() {
|
||||
if (this._range >= 500) return true;
|
||||
var player = $gamePlayer;
|
||||
var chara = this._character;
|
||||
if (this._range >= Math.abs(player.x - chara.x)) {
|
||||
if (this._range >= Math.abs(player.y - chara.y)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
Window_EventMiniLabel.prototype.meetsFacingRequirements = function() {
|
||||
if (!this._character) return true;
|
||||
if (!this._reqFacing) return true;
|
||||
var direction = $gamePlayer.direction();
|
||||
var playerX = $gamePlayer.x;
|
||||
var playerY = $gamePlayer.y;
|
||||
var eventX = this._character.x;
|
||||
var eventY = this._character.y;
|
||||
switch (direction) {
|
||||
case 1:
|
||||
return playerX >= eventX && playerY <= eventY;
|
||||
break;
|
||||
case 2:
|
||||
return playerY <= eventY;
|
||||
break;
|
||||
case 3:
|
||||
return playerX <= eventX && playerY <= eventY;
|
||||
break;
|
||||
case 4:
|
||||
return playerX >= eventX;
|
||||
break;
|
||||
case 6:
|
||||
return playerX <= eventX;
|
||||
break;
|
||||
case 7:
|
||||
return playerX >= eventX && playerY >= eventY;
|
||||
break;
|
||||
case 8:
|
||||
return playerY >= eventY;
|
||||
break;
|
||||
case 9:
|
||||
return playerX <= eventX && playerY >= eventY;
|
||||
break;
|
||||
default:
|
||||
return true;
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
//=============================================================================
|
||||
// Sprite_Character
|
||||
//=============================================================================
|
||||
|
||||
Yanfly.EML.Sprite_Character_update = Sprite_Character.prototype.update;
|
||||
Sprite_Character.prototype.update = function() {
|
||||
Yanfly.EML.Sprite_Character_update.call(this);
|
||||
this.updateMiniLabel();
|
||||
this.updateMiniLabelZoom();
|
||||
};
|
||||
|
||||
Sprite_Character.prototype.updateMiniLabel = function() {
|
||||
this.setupMiniLabel();
|
||||
if (!this._miniLabel) return;
|
||||
this.positionMiniLabel();
|
||||
};
|
||||
|
||||
Sprite_Character.prototype.setupMiniLabel = function() {
|
||||
if (this._miniLabel) return;
|
||||
if (!SceneManager._scene._spriteset) return;
|
||||
this._miniLabel = new Window_EventMiniLabel();
|
||||
this._miniLabel.setCharacter(this._character);
|
||||
//this.parent.parent.addChild(this._miniLabel);
|
||||
SceneManager._scene._spriteset.addChild(this._miniLabel);
|
||||
};
|
||||
|
||||
Sprite_Character.prototype.positionMiniLabel = function() {
|
||||
var win = this._miniLabel;
|
||||
var width = win.width * win.scale.x;
|
||||
win.x = this.x + width / -2 + win.bufferX();
|
||||
var height = win.height * win.scale.y;
|
||||
var buffer = win.bufferY() * win.scale.y;
|
||||
win.y = this.y + (this.height * -1) - height + buffer;
|
||||
};
|
||||
|
||||
Sprite_Character.prototype.updateMiniLabelZoom = function() {
|
||||
if (!this._miniLabel) return;
|
||||
var spriteset = SceneManager._scene._spriteset;
|
||||
this._miniLabel.scale.x = 1 / spriteset.scale.x;
|
||||
this._miniLabel.scale.y = 1 / spriteset.scale.y;
|
||||
};
|
||||
|
||||
Sprite_Character.prototype.refreshMiniLabel = function() {
|
||||
if (this._miniLabel) this._miniLabel.forceRefresh();
|
||||
};
|
||||
|
||||
//=============================================================================
|
||||
// Scene_Map
|
||||
//=============================================================================
|
||||
|
||||
Scene_Map.prototype.refreshAllMiniLabels = function() {
|
||||
var length = this._spriteset._characterSprites.length;
|
||||
for (var i = 0; i < length; ++i) {
|
||||
var sp = this._spriteset._characterSprites[i];
|
||||
sp.refreshMiniLabel();
|
||||
}
|
||||
};
|
||||
|
||||
//=============================================================================
|
||||
// End of File
|
||||
//=============================================================================
|
||||
77
js/plugins/YEP_Extra_Enemy_Drops.js
Normal file
77
js/plugins/YEP_Extra_Enemy_Drops.js
Normal file
@@ -0,0 +1,77 @@
|
||||
#Extra Enemy Drops v1.0
|
||||
#----------#
|
||||
#Features: Let's you set, via notes, more than just three item drops
|
||||
# from an enemy. Yay!
|
||||
#
|
||||
#Usage: Plug and play, customize as needed
|
||||
#
|
||||
# Enemy Notetags:
|
||||
# <DROP type id rate>
|
||||
# type is 1 for item, 2 for weapon, 3 for armor
|
||||
# id is the id of the item
|
||||
# rate is the 1/rate of the item, 20 would be 1/20 chance
|
||||
#
|
||||
# A weapon of id 3 that drops 1 out of 5 times would be:
|
||||
# <DROP 2 3 5>
|
||||
#
|
||||
#----------#
|
||||
#-- Script by: V.M of D.T
|
||||
#
|
||||
#- Questions or comments can be:
|
||||
# given by email: sumptuaryspade@live.ca
|
||||
# provided on facebook: http://www.facebook.com/DaimoniousTailsGames
|
||||
# All my other scripts and projects can be found here: http://daimonioustails.weebly.com/
|
||||
#
|
||||
#- Free to use in any project with credit given, donations always welcome!
|
||||
|
||||
#Maximum number of items that can drop from one enemy in a battle
|
||||
MAX_ENEMY_DROPS = 3
|
||||
|
||||
class RPG::Enemy
|
||||
def add_drop(type,id,rate)
|
||||
@drop_items.push(RPG::Enemy::DropItem.new)
|
||||
@drop_items[-1].kind = type
|
||||
@drop_items[-1].data_id = id
|
||||
@drop_items[-1].denominator = rate
|
||||
end
|
||||
def add_drops
|
||||
snote = self.note.clone
|
||||
while snote.include?("<DROP ")
|
||||
snote =~ /<DROP (\d+) (\d+) (\d+)>/
|
||||
add_drop($1.to_i,$2.to_i,$3.to_i)
|
||||
snote[snote.index("<DROP")] = "N"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
module DataManager
|
||||
def self.load_database
|
||||
if $BTEST
|
||||
load_battle_test_database
|
||||
else
|
||||
load_normal_database
|
||||
check_player_location
|
||||
end
|
||||
add_enemy_drops
|
||||
end
|
||||
def self.add_enemy_drops
|
||||
$data_enemies.each do |enemy|
|
||||
next if enemy.nil?
|
||||
enemy.add_drops
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
class Game_Enemy
|
||||
def make_drop_items
|
||||
iter = 0
|
||||
enemy.drop_items.inject([]) do |r, di|
|
||||
if di.kind > 0 && rand * di.denominator < drop_item_rate && iter < MAX_ENEMY_DROPS
|
||||
iter += 1
|
||||
r.push(item_object(di.kind, di.data_id))
|
||||
else
|
||||
r
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
804
js/plugins/YEP_JobPoints.js
Normal file
804
js/plugins/YEP_JobPoints.js
Normal file
@@ -0,0 +1,804 @@
|
||||
//=============================================================================
|
||||
// Yanfly Engine Plugins - Job Points
|
||||
// YEP_JobPoints.js
|
||||
//=============================================================================
|
||||
|
||||
var Imported = Imported || {};
|
||||
Imported.YEP_JobPoints = true;
|
||||
|
||||
var Yanfly = Yanfly || {};
|
||||
Yanfly.JP = Yanfly.JP || {};
|
||||
Yanfly.JP.version = 1.09;
|
||||
|
||||
//=============================================================================
|
||||
/*:
|
||||
* @plugindesc v1.09 This plugin by itself doesn't do much, but it enables
|
||||
* actors to acquire JP (job points) used for other plugins.
|
||||
* @author Yanfly Engine Plugins
|
||||
*
|
||||
* @param ---General---
|
||||
* @default
|
||||
*
|
||||
* @param JP Text
|
||||
* @parent ---General---
|
||||
* @desc This changes how you want JP to appear in the game.
|
||||
* @default JP
|
||||
*
|
||||
* @param JP Icon
|
||||
* @parent ---General---
|
||||
* @type number
|
||||
* @min 0
|
||||
* @desc This is the icon used for JP.
|
||||
* Use 0 if you wish to use no icon.
|
||||
* @default 188
|
||||
*
|
||||
* @param Max JP
|
||||
* @parent ---General---
|
||||
* @type number
|
||||
* @min 0
|
||||
* @desc This is the maximum JP an actor can have per class.
|
||||
* Use 0 if you wish to have no limit.
|
||||
* @default 0
|
||||
*
|
||||
* @param JP Per Action
|
||||
* @parent ---General---
|
||||
* @desc This is the amount of JP an actor gains for his/her
|
||||
* current class whenever he/she performs an action.
|
||||
* @default 10 + Math.randomInt(10)
|
||||
*
|
||||
* @param JP Per Level
|
||||
* @parent ---General---
|
||||
* @desc This is the amount of JP an actor gains per level up.
|
||||
* @default 100 + Math.randomInt(100)
|
||||
*
|
||||
* @param JP Per Enemy
|
||||
* @parent ---General---
|
||||
* @desc This is the amount of JP given per defeated enemy.
|
||||
* @default 50 + Math.randomInt(10)
|
||||
*
|
||||
* @param Show Results
|
||||
* @parent ---General---
|
||||
* @type boolean
|
||||
* @on Show
|
||||
* @off Hide
|
||||
* @desc Upon winning, show how much JP is earned for default?
|
||||
* NO - false YES - true
|
||||
* @default true
|
||||
*
|
||||
* @param JP Gained in Battle
|
||||
* @parent ---General---
|
||||
* @desc Adjusts how the gained JP text is shown after battle.
|
||||
* %1 - Actor %2 Value %3 JP
|
||||
* @default %1 gains %2%3!
|
||||
*
|
||||
* @param Alive Actors
|
||||
* @parent ---General---
|
||||
* @type boolean
|
||||
* @on Alive Requirement
|
||||
* @off No Requirement
|
||||
* @desc Actors must be alive to receive JP earned from enemies.
|
||||
* NO - false YES - true
|
||||
* @default true
|
||||
*
|
||||
* @param ---Menu---
|
||||
* @default
|
||||
*
|
||||
* @param Show In Menu
|
||||
* @parent ---Menu---
|
||||
* @type boolean
|
||||
* @on Show
|
||||
* @off Hide
|
||||
* @desc Display JP in the main menu?
|
||||
* NO - false YES - true
|
||||
* @default true
|
||||
*
|
||||
* @param Menu Format
|
||||
* @parent ---Menu---
|
||||
* @desc How the JP text format in the menu appears.
|
||||
* %1 - Value %2 - Amount %3 - Icon
|
||||
* @default %1\c[4]%2\c[0]%3
|
||||
*
|
||||
* @param ---Victory Aftermath---
|
||||
* @default
|
||||
*
|
||||
* @param Enable Aftermath
|
||||
* @parent ---Victory Aftermath---
|
||||
* @type boolean
|
||||
* @on Enable
|
||||
* @off Disable
|
||||
* @desc Enables Victory Aftermath windows.
|
||||
* NO - false YES - true
|
||||
* @default true
|
||||
*
|
||||
* @param Aftermath Text
|
||||
* @parent ---Victory Aftermath---
|
||||
* @desc Text used to describe how much JP is earned.
|
||||
* @default JP Earned
|
||||
*
|
||||
* @param Aftermath Format
|
||||
* @parent ---Victory Aftermath---
|
||||
* @desc How the JP text format in the aftermath appears.
|
||||
* %1 - Value %2 - Amount %3 - Icon
|
||||
* @default +%1\c[4]%2\c[0]%3
|
||||
*
|
||||
* @param Aftermath JP Earned
|
||||
* @parent ---Victory Aftermath---
|
||||
* @desc Describes how much JP is earned per actor.
|
||||
* @default JP Earned in Battle
|
||||
*
|
||||
* @help
|
||||
* ============================================================================
|
||||
* Introduction
|
||||
* ============================================================================
|
||||
*
|
||||
* This plugin by itself will not change any major game functions, but instead,
|
||||
* it works in combination with other plugins that make use of this plugin's
|
||||
* functions should you decide to incorporate Job Points into your game.
|
||||
*
|
||||
* When Job Points are earned, they are given to the actor's current class. If
|
||||
* the actor were to switch classes, then the Job Points will be changed to
|
||||
* that class's Job Points until reverted back.
|
||||
*
|
||||
* ============================================================================
|
||||
* Victory Aftermath Compatibility
|
||||
* ============================================================================
|
||||
*
|
||||
* If you have the YEP_VictoryAftermath plugin installed and wish to make use
|
||||
* of the JP windows, position this plugin lower than YEP_VictoryAftermath in
|
||||
* the Plugin Manager.
|
||||
*
|
||||
* After that, if you wish to define the timing of the JP window to appear at
|
||||
* a certain point instead of the plugin doing it automatically, insert "JP" in
|
||||
* the "Victory Order" parameter within Victory Aftermath where you want the
|
||||
* JP window to appear.
|
||||
*
|
||||
* ============================================================================
|
||||
* Notetags
|
||||
* ============================================================================
|
||||
*
|
||||
* Here are some notetags related to Job Points.
|
||||
*
|
||||
* Actor Notetags
|
||||
* <Starting JP: x>
|
||||
* Sets the actor's starting JP value to be x for the actor's initial class.
|
||||
*
|
||||
* <Class x Starting JP: y>
|
||||
* Sets the actor's starting JP value for class x to be y.
|
||||
*
|
||||
* <JP Rate: x%>
|
||||
* This changes the rate of JP gained by x%. By default, all objects have a
|
||||
* default rate of 100%. Increasing this to 200% will increase JP gained by
|
||||
* twice as much while 50% will halve the amount of JP gained.
|
||||
*
|
||||
* Skill and Item Notetags
|
||||
* <JP Gain: x>
|
||||
* This makes it so that the actor using this skill or item will gain x
|
||||
* amount of JP instead of the default amount of JP found in the parameters.
|
||||
*
|
||||
* <Target JP Gain: x>
|
||||
* This makes it so that the target actor affected by this skill or item will
|
||||
* gain x amount of JP.
|
||||
*
|
||||
* Class, Weapon, Armor, and State Notetag
|
||||
* <JP Rate: x%>
|
||||
* This changes the rate of JP gained by x%. By default, all objects have a
|
||||
* default rate of 100%. Increasing this to 200% will increase JP gained by
|
||||
* twice as much while 50% will halve the amount of JP gained.
|
||||
*
|
||||
* Enemy Notetag
|
||||
* <JP: x>
|
||||
* When the enemy is defeated, the party members present will gain x JP each.
|
||||
*
|
||||
* ============================================================================
|
||||
* Plugin Commands
|
||||
* ============================================================================
|
||||
*
|
||||
* For those wondering how to manually give, remove, or set JP for an actor,
|
||||
* you can use the following Plugin Commands.
|
||||
*
|
||||
* Plugin Commands:
|
||||
*
|
||||
* gainJp actorId jp
|
||||
* gainJp actorId jp classId
|
||||
* Replace 'actorId' with the ID of the actor you wish to change the JP of.
|
||||
* Replace 'jp' with the amount of JP you wish to alter. If you are using
|
||||
* 'classId', replace it with the ID of the actor's class you wish to alter.
|
||||
* This command will let the actor gain JP.
|
||||
*
|
||||
* loseJp actorId jp
|
||||
* loseJp actorId jp classId
|
||||
* Replace 'actorId' with the ID of the actor you wish to change the JP of.
|
||||
* Replace 'jp' with the amount of JP you wish to alter. If you are using
|
||||
* 'classId', replace it with the ID of the actor's class you wish to alter.
|
||||
* This command will cause the actor to lose JP.
|
||||
*
|
||||
* setJp actorId jp
|
||||
* setJp actorId jp classId
|
||||
* Replace 'actorId' with the ID of the actor you wish to change the JP of.
|
||||
* Replace 'jp' with the amount of JP you wish to alter. If you are using
|
||||
* 'classId', replace it with the ID of the actor's class you wish to alter.
|
||||
* This command will set the actor's JP to a particular value.
|
||||
*
|
||||
* ============================================================================
|
||||
* Changelog
|
||||
* ============================================================================
|
||||
*
|
||||
* Version 1.09:
|
||||
* - Updated for RPG Maker MV version 1.5.0.
|
||||
*
|
||||
* Version 1.08:
|
||||
* - Lunatic Mode fail safes added.
|
||||
*
|
||||
* Version 1.07:
|
||||
* - Updated for RPG Maker MV version 1.1.0.
|
||||
*
|
||||
* Version 1.06:
|
||||
* - Added 'Alive Actors' plugin parameter to prevent dead actors from gaining
|
||||
* JP from enemies. Any JP that currently dead actors earned in battle from
|
||||
* actions will still be 'earned' at the end of battle.
|
||||
*
|
||||
* Version 1.05:
|
||||
* - Updated compatibility for Subclasses gaining JP.
|
||||
*
|
||||
* Version 1.04a:
|
||||
* - Added failsafes to prevent JP from turning into NaN midbattle.
|
||||
* - Added failsafes to prevent no-target scopes from crashing the game.
|
||||
*
|
||||
* Version 1.03:
|
||||
* - Added 'Show Results' parameter to show/hide JP earned after battle for
|
||||
* those who aren't using the Victory Aftermath plugin.
|
||||
*
|
||||
* Version 1.02:
|
||||
* - Fixed a bug that would gain JP for changing classes of a higher level.
|
||||
*
|
||||
* Version 1.01:
|
||||
* - Added failsafes to prevent JP from turning into NaN.
|
||||
*
|
||||
* Version 1.00:
|
||||
* - Finished Plugin!
|
||||
*/
|
||||
//=============================================================================
|
||||
|
||||
//=============================================================================
|
||||
// Parameter Variables
|
||||
//=============================================================================
|
||||
|
||||
Yanfly.Parameters = PluginManager.parameters('YEP_JobPoints');
|
||||
Yanfly.Param = Yanfly.Param || {};
|
||||
Yanfly.Icon = Yanfly.Icon || {};
|
||||
|
||||
Yanfly.Param.Jp = String(Yanfly.Parameters['JP Text']);
|
||||
Yanfly.Icon.Jp = Number(Yanfly.Parameters['JP Icon']);
|
||||
Yanfly.Param.JpMax = Number(Yanfly.Parameters['Max JP']);
|
||||
Yanfly.Param.JpPerAction = String(Yanfly.Parameters['JP Per Action']);
|
||||
Yanfly.Param.JpPerEnemy = String(Yanfly.Parameters['JP Per Enemy']);
|
||||
Yanfly.Param.JpShowResults = eval(String(Yanfly.Parameters['Show Results']));
|
||||
Yanfly.Param.JpTextFormat = String(Yanfly.Parameters['JP Gained in Battle']);
|
||||
Yanfly.Param.JpAliveActors = eval(String(Yanfly.Parameters['Alive Actors']));
|
||||
|
||||
Yanfly.Param.JpShowMenu = String(Yanfly.Parameters['Show In Menu']);
|
||||
Yanfly.Param.JpShowMenu = eval(Yanfly.Param.JpShowMenu);
|
||||
Yanfly.Param.JpMenuFormat = String(Yanfly.Parameters['Menu Format']);
|
||||
|
||||
Yanfly.Param.JpPerLevel = String(Yanfly.Parameters['JP Per Level']);
|
||||
Yanfly.Param.JpEnableAftermath = String(Yanfly.Parameters['Enable Aftermath']);
|
||||
Yanfly.Param.JpAftermathText = String(Yanfly.Parameters['Aftermath Text']);
|
||||
Yanfly.Param.JpAftermathFmt = String(Yanfly.Parameters['Aftermath Format']);
|
||||
Yanfly.Param.JpAftermathEarn = String(Yanfly.Parameters['Aftermath JP Earned']);
|
||||
|
||||
//=============================================================================
|
||||
// DataManager
|
||||
//=============================================================================
|
||||
|
||||
Yanfly.JP.DataManager_isDatabaseLoaded = DataManager.isDatabaseLoaded;
|
||||
DataManager.isDatabaseLoaded = function() {
|
||||
if (!Yanfly.JP.DataManager_isDatabaseLoaded.call(this)) return false;
|
||||
if (!Yanfly._loaded_YEP_JobPoints) {
|
||||
this.processJPNotetags1($dataActors);
|
||||
this.processJPNotetags2($dataSkills);
|
||||
this.processJPNotetags2($dataItems);
|
||||
this.processJPNotetags3($dataEnemies);
|
||||
this.processJPNotetags4($dataClasses);
|
||||
this.processJPNotetags4($dataWeapons);
|
||||
this.processJPNotetags4($dataArmors);
|
||||
this.processJPNotetags4($dataStates);
|
||||
Yanfly._loaded_YEP_JobPoints = true;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
DataManager.processJPNotetags1 = function(group) {
|
||||
var note1 = /<(?:STARTING JP):[ ](\d+)>/i;
|
||||
var note2 = /<(?:CLASS)[ ](\d+)[ ](?:STARTING JP):[ ](\d+)>/i;
|
||||
var note3 = /<(?:JP RATE):[ ](\d+)([%%])>/i;
|
||||
for (var n = 1; n < group.length; n++) {
|
||||
var obj = group[n];
|
||||
var notedata = obj.note.split(/[\r\n]+/);
|
||||
|
||||
obj.startingJp = {};
|
||||
obj.jpRate = 1.0;
|
||||
|
||||
for (var i = 0; i < notedata.length; i++) {
|
||||
var line = notedata[i];
|
||||
if (line.match(note1)) {
|
||||
obj.startingJp[obj.classId] = parseInt(RegExp.$1);
|
||||
} else if (line.match(note2)) {
|
||||
obj.startingJp[parseInt(RegExp.$1)] = parseInt(RegExp.$2);
|
||||
} else if (line.match(note3)) {
|
||||
obj.jpRate = parseFloat(RegExp.$1 * 0.01);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
DataManager.processJPNotetags2 = function(group) {
|
||||
var note1 = /<(?:GAIN JP|JP GAIN):[ ](\d+)>/i;
|
||||
var note2 = /<(?:TARGET GAIN JP|TARGET JP GAIN):[ ](\d+)>/i;
|
||||
for (var n = 1; n < group.length; n++) {
|
||||
var obj = group[n];
|
||||
var notedata = obj.note.split(/[\r\n]+/);
|
||||
|
||||
obj.gainJp = Yanfly.Param.JpPerAction;
|
||||
obj.targetGainJp = 0;
|
||||
|
||||
for (var i = 0; i < notedata.length; i++) {
|
||||
var line = notedata[i];
|
||||
if (line.match(note1)) {
|
||||
obj.gainJp = parseInt(RegExp.$1);
|
||||
} else if (line.match(note2)) {
|
||||
obj.targetGainJp = parseInt(RegExp.$1);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
DataManager.processJPNotetags3 = function(group) {
|
||||
var note1 = /<(?:JP):[ ](\d+)>/i;
|
||||
for (var n = 1; n < group.length; n++) {
|
||||
var obj = group[n];
|
||||
var notedata = obj.note.split(/[\r\n]+/);
|
||||
|
||||
obj.jp = Yanfly.Param.JpPerEnemy;
|
||||
|
||||
for (var i = 0; i < notedata.length; i++) {
|
||||
var line = notedata[i];
|
||||
if (line.match(note1)) {
|
||||
obj.jp = parseInt(RegExp.$1);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
DataManager.processJPNotetags4 = function(group) {
|
||||
var note1 = /<(?:JP RATE):[ ](\d+)([%%])>/i;
|
||||
for (var n = 1; n < group.length; n++) {
|
||||
var obj = group[n];
|
||||
var notedata = obj.note.split(/[\r\n]+/);
|
||||
|
||||
obj.jpRate = 1.0;
|
||||
|
||||
for (var i = 0; i < notedata.length; i++) {
|
||||
var line = notedata[i];
|
||||
if (line.match(note1)) {
|
||||
obj.jpRate = parseFloat(RegExp.$1 * 0.01);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
//=============================================================================
|
||||
// BattleManager
|
||||
//=============================================================================
|
||||
|
||||
Yanfly.JP.BattleManager_makeRewards = BattleManager.makeRewards;
|
||||
BattleManager.makeRewards = function() {
|
||||
Yanfly.JP.BattleManager_makeRewards.call(this);
|
||||
this._rewards.jp = $gameTroop.jpTotal();
|
||||
this.gainJp();
|
||||
};
|
||||
|
||||
BattleManager.gainJp = function() {
|
||||
var jp = $gameTroop.jpTotal();
|
||||
$gameMessage.newPage();
|
||||
if (Yanfly.Param.JpAliveActors) {
|
||||
var members = $gameParty.aliveMembers();
|
||||
} else {
|
||||
var members = $gameParty.members();
|
||||
}
|
||||
members.forEach(function(actor) {
|
||||
actor.gainJp(jp);
|
||||
});
|
||||
};
|
||||
|
||||
Yanfly.JP.BattleManager_displayRewards = BattleManager.displayRewards;
|
||||
BattleManager.displayRewards = function() {
|
||||
Yanfly.JP.BattleManager_displayRewards.call(this);
|
||||
this.displayJpGain();
|
||||
};
|
||||
|
||||
BattleManager.displayJpGain = function() {
|
||||
if (!Yanfly.Param.JpShowResults) return;
|
||||
var jp = $gameTroop.jpTotal();
|
||||
$gameMessage.newPage();
|
||||
$gameParty.members().forEach(function(actor) {
|
||||
var fmt = Yanfly.Param.JpTextFormat;
|
||||
var text = fmt.format(actor.name(), Yanfly.Util.toGroup(actor.battleJp()),
|
||||
Yanfly.Param.Jp);
|
||||
$gameMessage.add('\\.' + text);
|
||||
});
|
||||
};
|
||||
|
||||
//=============================================================================
|
||||
// Game_Battler
|
||||
//=============================================================================
|
||||
|
||||
Yanfly.JP.Game_Battler_useItem = Game_Battler.prototype.useItem;
|
||||
Game_Battler.prototype.useItem = function(item) {
|
||||
Yanfly.JP.Game_Battler_useItem.call(this, item);
|
||||
if (!$gameParty.inBattle()) return;
|
||||
if (this.isActor()) this.gainJp(eval(item.gainJp), this.currentClass().id);
|
||||
};
|
||||
|
||||
Yanfly.JP.Game_Battler_onBattleStart = Game_Battler.prototype.onBattleStart;
|
||||
Game_Battler.prototype.onBattleStart = function() {
|
||||
Yanfly.JP.Game_Battler_onBattleStart.call(this);
|
||||
this._battleJp = 0;
|
||||
};
|
||||
|
||||
Yanfly.JP.Game_Battler_onBattleEnd = Game_Battler.prototype.onBattleEnd;
|
||||
Game_Battler.prototype.onBattleEnd = function() {
|
||||
Yanfly.JP.Game_Battler_onBattleEnd.call(this);
|
||||
this._battleJp = 0;
|
||||
};
|
||||
|
||||
//=============================================================================
|
||||
// Game_Actor
|
||||
//=============================================================================
|
||||
|
||||
Yanfly.JP.Game_Actor_setup = Game_Actor.prototype.setup;
|
||||
Game_Actor.prototype.setup = function(actorId) {
|
||||
Yanfly.JP.Game_Actor_setup.call(this, actorId);
|
||||
this.initJp();
|
||||
};
|
||||
|
||||
Game_Actor.prototype.jp = function(classId) {
|
||||
if (!this._jp) this.initJp();
|
||||
if (!this._jp) return 0;
|
||||
if (classId === undefined) classId = this.currentClass().id;
|
||||
if (!this._jp[classId]) this._jp[classId] = 0;
|
||||
return this._jp[classId];
|
||||
};
|
||||
|
||||
Game_Actor.prototype.initJp = function() {
|
||||
var actor = this.actor();
|
||||
for (var i = 0; i < $dataClasses.length; i++) {
|
||||
if (actor.startingJp) {
|
||||
var jp = actor.startingJp[i] || 0;
|
||||
this.setJp(jp, i);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Game_Actor.prototype.setJp = function(value, classId) {
|
||||
value = parseInt(value);
|
||||
if (value === NaN) value = 0;
|
||||
classId = classId || this.currentClass().id;
|
||||
if (!this._jp) this._jp = {};
|
||||
if (!this._jp[classId]) this._jp[classId] = 0;
|
||||
this._jp[classId] = Math.max(0, value);
|
||||
if (Yanfly.Param.JpMax > 0) {
|
||||
this._jp[classId] = Math.min(Yanfly.Param.JpMax, value);
|
||||
}
|
||||
};
|
||||
|
||||
Game_Actor.prototype.jpRate = function() {
|
||||
var rate = 1.0;
|
||||
rate *= this.actor().jpRate;
|
||||
rate *= this.currentClass().jpRate;
|
||||
var equips = this.equips();
|
||||
for (var i = 0; i < equips.length; i++) {
|
||||
var item = equips[i];
|
||||
if (item) rate *= item.jpRate;
|
||||
}
|
||||
var states = this.states();
|
||||
for (var i = 0; i < states.length; i++) {
|
||||
var state = states[i];
|
||||
if (state) rate *= state.jpRate;
|
||||
}
|
||||
return rate;
|
||||
};
|
||||
|
||||
Game_Actor.prototype.gainJp = function(value, classId) {
|
||||
value = parseInt(value);
|
||||
if (value === NaN) value = 0;
|
||||
classId = classId || this.currentClass().id;
|
||||
value = Math.floor(value * this.jpRate());
|
||||
if ($gameParty.inBattle()) {
|
||||
this._battleJp = this._battleJp || 0;
|
||||
this._battleJp += value;
|
||||
}
|
||||
this.setJp(this.jp(classId) + value, classId);
|
||||
if (classId === this.currentClass().id && this.isSublcassEarnJp()) {
|
||||
this.gainJpSubclass(value);
|
||||
}
|
||||
};
|
||||
|
||||
Game_Actor.prototype.isSublcassEarnJp = function() {
|
||||
if (!Imported.YEP_X_Subclass) return false;
|
||||
if (!this.subclass()) return false;
|
||||
return Yanfly.Param.SubclassJp;
|
||||
};
|
||||
|
||||
Game_Actor.prototype.gainJpSubclass = function(value) {
|
||||
var classId = this.subclass().id;
|
||||
value = Math.round(value * Yanfly.Param.SubclassJp);
|
||||
this.setJp(this.jp(classId) + value, classId);
|
||||
};
|
||||
|
||||
Game_Actor.prototype.loseJp = function(value, classId) {
|
||||
classId = classId || this.currentClass().id;
|
||||
this.setJp(this.jp(classId) - value, classId);
|
||||
};
|
||||
|
||||
Game_Actor.prototype.battleJp = function() {
|
||||
this._battleJp = this._battleJp || 0;
|
||||
return this._battleJp;
|
||||
};
|
||||
|
||||
Yanfly.JP.Game_Actor_changeClass = Game_Actor.prototype.changeClass;
|
||||
Game_Actor.prototype.changeClass = function(classId, keepExp) {
|
||||
this._preventJpLevelUpGain = true;
|
||||
Yanfly.JP.Game_Actor_changeClass.call(this, classId, keepExp);
|
||||
this._preventJpLevelUpGain = false;
|
||||
};
|
||||
|
||||
Yanfly.JP.Game_Actor_levelUp = Game_Actor.prototype.levelUp;
|
||||
Game_Actor.prototype.levelUp = function() {
|
||||
Yanfly.JP.Game_Actor_levelUp.call(this);
|
||||
if (this._preventJpLevelUpGain) return;
|
||||
var user = this;
|
||||
var target = this;
|
||||
var a = this;
|
||||
var b = this;
|
||||
var level = this.level;
|
||||
var code = Yanfly.Param.JpPerLevel;
|
||||
try {
|
||||
var value = eval(code)
|
||||
} catch (e) {
|
||||
var value = 0;
|
||||
Yanfly.Util.displayError(e, code, 'LEVEL UP JP FORMULA ERROR');
|
||||
}
|
||||
this.gainJp(value, this.currentClass().id);
|
||||
};
|
||||
|
||||
//=============================================================================
|
||||
// Game_Enemy
|
||||
//=============================================================================
|
||||
|
||||
Game_Enemy.prototype.jp = function() {
|
||||
var user = this;
|
||||
var target = this;
|
||||
var a = this;
|
||||
var b = this;
|
||||
var code = this.enemy().jp;
|
||||
try {
|
||||
return eval(code);
|
||||
} catch (e) {
|
||||
Yanfly.Util.displayError(e, code, 'ENEMY JP FORMULA ERROR');
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
||||
//=============================================================================
|
||||
// Game_Action
|
||||
//=============================================================================
|
||||
|
||||
Yanfly.JP.Game_Action_applyItemUserEffect =
|
||||
Game_Action.prototype.applyItemUserEffect;
|
||||
Game_Action.prototype.applyItemUserEffect = function(target) {
|
||||
Yanfly.JP.Game_Action_applyItemUserEffect.call(this, target);
|
||||
if (target) this.applyItemJpEffect(target);
|
||||
};
|
||||
|
||||
Game_Action.prototype.applyItemJpEffect = function(target) {
|
||||
var item = this.item();
|
||||
if (!item) return;
|
||||
if (target.isActor()) target.gainJp(item.targetGainJp);
|
||||
};
|
||||
|
||||
Yanfly.JP.Game_Action_hasItemAnyValidEffects =
|
||||
Game_Action.prototype.hasItemAnyValidEffects;
|
||||
Game_Action.prototype.hasItemAnyValidEffects = function(target) {
|
||||
var item = this.item();
|
||||
if (!item) return;
|
||||
if (target.isActor() && item.targetGainJp !== 0) return true;
|
||||
return Yanfly.JP.Game_Action_hasItemAnyValidEffects.call(this, target);
|
||||
};
|
||||
|
||||
//=============================================================================
|
||||
// Game_Troop
|
||||
//=============================================================================
|
||||
|
||||
Game_Troop.prototype.jpTotal = function() {
|
||||
return this.deadMembers().reduce(function(r, enemy) {
|
||||
return r + enemy.jp();
|
||||
}, 0);
|
||||
};
|
||||
|
||||
//=============================================================================
|
||||
// Game_Interpreter
|
||||
//=============================================================================
|
||||
|
||||
Yanfly.JP.Game_Interpreter_pluginCommand =
|
||||
Game_Interpreter.prototype.pluginCommand;
|
||||
Game_Interpreter.prototype.pluginCommand = function(command, args) {
|
||||
Yanfly.JP.Game_Interpreter_pluginCommand.call(this, command, args)
|
||||
if (command === 'gainJp') this.modifyJp('gain', args);
|
||||
if (command === 'loseJp') this.modifyJp('lose', args);
|
||||
if (command === 'setJp') this.modifyJp('set', args);
|
||||
};
|
||||
|
||||
Game_Interpreter.prototype.modifyJp = function(type, args) {
|
||||
if (!args) return;
|
||||
var actorId = parseInt(args[0]);
|
||||
var actor = $gameActors.actor(actorId);
|
||||
var jpValue = args[1] || 0;
|
||||
jpValue = parseInt(jpValue);
|
||||
var classId = args[2] || 0;
|
||||
classId = parseInt(classId);
|
||||
if (jpValue <= 0) return;
|
||||
if (classId <= 0) classId = actor.currentClass().id;
|
||||
if (type === 'gain') {
|
||||
actor.gainJp(jpValue, classId);
|
||||
} else if (type === 'lose') {
|
||||
actor.loseJp(jpValue, classId);
|
||||
} else if (type === 'set') {
|
||||
actor.setJp(jpValue, classId);
|
||||
}
|
||||
};
|
||||
|
||||
//=============================================================================
|
||||
// Window_Base
|
||||
//=============================================================================
|
||||
|
||||
Yanfly.JP.Window_Base_dASS = Window_Base.prototype.drawActorSimpleStatus;
|
||||
Window_Base.prototype.drawActorSimpleStatus = function(actor, wx, wy, ww) {
|
||||
this._drawMenuJP = Yanfly.Param.JpShowMenu;
|
||||
Yanfly.JP.Window_Base_dASS.call(this, actor, wx, wy, ww);
|
||||
this._drawMenuJP = undefined;
|
||||
};
|
||||
|
||||
Yanfly.JP.Window_Base_drawActorClass = Window_Base.prototype.drawActorClass;
|
||||
Window_Base.prototype.drawActorClass = function(actor, wx, wy, ww) {
|
||||
ww = ww || 168;
|
||||
Yanfly.JP.Window_Base_drawActorClass.call(this, actor, wx, wy, ww);
|
||||
if (!this._drawMenuJP) return;
|
||||
var classId = actor.currentClass().id;
|
||||
this.drawActorJp(actor, classId, wx, wy, ww, 'right');
|
||||
};
|
||||
|
||||
Window_Base.prototype.drawActorJp = function(actor, id, wx, wy, ww, align) {
|
||||
var jp = actor.jp(id);
|
||||
var icon = '\\i[' + Yanfly.Icon.Jp + ']';
|
||||
var fmt = Yanfly.Param.JpMenuFormat;
|
||||
var text = fmt.format(Yanfly.Util.toGroup(jp), Yanfly.Param.Jp, icon);
|
||||
if (align === 'left') {
|
||||
wx = 0;
|
||||
} else if (align === 'center') {
|
||||
wx += (ww - this.textWidthEx(text)) / 2;
|
||||
} else {
|
||||
wx += ww - this.textWidthEx(text);
|
||||
}
|
||||
this.drawTextEx(text, wx, wy);
|
||||
};
|
||||
|
||||
Window_Base.prototype.textWidthEx = function(text) {
|
||||
return this.drawTextEx(text, 0, this.contents.height);
|
||||
};
|
||||
|
||||
//=============================================================================
|
||||
// Window_VictoryJp
|
||||
//=============================================================================
|
||||
|
||||
if (Imported.YEP_VictoryAftermath && Yanfly.Param.JpEnableAftermath) {
|
||||
|
||||
function Window_VictoryJp() {
|
||||
this.initialize.apply(this, arguments);
|
||||
}
|
||||
|
||||
Window_VictoryJp.prototype = Object.create(Window_VictoryExp.prototype);
|
||||
Window_VictoryJp.prototype.constructor = Window_VictoryJp;
|
||||
|
||||
Window_VictoryJp.prototype.drawActorGauge = function(actor, index) {
|
||||
this.clearGaugeRect(index);
|
||||
var rect = this.gaugeRect(index);
|
||||
this.changeTextColor(this.normalColor());
|
||||
this.drawActorName(actor, rect.x + 2, rect.y);
|
||||
this.drawLevel(actor, rect);
|
||||
this.drawJpGained(actor, rect);
|
||||
};
|
||||
|
||||
Window_VictoryJp.prototype.drawJpGained = function(actor, rect) {
|
||||
var wy = rect.y + this.lineHeight() * 1;
|
||||
this.changeTextColor(this.systemColor());
|
||||
this.drawText(Yanfly.Param.JpAftermathEarn, rect.x + 2, wy, rect.width - 4,
|
||||
'left');
|
||||
var bonusJp = 1.0 * actor.battleJp() * this._tick /
|
||||
Yanfly.Param.VAGaugeTicks;
|
||||
var value = Yanfly.Util.toGroup(parseInt(bonusJp));
|
||||
var fmt = Yanfly.Param.JpAftermathFmt;
|
||||
var icon = '\\i[' + Yanfly.Icon.Jp + ']';
|
||||
var JpText = fmt.format(value, Yanfly.Param.Jp, icon);
|
||||
this.changeTextColor(this.normalColor());
|
||||
wx = rect.x + rect.width - this.textWidthEx(JpText);
|
||||
this.drawTextEx(JpText, wx, wy);
|
||||
};
|
||||
|
||||
//=============================================================================
|
||||
// Scene_Battle
|
||||
//=============================================================================
|
||||
|
||||
Yanfly.JP.Scene_Battle_addCustomVictorySteps =
|
||||
Scene_Battle.prototype.addCustomVictorySteps;
|
||||
Scene_Battle.prototype.addCustomVictorySteps = function(array) {
|
||||
array = Yanfly.JP.Scene_Battle_addCustomVictorySteps.call(this, array);
|
||||
if (!array.contains('JP')) array.push('JP');
|
||||
return array;
|
||||
};
|
||||
|
||||
Yanfly.JP.Scene_Battle_updateVictorySteps =
|
||||
Scene_Battle.prototype.updateVictorySteps;
|
||||
Scene_Battle.prototype.updateVictorySteps = function() {
|
||||
Yanfly.JP.Scene_Battle_updateVictorySteps.call(this);
|
||||
if (this.isVictoryStep('JP')) this.updateVictoryJp();
|
||||
};
|
||||
|
||||
Scene_Battle.prototype.updateVictoryJp = function() {
|
||||
if (!this._victoryJpWindow) {
|
||||
this.createVictoryJp();
|
||||
} else if (this._victoryJpWindow.isReady()) {
|
||||
if (this.victoryTriggerContinue()) this.finishVictoryJp();
|
||||
}
|
||||
};
|
||||
|
||||
Scene_Battle.prototype.createVictoryJp = function() {
|
||||
this._victoryTitleWindow.refresh(Yanfly.Param.JpAftermathText);
|
||||
this._victoryJpWindow = new Window_VictoryJp();
|
||||
this.addWindow(this._victoryJpWindow);
|
||||
this._victoryJpWindow.open();
|
||||
};
|
||||
|
||||
Scene_Battle.prototype.finishVictoryJp = function() {
|
||||
SoundManager.playOk();
|
||||
this._victoryJpWindow.close();
|
||||
this.processNextVictoryStep();
|
||||
};
|
||||
|
||||
}; // Imported.YEP_VictoryAftermath
|
||||
|
||||
//=============================================================================
|
||||
// Utilities
|
||||
//=============================================================================
|
||||
|
||||
Yanfly.Util = Yanfly.Util || {};
|
||||
|
||||
if (!Yanfly.Util.toGroup) {
|
||||
Yanfly.Util.toGroup = function(inVal) {
|
||||
return inVal;
|
||||
}
|
||||
};
|
||||
|
||||
Yanfly.Util.displayError = function(e, code, message) {
|
||||
console.log(message);
|
||||
console.log(code || 'NON-EXISTENT');
|
||||
console.error(e);
|
||||
if (Utils.isNwjs() && Utils.isOptionValid('test')) {
|
||||
if (!require('nw.gui').Window.get().isDevToolsOpen()) {
|
||||
require('nw.gui').Window.get().showDevTools();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
//=============================================================================
|
||||
// End of File
|
||||
//=============================================================================
|
||||
Reference in New Issue
Block a user