diff options
Diffstat (limited to 'app/models/item.rb')
-rw-r--r-- | app/models/item.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/app/models/item.rb b/app/models/item.rb index 1ef5d7d..8b80788 100644 --- a/app/models/item.rb +++ b/app/models/item.rb @@ -17,4 +17,17 @@ class Item < ApplicationRecord return [] unless self.equipment? self.whatnot[:equip_slots].map { |data| data.to_sym } end + + def equip_requirements + requirements = [] + self.whatnot[:equip_requirements]&.each do |req| + case req[:type] + when "skill" + requirements.push "level #{req[:level]} #{Skill.find_by_gid(req[:gid]).name}" + else + raise "Invalid equip requirement type string (#{req[:type]})" + end + end + requirements + end end |