Guest User

Untitled

a guest
Mar 13th, 2014
256
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 10.98 KB | None | 0 0
  1. =begin
  2. ===============================================================================
  3.  Expanded Item Categories (25/01/2013)
  4. -------------------------------------------------------------------------------
  5.  Created By: Shadowmaster/Shadowmaster9000/Shadowpasta
  6.  (www.crimson-castle.co.uk)
  7.  
  8. ===============================================================================
  9.  Information
  10. -------------------------------------------------------------------------------
  11.  This script adds more categories to your item and shop menus, such as
  12.  seperate armor categories, and a category for all items together. This script
  13.  also allows you to change the order that the categories appear in, as well
  14.  as how many appear on the screen at the same time.
  15.  
  16.  As a bonus, this script fixes a bug with horizontal window scrolling through
  17.  commands that prevented you from viewing all items if the maximum number of
  18.  items was double the amount of the maximum viewable at once.
  19.  
  20. ===============================================================================
  21.  How to Use
  22. -------------------------------------------------------------------------------
  23.  Place this script under Materials, preferably below any item altering scripts.
  24.  
  25.  Further down are some options you can change to your liking.
  26.  
  27. ===============================================================================
  28.  Required
  29. -------------------------------------------------------------------------------
  30.  Nothing.
  31.  
  32. ===============================================================================
  33.  Change log
  34. -------------------------------------------------------------------------------
  35.  v1.0: First release. (25/01/2013)
  36.  
  37. ===============================================================================
  38.  Terms of Use
  39. -------------------------------------------------------------------------------
  40.  * Free to use for both commercial and non-commerical projects.
  41.  * Credit me if used.
  42.  * Do not claim this as your own.
  43.  * You're free to post this on other websites, but please credit me and keep
  44.  the header intact.
  45.  * If you want to release any modifications/add-ons for this script, you must
  46.  use the same Terms of Use as this script uses.
  47.  * If you want to use your own seperate Terms of Use for your version or
  48.  add-ons of this script, you must contact me at http://www.rpgmakervxace.net
  49.  or www.crimson-castle.co.uk
  50.  
  51. ===============================================================================
  52. =end
  53. $imported = {} if $imported.nil?
  54. $imported["ExpandedItemCategories"] = true
  55.  
  56. module Itemlist
  57.  
  58. #==============================================================================
  59. # ** List of Categories
  60. #------------------------------------------------------------------------------
  61. #  Below are the list of categories available in this script. You can change
  62. #  the order of the categories to your pleasing, as well as their names and
  63. #  even remove any categories you don't want. I will record the list of all
  64. #  available categories here if in case you forget any of them.
  65. #
  66. #  :all_item         (Displays all items)
  67. #  :item             (Displays normal items)
  68. #  :weapon           (Displays all weapons)
  69. #  :armor            (Displays all armor gear)
  70. #  :armor_shield     (Displays shields only)
  71. #  :armor_head       (Displays head gear only)
  72. #  :armor_body       (Displays body gear only)
  73. #  :armor_accessory  (Displays accessories only)
  74. #  :key_item         (Displays key items)
  75. #==============================================================================
  76.  
  77.   Categories =[ # Do not remove this.
  78.     # [:all_item, "All"],
  79.       [:item, "Item"],
  80.       [:weapon, "Weapon"],  
  81.       [:armor, "Armor"],
  82.      # [:armor_shield, "Shields"],
  83.      # [:armor_head, "Head Gear"],
  84.      # [:armor_body, "Body Gear"],
  85.      # [:armor_accessory, "Accessory"],
  86.       [:armor_rune, "Rune"],
  87.       [:key_item, "Key Item"],
  88.       #[:armor_rune, "Runes"],
  89.     ] # Do not remove this.
  90.  
  91. #==============================================================================
  92. # ** Category Help Descriptions
  93. #------------------------------------------------------------------------------
  94. #  These set what text appears in the help window when you are viewing the
  95. #  item categories. If you want to leave them blank, just leave empty ""
  96. #  behind.
  97. #==============================================================================
  98.    
  99.   All_Item_Help_Info = "Viewing all items."
  100.   Item_Help_Info = "Viewing normal items."
  101.   Weapon_Help_Info = "Viewing all weapons."
  102.   Armor_Help_Info = "Viewing all armors."
  103.   Armor_Shield_Help_Info = "Viewing all shields."
  104.   Armor_Head_Help_Info = "Viewing head gear."
  105.   Armor_Body_Help_Info = "Viewing body gear."
  106.   Armor_Accessory_Help_Info = "Viewing accessories."
  107.   Key_Item_Help_Info = "Viewing important items."
  108.   Armor_Rune_Help_Info = "Viewing runes."
  109.  
  110. #==============================================================================
  111. # ** Max Columns
  112. #------------------------------------------------------------------------------
  113. #  This sets how many item categories you can view on the screen at one time.
  114. #  If the number of item categories exceed the number of maximum columns, you
  115. #  will be able to scroll through the window to see the rest of the item
  116. #  categories.
  117. #==============================================================================
  118.  
  119.   Max_Columns = 5
  120.  
  121. end
  122.  
  123. #==============================================================================
  124. # ** DO NOT edit anything below this unless if you know what you're doing!
  125. #==============================================================================
  126.      
  127. class RPG::Armor
  128.  
  129.   def armor_shield?
  130.     @etype_id == 1
  131.   end
  132.   def armor_head?
  133.     @etype_id == 2
  134.   end
  135.   def armor_body?
  136.     @etype_id == 3
  137.   end
  138.   def armor_accessory?
  139.     @etype_id == 4
  140.   end
  141.    def armor_rune?
  142.     @etype_id == 5
  143.   end
  144.  
  145. end
  146.  
  147. #==============================================================================
  148. # ** Window_HorzCommand
  149. #------------------------------------------------------------------------------
  150. #  This is a command window for the horizontal selection format.
  151. #==============================================================================
  152.  
  153. class Window_HorzCommand < Window_Command
  154.   #--------------------------------------------------------------------------
  155.   # * Set Leading Digits
  156.   #--------------------------------------------------------------------------
  157.   def top_col=(col)
  158.     col = 0 if col < 0
  159.     self.ox = col * (item_width + spacing)
  160.   end
  161. end
  162.  
  163. #==============================================================================
  164. # ** Window_ItemCategory
  165. #------------------------------------------------------------------------------
  166. #  This window is for selecting a category of normal items and equipment
  167. # on the item screen or shop screen.
  168. #==============================================================================
  169.  
  170. class Window_ItemCategory < Window_HorzCommand
  171.   #--------------------------------------------------------------------------
  172.   # * Get Digit Count
  173.   #--------------------------------------------------------------------------
  174.   def col_max
  175.     return Itemlist::Max_Columns
  176.   end
  177.   #--------------------------------------------------------------------------
  178.   # * Create Command List
  179.   #--------------------------------------------------------------------------
  180.   def make_command_list
  181.     Itemlist::Categories.each { |symbol, label|
  182.           add_command(label, symbol)
  183.         }
  184.   end
  185.   #--------------------------------------------------------------------------
  186.   # * Update Help Text
  187.   #--------------------------------------------------------------------------
  188.   def update_help
  189.     @help_window.clear
  190.     case current_symbol
  191.     when :all_item
  192.       @help_window.set_text(Itemlist::All_Item_Help_Info)
  193.     when :item
  194.       @help_window.set_text(Itemlist::Item_Help_Info)
  195.     when :weapon
  196.       @help_window.set_text(Itemlist::Weapon_Help_Info)
  197.     when :armor
  198.       @help_window.set_text(Itemlist::Armor_Help_Info)
  199.     when :armor_shield
  200.       @help_window.set_text(Itemlist::Armor_Shield_Help_Info)
  201.     when :armor_head
  202.       @help_window.set_text(Itemlist::Armor_Head_Help_Info)
  203.     when :armor_body
  204.       @help_window.set_text(Itemlist::Armor_Body_Help_Info)
  205.     when :armor_accessory
  206.       @help_window.set_text(Itemlist::Armor_Accessory_Help_Info)
  207.     when :key_item
  208.       @help_window.set_text(Itemlist::Key_Item_Help_Info)
  209.     when :armor_rune
  210.       @help_window.set_text(Itemlist::Armor_Rune_Help_Info)
  211.     else
  212.       @help_window.clear
  213.     end
  214.   end
  215. end
  216.  
  217. #==============================================================================
  218. # ** Window_ItemList
  219. #------------------------------------------------------------------------------
  220. #  This window displays a list of party items on the item screen.
  221. #==============================================================================
  222.  
  223. class Window_ItemList < Window_Selectable
  224.   #--------------------------------------------------------------------------
  225.   # * Include in Item List?
  226.   #--------------------------------------------------------------------------
  227.   def include?(item)
  228.     case @category
  229.     when :all_item
  230.       item.is_a?(RPG::Item) || item.is_a?(RPG::Weapon) || item.is_a?(RPG::Armor)
  231.     when :item
  232.       item.is_a?(RPG::Item) #&& !item.key_item?
  233.     when :weapon
  234.       item.is_a?(RPG::Weapon)
  235.     when :armor
  236.        item.is_a?(RPG::Armor) && item.armor_shield? || item.is_a?(RPG::Armor) && item.armor_head? || item.is_a?(RPG::Armor) && item.armor_body? ||  item.is_a?(RPG::Armor) && item.armor_accessory?
  237.     when :armor_shield
  238.       item.is_a?(RPG::Armor) && item.armor_shield?
  239.     when :armor_head
  240.       item.is_a?(RPG::Armor) && item.armor_head?
  241.     when :armor_body
  242.       item.is_a?(RPG::Armor) && item.armor_body?
  243.     when :armor_accessory
  244.       item.is_a?(RPG::Armor) && item.armor_accessory?
  245.     when :key_item
  246.       item.is_a?(RPG::Item) && item.key_item?
  247.      when :armor_rune
  248.       item.is_a?(RPG::Armor) && item.armor_rune?
  249.     else
  250.       false
  251.     end
  252.   end
  253. end
  254.  
  255. #==============================================================================
  256. # ** Scene_Shop
  257. #------------------------------------------------------------------------------
  258. #  This class performs shop screen processing.
  259. #==============================================================================
  260.  
  261. class Scene_Shop < Scene_MenuBase
  262.   #--------------------------------------------------------------------------
  263.   # * Start Processing
  264.   #--------------------------------------------------------------------------
  265.   alias start_itemlist start
  266.   def start
  267.     super
  268.     start_itemlist
  269.     @help_window.clear
  270.   end
  271.   #--------------------------------------------------------------------------
  272.   # * Category [Cancel]
  273.   #--------------------------------------------------------------------------
  274.   alias on_category_cancel_itemlist on_category_cancel
  275.   def on_category_cancel
  276.     on_category_cancel_itemlist
  277.     @help_window.clear
  278.   end
  279. end
Advertisement
Add Comment
Please, Sign In to add comment