Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #-------------------------------------------------------------------------------
- # Don't remove this header!
- #-------------------------------------------------------------------------------
- # Item Unsort
- # by Trihan
- #
- # Version : 1.0
- #
- # This script is commissioned by Batworks Software.
- #-------------------------------------------------------------------------------
- #-------------------------------------------------------------------------------
- # Version History
- #-------------------------------------------------------------------------------
- # 1.0 - Initial script.
- #-------------------------------------------------------------------------------
- #-------------------------------------------------------------------------------
- # This script removes the sorting of items/equipment in favour of arranging them
- # in the order they were obtained.
- #-------------------------------------------------------------------------------
- class Game_Party < Game_Unit
- alias :tlb_itemsort_initialize :initialize
- def initialize
- tlb_itemsort_initialize
- @item_timestamps = {}
- @weapon_timestamps = {}
- @armor_timestamps = {}
- end
- alias :tlb_itemsort_gain_item :gain_item
- def gain_item(item, amount, include_equip = false)
- tlb_itemsort_gain_item(item, amount, include_equip)
- container = item_container(item.class)
- return unless container
- t_container = timestamp_container(item.class)
- return unless t_container
- if !container[item.id]
- t_container.delete(item.id)
- else
- return if t_container[item.id]
- t_container[item.id] = Graphics.frame_count
- end
- end
- def timestamp_container(item_class)
- return @item_timestamps if item_class == RPG::Item
- return @weapon_timestamps if item_class == RPG::Weapon
- return @armor_timestamps if item_class == RPG::Armor
- return nil
- end
- def items
- @item_timestamps = {} if !@item_timestamps
- @items.keys.sort.sort_by {|id| @item_timestamps[id] }.collect {|id| $data_items[id] }
- end
- def weapons
- @weapon_timestamps = {} if !@weapon_timestamps
- @weapons.keys.sort.sort_by {|id| @weapon_timestamps[id] }.collect {|id| $data_weapons[id] }
- end
- def armors
- @armor_timestamps = {} if !@armor_timestamps
- @armors.keys.sort.sort_by {|id| @armor_timestamps[id] }.collect {|id| $data_armors[id] }
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement