diff options
author | David Gay <david@davidgay.org> | 2021-05-25 22:02:33 -0400 |
---|---|---|
committer | David Gay <david@davidgay.org> | 2021-05-25 22:02:33 -0400 |
commit | c4ba54f606c0c4cc5eaa78e108f6529187de3d78 (patch) | |
tree | 775adc8b06a7f04fd5cc2df58e83c985cb6dcbb2 /app/models | |
parent | 4d68d3dc80138e6cc6a3cbec001dbd77e85649cc (diff) |
Improve hearth crafting selection
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/hearth.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/app/models/hearth.rb b/app/models/hearth.rb index 5d244ec..1bd54a5 100644 --- a/app/models/hearth.rb +++ b/app/models/hearth.rb @@ -9,4 +9,10 @@ class Hearth < ApplicationRecord return false unless bhi bhi.level >= level end + + def amenity_level(hearth_amenity) + hearth_amenity = HearthAmenity.find_by_gid(hearth_amenity) if hearth_amenity.is_a? String + bhi = self.built_hearth_amenities.find_by(hearth_amenity: hearth_amenity) + bhi ? bhi.level : 0 + end end |