summaryrefslogtreecommitdiff
path: root/app/controllers/game_controller.rb
blob: 39ea6c9974daeefff9838fccd0a04fca52639a9e (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
class GameController < ApplicationController
  def toggle_resting
    if current_char.resting?
      if current_char.stop_resting
        flash[:notice] = "You stop resting. You now have #{current_char.rested_duration} seconds of rest."
      else
        flash[:alert] = "Failed to stop resting. Are you sure you're resting?"
      end
    else
      if current_char.start_resting
        flash[:notice] = "You are now resting."
      else
        flash[:alert] = "Failed to start resting. Are you already resting?"
      end
    end
    redirect_to character_path(current_char)
  end

  def stop_activity
    current_char.stop_activity
    redirect_to locations_path
  end

  def finish_activity
    @results = ActivityProcessor.new(current_char).results
  end
end