设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 1850|回复: 3
打印 上一主题 下一主题

[已经解决] Ace Item Menu v1.02菜单加强脚本修改

[复制链接]

Lv1.梦旅人

梦石
0
星屑
96
在线时间
81 小时
注册时间
2015-6-30
帖子
48
跳转到指定楼层
1
发表于 2015-7-26 17:00:16 | 只看该作者 |只看大图 回帖奖励 |正序浏览 |阅读模式

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

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

x


使用了物品大图,上面的文字挡到了图片,不知道怎样修改,求教
  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.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  82.     # - Item Command Settings -
  83.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  84.     # This array adjusts what options appear in the initial item command window
  85.     # before the items are split into separate categories. Add commands, remove
  86.     # commands, or rearrange them. Here's a list of which does what:
  87.     #
  88.     # -------------------------------------------------------------------------
  89.     # :command         Description
  90.     # -------------------------------------------------------------------------
  91.     # :item            Opens up the various item categories. Default.
  92.     # :weapon          Opens up the various weapon categories. Default.
  93.     # :armor           Opens up the various armour categories. Default.
  94.     # :key_item        Shows a list of the various key items. Default.
  95.     #
  96.     # :gogototori      Requires Kread-EX's Go Go Totori Synthesis.
  97.     #
  98.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  99.     COMMANDS =[
  100.       :item,         # Opens up the various item categories. Default.
  101.       :weapon,       # Opens up the various weapon categories. Default.
  102.       :armor,        # Opens up the various armour categories. Default.
  103.       :key_item,     # Shows a list of the various key items. Default.
  104.       :gogototori,   # Requires Kread-EX's Go Go Totori Synthesis.
  105.     # :custom1,      # Custom command 1.
  106.     # :custom2,      # Custom command 2.
  107.     ] # Do not remove this.
  108.    
  109.     #--------------------------------------------------------------------------
  110.     # - Item Custom Commands -
  111.     # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  112.     # For those who use scripts to that may produce unique effects for the item
  113.     # scene, use this hash to manage the custom commands for the Item Command
  114.     # Window. You can disable certain commands or prevent them from appearing
  115.     # by using switches. If you don't wish to bind them to a switch, set the
  116.     # proper switch to 0 for it to have no impact.
  117.     #--------------------------------------------------------------------------
  118.     CUSTOM_ITEM_COMMANDS ={
  119.     # :command => ["Display Name", EnableSwitch, ShowSwitch, Handler Method],
  120.       :gogototori => ["合成",            0,         0, :command_totori],
  121.       :custom1 => [ "自定義名稱",            0,          0, :command_name1],
  122.       :custom2 => [ "自定義文本",           13,          0, :command_name2],
  123.     } # Do not remove this.
  124.    
  125.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  126.     # - Item Type Settings -
  127.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  128.     # These arrays adjusts and shows the various item types shown for Items,
  129.     # Weapons, and Armours. Note that when using :category symbols, the
  130.     # specific category shown will be equal to the text used for the Display
  131.     # and the included item must contain a category equal to the Display name.
  132.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  133.     # This array contains the order for the Item categories.
  134.     ITEM_TYPES =[
  135.     # [  :symbol,   "Display"],
  136.       [   :field,     "恢复"], # Shows Menu-usable items.
  137.       [  :battle,    "辅助"], # Shows Battle-usable items.
  138.       [:category,   "法宝"], # Categorized by <category: string>
  139.       [:key_item,  "貴重物品"], # Shows all key items.
  140.       [     :all,       "全部"], # Shows all usable items.
  141.     ] # Do not remove this.
  142.    
  143.     # This array contains the order for the Weapon categories.
  144.     WEAPON_TYPES =[
  145.     # [  :symbol,   "Display"],
  146.       [   :types,  "WPNTYPES"], # Lists all of the individual weapon types.
  147.       [     :all,       "全部"], # Shows all weapons.
  148.     ] # Do not remove this.
  149.    
  150.     # This array contains the order for the Armour categories.
  151.     ARMOUR_TYPES =[
  152.     # [  :symbol,   "Display"],
  153.       [   :slots,  "ARMSLOTS"], # Lists all of the individual armour slots.
  154.       [   :types,  "ARMTYPES"], # Lists all of the individual armours types.
  155.       [     :all,       "全部"], # Shows all armours.
  156.     ] # Do not remove this.
  157.    
  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.    
  167.     # The following adjusts the vocabulary used for the status window. Each
  168.     # of the vocabulary settings are self explanatory.
  169.     VOCAB_STATUS ={
  170.       :empty      => "---",          # Text used when nothing is shown.
  171.       :hp_recover => "恢复生命",      # Text used for HP Recovery.
  172.       :mp_recover => "恢复内力",      # Text used for MP Recovery.
  173.       :tp_recover => "恢复TP",      # Text used for TP Recovery.
  174.       :tp_gain    => "增加TP",      # Text used for TP Gain.
  175.       :applies    => "使用效果",      # Text used for applied states and buffs.
  176.       :removes    => "移除效果",      # Text used for removed states and buffs.
  177.     } # Do not remove this.
  178.    
  179.   end # ITEM
  180. end # YEA

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

  186. module YEA
  187.   module REGEXP
  188.   module BASEITEM
  189.    
  190.     CATEGORY = /<(?:CATEGORIES|category):[ ](.*)>/i
  191.     IMAGE    = /<(?:IMAGE|image):[ ](.*)>/i
  192.    
  193.   end # BASEITEM
  194.   end # REGEXP
  195. end # YEA

  196. #==============================================================================
  197. # ■ Numeric
  198. #==============================================================================

  199. class Numeric
  200.   
  201.   #--------------------------------------------------------------------------
  202.   # new method: group_digits
  203.   #--------------------------------------------------------------------------
  204.   unless $imported["YEA-CoreEngine"]
  205.   def group; return self.to_s; end
  206.   end # $imported["YEA-CoreEngine"]
  207.    
  208. end # Numeric

  209. #==============================================================================
  210. # ■ Vocab
  211. #==============================================================================

  212. module Vocab
  213.   
  214.   #--------------------------------------------------------------------------
  215.   # new method: self.item_status
  216.   #--------------------------------------------------------------------------
  217.   def self.item_status(type)
  218.     return YEA::ITEM::VOCAB_STATUS[type]
  219.   end
  220.   
  221. end # Vocab

  222. #==============================================================================
  223. # ■ DataManager
  224. #==============================================================================

  225. module DataManager
  226.   
  227.   #--------------------------------------------------------------------------
  228.   # alias method: load_database
  229.   #--------------------------------------------------------------------------
  230.   class <<self; alias load_database_aim load_database; end
  231.   def self.load_database
  232.     load_database_aim
  233.     load_notetags_aim
  234.   end
  235.   
  236.   #--------------------------------------------------------------------------
  237.   # new method: load_notetags_aim
  238.   #--------------------------------------------------------------------------
  239.   def self.load_notetags_aim
  240.     groups = [$data_items, $data_weapons, $data_armors]
  241.     for group in groups
  242.       for obj in group
  243.         next if obj.nil?
  244.         obj.load_notetags_aim
  245.       end
  246.     end
  247.   end
  248.   
  249. end # DataManager

  250. #==============================================================================
  251. # ■ RPG::BaseItem
  252. #==============================================================================

  253. class RPG::BaseItem
  254.   
  255.   #--------------------------------------------------------------------------
  256.   # public instance variables
  257.   #--------------------------------------------------------------------------
  258.   attr_accessor :category
  259.   attr_accessor :image
  260.   
  261.   #--------------------------------------------------------------------------
  262.   # common cache: load_notetags_aim
  263.   #--------------------------------------------------------------------------
  264.   def load_notetags_aim
  265.     @category = []
  266.     #---
  267.     self.note.split(/[\r\n]+/).each { |line|
  268.       case line
  269.       #---
  270.       when YEA::REGEXP::BASEITEM::CATEGORY
  271.         @category.push($1.upcase.to_s)
  272.       when YEA::REGEXP::BASEITEM::IMAGE
  273.         @image = $1.to_s
  274.       end
  275.     } # self.note.split
  276.     #---
  277.   end
  278.   
  279. end # RPG::BaseItem

  280. #==============================================================================
  281. # ■ Game_Temp
  282. #==============================================================================

  283. class Game_Temp
  284.   
  285.   #--------------------------------------------------------------------------
  286.   # public instance variables
  287.   #--------------------------------------------------------------------------
  288.   attr_accessor :scene_item_index
  289.   attr_accessor :scene_item_oy
  290.   
  291. end # Game_Temp

  292. #==============================================================================
  293. # ■ Window_ItemList
  294. #==============================================================================

  295. class Window_ItemList < Window_Selectable
  296.   #--------------------------------------------------------------------------
  297.   # overwrite method: draw_item
  298.   #--------------------------------------------------------------------------
  299.   def draw_item(index)
  300.     item = @data[index]
  301.     return if item.nil?
  302.     rect = item_rect(index)
  303.     rect.width -= 4
  304.     draw_item_name(item, rect.x, rect.y, enable?(item), rect.width - 24)
  305.     draw_item_number(rect, item)
  306.   end
  307.   
  308. end # Window_ItemList

  309. #==============================================================================
  310. # ■ Window_ItemCommand
  311. #==============================================================================

  312. class Window_ItemCommand < Window_Command
  313.   
  314.   #--------------------------------------------------------------------------
  315.   # public instance variables
  316.   #--------------------------------------------------------------------------
  317.   attr_reader   :item_window
  318.   
  319.   #--------------------------------------------------------------------------
  320.   # initialize
  321.   #--------------------------------------------------------------------------
  322.   def initialize(x, y)
  323.     super(x, y)
  324.   end
  325.   
  326.   #--------------------------------------------------------------------------
  327.   # window_width
  328.   #--------------------------------------------------------------------------
  329.   def window_width; return 160; end
  330.   
  331.   #--------------------------------------------------------------------------
  332.   # visible_line_number
  333.   #--------------------------------------------------------------------------
  334.   def visible_line_number; return 4; end
  335.   
  336.   #--------------------------------------------------------------------------
  337.   # process_ok
  338.   #--------------------------------------------------------------------------
  339.   def process_ok
  340.     $game_temp.scene_item_index = index
  341.     $game_temp.scene_item_oy = self.oy
  342.     super
  343.   end
  344.   
  345.   #--------------------------------------------------------------------------
  346.   # make_command_list
  347.   #--------------------------------------------------------------------------
  348.   def make_command_list
  349.     for command in YEA::ITEM::COMMANDS
  350.       case command
  351.       #--- Default Commands ---
  352.       when :item
  353.         add_command(Vocab::item, :item)
  354.       when :weapon
  355.         add_command(Vocab::weapon, :weapon)
  356.       when :armor
  357.         add_command(Vocab::armor, :armor)
  358.       when :key_item
  359.         add_command(Vocab::key_item, :key_item)
  360.       #--- Imported ---
  361.       when :gogototori
  362.         next unless $imported["KRX-AlchemicSynthesis"]
  363.         process_custom_command(command)
  364.       #--- Custom Commands ---
  365.       else
  366.         process_custom_command(command)
  367.       end
  368.     end
  369.   end
  370.   
  371.   #--------------------------------------------------------------------------
  372.   # process_custom_command
  373.   #--------------------------------------------------------------------------
  374.   def process_custom_command(command)
  375.     return unless YEA::ITEM::CUSTOM_ITEM_COMMANDS.include?(command)
  376.     show = YEA::ITEM::CUSTOM_ITEM_COMMANDS[command][2]
  377.     continue = show <= 0 ? true : $game_switches[show]
  378.     return unless continue
  379.     text = YEA::ITEM::CUSTOM_ITEM_COMMANDS[command][0]
  380.     switch = YEA::ITEM::CUSTOM_ITEM_COMMANDS[command][1]
  381.     enabled = switch <= 0 ? true : $game_switches[switch]
  382.     add_command(text, command, enabled)
  383.   end
  384.   
  385.   #--------------------------------------------------------------------------
  386.   # update
  387.   #--------------------------------------------------------------------------
  388.   def update
  389.     super
  390.     return unless self.active
  391.     @item_window.category = current_symbol if @item_window
  392.   end
  393.   
  394.   #--------------------------------------------------------------------------
  395.   # item_window=
  396.   #--------------------------------------------------------------------------
  397.   def item_window=(item_window)
  398.     @item_window = item_window
  399.     update
  400.   end
  401.   
  402. end # Window_ItemCommand

  403. #==============================================================================
  404. # ■ Window_ItemType
  405. #==============================================================================

  406. class Window_ItemType < Window_Command
  407.   
  408.   #--------------------------------------------------------------------------
  409.   # public instance variables
  410.   #--------------------------------------------------------------------------
  411.   attr_reader   :item_window
  412.   
  413.   #--------------------------------------------------------------------------
  414.   # initialize
  415.   #--------------------------------------------------------------------------
  416.   def initialize(x, y)
  417.     super(x, y)
  418.     deactivate
  419.     @type = nil
  420.   end
  421.   
  422.   #--------------------------------------------------------------------------
  423.   # window_width
  424.   #--------------------------------------------------------------------------
  425.   def window_width; return 160; end
  426.   
  427.   #--------------------------------------------------------------------------
  428.   # visible_line_number
  429.   #--------------------------------------------------------------------------
  430.   def visible_line_number; return 4; end
  431.   
  432.   #--------------------------------------------------------------------------
  433.   # reveal
  434.   #--------------------------------------------------------------------------
  435.   def reveal(type)
  436.     @type = type
  437.     refresh
  438.     activate
  439.     select(0)
  440.   end
  441.   
  442.   #--------------------------------------------------------------------------
  443.   # make_command_list
  444.   #--------------------------------------------------------------------------
  445.   def make_command_list
  446.     return if @type.nil?
  447.     #---
  448.     case @type
  449.     when :item
  450.       commands = YEA::ITEM::ITEM_TYPES
  451.     when :weapon
  452.       commands = YEA::ITEM::WEAPON_TYPES
  453.     else
  454.       commands = YEA::ITEM::ARMOUR_TYPES
  455.     end
  456.     #---
  457.     for command in commands
  458.       case command[0]
  459.       #---
  460.       when :types
  461.         case @type
  462.         when :weapon
  463.           for i in 1...$data_system.weapon_types.size
  464.             name = $data_system.weapon_types[i]
  465.             add_command(name, :w_type, true, i)
  466.           end
  467.         else
  468.           for i in 1...$data_system.armor_types.size
  469.             name = $data_system.armor_types[i]
  470.             add_command(name, :a_type, true, i)
  471.           end
  472.         end
  473.       #---
  474.       when :slots
  475.         if $imported["YEA-AceEquipEngine"]
  476.           maximum = 1
  477.           for key in YEA::EQUIP::TYPES
  478.             maximum = [maximum, key[0]].max
  479.           end
  480.         else
  481.           maximum = 4
  482.         end
  483.         for i in 1..maximum
  484.           name = Vocab::etype(i)
  485.           add_command(name, :e_type, true, i) if name != ""
  486.         end
  487.       #---
  488.       else
  489.         add_command(command[1], command[0], true, @type)
  490.       end
  491.     end
  492.   end
  493.   
  494.   #--------------------------------------------------------------------------
  495.   # update
  496.   #--------------------------------------------------------------------------
  497.   def update
  498.     super
  499.     return unless self.active
  500.     @item_window.category = current_symbol if @item_window
  501.   end
  502.   
  503.   #--------------------------------------------------------------------------
  504.   # item_window=
  505.   #--------------------------------------------------------------------------
  506.   def item_window=(item_window)
  507.     @item_window = item_window
  508.     update
  509.   end
  510.   
  511. end # Window_ItemType

  512. #==============================================================================
  513. # ■ Window_ItemList
  514. #==============================================================================

  515. class Window_ItemList < Window_Selectable
  516.   
  517.   #--------------------------------------------------------------------------
  518.   # alias method: initialize
  519.   #--------------------------------------------------------------------------
  520.   alias window_itemlist_initialize_aim initialize
  521.   def initialize(dx, dy, dw, dh)
  522.     window_itemlist_initialize_aim(dx, dy, dw, dh)
  523.     @ext = :none
  524.     @name = ""
  525.   end
  526.   
  527.   #--------------------------------------------------------------------------
  528.   # alias method: category=
  529.   #--------------------------------------------------------------------------
  530.   alias window_itemlist_category_aim category=
  531.   def category=(category)
  532.     if @types_window.nil?
  533.       window_itemlist_category_aim(category)
  534.     else
  535.       return unless update_types?(category)
  536.       @category = category
  537.       if @types_window.active
  538.         @name = @types_window.current_data[:name]
  539.         @ext = @types_window.current_ext
  540.       end
  541.       refresh
  542.       self.oy = 0
  543.     end
  544.   end
  545.   
  546.   #--------------------------------------------------------------------------
  547.   # new method: update_types?
  548.   #--------------------------------------------------------------------------
  549.   def update_types?(category)
  550.     return true if @category != category
  551.     return false unless @types_window.active
  552.     if category == :category
  553.       return @name != @types_window.current_data[:name]
  554.     end
  555.     return @ext != @types_window.current_ext
  556.   end
  557.   
  558.   #--------------------------------------------------------------------------
  559.   # new method: types_window=
  560.   #--------------------------------------------------------------------------
  561.   def types_window=(window)
  562.     @types_window = window
  563.   end
  564.   
  565.   #--------------------------------------------------------------------------
  566.   # alias method: include?
  567.   #--------------------------------------------------------------------------
  568.   alias window_itemlist_include_aim include?
  569.   def include?(item)
  570.     if @types_window.nil?
  571.       return window_itemlist_include_aim(item)
  572.     else
  573.       return ace_item_menu_include?(item)
  574.     end
  575.   end
  576.   
  577.   #--------------------------------------------------------------------------
  578.   # new method: ace_item_menu_include?
  579.   #--------------------------------------------------------------------------
  580.   def ace_item_menu_include?(item)
  581.     case @category
  582.     #---
  583.     when :field
  584.       return false unless item.is_a?(RPG::Item)
  585.       return item.menu_ok?
  586.     when :battle
  587.       return false unless item.is_a?(RPG::Item)
  588.       return item.battle_ok?
  589.     #---
  590.     when :w_type
  591.       return false unless item.is_a?(RPG::Weapon)
  592.       return item.wtype_id == @types_window.current_ext
  593.     when :a_type
  594.       return false unless item.is_a?(RPG::Armor)
  595.       return item.atype_id == @types_window.current_ext
  596.     when :e_type
  597.       return false unless item.is_a?(RPG::Armor)
  598.       return item.etype_id == @types_window.current_ext
  599.     #---
  600.     when :all
  601.       case @types_window.current_ext
  602.       when :item
  603.         return item.is_a?(RPG::Item)
  604.       when :weapon
  605.         return item.is_a?(RPG::Weapon)
  606.       else
  607.         return item.is_a?(RPG::Armor)
  608.       end
  609.     #---
  610.     when :category
  611.       case @types_window.current_ext
  612.       when :item
  613.         return false unless item.is_a?(RPG::Item)
  614.       when :weapon
  615.         return false unless item.is_a?(RPG::Weapon)
  616.       else
  617.         return false unless item.is_a?(RPG::Armor)
  618.       end
  619.       return item.category.include?(@types_window.current_data[:name].upcase)
  620.     #---
  621.     else
  622.       return window_itemlist_include_aim(item)
  623.     end
  624.   end
  625.   
  626. end # Window_ItemList

  627. #==============================================================================
  628. # ■ Window_ItemStatus
  629. #==============================================================================

  630. class Window_ItemStatus < Window_Base
  631.   
  632.   #--------------------------------------------------------------------------
  633.   # initialize
  634.   #--------------------------------------------------------------------------
  635.   def initialize(dx, dy, item_window)
  636.     super(0, 100, 300 , 250)
  637.     @item_window = item_window
  638.     @item = nil
  639.     refresh
  640.   end
  641.   
  642.   #--------------------------------------------------------------------------
  643.   # update
  644.   #--------------------------------------------------------------------------
  645.   def update
  646.     super
  647.     update_item(@item_window.item)
  648.   end
  649.   
  650.   #--------------------------------------------------------------------------
  651.   # update_item
  652.   #--------------------------------------------------------------------------
  653.   def update_item(item)
  654.     return if @item == item
  655.     @item = item
  656.     refresh
  657.   end
  658.   
  659.   #--------------------------------------------------------------------------
  660.   # refresh
  661.   #--------------------------------------------------------------------------
  662.   def refresh
  663.     contents.clear
  664.     reset_font_settings
  665.     return draw_empty if @item.nil?
  666.     contents.font.size = YEA::ITEM::STATUS_FONT_SIZE
  667.     draw_item_image
  668.     draw_item_stats
  669.     draw_item_effects
  670.   end
  671.   
  672.   #--------------------------------------------------------------------------
  673.   # draw_empty
  674.   #--------------------------------------------------------------------------
  675.   def draw_empty
  676.     colour = Color.new(0, 0, 0, translucent_alpha/2)
  677.     rect = Rect.new(1, 1, 94, 94)
  678.     contents.fill_rect(rect, colour)
  679.     dx = 96; dy = 0
  680.     dw = (contents.width - 96) / 2
  681.     for i in 0...8
  682.       draw_background_box(dx, dy, dw)
  683.       dx = dx >= 96 + dw ? 96 : 96 + dw
  684.       dy += line_height if dx == 96
  685.     end
  686.   end
  687.   
  688.   #--------------------------------------------------------------------------
  689.   # draw_background_box
  690.   #--------------------------------------------------------------------------
  691.   def draw_background_box(dx, dy, dw)
  692.     colour = Color.new(0, 0, 0, translucent_alpha/2)
  693.     rect = Rect.new(dx+1, dy+1, dw-2, line_height-2)
  694.     contents.fill_rect(rect, colour)
  695.   end
  696.   
  697.   #--------------------------------------------------------------------------
  698.   # draw_item_image
  699.   #--------------------------------------------------------------------------
  700.   def draw_item_image
  701.     colour = Color.new(0, 0, 0, translucent_alpha/2)
  702.     rect = Rect.new(1, 1, 94, 94)
  703.     contents.fill_rect(rect, colour)
  704.     if @item.image.nil?
  705.       icon_index = @item.icon_index
  706.       bitmap = Cache.system("Iconset")
  707.       rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
  708.       target = Rect.new(0, 0, 96, 96)
  709.       contents.stretch_blt(target, bitmap, rect)
  710.     else
  711.       bitmap = Cache.picture(@item.image)
  712.       contents.blt(0, 0, bitmap, bitmap.rect, 255)
  713.     end
  714.   end
  715.   
  716.   #--------------------------------------------------------------------------
  717.   # draw_item_stats
  718.   #--------------------------------------------------------------------------
  719.   def draw_item_stats
  720.     return unless @item.is_a?(RPG::Weapon) || @item.is_a?(RPG::Armor)
  721.     dx = 96; dy = 0
  722.     dw = (contents.width - 96) / 2
  723.     for i in 0...8
  724.       draw_equip_param(i, dx, dy, dw)
  725.       dx = dx >= 96 + dw ? 96 : 96 + dw
  726.       dy += line_height if dx == 96
  727.     end
  728.   end
  729.   
  730.   #--------------------------------------------------------------------------
  731.   # draw_equip_param
  732.   #--------------------------------------------------------------------------
  733.   def draw_equip_param(param_id, dx, dy, dw)
  734.     draw_background_box(dx, dy, dw)
  735.     change_color(system_color)
  736.     draw_text(dx+4, dy, dw-8, line_height, Vocab::param(param_id))
  737.     if $imported["YEA-EquipDynamicStats"]
  738.       draw_percentage_param(param_id, dx, dy, dw)
  739.     else
  740.       draw_set_param(param_id, dx, dy, dw)
  741.     end
  742.   end
  743.   
  744.   #--------------------------------------------------------------------------
  745.   # draw_percentage_param
  746.   #--------------------------------------------------------------------------
  747.   def draw_percentage_param(param_id, dx, dy, dw)
  748.     if @item.per_params[param_id] != 0 && @item.params[param_id] != 0
  749.       text = draw_set_param(param_id, dx, dy, dw)
  750.       dw -= text_size(text).width
  751.       draw_percent_param(param_id, dx, dy, dw)
  752.     elsif @item.per_params[param_id] != 0 && @item.params[param_id] == 0
  753.       draw_percent_param(param_id, dx, dy, dw)
  754.     else
  755.       draw_set_param(param_id, dx, dy, dw)
  756.     end
  757.   end
  758.   
  759.   #--------------------------------------------------------------------------
  760.   # draw_set_param
  761.   #--------------------------------------------------------------------------
  762.   def draw_set_param(param_id, dx, dy, dw)
  763.     value = @item.params[param_id]
  764.     if $imported["YEA-EquipDynamicStats"] && @item.var_params[param_id] > 0
  765.       value += $game_variables[@item.var_params[param_id]] rescue 0
  766.     end
  767.     change_color(param_change_color(value), value != 0)
  768.     text = value.group
  769.     text = "+" + text if value > 0
  770.     draw_text(dx+4, dy, dw-8, line_height, text, 2)
  771.     return text
  772.   end
  773.   
  774.   #--------------------------------------------------------------------------
  775.   # draw_percent_param
  776.   #--------------------------------------------------------------------------
  777.   def draw_percent_param(param_id, dx, dy, dw)
  778.     value = @item.per_params[param_id]
  779.     change_color(param_change_color(value))
  780.     text = (@item.per_params[param_id] * 100).to_i.group + "%"
  781.     text = "+" + text if @item.per_params[param_id] > 0
  782.     draw_text(dx+4, dy, dw-8, line_height, text, 2)
  783.     return text
  784.   end
  785.   
  786.   #--------------------------------------------------------------------------
  787.   # draw_item_effects
  788.   #--------------------------------------------------------------------------
  789.   def draw_item_effects
  790.     return unless @item.is_a?(RPG::Item)
  791.     dx = 96; dy = 0
  792.     dw = (contents.width - 96) / 2
  793.     draw_hp_recover(dx, dy + line_height * 0, dw)
  794.     draw_mp_recover(dx, dy + line_height * 1, dw)
  795.     draw_tp_recover(dx + dw, dy + line_height * 0, dw)
  796.     draw_tp_gain(dx + dw, dy + line_height * 1, dw)
  797.     dw = contents.width - 96
  798.     draw_applies(dx, dy + line_height * 2, dw)
  799.     draw_removes(dx, dy + line_height * 3, dw)
  800.   end
  801.   
  802.   #--------------------------------------------------------------------------
  803.   # draw_hp_recover
  804.   #--------------------------------------------------------------------------
  805.   def draw_hp_recover(dx, dy, dw)
  806.     draw_background_box(dx, dy, dw)
  807.     change_color(system_color)
  808.     draw_text(dx+4, dy, dw-8, line_height, Vocab::item_status(:hp_recover))
  809.     per = 0
  810.     set = 0
  811.     for effect in @item.effects
  812.       next unless effect.code == 11
  813.       per += (effect.value1 * 100).to_i
  814.       set += effect.value2.to_i
  815.     end
  816.     if per != 0 && set != 0
  817.       change_color(param_change_color(set))
  818.       text = set > 0 ? sprintf("+%s", set.group) : set.group
  819.       draw_text(dx+4, dy, dw-8, line_height, text, 2)
  820.       dw -= text_size(text).width
  821.       change_color(param_change_color(per))
  822.       text = per > 0 ? sprintf("+%s%%", per.group) : sprintf("%s%%", per.group)
  823.       draw_text(dx+4, dy, dw-8, line_height, text, 2)
  824.       return
  825.     elsif per != 0
  826.       change_color(param_change_color(per))
  827.       text = per > 0 ? sprintf("+%s%%", per.group) : sprintf("%s%%", per.group)
  828.     elsif set != 0
  829.       change_color(param_change_color(set))
  830.       text = set > 0 ? sprintf("+%s", set.group) : set.group
  831.     else
  832.       change_color(normal_color, false)
  833.       text = Vocab::item_status(:empty)
  834.     end
  835.     draw_text(dx+4, dy, dw-8, line_height, text, 2)
  836.   end
  837.   
  838.   #--------------------------------------------------------------------------
  839.   # draw_mp_recover
  840.   #--------------------------------------------------------------------------
  841.   def draw_mp_recover(dx, dy, dw)
  842.     draw_background_box(dx, dy, dw)
  843.     change_color(system_color)
  844.     draw_text(dx+4, dy, dw-8, line_height, Vocab::item_status(:mp_recover))
  845.     per = 0
  846.     set = 0
  847.     for effect in @item.effects
  848.       next unless effect.code == 12
  849.       per += (effect.value1 * 100).to_i
  850.       set += effect.value2.to_i
  851.     end
  852.     if per != 0 && set != 0
  853.       change_color(param_change_color(set))
  854.       text = set > 0 ? sprintf("+%s", set.group) : set.group
  855.       draw_text(dx+4, dy, dw-8, line_height, text, 2)
  856.       dw -= text_size(text).width
  857.       change_color(param_change_color(per))
  858.       text = per > 0 ? sprintf("+%s%%", per.group) : sprintf("%s%%", per.group)
  859.       draw_text(dx+4, dy, dw-8, line_height, text, 2)
  860.       return
  861.     elsif per != 0
  862.       change_color(param_change_color(per))
  863.       text = per > 0 ? sprintf("+%s%%", per.group) : sprintf("%s%%", per.group)
  864.     elsif set != 0
  865.       change_color(param_change_color(set))
  866.       text = set > 0 ? sprintf("+%s", set.group) : set.group
  867.     else
  868.       change_color(normal_color, false)
  869.       text = Vocab::item_status(:empty)
  870.     end
  871.     draw_text(dx+4, dy, dw-8, line_height, text, 2)
  872.   end
  873.   
  874.   #--------------------------------------------------------------------------
  875.   # draw_tp_recover
  876.   #--------------------------------------------------------------------------
  877.   def draw_tp_recover(dx, dy, dw)
  878.     draw_background_box(dx, dy, dw)
  879.     change_color(system_color)
  880.     draw_text(dx+4, dy, dw-8, line_height, Vocab::item_status(:tp_recover))
  881.     set = 0
  882.     for effect in @item.effects
  883.       next unless effect.code == 13
  884.       set += effect.value1.to_i
  885.     end
  886.     if set != 0
  887.       change_color(param_change_color(set))
  888.       text = set > 0 ? sprintf("+%s", set.group) : set.group
  889.     else
  890.       change_color(normal_color, false)
  891.       text = Vocab::item_status(:empty)
  892.     end
  893.     draw_text(dx+4, dy, dw-8, line_height, text, 2)
  894.   end
  895.   
  896.   #--------------------------------------------------------------------------
  897.   # draw_tp_gain
  898.   #--------------------------------------------------------------------------
  899.   def draw_tp_gain(dx, dy, dw)
  900.     draw_background_box(dx, dy, dw)
  901.     change_color(system_color)
  902.     draw_text(dx+4, dy, dw-8, line_height, Vocab::item_status(:tp_gain))
  903.     set = @item.tp_gain
  904.     if set != 0
  905.       change_color(param_change_color(set))
  906.       text = set > 0 ? sprintf("+%s", set.group) : set.group
  907.     else
  908.       change_color(normal_color, false)
  909.       text = Vocab::item_status(:empty)
  910.     end
  911.     draw_text(dx+4, dy, dw-8, line_height, text, 2)
  912.   end
  913.   
  914.   #--------------------------------------------------------------------------
  915.   # draw_applies
  916.   #--------------------------------------------------------------------------
  917.   def draw_applies(dx, dy, dw)
  918.     draw_background_box(dx, dy, dw)
  919.     change_color(system_color)
  920.     draw_text(dx+4, dy, dw-8, line_height, Vocab::item_status(:applies))
  921.     icons = []
  922.     for effect in @item.effects
  923.       case effect.code
  924.       when 21
  925.         next unless effect.value1 > 0
  926.         next if $data_states[effect.value1].nil?
  927.         icons.push($data_states[effect.data_id].icon_index)
  928.       when 31
  929.         icons.push($game_actors[1].buff_icon_index(1, effect.data_id))
  930.       when 32
  931.         icons.push($game_actors[1].buff_icon_index(-1, effect.data_id))
  932.       end
  933.       icons.delete(0)
  934.       break if icons.size >= YEA::ITEM::MAX_ICONS_DRAWN
  935.     end
  936.     draw_icons(dx, dy, dw, icons)
  937.   end
  938.   
  939.   #--------------------------------------------------------------------------
  940.   # draw_removes
  941.   #--------------------------------------------------------------------------
  942.   def draw_removes(dx, dy, dw)
  943.     draw_background_box(dx, dy, dw)
  944.     change_color(system_color)
  945.     draw_text(dx+4, dy, dw-8, line_height, Vocab::item_status(:removes))
  946.     icons = []
  947.     for effect in @item.effects
  948.       case effect.code
  949.       when 22
  950.         next unless effect.value1 > 0
  951.         next if $data_states[effect.value1].nil?
  952.         icons.push($data_states[effect.data_id].icon_index)
  953.       when 33
  954.         icons.push($game_actors[1].buff_icon_index(1, effect.data_id))
  955.       when 34
  956.         icons.push($game_actors[1].buff_icon_index(-1, effect.data_id))
  957.       end
  958.       icons.delete(0)
  959.       break if icons.size >= YEA::ITEM::MAX_ICONS_DRAWN
  960.     end
  961.     draw_icons(dx, dy, dw, icons)
  962.   end
  963.   
  964.   #--------------------------------------------------------------------------
  965.   # draw_icons
  966.   #--------------------------------------------------------------------------
  967.   def draw_icons(dx, dy, dw, icons)
  968.     dx += dw - 4
  969.     dx -= icons.size * 24
  970.     for icon_id in icons
  971.       draw_icon(icon_id, dx, dy)
  972.       dx += 24
  973.     end
  974.     if icons.size == 0
  975.       change_color(normal_color, false)
  976.       text = Vocab::item_status(:empty)
  977.       draw_text(4, dy, contents.width-8, line_height, text, 2)
  978.     end
  979.   end
  980.   
  981. end # Window_ItemStatus

  982. #==============================================================================
  983. # ■ Scene_Item
  984. #==============================================================================

  985. class Scene_Item < Scene_ItemBase
  986.   
  987.   #--------------------------------------------------------------------------
  988.   # alias method: start
  989.   #--------------------------------------------------------------------------
  990.   alias scene_item_start_aim start
  991.   def start
  992.     scene_item_start_aim
  993.     create_types_window
  994.     create_status_window
  995.     relocate_windows
  996.   end
  997.   
  998.   #--------------------------------------------------------------------------
  999.   # overwrite method: return_scene
  1000.   #--------------------------------------------------------------------------
  1001.   def return_scene
  1002.     $game_temp.scene_item_index = nil
  1003.     $game_temp.scene_item_oy = nil
  1004.     super
  1005.   end
  1006.   
  1007.   #--------------------------------------------------------------------------
  1008.   # overwrite method: create_category_window
  1009.   #--------------------------------------------------------------------------
  1010.   def create_category_window
  1011.     wy = @help_window.height
  1012.     @category_window = Window_ItemCommand.new(0, wy)
  1013.     @category_window.viewport = @viewport
  1014.     @category_window.help_window = @help_window
  1015.     @category_window.y = @help_window.height
  1016.     if !$game_temp.scene_item_index.nil?
  1017.       @category_window.select($game_temp.scene_item_index)
  1018.       @category_window.oy = $game_temp.scene_item_oy
  1019.     end
  1020.     $game_temp.scene_item_index = nil
  1021.     $game_temp.scene_item_oy = nil
  1022.     @category_window.set_handler(:ok, method(:on_category_ok))
  1023.     @category_window.set_handler(:cancel, method(:return_scene))
  1024.     @category_window.set_handler(:item, method(:open_types))
  1025.     @category_window.set_handler(:weapon, method(:open_types))
  1026.     @category_window.set_handler(:armor, method(:open_types))
  1027.     process_custom_item_commands
  1028.   end
  1029.   
  1030.   #--------------------------------------------------------------------------
  1031.   # new method: process_custom_item_commands
  1032.   #--------------------------------------------------------------------------
  1033.   def process_custom_item_commands
  1034.     for command in YEA::ITEM::COMMANDS
  1035.       next unless YEA::ITEM::CUSTOM_ITEM_COMMANDS.include?(command)
  1036.       called_method = YEA::ITEM::CUSTOM_ITEM_COMMANDS[command][3]
  1037.       @category_window.set_handler(command, method(called_method))
  1038.     end
  1039.   end
  1040.   
  1041.   #--------------------------------------------------------------------------
  1042.   # new method: create_types_window
  1043.   #--------------------------------------------------------------------------
  1044.   def create_types_window
  1045.     wy = @category_window.y
  1046.     @types_window = Window_ItemType.new(Graphics.width, wy)
  1047.     @types_window.viewport = @viewport
  1048.     @types_window.help_window = @help_window
  1049.     @types_window.y = @help_window.height
  1050.     @types_window.item_window = @item_window
  1051.     @item_window.types_window = @types_window
  1052.     @types_window.set_handler(:ok, method(:on_types_ok))
  1053.     @types_window.set_handler(:cancel, method(:on_types_cancel))
  1054.   end
  1055.   
  1056.   #--------------------------------------------------------------------------
  1057.   # new method: create_status_window
  1058.   #--------------------------------------------------------------------------
  1059.   def create_status_window
  1060.     wx = @category_window.width
  1061.     wy = @category_window.y
  1062.     @status_window = Window_ItemStatus.new(wx, wy, @item_window)
  1063.     @status_window.viewport = @viewport
  1064.   end
  1065.   
  1066.   #--------------------------------------------------------------------------
  1067.   # new method: relocate_windows
  1068.   #--------------------------------------------------------------------------
  1069.   def relocate_windows
  1070.     return unless $imported["YEA-AceMenuEngine"]
  1071.     case Menu.help_window_location
  1072.     when 0 # Top
  1073.       @help_window.y = 0
  1074.       @category_window.y = @help_window.height
  1075.       @item_window.y = @category_window.y + @category_window.height
  1076.     when 1 # Middle
  1077.       @category_window.y = 0
  1078.       @help_window.y = @category_window.height
  1079.       @item_window.y = @help_window.y + @help_window.height
  1080.     else # Bottom
  1081.       @category_window.y = 0
  1082.       @item_window.y = @category_window.height
  1083.       @help_window.y = @item_window.y + @item_window.height
  1084.     end
  1085.     @types_window.y = @category_window.y
  1086.     @status_window.y = @category_window.y
  1087.   end
  1088.   
  1089.   #--------------------------------------------------------------------------
  1090.   # new method: open_categories
  1091.   #--------------------------------------------------------------------------
  1092.   def open_types
  1093.     @category_window.x = Graphics.width
  1094.     @types_window.x = 0
  1095.     @types_window.reveal(@category_window.current_symbol)
  1096.   end
  1097.   
  1098.   #--------------------------------------------------------------------------
  1099.   # new method: on_types_ok
  1100.   #--------------------------------------------------------------------------
  1101.   def on_types_ok
  1102.     @item_window.activate
  1103.     @item_window.select_last
  1104.   end
  1105.   
  1106.   #--------------------------------------------------------------------------
  1107.   # new method: on_types_cancel
  1108.   #--------------------------------------------------------------------------
  1109.   def on_types_cancel
  1110.     @category_window.x = 0
  1111.     @category_window.activate
  1112.     @types_window.unselect
  1113.     @types_window.x = Graphics.width
  1114.   end
  1115.   
  1116.   #--------------------------------------------------------------------------
  1117.   # alias method: on_item_cancel
  1118.   #--------------------------------------------------------------------------
  1119.   alias scene_item_on_item_cancel_aim on_item_cancel
  1120.   def on_item_cancel
  1121.     if @types_window.x <= 0
  1122.       @item_window.unselect
  1123.       @types_window.activate
  1124.     else
  1125.       scene_item_on_item_cancel_aim
  1126.     end
  1127.   end
  1128.   
  1129.   #--------------------------------------------------------------------------
  1130.   # new method: command_totori
  1131.   #--------------------------------------------------------------------------
  1132.   def command_totori
  1133.     SceneManager.call(Scene_Alchemy)
  1134.   end
  1135.   
  1136.   #--------------------------------------------------------------------------
  1137.   # new method: command_name1
  1138.   #--------------------------------------------------------------------------
  1139.   def command_name1
  1140.     # Do nothing.
  1141.   end
  1142.   
  1143.   #--------------------------------------------------------------------------
  1144.   # new method: command_name2
  1145.   #--------------------------------------------------------------------------
  1146.   def command_name2
  1147.     # Do nothing.
  1148.   end
  1149.   
  1150. end # Scene_Item

  1151. #==============================================================================
  1152. #
  1153. # ▼ End of File
  1154. #
  1155. #==============================================================================
