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

Project1

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

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

[复制链接]

Lv2.观梦者

梦石
0
星屑
341
在线时间
453 小时
注册时间
2009-10-2
帖子
125
跳转到指定楼层
1
发表于 2013-4-4 22:42:35 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

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

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

x
#==============================================================================
#
# ▼ 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
#
#==============================================================================
...

Lv2.观梦者

梦石
0
星屑
758
在线时间
2064 小时
注册时间
2011-10-3
帖子
1686
2
发表于 2013-4-4 23:46:18 | 只看该作者
放到脚本里就可以了
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
125
在线时间
0 小时
注册时间
2013-4-5
帖子
4
3
发表于 2013-4-5 12:09:19 | 只看该作者
放到MAIN前就可以了,但要小心跟其他的外来脚本有冲突,我就遇到过.
回复 支持 反对

使用道具 举报

Lv1.梦旅人

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

使用道具 举报

Lv2.观梦者

梦石
0
星屑
341
在线时间
453 小时
注册时间
2009-10-2
帖子
125
5
 楼主| 发表于 2013-4-7 15:05:05 | 只看该作者
我知道这么用了呵呵
...
回复 支持 反对

使用道具 举报

Lv3.寻梦者

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

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
198 小时
注册时间
2011-7-28
帖子
120
7
发表于 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
------------
这里有带这个脚本~有说明~
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
3617
在线时间
1065 小时
注册时间
2009-10-3
帖子
185
8
发表于 2013-4-10 23:00:55 | 只看该作者
yoyu1989 发表于 2013-4-10 18:19
28.物品菜单系统强化(Yanfly Engine Ace)
    这个脚本使得物品菜单进一步增加,增强了分类,大图标,使 ...

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

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
198 小时
注册时间
2011-7-28
帖子
120
9
发表于 2013-4-11 00:05:05 | 只看该作者
试了下发现是~100长100宽的~而且不会把图片拉抻~所以如果你素材是长方形的可能会对齐的有些歪~自己注意一下吧~

未命名1.jpg (35.31 KB, 下载次数: 33)

未命名1.jpg
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
3617
在线时间
1065 小时
注册时间
2009-10-3
帖子
185
10
发表于 2013-4-11 21:14:43 | 只看该作者
yoyu1989 发表于 2013-4-11 00:05
试了下发现是~100长100宽的~而且不会把图片拉抻~所以如果你素材是长方形的可能会对齐的有些歪~自己注意 ...

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

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2025-1-1 17:57

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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