################################################################################
# LAYERED ICONS
# By: Ixfuru
################################################################################
# This script is really a creator's tool. It gives you the ability to display
# item/weapon/armor and skill icons as layered graphics instead of the single
# image. In order to do this, you simply need to place a note tag in the name
# of the item you wish to display as layered icon.
#
# <licons a, b, c, d, e>
#
# With a, b, c, d, e all being the icon index you wish to use as the layer. You
# may place as many index references as you want as long as you follow two
# rules.
#
# Number 1 : You MUST HAVE commas between each entry
# Number 2 : You MUST HAVE the '<licons' at the beginning and a '>' at the end
#
# If you don't do these things, the images will not display correctly.
#
################################################################################
class RPG::BaseItem
#-----------------------------------------------------------------------------
# Layered Icons
#-----------------------------------------------------------------------------
def layered_icons
self.note.split(/[\r\n]/).each { |line|
case line
when /<licons.+/
icons = []
number = []
line.scan(/./) { |c|
if /(\d)/ =~ c
number.push($1.to_i)
elsif /,/ =~ c
icons.push(number.to_s.to_i)
number.clear
elsif />/ =~ c
icons.push(number.to_s.to_i) unless number.empty?
return icons
end
}
end
}
return nil
end
end
class Window_Base
#-----------------------------------------------------------------------------
# Draw Icon (ALIASED)
#-----------------------------------------------------------------------------
alias ixfuruwindowbasedrawicon draw_icon unless $@
def draw_icon(icon_index, x, y, enabled = true)
if icon_index.is_a?(Integer)
ixfuruwindowbasedrawicon(icon_index, x, y, enabled)
elsif icon_index.is_a?(Array)
for i in 0...icon_index.size
bitmap = Cache.system("Iconset")
rect = Rect.new(icon_index[i] % 16 * 24, icon_index[i] / 16 * 24, 24, 24)
self.contents.blt(x, y, bitmap, rect, enabled ? 255 : 128)
end
end
end
#-----------------------------------------------------------------------------
# Draw Item Name (ALIASED)
#-----------------------------------------------------------------------------
alias ixfuruwindowbasedrawitemname draw_item_name unless $@
def draw_item_name(item, x, y, enabled = true)
if !item.nil? && !item.layered_icons.nil?
draw_icon(item.layered_icons, x, y, enabled)
self.contents.font.color = normal_color
self.contents.font.color.alpha = enabled ? 255 : 128
self.contents.draw_text(x + 24, y, 172, WLH, item.name)
else
ixfuruwindowbasedrawitemname(item, x, y, enabled)
end
end
end