blob: 86757d89d13c19099a0a3470d5643e915317a19b (
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
27
28
29
30
|
class Characters::HearthController < ApplicationController
def index
@all_amenities = HearthAmenity.all.order(:id)
@construct_activities = Activity.where("gid like ?", "construct_%")
@amenity_activities = {
forge: [],
labratory: [],
spicebench: [],
}
Activity.where("gid like ?", "craft_%").each do |activity|
next unless current_char.can_do_activity?(activity, ignore_cost: true, ignore_requirements: true)
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
when "spicebench"
@amenity_activities[:spicebench].push(activity) && next
else
raise "Invalid amenity gid (#{requirement_data[:gid]}"
end
end
end
end
end
end
|