#==============================================================================
# ** Window_Base
#------------------------------------------------------------------------------
# This class is for all in-game windows.
#==============================================================================
class Window_Base < Window
#--------------------------------------------------------------------------
# Credit for the methods below go to:
#-------------------------------------------------------------------------
# ** Action Battle System
#------------------------------------------------------------------------
# By: Near Fantastica
#------------------------------------------------------------------------
#--------------------------------------------------------------------------
# * Draws Actors Hp meter
#--------------------------------------------------------------------------
def draw_actor_hp_bar(actor, x, y, width = 100, height = 10,
bar_color = Color.new(255, 0, 0, 255))
self.contents.fill_rect(x, y, width, height, Color.new(255, 255, 255, 100))
w = width * actor.hp / actor.maxhp
for i in 0..height
r = bar_color.red * (height -i)/height + 0 * i/height
g = bar_color.green * (height -i)/height + 0 * i/height
b = bar_color.blue * (height -i)/height + 0 * i/height
a = bar_color.alpha * (height -i)/height + 255 * i/height
self.contents.fill_rect(x, y+i, w , 1, Color.new(r, g, b, a))
end
end
#--------------------------------------------------------------------------
# * Draws Actors Sp meter
#--------------------------------------------------------------------------
def draw_actor_sp_bar(actor, x, y, width = 100, height = 10,
bar_color = Color.new(0, 0, 255, 255))
self.contents.fill_rect(x, y, width, height, Color.new(255, 255, 255, 100))
w = width * actor.sp / actor.maxsp
for i in 0..height
r = bar_color.red * (height -i)/height + 0 * i/height
g = bar_color.green * (height -i)/height + 0 * i/height
b = bar_color.blue * (height -i)/height + 0 * i/height
a = bar_color.alpha * (height -i)/height + 255 * i/height
self.contents.fill_rect(x, y+i, w , 1, Color.new(r, g, b, a))
end
end
#--------------------------------------------------------------------------
# * Draws Actors Exp meter
#--------------------------------------------------------------------------
def draw_actor_exp_bar(actor, x, y, width = 100, height = 10,
bar_color = Color.new(255, 255, 0, 255))
self.contents.fill_rect(x, y, width, height, Color.new(255, 255, 255, 100))
if actor.level == 99
w = 0
else
w = width * actor.exp / actor.next_exp_s.to_f
end
for i in 0..height
r = bar_color.red * (height -i)/height + 0 * i/height
g = bar_color.green * (height -i)/height + 0 * i/height
b = bar_color.blue * (height -i)/height + 0 * i/height
a = bar_color.alpha * (height -i)/height + 255 * i/height
self.contents.fill_rect(x, y+i, w , 1, Color.new(r, g, b, a))
end
end
end
#==============================================================================
# ** Window_WabbitHUD
#------------------------------------------------------------------------------
# This class shows the Hud window for pink wabbit.
#==============================================================================
class Window_PinkWabbitHUD < Window_Base
# Constant used to store the name of the icons to be used in the window.
ICON_NAMES = {
'hp' => 'heart.png',
'sp' => 'crystal.png',
'ep' => 'book.png',
'gp' => 'coin.png'
}
#--------------------------------------------------------------------------
# * Initializes the object.
#--------------------------------------------------------------------------
def initialize
super(0,0,160,150)
self.contents = Bitmap.new(width - 32, height - 32)
self.opacity = 100
# Draw the icons only once they won't change.
bitmap = RPG::Cache.icon(ICON_NAMES['hp'])
self.contents.blt(x, 0, bitmap, Rect.new(0, 0, 24, 24))
bitmap = RPG::Cache.icon(ICON_NAMES['sp'])
self.contents.blt(x, 32, bitmap, Rect.new(0, 0, 24, 24))
bitmap = RPG::Cache.icon(ICON_NAMES['ep'])
self.contents.blt(x, 64, bitmap, Rect.new(0, 0, 24, 24))
bitmap = RPG::Cache.icon(ICON_NAMES['gp'])
self.contents.blt(x, 96, bitmap, Rect.new(0, 0, 24, 24))
# Intialize some public instance variables.
@actor, @gold = $game_party.actors[0], $game_party.gold
@actor_hp, @actor_sp, @actor_exp = -1, -1, -1
# Call refresh to draw the more dynamic items.
refresh
end
#--------------------------------------------------------------------------
# * Redraws the data items in the window.
#--------------------------------------------------------------------------
def refresh
clear_color = Color.new(0, 0, 0, 0)
x, y = 0, 0
# Draw the Hitpoints of the Party Leader.
if @actor_hp != @actor.hp
# Save the new value
@actor_hp = @actor.hp
# Create a rectangle to clear the portion we will draw to.
rect = Rect.new(x + 26, y + 9, 100, 10)
self.contents.fill_rect(rect, clear_color)
# Draw the health bar.
draw_actor_hp_bar(@actor, x + 26, y + 9)
end
y += 32
# Draw the Skill Points of the Party Leader.
if @actor_sp != @actor.sp
# Save the new value
@actor_sp = @actor.sp
# Create a rectangle to clear the portion we will draw to.
rect = Rect.new(x + 26, y + 9, 100, 10)
self.contents.fill_rect(rect, clear_color)
# Draw the health bar.
draw_actor_sp_bar(@actor, x + 26, y + 9)
end
y += 32
# Draw the Experience of the Party Leader.
if @actor_exp != @actor.exp
# Save the new value
@actor_exp = @actor.exp
# Create a rectangle to clear the portion we will draw to.
rect = Rect.new(x + 26, y + 9, 100, 10)
self.contents.fill_rect(rect, clear_color)
# Draw the health bar.
draw_actor_exp_bar(@actor, x + 26, y + 9)
end
y += 32
# Draw the Gold
if @gold != $game_party.gold
# Save the new value
@gold = $game_party.gold
# Create a rectangle to clear the portion we will draw to.
rect = Rect.new(x + 26, y, 100, 32)
self.contents.fill_rect(rect, clear_color)
# Set the drawing text color to gold.
self.contents.font.color = Color.new(150,150,0,255)
self.contents.draw_text(x + 26, y - 5, 100, 32, @gold.to_s, 2)
end
end
#--------------------------------------------------------------------------
# * Checks to see if the window needs to be refreshed.
#--------------------------------------------------------------------------
def update
if Graphics.frame_count / Graphics.frame_rate != @total_sec
refresh
end
end
end
#==============================================================================
# ** Scene_Map
#------------------------------------------------------------------------------
# This class performs map screen processing.
#==============================================================================
class Scene_Map
alias_method :khmp_pinkwabbithud_main, :main
alias_method :khmp_pinkwabbithud_update, :update
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
@hud = Window_PinkWabbitHUD.new
khmp_pinkwabbithud_main
@hud.dispose
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
@hud.update
khmp_pinkwabbithud_update
end
end