IceDragon200

IEO-030(Aztile Menu)

Apr 22nd, 2011
205
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 42.74 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. #
  126. #------------------------------------------------------------------------------#
  127. #==============================================================================#
  128. # ** KNOWN ISSUES
  129. #------------------------------------------------------------------------------#  
  130. #
  131. #  Breaks stuff, lots of stuff with the menu and scene ties.
  132. #
  133. #------------------------------------------------------------------------------#
  134. #==============================================================================#
  135. # ** FAQ
  136. #-*--------------------------------------------------------------------------*-#  
  137. # Acronyms -
  138. #  BEM - Battle Engine Melody
  139. #  CBS - Custom Battle System
  140. #  DBS - Default Battle System
  141. #  GTBS- Gubid's Tactical Battle System
  142. #  IEO - Icy Engine Omega
  143. #  IEX - Icy Engine Xellion
  144. #  OHM - IEO-005(Ohmerion)
  145. #  SRN - IEX - Siren
  146. #  YGG - IEX - Yggdrasil
  147. #  ATB - Active Turn Battle
  148. #  DTB - Default Turn Battle
  149. #  PTB - Press Turn Battle
  150. #  CTB - Charge Turn Battle
  151. #
  152. # Q. Whats up with the IDs?
  153. # A. Well due to some naming issues, I ended up with 5 scripts in IEX
  154. #    all having similar names, this causes some issues for updating
  155. #    and sorting.
  156. #    I have decided to add some IDS so I can sort and find script with EASE.
  157. #
  158. # Q. Where is the name from?
  159. # A. Roman Alphabet, thanks to PentagonBuddy and Jalen by the way.
  160. #
  161. # Q. Where did you learn scripting?
  162. # A. Yanfly's scripts, read almost everyone of them, so my scripting style
  163. #    kinda looks like his.
  164. #
  165. #-*--------------------------------------------------------------------------*-#
  166. #==============================================================================#
  167. # $imported - Is mostly used by Japanese RPG Maker XP/VX scripters.
  168. #             This acts as a flag, or signal to show that "x" script is present.
  169. #             This is used for compatability with other future scripts.
  170. $imported = {} if $imported == nil
  171. $imported["IEO-AztileMenu"] = true
  172. #==============================================================================#
  173. # $ieo_script - This is a hash specific to IEO scripts
  174. #               they work just like the $imported, but there key is slightly
  175. #               different, it is an array conatining an integer
  176. #               and a string, since IEO script all have an ID, the value
  177. #               is the scripts version number.
  178. #               A version number of nil, or 0 means the script isn't present
  179. # EG. $ieo_script[[ScriptID, "ScriptName"]]
  180. $ieo_script = {} if $ieo_script == nil
  181. $ieo_script[[30, "AztileMenu"]] = 1.0
  182. #-*--------------------------------------------------------------------------*-#
  183. #==============================================================================#
  184. #==============================================================================#
  185. # IEO::MENU_SYSTEM
  186. #==============================================================================#
  187. module IEO
  188.   module MENU_SYSTEM
  189. #==============================================================================#
  190. #                      Start Primary Customization
  191. #------------------------------------------------------------------------------#
  192. #==============================================================================#    
  193.   #--------------------------------------------------------------------------#
  194.   # * MENU_LAYOUT
  195.   #--------------------------------------------------------------------------#
  196.   # This controls the order in which commands appear in the menu
  197.   # Default commands
  198.   # :item, :skill, :equip, :status, :save, :system (AKA end)
  199.   #--------------------------------------------------------------------------#
  200.     MENU_LAYOUT = [
  201.       :item,    # // Default Item Scene
  202.       :skill,   # // Default Skill Scene
  203.       :equip,   # // Default Equip Scene
  204.       :status,  # // Default Status Scene    
  205.       :swap,    # // Used for IPS
  206.       :save,    # // Default Save Scene
  207.       :system   # // Default End Scene
  208.     ]
  209.   #--------------------------------------------------------------------------#
  210.   # * MS_
  211.   #--------------------------------------------------------------------------#
  212.   # These constants control the MenuStatus window
  213.   # MS_RECT... is the selection size
  214.   #--------------------------------------------------------------------------#    
  215.     MS_YSPACING   = 128 #128 #96
  216.     # // Selection Width
  217.     MS_RECTWIDTH  = 96
  218.     # // Selection Height
  219.     MS_RECTHEIGHT = 96
  220.   #--------------------------------------------------------------------------#
  221.   # * IPS // Intergrated Party System
  222.   #--------------------------------------------------------------------------#
  223.   # Allows you to quickly add and remove actors from the party.
  224.   #--------------------------------------------------------------------------#    
  225.     USE_IPS = true # If this is false REMOVE the :swap command from the MENU_LAYOUT
  226.     # // 0 Normal Sprites, 1 Wide Frame Sprite, 2 Faces
  227.     PARTY_DRAW_STYLE = 2 #2
  228.     # // Maximum members on the active party
  229.     MAX_MEMBERS   = 3
  230.     # // Total members, thats the reserve + the party
  231.     TOTAL_MEMBERS = 8 #5
  232.     # // Should the players be able to remove actors from the party?
  233.     SWITCH_ONLY = true
  234.     # // IPS_WINDOW_SIZE
  235.     IPS_WINX      = 0
  236.     IPS_WINY      = ( Graphics.height - 160 ) / 2
  237.     IPS_WINWIDTH  = Graphics.width
  238.     IPS_WINHEIGHT = 160
  239.     # // This is the in-game variable associated with the EXP rate, so you can
  240.     # // change it during the game
  241.     RESERVE_EXP_VAR  = 4
  242.     RESERVE_EXP_RATE = 60
  243.    
  244. #==============================================================================#
  245. #                        End Primary Customization
  246. #------------------------------------------------------------------------------#
  247. #==============================================================================#      
  248.   end
  249. end
  250.  
  251. #==============================================================================#
  252. # Scene_Menu - IEO030-Lunatic
  253. #==============================================================================#
  254. class Scene_Menu < Scene_Base
  255.  
  256.   #--------------------------------------------------------------------------#
  257.   # * new method :menu_command
  258.   #--------------------------------------------------------------------------#  
  259.   def menu_command(command)
  260.     menulay = $game_system.menu_layout
  261.     case command
  262.     when :item
  263.       $scene = Scene_Item.new
  264.     when :skill
  265.       $scene = Scene_Skill.new(@status_window.index)
  266.     when :equip
  267.       $scene = Scene_Equip.new(@status_window.index)
  268.     when :status
  269.       if $imported["IEO-LotusStatus"]
  270.         $scene = Scene_Status.new(@status_window.index, :menu, Scene_Menu.command_index(:status))
  271.       else
  272.         $scene = Scene_Status.new(@status_window.index)
  273.       end
  274.     when :save
  275.       $scene = Scene_File.new(true, false, false)
  276.     when :system
  277.       $scene = Scene_End.new
  278.     # // Party swapping
  279.     when :swap
  280.       start_swap_window
  281.       @status_window.active = false
  282.     end  
  283.   end
  284.  
  285.   #--------------------------------------------------------------------------#
  286.   # * new class method :hide_command?
  287.   #--------------------------------------------------------------------------#  
  288.   def self.hide_command?(com)
  289.     case com
  290.     when :item   ; return $game_party.members.size == 0
  291.     when :skill  ; return $game_party.members.size == 0
  292.     when :equip  ; return $game_party.members.size == 0
  293.     when :status ; return $game_party.members.size == 0
  294.     when :save   ; return $game_system.save_disabled
  295.     when :system ; return false
  296.     # // Party swapping  
  297.     when :swap   ; return $game_party.all_members.size <= IEO::MENU_SYSTEM::MAX_MEMBERS
  298.      
  299.     end
  300.   end
  301.  
  302.   #--------------------------------------------------------------------------#
  303.   # * new class method :need_actor_selection?
  304.   #--------------------------------------------------------------------------#
  305.   def self.need_actor_selection?(com)
  306.     case com
  307.     when :item   ; return false
  308.     when :skill  ; return true
  309.     when :equip  ; return true
  310.     when :status ; return true
  311.     when :save   ; return false
  312.     when :system ; return false
  313.     # // Party swapping  
  314.     when :swap   ; return true
  315.     end
  316.   end
  317.  
  318.   #--------------------------------------------------------------------------#
  319.   # * new class method :command_index
  320.   #--------------------------------------------------------------------------#  
  321.   def self.command_index(com)
  322.     return $game_system.menu_layout.index(com)
  323.   end
  324.  
  325.   #--------------------------------------------------------------------------#
  326.   # * new method :before_actor_selection
  327.   #--------------------------------------------------------------------------#  
  328.   def before_actor_selection(lastcommand = :nil)
  329.     case lastcommand
  330.     when :swap
  331.       @status_window.change_item_max_mode(:party_select)
  332.     else  
  333.       @status_window.change_item_max_mode(:normal)
  334.     end  
  335.   end  
  336.  
  337.   #--------------------------------------------------------------------------#
  338.   # * new method :start_swap_window
  339.   #--------------------------------------------------------------------------#
  340.   def start_swap_window
  341.     @partyswap_window = Window_MenuPartySwap.new(0, 0)
  342.     @partyswap_window.x = (Graphics.width - @partyswap_window.width) / 2
  343.     @partyswap_window.y = (Graphics.height - @partyswap_window.height) / 2
  344.     @partyswap_window.active = true
  345.   end
  346.  
  347.   #--------------------------------------------------------------------------#
  348.   # * overwrite method :update
  349.   #--------------------------------------------------------------------------#
  350.   def update
  351.     super
  352.     update_menu_background
  353.     @command_window.update
  354.     @gold_window.update
  355.     @status_window.update
  356.     if @command_window.active
  357.       update_command_selection
  358.     elsif @status_window.active
  359.       update_actor_selection
  360.     else
  361.       update_swap_window unless @partyswap_window.nil?
  362.     end
  363.   end
  364.  
  365.   #--------------------------------------------------------------------------#
  366.   # * new method :update_swap_window
  367.   #--------------------------------------------------------------------------#  
  368.   def update_swap_window
  369.     unless @partyswap_window.nil?
  370.       @partyswap_window.update
  371.       sindex = @status_window.index
  372.       raid = @partyswap_window.current_actor
  373.       raid = raid.nil? ? nil : raid.id
  374.       if Input.trigger?(Input::C)
  375.         Sound.play_equip
  376.         old = $game_party.swap_battler_at(sindex, raid)
  377.         end_swap_window
  378.         @status_window.active = true
  379.         @status_window.refresh
  380.       elsif Input.trigger?(Input::B)
  381.         Sound.play_cancel
  382.         end_swap_window
  383.         @status_window.active = true
  384.         @status_window.refresh
  385.       end  
  386.     end  
  387.   end
  388.  
  389.   #--------------------------------------------------------------------------#
  390.   # * new method :end_swap_window
  391.   #--------------------------------------------------------------------------#  
  392.   def end_swap_window
  393.     @partyswap_window.dispose unless @partyswap_window.nil?
  394.   end
  395.  
  396. end
  397.  
  398. #==============================================================================#
  399. # IEO::Vocab
  400. #==============================================================================#
  401. module IEO
  402.   module Vocab
  403.    
  404.     module_function
  405.  
  406.     def menu(command)
  407.       case command
  408.       when :item    ; return ::Vocab.item
  409.       when :skill   ; return ::Vocab.skill
  410.       when :equip   ; return ::Vocab.equip
  411.       when :status  ; return ::Vocab.status
  412.       when :save    ; return ::Vocab.save
  413.       when :system  ; return ::Vocab.game_end
  414.       # // Party swapping    
  415.       when :swap    ; return "Party"  
  416.       else          ; return ""
  417.       end  
  418.     end
  419.    
  420.   end
  421. end
  422.  
  423. #==============================================================================#
  424. # IEO::Icon
  425. #==============================================================================#
  426. module IEO
  427.   module Icon
  428.     module_function
  429.     def menu(command) ; return 0 end
  430.   end
  431. end
  432.  
  433. #==============================================================================#
  434. # Game_System
  435. #==============================================================================#
  436. class Game_System
  437.  
  438.   attr_accessor :menu_layout
  439.   attr_accessor :ips_windowsize
  440.   attr_accessor :party_draw_style
  441.   attr_accessor :reserve_exprate_var
  442.  
  443.   alias ieo030_initialize initialize unless $@
  444.   def initialize
  445.     ieo030_initialize
  446.     a = IEO::MENU_SYSTEM
  447.     @menu_layout = a::MENU_LAYOUT.clone
  448.     @ips_windowsize = Rect.new(a::IPS_WINX, a::IPS_WINY, a::IPS_WINWIDTH, a::IPS_WINHEIGHT)
  449.     @party_draw_style = a::PARTY_DRAW_STYLE
  450.     @reserve_exprate_var = a::RESERVE_EXP_VAR
  451.   end
  452.  
  453. end  
  454.  
  455. #==============================================================================#
  456. # Game_Actor
  457. #==============================================================================#
  458. class Game_Actor < Game_Battler
  459.  
  460.   #--------------------------------------------------------------------------#
  461.   # * Public Instance Variables
  462.   #--------------------------------------------------------------------------#  
  463.   attr_accessor :party_lock
  464.  
  465.   #--------------------------------------------------------------------------#
  466.   # * alias method :setup
  467.   #--------------------------------------------------------------------------#
  468.   alias ieo030_setup setup unless $@
  469.   def setup(actor_id)
  470.       @party_lock = false
  471.     ieo030_setup(actor_id)
  472.   end
  473.  
  474.   #--------------------------------------------------------------------------#
  475.   # * new method :reserve_member?
  476.   #--------------------------------------------------------------------------#  
  477.   def reserve_member?
  478.     return ($game_party.all_members - $game_party.battle_members).include?(self)
  479.   end
  480.  
  481. end # Game_Actor
  482.  
  483. if IEO::MENU_SYSTEM::USE_IPS
  484. #==============================================================================#
  485. # Game_Party
  486. #==============================================================================#
  487. class Game_Party < Game_Unit
  488.  
  489.   #--------------------------------------------------------------------------#
  490.   # * Constants
  491.   #--------------------------------------------------------------------------#
  492.   TOTAL_MEMBERS = IEO::MENU_SYSTEM::TOTAL_MEMBERS
  493.   MAX_MEMBERS   = IEO::MENU_SYSTEM::MAX_MEMBERS
  494.  
  495.   #--------------------------------------------------------------------------#
  496.   # * Public Instance Variables
  497.   #--------------------------------------------------------------------------#  
  498.   attr_accessor :actors
  499.   attr_accessor :battlers
  500.  
  501.   #--------------------------------------------------------------------------#
  502.   # * overwrite method :members
  503.   #--------------------------------------------------------------------------#
  504.   def members ; return battle_members end
  505.    
  506.   #--------------------------------------------------------------------------#
  507.   # * new method :battle_members
  508.   #--------------------------------------------------------------------------#
  509.   def battle_members
  510.       if @battlers == nil
  511.         @battlers = Array.new(MAX_MEMBERS).map! { |ele| ele = nil}
  512.         for i in 0..([@actors.size, MAX_MEMBERS].min - 1)
  513.             @battlers[i] = @actors[i]
  514.         end
  515.     end  
  516.       result = []
  517.     @battlers.compact!
  518.       for id in @battlers
  519.         result.push($game_actors[id]) unless $game_actors[id] == nil
  520.       end
  521.       return result
  522.   end
  523.  
  524.   #--------------------------------------------------------------------------#
  525.   # * new method :all_battle_members
  526.   #--------------------------------------------------------------------------#  
  527.   def all_battle_members
  528.     battle_members if @battlers == nil
  529.     result = []
  530.     for id in @battlers
  531.       result.push($game_actors[id])
  532.     end  
  533.     return result
  534.   end  
  535.  
  536.   #--------------------------------------------------------------------------#
  537.   # * new method :party_members
  538.   #--------------------------------------------------------------------------#
  539.   def party_members
  540.     result = []
  541.     for member in battle_members
  542.       result.push(member)
  543.     end
  544.     for member in all_members
  545.       result.push(member) unless result.include?(member)
  546.       end
  547.       return result
  548.   end
  549.  
  550.   #--------------------------------------------------------------------------#
  551.   # * new method :all_members
  552.   #--------------------------------------------------------------------------#
  553.   def all_members
  554.     result = []
  555.     @actors.each { |aid| result << $game_actors[aid] if aid > 0}
  556.     return result
  557.   end
  558.  
  559.   #--------------------------------------------------------------------------#
  560.   # * new method :battle_party_size
  561.   #--------------------------------------------------------------------------#  
  562.   def battle_party_size ; return MAX_MEMBERS end
  563.    
  564.   #--------------------------------------------------------------------------#
  565.   # * overwrite method :add_actor
  566.   #--------------------------------------------------------------------------#  
  567.   def add_actor(actor_id)
  568.     last_size = @actors.size
  569.       if @actors.size < TOTAL_MEMBERS and !@actors.include?(actor_id)
  570.         @actors.push(actor_id)
  571.         $game_player.refresh
  572.       end
  573.     if last_size < @actors.size
  574.         battle_members if @battlers == nil
  575.         for i in 0..(@battlers.size-1)
  576.             if @battlers[i] == nil
  577.               @battlers[i] = actor_id unless battle_members.size == battle_party_size
  578.               break
  579.             end
  580.         end
  581.       end
  582.   end
  583.  
  584.   #--------------------------------------------------------------------------#
  585.   # * new method :set_battlers
  586.   #--------------------------------------------------------------------------#
  587.   def set_battlers(*args)
  588.     battle_members if @battlers == nil
  589.     old_bats = @battlers.clone
  590.     @battlers.clear
  591.     bats = *args
  592.     for i in 0...battle_party_size
  593.       bat = old_bats[i]
  594.       @battlers[i] = nil
  595.       @battlers[i] = old_bats[bat] if @actors.include?(bat)
  596.     end  
  597.     $game_player.refresh
  598.   end
  599.  
  600.   #--------------------------------------------------------------------------#
  601.   # * new method :change_battler_at
  602.   #--------------------------------------------------------------------------#  
  603.   def change_battler_at(index, aid)
  604.     battle_members if @battlers == nil
  605.     @battlers[index] = aid
  606.   end  
  607.  
  608.   #--------------------------------------------------------------------------#
  609.   # * new method :swap_battler_at
  610.   #--------------------------------------------------------------------------#  
  611.   def swap_battler_at(index, aid)
  612.     battle_members if @battlers == nil
  613.     oldbat = @battlers[index] ; @battlers[index] = aid
  614.     return oldbat
  615.   end
  616.  
  617.   #--------------------------------------------------------------------------#
  618.   # * new method :get_battler_at
  619.   #--------------------------------------------------------------------------#  
  620.   def get_battler_at(index)
  621.     battle_members if @battlers == nil
  622.     return @battlers[index]
  623.   end
  624.  
  625.   #--------------------------------------------------------------------------#
  626.   # * new method :get_empty_index
  627.   #--------------------------------------------------------------------------#  
  628.   def get_empty_index
  629.     for i in 0...battle_party_size
  630.       return i if @battlers[i] == nil
  631.     end  
  632.     return nil
  633.   end  
  634.    
  635.   #--------------------------------------------------------------------------#
  636.   # * alias method :remove_actor
  637.   #--------------------------------------------------------------------------#
  638.   alias ieo030_remove_actor remove_actor unless $@
  639.   def remove_actor(actor_id)
  640.     battle_members if @battlers == nil
  641.     @battlers[@battlers.index(actor_id)] = nil if @battlers.include?(actor_id)
  642.     ieo030_remove_actor(actor_id)
  643.   end
  644.  
  645.   #--------------------------------------------------------------------------#
  646.   # * new method :battle_members_full?
  647.   #--------------------------------------------------------------------------#  
  648.   def battle_members_full?
  649.     return battle_members.compact.size >= battle_party_size
  650.   end
  651.  
  652. end
  653.  
  654. end
  655.  
  656. #==============================================================================#
  657. # Window_MenuStatus
  658. #==============================================================================#
  659. class Window_MenuStatus < Window_Selectable
  660.  
  661.   #--------------------------------------------------------------------------#
  662.   # * super method :initialize
  663.   #--------------------------------------------------------------------------#
  664.   def initialize(x, y)
  665.     super(x, y, 384, 416)
  666.     @y_spacing   = IEO::MENU_SYSTEM::MS_YSPACING
  667.     @rect_width  = IEO::MENU_SYSTEM::MS_RECTWIDTH
  668.     @rect_height = IEO::MENU_SYSTEM::MS_RECTHEIGHT
  669.     @last_itemmax_mode = :normal
  670.     refresh
  671.     self.active = false
  672.     self.index = -1
  673.   end
  674.  
  675.   #--------------------------------------------------------------------------#
  676.   # * new method :change_item_max_mode
  677.   #--------------------------------------------------------------------------#  
  678.   def change_item_max_mode(mode)
  679.     case mode
  680.     when :normal
  681.       @item_max = $game_party.members.size
  682.     when :party_select
  683.       @item_max = Game_Party::MAX_MEMBERS
  684.     end  
  685.     @last_itemmax_mode = mode
  686.   end
  687.  
  688.   #--------------------------------------------------------------------------#
  689.   # * overwrite method :refresh
  690.   #--------------------------------------------------------------------------#
  691.   def refresh
  692.     self.contents.clear
  693.     change_item_max_mode(@last_itemmax_mode)
  694.     for actor in $game_party.members
  695.       self.contents.font.size = Font.default_size
  696.       draw_actor_face(actor, 2, actor.index * @y_spacing + 2, 92)
  697.       x = 104
  698.       y = actor.index * @y_spacing + WLH / 2
  699.       draw_actor_name(actor, x, y)
  700.       draw_actor_class(actor, x + 120, y)
  701.       draw_actor_level(actor, x, y + WLH * 1)
  702.       draw_actor_state(actor, x, y + WLH * 2)
  703.       draw_actor_hp(actor, x + 120, y + WLH * 1)
  704.       draw_actor_mp(actor, x + 120, y + WLH * 2)
  705.       if $imported["IEO-SkillLevelSystem"]
  706.         rect = Rect.new(x+24, y, 96, 24)
  707.         draw_actor_skl_p(actor, rect)
  708.       end
  709.     end
  710.   end
  711.  
  712.   #--------------------------------------------------------------------------#
  713.   # * overwrite method :top_row
  714.   #--------------------------------------------------------------------------#
  715.   def top_row
  716.     return self.oy / @y_spacing
  717.   end
  718.   #--------------------------------------------------------------------------#
  719.   # * overwrite method :top_row=
  720.   #--------------------------------------------------------------------------#
  721.   def top_row=(row)
  722.     row = 0 if row < 0
  723.     row = row_max - 1 if row > row_max - 1
  724.     self.oy = row * @y_spacing
  725.   end
  726.  
  727.   #--------------------------------------------------------------------------#
  728.   # * overwrite method :page_row_max
  729.   #--------------------------------------------------------------------------#
  730.   def page_row_max
  731.     return (self.height - 32) / @y_spacing
  732.   end
  733.  
  734.   #--------------------------------------------------------------------------#
  735.   # * overwrite method :update_cursor
  736.   #--------------------------------------------------------------------------#
  737.   def update_cursor
  738.     if @index < 0               # No cursor
  739.       self.cursor_rect.empty
  740.     elsif @index < @item_max    # Normal
  741.       self.cursor_rect.set(0, @index * @y_spacing, @rect_width, @rect_height)
  742.     elsif @index >= 100         # Self
  743.       self.cursor_rect.set(0, (@index - 100) * @y_spacing, @rect_width, @rect_height)
  744.     else                        # All
  745.       self.cursor_rect.set(0, 0, contents.width, self.height-32)
  746.     end
  747.   end
  748.  
  749. end
  750.  
  751. #==============================================================================#
  752. # Window_MenuCommand
  753. #==============================================================================#
  754. class Window_MenuCommand < Window_Command
  755.  
  756.   #--------------------------------------------------------------------------#
  757.   # * new method :get_current_command
  758.   #--------------------------------------------------------------------------#    
  759.   def get_current_command ; return @commands[self.index] end
  760.    
  761.   #--------------------------------------------------------------------------#
  762.   # * overwrite method :refresh
  763.   #--------------------------------------------------------------------------#  
  764.   def refresh
  765.     self.contents.clear
  766.     for i in 0...@item_max
  767.       draw_item(i, !Scene_Menu.hide_command?(@commands[i]))
  768.     end
  769.   end
  770.  
  771.   #--------------------------------------------------------------------------#
  772.   # * overwrite method :draw_item
  773.   #--------------------------------------------------------------------------#  
  774.   def draw_item(index, enabled = true)
  775.     rect = item_rect(index)
  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.     draw_icon(icon, rect.x, rect.y)
  783.     if icon > 0
  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.   # * overwrite method :update_command_selection
  967.   #--------------------------------------------------------------------------#
  968.   def update_command_selection
  969.     if Input.trigger?(Input::B)
  970.       Sound.play_cancel
  971.       $scene = Scene_Map.new
  972.     elsif Input.trigger?(Input::C)
  973.       com = @command_window.get_current_command
  974.       if com == nil
  975.         Sound.play_buzzer
  976.         return
  977.       end
  978.       if Scene_Menu.hide_command?(com)
  979.         Sound.play_buzzer
  980.         return
  981.       end
  982.       Sound.play_decision
  983.       if Scene_Menu.need_actor_selection?(com)
  984.         before_actor_selection(com)
  985.         start_actor_selection
  986.       else
  987.         menu_command(com)
  988.       end
  989.     end
  990.   end
  991.  
  992.   #--------------------------------------------------------------------------#
  993.   # * alias method :update_actor_selection
  994.   #--------------------------------------------------------------------------#  
  995.   alias ieo030_start_actor_selection start_actor_selection unless $@
  996.   def start_actor_selection
  997.     ieo030_start_actor_selection
  998.     imx = @status_window.item_max
  999.     @status_window.index = imx if @status_window.index > imx
  1000.   end  
  1001.  
  1002.   #--------------------------------------------------------------------------#
  1003.   # * overwrite method :update_actor_selection
  1004.   #--------------------------------------------------------------------------#
  1005.   def update_actor_selection
  1006.     if Input.trigger?(Input::B)
  1007.       Sound.play_cancel
  1008.       end_actor_selection
  1009.     elsif Input.trigger?(Input::C)
  1010.       $game_party.last_actor_index = @status_window.index
  1011.       com = @command_window.get_current_command
  1012.       Sound.play_decision
  1013.       menu_command(com)
  1014.     end
  1015.   end
  1016.  
  1017. end
  1018.  
  1019. #==============================================================================#
  1020. # Scene_Item
  1021. #==============================================================================#
  1022. class Scene_Item < Scene_Base
  1023.   #--------------------------------------------------------------------------#
  1024.   # * overwrite method :return_scene
  1025.   #--------------------------------------------------------------------------#
  1026.   def return_scene
  1027.     $scene = Scene_Menu.new(Scene_Menu.command_index(:item))
  1028.   end
  1029. end  
  1030.  
  1031. #==============================================================================#
  1032. # Scene_Skill
  1033. #==============================================================================#
  1034. class Scene_Skill < Scene_Base
  1035.   #--------------------------------------------------------------------------#
  1036.   # * overwrite method :return_scene
  1037.   #--------------------------------------------------------------------------#
  1038.   def return_scene
  1039.     $scene = Scene_Menu.new(Scene_Menu.command_index(:skill))
  1040.   end
  1041. end
  1042.  
  1043. #==============================================================================#
  1044. # Scene_Equip
  1045. #==============================================================================#
  1046. class Scene_Equip < Scene_Base
  1047.   #--------------------------------------------------------------------------#
  1048.   # * overwrite method :return_scene
  1049.   #--------------------------------------------------------------------------#
  1050.   def return_scene
  1051.     $scene = Scene_Menu.new(Scene_Menu.command_index(:equip))
  1052.   end
  1053. end
  1054.  
  1055. #==============================================================================#
  1056. # Scene_Status
  1057. #==============================================================================#
  1058. class Scene_Status < Scene_Base
  1059.   #--------------------------------------------------------------------------#
  1060.   # * overwrite method :return_scene
  1061.   #--------------------------------------------------------------------------#
  1062.   def return_scene
  1063.     $scene = Scene_Menu.new(Scene_Menu.command_index(:status))
  1064.   end
  1065. end  
  1066.  
  1067. #==============================================================================#
  1068. # Scene_File
  1069. #==============================================================================#
  1070. class Scene_File < Scene_Base
  1071.   #--------------------------------------------------------------------------#
  1072.   # * overwrite method :return_scene
  1073.   #--------------------------------------------------------------------------#
  1074.   def return_scene
  1075.     if @from_title
  1076.       $scene = Scene_Title.new
  1077.     elsif @from_event
  1078.       $scene = Scene_Map.new
  1079.     else
  1080.       $scene = Scene_Menu.new(Scene_Menu.command_index(:save))
  1081.     end
  1082.   end
  1083. end  
  1084.  
  1085. #==============================================================================#
  1086. # Scene_End
  1087. #==============================================================================#
  1088. class Scene_End < Scene_Base
  1089.   #--------------------------------------------------------------------------#
  1090.   # * overwrite method :return_scene
  1091.   #--------------------------------------------------------------------------#
  1092.   def return_scene
  1093.     $scene = Scene_Menu.new(Scene_Menu.command_index(:system))
  1094.   end
  1095. end
  1096.  
  1097. #==============================================================================#
  1098. # Scene_Battle
  1099. #==============================================================================#
  1100. class Scene_Battle < Scene_Base
  1101.  
  1102.   #--------------------------------------------------------------------------#
  1103.   # * overwrite method :display_level_up
  1104.   #--------------------------------------------------------------------------#
  1105.   def display_level_up
  1106.     exp = $game_troop.exp_total
  1107.     mems = $game_party.members
  1108.     mems = $game_party.all_members
  1109.     for actor in mems
  1110.       next if actor.dead?
  1111.       last_level = actor.level   ; last_skills = actor.skills
  1112.       nexp = exp
  1113.       nexp = exp.to_f * $game_variables[$game_system.reserve_exprate_var] / 100.0 if actor.reserve_member?
  1114.       actor.gain_exp(Integer(nexp), true)
  1115.     end
  1116.     wait_for_message
  1117.   end
  1118.  
  1119. end
  1120.  
  1121. #=*==========================================================================*=#
  1122. # ** END OF FILE
  1123. #=*==========================================================================*=#
Advertisement
Add Comment
Please, Sign In to add comment