Code:
#==============================================================================
# ** Moonpearl Patch for Multi-Slots!
#------------------------------------------------------------------------------
# by DerVVulfman
# version 1.0
# 05-22-2016 (mm/dd/yyyy
# RGSS / RMXP - Involves and requires Rewrites
#==============================================================================
#
# INTRODUCTION:
#
# This patch allows the Multi-Slots system to work with the Animated Custom
# Menu created by Moonpearl. Due to Moonpearl's recreation of certain scene
# classes, this script does require some editing by the end user.
#
#
#------------------------------------------------------------------------------
#
# INSTRUCTIONS:
#
# Install Multi-Slots in all its parts below Moonpearl's Animated Custom Menu
# System, and this patch below both.
#
# After that, youw will need to perform direct edits Multi-Slots as MoonPearl
# changed all the Scene_Classes of the default scripts.
#
# First, you will need to go to line 124 of 'mSlots (Scenes)' and attach the
# appelation of " < Scene_Base" to the end of the class name:
# In otherwords, it should now read: class Scene_Equip < Scene_Base
#
# Then, you will need to add the same " < Scene_Base" to the end of the class
# name on line 746 (class Scene_Battle < Scene_Base).
#
# NOTE: This application of 'Scene_Base' to Scene class scripts is required
# if using any Scene-altering script with Moonpearl scripts.
#
#------------------------------------------------------------------------------
#
# KNOWN ISSUES:
#
# The system isn't 100% clean. While I loathe to rewrite code, it was needed
# in order to make certain things function properly. The primary worry relate
# to the refresh method in Window_EquipLeft and the update_item method within
# Scene_Equip.
#
# Whole most windows will glide off-screen when exiting the Equipment menu,
# the Optimization option window and item windows that contain items beyond
# the normal 5 slot range remain until the Equipment menu exits. It is not
# understood as to why this cannot be fixed. The use of the 'set_move_from'
# method refused to function for some odd reason.
#
#------------------------------------------------------------------------------
#
# CONFLICTS:
#
# Within the Window_EquipLeft class, it actively rewrites the initialize,
# refresh and draw_parameters methods.
#
# It actively rewrites the type method within Window_EquipRight.
#
# It actively rewrites the initialize within both Window_EquipItem and
# Window_EquipControl
#
# It rewrites both the update_optimize_removal_active and update_item methods
# within Scene_Equip.
#
#
#==============================================================================
#==============================================================================
# ** Window_EquipLeft
#------------------------------------------------------------------------------
# This window displays actor parameter changes on the equipment screen.
#==============================================================================
class Window_EquipLeft < Window_Base
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :mode
attr_accessor :changes
#--------------------------------------------------------------------------
# * Object Initialization
# actor : actor
#--------------------------------------------------------------------------
def initialize(actor)
super(16, 144, 288, 128)
self.contents = Bitmap.new(width - 32, height - 32)
self.z += 100
@actor = actor
@mode = 0
@changes = [0, 0, 0, 0, 0, 0, 0, 0]
@elem_text = ""
@stat_text = ""
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
draw_actor_parameter(@actor, 4, 0, 0)
draw_actor_parameter(@actor, 4, 32, 1)
draw_actor_parameter(@actor, 4, 64, 2)
draw_parameter(0, @new_atk, 0) if @new_atk != nil
draw_parameter(1, @new_pdef, 32) if @new_pdef != nil
draw_parameter(2, @new_mdef, 64) if @new_mdef != nil
end
#--------------------------------------------------------------------------
# * Set parameters after changing equipment
# index : index value for the changes array
# value : numeric value of changed parameter
# y : y-position of changed text parameter
#--------------------------------------------------------------------------
def draw_parameter(index, value, y )
self.contents.font.color = system_color
if @changes[index] == 0
self.contents.blt(168, y, ICON_ARROW_SAME, Rect.new(0, 0, 24, 24))
self.contents.font.color = normal_color
elsif @changes[index] == -1
self.contents.blt(168, y, ICON_ARROW_DOWN, Rect.new(0, 0, 24, 24))
self.contents.font.color = MSlots::COLOR_DOWN
else
self.contents.blt(168, y, ICON_ARROW_UP, Rect.new(0, 0, 24, 24))
self.contents.font.color = MSlots::COLOR_UP
end
self.contents.draw_text(200, y, 36, 32, value.to_s, 2)
end
end
#==============================================================================
# ** Window_EquipRight
#------------------------------------------------------------------------------
# This window displays items the actor is currently equipped with on the
# equipment screen.
#==============================================================================
class Window_EquipRight < Window_Selectable
#--------------------------------------------------------------------------
# * Get the type
#--------------------------------------------------------------------------
def type
return if @actor.nil?
self.index = @equip_type.size - 1 if self.index >= @equip_type.size
return @equip_type[self.index]
end
end
#==============================================================================
# ** Window_EquipItem
#------------------------------------------------------------------------------
# This window displays choices when opting to change equipment on the
# equipment screen.
#==============================================================================
class Window_EquipItem < Window_Selectable
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :item_max
attr_accessor :column_max
attr_accessor :index
#--------------------------------------------------------------------------
# * Object Initialization
# actor : actor
# equip_type : equip region (0-3)
#--------------------------------------------------------------------------
def initialize(actor, equip_type)
super(336, 304, 288, 160)
@actor = actor
@equip_type = equip_type
@column_max = 1
refresh
self.active = false
self.index = -1
end
end
#==============================================================================
# ** Window_EquipControl
#------------------------------------------------------------------------------
#  This window deals with equipment command choices.
#==============================================================================
class Window_EquipControl < Window_Selectable
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(200, 80, 240, 32)
self.height = 128
self.contents = Bitmap.new(width - 32, height - 32)
@commands = [ MSlots::OPTIMIZE_NAMES[0],
MSlots::OPTIMIZE_NAMES[1],
MSlots::OPTIMIZE_NAMES[2]]
@item_max = 3
@item_width = (240-32)
self.back_opacity = 220
self.z = 1000
self.index = 0
refresh
end
end
#==============================================================================
# ** Scene_Title
#------------------------------------------------------------------------------
# This class performs title screen processing.
#==============================================================================
class Scene_Title < Scene_Base
#--------------------------------------------------------------------------
# * Fix items as you open RMXP
#--------------------------------------------------------------------------
alias mSlots_title_setup setup
def setup
RPG.initialized_item_types = false
mSlots_title_setup
RPG.reset
end
end
#==============================================================================
# ** Scene_Equip
#------------------------------------------------------------------------------
# This class performs equipment screen processing.
#==============================================================================
class Scene_Equip < Scene_Base
#--------------------------------------------------------------------------
# * Alias Listings
#--------------------------------------------------------------------------
alias mSlots_setup setup
alias mSlots_terminate terminate
alias mSlots_update_control update_control
alias mSlots_update_item_fix update_item
#--------------------------------------------------------------------------
# * Setup
#--------------------------------------------------------------------------
def setup
# Get actor
@actor = $game_party.actors[@actor_index]
# Create optimize windows
main_optimize
# Create additional windows
main_extra_slots
# Perform the original call
mSlots_setup
end
#--------------------------------------------------------------------------
# * Terminate Processing
#--------------------------------------------------------------------------
def terminate
# Perform the original call
mSlots_terminate
# Dispose of additional windows
main_extra_slots_dispose
# Dispose of optimize windows
main_optimize_dispose
end
#--------------------------------------------------------------------------
# * Frame Update (Handling Optimize update control)
#--------------------------------------------------------------------------
def update_optimize_removal_active
return unless MSlots::OPTIMIZE_REMOVE
# If control window is active: call update_control
return if @control_window.nil?
return if @control_window.disposed?
return update_control if @control_window.active
end
#--------------------------------------------------------------------------
# * Frame Update (when control window is active)
#--------------------------------------------------------------------------
def update_control
# If B button was pressed
if Input.trigger?(Input::B)
# Switch to menu screen (detect right window activity before exiting)
unless @right_window.active == true
@control_window.visible = false
end
end
# Perform the original call
mSlots_update_control
end
#--------------------------------------------------------------------------
# * Frame Update (when right sprite is active)
#--------------------------------------------------------------------------
def update_item
update_item_moonscroll if @right_window.index > 4
mSlots_update_item_fix
end
#--------------------------------------------------------------------------
# * Adding up down control for extra slots - somehow disabled by Moonpearl
#--------------------------------------------------------------------------
def update_item_moonscroll
if Input.repeat?(Input::DOWN)
# If column count is 1 and directional button was pressed down with no
# repeat, or if cursor position is more to the front than
# (item count - column count)
if (@item_window.column_max == 1 and Input.trigger?(Input::DOWN)) or
@item_window.index < @item_window.item_max - @item_window.column_max
# Move cursor down
$game_system.se_play($data_system.cursor_se)
@item_window.index = (@item_window.index + @item_window.column_max) %
@item_window.item_max
end
end
# If the up directional button was pressed
if Input.repeat?(Input::UP)
# If column count is 1 and directional button was pressed up with no
# repeat, or if cursor position is more to the back than column count
if (@item_window.column_max == 1 and Input.trigger?(Input::UP)) or
@item_window.index >= @item_window.column_max
# Move cursor up
$game_system.se_play($data_system.cursor_se)
@item_window.index = (@item_window.index - @item_window.column_max +
@item_window.item_max) % @item_window.item_max
end
end
@item_window.update_cursor_rect
end
end