Archeia

Yanfly Engine Ace - Ace Equip Engine v1.06

Mar 30th, 2014
752
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #==============================================================================
  2. #
  3. # ▼ Yanfly Engine Ace - Ace Equip Engine v1.06
  4. # -- Last Updated: 2012.02.02
  5. # -- Level: Normal, Hard
  6. # -- Requires: n/a
  7. #
  8. #==============================================================================
  9.  
  10. $imported = {} if $imported.nil?
  11. $imported["YEA-AceEquipEngine"] = true
  12.  
  13. #==============================================================================
  14. # ▼ Updates
  15. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  16. # 2012.02.02 - Bug Fixed: Crash when changing classes to different equip slots.
  17. # 2012.01.22 - Bug Fixed: <equip slot> notetags updated to factor in spaces.
  18. # 2012.01.05 - Compatibility Update: Equip Dynamic Stats
  19. # 2011.12.30 - Bug Fixed: Stats didn't update.
  20. # 2011.12.23 - Script efficiency optimized.
  21. # 2011.12.18 - Script efficiency optimized.
  22. # 2011.12.13 - Started Script and Finished.
  23. #
  24. #==============================================================================
  25. # ▼ Introduction
  26. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  27. # The default equipment system in RPG Maker VX is the standard equipment system
  28. # seen in all of the previous iterations, which consists of weapon, shield,
  29. # headgear, bodygear, and accessory. To break free of that norm, this script
  30. # allows users access to giving actors and/or classes dynamic equipment setups
  31. # (including having multiples of the same categories). In addition to having
  32. # different equip slot setups, newer equipment types can be made to allow for
  33. # more diversity in armour types.
  34. #
  35. #==============================================================================
  36. # ▼ Instructions
  37. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  38. # To install this script, open up your script editor and copy/paste this script
  39. # to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
  40. #
  41. # -----------------------------------------------------------------------------
  42. # Actor Notetags - These notetags go in the actors notebox in the database.
  43. # -----------------------------------------------------------------------------
  44. # <equip slots>
  45. #  string
  46. #  string
  47. # </equip slots>
  48. # This sets the actor's default slots to whatever is listed in between the two
  49. # notetags. An actor's custom equip slots will take priority over a class's
  50. # custom equip slots, which will take priority over the default equip slots.
  51. # Replace "string" with the proper equipment type name or when in doubt, use
  52. # "equip type: x" with x as the equipment type.
  53. #
  54. # <starting gear: x>
  55. # <starting gear: x, x>
  56. # Adds armour x to the actor's list of starting gear. This is used primarily
  57. # for the newer pieces of gear that can't be added through the starting set of
  58. # equipment through the RPG Maker VX Ace editor by default. Insert multiple of
  59. # these notetags to add more pieces of starting gear if so desired.
  60. #
  61. # <fixed equip: x>
  62. # <fixed equip: x, x>
  63. # This will fix the equip type x. Fixed equip slots mean that the equipment
  64. # already on it are unable to be exchanged in or out by the player. This tag
  65. # has been made so that equip types can be fixed for equip type 5 and above.
  66. # Use multiple of these notetags to add more fixed equipment restrictions.
  67. #
  68. # <sealed equip: x>
  69. # <sealed equip: x, x>
  70. # This will seal the equip type x. Sealed equip slots mean that no equipment
  71. # can be equipped onto that equip type slot. This tag has been made so that
  72. # equip types can be sealed for equip type 5 and above. Use multiple of these
  73. # notetags to add more sealed equipment restrictions.
  74. #
  75. # -----------------------------------------------------------------------------
  76. # Class Notetags - These notetags go in the class notebox in the database.
  77. # -----------------------------------------------------------------------------
  78. # <equip slots>
  79. #  string
  80. #  string
  81. # </equip slots>
  82. # This sets the class's default slots to whatever is listed in between the two
  83. # notetags. An actor's custom equip slots will take priority over a class's
  84. # custom equip slots, which will take priority over the default equip slots.
  85. # Replace "string" with the proper equipment type name or when in doubt, use
  86. # "equip type: x" with x as the equipment type.
  87. #
  88. # <fixed equip: x>
  89. # <fixed equip: x, x>
  90. # This will fix the equip type x. Fixed equip slots mean that the equipment
  91. # already on it are unable to be exchanged in or out by the player. This tag
  92. # has been made so that equip types can be fixed for equip type 5 and above.
  93. # Use multiple of these notetags to add more fixed equipment restrictions.
  94. #
  95. # <sealed equip: x>
  96. # <sealed equip: x, x>
  97. # This will seal the equip type x. Sealed equip slots mean that no equipment
  98. # can be equipped onto that equip type slot. This tag has been made so that
  99. # equip types can be sealed for equip type 5 and above. Use multiple of these
  100. # notetags to add more sealed equipment restrictions.
  101. #
  102. # -----------------------------------------------------------------------------
  103. # Weapon Notetags - These notetags go in the weapons notebox in the database.
  104. # -----------------------------------------------------------------------------
  105. # <fixed equip: x>
  106. # <fixed equip: x, x>
  107. # This will fix the equip type x. Fixed equip slots mean that the equipment
  108. # already on it are unable to be exchanged in or out by the player. This tag
  109. # has been made so that equip types can be fixed for equip type 5 and above.
  110. # Use multiple of these notetags to add more fixed equipment restrictions.
  111. #
  112. # <sealed equip: x>
  113. # <sealed equip: x, x>
  114. # This will seal the equip type x. Sealed equip slots mean that no equipment
  115. # can be equipped onto that equip type slot. This tag has been made so that
  116. # equip types can be sealed for equip type 5 and above. Use multiple of these
  117. # notetags to add more sealed equipment restrictions.
  118. #
  119. # -----------------------------------------------------------------------------
  120. # Armour Notetags - These notetags go in the armour notebox in the database.
  121. # -----------------------------------------------------------------------------
  122. # <equip type: x>
  123. # <equip type: string>
  124. # For the newer equip types, replace x or string with the equip type ID or the
  125. # name of the equip type respectively. This will set that armour to that
  126. # particular equip type.
  127. #
  128. # <fixed equip: x>
  129. # <fixed equip: x, x>
  130. # This will fix the equip type x. Fixed equip slots mean that the equipment
  131. # already on it are unable to be exchanged in or out by the player. This tag
  132. # has been made so that equip types can be fixed for equip type 5 and above.
  133. # Use multiple of these notetags to add more fixed equipment restrictions.
  134. #
  135. # <sealed equip: x>
  136. # <sealed equip: x, x>
  137. # This will seal the equip type x. Sealed equip slots mean that no equipment
  138. # can be equipped onto that equip type slot. This tag has been made so that
  139. # equip types can be sealed for equip type 5 and above. Use multiple of these
  140. # notetags to add more sealed equipment restrictions.
  141. #
  142. # -----------------------------------------------------------------------------
  143. # State Notetags - These notetags go in the states notebox in the database.
  144. # -----------------------------------------------------------------------------
  145. # <fixed equip: x>
  146. # <fixed equip: x, x>
  147. # This will fix the equip type x. Fixed equip slots mean that the equipment
  148. # already on it are unable to be exchanged in or out by the player. This tag
  149. # has been made so that equip types can be fixed for equip type 5 and above.
  150. # Use multiple of these notetags to add more fixed equipment restrictions.
  151. #
  152. # <sealed equip: x>
  153. # <sealed equip: x, x>
  154. # This will seal the equip type x. Sealed equip slots mean that no equipment
  155. # can be equipped onto that equip type slot. This tag has been made so that
  156. # equip types can be sealed for equip type 5 and above. Use multiple of these
  157. # notetags to add more sealed equipment restrictions.
  158. #
  159. #==============================================================================
  160. # ▼ Compatibility
  161. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  162. # This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
  163. # it will run with RPG Maker VX without adjusting.
  164. #
  165. #==============================================================================
  166.  
  167. module YEA
  168.   module EQUIP
  169.    
  170.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  171.     # - General Equip Settings -
  172.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  173.     # This adjusts the default equip configuration. While actors can have their
  174.     # own unique equipment configurations, it's recommended to not change too
  175.     # much as things get really hairy when it comes to proper eventing.
  176.     #
  177.     # ID   Equip Type
  178.     # ---  ------------
  179.     #  0   Weapon
  180.     #  1   Shield
  181.     #  2   Headgear
  182.     #  3   Bodygear
  183.     #  4   Accessory
  184.     #
  185.     # Whatever you set the below slots to, the dual wield setup will be exactly
  186.     # identical except that the second slot will be changed to a weapon (0).
  187.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  188.     # Adjust this array to set the default slots used for all of your actors
  189.     # and classes if they do not have a custom equipment slot setup.
  190.     DEFAULT_BASE_SLOTS = [ 0, 1, 2, 3, 5, 6, 4, 4]
  191.    
  192.     # This hash adjusts the new equip types (past 4+). Adjust them to match
  193.     # their names properly. You can choose to allow certain types of equipment
  194.     # be removable or not, or whether or not optimize will affect them.
  195.     TYPES ={
  196.     # TypeID => ["Type Name", Removable?, Optimize?],
  197.            0 => [   "Weapon",      false,      true],
  198.            1 => [   "Shield",       true,      true],
  199.            2 => [ "Headgear",       true,      true],
  200.            3 => [ "Bodygear",       true,      true],
  201.            4 => ["Accessory",       true,     false],
  202.            5 => [    "Cloak",       true,      true],
  203.            6 => [ "Necklace",       true,      true],
  204.     } # Do not remove this.
  205.    
  206.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  207.     # - Equip Command List -
  208.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  209.     # Here, you can adjust the order at which the commands appear (or even
  210.     # remove commands as you see fit). Here's a list of which does what:
  211.     #
  212.     # -------------------------------------------------------------------------
  213.     # :command         Description
  214.     # -------------------------------------------------------------------------
  215.     # :equip           Activates the manual equip window. Default.
  216.     # :optimize        Optimizes equipment for the actor. Default.
  217.     # :clear           Clears all equipment from the actor. Default
  218.     #
  219.     # And that's all of the currently available commands. This list will be
  220.     # updated as more scripts become available.
  221.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  222.     # This array arranges the order of which the commands appear in the Equip
  223.     # Command window in the Equip Scene.
  224.     COMMAND_LIST =[
  225.       :equip,
  226.       :optimize,
  227.       :clear,
  228.     # :custom1,
  229.     # :custom2,
  230.     ] # Do not remove this.
  231.    
  232.     #--------------------------------------------------------------------------
  233.     # - Equip Custom Commands -
  234.     # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  235.     # For those who use scripts to that may produce unique effects for
  236.     # equipping, use this hash to manage the custom commands for the Equip
  237.     # Command Window. You can disable certain commands or prevent them from
  238.     # appearing by using switches. If you don't wish to bind them to a switch,
  239.     # set the proper switch to 0 for it to have no impact.
  240.     #--------------------------------------------------------------------------
  241.     CUSTOM_EQUIP_COMMANDS ={
  242.     # :command => ["Display Name", EnableSwitch, ShowSwitch, Handler Method],
  243.       :custom1 => [ "Custom Name",            0,          0, :command_name1],
  244.       :custom2 => [ "Custom Text",           13,          0, :command_name2],
  245.     } # Do not remove this.
  246.    
  247.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  248.     # - Misc Window Settings -
  249.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  250.     # This section adjusts the minor visuals that you see inside of the newly
  251.     # organized Equip Scene. Adjust the settings as you see fit.
  252.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  253.     # This sets the font size used for the status window in the lower right
  254.     # corner of the screen (which shows stats and comparisons).
  255.     STATUS_FONT_SIZE = 20
  256.    
  257.     # This sets the remove equip command in the item window.
  258.     REMOVE_EQUIP_ICON = 185
  259.     REMOVE_EQUIP_TEXT = "<Remove Equip>"
  260.    
  261.     # This sets the no-equipment text in the slot window.
  262.     NOTHING_ICON = 185
  263.     NOTHING_TEXT = "<Empty>"
  264.    
  265.   end # EQUIP
  266. end # YEA
  267.  
  268. #==============================================================================
  269. # ▼ Editting anything past this point may potentially result in causing
  270. # computer damage, incontinence, explosion of user's head, coma, death, and/or
  271. # halitosis so edit at your own risk.
  272. #==============================================================================
  273.  
  274. module YEA
  275.   module REGEXP
  276.   module BASEITEM
  277.    
  278.     EQUIP_SLOTS_ON  = /<(?:EQUIP_SLOTS|equip slots)>/i
  279.     EQUIP_SLOTS_OFF = /<\/(?:EQUIP_SLOTS|equip slots)>/i
  280.    
  281.     EQUIP_TYPE_INT = /<(?:EQUIP_TYPE|equip type):[ ]*(\d+)>/i
  282.     EQUIP_TYPE_STR = /<(?:EQUIP_TYPE|equip type):[ ]*(.*)>/i
  283.    
  284.     STARTING_GEAR = /<(?:STARTING_GEAR|starting gear):[ ](\d+(?:\s*,\s*\d+)*)>/i
  285.    
  286.     FIXED_EQUIP = /<(?:FIXED_EQUIP|fixed equip):[ ](\d+(?:\s*,\s*\d+)*)>/i
  287.     SEALED_EQUIP = /<(?:SEALED_EQUIP|sealed equip):[ ](\d+(?:\s*,\s*\d+)*)>/i
  288.    
  289.   end # BASEITEM
  290.   end # REGEXP
  291. end # YEA
  292.  
  293. #==============================================================================
  294. # ■ Vocab
  295. #==============================================================================
  296.  
  297. module Vocab
  298.  
  299.   #--------------------------------------------------------------------------
  300.   # overwrite method: self.etype
  301.   #--------------------------------------------------------------------------
  302.   def self.etype(etype)
  303.     return $data_system.terms.etypes[etype] if [0,1,2,3,4].include?(etype)
  304.     return YEA::EQUIP::TYPES[etype][0] if YEA::EQUIP::TYPES.include?(etype)
  305.     return ""
  306.   end
  307.  
  308. end # Vocab
  309.  
  310. #==============================================================================
  311. # ■ Icon
  312. #==============================================================================
  313.  
  314. module Icon
  315.  
  316.   #--------------------------------------------------------------------------
  317.   # self.remove_equip
  318.   #--------------------------------------------------------------------------
  319.   def self.remove_equip; return YEA::EQUIP::REMOVE_EQUIP_ICON; end
  320.  
  321.   #--------------------------------------------------------------------------
  322.   # self.nothing_equip
  323.   #--------------------------------------------------------------------------
  324.   def self.nothing_equip; return YEA::EQUIP::NOTHING_ICON; end
  325.    
  326. end # Icon
  327.  
  328. #==============================================================================
  329. # ■ Numeric
  330. #==============================================================================
  331.  
  332. class Numeric
  333.  
  334.   #--------------------------------------------------------------------------
  335.   # new method: group_digits
  336.   #--------------------------------------------------------------------------
  337.   unless $imported["YEA-CoreEngine"]
  338.   def group; return self.to_s; end
  339.   end # $imported["YEA-CoreEngine"]
  340.    
  341. end # Numeric
  342.  
  343. #==============================================================================
  344. # ■ DataManager
  345. #==============================================================================
  346.  
  347. module DataManager
  348.  
  349.   #--------------------------------------------------------------------------
  350.   # alias method: load_database
  351.   #--------------------------------------------------------------------------
  352.   class <<self; alias load_database_aee load_database; end
  353.   def self.load_database
  354.     load_database_aee
  355.     load_notetags_aee
  356.   end
  357.  
  358.   #--------------------------------------------------------------------------
  359.   # new method: load_notetags_aee
  360.   #--------------------------------------------------------------------------
  361.   def self.load_notetags_aee
  362.     groups = [$data_actors, $data_classes, $data_weapons, $data_armors,
  363.       $data_states]
  364.     for group in groups
  365.       for obj in group
  366.         next if obj.nil?
  367.         obj.load_notetags_aee
  368.       end
  369.     end
  370.   end
  371.  
  372. end # DataManager
  373.  
  374. #==============================================================================
  375. # ■ RPG::BaseItem
  376. #==============================================================================
  377.  
  378. class RPG::BaseItem
  379.  
  380.   #--------------------------------------------------------------------------
  381.   # public instance variables
  382.   #--------------------------------------------------------------------------
  383.   attr_accessor :base_equip_slots
  384.   attr_accessor :fixed_equip_type
  385.   attr_accessor :sealed_equip_type
  386.   attr_accessor :extra_starting_equips
  387.  
  388.   #--------------------------------------------------------------------------
  389.   # common cache: load_notetags_aee
  390.   #--------------------------------------------------------------------------
  391.   def load_notetags_aee
  392.     @base_equip_slots = []
  393.     @equip_slots_on = false
  394.     @fixed_equip_type = []
  395.     @sealed_equip_type = []
  396.     @extra_starting_equips = []
  397.     #---
  398.     self.note.split(/[\r\n]+/).each { |line|
  399.       case line
  400.       #---
  401.       when YEA::REGEXP::BASEITEM::EQUIP_SLOTS_ON
  402.         next unless self.is_a?(RPG::Actor) ||self.is_a?(RPG::Class)
  403.         @equip_slots_on = true
  404.       when YEA::REGEXP::BASEITEM::EQUIP_SLOTS_OFF
  405.         next unless self.is_a?(RPG::Actor) ||self.is_a?(RPG::Class)
  406.         @equip_slots_on = false
  407.       #---
  408.       when YEA::REGEXP::BASEITEM::STARTING_GEAR
  409.         next unless self.is_a?(RPG::Actor)
  410.         $1.scan(/\d+/).each { |num|
  411.         @extra_starting_equips.push(num.to_i) if num.to_i > 0 }
  412.       when YEA::REGEXP::BASEITEM::FIXED_EQUIP
  413.         $1.scan(/\d+/).each { |num|
  414.         @fixed_equip_type.push(num.to_i) if num.to_i > 0 }
  415.       when YEA::REGEXP::BASEITEM::SEALED_EQUIP
  416.         $1.scan(/\d+/).each { |num|
  417.         @sealed_equip_type.push(num.to_i) if num.to_i > 0 }
  418.       #---
  419.       when YEA::REGEXP::BASEITEM::EQUIP_TYPE_INT
  420.         next unless self.is_a?(RPG::Armor)
  421.         @etype_id = [1, $1.to_i].max
  422.       when YEA::REGEXP::BASEITEM::EQUIP_TYPE_STR
  423.         next unless self.is_a?(RPG::Armor)
  424.         for key in YEA::EQUIP::TYPES
  425.           id = key[0]
  426.           next if YEA::EQUIP::TYPES[id][0].upcase != $1.to_s.upcase
  427.           @etype_id = [1, id].max
  428.           break
  429.         end
  430.       #---
  431.       else
  432.         if @equip_slots_on
  433.           case line.upcase
  434.           when /EQUIP TYPE[ ](\d+)/i, /EQUIP TYPE:[ ](\d+)/i
  435.             id = $1.to_i
  436.             @base_equip_slots.push(id) if [0,1,2,3,4].include?(id)
  437.             @base_equip_slots.push(id) if YEA::EQUIP::TYPES.include?(id)
  438.           when /WEAPON/i
  439.             @base_equip_slots.push(0)
  440.           when /SHIELD/i
  441.             @base_equip_slots.push(1)
  442.           when /HEAD/i
  443.             @base_equip_slots.push(2)
  444.           when /BODY/i, /ARMOR/i, /ARMOUR/i
  445.             @base_equip_slots.push(3)
  446.           when /ETC/i, /OTHER/i, /ACCESSOR/i
  447.             @base_equip_slots.push(4)
  448.           else
  449.             text = line.upcase.delete(" ")
  450.             for key in YEA::EQUIP::TYPES
  451.               id = key[0]
  452.               next if YEA::EQUIP::TYPES[id][0].upcase.delete(" ")!= text
  453.               @base_equip_slots.push(id)
  454.               break
  455.             end
  456.           end
  457.         end
  458.       end
  459.     } # self.note.split
  460.     #---
  461.     return unless self.is_a?(RPG::Class)
  462.     if @base_equip_slots.empty?
  463.       @base_equip_slots = YEA::EQUIP::DEFAULT_BASE_SLOTS.clone
  464.     end
  465.   end
  466.  
  467. end # RPG::BaseItem
  468.  
  469. #==============================================================================
  470. # ■ Game_Temp
  471. #==============================================================================
  472.  
  473. class Game_Temp
  474.  
  475.   #--------------------------------------------------------------------------
  476.   # public instance variables
  477.   #--------------------------------------------------------------------------
  478.   attr_accessor :eds_actor
  479.   attr_accessor :scene_equip_index
  480.   attr_accessor :scene_equip_oy
  481.  
  482. end # Game_Temp
  483.  
  484. #==============================================================================
  485. # ■ Game_BaseItem
  486. #==============================================================================
  487.  
  488. class Game_BaseItem
  489.  
  490.   #--------------------------------------------------------------------------
  491.   # public instance variables
  492.   #--------------------------------------------------------------------------
  493.   attr_accessor :item_id
  494.  
  495. end # Game_BaseItem
  496.  
  497. #==============================================================================
  498. # ■ Game_BattlerBase
  499. #==============================================================================
  500.  
  501. class Game_BattlerBase
  502.  
  503.   #--------------------------------------------------------------------------
  504.   # alias method: equip_type_fixed?
  505.   #--------------------------------------------------------------------------
  506.   alias game_battlerbase_equip_type_fixed_aee equip_type_fixed?
  507.   def equip_type_fixed?(etype_id)
  508.     return true if fixed_etypes.include?(etype_id) if actor?
  509.     return game_battlerbase_equip_type_fixed_aee(etype_id)
  510.   end
  511.  
  512.   #--------------------------------------------------------------------------
  513.   # alias method: equip_type_sealed?
  514.   #--------------------------------------------------------------------------
  515.   alias game_battlerbase_equip_type_sealed_aee equip_type_sealed?
  516.   def equip_type_sealed?(etype_id)
  517.     return true if sealed_etypes.include?(etype_id) if actor?
  518.     return game_battlerbase_equip_type_sealed_aee(etype_id)
  519.   end
  520.  
  521. end # Game_BattlerBase
  522.  
  523. #==============================================================================
  524. # ■ Game_Actor
  525. #==============================================================================
  526.  
  527. class Game_Actor < Game_Battler
  528.  
  529.   #--------------------------------------------------------------------------
  530.   # alias method: init_equips
  531.   #--------------------------------------------------------------------------
  532.   alias game_actor_init_equips_aee init_equips
  533.   def init_equips(equips)
  534.     game_actor_init_equips_aee(equips)
  535.     equip_extra_starting_equips
  536.   end
  537.  
  538.   #--------------------------------------------------------------------------
  539.   # new method: equip_extra_starting_equips
  540.   #--------------------------------------------------------------------------
  541.   def equip_extra_starting_equips
  542.     for equip_id in actor.extra_starting_equips
  543.       armour = $data_armors[equip_id]
  544.       next if armour.nil?
  545.       etype_id = armour.etype_id
  546.       next unless equip_slots.include?(etype_id)
  547.       slot_id = empty_slot(etype_id)
  548.       @equips[slot_id].set_equip(etype_id == 0, armour.id)
  549.     end
  550.     refresh
  551.   end
  552.  
  553.   #--------------------------------------------------------------------------
  554.   # overwrite method: equip_slots
  555.   #--------------------------------------------------------------------------
  556.   def equip_slots
  557.     return equip_slots_dual if dual_wield?
  558.     return equip_slots_normal
  559.   end
  560.  
  561.   #--------------------------------------------------------------------------
  562.   # new method: equip_slots_normal
  563.   #--------------------------------------------------------------------------
  564.   def equip_slots_normal
  565.     return self.actor.base_equip_slots if self.actor.base_equip_slots != []
  566.     return self.class.base_equip_slots
  567.   end
  568.  
  569.   #--------------------------------------------------------------------------
  570.   # new method: equip_slots_dual
  571.   #--------------------------------------------------------------------------
  572.   def equip_slots_dual
  573.     array = equip_slots_normal.clone
  574.     array[1] = 0 if array.size >= 2
  575.     return array
  576.   end
  577.  
  578.   #--------------------------------------------------------------------------
  579.   # new method: fixed_etypes
  580.   #--------------------------------------------------------------------------
  581.   def fixed_etypes
  582.     array = []
  583.     array |= self.actor.fixed_equip_type
  584.     array |= self.class.fixed_equip_type
  585.     for equip in equips
  586.       next if equip.nil?
  587.       array |= equip.fixed_equip_type
  588.     end
  589.     for state in states
  590.       next if state.nil?
  591.       array |= state.fixed_equip_type
  592.     end
  593.     return array
  594.   end
  595.  
  596.   #--------------------------------------------------------------------------
  597.   # new method: sealed_etypes
  598.   #--------------------------------------------------------------------------
  599.   def sealed_etypes
  600.     array = []
  601.     array |= self.actor.sealed_equip_type
  602.     array |= self.class.sealed_equip_type
  603.     for equip in equips
  604.       next if equip.nil?
  605.       array |= equip.sealed_equip_type
  606.     end
  607.     for state in states
  608.       next if state.nil?
  609.       array |= state.sealed_equip_type
  610.     end
  611.     return array
  612.   end
  613.  
  614.   #--------------------------------------------------------------------------
  615.   # alias method: change_equip
  616.   #--------------------------------------------------------------------------
  617.   alias game_actor_change_equip_aee change_equip
  618.   def change_equip(slot_id, item)
  619.     if item.nil? && !@optimize_clear
  620.       etype_id = equip_slots[slot_id]
  621.       return unless YEA::EQUIP::TYPES[etype_id][1]
  622.     elsif item.nil? && @optimize_clear
  623.       etype_id = equip_slots[slot_id]
  624.       return unless YEA::EQUIP::TYPES[etype_id][2]
  625.     end
  626.     @equips[slot_id] = Game_BaseItem.new if @equips[slot_id].nil?
  627.     game_actor_change_equip_aee(slot_id, item)
  628.   end
  629.  
  630.   #--------------------------------------------------------------------------
  631.   # overwrite method: optimize_equipments
  632.   #--------------------------------------------------------------------------
  633.   def optimize_equipments
  634.     $game_temp.eds_actor = self
  635.     @optimize_clear = true
  636.     clear_equipments
  637.     @optimize_clear = false
  638.     equip_slots.size.times do |i|
  639.       next if !equip_change_ok?(i)
  640.       next unless can_optimize?(i)
  641.       items = $game_party.equip_items.select do |item|
  642.         item.etype_id == equip_slots[i] &&
  643.         equippable?(item) && item.performance >= 0
  644.       end
  645.       change_equip(i, items.max_by {|item| item.performance })
  646.     end
  647.     $game_temp.eds_actor = nil
  648.   end
  649.  
  650.   #--------------------------------------------------------------------------
  651.   # new method: can_optimize?
  652.   #--------------------------------------------------------------------------
  653.   def can_optimize?(slot_id)
  654.     etype_id = equip_slots[slot_id]
  655.     return YEA::EQUIP::TYPES[etype_id][2]
  656.   end
  657.  
  658.   #--------------------------------------------------------------------------
  659.   # alias method: force_change_equip
  660.   #--------------------------------------------------------------------------
  661.   alias game_actor_force_change_equip_aee force_change_equip
  662.   def force_change_equip(slot_id, item)
  663.     @equips[slot_id] = Game_BaseItem.new if @equips[slot_id].nil?
  664.     game_actor_force_change_equip_aee(slot_id, item)
  665.   end
  666.  
  667.   #--------------------------------------------------------------------------
  668.   # alias method: weapons
  669.   #--------------------------------------------------------------------------
  670.   alias game_actor_weapons_aee weapons
  671.   def weapons
  672.     anti_crash_equips
  673.     return game_actor_weapons_aee
  674.   end
  675.  
  676.   #--------------------------------------------------------------------------
  677.   # alias method: armors
  678.   #--------------------------------------------------------------------------
  679.   alias game_actor_armors_aee armors
  680.   def armors
  681.     anti_crash_equips
  682.     return game_actor_armors_aee
  683.   end
  684.  
  685.   #--------------------------------------------------------------------------
  686.   # alias method: equips
  687.   #--------------------------------------------------------------------------
  688.   alias game_actor_equips_aee equips
  689.   def equips
  690.     anti_crash_equips
  691.     return game_actor_equips_aee
  692.   end
  693.  
  694.   #--------------------------------------------------------------------------
  695.   # new method: equips
  696.   #--------------------------------------------------------------------------
  697.   def anti_crash_equips
  698.     for i in 0...@equips.size
  699.       next unless @equips[i].nil?
  700.       @equips[i] = Game_BaseItem.new
  701.     end
  702.   end
  703.  
  704. end # Game_Actor
  705.  
  706. #==============================================================================
  707. # ■ Game_Interpreter
  708. #==============================================================================
  709.  
  710. class Game_Interpreter
  711.  
  712.   #--------------------------------------------------------------------------
  713.   # overwrite method: change equip
  714.   #--------------------------------------------------------------------------
  715.   def command_319
  716.     actor = $game_actors[@params[0]]
  717.     return if actor.nil?
  718.     if @params[1] == 0 && @params[2] != 0
  719.       item = $data_weapons[@params[2]]
  720.       return unless actor.equip_slots.include?(0)
  721.       slot_id = actor.empty_slot(0)
  722.     elsif @params[2] != 0
  723.       item = $data_armors[@params[2]]
  724.       return unless actor.equip_slots.include?(item.etype_id)
  725.       slot_id = actor.empty_slot(item.etype_id)
  726.     else
  727.       slot_id = @params[1]
  728.     end
  729.     actor.change_equip_by_id(slot_id, @params[2])
  730.   end
  731.  
  732. end # Game_Interpreter
  733.  
  734. #==============================================================================
  735. # ■ Window_EquipStatus
  736. #==============================================================================
  737.  
  738. class Window_EquipStatus < Window_Base
  739.  
  740.   #--------------------------------------------------------------------------
  741.   # overwrite method: initialize
  742.   #--------------------------------------------------------------------------
  743.   def initialize(dx, dy)
  744.     super(dx, dy, window_width, Graphics.height - dy)
  745.     @actor = nil
  746.     @temp_actor = nil
  747.     refresh
  748.   end
  749.  
  750.   #--------------------------------------------------------------------------
  751.   # overwrite method: window_width
  752.   #--------------------------------------------------------------------------
  753.   def window_width; return Graphics.width * 2 / 5; end
  754.  
  755.   #--------------------------------------------------------------------------
  756.   # overwrite method: refresh
  757.   #--------------------------------------------------------------------------
  758.   def refresh
  759.     contents.clear
  760.     8.times {|i| draw_item(0, line_height * i, i) }
  761.   end
  762.  
  763.   #--------------------------------------------------------------------------
  764.   # overwrite method: draw_item
  765.   #--------------------------------------------------------------------------
  766.   def draw_item(dx, dy, param_id)
  767.     draw_background_colour(dx, dy)
  768.     draw_param_name(dx + 4, dy, param_id)
  769.     draw_current_param(dx + 4, dy, param_id) if @actor
  770.     drx = (contents.width + 22) / 2
  771.     draw_right_arrow(drx, dy)
  772.     draw_new_param(drx + 22, dy, param_id) if @temp_actor
  773.     reset_font_settings
  774.   end
  775.  
  776.   #--------------------------------------------------------------------------
  777.   # new method: draw_background_colour
  778.   #--------------------------------------------------------------------------
  779.   def draw_background_colour(dx, dy)
  780.     colour = Color.new(0, 0, 0, translucent_alpha/2)
  781.     rect = Rect.new(dx+1, dy+1, contents.width - 2, line_height - 2)
  782.     contents.fill_rect(rect, colour)
  783.   end
  784.  
  785.   #--------------------------------------------------------------------------
  786.   # overwrite method: draw_param_name
  787.   #--------------------------------------------------------------------------
  788.   def draw_param_name(dx, dy, param_id)
  789.     contents.font.size = YEA::EQUIP::STATUS_FONT_SIZE
  790.     change_color(system_color)
  791.     draw_text(dx, dy, contents.width, line_height, Vocab::param(param_id))
  792.   end
  793.  
  794.   #--------------------------------------------------------------------------
  795.   # overwrite method: draw_current_param
  796.   #--------------------------------------------------------------------------
  797.   def draw_current_param(dx, dy, param_id)
  798.     change_color(normal_color)
  799.     dw = (contents.width + 22) / 2
  800.     draw_text(0, dy, dw, line_height, @actor.param(param_id).group, 2)
  801.     reset_font_settings
  802.   end
  803.  
  804.   #--------------------------------------------------------------------------
  805.   # overwrite method: draw_new_param
  806.   #--------------------------------------------------------------------------
  807.   def draw_new_param(dx, dy, param_id)
  808.     contents.font.size = YEA::EQUIP::STATUS_FONT_SIZE
  809.     new_value = @temp_actor.param(param_id)
  810.     change_color(param_change_color(new_value - @actor.param(param_id)))
  811.     draw_text(0, dy, contents.width-4, line_height, new_value.group, 2)
  812.     reset_font_settings
  813.   end
  814.  
  815. end # Window_EquipStatus
  816.  
  817. #==============================================================================
  818. # ■ Window_EquipCommand
  819. #==============================================================================
  820.  
  821. class Window_EquipCommand < Window_HorzCommand
  822.  
  823.   #--------------------------------------------------------------------------
  824.   # overwrite method: make_command_list
  825.   #--------------------------------------------------------------------------
  826.   def make_command_list
  827.     for command in YEA::EQUIP::COMMAND_LIST
  828.       case command
  829.       when :equip
  830.         add_command(Vocab::equip2, :equip)
  831.       when :optimize
  832.         add_command(Vocab::optimize, :optimize)
  833.       when :clear
  834.         add_command(Vocab::clear, :clear)
  835.       else
  836.         process_custom_command(command)
  837.       end
  838.     end
  839.   end
  840.  
  841.   #--------------------------------------------------------------------------
  842.   # process_ok
  843.   #--------------------------------------------------------------------------
  844.   def process_ok
  845.     $game_temp.scene_equip_index = index
  846.     $game_temp.scene_equip_oy = self.oy
  847.     super
  848.   end
  849.  
  850.   #--------------------------------------------------------------------------
  851.   # new method: process_custom_command
  852.   #--------------------------------------------------------------------------
  853.   def process_custom_command(command)
  854.     return unless YEA::EQUIP::CUSTOM_EQUIP_COMMANDS.include?(command)
  855.     show = YEA::EQUIP::CUSTOM_EQUIP_COMMANDS[command][2]
  856.     continue = show <= 0 ? true : $game_switches[show]
  857.     return unless continue
  858.     text = YEA::EQUIP::CUSTOM_EQUIP_COMMANDS[command][0]
  859.     switch = YEA::EQUIP::CUSTOM_EQUIP_COMMANDS[command][1]
  860.     enabled = switch <= 0 ? true : $game_switches[switch]
  861.     add_command(text, command, enabled)
  862.   end
  863.  
  864.   #--------------------------------------------------------------------------
  865.   # overwrite method: window_width
  866.   #--------------------------------------------------------------------------
  867.   def window_width; return 160; end
  868.  
  869.   #--------------------------------------------------------------------------
  870.   # overwrite method: contents_width
  871.   #--------------------------------------------------------------------------
  872.   def contents_width; return width - standard_padding * 2; end
  873.  
  874.   #--------------------------------------------------------------------------
  875.   # overwrite method: contents_height
  876.   #--------------------------------------------------------------------------
  877.   def contents_height
  878.     ch = height - standard_padding * 2
  879.     return [ch - ch % item_height, row_max * item_height].max
  880.   end
  881.  
  882.   #--------------------------------------------------------------------------
  883.   # overwrite method: visible_line_number
  884.   #--------------------------------------------------------------------------
  885.   def visible_line_number; return 4; end
  886.  
  887.   #--------------------------------------------------------------------------
  888.   # overwrite method: col_max
  889.   #--------------------------------------------------------------------------
  890.   def col_max; return 1; end
  891.    
  892.   #--------------------------------------------------------------------------
  893.   # overwrite method: item_rect
  894.   #--------------------------------------------------------------------------
  895.   def item_rect(index)
  896.     rect = Rect.new
  897.     rect.width = item_width
  898.     rect.height = item_height
  899.     rect.x = index % col_max * (item_width + spacing)
  900.     rect.y = index / col_max * item_height
  901.     rect
  902.   end
  903.  
  904.   #--------------------------------------------------------------------------
  905.   # overwrite method: ensure_cursor_visible
  906.   #--------------------------------------------------------------------------
  907.   def ensure_cursor_visible
  908.     self.top_row = row if row < top_row
  909.     self.bottom_row = row if row > bottom_row
  910.   end
  911.    
  912.   #--------------------------------------------------------------------------
  913.   # overwrite method: cursor_down
  914.   #--------------------------------------------------------------------------
  915.   def cursor_down(wrap = false)
  916.     if index < item_max - col_max || (wrap && col_max == 1)
  917.       select((index + col_max) % item_max)
  918.     end
  919.   end
  920.  
  921.   #--------------------------------------------------------------------------
  922.   # overwrite method: cursor_up
  923.   #--------------------------------------------------------------------------
  924.   def cursor_up(wrap = false)
  925.     if index >= col_max || (wrap && col_max == 1)
  926.       select((index - col_max + item_max) % item_max)
  927.     end
  928.   end
  929.  
  930.   #--------------------------------------------------------------------------
  931.   # overwrite method: process_pageup
  932.   #--------------------------------------------------------------------------
  933.   def process_pageup
  934.     Sound.play_cursor
  935.     Input.update
  936.     deactivate
  937.     call_handler(:pageup)
  938.   end
  939.  
  940.   #--------------------------------------------------------------------------
  941.   # overwrite method: process_pagedown
  942.   #--------------------------------------------------------------------------
  943.   def process_pagedown
  944.     Sound.play_cursor
  945.     Input.update
  946.     deactivate
  947.     call_handler(:pagedown)
  948.   end
  949.  
  950. end # Window_EquipCommand
  951.  
  952. #==============================================================================
  953. # ■ Window_EquipSlot
  954. #==============================================================================
  955.  
  956. class Window_EquipSlot < Window_Selectable
  957.  
  958.   #--------------------------------------------------------------------------
  959.   # overwrite method: initialize
  960.   #--------------------------------------------------------------------------
  961.   def initialize(dx, dy, dw)
  962.     super(dx, dy, dw, Graphics.height - dy)
  963.     @actor = nil
  964.     refresh
  965.   end
  966.  
  967.   #--------------------------------------------------------------------------
  968.   # overwrite method: window_height
  969.   #--------------------------------------------------------------------------
  970.   def window_height; return self.height; end
  971.  
  972.   #--------------------------------------------------------------------------
  973.   # overwrite method: visible_line_number
  974.   #--------------------------------------------------------------------------
  975.   def visible_line_number; return item_max; end
  976.  
  977.   #--------------------------------------------------------------------------
  978.   # overwrite method: refresh
  979.   #--------------------------------------------------------------------------
  980.   def refresh
  981.     create_contents
  982.     super
  983.   end
  984.  
  985.   #--------------------------------------------------------------------------
  986.   # overwrite method: draw_item
  987.   #--------------------------------------------------------------------------
  988.   def draw_item(index)
  989.     return unless @actor
  990.     rect = item_rect_for_text(index)
  991.     change_color(system_color, enable?(index))
  992.     draw_text(rect.x, rect.y, 92, line_height, slot_name(index))
  993.     item = @actor.equips[index]
  994.     dx = rect.x + 92
  995.     dw = contents.width - dx - 24
  996.     if item.nil?
  997.       draw_nothing_equip(dx, rect.y, false, dw)
  998.     else
  999.       draw_item_name(item, dx, rect.y, enable?(index), dw)
  1000.     end
  1001.   end
  1002.  
  1003.   #--------------------------------------------------------------------------
  1004.   # new method: draw_nothing_equip
  1005.   #--------------------------------------------------------------------------
  1006.   def draw_nothing_equip(dx, dy, enabled, dw)
  1007.     change_color(normal_color, enabled)
  1008.     draw_icon(Icon.nothing_equip, dx, dy, enabled)
  1009.     text = YEA::EQUIP::NOTHING_TEXT
  1010.     draw_text(dx + 24, dy, dw - 24, line_height, text)
  1011.   end
  1012.  
  1013. end # Window_EquipSlot
  1014.  
  1015. #==============================================================================
  1016. # ■ Window_EquipItem
  1017. #==============================================================================
  1018.  
  1019. class Window_EquipItem < Window_ItemList
  1020.  
  1021.   #--------------------------------------------------------------------------
  1022.   # overwrite method: col_max
  1023.   #--------------------------------------------------------------------------
  1024.   def col_max; return 1; end
  1025.  
  1026.   #--------------------------------------------------------------------------
  1027.   # overwrite method: slot_id=
  1028.   #--------------------------------------------------------------------------
  1029.   def slot_id=(slot_id)
  1030.     return if @slot_id == slot_id
  1031.     @slot_id = slot_id
  1032.     @last_item = nil
  1033.     self.oy = 0
  1034.   end
  1035.  
  1036.   #--------------------------------------------------------------------------
  1037.   # overwrite method: draw_item
  1038.   #--------------------------------------------------------------------------
  1039.   def draw_item(index)
  1040.     item = @data[index]
  1041.     rect = item_rect(index)
  1042.     rect.width -= 4
  1043.     if item.nil?
  1044.       draw_remove_equip(rect)
  1045.       return
  1046.     end
  1047.     dw = contents.width - rect.x - 24
  1048.     draw_item_name(item, rect.x, rect.y, enable?(item), dw)
  1049.     draw_item_number(rect, item)
  1050.   end
  1051.  
  1052.   #--------------------------------------------------------------------------
  1053.   # new method: draw_remove_equip
  1054.   #--------------------------------------------------------------------------
  1055.   def draw_remove_equip(rect)
  1056.     draw_icon(Icon.remove_equip, rect.x, rect.y)
  1057.     text = YEA::EQUIP::REMOVE_EQUIP_TEXT
  1058.     rect.x += 24
  1059.     rect.width -= 24
  1060.     draw_text(rect, text)
  1061.   end
  1062.  
  1063.   #--------------------------------------------------------------------------
  1064.   # overwrite method: include?
  1065.   #--------------------------------------------------------------------------
  1066.   def include?(item)
  1067.     if item.nil? && !@actor.nil?
  1068.       etype_id = @actor.equip_slots[@slot_id]
  1069.       return YEA::EQUIP::TYPES[etype_id][1]
  1070.     end
  1071.     return true if item.nil?
  1072.     return false unless item.is_a?(RPG::EquipItem)
  1073.     return false if @slot_id < 0
  1074.     return false if item.etype_id != @actor.equip_slots[@slot_id]
  1075.     return @actor.equippable?(item)
  1076.   end
  1077.  
  1078.   #--------------------------------------------------------------------------
  1079.   # overwrite method: enable?
  1080.   #--------------------------------------------------------------------------
  1081.   def enable?(item)
  1082.     if item.nil? && !@actor.nil?
  1083.       etype_id = @actor.equip_slots[@slot_id]
  1084.       return YEA::EQUIP::TYPES[etype_id][1]
  1085.     end
  1086.     return @actor.equippable?(item)
  1087.   end
  1088.  
  1089.   #--------------------------------------------------------------------------
  1090.   # new method: show
  1091.   #--------------------------------------------------------------------------
  1092.   def show
  1093.     @last_item = 0
  1094.     update_help
  1095.     super
  1096.   end
  1097.  
  1098.   #--------------------------------------------------------------------------
  1099.   # overwrite method: update_help
  1100.   #--------------------------------------------------------------------------
  1101.   def update_help
  1102.     super
  1103.     return if @actor.nil?
  1104.     return if @status_window.nil?
  1105.     return if @last_item == item
  1106.     @last_item = item
  1107.     temp_actor = Marshal.load(Marshal.dump(@actor))
  1108.     temp_actor.force_change_equip(@slot_id, item)
  1109.     @status_window.set_temp_actor(temp_actor)
  1110.   end
  1111.  
  1112. end # Window_EquipItem
  1113.  
  1114. #==============================================================================
  1115. # ■ Window_EquipActor
  1116. #==============================================================================
  1117.  
  1118. class Window_EquipActor < Window_Base
  1119.  
  1120.   #--------------------------------------------------------------------------
  1121.   # initialize
  1122.   #--------------------------------------------------------------------------
  1123.   def initialize(dx, dy)
  1124.     super(dx, dy, window_width, fitting_height(4))
  1125.     @actor = nil
  1126.   end
  1127.  
  1128.   #--------------------------------------------------------------------------
  1129.   # window_width
  1130.   #--------------------------------------------------------------------------
  1131.   def window_width; return Graphics.width - 160; end
  1132.  
  1133.   #--------------------------------------------------------------------------
  1134.   # actor=
  1135.   #--------------------------------------------------------------------------
  1136.   def actor=(actor)
  1137.     return if @actor == actor
  1138.     @actor = actor
  1139.     refresh
  1140.   end
  1141.  
  1142.   #--------------------------------------------------------------------------
  1143.   # refresh
  1144.   #--------------------------------------------------------------------------
  1145.   def refresh
  1146.     contents.clear
  1147.     return unless @actor
  1148.     draw_actor_face(@actor, 0, 0)
  1149.     draw_actor_simple_status(@actor, 108, line_height / 2)
  1150.   end
  1151.  
  1152. end # Window_EquipActor
  1153.  
  1154. #==============================================================================
  1155. # ■ Scene_Equip
  1156. #==============================================================================
  1157.  
  1158. class Scene_Equip < Scene_MenuBase
  1159.  
  1160.   #--------------------------------------------------------------------------
  1161.   # overwrite method: create_status_window
  1162.   #--------------------------------------------------------------------------
  1163.   def create_status_window
  1164.     wx = Graphics.width - (Graphics.width * 2 / 5)
  1165.     wy = @help_window.height + 120
  1166.     @status_window = Window_EquipStatus.new(wx, wy)
  1167.     @status_window.viewport = @viewport
  1168.     @status_window.actor = @actor
  1169.   end
  1170.  
  1171.   #--------------------------------------------------------------------------
  1172.   # overwrite method: create_command_window
  1173.   #--------------------------------------------------------------------------
  1174.   def create_command_window
  1175.     wx = 0
  1176.     wy = @help_window.height
  1177.     ww = 160
  1178.     @command_window = Window_EquipCommand.new(wx, wy, ww)
  1179.     @command_window.viewport = @viewport
  1180.     @command_window.help_window = @help_window
  1181.     if !$game_temp.scene_equip_index.nil?
  1182.       @command_window.select($game_temp.scene_equip_index)
  1183.       @command_window.oy = $game_temp.scene_equip_oy
  1184.     end
  1185.     $game_temp.scene_equip_index = nil
  1186.     $game_temp.scene_equip_oy = nil
  1187.     @command_window.set_handler(:equip,    method(:command_equip))
  1188.     @command_window.set_handler(:optimize, method(:command_optimize))
  1189.     @command_window.set_handler(:clear,    method(:command_clear))
  1190.     @command_window.set_handler(:cancel,   method(:return_scene))
  1191.     @command_window.set_handler(:pagedown, method(:next_actor))
  1192.     @command_window.set_handler(:pageup,   method(:prev_actor))
  1193.     process_custom_equip_commands
  1194.     create_actor_window
  1195.   end
  1196.  
  1197.   #--------------------------------------------------------------------------
  1198.   # new method: create_actor_window
  1199.   #--------------------------------------------------------------------------
  1200.   def create_actor_window
  1201.     wy = @help_window.height
  1202.     @actor_window = Window_EquipActor.new(@command_window.width, wy)
  1203.     @actor_window.viewport = @viewport
  1204.     @actor_window.actor = @actor
  1205.   end
  1206.  
  1207.   #--------------------------------------------------------------------------
  1208.   # new method: process_custom_equip_commands
  1209.   #--------------------------------------------------------------------------
  1210.   def process_custom_equip_commands
  1211.     for command in YEA::EQUIP::COMMAND_LIST
  1212.       next unless YEA::EQUIP::CUSTOM_EQUIP_COMMANDS.include?(command)
  1213.       called_method = YEA::EQUIP::CUSTOM_EQUIP_COMMANDS[command][3]
  1214.       @command_window.set_handler(command, method(called_method))
  1215.     end
  1216.   end
  1217.  
  1218.   #--------------------------------------------------------------------------
  1219.   # overwrite method: create_slot_window
  1220.   #--------------------------------------------------------------------------
  1221.   def create_slot_window
  1222.     wx = 0
  1223.     wy = @command_window.y + @command_window.height
  1224.     ww = Graphics.width - @status_window.width
  1225.     @slot_window = Window_EquipSlot.new(wx, wy, ww)
  1226.     @slot_window.viewport = @viewport
  1227.     @slot_window.help_window = @help_window
  1228.     @slot_window.status_window = @status_window
  1229.     @slot_window.actor = @actor
  1230.     @slot_window.set_handler(:ok,       method(:on_slot_ok))
  1231.     @slot_window.set_handler(:cancel,   method(:on_slot_cancel))
  1232.   end
  1233.  
  1234.   #--------------------------------------------------------------------------
  1235.   # overwrite method: create_item_window
  1236.   #--------------------------------------------------------------------------
  1237.   def create_item_window
  1238.     wx = @slot_window.x
  1239.     wy = @slot_window.y
  1240.     ww = @slot_window.width
  1241.     wh = @slot_window.height
  1242.     @item_window = Window_EquipItem.new(wx, wy, ww, wh)
  1243.     @item_window.viewport = @viewport
  1244.     @item_window.help_window = @help_window
  1245.     @item_window.status_window = @status_window
  1246.     @item_window.actor = @actor
  1247.     @item_window.set_handler(:ok,     method(:on_item_ok))
  1248.     @item_window.set_handler(:cancel, method(:on_item_cancel))
  1249.     @slot_window.item_window = @item_window
  1250.     @item_window.hide
  1251.   end
  1252.  
  1253.   #--------------------------------------------------------------------------
  1254.   # alias method: command_optimize
  1255.   #--------------------------------------------------------------------------
  1256.   alias scene_equip_command_optimize_aee command_optimize
  1257.   def command_optimize
  1258.     scene_equip_command_optimize_aee
  1259.     @actor_window.refresh
  1260.   end
  1261.  
  1262.   #--------------------------------------------------------------------------
  1263.   # alias method: command_clear
  1264.   #--------------------------------------------------------------------------
  1265.   alias scene_equip_command_clear_aee command_clear
  1266.   def command_clear
  1267.     scene_equip_command_clear_aee
  1268.     @actor_window.refresh
  1269.   end
  1270.  
  1271.   #--------------------------------------------------------------------------
  1272.   # alias method: on_slot_ok
  1273.   #--------------------------------------------------------------------------
  1274.   alias scene_equip_on_slot_ok_aee on_slot_ok
  1275.   def on_slot_ok
  1276.     scene_equip_on_slot_ok_aee
  1277.     @slot_window.hide
  1278.     @item_window.refresh
  1279.     @item_window.show
  1280.   end
  1281.  
  1282.   #--------------------------------------------------------------------------
  1283.   # alias method: on_item_ok
  1284.   #--------------------------------------------------------------------------
  1285.   alias scene_equip_on_item_ok_aee on_item_ok
  1286.   def on_item_ok
  1287.     scene_equip_on_item_ok_aee
  1288.     @actor_window.refresh
  1289.     @slot_window.show
  1290.     @item_window.hide
  1291.   end
  1292.  
  1293.   #--------------------------------------------------------------------------
  1294.   # alias method: on_item_cancel
  1295.   #--------------------------------------------------------------------------
  1296.   alias scene_equip_on_item_cancel_aee on_item_cancel
  1297.   def on_item_cancel
  1298.     scene_equip_on_item_cancel_aee
  1299.     @slot_window.show
  1300.     @item_window.hide
  1301.   end
  1302.  
  1303.   #--------------------------------------------------------------------------
  1304.   # alias method: on_actor_change
  1305.   #--------------------------------------------------------------------------
  1306.   alias scene_equip_on_actor_change_aee on_actor_change
  1307.   def on_actor_change
  1308.     scene_equip_on_actor_change_aee
  1309.     @actor_window.actor = @actor
  1310.   end
  1311.  
  1312.   #--------------------------------------------------------------------------
  1313.   # new method: command_name1
  1314.   #--------------------------------------------------------------------------
  1315.   def command_name1
  1316.     # Do nothing.
  1317.   end
  1318.  
  1319.   #--------------------------------------------------------------------------
  1320.   # new method: command_name2
  1321.   #--------------------------------------------------------------------------
  1322.   def command_name2
  1323.     # Do nothing.
  1324.   end
  1325.  
  1326. end # Scene_Equip
  1327.  
  1328. #==============================================================================
  1329. #
  1330. # ▼ End of File
  1331. #
  1332. #==============================================================================
RAW Paste Data