查看: 3478|回复: 11

[已经过期] 物品菜单强化 这么用

[复制链接]
梦石
0
星屑
336
在线时间
464 小时
注册时间
2009-10-2
回帖
117
发表于 2013-4-4 22:42:35 | 显示全部楼层 |阅读模式

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

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

×
#==============================================================================
#
# ▼ Yanfly Engine Ace - Ace Item Menu v1.02
# -- Last Updated: 2012.01.05
# -- Level: Normal, Hard
# -- Requires: n/a
#
#==============================================================================

$imported = {} if $imported.nil?
$imported["YEA-ItemMenu"] = true

#==============================================================================
# ▼ Updates
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# 2012.01.05 - Compatibility Update with Equip Dynamic Stats.
# 2012.01.03 - Started Script and Finished.
#            - Compatibility Update with Ace Menu Engine.
#
#==============================================================================
# ▼ Introduction
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# Ace项目菜单项分类提供了更多的控制和更好的布局
# 这simulatenously提供信息关于物品的玩家,
# 同时保持大量的产品列表在屏幕上可见一次。这个
# 脚本也可以定制重新命令和类别。
#
#==============================================================================
# ▼ Instructions
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# 要安装此脚本,打开你的脚本编辑和复制/粘贴这个脚本
# to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
#
# -----------------------------------------------------------------------------
# Item Notetags - These notetags go in the item notebox in the database.
# -----------------------------------------------------------------------------
# <类别:字符串>
# 把这个对象到项目类别为“字符串”。只要选择的
# 一类是突出在Ace项目菜单命令窗口,这个对象将
# 被包括在项目窗口中列示.
#
# <图片:字符串>
# 它使用一个图片从图形\图片\你的RPG制造商VX Ace项目
# directory with the filename of "string" (without the extension) as the image
# picture shown in the Ace Item Menu.
#
# -----------------------------------------------------------------------------
# Weapon Notetags - These notetags go in the weapon notebox in the database.
# -----------------------------------------------------------------------------
# <category: string>
# Places this object into the item category for "string". Whenever the selected
# category is highlighted in the Ace Item Menu command window, this object will
# be included and shown in the item window.
#
# <image: string>
# Uses a picture from Graphics\Pictures\ of your RPG Maker VX Ace Project's
# directory with the filename of "string" (without the extension) as the image
# picture shown in the Ace Item Menu.
#
# -----------------------------------------------------------------------------
# Armour Notetags - These notetags go in the armour notebox in the database.
# -----------------------------------------------------------------------------
# <category: string>
# Places this object into the item category for "string". Whenever the selected
# category is highlighted in the Ace Item Menu command window, this object will
# be included and shown in the item window.
#
# <image: string>
# Uses a picture from Graphics\Pictures\ of your RPG Maker VX Ace Project's
# directory with the filename of "string" (without the extension) as the image
# picture shown in the Ace Item Menu.
#
#==============================================================================
# ▼ Compatibility
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
# it will run with RPG Maker VX without adjusting.
#
#==============================================================================

module YEA
  module ITEM
   
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    # - Item Command Settings -
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    # This array adjusts what options appear in the initial item command window
    # before the items are split into separate categories. Add commands, remove
    # commands, or rearrange them. Here's a list of which does what:
    #
    # -------------------------------------------------------------------------
    # :command         Description
    # -------------------------------------------------------------------------
    # :item            Opens up the various item categories. Default.
    # :weapon          Opens up the various weapon categories. Default.
    # :armor           Opens up the various armour categories. Default.
    # :key_item        Shows a list of the various key items. Default.
    #
    # :gogototori      Requires Kread-EX's Go Go Totori Synthesis.
    #
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    COMMANDS =[
      :item,         # Opens up the various item categories. Default.
      :weapon,       # Opens up the various weapon categories. Default.
      :armor,        # Opens up the various armour categories. Default.
      :key_item,     # Shows a list of the various key items. Default.
      :gogototori,   # Requires Kread-EX's Go Go Totori Synthesis.
    # :custom1,      # Custom command 1.
    # :custom2,      # Custom command 2.
    ] # Do not remove this.
   
    #--------------------------------------------------------------------------
    # - Item Custom Commands -
    # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    # For those who use scripts to that may produce unique effects for the item
    # scene, use this hash to manage the custom commands for the Item Command
    # Window. You can disable certain commands or prevent them from appearing
    # by using switches. If you don't wish to bind them to a switch, set the
    # proper switch to 0 for it to have no impact.
    #--------------------------------------------------------------------------
    CUSTOM_ITEM_COMMANDS ={
    # :command => ["Display Name", EnableSwitch, ShowSwitch, Handler Method],
      :gogototori => ["合成",            0,         0, :command_totori],
      :custom1 => [ "自定義名稱",            0,          0, :command_name1],
      :custom2 => [ "自定義文本",           13,          0, :command_name2],
    } # Do not remove this.
   
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    # - Item Type Settings -
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    # 这些数组调整和显示各种类型的物品显示项,
    # Weapons, and Armours. Note that when using :category symbols, the
    # specific category shown will be equal to the text used for the Display
    # and the included item must contain a category equal to the Display name.
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    # This array contains the order for the Item categories.
    ITEM_TYPES =[
    # [  :symbol,   "Display"],
      [   :field,   "背包内"], # Shows Menu-usable items.
      [  :battle,   "战斗用"], # Shows Battle-usable items.
      [:category,   "炼金"], # Categorized by <category: string>
      [:category,   "食物"], # Categorized by <category: string>
      [:category,   "饮料"], # Categorized by <category: string>
      [:category,   "材料"], # Categorized by <category: string>
      [:category,   "书籍"], # Categorized by <category: string>
      [:category,   "特别"], # Categorized by <category: string>
      [:category,   "宝物"], # Shows all key items.
      [     :all,   "全部"], # Shows all usable items.
    ] # Do not remove this.
   
    # This array contains the order for the Weapon categories.
    WEAPON_TYPES =[
    # [  :symbol,   "Display"],
      [   :types,  "WPNTYPES"], # Lists all of the individual weapon types.
      [     :all,       "全部"], # Shows all weapons.
    ] # Do not remove this.
   
    # This array contains the order for the Armour categories.
    ARMOUR_TYPES =[
    # [  :symbol,   "Display"],
      [   :slots,  "ARMSLOTS"], # Lists all of the individual armour slots.
      [   :types,  "ARMTYPES"], # Lists all of the individual armours types.
      [     :all,       "全部"], # Shows all armours.
    ] # Do not remove this.
   
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    # - Item Status Settings -
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    # The item status window displays information about the item in detail.
    # Adjust the settings below to change the way the status window appears.
    #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    STATUS_FONT_SIZE = 20       # Font size used for status window.
    MAX_ICONS_DRAWN  = 10       # Maximum number of icons drawn for states.
   
    # The following adjusts the vocabulary used for the status window. Each
    # of the vocabulary settings are self explanatory.
    VOCAB_STATUS ={
      :empty      => "---",          # Text used when nothing is shown.
      :hp_recover => "治疗体力",      # Text used for HP Recovery.
      :mp_recover => "恢复魔法",      # Text used for MP Recovery.
      :tp_recover => "恢复TP",      # Text used for TP Recovery.
      :tp_gain    => "增加TP",      # Text used for TP Gain.
      :applies    => "使用效果",      # Text used for applied states and buffs.
      :removes    => "移除效果",      # Text used for removed states and buffs.
    } # Do not remove this.
   
  end # ITEM
