Project1

标题: 【物品描绘品质颜色】 [打印本页]

作者: VIPArcher    时间: 2014-10-9 11:46
标题: 【物品描绘品质颜色】
本帖最后由 VIPArcher 于 2014-11-16 22:16 编辑

论坛里有类似的脚本(比如:
https://rpg.blue/thread-217113-1-1.html
https://rpg.blue/thread-349653-1-1.html
这个脚本的不同之处就是使用windowskin里面的色板来获取颜色,
还可以通过这个脚本来进行自定义控制符控制的颜色
好处就是让物品帮助增强里也能使用颜色描绘
使用方法就是备注栏备注<color 1>或者<品质 2>又或者<颜色 3>
  1. #encoding:utf-8
  2. #==============================================================================
  3. # ■ 物品颜色描绘
  4. # By :VIPArcher
  5. #  -- 本脚本来自 https://rpg.blue 使用或转载请保留以上信息。
  6. #==============================================================================
  7. $VIPArcherScript ||= {};$VIPArcherScript[:itemcolor] = 20141007
  8. module VIPArcher;end
  9. module VIPArcher::ItemColor
  10.   RIM = true #是否描绘边框
  11.   #为了方便设置品质等级,
  12.   Color_Lv = {
  13.     0 => 0,
  14.     1 => 24,
  15.     2 => 1,
  16.     3 => 30,
  17.     4 => 27,
  18.     5 => 18,
  19.     6 => 14
  20. # 品质  控制符颜色编号
  21. # 继续添加
  22.     }
  23. end
  24. class RPG::BaseItem
  25.   #--------------------------------------------------------------------------
  26.   # ● 获取道具的品质
  27.   #--------------------------------------------------------------------------
  28.   def color
  29.     self.note =~ /\<(?:color|品质|颜色)\s*(\d+)\>/i
  30.     $1.nil? ? 0 : [[$1.to_i,VIPArcher::ItemColor::Color_Lv.size - 1].min,0].max
  31.   end
  32. end
  33. #==============================================================================
  34. # ■ 游戏中所有窗口的父类
  35. #==============================================================================
  36. class Window_Base < Window
  37.   #--------------------------------------------------------------------------
  38.   # ● 描绘物品
  39.   #--------------------------------------------------------------------------
  40.   def draw_item_name(item, x, y, enabled = true, width = 172)
  41.     return unless item
  42.     draw_icon(item.icon_index, x, y, enabled)
  43.     item_color = text_color(VIPArcher::ItemColor::Color_Lv[item.color])
  44.     change_color(item_color, enabled)
  45.     self.color_fill_rect(x,y,item_color) if VIPArcher::ItemColor::RIM
  46.     draw_text(x + 24, y, width, line_height, item.name)
  47.   end
  48.   #--------------------------------------------------------------------------
  49.   # ● 绘制图标边框
  50.   #--------------------------------------------------------------------------
  51.   def color_fill_rect(x,y,item_color)
  52.     contents.fill_rect(x+1 ,y+1 ,22, 1  ,item_color)
  53.     contents.fill_rect(x   ,y+2 ,1 , 20 ,item_color)
  54.     contents.fill_rect(x+1 ,y+22,22, 1  ,item_color)
  55.     contents.fill_rect(x+23,y+2 ,1 , 20 ,item_color)
  56.   end
  57. end
复制代码
Q&A
Q:物品颜色描绘已经有多个版本,而且好像功能比这个还多。为什么再写一个呢?
A:为了装逼就像上面说的,为了让帮助增强也能描绘物品的颜色特制的脚本。
作者: chd114    时间: 2014-10-9 21:48
  1. 使用windowskin里面的色板
复制代码
这一句的意思是像讨论区那个9月初提到的那个里面的那个东西那样吗?




欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1