blob: 02b84462d27e53fa2c04d0079cbbf566ec13c43e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
class Characters::HearthController < ApplicationController
def index
@all_amenities = HearthAmenity.all
@construct_activities = Activity.where("gid like ?", "construct_%")
@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
|