#==============================================================================
# ■ 装备品质1.0   By 狂晓霸道丶 QQ1711044261  2016/11/10
#------------------------------------------------------------------------------
# ★ 使用说明
#  - 在物品/武器/护甲的注释处,写入:品质[颜色]  例如:品质[橙]
#  - 颜色分别有:白、绿、蓝、紫、橙、红
#  - 素材放在(Graphics/System)的文件夹里,名字为:品质颜色 
#==============================================================================
class RPG::BaseItem
  attr_accessor :quality
  def quality
    a = ["白","绿","蓝","紫","橙","红"]
    note =~ /品质\[(.+?)\]/
    return a.index($1) if $1 != nil
    return 0 if [url=home.php?mod=space&uid=29701]@Quality[/url] == nil
    @quality
  end
end
#==============================================================================
# ■ Window_Base
#------------------------------------------------------------------------------
#  游戏中所有窗口的父类
#==============================================================================
class Window_Base
  #--------------------------------------------------------------------------
  # ● 绘制物品名称
  #     enabled : 有效的标志。false 的时候使用半透明效果绘制
  #--------------------------------------------------------------------------
  def draw_item_name(item, x, y, enabled = true, width = 172)
    return unless item
    bitmap = Cache.system("品质颜色")
    rect = Rect.new(32*item.quality,0, 32, 32)
    contents.blt(x, y, bitmap, rect)
    draw_icon(item.icon_index, x+4, y+4)
    change_color(normal_color, enabled)
    draw_text(x + 24+10, y+4, width, line_height, item.name)
  end
end
#==============================================================================
# ■ Window_ItemList
#------------------------------------------------------------------------------
#  物品画面中,显示持有物品的窗口。
#==============================================================================
class Window_ItemList
  #--------------------------------------------------------------------------
  # ● 获取项目的高度
  #--------------------------------------------------------------------------
  def item_height
    line_height + 12
  end
  #--------------------------------------------------------------------------
  # ● 绘制项目
  #--------------------------------------------------------------------------
  def draw_item(index)
    item = @data[index]
    if item
      rect = item_rect(index)
      rect.width -= 4
      draw_item_name(item, rect.x+2, rect.y+2, enable?(item))
      draw_item_number(rect, item)
    end
  end
end
#==============================================================================
# ■ Window_ShopBuy
#------------------------------------------------------------------------------
#  商店画面中,买入时显示所有商品的窗口。
#==============================================================================
class Window_ShopBuy
  #--------------------------------------------------------------------------
  # ● 获取项目的高度
  #--------------------------------------------------------------------------
  def item_height
    line_height + 12
  end
  #--------------------------------------------------------------------------
  # ● 绘制项目
  #--------------------------------------------------------------------------
  def draw_item(index)
    item = @data[index]
    rect = item_rect(index)
    draw_item_name(item, rect.x+2, rect.y+2, enable?(item))
    rect.width -= 4
    draw_text(rect, price(item), 2)
  end
end
#==============================================================================
# ■ Window_EquipSlot
#------------------------------------------------------------------------------
#  装备画面中,显示角色当前装备的窗口。
#==============================================================================
class Window_EquipSlot
  #--------------------------------------------------------------------------
  # ● 获取项目的高度
  #--------------------------------------------------------------------------
  def item_height
    line_height + 12
  end
  #--------------------------------------------------------------------------
  # ● 绘制项目
  #--------------------------------------------------------------------------
  def draw_item(index)
    return unless @actor
    rect = item_rect(index)
    change_color(system_color, enable?(index))
    draw_text(rect.x+2, rect.y+6, 92, line_height, slot_name(index))
    draw_item_name(@actor.equips[index], rect.x + 92+2, rect.y+2, enable?(index))
  end
  #--------------------------------------------------------------------------
  # ● 刷新
  #--------------------------------------------------------------------------
  def refresh
    create_contents
    draw_all_items
  end
end
#==============================================================================
# ■ Window_Status
#------------------------------------------------------------------------------
#  状态画面中,显示角色基本信息的窗口。
#==============================================================================
class Window_Status
  #--------------------------------------------------------------------------
  # ● 绘制装备
  #--------------------------------------------------------------------------
  def draw_equipments(x, y)
    @actor.equips.each_with_index do |item, i|
      draw_item_name(item, x + 2, y + (line_height+8) * i-8)
    end
  end
end