#==============================================================================
# ** Custom Menu
#------------------------------------------------------------------------------
# Made by Sheol
#==============================================================================
Â
class Scene_Menu
Â
 class Window_MenuCommand < Window_Selectable
  #--------------------------------------------------------------------------
  def initialize
   super(32, 32, 576, 64)
   self.contents = Bitmap.new(544, 32)
   @item_max = @column_max = 4
   @commands = %w( Inventory Missions Save Exit )
   refresh
   self.index = 0
  end
  #--------------------------------------------------------------------------
  def refresh
   self.contents.clear
   0.upto(@item_max-1) { |i| draw_item(i, false) }
  end
  #--------------------------------------------------------------------------
  def draw_item(index, color)
   self.contents.font.color = color ? disabled_color : normal_color
   self.contents.draw_text(index * 144 + 4, 0, 112-8, 32, @commands[index], 1)
  end
 end
Â
 class Window_MenuItem < Window_Item
  #--------------------------------------------------------------------------
  def initialize
   super
   self.active = false
   self.x = 32
   self.y = 96
   self.width = 576
   self.height = 352
   refresh
   update_cursor_rect
  end
  #--------------------------------------------------------------------------
  def draw_item(index)
   item = @data[index]
   case item
   when RPG::Item
    number = $game_party.item_number(item.id)
   when RPG::Weapon
    number = $game_party.weapon_number(item.id)
   when RPG::Armor
    number = $game_party.armor_number(item.id)
   end
   if item.is_a?(RPG::Item) and
    $game_party.item_can_use?(item.id)
    self.contents.font.color = normal_color
   else
    self.contents.font.color = disabled_color
   end
   x = 4 + index % 2 * (256 + 32)
   y = index / 2 * 32
   rect = Rect.new(x, y, self.width / @column_max - 32, 32)
   self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
   bitmap = RPG::Cache.icon(item.icon_name)
   opacity = self.contents.font.color == normal_color ? 255 : 128
   self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
   self.contents.draw_text(x + 28, y, 212 - 32, 32, item.name, 0)
   self.contents.draw_text(x + 240 - 32, y, 16, 32, ":", 1)
   self.contents.draw_text(x + 256 - 32, y, 24, 32, number.to_s, 2)
  end
 end
 #--------------------------------------------------------------------------
 def main
  @command_window = Window_MenuCommand.new
Â
  if $game_system.save_disabled
   @command_window.draw_item(2, true)
  end
 Â
  @item_window = Window_MenuItem.new
 Â
  @target_window = Window_Target.new
  @target_window.visible = false
  @target_window.active = false
 Â
  @dummy_window = Window_Base.new(32, 96, 576, 352)
  @dummy_window.z += 100
 Â
  Graphics.transition
  while $scene == self
   Graphics.update
   Input.update
   update
  end
  Graphics.freeze
  @command_window.dispose
  @item_window.dispose
  @target_window.dispose
  @dummy_window.dispose
 end
 #--------------------------------------------------------------------------
 def update
  if @item_window.active
   update_item
   return
  elsif @target_window.active
   update_target
   return
  end
 Â
  @command_window.update
  @dummy_window.visible = @command_window.index != 0
Â
  if Input.trigger?(Input::B)
   $game_system.se_play($data_system.cancel_se)
   $scene = Scene_Map.new
   return
  end
 Â
  if Input.trigger?(Input::C)
   case @command_window.index
   when 0
    $game_system.se_play($data_system.decision_se)
    @item_window.active = true
    @command_window.active = false
   when 1
    $game_system.se_play($data_system.decision_se)
    # Missions
    $scene = Omegas_Achievements_Scene.new
   when 2
    if $game_system.save_disabled
     $game_system.se_play($data_system.buzzer_se)
     return
    end
    $game_system.se_play($data_system.decision_se)
    $scene = Scene_Save.new
   when 3
    $game_system.se_play($data_system.decision_se)
    $scene = Scene_End.new
   end
  end
 end
 #--------------------------------------------------------------------------
 def update_item
  @item_window.update
  if Input.trigger?(Input::B)
   $game_system.se_play($data_system.cancel_se)
   @item_window.active = false
   @command_window.active = true
   return
  end
 Â
  if Input.trigger?(Input::C)
   @item = @item_window.item
   unless @item.is_a?(RPG::Item)
    $game_system.se_play($data_system.buzzer_se)
    return
   end
   unless $game_party.item_can_use?(@item.id)
    $game_system.se_play($data_system.buzzer_se)
    return
   end
   $game_system.se_play($data_system.decision_se)
   if @item.scope >= 3
    @item_window.active = false
    @target_window.x = (@item_window.index + 1) % 2 * 304
    @target_window.visible = true
    @target_window.active = true
    if @item.scope == 4 || @item.scope == 6
     @target_window.index = -1
    else
     @target_window.index = 0
    end
   else
    if @item.common_event_id > 0
     $game_temp.common_event_id = @item.common_event_id
     $game_system.se_play(@item.menu_se)
     if @item.consumable
      $game_party.lose_item(@item.id, 1)
      @item_window.draw_item(@item_window.index)
     end
     $scene = Scene_Map.new
    end
   end
  end
 end
 #--------------------------------------------------------------------------
 def update_target
  @target_window.update
Â
  if Input.trigger?(Input::B)
   $game_system.se_play($data_system.cancel_se)
   unless $game_party.item_can_use?(@item.id)
    @item_window.refresh
   end
   @item_window.active = true
   @target_window.visible = false
   @target_window.active = false
   return
  end
  if Input.trigger?(Input::C)
   if $game_party.item_number(@item.id) == 0
    $game_system.se_play($data_system.buzzer_se)
    return
   end
   if @target_window.index == -1
    used = false
    for i in $game_party.actors
     used |= i.item_effect(@item)
    end
   end
   if @target_window.index >= 0
    target = $game_party.actors[@target_window.index]
    used = target.item_effect(@item)
   end
   if used
    $game_system.se_play(@item.menu_se)
    if @item.consumable
     $game_party.lose_item(@item.id, 1)
     @item_window.draw_item(@item_window.index)
    end
    @target_window.refresh
    if $game_party.all_dead?
     $scene = Scene_Gameover.new
     return
    end
    if @item.common_event_id > 0
     $game_temp.common_event_id = @item.common_event_id
     $scene = Scene_Map.new
     return
    end
   end
   unless used
    $game_system.se_play($data_system.buzzer_se)
   end
  end
 end
end
Â