def refresh
self.contents.clear
self.contents.font.size = 18
self.contents.font.bold = true
self.contents.font.color = system_color
self.contents.draw_text(4, 0, 32, 32, 'H')
self.contents.draw_text(4, 32, 32, 32, 'J')
self.contents.draw_text(228, 0, 32, 32, 'K')
self.contents.draw_text(228, 32, 32, 32, 'L')
self.contents.font.color = normal_color
for i in 0...4
if ABS.skill_key[i] == nil
self.contents.draw_text((i / 2 * 224) + 54, 32 * (i % 2), 124, 32, 'Not assigned')
next
end
skill = $data_skills[ABS.skill_key[i + 1]]
bitmap = RPG::Cache.icon(skill.icon_name)
self.contents.blt((i / 2 * 224) + 26, (32 * (i % 2)) + 4, bitmap, Rect.new(0, 0, 24, 24))
self.contents.draw_text((i / 2 * 224) + 54, 32 * (i % 2), 124, 32, skill.name)
self.contents.draw_text((i / 2 * 224) + 178, 32 * (i % 2), 32, 32, skill.sp_cost.to_s, 2)
end
end
end
#==============================================================================
# ** Window_EquipStat
#------------------------------------------------------------------------------
# This window displays actor parameter changes on the equipment screen.
#==============================================================================
class Window_EquipStat < Window_Base
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :changes
attr_accessor :mode
#--------------------------------------------------------------------------
# * Object Initialization
# actor : actor
#--------------------------------------------------------------------------
def initialize(actor)
super(0, 96, 240, 336)
self.contents = Bitmap.new(width - 32, height - 32)
@actor = actor
@changes = [0, 0, 0, 0, 0, 0, 0, 0]
@mode = 0
@elem_text = ""
@stat_text = ""
refresh
end
#--------------------------------------------------------------------------
# * Updates Window With New Actor
# actor : new actor
#--------------------------------------------------------------------------
def update_actor(actor)
@actor = actor
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.size = 18
self.contents.font.bold = true
for i in 0..7
draw_actor_parameter(@actor, 16, (i * 20) - 8, i, 96, LegACy::STAT_BAR[1])
end
self.contents.font.color = system_color
oldelem_text = ""
oldstat_text = ""
if @mode == 0
item = $data_weapons[@actor.weapon_id]
if item != nil
more = false
for i in item.element_set
next if i == LegACy::ITEMS[0] || i == LegACy::ITEMS[1] ||
i == LegACy::ITEMS[2] || i == LegACy::ITEMS[3] ||
i == LegACy::ITEMS[4] || i == LegACy::ITEMS[5]
oldelem_text += ", " if more
oldelem_text += $data_system.elements[i].to_s
more = true
end
more = false
for i in item.plus_state_set
oldstat_text += ", " if more
oldstat_text += $data_states[i].name
more = true
end
else
oldelem_text = ""
oldstat_text = ""
end
else
item = $data_armors[eval("@actor.armor#{mode}_id")]
if item != nil
more = false
for i in item.guard_element_set
next if i == LegACy::ITEMS[0] || i == LegACy::ITEMS[1] ||
i == LegACy::ITEMS[2] || i == LegACy::ITEMS[3] ||
i == LegACy::ITEMS[4] || i == LegACy::ITEMS[5]
oldelem_text += ", " if more
oldelem_text += $data_system.elements[i].to_s
more = true
end
more = false
for i in item.guard_state_set
oldstat_text += ", " if more
oldstat_text += $data_states[i].name
more = true
end
else
oldelem_text = ""
oldstat_text = ""
end
end
if @mode == 0
self.contents.draw_text(4, 176, 200, 32, "Elemental Attack:")
self.contents.draw_text(4, 240, 200, 32, "Status Attack:")
else
self.contents.draw_text(4, 176, 200, 32, "Elemental Defense:")
self.contents.draw_text(4, 240, 200, 32, "Status Defense:")
end
self.contents.font.color = normal_color
self.contents.draw_text(24, 194, 220, 32, oldelem_text)
self.contents.draw_text(24, 258, 220, 32, oldstat_text)
if @elem_text != ""
self.contents.draw_text(24, 218, 220, 32, @elem_text)
end
if @stat_text != ""
self.contents.draw_text(24, 282, 220, 32, @stat_text)
end
if @new_atk != nil
self.contents.font.color = system_color
self.contents.draw_text(152, -8, 32, 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(176, -8, 32, 32, @new_atk.to_s, 2)
end
if @new_pdef != nil
self.contents.font.color = system_color
self.contents.draw_text(152, 12, 32, 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(176, 12, 32, 32, @new_pdef.to_s, 2)
end
if @new_mdef != nil
self.contents.font.color = system_color
self.contents.draw_text(152, 32, 32, 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(176, 32, 32, 32, @new_mdef.to_s, 2)
end
if @new_str != nil
self.contents.font.color = system_color
self.contents.draw_text(152, 52, 32, 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(176, 52, 32, 32, @new_str.to_s, 2)
end
if @new_dex != nil
self.contents.font.color = system_color
self.contents.draw_text(152, 72, 32, 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(176, 72, 32, 32, @new_dex.to_s, 2)
end
if @new_agi != nil
self.contents.font.color = system_color
self.contents.draw_text(152, 92, 32, 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(176, 92, 32, 32, @new_agi.to_s, 2)
end
if @new_int != nil
self.contents.font.color = system_color
self.contents.draw_text(152, 112, 32, 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(176, 112, 32, 32, @new_int.to_s, 2)
end
if @new_eva != nil
self.contents.font.color = system_color
self.contents.draw_text(152, 132, 32, 32, "»»", 1)
if @changes[7] == 0
self.contents.font.color = normal_color
elsif @changes[7] == -1
self.contents.font.color = down_color
else
self.contents.font.color = up_color
end
self.contents.draw_text(176, 132, 32, 32, @new_eva.to_s, 2)
end
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
# new_str : strength after changing equipment
# new_dex : dexterity after changing equipment
# new_agi : agility after changing equipment
# new_int : inteligence after changing equipment
# new_eva : evasion 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_str != @new_str ||
new_mdef != @new_mdef || new_dex != @new_dex || new_agi != @new_agi ||
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
#==============================================================================
# ** Window_Equipment
#------------------------------------------------------------------------------
# This window displays items the actor is currently equipped with on the
# equipment screen.
#==============================================================================
class Window_Equipment < Window_Selectable
#--------------------------------------------------------------------------
# * Object Initialization
# actor : actor
#--------------------------------------------------------------------------
def initialize(actor)
super(0, 96, 240, 176)
self.contents = Bitmap.new(width - 32, height - 32)
@actor = actor
refresh
self.index = 0
self.active = false
end
#--------------------------------------------------------------------------
# * Updates Window With New Actor
# actor : new actor
#--------------------------------------------------------------------------
def update_actor(actor)
@actor = actor
refresh
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.font.size = 19
self.contents.font.bold = true
self.contents.draw_text(0, 28 * 0, 76, 32, $data_system.words.weapon)
self.contents.draw_text(0, 28 * 1, 76, 32, $data_system.words.armor1)
self.contents.draw_text(0, 28 * 2, 76, 32, $data_system.words.armor2)
self.contents.draw_text(0, 28 * 3, 76, 32, $data_system.words.armor3)
self.contents.draw_text(0, 28 * 4, 76, 32, $data_system.words.armor4)
self.contents.font.bold = false
for i in 0..4
draw_item_name(@data[i], 76, 28 * i)
end
end
#--------------------------------------------------------------------------
# * Update Cursor Rectangle
#--------------------------------------------------------------------------
def update_cursor_rect
# Calculate cursor width
cursor_width = self.width / @column_max - 24
# Calculate cursor coordinates
x = @index % @column_max * (cursor_width + 24)
y = @index * 28
# Update cursor rectangle
self.cursor_rect.set(x - 4, y, cursor_width, 32)
end
def update
#super
# If cursor is movable
if self.active and @item_max > 0 and @index >= 0
# If pressing down on the directional buttons
if Input.repeat?(Input::DOWN)
# If column count is 1 and directional button was pressed down with no
# repeat, or if cursor position is more to the front than
# (item count - column count)
if (@column_max == 1 and Input.trigger?(Input::DOWN)) or
@index < @item_max - @column_max
# Move cursor down
$game_system.se_play($data_system.cursor_se)
@index = (@index + @column_max) % @item_max
end
end
# If the up directional button was pressed
if Input.repeat?(Input::UP)
# If column count is 1 and directional button was pressed up with no
# repeat, or if cursor position is more to the back than column count
if (@column_max == 1 and Input.trigger?(Input::UP)) or
@index >= @column_max
# Move cursor up
$game_system.se_play($data_system.cursor_se)
@index = (@index - @column_max + @item_max) % @item_max
end
end
# If the right directional button was pressed
if Input.repeat?(Input::RIGHT)
# If column count is 2 or more, and cursor position is closer to front
# than (item count -1)
if @column_max >= 2 and @index < @item_max - 1
# Move cursor right
$game_system.se_play($data_system.cursor_se)
@index += 1
end
end
# If the left directional button was pressed
if Input.repeat?(Input::LEFT)
# If column count is 2 or more, and cursor position is more back than 0
if @column_max >= 2 and @index > 0
# Move cursor left
$game_system.se_play($data_system.cursor_se)
@index -= 1
end
end
end
# Update help text (update_help is defined by the subclasses)
if self.active and @help_window != nil
update_help
end
# Update cursor rectangle
update_cursor_rect
end
#--------------------------------------------------------------------------
# * Help Text Update
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(self.item == nil ? "" : self.item.description)
end
end
#==============================================================================
# ** Window_EquipmentItem
#------------------------------------------------------------------------------
# This window displays choices when opting to change equipment on the
# equipment screen.
#==============================================================================
class Window_EquipmentItem < Window_Selectable
#--------------------------------------------------------------------------
# * Object Initialization
# actor : actor
# equip_type : equip region (0-3)
#--------------------------------------------------------------------------
def initialize(actor, equip_type)
super(0, 272, 240, 160)
@actor = actor
@equip_type = equip_type
refresh
self.active = false
self.index = -1
end
#--------------------------------------------------------------------------
# * Updates Window With New Actor
# actor : new actor
#--------------------------------------------------------------------------
def update_actor(actor)
@actor = actor
refresh
end
#--------------------------------------------------------------------------
# * Updates Window With New Equipment Type
# equip_type : new teyp of equipment
#--------------------------------------------------------------------------
def update_equipment(equip_type)
@equip_type = equip_type
refresh
end
#--------------------------------------------------------------------------
# * Item Acquisition
#--------------------------------------------------------------------------
def item
if self.index == 0
return @data[@item_max - 1]
else
return @data[self.index - 1]
end
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 - 32, row_max * 32)
for i in 0...@item_max - 1
draw_item(i)
end
self.contents.draw_text(4, 0, 204, 32, 'Unequip', 0)
end
#--------------------------------------------------------------------------
# * Draw Item
# index : item number
#--------------------------------------------------------------------------
def draw_item(index)
item = @data[index]
x = 4
y = (index + 1) * 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))
self.contents.font.color = normal_color
self.contents.font.size = 20
self.contents.font.bold = true
self.contents.draw_text(x + 28, y, 132, 32, item.name, 0)
self.contents.draw_text(x + 160, y, 12, 32, ":", 1)
self.contents.draw_text(x + 176, y, 24, 32, number.to_s, 2)
end
#--------------------------------------------------------------------------
# * Help Text Update
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(self.item == nil ? 'Unequip the current equipment.' :
self.item.description)
end
end
#==============================================================================
# ** Window_Status
#------------------------------------------------------------------------------
# This window displays full status specs on the status screen.
#==============================================================================
class Window_NewStatus < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
# actor : actor
#--------------------------------------------------------------------------
def initialize(actor)
super(0, 96, 640, 336)
self.contents = Bitmap.new(width - 32, height - 32)
@actor = actor
refresh
self.active = false
end
#--------------------------------------------------------------------------
# * Updates Window With New Actor
# actor : new actor
#--------------------------------------------------------------------------
def update_actor(actor)
@actor = actor
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.size = 22
self.contents.font.bold = false
draw_actor_name(@actor, 12, 0)
if LegACy::POTRAIT[1]
draw_actor_potrait(@actor, 12, 40, LegACy::POTRAIT[1])
draw_LegACy_bar(@actor, 120, 60, 'hp', 200)
draw_LegACy_bar(@actor, 120, 92, 'sp', 200)
draw_LegACy_bar(@actor, 120, 124, 'exp', 200)
else
draw_actor_graphic(@actor, 40, 120)
draw_LegACy_bar(@actor, 96, 60, 'hp', 200)
draw_LegACy_bar(@actor, 96, 92, 'sp', 200)
draw_LegACy_bar(@actor, 96, 124, 'exp', 200)
end
draw_actor_class(@actor, 262, 0)
draw_actor_level(@actor, 184, 0)
draw_actor_state(@actor, 96, 0)
self.contents.font.size = 17
self.contents.font.bold = true
for i in 0..7
draw_actor_parameter(@actor, 386, (i * 20) - 6, i, 120, LegACy::STAT_BAR[2])
end
self.contents.font.color = system_color
self.contents.font.size = 16
draw_actor_element_radar_graph(@actor, 48, 136)
self.contents.font.size = 18
self.contents.font.color = system_color
self.contents.draw_text(380, 156, 96, 32, "Equipment")
self.contents.draw_text(300, 180, 96, 32, "Weapon")
self.contents.draw_text(300, 204, 96, 32, "Shield")
self.contents.draw_text(300, 228, 96, 32, "Helmet")
self.contents.draw_text(300, 252, 96, 32, "Armor")
self.contents.draw_text(300, 276, 96, 32, "Accessory")
equip = $data_weapons[@actor.weapon_id]
if @actor.equippable?(equip)
draw_item_name($data_weapons[@actor.weapon_id], 406, 180)
else
self.contents.font.color = knockout_color
self.contents.draw_text(406, 180, 192, 32, "Nothing equipped")
end
equip1 = $data_armors[@actor.armor1_id]
if @actor.equippable?(equip1)
draw_item_name($data_armors[@actor.armor1_id], 406, 204)
else
self.contents.font.color = crisis_color
self.contents.draw_text(406, 204, 192, 32, "Nothing equipped")
end
equip2 = $data_armors[@actor.armor2_id]
if @actor.equippable?(equip2)
draw_item_name($data_armors[@actor.armor2_id], 406, 228)
else
self.contents.font.color = crisis_color
self.contents.draw_text(406, 228, 192, 32, "Nothing equipped")
end
equip3 = $data_armors[@actor.armor3_id]
if @actor.equippable?(equip3)
draw_item_name($data_armors[@actor.armor3_id], 406, 252)
else
self.contents.font.color = crisis_color
self.contents.draw_text(406, 252, 192, 32, "Nothing equipped")
end
equip4 = $data_armors[@actor.armor4_id]
if @actor.equippable?(equip4)
draw_item_name($data_armors[@actor.armor4_id], 406, 276)
else
self.contents.font.color = crisis_color
self.contents.draw_text(406, 276, 192, 32, "Nothing equipped")
end
end
def dummy
self.contents.font.color = system_color
self.contents.draw_text(320, 112, 96, 32, $data_system.words.weapon)
self.contents.draw_text(320, 176, 96, 32, $data_system.words.armor1)
self.contents.draw_text(320, 240, 96, 32, $data_system.words.armor2)
self.contents.draw_text(320, 304, 96, 32, $data_system.words.armor3)
self.contents.draw_text(320, 368, 96, 32, $data_system.words.armor4)
draw_item_name($data_weapons[@actor.weapon_id], 320 + 24, 144)
draw_item_name($data_armors[@actor.armor1_id], 320 + 24, 208)
draw_item_name($data_armors[@actor.armor2_id], 320 + 24, 272)
draw_item_name($data_armors[@actor.armor3_id], 320 + 24, 336)
draw_item_name($data_armors[@actor.armor4_id], 320 + 24, 400)
end
end
#==============================================================================
# ** Window_Files
#------------------------------------------------------------------------------
# This window shows a list of recorded save files.
#==============================================================================
class Window_File < Window_Selectable
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize()
super(0, 96, 320, 336)
self.contents = Bitmap.new(width - 32, LegACy::SAVE_NUMBER * 32)
index = $game_temp.last_file_index == nil ? 0 : $game_temp.last_file_index
self.index = index
self.active = false
@item_max = LegACy::SAVE_NUMBER
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.color = normal_color
time_stamp = Time.at(0)
for i in 0...LegACy::SAVE_NUMBER
filename = "Save#{i + 1}.rxdata"
self.contents.draw_text(1, i * 32, 32, 32, (i + 1).to_s, 1)
if FileTest.exist?(filename)
size = File.size(filename)
if size.between?(1000, 999999)
size /= 1000
size_str = "#{size} KB"
elsif size > 999999
size /= 1000000
size_str = "#{size} MB"
else
size_str = size.to_s
end
time_stamp = File.open(filename, "r").mtime
date = time_stamp.strftime("%m/%d/%Y")
time = time_stamp.strftime("%H:%M")
self.contents.font.size = 20
self.contents.font.bold = true
self.contents.draw_text(38, i * 32, 120, 32, date)
self.contents.draw_text(160, i * 32, 100, 32, time)
self.contents.draw_text(0, i * 32, 284, 32, size_str, 2)
end
end
end
end
#==============================================================================
# ** Window_FileStat
#------------------------------------------------------------------------------
# This window shows the status of the currently selected save file
#==============================================================================
class Window_FileStatus < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
# save_window : current save file
#--------------------------------------------------------------------------
def initialize(save_window)
super(0, 96, 320, 336)
self.contents = Bitmap.new(width - 32, height - 32)
@save_window = save_window
@index = @save_window.index
refresh
end
#--------------------------------------------------------------------------
# # Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
filename = "Save#{@index + 1}.rxdata"
return unless FileTest.exist?(filename)
file = File.open(filename, "r")
Marshal.load(file)
frame_count = Marshal.load(file)
for i in 0...6
Marshal.load(file)
end
party = Marshal.load(file)
Marshal.load(file)
map = Marshal.load(file)
self.contents.font.size = 20
self.contents.font.bold = true
for i in 0...party.actors.size
actor = party.actors[i]
x = 4
y = i * 56
draw_LegACy_bar(actor, x + 112, y + 14, 'hp', 160)
draw_LegACy_bar(actor, x + 112, y + 36, 'sp', 160)
draw_actor_name(actor, x + 40, y - 2)
draw_actor_level(actor, x + 40, y + 22)
draw_actor_graphic(actor, x + 10, y + 48)
end
total_sec = frame_count / Graphics.frame_rate
hour = total_sec / 60 / 60
min = total_sec / 60 % 60
sec = total_sec % 60
text = sprintf("%02d:%02d:%02d", hour, min, sec)
map_name = load_data("Data/MapInfos.rxdata")[map.map_id].name
self.contents.font.color = system_color
self.contents.draw_text(4, 224, 96, 32, "Play Time ")
self.contents.draw_text(4, 252, 96, 32, $data_system.words.gold)
self.contents.draw_text(4, 280, 96, 32, "Location ")
self.contents.draw_text(104, 224, 16, 32, ":")
self.contents.draw_text(104, 252, 16, 32, ":")
self.contents.draw_text(104, 280, 16, 32, ":")
self.contents.font.color = normal_color
self.contents.draw_text(120, 224, 144, 32, text)
self.contents.draw_text(120, 252, 144, 32, party.gold.to_s)
self.contents.draw_text(120, 280, 144, 32, map_name)
end
#--------------------------------------------------------------------------
# * Update
#--------------------------------------------------------------------------
def update
if @index != @save_window.index
@index = @save_window.index
refresh
end
super
end
end
#==============================================================================
# ** Scene_Menu
#------------------------------------------------------------------------------
# This class performs menu screen processing.
#==============================================================================
class Scene_Menu
#--------------------------------------------------------------------------
# * Object Initialization
# menu_index : command cursor's initial position
#--------------------------------------------------------------------------
def initialize(menu_index = 0)
@menu_index = menu_index
@update_frame = 0
@targetactive = false
@exit = false
@actor = $game_party.actors[0]
@old_actor = nil
$game_player.update
end
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
# Make command window
if LegACy::ICON
s1 = ' ' + $data_system.words.item
s2 = ' ' + $data_system.words.skill
s3 = ' ' + $data_system.words.equip
s4 = ' ' + 'Status'
s5 = ' ' + 'Save'
s6 = ' ' + 'Exit'
t1 = ' ' + 'Recov.'
t2 = ' ' + 'Weapon'
t3 = ' ' + 'Armor'
t4 = ' ' + 'Accessory'
t5 = ' ' + 'Quest'
t6 = ' ' + 'Misc.'
else
s1 = ' ' + $data_system.words.item
s2 = ' ' + $data_system.words.skill
s3 = ' ' + $data_system.words.equip
s4 = ' ' + 'Status'
s5 = 'Save'
s6 = 'Exit'
t1 = ' ' + 'Recov.'
t2 = ' ' + 'Weapon'
t3 = ' ' + 'Armor'
t4 = ' ' + 'Accessory'
t5 = 'Quest'
t6 = 'Misc.'
end
u1 = 'To Title'
u2 = 'Quit'
v1 = 'Optimize'
v2 = 'Unequip All'
@command_window = Window_NewCommand.new(320, [s1, s2, s3, s4, s5, s6])
@command_window = Window_NewCommand.new(320, [s1, s2, s3, s4, s5, s6], LegACy::ICON_NAME[0]) if LegACy::ICON
@command_window.y = -96
@command_window.index = @menu_index
# If number of party members is 0
if $game_party.actors.size == 0
# Disable items, skills, equipment, and status
@command_window.disable_item(0)
@command_window.disable_item(1)
@command_window.disable_item(2)
@command_window.disable_item(3)
end
# If save is forbidden
if $game_system.save_disabled
# Disable save
@command_window.disable_item(4)
end
# Make stat window
@stat_window = Window_Stat.new
@stat_window.x = 320
@stat_window.y = -96
# Make status window
@status_window = Window_NewMenuStatus.new
@status_window.x = 640
@status_window.y = 96
@location_window = Window_Location.new
@location_window.y = 480
@actor_window = Window_Actor.new
@actor_window.x = -160
@actor_window.y = 96
@itemcommand_window = Window_NewCommand.new(320, [t1, t2, t3, t4, t5, t6])
@itemcommand_window = Window_NewCommand.new(320, [t1, t2, t3, t4, t5, t6], LegACy::ICON_NAME[1]) if LegACy::ICON
@itemcommand_window.x = -320
@itemcommand_window.active = false
@help_window = Window_NewHelp.new
@help_window.x = -640
@help_window.y = 432
@item_window = Window_NewItem.new
@item_window.x = -480
@item_window.help_window = @help_window
@skill_window = Window_NewSkill.new(@actor)
@skill_window.x = -480
@skill_window.help_window = @help_window
if LegACy::ABS
@hotkey_window = Window_Hotkey.new
@hotkey_window.x = -480
end
@equipstat_window = Window_EquipStat.new(@actor)
@equipstat_window.x = -480
@equip_window = Window_Equipment.new(@actor)
@equip_window.x = -240
@equip_window.help_window = @help_window
@equipitem_window = Window_EquipmentItem.new(@actor, 0)
@equipitem_window.x = -240
@equipitem_window.help_window = @help_window
@equipenhanced_window = Window_Command.new(160, [v1, v2])
@equipenhanced_window.x = -160
@equipenhanced_window.active = false
@playerstatus_window = Window_NewStatus.new(@actor)
@playerstatus_window.x = -640
@file_window = Window_File.new
@file_window.x = -640
@filestatus_window = Window_FileStatus.new(@file_window)
@filestatus_window.x = -320
@end_window = Window_Command.new(120, [u1, u2])
@end_window.x = 640
@end_window.active = false
@spriteset = Spriteset_Map.new
@windows = [@command_window, @stat_window, @status_window,
@location_window, @actor_window, @itemcommand_window,@help_window,
@item_window, @skill_window, @equipstat_window, @equip_window,
@equipitem_window, @equipenhanced_window, @playerstatus_window,
@file_window, @filestatus_window, @end_window]
@windows.push(@hotkey_window) if LegACy::ABS
@windows.each {|i| i.opacity = LegACy::WIN_OPACITY}
@windows.each {|i| i.z = LegACy::WIN_Z}
# Execute transition
Graphics.transition
# Main loop
loop do
# Update game screen
Graphics.update
# Update input information
Input.update
# Frame update
update
# Abort loop if screen is changed
if $scene != self
break
end
end
# Prepare for transition
Graphics.freeze
# Dispose of windows
@spriteset.dispose
@windows.each {|i| i.dispose}
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# Update windows
@windows.each {|i| i.update}
animate
menu_update
update_scroll if @skill_window.active || @equip_window.active || @playerstatus_window.active
if LegACy::ANIMATED
@update_frame += 1
if @update_frame == 3
@update_frame = 0
@actor_window.frame_update
end
end
end
#--------------------------------------------------------------------------
# * Animating windows.
#--------------------------------------------------------------------------
def animate
if @command_window.active && @skill_window.x == -480 && @file_window.x == -640
@command_window.y += 6 if @command_window.y < 0
@stat_window.y += 6 if @stat_window.y < 0
@actor_window.x += 10 if @actor_window.x < 0
@status_window.x -= 30 if @status_window.x > 160
@location_window.y -= 3 if @location_window.y > 432
elsif @exit == true
@command_window.y -= 6 if @command_window.y > -96
@stat_window.y -= 6 if @stat_window.y > -96
@actor_window.x -= 10 if @actor_window.x > -160
@status_window.x += 30 if @status_window.x < 640
@location_window.y += 3 if @location_window.y < 480
$scene = Scene_Map.new if @location_window.y == 480
end
if @itemcommand_window.active
if @itemcommand_window.x < 0
@stat_window.x += 40
@command_window.x += 40
@itemcommand_window.x += 40
end
else
if @itemcommand_window.x > -320 && @command_window.active
@stat_window.x -= 40
@command_window.x -= 40
@itemcommand_window.x -= 40
end
end
if @item_window.active
if @item_window.x < 0
@location_window.x += 40
@help_window.x += 40
@status_window.x += 30
@actor_window.x += 30
@item_window.x += 30
end
elsif @targetactive != true
if @item_window.x > -480 && @command_window.index == 0
@help_window.x -= 40
@location_window.x -= 40
@item_window.x -= 30
@actor_window.x -= 30
@status_window.x -= 30
end
end
if @skill_window.active
if @skill_window.x < 0
@location_window.x += 40
@help_window.x += 40
@status_window.x += 30
@actor_window.x += 30
@hotkey_window.x += 30 if @actor_window.index == 0 && LegACy::ABS
@skill_window.x += 30
end
elsif @targetactive != true
if @skill_window.x > -480 && @command_window.index == 3
@help_window.x -= 40
@location_window.x -= 40
@skill_window.x -= 30
if LegACy::ABS
@hotkey_window.x -= 30 if @hotkey_window.x > -480
end
@actor_window.x -= 30
@status_window.x -= 30
end
end
if @equip_window.active
if @equipstat_window.x < 0
@status_window.x += 48
@actor_window.x += 48
@equip_window.x += 48