end # YEA

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

module YEA
  module REGEXP
  module BASEITEM
   
    CATEGORY = /<(?:CATEGORIES|category):[ ](.*)>/i
    IMAGE    = /<(?:IMAGE|image):[ ](.*)>/i
   
  end # BASEITEM
  end # REGEXP
end # YEA

#==============================================================================
# ■ Numeric
#==============================================================================

class Numeric
  
  #--------------------------------------------------------------------------
  # new method: group_digits
  #--------------------------------------------------------------------------
  unless $imported["YEA-CoreEngine"]
  def group; return self.to_s; end
  end # $imported["YEA-CoreEngine"]
   
end # Numeric

#==============================================================================
# ■ Vocab
#==============================================================================

module Vocab
  
  #--------------------------------------------------------------------------
  # new method: self.item_status
  #--------------------------------------------------------------------------
  def self.item_status(type)
    return YEA::ITEM::VOCAB_STATUS[type]
  end
  
end # Vocab

#==============================================================================
# ■ DataManager
#==============================================================================

module DataManager
  
  #--------------------------------------------------------------------------
  # alias method: load_database
  #--------------------------------------------------------------------------
  class <<self; alias load_database_aim load_database; end
  def self.load_database
    load_database_aim
    load_notetags_aim
  end
  
  #--------------------------------------------------------------------------
  # new method: load_notetags_aim
  #--------------------------------------------------------------------------
  def self.load_notetags_aim
    groups = [$data_items, $data_weapons, $data_armors]
    for group in groups
      for obj in group
        next if obj.nil?
        obj.load_notetags_aim
      end
    end
  end
  
end # DataManager

#==============================================================================
# ■ RPG::BaseItem
#==============================================================================

class RPG::BaseItem
  
  #--------------------------------------------------------------------------
  # public instance variables
  #--------------------------------------------------------------------------
  attr_accessor :category
  attr_accessor :image
  
  #--------------------------------------------------------------------------
  # common cache: load_notetags_aim
  #--------------------------------------------------------------------------
  def load_notetags_aim
    @category = []
    #---
    self.note.split(/[\r\n]+/).each { |line|
      case line
      #---
      when YEA::REGEXP::BASEITEM::CATEGORY
        @category.push($1.upcase.to_s)
      when YEA::REGEXP::BASEITEM::IMAGE
        @image = $1.to_s
      end
    } # self.note.split
    #---
  end
  
end # RPG::BaseItem

#==============================================================================
# ■ Game_Temp
#==============================================================================

class Game_Temp
  
  #--------------------------------------------------------------------------
  # public instance variables
  #--------------------------------------------------------------------------
  attr_accessor :scene_item_index
  attr_accessor :scene_item_oy
  
end # Game_Temp

#==============================================================================
# ■ Window_ItemList
#==============================================================================

class Window_ItemList < Window_Selectable
  
  #--------------------------------------------------------------------------
  # overwrite method: draw_item
  #--------------------------------------------------------------------------
  def draw_item(index)
    item = @data[index]
    return if item.nil?
    rect = item_rect(index)
    rect.width -= 4
    draw_item_name(item, rect.x, rect.y, enable?(item), rect.width - 24)
    draw_item_number(rect, item)
  end
  
end # Window_ItemList

#==============================================================================
# ■ Window_ItemCommand
#==============================================================================

class Window_ItemCommand < Window_Command
  
  #--------------------------------------------------------------------------
  # public instance variables
  #--------------------------------------------------------------------------
  attr_reader   :item_window
  
  #--------------------------------------------------------------------------
  # initialize
  #--------------------------------------------------------------------------
  def initialize(x, y)
    super(x, y)
  end
  
  #--------------------------------------------------------------------------
  # window_width
  #--------------------------------------------------------------------------
  def window_width; return 160; end
  
  #--------------------------------------------------------------------------
  # visible_line_number
  #--------------------------------------------------------------------------
  def visible_line_number; return 4; end
  
  #--------------------------------------------------------------------------
  # process_ok
  #--------------------------------------------------------------------------
  def process_ok
    $game_temp.scene_item_index = index
    $game_temp.scene_item_oy = self.oy
    super
  end
  
  #--------------------------------------------------------------------------
  # make_command_list
  #--------------------------------------------------------------------------
  def make_command_list
    for command in YEA::ITEM::COMMANDS
      case command
      #--- Default Commands ---
      when :item
        add_command(Vocab::item, :item)
      when :weapon
        add_command(Vocab::weapon, :weapon)
      when :armor
        add_command(Vocab::armor, :armor)
      when :key_item
        add_command(Vocab::key_item, :key_item)
      #--- Imported ---
      when :gogototori
        next unless $imported["KRX-AlchemicSynthesis"]
        process_custom_command(command)
      #--- Custom Commands ---
      else
        process_custom_command(command)
      end
    end
  end
  
  #--------------------------------------------------------------------------
  # process_custom_command
  #--------------------------------------------------------------------------
  def process_custom_command(command)
    return unless YEA::ITEM::CUSTOM_ITEM_COMMANDS.include?(command)
    show = YEA::ITEM::CUSTOM_ITEM_COMMANDS[command][2]
    continue = show <= 0 ? true : $game_switches[show]
    return unless continue
    text = YEA::ITEM::CUSTOM_ITEM_COMMANDS[command][0]
    switch = YEA::ITEM::CUSTOM_ITEM_COMMANDS[command][1]
    enabled = switch <= 0 ? true : $game_switches[switch]
    add_command(text, command, enabled)
  end
  
  #--------------------------------------------------------------------------
  # update
  #--------------------------------------------------------------------------
  def update
    super
    return unless self.active
    @item_window.category = current_symbol if @item_window
  end
  
  #--------------------------------------------------------------------------
  # item_window=
  #--------------------------------------------------------------------------
  def item_window=(item_window)
    @item_window = item_window
    update
  end
  
end # Window_ItemCommand

#==============================================================================
# ■ Window_ItemType
#==============================================================================

class Window_ItemType < Window_Command
  
  #--------------------------------------------------------------------------
  # public instance variables
  #--------------------------------------------------------------------------
  attr_reader   :item_window
  
  #--------------------------------------------------------------------------
  # initialize
  #--------------------------------------------------------------------------
  def initialize(x, y)
    super(x, y)
    deactivate
    @type = nil
  end
  
  #--------------------------------------------------------------------------
  # window_width
  #--------------------------------------------------------------------------
  def window_width; return 160; end
  
  #--------------------------------------------------------------------------
  # visible_line_number
  #--------------------------------------------------------------------------
  def visible_line_number; return 4; end
  
  #--------------------------------------------------------------------------
  # reveal
  #--------------------------------------------------------------------------
  def reveal(type)
    @type = type
    refresh
    activate
    select(0)
  end
  
  #--------------------------------------------------------------------------
  # make_command_list
  #--------------------------------------------------------------------------
  def make_command_list
    return if @type.nil?
    #---
    case @type
    when :item
      commands = YEA::ITEM::ITEM_TYPES
    when :weapon
      commands = YEA::ITEM::WEAPON_TYPES
    else
      commands = YEA::ITEM::ARMOUR_TYPES
    end
    #---
    for command in commands
      case command[0]
      #---
      when :types
        case @type
        when :weapon
          for i in 1...$data_system.weapon_types.size
            name = $data_system.weapon_types[i]
            add_command(name, :w_type, true, i)
          end
        else
          for i in 1...$data_system.armor_types.size
            name = $data_system.armor_types[i]
            add_command(name, :a_type, true, i)
          end
        end
      #---
      when :slots
        if $imported["YEA-AceEquipEngine"]
          maximum = 1
          for key in YEA::EQUIP::TYPES
            maximum = [maximum, key[0]].max
          end
        else
          maximum = 4
        end
        for i in 1..maximum
          name = Vocab::etype(i)
          add_command(name, :e_type, true, i) if name != ""
        end
      #---
      else
        add_command(command[1], command[0], true, @type)
      end
    end
  end
  
  #--------------------------------------------------------------------------
  # update
  #--------------------------------------------------------------------------
  def update
    super
    return unless self.active
    @item_window.category = current_symbol if @item_window
  end
  
  #--------------------------------------------------------------------------
  # item_window=
  #--------------------------------------------------------------------------
  def item_window=(item_window)
    @item_window = item_window
    update
  end
  
end # Window_ItemType

#==============================================================================
# ■ Window_ItemList
#==============================================================================

class Window_ItemList < Window_Selectable
  
  #--------------------------------------------------------------------------
  # alias method: initialize
  #--------------------------------------------------------------------------
  alias window_itemlist_initialize_aim initialize
  def initialize(dx, dy, dw, dh)
    window_itemlist_initialize_aim(dx, dy, dw, dh)
    @ext = :none
    @name = ""
  end
  
  #--------------------------------------------------------------------------
  # alias method: category=
  #--------------------------------------------------------------------------
  alias window_itemlist_category_aim category=
  def category=(category)
    if @types_window.nil?
      window_itemlist_category_aim(category)
    else
      return unless update_types?(category)
      @category = category
      if @types_window.active
        @name = @types_window.current_data[:name]
        @ext = @types_window.current_ext
      end
      refresh
      self.oy = 0
    end
  end
  
  #--------------------------------------------------------------------------
  # new method: update_types?
  #--------------------------------------------------------------------------
  def update_types?(category)
    return true if @category != category
    return false unless @types_window.active
    if category == :category
      return @name != @types_window.current_data[:name]
    end
    return @ext != @types_window.current_ext
  end
  
  #--------------------------------------------------------------------------
  # new method: types_window=
  #--------------------------------------------------------------------------
  def types_window=(window)
    @types_window = window
  end
  
  #--------------------------------------------------------------------------
  # alias method: include?
  #--------------------------------------------------------------------------
  alias window_itemlist_include_aim include?
  def include?(item)
    if @types_window.nil?
      return window_itemlist_include_aim(item)
    else
      return ace_item_menu_include?(item)
    end
  end
  
  #--------------------------------------------------------------------------
  # new method: ace_item_menu_include?
  #--------------------------------------------------------------------------
  def ace_item_menu_include?(item)
    case @category
    #---
    when :field
      return false unless item.is_a?(RPG::Item)
      return item.menu_ok?
    when :battle
      return false unless item.is_a?(RPG::Item)
      return item.battle_ok?
    #---
    when :w_type
      return false unless item.is_a?(RPG::Weapon)
      return item.wtype_id == @types_window.current_ext
    when :a_type
      return false unless item.is_a?(RPG::Armor)
      return item.atype_id == @types_window.current_ext
    when :e_type
      return false unless item.is_a?(RPG::Armor)
      return item.etype_id == @types_window.current_ext
    #---
    when :all
      case @types_window.current_ext
      when :item
        return item.is_a?(RPG::Item)
      when :weapon
        return item.is_a?(RPG::Weapon)
      else
        return item.is_a?(RPG::Armor)
      end
    #---
    when :category
      case @types_window.current_ext
      when :item
        return false unless item.is_a?(RPG::Item)
      when :weapon
        return false unless item.is_a?(RPG::Weapon)
      else
        return false unless item.is_a?(RPG::Armor)
      end
      return item.category.include?(@types_window.current_data[:name].upcase)
    #---
    else
      return window_itemlist_include_aim(item)
    end
  end
  
