summaryrefslogtreecommitdiff
path: root/app/controllers
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/characters/hearth_controller.rb21
1 files changed, 20 insertions, 1 deletions
diff --git a/app/controllers/characters/hearth_controller.rb b/app/controllers/characters/hearth_controller.rb
index abe8232..02b8446 100644
--- a/app/controllers/characters/hearth_controller.rb
+++ b/app/controllers/characters/hearth_controller.rb
@@ -2,6 +2,25 @@ class Characters::HearthController < ApplicationController
def index
@all_amenities = HearthAmenity.all
@construct_activities = Activity.where("gid like ?", "construct_%")
- @forge_activities = Activity.where("gid like ?", "craft_%")
+
+ @amenity_activities = {
+ forge: [],
+ labratory: [],
+ }
+
+ Activity.where("gid like ?", "craft_%").each do |activity|
+ activity.whatnot[:requirements]&.each do |requirement_data|
+ if requirement_data[:type] == "hearth_amenity"
+ case requirement_data[:gid]
+ when "forge"
+ @amenity_activities[:forge].push(activity) && next
+ when "labratory"
+ @amenity_activities[:labratory].push(activity) && next
+ else
+ raise "Invalid amenity gid (#{requirement_data[:gid]}"
+ end
+ end
+ end
+ end
end
end