Started by TrueCynder, January 31, 2014, 07:27:51 pm
#==============================================================================# ** Window_EquipItem#------------------------------------------------------------------------------# This window displays choices when opting to change equipment on the# equipment screen.#==============================================================================class Window_EquipItem < Window_Selectable #-------------------------------------------------------------------------- # * Refresh #-------------------------------------------------------------------------- def refresh if self.contents != nil self.contents.dispose self.contents = nil end @data = [] # Add equippable weapons if @equip_type == 0 weapon_set = $data_classes[@actor.class_id].weapon_set for i in 1...$data_weapons.size if $game_party.weapon_number(i) > 0 and weapon_set.include?(i) @data.push($data_weapons[i]) end end end # Add equippable armor if @equip_type != 0 armor_set = $data_classes[@actor.class_id].armor_set for i in 1...$data_armors.size if $game_party.armor_number(i) > 0 and armor_set.include?(i) @data.push($data_armors[i]) end end end # Add blank page @data.push(nil) # Make a bit map and draw all items @item_max = @data.size self.contents = Bitmap.new(width - 32, row_max * 32) for i in 0...@item_max-1 draw_item(i) end endend#==============================================================================# ** Scene_Equip#------------------------------------------------------------------------------# This class performs equipment screen processing.#==============================================================================class Scene_Equip #-------------------------------------------------------------------------- # * Main Processing #-------------------------------------------------------------------------- def main # Get actor @actor = $game_party.actors[@actor_index] # Make windows @help_window = Window_Help.new @help_window. y = 50 @left_window = Window_EquipLeft.new(@actor) @left_window. y = 100 @right_window = Window_EquipRight.new(@actor) @right_window. y = 100 @item_window1 = Window_EquipItem.new(@actor, 0) @item_window1. y = 292 @item_window2 = Window_EquipItem.new(@actor, 1) @item_window2. y = 292 # Associate help window @right_window.help_window = @help_window @item_window1.help_window = @help_window @item_window2.help_window = @help_window # Set cursor position @right_window.index = @equip_index refresh # Execute transition Graphics.transition # Main loop loop do # Update game screen Graphics.update # Update input information Input.update # Frame update update # Abort loop if screen is changed if $scene != self break end end # Prepare for transition Graphics.freeze # Dispose of windows @help_window.dispose @left_window.dispose @right_window.dispose @item_window1.dispose @item_window2.dispose end #-------------------------------------------------------------------------- # * Refresh #-------------------------------------------------------------------------- def refresh # Set item window to visible @item_window1.visible = (@right_window.index == 0) @item_window2.visible = (@right_window.index >= 1) # Get currently equipped item item1 = @right_window.item # Set current item window to @item_window case @right_window.index when 0 @item_window = @item_window1 when 1 @item_window = @item_window2 when 2 @item_window = @item_window2 when 3 @item_window = @item_window2 end # If right window is active if @right_window.active # Erase parameters for after equipment change @left_window.set_new_parameters( nil, nil, nil) end # If item window is active if @item_window.active # Get currently selected item item2 = @item_window.item # Change equipment last_hp = @actor.hp last_sp = @actor.sp @actor.equip(@right_window.index, item2 == nil ? 0 : item2.id) # Get parameters for after equipment change new_atk = @actor.atk new_pdef = @actor.pdef new_mdef = @actor.mdef # Return equipment @actor.equip(@right_window.index, item1 == nil ? 0 : item1.id) @actor.hp = last_hp @actor.sp = last_sp # Draw in left window @left_window.set_new_parameters(new_atk, new_pdef, new_mdef) end endend
#-------------------------------------------------------------------------- # * Refresh #-------------------------------------------------------------------------- def refresh if self.contents != nil self.contents.dispose self.contents = nil end @data = [] # Add equippable armor armor_set = $data_classes[@actor.class_id].armor_set for i in 1...$data_armors.size if $game_party.armor_number(i) > 0 and armor_set.include?(i) # If shield slot if @equip_type == 1 # Only add equip if it is a Shield type @data.push($data_armors[i]) if $data_armors[i].kind == 0 else # Push accessories but not Shields @data.push($data_armors[i]) if $data_armors[i].kind != 0 end end end # Add blank page @data.push(nil) # Make a bit map and draw all items @item_max = @data.size self.contents = Bitmap.new(width - 32, row_max * 32) for i in 0...@item_max-1 draw_item(i) end end
@item_window1 = Window_EquipItem.new(@actor, 1) # Shield slot @item_window1. y = 292 @item_window2 = Window_EquipItem.new(@actor, 2) # 4-anything slots @item_window2. y = 292
# Set current item window to @item_window if @right_window.index == 0 @item_window = @item_window1 else @item_window = @item_window2 end