end # Window_ItemList

#==============================================================================
# ■ Window_ItemStatus
#==============================================================================

class Window_ItemStatus < Window_Base
  
  #--------------------------------------------------------------------------
  # initialize
  #--------------------------------------------------------------------------
  def initialize(dx, dy, item_window)
    super(dx, dy, Graphics.width - dx, fitting_height(4))
    @item_window = item_window
    @item = nil
    refresh
  end
  
  #--------------------------------------------------------------------------
  # update
  #--------------------------------------------------------------------------
  def update
    super
    update_item(@item_window.item)
  end
  
  #--------------------------------------------------------------------------
  # update_item
  #--------------------------------------------------------------------------
  def update_item(item)
    return if @item == item
    @item = item
    refresh
  end
  
  #--------------------------------------------------------------------------
  # refresh
  #--------------------------------------------------------------------------
  def refresh
    contents.clear
    reset_font_settings
    return draw_empty if @item.nil?
    contents.font.size = YEA::ITEM::STATUS_FONT_SIZE
    draw_item_image
    draw_item_stats
    draw_item_effects
  end
  
  #--------------------------------------------------------------------------
  # draw_empty
  #--------------------------------------------------------------------------
  def draw_empty
    colour = Color.new(0, 0, 0, translucent_alpha/2)
    rect = Rect.new(1, 1, 94, 94)
    contents.fill_rect(rect, colour)
    dx = 96; dy = 0
    dw = (contents.width - 96) / 2
    for i in 0...8
      draw_background_box(dx, dy, dw)
      dx = dx >= 96 + dw ? 96 : 96 + dw
      dy += line_height if dx == 96
    end
  end
  
  #--------------------------------------------------------------------------
  # draw_background_box
  #--------------------------------------------------------------------------
  def draw_background_box(dx, dy, dw)
    colour = Color.new(0, 0, 0, translucent_alpha/2)
    rect = Rect.new(dx+1, dy+1, dw-2, line_height-2)
    contents.fill_rect(rect, colour)
  end
  
  #--------------------------------------------------------------------------
  # draw_item_image
  #--------------------------------------------------------------------------
  def draw_item_image
    colour = Color.new(0, 0, 0, translucent_alpha/2)
    rect = Rect.new(1, 1, 94, 94)
    contents.fill_rect(rect, colour)
    if @item.image.nil?
      icon_index = @item.icon_index
      bitmap = Cache.system("Iconset")
      rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
      target = Rect.new(0, 0, 96, 96)
      contents.stretch_blt(target, bitmap, rect)
    else
      bitmap = Cache.picture(@item.image)
      contents.blt(0, 0, bitmap, bitmap.rect, 255)
    end
  end
  
  #--------------------------------------------------------------------------
  # draw_item_stats
  #--------------------------------------------------------------------------
  def draw_item_stats
    return unless @item.is_a?(RPG::Weapon) || @item.is_a?(RPG::Armor)
    dx = 96; dy = 0
    dw = (contents.width - 96) / 2
    for i in 0...8
      draw_equip_param(i, dx, dy, dw)
      dx = dx >= 96 + dw ? 96 : 96 + dw
      dy += line_height if dx == 96
    end
  end
  
  #--------------------------------------------------------------------------
  # draw_equip_param
  #--------------------------------------------------------------------------
  def draw_equip_param(param_id, dx, dy, dw)
    draw_background_box(dx, dy, dw)
    change_color(system_color)
    draw_text(dx+4, dy, dw-8, line_height, Vocab::param(param_id))
    if $imported["YEA-EquipDynamicStats"]
      draw_percentage_param(param_id, dx, dy, dw)
    else
      draw_set_param(param_id, dx, dy, dw)
    end
  end
  
  #--------------------------------------------------------------------------
  # draw_percentage_param
  #--------------------------------------------------------------------------
  def draw_percentage_param(param_id, dx, dy, dw)
    if @item.per_params[param_id] != 0 && @item.params[param_id] != 0
      text = draw_set_param(param_id, dx, dy, dw)
      dw -= text_size(text).width
      draw_percent_param(param_id, dx, dy, dw)
    elsif @item.per_params[param_id] != 0 && @item.params[param_id] == 0
      draw_percent_param(param_id, dx, dy, dw)
    else
      draw_set_param(param_id, dx, dy, dw)
    end
  end
  
  #--------------------------------------------------------------------------
  # draw_set_param
  #--------------------------------------------------------------------------
  def draw_set_param(param_id, dx, dy, dw)
    value = @item.params[param_id]
    if $imported["YEA-EquipDynamicStats"] && @item.var_params[param_id] > 0
      value += $game_variables[@item.var_params[param_id]] rescue 0
    end
    change_color(param_change_color(value), value != 0)
    text = value.group
    text = "+" + text if value > 0
    draw_text(dx+4, dy, dw-8, line_height, text, 2)
    return text
  end
  
  #--------------------------------------------------------------------------
  # draw_percent_param
  #--------------------------------------------------------------------------
  def draw_percent_param(param_id, dx, dy, dw)
    value = @item.per_params[param_id]
    change_color(param_change_color(value))
    text = (@item.per_params[param_id] * 100).to_i.group + "%"
    text = "+" + text if @item.per_params[param_id] > 0
    draw_text(dx+4, dy, dw-8, line_height, text, 2)
    return text
  end
  
  #--------------------------------------------------------------------------
  # draw_item_effects
  #--------------------------------------------------------------------------
  def draw_item_effects
    return unless @item.is_a?(RPG::Item)
    dx = 96; dy = 0
    dw = (contents.width - 96) / 2
    draw_hp_recover(dx, dy + line_height * 0, dw)
    draw_mp_recover(dx, dy + line_height * 1, dw)
    draw_tp_recover(dx + dw, dy + line_height * 0, dw)
    draw_tp_gain(dx + dw, dy + line_height * 1, dw)
    dw = contents.width - 96
    draw_applies(dx, dy + line_height * 2, dw)
    draw_removes(dx, dy + line_height * 3, dw)
  end
  
  #--------------------------------------------------------------------------
  # draw_hp_recover
  #--------------------------------------------------------------------------
  def draw_hp_recover(dx, dy, dw)
    draw_background_box(dx, dy, dw)
    change_color(system_color)
    draw_text(dx+4, dy, dw-8, line_height, Vocab::item_status(:hp_recover))
    per = 0
    set = 0
    for effect in @item.effects
      next unless effect.code == 11
      per += (effect.value1 * 100).to_i
      set += effect.value2.to_i
    end
    if per != 0 && set != 0
      change_color(param_change_color(set))
      text = set > 0 ? sprintf("+%s", set.group) : set.group
      draw_text(dx+4, dy, dw-8, line_height, text, 2)
      dw -= text_size(text).width
      change_color(param_change_color(per))
      text = per > 0 ? sprintf("+%s%%", per.group) : sprintf("%s%%", per.group)
      draw_text(dx+4, dy, dw-8, line_height, text, 2)
      return
    elsif per != 0
      change_color(param_change_color(per))
      text = per > 0 ? sprintf("+%s%%", per.group) : sprintf("%s%%", per.group)
    elsif set != 0
      change_color(param_change_color(set))
      text = set > 0 ? sprintf("+%s", set.group) : set.group
    else
      change_color(normal_color, false)
      text = Vocab::item_status(:empty)
    end
    draw_text(dx+4, dy, dw-8, line_height, text, 2)
  end
  
  #--------------------------------------------------------------------------
  # draw_mp_recover
  #--------------------------------------------------------------------------
  def draw_mp_recover(dx, dy, dw)
    draw_background_box(dx, dy, dw)
    change_color(system_color)
    draw_text(dx+4, dy, dw-8, line_height, Vocab::item_status(:mp_recover))
    per = 0
    set = 0
    for effect in @item.effects
      next unless effect.code == 12
      per += (effect.value1 * 100).to_i
      set += effect.value2.to_i
    end
    if per != 0 && set != 0
      change_color(param_change_color(set))
      text = set > 0 ? sprintf("+%s", set.group) : set.group
      draw_text(dx+4, dy, dw-8, line_height, text, 2)
      dw -= text_size(text).width
      change_color(param_change_color(per))
      text = per > 0 ? sprintf("+%s%%", per.group) : sprintf("%s%%", per.group)
      draw_text(dx+4, dy, dw-8, line_height, text, 2)
      return
    elsif per != 0
      change_color(param_change_color(per))
      text = per > 0 ? sprintf("+%s%%", per.group) : sprintf("%s%%", per.group)
    elsif set != 0
      change_color(param_change_color(set))
      text = set > 0 ? sprintf("+%s", set.group) : set.group
    else
      change_color(normal_color, false)
      text = Vocab::item_status(:empty)
    end
    draw_text(dx+4, dy, dw-8, line_height, text, 2)
  end
  
  #--------------------------------------------------------------------------
  # draw_tp_recover
  #--------------------------------------------------------------------------
  def draw_tp_recover(dx, dy, dw)
    draw_background_box(dx, dy, dw)
    change_color(system_color)
    draw_text(dx+4, dy, dw-8, line_height, Vocab::item_status(:tp_recover))
    set = 0
    for effect in @item.effects
      next unless effect.code == 13
      set += effect.value1.to_i
    end
    if set != 0
      change_color(param_change_color(set))
      text = set > 0 ? sprintf("+%s", set.group) : set.group
    else
      change_color(normal_color, false)
      text = Vocab::item_status(:empty)
    end
    draw_text(dx+4, dy, dw-8, line_height, text, 2)
  end
  
  #--------------------------------------------------------------------------
  # draw_tp_gain
  #--------------------------------------------------------------------------
  def draw_tp_gain(dx, dy, dw)
    draw_background_box(dx, dy, dw)
    change_color(system_color)
    draw_text(dx+4, dy, dw-8, line_height, Vocab::item_status(:tp_gain))
    set = @item.tp_gain
    if set != 0
      change_color(param_change_color(set))
      text = set > 0 ? sprintf("+%s", set.group) : set.group
    else
      change_color(normal_color, false)
      text = Vocab::item_status(:empty)
    end
    draw_text(dx+4, dy, dw-8, line_height, text, 2)
  end
  
  #--------------------------------------------------------------------------
  # draw_applies
  #--------------------------------------------------------------------------
  def draw_applies(dx, dy, dw)
    draw_background_box(dx, dy, dw)
    change_color(system_color)
    draw_text(dx+4, dy, dw-8, line_height, Vocab::item_status(:applies))
    icons = []
    for effect in @item.effects
      case effect.code
      when 21
        next unless effect.value1 > 0
        next if $data_states[effect.value1].nil?
        icons.push($data_states[effect.data_id].icon_index)
      when 31
        icons.push($game_actors[1].buff_icon_index(1, effect.data_id))
      when 32
        icons.push($game_actors[1].buff_icon_index(-1, effect.data_id))
      end
      icons.delete(0)
      break if icons.size >= YEA::ITEM::MAX_ICONS_DRAWN
    end
    draw_icons(dx, dy, dw, icons)
  end
  
  #--------------------------------------------------------------------------
  # draw_removes
  #--------------------------------------------------------------------------
  def draw_removes(dx, dy, dw)
    draw_background_box(dx, dy, dw)
    change_color(system_color)
    draw_text(dx+4, dy, dw-8, line_height, Vocab::item_status(:removes))
    icons = []
    for effect in @item.effects
      case effect.code
      when 22
        next unless effect.value1 > 0
        next if $data_states[effect.value1].nil?
        icons.push($data_states[effect.data_id].icon_index)
      when 33
        icons.push($game_actors[1].buff_icon_index(1, effect.data_id))
      when 34
        icons.push($game_actors[1].buff_icon_index(-1, effect.data_id))
      end
      icons.delete(0)
      break if icons.size >= YEA::ITEM::MAX_ICONS_DRAWN
    end
    draw_icons(dx, dy, dw, icons)
  end
  
  #--------------------------------------------------------------------------
  # draw_icons
  #--------------------------------------------------------------------------
  def draw_icons(dx, dy, dw, icons)
    dx += dw - 4
    dx -= icons.size * 24
    for icon_id in icons
      draw_icon(icon_id, dx, dy)
      dx += 24
    end
    if icons.size == 0
      change_color(normal_color, false)
      text = Vocab::item_status(:empty)
      draw_text(4, dy, contents.width-8, line_height, text, 2)
    end
  end
  
