#===============================================================================
# Item Quality Colors
# Author game_guy
# Version 1.4
#-------------------------------------------------------------------------------
# Intro:
# Changes the color of the items name according to the items quality.
# e.g. rare, common, etc.
#
# Features:
# Unlimited Qualities
# Any Color You Want
#
# Instructions:
# Everything you need to configure for the script is below.
# -Setting the Items Quality:
# Go into the database, click the items, weapons, or armors tab. Type this into
# the name box after the name.
# \qty[quality name]
# e.g.
# You have a quality like so
# Quality['common'] = Color.new(255, 255, 0)
# You type \qty[common] in the items name
#
# Compatibility:
# Not tested with SDK.
# Most likely will not work with custom menu systems/custom item systems.
# -IF you do use a CMS/CIS
# -PM me at http://forum.chaos-project.com/index.php?action=profile;u=220
# -Message me at http://youtube.com/GameGuysProjects
# -Email me at gameguysprojects@hotmail.com
# Use as a last resort, I rarely check my email.
# -Then let me know which custom script you're using and send a copy of it
# and I'll whip up a compatibility patch if I have the time.
# There is some instructions on how to do it yourself in the topic.
#
# Update History:
# v1.0:
# -Initial release
# v1.1:
# -Added support for equip scene
# v1.2:
# -Improved method of getting quality
# v1.3
# -Added support for default shop scene
# v1.4
# -Fixed display for equip scene
# -Rewrote the script to make it more efficient
#
# Credits:
# game_guy ~ Creator of the script.
# mroedesigns ~ Requesting.
# Leongon ~ Original VX version.
#===============================================================================
module GG_QualityColors
Quality = {}
#================================================
# Color used for all other items without a
# quality or when a quality level does not exist
#================================================
Default_Color = Color.new(255, 255, 255)
#================================================
# Add a new line under the qualities already
# given and type
# Quality['quality name'] = Color.new(r, g, b)
# quality name - name of quality in quotes
# r - amount of red
# g - amount of green
# b - amount of blue
# Examples below.
#================================================
Quality['common'] = Color.new(255, 255, 0)
Quality['rare'] = Color.new(120, 20, 0)
Quality['epic'] = Color.new(0, 255, 0)
Quality['awesome'] = Color.new(80, 80, 240)
end
module RPG
def self.get_item_name(t)
text = t.clone
text.gsub!(/\\[Qq][Tt][Yy]\[([0-9A-Za-z_]+)\]/) { "" }
return text
end
def self.get_item_quality(t)
text = t.clone
quality = "gg_def"
text.gsub!(/\\[Qq][Tt][Yy]\[([0-9A-Za-z_]+)\]/) do
quality = $1.to_s
""
end
return quality
end
class Item
def name
return RPG.get_item_name(@name)
end
def quality
return RPG.get_item_quality(@name)
end
end
class Armor
def name
return RPG.get_item_name(@name)
end
def quality
return RPG.get_item_quality(@name)
end
end
class Weapon
def name
return RPG.get_item_name(@name)
end
def quality
return RPG.get_item_quality(@name)
end
end
end
class Window_Item < Window_Selectable
def draw_item(index)
use = false
item = @data[index]
case item
when RPG::Item
number = $game_party.item_number(item.id)
when RPG::Weapon
number = $game_party.weapon_number(item.id)
when RPG::Armor
number = $game_party.armor_number(item.id)
end
if item.is_a?(RPG::Item) and
$game_party.item_can_use?(item.id)
use = true
end
if item.quality == "gg_def"
self.contents.font.color = GG_QualityColors::Default_Color
else
self.contents.font.color = GG_QualityColors::Quality[item.quality]
end
x = 4 + index % 2 * (288 + 32)
y = index / 2 * 32
rect = Rect.new(x, y, self.width / @column_max - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(item.icon_name)
opacity = use == true ? 255 : 128
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
self.contents.font.color = Font.default_color
self.contents.draw_text(x + 240, y, 16, 32, ":", 1)
self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2)
end
end
class Window_Base < Window
def draw_item_name(item, x, y)
if item == nil
return
end
bitmap = RPG::Cache.icon(item.icon_name)
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
if item.quality == 'gg_def'
self.contents.font.color = GG_QualityColors::Default_Color
else
self.contents.font.color = GG_QualityColors::Quality[item.quality]
end
self.contents.draw_text(x + 28, y, 212, 32, item.name)
self.contents.font.color = Font.default_color
end
end
class Window_ShopSell < Window_Selectable
def draw_item(index)
item = @data[index]
case item
when RPG::Item
number = $game_party.item_number(item.id)
when RPG::Weapon
number = $game_party.weapon_number(item.id)
when RPG::Armor
number = $game_party.armor_number(item.id)
end
use = false
if item.price > 0
use = true
end
if item.quality == 'gg_def'
self.contents.font.color = GG_QualityColors::Default_Color
else
self.contents.font.color = GG_QualityColors::Quality[item.quality]
end
x = 4 + index % 2 * (288 + 32)
y = index / 2 * 32
rect = Rect.new(x, y, self.width / @column_max - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(item.icon_name)
opacity = use == true ? 255 : 128
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
self.contents.font.color = Font.default_color
self.contents.draw_text(x + 240, y, 16, 32, ":", 1)
self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2)
end
end
class Window_ShopBuy < Window_Selectable
def draw_item(index)
item = @data[index]
case item
when RPG::Item
number = $game_party.item_number(item.id)
when RPG::Weapon
number = $game_party.weapon_number(item.id)
when RPG::Armor
number = $game_party.armor_number(item.id)
end
if item.quality == 'gg_def'
self.contents.font.color = GG_QualityColors::Default_Color
else
self.contents.font.color = GG_QualityColors::Quality[item.quality]
end
use = false
if item.price <= $game_party.gold and number < 99
use = true
end
x = 4
y = index * 32
rect = Rect.new(x, y, self.width - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(item.icon_name)
opacity = use == true ? 255 : 128
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
self.contents.font.color = Font.default_color
self.contents.font.color = Font.default_color
self.contents.draw_text(x + 240, y, 88, 32, item.price.to_s, 2)
end
end
class Window_EquipItem < Window_Selectable
def draw_item(index)
item = @data[index]
x = 4 + index % 2 * (288 + 32)
y = index / 2 * 32
case item
when RPG::Weapon
number = $game_party.weapon_number(item.id)
when RPG::Armor
number = $game_party.armor_number(item.id)
end
bitmap = RPG::Cache.icon(item.icon_name)
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
if item.quality == 'gg_def'
self.contents.font.color = GG_QualityColors::Default_Color
else
self.contents.font.color = GG_QualityColors::Quality[item.quality]
end
self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
self.contents.font.color = Font.default_color
self.contents.draw_text(x + 240, y, 16, 32, ":", 1)
self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2)
end
end