复制代码

Lv1.梦旅人

梦石
0
星屑
96
在线时间
81 小时
注册时间
2015-6-30
帖子
48
4
 楼主| 发表于 2015-7-27 07:13:45 | 只看该作者
午睡的风铃 发表于 2015-7-26 18:51
如果只是单纯的将文字右移,改draw_item_effects里816行的dx,
然后817和822行改成
dw = (contents.width - ...

多谢........

点评

楼主你好 我一直在寻找类似脚本 看到你有 可以分享一下使用方法吗~谢谢  发表于 2015-7-27 18:02
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
1721
在线时间
761 小时
注册时间
2013-9-23
帖子
211

开拓者

3
发表于 2015-7-26 18:51:31 | 只看该作者
本帖最后由 午睡的风铃 于 2015-7-26 18:57 编辑

如果只是单纯的将文字右移,改draw_item_effects里816行的dx,
然后817和822行改成
dw = (contents.width - dx) / 2
dw = contents.width - dx
不过这样做可能会导致很难看.....



楼主的图貌似太大了点,推荐尺寸是96*96的。
draw_item_image这里可以改位图相关的。
Window_ItemStatus类是那个物品状态的窗口,里边有全部的设置,
规划界面这种事,牵一发而动全身。





评分

参与人数 1梦石 +1 收起 理由
taroxd + 1 精品文章

查看全部评分

回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
61
在线时间
251 小时
注册时间
2015-5-14
帖子
453
2
发表于 2015-7-26 17:55:09 | 只看该作者
修改文字的大小或坐标
回复 支持 反对

使用道具 举报

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

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2025-7-22 02:07

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表