end # Window_ItemStatus

#==============================================================================
# ■ Scene_Item
#==============================================================================

class Scene_Item < Scene_ItemBase
  
  #--------------------------------------------------------------------------
  # alias method: start
  #--------------------------------------------------------------------------
  alias scene_item_start_aim start
  def start
    scene_item_start_aim
    create_types_window
    create_status_window
    relocate_windows
  end
  
  #--------------------------------------------------------------------------
  # overwrite method: return_scene
  #--------------------------------------------------------------------------
  def return_scene
    $game_temp.scene_item_index = nil
    $game_temp.scene_item_oy = nil
    super
  end
  
  #--------------------------------------------------------------------------
  # overwrite method: create_category_window
  #--------------------------------------------------------------------------
  def create_category_window
    wy = @help_window.height
    @category_window = Window_ItemCommand.new(0, wy)
    @category_window.viewport = @viewport
    @category_window.help_window = @help_window
    @category_window.y = @help_window.height
    if !$game_temp.scene_item_index.nil?
      @category_window.select($game_temp.scene_item_index)
      @category_window.oy = $game_temp.scene_item_oy
    end
    $game_temp.scene_item_index = nil
    $game_temp.scene_item_oy = nil
    @category_window.set_handler(:ok, method(:on_category_ok))
    @category_window.set_handler(:cancel, method(:return_scene))
    @category_window.set_handler(:item, method(:open_types))
    @category_window.set_handler(:weapon, method(:open_types))
    @category_window.set_handler(:armor, method(:open_types))
    process_custom_item_commands
  end
  
  #--------------------------------------------------------------------------
  # new method: process_custom_item_commands
  #--------------------------------------------------------------------------
  def process_custom_item_commands
    for command in YEA::ITEM::COMMANDS
      next unless YEA::ITEM::CUSTOM_ITEM_COMMANDS.include?(command)
      called_method = YEA::ITEM::CUSTOM_ITEM_COMMANDS[command][3]
      @category_window.set_handler(command, method(called_method))
    end
  end
  
  #--------------------------------------------------------------------------
  # new method: create_types_window
  #--------------------------------------------------------------------------
  def create_types_window
    wy = @category_window.y
    @types_window = Window_ItemType.new(Graphics.width, wy)
    @types_window.viewport = @viewport
    @types_window.help_window = @help_window
    @types_window.y = @help_window.height
    @types_window.item_window = @item_window
    @item_window.types_window = @types_window
    @types_window.set_handler(:ok, method(:on_types_ok))
    @types_window.set_handler(:cancel, method(:on_types_cancel))
  end
  
  #--------------------------------------------------------------------------
  # new method: create_status_window
  #--------------------------------------------------------------------------
  def create_status_window
    wx = @category_window.width
    wy = @category_window.y
    @status_window = Window_ItemStatus.new(wx, wy, @item_window)
    @status_window.viewport = @viewport
  end
  
  #--------------------------------------------------------------------------
  # new method: relocate_windows
  #--------------------------------------------------------------------------
  def relocate_windows
    return unless $imported["YEA-AceMenuEngine"]
    case Menu.help_window_location
    when 0 # Top
      @help_window.y = 0
      @category_window.y = @help_window.height
      @item_window.y = @category_window.y + @category_window.height
    when 1 # Middle
      @category_window.y = 0
      @help_window.y = @category_window.height
      @item_window.y = @help_window.y + @help_window.height
    else # Bottom
      @category_window.y = 0
      @item_window.y = @category_window.height
      @help_window.y = @item_window.y + @item_window.height
    end
    @types_window.y = @category_window.y
    @status_window.y = @category_window.y
  end
  
  #--------------------------------------------------------------------------
  # new method: open_categories
  #--------------------------------------------------------------------------
  def open_types
    @category_window.x = Graphics.width
    @types_window.x = 0
    @types_window.reveal(@category_window.current_symbol)
  end
  
  #--------------------------------------------------------------------------
  # new method: on_types_ok
  #--------------------------------------------------------------------------
  def on_types_ok
    @item_window.activate
    @item_window.select_last
  end
  
  #--------------------------------------------------------------------------
  # new method: on_types_cancel
  #--------------------------------------------------------------------------
  def on_types_cancel
    @category_window.x = 0
    @category_window.activate
    @types_window.unselect
    @types_window.x = Graphics.width
  end
  
  #--------------------------------------------------------------------------
  # alias method: on_item_cancel
  #--------------------------------------------------------------------------
  alias scene_item_on_item_cancel_aim on_item_cancel
  def on_item_cancel
    if @types_window.x <= 0
      @item_window.unselect
      @types_window.activate
    else
      scene_item_on_item_cancel_aim
    end
  end
  
  #--------------------------------------------------------------------------
  # new method: command_totori
  #--------------------------------------------------------------------------
  def command_totori
    SceneManager.call(Scene_Alchemy)
  end
  
  #--------------------------------------------------------------------------
  # new method: command_name1
  #--------------------------------------------------------------------------
  def command_name1
    # Do nothing.
  end
  
  #--------------------------------------------------------------------------
  # new method: command_name2
  #--------------------------------------------------------------------------
  def command_name2
    # Do nothing.
  end
  
