khanhdu

Very Simple Item Menu Edit

Jul 25th, 2017
269
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 4.21 KB | None | 0 0
  1. =begin
  2. #--------------------------------------------------------------------------
  3. #Very Simple Item Menu Edit
  4. #Version 1,0
  5. #June 6, 2014
  6. #By smallhobbit (or lemongreen)
  7. #--------------------------------------------------------------------------
  8. A simple edit to the item menu so it only shows Items and Key Items as well as
  9. gets rid of the Help Text; also, only regular Items have numbers. Supposed to
  10. emulate the item menu from "Mad Father"
  11.  
  12. Just paste it in above Main and it'll work. (though probably not with other
  13. Item menu changing scripts)
  14. =end
  15.  
  16.  
  17. class Window_ItemCategory < Window_HorzCommand
  18.   #--------------------------------------------------------------------------
  19.   # * Get Window Width
  20.   #--------------------------------------------------------------------------
  21.   def window_width
  22.     Graphics.width/2
  23.   end
  24.   #--------------------------------------------------------------------------
  25.   # * Get Digit Count (changed number)
  26.   #--------------------------------------------------------------------------
  27.   def col_max
  28.     return 2
  29.   end
  30.   #--------------------------------------------------------------------------
  31.   # * Create Command List (Items & Key Items only)
  32.   #--------------------------------------------------------------------------
  33.   def make_command_list
  34.     add_command(Vocab::item,     :item)
  35.     add_command(Vocab::key_item, :key_item)
  36.   end
  37. end
  38.  
  39. class Window_ItemList < Window_Selectable
  40.   #--------------------------------------------------------------------------
  41.   # * Get Digit Count (changed number)
  42.   #--------------------------------------------------------------------------
  43.   def col_max
  44.     return 1
  45.   end
  46.   #--------------------------------------------------------------------------
  47.   # * Include in Item List? (removed weapons and armor)
  48.   #--------------------------------------------------------------------------
  49.   def include?(item)
  50.     case @category
  51.     when :item
  52.       item.is_a?(RPG::Item) && !item.key_item?
  53.     when :key_item
  54.       item.is_a?(RPG::Item) && item.key_item?
  55.     else
  56.       false
  57.     end
  58.   end
  59.   #--------------------------------------------------------------------------
  60.   # * Draw Item (changed draw_item_number)
  61.   #--------------------------------------------------------------------------
  62.   def draw_item(index)
  63.     item = @data[index]
  64.       rect = item_rect(index)
  65.       rect.width -= 4
  66.       draw_item_name(item, rect.x, rect.y, enable?(item))
  67.      if item.is_a?(RPG::Item) && !item.key_item?
  68.       draw_item_number(rect, item)
  69.     else
  70.       false
  71.     end
  72.   end
  73.   #--------------------------------------------------------------------------
  74.   # * Draw Number of Items
  75.   #--------------------------------------------------------------------------
  76.   def draw_item_number(rect, item)
  77.     draw_text(rect, sprintf(":%2d", $game_party.item_number(item)), 2)
  78.   end
  79. end
  80.  
  81. class Scene_Item < Scene_ItemBase
  82.   #--------------------------------------------------------------------------
  83.   # * Start Processing (removed help window
  84.   #--------------------------------------------------------------------------
  85.   def start
  86.     super
  87.     create_category_window
  88.     create_item_window
  89.   end
  90.   #--------------------------------------------------------------------------
  91.   # * Create Category Window
  92.   #--------------------------------------------------------------------------
  93.   def create_category_window
  94.     @category_window = Window_ItemCategory.new
  95.     @category_window.viewport = @viewport
  96.     @category_window.y = 20
  97.     @category_window.set_handler(:ok,     method(:on_category_ok))
  98.     @category_window.set_handler(:cancel, method(:return_scene))
  99.   end
  100.   #--------------------------------------------------------------------------
  101.   # * Create Item Window
  102.   #--------------------------------------------------------------------------
  103.   def create_item_window
  104.     wy = @category_window.y + @category_window.height
  105.     wh = Graphics.height - 150
  106.     @item_window = Window_ItemList.new(0, wy, Graphics.width/2, wh)
  107.     @item_window.viewport = @viewport
  108.     @item_window.set_handler(:ok,     method(:on_item_ok))
  109.     @item_window.set_handler(:cancel, method(:on_item_cancel))
  110.     @category_window.item_window = @item_window
  111.   end
  112. end
Advertisement
Add Comment
Please, Sign In to add comment