neutale

Item Borders Rank

Dec 3rd, 2020 (edited)
829
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #==============================================================================
  2. # ■ Item Borders Rank
  3. # By :VIPArcher [email: VIPArcher@sina.com]
  4. #  -- The script comes from http://rm.66rpg.com Please keep the information above.
  5. #  Feel free to use/ reprint
  6. #==============================================================================
  7. $VIPArcherScript ||= {};$VIPArcherScript[:itemcolor] = __FILE__ #20141007
  8. #-------------------------------------------------------------------------------
  9. module VIPArcher end
  10. #==============================================================================
  11. # ★ Setting ★
  12. #==============================================================================
  13. module VIPArcher::ItemColor
  14.   RIM = true # whether to draw a border
  15.   FILL = true # whether to fill the border
  16.   # To set a color quality,
  17.   Color_Lv = {
  18. # Rank => Control character color number,
  19.     0  =>  0,
  20.     1  =>  24,
  21.     2  =>  1,
  22.     3  =>  30,
  23.     4  =>  27,
  24.     5  =>  18,
  25.     6  =>  14
  26.     # Addition
  27.   };Color_Lv.default = 0 # Don't delete this line
  28. end
  29. #==============================================================================
  30. # ☆ End of setting ☆
  31. #==============================================================================
  32. class RPG::BaseItem
  33.   include VIPArcher::ItemColor
  34.   #--------------------------------------------------------------------------
  35.   # ● Define color
  36.   #--------------------------------------------------------------------------
  37.   def color
  38.     @note =~ /<rank:(?:\s*)(\d+)>/
  39.     [[$1.to_i,Color_Lv.size - 1].min,0].max
  40.   end
  41. end
  42. #-------------------------------------------------------------------------------
  43. class Window_Base < Window
  44.   include VIPArcher::ItemColor
  45.   #--------------------------------------------------------------------------
  46.   # ● Draw item name
  47.   #--------------------------------------------------------------------------
  48.   def draw_item_name(item, x, y, enabled = true, width = 172)
  49.     return unless item
  50.     item_color = text_color(Color_Lv[item.color])
  51.     change_color(item_color, enabled)
  52.     self.color_fill_rect(x,y,item_color) if RIM
  53.     draw_icon(item.icon_index, x, y, enabled)
  54.     draw_text(x + 30, y, width, line_height, item.name)
  55.   end
  56.   #--------------------------------------------------------------------------
  57.   # ● Draw icon border
  58.   #--------------------------------------------------------------------------
  59.   def color_fill_rect(x,y,item_color)
  60.     item_alpha = item_color.clone
  61.     item_alpha.alpha = 160
  62.     contents.fill_rect(x+1 ,y+1 ,22, 22 ,item_alpha) if FILL
  63.     contents.fill_rect(x+1 ,y+1 ,22, 1  ,item_color)
  64.     contents.fill_rect(x   ,y+2 ,1 , 20 ,item_color)
  65.     contents.fill_rect(x+1 ,y+22,22, 1  ,item_color)
  66.     contents.fill_rect(x+23,y+2 ,1 , 20 ,item_color)
  67.   end
  68. end
RAW Paste Data