查看: 730|回复: 2

[有事请教] 怎样更改物品名称颜色

[复制链接]
梦石
0
星屑
65
在线时间
3 小时
注册时间
2026-2-12
回帖
0
发表于 2026-3-5 17:29:09 | 显示全部楼层 |阅读模式

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

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

×
怎样更改物品名称颜色
梦石
0
星屑
7066
在线时间
607 小时
注册时间
2017-11-10
回帖
656

极短21参与

发表于 2026-3-11 09:34:22 | 显示全部楼层
[pre lang="ruby"]#==============================================================================
# ■ 物品颜色描绘
# By :VIPArcher [email: VIPArcher@sina.com]
#  -- 本脚本来自 http://rm.66rpg.com 使用或转载请保留以上信息。
#==============================================================================
$VIPArcherScript ||= {};$VIPArcherScript[:itemcolor] = __FILE__ #20141007
#-------------------------------------------------------------------------------
module VIPArcher end
#==============================================================================
# ★ 设定部分 ★
#==============================================================================
module VIPArcher::ItemColor
  RIM = false #是否描绘边框
  FILL = true #是否填充边框
  #为了方便设置品质等级,
  Color_Lv = {
# 品质 => 控制符颜色编号,
    0  =>   0,
    1  =>   1,
    2  =>   2,
    3  =>   3,
    4  =>   4,
    5  =>   5,


    # 继续添加
  };Color_Lv.default = 0 #这行不能删
end
#==============================================================================
# ☆ 设定结束 ☆
#==============================================================================
class RPG::BaseItem
  include VIPArcher::ItemColor
  #--------------------------------------------------------------------------
  # ● 获取道具的品质
  #--------------------------------------------------------------------------
  def color
    @note =~ /\<(?:color|品质|颜色)\s*(\d+)\>/i
    [[$1.to_i,Color_Lv.size - 1].min,0].max
  end
end
#-------------------------------------------------------------------------------
class Window_Base < Window
  include VIPArcher::ItemColor
  #--------------------------------------------------------------------------
  # ● 描绘物品
  #--------------------------------------------------------------------------
  def draw_item_name(item, x, y, enabled = true, width = 172)
    return unless item
    item_color = text_color(Color_Lv[item.color])
    change_color(item_color, enabled)
    self.color_fill_rect(x,y,item_color) if RIM and not item.is_a?(RPG::Skill)
    draw_icon(item.icon_index, x, y, enabled)
    draw_text(x + 24, y, width, line_height, item.name)
    change_color(normal_color)
  end
  #--------------------------------------------------------------------------
  # ● 绘制图标边框
  #--------------------------------------------------------------------------
  def color_fill_rect(x,y,item_color)
    item_alpha = item_color.clone
    item_alpha.alpha = 160
    contents.fill_rect(x+1 ,y+1 ,22, 22 ,item_alpha) if FILL
    contents.fill_rect(x+1 ,y+1 ,22, 1  ,item_color)
    contents.fill_rect(x   ,y+2 ,1 , 20 ,item_color)
    contents.fill_rect(x+1 ,y+22,22, 1  ,item_color)
    contents.fill_rect(x+23,y+2 ,1 , 20 ,item_color)
  end
end[/pre]
回复

使用道具 举报

梦石
0
星屑
7066
在线时间
607 小时
注册时间
2017-11-10
回帖
656

极短21参与

发表于 2026-3-11 09:35:41 | 显示全部楼层
本帖最后由 BCJT 于 2026-3-11 09:38 编辑

物品,装备,技能 的备注里填 <品质 X>  X在脚本里先设置好对应颜色代号,可以随意添加或减少
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部