Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # // Last Modified :06/08/2011
- #==============================================================================#
- # FRV::ITEM_SYSTEM
- #==============================================================================#
- module FRV
- module ITEM_SYSTEM
- ITEM_GROUPS = [
- "Items",
- "Equipment",
- "Key Items",
- ]
- end
- end
- #==============================================================================#
- # RPG::BaseItem
- #==============================================================================#
- class RPG::BaseItem
- #--------------------------------------------------------------------------#
- # * Public Instance Variables
- #--------------------------------------------------------------------------#
- attr_accessor :sort_group
- #--------------------------------------------------------------------------#
- # * new method :frv_ite_baseitem_cache
- #--------------------------------------------------------------------------#
- def frv_ite_baseitem_cache()
- @sort_group = []
- case self
- when RPG::Armor
- @sort_group << "Armors".upcase()
- @sort_group << "Equipment".upcase()
- when RPG::Item
- if @price > 0
- @sort_group << "Items".upcase()
- else
- @sort_group << "Key Items".upcase()
- end
- when RPG::Weapon
- @sort_group << "Weapons".upcase()
- @sort_group << "Equipment".upcase()
- when RPG::Skill
- @sort_group << "Skill".upcase()
- end
- end
- end
- #==============================================================================#
- # Game_System
- #==============================================================================#
- class Game_System
- #--------------------------------------------------------------------------#
- # * Public Instance Variables
- #--------------------------------------------------------------------------#
- attr_accessor :item_groups
- #--------------------------------------------------------------------------#
- # * alias method :initialize
- #--------------------------------------------------------------------------#
- alias :ieo_frv_gs_initialize :initialize unless $@
- def initialize()
- ieo_frv_gs_initialize()
- @item_groups = ::FRV::ITEM_SYSTEM::ITEM_GROUPS
- end
- end
- #==============================================================================#
- # Window_ItemHelp
- #==============================================================================#
- class Window_ItemHelp < IRS::Sprite_Help ; end
- #==============================================================================#
- # Window_ItemCommand
- #==============================================================================#
- class Window_ItemCommand < Window_Command ; end
- #==============================================================================#
- # Window_ItemSorted
- #==============================================================================#
- class Window_ItemSorted < Window_Item
- #--------------------------------------------------------------------------#
- # * Public Instance Variables
- #--------------------------------------------------------------------------#
- attr_accessor :sort_group
- #--------------------------------------------------------------------------#
- # * overwrite method :initialize
- #--------------------------------------------------------------------------#
- def include?( item )
- @sort_group = $game_system.item_groups[0] if @sort_group.nil?()
- return false if item == nil
- return unless item.sort_group.include?( @sort_group.upcase )
- if $game_temp.in_battle
- return false unless item.is_a?(RPG::Item)
- end
- return true
- end
- end
- #==============================================================================#
- # Scene_Title
- #==============================================================================#
- class Scene_Title < Scene_Base
- #--------------------------------------------------------------------------#
- # * alias method :load_database
- #--------------------------------------------------------------------------#
- alias :frv_ite_sct_load_database :load_database unless $@
- def load_database()
- frv_ite_sct_load_database()
- load_frv_ite_cache()
- end
- #--------------------------------------------------------------------------#
- # * alias method :load_bt_database
- #--------------------------------------------------------------------------#
- alias :frv_ite_sct_load_bt_database :load_database unless $@
- def load_bt_database()
- frv_ite_sct_load_bt_database()
- load_frv_ite_cache()
- end
- #--------------------------------------------------------------------------#
- # * new method :load_ieo003_cache
- #--------------------------------------------------------------------------#
- def load_frv_ite_cache()
- objs = [$data_items, $data_weapons, $data_armors]
- objs.each { |group| group.each { |obj|
- next if obj.nil?() ; obj.frv_ite_baseitem_cache() } }
- end
- end
- #==============================================================================#
- # Scene_Item
- #==============================================================================#
- class Scene_Item < Scene_Base
- #--------------------------------------------------------------------------#
- # * overwrite method :start
- #--------------------------------------------------------------------------#
- def start()
- super()
- create_menu_background()
- @viewport = Viewport.new( 0, 0, Graphics.width, Graphics.height )
- @help_window = Window_ItemHelp.new( 0, 0, Graphics.width, 32 )
- @help_window.viewport = @viewport
- @group_window = Window_ItemCommand.new( Graphics.width,
- $game_system.item_groups, $game_system.item_groups.size )
- @group_window.y = @help_window.height
- @group_window.active = false
- @item_window = Window_ItemSorted.new( 0, 32+56,
- Graphics.width, Graphics.height-32-56-32 )
- @item_window.viewport = @viewport
- @item_window.help_window = @help_window
- @item_window.active = false
- @target_window = Window_MenuStatus.new(0, 0)
- @inputhelp_window = Window_ItemHelp.new( 0, Graphics.height-32, Graphics.width, 32 )
- @inputhelp_window.align = 1
- @inputhelp_window.set_text("Use A and S to switch Catergories")
- hide_target_window()
- # // ----------------------------------------------------------------- // #
- @menuback_sprite.bitmap = Cache.system( "Menu_background" )
- @menuback_sprite.opacity= 255
- end
- #--------------------------------------------------------------------------#
- # * overwrite method :terminate
- #--------------------------------------------------------------------------#
- def terminate()
- super()
- dispose_menu_background()
- @viewport.dispose()
- @help_window.dispose()
- @item_window.dispose()
- @target_window.dispose()
- @group_window.dispose()
- @inputhelp_window.dispose()
- end
- #--------------------------------------------------------------------------#
- # * overwrite method :update
- #--------------------------------------------------------------------------#
- def update
- super
- update_menu_background()
- @help_window.update()
- @item_window.update()
- @target_window.update()
- if @item_window.active
- update_group_selection()
- update_item_selection()
- elsif @target_window.active
- update_target_selection()
- end
- end
- #--------------------------------------------------------------------------#
- # * new method :update_group_selection
- #--------------------------------------------------------------------------#
- def update_group_selection()
- @group_window.update()
- if Input.trigger?(Input::X)
- Sound.play_cursor()
- @group_window.index = (@group_window.index - 1) % @group_window.item_max
- @item_window.sort_group = @group_window.commands[@group_window.index]
- @item_window.refresh()
- @item_window.index = 0
- elsif Input.trigger?(Input::Y)
- Sound.play_cursor()
- @group_window.index = (@group_window.index + 1) % @group_window.item_max
- @item_window.sort_group = @group_window.commands[@group_window.index]
- @item_window.refresh()
- @item_window.index = 0
- end
- end
- end
- #=*==========================================================================*=#
- # ** END OF FILE
- #=*==========================================================================*=#
Advertisement
Add Comment
Please, Sign In to add comment