#==============================================================================
# XaiL System - Icon Item
# Author: Nicke
# Created: 09/04/2012
# Edited: 06/05/2012
# Version: 1.0b
#==============================================================================
# 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 the item list to display icons as items 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]
# If this is false every item will have the same default black color.
# NO_CATEGORIES = true/false
NO_CATEGORIES = true
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]' : ""
weight = $imported["XAIL-INVENTORY-WEIGHT"] ? weight = " - Weight #{item.weight}." : ""
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 + weight + new_line + desc
else
item_text = ""
end
set_text(item_text)
end
end
#==============================================================================#
# ** Window_ItemList_Icon
#==============================================================================#
class Window_ItemList_Icon < Window_ItemList
def col_max
# // Method to get col_max.
return 14
end
def spacing
# // Method to get spacing.
return 14
end
def item_width
# // Method to get item_width.
return 24
end
def item_height
# // Method to get item_height.
return 24
end
def row_max
# // Method to get row_max.
return item_max
end
def update_help
# // Method to update help details.
@help_window.set_item_help(item)
end
def item_rect(index)
# // Method to draw item rect.
rect = Rect.new
rect.width = item_width
rect.height = item_height
rect.x = index % col_max * (item_width + spacing)
rect.y = index / col_max * (item_height + 3)
rect
end
def page_row_max
# // Method to define page row max.
return 1
end
def scan_items(item)
# // Method to scan the notes for the items.
item.note.scan(/<category[:]*\s*(.+)>/i)
return $1 if !$1.nil?
end
def draw_item(index)
# // Method override to draw item.
item = @data[index]
if item
rect = item_rect(index)
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 += 8
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
#==============================================================================#
# ** Scene_Item
#==============================================================================#
class Scene_Item < Scene_ItemBase
#=*==========================================================================*=#
# ** END OF FILE
#=*==========================================================================*=#
Nie możesz pisać nowych tematów Nie możesz odpowiadać w tematach Nie możesz zmieniać swoich postów Nie możesz usuwać swoich postów Nie możesz głosować w ankietach Nie możesz załączać plików na tym forum Możesz ściągać załączniki na tym forum