class Scene_Menu
def create_background
end
def main
create_background
s1 = 'Items'
s2 = 'Skills'
s3 = 'Equip'
s4 = 'Status'
s5 = 'Save'
s6 = 'End Game'
$game_system.bar_style = 4
@command_window = Window_Command_WcW.new(0, 0, 160, [['032-Item01', s1], ['044-Skill01', s2], ['001-Weapon01', s3], ['050-Skill07', s4], ['047-Skill04', s5], ['037-Item06', s6]])
@command_window.back_opacity = 125
if $game_system.save_disabled
@command_window.disable_item(4)
end
@gold_window = Window_Gold.new
@gold_window.x = 0
@gold_window.y = 416
@steps_window = Window_Steps.new
@steps_window.y = 320
@steps_window.x = 0
@playtime_window = Window_PlayTime.new
@playtime_window.y = 224
@playtime_window.x = 0
@status_window = Window_MenuStatus.new
@status_window.x = 160
@status_window.y = 0
@command_window.x = 640
@status_window.y = 480
@status_window.x = 160
@gold_window.x = 640
@steps_window.x = 640
@playtime_window.x = 640
@command_window.back_opacity, @playtime_window.back_opacity, @gold_window.back_opacity, @steps_window.back_opacity, @status_window.back_opacity = 125, 125, 125, 125, 125
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
@command_window.dispose
@steps_window.dispose if @steps_window != nil
@gold_window.dispose
@playtime_window.dispose
@back.dispose if @back != nil
@status_window.dispose
end
alias animate update
def update
if @command_window.x != 0
@command_window.x -= 20
end
if @status_window.y != 0
@status_window.y -= 15
end
if @playtime_window.x != 0 && @command_window.x == 0
@playtime_window.x -= 20
end
if @steps_window.x != 0 && @playtime_window.x <= 320
@steps_window.x -= 20
end
if @gold_window.x != 0 && @steps_window.x <= 320
@gold_window.x -= 20
end
animate
end
end
class Game_Party
def add_actor(actor_id)
actor = $game_actors[actor_id]
if @actors.size < 1 and not @actors.include?(actor)
@actors.push(actor)
$game_player.refresh
end
end
end
#----------------------------------------------------------------------------
# * Window Command (WcW)
# Displays options w/ icons. Feel free to use this in your own script.
#----------------------------------------------------------------------------
class Window_Command_WcW < Window_Selectable
#--------------------------------------------------------------------------
# * Initialize
#--------------------------------------------------------------------------
def initialize(x, y, width, commands)
# Calls original initialize method
super(x, y, width, commands.size * 32 + 32)
# Sets maximum items and commands variables
@item_max = commands.size
@commands = commands
# Initializes the @disabled array, which is used for drawing disabled items
@disabled = []; @commands.size.times { @disabled.push false }
# Creates a new bitmap for the contents
self.contents = Bitmap.new(width-32, commands.size * 32)
# Sets the index to 0
self.index = 0
# Draws contents
refresh
end
#--------------------------------------------------------------------------
# * Refreshes Contents
#--------------------------------------------------------------------------
def refresh
# Clears bitmap
self.contents.clear
# For each command in the @commands array....
@commands.size.times {|i|
# Get the icon from RPG::Cache
self.contents.blt(4, 32 * i + 4, RPG::Cache.icon(@commands[i][0]),
Rect.new(0, 0, 24, 24))
# If the disabled array has this down for this disabled, draw it as
# disabled, if not, draw it normal
self.contents.font.color = @disabled[i] ? disabled_color : normal_color
# Draw the command
self.contents.draw_text(34, 32 * i, self.contents.width - 34, 32,
@commands[i][1], 0)
}
end
#--------------------------------------------------------------------------
# * Disable Items
#--------------------------------------------------------------------------
def disable_items(*indexes)
# For each index in the given argument array,
indexes.each {|index|
# Set that index to disabled in the @disabled array
@disabled[index] = true
}
# Re-draw contents
refresh
end
#--------------------------------------------------------------------------
# * Enable Items
#--------------------------------------------------------------------------
def enable_items(*indexes)
# For each index in the given argument array,
indexes.each {|index|
# Set that index to enabled in the @disabled array
@disable[index] = false
}
# Red-draw contents
refresh
end
end
class Window_MenuStatus < Window_Selectable
def initialize
super(0, 0, 480, 150)
self.contents = Bitmap.new(width - 32, height - 32)
refresh
self.active = false
self.index = -1
end
end
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# Blizz-Art Gradient Styler with HP/SP/EXP bars by Blizzard
# Version: 4.51b
# Type: Game Playability Improvement
# Date v4.0: 13.11.2006
# Date v4.11: 12.1.2007
# Date v4.2b: 12.3.2007
# Date v4.4b: 14.7.2007
# Date v4.41b: 23.10.2007
# Date v4.5b: 25.10.2007
# Date v4.51b: 28.1.2008
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#
# new in v2.x:
# - 2 styles, better code
#
# new in v3.x:
# - 6 styles, far better code
#
# new in v4.0:
# - 6 styles, overworked and extremely delagged, enjoy the most lagless
# gradient/slant bar code ever
#
# new in v4.11:
# - added instructions and a recognition constant for plugins
#
# new in v4.2b:
# - improved code
#
# new in v4.4b:
# - improved code, now 7 styles
#
# new in v4.41b:
# - resolved issue
#
# new in v4.5b:
# - improved coding
# - removed drawing glitch that was caused by using a variable name shorter
# than 4 letters
#
# new in v4.51b:
# - fixed glitch with StormTronics CMS
#
#
# Instructions:
#
# You can change style and opacity by using the "Call script" event command.
# Use one of of these syntaxes:
#
# $game_system.bar_style = X
# $game_system.bar_opacity = Y
#
# X - number from 0 to 6 and is the ID number of the style
# Y - number from 0 to 255 and indicates the opacity
#
# Values out of range will be corrected.
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
$Blizz_Art = true
#==============================================================================
# Game_System
#==============================================================================
class Game_System
attr_accessor :bar_style
attr_reader :bar_opacity
#----------------------------------------------------------------------------
# initialize
# Added bar style variables.
#----------------------------------------------------------------------------
alias init_blizzart_later initialize
def initialize
init_blizzart_later
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# START Configuration
#
# Configure this part manually if you have no "Options" controller for the
# styles and the opacity. (style: 0~6, opacity: 0~255)
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
@bar_style = 5
self.bar_opacity = 255
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# END Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
end
#----------------------------------------------------------------------------
# bar_opacity=
# alpha - opacity
# Encapsulation and range limitation of opacity.
#----------------------------------------------------------------------------
def bar_opacity=(alpha)
@bar_opacity = [[alpha, 0].max, 255].min
end
end
#==============================================================================
# Game_Actor
#==============================================================================
class Game_Actor
#----------------------------------------------------------------------------
# now_exp
# Returns the EXP collected in this level.
#----------------------------------------------------------------------------
def now_exp
return @exp - @exp_list[@level]
end
#----------------------------------------------------------------------------
# next_exp
# Returns the EXP needed to level up as number.
#----------------------------------------------------------------------------
def next_exp
return @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0
end
end
#==============================================================================
# Bitmap
#==============================================================================
class Bitmap
#----------------------------------------------------------------------------
# gradient_bar
# x - x coordinate
# y - y coordinate
# w - width of the bar to be drawn
# color1 - primary color
# color2 - secondary color
# color3 - back color
# rate - fill rate
# This special method is able to draw one out of 7 styles.
#----------------------------------------------------------------------------
def gradient_bar(x, y, w, color1, color2, color3, rate, flag = false)
# stop if not active or out of range
#return unless $game_system.BARS || flag
return if $game_system.bar_style < 0 || $game_system.bar_style > 6
# styles with "vertical" black borders
styles = [1, 3, 4, 5, 6]
# setup of coordinates and offsets depending on style
offs = 5
x += offs
y += 26
if styles.include?($game_system.bar_style)
offs += 2
y -= 1
[5, 6].include?($game_system.bar_style) ? y -= 2 : x += 1
# quantizes the width so it looks better (remove it and see what happens)
w = w / 8 * 8
end
# temporary variable
a = $game_system.bar_opacity
if $game_system.bar_style < 5
# draw black slanted back
(0...(offs+3)).each {|i| fill_rect(x-i, y+i-2, w+3, 1, Color.new(0, 0, 0))}
# draw white slanted back onto black, but let black borders stay
(0...(offs+1)).each {|i| fill_rect(x-i, y+i-1, w+1, 1, Color.new(255, 255, 255))}
if $game_system.bar_style < 2
# iterate through each vertical bar
(0...w+offs).each {|i|
# calculate color
r = color3.red * i / (w+offs)
g = color3.green * i / (w+offs)
b = color3.blue * i / (w+offs)
# special offset calculation
oy = i < offs ? offs-i : 0
off = i < offs ? i : i > w ? w+offs-i : offs
# draw this part of the bar
fill_rect(x+i-offs+1, y+oy-1, 1, off, Color.new(r, g, b, a))}
# if slanted bar is out of critical area
if (w*rate).to_i >= offs
# draw the little triangular part on the left
(0...((w*rate).to_i+offs)).each {|i|
r = color1.red + (color2.red-color1.red)*i / ((w+offs)*rate)
g = color1.green + (color2.green-color1.green)*i / ((w+offs)*rate)
b = color1.blue + (color2.blue-color1.blue)*i / ((w+offs)*rate)
oy = i < offs ? offs-i : 0
off = i < offs ? i : i > w*rate ? (w*rate).to_i+offs-i : offs
fill_rect(x+i-offs+1, y+oy-1, 1, off, Color.new(r, g, b, a))}
else
# draw the little triangular part on the left using special method
(0...(w * rate).to_i).each {|i| (0...offs).each {|j|
r = color1.red + (color2.red-color1.red)*i / (w*rate)
g = color1.green + (color2.green-color1.green)*i / (w*rate)
b = color1.blue + (color2.blue-color1.blue)*i / (w*rate)
set_pixel(x+i-j+1, y+j-1, Color.new(r, g, b, a))}}
end
else
# iterate through all horizontal lines
(0...offs).each {|i|
# calculate colors
r = color3.red * i / offs
g = color3.green * i / offs
b = color3.blue * i / offs
# draw background line
fill_rect(x-i+1, y+i-1, w, 1, Color.new(r, g, b, a))}
if $game_system.bar_style == 4
# iterate through half of all horizontal lines
(0...offs/2+1).each {|i|
# calculate colors
r = color2.red * (i+1) / (offs/2)
g = color2.green * (i+1) / (offs/2)
b = color2.blue * (i+1) / (offs/2)
# draw bar line
fill_rect(x-i+1, y+i-1, w*rate, 1, Color.new(r, g, b, a))
# draw bar line mirrored vertically
fill_rect(x-offs+i+2, y+offs-i-2, w*rate, 1, Color.new(r, g, b, a))}
else
# iterate through all horizontal lines
(0...offs).each {|i|
# calculate colors
r = color1.red + (color2.red-color1.red)*i / offs
g = color1.green + (color2.green-color1.green)*i / offs
b = color1.blue + (color2.blue-color1.blue)*i / offs
# draw bar line
fill_rect(x-i+1, y+i-1, w*rate, 1, Color.new(r, g, b, a))}
end
end
# if style with black vertical slanted intersections
if styles.include?($game_system.bar_style)
# add black bars on 1st and 8th column every 8 pixels
(0...w).each {|i| (0...offs).each {|j|
if styles.include?($game_system.bar_style) && i % 8 < 2
set_pixel(x+i-j+1, y+j-1, Color.new(0, 0, 0, a))
end}}
end
else
# fill white background
fill_rect(x+1, y-3, w+2, 12, Color.new(255, 255, 255, a))
# iterate through each of 6 lines
(1...6).each {|i|
# calculate background color
color = Color.new(color3.red*i/5, color3.green*i/5, color3.blue*i/5, a)
# draw background
fill_rect(x+2, y+i-3, w, 12-i*2, color)
# calculate bar color
color = Color.new(color2.red*i/5, color2.green*i/5, color2.blue*i/5, a)
# draw bar
fill_rect(x+2, y+i-3, w*rate, 12-i*2, color)}
# if style 5 (with vertical borders)
if $game_system.bar_style == 5
# add black bars on 1st and 8th column every 8 pixels
(0...w/8).each {|i|
fill_rect(x+2+i*8, y-2, 1, 10, Color.new(0, 0, 0, a))
fill_rect(x+2+(i+1)*8-1, y-2, 1, 10, Color.new(0, 0, 0, a))}
end
end
end
end
#==============================================================================
# Window_Base
#==============================================================================
class Window_Base
#----------------------------------------------------------------------------
# draw_actor_hp
# actor - the actor
# x - x coordinate
# y - y coordinate
# w - reserved max width
# Added fill rate calculation and bar drawing.
#----------------------------------------------------------------------------
alias draw_actor_hp_blizzart_later draw_actor_hp
def draw_actor_hp(actor, x, y, w = 148)
#if $game_system.BARS
# RTAB compatibility fix
if !(defined? Window_DetailsStatus) || !self.is_a?(Window_DetailsStatus)
w -= 12
end
# calculate bar fill rate
rate = (actor.maxhp > 0 ? actor.hp.to_f / actor.maxhp : 0)
# create colors depending on rate
if rate > 0.6
color1 = Color.new(80 - 150 * (rate-0.6), 80, 50 * (rate-0.6), 192)
color2 = Color.new(240 - 450 * (rate-0.6), 240, 150 * (rate-0.6), 192)
elsif rate > 0.2 && rate <= 0.6
color1 = Color.new(80, 200 * (rate-0.2), 0, 192)
color2 = Color.new(240, 600 * (rate-0.2), 0, 192)
elsif rate <= 0.2
color1 = Color.new(400 * rate, 0, 0, 192)
color2 = Color.new(240, 0, 0, 192)
end
# background color
color3 = Color.new(0, 80, 0, 192)
# draw bar with coordinates and colors
self.contents.gradient_bar(x, y, w, color1, color2, color3, rate)
if $scene.is_a?(Scene_Battle)
draw_actor_hp_blizzart_later(actor, x, y, w)
else
draw_actor_hp_blizzart_later(actor, x, y)
end
#else
#draw_actor_hp_blizzart_later(actor, x, y, w)
#end
end
#----------------------------------------------------------------------------
# draw_actor_sp
# actor - the actor
# x - x coordinate
# y - y coordinate
# w - reserved max width
# Added fill rate calculation and bar drawing.
#----------------------------------------------------------------------------
alias draw_actor_sp_blizzart_later draw_actor_sp
def draw_actor_sp(actor, x, y, w = 148)
#if $game_system.BARS
# RTAB compatibility fix
if !(defined? Window_DetailsStatus) || !self.is_a?(Window_DetailsStatus)
w -= 12
end
# calculate bar fill rate
rate = (actor.maxsp > 0 ? actor.sp.to_f / actor.maxsp : 0)
# create colors depending on rate
if rate > 0.4
color1 = Color.new(60 - 66 * (rate-0.4), 20, 80, 192)
color2 = Color.new(180 - 200 * (rate-0.4), 60, 240, 192)
elsif rate <= 0.4
color1 = Color.new(20 + 100 * rate, 50 * rate, 26 + 166 * rate, 192)
color2 = Color.new(60 + 300 * rate, 150 * rate, 80 + 400 * rate, 192)
end
# background color
color3 = Color.new(0, 0, 80, 192)
# draw bar with coordinates and colors
self.contents.gradient_bar(x, y, w, color1, color2, color3, rate)
if $scene.is_a?(Scene_Battle)
draw_actor_sp_blizzart_later(actor, x, y, w)
else
draw_actor_sp_blizzart_later(actor, x, y)
end
#else
# draw_actor_sp_blizzart_later(actor, x, y, w)
#end
end
#----------------------------------------------------------------------------
# draw_actor_exp
# actor - the actor
# x - x coordinate
# y - y coordinate
# w - reserved max width
# Added fill rate calculation and bar drawing.
#----------------------------------------------------------------------------
alias draw_actor_exp_blizzart_later draw_actor_exp
def draw_actor_exp(actor, x, y, w = 148)
#if $game_system.BARS
w += 12
# calculate bar fill rate
rate = (actor.next_exp != 0 ? actor.now_exp.to_f / actor.next_exp : 1)
# create colors depending on rate
if rate < 0.5
color1 = Color.new(20 * rate, 60, 80, 192)
color2 = Color.new(60 * rate, 180, 240, 192)
elsif rate >= 0.5
color1 = Color.new(20 + 120 * (rate-0.5), 60 + 40 * (rate-0.5), 80, 192)
color2 = Color.new(60 + 360 * (rate-0.5), 180 + 120 * (rate-0.5), 240, 192)
end
# background color
color3 = Color.new(80, 80, 80, 192)
# draw bar with coordinates and colors
self.contents.gradient_bar(x, y, w, color1, color2, color3, rate)
#end
draw_actor_exp_blizzart_later(actor, x, y)
end
end