Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # ------------------------------------------------------------------------------
- # Manual Item Sorting v1.0
- # FenixFyreX
- # RPG Maker VXAce
- # ------------------------------------------------------------------------------
- # This script allows manual sorting of items, weapons, armors, and skills.
- # It is completely Plug-and-Play.
- # All you do is select each item once to move items around. Selecting the same
- # item twice selects the item like normal.
- # ------------------------------------------------------------------------------
- # DO NOT EDIT BELOW UNLESS YOU KNOW WHAT YOU ARE DOING
- # ------------------------------------------------------------------------------
- class Game_System
- attr_reader :item_order, :weapon_order, :armor_order, :skill_order
- alias initialize_item_skill_order_fyx initialize
- def initialize(*argv, &argb)
- initialize_item_skill_order_fyx(*argv, &argb)
- setup_orders
- end
- def setup_orders
- @item_order = $data_items.map {|item| item ? item.id : 0 }
- @weapon_order = $data_weapons.map {|wep| wep ? wep.id : 0 }
- @armor_order = $data_armors.map {|arm| arm ? arm.id : 0 }
- @skill_order = []
- $data_actors.each do |actor|
- if actor
- @skill_order[actor.id] = $data_skills.map {|skill| skill ? skill.id : 0 }
- end
- end
- end
- def swap_item_order(id, id2)
- idx1 = @item_order.index(id)
- idx2 = @item_order.index(id2)
- @item_order[idx1], @item_order[idx2] = @item_order[idx2], @item_order[idx1]
- end
- def swap_weapon_order(id, id2)
- idx1 = @weapon_order.index(id)
- idx2 = @weapon_order.index(id2)
- @weapon_order[idx1], @weapon_order[idx2] = @weapon_order[idx2], @weapon_order[idx1]
- end
- def swap_armor_order(id, id2)
- idx1 = @armor_order.index(id)
- idx2 = @armor_order.index(id2)
- @armor_order[idx1], @armor_order[idx2] = @armor_order[idx2], @armor_order[idx1]
- end
- def swap_skill_order(aid, id, id2)
- idx1 = @skill_order[aid].index(id)
- idx2 = @skill_order[aid].index(id2)
- @skill_order[aid][idx1], @skill_order[aid][idx2] =
- @skill_order[aid][idx2], @skill_order[aid][idx1]
- end
- end
- class Window_Selectable
- def draw_item_cursor_fade(index)
- contents.fill_rect(item_rect(index), Color.new(0,0,0,100))
- end
- end
- class Window_ItemList
- def process_ok
- if (@bypass_switch_ids && (item.id == @bypass_index))
- @bypass_switch_ids = @bypass_index = nil
- super
- elsif (@bypass_switch_ids && (item.id != @bypass_index))
- process_switch_order
- elsif !@bypass_switch_ids
- if item
- Sound.play_ok
- @bypass_switch_ids = true
- @bypass_index = item ? item.id : 0
- refresh
- else
- @bypass_switch_ids = @bypass_index = nil
- super
- end
- end
- end
- alias process_cancel_bypass_swap process_cancel
- def process_cancel(*argv, &argb)
- @bypass_switch_ids = @bypass_index = nil
- refresh
- process_cancel_bypass_swap(*argv, &argb)
- end
- def process_switch_order
- Sound.play_ok
- swap_order(@bypass_index, item.id)
- @bypass_index = @bypass_switch_ids = nil
- refresh
- end
- def system_order_container
- case @category
- when :none
- []
- when :item, :key_item
- $game_system.item_order
- when :weapon
- $game_system.weapon_order
- when :armor
- $game_system.armor_order
- end
- end
- def swap_order(id1, id2)
- case @category
- when :item, :key_item
- $game_system.swap_item_order(id1, id2)
- when :weapon
- $game_system.swap_weapon_order(id1, id2)
- when :armor
- $game_system.swap_armor_order(id1, id2)
- end
- end
- alias sort_item_list_fyx make_item_list
- def make_item_list(*argv, &argb)
- sort_item_list_fyx(*argv, &argb)
- @data.sort_by! do |item|
- item ? system_order_container.index(item.id) : 0
- end
- @data
- end
- alias draw_item_fyx_swap_fade draw_item
- def draw_item(index, *argv, &argb)
- if @bypass_switch_ids
- idx = @data.index(@data.find {|i| i.id == @bypass_index})
- draw_item_cursor_fade(idx) if idx == index
- end
- draw_item_fyx_swap_fade(index, *argv, &argb)
- end
- end
- class Window_SkillList
- def process_ok
- if (@bypass_switch_ids && (item.id == @bypass_index))
- super
- elsif (@bypass_switch_ids && (item.id != @bypass_index))
- process_switch_order
- elsif !@bypass_switch_ids
- Sound.play_ok
- @bypass_switch_ids = true
- @bypass_index = item.id
- refresh
- end
- end
- alias process_cancel_bypass_swap process_cancel
- def process_cancel(*argv, &argb)
- @bypass_switch_ids = @bypass_index = nil
- refresh
- process_cancel_bypass_swap(*argv, &argb)
- end
- def process_switch_order
- Sound.play_ok
- $game_system.swap_skill_order(@actor.id, @bypass_index, item.id)
- @bypass_index = -1000
- @bypass_switch_ids = false
- refresh
- end
- alias sort_item_list_fyx make_item_list
- def make_item_list(*argv, &argb)
- sort_item_list_fyx(*argv, &argb)
- @data.sort_by! do |item|
- $game_system.skill_order[@actor.id].index(item.id)
- end
- @data
- end
- alias draw_item_fyx_swap_fade draw_item
- def draw_item(index, *argv, &argb)
- if @bypass_switch_ids
- idx = @data.index(@data.find {|i| i.id == @bypass_index})
- draw_item_cursor_fade(idx) if idx == index
- end
- draw_item_fyx_swap_fade(index, *argv, &argb)
- end
- end
- # ------------------------------------------------------------------------------
- # END OF SCRIPT
- # ------------------------------------------------------------------------------
RAW Paste Data