Advertisement
roninator2

Yanfly Item Menu - Hide categories

Dec 8th, 2024
29
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 3.90 KB | None | 0 0
  1. # ╔═════════════════════════════════════╦════════════════════╗
  2. # ║ Title: Yanfly Item Menu Types       ║  Version: 1.00     ║
  3. # ║ Author: Roninator2                  ║                    ║
  4. # ╠═════════════════════════════════════╬════════════════════╣
  5. # ║ Function:                           ║   Date Created     ║
  6. # ║    Only show category if there      ╠════════════════════╣
  7. # ║    is an item for that category     ║    07 Feb 2022     ║
  8. # ╚═════════════════════════════════════╩════════════════════╝
  9. # ╔══════════════════════════════════════════════════════════╗
  10. # ║ Instructions:                                            ║
  11. # ║   Plug and play                                          ║
  12. # ╚══════════════════════════════════════════════════════════╝
  13. # ╔══════════════════════════════════════════════════════════╗
  14. # ║ Terms of use:                                            ║
  15. # ║ Free for all uses in RPG Maker except nudity             ║
  16. # ╚══════════════════════════════════════════════════════════╝
  17. class Window_ItemCommand < Window_Command
  18.   def make_command_list
  19.     for command in YEA::ITEM::COMMANDS
  20.       case command
  21.       #--- Default Commands ---
  22.       when :item
  23.         add_command(Vocab::item, :item) unless $game_party.items.empty?
  24.       when :weapon
  25.         add_command(Vocab::weapon, :weapon) unless $game_party.weapons.empty?
  26.       when :armor
  27.         add_command(Vocab::armor, :armor) unless $game_party.armors.empty?
  28.       when :key_item
  29.         add_command(Vocab::key_item, :key_item)
  30.       #--- Imported ---
  31.       when :gogototori
  32.         next unless $imported["KRX-AlchemicSynthesis"]
  33.         process_custom_command(command)
  34.       #--- Custom Commands ---
  35.       else
  36.         process_custom_command(command)
  37.       end
  38.     end
  39.   end
  40. end
  41. class Window_ItemType < Window_Command
  42.   def make_command_list
  43.     return if @type.nil?
  44.     #---
  45.     case @type
  46.     when :item
  47.       commands = YEA::ITEM::ITEM_TYPES
  48.     when :weapon
  49.       commands = YEA::ITEM::WEAPON_TYPES
  50.     else
  51.       commands = YEA::ITEM::ARMOUR_TYPES
  52.     end
  53.     #---
  54.     for command in commands
  55.       case @type
  56.       when :weapon
  57.         for i in 0..$game_party.weapons.size - 1
  58.           if $game_party.weapons[i].note.include?(command[1])
  59.             add_command(command[1], command[0], true, @type) unless @list.find {|x| x[:name] == command[1]}
  60.           end
  61.         end
  62.       when :armor
  63.         for i in 0..$game_party.armors.size - 1
  64.           if $game_party.armors[i].note.include?(command[1])
  65.             add_command(command[1], command[0], true, @type) unless @list.find {|x| x[:name] == command[1]}
  66.           end
  67.         end
  68.       when :item
  69.         for i in 0..$game_party.items.size - 1
  70.           if $game_party.items[i].note.include?(command[1])
  71.             add_command(command[1], command[0], true, @type) unless @list.find {|x| x[:name] == command[1]}
  72.           end
  73.         end
  74.       end
  75.       add_command(command[1], command[0], true, @type) if command[0] == :all
  76.     end
  77.   end
  78. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement