KK20

No Bestiary

Dec 11th, 2014
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 163.05 KB | None | 0 0
  1. #==============================================================================
  2. # Custom Menu System
  3. # Written by Diego
  4. # Bug-fixing by ccoa
  5. #==============================================================================
  6. # - Fully Animated
  7. # Includes:
  8. # - Quest/Key Item Support
  9. # - Organized Menus by Items, Weapons, Armors, Accessories and Quest/Key Items
  10. # - Advanced Equip Screen (by RPG-Advocate)
  11. # - Reorganized Status Screen
  12. # - Elemental Resistance Circle
  13. # - Map Name Window
  14. # - Icons in Menu
  15. # - Options
  16. # - Support for Deke/Near Fantastica's Day/Night System
  17. #
  18. # Instructions Manual:
  19. #
  20. # Step 1 - copy and paste these lines into Scene_Title just under def main
  21. #    #-------------------------------------------------------------------------- # Item ID numbers
  22. #    $basic_items_ids = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22]
  23. #    $quest_items_ids = [23,24,25,26,27,28,29,30,31,32]
  24. #    #-------------------------------------------------------------------------- # Weapon ID numbers
  25. #    $weapon_ids = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,
  26. #19,20,21,22,23,24,25,26,27,28,29,30,31,32]
  27. #    #-------------------------------------------------------------------------- # Armor ID numbers
  28. #    $armor_ids = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24]
  29. #    $accessory_ids = [25,26,27,28,29,30,31,32]
  30. # This is for organizing your items.
  31. #
  32. # Step 2 - copy and paste these lines into Scene_Title just under $data_system        = load_data("Data/System.rxdata")
  33. #    $map_infos = load_data("Data/MapInfos.rxdata")
  34. #    for key in $map_infos.keys
  35. #      $map_infos[key] = $map_infos[key].name
  36. #    end
  37. #    $game_time = Game_Time.new
  38. # This is support for Window_NewTime and Window_NewLocation
  39. #
  40. # Step 3 - copy and paste this line into Scene_Save just under Marshal.dump($game_player, file)
  41. #    Marshal.dump($game_time,file)
  42. # also change this line $scene = Scene_Menu.new(4) into this $scene = Scene_Menu.new(9) in def on_decision(filename)
  43. # This is support for Window_NewTime
  44. #
  45. # Step 4 - copy and paste this line into Scene_Load just under $game_player        = Marshal.load(file)
  46. #    $game_time           =Marshal.load(file)
  47. # This is support for Window_NewTime
  48. #
  49. # Support for Deke/Near Fantastica's Day and Night System:
  50. # You can copy and paste the D&N system script into a new section above main,
  51. # just make sure that the D&N system script is below this one in the list
  52. #
  53. #
  54. # That's all. Enjoy ^^;
  55. #   - Diego
  56.  
  57.  
  58.  
  59.  
  60. #==============================================================================
  61. # ■ Bestiary
  62. #------------------------------------------------------------------------------
  63. # Created by Momomo
  64. # Modified by Thousand Dragoon Link
  65. #==============================================================================
  66.  
  67. module Enemy_Book_Config
  68.  DROP_ITEM_NEED_ANALYZE = false
  69.  EVA_NAME = "Evasion"            
  70.  SHOW_COMPLETE_TYPE = 3        
  71.                          
  72. end
  73.  
  74. class Game_Temp
  75.  attr_accessor :enemy_book_data
  76.  alias temp_enemy_book_data_initialize initialize
  77.  def initialize
  78.    temp_enemy_book_data_initialize
  79.    @enemy_book_data = Data_MonsterBook.new
  80.  end
  81. end
  82.  
  83. class Game_Party
  84.  attr_accessor :enemy_info          
  85.  #--------------------------------------------------------------------------
  86.  alias book_info_initialize initialize
  87.  def initialize
  88.    book_info_initialize
  89.    @enemy_info = {}
  90.  end
  91.  #--------------------------------------------------------------------------
  92.  def add_enemy_info(enemy_id, type = 0)
  93.    case type
  94.    when 0
  95.      if @enemy_info[enemy_id] == 2
  96.        return false
  97.      end
  98.      @enemy_info[enemy_id] = 1
  99.    when 1
  100.      @enemy_info[enemy_id] = 2
  101.    when -1
  102.      @enemy_info[enemy_id] = 0
  103.    end
  104.  end
  105.  #--------------------------------------------------------------------------
  106.  def enemy_book_max
  107.    return $game_temp.enemy_book_data.id_data.size - 1
  108.  end
  109.  #--------------------------------------------------------------------------
  110.  def enemy_book_now
  111.    now_enemy_info = @enemy_info.keys
  112.    no_add = $game_temp.enemy_book_data.no_add_element
  113.    new_enemy_info = []
  114.    for i in now_enemy_info
  115.      enemy = $data_enemies[i]
  116.      next if enemy.name == ""
  117.      if enemy.element_ranks[no_add] == 1
  118.        next
  119.      end
  120.      new_enemy_info.push(enemy.id)
  121.    end
  122.    return new_enemy_info.size
  123.  end
  124.  #--------------------------------------------------------------------------
  125.  def enemy_book_complete_percentage
  126.    e_max = enemy_book_max.to_f
  127.    e_now = enemy_book_now.to_f
  128.    comp = e_now / e_max * 100
  129.    return comp.truncate
  130.  end
  131. end
  132.  
  133. class Interpreter
  134.  def enemy_book_max
  135.    return $game_party.enemy_book_max
  136.  end
  137.  def enemy_book_now
  138.    return $game_party.enemy_book_now
  139.  end
  140.  def enemy_book_comp
  141.    return $game_party.enemy_book_complete_percentage
  142.  end
  143. end
  144.  
  145. class Scene_Battle
  146.  alias add_enemy_info_start_phase5 start_phase5
  147.  def start_phase5
  148.    for enemy in $game_troop.enemies
  149.      unless enemy.hidden
  150.        $game_party.add_enemy_info(enemy.id, 0)
  151.      end
  152.    end
  153.    add_enemy_info_start_phase5
  154.  end
  155. end
  156.  
  157. class Window_Base < Window
  158.  #--------------------------------------------------------------------------
  159.  def draw_enemy_drop_item(enemy, x, y)
  160.    self.contents.font.color = normal_color
  161.    treasures = []
  162.    if enemy.item_id > 0
  163.      treasures.push($data_items[enemy.item_id])
  164.    end
  165.    if enemy.weapon_id > 0
  166.      treasures.push($data_weapons[enemy.weapon_id])
  167.    end
  168.    if enemy.armor_id > 0
  169.      treasures.push($data_armors[enemy.armor_id])
  170.    end
  171.    if treasures.size > 0
  172.      item = treasures[0]
  173.      bitmap = RPG::Cache.icon(item.icon_name)
  174.      opacity = 255
  175.      self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  176.      name = treasures[0].name
  177.    else
  178.      self.contents.font.color = disabled_color
  179.      name = "No Item"
  180.    end
  181.    self.contents.draw_text(x+28, y, 212, 32, name)
  182.  end
  183.  #--------------------------------------------------------------------------
  184.  def draw_actor_hp2(actor, x, y, width = 144)
  185.     self.contents.font.color = system_color
  186.     self.contents.draw_text(x, y, 32, 32, $data_system.words.hp)
  187.     if width - 32 >= 108
  188.       hp_x = x + width - 108
  189.       flag = true
  190.     elsif width - 32 >= 48
  191.       hp_x = x + width - 48
  192.       flag = false
  193.     end
  194.     self.contents.font.color = actor.hp == 0 ? knockout_color :
  195.       actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color
  196.     #self.contents.draw_text(hp_x, y, 48, 32, actor.hp.to_s, 2)
  197.     if flag
  198.       self.contents.font.color = normal_color
  199.       #self.contents.draw_text(hp_x + 48, y, 12, 32, "/", 1)
  200.       self.contents.draw_text(hp_x + 84, y, 48, 32, actor.maxhp.to_s)
  201.     end
  202.   end
  203.   #--------------------------------------------------------------------------
  204.   def draw_actor_sp2(actor, x, y, width = 144)
  205.     self.contents.font.color = system_color
  206.     self.contents.draw_text(x, y, 32, 32, $data_system.words.sp)
  207.     if width - 32 >= 108
  208.       sp_x = x + width - 108
  209.       flag = true
  210.     elsif width - 32 >= 48
  211.       sp_x = x + width - 48
  212.       flag = false
  213.     end
  214.     self.contents.font.color = actor.sp == 0 ? knockout_color :
  215.       actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color
  216.     #self.contents.draw_text(sp_x, y, 48, 32, actor.sp.to_s, 2)
  217.     if flag
  218.       self.contents.font.color = normal_color
  219.       #self.contents.draw_text(sp_x + 48, y, 12, 32, "/", 1)
  220.       self.contents.draw_text(sp_x + 84, y, 48, 32, actor.maxsp.to_s)
  221.     end
  222.   end
  223.  #--------------------------------------------------------------------------
  224.  def draw_enemy_book_id(enemy, x, y)
  225.    self.contents.font.color = normal_color
  226.    id = $game_temp.enemy_book_data.id_data.index(enemy.id)
  227.    self.contents.draw_text(x, y, 32, 32, id.to_s)
  228.  end
  229.  #--------------------------------------------------------------------------
  230.  def draw_enemy_name(enemy, x, y)
  231.    self.contents.font.color = normal_color
  232.    self.contents.draw_text(x, y, 152, 32, enemy.name)
  233.  end
  234.  #--------------------------------------------------------------------------
  235.  def draw_enemy_graphic(enemy, x, y, opacity = 255)
  236.    bitmap = RPG::Cache.battler(enemy.battler_name, enemy.battler_hue)
  237.    cw = bitmap.width
  238.    ch = bitmap.height
  239.    src_rect = Rect.new(0, 0, cw, ch)
  240.    x = x + (cw / 2 - x) if cw / 2 > x
  241.    self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect, opacity)
  242.  end
  243.  #--------------------------------------------------------------------------
  244.  def draw_enemy_exp(enemy, x, y)
  245.    self.contents.font.color = system_color
  246.    self.contents.draw_text(x, y, 120, 32, "EXP")
  247.    self.contents.font.color = normal_color
  248.    self.contents.draw_text(x + 120, y, 36, 32, enemy.exp.to_s, 2)
  249.  end
  250.  #--------------------------------------------------------------------------
  251.  def draw_enemy_gold(enemy, x, y)
  252.    self.contents.font.color = system_color
  253.    self.contents.draw_text(x, y, 120, 32, $data_system.words.gold)
  254.    self.contents.font.color = normal_color
  255.    self.contents.draw_text(x + 120, y, 36, 32, enemy.gold.to_s, 2)
  256.  end
  257. end
  258.  
  259. class Game_Enemy_Book < Game_Enemy
  260.  #--------------------------------------------------------------------------
  261.  def initialize(enemy_id)
  262.    super(2, 1)
  263.    @enemy_id = enemy_id
  264.    enemy = $data_enemies[@enemy_id]
  265.    @battler_name = enemy.battler_name
  266.    @battler_hue = enemy.battler_hue
  267.    @hp = maxhp
  268.    @sp = maxsp
  269.  end
  270. end
  271.  
  272. class Data_MonsterBook
  273.  attr_reader :id_data
  274.  #--------------------------------------------------------------------------
  275.  def initialize
  276.    @id_data = enemy_book_id_set
  277.  end
  278.  #--------------------------------------------------------------------------
  279.  def no_add_element
  280.    no_add = 0
  281.    for i in 1...$data_system.elements.size
  282.      if $data_system.elements[i] =~ /図鑑登録無効/
  283.        no_add = i
  284.        break
  285.      end
  286.    end
  287.    return no_add
  288.  end
  289.  #--------------------------------------------------------------------------
  290.  def enemy_book_id_set
  291.    data = [0]
  292.    no_add = no_add_element
  293.    for i in 1...$data_enemies.size
  294.      enemy = $data_enemies[i]
  295.      next if enemy.name == ""
  296.      if enemy.element_ranks[no_add] == 1
  297.        next
  298.      end
  299.      data.push(enemy.id)
  300.    end
  301.    return data
  302.  end
  303. end
  304.  
  305.  
  306. class Window_MonsterBook < Window_Selectable
  307.  attr_reader   :data
  308.  #--------------------------------------------------------------------------
  309.  def initialize(index=0)
  310.    super(0, 64, 576, 352)
  311.    @column_max = 2
  312.    @book_data = $game_temp.enemy_book_data
  313.    @data = @book_data.id_data.dup
  314.    @data.shift
  315.    #@data.sort!
  316.    @item_max = @data.size
  317.    self.index = 0
  318.    refresh if @item_max > 0
  319.  end
  320.  #--------------------------------------------------------------------------
  321.  def data_set
  322.    data = $game_party.enemy_info.keys
  323.    data.sort!
  324.    newdata = []
  325.    for i in data
  326.      next if $game_party.enemy_info[i] == 0
  327.      if book_id(i) != nil
  328.        newdata.push(i)
  329.      end
  330.    end
  331.    return newdata
  332.  end
  333.  #--------------------------------------------------------------------------
  334.  def show?(id)
  335.    if $game_party.enemy_info[id] == 0 or $game_party.enemy_info[id] == nil
  336.      return false
  337.    else
  338.      return true
  339.    end
  340.  end
  341.  #--------------------------------------------------------------------------
  342.  def book_id(id)
  343.    return @book_data.index(id)
  344.  end
  345.  #--------------------------------------------------------------------------
  346.  def item
  347.    return @data[self.index]
  348.  end
  349.  #--------------------------------------------------------------------------
  350.  def refresh
  351.    if self.contents != nil
  352.      self.contents.dispose
  353.      self.contents = nil
  354.    end
  355.    self.contents = Bitmap.new(width - 32, row_max * 32)
  356.    self.contents.font.name= $fontface
  357.    self.contents.font.size= 20
  358.    if @item_max > 0
  359.      for i in 0...@item_max
  360.       draw_item(i)
  361.      end
  362.    end
  363.  end
  364.  #--------------------------------------------------------------------------
  365.  def draw_item(index)
  366.    enemy = $data_enemies[@data[index]]
  367.    return if enemy == nil
  368.    x = 4 + index % 2 * (256 + 32)
  369.    y = index / 2 * 32
  370.    rect = Rect.new(x, y, self.width / @column_max - 32, 32)
  371.    self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  372.    self.contents.font.color = normal_color
  373.    draw_enemy_book_id(enemy, x, y)
  374.    if show?(enemy.id)
  375.      self.contents.draw_text(x + 28+16, y, 212, 32, enemy.name, 0)
  376.    else
  377.      self.contents.draw_text(x + 28+16, y, 212, 32, "????????????????", 0)
  378.      return
  379.    end
  380.    if analyze?(@data[index])
  381.      self.contents.font.color = text_color(3)
  382.      self.contents.draw_text(x + 256, y, 24, 32, "済", 2)
  383.    end
  384.  end
  385.  #--------------------------------------------------------------------------
  386.  def analyze?(enemy_id)
  387.    if $game_party.enemy_info[enemy_id] == 2
  388.      return true
  389.    else
  390.      return false
  391.    end
  392.  end
  393. end
  394.  
  395.  
  396. class Window_MonsterBook_Info < Window_Base
  397.  include Enemy_Book_Config
  398.  #--------------------------------------------------------------------------
  399.  def initialize
  400.    super(0, 0+64, 576, 416-64)
  401.    self.contents = Bitmap.new(width - 32, height - 32)
  402.    self.contents.font.name= $fontface
  403.    self.contents.font.size= 20
  404.  end
  405.  #--------------------------------------------------------------------------
  406.  def refresh(enemy_id)
  407.    self.contents.clear
  408.    enemy = Game_Enemy_Book.new(enemy_id)
  409.    draw_enemy_graphic(enemy, 0, 240+48, 200)
  410.    draw_enemy_book_id(enemy, 4, 0)
  411.    draw_enemy_name(enemy, 48, 0)
  412.    draw_actor_hp2(enemy, 227, 0)
  413.    draw_actor_sp2(enemy, 227+160, 0)
  414. draw_actor_parameter(enemy, 227    ,  32, 0)
  415.    self.contents.font.color = normal_color
  416.    draw_actor_parameter(enemy, 288+100, 32, 7)
  417.    draw_actor_parameter(enemy, 227    ,  64, 3)
  418.    draw_actor_parameter(enemy, 288+100,  64, 4)
  419.    draw_actor_parameter(enemy, 227    ,  96, 5)
  420.    draw_actor_parameter(enemy, 288+100,  96, 6)
  421.    draw_actor_parameter(enemy, 227    , 128, 1)
  422.    draw_actor_parameter(enemy, 288+100, 128, 2)
  423.    draw_enemy_exp(enemy, 227, 160)
  424.    draw_enemy_gold(enemy, 227+160, 160)
  425.    if analyze?(enemy.id) or !DROP_ITEM_NEED_ANALYZE
  426.      self.contents.draw_text(260, 192, 96, 32, "Drop Item")
  427.      draw_enemy_drop_item(enemy, 288+96+4, 192)
  428.      self.contents.font.color = normal_color
  429.      #draw_element_guard(enemy, 320-32, 160-16+96)
  430.    end
  431.  end
  432.  #--------------------------------------------------------------------------
  433.  def analyze?(enemy_id)
  434.    if $game_party.enemy_info[enemy_id] == 2
  435.      return true
  436.    else
  437.      return false
  438.    end
  439.  end
  440. end
  441. #==============================================================================
  442. # END BESTIARY
  443.  
  444.  
  445.  
  446.  
  447. #==============================================================================
  448. # Window_SwitchParty class definition
  449. #------------------------------------------------------------------------------
  450. # A window that displays all 4 character slots in the party, and offers a
  451. #   cursor to modify it.
  452. #
  453. #   By exseiken, October 04, 2004
  454. #==============================================================================
  455.  
  456. class Window_SwitchParty < Window_Selectable
  457.  
  458.  
  459.  #----------------------------------------------------------------------------
  460.  # Create public access variables
  461.  #----------------------------------------------------------------------------
  462.  attr_reader   :new_party                # The party shown in the window [R-O]
  463.  
  464.  
  465.  #----------------------------------------------------------------------------
  466.  # Window's constructor. Create the window's contents, makes a copy of the
  467.  #     current party, then stocks it into member variable new_party, for later
  468.  #     use.
  469.  #----------------------------------------------------------------------------
  470.  def initialize()
  471.    # create the window and its contents
  472.    super(32, 32, 224, 416)
  473.    self.contents = Bitmap.new(width - 32, height - 32)
  474.    self.contents.font.name = $fontface
  475.    self.contents.font.size = 20
  476.    
  477.    # copy the party
  478.    @new_party = $game_party.actors.clone
  479.    
  480.    # always 4 party members
  481.    @item_max = 4
  482.    
  483.    # select the first character
  484.    if @new_party.size > 0
  485.      @index = @new_party.index(@new_party.first )
  486.      
  487.    else
  488.      @index = 0
  489.      
  490.    end
  491.    
  492.    # draw the window's contents
  493.    refresh
  494.    
  495.    # update the cursor rectangle
  496.    update_cursor_rect
  497.  
  498.  end
  499.  
  500.  
  501.  #----------------------------------------------------------------------------
  502.  # Return the actor currently selected.
  503.  #----------------------------------------------------------------------------
  504.  def actor
  505.    # return the selected actor, or nil if none
  506.    @new_party[@index]
  507.    
  508.  end
  509.  
  510.  
  511.  #----------------------------------------------------------------------------
  512.  # Update the contents of the window: clear the contents bitmap, then rebuild
  513.  #     it.
  514.  #----------------------------------------------------------------------------
  515.  def refresh
  516.    # clear the contents of the bitmap
  517.    self.contents.clear
  518.    
  519.    # draw each non-null party member
  520.    for i in 0..@new_party.size - 1
  521.      # get the actor
  522.      actor = @new_party[i]
  523.      
  524.      # if the actor is valid, draw it on the screen
  525.      if actor != nil
  526.        # calculate the y coordinate
  527.        y = 96 * i
  528.        
  529.        # draw the actor's graphic
  530.        draw_actor_graphic(actor, 24, y + 80)
  531.        
  532.        # draw the actor's name
  533.        draw_actor_name(actor, 64, y + 32)
  534.  
  535.        # if the actor is not available, write in red "can't select"
  536.        if actor.mandatory
  537.          self.contents.font.color = Color.new(255, 0, 0, 255)
  538.          self.contents.draw_text(0, y, 224, 32, "Unswitchable", 1)
  539.          
  540.        end
  541.        
  542.      end
  543.      
  544.    end
  545.  
  546.  end
  547.  
  548.  
  549.  #----------------------------------------------------------------------------
  550.  # Update the position rectangle of the cursor.
  551.  #----------------------------------------------------------------------------
  552.  def update_cursor_rect
  553.    # reset the cursor rectangle
  554.    self.cursor_rect.set(0, 96 * @index, width - 32, 96)
  555.  
  556.  end
  557.  
  558.  
  559.  #----------------------------------------------------------------------------
  560.  # Change the actor selected for another, then redraw the entire window.
  561.  #
  562.  # Parameters:
  563.  #     actors:             The actor that will replace the selected one
  564.  #----------------------------------------------------------------------------
  565.  def change_selection(actor)
  566.    # change the actor (can be nil to remove it)
  567.    @new_party[@index] = actor
  568.    
  569.    # redraw the window
  570.    refresh
  571.  
  572.  end
  573.  
  574.  
  575.  #----------------------------------------------------------------------------
  576.  # Update the help window. (Here, the help window is really the actor status
  577.  #     window.)
  578.  #----------------------------------------------------------------------------
  579.  def update_help
  580.    # draw the selected actor's name, level, status conditions and stats
  581.    @help_window.draw_actor_status(@new_party[@index])
  582.    
  583.  end
  584.  
  585. end
  586.  
  587. #==============================================================================
  588. # Window_SwitchReserve class definition
  589. #------------------------------------------------------------------------------
  590. # A window that displays all characters available to pick in the party. Offers
  591. #   a cursor to select them
  592. #
  593. #   By exseiken, October 06, 2004 (v. 1.01)
  594. #==============================================================================
  595.  
  596. class Window_SwitchReserve < Window_Selectable
  597.  
  598.  
  599.  #----------------------------------------------------------------------------
  600.  # Window constructor. Create the contents bitmap and fill it with all
  601.  #     characters that are not into the party, but that are loaded in the data
  602.  #     member of the Game_Actors global object.
  603.  #
  604.  # Parameters:
  605.  #     max_size:           The maximum of characters that can fit into that
  606.  #                         window
  607.  #----------------------------------------------------------------------------
  608.  def initialize(max_size)
  609.    # initialize the window and its contents
  610.    super(256, 160, 352, 288)
  611.    self.contents = Bitmap.new(width - 32, ((max_size & ~(0x01)) << 5) + ((max_size & 0x01) << 6))
  612.    self.contents.font.name = $fontface
  613.    self.contents.font.size = 20
  614.    
  615.    # initialize the list for the first time
  616.    @actor_list = $game_actors.data.clone
  617.    
  618.    # remove currently active party members
  619.    $game_party.actors.each do |actor|
  620.      @actor_list[actor.actor_id] = nil
  621.      
  622.    end
  623.    
  624.    # remove all actors that are unavailable
  625.    $game_actors.data.each do |actor|
  626.      if actor != nil and actor.unavailable
  627.        @actor_list[actor.actor_id] = nil
  628.        
  629.      end
  630.      
  631.    end
  632.    
  633.    # remove all holes in the list
  634.    @actor_list.compact!
  635.    
  636.    # set the maximum of characters the list can contain
  637.    @item_max = max_size
  638.    
  639.    # 2 columns
  640.    @column_max = 2
  641.    
  642.    # select the first item
  643.    @index = 0
  644.    
  645.    # default: unactive
  646.    self.active = false
  647.    
  648.    # draw the window's contents
  649.    refresh
  650.    
  651.    # draw the cursor rectangle
  652.    update_cursor_rect
  653.  
  654.  end
  655.  
  656.  
  657.  #----------------------------------------------------------------------------
  658.  # Update the contents of the window: clear the contents bitmap, then rebuild
  659.  #     it.
  660.  #----------------------------------------------------------------------------
  661.  def refresh
  662.    # clear the contents of the bitmap
  663.    self.contents.clear
  664.    
  665.    # display all actors
  666.    for i in 0..@actor_list.size
  667.      # get the concerned actor
  668.      actor = @actor_list[i]
  669.      
  670.      # if the actor is non-nil, draw it
  671.      if actor != nil
  672.        # get the coordinates
  673.        x = (i & 0x01) == 1 ? self.width / @column_max : 0
  674.        y = (i >> 0x01) * 64
  675.        
  676.        # draw the actor's sprite
  677.        draw_actor_graphic(actor, x + 24, y + 48)
  678.        
  679.        # draw the actor's name
  680.        draw_actor_name(actor, x + 64, y + 16)
  681.        
  682.      end
  683.    
  684.    end
  685.      
  686.  end
  687.  
  688.  
  689.  #----------------------------------------------------------------------------
  690.  # Update the position rectangle of the cursor.
  691.  #----------------------------------------------------------------------------
  692.  def update_cursor_rect
  693.    # if the screen is not active, or the cursor is invalid, don't display the
  694.    # cursor
  695.    if not active or @index < 0
  696.      # set an empty cursor
  697.      self.cursor_rect.empty
  698.      
  699.      # stop
  700.      return
  701.      
  702.    end
  703.    
  704.    # get the row of the item
  705.    row = @index / @column_max
  706.    
  707.    # if the cursor went over the window, scroll up
  708.    if row < self.top_row
  709.      # set the top row as the current row
  710.      self.top_row = row
  711.      
  712.    end
  713.    
  714.    # if the cursor went farther than the bottom of the window, scroll down
  715.    if row > self.top_row + (self.page_row_max - 1)
  716.      # set the bottom row as the current row
  717.      self.top_row = row - (self.page_row_max - 1)
  718.      
  719.    end
  720.    
  721.    # set the width of the cursor
  722.    cursor_width = self.width / @column_max - 32
  723.    
  724.    # get the upper-left coordinates of the window
  725.    x = @index % @column_max * (cursor_width + 32)
  726.    y = @index / @column_max * 64 - self.oy
  727.    
  728.    # set the cursor rectangle
  729.    self.cursor_rect.set(x, y, cursor_width, 64)
  730.      
  731.  end
  732.  
  733.  
  734.  #----------------------------------------------------------------------------
  735.  # Takes a character, put in into the list at the selected position, and
  736.  #     returns the character that was presently there. If there was no
  737.  #     character, returns nil.
  738.  #
  739.  # Parameters:
  740.  #     actor_to_switch:    The character to put at the selected position
  741.  #----------------------------------------------------------------------------
  742.  def swap_characters(actor_to_switch)
  743.    # store the old actor (needed for swapping)
  744.    old_actor = @actor_list[@index]
  745.    
  746.    # put the new actor at the place
  747.    @actor_list[@index] = actor_to_switch
  748.    
  749.    # redraw the window
  750.    refresh
  751.    
  752.    # return the old actor
  753.    return old_actor
  754.  
  755.  end
  756.  
  757.  
  758.  #----------------------------------------------------------------------------
  759.  # Update the help window. (Here, the help window is really the actor status
  760.  #     window.)
  761.  #----------------------------------------------------------------------------
  762.  def update_help
  763.    # draw the selected actor's name, level, status conditions and stats
  764.    @help_window.draw_actor_status(@actor_list[@index])
  765.    
  766.  end
  767.  
  768.  
  769.  #--------------------------------------------------------------------------
  770.  # Return the index of the top row, that is, the first row that is displayed
  771.  #     on the window.
  772.  #--------------------------------------------------------------------------
  773.  def top_row
  774.    # divide the coordinate of the top of the bitmap by the cursor's height,
  775.    # 64, returning the index of the top row
  776.    return self.oy / 64
  777.    
  778.  end
  779.  
  780.  
  781.  #--------------------------------------------------------------------------
  782.  # Validate, and set the top row to a new value. The validation makes sure
  783.  #     that the new row is not off-limits.
  784.  #
  785.  # Parameters:
  786.  #     row : the index of the row to be set as the new top row
  787.  #--------------------------------------------------------------------------
  788.  def top_row=(row)
  789.    # forces the new row to be positive
  790.    if row < 0
  791.      row = 0
  792.      
  793.    end
  794.    
  795.    # forces the new row to be less or equal to the maximum
  796.    if row > row_max - 1
  797.      row = row_max - 1
  798.      
  799.    end
  800.    
  801.    # return the top of the window by multiplying it by the height of the
  802.    # cursor window: 64.
  803.    self.oy = row * 64
  804.    
  805.  end
  806.  
  807.  
  808.  #--------------------------------------------------------------------------
  809.  # Return the maximum amount of rows that can
  810.  #--------------------------------------------------------------------------
  811.  def page_row_max
  812.    # return the maximum of rows fitting in a page by dividing the
  813.    # height of the bitmap by the height of a window, 64
  814.    return (self.height - 32) / 64
  815.    
  816.  end
  817.  
  818. end
  819.  
  820. #==============================================================================
  821. # Window_SwitchStatus class definition
  822. #------------------------------------------------------------------------------
  823. # A window that displays the status of a character being selected.
  824. #
  825. #   By exseiken, October 06, 2004 (v. 1.01)
  826. #==============================================================================
  827.  
  828. class Window_SwitchStatus < Window_Base
  829.  
  830.  
  831.  #----------------------------------------------------------------------------
  832.  # Construct the window: create the contents bitmap.
  833.  #----------------------------------------------------------------------------
  834.  def initialize
  835.    # create the window and initialize its contents
  836.    super(256, 32, 352, 128)
  837.    self.contents = Bitmap.new(width - 32, height - 32)
  838.    self.contents.font.name = $fontface
  839.   self.contents.font.size = 20
  840.    
  841.  end
  842.  
  843.  
  844.  #----------------------------------------------------------------------------
  845.  # Draw the status on an actor on the window's contents.
  846.  #
  847.  # Parameters:
  848.  #     actor:              The actor to put on the screen
  849.  #----------------------------------------------------------------------------
  850.  def draw_actor_status(actor)
  851.    # clear the contents of the bitmap
  852.    self.contents.clear
  853.    
  854.    # if the actor to draw is nil, leave the window empty
  855.    if actor == nil
  856.      return
  857.      
  858.    end
  859.    
  860.    # draw the actor's graphic
  861.    draw_actor_graphic(actor, 24, 64)
  862.    
  863.    # draw the actor's name, level
  864.    draw_actor_name(actor, 64, 0)
  865.    draw_actor_level(actor, 256, 0)
  866.    draw_actor_hp(actor, 64, 32)
  867.    draw_actor_sp(actor, 64, 64)
  868.  
  869.  end
  870.  
  871. end
  872. #==============================================================================
  873. # END SWITCH SCREEN
  874.  
  875.  
  876.  
  877. #==============================================================================
  878. # ■ Game_System
  879. #==============================================================================
  880.  
  881. class Game_System
  882.  
  883.   attr_reader   :map_interpreter          
  884.   attr_reader   :battle_interpreter      
  885.   attr_accessor :timer                    
  886.   attr_accessor :timer_working            
  887.   attr_accessor :save_disabled            
  888.   attr_accessor :menu_disabled            
  889.   attr_accessor :encounter_disabled      
  890.   attr_accessor :message_position        
  891.   attr_accessor :message_frame            
  892.   attr_accessor :save_count              
  893.   attr_accessor :magic_number            
  894.   attr_accessor :bgm_volume
  895.   attr_accessor :se_volume
  896.  
  897.   def initialize
  898.     @map_interpreter = Interpreter.new(0, true)
  899.     @battle_interpreter = Interpreter.new(0, false)
  900.     @timer = 0
  901.     @timer_working = false
  902.     @save_disabled = false
  903.     @menu_disabled = false
  904.     @encounter_disabled = false
  905.     @message_position = 2
  906.     @message_frame = 0
  907.     @save_count = 0
  908.     @magic_number = 0
  909.     @bgm_volume = 100
  910.     @se_volume = 100    
  911.   end
  912.  
  913.   def bgm_play(bgm)
  914.     @playing_bgm = bgm
  915.     if bgm != nil and bgm.name != ""
  916.       Audio.bgm_play("Audio/BGM/" + bgm.name , bgm.volume * bgm_volume / 100, bgm.pitch)
  917.     else
  918.       Audio.bgm_stop
  919.     end
  920.     Graphics.frame_reset
  921.   end
  922.  
  923.   def bgs_play(bgs)
  924.     @playing_bgs = bgs
  925.     if bgs != nil and bgs.name != ""
  926.       Audio.bgs_play("Audio/BGS/" + bgs.name, bgs.volume * se_volume / 100, bgs.pitch)
  927.     else
  928.       Audio.bgs_stop
  929.     end
  930.     Graphics.frame_reset
  931.   end
  932.  
  933.   def me_play(me)
  934.     if me != nil and me.name != ""
  935.       Audio.me_play("Audio/ME/" + me.name, me.volume * se_volume / 100, me.pitch)
  936.     else
  937.       Audio.me_stop
  938.     end
  939.     Graphics.frame_reset
  940.   end
  941.  
  942.   def se_play(se)
  943.     if se != nil and se.name != ""
  944.       Audio.se_play("Audio/SE/" + se.name, se.volume * se_volume / 100, se.pitch)
  945.     end
  946.   end
  947.  
  948. end
  949.  
  950. #==============================================================================
  951. # ■ Game_Actor
  952. #==============================================================================
  953.  
  954. class Game_Actor < Game_Battler
  955. def now_exp
  956.   return @exp - @exp_list[@level]
  957. end
  958. def next_exp
  959.   return @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0
  960. end
  961.  
  962. end
  963.  
  964. #==============================================================================
  965. # ■ Game_Map
  966. #==============================================================================
  967.  
  968.   class Game_Map
  969.        
  970.   def name
  971.      $map_infos[@map_id]
  972.   end
  973.    
  974. end
  975.  
  976. #==============================================================================
  977. # ■ class Game_Time                                              
  978. # written by Deke                                                            
  979. #--------------------------------------------------------------------------------------------------------------------------------------------
  980. #==============================================================================
  981. class Game_Time
  982.  
  983. attr_accessor :minute_length
  984.  
  985. def initialize
  986.  @minute_length=2.0      #length of game minute in real seconds
  987.  @hour_length= 60.0      #minute in an hour
  988.  @day_length=24.0        #hours in a day
  989.  @month_length=30.0    #days in a month
  990.  @year_length=12.0       #months in a year
  991.  @minutes=0                 #starting minute count
  992.  start_minute=0
  993.  add_minutes(start_minute)
  994.  start_hour=23             #starting hour count
  995.  add_hours(start_hour)
  996.  start_day=13                 #starting day count
  997.  add_days(start_day)
  998.  start_month=4              #starting month count
  999.  add_months(start_month-1)
  1000.  start_year=1207              #starting year count
  1001.  add_years(start_year)
  1002. end
  1003.  
  1004. def add_minutes(minutes)
  1005.  @minutes +=minutes
  1006. end
  1007.  
  1008. def add_hours(hours)
  1009.  @minutes +=hours*@hour_length
  1010. end
  1011.  
  1012. def add_days(days)
  1013.  @minutes += days*@hour_length*@day_length
  1014. end
  1015.  
  1016. def add_months(months)
  1017.  @minutes +=months * @hour_length*@day_length*@month_length
  1018. end
  1019.  
  1020. def add_years(years)
  1021.  @minutes += years * @hour_length*@day_length*@month_length * @year_length
  1022. end
  1023.  
  1024.  
  1025. def get_year
  1026.   minutes=get_total_minutes
  1027.   year=minutes / @hour_length / @day_length / @month_length  / @year_length
  1028.   return year
  1029. end
  1030.  
  1031. def get_month
  1032.   minutes=get_total_minutes
  1033.   month=minutes / @hour_length / @day_length /  @month_length % @year_length + 1
  1034.   return month
  1035. end
  1036.  
  1037. def get_day
  1038.   minutes=get_total_minutes
  1039.   day=minutes / @hour_length / @day_length % @month_length
  1040.   return day
  1041. end  
  1042.  
  1043. def get_hour
  1044.   minutes=get_total_minutes
  1045.   hour=minutes / @hour_length % @day_length
  1046.   return hour
  1047. end
  1048.  
  1049. def get_total_minutes
  1050.   total_sec=Graphics.frame_count / Graphics.frame_rate
  1051.   minute=(total_sec/@minute_length+@minutes)
  1052.   return minute
  1053. end
  1054.  
  1055. def get_minute
  1056.  minutes=get_total_minutes % @hour_length
  1057.  return minutes
  1058. end
  1059.  
  1060. def get_tone
  1061.  period_length=Math::PI*(get_hour / @day_length)
  1062.  red_shift=  -100+ 115*Math.sin(period_length)
  1063.  green_shift=  -140+ 155*Math.sin(period_length)
  1064.  blue_shift=  -150+ 165*Math.sin(period_length)
  1065.  return Tone.new(red_shift, green_shift, blue_shift, 0)
  1066. end
  1067.  
  1068. end
  1069.  
  1070. #==============================================================================
  1071. # ■ Window_Base
  1072. #==============================================================================
  1073.  
  1074. class Window_Base < Window
  1075.  
  1076.   def draw_actor_battler(actor, x, y)
  1077.     bitmap = RPG::Cache.battler(actor.battler_name, actor.battler_hue)
  1078.     cw =bitmap.width
  1079.     ch = bitmap.height
  1080.     src_rect = Rect.new(0, 0, cw,ch)
  1081.     self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect)
  1082.   end
  1083.  
  1084.   FONT_SIZE          = 16
  1085.   NUMBER_OF_ELEMENTS = 8
  1086.   ELEMENT_ORDER      = [1,2,3,4,5,6, 7, 8]
  1087.   GRAPH_SCALINE_COLOR        = Color.new(255, 255, 255, 128)
  1088.   GRAPH_SCALINE_COLOR_SHADOW = Color.new(  0,   0,   0, 192)
  1089.   GRAPH_LINE_COLOR           = Color.new(255, 255,  64, 255)
  1090.   GRAPH_LINE_COLOR_MINUS     = Color.new( 64, 255, 255, 255)
  1091.   GRAPH_LINE_COLOR_PLUS      = Color.new(255,  64,  64, 255)
  1092.  
  1093.   def draw_actor_element_radar_graph(actor, x, y, radius = 43)
  1094.     cx = x + radius + FONT_SIZE + 48
  1095.     cy = y + radius + FONT_SIZE + 32
  1096.     for loop_i in 0..NUMBER_OF_ELEMENTS
  1097.       if loop_i == 0
  1098.       else
  1099.       @pre_x  = @now_x
  1100.       @pre_y  = @now_y
  1101.       @pre_ex = @now_ex
  1102.       @pre_ey = @now_ey
  1103.       @color1 = @color2
  1104.     end
  1105.     if loop_i == NUMBER_OF_ELEMENTS
  1106.       eo = ELEMENT_ORDER[0]
  1107.     else
  1108.       eo = ELEMENT_ORDER[loop_i]
  1109.     end
  1110.     er = actor.element_rate(eo)
  1111.     estr = $data_system.elements[eo]
  1112.     @color2 = er < 0 ? GRAPH_LINE_COLOR_MINUS : er > 100 ? GRAPH_LINE_COLOR_PLUS : GRAPH_LINE_COLOR
  1113.     er = er.abs
  1114.     th = Math::PI * (0.5 - 2.0 * loop_i / NUMBER_OF_ELEMENTS)
  1115.     @now_x  = cx + (radius * Math.cos(th)).floor
  1116.     @now_y  = cy - (radius * Math.sin(th)).floor
  1117.     @now_wx = cx - 6 + ((radius + FONT_SIZE * 3 / 2) * Math.cos(th)).floor - FONT_SIZE
  1118.     @now_wy = cy - ((radius + FONT_SIZE * 1 / 2) * Math.sin(th)).floor - FONT_SIZE/2
  1119.     @now_vx = cx + ((radius + FONT_SIZE * 8 / 2) * Math.cos(th)).floor - FONT_SIZE
  1120.      @now_vy = cy - ((radius + FONT_SIZE * 3 / 2) * Math.sin(th)).floor - FONT_SIZE/2
  1121.      @now_ex = cx + (er*radius/100 * Math.cos(th)).floor
  1122.      @now_ey = cy - (er*radius/100 * Math.sin(th)).floor
  1123.      if loop_i == 0
  1124.        @pre_x  = @now_x
  1125.        @pre_y  = @now_y
  1126.        @pre_ex = @now_ex
  1127.        @pre_ey = @now_ey
  1128.        @color1 = @color2
  1129.      else      
  1130.      end
  1131.      next if loop_i == 0
  1132.      self.contents.draw_line(cx+1,cy+1, @now_x+1,@now_y+1, GRAPH_SCALINE_COLOR_SHADOW)
  1133.      self.contents.draw_line(@pre_x+1,@pre_y+1, @now_x+1,@now_y+1, GRAPH_SCALINE_COLOR_SHADOW)
  1134.      self.contents.draw_line(cx,cy, @now_x,@now_y, GRAPH_SCALINE_COLOR)
  1135.      self.contents.draw_line(@pre_x,@pre_y, @now_x,@now_y, GRAPH_SCALINE_COLOR)
  1136.      self.contents.draw_line(@pre_ex,@pre_ey, @now_ex,@now_ey, @color1, 2, @color2)
  1137.      self.contents.font.color = system_color
  1138.      self.contents.draw_text(@now_wx,@now_wy, FONT_SIZE*3.1, FONT_SIZE, estr, 1)
  1139.      self.contents.font.color = Color.new(255,255,255,128)
  1140.      self.contents.draw_text(@now_vx,@now_vy, FONT_SIZE*2, FONT_SIZE, er.to_s + "%", 2)
  1141.      self.contents.font.color = normal_color
  1142.    end
  1143.  end
  1144.  
  1145. alias :draw_actor_hp_original :draw_actor_hp
  1146. def draw_actor_hp(actor, x, y, width = 144)
  1147.   if actor.maxhp != 0
  1148.     rate = actor.hp.to_f / actor.maxhp
  1149.   else
  1150.     rate = 0
  1151.   end
  1152.   plus_x = 0
  1153.   rate_x = 0
  1154.   plus_y = 25
  1155.   plus_width = 0
  1156.   rate_width = 100
  1157.   height = 10
  1158.   align1 = 1
  1159.   align2 = 2
  1160.   align3 = 0
  1161.   grade1 = 1
  1162.   grade2 = 0
  1163.   color1 = Color.new(0, 0, 0, 192)
  1164.   color2 = Color.new(255, 255, 192, 192)
  1165.   color3 = Color.new(0, 0, 0, 192)
  1166.   color4 = Color.new(64, 0, 0, 192)
  1167.   color5 = Color.new(80 - 24 * rate, 80 * rate, 14 * rate, 192)
  1168.   color6 = Color.new(240 - 72 * rate, 240 * rate, 62 * rate, 192)
  1169.   if actor.maxhp != 0
  1170.     hp = (width + plus_width) * actor.hp * rate_width / 100 / actor.maxhp
  1171.   else
  1172.     hp = 0
  1173.   end
  1174.   gauge_rect(x + plus_x + width * rate_x / 100, y + plus_y,
  1175.               width, plus_width + width * rate_width / 100,
  1176.               height, hp, align1, align2, align3,
  1177.               color1, color2, color3, color4, color5, color6, grade1, grade2)
  1178.   draw_actor_hp_original(actor, x, y, width)
  1179. end
  1180.  
  1181. alias :draw_actor_sp_original :draw_actor_sp
  1182. def draw_actor_sp(actor, x, y, width = 144)
  1183.   if actor.maxsp != 0
  1184.     rate = actor.sp.to_f / actor.maxsp
  1185.   else
  1186.     rate = 1
  1187.   end  
  1188.   plus_x = 0
  1189.   rate_x = 0
  1190.   plus_y = 25
  1191.   plus_width = 0
  1192.   rate_width = 100
  1193.   height = 10
  1194.   align1 = 1
  1195.   align2 = 2
  1196.   align3 = 0
  1197.   grade1 = 1
  1198.   grade2 = 0
  1199.   color1 = Color.new(0, 0, 0, 192)
  1200.   color2 = Color.new(255, 255, 192, 192)
  1201.   color3 = Color.new(0, 0, 0, 192)
  1202.   color4 = Color.new(0, 64, 0, 192)
  1203.   color5 = Color.new(14 * rate, 80 - 24 * rate, 80 * rate, 192)
  1204.   color6 = Color.new(62 * rate, 240 - 72 * rate, 240 * rate, 192)
  1205.   if actor.maxsp != 0
  1206.     sp = (width + plus_width) * actor.sp * rate_width / 100 / actor.maxsp
  1207.   else
  1208.     sp = (width + plus_width) * rate_width / 100
  1209.   end
  1210.   gauge_rect(x + plus_x + width * rate_x / 100, y + plus_y,
  1211.               width, plus_width + width * rate_width / 100,
  1212.               height, sp, align1, align2, align3,
  1213.               color1, color2, color3, color4, color5, color6, grade1, grade2)
  1214.   draw_actor_sp_original(actor, x, y, width)
  1215. end
  1216.  
  1217. alias :draw_actor_exp_original :draw_actor_exp
  1218. def draw_actor_exp(actor, x, y, width = 204)
  1219.   if actor.next_exp != 0
  1220.     rate = actor.now_exp.to_f / actor.next_exp
  1221.   else
  1222.     rate = 1
  1223.   end
  1224.   plus_x = 0
  1225.   rate_x = 0
  1226.   plus_y = 25
  1227.   plus_width = 0
  1228.   rate_width = 100
  1229.   height = 10
  1230.   align1 = 1
  1231.   align2 = 2
  1232.   align3 = 0
  1233.   grade1 = 1
  1234.   grade2 = 0
  1235.   color1 = Color.new(0, 0, 0, 192)
  1236.   color2 = Color.new(255, 255, 192, 192)
  1237.   color3 = Color.new(0, 0, 0, 192)
  1238.   color4 = Color.new(64, 0, 0, 192)
  1239.   color5 = Color.new(80 * rate, 80 - 80 * rate ** 2, 80 - 80 * rate, 192)
  1240.   color6 = Color.new(240 * rate, 240 - 240 * rate ** 2, 240 - 240 * rate, 192)
  1241.   if actor.next_exp != 0
  1242.     exp = (width + plus_width) * actor.now_exp * rate_width /
  1243.                                                         100 / actor.next_exp
  1244.   else
  1245.     exp = (width + plus_width) * rate_width / 100
  1246.   end
  1247.   gauge_rect(x + plus_x + width * rate_x / 100, y + plus_y,
  1248.               width, plus_width + width * rate_width / 100,
  1249.               height, exp, align1, align2, align3,
  1250.               color1, color2, color3, color4, color5, color6, grade1, grade2)
  1251.   draw_actor_exp_original(actor, x, y)
  1252. end
  1253.  
  1254. def gauge_rect(x, y, rect_width, width, height, gauge, align1, align2, align3,
  1255.               color1, color2, color3, color4, color5, color6, grade1, grade2)
  1256.   case align1
  1257.   when 1
  1258.     x += (rect_width - width) / 2
  1259.   when 2
  1260.     x += rect_width - width
  1261.   end
  1262.   case align2
  1263.   when 1
  1264.     y -= height / 2
  1265.   when 2
  1266.     y -= height
  1267.   end
  1268.   # ˜g•`‰æ
  1269.   self.contents.fill_rect(x, y, width, height, color1)
  1270.   self.contents.fill_rect(x + 1, y + 1, width - 2, height - 2, color2)
  1271.   if align3 == 0
  1272.     if grade1 == 2
  1273.       grade1 = 3
  1274.     end
  1275.     if grade2 == 2
  1276.       grade2 = 3
  1277.     end
  1278.   end
  1279.   if (align3 == 1 and grade1 == 0) or grade1 > 0
  1280.     color = color3
  1281.     color3 = color4
  1282.     color4 = color
  1283.   end
  1284.   if (align3 == 1 and grade2 == 0) or grade2 > 0
  1285.     color = color5
  1286.     color5 = color6
  1287.     color6 = color
  1288.   end
  1289.   self.contents.gradation_rect(x + 2, y + 2, width - 4, height - 4,
  1290.                                 color3, color4, grade1)
  1291.   if align3 == 1
  1292.     x += width - gauge
  1293.   end
  1294.   self.contents.gradation_rect(x + 2, y + 2, gauge - 4, height - 4,
  1295.                                 color5, color6, grade2)
  1296.   end
  1297.                              
  1298.   def up_color
  1299.     return Color.new(74, 210, 74)
  1300.   end
  1301.  
  1302.   def down_color
  1303.     return Color.new(170, 170, 170)
  1304.   end
  1305.  
  1306.   def draw_actor_parameter(actor, x, y, type)
  1307.     case type
  1308.     when 0
  1309.       parameter_name = $data_system.words.atk
  1310.       parameter_value = actor.atk
  1311.     when 1
  1312.       parameter_name = $data_system.words.pdef
  1313.       parameter_value = actor.pdef
  1314.     when 2
  1315.       parameter_name = $data_system.words.mdef
  1316.       parameter_value = actor.mdef
  1317.     when 3
  1318.       parameter_name = $data_system.words.str
  1319.       parameter_value = actor.str
  1320.     when 4
  1321.       parameter_name = $data_system.words.dex
  1322.       parameter_value = actor.dex
  1323.     when 5
  1324.       parameter_name = $data_system.words.agi
  1325.       parameter_value = actor.agi
  1326.     when 6
  1327.       parameter_name = $data_system.words.int
  1328.       parameter_value = actor.int
  1329.     when 7
  1330.       parameter_name = "Evasion"
  1331.       parameter_value = actor.eva
  1332.     end
  1333.     self.contents.font.color = system_color
  1334.     self.contents.draw_text(x, y, 120, 32, parameter_name)
  1335.     self.contents.font.color = normal_color
  1336.     self.contents.draw_text(x + 120, y, 36, 32, parameter_value.to_s, 2)
  1337.   end
  1338.                              
  1339. end
  1340.  
  1341. #==============================================================================
  1342. # ■ Bitmap
  1343. #==============================================================================
  1344. class Bitmap
  1345.  
  1346.  def draw_line(start_x, start_y, end_x, end_y, start_color, width = 1, end_color = start_color)
  1347.    distance = (start_x - end_x).abs + (start_y - end_y).abs
  1348.    if end_color == start_color
  1349.      for i in 1..distance
  1350.        x = (start_x + 1.0 * (end_x - start_x) * i / distance).to_i
  1351.        y = (start_y + 1.0 * (end_y - start_y) * i / distance).to_i
  1352.        if width == 1
  1353.          self.set_pixel(x, y, start_color)
  1354.        else
  1355.          self.fill_rect(x, y, width, width, start_color)
  1356.        end
  1357.      end
  1358.    else
  1359.      for i in 1..distance
  1360.        x = (start_x + 1.0 * (end_x - start_x) * i / distance).to_i
  1361.        y = (start_y + 1.0 * (end_y - start_y) * i / distance).to_i
  1362.        r = start_color.red   * (distance-i)/distance + end_color.red   * i/distance
  1363.        g = start_color.green * (distance-i)/distance + end_color.green * i/distance
  1364.        b = start_color.blue  * (distance-i)/distance + end_color.blue  * i/distance
  1365.        a = start_color.alpha * (distance-i)/distance + end_color.alpha * i/distance
  1366.        if width == 1
  1367.          self.set_pixel(x, y, Color.new(r, g, b, a))
  1368.        else
  1369.          self.fill_rect(x, y, width, width, Color.new(r, g, b, a))
  1370.        end
  1371.      end
  1372.    end
  1373.  end
  1374.  
  1375.  def gradation_rect(x, y, width, height, color1, color2, align = 0)
  1376.   if align == 0
  1377.     for i in x...x + width
  1378.       red   = color1.red + (color2.red - color1.red) * (i - x) / (width - 1)
  1379.       green = color1.green +
  1380.               (color2.green - color1.green) * (i - x) / (width - 1)
  1381.       blue  = color1.blue +
  1382.               (color2.blue - color1.blue) * (i - x) / (width - 1)
  1383.       alpha = color1.alpha +
  1384.               (color2.alpha - color1.alpha) * (i - x) / (width - 1)
  1385.       color = Color.new(red, green, blue, alpha)
  1386.       fill_rect(i, y, 1, height, color)
  1387.     end
  1388.   elsif align == 1
  1389.     for i in y...y + height
  1390.       red   = color1.red +
  1391.               (color2.red - color1.red) * (i - y) / (height - 1)
  1392.       green = color1.green +
  1393.               (color2.green - color1.green) * (i - y) / (height - 1)
  1394.       blue  = color1.blue +
  1395.               (color2.blue - color1.blue) * (i - y) / (height - 1)
  1396.       alpha = color1.alpha +
  1397.               (color2.alpha - color1.alpha) * (i - y) / (height - 1)
  1398.       color = Color.new(red, green, blue, alpha)
  1399.       fill_rect(x, i, width, 1, color)
  1400.     end
  1401.   elsif align == 2
  1402.     for i in x...x + width
  1403.       for j in y...y + height
  1404.         red   = color1.red + (color2.red - color1.red) *
  1405.                 ((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
  1406.         green = color1.green + (color2.green - color1.green) *
  1407.                 ((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
  1408.         blue  = color1.blue + (color2.blue - color1.blue) *
  1409.                 ((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
  1410.         alpha = color1.alpha + (color2.alpha - color1.alpha) *
  1411.                 ((i - x) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
  1412.         color = Color.new(red, green, blue, alpha)
  1413.         set_pixel(i, j, color)
  1414.       end
  1415.     end
  1416.   elsif align == 3
  1417.     for i in x...x + width
  1418.       for j in y...y + height
  1419.         red   = color1.red + (color2.red - color1.red) *
  1420.               ((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
  1421.         green = color1.green + (color2.green - color1.green) *
  1422.               ((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
  1423.         blue  = color1.blue + (color2.blue - color1.blue) *
  1424.               ((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
  1425.         alpha = color1.alpha + (color2.alpha - color1.alpha) *
  1426.               ((x + width - i) / (width - 1.0) + (j - y) / (height - 1.0)) / 2
  1427.         color = Color.new(red, green, blue, alpha)
  1428.         set_pixel(i, j, color)
  1429.       end
  1430.     end
  1431.   end
  1432. end
  1433.  
  1434. end
  1435.  
  1436. #==============================================================================
  1437. # ■ Sprite
  1438. #==============================================================================
  1439.  
  1440.  
  1441. #==============================================================================
  1442. # ■ Window_MenuCommand
  1443. #==============================================================================
  1444. class Window_MenuCommand < Window_Selectable
  1445.  
  1446.   def initialize(width, commands)
  1447.     super(0, 0, width, commands.size * 32 + 32)
  1448.     @item_max = commands.size
  1449.     @commands = commands
  1450.     self.contents = Bitmap.new(width - 32, @item_max * 32)
  1451.     self.contents.font.name = $fontface
  1452.     self.contents.font.size = 20
  1453.     refresh
  1454.     self.index = 0
  1455.   end
  1456.  
  1457.   def refresh
  1458.     self.contents.clear
  1459.     self.contents.font.name = $fontface
  1460.     self.contents.font.size = 20
  1461.     for i in 0...@item_max
  1462.       draw_item(i, normal_color)
  1463.     end
  1464.   end
  1465.  
  1466.   def draw_item(index, color)
  1467.     self.contents.font.color = color
  1468.     rect = Rect.new(24, 32 * index, self.contents.width - 8, 32)
  1469.     self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  1470.     bitmap = RPG::Cache.icon("menu" + index.to_s)
  1471.     self.contents.blt(x + 3, index * 32 +4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  1472.     self.contents.draw_text(rect, @commands[index])
  1473.   end
  1474.  
  1475.   def disable_item(index)
  1476.     draw_item(index, normal_color)
  1477.   end
  1478.  
  1479. end
  1480.  
  1481. #==============================================================================
  1482. # ■ Window_ItemMenuCommand
  1483. #==============================================================================
  1484. class Window_ItemMenuCommand < Window_Selectable
  1485.  
  1486.   def initialize(width, commands)
  1487.     super(0, 0, width, commands.size * 32 + 32)
  1488.     @item_max = commands.size
  1489.     @commands = commands
  1490.     self.contents = Bitmap.new(width - 32, @item_max * 32)
  1491.     self.contents.font.name = $fontface
  1492.     self.contents.font.size = 20
  1493.     refresh
  1494.     self.index = 0
  1495.   end
  1496.  
  1497.   def refresh
  1498.     self.contents.clear
  1499.     for i in 0...@item_max
  1500.     draw_item(i, normal_color)
  1501.     end
  1502.   end
  1503.  
  1504.   def draw_item(index, color)
  1505.     self.contents.font.color = color
  1506.     rect = Rect.new(12, 32 * index, self.contents.width - 8, 32)
  1507.     self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  1508.     bitmap = RPG::Cache.icon("submenu" + index.to_s)
  1509.     self.contents.blt(x + 3, index * 32 +4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  1510.     self.contents.draw_text(rect, @commands[index])
  1511.   end
  1512.  
  1513.   def disable_item(index)
  1514.     draw_item(index, disabled_color)
  1515.   end
  1516.  
  1517. end
  1518.  
  1519. #==============================================================================
  1520. # ■ Window_NewMenuStatus
  1521. #==============================================================================
  1522.  
  1523. class Window_NewMenuStatus < Window_Selectable
  1524.  
  1525.   def initialize
  1526.     super(0, 0, 432, $game_party.actors.size * 88 + 32)
  1527.     self.contents = Bitmap.new(width - 32, height - 32)
  1528.     self.contents.font.name = $fontface
  1529.     self.contents.font.size = 20
  1530.     refresh
  1531.     self.active = false
  1532.     self.index = -1
  1533.   end
  1534.  
  1535.   def refresh
  1536.     self.contents.clear
  1537.     self.height = $game_party.actors.size * 88 + 32
  1538.     @item_max = $game_party.actors.size
  1539.     for i in 0...$game_party.actors.size
  1540.       x = 64
  1541.       y = i * 90
  1542.       actor = $game_party.actors[i]
  1543.       draw_actor_graphic(actor, x, y + 80)
  1544.       draw_actor_name(actor, x - 10, y)
  1545.       draw_actor_class(actor, x + 154, y)
  1546.       draw_actor_level(actor, x + 80, y)
  1547.       draw_actor_state(actor, x + 240, y)
  1548.       draw_actor_hp(actor, x + 32, y + 32)
  1549.       draw_actor_sp(actor, x + 192, y + 32)
  1550.     end
  1551.   end
  1552.  
  1553.   def update_cursor_rect
  1554.     if @index < 0
  1555.       self.cursor_rect.empty
  1556.     else
  1557.       self.cursor_rect.set(0, @index * 88, self.width - 32, 92)
  1558.     end
  1559.   end
  1560.  
  1561. end
  1562.  
  1563. #==============================================================================
  1564. # ■ Window_Basic_Item
  1565. #==============================================================================
  1566.  
  1567. class Window_Basic_Item < Window_Selectable
  1568.  
  1569.   def initialize
  1570.     super(0, 64, 384, 352)
  1571.     @column_max = 1
  1572.     refresh
  1573.     self.index = 0
  1574.     if $game_temp.in_battle
  1575.       self.y = 64
  1576.       self.height = 272
  1577.       self.back_opacity = 160
  1578.     end
  1579.   end
  1580.  
  1581.   def item
  1582.     return @data[self.index]
  1583.   end
  1584.  
  1585.   def refresh
  1586.     if self.contents != nil
  1587.       self.contents.dispose
  1588.       self.contents = nil
  1589.     end
  1590.     @data = []
  1591.     for i in 1...$data_items.size
  1592.       if $game_party.item_number(i) > 0
  1593.         for x in 0...$basic_items_ids.size
  1594.           if i == $basic_items_ids[x]
  1595.           @data.push($data_items [i] )
  1596.         end
  1597.       end
  1598.     end
  1599.   end
  1600.  
  1601.     @item_max = @data.size
  1602.     if @item_max > 0
  1603.       self.contents = Bitmap.new(width - 32, row_max * 32)
  1604.       self.contents.font.name = $fontface
  1605.       self.contents.font.size = 20
  1606.       for i in 0...@item_max
  1607.         draw_item(i)
  1608.       end
  1609.     end
  1610.   end
  1611.  
  1612.   def draw_item(index)
  1613.     item = @data[index]
  1614.     case item
  1615.     when RPG::Item
  1616.       number = $game_party.item_number(item.id)
  1617.     end
  1618.     if item.is_a?(RPG::Item) and
  1619.        $game_party.item_can_use?(item.id)
  1620.       self.contents.font.color = normal_color
  1621.     else
  1622.       self.contents.font.color = disabled_color
  1623.     end
  1624.     x = 4 + index % 1 * (240 + 32)
  1625.     y = index / 1 * 32
  1626.     rect = Rect.new(x, y, self.width / @column_max - 32, 32)
  1627.     self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  1628.     bitmap = RPG::Cache.icon(item.icon_name)
  1629.     opacity = self.contents.font.color == normal_color ? 255 : 128
  1630.     self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  1631.     self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
  1632.     self.contents.draw_text(x + 304, y, 16, 32, ":", 1)
  1633.     self.contents.draw_text(x + 320, y, 24, 32, number.to_s, 2)
  1634.   end
  1635.  
  1636.   def update_help
  1637.     @help_window.set_text(self.item == nil ? "" : self.item.description)
  1638.   end
  1639.  
  1640. end
  1641.  
  1642. #==============================================================================
  1643. # ■ Window_NewTarget
  1644. #==============================================================================
  1645.  
  1646. class Window_NewTarget < Window_Selectable
  1647.  
  1648.   def initialize
  1649.     super(0, 0, 192, 352)
  1650.     self.contents = Bitmap.new(width - 32, height - 32)
  1651.     self.contents.font.name = $fontface
  1652.     self.contents.font.size = 20
  1653.     self.z += 10
  1654.     @item_max = $game_party.actors.size
  1655.     refresh
  1656.   end
  1657.  
  1658.   def refresh
  1659.     self.contents.clear
  1660.     for i in 0...$game_party.actors.size
  1661.       x = 4
  1662.       y = i * 80
  1663.       actor = $game_party.actors[i]
  1664.       draw_actor_name(actor, x, y)
  1665.       draw_actor_state(actor, x + 80, y)
  1666.       draw_actor_hp(actor, x, y + 24)
  1667.       draw_actor_sp(actor, x, y + 48)
  1668.     end
  1669.   end
  1670.  
  1671.   def update_cursor_rect
  1672.     if self.active == false
  1673.       self.cursor_rect.empty
  1674.     end
  1675.     if self.index >= 0 and self.active
  1676.       self.cursor_rect.set(0, @index * 80, self.width - 32, 80)
  1677.     elsif self.index >= -1 and self.active
  1678.       self.cursor_rect.set(0, 0, self.width - 32, self.height - 32)
  1679.     end
  1680.   end
  1681.  
  1682. end
  1683.  
  1684. #==============================================================================
  1685. # ■ Window_NewHelp
  1686. #==============================================================================
  1687. class Window_NewHelp < Window_Base
  1688.  
  1689. def initialize
  1690.     super(0, 0, 576, 64)
  1691.     self.contents = Bitmap.new(width - 32, height - 32)
  1692.     self.contents.font.name = $fontface
  1693.     self.contents.font.size = 20
  1694.   end
  1695.  
  1696.   def set_text(text, align = 0)
  1697.     if text != @text or align != @align
  1698.       self.contents.clear
  1699.       self.contents.font.name = $fontface
  1700.       self.contents.font.size = 20
  1701.       self.contents.font.color = normal_color
  1702.       self.contents.draw_text(4, 0, self.width - 40, 32, text, align)
  1703.       @text = text
  1704.       @align = align
  1705.       @actor = nil
  1706.     end
  1707.     self.visible = true
  1708.   end
  1709.  
  1710.   def set_actor(actor)
  1711.     if actor != @actor
  1712.       self.contents.clear
  1713.       self.contents.font.name = $fontface
  1714.       self.contents.font.size = 20
  1715.       draw_actor_name(actor, 4, 0)
  1716.       draw_actor_state(actor, 140, 0)
  1717.       draw_actor_hp(actor, 284, 0)
  1718.       draw_actor_sp(actor, 460, 0)
  1719.       @actor = actor
  1720.       @text = nil
  1721.       self.visible = true
  1722.     end
  1723.   end
  1724.  
  1725.   def set_enemy(enemy)
  1726.     self.contents.clear
  1727.     self.contents.font.name = $fontface
  1728.     self.contents.font.size = 20
  1729.     text = enemy.name
  1730.     state_text = make_battler_state_text(enemy, 112, false)
  1731.     if state_text != ""
  1732.       text += "  " + state_text
  1733.     end
  1734.     set_text(text, 1)
  1735.   end
  1736.  
  1737. end
  1738.  
  1739. #==============================================================================
  1740. # ■ Window_Quest_Item
  1741. #==============================================================================
  1742.  
  1743. class Window_Quest_Item < Window_Selectable
  1744.  
  1745.   def initialize
  1746.     super(0, 64, 576, 128)
  1747.     @column_max = 3
  1748.     refresh
  1749.     self.index = 0
  1750.     if $game_temp.in_battle
  1751.       self.y = 64
  1752.       self.height = 256
  1753.       self.back_opacity = 160
  1754.     end
  1755.   end
  1756.  
  1757.   def item
  1758.     return @data[self.index]
  1759.   end
  1760.  
  1761.   def refresh
  1762.     if self.contents != nil
  1763.       self.contents.dispose
  1764.       self.contents = nil
  1765.     end
  1766.     @data = []    
  1767.     for i in 1...$data_items.size
  1768.       if $game_party.item_number(i) > 0
  1769.         for x in 0...$quest_items_ids.size
  1770.           if i == $quest_items_ids[x]
  1771.           @data.push($data_items [i] )
  1772.         end
  1773.       end
  1774.     end
  1775.   end
  1776.     @item_max = @data.size
  1777.     if @item_max > 0
  1778.       self.contents = Bitmap.new(width - 32, row_max * 32)
  1779.       self.contents.font.name = $fontface
  1780.       self.contents.font.size = 20
  1781.       for i in 0...@item_max
  1782.         draw_item(i)
  1783.       end
  1784.     end
  1785.   end
  1786.  
  1787.   def draw_item(index)
  1788.     item = @data[index]
  1789.     case item
  1790.     when RPG::Item
  1791.       number = $game_party.item_number(item.id)
  1792.     when RPG::Weapon
  1793.       number = $game_party.weapon_number(item.id)
  1794.     when RPG::Armor
  1795.       number = $game_party.armor_number(item.id)
  1796.     end
  1797.     if item.is_a?(RPG::Item) and
  1798.        $game_party.item_can_use?(item.id)
  1799.       self.contents.font.color = normal_color
  1800.     else
  1801.       self.contents.font.color = disabled_color
  1802.     end
  1803.     x = 4 + index % 3 * (160 + 32)
  1804.     y = index / 3 * 32
  1805.     rect = Rect.new(x, y, self.width / @column_max - 32, 32)
  1806.     self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  1807.     bitmap = RPG::Cache.icon(item.icon_name)
  1808.     opacity = self.contents.font.color == normal_color ? 255 : 128
  1809.     self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  1810.     self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
  1811.     self.contents.draw_text(x + 112, y, 16, 32, ":", 1)
  1812.     self.contents.draw_text(x + 128, y, 24, 32, number.to_s, 2)
  1813.   end
  1814.  
  1815.   def update_help
  1816.     @help_window.set_text(self.item == nil ? "" : self.item.description)
  1817.   end
  1818.  
  1819. end
  1820.  
  1821. #==============================================================================
  1822. # ■ Window_Weapons
  1823. #==============================================================================
  1824.  
  1825. class Window_Weapons < Window_Selectable
  1826.  
  1827.   def initialize
  1828.     super(0, 64, 224, 352)
  1829.     @column_max = 1
  1830.     refresh
  1831.     self.index = 0
  1832.     if $game_temp.in_battle
  1833.       self.y = 64
  1834.       self.height = 256
  1835.       self.back_opacity = 160
  1836.     end
  1837.   end
  1838.  
  1839.   def item
  1840.     return @data[self.index]
  1841.   end
  1842.  
  1843.   def refresh
  1844.     if self.contents != nil
  1845.       self.contents.dispose
  1846.       self.contents = nil
  1847.     end
  1848.     @data = []    
  1849.     for i in 1...$data_weapons.size
  1850.       if $game_party.weapon_number(i) > 0
  1851.         for x in 0...$weapon_ids.size
  1852.           if i == $weapon_ids[x]
  1853.           @data.push($data_weapons [i] )
  1854.         end
  1855.       end
  1856.     end
  1857.   end
  1858.     @item_max = @data.size
  1859.     if @item_max > 0
  1860.       self.contents = Bitmap.new(width - 32, row_max * 32)
  1861.       self.contents.font.name = $fontface
  1862.       self.contents.font.size = 20
  1863.       for i in 0...@item_max
  1864.         draw_item(i)
  1865.       end
  1866.     end
  1867.   end
  1868.  
  1869.   def draw_item(index)
  1870.     item = @data[index]
  1871.     case item
  1872.     when RPG::Item
  1873.       number = $game_party.item_number(item.id)
  1874.     when RPG::Weapon
  1875.       number = $game_party.weapon_number(item.id)
  1876.     when RPG::Armor
  1877.       number = $game_party.armor_number(item.id)
  1878.     end
  1879.     if item.is_a?(RPG::Item) and
  1880.        $game_party.item_can_use?(item.id)
  1881.       self.contents.font.color = normal_color
  1882.     else
  1883.       self.contents.font.color = disabled_color
  1884.     end
  1885.     x = 4 + index % 1 * (288 + 32)
  1886.     y = index / 1 * 32
  1887.     rect = Rect.new(x, y, self.width / @column_max - 32, 32)
  1888.     self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  1889.     bitmap = RPG::Cache.icon(item.icon_name)
  1890.     opacity = self.contents.font.color == normal_color ? 255 : 128
  1891.     self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  1892.     self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
  1893.     self.contents.draw_text(x + 144, y, 16, 32, ":", 1)
  1894.     self.contents.draw_text(x + 160, y, 24, 32, number.to_s, 2)
  1895.   end
  1896.  
  1897.   def update_help
  1898.     @help_window.set_text(self.item == nil ? "" : self.item.description)
  1899.   end
  1900.  
  1901. end
  1902.  
  1903. #==============================================================================
  1904. # ■ Window_Weapon_Stats
  1905. #==============================================================================
  1906.  
  1907. class Window_Weapon_Stats < Window_Base
  1908.  
  1909.   def initialize
  1910.     super(0, 0, 352, 352)
  1911.     self.contents = Bitmap.new(width - 32, height - 32)
  1912.     self.contents.font.name = $fontface
  1913.     self.contents.font.size = 20
  1914.     @item = nil
  1915.     refresh
  1916.   end
  1917.  
  1918.   def refresh
  1919.     self.contents.clear
  1920.     if @item == nil
  1921.       return
  1922.     end
  1923.     case @item
  1924.     when RPG::Item
  1925.       number = $game_party.item_number(@item.id)
  1926.     when RPG::Weapon
  1927.       number = $game_party.weapon_number(@item.id)
  1928.     when RPG::Armor
  1929.       number = $game_party.armor_number(@item.id)
  1930.     end
  1931.     if @item.is_a?(RPG::Item)
  1932.       return
  1933.     end
  1934.     for i in 0...$game_party.actors.size
  1935.       actor = $game_party.actors[i]
  1936.       if @item.is_a?(RPG::Weapon)
  1937.         item1 = $data_weapons[actor.weapon_id]
  1938.       elsif @item.kind == 0
  1939.         item1 = $data_armors[actor.armor1_id]
  1940.       elsif @item.kind == 1
  1941.         item1 = $data_armors[actor.armor2_id]
  1942.       elsif @item.kind == 2
  1943.         item1 = $data_armors[actor.armor3_id]
  1944.       else
  1945.         item1 = $data_armors[actor.armor4_id]
  1946.       end
  1947.       if not actor.equippable?(@item)
  1948.         draw_actor_graphic(actor, 16, 68 + (84 * i))
  1949.         draw_actor_name(actor, 0, -6 + (84 * i))
  1950.         draw_actor_level(actor, 86, -6 + (84 * i))
  1951.         draw_actor_class(actor, 150, -6 + (84 * i))
  1952.         draw_actor_state(actor, 230, -6 + (84 * i))
  1953.         self.contents.draw_text(150, 44 + (84 * i), 150, 32, @item.name)
  1954.         self.contents.font.name = $fontface
  1955.         self.contents.font.size = 20
  1956.         self.contents.font.color = normal_color
  1957.         self.contents.draw_text(48, 18 + (84 * i), 256, 32, "Cannot Equip")
  1958.       end
  1959.       if actor.equippable?(@item)
  1960.         draw_actor_graphic(actor, 16, 68 + (84 * i))
  1961.         draw_actor_name(actor, 0, -6 + (84 * i))
  1962.         draw_actor_level(actor, 86, -6 + (84 * i))
  1963.         draw_actor_class(actor, 150, -6 + (84 * i))
  1964.         draw_actor_state(actor, 230, -6 + (84 * i))
  1965.         self.contents.draw_text(150, 44 + (84 * i), 150, 32, @item.name)
  1966.           atk1 = 0
  1967.           atk2 = 0
  1968.           eva1 = 0
  1969.           eva2 = 0
  1970.           str1 = 0
  1971.           str2 = 0
  1972.           dex1 = 0
  1973.           dex2 = 0
  1974.           agi1 = 0
  1975.           agi2 = 0
  1976.           int1 = 0
  1977.           int2 = 0
  1978.           pdf1 = 0
  1979.           pdf2 = 0
  1980.           mdf1 = 0
  1981.           mdf2 = 0
  1982.           eva1 = 0
  1983.           eva2 = 0
  1984.           str1 = item1 != nil ? item1.str_plus : 0
  1985.           str2 = @item != nil ? @item.str_plus : 0
  1986.           dex1 = item1 != nil ? item1.dex_plus : 0
  1987.           dex2 = @item != nil ? @item.dex_plus : 0
  1988.           agi1 = item1 != nil ? item1.agi_plus : 0
  1989.           agi2 = @item != nil ? @item.agi_plus : 0
  1990.           int1 = item1 != nil ? item1.int_plus : 0
  1991.           int2 = @item != nil ? @item.int_plus : 0
  1992.           pdf1 = item1 != nil ? item1.pdef : 0
  1993.           pdf2 = @item != nil ? @item.pdef : 0
  1994.           mdf1 = item1 != nil ? item1.mdef : 0
  1995.           mdf2 = @item != nil ? @item.mdef : 0
  1996.         if @item.is_a?(RPG::Weapon)
  1997.           atk1 = item1 != nil ? item1.atk : 0
  1998.           atk2 = @item != nil ? @item.atk : 0
  1999.         end
  2000.         if @item.is_a?(RPG::Armor)
  2001.           eva1 = item1 != nil ? item1.eva : 0
  2002.           eva2 = @item != nil ? @item.eva : 0
  2003.         end
  2004.         str_change = str2 - str1
  2005.         dex_change = dex2 - dex1
  2006.         agi_change = agi2 - agi1
  2007.         int_change = int2 - int1
  2008.         pdf_change = pdf2 - pdf1
  2009.         mdf_change = mdf2 - mdf1
  2010.         atk_change = atk2 - atk1
  2011.         eva_change = eva2 - eva1
  2012.         if item1 == nil
  2013.           name1 = ""
  2014.         else
  2015.           name1 = item1.name
  2016.         end
  2017.         if @item == nil
  2018.           name2 = ""
  2019.         else
  2020.           name2 = @item.name
  2021.         end
  2022.         if str_change == 0 && dex_change == 0 && agi_change == 0 &&
  2023.         pdf_change == 0 && mdf_change == 0 && atk_change == 0 &&
  2024.         eva_change == 0 && name1 != name2
  2025.         self.contents.font.name = $fontface
  2026.         self.contents.font.size = 20
  2027.         self.contents.draw_text(48, 18 + (84 * i), 288, 32, "No Change")
  2028.         end
  2029.         if name1 == name2
  2030.         self.contents.font.name = $fontface
  2031.         self.contents.font.size = 20
  2032.         self.contents.draw_text(48, 18 + (84 * i), 288, 32, "Currently Equipped")
  2033.         end
  2034.         self.contents.font.name = $fontface
  2035.         self.contents.font.size = 20
  2036.         self.contents.font.color = normal_color
  2037.         if @item.is_a?(RPG::Weapon) && atk_change != 0
  2038.           self.contents.draw_text(48, 18 + (84 * i), 256, 32, "Equippable")
  2039.         end
  2040.         if @item.is_a?(RPG::Armor) && eva_change != 0
  2041.           self.contents.draw_text(48, 18 + (84 * i), 256, 32, "Equippable")
  2042.         end
  2043.         if pdf_change != 0
  2044.           self.contents.draw_text(48, 18 + (84 * i), 256, 32, "Equippable")
  2045.         end
  2046.         if mdf_change != 0
  2047.           self.contents.draw_text(48, 18 + (84 * i), 256, 32, "Equippable")
  2048.         end
  2049.         if str_change != 0
  2050.           self.contents.draw_text(48, 18 + (84 * i), 256, 32, "Equippable")
  2051.         end
  2052.         if dex_change != 0
  2053.           self.contents.draw_text(48, 18 + (84 * i), 256, 32, "Equippable")
  2054.         end
  2055.         if agi_change != 0
  2056.           self.contents.draw_text(48, 18 + (84 * i), 256, 32, "Equippable")
  2057.         end
  2058.         if str_change != 0
  2059.           self.contents.draw_text(48, 18 + (84 * i), 256, 32, "Equippable")
  2060.         end        
  2061.       end
  2062.     end
  2063.   end
  2064.  
  2065.   def item=(item)
  2066.     if @item != item
  2067.       @item = item
  2068.       refresh
  2069.     end
  2070.   end
  2071.  
  2072.   def draw_actor_graphic(actor, x, y)
  2073.     bitmap = RPG::Cache.character(actor.character_name, actor.character_hue)
  2074.     cw = bitmap.width / 4
  2075.     ch = bitmap.height / 4
  2076.     src_rect = Rect.new(0, 0, cw, ch)
  2077.     self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect)
  2078.   end
  2079.  
  2080. end
  2081.  
  2082. #==============================================================================
  2083. # ■ Window_Armor
  2084. #==============================================================================
  2085.  
  2086. class Window_Armor < Window_Selectable
  2087.  
  2088.   def initialize
  2089.     super(0, 64, 224, 352)
  2090.     @column_max = 1
  2091.     refresh
  2092.     self.index = 0
  2093.     if $game_temp.in_battle
  2094.       self.y = 64
  2095.       self.height = 256
  2096.       self.back_opacity = 160
  2097.     end
  2098.   end
  2099.  
  2100.   def item
  2101.     return @data[self.index]
  2102.   end
  2103.  
  2104.   def refresh
  2105.     if self.contents != nil
  2106.       self.contents.dispose
  2107.       self.contents = nil
  2108.     end
  2109.     @data = []    
  2110.     for i in 1...$data_armors.size
  2111.       if $game_party.armor_number(i) > 0
  2112.         for x in 0...$armor_ids.size
  2113.           if i == $armor_ids[x]
  2114.           @data.push($data_armors [i] )
  2115.         end
  2116.       end
  2117.     end
  2118.   end
  2119.     @item_max = @data.size
  2120.     if @item_max > 0
  2121.       self.contents = Bitmap.new(width - 32, row_max * 32)
  2122.       self.contents.font.name = $fontface
  2123.       self.contents.font.size = 20
  2124.       for i in 0...@item_max
  2125.         draw_item(i)
  2126.       end
  2127.     end
  2128.   end
  2129.  
  2130.   def draw_item(index)
  2131.     item = @data[index]
  2132.     case item
  2133.     when RPG::Item
  2134.       number = $game_party.item_number(item.id)
  2135.     when RPG::Weapon
  2136.       number = $game_party.weapon_number(item.id)
  2137.     when RPG::Armor
  2138.       number = $game_party.armor_number(item.id)
  2139.     end
  2140.     if item.is_a?(RPG::Item) and
  2141.        $game_party.item_can_use?(item.id)
  2142.       self.contents.font.color = normal_color
  2143.     else
  2144.       self.contents.font.color = disabled_color
  2145.     end
  2146.     x = 4 + index % 1 * (288 + 32)
  2147.     y = index / 1 * 32
  2148.     rect = Rect.new(x, y, self.width / @column_max - 32, 32)
  2149.     self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  2150.     bitmap = RPG::Cache.icon(item.icon_name)
  2151.     opacity = self.contents.font.color == normal_color ? 255 : 128
  2152.     self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  2153.     self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
  2154.     self.contents.draw_text(x + 144, y, 16, 32, ":", 1)
  2155.     self.contents.draw_text(x + 160, y, 24, 32, number.to_s, 2)
  2156.   end
  2157.  
  2158.   def update_help
  2159.     @help_window.set_text(self.item == nil ? "" : self.item.description)
  2160.   end
  2161.  
  2162. end
  2163.  
  2164. #==============================================================================
  2165. # ■ Window_Armor_Stats
  2166. #==============================================================================
  2167.  
  2168. class Window_Armor_Stats < Window_Base
  2169.  
  2170.   def initialize
  2171.     super(0, 0, 352, 352)
  2172.     self.contents = Bitmap.new(width - 32, height - 32)
  2173.     self.contents.font.name = $fontface
  2174.     self.contents.font.size = 20
  2175.     @item = nil
  2176.     refresh
  2177.   end
  2178.  
  2179.   def refresh
  2180.     self.contents.clear
  2181.     if @item == nil
  2182.       return
  2183.     end
  2184.     case @item
  2185.     when RPG::Item
  2186.       number = $game_party.item_number(@item.id)
  2187.     when RPG::Weapon
  2188.       number = $game_party.weapon_number(@item.id)
  2189.     when RPG::Armor
  2190.       number = $game_party.armor_number(@item.id)
  2191.     end
  2192.     if @item.is_a?(RPG::Item)
  2193.       return
  2194.     end
  2195.     for i in 0...$game_party.actors.size
  2196.       actor = $game_party.actors[i]
  2197.       if @item.is_a?(RPG::Weapon)
  2198.         item1 = $data_weapons[actor.weapon_id]
  2199.       elsif @item.kind == 0
  2200.         item1 = $data_armors[actor.armor1_id]
  2201.       elsif @item.kind == 1
  2202.         item1 = $data_armors[actor.armor2_id]
  2203.       elsif @item.kind == 2
  2204.         item1 = $data_armors[actor.armor3_id]
  2205.       else
  2206.         item1 = $data_armors[actor.armor4_id]
  2207.       end
  2208.       if not actor.equippable?(@item)
  2209.         draw_actor_graphic(actor, 16, 68 + (84 * i))
  2210.         draw_actor_name(actor, 0, -6 + (84 * i))
  2211.         draw_actor_level(actor, 86, -6 + (84 * i))
  2212.         draw_actor_class(actor, 150, -6 + (84 * i))
  2213.         draw_actor_state(actor, 230, -6 + (84 * i))
  2214.         self.contents.draw_text(150, 44 + (84 * i), 150, 32, @item.name)
  2215.         self.contents.font.name = $fontface
  2216.         self.contents.font.size = 20
  2217.         self.contents.font.color = normal_color
  2218.         self.contents.draw_text(48, 18 + (84 * i), 256, 32, "Cannot Equip")
  2219.       end
  2220.       if actor.equippable?(@item)
  2221.         draw_actor_graphic(actor, 16, 68 + (84 * i))
  2222.         draw_actor_name(actor, 0, -6 + (84 * i))
  2223.         draw_actor_level(actor, 86, -6 + (84 * i))
  2224.         draw_actor_class(actor, 150, -6 + (84 * i))
  2225.         draw_actor_state(actor, 230, -6 + (84 * i))
  2226.         self.contents.draw_text(150, 44 + (84 * i), 150, 32, @item.name)
  2227.           atk1 = 0
  2228.           atk2 = 0
  2229.           eva1 = 0
  2230.           eva2 = 0
  2231.           str1 = 0
  2232.           str2 = 0
  2233.           dex1 = 0
  2234.           dex2 = 0
  2235.           agi1 = 0
  2236.           agi2 = 0
  2237.           int1 = 0
  2238.           int2 = 0
  2239.           pdf1 = 0
  2240.           pdf2 = 0
  2241.           mdf1 = 0
  2242.           mdf2 = 0
  2243.           eva1 = 0
  2244.           eva2 = 0
  2245.           str1 = item1 != nil ? item1.str_plus : 0
  2246.           str2 = @item != nil ? @item.str_plus : 0
  2247.           dex1 = item1 != nil ? item1.dex_plus : 0
  2248.           dex2 = @item != nil ? @item.dex_plus : 0
  2249.           agi1 = item1 != nil ? item1.agi_plus : 0
  2250.           agi2 = @item != nil ? @item.agi_plus : 0
  2251.           int1 = item1 != nil ? item1.int_plus : 0
  2252.           int2 = @item != nil ? @item.int_plus : 0
  2253.           pdf1 = item1 != nil ? item1.pdef : 0
  2254.           pdf2 = @item != nil ? @item.pdef : 0
  2255.           mdf1 = item1 != nil ? item1.mdef : 0
  2256.           mdf2 = @item != nil ? @item.mdef : 0
  2257.         if @item.is_a?(RPG::Weapon)
  2258.           atk1 = item1 != nil ? item1.atk : 0
  2259.           atk2 = @item != nil ? @item.atk : 0
  2260.         end
  2261.         if @item.is_a?(RPG::Armor)
  2262.           eva1 = item1 != nil ? item1.eva : 0
  2263.           eva2 = @item != nil ? @item.eva : 0
  2264.         end
  2265.         str_change = str2 - str1
  2266.         dex_change = dex2 - dex1
  2267.         agi_change = agi2 - agi1
  2268.         int_change = int2 - int1
  2269.         pdf_change = pdf2 - pdf1
  2270.         mdf_change = mdf2 - mdf1
  2271.         atk_change = atk2 - atk1
  2272.         eva_change = eva2 - eva1
  2273.         if item1 == nil
  2274.           name1 = ""
  2275.         else
  2276.           name1 = item1.name
  2277.         end
  2278.         if @item == nil
  2279.           name2 = ""
  2280.         else
  2281.           name2 = @item.name
  2282.         end
  2283.         if str_change == 0 && dex_change == 0 && agi_change == 0 &&
  2284.         pdf_change == 0 && mdf_change == 0 && atk_change == 0 &&
  2285.         eva_change == 0 && name1 != name2
  2286.         self.contents.font.name = $fontface
  2287.         self.contents.font.size = 20
  2288.         self.contents.draw_text(48, 18 + (84 * i), 288, 32, "No Change")
  2289.         end
  2290.         if name1 == name2
  2291.         self.contents.font.name = $fontface
  2292.         self.contents.font.size = 20
  2293.         self.contents.draw_text(48, 18 + (84 * i), 288, 32, "Currently Equipped")
  2294.         end
  2295.         self.contents.font.name = $fontface
  2296.         self.contents.font.size = 20
  2297.         self.contents.font.color = normal_color
  2298.         if @item.is_a?(RPG::Weapon) && atk_change != 0
  2299.           self.contents.draw_text(48, 18 + (84 * i), 256, 32, "Equippable")
  2300.         end
  2301.         if @item.is_a?(RPG::Armor) && eva_change != 0
  2302.           self.contents.draw_text(48, 18 + (84 * i), 256, 32, "Equippable")
  2303.         end
  2304.         if pdf_change != 0
  2305.           self.contents.draw_text(48, 18 + (84 * i), 256, 32, "Equippable")
  2306.         end
  2307.         if mdf_change != 0
  2308.           self.contents.draw_text(48, 18 + (84 * i), 256, 32, "Equippable")
  2309.         end
  2310.         if str_change != 0
  2311.           self.contents.draw_text(48, 18 + (84 * i), 256, 32, "Equippable")
  2312.         end
  2313.         if dex_change != 0
  2314.           self.contents.draw_text(48, 18 + (84 * i), 256, 32, "Equippable")
  2315.         end
  2316.         if agi_change != 0
  2317.           self.contents.draw_text(48, 18 + (84 * i), 256, 32, "Equippable")
  2318.         end
  2319.         if str_change != 0
  2320.           self.contents.draw_text(48, 18 + (84 * i), 256, 32, "Equippable")
  2321.         end        
  2322.       end
  2323.     end
  2324.   end
  2325.  
  2326.   def item=(item)
  2327.     if @item != item
  2328.       @item = item
  2329.       refresh
  2330.     end
  2331.   end
  2332.  
  2333.   def draw_actor_graphic(actor, x, y)
  2334.     bitmap = RPG::Cache.character(actor.character_name, actor.character_hue)
  2335.     cw = bitmap.width / 4
  2336.     ch = bitmap.height / 4
  2337.     src_rect = Rect.new(0, 0, cw, ch)
  2338.     self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect)
  2339.   end
  2340.  
  2341. end
  2342.  
  2343. #==============================================================================
  2344. # ■ Window_Accessory
  2345. #==============================================================================
  2346.  
  2347. class Window_Accessory < Window_Selectable
  2348.  
  2349.   def initialize
  2350.     super(0, 64, 224, 352)
  2351.     @column_max = 1
  2352.     refresh
  2353.     self.index = 0
  2354.     if $game_temp.in_battle
  2355.       self.y = 64
  2356.       self.height = 256
  2357.       self.back_opacity = 160
  2358.     end
  2359.   end
  2360.  
  2361.   def item
  2362.     return @data[self.index]
  2363.   end
  2364.  
  2365.   def refresh
  2366.     if self.contents != nil
  2367.       self.contents.dispose
  2368.       self.contents = nil
  2369.     end
  2370.     @data = []    
  2371.     for i in 1...$data_armors.size
  2372.       if $game_party.armor_number(i) > 0
  2373.         for x in 0...$accessory_ids.size
  2374.           if i == $accessory_ids[x]
  2375.           @data.push($data_armors [i] )
  2376.         end
  2377.       end
  2378.     end
  2379.   end
  2380.     @item_max = @data.size
  2381.     if @item_max > 0
  2382.       self.contents = Bitmap.new(width - 32, row_max * 32)
  2383.       self.contents.font.name = $fontface
  2384.       self.contents.font.size = 20
  2385.       for i in 0...@item_max
  2386.         draw_item(i)
  2387.       end
  2388.     end
  2389.   end
  2390.  
  2391.   def draw_item(index)
  2392.     item = @data[index]
  2393.     case item
  2394.     when RPG::Item
  2395.       number = $game_party.item_number(item.id)
  2396.     when RPG::Weapon
  2397.       number = $game_party.weapon_number(item.id)
  2398.     when RPG::Armor
  2399.       number = $game_party.armor_number(item.id)
  2400.     end
  2401.     if item.is_a?(RPG::Item) and
  2402.        $game_party.item_can_use?(item.id)
  2403.       self.contents.font.color = normal_color
  2404.     else
  2405.       self.contents.font.color = disabled_color
  2406.     end
  2407.     x = 4 + index % 1 * (288 + 32)
  2408.     y = index / 1 * 32
  2409.     rect = Rect.new(x, y, self.width / @column_max - 32, 32)
  2410.     self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  2411.     bitmap = RPG::Cache.icon(item.icon_name)
  2412.     opacity = self.contents.font.color == normal_color ? 255 : 128
  2413.     self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  2414.     self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
  2415.     self.contents.draw_text(x + 144, y, 16, 32, ":", 1)
  2416.     self.contents.draw_text(x + 160, y, 24, 32, number.to_s, 2)
  2417.   end
  2418.  
  2419.   def update_help
  2420.     @help_window.set_text(self.item == nil ? "" : self.item.description)
  2421.   end
  2422.  
  2423. end
  2424.  
  2425. #==============================================================================
  2426. # ■ Window_Accessory_Stats
  2427. #==============================================================================
  2428.  
  2429. class Window_Accessory_Stats < Window_Base
  2430.  
  2431.   def initialize
  2432.     super(0, 0, 352, 352)
  2433.     self.contents = Bitmap.new(width - 32, height - 32)
  2434.     self.contents.font.name = $fontface
  2435.     self.contents.font.size = 20
  2436.     @item = nil
  2437.     refresh
  2438.   end
  2439.  
  2440.   def refresh
  2441.     self.contents.clear
  2442.     if @item == nil
  2443.       return
  2444.     end
  2445.     case @item
  2446.     when RPG::Item
  2447.       number = $game_party.item_number(@item.id)
  2448.     when RPG::Weapon
  2449.       number = $game_party.weapon_number(@item.id)
  2450.     when RPG::Armor
  2451.       number = $game_party.armor_number(@item.id)
  2452.     end
  2453.     if @item.is_a?(RPG::Item)
  2454.       return
  2455.     end
  2456.     for i in 0...$game_party.actors.size
  2457.       actor = $game_party.actors[i]
  2458.       if @item.is_a?(RPG::Weapon)
  2459.         item1 = $data_weapons[actor.weapon_id]
  2460.       elsif @item.kind == 0
  2461.         item1 = $data_armors[actor.armor1_id]
  2462.       elsif @item.kind == 1
  2463.         item1 = $data_armors[actor.armor2_id]
  2464.       elsif @item.kind == 2
  2465.         item1 = $data_armors[actor.armor3_id]
  2466.       else
  2467.         item1 = $data_armors[actor.armor4_id]
  2468.       end
  2469.       if not actor.equippable?(@item)
  2470.         draw_actor_graphic(actor, 16, 68 + (84 * i))
  2471.         draw_actor_name(actor, 0, -6 + (84 * i))
  2472.         draw_actor_level(actor, 86, -6 + (84 * i))
  2473.         draw_actor_class(actor, 150, -6 + (84 * i))
  2474.         draw_actor_state(actor, 230, -6 + (84 * i))
  2475.         self.contents.draw_text(150, 44 + (84 * i), 150, 32, @item.name)
  2476.         self.contents.font.name = $fontface
  2477.         self.contents.font.size = 20
  2478.         self.contents.font.color = normal_color
  2479.         self.contents.draw_text(48, 18 + (84 * i), 256, 32, "Cannot Equip")
  2480.       end
  2481.       if actor.equippable?(@item)
  2482.         draw_actor_graphic(actor, 16, 68 + (84 * i))
  2483.         draw_actor_name(actor, 0, -6 + (84 * i))
  2484.         draw_actor_level(actor, 86, -6 + (84 * i))
  2485.         draw_actor_class(actor, 150, -6 + (84 * i))
  2486.         draw_actor_state(actor, 230, -6 + (84 * i))
  2487.         self.contents.draw_text(150, 44 + (84 * i), 150, 32, @item.name)
  2488.           atk1 = 0
  2489.           atk2 = 0
  2490.           eva1 = 0
  2491.           eva2 = 0
  2492.           str1 = 0
  2493.           str2 = 0
  2494.           dex1 = 0
  2495.           dex2 = 0
  2496.           agi1 = 0
  2497.           agi2 = 0
  2498.           int1 = 0
  2499.           int2 = 0
  2500.           pdf1 = 0
  2501.           pdf2 = 0
  2502.           mdf1 = 0
  2503.           mdf2 = 0
  2504.           eva1 = 0
  2505.           eva2 = 0
  2506.           str1 = item1 != nil ? item1.str_plus : 0
  2507.           str2 = @item != nil ? @item.str_plus : 0
  2508.           dex1 = item1 != nil ? item1.dex_plus : 0
  2509.           dex2 = @item != nil ? @item.dex_plus : 0
  2510.           agi1 = item1 != nil ? item1.agi_plus : 0
  2511.           agi2 = @item != nil ? @item.agi_plus : 0
  2512.           int1 = item1 != nil ? item1.int_plus : 0
  2513.           int2 = @item != nil ? @item.int_plus : 0
  2514.           pdf1 = item1 != nil ? item1.pdef : 0
  2515.           pdf2 = @item != nil ? @item.pdef : 0
  2516.           mdf1 = item1 != nil ? item1.mdef : 0
  2517.           mdf2 = @item != nil ? @item.mdef : 0
  2518.         if @item.is_a?(RPG::Weapon)
  2519.           atk1 = item1 != nil ? item1.atk : 0
  2520.           atk2 = @item != nil ? @item.atk : 0
  2521.         end
  2522.         if @item.is_a?(RPG::Armor)
  2523.           eva1 = item1 != nil ? item1.eva : 0
  2524.           eva2 = @item != nil ? @item.eva : 0
  2525.         end
  2526.         str_change = str2 - str1
  2527.         dex_change = dex2 - dex1
  2528.         agi_change = agi2 - agi1
  2529.         int_change = int2 - int1
  2530.         pdf_change = pdf2 - pdf1
  2531.         mdf_change = mdf2 - mdf1
  2532.         atk_change = atk2 - atk1
  2533.         eva_change = eva2 - eva1
  2534.         if item1 == nil
  2535.           name1 = ""
  2536.         else
  2537.           name1 = item1.name
  2538.         end
  2539.         if @item == nil
  2540.           name2 = ""
  2541.         else
  2542.           name2 = @item.name
  2543.         end
  2544.         if str_change == 0 && dex_change == 0 && agi_change == 0 &&
  2545.         pdf_change == 0 && mdf_change == 0 && atk_change == 0 &&
  2546.         eva_change == 0 && name1 != name2
  2547.         self.contents.font.name = $fontface
  2548.         self.contents.font.size = 20
  2549.         self.contents.draw_text(48, 18 + (84 * i), 288, 32, "Equippable")
  2550.         end
  2551.         if name1 == name2
  2552.         self.contents.font.name = $fontface
  2553.         self.contents.font.size = 20
  2554.         self.contents.draw_text(48, 18 + (84 * i), 288, 32, "Currently Equipped")
  2555.         end
  2556.         self.contents.font.name = $fontface
  2557.         self.contents.font.size = 20
  2558.         self.contents.font.color = normal_color
  2559.         if @item.is_a?(RPG::Weapon) && atk_change != 0
  2560.           self.contents.draw_text(48, 18 + (84 * i), 256, 32, "Equippable")
  2561.         end
  2562.         if @item.is_a?(RPG::Armor) && eva_change != 0
  2563.           self.contents.draw_text(48, 18 + (84 * i), 256, 32, "Equippable")
  2564.         end
  2565.         if pdf_change != 0
  2566.           self.contents.draw_text(48, 18 + (84 * i), 256, 32, "Equippable")
  2567.         end
  2568.         if mdf_change != 0
  2569.           self.contents.draw_text(48, 18 + (84 * i), 256, 32, "Equippable")
  2570.         end
  2571.         if str_change != 0
  2572.           self.contents.draw_text(48, 18 + (84 * i), 256, 32, "Equippable")
  2573.         end
  2574.         if dex_change != 0
  2575.           self.contents.draw_text(48, 18 + (84 * i), 256, 32, "Equippable")
  2576.         end
  2577.         if agi_change != 0
  2578.           self.contents.draw_text(48, 18 + (84 * i), 256, 32, "Equippable")
  2579.         end
  2580.         if str_change != 0
  2581.           self.contents.draw_text(48, 18 + (84 * i), 256, 32, "Equippable")
  2582.         end        
  2583.       end
  2584.     end
  2585.   end
  2586.  
  2587.   def item=(item)
  2588.     if @item != item
  2589.       @item = item
  2590.       refresh
  2591.     end
  2592.   end
  2593.  
  2594.   def draw_actor_graphic(actor, x, y)
  2595.     bitmap = RPG::Cache.character(actor.character_name, actor.character_hue)
  2596.     cw = bitmap.width / 4
  2597.     ch = bitmap.height / 4
  2598.     src_rect = Rect.new(0, 0, cw, ch)
  2599.     self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect)
  2600.   end
  2601.  
  2602. end
  2603.  
  2604. #==============================================================================
  2605. # ■ Window_NewSkill
  2606. #==============================================================================
  2607.  
  2608. class Window_NewSkill < Window_Selectable
  2609.  
  2610.   def initialize(actor)
  2611.     super(0, 64, 384, 352)
  2612.     @actor = actor
  2613.     @column_max = 1
  2614.     refresh
  2615.     self.index = 0
  2616.     if $game_temp.in_battle
  2617.       self.y = 64
  2618.       self.height = 256
  2619.       self.back_opacity = 160
  2620.     end
  2621.   end
  2622.  
  2623.   def skill
  2624.     return @data[self.index]
  2625.   end
  2626.  
  2627.   def update_actor(actor)
  2628.     @actor = actor
  2629.     refresh
  2630.   end
  2631.  
  2632.   def refresh
  2633.     if self.contents != nil
  2634.       self.contents.dispose
  2635.       self.contents = nil
  2636.     end
  2637.     @data = []
  2638.     for i in 0...@actor.skills.size
  2639.       skill = $data_skills[@actor.skills[i]]
  2640.       if skill != nil
  2641.         @data.push(skill)
  2642.       end
  2643.     end
  2644.     @item_max = @data.size
  2645.     if @item_max > 0
  2646.       self.contents = Bitmap.new(width - 32, row_max * 32)
  2647.       self.contents.font.name = $fontface
  2648.       self.contents.font.size = 20
  2649.       for i in 0...@item_max
  2650.         draw_item(i)
  2651.       end
  2652.     end
  2653.   end
  2654.  
  2655.   def draw_item(index)
  2656.     skill = @data[index]
  2657.     if @actor.skill_can_use?(skill.id)
  2658.       self.contents.font.color = normal_color
  2659.     else
  2660.       self.contents.font.color = disabled_color
  2661.     end
  2662.     x = 4 + index % 1 * (240 + 32)
  2663.     y = index / 1 * 32
  2664.     rect = Rect.new(x, y, self.width / @column_max - 32, 32)
  2665.     self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  2666.     bitmap = RPG::Cache.icon(skill.icon_name)
  2667.     opacity = self.contents.font.color == normal_color ? 255 : 128
  2668.     self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  2669.     self.contents.draw_text(x + 28, y, 204, 32, skill.name, 0)
  2670.     self.contents.draw_text(x + 288, y, 48, 32, skill.sp_cost.to_s, 2)
  2671.   end
  2672.  
  2673.   def update_help
  2674.     @help_window.set_text(self.skill == nil ? "" : self.skill.description)
  2675.   end
  2676.  
  2677. end
  2678.  
  2679. #==============================================================================
  2680. # ■ Window_NewEquipLeft
  2681. #==============================================================================
  2682.  
  2683. class Window_NewEquipLeft < Window_Base
  2684.  
  2685.   attr_accessor :mode
  2686.   attr_accessor :changes
  2687.  
  2688.   def initialize(actor)
  2689.     super(32, 96, 272, 352)
  2690.     self.contents = Bitmap.new(width - 32, height - 32)
  2691.     self.contents.font.name = $fontface
  2692.     self.contents.font.size = 20
  2693.     self.z += 100
  2694.     @actor = actor
  2695.     @mode = 0
  2696.     @changes = [0, 0, 0, 0, 0, 0, 0, 0]
  2697.     @elem_text = ""
  2698.     @stat_text = ""
  2699.     refresh
  2700.   end
  2701.  
  2702.   def update_actor(actor)
  2703.     @actor = actor
  2704.     refresh
  2705.   end
  2706.  
  2707.   def refresh
  2708.     self.contents.clear
  2709.     draw_actor_name(@actor, 4, 0)
  2710.     draw_actor_level(@actor, 180, 0)
  2711.     draw_actor_parameter(@actor, 4, 24, 0)
  2712.     draw_actor_parameter(@actor, 4, 48, 1)
  2713.     draw_actor_parameter(@actor, 4, 72, 2)
  2714.     draw_actor_parameter(@actor, 4, 96, 3)
  2715.     draw_actor_parameter(@actor, 4, 120, 4)
  2716.     draw_actor_parameter(@actor, 4, 144, 5)
  2717.     draw_actor_parameter(@actor, 4, 168, 6)
  2718.     if @mode == 0
  2719.       self.contents.font.color = up_color
  2720.       self.contents.draw_text(4, 216, 200, 32, "Elemental Attack:")
  2721.       self.contents.draw_text(4, 264, 200, 32, "Status Attack:")
  2722.     end
  2723.     if @mode == 1
  2724.       self.contents.font.color = up_color
  2725.       self.contents.draw_text(4, 216, 200, 32, "Elemental Defense:")
  2726.       self.contents.draw_text(4, 264, 200, 32, "Status Defense:")
  2727.     end
  2728.     self.contents.font.color = normal_color
  2729.     self.contents.draw_text(24, 240, 220, 32, @elem_text)
  2730.     self.contents.draw_text(24, 288, 220, 32, @stat_text)
  2731.     if @new_atk != nil
  2732.       self.contents.font.color = system_color
  2733.       self.contents.draw_text(168, 24, 40, 32, "»»", 1)
  2734.       if @changes[0] == 0
  2735.         self.contents.font.color = normal_color
  2736.       elsif @changes[0] == -1
  2737.         self.contents.font.color = down_color
  2738.       else
  2739.         self.contents.font.color = up_color
  2740.       end
  2741.       self.contents.draw_text(200, 24, 36, 32, @new_atk.to_s, 2)
  2742.     end
  2743.     if @new_pdef != nil
  2744.       self.contents.font.color = system_color
  2745.       self.contents.draw_text(168, 48, 40, 32, "»»", 1)
  2746.       if @changes[1] == 0
  2747.         self.contents.font.color = normal_color
  2748.       elsif @changes[1] == -1
  2749.         self.contents.font.color = down_color
  2750.       else
  2751.         self.contents.font.color = up_color
  2752.       end
  2753.       self.contents.draw_text(200, 48, 36, 32, @new_pdef.to_s, 2)
  2754.     end
  2755.     if @new_mdef != nil
  2756.       self.contents.font.color = system_color
  2757.       self.contents.draw_text(168, 72, 40, 32, "»»", 1)
  2758.       if @changes[2] == 0
  2759.         self.contents.font.color = normal_color
  2760.       elsif @changes[2] == -1
  2761.         self.contents.font.color = down_color
  2762.       else
  2763.         self.contents.font.color = up_color
  2764.       end
  2765.       self.contents.draw_text(200, 72, 36, 32, @new_mdef.to_s, 2)
  2766.     end
  2767.     if @new_str != nil
  2768.       self.contents.font.color = system_color
  2769.       self.contents.draw_text(168, 96, 40, 32, "»»", 1)
  2770.       if @changes[3] == 0
  2771.         self.contents.font.color = normal_color
  2772.       elsif @changes[3] == -1
  2773.         self.contents.font.color = down_color
  2774.       else
  2775.         self.contents.font.color = up_color
  2776.       end
  2777.       self.contents.draw_text(200, 96, 36, 32, @new_str.to_s, 2)
  2778.     end
  2779.      if @new_dex != nil
  2780.       self.contents.font.color = system_color
  2781.       self.contents.draw_text(168, 120, 40, 32, "»»", 1)
  2782.       if @changes[4] == 0
  2783.         self.contents.font.color = normal_color
  2784.       elsif @changes[4] == -1
  2785.         self.contents.font.color = down_color
  2786.       else
  2787.         self.contents.font.color = up_color
  2788.       end
  2789.       self.contents.draw_text(200, 120, 36, 32, @new_dex.to_s, 2)
  2790.     end
  2791.       if @new_agi != nil
  2792.       self.contents.font.color = system_color
  2793.       self.contents.draw_text(168, 144, 40, 32, "»»", 1)
  2794.       if @changes[5] == 0
  2795.         self.contents.font.color = normal_color
  2796.       elsif @changes[5] == -1
  2797.         self.contents.font.color = down_color
  2798.       else
  2799.         self.contents.font.color = up_color
  2800.       end
  2801.       self.contents.draw_text(200, 144, 36, 32, @new_agi.to_s, 2)
  2802.     end
  2803.       if @new_int != nil
  2804.       self.contents.font.color = system_color
  2805.       self.contents.draw_text(168, 168, 40, 32, "»»", 1)
  2806.       if @changes[6] == 0
  2807.         self.contents.font.color = normal_color
  2808.       elsif @changes[6] == -1
  2809.         self.contents.font.color = down_color
  2810.       else
  2811.         self.contents.font.color = up_color
  2812.       end
  2813.       self.contents.draw_text(200, 168, 36, 32, @new_int.to_s, 2)
  2814.     end
  2815.   end
  2816.  
  2817.  def set_new_parameters(new_atk, new_pdef, new_mdef, new_str, new_dex,
  2818.     new_agi, new_int, new_eva, elem_text, stat_text)
  2819.     flag = false
  2820.     if new_atk != @new_atk || new_pdef != @new_pdef || new_mdef != @new_mdef
  2821.       flag = true
  2822.     end
  2823.     if new_str != @new_str || new_dex != @new_dex || new_agi != @new_agi
  2824.       flag = true
  2825.     end
  2826.      if new_eva != @new_eva || elem_text != @elem_text || stat_text != @stat_text
  2827.       flag = true
  2828.     end
  2829.     @new_atk = new_atk
  2830.     @new_pdef = new_pdef
  2831.     @new_mdef = new_mdef
  2832.     @new_str = new_str
  2833.     @new_dex = new_dex
  2834.     @new_agi = new_agi
  2835.     @new_int = new_int
  2836.     @new_eva = new_eva
  2837.     @elem_text = elem_text
  2838.     @stat_text = stat_text
  2839.     if flag
  2840.       refresh
  2841.     end
  2842.   end
  2843.    
  2844. end
  2845.  
  2846. #==============================================================================
  2847. # ■ Window_NewEquipRight
  2848. #==============================================================================
  2849.  
  2850. class Window_NewEquipRight < Window_Selectable
  2851.  
  2852.   def initialize(actor)
  2853.     super(304, 96, 304, 192)
  2854.     self.contents = Bitmap.new(width - 32, height - 32)
  2855.     self.contents.font.name = $fontface
  2856.     self.contents.font.size = 20
  2857.     @actor = actor
  2858.     refresh
  2859.     self.index = 0
  2860.   end
  2861.  
  2862.   def item
  2863.     return @data[self.index]
  2864.   end
  2865.  
  2866.   def update_actor(actor)
  2867.     @actor = actor
  2868.     refresh
  2869.   end
  2870.  
  2871.   def refresh
  2872.     self.contents.clear
  2873.     @data = []
  2874.     @data.push($data_weapons[@actor.weapon_id])
  2875.     @data.push($data_armors[@actor.armor1_id])
  2876.     @data.push($data_armors[@actor.armor2_id])
  2877.     @data.push($data_armors[@actor.armor3_id])
  2878.     @data.push($data_armors[@actor.armor4_id])
  2879.     @item_max = @data.size
  2880.     self.contents.font.color = system_color
  2881.     self.contents.draw_text(4, 32 * 0, 92, 32, $data_system.words.weapon)
  2882.     self.contents.draw_text(4, 32 * 1, 92, 32, $data_system.words.armor1)
  2883.     self.contents.draw_text(4, 32 * 2, 92, 32, $data_system.words.armor2)
  2884.     self.contents.draw_text(4, 32 * 3, 92, 32, $data_system.words.armor3)
  2885.     self.contents.draw_text(5, 32 * 4, 92, 32, $data_system.words.armor4)
  2886.     draw_item_name(@data[0], 92, 32 * 0)
  2887.     draw_item_name(@data[1], 92, 32 * 1)
  2888.     draw_item_name(@data[2], 92, 32 * 2)
  2889.     draw_item_name(@data[3], 92, 32 * 3)
  2890.     draw_item_name(@data[4], 92, 32 * 4)
  2891.   end
  2892.  
  2893.   def update_help
  2894.     @help_window.set_text(self.item == nil ? "" : self.item.description)
  2895.   end
  2896.  
  2897. end
  2898.  
  2899. #==============================================================================
  2900. # ■ Window_NewEquipItem
  2901. #==============================================================================
  2902.  
  2903. class Window_NewEquipItem < Window_Selectable
  2904.  
  2905.   def initialize(actor, equip_type)
  2906.     super(304, 288, 304, 160)
  2907.     @actor = actor
  2908.     @equip_type = equip_type
  2909.     @column_max = 1
  2910.     refresh
  2911.     self.active = false
  2912.     self.index = -1
  2913.   end
  2914.  
  2915.   def item
  2916.     return @data[self.index]
  2917.   end
  2918.  
  2919.   def update_actor(actor, equip_type)
  2920.    @actor = actor
  2921.    @equip_type = equip_type
  2922.    refresh
  2923.  end
  2924.  
  2925.   def refresh
  2926.     if self.contents != nil
  2927.       self.contents.dispose
  2928.       self.contents = nil
  2929.     end
  2930.     @data = []
  2931.     if @equip_type == 0
  2932.       weapon_set = $data_classes[@actor.class_id].weapon_set
  2933.       for i in 1...$data_weapons.size
  2934.         if $game_party.weapon_number(i) > 0 and weapon_set.include?(i)
  2935.           @data.push($data_weapons[i])
  2936.         end
  2937.       end
  2938.     end
  2939.     if @equip_type != 0
  2940.       armor_set = $data_classes[@actor.class_id].armor_set
  2941.       for i in 1...$data_armors.size
  2942.         if $game_party.armor_number(i) > 0 and armor_set.include?(i)
  2943.           if $data_armors[i].kind == @equip_type-1
  2944.             @data.push($data_armors[i])
  2945.           end
  2946.         end
  2947.       end
  2948.     end
  2949.     @data.push(nil)
  2950.     @item_max = @data.size
  2951.     self.contents = Bitmap.new(width - 32, row_max * 32)
  2952.     self.contents.font.name = $fontface
  2953.     self.contents.font.size = 20
  2954.     for i in 0...@item_max-1
  2955.       draw_item(i)
  2956.     end
  2957.     s = @data.size-1
  2958.     self.contents.draw_text(4, s*32, 100, 32, "[Remove]")
  2959.   end
  2960.  
  2961.   def draw_item(index)
  2962.     item = @data[index]
  2963.     x = 4
  2964.     y = index * 32
  2965.     case item
  2966.     when RPG::Weapon
  2967.       number = $game_party.weapon_number(item.id)
  2968.     when RPG::Armor
  2969.       number = $game_party.armor_number(item.id)
  2970.     end
  2971.     bitmap = RPG::Cache.icon(item.icon_name)
  2972.     self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
  2973.     self.contents.font.color = normal_color
  2974.     self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
  2975.     self.contents.draw_text(x + 208, y, 16, 32, ":", 1)
  2976.     self.contents.draw_text(x + 224, y, 24, 32, number.to_s, 2)
  2977.   end
  2978.  
  2979.   def update_help
  2980.     @help_window.set_text(self.item == nil ? "" : self.item.description)
  2981.   end
  2982.  
  2983. end
  2984.  
  2985. #==============================================================================
  2986. # ■ Window_NewStatus
  2987. #==============================================================================
  2988.  
  2989. class Window_NewStatus < Window_Base
  2990.  
  2991.   def initialize(actor)
  2992.     super(0, 0, 576, 416)
  2993.     self.contents = Bitmap.new(width - 32, height - 32)
  2994.     self.contents.font.name = $fontface
  2995.     self.contents.font.size = 20
  2996.     @actor = actor
  2997.     refresh
  2998.   end
  2999.  
  3000.   def refresh
  3001.     self.contents.clear
  3002.     draw_actor_name(@actor, 54, 0)
  3003.     draw_actor_battler(@actor, 80, 200)
  3004.     draw_actor_class(@actor, 254, 0)
  3005.     draw_actor_level(@actor, 184, 0)
  3006.     draw_actor_state(@actor, 184, 40)
  3007.     draw_actor_hp(@actor, 184, 80, 172)
  3008.     draw_actor_sp(@actor, 184, 120, 172)
  3009.     draw_actor_exp(@actor, 184, 160, 172)
  3010.     draw_actor_parameter(@actor, 386, 0, 0)
  3011.     draw_actor_parameter(@actor, 386, 24, 1)
  3012.     draw_actor_parameter(@actor, 386, 48, 2)
  3013.     draw_actor_parameter(@actor, 386, 72, 3)
  3014.     draw_actor_parameter(@actor, 386, 96, 4)
  3015.     draw_actor_parameter(@actor, 386, 120, 5)
  3016.     draw_actor_parameter(@actor, 386, 144, 6)
  3017.     draw_actor_parameter(@actor, 386, 168, 7)
  3018.     self.contents.font.color = system_color
  3019.     self.contents.draw_text(45, 196, 180, 32, "Elemental Vulnerability" )
  3020.     self.contents.font.size = 16
  3021.     draw_actor_element_radar_graph(@actor, 14, 204)
  3022.     self.contents.font.size = 20
  3023.     self.contents.font.color = system_color
  3024.     self.contents.draw_text(360, 200, 96, 32, "Equipment")
  3025.     self.contents.draw_text(280, 228, 96, 32, "Weapon")
  3026.     self.contents.draw_text(280, 256, 96, 32, "Shield")
  3027.     self.contents.draw_text(280, 284, 96, 32, "Helmet")
  3028.     self.contents.draw_text(280, 312, 96, 32, "Armor")
  3029.     self.contents.draw_text(280, 340, 96, 32, "Accessory")
  3030.     equip = $data_weapons[@actor.weapon_id]
  3031.     if  @actor.equippable?(equip)
  3032.       draw_item_name($data_weapons[@actor.weapon_id], 386, 228)
  3033.     else
  3034.       self.contents.font.color = knockout_color
  3035.       self.contents.draw_text(386, 228, 192, 32, "Nothing equipped")
  3036.     end
  3037.     equip1 = $data_armors[@actor.armor1_id]
  3038.       if  @actor.equippable?(equip1)
  3039.       draw_item_name($data_armors[@actor.armor1_id], 386, 256)
  3040.     else
  3041.       self.contents.font.color = crisis_color
  3042.       self.contents.draw_text(386, 256, 192, 32, "Nothing equipped")
  3043.     end
  3044.     equip2 = $data_armors[@actor.armor2_id]
  3045.       if  @actor.equippable?(equip2)
  3046.       draw_item_name($data_armors[@actor.armor2_id], 386, 284)
  3047.     else
  3048.       self.contents.font.color = crisis_color
  3049.       self.contents.draw_text(386, 284, 192, 32, "Nothing equipped")
  3050.     end
  3051.     equip3 = $data_armors[@actor.armor3_id]
  3052.       if  @actor.equippable?(equip3)
  3053.       draw_item_name($data_armors[@actor.armor3_id], 386, 312)
  3054.     else
  3055.       self.contents.font.color = crisis_color
  3056.       self.contents.draw_text(386, 312, 192, 32, "Nothing equipped")
  3057.     end
  3058.     equip4 = $data_armors[@actor.armor4_id]
  3059.       if  @actor.equippable?(equip4)
  3060.       draw_item_name($data_armors[@actor.armor4_id], 386, 340)
  3061.     else
  3062.       self.contents.font.color = crisis_color
  3063.       self.contents.draw_text(386, 340, 192, 32, "Nothing equipped")
  3064.     end    
  3065.   end
  3066.  
  3067.   def update_actor(actor)
  3068.     @actor = actor
  3069.     refresh
  3070.   end
  3071.  
  3072.   def dummy
  3073.     self.contents.font.color = system_color
  3074.     self.contents.draw_text(320, 112, 96, 32, $data_system.words.weapon)
  3075.     self.contents.draw_text(320, 176, 96, 32, $data_system.words.armor1)
  3076.     self.contents.draw_text(320, 240, 96, 32, $data_system.words.armor2)
  3077.     self.contents.draw_text(320, 304, 96, 32, $data_system.words.armor3)
  3078.     self.contents.draw_text(320, 368, 96, 32, $data_system.words.armor4)
  3079.     draw_item_name($data_weapons[@actor.weapon_id], 320 + 24, 144)
  3080.     draw_item_name($data_armors[@actor.armor1_id], 320 + 24, 208)
  3081.     draw_item_name($data_armors[@actor.armor2_id], 320 + 24, 272)
  3082.     draw_item_name($data_armors[@actor.armor3_id], 320 + 24, 336)
  3083.     draw_item_name($data_armors[@actor.armor4_id], 320 + 24, 400)
  3084.   end
  3085.  
  3086. end
  3087.  
  3088.  
  3089. #==============================================================================
  3090. # ■ Window_NewGold
  3091. #==============================================================================
  3092.  
  3093. class Window_NewGold < Window_Base
  3094.  
  3095.  def initialize
  3096.    super(0, 0, 160, 64)
  3097.    self.contents = Bitmap.new(width - 32, height - 32)
  3098.    self.contents.font.name = $fontface
  3099.    self.contents.font.size = 20
  3100.    refresh
  3101.  end
  3102.  
  3103.  def refresh
  3104.    self.contents.clear
  3105.    cx = contents.text_size($data_system.words.gold).width
  3106.    self.contents.font.color = normal_color
  3107.    self.contents.draw_text(4, 0, 120-cx-2, 32,  $game_party.gold.to_s + " ", 2)
  3108.    self.contents.font.color = system_color
  3109.    self.contents.draw_text(124-cx, 0, cx, 32, $data_system.words.gold, 2)
  3110.  end
  3111.  
  3112. end
  3113.  
  3114.  
  3115. #==============================================================================
  3116. # ■ class Window_NewTime                                              
  3117. # written by Deke                                                            
  3118. #--------------------------------------------------------------------------------------------------------------------------------------------
  3119. #==============================================================================
  3120.  
  3121. class Window_NewTime < Window_Base
  3122.  
  3123.   def initialize
  3124.     super(0, 0, 160, 96)
  3125.     self.contents = Bitmap.new(width - 32, height - 32)
  3126.     self.contents.font.name = $fontface
  3127.     self.contents.font.size = 20
  3128.     refresh
  3129.   end
  3130.  
  3131.   def refresh
  3132.     self.contents.clear
  3133.     self.windowskin = RPG::Cache.windowskin($game_system.windowskin_name)
  3134.     self.contents.font.name = $fontface
  3135.     self.contents.font.size = 20
  3136.     @total_sec = Graphics.frame_count / Graphics.frame_rate
  3137.     @minute=$game_time.get_minute.floor
  3138.     hour = $game_time.get_hour
  3139.     pm_flag= hour >=12 ? true : false
  3140.     hour= hour >= 12 ? hour-12 : hour
  3141.     day=$game_time.get_day
  3142.     month=$game_time.get_month
  3143.     year=$game_time.get_year
  3144.     if hour.floor==0
  3145.       text=sprintf("%02d:%02d",12,@minute)
  3146.     else
  3147.       text=sprintf("%02d:%02d",hour,@minute)
  3148.     end
  3149.     if pm_flag
  3150.       text += " PM"
  3151.     else
  3152.       text += " AM"
  3153.     end
  3154.     self.contents.font.color = normal_color
  3155.     self.contents.draw_text(16, 32, 110, 32, text, 2)
  3156.     text = sprintf("%02d - %02d - %02d", month, day, year)
  3157.     self.contents.font.color = system_color
  3158.     self.contents.draw_text(4,0,120,32,text)
  3159.   end
  3160.  
  3161.   def update
  3162.     if $game_time.get_minute.floor != @minute
  3163.       refresh
  3164.     end
  3165.   end
  3166.  
  3167. end
  3168.  
  3169. #==============================================================================
  3170. # ■ Window_NewLocation
  3171. #==============================================================================
  3172.  
  3173. class Window_NewLocation < Window_Base
  3174.  
  3175.   def initialize
  3176.     super(0, 0, 160, 96)
  3177.     self.contents = Bitmap.new(width - 32, height - 32)
  3178.     self.contents.font.name = $fontface
  3179.     self.contents.font.size = 20
  3180.     refresh
  3181.   end
  3182.  
  3183.   def refresh
  3184.     self.contents.clear
  3185.     self.contents.font.color = system_color
  3186.     self.contents.draw_text(4, 0, 120, 32, "Location")
  3187.     self.contents.font.color = normal_color
  3188.     self.contents.draw_text(4, 32, 120, 32, $game_map.name.to_s, 2)
  3189.   end
  3190.  
  3191. end
  3192.  
  3193. #==============================================================================
  3194. # ■ Window_OptionMenuCommand
  3195. #==============================================================================
  3196. class Window_OptionMenuCommand < Window_Selectable
  3197.  
  3198.   def initialize(width, commands)
  3199.     super(0, 0, width, commands.size * 32 + 32)
  3200.     @item_max = commands.size
  3201.     @commands = commands
  3202.     self.contents = Bitmap.new(width - 32, @item_max * 32)
  3203.     self.contents.font.name = $fontface
  3204.     self.contents.font.size = 20
  3205.     refresh
  3206.     self.index = 0
  3207.   end
  3208.  
  3209.   def refresh
  3210.     self.contents.clear
  3211.     for i in 0...@item_max
  3212.     draw_item(i, normal_color)
  3213.     end
  3214.   end
  3215.  
  3216.   def draw_item(index, color)
  3217.     self.contents.font.color = color
  3218.     rect = Rect.new(12, 32 * index, self.contents.width - 8, 32)
  3219.     self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  3220.     bitmap = RPG::Cache.icon("optionmenu" + index.to_s)
  3221.     self.contents.blt(x + 3, index * 32 +4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  3222.     self.contents.draw_text(rect, @commands[index])
  3223.   end
  3224.  
  3225.   def disable_item(index)
  3226.     draw_item(index, disabled_color)
  3227.   end
  3228.  
  3229. end
  3230.  
  3231. #==============================================================================
  3232. # ■ Window_CurrentWindowSkin
  3233. #==============================================================================
  3234. class Window_CurrentWindowSkin < Window_Base
  3235.  
  3236.   def initialize
  3237.     super(0, 0, 192, 96)
  3238.     self.contents = Bitmap.new(width - 32, height - 32)
  3239.     self.contents.font.name = $fontface
  3240.     self.contents.font.size = 20
  3241.   end
  3242.  
  3243.   def refresh
  3244.     self.contents.clear
  3245.     self.contents.font.color = system_color
  3246.     self.contents.draw_text(4, 0, 120, 32, "Current skin")
  3247.     self.contents.font.color = normal_color
  3248.     self.contents.draw_text(4, 32, 120, 32, $game_system.windowskin_name.to_s, 2.9)
  3249.   end
  3250.  
  3251. end
  3252.  
  3253. #==============================================================================
  3254. # ■ Window_WindowSkin
  3255. #==============================================================================
  3256. class Window_WindowSkin < Window_Selectable
  3257.  
  3258.   def initialize(width, commands)
  3259.     super(0, 0, width, commands.size * 32 + 32)
  3260.     @item_max = commands.size
  3261.     @commands = commands
  3262.     self.contents = Bitmap.new(width - 32, @item_max * 32)
  3263.     self.contents.font.name = $fontface
  3264.     self.contents.font.size = 20
  3265.     refresh
  3266.     self.index = 0
  3267.   end
  3268.  
  3269.   def refresh
  3270.     self.contents.clear
  3271.     for i in 0...@item_max
  3272.     draw_item(i, normal_color)
  3273.     end
  3274.   end
  3275.  
  3276.   def draw_item(index, color)
  3277.     self.contents.font.color = color
  3278.     rect = Rect.new(12, 32 * index, self.contents.width - 8, 32)
  3279.     self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  3280.     bitmap = RPG::Cache.icon("skin" + index.to_s)
  3281.     self.contents.blt(x + 3, index * 32 +4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  3282.     self.contents.draw_text(rect, @commands[index])
  3283.   end
  3284.  
  3285.   def disable_item(index)
  3286.     draw_item(index, disabled_color)
  3287.   end
  3288.  
  3289. end
  3290.  
  3291. #==============================================================================
  3292. # ■ Window_CurrentFontType
  3293. #==============================================================================
  3294. class Window_CurrentFontType < Window_Base
  3295.  
  3296.   def initialize
  3297.     super(0, 0, 192, 96)
  3298.     self.contents = Bitmap.new(width - 32, height - 32)
  3299.     self.contents.font.name = $fontface
  3300.     self.contents.font.size = 20
  3301.   end
  3302.  
  3303.   def refresh
  3304.     self.contents.clear
  3305.     self.contents.font.color = system_color
  3306.     self.contents.draw_text(4, 0, 120, 32, "Current Font")
  3307.     self.contents.font.color = normal_color
  3308.     self.contents.draw_text(4, 32, 120, 32, $fontface.to_s, 2.9)
  3309.   end
  3310.  
  3311. end
  3312.  
  3313. #==============================================================================
  3314. # ■ Window_FontType
  3315. #==============================================================================
  3316. class Window_FontType < Window_Selectable
  3317.  
  3318.   def initialize(width, commands)
  3319.     super(0, 0, width, commands.size * 32 + 32)
  3320.     @item_max = commands.size
  3321.     @commands = commands
  3322.     self.contents = Bitmap.new(width - 32, @item_max * 32)
  3323.     self.contents.font.name = $fontface
  3324.     self.contents.font.size = 20
  3325.     refresh
  3326.     self.index = 0
  3327.   end
  3328.  
  3329.   def refresh
  3330.     self.contents.clear
  3331.     for i in 0...@item_max
  3332.     draw_item(i, normal_color)
  3333.     end
  3334.   end
  3335.  
  3336.   def draw_item(index, color)
  3337.     self.contents.font.color = color
  3338.     rect = Rect.new(4, 32 * index, self.contents.width - 8, 32)
  3339.     self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  3340.     self.contents.draw_text(rect, @commands[index])
  3341.   end
  3342.  
  3343.   def disable_item(index)
  3344.     draw_item(index, disabled_color)
  3345.   end
  3346.  
  3347. end
  3348.  
  3349. #==============================================================================
  3350. # ■ Window_CurrentBGM_Volume
  3351. #==============================================================================
  3352. class Window_CurrentBGM_Volume < Window_Base
  3353.  
  3354.   def initialize
  3355.     super(0, 0, 192, 96)
  3356.     self.contents = Bitmap.new(width - 32, height - 32)
  3357.     self.contents.font.name = $fontface
  3358.     self.contents.font.size = 20
  3359.   end
  3360.  
  3361.   def refresh
  3362.     self.contents.clear
  3363.     self.contents.font.color = system_color
  3364.     self.contents.draw_text(4, 0, 160, 32, "Current BGM Volume")
  3365.     self.contents.font.color = normal_color
  3366.     self.contents.draw_text(4, 32, 120, 32, $game_system.bgm_volume.to_s + "%", 2.9)
  3367.   end
  3368.  
  3369. end
  3370.  
  3371. #==============================================================================
  3372. # ■ Window_BGM_Volume
  3373. #==============================================================================
  3374. class Window_BGM_Volume < Window_Selectable
  3375.  
  3376.   def initialize(width, commands)
  3377.     super(0, 0, width, commands.size * 32 + 32)
  3378.     @item_max = commands.size
  3379.     @commands = commands
  3380.     self.contents = Bitmap.new(width - 32, @item_max * 32)
  3381.     self.contents.font.name = $fontface
  3382.     self.contents.font.size = 20
  3383.     refresh
  3384.     self.index = 0
  3385.   end
  3386.  
  3387.   def refresh
  3388.     self.contents.clear
  3389.     self.contents.font.name = $fontface
  3390.     self.contents.font.size = 20
  3391.     for i in 0...@item_max
  3392.     draw_item(i, normal_color)
  3393.     end
  3394.   end
  3395.  
  3396.   def draw_item(index, color)
  3397.     self.contents.font.color = color
  3398.     rect = Rect.new(4, 32 * index, self.contents.width - 8, 32)
  3399.     self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  3400.     self.contents.draw_text(rect, @commands[index])
  3401.   end
  3402.  
  3403.   def disable_item(index)
  3404.     draw_item(index, disabled_color)
  3405.   end
  3406.  
  3407. end
  3408.  
  3409. #==============================================================================
  3410. # ■ Window_CurrentSFX_Volume
  3411. #==============================================================================
  3412. class Window_CurrentSFX_Volume < Window_Base
  3413.  
  3414.   def initialize
  3415.     super(0, 0, 192, 96)
  3416.     self.contents = Bitmap.new(width - 32, height - 32)
  3417.     self.contents.font.name = $fontface
  3418.     self.contents.font.size = 20
  3419.   end
  3420.  
  3421.   def refresh
  3422.     self.contents.clear
  3423.     self.contents.font.color = system_color
  3424.     self.contents.draw_text(4, 0, 160, 32, "Current SFX Volume")
  3425.     self.contents.font.color = normal_color
  3426.     self.contents.draw_text(4, 32, 120, 32, $game_system.se_volume.to_s + "%", 2.9)
  3427.   end
  3428.  
  3429. end
  3430.  
  3431. #==============================================================================
  3432. # ■ Window_SFX_Volume
  3433. #==============================================================================
  3434. class Window_SFX_Volume < Window_Selectable
  3435.  
  3436.   def initialize(width, commands)
  3437.     super(0, 0, width, commands.size * 32 + 32)
  3438.     @item_max = commands.size
  3439.     @commands = commands
  3440.     self.contents = Bitmap.new(width - 32, @item_max * 32)
  3441.     self.contents.font.name = $fontface
  3442.     self.contents.font.size = 20
  3443.     refresh
  3444.     self.index = 0
  3445.   end
  3446.  
  3447.   def refresh
  3448.     self.contents.clear
  3449.     self.contents.font.name = $fontface
  3450.     self.contents.font.size = 20
  3451.     for i in 0...@item_max
  3452.     draw_item(i, normal_color)
  3453.     end
  3454.   end
  3455.  
  3456.   def draw_item(index, color)
  3457.     self.contents.font.color = color
  3458.     rect = Rect.new(4, 32 * index, self.contents.width - 8, 32)
  3459.     self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  3460.     self.contents.draw_text(rect, @commands[index])
  3461.   end
  3462.  
  3463.   def disable_item(index)
  3464.     draw_item(index, disabled_color)
  3465.   end
  3466.  
  3467. end
  3468.  
  3469.  
  3470. #==============================================================================
  3471. # ■ Window_NewCommand
  3472. #==============================================================================
  3473.  
  3474. class Window_NewCommand < Window_Selectable
  3475.  
  3476.   def initialize(width, commands)
  3477.     super(0, 0, width, commands.size * 32 + 32)
  3478.     @item_max = commands.size
  3479.     @commands = commands
  3480.     self.contents = Bitmap.new(width - 32, @item_max * 32)
  3481.     self.contents.font.name = $fontface
  3482.     self.contents.font.size = 20
  3483.     refresh
  3484.     self.index = 0
  3485.   end
  3486.  
  3487.   def refresh
  3488.     self.contents.clear
  3489.     for i in 0...@item_max
  3490.       draw_item(i, normal_color)
  3491.     end
  3492.   end
  3493.  
  3494.   def draw_item(index, color)
  3495.     self.contents.font.color = color
  3496.     rect = Rect.new(4, 32 * index, self.contents.width - 8, 32)
  3497.     self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  3498.     self.contents.draw_text(rect, @commands[index])
  3499.   end
  3500.  
  3501.   def disable_item(index)
  3502.     draw_item(index, disabled_color)
  3503.   end
  3504.  
  3505. end
  3506.  
  3507. #==============================================================================
  3508. # ■ Scene_Menu
  3509. #==============================================================================
  3510.  
  3511. class Scene_Menu
  3512.  
  3513.   def initialize(menu_index = 0, actor_index = 0, equip_index = 0, min_size = 1, max_size = 4)
  3514.     @menu_index = menu_index
  3515.     @actor_index = actor_index
  3516.     @equip_index = equip_index
  3517.     @min_size = [[min_size, 1].max, 4].min
  3518.     @max_size = [[max_size, @min_size].max, 4].min
  3519.   end
  3520.  
  3521.   def main
  3522.     $game_temp.enemy_book_data = Data_MonsterBook.new
  3523.     @actor = $game_party.actors[@actor_index]
  3524.     @spriteset = Spriteset_Map.new
  3525.     s1 = "     " + $data_system.words.item
  3526.     s2 = "     " + $data_system.words.skill
  3527.     s3 = "     " + $data_system.words.equip
  3528.     s4 = "     " + "Status"
  3529.     s5 = "     " + $data_system.words.gold
  3530.     s6 = "     " + "Time"
  3531.     s7 = "     " + "Location"
  3532.     s8 = "     " + "Options"
  3533.     s9 = "     " + "Party"
  3534.     s10 = "     " + "Load"
  3535.     s11 = "     " + "Save"
  3536.     s12 = "     " + "Exit"
  3537.    
  3538.     u1 = "     " + "Basic"
  3539.     u2 = "     " + "Weapons"
  3540.     u3 = "     " + "Armor"
  3541.     u4 = "     " + "Accessory"
  3542.     u5 = "     " + "Quest"
  3543.    
  3544.     v1 = "     " + "Window Skin"
  3545.     v2 = "     " + "Font Type"
  3546.     v3 = "     " + "BGM Volume"
  3547.     v4 = "     " + "SFX Volume"
  3548.    
  3549.     r1 = ""
  3550.     r2 = ""
  3551.     r3 = ""
  3552.     r4 = ""
  3553.     r5 = ""
  3554.     r6 = ""
  3555.     r7 = ""
  3556.     r8 = ""
  3557.    
  3558.     f1 = "Arial"
  3559.     f2 = "Bookman Old Style"
  3560.     f3 = "Comic Sans MS"
  3561.     f4 = "Mistral"
  3562.     f5 = "Papyrus"
  3563.     f6 = "Tahoma"
  3564.     f7 = "Times New Roman"
  3565.    
  3566.     b1 = "0%"
  3567.     b2 = "17%"
  3568.     b3 = "34%"
  3569.     b4 = "50%"
  3570.     b5 = "67%"
  3571.     b6 = "84%"
  3572.     b7 = "100%"
  3573.    
  3574.     m1 = "0%"
  3575.     m2 = "17%"
  3576.     m3 = "34%"
  3577.     m4 = "50%"
  3578.     m5 = "67%"
  3579.     m6 = "84%"
  3580.     m7 = "100%"
  3581.    
  3582.     e1 = "To Title"
  3583.     e2 = "Shutdown"
  3584.     e3 = "Cancel"
  3585.    
  3586.     @command_window = Window_MenuCommand.new(160, [s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12])
  3587.     @command_window.index = @menu_index
  3588.     @command_window.x = 640
  3589.     @command_window.y = 32
  3590.     @command_window.z = 999
  3591.     if $game_party.actors.size == 0
  3592.       @command_window.disable_item(0)
  3593.       @command_window.disable_item(1)
  3594.       @command_window.disable_item(2)
  3595.       @command_window.disable_item(3)
  3596.     end
  3597.     if $game_system.save_disabled
  3598.       @command_window.disable_item(11)
  3599.     end
  3600.    
  3601.     @item_command_window = Window_ItemMenuCommand.new(192, [u1, u2, u3, u4, u5])
  3602.     @item_command_window.active = false
  3603.     @item_command_window.x = -192
  3604.     @item_command_window.y = 32
  3605.     @item_command_window.z = 1999
  3606.     @status_window = Window_NewMenuStatus.new
  3607.     @status_window.active = false
  3608.     @status_window.x = -432
  3609.     @status_window.y = 64
  3610.     @help_window = Window_NewHelp.new
  3611.     @help_window.active = false
  3612.     @help_window.x = 48
  3613.     @help_window.y = -352
  3614.     @help_window.z = 2999
  3615.     @basic_item_window = Window_Basic_Item.new
  3616.     @basic_item_window.active = false
  3617.     @basic_item_window.x = 240
  3618.     @basic_item_window.y = 480
  3619.     @basic_item_window.z = 2999
  3620.     @basic_item_window.help_window = @help_window
  3621.     @target_window = Window_NewTarget.new
  3622.     @target_window.active = false
  3623.     @target_window.visible = false
  3624.     @target_window.x = 48
  3625.     @target_window.y = 480
  3626.     @target_window.z = 2999
  3627.     @weapons_window = Window_Weapons.new
  3628.     @weapons_window.active = false
  3629.     @weapons_window.x = 400
  3630.     @weapons_window.y = 480
  3631.     @weapons_window.z = 1999
  3632.     @weapons_window.help_window = @help_window
  3633.     @weapon_stats_window = Window_Weapon_Stats.new
  3634.     @weapon_stats_window.active = false
  3635.     @weapon_stats_window.x = 48
  3636.     @weapon_stats_window.y = 480
  3637.     @weapon_stats_window.z = 2999
  3638.     @armor_window = Window_Armor.new
  3639.     @armor_window.active = false
  3640.     @armor_window.x = 400
  3641.     @armor_window.y = 480
  3642.     @armor_window.z = 1999
  3643.     @armor_window.help_window = @help_window
  3644.     @armor_stats_window = Window_Armor_Stats.new
  3645.     @armor_stats_window.active = false
  3646.     @armor_stats_window.x = 48
  3647.     @armor_stats_window.y = 480
  3648.     @armor_stats_window.z = 2999
  3649.     @accessory_window = Window_Accessory.new
  3650.     @accessory_window.active = false
  3651.     @accessory_window.x = 400
  3652.     @accessory_window.y = 480
  3653.     @accessory_window.z = 1999
  3654.     @accessory_window.help_window = @help_window
  3655.     @accessory_stats_window = Window_Accessory_Stats.new
  3656.     @accessory_stats_window.active = false
  3657.     @accessory_stats_window.x = 48
  3658.     @accessory_stats_window.y = 480
  3659.     @accessory_stats_window.z = 2999
  3660.    
  3661.  
  3662.     @quest_item_window = Window_Quest_Item.new
  3663.     @quest_item_window.active = false
  3664.     @quest_item_window.x = 48
  3665.     @quest_item_window.y = 480
  3666.     @quest_item_window.z = 2999
  3667.     @quest_item_window.help_window = @help_window
  3668.     @skill_window = Window_NewSkill.new(@actor)
  3669.     @skill_window.active = false
  3670.     @skill_window.x = 240
  3671.     @skill_window.y = 480
  3672.     @skill_window.z = 2999
  3673.     @skill_window.help_window = @help_window
  3674.     @skilltarget_window = Window_NewTarget.new
  3675.     @skilltarget_window.active = false
  3676.     @skilltarget_window.visible = false
  3677.     @skilltarget_window.x = 48
  3678.     @skilltarget_window.y = 480
  3679.     @skilltarget_window.z = 2999
  3680.     @left_window = Window_NewEquipLeft.new(@actor)
  3681.     @left_window.active = false
  3682.     @left_window.x = -352
  3683.     @left_window.y = 96
  3684.     @left_window.z = 2999
  3685.     @right_window = Window_NewEquipRight.new(@actor)
  3686.     @right_window.help_window = @help_window
  3687.     @right_window.active = false
  3688.     @right_window.x = 688
  3689.     @right_window.y = 96
  3690.     @right_window.z = 2999
  3691.     @right_window.index = @equip_index
  3692.  
  3693.     @item_window1 = Window_NewEquipItem.new(@actor, 0)
  3694.     @item_window1.help_window = @help_window
  3695.     @item_window1.visible = false
  3696.     @item_window1.active = false
  3697.     @item_window1.x = 304
  3698.     @item_window1.y = 672
  3699.     @item_window1.z = 2999
  3700.     @item_window2 = Window_NewEquipItem.new(@actor, 1)
  3701.     @item_window2.help_window = @help_window
  3702.     @item_window2.visible = false
  3703.     @item_window2.active = false
  3704.     @item_window2.x = 304
  3705.     @item_window2.y = 672
  3706.     @item_window2.z = 2999
  3707.     @item_window3 = Window_NewEquipItem.new(@actor, 2)
  3708.     @item_window3.help_window = @help_window
  3709.     @item_window3.visible = false
  3710.     @item_window3.active = false
  3711.     @item_window3.x = 304
  3712.     @item_window3.y = 672
  3713.     @item_window3.z = 2999
  3714.     @item_window4 = Window_NewEquipItem.new(@actor, 3)
  3715.     @item_window4.help_window = @help_window
  3716.     @item_window4.visible = false
  3717.     @item_window4.active = false
  3718.     @item_window4.x = 304
  3719.     @item_window4.y = 672
  3720.     @item_window4.z = 2999
  3721.     @item_window5 = Window_NewEquipItem.new(@actor, 4)
  3722.     @item_window5.help_window = @help_window
  3723.     @item_window5.visible = false
  3724.     @item_window5.active = false
  3725.     @item_window5.x = 304
  3726.     @item_window5.y = 672
  3727.     @item_window5.z = 2999
  3728.  
  3729.     @playerstatus_window = Window_NewStatus.new(@actor)
  3730.     @playerstatus_window.active= false
  3731.     @playerstatus_window.x = 640
  3732.     @playerstatus_window.y = 32
  3733.     @playerstatus_window.z = 1999
  3734.     @gold_window = Window_NewGold.new
  3735.     @gold_window.active = false
  3736.     @gold_window.x = -160
  3737.     @gold_window.y = 160
  3738.     @gold_window.z = 1999
  3739.     @time_window = Window_NewTime.new
  3740.     @time_window.active = false
  3741.     @time_window.x = -160
  3742.     @time_window.y = 192
  3743.     @time_window.z = 1999
  3744.     @location_window = Window_NewLocation.new
  3745.     @location_window.active = false
  3746.     @location_window.x = -160
  3747.     @location_window.y = 224
  3748.     @location_window.z = 1999
  3749.  
  3750.     @option_command_window = Window_OptionMenuCommand.new(192, [v1, v2, v3, v4])
  3751.     @option_command_window.active = false
  3752.     @option_command_window.x = -208
  3753.     @option_command_window.y = 256
  3754.     @option_command_window.z = 1999
  3755.     @windowskin_window = Window_WindowSkin.new(64, [r1, r2, r3, r4, r5, r6, r7])
  3756.     @windowskin_window.active = false
  3757.     @windowskin_window.x = -80
  3758.     @windowskin_window.y = 160
  3759.     @windowskin_window.z = 2999
  3760.     @currentwindowskin_window = Window_CurrentWindowSkin.new
  3761.     @currentwindowskin_window.active = false
  3762.     @currentwindowskin_window.x = 208
  3763.     @currentwindowskin_window.y = -288
  3764.     @currentwindowskin_window.z = 1999
  3765.     @fonttype_window = Window_FontType.new(192, [f1, f2, f3, f4, f5, f6, f7])
  3766.     @fonttype_window.active = false
  3767.     @fonttype_window.x = -208
  3768.     @fonttype_window.y = 160
  3769.     @fonttype_window.z = 2999
  3770.     @currentfonttype_window = Window_CurrentFontType.new
  3771.     @currentfonttype_window.active = false
  3772.     @currentfonttype_window.x = 208
  3773.     @currentfonttype_window.y = -416
  3774.     @currentfonttype_window.z = 1999
  3775.     @bgm_window = Window_BGM_Volume.new(80, [b1, b2, b3, b4, b5, b6, b7])
  3776.     @bgm_window.active = false
  3777.     @bgm_window.x = -208
  3778.     @bgm_window.y = 160
  3779.     @bgm_window.z = 2999
  3780.     @currentbgm_window = Window_CurrentBGM_Volume.new
  3781.     @currentbgm_window.active = false
  3782.     @currentbgm_window.x = 208
  3783.     @currentbgm_window.y = -416
  3784.     @currentbgm_window.z = 1999
  3785.     @sfx_window = Window_SFX_Volume.new(80, [m1, m2, m3, m4, m5, m6, m7])
  3786.     @sfx_window.active = false
  3787.     @sfx_window.x = -208
  3788.     @sfx_window.y = 160
  3789.     @sfx_window.z = 2999
  3790.     @currentsfx_window = Window_CurrentSFX_Volume.new
  3791.     @currentsfx_window.active = false
  3792.     @currentsfx_window.x = 208
  3793.     @currentsfx_window.y = -416
  3794.     @currentsfx_window.z = 1999
  3795.     @party_window = Window_SwitchParty.new
  3796.     @party_window.active = false
  3797.     @party_window.x = -352
  3798.     @party_window.y = 32
  3799.     @party_window.z = 2999
  3800.     @reserve_window = Window_SwitchReserve.new(20)
  3801.     @reserve_window.active = false
  3802.     @reserve_window.visible = false
  3803.     @reserve_window.x = 256
  3804.     @reserve_window.y = 544
  3805.     @reserve_window.z = 2999
  3806.     @switchstatus_window = Window_SwitchStatus.new
  3807.     @switchstatus_window.active = false
  3808.     @switchstatus_window.x = 640
  3809.     @switchstatus_window.y = 32
  3810.     @switchstatus_window.z = 2999
  3811.     if $game_party.actors.size == 0
  3812.       @party_window.active = false
  3813.     else
  3814.       @reserve_window.active = false
  3815.     end
  3816.     @party_window.help_window = @switchstatus_window
  3817.     @reserve_window.help_window = @switchstatus_window
  3818.    # t = Time.now
  3819.    
  3820.     @title_window = Window_Base.new(-576, 32, 576, 64)
  3821.     @title_window.contents = Bitmap.new(576 - 32, 64 - 32)
  3822.     @title_window.contents.font.name = $fontface
  3823.     @title_window.contents.font.size = 20
  3824.     #@title_window.contents.draw_text(4, 0, 320, 32, "Bestiary", 0)
  3825.     #e_now = $game_party.enemy_book_now
  3826.     #e_max = $game_party.enemy_book_max
  3827.     #comp = $game_party.enemy_book_complete_percentage
  3828.     #text = e_now.to_s + " / " + e_max.to_s + "      " + comp.to_s + " %"
  3829.     #@title_window.contents.draw_text(256, 0, 288, 32,  text, 2)
  3830.     @title_window.active = false
  3831.     @title_window.z = 2999
  3832.     @main_window = Window_Base.new(1,1,1,1)#Window_MonsterBook.new
  3833.     @main_window.active = false
  3834.     @main_window.x = 640
  3835.     @main_window.y = 96
  3836.     @main_window.z = 2999
  3837.     @info_window = Window_Base.new(1,1,1,1)#Window_MonsterBook_Info.new
  3838.     @info_window.active = false
  3839.     @info_window.visible = false
  3840.     @info_window.x = 640
  3841.     @info_window.y = 96
  3842.     @info_window.z = 3999
  3843.  
  3844.     @end_window = Window_NewCommand.new(128, [e1, e2, e3])
  3845.     @end_window.active = false
  3846.     @end_window.x = -192
  3847.     @end_window.y = 352
  3848.     @end_window.z = 1999
  3849.     Graphics.transition
  3850.     loop do
  3851.       Graphics.update
  3852.       Input.update
  3853.       update
  3854.       if $scene != self
  3855.         break
  3856.       end
  3857.     end
  3858.     @spriteset.dispose
  3859.     @command_window.dispose
  3860.     @item_command_window.dispose
  3861.     @status_window.dispose
  3862.     @help_window.dispose
  3863.     @basic_item_window.dispose
  3864.     @target_window.dispose
  3865.     @weapons_window.dispose
  3866.     @weapon_stats_window.dispose
  3867.     @armor_window.dispose
  3868.     @armor_stats_window.dispose
  3869.     @accessory_window.dispose
  3870.     @accessory_stats_window.dispose
  3871.     @quest_item_window.dispose
  3872.     @skill_window.dispose
  3873.     @skilltarget_window.dispose
  3874.     @left_window.dispose
  3875.     @right_window.dispose
  3876.     @item_window1.dispose
  3877.     @item_window2.dispose
  3878.     @item_window3.dispose
  3879.     @item_window4.dispose
  3880.     @item_window5.dispose
  3881.     @playerstatus_window.dispose
  3882.     @gold_window.dispose
  3883.     @time_window.dispose
  3884.     @location_window.dispose
  3885.     @option_command_window.dispose
  3886.     @windowskin_window.dispose
  3887.     @currentwindowskin_window.dispose
  3888.     @fonttype_window.dispose
  3889.     @currentfonttype_window.dispose
  3890.     @bgm_window.dispose
  3891.     @currentbgm_window.dispose
  3892.     @sfx_window.dispose
  3893.     @currentsfx_window.dispose
  3894.     @switchstatus_window.dispose
  3895.     @reserve_window.dispose
  3896.     @party_window.dispose
  3897.     @main_window.dispose
  3898.     @info_window.dispose
  3899.     @title_window.dispose
  3900.     @end_window.dispose
  3901.   end
  3902.  
  3903.   def equip_refresh
  3904.     @item_window1.visible = (@right_window.index == 0)
  3905.     @item_window2.visible = (@right_window.index == 1)
  3906.     @item_window3.visible = (@right_window.index == 2)
  3907.     @item_window4.visible = (@right_window.index == 3)
  3908.     @item_window5.visible = (@right_window.index == 4)
  3909.     item1 = @right_window.item
  3910.     case @right_window.index
  3911.     when 0
  3912.       @item_window = @item_window1
  3913.       newmode = 0
  3914.     when 1
  3915.       @item_window = @item_window2
  3916.       newmode = 1
  3917.     when 2
  3918.       @item_window = @item_window3
  3919.       newmode = 1
  3920.     when 3
  3921.       @item_window = @item_window4
  3922.       newmode = 1
  3923.     when 4
  3924.       @item_window = @item_window5
  3925.       newmode = 1
  3926.     end
  3927.     if newmode != @left_window.mode
  3928.       @left_window.mode = newmode
  3929.       @left_window.refresh
  3930.     end
  3931.     if @right_window.active
  3932.       @left_window.set_new_parameters(nil, nil, nil, nil, nil, nil, nil, nil,"", "")
  3933.     end
  3934.     if @item_window.active
  3935.       item2 = @item_window.item
  3936.       last_hp = @actor.hp
  3937.       last_sp = @actor.sp
  3938.       old_atk = @actor.atk
  3939.       old_pdef = @actor.pdef
  3940.       old_mdef = @actor.mdef
  3941.       old_str = @actor.str
  3942.       old_dex = @actor.dex
  3943.       old_agi = @actor.agi
  3944.       old_int = @actor.int
  3945.       old_eva = @actor.eva
  3946.       @actor.equip(@right_window.index, item2 == nil ? 0 : item2.id)
  3947.       new_atk = @actor.atk
  3948.       new_pdef = @actor.pdef
  3949.       new_mdef = @actor.mdef
  3950.       new_str = @actor.str
  3951.       new_dex = @actor.dex
  3952.       new_agi = @actor.agi
  3953.       new_int = @actor.int
  3954.       new_eva = @actor.eva
  3955.       @left_window.changes = [0, 0, 0, 0, 0, 0, 0, 0]
  3956.       if new_atk > old_atk
  3957.         @left_window.changes[0] = 1
  3958.       end
  3959.       if new_atk < old_atk
  3960.         @left_window.changes[0] = -1
  3961.       end
  3962.       if new_pdef > old_pdef
  3963.         @left_window.changes[1] = 1
  3964.       end
  3965.       if new_pdef < old_pdef
  3966.         @left_window.changes[1] = -1
  3967.       end
  3968.       if new_mdef > old_mdef
  3969.         @left_window.changes[2] = 1
  3970.       end
  3971.       if new_mdef < old_mdef
  3972.         @left_window.changes[2] = -1
  3973.       end
  3974.        if new_str > old_str
  3975.         @left_window.changes[3] = 1
  3976.       end
  3977.       if new_str < old_str
  3978.         @left_window.changes[3] = -1
  3979.       end
  3980.         if new_dex > old_dex
  3981.         @left_window.changes[4] = 1
  3982.       end
  3983.       if new_dex < old_dex
  3984.         @left_window.changes[4] = -1
  3985.       end
  3986.       if new_agi > old_agi
  3987.         @left_window.changes[5] = 1
  3988.       end
  3989.       if new_agi < old_agi
  3990.         @left_window.changes[5] = -1
  3991.       end
  3992.       if new_int > old_int
  3993.         @left_window.changes[6] = 1
  3994.       end
  3995.       if new_int < old_int
  3996.         @left_window.changes[6] = -1
  3997.       end
  3998.       if new_eva > old_eva
  3999.         @left_window.changes[7] = 1
  4000.       end
  4001.       if new_eva < old_eva
  4002.         @left_window.changes[7] = -1
  4003.       end
  4004.       elem_text = make_elem_text(item2)
  4005.       stat_text = make_stat_text(item2)
  4006.       @actor.equip(@right_window.index, item1 == nil ? 0 : item1.id)
  4007.       @actor.hp = last_hp
  4008.       @actor.sp = last_sp
  4009.       @left_window.set_new_parameters(new_atk, new_pdef, new_mdef, new_str,
  4010.       new_dex, new_agi, new_int, new_eva, elem_text, stat_text)
  4011.     end
  4012.   end
  4013.  
  4014.   def make_elem_text(item)
  4015.     text = ""
  4016.     flag = false
  4017.     if item.is_a?(RPG::Weapon)
  4018.       for i in item.element_set
  4019.         if flag
  4020.           text += ", "
  4021.         end
  4022.         text += $data_system.elements[i]
  4023.         flag = true
  4024.       end
  4025.     end
  4026.     if item.is_a?(RPG::Armor)
  4027.       for i in item.guard_element_set
  4028.         if flag
  4029.           text += ", "
  4030.         end
  4031.         text += $data_system.elements[i]
  4032.         flag = true
  4033.       end
  4034.     end
  4035.     return text
  4036.   end
  4037.  
  4038.   def make_stat_text(item)
  4039.     text = ""
  4040.     flag = false
  4041.     if item.is_a?(RPG::Weapon)
  4042.       for i in item.plus_state_set
  4043.         if flag
  4044.           text += ", "
  4045.         end
  4046.         text += $data_states[i].name
  4047.         flag = true
  4048.       end
  4049.     end
  4050.     if item.is_a?(RPG::Armor)
  4051.       for i in item.guard_state_set
  4052.         if flag
  4053.           text += ", "
  4054.         end
  4055.         text += $data_states[i].name
  4056.         flag = true
  4057.       end
  4058.     end
  4059.     return text
  4060.   end
  4061.  
  4062.   def update
  4063.     @command_window.update
  4064.     @item_command_window.update
  4065.     @status_window.update
  4066.     @help_window.update
  4067.     @basic_item_window.update
  4068.     @target_window.update
  4069.     @weapons_window.update
  4070.     @weapon_stats_window.update
  4071.     @armor_window.update
  4072.     @armor_stats_window.update
  4073.     @accessory_window.update
  4074.     @accessory_stats_window.update
  4075.     @quest_item_window.update
  4076.     @skill_window.update
  4077.     @skilltarget_window.update
  4078.     @left_window.update
  4079.     @right_window.update
  4080.     @playerstatus_window.update
  4081.     @gold_window.update
  4082.     @time_window.update
  4083.     @location_window.update
  4084.     @option_command_window.update
  4085.     @windowskin_window.update
  4086.     @currentwindowskin_window.update
  4087.     @fonttype_window.update
  4088.     @currentfonttype_window.update
  4089.     @bgm_window.update
  4090.     @currentbgm_window.update
  4091.     @sfx_window.update
  4092.     @currentsfx_window.update
  4093.     @party_window.update
  4094.     @reserve_window.update
  4095.     @switchstatus_window.update
  4096.     @main_window.update
  4097.     @info_window.update
  4098.     @end_window.update
  4099.    
  4100.     if @command_window.x > 48
  4101.       @command_window.x = 48
  4102.     end
  4103.     if @item_command_window.active
  4104.         @item_command_window.x = 208
  4105.     end
  4106.     if @status_window.x < 160
  4107.       @status_window.x = 160
  4108.     end
  4109.     if @help_window.active
  4110.         @help_window.y = 32
  4111.     end
  4112.     if @basic_item_window.active
  4113.         @basic_item_window.y = 96
  4114.     end
  4115.     if @target_window.visible
  4116.         @target_window.y = 96
  4117.     end
  4118.     if @weapons_window.active
  4119.         @weapons_window.y = 96
  4120.     end
  4121.      if @weapon_stats_window.active
  4122.         @weapon_stats_window.y = 96
  4123.     end
  4124.     if @armor_window.active
  4125.         @armor_window.y = 96
  4126.     end
  4127.      if @armor_stats_window.active
  4128.         @armor_stats_window.y = 96
  4129.     end
  4130.     if @accessory_window.active
  4131.         @accessory_window.y = 96
  4132.     end
  4133.      if @accessory_stats_window.active
  4134.         @accessory_stats_window.y = 96
  4135.     end
  4136.     if @quest_item_window.active
  4137.         @quest_item_window.y = 96
  4138.     end
  4139.     if @skill_window.active
  4140.         @skill_window.y = 96
  4141.     end
  4142.     if @skilltarget_window.visible
  4143.         @skilltarget_window.y = 96
  4144.     end
  4145.     if @item_window != nil
  4146.       if @item_window.visible
  4147.         equip_refresh
  4148.         @item_window.update
  4149.         @item_window2.y = 288
  4150.         @item_window3.y = 288
  4151.         @item_window4.y = 288
  4152.         @item_window5.y = 288
  4153.       end
  4154.     end
  4155.     if @item_window1.visible
  4156.         @item_window1.y = 288
  4157.     end
  4158.     if @left_window.active
  4159.         @left_window.x = 32
  4160.     end
  4161.     if @right_window.active
  4162.         @right_window.x = 304
  4163.     end    
  4164.     if @playerstatus_window.active
  4165.         @playerstatus_window.x = 32
  4166.     end
  4167.     if @gold_window.active
  4168.         @gold_window.x = 208
  4169.     end
  4170.     if @time_window.active
  4171.         @time_window.x = 208
  4172.     end
  4173.     if @location_window.active
  4174.         @location_window.x = 208
  4175.     end
  4176.     if @option_command_window.active
  4177.         @option_command_window.x = 208
  4178.     end
  4179.     if @windowskin_window.active
  4180.         @windowskin_window.x = 400
  4181.     end
  4182.     if @currentwindowskin_window.active
  4183.         @currentwindowskin_window.y = 160
  4184.     end
  4185.     if @fonttype_window.active
  4186.         @fonttype_window.x = 400
  4187.     end
  4188.     if @currentfonttype_window.active
  4189.         @currentfonttype_window.y = 160
  4190.     end
  4191.     if @bgm_window.active
  4192.         @bgm_window.x = 400
  4193.     end
  4194.     if @currentbgm_window.active
  4195.         @currentbgm_window.y = 160
  4196.     end
  4197.     if @sfx_window.active
  4198.         @sfx_window.x = 400
  4199.     end
  4200.     if @currentsfx_window.active
  4201.         @currentsfx_window.y = 160
  4202.     end
  4203.     if @title_window.active
  4204.         @title_window.x = 32
  4205.     end
  4206.     if @switchstatus_window.active
  4207.         @switchstatus_window.x = 256
  4208.     end
  4209.     if @party_window.active
  4210.         @party_window.x = 32
  4211.     end
  4212.     if @reserve_window.visible
  4213.         @reserve_window.y = 160
  4214.     end
  4215.     if @main_window.active
  4216.         @main_window.x = 32
  4217.     end
  4218.     if @info_window.visible
  4219.         @info_window.x = 32
  4220.     end
  4221.     if @end_window.active
  4222.         @end_window.x = 208
  4223.     end
  4224.    
  4225.     if @command_window.active
  4226.       update_command
  4227.       return
  4228.     end
  4229.     if @item_command_window.active
  4230.       update_item_command
  4231.       return
  4232.     end
  4233.     if @status_window.active
  4234.       update_status
  4235.       return
  4236.     end
  4237.     if @basic_item_window.active
  4238.       update_item
  4239.       return
  4240.     end
  4241.     if @target_window.active
  4242.       update_target
  4243.       return
  4244.     end
  4245.     if @weapons_window.active
  4246.       update_weapons
  4247.       return
  4248.     end
  4249.     if @armor_window.active
  4250.       update_armor
  4251.       return
  4252.     end
  4253.     if @accessory_window.active
  4254.       update_accessory
  4255.       return
  4256.     end
  4257.     if @quest_item_window.active
  4258.       update_quest_item
  4259.       return
  4260.     end
  4261.     if @skill_window.active
  4262.       update_skill
  4263.       return
  4264.     end
  4265.     if @skilltarget_window.active
  4266.       update_skilltarget
  4267.       return
  4268.     end
  4269.     if @right_window.active
  4270.       update_right_equip
  4271.       return
  4272.     end
  4273.     if @item_window != nil
  4274.       if @item_window.active
  4275.         update_eitem
  4276.         return
  4277.       end
  4278.     end
  4279.     if @playerstatus_window.active
  4280.       update_playerstatus
  4281.       return
  4282.     end
  4283.     if @gold_window.active
  4284.       update_gold
  4285.       return
  4286.     end
  4287.     if @time_window.active
  4288.       update_time
  4289.       return
  4290.     end
  4291.     if @location_window.active
  4292.       update_location
  4293.       return
  4294.     end
  4295.     if @option_command_window.active
  4296.       update_option_command
  4297.       return
  4298.     end
  4299.     if @windowskin_window.active
  4300.       update_windowskin
  4301.       return
  4302.     end
  4303.     if @fonttype_window.active
  4304.       update_fonttype
  4305.       return
  4306.     end
  4307.     if @bgm_window.active
  4308.       update_bgm
  4309.       return
  4310.     end
  4311.     if @sfx_window.active
  4312.       update_sfx
  4313.       return
  4314.     end
  4315.     if @info_window.active
  4316.       update_info
  4317.       return
  4318.     end
  4319.     if @party_window.active
  4320.      update_party
  4321.      return    
  4322.     end
  4323.    if @reserve_window.active
  4324.      update_reserve
  4325.      return    
  4326.    end
  4327.     if @main_window.active
  4328.       update_main
  4329.       return
  4330.     end
  4331.     if @end_window.active
  4332.       update_end
  4333.       return
  4334.     end
  4335.   end
  4336.  
  4337.   def delay(seconds)
  4338.     for i in 0...(seconds * 1)
  4339.       sleep 0.01
  4340.       Graphics.update
  4341.     end
  4342.   end
  4343.  
  4344.   def update_command
  4345.     if Input.trigger?(Input::B)
  4346.       $game_system.se_play($data_system.cancel_se)
  4347.       $scene = Scene_Map.new
  4348.       return
  4349.     end
  4350.     if Input.trigger?(Input::C)
  4351.       if $game_party.actors.size == 0 and @command_window.index < 4
  4352.         $game_system.se_play($data_system.buzzer_se)
  4353.         return
  4354.       end
  4355.       case @command_window.index
  4356.       when 0  
  4357.         $game_system.se_play($data_system.decision_se)
  4358.         @item_command_window.active = true
  4359.         @command_window.active = false
  4360.       when 1  
  4361.         $game_system.se_play($data_system.decision_se)
  4362.         @command_window.active = false
  4363.         @status_window.active = true
  4364.         @status_window.index = 0
  4365.       when 2  
  4366.         $game_system.se_play($data_system.decision_se)
  4367.         @command_window.active = false
  4368.         @status_window.active = true
  4369.         @status_window.index = 0
  4370.       when 3  
  4371.         $game_system.se_play($data_system.decision_se)
  4372.         @command_window.active = false
  4373.         @status_window.active = true
  4374.         @status_window.index = 0
  4375.       when 4
  4376.         $game_system.se_play($data_system.decision_se)
  4377.         @gold_window.active = true
  4378.         @command_window.active = false
  4379.       when 5  
  4380.         $game_system.se_play($data_system.decision_se)
  4381.         @time_window.active = true
  4382.         @command_window.active = false
  4383.       when 6
  4384.         $game_system.se_play($data_system.decision_se)
  4385.         @location_window.active = true
  4386.         @command_window.active = false
  4387.       when 7
  4388.         $game_system.se_play($data_system.decision_se)
  4389.         @option_command_window.active = true
  4390.         @command_window.active = false
  4391.       when 8
  4392.         $game_system.se_play($data_system.decision_se)
  4393.         @switchstatus_window.active = true
  4394.         @party_window.active = true
  4395.         @reserve_window.visible = true
  4396.         @command_window.active = false
  4397.       when 9
  4398.         $game_system.se_play($data_system.decision_se)
  4399.         $scene = Scene_NewLoad.new
  4400.       when 10
  4401.         if $game_system.save_disabled
  4402.           $game_system.se_play($data_system.buzzer_se)
  4403.           return
  4404.         end
  4405.         $game_system.se_play($data_system.decision_se)
  4406.         $scene = Scene_Save.new
  4407.       when 11
  4408.         $game_system.se_play($data_system.decision_se)
  4409.         @end_window.active = true
  4410.         @command_window.active = false
  4411.       end
  4412.       return
  4413.     end
  4414.   end
  4415.  
  4416.   def update_status
  4417.     if Input.trigger?(Input::B)
  4418.       $game_system.se_play($data_system.cancel_se)
  4419.       @status_window.active = false
  4420.       @command_window.active = true
  4421.       @status_window.index = -1
  4422.       return
  4423.     end
  4424.     if Input.trigger?(Input::C)
  4425.       case @command_window.index
  4426.       when 1
  4427.         if $game_party.actors[@status_window.index].restriction >= 2
  4428.           $game_system.se_play($data_system.buzzer_se)
  4429.           return
  4430.         end
  4431.         $game_system.se_play($data_system.decision_se)
  4432.         @actor = $game_party.actors[@status_window.index]
  4433.         @skill_window.update_actor(@actor)
  4434.         @skill_window.active = true
  4435.         @skilltarget_window.visible = true
  4436.         @help_window.active = true
  4437.         @status_window.active = false
  4438.       when 2
  4439.         $game_system.se_play($data_system.decision_se)
  4440.         @actor = $game_party.actors[@status_window.index]
  4441.         @right_window.update_actor(@actor)
  4442.         @right_window.active = true
  4443.         @left_window.update_actor(@actor)
  4444.         @left_window.active = true
  4445.         @help_window.x = 32
  4446.         @help_window.active = true
  4447.         @item_window1.visible = true
  4448.         @item_window2.visible = true
  4449.         @item_window3.visible = true
  4450.         @item_window4.visible = true
  4451.         @item_window5.visible = true
  4452.         @item_window1.update_actor(@actor, 0)
  4453.         @item_window2.update_actor(@actor, 1)
  4454.         @item_window3.update_actor(@actor, 2)
  4455.         @item_window4.update_actor(@actor, 3)
  4456.         @item_window5.update_actor(@actor, 4)
  4457.         @status_window.active = false
  4458.         equip_refresh
  4459.         return
  4460.       when 3  
  4461.         $game_system.se_play($data_system.decision_se)
  4462.         @actor = $game_party.actors[@status_window.index]
  4463.         @playerstatus_window.update_actor(@actor)
  4464.         @playerstatus_window.active = true
  4465.         @status_window.active = false
  4466.       end
  4467.       return
  4468.     end
  4469.   end
  4470.  
  4471.   def update_item_command
  4472.     if Input.trigger?(Input::B)
  4473.       $game_system.se_play($data_system.cancel_se)
  4474.       @item_command_window.active = false
  4475.       @item_command_window.x = -192
  4476.       @command_window.active = true
  4477.       @item_command_window.index = 0
  4478.       @status_window.index = -1
  4479.       return
  4480.     end
  4481.     if Input.trigger?(Input::C)
  4482.       case @item_command_window.index
  4483.       when 0
  4484.         $game_system.se_play($data_system.decision_se)
  4485.         @item_command_window.active = false
  4486.         @basic_item_window.active = true
  4487.         @help_window.active = true
  4488.         @target_window.visible = true
  4489.       when 1
  4490.         $game_system.se_play($data_system.decision_se)
  4491.         @item_command_window.active = false
  4492.         @weapons_window.active = true
  4493.         @help_window.active = true
  4494.         @weapon_stats_window.active = true
  4495.       when 2  
  4496.         $game_system.se_play($data_system.decision_se)
  4497.         @item_command_window.active = false
  4498.         @armor_window.active = true
  4499.         @help_window.active = true
  4500.         @armor_stats_window.active = true      
  4501.         when 3  
  4502.         $game_system.se_play($data_system.decision_se)
  4503.         @item_command_window.active = false
  4504.         @accessory_window.active = true
  4505.         @help_window.active = true
  4506.         @accessory_stats_window.active = true  
  4507.         when 4
  4508.         $game_system.se_play($data_system.decision_se)
  4509.         @item_command_window.active = false
  4510.         @quest_item_window.active = true
  4511.         @help_window.active = true
  4512.       end
  4513.       return
  4514.     end
  4515.   end
  4516.  
  4517.   def update_item
  4518.     if Input.trigger?(Input::B)
  4519.       $game_system.se_play($data_system.cancel_se)
  4520.       @basic_item_window.active = false
  4521.       @basic_item_window.y = 480
  4522.       @basic_item_window.index = 0
  4523.       @help_window.active = false
  4524.       @help_window.y = -352
  4525.       @item_command_window.active = true
  4526.       @target_window.visible = false
  4527.       @target_window.y = 480
  4528.       return
  4529.     end
  4530.     if Input.trigger?(Input::C)
  4531.       @item = @basic_item_window.item
  4532.       unless @item.is_a?(RPG::Item)
  4533.         $game_system.se_play($data_system.buzzer_se)
  4534.         return
  4535.       end
  4536.       unless $game_party.item_can_use?(@item.id)
  4537.         $game_system.se_play($data_system.buzzer_se)
  4538.         return
  4539.       end
  4540.       $game_system.se_play($data_system.decision_se)
  4541.       if @item.scope >= 3
  4542.         @basic_item_window.active = false
  4543.         @target_window.visible = true
  4544.         @target_window.active = true
  4545.         if @item.scope == 4 || @item.scope == 6
  4546.           @target_window.index = -1
  4547.         else
  4548.           @target_window.index = 0
  4549.         end
  4550.       else
  4551.         if @item.common_event_id > 0
  4552.           $game_temp.common_event_id = @item.common_event_id
  4553.           $game_system.se_play(@item.menu_se)
  4554.           if @item.consumable
  4555.             $game_party.lose_item(@item.id, 1)
  4556.             @basic_item_window.draw_item(@basic_item_window.index)
  4557.           end
  4558.           $scene = Scene_Map.new
  4559.           return
  4560.         end
  4561.       end
  4562.       return
  4563.     end
  4564.   end
  4565.  
  4566.   def update_target
  4567.     if Input.trigger?(Input::B)
  4568.       $game_system.se_play($data_system.cancel_se)
  4569.       unless $game_party.item_can_use?(@item.id)
  4570.         @basic_item_window.refresh
  4571.       end
  4572.       @basic_item_window.active = true
  4573.       @target_window.active = false
  4574.       return
  4575.     end
  4576.     if Input.trigger?(Input::C)
  4577.       if $game_party.item_number(@item.id) == 0
  4578.         $game_system.se_play($data_system.buzzer_se)
  4579.         return
  4580.       end
  4581.       if @target_window.index == -1
  4582.         used = false
  4583.         for i in $game_party.actors
  4584.           used |= i.item_effect(@item)
  4585.         end
  4586.       end
  4587.       if @target_window.index >= 0
  4588.         target = $game_party.actors[@target_window.index]
  4589.         used = target.item_effect(@item)
  4590.       end
  4591.       if used
  4592.         $game_system.se_play(@item.menu_se)
  4593.         if @item.consumable
  4594.           $game_party.lose_item(@item.id, 1)
  4595.           @basic_item_window.draw_item(@basic_item_window.index)
  4596.         end
  4597.         @target_window.refresh
  4598.         @skilltarget_window.refresh
  4599.         @status_window.refresh
  4600.         if $game_party.all_dead?
  4601.           $scene = Scene_Gameover.new
  4602.           return
  4603.         end
  4604.         if @item.common_event_id > 0
  4605.           $game_temp.common_event_id = @item.common_event_id
  4606.           $scene = Scene_Map.new
  4607.           return
  4608.         end
  4609.       end
  4610.       unless used
  4611.         $game_system.se_play($data_system.buzzer_se)
  4612.       end
  4613.       return
  4614.     end
  4615.   end
  4616.  
  4617.   def update_weapons
  4618.     @weapon_stats_window.item = @weapons_window.item
  4619.     if Input.trigger?(Input::B)
  4620.       $game_system.se_play($data_system.cancel_se)
  4621.       @weapons_window.active = false
  4622.       @weapons_window.y = 480
  4623.       @weapons_window.index = 0
  4624.       @help_window.active = false
  4625.       @help_window.y = -352
  4626.       @item_command_window.active = true
  4627.       @weapon_stats_window.active = false
  4628.       @weapon_stats_window.y = 480
  4629.       @weapon_stats_window.item = nil
  4630.       return
  4631.     end
  4632.     if Input.trigger?(Input::C)
  4633.       @item = @weapons_window.item
  4634.       unless @item.is_a?(RPG::Item)
  4635.         $game_system.se_play($data_system.buzzer_se)
  4636.         return
  4637.       end
  4638.       unless $game_party.item_can_use?(@item.id)
  4639.         $game_system.se_play($data_system.buzzer_se)
  4640.         return
  4641.       end
  4642.       $game_system.se_play($data_system.decision_se)
  4643.       return
  4644.     end
  4645.   end
  4646.  
  4647.   def update_armor
  4648.     @armor_stats_window.item = @armor_window.item
  4649.     if Input.trigger?(Input::B)
  4650.       $game_system.se_play($data_system.cancel_se)
  4651.       @armor_window.active = false
  4652.       @armor_window.y = 480
  4653.       @armor_window.index = 0
  4654.       @help_window.active = false
  4655.       @help_window.y = -352
  4656.       @item_command_window.active = true
  4657.       @armor_stats_window.active = false
  4658.       @armor_stats_window.y = 480
  4659.       @armor_stats_window.item = nil
  4660.       return
  4661.     end
  4662.     if Input.trigger?(Input::C)
  4663.       @item = @armor_window.item
  4664.       unless @item.is_a?(RPG::Item)
  4665.         $game_system.se_play($data_system.buzzer_se)
  4666.         return
  4667.       end
  4668.       unless $game_party.item_can_use?(@item.id)
  4669.         $game_system.se_play($data_system.buzzer_se)
  4670.         return
  4671.       end
  4672.       $game_system.se_play($data_system.decision_se)
  4673.       return
  4674.     end
  4675.   end
  4676.  
  4677.   def update_accessory
  4678.     @accessory_stats_window.item = @accessory_window.item
  4679.     if Input.trigger?(Input::B)
  4680.       $game_system.se_play($data_system.cancel_se)
  4681.       @accessory_window.active = false
  4682.       @accessory_window.y = 480
  4683.       @accessory_window.index = 0
  4684.       @help_window.active = false
  4685.       @help_window.y = -352
  4686.       @item_command_window.active = true
  4687.       @accessory_stats_window.active = false
  4688.       @accessory_stats_window.y = 480
  4689.       @accessory_stats_window.item = nil
  4690.       return
  4691.     end
  4692.     if Input.trigger?(Input::C)
  4693.       @item = @accessory_window.item
  4694.       unless @item.is_a?(RPG::Item)
  4695.         $game_system.se_play($data_system.buzzer_se)
  4696.         return
  4697.       end
  4698.       unless $game_party.item_can_use?(@item.id)
  4699.         $game_system.se_play($data_system.buzzer_se)
  4700.         return
  4701.       end
  4702.       $game_system.se_play($data_system.decision_se)
  4703.       return
  4704.     end
  4705.   end
  4706.  
  4707.   def update_quest_item
  4708.     if Input.trigger?(Input::B)
  4709.       $game_system.se_play($data_system.cancel_se)
  4710.       @quest_item_window.active = false
  4711.       @quest_item_window.y = 480
  4712.       @quest_item_window.index = 0
  4713.       @help_window.active = false
  4714.       @help_window.y = -352
  4715.       @item_command_window.active = true
  4716.       return
  4717.     end
  4718.     if Input.trigger?(Input::C)
  4719.       @item = @quest_item_window.item
  4720.       unless @item.is_a?(RPG::Item)
  4721.         $game_system.se_play($data_system.buzzer_se)
  4722.         return
  4723.       end
  4724.       unless $game_party.item_can_use?(@item.id)
  4725.         $game_system.se_play($data_system.buzzer_se)
  4726.         return
  4727.       end
  4728.       $game_system.se_play($data_system.decision_se)
  4729.       return
  4730.     end
  4731.   end
  4732.  
  4733.   def update_skill
  4734.     if Input.trigger?(Input::B)
  4735.       $game_system.se_play($data_system.cancel_se)
  4736.       @skill_window.active = false
  4737.       @skill_window.y = 480
  4738.       @skill_window.index = 0
  4739.       @skilltarget_window.visible = false
  4740.       @skilltarget_window.y = 480
  4741.       @help_window.active = false
  4742.       @help_window.y = -352
  4743.       @command_window.active = true
  4744.       @status_window.index = -1
  4745.       return
  4746.     end
  4747.     if Input.trigger?(Input::C)
  4748.       @skill = @skill_window.skill
  4749.       if @skill == nil or not @actor.skill_can_use?(@skill.id)
  4750.         $game_system.se_play($data_system.buzzer_se)
  4751.         return
  4752.       end
  4753.       $game_system.se_play($data_system.decision_se)
  4754.       if @skill.scope >= 3
  4755.         @skill_window.active = false
  4756.         @skilltarget_window.visible = true
  4757.         @skilltarget_window.active = true
  4758.         if @skill.scope == 4 || @skill.scope == 6
  4759.           @skilltarget_window.index = -1
  4760.         elsif @skill.scope == 7
  4761.           @skilltarget_window.index = @actor_index - 10
  4762.         else
  4763.           @skilltarget_window.index = 0
  4764.         end
  4765.       else
  4766.         if @skill.common_event_id > 0
  4767.           $game_temp.common_event_id = @skill.common_event_id
  4768.           $game_system.se_play(@skill.menu_se)
  4769.           @actor.sp -= @skill.sp_cost
  4770.           @status_window.refresh
  4771.           @skill_window.refresh
  4772.           @skilltarget_window.refresh
  4773.           $scene = Scene_Map.new
  4774.           return
  4775.         end
  4776.       end
  4777.       return
  4778.     end
  4779.   end
  4780.  
  4781.   def update_skilltarget
  4782.     if Input.trigger?(Input::B)
  4783.     $game_system.se_play($data_system.cancel_se)
  4784.     @skill_window.active = true
  4785.     @skilltarget_window.active = false
  4786.     return
  4787.   end
  4788.   if Input.trigger?(Input::C)
  4789.     unless @actor.skill_can_use?(@skill.id)
  4790.       $game_system.se_play($data_system.buzzer_se)
  4791.       return
  4792.     end
  4793.     if @skilltarget_window.index == -1
  4794.       used = false
  4795.       for i in $game_party.actors
  4796.         used |= i.skill_effect(@actor, @skill)
  4797.         end
  4798.       end
  4799.       if @skilltarget_window.index <= -2
  4800.         target = $game_party.actors[@skilltarget_window.index + 10]
  4801.         used = target.skill_effect(@actor, @skill)
  4802.       end
  4803.       if @skilltarget_window.index >= 0
  4804.         target = $game_party.actors[@skilltarget_window.index]
  4805.         used = target.skill_effect(@actor, @skill)
  4806.       end
  4807.       if used
  4808.         $game_system.se_play(@skill.menu_se)
  4809.         @actor.sp -= @skill.sp_cost
  4810.         @target_window.refresh
  4811.         @status_window.refresh
  4812.         @skill_window.refresh
  4813.         @skilltarget_window.refresh
  4814.         if $game_party.all_dead?
  4815.           $scene = Scene_Gameover.new
  4816.           return
  4817.         end
  4818.         if @skill.common_event_id > 0
  4819.           $game_temp.common_event_id = @skill.common_event_id
  4820.           $scene = Scene_Map.new
  4821.           return
  4822.         end
  4823.       end
  4824.       unless used
  4825.       $game_system.se_play($data_system.buzzer_se)
  4826.       end
  4827.       return
  4828.     end
  4829.   end
  4830.  
  4831.    def update_right_equip
  4832.     if Input.trigger?(Input::B)
  4833.       $game_system.se_play($data_system.cancel_se)
  4834.       @right_window.active = false
  4835.       @right_window.x = 688
  4836.       @right_window.index = 0
  4837.       @left_window.active = false
  4838.       @left_window.x = -352
  4839.       @help_window.active = false
  4840.       @help_window.y = -352
  4841.       @help_window.x = 48
  4842.       @item_window.y = 672
  4843.       @item_window.visible = false      
  4844.       @item_window1.y = 672
  4845.       @item_window2.y = 672
  4846.       @item_window3.y = 672
  4847.       @item_window4.y = 672
  4848.       @item_window5.y = 672
  4849.       @command_window.active = true
  4850.       @status_window.index = -1
  4851.       return
  4852.     end
  4853.     if Input.trigger?(Input::C)
  4854.       if @actor.equip_fix?(@right_window.index)
  4855.         $game_system.se_play($data_system.buzzer_se)
  4856.         return
  4857.       end
  4858.       $game_system.se_play($data_system.decision_se)
  4859.       @right_window.active = false
  4860.       @item_window.active = true
  4861.       @item_window.index = 0
  4862.       return
  4863.     end
  4864.   end
  4865.  
  4866.   def update_eitem
  4867.     if Input.trigger?(Input::B)
  4868.       $game_system.se_play($data_system.cancel_se)
  4869.       @right_window.active = true
  4870.       @item_window.active = false
  4871.       @item_window.index = -1
  4872.       return
  4873.     end
  4874.     if Input.trigger?(Input::C)
  4875.       $game_system.se_play($data_system.equip_se)
  4876.       item = @item_window.item
  4877.       @actor.equip(@right_window.index, item == nil ? 0 : item.id)
  4878.       @right_window.active = true
  4879.       @item_window.active = false
  4880.       @item_window.index = -1
  4881.       @right_window.refresh
  4882.       @item_window.refresh
  4883.       @item_window1.refresh
  4884.       @item_window2.refresh
  4885.       @item_window3.refresh
  4886.       @item_window4.refresh
  4887.       @item_window5.refresh
  4888.       return
  4889.     end
  4890.   end
  4891.  
  4892.   def update_playerstatus
  4893.     if Input.trigger?(Input::B)
  4894.       $game_system.se_play($data_system.cancel_se)
  4895.       @playerstatus_window.active = false
  4896.       @playerstatus_window.x = 640
  4897.       @command_window.active = true
  4898.       @status_window.index = -1
  4899.     end
  4900.   end
  4901.  
  4902.   def update_gold
  4903.     if Input.trigger?(Input::B)
  4904.       $game_system.se_play($data_system.cancel_se)
  4905.       @gold_window.active = false
  4906.       @gold_window.x = -160
  4907.       @command_window.active = true
  4908.     end
  4909.   end
  4910.  
  4911.   def update_time
  4912.     if Input.trigger?(Input::B)
  4913.       $game_system.se_play($data_system.cancel_se)
  4914.       @time_window.active = false
  4915.       @time_window.x = -160
  4916.       @command_window.active = true
  4917.     end
  4918.   end
  4919.  
  4920.   def update_location
  4921.     if Input.trigger?(Input::B)
  4922.       $game_system.se_play($data_system.cancel_se)
  4923.       @location_window.active = false
  4924.       @location_window.x = -160
  4925.       @command_window.active = true
  4926.     end
  4927.   end
  4928.  
  4929.   def update_option_command
  4930.     if Input.trigger?(Input::B)
  4931.       $game_system.se_play($data_system.cancel_se)
  4932.       @option_command_window.active = false
  4933.       @option_command_window.x = -192
  4934.       @option_command_window.index = 0
  4935.       @command_window.active = true
  4936.       return
  4937.     end
  4938.     if Input.trigger?(Input::C)
  4939.       case @option_command_window.index
  4940.       when 0
  4941.         $game_system.se_play($data_system.decision_se)
  4942.         @option_command_window.active = false
  4943.         @windowskin_window.active = true
  4944.         @currentwindowskin_window.active = true
  4945.         @currentwindowskin_window.refresh
  4946.       when 1
  4947.         $game_system.se_play($data_system.decision_se)
  4948.         @option_command_window.active = false
  4949.         @fonttype_window.active = true
  4950.         @currentfonttype_window.active = true
  4951.         @currentfonttype_window.refresh
  4952.       when 2  
  4953.         $game_system.se_play($data_system.decision_se)
  4954.         @option_command_window.active = false
  4955.         @bgm_window.active = true
  4956.         @currentbgm_window.active = true
  4957.         @currentbgm_window.refresh
  4958.       when 3  
  4959.         $game_system.se_play($data_system.decision_se)
  4960.         @option_command_window.active = false
  4961.         @sfx_window.active = true
  4962.         @currentsfx_window.active = true
  4963.         @currentsfx_window.refresh
  4964.       end
  4965.       return
  4966.     end
  4967.   end
  4968.  
  4969.   def update_windowskin
  4970.     if Input.trigger?(Input::B)
  4971.       $game_system.se_play($data_system.cancel_se)
  4972.       @windowskin_window.active = false
  4973.       @windowskin_window.x = -80
  4974.       @windowskin_window.index = 0
  4975.       @currentwindowskin_window.active = false
  4976.       @currentwindowskin_window.y = -304
  4977.       @option_command_window.active = true
  4978.       return
  4979.     end
  4980.     if Input.trigger?(Input::C)
  4981.       case @windowskin_window.index
  4982.       when 0
  4983.         $game_system.se_play($data_system.decision_se)
  4984.         $game_system.windowskin_name = "Black"
  4985.         @currentwindowskin_window.refresh
  4986.         @time_window.refresh
  4987.       when 1
  4988.         $game_system.se_play($data_system.decision_se)
  4989.         $game_system.windowskin_name = "Old"
  4990.         @currentwindowskin_window.refresh
  4991.         @time_window.refresh
  4992.       when 2
  4993.         $game_system.se_play($data_system.decision_se)
  4994.         $game_system.windowskin_name = "Red"
  4995.         @currentwindowskin_window.refresh
  4996.         @time_window.refresh
  4997.       when 3
  4998.         $game_system.se_play($data_system.decision_se)
  4999.         $game_system.windowskin_name = "Chaos"
  5000.         @currentwindowskin_window.refresh
  5001.         @time_window.refresh
  5002.       when 4
  5003.         $game_system.se_play($data_system.decision_se)
  5004.         $game_system.windowskin_name = "Grey"
  5005.         @currentwindowskin_window.refresh
  5006.         @time_window.refresh
  5007.       when 5
  5008.         $game_system.se_play($data_system.decision_se)
  5009.         $game_system.windowskin_name = "Sky"
  5010.         @currentwindowskin_window.refresh
  5011.         @time_window.refresh
  5012.       when 6
  5013.         $game_system.se_play($data_system.decision_se)
  5014.         $game_system.windowskin_name = "Army"
  5015.         @currentwindowskin_window.refresh
  5016.         @time_window.refresh
  5017.       end
  5018.       return
  5019.     end
  5020.   end
  5021.  
  5022.   def update_fonttype
  5023.     if Input.trigger?(Input::B)
  5024.       $game_system.se_play($data_system.cancel_se)
  5025.       @fonttype_window.active = false
  5026.       @fonttype_window.x = -192
  5027.       @fonttype_window.index = 0
  5028.       @currentfonttype_window.active = false
  5029.       @currentfonttype_window.y = -416
  5030.       @option_command_window.active = true
  5031.       return
  5032.     end
  5033.     if Input.trigger?(Input::C)
  5034.       case @fonttype_window.index
  5035.       when 0
  5036.         $game_system.se_play($data_system.decision_se)
  5037.         $fontface = "Arial"
  5038.         $scene = Scene_Menu.new
  5039.       when 1
  5040.         $game_system.se_play($data_system.decision_se)
  5041.         $fontface = "Bookman Old Style"
  5042.         $scene = Scene_Menu.new
  5043.       when 2
  5044.         $game_system.se_play($data_system.decision_se)
  5045.         $fontface = "Comic Sans MS"
  5046.         $scene = Scene_Menu.new
  5047.       when 3
  5048.         $game_system.se_play($data_system.decision_se)
  5049.         $fontface = "Mistral"
  5050.         $scene = Scene_Menu.new
  5051.       when 4
  5052.         $game_system.se_play($data_system.decision_se)
  5053.         $fontface = "Papyrus"
  5054.         $scene = Scene_Menu.new
  5055.       when 5
  5056.         $game_system.se_play($data_system.decision_se)
  5057.         $fontface = "Tahoma"
  5058.         $scene = Scene_Menu.new
  5059.       when 6
  5060.         $game_system.se_play($data_system.decision_se)
  5061.         $fontface = "Times New Roman"
  5062.         $scene = Scene_Menu.new
  5063.       end
  5064.       return
  5065.     end
  5066.   end
  5067.  
  5068.   def update_bgm
  5069.     if Input.trigger?(Input::B)
  5070.       $game_system.se_play($data_system.cancel_se)
  5071.       @bgm_window.active = false
  5072.       @bgm_window.x = -192
  5073.       @bgm_window.index = 0
  5074.       @currentbgm_window.active = false
  5075.       @currentbgm_window.y = -416
  5076.       @option_command_window.active = true
  5077.       return
  5078.     end
  5079.     if Input.trigger?(Input::C)
  5080.       case @bgm_window.index
  5081.       when 0
  5082.         $game_system.bgm_volume = 0
  5083.         $game_system.bgm_play($game_system.bgm_memorize)
  5084.         @currentbgm_window.refresh
  5085.       when 1
  5086.         $game_system.bgm_volume = 17
  5087.         $game_system.bgm_play($game_system.bgm_memorize)
  5088.         @currentbgm_window.refresh
  5089.       when 2
  5090.         $game_system.bgm_volume = 34
  5091.         $game_system.bgm_play($game_system.bgm_memorize)
  5092.         @currentbgm_window.refresh
  5093.       when 3
  5094.         $game_system.bgm_volume = 50
  5095.         $game_system.bgm_play($game_system.bgm_memorize)
  5096.         @currentbgm_window.refresh
  5097.       when 4
  5098.         $game_system.bgm_volume = 67
  5099.         $game_system.bgm_play($game_system.bgm_memorize)
  5100.         @currentbgm_window.refresh
  5101.       when 5
  5102.         $game_system.bgm_volume = 84
  5103.         $game_system.bgm_play($game_system.bgm_memorize)
  5104.         @currentbgm_window.refresh
  5105.       when 6
  5106.         $game_system.bgm_volume = 100
  5107.         $game_system.bgm_play($game_system.bgm_memorize)
  5108.         @currentbgm_window.refresh
  5109.       end
  5110.       return
  5111.     end
  5112.   end
  5113.  
  5114.   def update_sfx
  5115.     if Input.trigger?(Input::B)
  5116.       $game_system.se_play($data_system.cancel_se)
  5117.       @sfx_window.active = false
  5118.       @sfx_window.x = -192
  5119.       @sfx_window.index = 0
  5120.       @currentsfx_window.active = false
  5121.       @currentsfx_window.y = -416
  5122.       @option_command_window.active = true
  5123.       return
  5124.     end
  5125.     if Input.trigger?(Input::C)
  5126.       case @sfx_window.index
  5127.       when 0
  5128.         $game_system.se_volume = 0
  5129.         $game_system.se_play($data_system.decision_se)
  5130.         @currentsfx_window.refresh
  5131.       when 1
  5132.         $game_system.se_volume = 17
  5133.         $game_system.se_play($data_system.decision_se)
  5134.         @currentsfx_window.refresh
  5135.       when 2
  5136.         $game_system.se_volume = 34
  5137.         $game_system.se_play($data_system.decision_se)
  5138.         @currentsfx_window.refresh
  5139.       when 3
  5140.         $game_system.se_volume = 50
  5141.         $game_system.se_play($data_system.decision_se)
  5142.         @currentsfx_window.refresh
  5143.       when 4
  5144.         $game_system.se_volume = 67
  5145.         $game_system.se_play($data_system.decision_se)
  5146.         @currentsfx_window.refresh
  5147.       when 5
  5148.         $game_system.se_volume = 84
  5149.         $game_system.se_play($data_system.decision_se)
  5150.         @currentsfx_window.refresh
  5151.       when 6
  5152.         $game_system.se_volume = 100
  5153.         $game_system.se_play($data_system.decision_se)
  5154.         @currentsfx_window.refresh
  5155.       end
  5156.       return
  5157.     end
  5158.   end
  5159.  
  5160.   def update_party
  5161.    if Input.trigger?(Input::B)
  5162.      new_party = @party_window.new_party.compact
  5163.      n = new_party.size
  5164.      if n < @min_size or n > @max_size
  5165.        $game_system.se_play($data_system.buzzer_se)
  5166.        return
  5167.      end
  5168.      $game_system.se_play($data_system.decision_se)
  5169.      $game_party.actors = new_party
  5170.      @status_window.refresh
  5171.      @party_window.active = false
  5172.      @party_window.x = -352
  5173.      @switchstatus_window.active = false
  5174.      @switchstatus_window.x = 640
  5175.      @reserve_window.visible = false
  5176.      @reserve_window.y = 544
  5177.      @command_window.active = true
  5178.      $game_player.refresh
  5179.      return
  5180.    elsif Input.trigger?(Input::C)
  5181.      if(@party_window.actor != nil and @party_window.actor.mandatory)
  5182.        $game_system.se_play($data_system.buzzer_se)
  5183.      else
  5184.        $game_system.se_play($data_system.decision_se)
  5185.        @party_window.active = false
  5186.        @reserve_window.active = true      
  5187.      end    
  5188.    end    
  5189.  end
  5190.  
  5191.  def update_reserve
  5192.    if Input.trigger?(Input::B)
  5193.      $game_system.se_play($data_system.decision_se)
  5194.      @reserve_window.active = false
  5195.      @party_window.active = true
  5196.      return
  5197.    elsif Input.trigger?(Input::C)
  5198.      $game_system.se_play($data_system.decision_se)
  5199.      @party_window.change_selection(@reserve_window.swap_characters(@party_window.actor))
  5200.      @reserve_window.active = false
  5201.      @party_window.active = true    
  5202.    end
  5203.  end
  5204.  
  5205.  
  5206.   def update_main
  5207.     if Input.trigger?(Input::B)
  5208.       $game_system.se_play($data_system.cancel_se)
  5209.       @title_window.active = false
  5210.       @title_window.x = -576
  5211.       @main_window.active = false
  5212.       @main_window.x = 640
  5213.       @info_window.active = false
  5214.       @info_window.visible = false
  5215.       @info_window.x = 640
  5216.       @command_window.active = true
  5217.       return
  5218.     end
  5219.     if Input.trigger?(Input::C)
  5220.       if @main_window.item == nil or @main_window.show?(@main_window.item) == false
  5221.         $game_system.se_play($data_system.buzzer_se)
  5222.         return
  5223.       end
  5224.       $game_system.se_play($data_system.decision_se)
  5225.       @main_window.active = false
  5226.       @info_window.active = true
  5227.       @info_window.visible = true
  5228.       @visible_index = @main_window.index
  5229.       @info_window.refresh(@main_window.item)
  5230.       return
  5231.     end
  5232.   end
  5233.  
  5234.   def update_info
  5235.     if Input.trigger?(Input::B)
  5236.       $game_system.se_play($data_system.cancel_se)
  5237.       @main_window.active = true
  5238.       @info_window.active = false
  5239.       @info_window.x = 640
  5240.       return
  5241.     end
  5242.     if Input.trigger?(Input::C)
  5243.       $game_system.se_play($data_system.decision_se)
  5244.       return
  5245.     end
  5246.     if Input.trigger?(Input::L)
  5247.       $game_system.se_play($data_system.decision_se)
  5248.       loop_end = false
  5249.       while loop_end == false
  5250.         if @visible_index != 0
  5251.           @visible_index -= 1
  5252.         else
  5253.           @visible_index = @main_window.data.size - 1
  5254.         end
  5255.         loop_end = true if @main_window.show?(@main_window.data[@visible_index])
  5256.       end
  5257.       id = @main_window.data[@visible_index]
  5258.       @info_window.refresh(id)
  5259.       return
  5260.     end
  5261.     if Input.trigger?(Input::R)
  5262.       $game_system.se_play($data_system.decision_se)
  5263.       loop_end = false
  5264.        while loop_end == false
  5265.         if @visible_index != @main_window.data.size - 1
  5266.           @visible_index += 1
  5267.         else
  5268.           @visible_index = 0
  5269.         end
  5270.         loop_end = true if @main_window.show?(@main_window.data[@visible_index])
  5271.       end
  5272.       id = @main_window.data[@visible_index]
  5273.       @info_window.refresh(id)
  5274.       return
  5275.     end
  5276.   end
  5277.    
  5278.   def update_end
  5279.     if Input.trigger?(Input::B)
  5280.       $game_system.se_play($data_system.cancel_se)
  5281.       @end_window.active = false
  5282.       @end_window.x = -192
  5283.       @command_window.active = true
  5284.       return
  5285.     end
  5286.     if Input.trigger?(Input::C)
  5287.       case @end_window.index
  5288.       when 0
  5289.         command_to_title
  5290.       when 1
  5291.         command_shutdown
  5292.       when 2
  5293.         command_cancel
  5294.       end
  5295.       return
  5296.     end
  5297.   end
  5298.  
  5299.   def command_to_title
  5300.     $game_system.se_play($data_system.decision_se)
  5301.     Audio.bgm_fade(800)
  5302.     Audio.bgs_fade(800)
  5303.     Audio.me_fade(800)
  5304.     $scene = Scene_Title.new
  5305.   end
  5306.  
  5307.   def command_shutdown
  5308.     $game_system.se_play($data_system.decision_se)
  5309.     Audio.bgm_fade(800)
  5310.     Audio.bgs_fade(800)
  5311.     Audio.me_fade(800)
  5312.     $scene = nil
  5313.   end
  5314.  
  5315.   def command_cancel
  5316.     $game_system.se_play($data_system.cancel_se)
  5317.     @end_window.active = false
  5318.     @end_window.x = -192
  5319.     @command_window.active = true
  5320.   end
  5321.  
  5322. end
  5323.  
  5324. #==============================================================================
  5325. # ■ Scene_NewLoad
  5326. #==============================================================================
  5327.  
  5328. class Scene_NewLoad < Scene_File
  5329.  
  5330.   def initialize
  5331.     $game_temp = Game_Temp.new
  5332.     $game_temp.last_file_index = 0
  5333.     latest_time = Time.at(0)
  5334.     for i in 0..3
  5335.       filename = make_filename(i)
  5336.       if FileTest.exist?(filename)
  5337.         file = File.open(filename, "r")
  5338.         if file.mtime > latest_time
  5339.           latest_time = file.mtime
  5340.           $game_temp.last_file_index = i
  5341.         end
  5342.         file.close
  5343.       end
  5344.     end
  5345.     super("Which file do you wish to load from?")
  5346.   end
  5347.  
  5348.   def on_decision(filename)
  5349.     unless FileTest.exist?(filename)
  5350.       $game_system.se_play($data_system.buzzer_se)
  5351.       return
  5352.     end
  5353.     $game_system.se_play($data_system.load_se)
  5354.     file = File.open(filename, "rb")
  5355.     read_save_data(file)
  5356.     file.close
  5357.     $game_system.bgm_play($game_system.playing_bgm)
  5358.     $game_system.bgs_play($game_system.playing_bgs)
  5359.     $game_map.update
  5360.     $scene = Scene_Map.new
  5361.   end
  5362.  
  5363.   def on_cancel
  5364.     $game_system.se_play($data_system.cancel_se)
  5365.     $scene = Scene_Menu.new(9)
  5366.   end
  5367.  
  5368.   def read_save_data(file)
  5369.     characters = Marshal.load(file)
  5370.     Graphics.frame_count = Marshal.load(file)
  5371.     $game_system        = Marshal.load(file)
  5372.     $game_switches      = Marshal.load(file)
  5373.     $game_variables     = Marshal.load(file)
  5374.     $game_self_switches = Marshal.load(file)
  5375.     $game_screen        = Marshal.load(file)
  5376.     $game_actors        = Marshal.load(file)
  5377.     $game_party         = Marshal.load(file)
  5378.     $game_troop         = Marshal.load(file)
  5379.     $game_map           = Marshal.load(file)
  5380.     $game_player        = Marshal.load(file)
  5381.     $game_time           =Marshal.load(file)
  5382.     if $game_system.magic_number != $data_system.magic_number
  5383.       $game_map.setup($game_map.map_id)
  5384.       $game_player.center($game_player.x, $game_player.y)
  5385.     end
  5386.     $game_party.refresh
  5387.   end
  5388.  
  5389. end
Advertisement
Add Comment
Please, Sign In to add comment