end # Scene_Item

#==============================================================================
#
# ▼ End of File
#
#==============================================================================
...
梦石
0
星屑
803
在线时间
2068 小时
注册时间
2011-10-3
回帖
1620
发表于 2013-4-4 23:46:18 | 显示全部楼层
放到脚本里就可以了
回复

使用道具 举报

梦石
0
星屑
125
在线时间
0 小时
注册时间
2013-4-5
回帖
3
发表于 2013-4-5 12:09:19 | 显示全部楼层
放到MAIN前就可以了,但要小心跟其他的外来脚本有冲突,我就遇到过.
回复

使用道具 举报

梦石
0
星屑
166
在线时间
630 小时
注册时间
2012-6-9
回帖
1233
发表于 2013-4-5 18:43:01 | 显示全部楼层
你能不能用 1.png 框起来呀,1000条捏。
脚本不是有注释么?你自己翻译看看吧。

  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. # Ace项目菜单项分类提供了更多的控制和更好的布局
  22. # 这simulatenously提供信息关于物品的玩家,
  23. # 同时保持大量的产品列表在屏幕上可见一次。这个
  24. # 脚本也可以定制重新命令和类别。
  25. #
  26. #==============================================================================
  27. # ▼ Instructions
  28. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  29. # 要安装此脚本,打开你的脚本编辑和复制/粘贴这个脚本
  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. # <类别:字符串>
  36. # 把这个对象到项目类别为“字符串”。只要选择的
  37. # 一类是突出在Ace项目菜单命令窗口,这个对象将
  38. # 被包括在项目窗口中列示.
  39. #
  40. # <图片:字符串>
  41. # 它使用一个图片从图形\图片\你的RPG制造商VX Ace项目
  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.     # 这些数组调整和显示各种类型的物品显示项,
  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.       [:category,   "食物"], # Categorized by <category: string>
  140.       [:category,   "饮料"], # Categorized by <category: string>
  141.       [:category,   "材料"], # Categorized by <category: string>
  142.       [:category,   "书籍"], # Categorized by <category: string>
  143.       [:category,   "特别"], # Categorized by <category: string>
  144.       [:category,   "宝物"], # Shows all key items.
  145.       [     :all,   "全部"], # Shows all usable items.
  146.     ] # Do not remove this.
  147.    
  148.     # This array contains the order for the Weapon categories.
  149.     WEAPON_TYPES =[
  150.     # [  :symbol,   "Display"],
  151.       [   :types,  "WPNTYPES"], # Lists all of the individual weapon types.
  152.       [     :all,       "全部"], # Shows all weapons.
  153.     ] # Do not remove this.
  154.    
  155.     # This array contains the order for the Armour categories.
  156.     ARMOUR_TYPES =[
  157.     # [  :symbol,   "Display"],
  158.       [   :slots,  "ARMSLOTS"], # Lists all of the individual armour slots.
  159.       [   :types,  "ARMTYPES"], # Lists all of the individual armours types.
  160.       [     :all,       "全部"], # Shows all armours.
  161.     ] # Do not remove this.
  162.    
  163.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  164.     # - Item Status Settings -
  165.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  166.     # The item status window displays information about the item in detail.
  167.     # Adjust the settings below to change the way the status window appears.
  168.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  169.     STATUS_FONT_SIZE = 20       # Font size used for status window.
  170.     MAX_ICONS_DRAWN  = 10       # Maximum number of icons drawn for states.
  171.    
  172.     # The following adjusts the vocabulary used for the status window. Each
  173.     # of the vocabulary settings are self explanatory.
  174.     VOCAB_STATUS ={
  175.       :empty      => "---",          # Text used when nothing is shown.
  176.       :hp_recover => "治疗体力",      # Text used for HP Recovery.
  177.       :mp_recover => "恢复魔法",      # Text used for MP Recovery.
  178.       :tp_recover => "恢复TP",      # Text used for TP Recovery.
  179.       :tp_gain    => "增加TP",      # Text used for TP Gain.
  180.       :applies    => "使用效果",      # Text used for applied states and buffs.
  181.       :removes    => "移除效果",      # Text used for removed states and buffs.
  182.     } # Do not remove this.
  183.    
  184.   end # ITEM
  185. end # YEA

  186. #==============================================================================
  187. # ▼ Editting anything past this point may potentially result in causing
  188. # computer damage, incontinence, explosion of user's head, coma, death, and/or
  189. # halitosis so edit at your own risk.
  190. #==============================================================================

  191. module YEA
  192.   module REGEXP
  193.   module BASEITEM
  194.    
  195.     CATEGORY = /<(?:CATEGORIES|category):[ ](.*)>/i
  196.     IMAGE    = /<(?:IMAGE|image):[ ](.*)>/i
  197.    
  198.   end # BASEITEM
  199.   end # REGEXP
  200. end # YEA

  201. #==============================================================================
  202. # ■ Numeric
  203. #==============================================================================

  204. class Numeric
  205.   
  206.   #--------------------------------------------------------------------------
  207.   # new method: group_digits
  208.   #--------------------------------------------------------------------------
  209.   unless $imported["YEA-CoreEngine"]
  210.   def group; return self.to_s; end
  211.   end # $imported["YEA-CoreEngine"]
  212.    
  213. end # Numeric

  214. #==============================================================================
  215. # ■ Vocab
  216. #==============================================================================

  217. module Vocab
  218.   
  219.   #--------------------------------------------------------------------------
  220.   # new method: self.item_status
  221.   #--------------------------------------------------------------------------
  222.   def self.item_status(type)
  223.     return YEA::ITEM::VOCAB_STATUS[type]
  224.   end
  225.   
  226. end # Vocab

  227. #==============================================================================
  228. # ■ DataManager
  229. #==============================================================================

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

  255. #==============================================================================
  256. # ■ RPG::BaseItem
  257. #==============================================================================

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

  285. #==============================================================================
  286. # ■ Game_Temp
  287. #==============================================================================

  288. class Game_Temp
  289.   
  290.   #--------------------------------------------------------------------------
  291.   # public instance variables
  292.   #--------------------------------------------------------------------------
  293.   attr_accessor :scene_item_index
  294.   attr_accessor :scene_item_oy
  295.   
  296. end # Game_Temp

  297. #==============================================================================
  298. # ■ Window_ItemList
  299. #==============================================================================

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

  315. #==============================================================================
  316. # ■ Window_ItemCommand
  317. #==============================================================================

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

  409. #==============================================================================
  410. # ■ Window_ItemType
  411. #==============================================================================

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

  518. #==============================================================================
  519. # ■ Window_ItemList
  520. #==============================================================================

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

  633. #==============================================================================
  634. # ■ Window_ItemStatus
  635. #==============================================================================

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

  988. #==============================================================================
  989. # ■ Scene_Item
  990. #==============================================================================

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

  1157. #==============================================================================
  1158. #
  1159. # ▼ End of File
  1160. #
  1161. #==============================================================================
复制代码
回复

使用道具 举报

梦石
0
星屑
336
在线时间
464 小时
注册时间
2009-10-2
回帖
117
 楼主| 发表于 2013-4-7 15:05:05 | 显示全部楼层
我知道这么用了呵呵
...
回复

使用道具 举报

梦石
0
星屑
4853
在线时间
1157 小时
注册时间
2009-10-3
回帖
140
发表于 2013-4-9 11:36:45 | 显示全部楼层
有一个问题
就是那个大图标会变得很模糊啊 怎么才能让大图标和小图标显示的不一样呢
就像是RO里面的那样
小图标
大图标
自己给自己挖了一个坑,然后掉下去的我,竟然爬不上来了,呵呵(NMB)。
回复

使用道具 举报

梦石
0
星屑
50
在线时间
198 小时
注册时间
2011-7-28
回帖
113
发表于 2013-4-10 18:19:38 | 显示全部楼层
28.物品菜单系统强化(Yanfly Engine Ace)
    这个脚本使得物品菜单进一步增加,增强了分类,大图标,使得菜单更得具体美观。脚本中可以自由设置分类名称,在物品备注中设置<category: X>(X为分类名称)就可以将物品归为某分类。在picture文件夹放置图片,然后在物品备注上写<image: X>(X为那个图片的名称),这个物品的大图标就变成这个图片了。如果一个物品没有设置大图标,脚本设置会自动放大物品数倍填入大图标栏。
