Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # =============================================================================
- module PearlBars
- HP_BarDimentions = [96 + 12, 16, 118, 14]
- MP_BarDimentions = [96 + 12, 36, 118, 14]
- EX_BarDimentions = [96 + 12, 57, 118, 10]
- TP_Info = [96 + 12, 64]
- end
- # =============================================================================
- module PearlKernel
- def self.draw_exp(obj, battler, x, y, w, h, color, name=nil)
- tag = 'Inv' ; c = color
- name = battler.name if !name.nil?
- draw_gauge_exc(obj,$game_party.total_inv_size, $game_party.inv_max, x, y, w,
- h, c, tag,name)
- end
- # exclusive
- def self.draw_gauge_exc(obj, nm, max, x, y, w, h, col, tag, name)
- obj.font.shadow = true
- w2 = w - 2 ; max = 1 if max == 0
- obj.fill_rect(x, y - 1, w, h + 2, @gaugeback)
- obj.fill_rect(x+1, y+1, w2*nm/max, h/2 - 1, col[0])
- obj.fill_rect(x+1, y + h/2, w2*nm/max, h/2 - 1, col[1])
- obj.draw_text(x, y + h - 22, w, 32, nm.to_s + "/" + max.to_s, 2)
- obj.draw_text(x + 4, y + h - 22, w, 32, tag)
- obj.draw_text(x, y - 25, w, 32, name, 1) if !name.nil?
- end
- end
- class Sprite_LifeBars < Sprite
- def refresh_contents
- self.bitmap.clear
- self.bitmap.font.size = 19
- @erasetimer = 180
- self.opacity = 255
- if battler.is_a?(Game_Actor)
- # also this part
- draw_actor_face(battler, 8, 16)
- @old_exp = $game_party.total_inv_size
- @old_tp = battler.tp
- self.x = ScreenPos_X
- self.y = ScreenPos_Y
- h = HP_BarDimentions ; m = MP_BarDimentions ; e = EX_BarDimentions
- if PearlBars::ActorsHp != ""
- @pimg = Cache.picture(PearlBars::ActorsHp) if @pimg.nil?
- @bimg = Cache.picture(PearlBars::ActorsBack) if @bimg.nil?
- @pimp = Cache.picture(PearlBars::ActorsMp) if @pimp.nil?
- PearlKernel.image_hp(self.bitmap, h[0] + 4, h[1],@bimg,
- @pimg, battler,true)
- PearlKernel.image_mp(self.bitmap, m[0] + 4, m[1], @bimg, @pimp, battler)
- if PearlBars::ActorsExp != ""
- @piexp = Cache.picture(PearlBars::ActorsExp) if @piexp.nil?
- PearlKernel.image_exp(self.bitmap,e[0] + 4,e[1],@bimg,@piexp, battler)
- end
- else
- hc = HP_Color ; mc = MP_Color ; ec = EX_Color
- PearlKernel.draw_hp(self.bitmap,battler, h[0], h[1], h[2], h[3], hc)
- PearlKernel.draw_mp(self.bitmap,battler, m[0], m[1], m[2], m[3], mc)
- PearlKernel.draw_exp(self.bitmap,battler, e[0], e[1], e[2], e[3], ec)
- end
- PearlKernel.draw_tp(self.bitmap, TP_Info[0], TP_Info[1], battler)
- else battler.is_a?(Game_Enemy)
- if boss?
- self.x = BeScreenPos_X
- self.y = BeScreenPos_Y
- h = BHP_BarDimentions ; hc = BHP_Color
- if PearlBars::BossEne != ""
- @n_img = Cache.picture(PearlBars::BossEne) if @n_img.nil?
- @n_back = Cache.picture(PearlBars::BossBack) if @n_back.nil?
- PearlKernel.image_hp(self.bitmap, h[0] + 4, h[1],@n_back,
- @n_img, battler,true)
- else
- PearlKernel.draw_hp(self.bitmap,battler, h[0],h[1],h[2], h[3],hc,true)
- end
- else
- self.x = NeScreenPos_X
- self.y = NeScreenPos_Y
- h = EHP_BarDimentions ; hc = EHP_Color
- if PearlBars::NormalEne != ""
- @n_img = Cache.picture(PearlBars::NormalEne) if @n_img.nil?
- @n_back = Cache.picture(PearlBars::NormalBack) if @n_back.nil?
- PearlKernel.image_hp(self.bitmap, h[0] + 4, h[1],@n_back,
- @n_img, battler,true)
- else
- PearlKernel.draw_hp(self.bitmap,battler,h[0],h[1],h[2], h[3], hc,true)
- end
- end
- end
- end
- def update
- super
- if battler.nil?
- dispose
- return
- end
- if @old_hp != battler.hp
- refresh_contents
- @old_hp = battler.hp
- end
- if @old_mp != battler.mp
- refresh_contents
- @character.actor.apply_usability if @character.is_a?(Game_Player)
- @old_mp = battler.mp
- end
- if battler.is_a?(Game_Actor)
- # Edited this part
- if @old_exp != $game_party.total_inv_size
- @old_exp = $game_party.total_inv_size
- refresh_contents
- end
- if @old_tp != battler.tp
- @old_tp = battler.tp
- @character.actor.apply_usability if @character.is_a?(Game_Player)
- refresh_contents
- end
- elsif battler.is_a?(Game_Enemy)
- if boss?
- dispose if battler.dead?
- else
- if @erasetimer > 0
- @erasetimer -= 1
- self.opacity -= 10 if @erasetimer <= 25
- @states.opacity = self.opacity if !@states.nil?
- dispose if @erasetimer == 0
- end
- end
- update_enemy_status_icons
- end
- end
- def draw_face(face_name, face_index, x, y, enabled = true)
- bitmap = Cache.face(face_name)
- rect = Rect.new(face_index % 4 * 96, face_index / 4 * 96, 96, 96)
- self.bitmap.blt(x, y, bitmap, rect, enabled ? 255 : 128)
- bitmap.dispose
- end
- def draw_actor_face(actor, x, y, enabled = true)
- draw_face(actor.face_name, actor.face_index, x, y, enabled)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment