TheoAllen

Item Record Checker

Aug 29th, 2013
251
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.95 KB | None | 0 0
  1. class Game_Party < Game_Unit
  2.  
  3.   alias theo_invcheck_init initialize
  4.   def initialize
  5.     theo_invcheck_init
  6.     init_inv_checker
  7.   end
  8.  
  9.   def init_inv_checker
  10.     @item_records = []
  11.     @weapon_records = []
  12.     @armor_records = []
  13.   end
  14.  
  15.   alias theo_invcheck_gain_item gain_item
  16.   def gain_item(item, amount, include_equip = false)
  17.     add_record(item)
  18.     theo_invcheck_gain_item(item, amount, include_equip)
  19.   end
  20.  
  21.   def check_record(item)
  22.     case item.class
  23.     when RPG::Item
  24.       return @item_records.include?(item.id)
  25.     when RPG::Weapon
  26.       return @weapon_records.include?(item.id)
  27.     when RPG::Armor
  28.       return @armor_records.include?(item.id)
  29.     end
  30.   end
  31.  
  32.   def add_record(item)
  33.     case item.class
  34.     when RPG::Item
  35.       @item_records.push(item.id).uniq!
  36.     when RPG::Weapon
  37.       @weapon_records.push(item.id).uniq!
  38.     when RPG::Armor
  39.       @armor_records.push(item.id).uniq!
  40.     end
  41.   end
  42.  
  43. end
Advertisement
Add Comment
Please, Sign In to add comment