IceDragon200

Cheapo Stats Patch (RGSS3 Wrap)

Mar 17th, 2012
253
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 3.13 KB | None | 0 0
  1. # // Cheapo Stats Patch (RGSS3 Wrap)
  2. module Vocab
  3.   def self.param(id)
  4.     case id
  5.     when 0
  6.       return self.hp_a
  7.     when 1
  8.       return self.mp_a
  9.     when 2
  10.       return self.atk
  11.     when 3
  12.       return self.def()
  13.     when 4
  14.       return self.spi
  15.     when 5
  16.       return self.res
  17.     when 6
  18.       return self.agi
  19.     when 7
  20.       return self.dex
  21.     else
  22.       return ""  
  23.     end
  24.   #rescue
  25.   #  return ""
  26.   end
  27. end
  28. class Game_Battler
  29.   def param(id)
  30.     case id
  31.     when 0
  32.       return maxhp
  33.     when 1
  34.       return maxmp
  35.     when 2
  36.       return atk
  37.     when 3
  38.       return self.def()
  39.     when 4
  40.       return spi
  41.     when 5
  42.       return res
  43.     when 6
  44.       return agi
  45.     when 7
  46.       return dex
  47.     else
  48.       return 0    
  49.     end
  50.   #rescue
  51.   #  return -1  
  52.   end
  53. end
  54. class Window_Base
  55.   def draw_actor_parameter(actor, x, y, type)
  56.     parameter_name  = Vocab.param(type)
  57.     parameter_value = actor.param(type)
  58.     self.contents.font.color = system_color
  59.     self.contents.draw_text(x, y, 120, WLH, parameter_name)
  60.     self.contents.font.color = normal_color
  61.     self.contents.draw_text(x + 120, y, 36, WLH, parameter_value, 2)
  62.   end
  63. end  
  64. class Window_EquipStatus < Window_Base
  65.   def refresh
  66.     self.contents.clear
  67.     draw_actor_name(@actor, 4, 0)
  68.     for i in 0...6
  69.       draw_parameter(0, 16 * (i+1), i+2)
  70.     end
  71.   end
  72.   def set_new_parameters(*params)
  73.     @params ||= [nil]*8
  74.     if(@params != params)
  75.       @params = params
  76.       refresh
  77.     end
  78.   end
  79.   def draw_parameter(x, y, type)
  80.     @params ||= [nil]*8
  81.     name = Vocab.param(type)
  82.     value = @actor.param(type)
  83.     new_value = @params[type]
  84.     self.contents.font.color = system_color
  85.     self.contents.draw_text(x + 4, y, 80, WLH, name)
  86.     self.contents.font.color = normal_color
  87.     self.contents.draw_text(x + 90, y, 30, WLH, value, 2)
  88.     self.contents.font.color = system_color
  89.     self.contents.draw_text(x + 122, y, 20, WLH, ">", 1)
  90.     if new_value != nil
  91.       self.contents.font.color = new_parameter_color(value, new_value)
  92.       self.contents.draw_text(x + 142, y, 30, WLH, new_value, 2)
  93.     end
  94.   end
  95. end
  96. class FRV::Window_StatusBase < ::Window_Selectable
  97.   def draw_parameters( x, y, param_spacing=16)#WLH )
  98.     for i in 0...6
  99.       draw_actor_parameter(@actor, x, y + param_spacing * i, i+2)
  100.     end
  101.   end
  102. end  
  103. class FRV::Window_StatusMain < ::FRV::Window_StatusBase
  104.   def refresh()
  105.     create_contents()
  106.     draw_actor_face( @actor, 0, 0 )
  107.     draw_actor_name( @actor, 100, 4 )
  108.     draw_actor_hp( @actor, 100, 42 )
  109.     draw_actor_mp( @actor, 100, 56 )
  110.     draw_actor_level( @actor, 4, 96-24 )
  111.     draw_actor_state( @actor, 100, 26, 128 )
  112.     draw_parameters( self.width / 2, 0 )
  113.   end
  114. end
  115. class Scene_Equip
  116.   def update_status_window
  117.     if @equip_window.active
  118.       @status_window.set_new_parameters(*([nil]*8))
  119.     elsif @item_window.active
  120.       temp_actor = @actor.clone
  121.       temp_actor.change_equip(@equip_window.index, @item_window.item, true)
  122.       @status_window.set_new_parameters(*(0...8).to_a.collect{|i|temp_actor.param(i)})
  123.     end
  124.     @status_window.update
  125.   end
  126. end
Advertisement
Add Comment
Please, Sign In to add comment