Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- module Dhoom
- module LivingLiveHUD
- WWIDTH = 300
- WHEIGHT = 152
- WX = 0
- WY = Graphics.height - WHEIGHT
- VAR_STAMINA = 1
- VAR_MAX_STAMINA = 5
- VAR_INT = 6
- VAR_INT_EXP = 7
- VAR_CHR = 8
- VAR_CHR_EXP = 9
- VAR_STR = 10
- VAR_STR_EXP = 11
- STAMINA_COLOR1 = Color.new(0,128,0)
- STAMINA_COLOR2 = Color.new(0,255,0)
- INT_COLOR1 = Color.new(0,0,128)
- INT_COLOR2 = Color.new(0,0,255)
- CHR_COLOR1 = Color.new(128,128,128)
- CHR_COLOR2 = Color.new(255,255,255)
- STR_COLOR1 = Color.new(128,0,0)
- STR_COLOR2 = Color.new(255,0,0)
- HUD_SWITCH = 1
- end
- end
- class Window_HUD < Window_Base
- include Dhoom::LivingLiveHUD
- def initialize
- super(WX,WY,WWIDTH,WHEIGHT)
- self.opacity = 0
- @actor = $game_party.members[0]
- refresh
- end
- def refresh
- contents.clear
- draw_face(@actor.face_name, @actor.face_index, 0, 0)
- contents.font.size = 24
- draw_currency_value($game_party.gold, Vocab::currency_unit, 0, 100, 96)
- contents.font.color = normal_color
- draw_actor_name
- draw_stamina
- draw_int
- draw_int_exp
- draw_chr
- draw_chr_exp
- draw_str
- draw_str_exp
- end
- def draw_actor_name
- contents.font.size = 28
- draw_text(98, 0, contents.width-98, 28, @actor.name, 1)
- contents.font.size = 24
- end
- def draw_stamina
- @stamina = $game_variables[VAR_STAMINA]
- @stamina_max = $game_variables[VAR_MAX_STAMINA]
- return if @stamina_max == 0
- draw_gauge(98, 34, contents.width-98, line_height-8, @stamina.to_f/@stamina_max, STAMINA_COLOR1, STAMINA_COLOR2)
- contents.font.size = 18
- draw_text(98, 30, contents.width-98, line_height, "Stamina: #{@stamina} / #{@stamina_max}", 1)
- contents.font.size = 18
- end
- def draw_int
- @int = $game_variables[VAR_INT]
- draw_text(98, 30+line_height, (contents.width-98)/2, line_height, "INT: #{@int}")
- end
- def draw_int_exp
- @int_exp = $game_variables[VAR_INT_EXP]
- draw_gauge(98+(contents.width-98)/2, 34+line_height, (contents.width-98)/2, line_height-8, @int_exp/100.0, INT_COLOR1, INT_COLOR2)
- contents.font.size = 18
- draw_text(98+(contents.width-98)/2, 30+line_height, (contents.width-98)/2, line_height, "EXP: #{@int_exp} / 100", 1)
- end
- def draw_chr
- @chr = $game_variables[VAR_CHR]
- draw_text(98, 30+line_height*2, (contents.width-98)/2, line_height, "CHR: #{@chr}")
- end
- def draw_chr_exp
- @chr_exp = $game_variables[VAR_CHR_EXP]
- draw_gauge(98+(contents.width-98)/2, 34+line_height*2, (contents.width-98)/2, line_height-8, @chr_exp/100.0, CHR_COLOR1, CHR_COLOR2)
- contents.font.size = 18
- draw_text(98+(contents.width-98)/2, 30+line_height*2, (contents.width-98)/2, line_height, "EXP: #{@chr_exp} / 100", 1)
- end
- def draw_str
- @str = $game_variables[VAR_STR]
- draw_text(98, 30+line_height*3, (contents.width-98)/2, line_height, "STR: #{@str}")
- end
- def draw_str_exp
- @str_exp = $game_variables[VAR_STR_EXP]
- draw_gauge(98+(contents.width-98)/2, 34+line_height*3, (contents.width-98)/2, line_height-8, @str_exp/100.0, STR_COLOR1, STR_COLOR2)
- contents.font.size = 18
- draw_text(98+(contents.width-98)/2, 30+line_height*3, (contents.width-98)/2, line_height, "EXP: #{@str_exp} / 100", 1)
- end
- def draw_gauge(x, y, width, height, rate, color1, color2)
- fill_w = (width * rate).to_i
- contents.fill_rect(x, y, width, height, gauge_back_color)
- contents.gradient_fill_rect(x, y, fill_w, height, color1, color2)
- end
- def update
- super
- refresh if something_changed?
- end
- def something_changed?
- return true if @stamina != $game_variables[VAR_STAMINA]
- return true if @stamina_max != $game_variables[VAR_MAX_STAMINA]
- return true if @int != $game_variables[VAR_INT]
- return true if @chr != $game_variables[VAR_CHR]
- return true if @str != $game_variables[VAR_STR]
- return true if @int_exp != $game_variables[VAR_INT_EXP]
- return true if @chr_exp != $game_variables[VAR_CHR_EXP]
- return true if @str_exp != $game_variables[VAR_STR_EXP]
- return false
- end
- end
- class Scene_Map < Scene_Base
- include Dhoom::LivingLiveHUD
- alias dhoom_hudlivliv_scmap_create_all_windows create_all_windows
- def create_all_windows
- dhoom_hudlivliv_scmap_create_all_windows
- @hud_window = Window_HUD.new
- @hud_window.z = 9999
- @hud_window.openness = 0 unless $game_switches[HUD_SWITCH]
- end
- alias dhoom_hudlivliv_scmap_update update
- def update
- dhoom_hudlivliv_scmap_update
- if $game_switches[HUD_SWITCH]
- @hud_window.open
- else
- @hud_window.close
- end
- end
- end
Add Comment
Please, Sign In to add comment