查看: 1401|回复: 1

[已经解决] 物品菜单强化脚本的问题,自定义栏目的那一块,求指教

[复制链接]
梦石
0
星屑
2019
在线时间
940 小时
注册时间
2015-10-26
回帖
293

开拓者

发表于 2017-7-25 11:59:54 | 显示全部楼层 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有账号?注册会员

×
就是:custom1,  那一块,看样子可以自定义名称,可是里面显示的内容在哪里设定呢?
我依样画葫芦在    ITEM_TYPES  那一段后面接了
    custom1_TYPES =[
      [:category,   "材料"], # Categorized by <category: 材料>
]
没有用啊-0-
  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. $imported = {} if $imported.nil?
  10. $imported["YEA-ItemMenu"] = true

  11. #==============================================================================
  12. # ▼ Updates
  13. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  14. # 2012.01.05 - Compatibility Update with Equip Dynamic Stats.
  15. # 2012.01.03 - Started Script and Finished.
  16. #            - Compatibility Update with Ace Menu Engine.
  17. #
  18. #==============================================================================
  19. # ▼ Introduction
  20. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  21. # The Ace Item Menu offers more item categorization control and a better layout
  22. # that simulatenously provides information regarding the items to the player,
  23. # while keeping a good amount of the item list visible on screen at once. The
  24. # script can also be customized to rearrange commands and categories.
  25. #
  26. #==============================================================================
  27. # ▼ Instructions
  28. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  29. # To install this script, open up your script editor and copy/paste this script
  30. # to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
  31. #
  32. # -----------------------------------------------------------------------------
  33. # Item Notetags - These notetags go in the item notebox in the database.
  34. # -----------------------------------------------------------------------------
  35. # <category: string>
  36. # Places this object into the item category for "string". Whenever the selected
  37. # category is highlighted in the Ace Item Menu command window, this object will
  38. # be included and shown in the item window.
  39. #
  40. # <image: string>
  41. # Uses a picture from Graphics\Pictures\ of your RPG Maker VX Ace Project's
  42. # directory with the filename of "string" (without the extension) as the image
  43. # picture shown in the Ace Item Menu.
  44. #
  45. # -----------------------------------------------------------------------------
  46. # Weapon Notetags - These notetags go in the weapon notebox in the database.
  47. # -----------------------------------------------------------------------------
  48. # <category: string>
  49. # Places this object into the item category for "string". Whenever the selected
  50. # category is highlighted in the Ace Item Menu command window, this object will
  51. # be included and shown in the item window.
  52. #
  53. # <image: string>
  54. # Uses a picture from Graphics\Pictures\ of your RPG Maker VX Ace Project's
  55. # directory with the filename of "string" (without the extension) as the image
  56. # picture shown in the Ace Item Menu.
  57. #
  58. # -----------------------------------------------------------------------------
  59. # Armour Notetags - These notetags go in the armour notebox in the database.
  60. # -----------------------------------------------------------------------------
  61. # <category: string>
  62. # Places this object into the item category for "string". Whenever the selected
  63. # category is highlighted in the Ace Item Menu command window, this object will
  64. # be included and shown in the item window.
  65. #
  66. # <image: string>
  67. # Uses a picture from Graphics\Pictures\ of your RPG Maker VX Ace Project's
  68. # directory with the filename of "string" (without the extension) as the image
  69. # picture shown in the Ace Item Menu.
  70. #
  71. #==============================================================================
  72. # ▼ Compatibility
  73. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  74. # This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
  75. # it will run with RPG Maker VX without adjusting.
  76. #
  77. #==============================================================================

  78. module YEA
  79.   module ITEM

  80.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  81.     # - Item Command Settings -
  82.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  83.     # This array adjusts what options appear in the initial item command window
  84.     # before the items are split into separate categories. Add commands, remove
  85.     # commands, or rearrange them. Here's a list of which does what:
  86.     #
  87.     # -------------------------------------------------------------------------
  88.     # :command         Description
  89.     # -------------------------------------------------------------------------
  90.     # :item            Opens up the various item categories. Default.
  91.     # :weapon          Opens up the various weapon categories. Default.
  92.     # :armor           Opens up the various armour categories. Default.
  93.     # :key_item        Shows a list of the various key items. Default.
  94.     #
  95.     # :gogototori      Requires Kread-EX's Go Go Totori Synthesis.
  96.     #
  97.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  98.     COMMANDS =[
  99.       :item,         # Opens up the various item categories. Default.
  100.       :weapon,       # Opens up the various weapon categories. Default.
  101.       :armor,        # Opens up the various armour categories. Default.
  102.       :key_item,     # Shows a list of the various key items. Default.
  103.       :gogototori,   # Requires Kread-EX's Go Go Totori Synthesis.
  104.     # :custom1,      # Custom command 1.
  105.     # :custom2,      # Custom command 2.
  106.     ] # Do not remove this.

  107.     #--------------------------------------------------------------------------
  108.     # - Item Custom Commands -
  109.     # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  110.     # For those who use scripts to that may produce unique effects for the item
  111.     # scene, use this hash to manage the custom commands for the Item Command
  112.     # Window. You can disable certain commands or prevent them from appearing
  113.     # by using switches. If you don't wish to bind them to a switch, set the
  114.     # proper switch to 0 for it to have no impact.
  115.     #--------------------------------------------------------------------------
  116.     CUSTOM_ITEM_COMMANDS ={
  117.     # :command => ["Display Name", EnableSwitch, ShowSwitch, Handler Method],
  118.       :gogototori => ["合成",            0,         0, :command_totori],
  119.       :custom1 => [ "自定義名稱",            0,          0, :command_name1],
  120.       :custom2 => [ "自定義文本",           13,          0, :command_name2],
  121.     } # Do not remove this.

  122.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  123.     # - Item Type Settings -
  124.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  125.     # These arrays adjusts and shows the various item types shown for Items,
  126.     # Weapons, and Armours. Note that when using :category symbols, the
  127.     # specific category shown will be equal to the text used for the Display
  128.     # and the included item must contain a category equal to the Display name.
  129.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  130.     # This array contains the order for the Item categories.
  131.     ITEM_TYPES =[
  132.     # [  :symbol,   "Display"],
  133.       [:all,       "全部"], # Shows all usable items.
  134.       [:field,     "背包内"], # Shows Menu-usable items.
  135.       [:battle,    "战斗用"], # Shows Battle-usable items.
  136.       [:category,   "材料"], # Categorized by <category: 材料>
  137.       [:category,"特别"], # Categorized by <category: 特别>
  138.       [:category,"石头"], # Categorized by <category: 石头>
  139.       [:category,"宝珠"], # Categorized by <category: 宝珠>
  140.       [:category,"药剂"], # Categorized by <category: 技能书>
  141.       [:category,"技能书"], # Categorized by <category: 药剂>
  142.       [:category,"宝物"], # Categorized by <category: 宝物>
  143.       [:category,  "进阶"], # Shows all key items.
  144.     ] # Do not remove this.

  145.     # This array contains the order for the Weapon categories.
  146.     WEAPON_TYPES =[
  147.     # [  :symbol,   "Display"],
  148.       [   :types,  "WPNTYPES"], # Lists all of the individual weapon types.
  149.       [     :all,       "全部"], # Shows all weapons.
  150.     ] # Do not remove this.

  151.     # This array contains the order for the Armour categories.
  152.     ARMOUR_TYPES =[
  153.     # [  :symbol,   "Display"],
  154.       [   :slots,  "ARMSLOTS"], # Lists all of the individual armour slots.
  155.       [   :types,  "ARMTYPES"], # Lists all of the individual armours types.
  156.       [     :all,       "全部"], # Shows all armours.
  157.     ] # Do not remove this.

  158.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  159.     # - Item Status Settings -
  160.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  161.     # The item status window displays information about the item in detail.
  162.     # Adjust the settings below to change the way the status window appears.
  163.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  164.     STATUS_FONT_SIZE = 20       # Font size used for status window.
  165.     MAX_ICONS_DRAWN  = 10       # Maximum number of icons drawn for states.

  166.     # The following adjusts the vocabulary used for the status window. Each
  167.     # of the vocabulary settings are self explanatory.
  168.     VOCAB_STATUS ={
  169.       :empty      => "---",          # Text used when nothing is shown.
  170.       :hp_recover => "回复血量",      # Text used for HP Recovery.
  171.       :mp_recover => "回复魔法",      # Text used for MP Recovery.
  172.       :tp_recover => "回复TP",      # Text used for TP Recovery.
  173.       :tp_gain    => "增加TP",      # Text used for TP Gain.
  174.       :applies    => "增加效果",      # Text used for applied states and buffs.
  175.       :removes    => "移除效果",      # Text used for removed states and buffs.
  176.     } # Do not remove this.

  177.   end # ITEM
  178. end # YEA

  179. #==============================================================================
  180. # ▼ Editting anything past this point may potentially result in causing
  181. # computer damage, incontinence, explosion of user's head, coma, death, and/or
  182. # halitosis so edit at your own risk.
  183. #==============================================================================

  184. module YEA
  185.   module REGEXP
  186.   module BASEITEM

  187.     CATEGORY = /<(?:CATEGORIES|category):[ ](.*)>/i
  188.     IMAGE    = /<(?:IMAGE|image):[ ](.*)>/i

  189.   end # BASEITEM
  190.   end # REGEXP
  191. end # YEA

  192. #==============================================================================
  193. # ■ Numeric
  194. #==============================================================================

  195. class Numeric

  196.   #--------------------------------------------------------------------------
  197.   # new method: group_digits
  198.   #--------------------------------------------------------------------------
  199.   unless $imported["YEA-CoreEngine"]
  200.   def group; return self.to_s; end
  201.   end # $imported["YEA-CoreEngine"]

  202. end # Numeric

  203. #==============================================================================
  204. # ■ Vocab
  205. #==============================================================================

  206. module Vocab

  207.   #--------------------------------------------------------------------------
  208.   # new method: self.item_status
  209.   #--------------------------------------------------------------------------
  210.   def self.item_status(type)
  211.     return YEA::ITEM::VOCAB_STATUS[type]
  212.   end

  213. end # Vocab

  214. #==============================================================================
  215. # ■ DataManager
  216. #==============================================================================

  217. module DataManager

  218.   #--------------------------------------------------------------------------
  219.   # alias method: load_database
  220.   #--------------------------------------------------------------------------
  221.   class <<self; alias load_database_aim load_database; end
  222.   def self.load_database
  223.     load_database_aim
  224.     load_notetags_aim
  225.   end

  226.   #--------------------------------------------------------------------------
  227.   # new method: load_notetags_aim
  228.   #--------------------------------------------------------------------------
  229.   def self.load_notetags_aim
  230.     groups = [$data_items, $data_weapons, $data_armors]
  231.     for group in groups
  232.       for obj in group
  233.         next if obj.nil?
  234.         obj.load_notetags_aim
  235.       end
  236.     end
  237.   end

  238. end # DataManager

  239. #==============================================================================
  240. # ■ RPG::BaseItem
  241. #==============================================================================

  242. class RPG::BaseItem

  243.   #--------------------------------------------------------------------------
  244.   # public instance variables
  245.   #--------------------------------------------------------------------------
  246.   attr_accessor :category
  247.   attr_accessor :image

  248.   #--------------------------------------------------------------------------
  249.   # common cache: load_notetags_aim
  250.   #--------------------------------------------------------------------------
  251.   def load_notetags_aim
  252.     @category = []
  253.     #---
  254.     self.note.split(/[\r\n]+/).each { |line|
  255.       case line
  256.       #---
  257.       when YEA::REGEXP::BASEITEM::CATEGORY
  258.         @category.push($1.upcase.to_s)
  259.       when YEA::REGEXP::BASEITEM::IMAGE
  260.         @image = $1.to_s
  261.       end
  262.     } # self.note.split
  263.     #---
  264.   end

  265. end # RPG::BaseItem

  266. #==============================================================================
  267. # ■ Game_Temp
  268. #==============================================================================

  269. class Game_Temp

  270.   #--------------------------------------------------------------------------
  271.   # public instance variables
  272.   #--------------------------------------------------------------------------
  273.   attr_accessor :scene_item_index
  274.   attr_accessor :scene_item_oy

  275. end # Game_Temp

  276. #==============================================================================
  277. # ■ Window_ItemList
  278. #==============================================================================

  279. class Window_ItemList < Window_Selectable

  280.   #--------------------------------------------------------------------------
  281.   # overwrite method: draw_item
  282.   #--------------------------------------------------------------------------
  283.   def draw_item(index)
  284.     item = @data[index]
  285.     return if item.nil?
  286.     rect = item_rect(index)
  287.     rect.width -= 4
  288.     draw_item_name(item, rect.x, rect.y, enable?(item), rect.width - 24)
  289.     draw_item_number(rect, item)
  290.   end

  291. end # Window_ItemList

  292. #==============================================================================
  293. # ■ Window_ItemCommand
  294. #==============================================================================

  295. class Window_ItemCommand < Window_Command

  296.   #--------------------------------------------------------------------------
  297.   # public instance variables
  298.   #--------------------------------------------------------------------------
  299.   attr_reader   :item_window

  300.   #--------------------------------------------------------------------------
  301.   # initialize
  302.   #--------------------------------------------------------------------------
  303.   def initialize(x, y)
  304.     super(x, y)
  305.   end

  306.   #--------------------------------------------------------------------------
  307.   # window_width
  308.   #--------------------------------------------------------------------------
  309.   def window_width; return 160; end

  310.   #--------------------------------------------------------------------------
  311.   # visible_line_number
  312.   #--------------------------------------------------------------------------
  313.   def visible_line_number; return 4; end

  314.   #--------------------------------------------------------------------------
  315.   # process_ok
  316.   #--------------------------------------------------------------------------
  317.   def process_ok
  318.     $game_temp.scene_item_index = index
  319.     $game_temp.scene_item_oy = self.oy
  320.     super
  321.   end

  322.   #--------------------------------------------------------------------------
  323.   # make_command_list
  324.   #--------------------------------------------------------------------------
  325.   def make_command_list
  326.     for command in YEA::ITEM::COMMANDS
  327.       case command
  328.       #--- Default Commands ---
  329.       when :item
  330.         add_command(Vocab::item, :item)
  331.       when :weapon
  332.         add_command(Vocab::weapon, :weapon)
  333.       when :armor
  334.         add_command(Vocab::armor, :armor)
  335.       when :key_item
  336.         add_command(Vocab::key_item, :key_item)
  337.       #--- Imported ---
  338.       when :gogototori
  339.         next unless $imported["KRX-AlchemicSynthesis"]
  340.         process_custom_command(command)
  341.       #--- Custom Commands ---
  342.       else
  343.         process_custom_command(command)
  344.       end
  345.     end
  346.   end

  347.   #--------------------------------------------------------------------------
  348.   # process_custom_command
  349.   #--------------------------------------------------------------------------
  350.   def process_custom_command(command)
  351.     return unless YEA::ITEM::CUSTOM_ITEM_COMMANDS.include?(command)
  352.     show = YEA::ITEM::CUSTOM_ITEM_COMMANDS[command][2]
  353.     continue = show <= 0 ? true : $game_switches[show]
  354.     return unless continue
  355.     text = YEA::ITEM::CUSTOM_ITEM_COMMANDS[command][0]
  356.     switch = YEA::ITEM::CUSTOM_ITEM_COMMANDS[command][1]
  357.     enabled = switch <= 0 ? true : $game_switches[switch]
  358.     add_command(text, command, enabled)
  359.   end

  360.   #--------------------------------------------------------------------------
  361.   # update
  362.   #--------------------------------------------------------------------------
  363.   def update
  364.     super
  365.     return unless self.active
  366.     @item_window.category = current_symbol if @item_window
  367.   end

  368.   #--------------------------------------------------------------------------
  369.   # item_window=
  370.   #--------------------------------------------------------------------------
  371.   def item_window=(item_window)
  372.     @item_window = item_window
  373.     update
  374.   end

  375. end # Window_ItemCommand

  376. #==============================================================================
  377. # ■ Window_ItemType
  378. #==============================================================================

  379. class Window_ItemType < Window_Command

  380.   #--------------------------------------------------------------------------
  381.   # public instance variables
  382.   #--------------------------------------------------------------------------
  383.   attr_reader   :item_window

  384.   #--------------------------------------------------------------------------
  385.   # initialize
  386.   #--------------------------------------------------------------------------
  387.   def initialize(x, y)
  388.     super(x, y)
  389.     deactivate
  390.     @type = nil
  391.   end

  392.   #--------------------------------------------------------------------------
  393.   # window_width
  394.   #--------------------------------------------------------------------------
  395.   def window_width; return 160; end

  396.   #--------------------------------------------------------------------------
  397.   # visible_line_number
  398.   #--------------------------------------------------------------------------
  399.   def visible_line_number; return 4; end

  400.   #--------------------------------------------------------------------------
  401.   # reveal
  402.   #--------------------------------------------------------------------------
  403.   def reveal(type)
  404.     @type = type
  405.     refresh
  406.     activate
  407.     select(0)
  408.   end

  409.   #--------------------------------------------------------------------------
  410.   # make_command_list
  411.   #--------------------------------------------------------------------------
  412.   def make_command_list
  413.     return if @type.nil?
  414.     #---
  415.     case @type
  416.     when :item
  417.       commands = YEA::ITEM::ITEM_TYPES
  418.     when :weapon
  419.       commands = YEA::ITEM::WEAPON_TYPES
  420.     else
  421.       commands = YEA::ITEM::ARMOUR_TYPES
  422.     end
  423.     #---
  424.     for command in commands
  425.       case command[0]
  426.       #---
  427.       when :types
  428.         case @type
  429.         when :weapon
  430.           for i in 1...$data_system.weapon_types.size
  431.             name = $data_system.weapon_types[i]
  432.             add_command(name, :w_type, true, i)
  433.           end
  434.         else
  435.           for i in 1...$data_system.armor_types.size
  436.             name = $data_system.armor_types[i]
  437.             add_command(name, :a_type, true, i)
  438.           end
  439.         end
  440.       #---
  441.       when :slots
  442.         if $imported["YEA-AceEquipEngine"]
  443.           maximum = 1
  444.           for key in YEA::EQUIP::TYPES
  445.             maximum = [maximum, key[0]].max
  446.           end
  447.         else
  448.           maximum = 4
  449.         end
  450.         for i in 1..maximum
  451.           name = Vocab::etype(i)
  452.           add_command(name, :e_type, true, i) if name != ""
  453.         end
  454.       #---
  455.       else
  456.         add_command(command[1], command[0], true, @type)
  457.       end
  458.     end
  459.   end

  460.   #--------------------------------------------------------------------------
  461.   # update
  462.   #--------------------------------------------------------------------------
  463.   def update
  464.     super
  465.     return unless self.active
  466.     @item_window.category = current_symbol if @item_window
  467.   end

  468.   #--------------------------------------------------------------------------
  469.   # item_window=
  470.   #--------------------------------------------------------------------------
  471.   def item_window=(item_window)
  472.     @item_window = item_window
  473.     update
  474.   end

  475. end # Window_ItemType

  476. #==============================================================================
  477. # ■ Window_ItemList
  478. #==============================================================================

  479. class Window_ItemList < Window_Selectable

  480.   #--------------------------------------------------------------------------
  481.   # alias method: initialize
  482.   #--------------------------------------------------------------------------
  483.   alias window_itemlist_initialize_aim initialize
  484.   def initialize(dx, dy, dw, dh)
  485.     window_itemlist_initialize_aim(dx, dy, dw, dh)
  486.     @ext = :none
  487.     @name = ""
  488.   end

  489.   #--------------------------------------------------------------------------
  490.   # alias method: category=
  491.   #--------------------------------------------------------------------------
  492.   alias window_itemlist_category_aim category=
  493.   def category=(category)
  494.     if @types_window.nil?
  495.       window_itemlist_category_aim(category)
  496.     else
  497.       return unless update_types?(category)
  498.       @category = category
  499.       if @types_window.active
  500.         @name = @types_window.current_data[:name]
  501.         @ext = @types_window.current_ext
  502.       end
  503.       refresh
  504.       self.oy = 0
  505.     end
  506.   end

  507.   #--------------------------------------------------------------------------
  508.   # new method: update_types?
  509.   #--------------------------------------------------------------------------
  510.   def update_types?(category)
  511.     return true if @category != category
  512.     return false unless @types_window.active
  513.     if category == :category
  514.       return @name != @types_window.current_data[:name]
  515.     end
  516.     return @ext != @types_window.current_ext
  517.   end

  518.   #--------------------------------------------------------------------------
  519.   # new method: types_window=
  520.   #--------------------------------------------------------------------------
  521.   def types_window=(window)
  522.     @types_window = window
  523.   end

  524.   #--------------------------------------------------------------------------
  525.   # alias method: include?
  526.   #--------------------------------------------------------------------------
  527.   alias window_itemlist_include_aim include?
  528.   def include?(item)
  529.     if @types_window.nil?
  530.       return window_itemlist_include_aim(item)
  531.     else
  532.       return ace_item_menu_include?(item)
  533.     end
  534.   end

  535.   #--------------------------------------------------------------------------
  536.   # new method: ace_item_menu_include?
  537.   #--------------------------------------------------------------------------
  538.   def ace_item_menu_include?(item)
  539.     case @category
  540.     #---
  541.     when :field
  542.       return false unless item.is_a?(RPG::Item)
  543.       return item.menu_ok?
  544.     when :battle
  545.       return false unless item.is_a?(RPG::Item)
  546.       return item.battle_ok?
  547.     #---
  548.     when :w_type
  549.       return false unless item.is_a?(RPG::Weapon)
  550.       return item.wtype_id == @types_window.current_ext
  551.     when :a_type
  552.       return false unless item.is_a?(RPG::Armor)
  553.       return item.atype_id == @types_window.current_ext
  554.     when :e_type
  555.       return false unless item.is_a?(RPG::Armor)
  556.       return item.etype_id == @types_window.current_ext
  557.     #---
  558.     when :all
  559.       case @types_window.current_ext
  560.       when :item
  561.         return item.is_a?(RPG::Item)
  562.       when :weapon
  563.         return item.is_a?(RPG::Weapon)
  564.       else
  565.         return item.is_a?(RPG::Armor)
  566.       end
  567.     #---
  568.     when :category
  569.       case @types_window.current_ext
  570.       when :item
  571.         return false unless item.is_a?(RPG::Item)
  572.       when :weapon
  573.         return false unless item.is_a?(RPG::Weapon)
  574.       else
  575.         return false unless item.is_a?(RPG::Armor)
  576.       end
  577.       return item.category.include?(@types_window.current_data[:name].upcase)
  578.     #---
  579.     else
  580.       return window_itemlist_include_aim(item)
  581.     end
  582.   end

  583. end # Window_ItemList

  584. #==============================================================================
  585. # ■ Window_ItemStatus
  586. #==============================================================================

  587. class Window_ItemStatus < Window_Base

  588.   #--------------------------------------------------------------------------
  589.   # initialize
  590.   #--------------------------------------------------------------------------
  591.   def initialize(dx, dy, item_window)
  592.     super(dx, dy, Graphics.width - dx, fitting_height(4))
  593.     @item_window = item_window
  594.     @item = nil
  595.     refresh
  596.   end

  597.   #--------------------------------------------------------------------------
  598.   # update
  599.   #--------------------------------------------------------------------------
  600.   def update
  601.     super
  602.     update_item(@item_window.item)
  603.   end

  604.   #--------------------------------------------------------------------------
  605.   # update_item
  606.   #--------------------------------------------------------------------------
  607.   def update_item(item)
  608.     return if @item == item
  609.     @item = item
  610.     refresh
  611.   end

  612.   #--------------------------------------------------------------------------
  613.   # refresh
  614.   #--------------------------------------------------------------------------
  615.   def refresh
  616.     contents.clear
  617.     reset_font_settings
  618.     return draw_empty if @item.nil?
  619.     contents.font.size = YEA::ITEM::STATUS_FONT_SIZE
  620.     draw_item_image
  621.     draw_item_stats
  622.     draw_item_effects
  623.   end

  624.   #--------------------------------------------------------------------------
  625.   # draw_empty
  626.   #--------------------------------------------------------------------------
  627.   def draw_empty
  628.     colour = Color.new(0, 0, 0, translucent_alpha/2)
  629.     rect = Rect.new(1, 1, 94, 94)
  630.     contents.fill_rect(rect, colour)
  631.     dx = 96; dy = 0
  632.     dw = (contents.width - 96) / 2
  633.     for i in 0...8
  634.       draw_background_box(dx, dy, dw)
  635.       dx = dx >= 96 + dw ? 96 : 96 + dw
  636.       dy += line_height if dx == 96
  637.     end
  638.   end

  639.   #--------------------------------------------------------------------------
  640.   # draw_background_box
  641.   #--------------------------------------------------------------------------
  642.   def draw_background_box(dx, dy, dw)
  643.     colour = Color.new(0, 0, 0, translucent_alpha/2)
  644.     rect = Rect.new(dx+1, dy+1, dw-2, line_height-2)
  645.     contents.fill_rect(rect, colour)
  646.   end

  647.   #--------------------------------------------------------------------------
  648.   # draw_item_image
  649.   #--------------------------------------------------------------------------
  650.   def draw_item_image
  651.     colour = Color.new(0, 0, 0, translucent_alpha/2)
  652.     rect = Rect.new(1, 1, 94, 94)
  653.     contents.fill_rect(rect, colour)
  654.     if @item.image.nil?
  655.       icon_index = @item.icon_index
  656.       bitmap = Cache.system("Iconset")
  657.       rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
  658.       target = Rect.new(0, 0, 96, 96)
  659.       contents.stretch_blt(target, bitmap, rect)
  660.     else
  661.       bitmap = Cache.picture(@item.image)
  662.       contents.blt(0, 0, bitmap, bitmap.rect, 255)
  663.     end
  664.   end

  665.   #--------------------------------------------------------------------------
  666.   # draw_item_stats
  667.   #--------------------------------------------------------------------------
  668.   def draw_item_stats
  669.     return unless @item.is_a?(RPG::Weapon) || @item.is_a?(RPG::Armor)
  670.     dx = 96; dy = 0
  671.     dw = (contents.width - 96) / 2
  672.     for i in 0...8
  673.       draw_equip_param(i, dx, dy, dw)
  674.       dx = dx >= 96 + dw ? 96 : 96 + dw
  675.       dy += line_height if dx == 96
  676.     end
  677.   end

  678.   #--------------------------------------------------------------------------
  679.   # draw_equip_param
  680.   #--------------------------------------------------------------------------
  681.   def draw_equip_param(param_id, dx, dy, dw)
  682.     draw_background_box(dx, dy, dw)
  683.     change_color(system_color)
  684.     draw_text(dx+4, dy, dw-8, line_height, Vocab::param(param_id))
  685.     if $imported["YEA-EquipDynamicStats"]
  686.       draw_percentage_param(param_id, dx, dy, dw)
  687.     else
  688.       draw_set_param(param_id, dx, dy, dw)
  689.     end
  690.   end

  691.   #--------------------------------------------------------------------------
  692.   # draw_percentage_param
  693.   #--------------------------------------------------------------------------
  694.   def draw_percentage_param(param_id, dx, dy, dw)
  695.     if @item.per_params[param_id] != 0 && @item.params[param_id] != 0
  696.       text = draw_set_param(param_id, dx, dy, dw)
  697.       dw -= text_size(text).width
  698.       draw_percent_param(param_id, dx, dy, dw)
  699.     elsif @item.per_params[param_id] != 0 && @item.params[param_id] == 0
  700.       draw_percent_param(param_id, dx, dy, dw)
  701.     else
  702.       draw_set_param(param_id, dx, dy, dw)
  703.     end
  704.   end

  705.   #--------------------------------------------------------------------------
  706.   # draw_set_param
  707.   #--------------------------------------------------------------------------
  708.   def draw_set_param(param_id, dx, dy, dw)
  709.     value = @item.params[param_id]
  710.     if $imported["YEA-EquipDynamicStats"] && @item.var_params[param_id] > 0
  711.       value += $game_variables[@item.var_params[param_id]] rescue 0
  712.     end
  713.     change_color(param_change_color(value), value != 0)
  714.     text = value.group
  715.     text = "+" + text if value > 0
  716.     draw_text(dx+4, dy, dw-8, line_height, text, 2)
  717.     return text
  718.   end

  719.   #--------------------------------------------------------------------------
  720.   # draw_percent_param
  721.   #--------------------------------------------------------------------------
  722.   def draw_percent_param(param_id, dx, dy, dw)
  723.     value = @item.per_params[param_id]
  724.     change_color(param_change_color(value))
  725.     text = (@item.per_params[param_id] * 100).to_i.group + "%"
  726.     text = "+" + text if @item.per_params[param_id] > 0
  727.     draw_text(dx+4, dy, dw-8, line_height, text, 2)
  728.     return text
  729.   end

  730.   #--------------------------------------------------------------------------
  731.   # draw_item_effects
  732.   #--------------------------------------------------------------------------
  733.   def draw_item_effects
  734.     return unless @item.is_a?(RPG::Item)
  735.     dx = 96; dy = 0
  736.     dw = (contents.width - 96) / 2
  737.     draw_hp_recover(dx, dy + line_height * 0, dw)
  738.     draw_mp_recover(dx, dy + line_height * 1, dw)
  739.     draw_tp_recover(dx + dw, dy + line_height * 0, dw)
  740.     draw_tp_gain(dx + dw, dy + line_height * 1, dw)
  741.     dw = contents.width - 96
  742.     draw_applies(dx, dy + line_height * 2, dw)
  743.     draw_removes(dx, dy + line_height * 3, dw)
  744.   end

  745.   #--------------------------------------------------------------------------
  746.   # draw_hp_recover
  747.   #--------------------------------------------------------------------------
  748.   def draw_hp_recover(dx, dy, dw)
  749.     draw_background_box(dx, dy, dw)
  750.     change_color(system_color)
  751.     draw_text(dx+4, dy, dw-8, line_height, Vocab::item_status(:hp_recover))
  752.     per = 0
  753.     set = 0
  754.     for effect in @item.effects
  755.       next unless effect.code == 11
  756.       per += (effect.value1 * 100).to_i
  757.       set += effect.value2.to_i
  758.     end
  759.     if per != 0 && set != 0
  760.       change_color(param_change_color(set))
  761.       text = set > 0 ? sprintf("+%s", set.group) : set.group
  762.       draw_text(dx+4, dy, dw-8, line_height, text, 2)
  763.       dw -= text_size(text).width
  764.       change_color(param_change_color(per))
  765.       text = per > 0 ? sprintf("+%s%%", per.group) : sprintf("%s%%", per.group)
  766.       draw_text(dx+4, dy, dw-8, line_height, text, 2)
  767.       return
  768.     elsif per != 0
  769.       change_color(param_change_color(per))
  770.       text = per > 0 ? sprintf("+%s%%", per.group) : sprintf("%s%%", per.group)
  771.     elsif set != 0
  772.       change_color(param_change_color(set))
  773.       text = set > 0 ? sprintf("+%s", set.group) : set.group
  774.     else
  775.       change_color(normal_color, false)
  776.       text = Vocab::item_status(:empty)
  777.     end
  778.     draw_text(dx+4, dy, dw-8, line_height, text, 2)
  779.   end

  780.   #--------------------------------------------------------------------------
  781.   # draw_mp_recover
  782.   #--------------------------------------------------------------------------
  783.   def draw_mp_recover(dx, dy, dw)
  784.     draw_background_box(dx, dy, dw)
  785.     change_color(system_color)
  786.     draw_text(dx+4, dy, dw-8, line_height, Vocab::item_status(:mp_recover))
  787.     per = 0
  788.     set = 0
  789.     for effect in @item.effects
  790.       next unless effect.code == 12
  791.       per += (effect.value1 * 100).to_i
  792.       set += effect.value2.to_i
  793.     end
  794.     if per != 0 && set != 0
  795.       change_color(param_change_color(set))
  796.       text = set > 0 ? sprintf("+%s", set.group) : set.group
  797.       draw_text(dx+4, dy, dw-8, line_height, text, 2)
  798.       dw -= text_size(text).width
  799.       change_color(param_change_color(per))
  800.       text = per > 0 ? sprintf("+%s%%", per.group) : sprintf("%s%%", per.group)
  801.       draw_text(dx+4, dy, dw-8, line_height, text, 2)
  802.       return
  803.     elsif per != 0
  804.       change_color(param_change_color(per))
  805.       text = per > 0 ? sprintf("+%s%%", per.group) : sprintf("%s%%", per.group)
  806.     elsif set != 0
  807.       change_color(param_change_color(set))
  808.       text = set > 0 ? sprintf("+%s", set.group) : set.group
  809.     else
  810.       change_color(normal_color, false)
  811.       text = Vocab::item_status(:empty)
  812.     end
  813.     draw_text(dx+4, dy, dw-8, line_height, text, 2)
  814.   end

  815.   #--------------------------------------------------------------------------
  816.   # draw_tp_recover
  817.   #--------------------------------------------------------------------------
  818.   def draw_tp_recover(dx, dy, dw)
  819.     draw_background_box(dx, dy, dw)
  820.     change_color(system_color)
  821.     draw_text(dx+4, dy, dw-8, line_height, Vocab::item_status(:tp_recover))
  822.     set = 0
  823.     for effect in @item.effects
  824.       next unless effect.code == 13
  825.       set += effect.value1.to_i
  826.     end
  827.     if set != 0
  828.       change_color(param_change_color(set))
  829.       text = set > 0 ? sprintf("+%s", set.group) : set.group
  830.     else
  831.       change_color(normal_color, false)
  832.       text = Vocab::item_status(:empty)
  833.     end
  834.     draw_text(dx+4, dy, dw-8, line_height, text, 2)
  835.   end

  836.   #--------------------------------------------------------------------------
  837.   # draw_tp_gain
  838.   #--------------------------------------------------------------------------
  839.   def draw_tp_gain(dx, dy, dw)
  840.     draw_background_box(dx, dy, dw)
  841.     change_color(system_color)
  842.     draw_text(dx+4, dy, dw-8, line_height, Vocab::item_status(:tp_gain))
  843.     set = @item.tp_gain
  844.     if set != 0
  845.       change_color(param_change_color(set))
  846.       text = set > 0 ? sprintf("+%s", set.group) : set.group
  847.     else
  848.       change_color(normal_color, false)
  849.       text = Vocab::item_status(:empty)
  850.     end
  851.     draw_text(dx+4, dy, dw-8, line_height, text, 2)
  852.   end

  853.   #--------------------------------------------------------------------------
  854.   # draw_applies
  855.   #--------------------------------------------------------------------------
  856.   def draw_applies(dx, dy, dw)
  857.     draw_background_box(dx, dy, dw)
  858.     change_color(system_color)
  859.     draw_text(dx+4, dy, dw-8, line_height, Vocab::item_status(:applies))
  860.     icons = []
  861.     for effect in @item.effects
  862.       case effect.code
  863.       when 21
  864.         next unless effect.value1 > 0
  865.         next if $data_states[effect.value1].nil?
  866.         icons.push($data_states[effect.data_id].icon_index)
  867.       when 31
  868.         icons.push($game_actors[1].buff_icon_index(1, effect.data_id))
  869.       when 32
  870.         icons.push($game_actors[1].buff_icon_index(-1, effect.data_id))
  871.       end
  872.       icons.delete(0)
  873.       break if icons.size >= YEA::ITEM::MAX_ICONS_DRAWN
  874.     end
  875.     draw_icons(dx, dy, dw, icons)
  876.   end

  877.   #--------------------------------------------------------------------------
  878.   # draw_removes
  879.   #--------------------------------------------------------------------------
  880.   def draw_removes(dx, dy, dw)
  881.     draw_background_box(dx, dy, dw)
  882.     change_color(system_color)
  883.     draw_text(dx+4, dy, dw-8, line_height, Vocab::item_status(:removes))
  884.     icons = []
  885.     for effect in @item.effects
  886.       case effect.code
  887.       when 22
  888.         next unless effect.value1 > 0
  889.         next if $data_states[effect.value1].nil?
  890.         icons.push($data_states[effect.data_id].icon_index)
  891.       when 33
  892.         icons.push($game_actors[1].buff_icon_index(1, effect.data_id))
  893.       when 34
  894.         icons.push($game_actors[1].buff_icon_index(-1, effect.data_id))
  895.       end
  896.       icons.delete(0)
  897.       break if icons.size >= YEA::ITEM::MAX_ICONS_DRAWN
  898.     end
  899.     draw_icons(dx, dy, dw, icons)
  900.   end

  901.   #--------------------------------------------------------------------------
  902.   # draw_icons
  903.   #--------------------------------------------------------------------------
  904.   def draw_icons(dx, dy, dw, icons)
  905.     dx += dw - 4
  906.     dx -= icons.size * 24
  907.     for icon_id in icons
  908.       draw_icon(icon_id, dx, dy)
  909.       dx += 24
  910.     end
  911.     if icons.size == 0
  912.       change_color(normal_color, false)
  913.       text = Vocab::item_status(:empty)
  914.       draw_text(4, dy, contents.width-8, line_height, text, 2)
  915.     end
  916.   end

  917. end # Window_ItemStatus

  918. #==============================================================================
  919. # ■ Scene_Item
  920. #==============================================================================

  921. class Scene_Item < Scene_ItemBase

  922.   #--------------------------------------------------------------------------
  923.   # alias method: start
  924.   #--------------------------------------------------------------------------
  925.   alias scene_item_start_aim start
  926.   def start
  927.     scene_item_start_aim
  928.     create_types_window
  929.     create_status_window
  930.     relocate_windows
  931.   end

  932.   #--------------------------------------------------------------------------
  933.   # overwrite method: return_scene
  934.   #--------------------------------------------------------------------------
  935.   def return_scene
  936.     $game_temp.scene_item_index = nil
  937.     $game_temp.scene_item_oy = nil
  938.     super
  939.   end

  940.   #--------------------------------------------------------------------------
  941.   # overwrite method: create_category_window
  942.   #--------------------------------------------------------------------------
  943.   def create_category_window
  944.     wy = @help_window.height
  945.     @category_window = Window_ItemCommand.new(0, wy)
  946.     @category_window.viewport = @viewport
  947.     @category_window.help_window = @help_window
  948.     @category_window.y = @help_window.height
  949.     if !$game_temp.scene_item_index.nil?
  950.       @category_window.select($game_temp.scene_item_index)
  951.       @category_window.oy = $game_temp.scene_item_oy
  952.     end
  953.     $game_temp.scene_item_index = nil
  954.     $game_temp.scene_item_oy = nil
  955.     @category_window.set_handler(:ok, method(:on_category_ok))
  956.     @category_window.set_handler(:cancel, method(:return_scene))
  957.     @category_window.set_handler(:item, method(:open_types))
  958.     @category_window.set_handler(:weapon, method(:open_types))
  959.     @category_window.set_handler(:armor, method(:open_types))
  960.     process_custom_item_commands
  961.   end

  962.   #--------------------------------------------------------------------------
  963.   # new method: process_custom_item_commands
  964.   #--------------------------------------------------------------------------
  965.   def process_custom_item_commands
  966.     for command in YEA::ITEM::COMMANDS
  967.       next unless YEA::ITEM::CUSTOM_ITEM_COMMANDS.include?(command)
  968.       called_method = YEA::ITEM::CUSTOM_ITEM_COMMANDS[command][3]
  969.       @category_window.set_handler(command, method(called_method))
  970.     end
  971.   end

  972.   #--------------------------------------------------------------------------
  973.   # new method: create_types_window
  974.   #--------------------------------------------------------------------------
  975.   def create_types_window
  976.     wy = @category_window.y
  977.     @types_window = Window_ItemType.new(Graphics.width, wy)
  978.     @types_window.viewport = @viewport
  979.     @types_window.help_window = @help_window
  980.     @types_window.y = @help_window.height
  981.     @types_window.item_window = @item_window
  982.     @item_window.types_window = @types_window
  983.     @types_window.set_handler(:ok, method(:on_types_ok))
  984.     @types_window.set_handler(:cancel, method(:on_types_cancel))
  985.   end

  986.   #--------------------------------------------------------------------------
  987.   # new method: create_status_window
  988.   #--------------------------------------------------------------------------
  989.   def create_status_window
  990.     wx = @category_window.width
  991.     wy = @category_window.y
  992.     @status_window = Window_ItemStatus.new(wx, wy, @item_window)
  993.     @status_window.viewport = @viewport
  994.   end

  995.   #--------------------------------------------------------------------------
  996.   # new method: relocate_windows
  997.   #--------------------------------------------------------------------------
  998.   def relocate_windows
  999.     return unless $imported["YEA-AceMenuEngine"]
  1000.     case Menu.help_window_location
  1001.     when 0 # Top
  1002.       @help_window.y = 0
  1003.       @category_window.y = @help_window.height
  1004.       @item_window.y = @category_window.y + @category_window.height
  1005.     when 1 # Middle
  1006.       @category_window.y = 0
  1007.       @help_window.y = @category_window.height
  1008.       @item_window.y = @help_window.y + @help_window.height
  1009.     else # Bottom
  1010.       @category_window.y = 0
  1011.       @item_window.y = @category_window.height
  1012.       @help_window.y = @item_window.y + @item_window.height
  1013.     end
  1014.     @types_window.y = @category_window.y
  1015.     @status_window.y = @category_window.y
  1016.   end

  1017.   #--------------------------------------------------------------------------
  1018.   # new method: open_categories
  1019.   #--------------------------------------------------------------------------
  1020.   def open_types
  1021.     @category_window.x = Graphics.width
  1022.     @types_window.x = 0
  1023.     @types_window.reveal(@category_window.current_symbol)
  1024.   end

  1025.   #--------------------------------------------------------------------------
  1026.   # new method: on_types_ok
  1027.   #--------------------------------------------------------------------------
  1028.   def on_types_ok
  1029.     @item_window.activate
  1030.     @item_window.select_last
  1031.   end

  1032.   #--------------------------------------------------------------------------
  1033.   # new method: on_types_cancel
  1034.   #--------------------------------------------------------------------------
  1035.   def on_types_cancel
  1036.     @category_window.x = 0
  1037.     @category_window.activate
  1038.     @types_window.unselect
  1039.     @types_window.x = Graphics.width
  1040.   end

  1041.   #--------------------------------------------------------------------------
  1042.   # alias method: on_item_cancel
  1043.   #--------------------------------------------------------------------------
  1044.   alias scene_item_on_item_cancel_aim on_item_cancel
  1045.   def on_item_cancel
  1046.     if @types_window.x <= 0
  1047.       @item_window.unselect
  1048.       @types_window.activate
  1049.     else
  1050.       scene_item_on_item_cancel_aim
  1051.     end
  1052.   end

  1053.   #--------------------------------------------------------------------------
  1054.   # new method: command_totori
  1055.   #--------------------------------------------------------------------------
  1056.   def command_totori
  1057.     SceneManager.call(Scene_Alchemy)
  1058.   end

  1059.   #--------------------------------------------------------------------------
  1060.   # new method: command_name1
  1061.   #--------------------------------------------------------------------------
  1062.   def command_name1
  1063.     # Do nothing.
  1064.   end

  1065.   #--------------------------------------------------------------------------
  1066.   # new method: command_name2
  1067.   #--------------------------------------------------------------------------
  1068.   def command_name2
  1069.     # Do nothing.
  1070.   end

  1071. end # Scene_Item

  1072. #==============================================================================
  1073. #
  1074. # ▼ End of File
  1075. #
  1076. #==============================================================================
复制代码
梦石
0
星屑
2378
在线时间
1014 小时
注册时间
2012-4-30
回帖
1459

开拓者

发表于 2017-7-27 10:24:11 | 显示全部楼层
COMMANDS[]里面添加的只能是指令(比如跳转到存到界面什么的)没办法再加一个分类给你打开

评分

参与人数 2星屑 +155 收起 理由
RaidenInfinity + 150 认可答案
踢腿水上飘 + 5 是这样啊,多谢了

查看全部评分

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部