ForeverZer0

[RMXP] Item Weight Addon - Shop

Apr 16th, 2012
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 1.93 KB | None | 0 0
  1. #===============================================================================
  2. # * Scene_Shop
  3. #===============================================================================
  4.  
  5. class Scene_Shop
  6.   #-----------------------------------------------------------------------------
  7.   # * update_number
  8.   #     Prevents purchasing of items when OVERWEIGHT_PARTY is true and number
  9.   #     of items to buy would exceed maximum weight
  10.   #-----------------------------------------------------------------------------
  11.   alias item_weight_update_number update_number
  12.   def update_number
  13.     unless Weight::OVERWEIGHT_PARTY
  14.       if Input.trigger?(Input::C) && @command_window.index == 0
  15.         weight = @item.weight * @number_window.number
  16.         weight += $game_party.total_weight
  17.         if weight > $game_party.weight_capacity
  18.           $game_system.se_play($data_system.buzzer_se)
  19.           return
  20.         end
  21.       end
  22.     end
  23.     item_weight_update_number
  24.   end
  25. end
  26.  
  27. #===============================================================================
  28. # * Window_ShopNumber
  29. #===============================================================================
  30.  
  31. class Window_ShopNumber
  32.   #-----------------------------------------------------------------------------
  33.   # * refresh
  34.   #     Adds a weight display to the number screen at the shop
  35.   #-----------------------------------------------------------------------------
  36.   alias item_weight_refresh refresh
  37.   def refresh
  38.     item_weight_refresh
  39.     weight = (@item.weight * @number) + $game_party.total_weight
  40.     capacity = $game_party.weight_capacity
  41.     self.contents.draw_text(4, 192, 72, 32, 'Weight:')
  42.     color = weight > capacity ? crisis_color : normal_color
  43.     self.contents.font.color = color
  44.     self.contents.draw_text(76, 192, 64, 32, weight.to_s, 2)
  45.     self.contents.font.color = normal_color
  46.     self.contents.draw_text(144, 192, 64, 32, '/ ' + capacity.to_s)
  47.   end
  48. end
Add Comment
Please, Sign In to add comment