Sorry for the triple post, the second code didn't fit a single one.
CMS First part#=============================================================
# 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 = false # True if you want to use Enhanced Equipment feature.
PARTY_SWAP = true # True if you want to use Party Swapper feature.
BATTLE_BAR = false # 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 = 10 # 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[i]
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[i]
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[i].element_set.include?(@attribute)
@data.push($data_items[i])
end
end
# Also add weapons and armors
for i in 1...$data_weapons.size
if $game_party.weapon_number(i) > 0 and
$data_weapons[i].element_set.include?(@attribute)
@data.push($data_weapons[i])
end
end
for i in 1...$data_armors.size
if $game_party.armor_number(i) > 0 and
$data_armors[i].guard_element_set.include?(@attribute)
@data.push($data_armors[i])
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[i]]
if skill != nil
@data.push(skill)
end
end
# If item count is not 0, make a bit map and draw all items
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 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[i] == nil
self.contents.draw_text((i / 2 * 224) + 54, 32 * (i % 2), 124, 32, 'Not assigned')
next
end
skill = $data_skills[ABS.skill_key[i + 1]]
bitmap = RPG::Cache.icon(skill.icon_name)
self.contents.blt((i / 2 * 224) + 26, (32 * (i % 2)) + 4, bitmap, Rect.new(0, 0, 24, 24))
self.contents.draw_text((i / 2 * 224) + 54, 32 * (i % 2), 124, 32, skill.name)
self.contents.draw_text((i / 2 * 224) + 178, 32 * (i % 2), 32, 32, skill.sp_cost.to_s, 2)
end
end
end
#==============================================================================
# ** Window_EquipStat
#------------------------------------------------------------------------------<