Advertisement
roninator2

Neon Black Victory Grade addon - KMS gauges

Dec 5th, 2024
27
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 3.20 KB | None | 0 0
  1. #==============================================================================
  2. # Compatibility Patch :                                         v1.0 (05/10/20)
  3. #   Neon Black Victory Grade + KMS Generic Gauge
  4. #==============================================================================
  5. # Script by:
  6. #     Mr. Bubble - recreated by Roninator2
  7. #--------------------------------------------------------------------------
  8. # Place this script below both Neon Black Victory Grade and KMS Generic Gauge
  9. # in your script edtior.
  10. #
  11. #==============================================================================
  12.  
  13. $imported ||= {}
  14. $kms_imported ||= {}
  15.  
  16. module Bubs
  17.   module GGPatch
  18.     # * Gauge File Names
  19.     #  Images must be placed in the "Graphics/System" folder of your project
  20.     GRADE_EXP_IMAGE = "GaugeHP"
  21.  
  22.     # * Gauge Position Offset [x, y]
  23.     GRADE_EXP_OFFSET = [-25, -2]
  24.  
  25.     # * Gauge Length Adjustment
  26.     GRADE_EXP_LENGTH = -40
  27.  
  28.     # * Gauge Slope
  29.     #   Must be between -89 ~ 89 degrees
  30.     GRADE_EXP_SLOPE = 30
  31.   end
  32. end
  33.  
  34. if $imported['CP_VICTORY'] && $kms_imported["GenericGauge"]
  35. class Window_VictoryMain < Window_Selectable
  36.  
  37.   def draw_actor_exp_info(actor, x, y, width, aexp = 0)
  38.     x += (width - 96) / 2
  39.     width = [width, 96].min
  40.     aexr = aexp * actor.exr
  41.     cexp = actor.exp - actor.current_level_exp
  42.     nexp = actor.next_level_exp - actor.current_level_exp
  43.     if cexp - aexr >= 0
  44.       rate = cexp.to_f / nexp
  45.       rate = 1.0 if rate > 1.0
  46.       gc1 = text_color(CP::VICTORY::EXP_ADDED)
  47.       gc2 = text_color(CP::VICTORY::EXP_ADDED)
  48.       draw_actor_exp_gauge(actor, x, y, width)
  49.       cexp -= aexr
  50.       rate = cexp.to_f / nexp
  51.       rate = 1.0 if rate > 1.0
  52.       rate = 1.0 if actor.level == actor.max_level
  53.       gc1 = text_color(CP::VICTORY::EXP_GAUGE_1)
  54.       gc2 = text_color(CP::VICTORY::EXP_GAUGE_2)
  55.       draw_gauge_clear(x, y, width, rate, gc1, gc2)
  56.     else
  57.       rate = 1.0
  58.       gc1 = text_color(CP::VICTORY::EXP_ADDED)
  59.       gc2 = text_color(CP::VICTORY::EXP_ADDED)
  60.       draw_actor_exp_gauge(actor, x, y, width)
  61.       cexp = actor.exp - actor.last_level_exp - aexr
  62.       nexp = actor.current_level_exp - actor.last_level_exp
  63.       rate = cexp.to_f / nexp
  64.       gc1 = text_color(CP::VICTORY::EXP_GAUGE_1)
  65.       gc2 = text_color(CP::VICTORY::EXP_GAUGE_2)
  66.       draw_gauge_clear(x, y, width, rate, gc1, gc2)
  67.       change_color(normal_color)
  68.       draw_text(x, y, width, line_height, CP::VICTORY::LEVEL_UP, 1)
  69.       @leveled.push(actor)
  70.     end
  71.   end
  72.   def draw_top_exp_gauge(file, x, y, width, ratio, offset, len_offset, slope,
  73.                          gauge_type = :normal)
  74.     img    = Cache.system(file)
  75.     x     += offset[0]
  76.     y     += offset[1]
  77.     width += len_offset
  78.     gw = (width * ratio).to_i
  79.     draw_generic_gauge_bar(img, x, y, width, gw, slope, GAUGE_SRC_POS[gauge_type])
  80.   end
  81.   def draw_gauge_clear(x, y, width, rate, color1, color2)
  82.     file = Bubs::GGPatch::GRADE_EXP_IMAGE
  83.     offset = Bubs::GGPatch::GRADE_EXP_OFFSET
  84.     len_offset = Bubs::GGPatch::GRADE_EXP_LENGTH
  85.     slope = Bubs::GGPatch::GRADE_EXP_SLOPE
  86.     draw_top_exp_gauge(file, x, y, width, rate, offset, len_offset, slope)
  87.   end
  88.  
  89. end
  90. end # if $imported
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement