#=========================================================================================
# ■ Custom Equip Menu by Jackolas
#=========================================================================================
# script by: Jackolas
# Materia system by: Atoa and SephirothSpawn
# Thanks: Juan (for his menu system that helped me a lot)
# SorceressKyrsty (for requesting this script)
#
# Version number: V 0.20
# Last edit date: 25-11-09
#
# Place this script ABOVE the "FF:VII Materia System XP" script (if used) and
# below any other menu scripts
#==============================================================================
module Jackolas_Equip
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# START Configuration below
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Window_opt = 255 #Window optica (1..255)
Font_size = 18 # Font size (default rmxp is 22, recoment 18).
Font_space = 0 #Pixel space between one line and the next
Font_bold = true #Use Bold text or not (false/true)
Color_up = Color.new(0, 255, 0) #Color of increasing stats (red, green, blue)
Color_down = Color.new(255, 0, 0) #Color of decreasing stats (red, green, blue)
Use_Face = true # Put faces on or off (any face of max 100 x 100 will do)
Face_Place = "Faces/" #The directory where the script can find the faces
Face_Name = "_face" #The added name of the face
Materia = false #Enable materia or not (false/true)
Equip_win = false #Display the little equip window or not (false/true)
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# END Configuration above
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
end
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
#==============================================================================
# Start of the script
#==============================================================================
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
#--------------------------------------------------------------------------
# * Get Up Text Color
#--------------------------------------------------------------------------
def up_color
return Jackolas_Equip::Color_up
end
#--------------------------------------------------------------------------
# * Get Down Text Color
#--------------------------------------------------------------------------
def down_color
return Jackolas_Equip::Color_down
end
#==============================================================================
# ** Player_char_window
#------------------------------------------------------------------------------
# This window shows the current player selected and there main stats
#==============================================================================
class Player_char_window < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(actor)
super(0, 0, 300,132)
self.contents = Bitmap.new(width - 32, height - 32)
self.active = false
self.opacity = Jackolas_Equip::Window_opt
self.z += 110
@actor = actor
refresh
end
def refresh
spacer = Jackolas_Equip::Font_size + Jackolas_Equip::Font_space
self.contents.clear
self.contents.font.color = normal_color
self.contents.font.size = Jackolas_Equip::Font_size
self.contents.font.bold = Jackolas_Equip::Font_bold
if Jackolas_Equip::Use_Face == true
draw_actor_graphic(@actor, 0, 0)
end
draw_actor_name(@actor, 100 + spacer, 0)
draw_actor_level(@actor, 100 + spacer, spacer * 1)
draw_actor_hp(@actor, 100 + spacer, spacer * 2)
draw_actor_sp(@actor, 100 + spacer, spacer * 3)
@text = nil
self.visible = true
self.contents.font.size = Font.default_size
self.contents.font.bold = false
end
def update
super
end
#--------------------------------------------------------------------------
# * Draw actor faces
#--------------------------------------------------------------------------
def draw_actor_graphic(actor, x, y)
if actor != nil && actor.character_name != ''
if Jackolas_Equip::Use_Face == true
place = Jackolas_Equip::Face_Place
name = Jackolas_Equip::Face_Name
bitmap = RPG::Cache.character("#{place}#{actor.character_name}#{name}", actor.character_hue)
x -= (bitmap.width - 100) / 2
y -= (bitmap.height - 100) / 2
draw_actor_face_Jackolas_equip(actor, x, y)
end
end
end
def draw_actor_face_Jackolas_equip(actor, x, y)
if $tons_version == nil || $tons_version < 3.71 || !FACE_HUE
hue = 0
else
hue = (FACE_HUE ? actor.character_hue : 0)
end
place = Jackolas_Equip::Face_Place
name = Jackolas_Equip::Face_Name
bitmap = RPG::Cache.character("#{place}#{actor.character_name}#{name}", hue)
src_rect = Rect.new(0, 0, bitmap.width, bitmap.height)
self.contents.blt(x, y, bitmap, src_rect)
end
end
#==============================================================================
# ** Window_Materia
#------------------------------------------------------------------------------
# This window shows the Materia
#==============================================================================
class New_Window_Materia < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(actor)
super(0, 189, 320, 96)
self.contents = Bitmap.new(width - 32, height - 32)
self.opacity = Jackolas_Equip::Window_opt
self.z += 106
@actor = actor
@frame = 0
refresh
end
#--------------------------------------------------------------------------
# * Refesh
#--------------------------------------------------------------------------
def refresh(actor = @actor)
self.contents.clear
draw_actor_materia
end
#--------------------------------------------------------------------------
# * Draw Materia
#--------------------------------------------------------------------------
def draw_actor_materia
if Jackolas_Equip::Materia == true
self.contents.clear
self.contents.font.color = normal_color
self.contents.font.size = Jackolas_Equip::Font_size
self.contents.font.bold = Jackolas_Equip::Font_bold
self.contents.draw_text(0, 4, 110, Jackolas_Equip::Font_size, "Equiped:", 0)
self.contents.draw_text(0, 34, 110, Jackolas_Equip::Font_size, "Replaced:", 0)
self.contents.font.size = Font.default_size
self.contents.font.bold = false
self.contents.fill_rect(96, 0, 192, 120, Color.new(0, 0, 0, 0))
self.contents.fill_rect(96, 0, 192, 24, Color.new(0, 0, 0, 50))
self.contents.fill_rect(96, 30, 192, 24, Color.new(0, 0, 0, 50))
for i in 0..1
slots_x, y = 96 - 24, i * 30
if i == 0
if @actor.weapon_id == 0
p_times, s_times = 0, 0
else
p_times = $data_weapons[@actor.weapon_id].paired_materia
s_times = $data_weapons[@actor.weapon_id].single_materia
end
else
if (eval "@actor.armor#{i}_id") == 0
p_times, s_times = 0, 0
else
p_times = eval "$data_armors[@actor.armor#{i}_id].paired_materia"
s_times = eval "$data_armors[@actor.armor#{i}_id].single_materia"
end
end
p_times.times do
bitmap = RPG::Cache.icon(Materia_Config::Paired_Slot_Left)
self.contents.blt(slots_x += 24, y, bitmap, Rect.new(0, 0, 24, 24))
bitmap = RPG::Cache.icon(Materia_Config::Paired_Slot_Right)
self.contents.blt(slots_x += 24, y, bitmap, Rect.new(0, 0, 24, 24))
end
s_times.times do
bitmap = RPG::Cache.icon(Materia_Config::Single_Slot)
self.contents.blt(slots_x += 24, y, bitmap, Rect.new(0, 0, 24, 24))
end
end
for i in 0...@actor.weapon_materia.size
materia = @actor.weapon_materia[i]
unless materia.nil?
hue = materia.get_hue
begin
bitmap = RPG::Cache.icon(materia.name + "_m").dup
rescue
bitmap = RPG::Cache.icon(Materia_Config::Default_Icon).dup
bitmap.hue_change(hue)
end
self.contents.blt(96 + i * 24, 0, bitmap, Rect.new(0, 0, 24, 24))
end
end
for h in 1..4
size = eval "@actor.armor#{h}_materia.size"
for i in 0...size
list = eval "@actor.armor#{h}_materia"
materia = list[i]
unless materia.nil?
hue = materia.get_hue
begin
bitmap = RPG::Cache.icon(materia.name + "_m").dup
rescue
bitmap = RPG::Cache.icon(Materia_Config::Default_Icon).dup
bitmap.hue_change(hue)
end
self.contents.blt(96 + i * 24, 24 * h, bitmap, Rect.new(0, 0, 24, 24))
end
end
end
end
end
#--------------------------------------------------------------------------
# * Update
#--------------------------------------------------------------------------
def update
super
end
end
#==============================================================================
# ** Window_Help
#------------------------------------------------------------------------------
# This window shows skill and item explanations along with actor status.
#==============================================================================
class New_Window_Help < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(0, 132, 640, 57)
self.contents = Bitmap.new(width - 32, height - 32)
self.opacity = Jackolas_Equip::Window_opt
self.z += 105
end
#--------------------------------------------------------------------------
# * Set Text
# text : text string displayed in window
# align : alignment (0..flush left, 1..center, 2..flush right)
#--------------------------------------------------------------------------
def set_text(text, align = 0)
# If at least one part of text and alignment differ from last time
if text != @text or align != @align
# Redraw text
self.contents.clear
self.contents.font.color = normal_color
self.contents.font.size = Jackolas_Equip::Font_size
self.contents.font.bold = Jackolas_Equip::Font_bold
self.contents.draw_text(4, 0, self.width - 40, 25, text, align)
self.contents.font.size = Font.default_size
self.contents.font.bold = false
@text = text
@align = align
@actor = nil
end
self.visible = true
end
#--------------------------------------------------------------------------
# * Set Actor
# actor : status displaying actor
#--------------------------------------------------------------------------
def set_actor(actor)
if actor != @actor
self.contents.clear
draw_actor_name(actor, 4, 0)
draw_actor_state(actor, 140, 0)
draw_actor_hp(actor, 284, 0)
draw_actor_sp(actor, 460, 0)
@actor = actor
@text = nil
self.visible = true
end
end
#--------------------------------------------------------------------------
# * Set Enemy
# enemy : name and status displaying enemy
#--------------------------------------------------------------------------
def set_enemy(enemy)
text = enemy.name
state_text = make_battler_state_text(enemy, 112, false)
if state_text != ""
text += " " + state_text
end
set_text(text, 1)
end
end
#==============================================================================
# Scene_Equip
#==============================================================================
class Scene_Equip
#--------------------------------------------------------------------------
# * Object Initialization
# actor_index : actor index
# equip_index : equipment index
#--------------------------------------------------------------------------
def initialize(actor_index = 0, equip_index = 0)
@actor_index = actor_index
@equip_index = equip_index
end
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
# if Jackolas_Equip::Materia == true
# alias seph_materiasystem_sceneequip_main main
# end
def main
# Get actor
@actor = $game_party.actors[@actor_index]
# if Jackolas_Equip::Materia == true
# @actor.check_old_equip
# seph_materiasystem_sceneequip_main
# @actor.check_equip_change
# end
# Make windows
@help_window = New_Window_Help.new
@left_window = New_Window_EquipLeft.new(@actor)
@right_window = New_Window_EquipRight.new(@actor)
@materia_window = New_Window_Materia.new(@actor)
if Jackolas_Equip::Equip_win == true
@equiptext_window = New_Equip_Text.new
end
@playerchar_window = Player_char_window.new(@actor)
@item_windows = []
(0..4).each {|i| @item_windows.push(New_Window_EquipItem.new(@actor, i))}
@spriteset = Spriteset_Map.new
# Associate help window
@right_window.help_window = @help_window
@item_windows.each {|win| win.help_window = @help_window}
# Set menu opacity
@help_window.opacity = Jackolas_Equip::Window_opt
@left_window.opacity = Jackolas_Equip::Window_opt
@right_window.opacity = Jackolas_Equip::Window_opt
@materia_window.opacity = Jackolas_Equip::Window_opt
if Jackolas_Equip::Equip_win == true
@equiptext_window.opacity = Jackolas_Equip::Window_opt
end
@playerchar_window.opacity = Jackolas_Equip::Window_opt
@item_windows.each_index {|i|
@item_windows[i].opacity = Jackolas_Equip::Window_opt
}
# Set cursor position
@right_window.index = @equip_index
refresh
# Execute transition
Graphics.transition
# Main loop
loop {
# Update game screen
Graphics.update
# Update input information
Input.update
# Frame update
update
# Abort loop if screen is changed
break if $scene != self
}
# Prepare for transition
Graphics.freeze
# Dispose of windows
@help_window.dispose
@left_window.dispose
@right_window.dispose
@materia_window.dispose
if Jackolas_Equip::Equip_win == true
@equiptext_window.dispose
end
@playerchar_window.dispose
@item_windows.each {|win| win.dispose}
@spriteset.dispose
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
# Set item windows to visible
@item_windows.each_index {|i|
@item_windows[i].visible = (@right_window.index == i)
}
# Get currently equipped item
item1 = @right_window.item
# Set current item window to @item_window
case @right_window.index
when 0
newmode = 0
when 1
newmode = 1
when 2
newmode = 1
when 3
newmode = 1
when 4
newmode = 1
end
if newmode != @left_window.mode
@left_window.mode = newmode
@left_window.refresh
end
if @right_window.active
@left_window.set_new_parameters(nil, nil, nil, nil, nil, nil, nil, nil,
'', '')
end
@item_window = @item_windows[@right_window.index]
# If right window is active
if @right_window.active
# Erase parameters for after equipment change
@left_window.set_new_parameters(nil, nil, nil, nil, nil, nil, nil, nil,
'', '')
end
# If item window is active
if @item_window.active
item2 = @item_window.item
last_hp = @actor.hp
last_sp = @actor.sp
old_atk = @actor.atk
old_pdef = @actor.pdef
old_mdef = @actor.mdef
old_str = @actor.str
old_dex = @actor.dex
old_agi = @actor.agi
old_int = @actor.int
old_eva = @actor.eva
@actor.equip(@right_window.index, item2 == nil ? 0 : item2.id)
new_atk = @actor.atk
new_pdef = @actor.pdef
new_mdef = @actor.mdef
new_str = @actor.str
new_dex = @actor.dex
new_agi = @actor.agi
new_int = @actor.int
new_eva = @actor.eva
@left_window.changes = [0, 0, 0, 0, 0, 0, 0, 0]
if new_atk > old_atk
@left_window.changes[0] = 1
end
if new_atk < old_atk
@left_window.changes[0] = -1
end
if new_pdef > old_pdef
@left_window.changes[1] = 1
end
if new_pdef < old_pdef
@left_window.changes[1] = -1
end
if new_mdef > old_mdef
@left_window.changes[2] = 1
end
if new_mdef < old_mdef
@left_window.changes[2] = -1
end
if new_str > old_str
@left_window.changes[3] = 1
end
if new_str < old_str
@left_window.changes[3] = -1
end
if new_dex > old_dex
@left_window.changes[4] = 1
end
if new_dex < old_dex
@left_window.changes[4] = -1
end
if new_agi > old_agi
@left_window.changes[5] = 1
end
if new_agi < old_agi
@left_window.changes[5] = -1
end
if new_int > old_int
@left_window.changes[6] = 1
end
if new_int < old_int
@left_window.changes[6] = -1
end
if new_eva > old_eva
@left_window.changes[7] = 1
end
if new_eva < old_eva
@left_window.changes[7] = -1
end
elem_text = make_elem_text(item2)
stat_text = make_stat_text(item2)
@actor.equip(@right_window.index, item1 == nil ? 0 : item1.id)
@actor.hp = last_hp
@actor.sp = last_sp
@left_window.set_new_parameters(new_atk, new_pdef, new_mdef, new_str,
new_dex, new_agi, new_int, new_eva, elem_text, stat_text)
end
end
#--------------------------------------------------------------------------
# * Set elemental Text
#--------------------------------------------------------------------------
def make_elem_text(item)
text = ''
flag = false
if item.is_a?(RPG::Weapon)
for i in item.element_set
if flag
text += ','
end
text += $data_system.elements[i]
flag = true
end
end
if item.is_a?(RPG::Armor)
for i in item.guard_element_set
if flag
text += ','
end
text += $data_system.elements[i]
flag = true
end
end
return text
end
#--------------------------------------------------------------------------
# * Set stats text
#--------------------------------------------------------------------------
def make_stat_text(item)
text = ''
flag = false
if item.is_a?(RPG::Weapon)
for i in item.plus_state_set
if flag
text += ','
end
text += $data_states[i].name
flag = true
end
end
if item.is_a?(RPG::Armor)
for i in item.guard_state_set
if flag
text += ', '
end
text += $data_states[i].name
flag = true
end
end
return text
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# Update windows
@left_window.update
@right_window.update
@item_window.update
@materia_window.update
@playerchar_window.update
@spriteset.update
refresh
# If right window is active: call update_right
if @right_window.active
update_right
# If item window is active: call update_item
elsif @item_window.active
update_item
end
end
#--------------------------------------------------------------------------
# * Frame Update (when right window is active)
#--------------------------------------------------------------------------
def update_right
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Switch to menu screen
$scene = Scene_Menu.new(2)
# If C button was pressed
elsif Input.trigger?(Input::C)
# If equipment is fixed
if @actor.equip_fix?(@right_window.index)
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Activate item window
@right_window.active = false
@item_window.active = true
@item_window.index = 0
# If R button was pressed
elsif Input.trigger?(Input::R)
# Play cursor SE
$game_system.se_play($data_system.cursor_se)
# To next actor
@actor_index += 1
@actor_index %= $game_party.actors.size
# Switch to different equipment screen
$scene = Scene_Equip.new(@actor_index, @right_window.index)
# If Right button was pressed
elsif Input.trigger?(Input::RIGHT)
# Play cursor SE
$game_system.se_play($data_system.cursor_se)
# To next actor
@actor_index += 1
@actor_index %= $game_party.actors.size
# Switch to different equipment screen
$scene = Scene_Equip.new(@actor_index, @right_window.index)
# If L button was pressed
elsif Input.trigger?(Input::L)
# Play cursor SE
$game_system.se_play($data_system.cursor_se)
# To previous actor
@actor_index += $game_party.actors.size - 1
@actor_index %= $game_party.actors.size
# Switch to different equipment screen
$scene = Scene_Equip.new(@actor_index, @right_window.index)
# If L button was pressed
elsif Input.trigger?(Input::LEFT)
# Play cursor SE
$game_system.se_play($data_system.cursor_se)
# To previous actor
@actor_index += $game_party.actors.size - 1
@actor_index %= $game_party.actors.size
# Switch to different equipment screen
$scene = Scene_Equip.new(@actor_index, @right_window.index)
end
end
#--------------------------------------------------------------------------
# * Frame Update (when item window is active)
#--------------------------------------------------------------------------
def update_item
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Activate right window
@right_window.active = true
@item_window.active = false
@item_window.index = -1
# If C button was pressed
elsif Input.trigger?(Input::C)
# Play equip SE
$game_system.se_play($data_system.equip_se)
# Get currently selected data on the item window
item = @item_window.item
# Change equipment
@actor.equip(@right_window.index, item == nil ? 0 : item.id)
# Activate right window
@right_window.active = true
@item_window.active = false
@item_window.index = -1
# Remake right window and item window contents
@right_window.refresh
@item_window.refresh
@materia_window.refresh
end
end
end
#==============================================================================
# New_Window_EquipLeft
#==============================================================================
class New_Window_EquipLeft < Window_Base
# --------------------------------
attr_accessor :mode
attr_accessor :changes
# --------------------------------
#--------------------------------------------------------------------------
# * Object Initialization
# actor : actor
#--------------------------------------------------------------------------
def initialize(actor)
super(0, 285, 320, 195)
self.contents = Bitmap.new(width - 32, height - 32)
self.opacity = Jackolas_Equip::Window_opt
self.z += 102
@actor = actor
@mode = 0
@changes = [0, 0, 0, 0, 0, 0, 0, 0]
@elem_text = ''
@stat_text = ''
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
spacer = Jackolas_Equip::Font_size + Jackolas_Equip::Font_space
self.contents.font.size = Jackolas_Equip::Font_size
self.contents.font.bold = Jackolas_Equip::Font_bold
(0..6).each {|i| draw_actor_parameter(@actor, 4, spacer * i, i)}
if @new_atk != nil
self.contents.font.color = system_color
self.contents.draw_text(160, 0, 40, 32, '»»', 1)
if @changes[0] == 0
self.contents.font.color = normal_color
elsif @changes[0] == -1
self.contents.font.color = down_color
else
self.contents.font.color = up_color
end
self.contents.draw_text(200, 0, 36, 32, @new_atk.to_s, 2)
end
if @new_pdef != nil
self.contents.font.color = system_color
self.contents.draw_text(160, spacer, 40, 32, '»»', 1)
if @changes[1] == 0
self.contents.font.color = normal_color
elsif @changes[1] == -1
self.contents.font.color = down_color
else
self.contents.font.color = up_color
end
self.contents.draw_text(200, spacer, 36, 32, @new_pdef.to_s, 2)
end
if @new_mdef != nil
self.contents.font.color = system_color
self.contents.draw_text(160, spacer * 2, 40, 32, '»»', 1)
if @changes[2] == 0
self.contents.font.color = normal_color
elsif @changes[2] == -1
self.contents.font.color = down_color
else
self.contents.font.color = up_color
end
self.contents.draw_text(200, spacer * 2, 36, 32, @new_mdef.to_s, 2)
end
if @new_str != nil
self.contents.font.color = system_color
self.contents.draw_text(160, spacer * 3, 40, 32, '»»', 1)
if @changes[3] == 0
self.contents.font.color = normal_color
elsif @changes[3] == -1
self.contents.font.color = down_color
else
self.contents.font.color = up_color
end
self.contents.draw_text(200, spacer * 3, 36, 32, @new_str.to_s, 2)
end
if @new_dex != nil
self.contents.font.color = system_color
self.contents.draw_text(160, spacer * 4, 40, 32, '»»', 1)
if @changes[4] == 0
self.contents.font.color = normal_color
elsif @changes[4] == -1
self.contents.font.color = down_color
else
self.contents.font.color = up_color
end
self.contents.draw_text(200, spacer * 4, 36, 32, @new_dex.to_s, 2)
end
if @new_agi != nil
self.contents.font.color = system_color
self.contents.draw_text(160, spacer * 5, 40, 32, '»»', 1)
if @changes[5] == 0
self.contents.font.color = normal_color
elsif @changes[5] == -1
self.contents.font.color = down_color
else
self.contents.font.color = up_color
end
self.contents.draw_text(200, spacer * 5, 36, 32, @new_agi.to_s, 2)
end
if @new_int != nil
self.contents.font.color = system_color
self.contents.draw_text(160, spacer * 6, 40, 32, '»»', 1)
if @changes[6] == 0
self.contents.font.color = normal_color
elsif @changes[6] == -1
self.contents.font.color = down_color
else
self.contents.font.color = up_color
end
self.contents.draw_text(200, spacer * 6, 36, 32, @new_int.to_s, 2)
end
self.contents.font.size = Font.default_size
self.contents.font.bold = false
end
#--------------------------------------------------------------------------
# * Set parameters after changing equipment
# new_atk : attack power after changing equipment
# new_pdef : physical defense after changing equipment
# new_mdef : magic defense after changing equipment
#--------------------------------------------------------------------------
def set_new_parameters(new_atk, new_pdef, new_mdef, new_str, new_dex,
new_agi, new_int, new_eva, elem_text, stat_text)
flag = false
if new_atk != @new_atk || new_pdef != @new_pdef || new_mdef != @new_mdef
flag = true
elsif new_str != @new_str || new_dex != @new_dex || new_agi != @new_agi
flag = true
elsif new_eva != @new_eva || elem_text != @elem_text || stat_text != @stat_text
flag = true
end
@new_atk = new_atk
@new_pdef = new_pdef
@new_mdef = new_mdef
@new_str = new_str
@new_dex = new_dex
@new_agi = new_agi
@new_int = new_int
@new_eva = new_eva
@elem_text = elem_text
@stat_text = stat_text
if flag
refresh
end
end
end
#==============================================================================
# New_Window_EquipRight
#==============================================================================
class New_Window_EquipRight < Window_Selectable
#--------------------------------------------------------------------------
# * Object Initialization
# actor : actor
#--------------------------------------------------------------------------
def initialize(actor)
super(300, 0, 340, 132) # 125 super(272, 64, 368, 192)
self.contents = Bitmap.new(width - 32, 5 * 32)
self.opacity = Jackolas_Equip::Window_opt
self.z += 100
@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]) #Weapon
@data.push($data_armors[@actor.armor1_id]) #Shield
@data.push($data_armors[@actor.armor2_id]) #Helm
@data.push($data_armors[@actor.armor3_id]) #Armor
@data.push($data_armors[@actor.armor4_id]) #Neck
@item_max = @data.size
self.contents.font.size = Jackolas_Equip::Font_size
self.contents.font.bold = Jackolas_Equip::Font_bold
self.contents.font.color = system_color
self.contents.draw_text(4, 0, 92, 32, $data_system.words.weapon) # weapon
self.contents.draw_text(4, 32, 92, 32, $data_system.words.armor1) # shield
self.contents.draw_text(4, 64, 92, 32, $data_system.words.armor2) # Helm
self.contents.draw_text(4, 96, 92, 32, $data_system.words.armor3) # Armor
self.contents.draw_text(4, 128, 92, 32, $data_system.words.armor4) # Neck\
@data.each_index {|i| draw_item_name(@data[i], 100, 32 * i)}
self.contents.font.size = Font.default_size
self.contents.font.bold = false
end
#--------------------------------------------------------------------------
# * Help Text Update
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(self.item == nil ? '' : self.item.description)
end
end
#==============================================================================
# New_Window_EquipItem
#==============================================================================
class New_Window_EquipItem < Window_Selectable
#--------------------------------------------------------------------------
# * Object Initialization
# actor : actor
# equip_type : equip region (0-3)
#--------------------------------------------------------------------------
def initialize(actor, equip_type)
super(320, 189, 320, 291)
@actor = actor
@equip_type = equip_type
@column_max = 1
refresh
self.active = false
self.index = -1
self.opacity = Jackolas_Equip::Window_opt
self.z += 101
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 = []
if @equip_type == 0
weapon_set = $data_classes[@actor.class_id].weapon_set
(1...$data_weapons.size).each {|i|
if $game_party.weapon_number(i) > 0 && weapon_set.include?(i)
@data.push($data_weapons[i])
end}
else
armor_set = $data_classes[@actor.class_id].armor_set
(1...$data_armors.size).each {|i|
if $game_party.armor_number(i) > 0 && armor_set.include?(i)
@data.push($data_armors[i]) if $data_armors[i].kind == @equip_type-1
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 - 32, row_max * 32)
(0...@item_max-1).each {|i| draw_item(i)}
self.contents.font.size = Jackolas_Equip::Font_size
self.contents.font.bold = Jackolas_Equip::Font_bold
self.contents.draw_text(4, (@item_max-1)*32, 100, 32, '[Unequip]')
self.contents.font.size = Font.default_size
self.contents.font.bold = false
end
#--------------------------------------------------------------------------
# * Draw Item
# index : item number
#--------------------------------------------------------------------------
def draw_item(index)
item = @data[index]
x = 4
y = index * 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.font.size = Jackolas_Equip::Font_size
self.contents.font.bold = Jackolas_Equip::Font_bold
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
self.contents.font.color = normal_color
self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
self.contents.draw_text(x + 240, y, 16, 32, ':', 1)
self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2)
self.contents.font.size = Font.default_size
self.contents.font.bold = false
end
#--------------------------------------------------------------------------
# * Help Text Update
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(self.item == nil ? '' : self.item.description)
end
end
#==============================================================================
# ** Window_equip_text
#------------------------------------------------------------------------------
# This window shows skill and item explanations along with actor status.
#==============================================================================
class New_Equip_Text < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(558, 0, 82, Jackolas_Equip::Font_size+32)
self.contents = Bitmap.new(width - 32, height - 32)
self.active = false
self.opacity = Jackolas_Equip::Window_opt
self.z += 110
refresh
end
def refresh
self.contents.clear
self.contents.font.color = normal_color
self.contents.font.size = Jackolas_Equip::Font_size
self.contents.font.bold = Jackolas_Equip::Font_bold
self.contents.draw_text(0, 0, 50, Jackolas_Equip::Font_size, "Equip", 1)
self.contents.font.size = Font.default_size
self.contents.font.bold = false
end
end