Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #==============================================================================
- # XaiL System - Icon Item
- # Author: Nicke
- # Created: 09/04/2012
- # Edited: 09/04/2012
- # Version: 1.0
- #==============================================================================
- # Instructions
- # -----------------------------------------------------------------------------
- # To install this script, open up your script editor and copy/paste this script
- # to an open slot below ▼ Materials but above ▼ Main. Remember to save.
- #
- # This script changes Item Scene to display a icon as command instead.
- # There is also a category feature which allows you to change the background
- # color of each items/weapons/armour etc.
- #
- # Right now there is a setup of 6 categories one being the default one.
- # You can easily edit the draw_item_rect method to add new ones.
- #
- # To setup a category for a item use the following code in the note field of the
- # item:
- # <category health>
- # or
- # <category mana>
- # The above will only work if you did not edit the category list.
- #
- # *** Only for RPG Maker VX Ace. ***
- #==============================================================================
- ($imported ||= {})["XAIL-ICON-SKILLS"] = true
- module XAIL
- module ICON_ITEM
- #--------------------------------------------------------------------------#
- # * Settings
- #--------------------------------------------------------------------------#
- # FONT = [name, size, color, bold, shadow]
- FONT = [["Anklada™", "Verdana"], 16, Color.new(255,225,255), true, true]
- # Show/hide option for the item scene.
- # DISPLAY = [show_help_icon, show_name, show_description,
- # show_consumable, show_amount]
- DISPLAY = [true, true, true, true, true]
- # If this is false every item will have the same default black color.
- # NO_CATEGORIES = true/false
- NO_CATEGORIES = true
- end
- end
- class Rect
- # // Rect - IceDragon Surface Xpansion
- def contract!( n=1 )
- contract_horz!(n)
- contract_vert!(n)
- return self
- end
- def contract_horz!( n=1 )
- self.x += n
- self.width -= n*2
- return self
- end
- def contract_vert!( n=1 )
- self.y += n
- self.height -= n*2
- return self
- end
- end
- # *** Don't edit below unless you know what you are doing. ***
- #==============================================================================#
- # ** Window_Help
- #==============================================================================#
- class Window_Help < Window_Base
- def set_item_help(item)
- # // Method to set the item for window help.
- contents.font.name = XAIL::ICON_ITEM::FONT[0]
- contents.font.bold = XAIL::ICON_ITEM::FONT[3]
- contents.font.shadow = XAIL::ICON_ITEM::FONT[4]
- contents.font.out_color = Color.new(0,0,0,255)
- if item
- icon = XAIL::ICON_ITEM::DISPLAY[0] ? '\i[' + item.icon_index.to_s + ']' : ""
- name = XAIL::ICON_ITEM::DISPLAY[1] ? '\c[2] »» ' + item.name + '\c[0]' : ""
- if item.is_a?(RPG::Item) and XAIL::ICON_ITEM::DISPLAY[2]
- consumable = item.consumable ? " (Consumable)" : " (Non-consumable)"
- else
- consumable = ""
- end
- desc = XAIL::ICON_ITEM::DISPLAY[3] ? item.description : ""
- new_line = "\n"
- item_text = icon + name + consumable + new_line + desc
- else
- item_text = ""
- end
- set_text(item_text)
- end
- end
- #==============================================================================#
- # ** Window_ItemList_Icon
- #==============================================================================#
- class Window_ItemList_Icon < Window_ItemList
- #alias xail_itemlist_win_col_max col_max # // No reason to alias
- def col_max(*args, &block)
- return 14
- end
- #alias xail_itemlist_win_spacing spacing # // No reason to alias
- def spacing(*args, &block)
- return 8
- end
- def item_height
- return 26
- end
- def item_width
- return 26
- end
- def update_help(*args, &block)
- # // Method to update help details.
- @help_window.set_item_help(item)
- end
- def refresh
- # // Method to refresh the window.
- contents.clear
- make_item_list
- create_contents
- draw_all_items
- end
- def scan_items(item)
- # // Method to scan the notes for the items.
- item.note.scan(/<category[:]*\s*(.+)>/i)
- return $1
- end
- def draw_item(index)
- # // Method override to draw item.
- item = @data[index]
- if item
- rect = item_rect(index).contract(1)
- draw_item_rect(index, item, rect, rect.x, rect.y)
- draw_item_number(rect, item) if $game_party.item_number(item) > 1 and XAIL::ICON_ITEM::DISPLAY[3]
- end
- end
- def draw_item_icon(icon_index, x, y, enabled = true)
- # // Method to draw icon.
- bitmap = Cache.system("Iconset")
- rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
- contents.blt(x, y, bitmap, rect, enabled ? 255 : 75)
- end
- def draw_item_rect(index, item, rect, x, y)
- # // Method to draw rect.
- outline = rect.clone
- outline.width = rect.width + 1
- outline.height = rect.height + 1
- contents.fill_rect(outline,Color.new(255,255,255,80))
- if XAIL::ICON_ITEM::NO_CATEGORIES
- case scan_items(item)
- when "health"
- color = Color.new(150,0,0,45)
- when "mana"
- color = Color.new(0,0,150,45)
- when "cure"
- color = Color.new(0,130,0,45)
- when "elixir"
- color = Color.new(250,250,0,45)
- when "herbs"
- color = Color.new(0,215,0,45)
- when nil
- color = Color.new(0,0,0,128)
- else
- color = Color.new(0,0,0,128)
- end
- else
- color = Color.new(0,0,0,128)
- end
- color = enable?(item) ? color : Color.new(0,0,0,128)
- contents.fill_rect(rect, color)
- draw_item_icon(item.icon_index, x + 1, y, enable?(item))
- end
- def check_color(color, enabled = true)
- # // Method to set the color and alpha.
- contents.font.color.set(color)
- contents.font.color.alpha = 95 unless enabled
- end
- def draw_item_number(rect, item)
- # // Method to draw the item number.
- rect.y += 15
- if $game_party.item_number(item) < 10
- rect.x -= 2
- end
- contents.font = Font.new(XAIL::ICON_ITEM::FONT[0], XAIL::ICON_ITEM::FONT[1])
- check_color(XAIL::ICON_ITEM::FONT[2], enable?(item))
- contents.font.bold = XAIL::ICON_ITEM::FONT[3]
- contents.font.shadow = XAIL::ICON_ITEM::FONT[4]
- contents.font.out_color = Color.new(0,0,0,255)
- draw_text(rect, sprintf("%2d", $game_party.item_number(item)), 1)
- reset_font_settings
- end
- end
- class Scene_Item < Scene_ItemBase
- def create_item_window
- # // Method override create the item list window.
- wy = @category_window.y + @category_window.height
- wh = Graphics.height - wy
- @item_window = Window_ItemList_Icon.new(0, wy, Graphics.width, wh)
- @item_window.viewport = @viewport
- @item_window.help_window = @help_window
- @item_window.set_handler(:ok, method(:on_item_ok))
- @item_window.set_handler(:cancel, method(:on_item_cancel))
- @category_window.item_window = @item_window
- end
- end # END OF FILE
- #=*==========================================================================*=#
- # ** END OF FILE
- #=*==========================================================================*=#
Advertisement
Add Comment
Please, Sign In to add comment