Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Need help with LagAcy's 1 scene CMS and Blizzard's Easy Party Switcher

I like those two scripts, so when I looked at the 1 Scene CMS, I want to replace "Save" with "Swap" which calls the Easy Party Switcher, heres my problem, I did everything, so when I test play my game, I went to the "save" which called the Party Switching Script, but when I go to the other menu, like the Items, Skill, Status, Equip even Exit, it made the menu froze, it does nothing, just the sound, when I pressed X, then the game froze.

Can someone modify this script or check what am I going wrong?

Sorry for the major double post and posting up too many lines, I dont know how to function on this forum works.. But by posting the script, I can show what I change and hopefully someone can point it out what I did wrong..

Sorry and Thanks again!
 
#=============================================================
# 1-Scene Custom Menu System
#=============================================================
# LegACy
# Version 1.17b
# 7.29.06
#=============================================================
# This script is a further development of Hydrolic's CMS
# request. I enhance it toward every aspect of a menu system
# so now it all operates in one scene full of animation.
# There's an animated sprite and element wheel features.
# There's also different category for items implemented.
# Now there's enhanced equipment features as well as faceset
# features. Don't forget the icon command feature, too!
# The newest version now has an integrated party swapper!
#
# To put items into different catagory, simply apply
# attributes to them, you can apply more than 1 attributes
# to each item. In default, the attributes are :
# :: 17 > Recovery items
# :: 18 > Weaponry
# :: 19 > Armor
# :: 20 > Accessories
# :: 21 > Key Items
# :: 22 > Miscellanous Items
#
# Faceset pictures should be 'Potrait_', or 'Class_' if you based it
# on actor's class, followed with the ID of the actor. So for Arshes
# it will either 'Potrait_1' or 'Class_1'
#
# For customization, look in LegACy class, further explanation's
# located there.
#
# Special thanks to Hydrolic for the idea, Diego for the
# element wheel, SephirotSpawn for sprite animation, KGC
# for the his AlterEquip script and Squall for his ASM.
#=============================================================

#==============================================================================
# ** LegACy's Script Customization (CMS)
#==============================================================================
class LegACy
#--------------------------------------------------------------------------
# * Custom Scripts Support
#--------------------------------------------------------------------------
AMS = false # True if you're using AMS script.
ATS = false # True if you're using ATS script.
ABS = false # True if you're using Near's ABS script.
PREXUS = false # True if you're using Prexus' ABS script.
#--------------------------------------------------------------------------
# * Features Customization Constants
#--------------------------------------------------------------------------
ANIMATED = false # True if you want to have animated chara feature.
EXTRA_EQUIP = true # True if you want to use Enhanced Equipment feature.
PARTY_SWAP = true # True if you want to use Party Swapper feature.
BATTLE_BAR = true # True if you want to have bar for battle system.
ICON = true # True if you want to have icon on command_window.
MAX_PARTY = 4 # Number of max member in the party.
SAVE_NUMBER = 99 # Number of save slot available
#--------------------------------------------------------------------------
# * Item Grouping Customization Constants
#--------------------------------------------------------------------------
ITEMS = [17, 19, 21, 18, 20, 22] # Attributes ID for Item Catagory in order.
#--------------------------------------------------------------------------
# * Display Customization Constants
#--------------------------------------------------------------------------
WIN_OPACITY = 200 # Opacity of CMS' windows
WIN_Z = 201 # Z value of CMS' windows
ICON_NAME = ['menu', 'item'] # Image name for icon, first is for main menu while the second is for item command.
POTRAIT = [false, false] # True if you want to use faceset instead of charset display, first is for front menu while the second is for status window.
CLASS_POTRAIT = [false, false] # True if you want to base the faceset on class instead of actor, first is for front menu while the second is for status window.
POTRAIT_DIR = 'Potrait_' # Image name for actor-based faceset.
CLASS_DIR = 'Class_' # Image name for class-based faceset.
STAT_BAR = [false, false, true] # Windows where the stat bar appears.
BAR_COLOR = [Color.new(255, 0, 0, 200), # Color for bars.
Color.new(255, 255, 0, 200),
Color.new(0, 255, 255, 200),
Color.new(200, 64, 64, 255),
Color.new(64, 128, 64, 255),
Color.new(160, 100, 160, 255),
Color.new(128, 128, 200, 255)]
#--------------------------------------------------------------------------
# * Element Wheel Customization Constants
#--------------------------------------------------------------------------
ELEMENT_NUMBER = 8 # Number of elements applied in the element wheel.
ELEMENTS = [1, 2, 3, 4, 5, 6, 7, 8] # Elements that appear on the element wheel, in order.
end

#==============================================================================
# ** Bitmap
#==============================================================================
class Bitmap
def draw_line(start_x, start_y, end_x, end_y, start_color, width = 1, end_color = start_color)
distance = (start_x - end_x).abs + (start_y - end_y).abs
if end_color == start_color
for i in 1..distance
x = (start_x + 1.0 * (end_x - start_x) * i / distance).to_i
y = (start_y + 1.0 * (end_y - start_y) * i / distance).to_i
if width == 1
self.set_pixel(x, y, start_color)
else
self.fill_rect(x, y, width, width, start_color)
end
end
else
for i in 1..distance
x = (start_x + 1.0 * (end_x - start_x) * i / distance).to_i
y = (start_y + 1.0 * (end_y - start_y) * i / distance).to_i
r = start_color.red * (distance-i)/distance + end_color.red * i/distance
g = start_color.green * (distance-i)/distance + end_color.green * i/distance
b = start_color.blue * (distance-i)/distance + end_color.blue * i/distance
a = start_color.alpha * (distance-i)/distance + end_color.alpha * i/distance
if width == 1
self.set_pixel(x, y, Color.new(r, g, b, a))
else
self.fill_rect(x, y, width, width, Color.new(r, g, b, a))
end
end
end
end
end

#==============================================================================
# ** Game_Actor
#------------------------------------------------------------------------------
# This class handles the actor. It's used within the Game_Actors class
# ($game_actors) and refers to the Game_Party class ($game_party).
#==============================================================================
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# * Get Current Experience Points
#--------------------------------------------------------------------------
def now_exp
return @exp - @exp_list[@level]
end
#--------------------------------------------------------------------------
# * Get Needed Experience Points
#--------------------------------------------------------------------------
def next_exp
return @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0
end
end

#==============================================================================
# ** Game_Party
#------------------------------------------------------------------------------
# This class handles the party. It includes information on amount of gold
# and items. Refer to "$game_party" for the instance of this class.
#==============================================================================
class Game_Party
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :reserve # reserve actors
#--------------------------------------------------------------------------
# * Alias Initialization
#--------------------------------------------------------------------------
alias legacy_CMS_gameparty_init initialize
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
# Create reserve actor array
@reserve = []
legacy_CMS_gameparty_init
end
#--------------------------------------------------------------------------
# * Add an Actor
# actor_id : actor ID
#--------------------------------------------------------------------------
def add_actor(actor_id)
# Get actor
actor = $game_actors[actor_id]
# If the party has less than 4 members and this actor is not in the party
if @actors.size < LegACy::MAX_PARTY and not @actors.include?(actor)
# Add actor
@actors.push(actor)
else
@reserve.push(actor)
end
# Refresh player
$game_player.refresh
end
#--------------------------------------------------------------------------
# * Remove Actor
# actor_id : actor ID
#--------------------------------------------------------------------------
def remove_actor(actor_id)
# Get actor
actor = $game_actors[actor_id]
# Delete actor
@actors.delete(actor) if @actors.include?(actor)
@reserve.delete(actor) if @reserve.include?(actor)
# Refresh player
$game_player.refresh
end

end

#==============================================================================
# ** Game_Map
#------------------------------------------------------------------------------
# This class handles the map. It includes scrolling and passable determining
# functions. Refer to "$game_map" for the instance of this class.
#==============================================================================
class Game_Map
#--------------------------------------------------------------------------
# * Get Map Name
#--------------------------------------------------------------------------
def name
load_data("Data/MapInfos.rxdata")[@map_id].name
end
end

