#==============================================================================
# ** Window_EquipLeft
#------------------------------------------------------------------------------
# This window displays actor parameter changes on the equipment screen.
#==============================================================================
class Window_EquipLeft < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
# actor : actor
#--------------------------------------------------------------------------
def initialize(actor)
super(0, 64, 320, 96)
self.contents = Bitmap.new(width - 32, height - 32)
@actor = actor
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
draw_actor_graphic(@actor, 32, 64)
draw_actor_name(@actor, 68, 32)
end
end
#==============================================================================
# ** Window_EquipRight
#------------------------------------------------------------------------------
# This window displays items the actor is currently equipped with on the
# equipment screen.
#==============================================================================
class Window_EquipRight < Window_Selectable
#--------------------------------------------------------------------------
# * Object Initialization
# actor : actor
#--------------------------------------------------------------------------
def initialize(actor)
super(0, 160, 320, 320)
self.contents = Bitmap.new(width - 32, height - 32)
@actor = actor
refresh
self.index = 0
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
@data = []
@data.push($data_weapons[@actor.attackability1_id])
@data.push($data_weapons[@actor.attackability2_id])
@data.push($data_weapons[@actor.attackability3_id])
@data.push($data_weapons[@actor.attackability4_id])
@data.push(nil) # Creates an empty space
@data.push($data_armors[@actor.defendability1_id])
@data.push($data_armors[@actor.defendability2_id])
@data.push($data_armors[@actor.defendability3_id])
@data.push($data_armors[@actor.defendability4_id])
@data.each_with_index {|item, i| draw_item_name(item, 0, 32 * i)}
@data.delete(nil) # Removes the empty space from the data
@item_max = @data.size
end
#--------------------------------------------------------------------------
# * Update Cursor Rect - Make bottom four items lower than the rest
#--------------------------------------------------------------------------
def update_cursor_rect
super
self.cursor_rect.y += 32 if @index >= 4
end
end
#==============================================================================
# ** Window_EquipItem
#------------------------------------------------------------------------------
# This window displays choices when opting to change equipment on the
# equipment screen.
#==============================================================================
class Window_EquipItem < Window_Selectable
#--------------------------------------------------------------------------
# * Object Initialization
# actor : actor
# equip_type : equip region (0-3)
#--------------------------------------------------------------------------
def initialize(actor, equip_type)
super(320, 64, 320, 416)
@actor = actor
@equip_type = equip_type
refresh
self.active = false
self.index = -1
end
#--------------------------------------------------------------------------
# * Draw Item
# index : item number
#--------------------------------------------------------------------------
def draw_item(index)
item = @data[index]
x = 4
y = index * 32
case item
when RPG::Weapon
number = $game_party.weapon_number(item.id)
when RPG::Armor
number = $game_party.armor_number(item.id)
end
bitmap = RPG::Cache.icon(item.icon_name)
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
self.contents.font.color = normal_color
self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
self.contents.draw_text(x + 240, y, 16, 32, ":", 1)
self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2)
end
end
#==============================================================================
# ** Scene_Equip
#------------------------------------------------------------------------------
# This class performs equipment screen processing.
#==============================================================================
class Scene_Equip
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
# Set item window to visible
@item_window1.visible = false
@item_window2.visible = false
@item_window3.visible = false
@item_window4.visible = false
@item_window5.visible = false
# Get currently equipped item
item1 = @right_window.item
# Set current item window to @item_window
case @right_window.index
when 0..3
@item_window = @item_window1
when 4..7
@item_window = @item_window4
end
@item_window.visible = true
end
#--------------------------------------------------------------------------
# * Frame Update (when item window is active)
#--------------------------------------------------------------------------
def update_item
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Activate right window
@right_window.active = true
@item_window.active = false
@item_window.index = -1
return
end
# If C button was pressed
if Input.trigger?(Input::C)
# Play equip SE
$game_system.se_play($data_system.equip_se)
# Get currently selected data on the item window
item = @item_window.item
# Change equipment
case @right_window.index
when 0
@actor.attackability1_id = item == nil ? 0 : item.id
when 1
@actor.attackability2_id = item == nil ? 0 : item.id
when 2
@actor.attackability3_id = item == nil ? 0 : item.id
when 3
@actor.attackability4_id = item == nil ? 0 : item.id
when 4
@actor.defendability1_id = item == nil ? 0 : item.id
when 5
@actor.defendability2_id = item == nil ? 0 : item.id
when 6
@actor.defendability3_id = item == nil ? 0 : item.id
when 7
@actor.defendability4_id = item == nil ? 0 : item.id
end
# Activate right window
@right_window.active = true
@item_window.active = false
@item_window.index = -1
# Remake right window and item window contents
@right_window.refresh
@item_window.refresh
return
end
end
end