#==============================================================================
# ** Theory's Greater Icons
#------------------------------------------------------------------------------
# This script allows you to set x and y sizes for your item and skill icons.
# Be sure to make the files in your icons folder reflect this- it does not
# stretch icons. This script was optimized for 50x50 icons, but any dimensions
# larger than 30x30 and smaller than 200x200 should work.
#
# It required a small menu edit for quantity and SP cost locations; and will
# not be compatible with most CMS's without editing.
#==============================================================================
module Theory_Greater_Icons
Width = 50
Height = 50
Background = 'back'
UncommonElement = 18
UncommonBackground = 'uncommon'
UncommonColor = Color.new(0, 255, 0, 255)
UncommonColorDisabled = Color.new(0, 255, 0, 128)
RareElement = 19
RareBackground = 'rare'
RareColor = Color.new(0, 200, 255, 255)
RareColorDisabled = Color.new(0, 200, 255, 128)
LegendaryElement = 20
LegendaryBackground = 'legendary'
LegendaryColor = Color.new(255, 255, 0, 255)
LegendaryColorDisabled = Color.new(255, 255, 0, 128)
end
#==============================================================================
# ** Window_Selectable
#==============================================================================
class Window_Selectable
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_writer :oh
#--------------------------------------------------------------------------
# * Text Cursor Height
#--------------------------------------------------------------------------
def oh
return @oh.nil? ? 32 : @oh
end
#--------------------------------------------------------------------------
# * Get Top Row
#--------------------------------------------------------------------------
def top_row
# Divide y-coordinate of window contents transfer origin by 1 row
# height of self.oh
return self.oy / self.oh
end
#--------------------------------------------------------------------------
# * Set Top Row
# row : row shown on top
#--------------------------------------------------------------------------
def top_row=(row)
# If row is less than 0, change it to 0
# If row exceeds row_max - 1, change it to row_max - 1
row = [[row, 0].max, row_max - 1].min
# Multiply 1 row height by 32 for y-coordinate of window contents
# transfer origin
self.oy = row * self.oh
end
#--------------------------------------------------------------------------
# * Get Number of Rows Displayable on 1 Page
#--------------------------------------------------------------------------
def page_row_max
# Subtract a frame height of 32 from the window height, and divide it by
# 1 row height of self.oh
return (self.height - 32) / self.oh
end
#--------------------------------------------------------------------------
# * Update Cursor Rectangle
#--------------------------------------------------------------------------
def update_cursor_rect
# If cursor position is less than 0
if @index < 0
self.cursor_rect.empty
return
end
# Get current row
row = @index / @column_max
# If current row is before top row
if row < self.top_row
# Scroll so that current row becomes top row
self.top_row = row
end
# If current row is more to back than back row
if row > self.top_row + (self.page_row_max - 1)
# Scroll so that current row becomes back row
self.top_row = row - (self.page_row_max - 1)
end
# Calculate cursor width
cursor_width = self.width / @column_max - 32
# Calculate cursor coordinates
x = @index % @column_max * (cursor_width + 32)
y = @index / @column_max * self.oh - self.oy
if self.active == true
# Update cursor rectangle
self.cursor_rect.set(x, y, cursor_width, self.oh)
end
end
end
#==============================================================================
# ** Window_Item
#------------------------------------------------------------------------------
# This window displays items in possession on the item and battle screens.
#==============================================================================
class Window_Item < Window_Selectable
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(0, 64, 640, 416)
@column_max = 2
##set the parent selectable height
@oh = Theory_Greater_Icons::Height
refresh
self.index = 0
# If in battle, move window to center of screen
# and make it semi-transparent
if $game_temp.in_battle
self.y = 64
self.height = 256
self.back_opacity = 160
end
end
#--------------------------------------------------------------------------
# * Get Item
#--------------------------------------------------------------------------
def item
return @data[self.index]
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
# Add item
for i in 1...$data_items.size
if $game_party.item_number(i) > 0
@data.push($data_items[i])
end
end
# Also add weapons and items if outside of battle
unless $game_temp.in_battle
for i in 1...$data_weapons.size
if $game_party.weapon_number(i) > 0
@data.push($data_weapons[i])
end
end
for i in 1...$data_armors.size
if $game_party.armor_number(i) > 0
@data.push($data_armors[i])
end
end
end
# If item count is not 0, make a bit map and draw all items
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - Theory_Greater_Icons::Width, row_max * Theory_Greater_Icons::Height)
for i in 0...@item_max
draw_item(i)
end
end
end
#--------------------------------------------------------------------------
# * Draw Item
# index : item number
#--------------------------------------------------------------------------
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
x = 4 + index % 2 * (288 + Theory_Greater_Icons::Width)
y = index / 2 * Theory_Greater_Icons::Height
rect = Rect.new(x, y, self.width / @column_max - Theory_Greater_Icons::Width, Theory_Greater_Icons::Height)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
@bitmap = RPG::Cache.icon(item.icon_name)
case item
when RPG::Weapon
weapon = $data_weapons[item.id]
if weapon.element_set.include?(Theory_Greater_Icons::LegendaryElement)
self.contents.font.color = Theory_Greater_Icons::LegendaryColorDisabled
self.contents.draw_icon(x, y, @bitmap, Theory_Greater_Icons::LegendaryBackground)
elsif weapon.element_set.include?(Theory_Greater_Icons::RareElement)
self.contents.font.color = Theory_Greater_Icons::RareColorDisabled
self.contents.draw_icon(x, y, @bitmap, Theory_Greater_Icons::RareBackground)
elsif weapon.element_set.include?(Theory_Greater_Icons::UncommonElement)
self.contents.font.color = Theory_Greater_Icons::UncommonColorDisabled
self.contents.draw_icon(x, y, @bitmap, Theory_Greater_Icons::UncommonBackground)
elsif !weapon.element_set.include?(Theory_Greater_Icons::RareElement) and !weapon.element_set.include?(Theory_Greater_Icons::UncommonElement) and !weapon.element_set.include?(Theory_Greater_Icons::LegendaryElement)
self.contents.font.color = normal_color
self.contents.draw_icon(x, y, @bitmap, Theory_Greater_Icons::Background)
end
when RPG::Armor
armor = $data_armors[item.id]
if armor.guard_element_set.include?(Theory_Greater_Icons::LegendaryElement)
self.contents.font.color = Theory_Greater_Icons::LegendaryColorDisabled
self.contents.draw_icon(x, y, @bitmap, Theory_Greater_Icons::LegendaryBackground)
elsif armor.guard_element_set.include?(Theory_Greater_Icons::RareElement)
self.contents.font.color = Theory_Greater_Icons::RareColorDisabled
self.contents.draw_icon(x, y, @bitmap, Theory_Greater_Icons::RareBackground)
elsif armor.guard_element_set.include?(Theory_Greater_Icons::UncommonElement)
self.contents.font.color = Theory_Greater_Icons::UncommonColorDisabled
self.contents.draw_icon(x, y, @bitmap, Theory_Greater_Icons::UncommonBackground)
elsif !armor.guard_element_set.include?(Theory_Greater_Icons::RareElement) and !armor.guard_element_set.include?(Theory_Greater_Icons::UncommonElement) and !armor.guard_element_set.include?(Theory_Greater_Icons::LegendaryElement)
self.contents.font.color = disabled_color
self.contents.draw_icon(x, y, @bitmap, Theory_Greater_Icons::Background)
end
when RPG::Item
itema = $data_items[item.id]
if itema.element_set.include?(Theory_Greater_Icons::LegendaryElement)
if $game_party.item_can_use?(item.id)
self.contents.font.color = Theory_Greater_Icons::LegendaryColor
else
self.contents.font.color = Theory_Greater_Icons::LegendaryColorDisabled
end
self.contents.draw_icon(x, y, @bitmap, Theory_Greater_Icons::LegendaryBackground)
elsif itema.element_set.include?(Theory_Greater_Icons::RareElement)
if $game_party.item_can_use?(item.id)
self.contents.font.color = Theory_Greater_Icons::RareColor
else
self.contents.font.color = Theory_Greater_Icons::RareColorDisabled
end
self.contents.draw_icon(x, y, @bitmap, Theory_Greater_Icons::RareBackground)
elsif itema.element_set.include?(Theory_Greater_Icons::UncommonElement)
if $game_party.item_can_use?(item.id)
self.contents.font.color = Theory_Greater_Icons::UncommonColor
else
self.contents.font.color = Theory_Greater_Icons::UncommonColorDisabled
end
self.contents.draw_icon(x, y, @bitmap, Theory_Greater_Icons::UncommonBackground)
elsif !itema.element_set.include?(Theory_Greater_Icons::RareElement) and !itema.element_set.include?(Theory_Greater_Icons::UncommonElement) and !itema.element_set.include?(Theory_Greater_Icons::LegendaryElement)
if $game_party.item_can_use?(item.id)
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
self.contents.draw_icon(x, y, @bitmap, Theory_Greater_Icons::Background)
end
end
opacity = self.contents.font.color == normal_color ? 255 : 128
self.contents.draw_text(x + Theory_Greater_Icons::Width + 4, y, 212, Theory_Greater_Icons::Height, item.name, 0)
tempy = y + Theory_Greater_Icons::Height - 36
self.contents.draw_text(x - 5, tempy, 24, Theory_Greater_Icons::Height, number.to_s, 2)
end
end
#==============================================================================
# ** Window_Status
#------------------------------------------------------------------------------
# This window displays full status specs on the status screen.
#==============================================================================
class Window_Status < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
# actor : actor
#--------------------------------------------------------------------------
def initialize(actor)
super(0, 0, 640, 480)
self.contents = Bitmap.new(width - 32, height - 32)
@actor = actor
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
draw_actor_graphic(@actor, 40, 112)
draw_actor_name(@actor, 4, 0)
draw_actor_class(@actor, 4 + 144, 0)
draw_actor_level(@actor, 96, 32)
draw_actor_state(@actor, 96, 64)
draw_actor_hp(@actor, 96, 112, 172)
draw_actor_sp(@actor, 96, 144, 172)
draw_actor_parameter(@actor, 96, 192, 0)
draw_actor_parameter(@actor, 96, 224, 1)
draw_actor_parameter(@actor, 96, 256, 2)
draw_actor_parameter(@actor, 96, 304, 3)
draw_actor_parameter(@actor, 96, 336, 4)
draw_actor_parameter(@actor, 96, 368, 5)
draw_actor_parameter(@actor, 96, 400, 6)
self.contents.font.color = system_color
self.contents.draw_text(320, 48, 80, 32, "EXP")
self.contents.draw_text(320, 80, 80, 32, "NEXT")
self.contents.font.color = normal_color
self.contents.draw_text(320 + 80, 48, 84, 32, @actor.exp_s, 2)
self.contents.draw_text(320 + 80, 80, 84, 32, @actor.next_rest_exp_s, 2)
self.contents.font.color = system_color
self.contents.draw_text(320, 160, 96, 32, "equipment")
draw_item_name($data_weapons[@actor.weapon_id], 320 + 16, 203)
draw_item_name($data_armors[@actor.armor1_id], 320 + 16, 251)
draw_item_name($data_armors[@actor.armor2_id], 320 + 16, 299)
draw_item_name($data_armors[@actor.armor3_id], 320 + 16, 347)
draw_item_name($data_armors[@actor.armor4_id], 320 + 16, 395)
end
end
#==============================================================================
# ** Window_EquipItem
#------------------------------------------------------------------------------
# This window displays choices when opting to change equipment on the
# equipment screen.
#==============================================================================
class Window_EquipItem < Window_Selectable
#--------------------------------------------------------------------------
# * Object Initialization
# actor : actor
# equip_type : equip region (0-3)
#--------------------------------------------------------------------------
def initialize(actor, equip_type)
super(0, 256, 640, 224)
@oh = Theory_Greater_Icons::Height
@actor = actor
@equip_type = equip_type
@column_max = 2
refresh
self.active = false
self.index = -1
end
#--------------------------------------------------------------------------
# * Item Acquisition
#--------------------------------------------------------------------------
def item
return @data[self.index]
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
# Add equippable weapons
if @equip_type == 0
weapon_set = $data_classes[@actor.class_id].weapon_set
for i in 1...$data_weapons.size
if $game_party.weapon_number(i) > 0 and weapon_set.include?(i)
@data.push($data_weapons[i])
end
end
end
# Add equippable armor
if @equip_type != 0
armor_set = $data_classes[@actor.class_id].armor_set
for i in 1...$data_armors.size
if $game_party.armor_number(i) > 0 and armor_set.include?(i)
if $data_armors[i].kind == @equip_type-1
@data.push($data_armors[i])
end
end
end
end
# Add blank page
@data.push(nil)
# Make a bit map and draw all items
@item_max = @data.size
self.contents = Bitmap.new(width - Theory_Greater_Icons::Width, row_max * Theory_Greater_Icons::Height)
for i in 0...@item_max-1
draw_item(i)
end
end
#--------------------------------------------------------------------------
# * Draw Item
# index : item number
#--------------------------------------------------------------------------
def draw_item(index)
item = @data[index]
x = 4 + index % 2 * (288 + 32)
y = index / 2 * Theory_Greater_Icons::Height + 2
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)
case item
when RPG::Weapon
weapon = @data[index]
if weapon.element_set.include?(Theory_Greater_Icons::LegendaryElement)
self.contents.font.color = Theory_Greater_Icons::LegendaryColor
self.contents.draw_icon(x, y, @bitmap, Theory_Greater_Icons::LegendaryBackground)
elsif weapon.element_set.include?(Theory_Greater_Icons::RareElement)
self.contents.font.color = Theory_Greater_Icons::RareColor
self.contents.draw_icon(x, y, @bitmap, Theory_Greater_Icons::RareBackground)
elsif weapon.element_set.include?(Theory_Greater_Icons::UncommonElement)
self.contents.font.color = Theory_Greater_Icons::UncommonColor
self.contents.draw_icon(x, y, @bitmap, Theory_Greater_Icons::UncommonBackground)
elsif !weapon.element_set.include?(Theory_Greater_Icons::RareElement) and !weapon.element_set.include?(Theory_Greater_Icons::UncommonElement) and !weapon.element_set.include?(Theory_Greater_Icons::LegendaryElement)
self.contents.font.color = normal_color
self.contents.draw_icon(x, y, @bitmap, Theory_Greater_Icons::Background)
end
when RPG::Armor
armor = @data[index]
if armor.guard_element_set.include?(Theory_Greater_Icons::LegendaryElement)
self.contents.font.color = Theory_Greater_Icons::LegendaryColor
self.contents.draw_icon(x, y, @bitmap, Theory_Greater_Icons::LegendaryBackground)
elsif armor.guard_element_set.include?(Theory_Greater_Icons::RareElement)
self.contents.font.color = Theory_Greater_Icons::RareColor
self.contents.draw_icon(x, y, @bitmap, Theory_Greater_Icons::RareBackground)
elsif armor.guard_element_set.include?(Theory_Greater_Icons::UncommonElement)
self.contents.font.color = Theory_Greater_Icons::UncommonColor
self.contents.draw_icon(x, y, @bitmap, Theory_Greater_Icons::UncommonBackground)
elsif !armor.guard_element_set.include?(Theory_Greater_Icons::RareElement) and !armor.guard_element_set.include?(Theory_Greater_Icons::UncommonElement) and !armor.guard_element_set.include?(Theory_Greater_Icons::LegendaryElement)
self.contents.font.color = normal_color
self.contents.draw_icon(x, y, @bitmap, Theory_Greater_Icons::Background)
end
end
self.contents.draw_text(x + Theory_Greater_Icons::Width + 3, y, 212, Theory_Greater_Icons::Height, item.name, 0)
tempy = y + Theory_Greater_Icons::Height - 36
self.contents.font.color = normal_color
self.contents.draw_text(x - 5, tempy, 24, Theory_Greater_Icons::Height, number.to_s, 2)
end
#--------------------------------------------------------------------------
# * Help Text Update
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(self.item == nil ? "" : self.item.description)
end
end
#==============================================================================
# ** Window_EquipRight
#------------------------------------------------------------------------------
# This window displays items the actor is currently equipped with on the
# equipment screen.
#==============================================================================
class Window_EquipRight < Window_Selectable
#--------------------------------------------------------------------------
# * Object Initialization
# actor : actor
#--------------------------------------------------------------------------
def initialize(actor)
super(272, 64, 368, 192)
@oh = Theory_Greater_Icons::Height
self.contents = Bitmap.new(width - Theory_Greater_Icons::Width, height + Theory_Greater_Icons::Height + 15)
@actor = actor
refresh
self.index = 0
end
#--------------------------------------------------------------------------
# * Item Acquisition
#--------------------------------------------------------------------------
def item
return @data[self.index]
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
@data = []
@data.push($data_weapons[@actor.weapon_id])
@data.push($data_armors[@actor.armor1_id])
@data.push($data_armors[@actor.armor2_id])
@data.push($data_armors[@actor.armor3_id])
@data.push($data_armors[@actor.armor4_id])
@item_max = @data.size
self.contents.font.color = system_color
self.contents.draw_text(4, Theory_Greater_Icons::Height * 0, 92, Theory_Greater_Icons::Height, $data_system.words.weapon)
self.contents.draw_text(4, Theory_Greater_Icons::Height * 1, 92, Theory_Greater_Icons::Height, $data_system.words.armor1)
self.contents.draw_text(4, Theory_Greater_Icons::Height * 2, 92, Theory_Greater_Icons::Height, $data_system.words.armor2)
self.contents.draw_text(4, Theory_Greater_Icons::Height * 3, 92, Theory_Greater_Icons::Height, $data_system.words.armor3)
self.contents.draw_text(5, Theory_Greater_Icons::Height * 4, 92, Theory_Greater_Icons::Height, $data_system.words.armor4)
draw_item_name(@data[0], 92, Theory_Greater_Icons::Height * 0)
draw_item_name(@data[1], 92, Theory_Greater_Icons::Height * 1)
draw_item_name(@data[2], 92, Theory_Greater_Icons::Height * 2)
draw_item_name(@data[3], 92, Theory_Greater_Icons::Height * 3)
draw_item_name(@data[4], 92, Theory_Greater_Icons::Height * 4)
end
#--------------------------------------------------------------------------
# * Help Text Update
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(self.item == nil ? "" : self.item.description)
end
end
#==============================================================================
# ** Window_Skill
#------------------------------------------------------------------------------
# This window displays usable skills on the skill and battle screens.
#==============================================================================
class Window_Skill < Window_Selectable
#--------------------------------------------------------------------------
# * Object Initialization
# actor : actor
#--------------------------------------------------------------------------
def initialize(actor)
super(0, 128, 640, 352)
@oh = Theory_Greater_Icons::Height
@actor = actor
@column_max = 2
refresh
self.index = 0
# If in battle, move window to center of screen
# and make it semi-transparent
if $game_temp.in_battle
self.y = 64
self.height = 256
self.back_opacity = 160
end
end
#--------------------------------------------------------------------------
# * Acquiring Skill
#--------------------------------------------------------------------------
def skill
return @data[self.index]
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
for i in [email=0...@actor.skills.size]0...@actor.skills.size[/email]
skill = $data_skills[@actor.skills[i]]
if skill != nil
@data.push(skill)
end
end
# If item count is not 0, make a bit map and draw all items
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - Theory_Greater_Icons::Width, row_max * Theory_Greater_Icons::Height)
for i in 0...@item_max
draw_item(i)
end
end
end
#--------------------------------------------------------------------------
# * Draw Item
# index : item number
#--------------------------------------------------------------------------
def draw_item(index)
skill = @data[index]
x = 4 + index % 2 * (288 + Theory_Greater_Icons::Width)
y = index / 2 * Theory_Greater_Icons::Height
rect = Rect.new(x, y, self.width / @column_max - Theory_Greater_Icons::Width, Theory_Greater_Icons::Height)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
@bitmap = RPG::Cache.icon(skill.icon_name)
if skill.element_set.include?(Theory_Greater_Icons::LegendaryElement)
if @actor.skill_can_use?(skill.id)
self.contents.font.color = Theory_Greater_Icons::LegendaryColor
else
self.contents.font.color = Theory_Greater_Icons::LegendaryColorDisabled
end
self.contents.draw_icon(x, y, @bitmap, Theory_Greater_Icons::LegendaryBackground)
elsif skill.element_set.include?(Theory_Greater_Icons::RareElement)
if @actor.skill_can_use?(skill.id)
self.contents.font.color = Theory_Greater_Icons::RareColor
else
self.contents.font.color = Theory_Greater_Icons::RareColorDisabled
end
self.contents.draw_icon(x, y, @bitmap, Theory_Greater_Icons::RareBackground)
elsif skill.element_set.include?(Theory_Greater_Icons::UncommonElement)
if @actor.skill_can_use?(skill.id)
self.contents.font.color = Theory_Greater_Icons::UncommonColor
else
self.contents.font.color = Theory_Greater_Icons::UncommonColorDisabled
end
self.contents.draw_icon(x, y, @bitmap, Theory_Greater_Icons::UncommonBackground)
elsif !skill.element_set.include?(Theory_Greater_Icons::RareElement) and !skill.element_set.include?(Theory_Greater_Icons::UncommonElement) and !skill.element_set.include?(Theory_Greater_Icons::LegendaryElement)
if @actor.skill_can_use?(skill.id)
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
self.contents.draw_icon(x, y, @bitmap, Theory_Greater_Icons::Background)
end
self.contents.draw_text(x + Theory_Greater_Icons::Width + 4, y - 10, 204, Theory_Greater_Icons::Height, skill.name, 0)
self.contents.draw_text(x + Theory_Greater_Icons::Width + 6, y + 10, 48, Theory_Greater_Icons::Height, skill.sp_cost.to_s, 2)
end
#--------------------------------------------------------------------------
# * Help Text Update
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(self.skill == nil ? "" : self.skill.description)
end
end
#==============================================================================
# ** Window_BattleResult
#------------------------------------------------------------------------------
# This window displays amount of gold and EXP acquired at the end of a battle.
#==============================================================================
class Window_BattleResult < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
# exp : EXP
# gold : amount of gold
# treasures : treasures
#--------------------------------------------------------------------------
def initialize(exp, gold, treasures)
@exp = exp
@gold = gold
@treasures = treasures
super(160, 0, 320, @treasures.size * Theory_Greater_Icons::Height + 64)
self.contents = Bitmap.new(width - 32, height - 32)
self.y = 160 - height / 2
self.back_opacity = 160
self.visible = false
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
x = 4
self.contents.font.color = normal_color
cx = contents.text_size(@exp.to_s).width
self.contents.draw_text(x, 0, cx, 32, @exp.to_s)
x += cx + 4
self.contents.font.color = system_color
cx = contents.text_size("EXP").width
self.contents.draw_text(x, 0, 64, 32, "EXP")
x += cx + 16
self.contents.font.color = normal_color
cx = contents.text_size(@gold.to_s).width
self.contents.draw_text(x, 0, cx, 32, @gold.to_s)
x += cx + 4
self.contents.font.color = system_color
self.contents.draw_text(x, 0, 128, 32, $data_system.words.gold)
y = 32
for item in @treasures
draw_item_name(item, 4, y)
y += Theory_Greater_Icons::Height
end
end
end
#==============================================================================
# ** Window_ShopBuy
#------------------------------------------------------------------------------
# This window displays buyable goods on the shop screen.
#==============================================================================
class Window_ShopBuy < Window_Selectable
#--------------------------------------------------------------------------
# * Object Initialization
# shop_goods : goods
#--------------------------------------------------------------------------
def initialize(shop_goods)
super(0, 128, 368, 352)
@oh = Theory_Greater_Icons::Height
@shop_goods = shop_goods
refresh
self.index = 0
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
for goods_item in @shop_goods
case goods_item[0]
when 0
item = $data_items[goods_item[1]]
when 1
item = $data_weapons[goods_item[1]]
when 2
item = $data_armors[goods_item[1]]
end
if item != nil
@data.push(item)
end
end
# If item count is not 0, make a bit map and draw all items
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - Theory_Greater_Icons::Width, row_max * Theory_Greater_Icons::Height)
for i in 0...@item_max
draw_item(i)
end
end
end
#--------------------------------------------------------------------------
# * Draw Item
# index : item number
#--------------------------------------------------------------------------
def draw_item(index)
item = @data[index]
x = 4
y = index * Theory_Greater_Icons::Height
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)
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
case item
when RPG::Weapon
weapon = @data[index]
if weapon.element_set.include?(Theory_Greater_Icons::LegendaryElement)
self.contents.font.color = Theory_Greater_Icons::LegendaryColor
self.contents.draw_icon(x, y, @bitmap, Theory_Greater_Icons::LegendaryBackground)
elsif weapon.element_set.include?(Theory_Greater_Icons::RareElement)
self.contents.font.color = Theory_Greater_Icons::RareColor
self.contents.draw_icon(x, y, @bitmap, Theory_Greater_Icons::RareBackground)
elsif weapon.element_set.include?(Theory_Greater_Icons::UncommonElement)
self.contents.font.color = Theory_Greater_Icons::UncommonColor
self.contents.draw_icon(x, y, @bitmap, Theory_Greater_Icons::UncommonBackground)
elsif !weapon.element_set.include?(Theory_Greater_Icons::RareElement) and !weapon.element_set.include?(Theory_Greater_Icons::UncommonElement) and !weapon.element_set.include?(Theory_Greater_Icons::LegendaryElement)
self.contents.font.color = normal_color
self.contents.draw_icon(x, y, @bitmap, Theory_Greater_Icons::Background)
end
when RPG::Armor
armor = @data[index]
if armor.guard_element_set.include?(Theory_Greater_Icons::LegendaryElement)
self.contents.font.color = Theory_Greater_Icons::LegendaryColor
self.contents.draw_icon(x, y, @bitmap, Theory_Greater_Icons::LegendaryBackground)
elsif armor.guard_element_set.include?(Theory_Greater_Icons::RareElement)
self.contents.font.color = Theory_Greater_Icons::RareColor
self.contents.draw_icon(x, y, @bitmap, Theory_Greater_Icons::RareBackground)
elsif armor.guard_element_set.include?(Theory_Greater_Icons::UncommonElement)
self.contents.font.color = Theory_Greater_Icons::UncommonColor
self.contents.draw_icon(x, y, @bitmap, Theory_Greater_Icons::UncommonBackground)
elsif !armor.guard_element_set.include?(Theory_Greater_Icons::RareElement) and !armor.guard_element_set.include?(Theory_Greater_Icons::UncommonElement) and !armor.guard_element_set.include?(Theory_Greater_Icons::LegendaryElement)
self.contents.font.color = normal_color
self.contents.draw_icon(x, y, @bitmap, Theory_Greater_Icons::Background)
end
when RPG::Item
itema = $data_items[item.id]
if itema.element_set.include?(Theory_Greater_Icons::LegendaryElement)
self.contents.font.color = Theory_Greater_Icons::LegendaryColor
self.contents.draw_icon(x, y, @bitmap, Theory_Greater_Icons::LegendaryBackground)
elsif itema.element_set.include?(Theory_Greater_Icons::RareElement)
self.contents.font.color = Theory_Greater_Icons::RareColor
self.contents.draw_icon(x, y, @bitmap, Theory_Greater_Icons::RareBackground)
elsif itema.element_set.include?(Theory_Greater_Icons::UncommonElement)
self.contents.font.color = Theory_Greater_Icons::UncommonColor
self.contents.draw_icon(x, y, @bitmap, Theory_Greater_Icons::UncommonBackground)
elsif !itema.element_set.include?(Theory_Greater_Icons::RareElement) and !itema.element_set.include?(Theory_Greater_Icons::UncommonElement) and !itema.element_set.include?(Theory_Greater_Icons::LegendaryElement)
self.contents.font.color = normal_color
self.contents.draw_icon(x, y, @bitmap, Theory_Greater_Icons::Background)
end
end
# Get items in possession
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 price is less than money in possession, and amount in possession is
# not 99, then set to normal text color. Otherwise set to disabled color
if item.price <= $game_party.gold and number < 99
else
self.contents.font.color = disabled_color
end
pricea = item.price
self.contents.draw_text(x + Theory_Greater_Icons::Width + 3, y, 212, Theory_Greater_Icons::Height, item.name, 0)
tempy = y + Theory_Greater_Icons::Height - 36
self.contents.font.color = normal_color
self.contents.draw_text(x - 5, tempy, 24, Theory_Greater_Icons::Height, number.to_s, 2)
self.contents.draw_text(x + 200, y, 16, Theory_Greater_Icons::Height, ":", 1)
self.contents.draw_text(x + 206, y, 60, Theory_Greater_Icons::Height, pricea.to_s, 2)
end
end
#==============================================================================
# ** Window_ShopSell
#------------------------------------------------------------------------------
# This window displays items in possession for selling on the shop screen.
#==============================================================================
class Window_ShopSell < Window_Selectable
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(0, 128, 640, 352)
@oh = Theory_Greater_Icons::Height
@column_max = 2
refresh
self.index = 0
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
for i in 1...$data_items.size
if $game_party.item_number(i) > 0
@data.push($data_items[i])
end
end
for i in 1...$data_weapons.size
if $game_party.weapon_number(i) > 0
@data.push($data_weapons[i])
end
end
for i in 1...$data_armors.size
if $game_party.armor_number(i) > 0
@data.push($data_armors[i])
end
end
# If item count is not 0, make a bitmap and draw all items
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - Theory_Greater_Icons::Width, row_max * Theory_Greater_Icons::Height)
for i in 0...@item_max
draw_item(i)
end
end
end
#--------------------------------------------------------------------------
# * Draw Item
# index : item number
#--------------------------------------------------------------------------
def draw_item(index)
item = @data[index]
x = 4 + index % 2 * (288 + 32)
y = index / 2 * Theory_Greater_Icons::Height
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)
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
case item
when RPG::Weapon
weapon = @data[index]
if weapon.element_set.include?(Theory_Greater_Icons::LegendaryElement)
self.contents.font.color = Theory_Greater_Icons::LegendaryColor
self.contents.draw_icon(x, y, @bitmap, Theory_Greater_Icons::LegendaryBackground)
elsif weapon.element_set.include?(Theory_Greater_Icons::RareElement)
self.contents.font.color = Theory_Greater_Icons::RareColor
self.contents.draw_icon(x, y, @bitmap, Theory_Greater_Icons::RareBackground)
elsif weapon.element_set.include?(Theory_Greater_Icons::UncommonElement)
self.contents.font.color = Theory_Greater_Icons::UncommonColor
self.contents.draw_icon(x, y, @bitmap, Theory_Greater_Icons::UncommonBackground)
elsif !weapon.element_set.include?(Theory_Greater_Icons::RareElement) and !weapon.element_set.include?(Theory_Greater_Icons::UncommonElement) and !weapon.element_set.include?(Theory_Greater_Icons::LegendaryElement)
self.contents.font.color = normal_color
self.contents.draw_icon(x, y, @bitmap, Theory_Greater_Icons::Background)
end
when RPG::Armor
armor = @data[index]
if armor.guard_element_set.include?(Theory_Greater_Icons::LegendaryElement)
self.contents.font.color = Theory_Greater_Icons::LegendaryColor
self.contents.draw_icon(x, y, @bitmap, Theory_Greater_Icons::LegendaryBackground)
elsif armor.guard_element_set.include?(Theory_Greater_Icons::RareElement)
self.contents.font.color = Theory_Greater_Icons::RareColor
self.contents.draw_icon(x, y, @bitmap, Theory_Greater_Icons::RareBackground)
elsif armor.guard_element_set.include?(Theory_Greater_Icons::UncommonElement)
self.contents.font.color = Theory_Greater_Icons::UncommonColor
self.contents.draw_icon(x, y, @bitmap, Theory_Greater_Icons::UncommonBackground)
elsif !armor.guard_element_set.include?(Theory_Greater_Icons::RareElement) and !armor.guard_element_set.include?(Theory_Greater_Icons::UncommonElement) and !armor.guard_element_set.include?(Theory_Greater_Icons::LegendaryElement)
self.contents.font.color = normal_color
self.contents.draw_icon(x, y, @bitmap, Theory_Greater_Icons::Background)
end
when RPG::Item
itema = $data_items[item.id]
if itema.element_set.include?(Theory_Greater_Icons::LegendaryElement)
self.contents.font.color = Theory_Greater_Icons::LegendaryColor
self.contents.draw_icon(x, y, @bitmap, Theory_Greater_Icons::LegendaryBackground)
elsif itema.element_set.include?(Theory_Greater_Icons::RareElement)
self.contents.font.color = Theory_Greater_Icons::RareColor
self.contents.draw_icon(x, y, @bitmap, Theory_Greater_Icons::RareBackground)
elsif itema.element_set.include?(Theory_Greater_Icons::UncommonElement)
self.contents.font.color = Theory_Greater_Icons::UncommonColor
self.contents.draw_icon(x, y, @bitmap, Theory_Greater_Icons::UncommonBackground)
elsif !itema.element_set.include?(Theory_Greater_Icons::RareElement) and !itema.element_set.include?(Theory_Greater_Icons::UncommonElement) and !itema.element_set.include?(Theory_Greater_Icons::LegendaryElement)
self.contents.font.color = normal_color
self.contents.draw_icon(x, y, @bitmap, Theory_Greater_Icons::Background)
end
end
if item.price <= 0
self.contents.font.color = disabled_color
end
pricea = item.price / 2
self.contents.draw_text(x + Theory_Greater_Icons::Width + 3, y, 212, Theory_Greater_Icons::Height, item.name, 0)
tempy = y + Theory_Greater_Icons::Height - 36
self.contents.font.color = normal_color
self.contents.draw_text(x - 5, tempy, 24, Theory_Greater_Icons::Height, number.to_s, 2)
self.contents.draw_text(x + 200, y, 16, Theory_Greater_Icons::Height, ":", 1)
self.contents.draw_text(x + 206, y, 60, Theory_Greater_Icons::Height, pricea.to_s, 2)
end
end
class Bitmap
def draw_icon(x, y, filename, back='')
backdrop = RPG::Cache.icon(back)
center_x = Theory_Greater_Icons::Width / 2 + x
center_y = Theory_Greater_Icons::Height / 2 + y
left_x = center_x - backdrop.rect.width / 2
upper_y = center_y - backdrop.rect.height / 2
self.blt(left_x, upper_y, backdrop, backdrop.rect, 255)
bitmap = filename
left_x = center_x - bitmap.rect.width / 2
upper_y = center_y - bitmap.rect.height / 2
self.blt(left_x, upper_y - 2, bitmap, bitmap.rect, 255)
end
end
class Window_Base
#--------------------------------------------------------------------------
# * Draw Item Name
# item : item
# x : draw spot x-coordinate
# y : draw spot y-coordinate
#--------------------------------------------------------------------------
def draw_item_name(item, x, y)
if item == nil
return
end
@bitmap = RPG::Cache.icon(item.icon_name)
case item
when RPG::Weapon
weapon = $data_weapons[item.id]
if weapon.element_set.include?(Theory_Greater_Icons::LegendaryElement)
self.contents.font.color = Theory_Greater_Icons::LegendaryColor
self.contents.draw_icon(x, y, @bitmap, Theory_Greater_Icons::LegendaryBackground)
elsif weapon.element_set.include?(Theory_Greater_Icons::RareElement)
self.contents.font.color = Theory_Greater_Icons::RareColor
self.contents.draw_icon(x, y, @bitmap, Theory_Greater_Icons::RareBackground)
elsif weapon.element_set.include?(Theory_Greater_Icons::UncommonElement)
self.contents.font.color = Theory_Greater_Icons::UncommonColor
self.contents.draw_icon(x, y, @bitmap, Theory_Greater_Icons::UncommonBackground)
elsif !weapon.element_set.include?(Theory_Greater_Icons::RareElement) and !weapon.element_set.include?(Theory_Greater_Icons::UncommonElement) and !weapon.element_set.include?(Theory_Greater_Icons::LegendaryElement)
self.contents.font.color = normal_color
self.contents.draw_icon(x, y, @bitmap, Theory_Greater_Icons::Background)
end
when RPG::Armor
armor = $data_armors[item.id]
if armor.guard_element_set.include?(Theory_Greater_Icons::LegendaryElement)
self.contents.font.color = Theory_Greater_Icons::LegendaryColor
self.contents.draw_icon(x, y, @bitmap, Theory_Greater_Icons::LegendaryBackground)
elsif armor.guard_element_set.include?(Theory_Greater_Icons::RareElement)
self.contents.font.color = Theory_Greater_Icons::RareColor
self.contents.draw_icon(x, y, @bitmap, Theory_Greater_Icons::RareBackground)
elsif armor.guard_element_set.include?(Theory_Greater_Icons::UncommonElement)
self.contents.font.color = Theory_Greater_Icons::UncommonColor
self.contents.draw_icon(x, y, @bitmap, Theory_Greater_Icons::UncommonBackground)
elsif !armor.guard_element_set.include?(Theory_Greater_Icons::RareElement) and !armor.guard_element_set.include?(Theory_Greater_Icons::UncommonElement) and !armor.guard_element_set.include?(Theory_Greater_Icons::LegendaryElement)
self.contents.font.color = normal_color
self.contents.draw_icon(x, y, @bitmap, Theory_Greater_Icons::Background)
end
when RPG::Item
itema = $data_items[item.id]
if itema.element_set.include?(Theory_Greater_Icons::LegendaryElement)
self.contents.font.color = Theory_Greater_Icons::LegendaryColor
self.contents.draw_icon(x, y, @bitmap, Theory_Greater_Icons::LegendaryBackground)
elsif itema.element_set.include?(Theory_Greater_Icons::RareElement)
self.contents.font.color = Theory_Greater_Icons::RareColor
self.contents.draw_icon(x, y, @bitmap, Theory_Greater_Icons::RareBackground)
elsif itema.element_set.include?(Theory_Greater_Icons::UncommonElement)
self.contents.font.color = Theory_Greater_Icons::UncommonColor
self.contents.draw_icon(x, y, @bitmap, Theory_Greater_Icons::UncommonBackground)
elsif !itema.element_set.include?(Theory_Greater_Icons::RareElement) and !itema.element_set.include?(Theory_Greater_Icons::UncommonElement) and !itema.element_set.include?(Theory_Greater_Icons::LegendaryElement)
self.contents.font.color = normal_color
self.contents.draw_icon(x, y, @bitmap, Theory_Greater_Icons::Background)
end
end
self.contents.draw_text(x + Theory_Greater_Icons::Width + 4, y, 212, Theory_Greater_Icons::Width, item.name)
end
end