适用游戏:物品分类较多的游戏
http://rpg.blue/thread-247817-1-1.html
------------
这里有带这个脚本~有说明~
回复

使用道具 举报

梦石
0
星屑
4853
在线时间
1157 小时
注册时间
2009-10-3
回帖
140
发表于 2013-4-10 23:00:55 | 显示全部楼层
yoyu1989 发表于 2013-4-10 18:19
28.物品菜单系统强化(Yanfly Engine Ace)
    这个脚本使得物品菜单进一步增加,增强了分类,大图标,使 ...

嗯   原来如此  谢谢了
不过大图标的放大比例是多少呢
因为我只知道小图标像素是24*24
那么那个默认的大图标像素是多少呢?
您好人当到底,送佛送到西嘛。呵呵
再次感谢
自己给自己挖了一个坑,然后掉下去的我,竟然爬不上来了,呵呵(NMB)。
回复

使用道具 举报

梦石
0
星屑
50
在线时间
198 小时
注册时间
2011-7-28
回帖
113
发表于 2013-4-11 00:05:05 | 显示全部楼层
试了下发现是~100长100宽的~而且不会把图片拉抻~所以如果你素材是长方形的可能会对齐的有些歪~自己注意一下吧~
未命名1.jpg
回复

使用道具 举报

梦石
0
星屑
4853
在线时间
1157 小时
注册时间
2009-10-3
回帖
140
发表于 2013-4-11 21:14:43 | 显示全部楼层
yoyu1989 发表于 2013-4-11 00:05
试了下发现是~100长100宽的~而且不会把图片拉抻~所以如果你素材是长方形的可能会对齐的有些歪~自己注意 ...

那能不能通过修改脚本中的部分数据将这个值改变呢?
我在脚本中还是看见了几个100的数据 就是不知道怎么改呢?
能教教我么?
自己给自己挖了一个坑,然后掉下去的我,竟然爬不上来了,呵呵(NMB)。
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部