#==============================================================================
# Window Hud
#==============================================================================
module Crissaegrim_Hud
Background = "HUD-Background" # Imagem de fundo da hud
HP_Bar = "HP-Bar" # Imagem da barra de HP
MP_Bar = "MP-Bar" # Imagem da barra de MP
Base = "Bars-Base" # Imagm do fundo das barras
OnOff_Hud_Switch = 1 # Switch que ativa / desativa a HUD
Show_Hide_Button = Input::Tab # Tecla que mostra / esconde a HUD
Skill_Hud_X = 350
Item_Hud_X = 350
end
#------------------------------------------------------------------------------
class Window_CrissaegrimHud < Window_Base
def initialize
super(0,0,544,416)
self.opacity = 0
end
def update
@actor = $game_party.members[0]
self.contents.font.size = 16
self.contents.clear
skill_count = 0
if Crissaegrim_ABS::Skill_Button[@actor.id] != nil
for button in Crissaegrim_ABS::Skill_Button[@actor.id].keys
if button == nil
skill_count += 1
next
end
x = Crissaegrim_Hud::Skill_Hud_X
skill = $data_skills[Crissaegrim_ABS::Skill_Button[@actor.id][button]]
if skill == nil
skill_count += 1
next
end
show_icon(skill, (29 * skill_count) + x, 0)
skill_count += 1
end
end
item_count = 0
for btn in Crissaegrim_ABS::Item_Button.keys.sort
if btn == nil
item_count += 1
next
end
item = $data_items[Crissaegrim_ABS::Item_Button[btn]]
if item == nil
item_count += 1
next
end
x = Crissaegrim_Hud::Item_Hud_X
show_icon(item, (29 * item_count) + x, 356)
item_count += 1
self.contents.font.size = 18
self.contents.font.color = text_color(15)
self.contents.draw_text((29 * item_count) + x-32, 364, 32, 28, $game_party.item_number(item),1)
self.contents.font.size = 16
self.contents.font.color = text_color(0)
self.contents.draw_text((29 * item_count) + x-32, 365, 32, 28, $game_party.item_number(item),1)
end
refresh
end
def refresh
draw_hp(@actor, 0, 0)
draw_mp(@actor, 0, 24)
show_state(@actor, 130, 0)
end
def show_state(actor, x, y)
count = 0
for state in actor.states
draw_icon(state.icon_index, x, y + 24 * count)
count += 1
break if (24 * count > 76)
end
end
def show_icon(item, x, y)
if item != nil
draw_icon(item.icon_index, x, y)
end
end
def draw_hp(actor, x, y)
back = Cache.system(Crissaegrim_Hud::Base)
cw = back.width
ch = back.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x, y-ch+24, back, src_rect)
meter = Cache.system(Crissaegrim_Hud::HP_Bar)
cw = meter.width * actor.hp / actor.maxhp
ch = meter.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x+5, y-ch+17, meter, src_rect)
self.contents.font.size = Font.default_size
self.contents.draw_text(x,y-5,self.contents.text_size(Vocab.hp).width,24,Vocab.hp,0)
self.contents.draw_text(x+self.contents.text_size(Vocab.hp).width,y-5,back.width-30,24,actor.hp.to_s + "/" + actor.maxhp.to_s,2)
self.contents.font.size = 16
end
def draw_mp(actor, x, y)
back = Cache.system(Crissaegrim_Hud::Base)
cw = back.width
ch = back.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x, y-ch+24, back, src_rect)
meter = Cache.system(Crissaegrim_Hud::MP_Bar)
cw = meter.width * actor.mp / actor.maxmp
ch = meter.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(x+5, y-ch+17, meter, src_rect)
self.contents.font.size = Font.default_size
self.contents.draw_text(x,y-5,self.contents.text_size(Vocab.mp).width,24,Vocab.mp,0)
self.contents.draw_text(x+self.contents.text_size(Vocab.mp).width,y-5,back.width-30,24,actor.mp.to_s + "/" + actor.maxmp.to_s,2)
self.contents.font.size = 16
end
end
#------------------------------------------------------------------------------
class Scene_Map
alias crissaegrim_abs_hud_start start
alias crissaegrim_abs_hud_update update
alias crissaegrim_abs_hud_terminate terminate
def start
crissaegrim_abs_hud_start
if Crissaegrim_Hud::Background != ""
@bg = Sprite.new
@bg.bitmap = Cache.system(Crissaegrim_Hud::Background)
end
@hud = Window_CrissaegrimHud.new
showing_hud
@show = true
end
def update
crissaegrim_abs_hud_update
@bg.update if Crissaegrim_Hud::Background != ""
@hud.update
showing_hud
end
def terminate
crissaegrim_abs_hud_terminate
@bg.dispose if Crissaegrim_Hud::Background != ""
@hud.dispose
end
def showing_hud
if Input.trigger?(Crissaegrim_Hud::Show_Hide_Button)
if @show == true
@show = false
else
@show = true
end
end
if Crissaegrim_Hud::OnOff_Hud_Switch == 0 or $game_switches[Crissaegrim_Hud::OnOff_Hud_Switch] == true
if @show == true
@hud.visible = true
@bg.visible = true if Crissaegrim_Hud::Background != ""
elsif @show == false
@hud.visible = false
@bg.visible = false if Crissaegrim_Hud::Background != ""
end
else
@hud.visible = false
@bg.visible = false if Crissaegrim_Hud::Background != ""
end
end
end
Skill_Button[1] = {Input::Numberkeys[1] => 0, Input::Numberkeys[2] => 0, Input::Numberkeys[3] => 0,Input::Numberkeys[4] => 0,Input::Numberkeys[5] => 0,}
Skill_Button[10] = {Input::Numberkeys[1] => 0, Input::Numberkeys[2] => 0, Input::Numberkeys[3] => 0,Input::Numberkeys[4] => 0,Input::Numberkeys[5] => 0,}
Item_Button = { Input::Numberkeys[7] => 0, Input::Numberkeys[8] => 0,Input::Numberkeys[9] => 0,Input::Numberkeys[6] => 0,}