Advertisement
roninator2

Yanfly Class System Addons - Show Equip Types

Dec 9th, 2024
34
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 4.45 KB | None | 0 0
  1. #==============================================================================
  2. #
  3. # ▼ Yanfly Engine Ace - Class System v1.10 - addon
  4. # -- Last Updated: 2021.02.19
  5. # -- Requires: Yanfly Class System
  6. # -- addon created by: Roninator2
  7. #==============================================================================
  8. # ▼ Updates
  9. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  10. # 2021.02.17 - Started Script
  11. # 2021.02.19 - Finished Script
  12. #==============================================================================
  13. # ▼ Introduction
  14. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  15. # for showing class equip types in the class scene
  16. #==============================================================================
  17. class Window_ClassList < Window_Selectable
  18.   alias r2_equip_update_help    update_help
  19.   def update_help
  20.     r2_equip_update_help
  21.     draw_equip_class
  22.   end
  23.   #--------------------------------------------------------------------------
  24.   # * Move Cursor Up
  25.   #--------------------------------------------------------------------------
  26.   def cursor_up(wrap = false)
  27.     return if index == 0
  28.     if index >= col_max || (wrap && col_max == 1)
  29.       select((index - col_max + item_max) % item_max)
  30.     end
  31.   end
  32.   #--------------------------------------------------------------------------
  33.   # * Move Cursor Down
  34.   #--------------------------------------------------------------------------
  35.   def cursor_down(wrap = false)
  36.     return if index == item_max - 1
  37.     if index == 7
  38.       cursor_pagedown_list
  39.       @index = 8
  40.       cursor_rect.set(item_rect(@index))
  41.       select(8)
  42.     else
  43.     if index < item_max - col_max || (wrap && col_max == 1)
  44.       select((index + col_max) % item_max)
  45.     end
  46.     end
  47.   end
  48.   #--------------------------------------------------------------------------
  49.   # * Move Cursor One Page Down
  50.   #--------------------------------------------------------------------------
  51.   def cursor_pagedown
  52.   end
  53.   #--------------------------------------------------------------------------
  54.   # * Move Cursor One Page Up
  55.   #--------------------------------------------------------------------------
  56.   def cursor_pageup
  57.   end
  58.   #--------------------------------------------------------------------------
  59.   # * Move Cursor One Page Down
  60.   #--------------------------------------------------------------------------
  61.   def cursor_pagedown_list
  62.     if top_row + page_row_max < row_max
  63.       self.top_row += page_row_max
  64.       select([@index + page_item_max, item_max - 1].min)
  65.     end
  66.   end
  67.   #--------------------------------------------------------------------------
  68.   # * Move Cursor One Page Up
  69.   #--------------------------------------------------------------------------
  70.   def cursor_pageup_list
  71.     if top_row > 0
  72.       self.top_row -= page_row_max
  73.       select([@index - page_item_max, 0].max)
  74.     end
  75.   end
  76.   #--------------------------------------------------------------------------
  77.   # * Get Number of Rows Displayable on 1 Page
  78.   #--------------------------------------------------------------------------
  79.   def page_row_max
  80.     return 8
  81.   end
  82.   #--------------------------------------------------------------------------
  83.   # * Get Row Count
  84.   #--------------------------------------------------------------------------
  85.   def row_max
  86.     return 16
  87.   end
  88.   #--------------------------------------------------------------------------
  89.   # * Draw Equipment For The Class
  90.   #--------------------------------------------------------------------------
  91.   def draw_equip_class
  92.     class_equip = []
  93.     actor_class = @data[index]
  94.     actor_class.features.each do |set|
  95.       next if set.data_id == 0
  96.       case set.code
  97.       when 51 # weapon
  98.         class_equip.push($data_system.weapon_types[set.data_id])
  99.       when 52 # armour
  100.         class_equip.push($data_system.armor_types[set.data_id])
  101.       else
  102.         next
  103.       end
  104.     end
  105.     change_color(normal_color)
  106.     contents.clear_rect(110, 0, 150, 400)
  107.     if class_equip != []
  108.       y = 0
  109.       case @index
  110.       when 0..6
  111.       when 7
  112.         spot = @index
  113.         cursor_pageup_list
  114.         @index = spot
  115.         cursor_rect.set(item_rect(@index))
  116.       when 8..16
  117.         y = 8 * 24
  118.       end
  119.       draw_text(110, y, 150, 24, "Can Equip", 1)
  120.       y += 24
  121.       for equip_id in class_equip
  122.         draw_text(110, y, 150, 24, equip_id, 1)
  123.         y += 24
  124.       end
  125.     end
  126.   end
  127. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement