#_________________________________________________________________________
______
# SEL SCENE EQUIP MENU V2.0
#_______________________________________________________________________________
# By Selacius
# Graphics by lomastul, MOGHUNTER
# Original XP Script by MOGHUNTER
#_______________________________________________________________________________
module MOG
# Set Maximum (STR,DEX,AGL,INT)
MST_ST = 999
# Set Maximum (ATK,PDEF,MDEF)
MST_STE = 999
# Set Maximum (HP, MP)
MST_HMP = 9999
end
module Cache
def self.menu(filename)
load_bitmap("Graphics/Menus/", filename)
end
def self.icon(filename)
load_bitmap("Graphics/Icons/", filename)
end
end
#==============================================================================
# ** Window_Equip
#==============================================================================
class Window_Equip < Window_Selectable
def initialize(actor)
super(260, 70, 220, 170)
self.contents = Bitmap.new(width - 32, height - 32)
self.opacity = 0
@actor = actor
refresh
self.index = 0
end
def item
return @data[self.index]
end
def refresh
self.contents.clear
@data = []
for item in @actor.equips do @data.push(item) end
@item_max = @data.size
self.contents.font.color = system_color
self.contents.font.bold = true
self.contents.font.shadow = true
self.contents.font.size = 14
draw_item_name_menu_equip(@actor.equips[0], 0, 0)
draw_item_name_menu_equip(@actor.equips[1], 0, 24)
draw_item_name_menu_equip(@actor.equips[2], 0, 48)
draw_item_name_menu_equip(@actor.equips[3], 0, 72)
draw_item_name_menu_equip(@actor.equips[4], 0, 96)
end
def draw_item_name_menu_equip(item, x, y, enabled = true)
if item != nil
draw_icon(item.icon_index, x, y, enabled)
self.contents.font.color = normal_color
self.contents.font.color.alpha = enabled ? 255 : 128
self.contents.draw_text(x + 30, y, 150, WLH, item.name)
end
end
def item_rect(index)
rect = Rect.new(0, 0, 0, 0)
rect.width = (contents.width + @spacing) / @column_max - @spacing
rect.height = WLH
rect.x = index % @column_max * (rect.width + @spacing)
rect.y = index / @column_max * WLH
return rect
end
end
#==============================================================================
# ** Window_EquipStatus
#------------------------------------------------------------------------------
class Window_EquipStatus < Window_Base
def initialize(x, y, actor)
super(x, y, 270, 390)
self.contents = Bitmap.new(width - 32, height - 32)
self.opacity = 0
self.contents.font.bold = true
self.contents.font.shadow = true
self.contents.font.size = 14
@actor = actor
refresh
end
def refresh
self.contents.clear
drw_equist(0,390)
draw_actor_face(@actor, 4, 30)
draw_actor_name(@actor, 4, 10)
self.contents.draw_text(4, 130, 36, 24, @actor.level.to_s, 2)
self.contents.draw_text(25, 145, 90, 24, @actor.class.name, 2)
draw_actor_parameter2(@actor, 0, 162 , 4, 10)
draw_actor_parameter2(@actor, 0, 185 , 5, 10)
draw_actor_parameter2(@actor, 0, 208 , 0)
draw_actor_parameter2(@actor, 0, 231 , 1)
draw_actor_parameter2(@actor, 0, 256 , 3)
draw_actor_parameter2(@actor, 0, 279 , 2)
if @new_hp != nil
self.contents.font.color = system_color
if @new_hp < @actor.hp
drw_eqpup(140,185,2)
self.contents.font.color = Color.new(255,50,50,255)
elsif @new_hp > @actor.hp
drw_eqpup(140,185,1)
self.contents.font.color = Color.new(50,250,150,255)
else
drw_eqpup(140,188,0)
self.contents.font.color = Color.new(255,255,255,255)
end
self.contents.draw_text(165, 164, 36, 24, @new_hp.to_s, 2)
end
if @new_mp != nil
self.contents.font.color = system_color
if @new_mp < @actor.mp
drw_eqpup(140,207,2)
self.contents.font.color = Color.new(255,50,50,255)
elsif @new_mp > @actor.mp
drw_eqpup(140,207,1)
self.contents.font.color = Color.new(50,250,150,255)
else
drw_eqpup(140,210,0)
self.contents.font.color = Color.new(255,255,255,255)
end
self.contents.draw_text(165, 187, 36, 24, @new_mp.to_s, 2)
end
if @new_atk != nil
self.contents.font.color = system_color
if @new_atk < @actor.atk
drw_eqpup(140,230,2)
self.contents.font.color = Color.new(255,50,50,255)
elsif @new_atk > @actor.atk
drw_eqpup(140,230,1)
self.contents.font.color = Color.new(50,250,150,255)
else
drw_eqpup(140,234,0)
self.contents.font.color = Color.new(255,255,255,255)
end
self.contents.draw_text(165, 210, 36, 24, @new_atk.to_s, 2)
end
if @new_def != nil
if @new_def < @actor.def
drw_eqpup(140,254,2)
self.contents.font.color = Color.new(255,50,50,255)
elsif @new_def > @actor.def
drw_eqpup(140,254,1)
self.contents.font.color = Color.new(50,250,150,255)
else
drw_eqpup(140,257,0)
self.contents.font.color = Color.new(255,255,255,255)
end
self.contents.draw_text(165, 232, 36, 24, @new_def.to_s, 2)
end
if @new_agi != nil
if @new_agi < @actor.agi
drw_eqpup(140,279,2)
self.contents.font.color = Color.new(255,50,50,255)
elsif @new_agi > @actor.agi
drw_eqpup(140,279,1)
self.contents.font.color = Color.new(50,250,150,255)
else
drw_eqpup(140,282,0)
self.contents.font.color = Color.new(255,255,255,255)
end
self.contents.draw_text(165, 258, 36, 24, @new_agi.to_s, 2)
end
if @new_spi != nil
if @new_spi < @actor.spi
drw_eqpup(140,302,2)
self.contents.font.color = Color.new(255,50,50,255)
elsif @new_spi > @actor.spi
drw_eqpup(140,302,1)
self.contents.font.color = Color.new(50,250,150,255)
else
drw_eqpup(140,305,0)
self.contents.font.color = Color.new(255,255,255,255)
end
self.contents.draw_text(165, 281, 36, 24, @new_spi.to_s, 2)
end
end
def set_new_parameters(new_hp, new_mp, new_atk, new_def, new_spi, new_agi)
if @new_hp != new_hp or @new_mp != new_mp or
@new_atk != new_atk or @new_def != new_def or
@new_spi != new_spi or @new_agi != new_agi
@new_hp = new_hp
@new_mp = new_mp
@new_atk = new_atk
@new_def = new_def
@new_spi = new_spi
@new_agi = new_agi
refresh
end
end
def drw_equist(x,y)
equist = Cache.menu("Equip_St")
cw = equist.width
ch = equist.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x , y - ch, equist, src_rect)
end
def drw_eqpup(x,y,type)
case type
when 0
est = Cache.icon("ST_EQU")
when 1
est = Cache.icon("ST_UP")
when 2
est = Cache.icon("ST_DOWN")
end
cw = est.width
ch = est.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x , y - ch, est, src_rect)
end
def draw_actor_parameter2(actor, x, y, type, z = 0)
back = Cache.menu("Parameter_Bar_Back")
cw = back.width
ch = back.height
src_rect = Rect.new(0, 0, cw - 106 - z, ch)
self.contents.blt(x + 40 , y - ch + 18, back, src_rect)
meter = Cache.menu("Parameter_Bar")
case type
when 0
parameter_value = actor.atk
cw = (meter.width - 106) * actor.atk / MOG::MST_STE
when 1
parameter_value = actor.def
cw = (meter.width - 106) * actor.def / MOG::MST_STE
when 2
parameter_value = actor.spi
cw = (meter.width - 106) * actor.spi / MOG::MST_ST
when 3
parameter_value = actor.agi
cw = (meter.width - 106) * actor.agi / MOG::MST_ST
when 4
parameter_value = actor.hp
cw = (meter.width - 106 - z) * actor.hp / MOG::MST_HMP
when 5
parameter_value = actor.mp
cw = (meter.width - 106 - z) * actor.mp / MOG::MST_HMP
end
self.contents.font.color = normal_color
self.contents.draw_text(x + 100, y - 2, 36, 32, parameter_value.to_s, 2)
ch = meter.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x + 40 , y - ch + 18, meter, src_rect)
end
end
#==============================================================================
# ** Window_EquipItem
#==============================================================================
class Window_EquipItem < Window_Item
def initialize(x, y, width, height, actor, equip_type)
@actor = actor
if equip_type == 1 and actor.two_swords_style
equip_type = 0 # Change shield to weapon
end
@equip_type = equip_type
@column_max = 1
super(x, y, width, height)
refresh
end
def include?(item)
return true if item == nil
if @equip_type == 0
return false unless item.is_a?(RPG::Weapon)
else
return false unless item.is_a?(RPG::Armor)
return false unless item.kind == @equip_type - 1
end
return @actor.equippable?(item)
end
def enable?(item)
return true
end
end
#==============================================================================
# ** Scene_Equip
#==============================================================================
class Scene_Equip < Scene_Base
EQUIP_TYPE_MAX = 5 # Number of equip region
def initialize(actor_index = 0, equip_index = 0)
@actor_index = actor_index
@equip_index = equip_index
end
def start
super
@actor = $game_party.members[@actor_index]
@msk_back1 = Plane.new
@msk_back1.bitmap = Cache.menu("Background")
@msk_lay = Sprite.new
if @actor.two_swords_style
@msk_lay.bitmap = Cache.menu("Equip_Lay2")
else
@msk_lay.bitmap = Cache.menu("Equip_Lay")
end
@help_window = Window_Help.new(42,362)
@help_window.opacity = 0
create_item_windows
@equip_window = Window_Equip.new(@actor)
@equip_window.help_window = @help_window
@equip_window.index = @equip_index
@status_window = Window_EquipStatus.new(0, 30, @actor)
end
def update
@help_window.update
@equip_window.update
update_status_window
update_item_windows
@msk_back1.ox += 1
if @equip_window.active
update_equip_selection
elsif @item_window.active
update_item_selection
end
end
def create_item_windows
@item_windows = []
for i in 0...EQUIP_TYPE_MAX
@item_windows[i] = Window_EquipItem.new(240, 208, 300, 170, @actor, i)
@item_windows[i].opacity = 0
@item_windows[i].help_window = @help_window
@item_windows[i].visible = (@equip_index == i)
@item_windows[i].active = false
@item_windows[i].index = -1
end
end
def update_status_window
if @equip_window.active
@status_window.set_new_parameters(nil, nil, nil, nil, nil, nil)
elsif @item_window.active
temp_actor = @actor.clone
temp_actor.change_equip(@equip_window.index, @item_window.item, true)
new_hp = temp_actor.hp
new_mp = temp_actor.mp
new_atk = temp_actor.atk
new_def = temp_actor.def
new_spi = temp_actor.spi
new_agi = temp_actor.agi
@status_window.set_new_parameters(new_hp, new_mp,new_atk, new_def, new_spi, new_agi)
end
@status_window.update
end
def terminate
super
@msk_lay.dispose
@help_window.dispose
@equip_window.dispose
@status_window.dispose
dispose_item_windows
end
def update_equip_selection
if Input.trigger?(Input::

Sound.play_cancel
return_scene
elsif Input.trigger?(Input::RIGHT)
Sound.play_cursor
next_actor
elsif Input.trigger?(Input::LEFT)
Sound.play_cursor
prev_actor
elsif Input.trigger?(Input::C)
if @actor.fix_equipment
Sound.play_buzzer
else
Sound.play_decision
@equip_window.active = false
@item_window.active = true
@item_window.index = 0
end
end
end
end