class Window_EquipItem < Window_Selectable
#--------------------------------------------------------------------------
# - Object initialization
# actor : Actor
# equip_type : Equipment region (0-3)
#--------------------------------------------------------------------------
def initialize(actor, equip_type)
super(0, 0, 350, 265)
@actor = actor
@equip_type = equip_type
@column_max = 1
refresh
self.active = false
self.index = -1
end
#--------------------------------------------------------------------------
# - Acquisition of item
#--------------------------------------------------------------------------
def item
return @data[self.index]
end
#--------------------------------------------------------------------------
# - Refreshment
#--------------------------------------------------------------------------
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
# Adding the equipment possible weapon
if @equip_type == 0
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)
@data.push($data_weapons[i])
end
end
end
# Adding the equipment possible guard
if @equip_type != 0
armor_set = $data_classes[@actor.class_id].armor_set
for i in 1...$data_armors.size
if $game_party.armor_number(i) > 0 and armor_set.include?(i)
if $data_armors[i].kind == @equip_type-1
@data.push($data_armors[i])
end
end
end
end
# Adding blank
@data.push(nil)
# It draws up bit map, drawing all item
@item_max = @data.size
self.contents = Bitmap.new(width - 32, row_max * 32)
for i in 0...@item_max-1
draw_item(i)
end
end
#--------------------------------------------------------------------------
# - Drawing of item
# index : Item number
#--------------------------------------------------------------------------
def draw_item(index)
item = @data[index]
x = 4
y = (index * 19) - 5
case item
when RPG::Weapon
number = $game_party.weapon_number(item.id)
when RPG::Armor
number = $game_party.armor_number(item.id)
end
self.contents.font.name = $fontface
self.contents.font.size = $menu_small_1
self.contents.font.bold = true
self.contents.font.outline = true
#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 + 10, y, 212, 32, item.name, 0)
self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2)
end
#--------------------------------------------------------------------------
# - Help text renewal
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(self.item == nil ? "" : self.item.description)
end
def update_cursor_rect
self.cursor_rect.set(0, @index * 19 + 10, 0, 0)
end
end