class Window_Base
def draw_actor_hp(actor, x, y, width = 144, text = true)
# Draw hp bar
bitmap = RPG::Cache.acms_menusprite("HP")
rect = Rect.new(x + BAR_PADDING, y, (width - 2 * BAR_PADDING) * actor.hp / actor.maxhp, bitmap.height)
self.contents.stretch_blt(rect, bitmap, Rect.new(0, 0,
bitmap.width * actor.hp / actor.maxhp, bitmap.height), opacity)
bitmap = RPG::Cache.acms_menusprite("Gauge")
rect = []
w = bitmap.width / 3
for i in 0...3
rect << Rect.new(i * w, 0, w, bitmap.height)
end
self.contents.blt(x, y, bitmap, rect[0], opacity)
i = w
while i < width - 2 * w
self.contents.blt(x + i, y, bitmap, rect[1], opacity)
i += w
end
rect[1].width = (width - 1) % w + 1
self.contents.blt(x + i, y, bitmap, rect[1], opacity)
i += (width - 1) % w + 1
self.contents.blt(x + i, y, bitmap, rect[2], opacity)
# Draw hp name
rect = self.contents.text_size($data_system.words.hp)
self.contents.draw_text(x, y + (bitmap.height - rect.height) / 2, 32, 32, $data_system.words.hp, opacity)
self.contents.font.color = Color.new(255,255,255)
sz = self.contents.font.size
self.contents.font.size = 18
self.contents.font.bold = true
self.contents.draw_text_outline(x-16, y-8, width, 32, sprintf("%4d/%4d", actor.hp, actor.maxhp),2)
self.contents.font.size = sz
self.contents.font.bold = false
end
def draw_actor_sp(actor, x, y, width = 144, text = true)
# Draw sp bar
bitmap = RPG::Cache.acms_menusprite("SP")
rect = Rect.new(x + BAR_PADDING, y, (width - 2 * BAR_PADDING) * actor.sp / actor.maxsp, bitmap.height)
self.contents.stretch_blt(rect, bitmap, Rect.new(0, 0,
bitmap.width * actor.sp / actor.maxsp, bitmap.height), opacity)
bitmap = RPG::Cache.acms_menusprite("Gauge")
rect = []
w = bitmap.width / 3
for i in 0...3
rect << Rect.new(i * w, 0, w, bitmap.height)
end
self.contents.blt(x, y, bitmap, rect[0], opacity)
i = w
while i < width - 2 * w
self.contents.blt(x + i, y, bitmap, rect[1], opacity)
i += w
end
rect[1].width = (width - 1) % w + 1
self.contents.blt(x + i, y, bitmap, rect[1], opacity)
i += (width - 1) % w + 1
self.contents.blt(x + i, y, bitmap, rect[2], opacity)
# Draw sp name
rect = self.contents.text_size($data_system.words.sp)
self.contents.draw_text(x, y + (bitmap.height - rect.height) / 2, 32, 32, $data_system.words.sp, opacity)
self.contents.font.color = Color.new(255,255,255)
sz = self.contents.font.size
self.contents.font.size = 18
self.contents.font.bold = true
self.contents.draw_text_outline(x-16, y-8, width, 32, sprintf("%4d/%4d", actor.sp, actor.maxsp),2)
self.contents.font.bold = false
self.contents.font.size = sz
end
end
class Bitmap
def draw_text_outline(x,y,w,h,s,align=0)
c = font.color.dup
font.color = Color.new(0,0,0)
draw_text(x, y+1 ,w ,h,s,align)
draw_text(x+2,y+1 ,w,h,s,align)
draw_text(x+1,y ,w,h ,s,align)
draw_text(x+1,y+2 ,w,h,s,align)
font.color = c
mp_draw_text(x+1, y+1 ,w,h,s,align)
end
end
class Window_Status < Window_Base
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
draw_actor_graphic(@actor, 16, 48)
draw_actor_name(@actor, 40, 0)
#draw_actor_class(@actor, 160, 0)
draw_actor_level(@actor, 160, 0)
draw_actor_state(@actor, 224, 0)
draw_actor_hp(@actor, 64, 44, 192, true)
draw_actor_sp(@actor, 64, 64, 192, true)
self.contents.font.color = system_color
self.contents.draw_text(0, 88, 40, 32, "EXP")
self.contents.draw_text(128, 88, 40, 32, "NEXT")
self.contents.font.color = normal_color
self.contents.draw_text(24, 88, 80, 32, @actor.exp_s, 2)
self.contents.draw_text(152, 88, 80, 32, @actor.next_rest_exp_s, 2)
draw_actor_parameter(@actor, 0, 120, 0)
draw_actor_parameter(@actor, 0, 144, 1)
draw_actor_parameter(@actor, 0, 168, 2)
draw_actor_parameter(@actor, 0, 192, 3)
draw_actor_parameter(@actor, 0, 216, 4)
draw_actor_parameter(@actor, 0, 240, 5)
draw_actor_parameter(@actor, 0, 264, 6)
draw_item_name($data_weapons[@actor.weapon_id], 120, 120, 136)
draw_item_name($data_armors[@actor.armor1_id], 120, 152, 136)
draw_item_name($data_armors[@actor.armor2_id], 120, 184, 136)
draw_item_name($data_armors[@actor.armor3_id], 120, 216, 136)
draw_item_name($data_armors[@actor.armor4_id], 120, 248, 136)
end
end
class Game_Map
attr_reader :cur_reg
end
class Window_Base
def draw_info(type, align)
icon = nil
text = nil
number = nil
case type
# Gold
when GOLD
icon = ICON_GOLD
number = $game_party.gold
text = $data_system.words.gold
size = 32 + SPACING_BIG * (number.to_s.size + 1) + self.contents.text_size(text).width
fnt = FNT_GOLD
# Location
when LOCATION
icon = ICON_LOCATION
text = zen_get_location_name
size = 32 + self.contents.text_size(text).width
# Time
when TIME
icon = ICON_TIME
t = Graphics.frame_count / Graphics.frame_rate
number = sprintf("%02d:%02d:%02d", t / 3600, (t / 60) % 60, t % 60)
size = 32 + SPACING_BIG * number.to_s.size
fnt = FNT_TIME
end
case align
# Left
when 0
x = 12
# Middle
when 1
x = (self.contents.width - size) / 2
# Right
when 2
x = self.contents.width - size - 12
end
# Draw icon
if icon
self.contents.blt(x, (self.contents.height - 24) / 2, icon, icon.rect)
x += 32
end
# Draw number
if number
self.contents.draw_number(x, (self.contents.height - fnt.height) / 2, number, fnt, SPACING_BIG)
x += SPACING_BIG * (number.to_s.size + 1)
end
# Draw text
if text
rect = self.contents.text_size(text)
self.contents.draw_text(x, (self.contents.height - rect.height) / 2, 200, 32, text, 0)
x += rect.width
end
end
def zen_get_location_name
$game_map.check_current_region
regions = [$data_mapinfos[$game_map.map_id].name]
if $game_map.cur_reg.length > 0
regions = []
for i in $game_map.cur_reg
regions.push REGIONS.regions($game_map.map_id)[i][0]
end
end
return regions.join(", ")
end
end