#==============================================================================
# ***** HUD Cabal Online *****
#------------------------------------------------------------------------------
# ***** By RD12 *****
#------------------------------------------------------------------------------
class Hud < Window_Base
def initialize
super(-10,-10,280,90)
self.back_opacity = 0
self.contents = Bitmap.new(width - 32, height - 32)
self.windowskin = RPG::Cache.windowskin("Blank")
refresh
end
def update
super
refresh if something_changed?
end
def something_changed?
return true if @old_exp != @actor.now_exp
return true if @old_hp != @actor.hp
return true if @old_sp != @actor.sp
return true if @old_level != @actor.level
return true if @old_name != @actor.name
return false
end
def refresh
self.contents.clear
@actor = $game_party.actors[0]
@old_exp = @actor.now_exp
@old_hp = @actor.hp
@old_sp = @actor.sp
@old_level = @actor.level
@old_name = @actor.name
hud3 = RPG::Cache.picture("Base-2")
hud1 = hud3.width
hud2 = hud3.height
hud4 = Rect.new(0,0,hud1,hud2)
self.contents.blt(-13,-16,hud3,hud4)
#Fundo
fundo = RPG::Cache.picture("Fundo")
fundowidth = fundo.width
fundoheight = fundo.height
fundo_rect = Rect.new(0,0,fundowidth,fundoheight)
self.contents.blt(1+1,1,fundo,fundo_rect)
# Face do Personagem na HUD
if User_Edit::Face == true
grafico = $game_party.actors[0].character_name + "-face"
face = RPG::Cache.picture("#{grafico}")
face_rect = Rect.new(0,0,32,32)
self.contents.blt(14,13,face,face_rect)
end
# Nome e Level
self.contents.font.color = Color.new(200,200,200)
self.contents.draw_text(130, -6, 112, 32, "#{@actor.name}")
self.contents.draw_text(67, -6, 112, 32, "Level #{@actor.level} -")
self.contents.font.color = Color.new(200,200,200)
# Hp
hpbar = RPG::Cache.picture("HP-2")
hpbarwidth = hpbar.width * @actor.hp / @actor.maxhp
hpbarheight = hpbar.height
hpbar_rect = Rect.new(0,0,hpbarwidth,hpbarheight)
self.contents.blt(58,20,hpbar,hpbar_rect)
if $game_party.actors[0].level <= 21
self.contents.draw_text(120, -10, 200, 70, "#{@actor.hp}/#{@actor.maxhp}")
else
self.contents.draw_text(120, -10, 200, 70, "#{@actor.hp}/#{@actor.maxhp}")
end
# Sp
mpbar = RPG::Cache.picture("MP-2")
mpbarwidth = mpbar.width * @actor.sp / @actor.maxsp
mpbarheight = mpbar.height
mpbar_rect = Rect.new(0,0,mpbarwidth,mpbarheight)
self.contents.blt(56,33,mpbar,mpbar_rect)
# EXP
if $game_party.actors[0].level != 99
xpbar = RPG::Cache.picture("XP-2")
xpbarwidth = xpbar.width * @actor.now_exp / @actor.next_exp
xpbarheight = xpbar.height
xpbar_rect = Rect.new(0,0,xpbarwidth,xpbarheight)
self.contents.blt(51,41,xpbar,xpbar_rect)
end
end
end
class Scene_Map
alias hud_main main
def main
@Hud = Hud.new
hud_main
@Hud.dispose
end
alias hud_update update
def update
hud_update
@Hud.update
@Hud.refresh
end
end
class Game_Actor < Game_Battler
def now_exp
return @exp - @exp_list[@level]
end
def next_exp
return @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0
end
end