#==============================================================================
# ** Window_Base
#------------------------------------------------------------------------------
# This class is for all in-game windows.
#==============================================================================
class Window_Base < Window
FONT_SIZE = 16
GRAPH_SCALINE_COLOR = Color.new(255, 255, 255, 128)
GRAPH_SCALINE_COLOR_SHADOW = Color.new( 0, 0, 0, 192)
GRAPH_LINE_COLOR = Color.new(255, 255, 64, 255)
GRAPH_LINE_COLOR_MINUS = Color.new( 64, 255, 255, 255)
GRAPH_LINE_COLOR_PLUS = Color.new(255, 64, 64, 255)

def draw_actor_element_radar_graph(actor, x, y, radius = 43)
cx = x + radius + FONT_SIZE + 48
cy = y + radius + FONT_SIZE + 32
for loop_i in 0..LegACy::ELEMENT_NUMBER
if loop_i != 0
@pre_x = @now_x
@pre_y = @now_y
@pre_ex = @now_ex
@pre_ey = @now_ey
@color1 = @color2
end
if loop_i == LegACy::ELEMENT_NUMBER
eo = LegACy::ELEMENTS[0]
else
eo = LegACy::ELEMENTS[loop_i]
end
er = actor.element_rate(eo)
estr = $data_system.elements[eo]
@color2 = er < 0 ? GRAPH_LINE_COLOR_MINUS : er > 100 ? GRAPH_LINE_COLOR_PLUS : GRAPH_LINE_COLOR
er = er.abs
th = Math::PI * (0.5 - 2.0 * loop_i / LegACy::ELEMENT_NUMBER)
@now_x = cx + (radius * Math.cos(th)).floor
@now_y = cy - (radius * Math.sin(th)).floor
@now_wx = cx - 6 + ((radius + FONT_SIZE * 3 / 2) * Math.cos(th)).floor - FONT_SIZE
@now_wy = cy - ((radius + FONT_SIZE * 1 / 2) * Math.sin(th)).floor - FONT_SIZE/2
@now_vx = cx + ((radius + FONT_SIZE * 8 / 2) * Math.cos(th)).floor - FONT_SIZE
@now_vy = cy - ((radius + FONT_SIZE * 3 / 2) * Math.sin(th)).floor - FONT_SIZE/2
@now_ex = cx + (er*radius/100 * Math.cos(th)).floor
@now_ey = cy - (er*radius/100 * Math.sin(th)).floor
if loop_i == 0
@pre_x = @now_x
@pre_y = @now_y
@pre_ex = @now_ex
@pre_ey = @now_ey
@color1 = @color2
else
end
next if loop_i == 0
self.contents.draw_line(cx+1,cy+1, @now_x+1,@now_y+1, GRAPH_SCALINE_COLOR_SHADOW)
self.contents.draw_line(@pre_x+1,@pre_y+1, @now_x+1,@now_y+1, GRAPH_SCALINE_COLOR_SHADOW)
self.contents.draw_line(cx,cy, @now_x,@now_y, GRAPH_SCALINE_COLOR)
self.contents.draw_line(@pre_x,@pre_y, @now_x,@now_y, GRAPH_SCALINE_COLOR)
self.contents.draw_line(@pre_ex,@pre_ey, @now_ex,@now_ey, @color1, 2, @color2)
self.contents.font.color = system_color
self.contents.draw_text(@now_wx,@now_wy, FONT_SIZE*3.1, FONT_SIZE, estr, 1)
self.contents.font.color = Color.new(255,255,255,128)
self.contents.draw_text(@now_vx,@now_vy, FONT_SIZE*2, FONT_SIZE, er.to_s + "%", 2)
self.contents.font.color = normal_color
end
end
#--------------------------------------------------------------------------
# Draw Stat Bar
# actor : actor
# x : bar x-coordinate
# y : bar y-coordinate
# stat : stat to be displayed
#--------------------------------------------------------------------------
def draw_LegACy_bar(actor, x, y, stat, width = 156, height = 7)
bar_color = Color.new(0, 0, 0, 255)
end_color = Color.new(255, 255, 255, 255)
max = 999
case stat
when "hp"
bar_color = Color.new(150, 0, 0, 255)
end_color = Color.new(255, 255, 60, 255)
min = actor.hp
max = actor.maxhp
when "sp"
bar_color = Color.new(0, 0, 155, 255)
end_color = Color.new(255, 255, 255, 255)
min = actor.sp
max = actor.maxsp
when "exp"
bar_color = Color.new(0, 155, 0, 255)
end_color = Color.new(255, 255, 255, 255)
unless actor.level == $data_actors[actor.id].final_level
min = actor.now_exp
max = actor.next_exp
else
min = 1
max = 1
end
when 'atk'
bar_color = LegACy::BAR_COLOR[0]
min = actor.atk
when 'pdef'
bar_color = LegACy::BAR_COLOR[1]
min = actor.pdef
when 'mdef'
bar_color = LegACy::BAR_COLOR[2]
min = actor.mdef
when 'str'
bar_color = LegACy::BAR_COLOR[3]
min = actor.str
when 'dex'
bar_color = LegACy::BAR_COLOR[4]
min = actor.dex
when 'agi'
bar_color = LegACy::BAR_COLOR[5]
min = actor.agi
when 'int'
bar_color = LegACy::BAR_COLOR[6]
min = actor.int
end
max = 1 if max == 0
# Draw Border
for i in 0..height
self.contents.fill_rect(x + i, y + height - i, width + 1, 1,
Color.new(50, 50, 50, 255))
end
# Draw Background
for i in 1..(height - 1)
r = 100 * (height - i) / height + 0 * i / height
g = 100 * (height - i) / height + 0 * i / height
b = 100 * (height - i) / height + 0 * i / height
a = 255 * (height - i) / height + 255 * i / height
self.contents.fill_rect(x + i, y + height - i, width, 1,
Color.new(r, b, g, a))
end
# Draws Bar
for i in 1..( (min.to_f / max.to_f) * width - 1)
for j in 1..(height - 1)
r = bar_color.red * (width - i) / width + end_color.red * i / width
g = bar_color.green * (width - i) / width + end_color.green * i / width
b = bar_color.blue * (width - i) / width + end_color.blue * i / width
a = bar_color.alpha * (width - i) / width + end_color.alpha * i / width
self.contents.fill_rect(x + i + j, y + height - j, 1, 1,
Color.new(r, g, b, a))
end
end
case stat
when "hp"
draw_actor_hp(actor, x - 1, y - 18)
when "sp"
draw_actor_sp(actor, x - 1, y - 18)
when "exp"
draw_actor_exp(actor, x - 1, y - 18)
end
end
#--------------------------------------------------------------------------
# * Draw Sprite
#--------------------------------------------------------------------------
def draw_LegACy_sprite(x, y, name, hue, frame)
bitmap = RPG::Cache.character(name, hue)
cw = bitmap.width / 4
ch = bitmap.height / 4
# Current Animation Slide
case frame
when 0 ;b = 0
when 1 ;b = cw
when 2 ;b = cw * 2
when 3 ;b = cw * 3
end
# Bitmap Rectange
src_rect = Rect.new(b, 0, cw, ch)
# Draws Bitmap
self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect)
end
#--------------------------------------------------------------------------
# * Get Upgrade Text Color
#--------------------------------------------------------------------------
def up_color
return Color.new(74, 210, 74)
end
#--------------------------------------------------------------------------
# * Get Downgrade Text Color
#--------------------------------------------------------------------------
def down_color
return Color.new(170, 170, 170)
end
#--------------------------------------------------------------------------
# * Draw Potrait
# actor : actor
# x : draw spot x-coordinate
# y : draw spot y-coordinate
#--------------------------------------------------------------------------
def draw_actor_potrait(actor, x, y, classpotrait = false, width = 96, height = 96)
classpotrait ? bitmap = RPG::Cache.picture(LegACy::CLASS_DIR + actor.class_id.to_s) :
bitmap = RPG::Cache.picture(LegACy::CLASS_DIR + actor.id.to_s)
src_rect = Rect.new(0, 0, width, height)
self.contents.blt(x, y, bitmap, src_rect)
end
#--------------------------------------------------------------------------
# * Draw parameter
# actor : actor
# x : draw spot x-coordinate
# y : draw spot y-coordinate
# type : parameter type
#------------------------------------------------------------------------
def draw_actor_parameter(actor, x, y, type, width = 120, bar = false)
case type
when 0
parameter_name = $data_system.words.atk
parameter_value = actor.atk
stat = 'atk'
when 1
parameter_name = $data_system.words.pdef
parameter_value = actor.pdef
stat = 'pdef'
when 2
parameter_name = $data_system.words.mdef
parameter_value = actor.mdef
stat = 'mdef'
when 3
parameter_name = $data_system.words.str
parameter_value = actor.str
stat = 'str'
when 4
parameter_name = $data_system.words.dex
parameter_value = actor.dex
stat = 'dex'
when 5
parameter_name = $data_system.words.agi
parameter_value = actor.agi
stat = 'agi'
when 6
parameter_name = $data_system.words.int
parameter_value = actor.int
stat = 'int'
when 7
parameter_name = "Evasion"
parameter_value = actor.eva
stat = 'eva'
end
if bar == true && stat != 'eva'
draw_LegACy_bar(actor, x + 16, y + 21, stat, width - 16, 5)
end
self.contents.font.color = system_color
self.contents.draw_text(x, y, 120, 32, parameter_name)
self.contents.font.color = normal_color
self.contents.draw_text(x + width, y, 36, 32, parameter_value.to_s, 2)
end
end

#==============================================================================
# ** Window_NewCommand
#------------------------------------------------------------------------------
# This window deals with general command choices.
#==============================================================================

class Window_NewCommand < Window_Selectable
#--------------------------------------------------------------------------
# * Object Initialization
# width : window width
# commands : command text string array
#--------------------------------------------------------------------------
def initialize(width, commands, icon = nil)
# Compute window height from command quantity
super(0, 0, width, commands.size / 3 * 32 + 32)
@item_max = commands.size
@commands = commands
@icon = icon
@column_max = 3
self.contents = Bitmap.new(width - 32, @item_max/3 * 32)
refresh
self.index = 0
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
for i in 0...@item_max
draw_item(i, normal_color)
end
end
#--------------------------------------------------------------------------
# * Draw Item
# index : item number
# color : text color
#--------------------------------------------------------------------------
def draw_item(index, color)
self.contents.font.color = color
self.contents.font.size = 20
self.contents.font.bold = true
rect = Rect.new((109 * (index / 2)), 32 * (index % 2), self.width / @column_max - 12, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
unless @icon == nil
bitmap = RPG::Cache.icon(@icon + index.to_s)
self.contents.blt((106 * (index / 2)), 32 * (index % 2) + 4, bitmap, Rect.new(0, 0, 24, 24))
end
self.contents.draw_text(rect, @commands[index])
end
#--------------------------------------------------------------------------
# * Disable Item
# index : item number
#--------------------------------------------------------------------------
def disable_item(index)
draw_item(index, disabled_color)
end
end

#==============================================================================
# ** Window_NewMenuStatus
#------------------------------------------------------------------------------
# This window displays party member status on the menu screen.
#==============================================================================

class Window_NewMenuStatus < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
$game_party.actors.size < 4 ? i = 14 : i = 0
$game_party.actors.size == 1 ? i = 24 : i = i
super(0, 0, 480, ($game_party.actors.size * 84) + i)
self.contents = Bitmap.new(width - 32, height - 32)
refresh
self.active = false
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
for i in 0...$game_party.actors.size
x = 4
y = (i * 76) - 6
actor = $game_party.actors
self.contents.font.size = 19
self.contents.font.bold = true
draw_actor_class(actor, x, y - 1)
draw_actor_state(actor, x + 160, y - 1)
self.contents.font.size = 15
draw_actor_parameter(actor, x, y + 14, 0, 120, LegACy::STAT_BAR[0])
draw_actor_parameter(actor, x, y + 29, 1, 120, LegACy::STAT_BAR[0])
draw_actor_parameter(actor, x, y + 44, 2, 120, LegACy::STAT_BAR[0])
draw_actor_parameter(actor, x, y + 59, 3, 120, LegACy::STAT_BAR[0])
draw_actor_parameter(actor, x + 240, y + 14, 4, 120, LegACy::STAT_BAR[0])
draw_actor_parameter(actor, x + 240, y + 29, 5, 120, LegACy::STAT_BAR[0])
draw_actor_parameter(actor, x + 240, y + 44, 6, 120, LegACy::STAT_BAR[0])
draw_LegACy_bar(actor, x + 240, y + 75, 'exp')
end
end
end

#==============================================================================
# ** Window_Actor
#------------------------------------------------------------------------------
# This window displays party member status on the menu screen.
#==============================================================================

class Window_Actor < Window_Selectable
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :party # party switcher
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
$game_party.actors.size < 4 ? i = 14 : i = 0
$game_party.actors.size == 1 ? i = 24 : i = i
super(0, 0, 160, ($game_party.actors.size * 84) + i)
self.contents = Bitmap.new(width - 32, height - 32)
@frame = 0
@party = false
refresh
self.active = false
self.index = -1
end
#--------------------------------------------------------------------------
# * Returning Party Swapping State
#--------------------------------------------------------------------------
def party
return @party
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
@party ? @item_max = $game_party.actors.size : @item_max = 4
@item_max = $game_party.actors.size # if $game_party.actors.size <= 4
$game_party.actors.size < 4 ? i = 14 : i = 0
$game_party.actors.size == 1 ? i = 24 : i = i
self.contents = Bitmap.new(width - 32, (@item_max * 84) + i - 32)
for i in 0...@item_max
x = 4
y = (i * 77) - 12
actor = $game_party.actors
self.contents.font.size = 17
self.contents.font.bold = true
LegACy::POTRAIT[0] ? draw_actor_potrait(actor, x, y - 1, LegACy::CLASS_POTRAIT[0]) : draw_LegACy_sprite(x + 20,
y + 57, actor.character_name, actor.character_hue, @frame)
draw_actor_name(actor, x + 52, y + 6)
draw_actor_level(actor, x + 52, y + 24)
draw_LegACy_bar(actor, x - 3, y + 60, 'hp', 120)
draw_LegACy_bar(actor, x - 3, y + 75, 'sp', 120)
end
end
#--------------------------------------------------------------------------
# * Cursor Rectangle Update
#--------------------------------------------------------------------------
def update_cursor_rect
@index > 3 ? self.oy = (@index - 3) * 77 : self.oy = 0
if @index < 0
self.cursor_rect.empty
else
self.cursor_rect.set(-4, (@index * 77) - 2 - self.oy, self.width - 24, 77)
end
end
#--------------------------------------------------------------------------
# Frame Update
#--------------------------------------------------------------------------
def frame_update
@frame == 3 ? @frame = 0 : @frame += 1
refresh
end
end

#==============================================================================
# ** Window_Stat
#------------------------------------------------------------------------------
# This window displays play time on the menu screen.
#==============================================================================

class Window_Stat < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(0, 0, 320, 96)
self.contents = Bitmap.new(width - 32, height - 32)
refresh
end
 
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.color = system_color
self.contents.font.size = 18
self.contents.font.bold = true
@total_sec = Graphics.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)
self.contents.draw_text(4, -4, 120, 32, "Play Time")
cx = contents.text_size($data_system.words.gold).width
self.contents.draw_text(4, 18, 120, 32, "Step Count")
self.contents.draw_text(4, 38, cx, 32, $data_system.words.gold, 2)
self.contents.font.color = normal_color
if LegACy::ATS
self.contents.draw_text(144, -4, 120, 32, $ats.clock, 2)
else
self.contents.draw_text(144, -4, 120, 32, text, 2)
end
self.contents.draw_text(144, 18, 120, 32, $game_party.steps.to_s, 2)
self.contents.draw_text(144, 40, 120, 32, $game_party.gold.to_s, 2)
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
super
if Graphics.frame_count / Graphics.frame_rate != @total_sec
refresh
end
end
end

#==============================================================================
# ** Window_Location
#------------------------------------------------------------------------------
# This window displays current map name.
#==============================================================================

class Window_Location < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(0, 0, 640, 48)
self.contents = Bitmap.new(width - 32, height - 32)
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.color = system_color
self.contents.font.bold = true
self.contents.font.size = 20
self.contents.draw_text(4, -4, 120, 24, "Location")
self.contents.font.color = normal_color
self.contents.draw_text(170, -4, 400, 24, $game_map.name.to_s, 2)
end
end

#==============================================================================
# ** Window_NewHelp
#------------------------------------------------------------------------------
# This window shows skill and item explanations along with actor status.
#==============================================================================

class Window_NewHelp < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(0, 0, 640, 48)
self.contents = Bitmap.new(width - 32, height - 32)
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)
self.contents.font.bold = true
self.contents.font.size = 20
# 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.draw_text(4, -4, self.width - 40, 24, text, align)
@text = text
@align = align
@actor = nil
end
self.visible = true
end
end

#==============================================================================
# ** Window_NewItem
#------------------------------------------------------------------------------
# This window displays items in possession on the item and battle screens.
#==============================================================================

class Window_NewItem < Window_Selectable
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(0, 96, 480, 336)
@column_max = 2
@attribute = LegACy::ITEMS[0]
refresh
self.index = 0
self.active = false
end
#--------------------------------------------------------------------------
# * Get Item
#--------------------------------------------------------------------------
def item
return @data[self.index]
end
#--------------------------------------------------------------------------
# * Updates Window With New Item Type
# attribute : new item type
#--------------------------------------------------------------------------
def update_item(attribute)
@attribute = attribute
refresh
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 and
$data_items.element_set.include?(@attribute)
@data.push($data_items)
end
end
# Also add weapons and armors
for i in 1...$data_weapons.size
if $game_party.weapon_number(i) > 0 and
$data_weapons.element_set.include?(@attribute)
@data.push($data_weapons)
end
end
for i in 1...$data_armors.size
if $game_party.armor_number(i) > 0 and
$data_armors.guard_element_set.include?(@attribute)
@data.push($data_armors)
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 - 32, row_max * 32)
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
if item.is_a?(RPG::Item) and
$game_party.item_can_use?(item.id)
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
x = 4 + index % 2 * (208 + 32)
y = index / 2 * 32
rect = Rect.new(x, y, self.width / @column_max - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(item.icon_name)
opacity = self.contents.font.color == normal_color ? 255 : 128
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
self.contents.draw_text(x + 28, y, 132, 32, item.name, 0)
self.contents.draw_text(x + 160, y, 16, 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 ? "" : self.item.description)
end
end

#==============================================================================
# ** Window_NewSkill
#------------------------------------------------------------------------------
# This window displays usable skills on the skill screen.
#==============================================================================

class Window_NewSkill < Window_Selectable
#--------------------------------------------------------------------------
# * Object Initialization
# actor : actor
#--------------------------------------------------------------------------
def initialize(actor)
super(0, 96, 480, 336)
@actor = actor
@column_max = 2
refresh
self.index = 0
self.active = false
end
#--------------------------------------------------------------------------
# * Acquiring Skill
#--------------------------------------------------------------------------
def skill
return @data[self.index]
end
#--------------------------------------------------------------------------
# * Updates Window With New Actor
# actor : new actor
#--------------------------------------------------------------------------
def update_actor(actor)
@actor = actor
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
for i in 0...@actor.skills.size
skill = $data_skills[@actor.skills]
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 - 32, row_max * 32)
for i in 0...@item_max
LegACy::PREXUS ? draw_prexus_item(i) : draw_item(i)
end
end
end
#--------------------------------------------------------------------------
# * Draw Item
# index : item number
#--------------------------------------------------------------------------
def draw_item(index)
skill = @data[index]
if @actor.skill_can_use?(skill.id)
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
x = 4 + index % 2 * (208 + 32)
y = index / 2 * 32
rect = Rect.new(x, y, self.width / @column_max - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(skill.icon_name)
opacity = self.contents.font.color == normal_color ? 255 : 128
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
self.contents.draw_text(x + 28, y, 124, 32, skill.name, 0)
self.contents.draw_text(x + 152 , y, 48, 32, skill.sp_cost.to_s, 2)
end
#--------------------------------------------------------------------------
# * Draw Item (For Prexus ABS)
# index : item number
#--------------------------------------------------------------------------
def draw_prexus_item(index)
skill = @data[index]
if @actor.skill_can_use?(skill.id)
if $ABS.player.abs.hot_key.include?(skill.id)
self.contents.font.color = Color.new(0, 225, 0, 255)
else
self.contents.font.color = normal_color
end
else
if $ABS.player.abs.hot_key.include?(skill.id)
self.contents.font.color = Color.new(0, 225, 0, 160)
else
self.contents.font.color = disabled_color
end
end
x = 4 + index % 2 * (208 + 32)
y = index / 2 * 32
rect = Rect.new(x, y, self.width / @column_max - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(skill.icon_name)
opacity = self.contents.font.color == normal_color ? 255 : 128
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
self.contents.draw_text(x + 28, y, 124, 32, skill.name, 0)
self.contents.draw_text(x + 152 , y, 48, 32, 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_Hotkey
#------------------------------------------------------------------------------
# This window displays the skill shortcut
#==============================================================================

class Window_Hotkey < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(0, 336, 480, 96)
self.contents = Bitmap.new(width - 32, height - 32)
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
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 == 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.to_s
more = true
end
more = false
for i in item.plus_state_set
oldstat_text += ", " if more
oldstat_text += $data_states.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.to_s
more = true
end
more = false
for i in item.guard_state_set
oldstat_text += ", " if more
oldstat_text += $data_states.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, 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)
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.kind == @equip_type-1
@data.push($data_armors)
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
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
@partyswitch = false
@actor = $game_party.actors[0]
@old_actor = nil
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 = ' ' + 'Swap'
s6 = ' ' + 'Exit'
t1 = ' ' + 'Casume'
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 = 'Swap'
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
 
#--------------------------------------------------------------------------
# * 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.to_s
more = true
end
more = false
for i in item.plus_state_set
oldstat_text += ", " if more
oldstat_text += $data_states.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.to_s
more = true
end
more = false
for i in item.guard_state_set
oldstat_text += ", " if more
oldstat_text += $data_states.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, 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)
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.kind == @equip_type-1
@data.push($data_armors)
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
 
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.color = system_color
self.contents.font.size = 18
self.contents.font.bold = true
@total_sec = Graphics.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)
self.contents.draw_text(4, -4, 120, 32, "Play Time")
cx = contents.text_size($data_system.words.gold).width
self.contents.draw_text(4, 18, 120, 32, "Step Count")
self.contents.draw_text(4, 38, cx, 32, $data_system.words.gold, 2)
self.contents.font.color = normal_color
if LegACy::ATS
self.contents.draw_text(144, -4, 120, 32, $ats.clock, 2)
else
self.contents.draw_text(144, -4, 120, 32, text, 2)
end
self.contents.draw_text(144, 18, 120, 32, $game_party.steps.to_s, 2)
self.contents.draw_text(144, 40, 120, 32, $game_party.gold.to_s, 2)
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
super
if Graphics.frame_count / Graphics.frame_rate != @total_sec
refresh
end
end
end

#==============================================================================
# ** Window_Location
#------------------------------------------------------------------------------
# This window displays current map name.
#==============================================================================

class Window_Location < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(0, 0, 640, 48)
self.contents = Bitmap.new(width - 32, height - 32)
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.color = system_color
self.contents.font.bold = true
self.contents.font.size = 20
self.contents.draw_text(4, -4, 120, 24, "Location")
self.contents.font.color = normal_color
self.contents.draw_text(170, -4, 400, 24, $game_map.name.to_s, 2)
end
end

#==============================================================================
# ** Window_NewHelp
#------------------------------------------------------------------------------
# This window shows skill and item explanations along with actor status.
#==============================================================================

class Window_NewHelp < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(0, 0, 640, 48)
self.contents = Bitmap.new(width - 32, height - 32)
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)
self.contents.font.bold = true
self.contents.font.size = 20
# 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.draw_text(4, -4, self.width - 40, 24, text, align)
@text = text
@align = align
@actor = nil
end
self.visible = true
end
end

#==============================================================================
# ** Window_NewItem
#------------------------------------------------------------------------------
# This window displays items in possession on the item and battle screens.
#==============================================================================

