Advertisement
LiTTleDRAgo

[RGSS/2/3] Item Art Color

Oct 21st, 2011
285
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 7.09 KB | None | 0 0
  1. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  2. # Item Art Color
  3. # Version: 1.21
  4. # Author : LiTTleDRAgo
  5. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  6. module LiTTleDRAgo
  7. #------------------------------------------------------------------------------      
  8. # Config Item Color
  9. #         when (ID Item) then return (Type)
  10. # or
  11. #         when (ID Item) then return (Color)
  12. #------------------------------------------------------------------------------      
  13.   def self.ItemColor(i)
  14.     color = case i
  15.     when 2,4,5,9  then Type('common')
  16.     when 3,6      then Type('epic')
  17.     when 7,8      then Color.new(120,20,0,255)
  18.     end
  19.     return color  
  20.   end
  21. #------------------------------------------------------------------------------    
  22. # Config Weapon Color
  23. #       when (ID Weapon) then return (Name Type)
  24. # or
  25. #       when (ID Weapon) then return (Color)
  26. #------------------------------------------------------------------------------      
  27.   def self.WeaponColor(i)
  28.     color = case i
  29.     when 2 then Type('common')
  30.     when 4 then Type('rare')
  31.     end
  32.     return color
  33.   end
  34. #------------------------------------------------------------------------------      
  35. # Config Armor Color
  36. #       when (ID Armor) then return (Name Type)
  37. # or
  38. #       when (ID Armor) then return (Color)
  39. #------------------------------------------------------------------------------      
  40.   def self.ArmorColor(i)
  41.     color = case i
  42.     when 1 then Type('fire')
  43.     when 2 then Type('common')
  44.     when 3 then Type('wind')
  45.     when 6,7 then Type('epic')
  46.     end
  47.     return color
  48.   end
  49. #------------------------------------------------------------------------------      
  50. # Config Type Color
  51. # when (Name Type) then return (Color)
  52. #------------------------------------------------------------------------------      
  53.   def self.Type(x)
  54.     color = case x
  55.     when 'fire'    then Color.red
  56.     when 'ice'     then Color.cyan
  57.     when 'thunder' then Color.purple
  58.     when 'wind'    then Color.green
  59.     when 'earth'   then Color.magenta
  60.     when 'light'   then Color.light_gray
  61.     when 'dark'    then Color.dark_gray
  62.     when 'common'  then Color.new(255, 255, 0  , 255)
  63.     when 'rare'    then Color.new(120, 20 , 0  , 255)
  64.     when 'epic'    then Color.new(119, 255, 0  , 255)
  65.     when 'awesome' then Color.new(80 , 80 , 240, 255)
  66.     end
  67.     return color
  68.   end
  69. #------------------------------------------------------------------------------      
  70. # CONFIG END, DON'T EDIT BELOW UNLESS YOU KNOW WHAT YOU DO
  71. #------------------------------------------------------------------------------
  72. end
  73. #------------------------------------------------------------------------------      
  74. # THE SCRIPT START HERE
  75. #------------------------------------------------------------------------------  
  76. VX = defined?(Window_BattleMessage)
  77. VXA = defined?(Window_KeyItem)
  78. class Window_Base
  79.   alias_method :drago_drawitemname, :draw_item_name
  80.   def drago_item_colors(item,type = 0)
  81.     return normal_color if item == nil
  82.     color = case item
  83.     when RPG::Item   then LiTTleDRAgo.ItemColor  (item.id)
  84.     when RPG::Weapon then LiTTleDRAgo.WeaponColor(item.id)
  85.     when RPG::Armor  then LiTTleDRAgo.ArmorColor (item.id)
  86.     end
  87.     return color ? color : normal_color
  88.   end
  89.  
  90.   def draw_item_name(item, x, y,enabled = true)
  91.     return if !item
  92.     args = VX || VXA ? [item, x, y,enabled] : [item, x, y]
  93.     drago_drawitemname(*args)
  94.     self.contents.font.color = drago_item_colors(item)
  95.     self.contents.font.color.alpha = enabled ? 255 : 128
  96.     if VX || VXA
  97.       self.contents.draw_text(x + 24, y, 172, 24, item.name)
  98.     else
  99.       self.contents.draw_text(x + 28, y, 212, 32, item.name)
  100.     end
  101.   end
  102. end
  103.  
  104. if !VX && !VXA
  105.   Class = ['ShopSell','ShopBuy','Item','EquipItem']
  106.   (0...Class.size).each {|i| eval "
  107.  class Window_#{Class[i]} < Window_Selectable  
  108.    alias_method :drago_itemcolors_drawitem, :draw_item
  109.    def draw_item(index)
  110.      drago_itemcolors_drawitem(index)
  111.      self.contents.font.color = drago_item_colors(@data[index])
  112.      x,y = 4+index%2 * (288+32), index/2*32
  113.      x,y = 4, index * 32 if '#{Class[i]}' =~ /ShopBuy/i
  114.      self.contents.draw_text(x + 28, y, 212, 32, @data[index].name)
  115.    end
  116.  end#"}
  117. end
  118.  
  119. class Color
  120.   def self.normal_color()   Color.new(255,255,255,255)end
  121.   def self.white(a=255)     Color.new(255,255,255,a)  end
  122.   def self.black(a=255)     Color.new(0,0,0,a)        end
  123.   def self.red(a=255)       Color.new(255,0,0,a)      end
  124.   def self.green(a=255)     Color.new(0,255,0,a)      end
  125.   def self.blue(a=255)      Color.new(0,0,255,a)      end
  126.   def self.purple(a=255)    Color.new(255,0,255,a)    end
  127.   def self.yellow(a=255)    Color.new(255,255,0,a)    end
  128.   def self.cyan(a=255)      Color.new(0,255,255,a)    end
  129.   def self.magenta(a=255)   Color.new(255,255,0,a)    end
  130.   def self.light_gray(a=255)Color.new(192,192,192,a)  end
  131.   def self.gray(a=255)      Color.new(128,128,128,a)  end
  132.   def self.dark_gray(a=255) Color.new(64,64,64,a)     end
  133.   def self.pink(a=255)      Color.new(255,175,175,a)  end
  134.   def self.orange(a=255)    Color.new(255,200,0,a)    end
  135. end
  136. #--------------------------------------------------------------------------
  137. # FOR STCMS
  138. #--------------------------------------------------------------------------
  139. if $stormtronics_cms
  140.   Class=[['CMS','Selectable'],['Equipment','CMSItem'],['CMSEquip','Selectable']]
  141.   (0...Class.size).each {|a| eval "
  142.  class Window_#{Class[a][0]}Item < Window_#{Class[a][1]}
  143.   alias_method :drago_itemcolors_drawitem, :draw_item
  144.    def draw_item(i)
  145.      drago_itemcolors_drawitem(i)
  146.      @clas = 1 if '#{Class[a][0]}' =~ /CMS/i
  147.      @clas = 2 if '#{Class[a][0]}' =~ /Equipment/i
  148.      @clas = 3 if '#{Class[a][0]}' =~ /CMSEquip/i
  149.      if (@data[i].is_a?(RPG::Item) || @mode == nil) && @clas == 1
  150.        number = $game_party.item_number(@data[i].id)
  151.        self.contents.font.color = drago_item_colors(@data[i])
  152.        if !$game_party.item_can_use?(@data[i].id)
  153.          self.contents.font.color.alpha = 128
  154.        end
  155.      elsif @data[i].is_a?(RPG::Weapon)
  156.        number = $game_party.weapon_number(@data[i].id)
  157.        self.contents.font.color = drago_item_colors(@data[i])
  158.        if @clas == 1 || (@clas == 2 &&
  159.          !@actor.equippable?($data_weapons[@data[i].id]))
  160.          self.contents.font.color.alpha = 128
  161.        end
  162.      elsif @data[i].is_a?(RPG::Armor)
  163.        number = $game_party.armor_number(@data[i].id)
  164.        self.contents.font.color = drago_item_colors(@data[i])
  165.        if @clas == 1 || (@clas == 2 &&
  166.          !@actor.equippable?($data_armors[@data[i].id]))
  167.          self.contents.font.color.alpha = 128
  168.        end
  169.      end
  170.      self.contents.draw_text(32, i*32, 212, 32, @data[i].name, 0)
  171.      self.contents.draw_text(308, i*32, 16, 32, ':', 1)
  172.      self.contents.draw_text(324, i*32, 24, 32, number.to_s, 2)
  173.    end
  174.  end#"}
  175. end
  176. #--------------------------------------------------------------------------
  177. # END OF SCRIPT
  178. #--------------------------------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement