Advertisement
TheSixth

EXP Bar Fix for Falcao's ABS

Jun 24th, 2016
319
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 1.60 KB | None | 0 0
  1. =begin
  2.  
  3. EXP Bar Fix for Falcao's ABS
  4. Made by: Sixth
  5.  
  6. What is fixed:
  7. - The displayed XP bar did not show the correct values.
  8. - The XP bar could get out of scope (over max limit) after the player reaches
  9.   the maximum level.
  10.  
  11. Installation:
  12. - Put this script below the Falcao's ABS scripts!
  13.  
  14. =end
  15.  
  16. module PearlKernel
  17.  
  18.   def self.draw_gauge(obj, nm, max, x, y, w, h, col, tag, name)
  19.     obj.font.shadow = true
  20.     w2 = w - 2 ; max = 1 if max == 0
  21.     obj.fill_rect(x, y - 1, w, h + 2, @gaugeback)
  22.     obj.fill_rect(x+1, y+1, w2*[nm.to_f/max,1].min, h/2 - 1, col[0])
  23.     obj.fill_rect(x+1, y + h/2, w2*[nm.to_f/max,1].min, h/2 - 1, col[1])
  24.     txt = tag == 'Exp' && nm.to_f / max > 1 ? "-------" : nm.to_s+"/"+max.to_s
  25.     obj.draw_text(x, y + h - 22, w, 32, txt, 2)
  26.     obj.draw_text(x + 4, y + h - 22, w, 32, tag)
  27.     obj.draw_text(x, y - 25, w, 32, name, 1) if !name.nil?
  28.   end
  29.  
  30.   def self.draw_i_gauge(bitmap, x, y, back, image, nm, max, tag, name)
  31.     cw = back.width  
  32.     ch = back.height
  33.     max = 1 if max == 0
  34.     src_rect = Rect.new(0, 0, cw, ch)    
  35.     bitmap.blt(x - 10, y - ch + 30,  back, src_rect)
  36.     cw = image.width  * [nm.to_f / max, 1].min
  37.     ch = image.height
  38.     src_rect = Rect.new(0, 0, cw, ch)
  39.     txt = tag == 'Exp' && nm.to_f / max > 1 ? "-------" : nm.to_s+"/"+max.to_s
  40.     bitmap.blt(x - 10, y - ch + 30, image, src_rect)
  41.     bitmap.draw_text(x - 4, y + back.height - 14, back.width, 32, tag)
  42.     bitmap.draw_text(x - 12, y + back.height - 14, back.width, 32, txt, 2)
  43.     bitmap.draw_text(x - 6, y - 10, back.width, 32, name, 1) if !name.nil?
  44.   end
  45.  
  46. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement