#==============================================================================
# Multi-slot equipment script
#------------------------------------------------------------------------------
# Section 3: Windows
#------------------------------------------------------------------------------
# Guillaume777
# 6.2.1
# 2006/02/14
#==============================================================================
#==============================================================================
# ** Scene_Equip
#------------------------------------------------------------------------------
# This class performs equipment screen processing.
#==============================================================================
class Scene_Equip
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
alias g7_ms_scene_equip_main main
def main
@additional_initialize_done = false
g7_ms_scene_equip_main
for i in 5...@item_windows.size
@item_windows[i].dispose unless @item_windows[i].nil?
end
end
#--------------------------------------------------------------------------
# * Initialize the extra right windows
#--------------------------------------------------------------------------
def g7_ms_scene_equip_additional_initialize
unless @additional_initialize_done
@item_windows = []
@item_windows[0] = @item_window1 # Weapon
@item_windows[1] = @item_window2 # Shield
@item_windows[2] = @item_window3 # Helmet
@item_windows[3] = @item_window4 # Armor
@item_windows[4] = @item_window5 # Accessory
nb_old_windows = @item_windows.size
for i in nb_old_windows...@actor.armor_slots.max+1
# Add the remaining windows for extra slots
@item_windows.push(Window_EquipItem.new(@actor, i) )
@item_windows[i].help_window = @help_window
end
@item_windows.push(Window_EquipOffHand.new(@actor, 0))
@item_windows[-1].help_window = @help_window
# If windows_stretch is true, stretch window
if G7_MS_MOD::WINDOWS_STRETCH
h = (@actor.weapon_slots.size + @actor.armor_slots.size + 1) * 32
h2 = (G7_MS_MOD::MAX_SHOW_SLOTS+1) * 32
h = [h, h2].min
@right_window.height = h
if @right_window.index > @actor.weapon_slots.size + @actor.armor_slots.size - 1
@right_window.index = @actor.weapon_slots.size + @actor.armor_slots.size - 1
end
if @left_window.y + @left_window.height == 256
@left_window.height = @right_window.height
elsif G7_MS_MOD::HELP_AT_BOTTOM == true and @left_window.height == 416 then
# Make left window shorter
@left_window.height -= 64
end
y_pos = (@right_window.y + @right_window.height)
y_space = 480 - y_pos
# If help at bottom, reduce bottom item window size
if G7_MS_MOD::HELP_AT_BOTTOM == true then y_space -= 64 end
for item_window in @item_windows
next if item_window.nil?
item_window.y = y_pos
item_window.height = y_space
end
end
@additional_initialize_done = true
end
end
#--------------------------------------------------------------------------
# * Refresh and make visible the correct right window
#--------------------------------------------------------------------------
alias g7_ms_scene_equip_refresh refresh
def refresh
# This part is used to refresh the equipped item at the right window
g7_ms_scene_equip_additional_initialize
@actor.translucent_texts.fill(false)
@actor.equip_type_force = index_to_equip_part(@right_window.index)
@right_window.item_fix_on
@right_window.scroll_fix_on
save = @right_window.index
@right_window.index = index_to_equip_kind(@right_window.index)
if @right_window.index == 0 and @actor.ignore_offhand? != true then
if @actor.nb_offhand_required(save) > 0 then
@right_window.index = @item_windows.size-1
end
end
@actor.equip_from_menu = true
# Ensure current equipment will get properly stored...
@actor.equip_mode = 'STORE'
# ...and re-equiped
@item_window = @item_windows[@right_window.index]
@item_windows[@right_window.index].visible = true
for i in 0...@item_windows.size
if i != @right_window.index then
@item_windows[i].visible = false
end
end
# Equip and remove item
g7_ms_scene_equip_refresh
@actor.equip_from_menu = false
@actor.equip_mode = nil
@actor.equip_type_force = nil
@right_window.index = save
@right_window.scroll_fix_off
@right_window.item_fix_off
if @item_window.index != @old_index
@right_window.refresh
end
@old_index = @item_window.index
end
#--------------------------------------------------------------------------
# * Convert the right_window.index to equip_type
#--------------------------------------------------------------------------
alias g7_ms_scene_equip_update_item update_item
def update_item
# This changes the @right_window.index to the correct value to take
# account of extra slots
@actor.equip_type_force = index_to_equip_part(@right_window.index)
@right_window.item_fix_on
@right_window.scroll_fix_on
save = @right_window.index
@right_window.index = index_to_equip_kind(@right_window.index)
@actor.equip_from_menu = true
# Equip item
g7_ms_scene_equip_update_item
@actor.equip_from_menu = false
@actor.equip_type_force = nil
# If not in item_window screen
if @item_window.index == -1
# If shield-weapon can modify each other
if @actor.shield_hand_wield == true and
if @right_window.index == @actor.shield_hand_slot then
@item_windows[0].refresh
@item_windows[-1].refresh
elsif @right_window.index == 0
# Refresh the shield slot
@item_windows[@actor.shield_hand_slot].refresh
end
end
if @right_window.index == 0 and @actor.ignore_offhand? != true then
if @item_window == @item_windows[-1] then
@item_windows[0].refresh
elsif @item_window == @item_windows[0] then
@item_windows[-1].refresh
end
end
end
@right_window.index = save
@right_window.scroll_fix_off
@right_window.item_fix_off
@actor.equip_type_force = nil
end
#--------------------------------------------------------------------------
# * Convert index to equip part
# index : slot number
#--------------------------------------------------------------------------
def index_to_equip_part(index)
# Return index of slot in the
# array [0, @actor.armor_slots, actor.weapon_slots]
# If Armor
if index >= @actor.weapon_slots.size
return index - (@actor.weapon_slots.size - 1)
# If extra weapon
elsif index >= 1
# Make it last
return index + [@actor.armor_slots.size, 4].max
else
return 0
end
end
#--------------------------------------------------------------------------
# Convert index to equip kind
# index : slot number
#--------------------------------------------------------------------------
def index_to_equip_kind(index)
# Return index of slot in either actor.weapon_slots or actor.armor_slots
i = index_to_equip_part(index)
# If armor
if index >= @actor.weapon_slots.size
set = @actor.armor_slots[i-1]
# If weapon
else
i = i == 0 ? 0 : i - [@actor.armor_slots.size, 4].max
set = @actor.weapon_slots[i]
end
return set != nil ? set : 0
end
#--------------------------------------------------------------------------
# * End of CLASS: Scene Equip
#--------------------------------------------------------------------------
end
#==============================================================================
# ** Window_EquipRight
#------------------------------------------------------------------------------
# This window displays items the actor is currently equipped with on the
# equipment screen.
#==============================================================================
class Window_EquipRight < Window_Selectable
#--------------------------------------------------------------------------
# * Item Fix On
#--------------------------------------------------------------------------
def item_fix_on
# Fix window
@fixed_item = @data[self.index]
@fixed = true
end
#--------------------------------------------------------------------------
# * Item Fix Off
#--------------------------------------------------------------------------
def item_fix_off
#stop fixing window
@fixed_item = nil
@fixed = false
end
#--------------------------------------------------------------------------
# * Don't scroll right window if you press L or R
#--------------------------------------------------------------------------
def update
if Input.repeat?(Input::R) or Input.repeat?(Input::L) then
return
else
super
end
end
#--------------------------------------------------------------------------
# Draws equipped items with support of translucent and cursed items
# item : item
# x : draw spot x-coordinate
# y : draw spot y-coordinate
# translucent : draw translucent
#--------------------------------------------------------------------------
def draw_item_name(item, x, y, translucent = false)
if item == nil
return
end
bitmap = RPG::Cache.icon(item.icon_name)
if item.cursed
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
self.contents.font.color = G7_MS_MOD::CURSED_COLOR
elsif translucent
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), 128)
self.contents.font.color = disabled_color
else
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
self.contents.font.color = normal_color
end
self.contents.draw_text(x + 28, y, 212, 32, item.name)
end
#--------------------------------------------------------------------------
# * Prevent needless update of item quantities in item window
#--------------------------------------------------------------------------
alias g7_ms_window_equipright_item item
def item
# This ensures that the number of items doesn't get updated if you move
# cursor in item window
return @fixed_item if @fixed
return g7_ms_window_equipright_item
end
#--------------------------------------------------------------------------
# * Change the height of right windows to fit the slots
# actor : actor
#--------------------------------------------------------------------------
alias g7_ms_window_equipright_initialize initialize
def initialize(actor)
# Initialize with a different height
g7_ms_window_equipright_initialize(actor)
# Total height of right window
h = (actor.weapon_slots.size + actor.armor_slots.size) * 32
# Change the height
self.contents = Bitmap.new(width - 32, h)
refresh
end
#--------------------------------------------------------------------------
# * Shows the slot names and the name of the items you have equipped
#--------------------------------------------------------------------------
def refresh
# Replaced method to show caption of all items and slot
self.contents.clear
@data = []
# Begin Multi-slot equipment script Edit
self.contents.font.name = G7_MS_MOD::FONT_NAME
for i in 0...@actor.weapon_slots.size
# Push the name(s) of the weapon(s)
@data.push($data_weapons[@actor.weapon_ids[i]])
end
for i in 0...@actor.armor_slots.size
# Push the names of the armors
@data.push($data_armors[@actor.armor_ids[i]])
end
@caption = []
for i in 0...@actor.weapon_slots.size
# Push the name(s) of the weapon slots
@caption.push(@actor.weapon_slot_names[i])
end
for i in 0...@actor.armor_slots.size
# Push the names of the armor slots
@caption.push(@actor.armor_slot_names[@actor.armor_slots[i]-1])
end
@item_max = @data.size
if @actor.translucent_texts == nil then @actor.translucent_texts = Array.new end
for i in 0...@data.size
if @caption[i] != nil
self.contents.font.color = system_color
# Draw the name of the slots
self.contents.draw_text(4, 32 * i, 92, 32, @caption[i])
end
# Draw the name of the equipment
draw_item_name(@data[i], 92, 32 * i, @actor.translucent_texts[i])
end
# Support for other script
if defined? xrxs_additional_refresh
xrxs_additional_refresh
end
# End Multi-slot equipment script Edit
end
#--------------------------------------------------------------------------
# * End of CLASS: Window EquipRight
#--------------------------------------------------------------------------
end
#============================================================================
# ** Window_EquipOffHand
#----------------------------------------------------------------------------
# A new window class that displays an equipped item in the actor's off hand.
#============================================================================
class Window_EquipOffHand < Window_EquipItem
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
# Add equippable weapons
weapon_set = $data_classes[@actor.class_id].weapon_set
for i in 1...$data_weapons.size
if $game_party.weapon_number(i) > 0 and weapon_set.include?(i)
weapon = $data_weapons[i]
if weapon.needs_offhand == false
if G7_MS_MOD::TWOHANDED_IN_OFFHAND != false and weapon.nb_hands <= 1 then
@data.push(weapon)
end
end
end
end
# Add blank page
@data.push(nil)
# Make a bit map and draw all items
@item_max = @data.size
self.contents = Bitmap.new(width - 32, row_max * 32)
self.contents.font.name = G7_MS_MOD::FONT_NAME
#self.contents.font.size = 24
for i in 0...@item_max-1
draw_item(i)
end
if G7_MS_MOD::SHOW_REMOVE then
i = @item_max -1
x = 4 + i % @column_max * (288 + 32)
y = i / @column_max * 32
self.contents.draw_text(x+4, y, 100, 32, '[Remove]')
end
end
#--------------------------------------------------------------------------
# * End of CLASS: Window EquipOffHand
#--------------------------------------------------------------------------
end
#==============================================================================
# ** Window_Selectable
#------------------------------------------------------------------------------
# This window class contains cursor movement and scroll functions.
#==============================================================================
class Window_Selectable < Window_Base
#--------------------------------------------------------------------------
# * Scroll Fix On
#--------------------------------------------------------------------------
def scroll_fix_on
@scroll_fixed = true
end
#--------------------------------------------------------------------------
# * Scroll Fix Off
#--------------------------------------------------------------------------
def scroll_fix_off
@scroll_fixed = false
update_cursor_rect
end
#--------------------------------------------------------------------------
# * Update Cursor Rectangle
#--------------------------------------------------------------------------
alias g7_ms_update_cursor_rect update_cursor_rect
def update_cursor_rect
# This prevents the windows from scrolling if scroll is fixed
# This was added to ensure that if there are few slots, the right equip
# screen doesn't scroll needlessly
return if @scroll_fixed
g7_ms_update_cursor_rect
end
#--------------------------------------------------------------------------
# * End of CLASS: Window Selectable
#--------------------------------------------------------------------------
end
#==============================================================================
# *** Global IF condition
# Shows a new status window if Status_window_arrange is true
#==============================================================================
if G7_MS_MOD::STATUS_WINDOW_ARRANGE
#============================================================================
# ** Window_Status
#----------------------------------------------------------------------------
# This window displays full status specs on the status screen.
#============================================================================
class Window_Status < Window_Base
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
# Begin Multi-slot equipment script Edit
self.contents.font.name = G7_MS_MOD::FONT_NAME
# End Multi-slot equipment script Edit
self.contents.clear
draw_actor_graphic(@actor, 40, 112)
draw_actor_name(@actor, 4, 0)
draw_actor_class(@actor, 4 + 144, 0)
draw_actor_level(@actor, 96, 32)
draw_actor_state(@actor, 96, 64)
draw_actor_hp(@actor, 96, 112, 172)
draw_actor_sp(@actor, 96, 144, 172)
draw_actor_parameter(@actor, 96, 192, 0)
draw_actor_parameter(@actor, 96, 224, 1)
draw_actor_parameter(@actor, 96, 256, 2)
draw_actor_parameter(@actor, 96, 304, 3)
draw_actor_parameter(@actor, 96, 336, 4)
draw_actor_parameter(@actor, 96, 368, 5)
draw_actor_parameter(@actor, 96, 400, 6)
# Begin Multi-slot equipment script Edit
if G7_MS_MOD::EVADE
# Activate if you have a draw_actor_paramter method that draws evade
draw_actor_parameter(@actor, 96, 432, 7)
end
self.contents.font.color = system_color
self.contents.draw_text(320, 16, 80, 32, 'EXP')
self.contents.draw_text(320, 48, 80, 32, 'NEXT')
self.contents.font.color = normal_color
self.contents.draw_text(320 + 80, 16, 84, 32, @actor.exp_s, 2)
self.contents.draw_text(320 + 80, 48, 84, 32, @actor.next_rest_exp_s, 2)
self.contents.font.color = system_color
self.contents.draw_text(320, 80, 96, 32, 'Equipment')
y = 108
for i in 0...@actor.weapon_slots.size
draw_item_name($data_weapons[@actor.weapon_ids[i]], 320 + 16, y)
y += G7_MS_MOD::STATUS_WINDOW_SPACING
end
for i in 0...@actor.armor_slots.size
draw_item_name($data_armors[@actor.armor_ids[i]], 320 + 16, y)
y += G7_MS_MOD::STATUS_WINDOW_SPACING
end
# End Multi-slot equipment script Edit
end
#------------------------------------------------------------------------
# * End of CLASS: Window Status
#------------------------------------------------------------------------
end
#--------------------------------------------------------------------------
# * End of Global IF condition
#--------------------------------------------------------------------------
end