Advertisement
roninator2

Kid Friendly Basic Quest - Battle Item

Dec 13th, 2024
27
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 6.38 KB | None | 0 0
  1. # ╔═════════════════════════════════════╦════════════════════╗
  2. # ║ Title: KFBQ Battle Item Override    ║  Version: 1.00     ║
  3. # ║ Author: Roninator2                  ║                    ║
  4. # ╠═════════════════════════════════════╬════════════════════╣
  5. # ║ Function:                           ║   Date Created     ║
  6. # ║                                     ╠════════════════════╣
  7. # ║   FFMQ Style Battle Items           ║    12 Mar 2023     ║
  8. # ╚═════════════════════════════════════╩════════════════════╝
  9. # ╔══════════════════════════════════════════════════════════╗
  10. # ║ Instructions:                                            ║
  11. # ║                                                          ║
  12. # ║  none                                                    ║
  13. # ╚══════════════════════════════════════════════════════════╝
  14. # ╔══════════════════════════════════════════════════════════╗
  15. # ║ Terms of use:                                            ║
  16. # ║ Free for all uses in RPG Maker - Except nudity           ║
  17. # ╚══════════════════════════════════════════════════════════╝
  18.  
  19. #==============================================================================
  20. # ** Window_BattleItem
  21. #==============================================================================
  22. class KFBQ_BattleItem < Window_ItemList
  23.   #--------------------------------------------------------------------------
  24.   # * Object Initialization
  25.   #     info_viewport : Viewport for displaying information
  26.   #--------------------------------------------------------------------------
  27.   def initialize(help_window, info_viewport)
  28.     super(250, 280, 280, 100)
  29.     self.visible = false
  30.     self.tone.set(Color.new(0,0,0))
  31.     self.opacity = 255
  32.     self.back_opacity = 255
  33.     self.contents_opacity = 255
  34.     self.z = 400
  35.     @help_window = help_window
  36.     @info_viewport = info_viewport
  37.     update_padding
  38.     @data = []
  39.     select(0)
  40.   end
  41.   #--------------------------------------------------------------------------
  42.   # * Include in Item List?
  43.   #--------------------------------------------------------------------------
  44.   def include?(item)
  45.     $game_party.usable?(item)
  46.   end
  47.   #--------------------------------------------------------------------------
  48.   # * Show Window
  49.   #--------------------------------------------------------------------------
  50.   def show
  51.     select_last
  52.     @help_window.show
  53.     super
  54.   end
  55.   #--------------------------------------------------------------------------
  56.   # * Hide Window
  57.   #--------------------------------------------------------------------------
  58.   def hide
  59.     @help_window.hide
  60.     super
  61.   end
  62.   #--------------------------------------------------------------------------
  63.   # * Refresh
  64.   #--------------------------------------------------------------------------
  65.   def refresh
  66.     make_item_list
  67.     create_contents
  68.     draw_all_items
  69.     call_update_help
  70.   end
  71.   #--------------------------------------------------------------------------
  72.   # * Calculate Height of Window Contents
  73.   #--------------------------------------------------------------------------
  74.   def standard_padding
  75.     return 18
  76.   end
  77.   #--------------------------------------------------------------------------
  78.   # * Get Digit Count
  79.   #--------------------------------------------------------------------------
  80.   def col_max
  81.     return 4
  82.   end
  83.   #--------------------------------------------------------------------------
  84.   # * Item Rect
  85.   #--------------------------------------------------------------------------
  86.   def item_rect(index)
  87.     rect = Rect.new
  88.     rect.width = 60
  89.     rect.height = 60
  90.     rect.x = index % col_max * (60)
  91.     rect.y = index / col_max * (60) - 2
  92.     rect
  93.   end
  94.   #--------------------------------------------------------------------------
  95.   # * Create Skill List
  96.   #--------------------------------------------------------------------------
  97.   def make_item_list
  98.     @data = $game_party.all_items.select {|item| include?(item) }
  99.     @data.push(nil) if include?(nil)
  100.   end
  101.   #--------------------------------------------------------------------------
  102.   # * Update Cursor
  103.   #--------------------------------------------------------------------------
  104.   def update_cursor
  105.     ensure_cursor_visible
  106.     cursor_rect.set(item_rect(@index))
  107.     cursor_rect.y += 2
  108.   end
  109. end
  110.  
  111. #==============================================================================
  112. # ** Window_Item_Command
  113. #==============================================================================
  114. class KFBQ_Item_Command < Window_Base
  115.   #--------------------------------------------------------------------------
  116.   # * Iniatilize
  117.   #--------------------------------------------------------------------------
  118.   def initialize
  119.     super(40, 280, 200, fitting_height(1))
  120.     self.tone.set(Color.new(-255,-255,-255))
  121.     self.opacity = 255
  122.     self.arrows_visible = false
  123.     self.pause = false
  124.     self.back_opacity = 255
  125.     self.contents_opacity = 255
  126.     refresh
  127.   end
  128.   #--------------------------------------------------------------------------
  129.   # * Dispose
  130.   #--------------------------------------------------------------------------
  131.   def dispose
  132.     contents.dispose unless disposed?
  133.     super unless disposed?
  134.   end
  135.   #--------------------------------------------------------------------------
  136.   # * Refresh
  137.   #--------------------------------------------------------------------------
  138.   def refresh
  139.     contents.clear
  140.     name = "Item"
  141.     draw_text(0, 0, 180, line_height, name, 1)
  142.   end
  143. end
  144.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement