summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/controllers/characters/spells_controller.rb4
-rw-r--r--app/lib/activity_processor.rb4
-rw-r--r--app/views/application/_results.html.erb6
3 files changed, 13 insertions, 1 deletions
diff --git a/app/controllers/characters/spells_controller.rb b/app/controllers/characters/spells_controller.rb
index a0e6913..b98c1c3 100644
--- a/app/controllers/characters/spells_controller.rb
+++ b/app/controllers/characters/spells_controller.rb
@@ -1,6 +1,8 @@
class Characters::SpellsController < ApplicationController
def index
- @spell_activities = Activity.where("gid like ?", "havencast_%").where(innate: true).order(:name)
+ @spell_activities = Activity.where("gid like ?", "havencast_%")
+ .or(Activity.where("gid like ?", "worldcall_%"))
+ .where(innate: true).order(:name)
# TODO: Don't load into memory
@spell_activities = @spell_activities.to_a + current_char.learned_activities
.map { |la| la.activity }
diff --git a/app/lib/activity_processor.rb b/app/lib/activity_processor.rb
index 72aa85d..3f62d28 100644
--- a/app/lib/activity_processor.rb
+++ b/app/lib/activity_processor.rb
@@ -111,6 +111,10 @@ class ActivityProcessor
end
end
end
+ when "hearth_location"
+ location = @character.hearth&.location || Location.find_by_gid("floret")
+ @character.update(location: location)
+ @results.push({ type: type, location: location })
else
raise "Invalid result type (#{type})" # TODO: Improve this.
end
diff --git a/app/views/application/_results.html.erb b/app/views/application/_results.html.erb
index a7dc002..d1ec927 100644
--- a/app/views/application/_results.html.erb
+++ b/app/views/application/_results.html.erb
@@ -12,6 +12,12 @@
<% when "hearth_planting" %>
<p>You planted <%= link_to result[:hearth_planting].item.name,
item_path(result[:hearth_planting].item) %> in the loam.</p>
+ <% when "hearth_location" %>
+ <% if current_char.hearth&.location %>
+ <p>You appear in <%= result[:location].name %>.</p>
+ <% else %>
+ <p>Lacking a hearth to return to, you appear in an empty patch of land in <%= result[:location].name %>.</p>
+ <% end %>
<% when "activity" %>
<p>You learned how to <%= result[:activity].name %>!</p>
<% when "monster" %>