Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #==============================================================================
- # ** Drago - Iconset Loader
- # Version : 1.00
- # Contact : littledrago.blogspot.com / forum.chaos-project.com
- #==============================================================================
- ($imported ||= {})[:drg_iconset_loader] = 1.00
- #==============================================================================
- #
- # Introduction :
- #
- # This script loads icon graphics from VX / VXAce Iconset
- #
- # How to use :
- #
- # Place Iconset.png in Graphics/System (you can get it from VX / VXAce RTP)
- #
- # Change every item/weapon/armor/skill icon index in the module below.
- # Unconfigured item/weapon/armor/skill will keep using old image.
- #
- # Available effects :
- #
- # :brighten!, :darken!, :frost!, :pixelate!, :invert!, :grayscale!, :blur,
- # :flip_vertical!, :flip_horizontal!, :add_bitmap_blend, :sub_bitmap_blend
- # :rotate90!, :rotate180!, :rotate270!
- #
- #==============================================================================
- core = "This script needs Drago - Core Engine ver 1.58 or above"
- rmvx = "This script only for RMXP"
- ($imported[:drg_core_engine]||0) >= 1.58 || raise(core)
- LiTTleDRAgo::XP || raise(rmxp)
- module Iconset
- #============================================================================
- # ■ Iconset::Item
- #----------------------------------------------------------------------------
- #
- #============================================================================
- module Item
- def self.icon_index(id)
- case id
- when :ID then [:index, :hue, :effects, :effects, '...']
- when 1 then [192]
- when 2 then [192, 40, :brighten!, :brighten!]
- when 3 then [192, 80, :brighten!, :brighten!, :brighten!]
- when 4 then [193]
- when 5 then [193, 40]
- when 6 then [193, 80, :frost!]
- end
- end
- end
- #============================================================================
- # ■ Iconset::Armor
- #----------------------------------------------------------------------------
- #
- #============================================================================
- module Armor
- def self.icon_index(id)
- case id
- when :ID then [:index, :hue, :effects, :effects, '...']
- end
- end
- end
- #============================================================================
- # ■ Iconset::Weapon
- #----------------------------------------------------------------------------
- #
- #============================================================================
- module Weapon
- def self.icon_index(id)
- case id
- when :ID then [:index, :hue, :effects, :effects, '...']
- end
- end
- end
- #============================================================================
- # ■ Iconset::Skill
- #----------------------------------------------------------------------------
- #
- #============================================================================
- module Skill
- def self.icon_index(id)
- case id
- when :ID then [:index, :hue, :effects, :effects, '...']
- end
- end
- end
- end
- #==============================================================================
- # ■ RPG::Cache
- #------------------------------------------------------------------------------
- #
- #==============================================================================
- ModCache = LiTTleDRAgo.cache
- class << ModCache
- #-----------------------------------------------------------------------
- # * Alias Listing
- #-----------------------------------------------------------------------
- alias_sec_method :iconset_effect_change, :icon
- #-----------------------------------------------------------------------
- # * Aliased method: tileset
- #-----------------------------------------------------------------------
- def icon(filename,*args)
- if (img = filename[/<Icon\s*(.+?)\>/i])
- unless include?(filename)
- array = img.get_ints
- bitmap = Bitmap.new(24,24)
- bitmap.draw_icon(array.at(0),0,0)
- bitmap.change_hue(array.at(1)) if array.at(1)
- $1.split(',').each do |method|
- if method.not.empty? && bitmap.respond_to?(method.to_sym)
- bitmap.send(method.to_sym)
- end
- end
- @cache[filename] = bitmap
- end
- @cache[filename]
- else
- iconset_effect_change(filename,*args)
- end
- end
- end
- #==============================================================================
- # ** Object
- #------------------------------------------------------------------------------
- # This class is superclass for all class
- #==============================================================================
- class Object
- #--------------------------------------------------------------------------
- # * self.iconset_init
- #--------------------------------------------------------------------------
- def self.iconset_init(index)
- method = case index
- when 0 then 'Iconset::Item.icon_index(@id)'
- when 1 then 'Iconset::Armor.icon_index(@id)'
- when 2 then 'Iconset::Weapon.icon_index(@id)'
- when 3 then 'Iconset::Skill.icon_index(@id)'
- end
- return unless method
- send(:alias_sec_method, :iconset_effect_change, :icon_name)
- send(:redirect_method, :iconset_index, method)
- send(:define_method, :icon_name) do |*args|
- return "<Icon #{iconset_index}>" if iconset_index.is_a?(Integer)
- return "<Icon #{iconset_index.join(',')}>" if iconset_index.is_a?(Array)
- iconset_effect_change(*args)
- end
- end
- end
- _class = [RPG::Item, RPG::Armor, RPG::Weapon, RPG::Skill]
- _class.each_with_index { |klass,index| klass.iconset_init(index) }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement