ForeverZer0

[RMXP] Item Weight Addon - Menu

Apr 16th, 2012
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 1.77 KB | None | 0 0
  1. #===============================================================================
  2. # * Window_Base
  3. #===============================================================================
  4.  
  5. class Window_Base
  6.   #-----------------------------------------------------------------------------
  7.   # * draw_actor_weight
  8.   #     Draws the actor's weight/capacity at given location
  9.   #-----------------------------------------------------------------------------
  10.   def draw_actor_weight(actor, x, y, width = 144)
  11.     self.contents.font.color = system_color
  12.     self.contents.draw_text(x, y, 32, 32, 'WT')
  13.     color = actor.weight > actor.weight_capacity ? crisis_color : normal_color
  14.     self.contents.font.color = color
  15.     if width - 32 >= 108
  16.       wt_x = x + width - 108
  17.       flag = true
  18.     elsif width - 32 >= 48
  19.       wt_x = x + width - 48
  20.       flag = false
  21.     end    
  22.     self.contents.draw_text(wt_x, y, 48, 32, actor.weight.to_s, 2)
  23.     if flag
  24.       self.contents.font.color = normal_color
  25.       self.contents.draw_text(wt_x + 48, y, 12, 32, '/', 1)
  26.       self.contents.draw_text(wt_x + 60, y, 48, 32, actor.weight_capacity.to_s)
  27.     end
  28.   end
  29. end
  30.  
  31. #===============================================================================
  32. # * Window_MenuStatus
  33. #===============================================================================
  34.  
  35. class Window_MenuStatus
  36.   #-----------------------------------------------------------------------------
  37.   # * refresh
  38.   #     Draws each actor's weight/capacity on the menu
  39.   #-----------------------------------------------------------------------------
  40.   alias item_weight_refresh refresh
  41.   def refresh
  42.     item_weight_refresh
  43.     $game_party.actors.each_index {|i|
  44.       draw_actor_weight($game_party.actors[i], 300, i * 116) }
  45.   end
  46. end
Add Comment
Please, Sign In to add comment