IceDragon200

IEO030_AztileMenu

Apr 8th, 2011
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 43.28 KB | None | 0 0
  1. #==============================================================================#
  2. # ** IEO(Icy Engine Omega) - Aztile Menu
  3. #-*--------------------------------------------------------------------------*-#
  4. # ** Author        : IceDragon (http://www.rpgmakervx.net/)
  5. # ** Script-Status : Change (Menu), Add (Party System)
  6. # ** Script Type   : Menu Arrangement, Party System
  7. # ** Date Created  : 03/25/2011
  8. # ** Date Modified : 04/23/2011
  9. # ** Script Tag    : IEO-030(Aztile Menu)
  10. # ** Difficulty    : Easy, Medium, Lunatic
  11. # ** Version       : 1.0a
  12. # ** IEO ID        : 030
  13. #-*--------------------------------------------------------------------------*-#
  14. #==============================================================================#
  15. # ** CREDITS/USED STUFF/EDITING
  16. #-*--------------------------------------------------------------------------*-#
  17. # You may:
  18. # Edit and Adapt this script as long you credit aforementioned author(s).
  19. #
  20. # You may not:
  21. # Claim this as your own work, or redistribute without the consent of the author.
  22. #
  23. #------------------------------------------------------------------------------#
  24. #==============================================================================#
  25. # ** INTRODUCTION
  26. #-*--------------------------------------------------------------------------*-#
  27. # *Crawls in* Never again will I touch Java...
  28. # Anyway, this here script is a small change to the default menu system,
  29. # along with a Integrated Party system (optional)
  30. # So yeah have fuuuuuun.
  31. #------------------------------------------------------------------------------#
  32. #==============================================================================#
  33. # ** INSTRUCTIONS
  34. #-*--------------------------------------------------------------------------*-#
  35. #
  36. # Plug 'n' Play
  37. #
  38. #------------------------------------------------------------------------------#
  39. #==============================================================================#
  40. # ** COMPATABLITIES
  41. #-*--------------------------------------------------------------------------*-#
  42. #
  43. # Breaks a lot of the return_scene methods so beeeee careful..
  44. #
  45. #------------------------------------------------------------------------------#
  46. #==============================================================================#
  47. # ** INSTALLATION
  48. #-*--------------------------------------------------------------------------*-#
  49. # To install this script, open up your script editor and copy/paste this script
  50. # to an open slot below ▼ Materials but above ▼ Main. Remember to save.
  51. #
  52. #-*--------------------------------------------------------------------------*-#
  53. # Below
  54. #   Materials
  55. #  
  56. # Above
  57. #   Main
  58. #   Everything else
  59. #
  60. #------------------------------------------------------------------------------#
  61. #==============================================================================#
  62. # ** CHANGES
  63. #-*--------------------------------------------------------------------------*-#
  64. # * If IPS enabled
  65. # Classes
  66. #   Game_Actor
  67. #     alias-method :setup
  68. #     new-method   :reserve_member?
  69. #   *Game_Party
  70. #     new-method   :battle_members
  71. #     new-method   :all_battle_members
  72. #     new-method   :party_members
  73. #     new-method   :all_members
  74. #     new-method   :battle_party_size
  75. #     new-method   :add_actor
  76. #     new-method   :set_battlers
  77. #     new-method   :change_battler_at
  78. #     new-method   :swap_battler_at
  79. #     new-method   :get_battler_at
  80. #     new-method   :get_empty_index
  81. #     new-method   :battle_members_full?
  82. #     alias-method :remove_actor
  83. #     overwrite    :members
  84. #   Window_MenuStatus
  85. #     super-method :initialize
  86. #     new-method   :change_item_max_mode
  87. #     overwrite    :refresh
  88. #     overwrite    :top_row
  89. #     overwrite    :top_row=
  90. #     overwrite    :page_row_max
  91. #     overwrite    :update_cursor
  92. #   Scene_Title
  93. #     alias-method :create_game_objects
  94. #     new-method   :load_ieo030_objects
  95. #   Scene_Menu
  96. #     new-Cmethod  :hide_command?
  97. #     new-Cmethod  :need_actor_selection?
  98. #     new-Cmethod  :command_index
  99. #     new-method   :menu_command
  100. #     new-method   :before_actor_selection
  101. #     new-method   :start_swap_window
  102. #     new-method   :update_swap_window
  103. #     new-method   :end_swap_window
  104. #     overwrite    :update
  105. #     overwrite    :create_command_window
  106. #     overwrite    :update_command_selection
  107. #     alias-method :start_actor_selection
  108. #     alias-method :update_actor_selection
  109. #   Scene_Item
  110. #   Scene_Skill
  111. #   Scene_Equip
  112. #   Scene_Status
  113. #   Scene_File
  114. #   Scene_End
  115. #     overwrite    :return_scene
  116. #   Scene_Battle
  117. #     overwrite    :display_level_up
  118. #------------------------------------------------------------------------------#
  119. #==============================================================================#
  120. # ** CHANGE LOG
  121. #-*--------------------------------------------------------------------------*-#
  122. # (DD/MM/YYYY)
  123. #  03/25/2011 - V1.0  Started Script
  124. #  04/08/2011 - V1.0  Finished Script
  125. #  04/23/2011 - V1.0a Fixed a EXP bug, regarding reserve members
  126. #
  127. #------------------------------------------------------------------------------#
  128. #==============================================================================#
  129. # ** KNOWN ISSUES
  130. #------------------------------------------------------------------------------#  
  131. #
  132. #  Breaks stuff, lots of stuff with the menu and scene ties.
  133. #
  134. #------------------------------------------------------------------------------#
  135. #==============================================================================#
  136. # $imported - Is mostly used by Japanese RPG Maker XP/VX scripters.
  137. #             This acts as a flag, or signal to show that "x" script is present.
  138. #             This is used for compatability with other future scripts.
  139. $imported = {} if $imported == nil
  140. $imported["IEO-AztileMenu"] = true
  141. #==============================================================================#
  142. # $ieo_script - This is a hash specific to IEO scripts
  143. #               they work just like the $imported, but there key is slightly
  144. #               different, it is an array conatining an integer
  145. #               and a string, since IEO script all have an ID, the value
  146. #               is the scripts version number.
  147. #               A version number of nil, or 0 means the script isn't present
  148. # EG. $ieo_script[[ScriptID, "ScriptName"]]
  149. $ieo_script = {} if $ieo_script == nil
  150. $ieo_script[[30, "AztileMenu"]] = 1.0
  151. #-*--------------------------------------------------------------------------*-#
  152. #==============================================================================#
  153. #==============================================================================#
  154. # IEO::MENU_SYSTEM
  155. #==============================================================================#
  156. module IEO
  157.   module MENU_SYSTEM
  158. #==============================================================================#
  159. #                      Start Primary Customization
  160. #------------------------------------------------------------------------------#
  161. #==============================================================================#    
  162.   #--------------------------------------------------------------------------#
  163.   # * MENU_LAYOUT
  164.   #--------------------------------------------------------------------------#
  165.   # This controls the order in which commands appear in the menu
  166.   # Default commands
  167.   # :item, :skill, :equip, :status, :save, :system (AKA end)
  168.   #--------------------------------------------------------------------------#
  169.     MENU_LAYOUT = [
  170.       :item,    # // Default Item Scene
  171.       :skill,   # // Default Skill Scene
  172.       :equip,   # // Default Equip Scene
  173.       :status,  # // Default Status Scene    
  174.       :swap,    # // Used for IPS
  175.       :save,    # // Default Save Scene
  176.       :system   # // Default End Scene
  177.     ]
  178.   #--------------------------------------------------------------------------#
  179.   # * MS_
  180.   #--------------------------------------------------------------------------#
  181.   # These constants control the MenuStatus window
  182.   # MS_RECT... is the selection size
  183.   #--------------------------------------------------------------------------#    
  184.     MS_YSPACING   = 96 #128 #96
  185.     # // Selection Width
  186.     MS_RECTWIDTH  = 96
  187.     # // Selection Height
  188.     MS_RECTHEIGHT = 96
  189.   #--------------------------------------------------------------------------#
  190.   # * IPS // Intergrated Party System
  191.   #--------------------------------------------------------------------------#
  192.   # Allows you to quickly add and remove actors from the party.
  193.   #--------------------------------------------------------------------------#    
  194.     USE_IPS = true # If this is false REMOVE the :swap command from the MENU_LAYOUT
  195.     # // 0 Normal Sprites, 1 Wide Frame Sprite, 2 Faces
  196.     PARTY_DRAW_STYLE = 2 #2
  197.     # // Maximum members on the active party
  198.     MAX_MEMBERS   = 4
  199.     # // Total members, thats the reserve + the party
  200.     TOTAL_MEMBERS = 8 #5
  201.     # // Should the players be able to remove actors from the party?
  202.     SWITCH_ONLY = true
  203.     # // IPS_WINDOW_SIZE
  204.     IPS_WINX      = 0
  205.     IPS_WINY      = ( Graphics.height - 160 ) / 2
  206.     IPS_WINWIDTH  = Graphics.width
  207.     IPS_WINHEIGHT = 160
  208.     # // This is the in-game variable associated with the EXP rate, so you can
  209.     # // change it during the game
  210.     RESERVE_EXP_VAR  = 4
  211.     RESERVE_EXP_RATE = 60
  212.    
  213. #==============================================================================#
  214. #                        End Primary Customization
  215. #------------------------------------------------------------------------------#
  216. #==============================================================================#      
  217.   end
  218. end
  219.  
  220. #==============================================================================#
  221. # Scene_Menu - IEO030-Lunatic
  222. #==============================================================================#
  223. class Scene_Menu < Scene_Base
  224.  
  225.   #--------------------------------------------------------------------------#
  226.   # * new method :menu_command
  227.   #--------------------------------------------------------------------------#  
  228.   def menu_command(command)
  229.     menulay = $game_system.menu_layout
  230.     case command
  231.     when :item
  232.       $scene = Scene_Item.new
  233.     when :skill
  234.       $scene = Scene_Skill.new(@status_window.index)
  235.     when :equip
  236.       $scene = Scene_Equip.new(@status_window.index)
  237.     when :status
  238.       if $imported["IEO-LotusStatus"]
  239.         $scene = Scene_Status.new(@status_window.index, :menu, Scene_Menu.command_index(:status))
  240.       else
  241.         $scene = Scene_Status.new(@status_window.index)
  242.       end
  243.     when :save
  244.       $scene = Scene_File.new(true, false, false)
  245.     when :system
  246.       $scene = Scene_End.new
  247.     # // Party swapping
  248.     when :swap
  249.       start_swap_window()
  250.       @status_window.active = false
  251.     end  
  252.   end
  253.  
  254.   #--------------------------------------------------------------------------#
  255.   # * new class method :hide_command?
  256.   #--------------------------------------------------------------------------#  
  257.   def self.hide_command?(com)
  258.     case com
  259.     when :item   ; return $game_party.members.size == 0
  260.     when :skill  ; return $game_party.members.size == 0
  261.     when :equip  ; return $game_party.members.size == 0
  262.     when :status ; return $game_party.members.size == 0
  263.     when :save   ; return $game_system.save_disabled
  264.     when :system ; return false
  265.     # // Party swapping  
  266.     when :swap   ; return $game_party.all_members.size <= IEO::MENU_SYSTEM::MAX_MEMBERS
  267.      
  268.     end
  269.     return false
  270.   end
  271.  
  272.   #--------------------------------------------------------------------------#
  273.   # * new class method :need_actor_selection?
  274.   #--------------------------------------------------------------------------#
  275.   def self.need_actor_selection?(com)
  276.     case com
  277.     when :item   ; return false
  278.     when :skill  ; return true
  279.     when :equip  ; return true
  280.     when :status ; return true
  281.     when :save   ; return false
  282.     when :system ; return false
  283.     # // Party swapping  
  284.     when :swap   ; return true
  285.     end
  286.     return false
  287.   end
  288.  
  289.   #--------------------------------------------------------------------------#
  290.   # * new class method :command_index
  291.   #--------------------------------------------------------------------------#  
  292.   def self.command_index(com)
  293.     return $game_system.menu_layout.index(com)
  294.   end
  295.  
  296.   #--------------------------------------------------------------------------#
  297.   # * new method :before_actor_selection
  298.   #--------------------------------------------------------------------------#  
  299.   def before_actor_selection(lastcommand = :nil)
  300.     case lastcommand
  301.     when :swap
  302.       @status_window.change_item_max_mode(:party_select)
  303.     else  
  304.       @status_window.change_item_max_mode(:normal)
  305.     end  
  306.   end  
  307.  
  308.   #--------------------------------------------------------------------------#
  309.   # * new method :start_swap_window
  310.   #--------------------------------------------------------------------------#
  311.   def start_swap_window
  312.     @partyswap_window = Window_MenuPartySwap.new(0, 0)
  313.     @partyswap_window.x = (Graphics.width - @partyswap_window.width) / 2
  314.     @partyswap_window.y = (Graphics.height - @partyswap_window.height) / 2
  315.     @partyswap_window.active = true
  316.   end
  317.  
  318.   #--------------------------------------------------------------------------#
  319.   # * overwrite method :update
  320.   #--------------------------------------------------------------------------#
  321.   def update
  322.     super
  323.     update_menu_background
  324.     @command_window.update
  325.     @gold_window.update
  326.     @status_window.update
  327.     if @command_window.active
  328.       update_command_selection
  329.     elsif @status_window.active
  330.       update_actor_selection
  331.     else
  332.       update_swap_window unless @partyswap_window.nil?
  333.     end
  334.   end
  335.  
  336.   #--------------------------------------------------------------------------#
  337.   # * new method :update_swap_window
  338.   #--------------------------------------------------------------------------#  
  339.   def update_swap_window
  340.     unless @partyswap_window.nil?
  341.       @partyswap_window.update
  342.       sindex = @status_window.index
  343.       raid = @partyswap_window.current_actor
  344.       raid = raid.nil? ? nil : raid.id
  345.       if Input.trigger?(Input::C)
  346.         Sound.play_equip
  347.         old = $game_party.swap_battler_at(sindex, raid)
  348.         end_swap_window
  349.         @status_window.active = true
  350.         @status_window.refresh
  351.       elsif Input.trigger?(Input::B)
  352.         Sound.play_cancel
  353.         end_swap_window
  354.         @status_window.active = true
  355.         @status_window.refresh
  356.       end  
  357.     end  
  358.   end
  359.  
  360.   #--------------------------------------------------------------------------#
  361.   # * new method :end_swap_window
  362.   #--------------------------------------------------------------------------#  
  363.   def end_swap_window
  364.     @partyswap_window.dispose unless @partyswap_window.nil?
  365.   end
  366.  
  367. end
  368.  
  369. #==============================================================================#
  370. # IEO::Vocab
  371. #==============================================================================#
  372. module IEO
  373.   module Vocab
  374.    
  375.     module_function
  376.  
  377.     def menu(command)
  378.       case command
  379.       when :item    ; return ::Vocab.item
  380.       when :skill   ; return ::Vocab.skill
  381.       when :equip   ; return ::Vocab.equip
  382.       when :status  ; return ::Vocab.status
  383.       when :save    ; return ::Vocab.save
  384.       when :system  ; return ::Vocab.game_end
  385.       # // Party swapping    
  386.       when :swap    ; return "Party"  
  387.       else          ; return ""
  388.       end  
  389.     end
  390.    
  391.   end
  392. end
  393.  
  394. #==============================================================================#
  395. # IEO::Icon
  396. #==============================================================================#
  397. module IEO
  398.   module Icon
  399.     module_function
  400.     def menu(command) ; return 0 end
  401.   end
  402. end
  403.  
  404. #==============================================================================#
  405. # Game_System
  406. #==============================================================================#
  407. class Game_System
  408.  
  409.   #--------------------------------------------------------------------------#
  410.   # * Public Instance Variables
  411.   #--------------------------------------------------------------------------#  
  412.   attr_accessor :menu_layout
  413.   attr_accessor :ips_windowsize
  414.   attr_accessor :party_draw_style
  415.   attr_accessor :reserve_exprate_var
  416.  
  417.   #--------------------------------------------------------------------------#
  418.   # * alias method :initialize
  419.   #--------------------------------------------------------------------------#  
  420.   alias :ieo030_gs_initialize :initialize unless $@
  421.   def initialize()
  422.     ieo030_gs_initialize()
  423.     a = IEO::MENU_SYSTEM
  424.     @menu_layout = a::MENU_LAYOUT.clone
  425.     @ips_windowsize = Rect.new(a::IPS_WINX, a::IPS_WINY, a::IPS_WINWIDTH, a::IPS_WINHEIGHT)
  426.     @party_draw_style = a::PARTY_DRAW_STYLE
  427.     @reserve_exprate_var = a::RESERVE_EXP_VAR
  428.   end
  429.  
  430. end  
  431.  
  432. #==============================================================================#
  433. # Game_Actor
  434. #==============================================================================#
  435. class Game_Actor < Game_Battler
  436.  
  437.   #--------------------------------------------------------------------------#
  438.   # * Public Instance Variables
  439.   #--------------------------------------------------------------------------#  
  440.   attr_accessor :party_lock
  441.  
  442.   #--------------------------------------------------------------------------#
  443.   # * alias method :setup
  444.   #--------------------------------------------------------------------------#
  445.   alias ieo030_setup setup unless $@
  446.   def setup(actor_id)
  447.       @party_lock = false
  448.     ieo030_setup(actor_id)
  449.   end
  450.  
  451.   #--------------------------------------------------------------------------#
  452.   # * new method :reserve_member?
  453.   #--------------------------------------------------------------------------#  
  454.   def reserve_member?
  455.     return ($game_party.all_members - $game_party.battle_members).include?(self)
  456.   end
  457.  
  458. end # Game_Actor
  459.  
  460. if IEO::MENU_SYSTEM::USE_IPS
  461. #==============================================================================#
  462. # Game_Party
  463. #==============================================================================#
  464. class Game_Party < Game_Unit
  465.  
  466.   #--------------------------------------------------------------------------#
  467.   # * Constants
  468.   #--------------------------------------------------------------------------#
  469.   TOTAL_MEMBERS = IEO::MENU_SYSTEM::TOTAL_MEMBERS
  470.   MAX_MEMBERS   = IEO::MENU_SYSTEM::MAX_MEMBERS
  471.  
  472.   #--------------------------------------------------------------------------#
  473.   # * Public Instance Variables
  474.   #--------------------------------------------------------------------------#  
  475.   attr_accessor :actors
  476.   attr_accessor :battlers
  477.  
  478.   #--------------------------------------------------------------------------#
  479.   # * overwrite method :members
  480.   #--------------------------------------------------------------------------#
  481.   def members ; return battle_members end
  482.    
  483.   #--------------------------------------------------------------------------#
  484.   # * new method :battle_members
  485.   #--------------------------------------------------------------------------#
  486.   def battle_members
  487.       if @battlers == nil
  488.         @battlers = Array.new(MAX_MEMBERS).map! { |ele| ele = nil}
  489.         for i in 0..([@actors.size, MAX_MEMBERS].min - 1)
  490.             @battlers[i] = @actors[i]
  491.         end
  492.     end  
  493.       result = []
  494.     @battlers.compact!
  495.       for id in @battlers
  496.         result.push($game_actors[id]) unless $game_actors[id] == nil
  497.       end
  498.       return result
  499.   end
  500.  
  501.   #--------------------------------------------------------------------------#
  502.   # * new method :all_battle_members
  503.   #--------------------------------------------------------------------------#  
  504.   def all_battle_members
  505.     battle_members if @battlers == nil
  506.     result = []
  507.     for id in @battlers
  508.       result.push($game_actors[id])
  509.     end  
  510.     return result
  511.   end  
  512.  
  513.   #--------------------------------------------------------------------------#
  514.   # * new method :party_members
  515.   #--------------------------------------------------------------------------#
  516.   def party_members
  517.     result = []
  518.     for member in battle_members
  519.       result.push(member)
  520.     end
  521.     for member in all_members
  522.       result.push(member) unless result.include?(member)
  523.       end
  524.       return result
  525.   end
  526.  
  527.   #--------------------------------------------------------------------------#
  528.   # * new method :all_members
  529.   #--------------------------------------------------------------------------#
  530.   def all_members
  531.     result = []
  532.     @actors.each { |aid| result << $game_actors[aid] if aid > 0}
  533.     return result
  534.   end
  535.  
  536.   #--------------------------------------------------------------------------#
  537.   # * new method :battle_party_size
  538.   #--------------------------------------------------------------------------#  
  539.   def battle_party_size ; return MAX_MEMBERS end
  540.    
  541.   #--------------------------------------------------------------------------#
  542.   # * overwrite method :add_actor
  543.   #--------------------------------------------------------------------------#  
  544.   def add_actor(actor_id)
  545.     last_size = @actors.size
  546.       if @actors.size < TOTAL_MEMBERS and !@actors.include?(actor_id)
  547.         @actors.push(actor_id)
  548.         $game_player.refresh
  549.       end
  550.     if last_size < @actors.size
  551.         battle_members if @battlers == nil
  552.         for i in 0..(@battlers.size-1)
  553.             if @battlers[i] == nil
  554.               @battlers[i] = actor_id unless battle_members.size == battle_party_size
  555.               break
  556.             end
  557.         end
  558.       end
  559.   end
  560.  
  561.   #--------------------------------------------------------------------------#
  562.   # * new method :set_battlers
  563.   #--------------------------------------------------------------------------#
  564.   def set_battlers(*args)
  565.     battle_members if @battlers == nil
  566.     old_bats = @battlers.clone
  567.     @battlers.clear
  568.     bats = *args
  569.     for i in 0...battle_party_size
  570.       bat = old_bats[i]
  571.       @battlers[i] = nil
  572.       @battlers[i] = old_bats[bat] if @actors.include?(bat)
  573.     end  
  574.     $game_player.refresh
  575.   end
  576.  
  577.   #--------------------------------------------------------------------------#
  578.   # * new method :change_battler_at
  579.   #--------------------------------------------------------------------------#  
  580.   def change_battler_at(index, aid)
  581.     battle_members if @battlers == nil
  582.     @battlers[index] = aid
  583.   end  
  584.  
  585.   #--------------------------------------------------------------------------#
  586.   # * new method :swap_battler_at
  587.   #--------------------------------------------------------------------------#  
  588.   def swap_battler_at(index, aid)
  589.     battle_members if @battlers == nil
  590.     oldbat = @battlers[index] ; @battlers[index] = aid
  591.     return oldbat
  592.   end
  593.  
  594.   #--------------------------------------------------------------------------#
  595.   # * new method :get_battler_at
  596.   #--------------------------------------------------------------------------#  
  597.   def get_battler_at(index)
  598.     battle_members if @battlers == nil
  599.     return @battlers[index]
  600.   end
  601.  
  602.   #--------------------------------------------------------------------------#
  603.   # * new method :get_empty_index
  604.   #--------------------------------------------------------------------------#  
  605.   def get_empty_index
  606.     for i in 0...battle_party_size
  607.       return i if @battlers[i] == nil
  608.     end  
  609.     return nil
  610.   end  
  611.    
  612.   #--------------------------------------------------------------------------#
  613.   # * alias method :remove_actor
  614.   #--------------------------------------------------------------------------#
  615.   alias ieo030_remove_actor remove_actor unless $@
  616.   def remove_actor(actor_id)
  617.     battle_members if @battlers == nil
  618.     @battlers[@battlers.index(actor_id)] = nil if @battlers.include?(actor_id)
  619.     ieo030_remove_actor(actor_id)
  620.   end
  621.  
  622.   #--------------------------------------------------------------------------#
  623.   # * new method :battle_members_full?
  624.   #--------------------------------------------------------------------------#  
  625.   def battle_members_full?
  626.     return battle_members.compact.size >= battle_party_size
  627.   end
  628.  
  629. end
  630.  
  631. end
  632.  
  633. #==============================================================================#
  634. # Window_MenuStatus
  635. #==============================================================================#
  636. class Window_MenuStatus < Window_Selectable
  637.  
  638.   #--------------------------------------------------------------------------#
  639.   # * super method :initialize
  640.   #--------------------------------------------------------------------------#
  641.   def initialize(x, y)
  642.     super(x, y, 384, 416)
  643.     @y_spacing   = IEO::MENU_SYSTEM::MS_YSPACING
  644.     @rect_width  = IEO::MENU_SYSTEM::MS_RECTWIDTH
  645.     @rect_height = IEO::MENU_SYSTEM::MS_RECTHEIGHT
  646.     @last_itemmax_mode = :normal
  647.     refresh
  648.     self.active = false
  649.     self.index = -1
  650.   end
  651.  
  652.   #--------------------------------------------------------------------------#
  653.   # * new method :change_item_max_mode
  654.   #--------------------------------------------------------------------------#  
  655.   def change_item_max_mode(mode)
  656.     case mode
  657.     when :normal
  658.       @item_max = $game_party.members.size
  659.     when :party_select
  660.       @item_max = Game_Party::MAX_MEMBERS
  661.     end  
  662.     @last_itemmax_mode = mode
  663.   end
  664.  
  665.   #--------------------------------------------------------------------------#
  666.   # * overwrite method :refresh
  667.   #--------------------------------------------------------------------------#
  668.   def refresh
  669.     self.contents.clear
  670.     change_item_max_mode(@last_itemmax_mode)
  671.     for actor in $game_party.members
  672.       self.contents.font.size = Font.default_size
  673.       draw_actor_face(actor, 2, actor.index * @y_spacing + 2, 92)
  674.       x = 104
  675.       y = actor.index * @y_spacing + WLH / 2
  676.       draw_actor_name(actor, x, y)
  677.       draw_actor_class(actor, x + 120, y)
  678.       draw_actor_level(actor, x, y + WLH * 1)
  679.       draw_actor_state(actor, x, y + WLH * 2)
  680.       draw_actor_hp(actor, x + 120, y + WLH * 1)
  681.       draw_actor_mp(actor, x + 120, y + WLH * 2)
  682.       if $imported["IEO-SkillLevelSystem"]
  683.         rect = Rect.new(x+24, y, 96, 24)
  684.         draw_actor_skl_p(actor, rect)
  685.       end
  686.     end
  687.   end
  688.  
  689.   #--------------------------------------------------------------------------#
  690.   # * overwrite method :top_row
  691.   #--------------------------------------------------------------------------#
  692.   def top_row
  693.     return self.oy / @y_spacing
  694.   end
  695.   #--------------------------------------------------------------------------#
  696.   # * overwrite method :top_row=
  697.   #--------------------------------------------------------------------------#
  698.   def top_row=(row)
  699.     row = 0 if row < 0
  700.     row = row_max - 1 if row > row_max - 1
  701.     self.oy = row * @y_spacing
  702.   end
  703.  
  704.   #--------------------------------------------------------------------------#
  705.   # * overwrite method :page_row_max
  706.   #--------------------------------------------------------------------------#
  707.   def page_row_max
  708.     return (self.height - 32) / @y_spacing
  709.   end
  710.  
  711.   #--------------------------------------------------------------------------#
  712.   # * overwrite method :update_cursor
  713.   #--------------------------------------------------------------------------#
  714.   def update_cursor
  715.     if @index < 0               # No cursor
  716.       self.cursor_rect.empty
  717.     elsif @index < @item_max    # Normal
  718.       self.cursor_rect.set(0, @index * @y_spacing, @rect_width, @rect_height)
  719.     elsif @index >= 100         # Self
  720.       self.cursor_rect.set(0, (@index - 100) * @y_spacing, @rect_width, @rect_height)
  721.     else                        # All
  722.       self.cursor_rect.set(0, 0, contents.width, self.height-32)
  723.     end
  724.   end
  725.  
  726. end
  727.  
  728. #==============================================================================#
  729. # Window_MenuCommand
  730. #==============================================================================#
  731. class Window_MenuCommand < Window_Command
  732.  
  733.   #--------------------------------------------------------------------------#
  734.   # * new method :get_current_command
  735.   #--------------------------------------------------------------------------#    
  736.   def get_current_command ; return @commands[self.index] end
  737.    
  738.   #--------------------------------------------------------------------------#
  739.   # * overwrite method :refresh
  740.   #--------------------------------------------------------------------------#  
  741.   def refresh
  742.     self.contents.clear
  743.     for i in 0...@item_max
  744.       draw_item( i, !Scene_Menu.hide_command?(@commands[i]) )
  745.     end
  746.   end
  747.  
  748.   #--------------------------------------------------------------------------#
  749.   # * overwrite method :item_rect
  750.   #--------------------------------------------------------------------------#
  751.   def item_rect( index, adapt=true )
  752.     rect = Rect.new( 0, 0, 0, 0 )
  753.     rect.width = ( contents.width + @spacing ) / @column_max - @spacing
  754.     rect.height = WLH
  755.     rect.x = index % @column_max * ( rect.width + @spacing )
  756.     rect.y = index / @column_max * WLH
  757.     if $imported["IEO-BugFixesUpgrades"]
  758.       if IEO::UPGRADE::ADAPTIVE_CURSOR    
  759.         if adapt
  760.           tx = IEO::Vocab.menu( @commands[index] )
  761.           rect.width = self.contents.text_size( tx ).width+12
  762.           icon = IEO::Icon.menu( @commands[index] )
  763.           rect.width += 24 if icon > 0
  764.         end  
  765.       end
  766.     end  
  767.     return rect
  768.   end
  769.  
  770.   #--------------------------------------------------------------------------#
  771.   # * overwrite method :draw_item
  772.   #--------------------------------------------------------------------------#  
  773.   def draw_item( index, enabled = true )
  774.     self.contents.font.size = Font.default_size
  775.     rect = item_rect( index, false )
  776.     rect.x += 4
  777.     rect.width -= 8
  778.     self.contents.clear_rect( rect )
  779.     self.contents.font.color = normal_color
  780.     self.contents.font.color.alpha = enabled ? 255 : 128
  781.     icon = IEO::Icon.menu( @commands[index] )
  782.     if icon > 0
  783.       draw_icon( icon, rect.x, rect.y )
  784.       rect.x += 24 ; rect.width -= 24
  785.     end  
  786.     self.contents.draw_text( rect, IEO::Vocab.menu( @commands[index] ) )
  787.   end
  788.  
  789. end  
  790.  
  791. #==============================================================================#
  792. # Window_MenuPartySwap
  793. #==============================================================================#
  794. class Window_MenuPartySwap < Window_Selectable
  795.  
  796.   #--------------------------------------------------------------------------#
  797.   # * Constants
  798.   #--------------------------------------------------------------------------#  
  799.   HEIGHT_PUSH = 72
  800.  
  801.   #--------------------------------------------------------------------------#
  802.   # * super method :initialize
  803.   #--------------------------------------------------------------------------#
  804.   def initialize(px, py)
  805.     @character_rect = Rect.new(0, 0, 32, 32)
  806.     @draw_style = $game_system.party_draw_style
  807.     @widthadd = 32
  808.     @heightadd= 32
  809.     @widthadd = 64 if [1, 2].include?(@draw_style)
  810.     @height_push = HEIGHT_PUSH
  811.     @height_push += 46 if [2].include?(@draw_style)
  812.     #tt = Game_Party::TOTAL_MEMBERS - (Game_Party::MAX_MEMBERS-1)
  813.     #(@character_rect.width+@widthadd) * tt, @height_push+@heightadd
  814.     px, py, pw, ph = $game_system.ips_windowsize.x, $game_system.ips_windowsize.y,
  815.                      $game_system.ips_windowsize.width, $game_system.ips_windowsize.height
  816.       super(px, py, pw, ph)
  817.     @actors = $game_party.battle_members
  818.     @item_max = $game_party.battle_party_size
  819.     self.index = 0
  820.     @smindex = nil
  821.     refresh if init_refresh?
  822.   end
  823.  
  824.   #--------------------------------------------------------------------------#
  825.   # * new method :init_refresh?
  826.   #--------------------------------------------------------------------------#    
  827.   def init_refresh? ; return true end
  828.   #--------------------------------------------------------------------------#
  829.   # * new method :current_actor
  830.   #--------------------------------------------------------------------------#        
  831.   def current_actor ; return @actors[self.index] end
  832.   #--------------------------------------------------------------------------#
  833.   # * new method :get_actor_at
  834.   #--------------------------------------------------------------------------#  
  835.   def get_actor_at(index) ; return @actors[index] end
  836.    
  837.   #--------------------------------------------------------------------------#
  838.   # * new method :refresh
  839.   #--------------------------------------------------------------------------#      
  840.   def refresh
  841.       self.contents.clear
  842.     @actors = []
  843.       for mem in $game_party.all_members.compact
  844.       @actors.push(mem) unless $game_party.battle_members.include?(mem)
  845.     end
  846.     @actors.push(nil) unless IEO::MENU_SYSTEM::SWITCH_ONLY
  847.       @item_max = @actors.size
  848.     @column_max = [1, @item_max].max
  849.     create_contents
  850.       for i in 0...@item_max
  851.         draw_item(i)
  852.       end
  853.   end  
  854.  
  855.   #--------------------------------------------------------------------------#
  856.   # * new method :draw_item
  857.   #--------------------------------------------------------------------------#  
  858.   def draw_item(index)
  859.     rect = item_rect(index)
  860.     self.contents.clear_rect(rect)
  861.       actor = @actors[index]
  862.     unless actor.nil?
  863.         aname  = actor.name
  864.         aclass = actor.class.name
  865.         alevel = actor.level
  866.       ash = (rect.height-@character_rect.height)/2
  867.         locked = actor.party_lock
  868.       ch = @character_rect.height
  869.       if [0, 1].include?(@draw_style)
  870.         draw_actor_graphic(actor, rect.x+16, rect.y+@character_rect.height+ash+4, !locked)
  871.           self.contents.font.color.alpha = locked ? 128 : 255
  872.           self.contents.font.size = 12
  873.           self.contents.draw_text(rect.x+3,rect.y - 4,rect.width,24,aname)
  874.           self.contents.draw_text(rect.x,rect.y+18,rect.width-2,24,"Lv.",2)
  875.           self.contents.draw_text(rect.x,rect.y+28,rect.width-2,24,alevel,2)
  876.           self.contents.draw_text(rect.x,rect.y+17+ch,rect.width-3,24,aclass,2)
  877.       elsif [2].include?(@draw_style)  
  878.         draw_actor_face(actor, rect.x, rect.y)
  879.         self.contents.font.color.alpha = locked ? 128 : 255
  880.           self.contents.font.size = 18
  881.         self.contents.draw_text(rect.x,rect.y+96-20,rect.width-2,24,"Lv.",0)
  882.           self.contents.draw_text(rect.x+24,rect.y+96-20,rect.width-2,24,alevel,0)
  883.         self.contents.draw_text(rect.x, rect.y+96, rect.width, 24, aname, 1)
  884.       end  
  885.       end
  886.   end
  887.  
  888.   #--------------------------------------------------------------------------#
  889.   # * overwrite method :item_rect
  890.   #--------------------------------------------------------------------------#
  891.   def item_rect(index)
  892.     rect = Rect.new(0, 0, 0, 0)
  893.     rect.width = @character_rect.width + @widthadd
  894.     rect.height = @character_rect.height + (@height_push-@heightadd)
  895.     rect.x = index * (rect.width + 10)
  896.     rect.y = 0
  897.     return rect
  898.   end
  899.  
  900.   #--------------------------------------------------------------------------#
  901.   # * overwrite method :draw_actor_graphic
  902.   #--------------------------------------------------------------------------#
  903.   def draw_actor_graphic(actor, x, y, enabled=true)
  904.     draw_character(actor.character_name, actor.character_index, x, y, enabled)
  905.   end
  906.  
  907.   #--------------------------------------------------------------------------#
  908.   # * overwrite method :draw_character
  909.   #--------------------------------------------------------------------------#
  910.   def draw_character(character_name, character_index, x, y, enabled=true)
  911.     return if character_name == nil
  912.     bitmap = Cache.character(character_name)
  913.     sign = character_name[/^[\!\$]./]
  914.     if sign != nil and sign.include?('$')
  915.       cw = bitmap.width / 3
  916.       ch = bitmap.height / 4
  917.     else
  918.       cw = bitmap.width / 12
  919.       ch = bitmap.height / 8
  920.     end
  921.     n = character_index
  922.     src_rect = Rect.new((n%4*3+1)*cw, (n/4*4)*ch, cw, ch)
  923.     self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect, enabled ? 255 : 128)
  924.   end
  925.  
  926. end  
  927.  
  928. #==============================================================================#
  929. # Scene_Title
  930. #==============================================================================#
  931. class Scene_Title < Scene_Base
  932.  
  933.   #--------------------------------------------------------------------------#
  934.   # alias method :create_game_object
  935.   #--------------------------------------------------------------------------#
  936.   alias ieo030_create_game_objects create_game_objects unless $@
  937.   def create_game_objects
  938.     ieo030_create_game_objects
  939.     load_ieo030_objects
  940.   end
  941.  
  942.   #--------------------------------------------------------------------------#
  943.   # new method :load_ieo030_object
  944.   #--------------------------------------------------------------------------#
  945.   def load_ieo030_objects
  946.     $game_variables[$game_system.reserve_exprate_var] = IEO::MENU_SYSTEM::RESERVE_EXP_RATE
  947.   end
  948.  
  949. end  
  950.  
  951. #==============================================================================#
  952. # Scene_Menu
  953. #==============================================================================#
  954. class Scene_Menu < Scene_Base
  955.    
  956.   #--------------------------------------------------------------------------#
  957.   # * overwrite method :create_command_window
  958.   #--------------------------------------------------------------------------#
  959.   def create_command_window()
  960.     coms = $game_system.menu_layout
  961.     @command_window = Window_MenuCommand.new( 160, coms )
  962.     @command_window.index = @menu_index
  963.   end
  964.  
  965.   #--------------------------------------------------------------------------#
  966.   # * new method :return_scene
  967.   #--------------------------------------------------------------------------#
  968.   def return_scene()
  969.     $scene = Scene_Map.new()
  970.   end
  971.  
  972.   #--------------------------------------------------------------------------#
  973.   # * overwrite method :update_command_selection
  974.   #--------------------------------------------------------------------------#
  975.   def update_command_selection()
  976.     if Input.trigger?( Input::B )
  977.       Sound.play_cancel
  978.       return_scene()
  979.     elsif Input.trigger?( Input::C )
  980.       com = @command_window.get_current_command
  981.       if com == nil
  982.         Sound.play_buzzer
  983.         return
  984.       end
  985.       if Scene_Menu.hide_command?( com )
  986.         Sound.play_buzzer
  987.         return
  988.       end
  989.       Sound.play_decision()
  990.       if Scene_Menu.need_actor_selection?( com )
  991.         before_actor_selection( com )
  992.         start_actor_selection()
  993.       else
  994.         menu_command( com )  
  995.       end
  996.     end
  997.   end
  998.  
  999.   #--------------------------------------------------------------------------#
  1000.   # * alias method :update_actor_selection
  1001.   #--------------------------------------------------------------------------#  
  1002.   alias ieo030_start_actor_selection start_actor_selection unless $@
  1003.   def start_actor_selection()
  1004.     ieo030_start_actor_selection()
  1005.     imx = @status_window.item_max()
  1006.     @status_window.index = imx if @status_window.index > imx
  1007.   end  
  1008.  
  1009.   #--------------------------------------------------------------------------#
  1010.   # * overwrite method :update_actor_selection
  1011.   #--------------------------------------------------------------------------#
  1012.   def update_actor_selection()
  1013.     if Input.trigger?( Input::B )
  1014.       Sound.play_cancel
  1015.       end_actor_selection
  1016.     elsif Input.trigger?( Input::C )
  1017.       $game_party.last_actor_index = @status_window.index
  1018.       com = @command_window.get_current_command()
  1019.       Sound.play_decision
  1020.       menu_command( com )
  1021.     end
  1022.   end
  1023.  
  1024. end
  1025.  
  1026. #==============================================================================#
  1027. # Scene_Item
  1028. #==============================================================================#
  1029. class Scene_Item < Scene_Base
  1030.   #--------------------------------------------------------------------------#
  1031.   # * overwrite method :return_scene
  1032.   #--------------------------------------------------------------------------#
  1033.   def return_scene
  1034.     $scene = Scene_Menu.new( Scene_Menu.command_index(:item) )
  1035.   end
  1036. end  
  1037.  
  1038. #==============================================================================#
  1039. # Scene_Skill
  1040. #==============================================================================#
  1041. class Scene_Skill < Scene_Base
  1042.   #--------------------------------------------------------------------------#
  1043.   # * overwrite method :return_scene
  1044.   #--------------------------------------------------------------------------#
  1045.   def return_scene
  1046.     $scene = Scene_Menu.new( Scene_Menu.command_index(:skill) )
  1047.   end
  1048. end
  1049.  
  1050. #==============================================================================#
  1051. # Scene_Equip
  1052. #==============================================================================#
  1053. class Scene_Equip < Scene_Base
  1054.   #--------------------------------------------------------------------------#
  1055.   # * overwrite method :return_scene
  1056.   #--------------------------------------------------------------------------#
  1057.   def return_scene
  1058.     $scene = Scene_Menu.new( Scene_Menu.command_index(:equip) )
  1059.   end
  1060. end
  1061.  
  1062. #==============================================================================#
  1063. # Scene_Status
  1064. #==============================================================================#
  1065. class Scene_Status < Scene_Base
  1066.   #--------------------------------------------------------------------------#
  1067.   # * overwrite method :return_scene
  1068.   #--------------------------------------------------------------------------#
  1069.   def return_scene
  1070.     $scene = Scene_Menu.new( Scene_Menu.command_index(:status) )
  1071.   end
  1072. end  
  1073.  
  1074. #==============================================================================#
  1075. # Scene_File
  1076. #==============================================================================#
  1077. class Scene_File < Scene_Base
  1078.   #--------------------------------------------------------------------------#
  1079.   # * overwrite method :return_scene
  1080.   #--------------------------------------------------------------------------#
  1081.   def return_scene
  1082.     if @from_title
  1083.       $scene = Scene_Title.new
  1084.     elsif @from_event
  1085.       $scene = Scene_Map.new
  1086.     else
  1087.       $scene = Scene_Menu.new( Scene_Menu.command_index(:save) )
  1088.     end
  1089.   end
  1090. end  
  1091.  
  1092. #==============================================================================#
  1093. # Scene_End
  1094. #==============================================================================#
  1095. class Scene_End < Scene_Base
  1096.   #--------------------------------------------------------------------------#
  1097.   # * overwrite method :return_scene
  1098.   #--------------------------------------------------------------------------#
  1099.   def return_scene
  1100.     $scene = Scene_Menu.new( Scene_Menu.command_index(:system) )
  1101.   end
  1102. end
  1103.  
  1104. #==============================================================================#
  1105. # Scene_Battle
  1106. #==============================================================================#
  1107. class Scene_Battle < Scene_Base
  1108.  
  1109.   #--------------------------------------------------------------------------#
  1110.   # * overwrite method :display_level_up
  1111.   #--------------------------------------------------------------------------#
  1112.   def display_level_up
  1113.     exp = $game_troop.exp_total
  1114.     mems = $game_party.members
  1115.     mems = $game_party.all_members
  1116.     for actor in mems
  1117.       next if actor.dead?
  1118.       last_level = actor.level   ; last_skills = actor.skills
  1119.       nexp = exp
  1120.       nexp = exp.to_f * $game_variables[$game_system.reserve_exprate_var] / 100.0 if actor.reserve_member?
  1121.       actor.gain_exp( Integer(nexp), true )
  1122.     end
  1123.     wait_for_message
  1124.   end
  1125.  
  1126. end
  1127.  
  1128. #=*==========================================================================*=#
  1129. # ** END OF FILE
  1130. #=*==========================================================================*=#
Advertisement
Add Comment
Please, Sign In to add comment