class Window_NewItem < Window_Selectable
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(0, 96, 480, 336)
@column_max = 2
@attribute = LegACy::ITEMS[0]
refresh
self.index = 0
self.active = false
end
#--------------------------------------------------------------------------
# * Get Item
#--------------------------------------------------------------------------
def item
return @data[self.index]
end
#--------------------------------------------------------------------------
# * Updates Window With New Item Type
# attribute : new item type
#--------------------------------------------------------------------------
def update_item(attribute)
@attribute = attribute
refresh
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 and
$data_items.element_set.include?(@attribute)
@data.push($data_items)
end
end
# Also add weapons and armors
for i in 1...$data_weapons.size
if $game_party.weapon_number(i) > 0 and
$data_weapons.element_set.include?(@attribute)
@data.push($data_weapons)
end
end
for i in 1...$data_armors.size
if $game_party.armor_number(i) > 0 and
$data_armors.guard_element_set.include?(@attribute)
@data.push($data_armors)
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 - 32, row_max * 32)
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
if item.is_a?(RPG::Item) and
$game_party.item_can_use?(item.id)
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
x = 4 + index % 2 * (208 + 32)
y = index / 2 * 32
rect = Rect.new(x, y, self.width / @column_max - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(item.icon_name)
opacity = self.contents.font.color == normal_color ? 255 : 128
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
self.contents.draw_text(x + 28, y, 132, 32, item.name, 0)
self.contents.draw_text(x + 160, y, 16, 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 ? "" : self.item.description)
end
end

#==============================================================================
# ** Window_NewSkill
#------------------------------------------------------------------------------
# This window displays usable skills on the skill screen.
#==============================================================================

class Window_NewSkill < Window_Selectable
#--------------------------------------------------------------------------
# * Object Initialization
# actor : actor
#--------------------------------------------------------------------------
def initialize(actor)
super(0, 96, 480, 336)
@actor = actor
@column_max = 2
refresh
self.index = 0
self.active = false
end
#--------------------------------------------------------------------------
# * Acquiring Skill
#--------------------------------------------------------------------------
def skill
return @data[self.index]
end
#--------------------------------------------------------------------------
# * Updates Window With New Actor
# actor : new actor
#--------------------------------------------------------------------------
def update_actor(actor)
@actor = actor
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
for i in 0...@actor.skills.size
skill = $data_skills[@actor.skills]
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 - 32, row_max * 32)
for i in 0...@item_max
LegACy::PREXUS ? draw_prexus_item(i) : draw_item(i)
end
end
end
#--------------------------------------------------------------------------
# * Draw Item
# index : item number
#--------------------------------------------------------------------------
def draw_item(index)
skill = @data[index]
if @actor.skill_can_use?(skill.id)
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
x = 4 + index % 2 * (208 + 32)
y = index / 2 * 32
rect = Rect.new(x, y, self.width / @column_max - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(skill.icon_name)
opacity = self.contents.font.color == normal_color ? 255 : 128
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
self.contents.draw_text(x + 28, y, 124, 32, skill.name, 0)
self.contents.draw_text(x + 152 , y, 48, 32, skill.sp_cost.to_s, 2)
end
#--------------------------------------------------------------------------
# * Draw Item (For Prexus ABS)
# index : item number
#--------------------------------------------------------------------------
def draw_prexus_item(index)
skill = @data[index]
if @actor.skill_can_use?(skill.id)
if $ABS.player.abs.hot_key.include?(skill.id)
self.contents.font.color = Color.new(0, 225, 0, 255)
else
self.contents.font.color = normal_color
end
else
if $ABS.player.abs.hot_key.include?(skill.id)
self.contents.font.color = Color.new(0, 225, 0, 160)
else
self.contents.font.color = disabled_color
end
end
x = 4 + index % 2 * (208 + 32)
y = index / 2 * 32
rect = Rect.new(x, y, self.width / @column_max - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(skill.icon_name)
opacity = self.contents.font.color == normal_color ? 255 : 128
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
self.contents.draw_text(x + 28, y, 124, 32, skill.name, 0)
self.contents.draw_text(x + 152 , y, 48, 32, 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_Hotkey
#------------------------------------------------------------------------------
# This window displays the skill shortcut
#==============================================================================

class Window_Hotkey < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(0, 336, 480, 96)
self.contents = Bitmap.new(width - 32, height - 32)
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
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 == 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.to_s
more = true
end
more = false
for i in item.plus_state_set
oldstat_text += ", " if more
oldstat_text += $data_states.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.to_s
more = true
end
more = false
for i in item.guard_state_set
oldstat_text += ", " if more
oldstat_text += $data_states.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
 
#==============================================================================
# ** 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
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
@partyswitch = false
@actor = $game_party.actors[0]
@old_actor = nil
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 = ' ' + 'Swap'
s6 = ' ' + 'Exit'
t1 = ' ' + 'Casume'
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 = 'Swap'
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
if @location_window.y == 480
if @location_window.y == 480
if @partyswitch == true
$scene = Scene_PartySwitcher.new
else
$scene = Scene_Map.new
end
end

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
@equipitem_window.x += 48
@equipstat_window.x += 48
@location_window.x += 64
@help_window.x += 64
end
elsif ! @equipitem_window.active && ! @equipenhanced_window.active
if @equipstat_window.x > -480 && @command_window.index == 1
@equipstat_window.x -= 48
@equip_window.x -= 48
@equipitem_window.x -= 48
@actor_window.x -= 48
@status_window.x -= 48
@help_window.x -= 64
@location_window.x -= 64
end
end
if @equipenhanced_window.active
if @equipenhanced_window.x < 0
@stat_window.x += 16
@command_window.x += 16
@equipenhanced_window.x += 16
end
else
if @equipenhanced_window.x > -160 && @equip_window.active
@equipenhanced_window.x -= 16
@stat_window.x -= 16
@command_window.x -= 16
end
end
if @playerstatus_window.active
if @playerstatus_window.x < 0
@status_window.x += 40
@actor_window.x += 40
@playerstatus_window.x += 40
end
else
if @playerstatus_window.x > -640 && @command_window.index == 4
@playerstatus_window.x -= 40
@actor_window.x -= 40
@status_window.x -= 40
end
end
if @file_window.active
if @file_window.x < 0
@status_window.x += 40
@actor_window.x += 40
@filestatus_window.x += 40
@file_window.x += 40
end
else
if @file_window.x > -640
@file_window.x -= 40
@filestatus_window.x -= 40
@actor_window.x -= 40
@status_window.x -= 40
end
end
if @end_window.active
if @end_window.x > 520
@stat_window.x -= 10
@command_window.x -= 10
@end_window.x -= 10
end
else
if @end_window.x < 640 && @command_window.index == 5
@end_window.x += 10
@stat_window.x += 10
@command_window.x += 10
end
end
end
#--------------------------------------------------------------------------
# * Checking Update Method Needed
#--------------------------------------------------------------------------
def menu_update
if @command_window.active && @command_window.y == 0 && @command_window.x == 0 then update_command
elsif @item_window.x == -480 && @itemcommand_window.active && @itemcommand_window.x == 0 then update_itemcommand
elsif @item_window.active && @item_window.x == 0 then update_item
elsif @skill_window.active then update_skill
elsif @targetactive == true then update_target
elsif @equip_window.active && @equip_window.x == 240 then update_equip
elsif @equipitem_window.active then update_equipment
elsif @equipenhanced_window.x == 0 then update_extraequip
elsif @playerstatus_window.x == 0 then update_playerstatus
elsif @file_window.x == 0 then update_save
elsif @actor_window.active && @actor_window.x == 0 then update_status
elsif @end_window.active then update_end
end
end
#--------------------------------------------------------------------------
# * Windows Actor Scrolling Update
#--------------------------------------------------------------------------
def update_scroll
if Input.trigger?(Input::R)
# Play cursor SE
$game_system.se_play($data_system.cursor_se)
# To next actor
if $game_party.actors.size - 1 == @actor_window.index
@actor_window.index = 0
else
@actor_window.index += 1
end
actor = $game_party.actors[@actor_window.index]
if @skill_window.active
if LegACy::ABS
@actor_window.index == 0 ? @skill_window.height = 240 : @skill_window.height = 336
@actor_window.index == 0 ? @hotkey_window.x = 0 : @hotkey_window.x = -480
end
@skill_window.update_actor(actor)
end
if @equip_window.active
@equip_window.update_actor(actor)
@equipitem_window.update_actor(actor)
@equipstat_window.update_actor(actor)
end
@playerstatus_window.update_actor(actor) if @playerstatus_window.active
return
end
# If L button was pressed
if Input.trigger?(Input::L)
# Play cursor SE
$game_system.se_play($data_system.cursor_se)
# To previous actor
if @actor_window.index == 0
@actor_window.index = $game_party.actors.size - 1
else
@actor_window.index -= 1
end
actor = $game_party.actors[@actor_window.index]
if @skill_window.active
if LegACy::ABS
@actor_window.index == 0 ? @skill_window.height = 240 : @skill_window.height = 336
@actor_window.index == 0 ? @hotkey_window.x = 0 : @hotkey_window.x = -480
end
@skill_window.update_actor(actor)
end
if @equip_window.active
@equip_window.update_actor(actor)
@equipitem_window.update_actor(actor)
@equipstat_window.update_actor(actor)
end
@playerstatus_window.update_actor(actor) if @playerstatus_window.active
return
end
end
#--------------------------------------------------------------------------
# * Frame Update (when command window is active)
#--------------------------------------------------------------------------
def update_command
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Switch to map screen
@command_window.active = false
@exit = true
return
end
# If B button was pressed
if Input.trigger?(Input::SHIFT) && LegACy::PARTY_SWAP
# Play cancel SE
$game_system.se_play($data_system.decision_se)
# Switch to map screen
@command_window.active = false
@actor_window.party = true
unless $game_party.reserve == []
for i in 0...$game_party.reserve.size
$game_party.actors.push($game_party.reserve)
end
end
@actor_window.refresh
@actor_window.active = true
@actor_window.index = 0
return
end
# If C button was pressed
if Input.trigger?(Input::C)
# If command other than save or end game, and party members = 0
if $game_party.actors.size == 0 and @command_window.index < 4
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# Branch by command window cursor position
case @command_window.index
when 0 # item
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch to item screen
@command_window.active = false
@itemcommand_window.active = true
when 1 # equipment
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Make status window active
@command_window.active = false
@actor_window.active = true
@actor_window.index = 0
when 2 # save
@command_window.active = false
@partyswitch = true
@exit = true
when 3..4 # skill & status
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Make status window active
@command_window.active = false
@actor_window.active = true
@actor_window.index = 0
when 5 # end game
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch to end game screen
@command_window.active = false
@end_window.active = true
end
return
end
end
 
#--------------------------------------------------------------------------
# * Frame Update (when item command window is active)
#--------------------------------------------------------------------------
def update_itemcommand
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Switch to item command window
@command_window.active = true
@itemcommand_window.active = false
return
end
# If C button was pressed
if Input.trigger?(Input::C)
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Branch by command window cursor position
type = LegACy::ITEMS[@itemcommand_window.index]
@item_window.active = true
@itemcommand_window.active = false
@item_window.update_item(type)
@item_window.index = 0
@help_window.active = true
return
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)
# Switch to item command window
@item_window.active = false
@itemcommand_window.active = true
@help_window.active = false
return
end
# If C button was pressed
if Input.trigger?(Input::C)
# Get currently selected data on the item window
@item = @item_window.item
# If not a use item
unless @item.is_a?(RPG::Item)
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# If it can't be used
unless $game_party.item_can_use?(@item.id)
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# Play decision SE
$game_system.se_play($data_system.decision_se)
# If effect scope is an ally
if @item.scope >= 3
# Activate target window
@item_window.active = false
@targetactive = true
@actor_window.active = true
# Set cursor position to effect scope (single / all)
if @item.scope == 4 || @item.scope == 6
@actor_window.index = -1
else
@actor_window.index = 0
end
# If effect scope is other than an ally
else
# If command event ID is valid
if @item.common_event_id > 0
# Command event call reservation
$game_temp.common_event_id = @item.common_event_id
# Play item use SE
$game_system.se_play(@item.menu_se)
# If consumable
if @item.consumable
# Decrease used items by 1
$game_party.lose_item(@item.id, 1)
# Draw item window item
@item_window.draw_item(@item_window.index)
end
# Switch to map screen
$scene = Scene_Map.new
return
end
end
return
end
end
#--------------------------------------------------------------------------
# * Frame Update (if skill window is active)
#--------------------------------------------------------------------------
def update_skill
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Switch to main command menu
@skill_window.active = false
@help_window.active = false
@actor_window.active = true
return
end
# If C button was pressed
if Input.trigger?(Input::C)
# Get currently selected data on the skill window
@skill = @skill_window.skill
# If unable to use
if @skill == nil or not @actor.skill_can_use?(@skill.id)
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# Play decision SE
$game_system.se_play($data_system.decision_se)
# If effect scope is ally
if @skill.scope >= 3
# Activate target window
@skill_window.active = false
@targetactive = true
@actor_window.active = true
# Set cursor position to effect scope (single / all)
if @skill.scope == 4 || @skill.scope == 6
@actor_window.index = -1
elsif @skill.scope == 7
@actor_index = @actor_window.index
@actor_window.index = @actor_index - 10
else
@actor_window.index = 0
end
# If effect scope is other than ally
else
# If common event ID is valid
if @skill.common_event_id > 0
# Common event call reservation
$game_temp.common_event_id = @skill.common_event_id
# Play use skill SE
$game_system.se_play(@skill.menu_se)
# Use up SP
@actor.sp -= @skill.sp_cost
# Remake each window content
@actor_window.refresh
@skill_window.refresh
# Switch to map screen
$scene = Scene_Map.new
return
end
end
return
end
if @skill_window.height == 240 && LegACy::ABS
if Kboard.keyboard($R_Key_H)
$game_system.se_play($data_system.decision_se)
$ABS.skill_key[1] = @skill_window.skill.id
@hotkey_window.refresh
return
end
if Kboard.keyboard($R_Key_J)
$game_system.se_play($data_system.decision_se)
$ABS.skill_key[2] = @skill_window.skill.id
@hotkey_window.refresh
return
end
if Kboard.keyboard($R_Key_K)
$game_system.se_play($data_system.decision_se)
$ABS.skill_key[3] = @skill_window.skill.id
@hotkey_window.refresh
return
end
if Kboard.keyboard($R_Key_L)
$game_system.se_play($data_system.decision_se)
$ABS.skill_key[4] = @skill_window.skill.id
@hotkey_window.refresh
return
end
end
if LegACy::PREXUS
if Input.trigger?(Input::X)
skill = @skill_window.skill
unless $ABS.player.abs.hot_key[0] or
$ABS.player.abs.hot_key.include?(skill.id)
$ABS.player.abs.hot_key[0] = skill.id
end
@skill_window.refresh
return
end
if Input.trigger?(Input::Y)
skill = @skill_window.skill
unless $ABS.player.abs.hot_key[1] or
$ABS.player.abs.hot_key.include?(skill.id)
$ABS.player.abs.hot_key[1] = skill.id
end
@skill_window.refresh
return
end
if Input.trigger?(Input::Z)
skill = @skill_window.skill
unless $ABS.player.abs.hot_key[2] or
$ABS.player.abs.hot_key.include?(skill.id)
$ABS.player.abs.hot_key[2] = skill.id
end
@skill_window.refresh
return
end
if Input.trigger?(Input::A)
skill = @skill_window.skill
for i in 0..$ABS.player.abs.hot_key.size
skillX = $ABS.player.abs.hot_key
next unless skillX
$ABS.player.abs.hot_key = nil if skill.id == skillX
end
@skill_window.refresh
return
end
end
end
#--------------------------------------------------------------------------
# * Frame Update (when target window is active)
#--------------------------------------------------------------------------
def update_target
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# If unable to use because items ran out
@actor_window.index = 0
if @command_window.index == 0
# Remake item window contents
@item_window.refresh
@item_window.active = true
@actor_window.active = false
end
if @command_window.index == 3
# Remake skill window contents
@skill_window.refresh
@skill_window.active = true
@actor_window.active = false
@skill_window.update_actor($game_party.actors[0])
end
@targetactive = false
return
end
# If C button was pressed
if Input.trigger?(Input::C)
if @command_window.index == 0
# If items are used up
if $game_party.item_number(@item.id) == 0
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# If target is all
if @actor_window.index == -1
# Apply item effects to entire party
used = false
for i in $game_party.actors
used |= i.item_effect(@item)
end
end
# If single target
if @actor_window.index >= 0
# Apply item use effects to target actor
target = $game_party.actors[@actor_window.index]
used = target.item_effect(@item)
end
# If an item was used
if used
# Play item use SE
$game_system.se_play(@item.menu_se)
# If consumable
if @item.consumable
# Decrease used items by 1
$game_party.lose_item(@item.id, 1)
# Redraw item window item
@item_window.draw_item(@item_window.index)
end
# Remake target window contents
@actor_window.refresh
@status_window.refresh
# If all party members are dead
if $game_party.all_dead?
@targetactive = false
# Switch to game over screen
$scene = Scene_Gameover.new
return
end
# If common event ID is valid
if @item.common_event_id > 0
# Common event call reservation
$game_temp.common_event_id = @item.common_event_id
@targetactive = false
# Switch to map screen
$scene = Scene_Map.new
return
end
end
# If item wasn't used
unless used
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
end
return
end
if @command_window.index == 3
# If unable to use because SP ran out
unless @actor.skill_can_use?(@skill.id)
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# If target is all
if @actor_window.index == -1
# Apply skill use effects to entire party
used = false
for i in $game_party.actors
used |= i.skill_effect(@actor, @skill)
end
end
# If target is user
if @actor_window.index <= -2
# Apply skill use effects to target actor
target = $game_party.actors[@actor_window.index + 10]
used = target.skill_effect(@actor, @skill)
end
# If single target
if @actor_window.index >= 0
# Apply skill use effects to target actor
target = $game_party.actors[@actor_window.index]
used = target.skill_effect(@actor, @skill)
end
# If skill was used
if used
# Play skill use SE
$game_system.se_play(@skill.menu_se)
# Use up SP
@actor.sp -= @skill.sp_cost
# Remake each window content
@actor_window.refresh
@skill_window.refresh
# If entire party is dead
if $game_party.all_dead?
# Switch to game over screen
@targetactive = false
$scene = Scene_Gameover.new
return
end
# If command event ID is valid
if @skill.common_event_id > 0
# Command event call reservation
$game_temp.common_event_id = @skill.common_event_id
@targetactive = false
# Switch to map screen
$scene = Scene_Map.new
return
end
end
# If skill wasn't used
unless used
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
end
return
end
end
end
#--------------------------------------------------------------------------
# * Frame Update (when equip window is active)
#--------------------------------------------------------------------------
def update_equip
@equipitem_window.update_equipment(@equip_window.index)
@equipstat_window.mode = @equip_window.index
@equipstat_window.refresh
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
@status_window.refresh
# Switch to menu screen
@equip_window.active = false
@help_window.active = false
@actor_window.active = true
return
end
# If C button was pressed
if Input.trigger?(Input::C)
# If equipment is fixed
if @actor.equip_fix?(@equip_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
@equip_window.active = false
@equipitem_window.active = true
@equipitem_window.index = 0
return
end
# If Shift button was pressed
if Input.trigger?(Input::SHIFT) && LegACy::EXTRA_EQUIP
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Activate item window
@equip_window.active = false
@equipenhanced_window.active = true
@equipenhanced_window.index = 0
return
end
end
#--------------------------------------------------------------------------
# * Frame Update (when equipment item window is active)
#--------------------------------------------------------------------------
def update_equipment
# Get currently item
item1 = @equip_window.item
item2 = @equipitem_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(@equip_window.index, item2 == nil ? 0 : item2.id)
# Get parameters for after equipment change
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
@equipstat_window.changes = [0, 0, 0, 0, 0, 0, 0, 0]
@equipstat_window.changes[0] = new_atk > old_atk ? 1 : @equipstat_window.changes[0]
@equipstat_window.changes[0] = new_atk < old_atk ? -1 : @equipstat_window.changes[0]
@equipstat_window.changes[1] = new_pdef > old_pdef ? 1 : @equipstat_window.changes[1]
@equipstat_window.changes[1] = new_pdef < old_pdef ? -1 : @equipstat_window.changes[1]
@equipstat_window.changes[2] = new_mdef > old_mdef ? 1 : @equipstat_window.changes[2]
@equipstat_window.changes[2] = new_mdef < old_mdef ? -1 : @equipstat_window.changes[2]
@equipstat_window.changes[3] = new_str > old_str ? 1 : @equipstat_window.changes[3]
@equipstat_window.changes[3] = new_str < old_str ? -1 : @equipstat_window.changes[3]
@equipstat_window.changes[4] = new_dex > old_dex ? 1 : @equipstat_window.changes[4]
@equipstat_window.changes[4] = new_dex < old_dex ? -1 : @equipstat_window.changes[4]
@equipstat_window.changes[5] = new_agi > old_agi ? 1 : @equipstat_window.changes[5]
@equipstat_window.changes[5] = new_agi < old_agi ? -1 : @equipstat_window.changes[5]
@equipstat_window.changes[6] = new_int > old_int ? 1 : @equipstat_window.changes[6]
@equipstat_window.changes[6] = new_int < old_int ? -1 : @equipstat_window.changes[6]
@equipstat_window.changes[7] = new_eva > old_eva ? 1 : @equipstat_window.changes[7]
@equipstat_window.changes[7] = new_eva < old_eva ? -1 : @equipstat_window.changes[7]
# Return equipment
@actor.equip(@equip_window.index, item1 == nil ? 0 : item1.id)
@actor.hp = last_hp
@actor.sp = last_sp
elem_text = ""
stat_text = ""
if item2.is_a?(RPG::Weapon)
flag = false
for i in item2.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]
elem_text += ", " if flag
elem_text += $data_system.elements
flag = true
end
flag = false
for i in item2.plus_state_set
stat_text += ", " if flag
stat_text += $data_states.name
flag = true
end
end
if item2.is_a?(RPG::Armor)
flag = false
for i in item2.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]
elem_text += ", " if flag
elem_text += $data_system.elements
flag = true
end
flag = false
for i in item2.guard_state_set
stat_text += ", " if flag
stat_text += $data_states.name
flag = true
end
end
# Draw in left window
@equipstat_window.set_new_parameters(new_atk, new_pdef, new_mdef, new_str,
new_dex, new_agi, new_int, new_eva, elem_text, stat_text)
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Erase parameters for after equipment change
@equipstat_window.set_new_parameters(nil, nil, nil, nil, nil, nil, nil, nil, '', '')
# Activate right window
@equip_window.active = true
@equipitem_window.active = false
@equipitem_window.index = -1
return
end
# If C button was pressed
if Input.trigger?(Input::C)
# Play equip SE
$game_system.se_play($data_system.equip_se)
# Get currently selected data on the item window
item = @equipitem_window.item
# Change equipment
@actor.equip(@equip_window.index, item == nil ? 0 : item.id)
# Erase parameters for after equipment change
@equipstat_window.set_new_parameters(nil, nil, nil, nil, nil, nil, nil, nil, '', '')
# Activate right window
@equip_window.active = true
@equipitem_window.active = false
@equipitem_window.index = -1
# Remake right window and item window contents
@equip_window.refresh
@equipitem_window.refresh
return
end
end
#--------------------------------------------------------------------------
# * Frame Update (when enhnaced equip window is active)
#--------------------------------------------------------------------------
def update_extraequip
# If B button was pressed
if Input.trigger?(Input::B) || Input.trigger?(Input::SHIFT)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Switch to menu screen
@equipenhanced_window.active = false
@equip_window.active = true
return
end
# If C button was pressed
if Input.trigger?(Input::C)
$game_system.se_play($data_system.equip_se)
case @equipenhanced_window.index
when 0
for i in 0..4
@actor.equip(i, 0) unless @actor.equip_fix?(i)
next if @actor.equip_fix?(i)
case i
when 0
weapons = []
weapon_set = $data_classes[@actor.class_id].weapon_set
for j in 1...$data_weapons.size
if $game_party.weapon_number(j) > 0 && weapon_set.include?(j)
weapons.push($data_weapons[j])
end
end
next if weapons == []
weapons = weapons.reverse
strongest_weapon = weapons[0]
for weapon in weapons
strongest_weapon = weapon if strongest_weapon.atk < weapon.atk
end
@actor.equip(0, strongest_weapon.id)
when 1..4
armors = []
armor_set = $data_classes[@actor.class_id].armor_set
for j in 1...$data_armors.size
if $game_party.armor_number(j) > 0 && armor_set.include?(j)
if $data_armors[j].kind == i - 1
armors.push($data_armors[j])
end
end
end
next if armors == []
armors = armors.reverse
strongest_armor = armors[0]
for armor in armors
strongest_armor = armor if strongest_armor.pdef < armor.pdef
end
@actor.equip(i, strongest_armor.id)
end
end
when 1
for j in 0..4
@actor.equip(j, 0) unless @actor.equip_fix?(j)
end
end
@equip_window.refresh
@equipitem_window.refresh
@equipstat_window.refresh
return
end
end
#--------------------------------------------------------------------------
# * Frame Update (when status window is active)
#--------------------------------------------------------------------------
def update_playerstatus
# 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
@playerstatus_window.active = false
@actor_window.active = true
return
end
end
#--------------------------------------------------------------------------
# * Frame Update (when save window is active)
#--------------------------------------------------------------------------
def update_save
# 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
@file_window.active = false
@command_window.active = false
return
end
# If C button was pressed
if Input.trigger?(Input::C)
$game_system.se_play($data_system.save_se)
file = File.open("Save#{@file_window.index + 1}.rxdata", "wb")
characters = []
for i in 0...$game_party.actors.size
actor = $game_party.actors
characters.push([actor.character_name, actor.character_hue])
end
Marshal.dump(characters, file)
Marshal.dump(Graphics.frame_count, file)
$game_system.save_count += 1
$game_system.magic_number = $data_system.magic_number
Marshal.dump($game_system, file)
Marshal.dump($game_switches, file)
Marshal.dump($game_variables, file)
Marshal.dump($game_self_switches, file)
Marshal.dump($game_screen, file)
Marshal.dump($game_actors, file)
Marshal.dump($game_party, file)
Marshal.dump($game_troop, file)
Marshal.dump($game_map, file)
Marshal.dump($game_player, file)
Marshal.dump($ams, file) if LegACy::AMS
Marshal.dump($ABS, file) if LegACY::PREXUS
Marshal.dump($game_allies, file) if LegACy::ABS
file.close
@file_window.refresh
@filestatus_window.refresh
return
end
end
#--------------------------------------------------------------------------
# * Frame Update (when status window is active)
#--------------------------------------------------------------------------
def update_status
@actor = $game_party.actors[@actor_window.index]
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
if @old_actor == nil
@command_window.active = false
@actor_window.active = false
if @actor_window.party
for i in 4...$game_party.actors.size
unless $game_party.reserve == []
$game_party.reserve[i - 4] = $game_party.actors[4]
$game_party.actors.delete($game_party.actors[4])
end
end
@actor_window.party = false
@actor_window.refresh
end
@actor_window.index = -1
else
@old_actor = nil
end
return
end
# If C button was pressed
if Input.trigger?(Input::C)
if @actor_window.party == false
# Branch by command window cursor position
case @command_window.index
when 1 # equipment
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch to skill screen
@equip_window.active = true
@equip_window.update_actor(@actor)
@equipitem_window.update_actor(@actor)
@equipstat_window.update_actor(@actor)
@help_window.active = true
@actor_window.active = false
when 3 # skill

# If this actor's action limit is 2 or more
if $game_party.actors[@actor_window.index].restriction >= 2
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch to skill screen
if LegACy::ABS
@actor_window.index == 0 ? @skill_window.height = 240 : @skill_window.height = 336
end
@skill_window.active = true
@skill_window.index = 0
@skill_window.update_actor(@actor)
@help_window.active = true
@actor_window.active = false
when 4 # status
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch to status screen
@playerstatus_window.active = true
@playerstatus_window.update_actor(@actor)
@actor_window.active = false
end
return
else
# Play decision SE
$game_system.se_play($data_system.decision_se)
if @old_actor == nil
@old_actor = @actor
else
$game_party.actors[$game_party.actors.index(@old_actor)] = $game_party.actors[@actor_window.index]
$game_party.actors[@actor_window.index] = @old_actor
@actor_window.refresh
$game_player.refresh
@old_actor = nil
end
return
end
end
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update_end
# 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
@end_window.active = false
@command_window.active = false
return
end
# If C button was pressed
if Input.trigger?(Input::C)
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Fade out BGM, BGS, and ME
Audio.bgm_fade(800)
Audio.bgs_fade(800)
Audio.me_fade(800)
# Branch by command window cursor position
case @end_window.index
when 0 # to title
# Switch to title screen
$scene = Scene_Title.new
when 1 # shutdown
# Shutdown
$scene = nil
end
return
end
end
def setup_actor_character_sprites(characters)
@spriteset.setup_actor_character_sprites(characters)
end
end

#==============================================================================
# ** Window_BattleStatus
#------------------------------------------------------------------------------
# This window displays the status of all party members on the battle screen.
#==============================================================================
if LegACy::BATTLE_BAR
class Window_BattleStatus < Window_Base
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
@item_max = $game_party.actors.size
for i in 0...$game_party.actors.size
actor = $game_party.actors
actor_x = i * 160 + 4
draw_actor_name(actor, actor_x, 0)
draw_LegACy_bar(actor, actor_x - 4, 46, 'hp', 120)
draw_LegACy_bar(actor, actor_x - 4, 76, 'sp', 120)
if @level_up_flags
self.contents.font.color = normal_color
self.contents.draw_text(actor_x, 96, 120, 32, "LEVEL UP!")
else
draw_actor_state(actor, actor_x, 96)
end
end
end
end

#==============================================================================
# ** Scene_Load
#------------------------------------------------------------------------------
# This class performs load screen processing.
#==============================================================================
class Scene_Load
#--------------------------------------------------------------------------
# * Object Initialization
# help_text : text string shown in the help window
#--------------------------------------------------------------------------
def initialize
$game_temp = Game_Temp.new
$game_temp.last_file_index = 0
latest_time = Time.at(0)
for i in 0..LegACy::SAVE_NUMBER
filename = "Save#{i + 1}.rxdata"
if FileTest.exist?(filename)
file = File.open(filename, "r")
if file.mtime > latest_time
latest_time = file.mtime
$game_temp.last_file_index = i
end
file.close
end
end
end
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
@help_window = Window_Help.new
@help_window.set_text("Select a file to load.")
@file_window = Window_File.new
@file_window.y = 64
@file_window.height = 416
@file_window.active = true
@status_window = Window_FileStatus.new(@file_window)
@status_window.x = 320
@status_window.y = 64
@status_window.height = 416
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
@help_window.dispose
@file_window.dispose
@status_window.dispose
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
@help_window.update
@file_window.update
@status_window.update
# If C button was pressed
if Input.trigger?(Input::C)
unless FileTest.exist?(filename)
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.load_se)
file = File.open(filename, "rb")
read_save_data(file)
file.close
$game_system.bgm_play($game_system.playing_bgm)
$game_system.bgs_play($game_system.playing_bgs)
$game_map.update
$scene = Scene_Map.new
$game_temp.last_file_index = @file_index
return
end
# If B button was pressed
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Title.new
return
end
end
#--------------------------------------------------------------------------
# * Read Save Data
# file : file object for reading (opened)
#--------------------------------------------------------------------------
def read_save_data(file)
# Read character data for drawing save file
characters = Marshal.load(file)
# Read frame count for measuring play time
Graphics.frame_count = Marshal.load(file)
# Read each type of game object
$game_system = Marshal.load(file)
$game_switches = Marshal.load(file)
$game_variables = Marshal.load(file)
$game_self_switches = Marshal.load(file)
$game_screen = Marshal.load(file)
$game_actors = Marshal.load(file)
$game_party = Marshal.load(file)
$game_troop = Marshal.load(file)
$game_map = Marshal.load(file)
$game_player = Marshal.load(file)
# If magic number is different from when saving
# (if editing was added with editor)
if $game_system.magic_number != $data_system.magic_number
# Load map
$game_map.setup($game_map.map_id)
$game_player.center($game_player.x, $game_player.y)
end
# Refresh party members
$game_party.refresh
end
end
#--------------------------------------------------------------------------
# ● return the selected file's name
#--------------------------------------------------------------------------
def filename
return "Save#{@file_window.index + 1}.rxdata"
end
end

end
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top