From 751ff05874d0e97cbdfc2f16f45f72f5ab6d165b Mon Sep 17 00:00:00 2001 From: David Gay Date: Mon, 31 May 2021 18:41:28 -0400 Subject: Allow choosing how many items you'd like to craft at hearth amenities --- CHANGELOG.md | 2 ++ app/controllers/application_controller.rb | 3 ++- app/views/characters/hearth/index.html.erb | 5 +++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ff8fe3c..161cb8e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,8 @@ All notable changes to this project will be documented in this file. do not see a timer reduction for, it's a bug. - Rested time is used at the end of the activity, when the timer runs out, like other calculations. If you stop your activity before it finishes, rested time will not be used. +- You can now choose how many items you'd like to craft at your forge or labratory. If you want to just keep crafting + until you run out of materials, just enter a large number. Crafting will continue until materials are expended. - New Beastslay activity: the Hopegraves - New Fluxseethe activities: brew trawling draught, distill lusterlight tincture - New Otherforge activity: craft onus of vision diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index f28d30b..7a59299 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -21,7 +21,8 @@ class ApplicationController < ActionController::Base flash[:alert] = "You can't do anything while you're resting. Go to the Character page to stop resting." redirect_to character_path(current_char) and return end - if current_char.start_activity(activity, queued_actions: params[:queued_actions]) + queued_actions = params[:actions].present? ? params[:actions].to_i - 1 : nil + if current_char.start_activity(activity, queued_actions: queued_actions) redirect_to look_path else message = "You can't do that." diff --git a/app/views/characters/hearth/index.html.erb b/app/views/characters/hearth/index.html.erb index 20b6fc0..c058007 100644 --- a/app/views/characters/hearth/index.html.erb +++ b/app/views/characters/hearth/index.html.erb @@ -17,6 +17,7 @@ <% if @amenity_activities[ha.gid.to_sym] %> <%= form_with url: start_activity_path, method: :post do |f| %> <%= f.select :id, @amenity_activities[ha.gid.to_sym].sort_by { |a| a.name }.map { |a| [a.name, a.id] } %> + <%= f.number_field :actions, value: 1, size: 5, min: 1, max: 2_000_000_000 %> <%= f.submit "Go" %> <% end %> <% end %> @@ -30,7 +31,7 @@
<%= form_with url: start_activity_path do |f| %> <%= f.hidden_field :id, value: construct_activity.id %> - <%= f.hidden_field :queued_actions, value: 0 %> + <%= f.hidden_field :actions, value: 1 %> <%= f.submit construct_activity.name %> <% end %>
(costs <%= construct_activity.costs.join(", ")%>)
@@ -44,7 +45,7 @@ <% construct_activity = foundation.construct_activity(1) %> <%= form_with url: start_activity_path do |f| %> <%= f.hidden_field :id, value: construct_activity.id %> - <%= f.hidden_field :queued_actions, value: 0 %> + <%= f.hidden_field :actions, value: 1 %> <%= f.submit construct_activity.name %> <% end %> (costs <%= construct_activity.costs.join(", ")%>) -- cgit v1.2.3