Project1

标题: 物品菜单强化脚本的问题,自定义栏目的那一块,求指教 [打印本页]

作者: 踢腿水上飘    时间: 2017-7-25 11:59
标题: 物品菜单强化脚本的问题,自定义栏目的那一块,求指教
就是:custom1,  那一块,看样子可以自定义名称,可是里面显示的内容在哪里设定呢?
我依样画葫芦在    ITEM_TYPES  那一段后面接了
    custom1_TYPES =[
      [:category,   "材料"], # Categorized by <category: 材料>
]
没有用啊-0-
RUBY 代码复制
  1. #==============================================================================
  2. #
  3. # ▼ Yanfly Engine Ace - Ace Item Menu v1.02
  4. # -- Last Updated: 2012.01.05
  5. # -- Level: Normal, Hard
  6. # -- Requires: n/a
  7. #
  8. #==============================================================================
  9.  
  10. $imported = {} if $imported.nil?
  11. $imported["YEA-ItemMenu"] = true
  12.  
  13. #==============================================================================
  14. # ▼ Updates
  15. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  16. # 2012.01.05 - Compatibility Update with Equip Dynamic Stats.
  17. # 2012.01.03 - Started Script and Finished.
  18. #            - Compatibility Update with Ace Menu Engine.
  19. #
  20. #==============================================================================
  21. # ▼ Introduction
  22. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  23. # The Ace Item Menu offers more item categorization control and a better layout
  24. # that simulatenously provides information regarding the items to the player,
  25. # while keeping a good amount of the item list visible on screen at once. The
  26. # script can also be customized to rearrange commands and categories.
  27. #
  28. #==============================================================================
  29. # ▼ Instructions
  30. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  31. # To install this script, open up your script editor and copy/paste this script
  32. # to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
  33. #
  34. # -----------------------------------------------------------------------------
  35. # Item Notetags - These notetags go in the item notebox in the database.
  36. # -----------------------------------------------------------------------------
  37. # <category: string>
  38. # Places this object into the item category for "string". Whenever the selected
  39. # category is highlighted in the Ace Item Menu command window, this object will
  40. # be included and shown in the item window.
  41. #
  42. # <image: string>
  43. # Uses a picture from Graphics\Pictures\ of your RPG Maker VX Ace Project's
  44. # directory with the filename of "string" (without the extension) as the image
  45. # picture shown in the Ace Item Menu.
  46. #
  47. # -----------------------------------------------------------------------------
  48. # Weapon Notetags - These notetags go in the weapon notebox in the database.
  49. # -----------------------------------------------------------------------------
  50. # <category: string>
  51. # Places this object into the item category for "string". Whenever the selected
  52. # category is highlighted in the Ace Item Menu command window, this object will
  53. # be included and shown in the item window.
  54. #
  55. # <image: string>
  56. # Uses a picture from Graphics\Pictures\ of your RPG Maker VX Ace Project's
  57. # directory with the filename of "string" (without the extension) as the image
  58. # picture shown in the Ace Item Menu.
  59. #
  60. # -----------------------------------------------------------------------------
  61. # Armour Notetags - These notetags go in the armour notebox in the database.
  62. # -----------------------------------------------------------------------------
  63. # <category: string>
  64. # Places this object into the item category for "string". Whenever the selected
  65. # category is highlighted in the Ace Item Menu command window, this object will
  66. # be included and shown in the item window.
  67. #
  68. # <image: string>
  69. # Uses a picture from Graphics\Pictures\ of your RPG Maker VX Ace Project's
  70. # directory with the filename of "string" (without the extension) as the image
  71. # picture shown in the Ace Item Menu.
  72. #
  73. #==============================================================================
  74. # ▼ Compatibility
  75. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  76. # This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
  77. # it will run with RPG Maker VX without adjusting.
  78. #
  79. #==============================================================================
  80.  
  81. module YEA
  82.   module ITEM
  83.  
  84.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  85.     # - Item Command Settings -
  86.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  87.     # This array adjusts what options appear in the initial item command window
  88.     # before the items are split into separate categories. Add commands, remove
  89.     # commands, or rearrange them. Here's a list of which does what:
  90.     #
  91.     # -------------------------------------------------------------------------
  92.     # :command         Description
  93.     # -------------------------------------------------------------------------
  94.     # :item            Opens up the various item categories. Default.
  95.     # :weapon          Opens up the various weapon categories. Default.
  96.     # :armor           Opens up the various armour categories. Default.
  97.     # :key_item        Shows a list of the various key items. Default.
  98.     #
  99.     # :gogototori      Requires Kread-EX's Go Go Totori Synthesis.
  100.     #
  101.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  102.     COMMANDS =[
  103.       :item,         # Opens up the various item categories. Default.
  104.       :weapon,       # Opens up the various weapon categories. Default.
  105.       :armor,        # Opens up the various armour categories. Default.
  106.       :key_item,     # Shows a list of the various key items. Default.
  107.       :gogototori,   # Requires Kread-EX's Go Go Totori Synthesis.
  108.     # :custom1,      # Custom command 1.
  109.     # :custom2,      # Custom command 2.
  110.     ] # Do not remove this.
  111.  
  112.     #--------------------------------------------------------------------------
  113.     # - Item Custom Commands -
  114.     # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  115.     # For those who use scripts to that may produce unique effects for the item
  116.     # scene, use this hash to manage the custom commands for the Item Command
  117.     # Window. You can disable certain commands or prevent them from appearing
  118.     # by using switches. If you don't wish to bind them to a switch, set the
  119.     # proper switch to 0 for it to have no impact.
  120.     #--------------------------------------------------------------------------
  121.     CUSTOM_ITEM_COMMANDS ={
  122.     # :command => ["Display Name", EnableSwitch, ShowSwitch, Handler Method],
  123.       :gogototori => ["合成",            0,         0, :command_totori],
  124.       :custom1 => [ "自定義名稱",            0,          0, :command_name1],
  125.       :custom2 => [ "自定義文本",           13,          0, :command_name2],
  126.     } # Do not remove this.
  127.  
  128.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  129.     # - Item Type Settings -
  130.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  131.     # These arrays adjusts and shows the various item types shown for Items,
  132.     # Weapons, and Armours. Note that when using :category symbols, the
  133.     # specific category shown will be equal to the text used for the Display
  134.     # and the included item must contain a category equal to the Display name.
  135.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  136.     # This array contains the order for the Item categories.
  137.     ITEM_TYPES =[
  138.     # [  :symbol,   "Display"],
  139.       [:all,       "全部"], # Shows all usable items.
  140.       [:field,     "背包内"], # Shows Menu-usable items.
  141.       [:battle,    "战斗用"], # Shows Battle-usable items.
  142.       [:category,   "材料"], # Categorized by <category: 材料>
  143.       [:category,"特别"], # Categorized by <category: 特别>
  144.       [:category,"石头"], # Categorized by <category: 石头>
  145.       [:category,"宝珠"], # Categorized by <category: 宝珠>
  146.       [:category,"药剂"], # Categorized by <category: 技能书>
  147.       [:category,"技能书"], # Categorized by <category: 药剂>
  148.       [:category,"宝物"], # Categorized by <category: 宝物>
  149.       [:category,  "进阶"], # Shows all key items.
  150.     ] # Do not remove this.
  151.  
  152.     # This array contains the order for the Weapon categories.
  153.     WEAPON_TYPES =[
  154.     # [  :symbol,   "Display"],
  155.       [   :types,  "WPNTYPES"], # Lists all of the individual weapon types.
  156.       [     :all,       "全部"], # Shows all weapons.
  157.     ] # Do not remove this.
  158.  
  159.     # This array contains the order for the Armour categories.
  160.     ARMOUR_TYPES =[
  161.     # [  :symbol,   "Display"],
  162.       [   :slots,  "ARMSLOTS"], # Lists all of the individual armour slots.
  163.       [   :types,  "ARMTYPES"], # Lists all of the individual armours types.
  164.       [     :all,       "全部"], # Shows all armours.
  165.     ] # Do not remove this.
  166.  
  167.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  168.     # - Item Status Settings -
  169.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  170.     # The item status window displays information about the item in detail.
  171.     # Adjust the settings below to change the way the status window appears.
  172.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  173.     STATUS_FONT_SIZE = 20       # Font size used for status window.
  174.     MAX_ICONS_DRAWN  = 10       # Maximum number of icons drawn for states.
  175.  
  176.     # The following adjusts the vocabulary used for the status window. Each
  177.     # of the vocabulary settings are self explanatory.
  178.     VOCAB_STATUS ={
  179.       :empty      => "---",          # Text used when nothing is shown.
  180.       :hp_recover => "回复血量",      # Text used for HP Recovery.
  181.       :mp_recover => "回复魔法",      # Text used for MP Recovery.
  182.       :tp_recover => "回复TP",      # Text used for TP Recovery.
  183.       :tp_gain    => "增加TP",      # Text used for TP Gain.
  184.       :applies    => "增加效果",      # Text used for applied states and buffs.
  185.       :removes    => "移除效果",      # Text used for removed states and buffs.
  186.     } # Do not remove this.
  187.  
  188.   end # ITEM
  189. end # YEA
  190.  
  191. #==============================================================================
  192. # ▼ Editting anything past this point may potentially result in causing
  193. # computer damage, incontinence, explosion of user's head, coma, death, and/or
  194. # halitosis so edit at your own risk.
  195. #==============================================================================
  196.  
  197. module YEA
  198.   module REGEXP
  199.   module BASEITEM
  200.  
  201.     CATEGORY = /<(?:CATEGORIES|category):[ ](.*)>/i
  202.     IMAGE    = /<(?:IMAGE|image):[ ](.*)>/i
  203.  
  204.   end # BASEITEM
  205.   end # REGEXP
  206. end # YEA
  207.  
  208. #==============================================================================
  209. # ■ Numeric
  210. #==============================================================================
  211.  
  212. class Numeric
  213.  
  214.   #--------------------------------------------------------------------------
  215.   # new method: group_digits
  216.   #--------------------------------------------------------------------------
  217.   unless $imported["YEA-CoreEngine"]
  218.   def group; return self.to_s; end
  219.   end # $imported["YEA-CoreEngine"]
  220.  
  221. end # Numeric
  222.  
  223. #==============================================================================
  224. # ■ Vocab
  225. #==============================================================================
  226.  
  227. module Vocab
  228.  
  229.   #--------------------------------------------------------------------------
  230.   # new method: self.item_status
  231.   #--------------------------------------------------------------------------
  232.   def self.item_status(type)
  233.     return YEA::ITEM::VOCAB_STATUS[type]
  234.   end
  235.  
  236. end # Vocab
  237.  
  238. #==============================================================================
  239. # ■ DataManager
  240. #==============================================================================
  241.  
  242. module DataManager
  243.  
  244.   #--------------------------------------------------------------------------
  245.   # alias method: load_database
  246.   #--------------------------------------------------------------------------
  247.   class <<self; alias load_database_aim load_database; end
  248.   def self.load_database
  249.     load_database_aim
  250.     load_notetags_aim
  251.   end
  252.  
  253.   #--------------------------------------------------------------------------
  254.   # new method: load_notetags_aim
  255.   #--------------------------------------------------------------------------
  256.   def self.load_notetags_aim
  257.     groups = [$data_items, $data_weapons, $data_armors]
  258.     for group in groups
  259.       for obj in group
  260.         next if obj.nil?
  261.         obj.load_notetags_aim
  262.       end
  263.     end
  264.   end
  265.  
  266. end # DataManager
  267.  
  268. #==============================================================================
  269. # ■ RPG::BaseItem
  270. #==============================================================================
  271.  
  272. class RPG::BaseItem
  273.  
  274.   #--------------------------------------------------------------------------
  275.   # public instance variables
  276.   #--------------------------------------------------------------------------
  277.   attr_accessor :category
  278.   attr_accessor :image
  279.  
  280.   #--------------------------------------------------------------------------
  281.   # common cache: load_notetags_aim
  282.   #--------------------------------------------------------------------------
  283.   def load_notetags_aim
  284.     @category = []
  285.     #---
  286.     self.note.split(/[\r\n]+/).each { |line|
  287.       case line
  288.       #---
  289.       when YEA::REGEXP::BASEITEM::CATEGORY
  290.         @category.push($1.upcase.to_s)
  291.       when YEA::REGEXP::BASEITEM::IMAGE
  292.         @image = $1.to_s
  293.       end
  294.     } # self.note.split
  295.     #---
  296.   end
  297.  
  298. end # RPG::BaseItem
  299.  
  300. #==============================================================================
  301. # ■ Game_Temp
  302. #==============================================================================
  303.  
  304. class Game_Temp
  305.  
  306.   #--------------------------------------------------------------------------
  307.   # public instance variables
  308.   #--------------------------------------------------------------------------
  309.   attr_accessor :scene_item_index
  310.   attr_accessor :scene_item_oy
  311.  
  312. end # Game_Temp
  313.  
  314. #==============================================================================
  315. # ■ Window_ItemList
  316. #==============================================================================
  317.  
  318. class Window_ItemList < Window_Selectable
  319.  
  320.   #--------------------------------------------------------------------------
  321.   # overwrite method: draw_item
  322.   #--------------------------------------------------------------------------
  323.   def draw_item(index)
  324.     item = @data[index]
  325.     return if item.nil?
  326.     rect = item_rect(index)
  327.     rect.width -= 4
  328.     draw_item_name(item, rect.x, rect.y, enable?(item), rect.width - 24)
  329.     draw_item_number(rect, item)
  330.   end
  331.  
  332. end # Window_ItemList
  333.  
  334. #==============================================================================
  335. # ■ Window_ItemCommand
  336. #==============================================================================
  337.  
  338. class Window_ItemCommand < Window_Command
  339.  
  340.   #--------------------------------------------------------------------------
  341.   # public instance variables
  342.   #--------------------------------------------------------------------------
  343.   attr_reader   :item_window
  344.  
  345.   #--------------------------------------------------------------------------
  346.   # initialize
  347.   #--------------------------------------------------------------------------
  348.   def initialize(x, y)
  349.     super(x, y)
  350.   end
  351.  
  352.   #--------------------------------------------------------------------------
  353.   # window_width
  354.   #--------------------------------------------------------------------------
  355.   def window_width; return 160; end
  356.  
  357.   #--------------------------------------------------------------------------
  358.   # visible_line_number
  359.   #--------------------------------------------------------------------------
  360.   def visible_line_number; return 4; end
  361.  
  362.   #--------------------------------------------------------------------------
  363.   # process_ok
  364.   #--------------------------------------------------------------------------
  365.   def process_ok
  366.     $game_temp.scene_item_index = index
  367.     $game_temp.scene_item_oy = self.oy
  368.     super
  369.   end
  370.  
  371.   #--------------------------------------------------------------------------
  372.   # make_command_list
  373.   #--------------------------------------------------------------------------
  374.   def make_command_list
  375.     for command in YEA::ITEM::COMMANDS
  376.       case command
  377.       #--- Default Commands ---
  378.       when :item
  379.         add_command(Vocab::item, :item)
  380.       when :weapon
  381.         add_command(Vocab::weapon, :weapon)
  382.       when :armor
  383.         add_command(Vocab::armor, :armor)
  384.       when :key_item
  385.         add_command(Vocab::key_item, :key_item)
  386.       #--- Imported ---
  387.       when :gogototori
  388.         next unless $imported["KRX-AlchemicSynthesis"]
  389.         process_custom_command(command)
  390.       #--- Custom Commands ---
  391.       else
  392.         process_custom_command(command)
  393.       end
  394.     end
  395.   end
  396.  
  397.   #--------------------------------------------------------------------------
  398.   # process_custom_command
  399.   #--------------------------------------------------------------------------
  400.   def process_custom_command(command)
  401.     return unless YEA::ITEM::CUSTOM_ITEM_COMMANDS.include?(command)
  402.     show = YEA::ITEM::CUSTOM_ITEM_COMMANDS[command][2]
  403.     continue = show <= 0 ? true : $game_switches[show]
  404.     return unless continue
  405.     text = YEA::ITEM::CUSTOM_ITEM_COMMANDS[command][0]
  406.     switch = YEA::ITEM::CUSTOM_ITEM_COMMANDS[command][1]
  407.     enabled = switch <= 0 ? true : $game_switches[switch]
  408.     add_command(text, command, enabled)
  409.   end
  410.  
  411.   #--------------------------------------------------------------------------
  412.   # update
  413.   #--------------------------------------------------------------------------
  414.   def update
  415.     super
  416.     return unless self.active
  417.     @item_window.category = current_symbol if @item_window
  418.   end
  419.  
  420.   #--------------------------------------------------------------------------
  421.   # item_window=
  422.   #--------------------------------------------------------------------------
  423.   def item_window=(item_window)
  424.     @item_window = item_window
  425.     update
  426.   end
  427.  
  428. end # Window_ItemCommand
  429.  
  430. #==============================================================================
  431. # ■ Window_ItemType
  432. #==============================================================================
  433.  
  434. class Window_ItemType < Window_Command
  435.  
  436.   #--------------------------------------------------------------------------
  437.   # public instance variables
  438.   #--------------------------------------------------------------------------
  439.   attr_reader   :item_window
  440.  
  441.   #--------------------------------------------------------------------------
  442.   # initialize
  443.   #--------------------------------------------------------------------------
  444.   def initialize(x, y)
  445.     super(x, y)
  446.     deactivate
  447.     @type = nil
  448.   end
  449.  
  450.   #--------------------------------------------------------------------------
  451.   # window_width
  452.   #--------------------------------------------------------------------------
  453.   def window_width; return 160; end
  454.  
  455.   #--------------------------------------------------------------------------
  456.   # visible_line_number
  457.   #--------------------------------------------------------------------------
  458.   def visible_line_number; return 4; end
  459.  
  460.   #--------------------------------------------------------------------------
  461.   # reveal
  462.   #--------------------------------------------------------------------------
  463.   def reveal(type)
  464.     @type = type
  465.     refresh
  466.     activate
  467.     select(0)
  468.   end
  469.  
  470.   #--------------------------------------------------------------------------
  471.   # make_command_list
  472.   #--------------------------------------------------------------------------
  473.   def make_command_list
  474.     return if @type.nil?
  475.     #---
  476.     case @type
  477.     when :item
  478.       commands = YEA::ITEM::ITEM_TYPES
  479.     when :weapon
  480.       commands = YEA::ITEM::WEAPON_TYPES
  481.     else
  482.       commands = YEA::ITEM::ARMOUR_TYPES
  483.     end
  484.     #---
  485.     for command in commands
  486.       case command[0]
  487.       #---
  488.       when :types
  489.         case @type
  490.         when :weapon
  491.           for i in 1...$data_system.weapon_types.size
  492.             name = $data_system.weapon_types[i]
  493.             add_command(name, :w_type, true, i)
  494.           end
  495.         else
  496.           for i in 1...$data_system.armor_types.size
  497.             name = $data_system.armor_types[i]
  498.             add_command(name, :a_type, true, i)
  499.           end
  500.         end
  501.       #---
  502.       when :slots
  503.         if $imported["YEA-AceEquipEngine"]
  504.           maximum = 1
  505.           for key in YEA::EQUIP::TYPES
  506.             maximum = [maximum, key[0]].max
  507.           end
  508.         else
  509.           maximum = 4
  510.         end
  511.         for i in 1..maximum
  512.           name = Vocab::etype(i)
  513.           add_command(name, :e_type, true, i) if name != ""
  514.         end
  515.       #---
  516.       else
  517.         add_command(command[1], command[0], true, @type)
  518.       end
  519.     end
  520.   end
  521.  
  522.   #--------------------------------------------------------------------------
  523.   # update
  524.   #--------------------------------------------------------------------------
  525.   def update
  526.     super
  527.     return unless self.active
  528.     @item_window.category = current_symbol if @item_window
  529.   end
  530.  
  531.   #--------------------------------------------------------------------------
  532.   # item_window=
  533.   #--------------------------------------------------------------------------
  534.   def item_window=(item_window)
  535.     @item_window = item_window
  536.     update
  537.   end
  538.  
  539. end # Window_ItemType
  540.  
  541. #==============================================================================
  542. # ■ Window_ItemList
  543. #==============================================================================
  544.  
  545. class Window_ItemList < Window_Selectable
  546.  
  547.   #--------------------------------------------------------------------------
  548.   # alias method: initialize
  549.   #--------------------------------------------------------------------------
  550.   alias window_itemlist_initialize_aim initialize
  551.   def initialize(dx, dy, dw, dh)
  552.     window_itemlist_initialize_aim(dx, dy, dw, dh)
  553.     @ext = :none
  554.     @name = ""
  555.   end
  556.  
  557.   #--------------------------------------------------------------------------
  558.   # alias method: category=
  559.   #--------------------------------------------------------------------------
  560.   alias window_itemlist_category_aim category=
  561.   def category=(category)
  562.     if @types_window.nil?
  563.       window_itemlist_category_aim(category)
  564.     else
  565.       return unless update_types?(category)
  566.       @category = category
  567.       if @types_window.active
  568.         @name = @types_window.current_data[:name]
  569.         @ext = @types_window.current_ext
  570.       end
  571.       refresh
  572.       self.oy = 0
  573.     end
  574.   end
  575.  
  576.   #--------------------------------------------------------------------------
  577.   # new method: update_types?
  578.   #--------------------------------------------------------------------------
  579.   def update_types?(category)
  580.     return true if @category != category
  581.     return false unless @types_window.active
  582.     if category == :category
  583.       return @name != @types_window.current_data[:name]
  584.     end
  585.     return @ext != @types_window.current_ext
  586.   end
  587.  
  588.   #--------------------------------------------------------------------------
  589.   # new method: types_window=
  590.   #--------------------------------------------------------------------------
  591.   def types_window=(window)
  592.     @types_window = window
  593.   end
  594.  
  595.   #--------------------------------------------------------------------------
  596.   # alias method: include?
  597.   #--------------------------------------------------------------------------
  598.   alias window_itemlist_include_aim include?
  599.   def include?(item)
  600.     if @types_window.nil?
  601.       return window_itemlist_include_aim(item)
  602.     else
  603.       return ace_item_menu_include?(item)
  604.     end
  605.   end
  606.  
  607.   #--------------------------------------------------------------------------
  608.   # new method: ace_item_menu_include?
  609.   #--------------------------------------------------------------------------
  610.   def ace_item_menu_include?(item)
  611.     case @category
  612.     #---
  613.     when :field
  614.       return false unless item.is_a?(RPG::Item)
  615.       return item.menu_ok?
  616.     when :battle
  617.       return false unless item.is_a?(RPG::Item)
  618.       return item.battle_ok?
  619.     #---
  620.     when :w_type
  621.       return false unless item.is_a?(RPG::Weapon)
  622.       return item.wtype_id == @types_window.current_ext
  623.     when :a_type
  624.       return false unless item.is_a?(RPG::Armor)
  625.       return item.atype_id == @types_window.current_ext
  626.     when :e_type
  627.       return false unless item.is_a?(RPG::Armor)
  628.       return item.etype_id == @types_window.current_ext
  629.     #---
  630.     when :all
  631.       case @types_window.current_ext
  632.       when :item
  633.         return item.is_a?(RPG::Item)
  634.       when :weapon
  635.         return item.is_a?(RPG::Weapon)
  636.       else
  637.         return item.is_a?(RPG::Armor)
  638.       end
  639.     #---
  640.     when :category
  641.       case @types_window.current_ext
  642.       when :item
  643.         return false unless item.is_a?(RPG::Item)
  644.       when :weapon
  645.         return false unless item.is_a?(RPG::Weapon)
  646.       else
  647.         return false unless item.is_a?(RPG::Armor)
  648.       end
  649.       return item.category.include?(@types_window.current_data[:name].upcase)
  650.     #---
  651.     else
  652.       return window_itemlist_include_aim(item)
  653.     end
  654.   end
  655.  
  656. end # Window_ItemList
  657.  
  658. #==============================================================================
  659. # ■ Window_ItemStatus
  660. #==============================================================================
  661.  
  662. class Window_ItemStatus < Window_Base
  663.  
  664.   #--------------------------------------------------------------------------
  665.   # initialize
  666.   #--------------------------------------------------------------------------
  667.   def initialize(dx, dy, item_window)
  668.     super(dx, dy, Graphics.width - dx, fitting_height(4))
  669.     @item_window = item_window
  670.     @item = nil
  671.     refresh
  672.   end
  673.  
  674.   #--------------------------------------------------------------------------
  675.   # update
  676.   #--------------------------------------------------------------------------
  677.   def update
  678.     super
  679.     update_item(@item_window.item)
  680.   end
  681.  
  682.   #--------------------------------------------------------------------------
  683.   # update_item
  684.   #--------------------------------------------------------------------------
  685.   def update_item(item)
  686.     return if @item == item
  687.     @item = item
  688.     refresh
  689.   end
  690.  
  691.   #--------------------------------------------------------------------------
  692.   # refresh
  693.   #--------------------------------------------------------------------------
  694.   def refresh
  695.     contents.clear
  696.     reset_font_settings
  697.     return draw_empty if @item.nil?
  698.     contents.font.size = YEA::ITEM::STATUS_FONT_SIZE
  699.     draw_item_image
  700.     draw_item_stats
  701.     draw_item_effects
  702.   end
  703.  
  704.   #--------------------------------------------------------------------------
  705.   # draw_empty
  706.   #--------------------------------------------------------------------------
  707.   def draw_empty
  708.     colour = Color.new(0, 0, 0, translucent_alpha/2)
  709.     rect = Rect.new(1, 1, 94, 94)
  710.     contents.fill_rect(rect, colour)
  711.     dx = 96; dy = 0
  712.     dw = (contents.width - 96) / 2
  713.     for i in 0...8
  714.       draw_background_box(dx, dy, dw)
  715.       dx = dx >= 96 + dw ? 96 : 96 + dw
  716.       dy += line_height if dx == 96
  717.     end
  718.   end
  719.  
  720.   #--------------------------------------------------------------------------
  721.   # draw_background_box
  722.   #--------------------------------------------------------------------------
  723.   def draw_background_box(dx, dy, dw)
  724.     colour = Color.new(0, 0, 0, translucent_alpha/2)
  725.     rect = Rect.new(dx+1, dy+1, dw-2, line_height-2)
  726.     contents.fill_rect(rect, colour)
  727.   end
  728.  
  729.   #--------------------------------------------------------------------------
  730.   # draw_item_image
  731.   #--------------------------------------------------------------------------
  732.   def draw_item_image
  733.     colour = Color.new(0, 0, 0, translucent_alpha/2)
  734.     rect = Rect.new(1, 1, 94, 94)
  735.     contents.fill_rect(rect, colour)
  736.     if @item.image.nil?
  737.       icon_index = @item.icon_index
  738.       bitmap = Cache.system("Iconset")
  739.       rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
  740.       target = Rect.new(0, 0, 96, 96)
  741.       contents.stretch_blt(target, bitmap, rect)
  742.     else
  743.       bitmap = Cache.picture(@item.image)
  744.       contents.blt(0, 0, bitmap, bitmap.rect, 255)
  745.     end
  746.   end
  747.  
  748.   #--------------------------------------------------------------------------
  749.   # draw_item_stats
  750.   #--------------------------------------------------------------------------
  751.   def draw_item_stats
  752.     return unless @item.is_a?(RPG::Weapon) || @item.is_a?(RPG::Armor)
  753.     dx = 96; dy = 0
  754.     dw = (contents.width - 96) / 2
  755.     for i in 0...8
  756.       draw_equip_param(i, dx, dy, dw)
  757.       dx = dx >= 96 + dw ? 96 : 96 + dw
  758.       dy += line_height if dx == 96
  759.     end
  760.   end
  761.  
  762.   #--------------------------------------------------------------------------
  763.   # draw_equip_param
  764.   #--------------------------------------------------------------------------
  765.   def draw_equip_param(param_id, dx, dy, dw)
  766.     draw_background_box(dx, dy, dw)
  767.     change_color(system_color)
  768.     draw_text(dx+4, dy, dw-8, line_height, Vocab::param(param_id))
  769.     if $imported["YEA-EquipDynamicStats"]
  770.       draw_percentage_param(param_id, dx, dy, dw)
  771.     else
  772.       draw_set_param(param_id, dx, dy, dw)
  773.     end
  774.   end
  775.  
  776.   #--------------------------------------------------------------------------
  777.   # draw_percentage_param
  778.   #--------------------------------------------------------------------------
  779.   def draw_percentage_param(param_id, dx, dy, dw)
  780.     if @item.per_params[param_id] != 0 && @item.params[param_id] != 0
  781.       text = draw_set_param(param_id, dx, dy, dw)
  782.       dw -= text_size(text).width
  783.       draw_percent_param(param_id, dx, dy, dw)
  784.     elsif @item.per_params[param_id] != 0 && @item.params[param_id] == 0
  785.       draw_percent_param(param_id, dx, dy, dw)
  786.     else
  787.       draw_set_param(param_id, dx, dy, dw)
  788.     end
  789.   end
  790.  
  791.   #--------------------------------------------------------------------------
  792.   # draw_set_param
  793.   #--------------------------------------------------------------------------
  794.   def draw_set_param(param_id, dx, dy, dw)
  795.     value = @item.params[param_id]
  796.     if $imported["YEA-EquipDynamicStats"] && @item.var_params[param_id] > 0
  797.       value += $game_variables[@item.var_params[param_id]] rescue 0
  798.     end
  799.     change_color(param_change_color(value), value != 0)
  800.     text = value.group
  801.     text = "+" + text if value > 0
  802.     draw_text(dx+4, dy, dw-8, line_height, text, 2)
  803.     return text
  804.   end
  805.  
  806.   #--------------------------------------------------------------------------
  807.   # draw_percent_param
  808.   #--------------------------------------------------------------------------
  809.   def draw_percent_param(param_id, dx, dy, dw)
  810.     value = @item.per_params[param_id]
  811.     change_color(param_change_color(value))
  812.     text = (@item.per_params[param_id] * 100).to_i.group + "%"
  813.     text = "+" + text if @item.per_params[param_id] > 0
  814.     draw_text(dx+4, dy, dw-8, line_height, text, 2)
  815.     return text
  816.   end
  817.  
  818.   #--------------------------------------------------------------------------
  819.   # draw_item_effects
  820.   #--------------------------------------------------------------------------
  821.   def draw_item_effects
  822.     return unless @item.is_a?(RPG::Item)
  823.     dx = 96; dy = 0
  824.     dw = (contents.width - 96) / 2
  825.     draw_hp_recover(dx, dy + line_height * 0, dw)
  826.     draw_mp_recover(dx, dy + line_height * 1, dw)
  827.     draw_tp_recover(dx + dw, dy + line_height * 0, dw)
  828.     draw_tp_gain(dx + dw, dy + line_height * 1, dw)
  829.     dw = contents.width - 96
  830.     draw_applies(dx, dy + line_height * 2, dw)
  831.     draw_removes(dx, dy + line_height * 3, dw)
  832.   end
  833.  
  834.   #--------------------------------------------------------------------------
  835.   # draw_hp_recover
  836.   #--------------------------------------------------------------------------
  837.   def draw_hp_recover(dx, dy, dw)
  838.     draw_background_box(dx, dy, dw)
  839.     change_color(system_color)
  840.     draw_text(dx+4, dy, dw-8, line_height, Vocab::item_status(:hp_recover))
  841.     per = 0
  842.     set = 0
  843.     for effect in @item.effects
  844.       next unless effect.code == 11
  845.       per += (effect.value1 * 100).to_i
  846.       set += effect.value2.to_i
  847.     end
  848.     if per != 0 && set != 0
  849.       change_color(param_change_color(set))
  850.       text = set > 0 ? sprintf("+%s", set.group) : set.group
  851.       draw_text(dx+4, dy, dw-8, line_height, text, 2)
  852.       dw -= text_size(text).width
  853.       change_color(param_change_color(per))
  854.       text = per > 0 ? sprintf("+%s%%", per.group) : sprintf("%s%%", per.group)
  855.       draw_text(dx+4, dy, dw-8, line_height, text, 2)
  856.       return
  857.     elsif per != 0
  858.       change_color(param_change_color(per))
  859.       text = per > 0 ? sprintf("+%s%%", per.group) : sprintf("%s%%", per.group)
  860.     elsif set != 0
  861.       change_color(param_change_color(set))
  862.       text = set > 0 ? sprintf("+%s", set.group) : set.group
  863.     else
  864.       change_color(normal_color, false)
  865.       text = Vocab::item_status(:empty)
  866.     end
  867.     draw_text(dx+4, dy, dw-8, line_height, text, 2)
  868.   end
  869.  
  870.   #--------------------------------------------------------------------------
  871.   # draw_mp_recover
  872.   #--------------------------------------------------------------------------
  873.   def draw_mp_recover(dx, dy, dw)
  874.     draw_background_box(dx, dy, dw)
  875.     change_color(system_color)
  876.     draw_text(dx+4, dy, dw-8, line_height, Vocab::item_status(:mp_recover))
  877.     per = 0
  878.     set = 0
  879.     for effect in @item.effects
  880.       next unless effect.code == 12
  881.       per += (effect.value1 * 100).to_i
  882.       set += effect.value2.to_i
  883.     end
  884.     if per != 0 && set != 0
  885.       change_color(param_change_color(set))
  886.       text = set > 0 ? sprintf("+%s", set.group) : set.group
  887.       draw_text(dx+4, dy, dw-8, line_height, text, 2)
  888.       dw -= text_size(text).width
  889.       change_color(param_change_color(per))
  890.       text = per > 0 ? sprintf("+%s%%", per.group) : sprintf("%s%%", per.group)
  891.       draw_text(dx+4, dy, dw-8, line_height, text, 2)
  892.       return
  893.     elsif per != 0
  894.       change_color(param_change_color(per))
  895.       text = per > 0 ? sprintf("+%s%%", per.group) : sprintf("%s%%", per.group)
  896.     elsif set != 0
  897.       change_color(param_change_color(set))
  898.       text = set > 0 ? sprintf("+%s", set.group) : set.group
  899.     else
  900.       change_color(normal_color, false)
  901.       text = Vocab::item_status(:empty)
  902.     end
  903.     draw_text(dx+4, dy, dw-8, line_height, text, 2)
  904.   end
  905.  
  906.   #--------------------------------------------------------------------------
  907.   # draw_tp_recover
  908.   #--------------------------------------------------------------------------
  909.   def draw_tp_recover(dx, dy, dw)
  910.     draw_background_box(dx, dy, dw)
  911.     change_color(system_color)
  912.     draw_text(dx+4, dy, dw-8, line_height, Vocab::item_status(:tp_recover))
  913.     set = 0
  914.     for effect in @item.effects
  915.       next unless effect.code == 13
  916.       set += effect.value1.to_i
  917.     end
  918.     if set != 0
  919.       change_color(param_change_color(set))
  920.       text = set > 0 ? sprintf("+%s", set.group) : set.group
  921.     else
  922.       change_color(normal_color, false)
  923.       text = Vocab::item_status(:empty)
  924.     end
  925.     draw_text(dx+4, dy, dw-8, line_height, text, 2)
  926.   end
  927.  
  928.   #--------------------------------------------------------------------------
  929.   # draw_tp_gain
  930.   #--------------------------------------------------------------------------
  931.   def draw_tp_gain(dx, dy, dw)
  932.     draw_background_box(dx, dy, dw)
  933.     change_color(system_color)
  934.     draw_text(dx+4, dy, dw-8, line_height, Vocab::item_status(:tp_gain))
  935.     set = @item.tp_gain
  936.     if set != 0
  937.       change_color(param_change_color(set))
  938.       text = set > 0 ? sprintf("+%s", set.group) : set.group
  939.     else
  940.       change_color(normal_color, false)
  941.       text = Vocab::item_status(:empty)
  942.     end
  943.     draw_text(dx+4, dy, dw-8, line_height, text, 2)
  944.   end
  945.  
  946.   #--------------------------------------------------------------------------
  947.   # draw_applies
  948.   #--------------------------------------------------------------------------
  949.   def draw_applies(dx, dy, dw)
  950.     draw_background_box(dx, dy, dw)
  951.     change_color(system_color)
  952.     draw_text(dx+4, dy, dw-8, line_height, Vocab::item_status(:applies))
  953.     icons = []
  954.     for effect in @item.effects
  955.       case effect.code
  956.       when 21
  957.         next unless effect.value1 > 0
  958.         next if $data_states[effect.value1].nil?
  959.         icons.push($data_states[effect.data_id].icon_index)
  960.       when 31
  961.         icons.push($game_actors[1].buff_icon_index(1, effect.data_id))
  962.       when 32
  963.         icons.push($game_actors[1].buff_icon_index(-1, effect.data_id))
  964.       end
  965.       icons.delete(0)
  966.       break if icons.size >= YEA::ITEM::MAX_ICONS_DRAWN
  967.     end
  968.     draw_icons(dx, dy, dw, icons)
  969.   end
  970.  
  971.   #--------------------------------------------------------------------------
  972.   # draw_removes
  973.   #--------------------------------------------------------------------------
  974.   def draw_removes(dx, dy, dw)
  975.     draw_background_box(dx, dy, dw)
  976.     change_color(system_color)
  977.     draw_text(dx+4, dy, dw-8, line_height, Vocab::item_status(:removes))
  978.     icons = []
  979.     for effect in @item.effects
  980.       case effect.code
  981.       when 22
  982.         next unless effect.value1 > 0
  983.         next if $data_states[effect.value1].nil?
  984.         icons.push($data_states[effect.data_id].icon_index)
  985.       when 33
  986.         icons.push($game_actors[1].buff_icon_index(1, effect.data_id))
  987.       when 34
  988.         icons.push($game_actors[1].buff_icon_index(-1, effect.data_id))
  989.       end
  990.       icons.delete(0)
  991.       break if icons.size >= YEA::ITEM::MAX_ICONS_DRAWN
  992.     end
  993.     draw_icons(dx, dy, dw, icons)
  994.   end
  995.  
  996.   #--------------------------------------------------------------------------
  997.   # draw_icons
  998.   #--------------------------------------------------------------------------
  999.   def draw_icons(dx, dy, dw, icons)
  1000.     dx += dw - 4
  1001.     dx -= icons.size * 24
  1002.     for icon_id in icons
  1003.       draw_icon(icon_id, dx, dy)
  1004.       dx += 24
  1005.     end
  1006.     if icons.size == 0
  1007.       change_color(normal_color, false)
  1008.       text = Vocab::item_status(:empty)
  1009.       draw_text(4, dy, contents.width-8, line_height, text, 2)
  1010.     end
  1011.   end
  1012.  
  1013. end # Window_ItemStatus
  1014.  
  1015. #==============================================================================
  1016. # ■ Scene_Item
  1017. #==============================================================================
  1018.  
  1019. class Scene_Item < Scene_ItemBase
  1020.  
  1021.   #--------------------------------------------------------------------------
  1022.   # alias method: start
  1023.   #--------------------------------------------------------------------------
  1024.   alias scene_item_start_aim start
  1025.   def start
  1026.     scene_item_start_aim
  1027.     create_types_window
  1028.     create_status_window
  1029.     relocate_windows
  1030.   end
  1031.  
  1032.   #--------------------------------------------------------------------------
  1033.   # overwrite method: return_scene
  1034.   #--------------------------------------------------------------------------
  1035.   def return_scene
  1036.     $game_temp.scene_item_index = nil
  1037.     $game_temp.scene_item_oy = nil
  1038.     super
  1039.   end
  1040.  
  1041.   #--------------------------------------------------------------------------
  1042.   # overwrite method: create_category_window
  1043.   #--------------------------------------------------------------------------
  1044.   def create_category_window
  1045.     wy = @help_window.height
  1046.     @category_window = Window_ItemCommand.new(0, wy)
  1047.     @category_window.viewport = @viewport
  1048.     @category_window.help_window = @help_window
  1049.     @category_window.y = @help_window.height
  1050.     if !$game_temp.scene_item_index.nil?
  1051.       @category_window.select($game_temp.scene_item_index)
  1052.       @category_window.oy = $game_temp.scene_item_oy
  1053.     end
  1054.     $game_temp.scene_item_index = nil
  1055.     $game_temp.scene_item_oy = nil
  1056.     @category_window.set_handler(:ok, method(:on_category_ok))
  1057.     @category_window.set_handler(:cancel, method(:return_scene))
  1058.     @category_window.set_handler(:item, method(:open_types))
  1059.     @category_window.set_handler(:weapon, method(:open_types))
  1060.     @category_window.set_handler(:armor, method(:open_types))
  1061.     process_custom_item_commands
  1062.   end
  1063.  
  1064.   #--------------------------------------------------------------------------
  1065.   # new method: process_custom_item_commands
  1066.   #--------------------------------------------------------------------------
  1067.   def process_custom_item_commands
  1068.     for command in YEA::ITEM::COMMANDS
  1069.       next unless YEA::ITEM::CUSTOM_ITEM_COMMANDS.include?(command)
  1070.       called_method = YEA::ITEM::CUSTOM_ITEM_COMMANDS[command][3]
  1071.       @category_window.set_handler(command, method(called_method))
  1072.     end
  1073.   end
  1074.  
  1075.   #--------------------------------------------------------------------------
  1076.   # new method: create_types_window
  1077.   #--------------------------------------------------------------------------
  1078.   def create_types_window
  1079.     wy = @category_window.y
  1080.     @types_window = Window_ItemType.new(Graphics.width, wy)
  1081.     @types_window.viewport = @viewport
  1082.     @types_window.help_window = @help_window
  1083.     @types_window.y = @help_window.height
  1084.     @types_window.item_window = @item_window
  1085.     @item_window.types_window = @types_window
  1086.     @types_window.set_handler(:ok, method(:on_types_ok))
  1087.     @types_window.set_handler(:cancel, method(:on_types_cancel))
  1088.   end
  1089.  
  1090.   #--------------------------------------------------------------------------
  1091.   # new method: create_status_window
  1092.   #--------------------------------------------------------------------------
  1093.   def create_status_window
  1094.     wx = @category_window.width
  1095.     wy = @category_window.y
  1096.     @status_window = Window_ItemStatus.new(wx, wy, @item_window)
  1097.     @status_window.viewport = @viewport
  1098.   end
  1099.  
  1100.   #--------------------------------------------------------------------------
  1101.   # new method: relocate_windows
  1102.   #--------------------------------------------------------------------------
  1103.   def relocate_windows
  1104.     return unless $imported["YEA-AceMenuEngine"]
  1105.     case Menu.help_window_location
  1106.     when 0 # Top
  1107.       @help_window.y = 0
  1108.       @category_window.y = @help_window.height
  1109.       @item_window.y = @category_window.y + @category_window.height
  1110.     when 1 # Middle
  1111.       @category_window.y = 0
  1112.       @help_window.y = @category_window.height
  1113.       @item_window.y = @help_window.y + @help_window.height
  1114.     else # Bottom
  1115.       @category_window.y = 0
  1116.       @item_window.y = @category_window.height
  1117.       @help_window.y = @item_window.y + @item_window.height
  1118.     end
  1119.     @types_window.y = @category_window.y
  1120.     @status_window.y = @category_window.y
  1121.   end
  1122.  
  1123.   #--------------------------------------------------------------------------
  1124.   # new method: open_categories
  1125.   #--------------------------------------------------------------------------
  1126.   def open_types
  1127.     @category_window.x = Graphics.width
  1128.     @types_window.x = 0
  1129.     @types_window.reveal(@category_window.current_symbol)
  1130.   end
  1131.  
  1132.   #--------------------------------------------------------------------------
  1133.   # new method: on_types_ok
  1134.   #--------------------------------------------------------------------------
  1135.   def on_types_ok
  1136.     @item_window.activate
  1137.     @item_window.select_last
  1138.   end
  1139.  
  1140.   #--------------------------------------------------------------------------
  1141.   # new method: on_types_cancel
  1142.   #--------------------------------------------------------------------------
  1143.   def on_types_cancel
  1144.     @category_window.x = 0
  1145.     @category_window.activate
  1146.     @types_window.unselect
  1147.     @types_window.x = Graphics.width
  1148.   end
  1149.  
  1150.   #--------------------------------------------------------------------------
  1151.   # alias method: on_item_cancel
  1152.   #--------------------------------------------------------------------------
  1153.   alias scene_item_on_item_cancel_aim on_item_cancel
  1154.   def on_item_cancel
  1155.     if @types_window.x <= 0
  1156.       @item_window.unselect
  1157.       @types_window.activate
  1158.     else
  1159.       scene_item_on_item_cancel_aim
  1160.     end
  1161.   end
  1162.  
  1163.   #--------------------------------------------------------------------------
  1164.   # new method: command_totori
  1165.   #--------------------------------------------------------------------------
  1166.   def command_totori
  1167.     SceneManager.call(Scene_Alchemy)
  1168.   end
  1169.  
  1170.   #--------------------------------------------------------------------------
  1171.   # new method: command_name1
  1172.   #--------------------------------------------------------------------------
  1173.   def command_name1
  1174.     # Do nothing.
  1175.   end
  1176.  
  1177.   #--------------------------------------------------------------------------
  1178.   # new method: command_name2
  1179.   #--------------------------------------------------------------------------
  1180.   def command_name2
  1181.     # Do nothing.
  1182.   end
  1183.  
  1184. end # Scene_Item
  1185.  
  1186. #==============================================================================
  1187. #
  1188. # ▼ End of File
  1189. #
  1190. #==============================================================================

作者: 铅笔描绘的思念    时间: 2017-7-27 10:24
COMMANDS[]里面添加的只能是指令(比如跳转到存到界面什么的)没办法再加一个分类给你打开




欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1