diff options
author | David Gay <david@davidgay.org> | 2021-06-15 19:13:55 -0400 |
---|---|---|
committer | David Gay <david@davidgay.org> | 2021-06-15 19:13:55 -0400 |
commit | 53c9df5feb8ad4ebef8f40840d29255a81edb6df (patch) | |
tree | 2b11367d054363e100db8b488bab3c816e070bf3 /app/controllers/characters | |
parent | 362fcb62af0949b4c7ac1dfa052fa10b39d70b43 (diff) |
Reboot omens and allow infixing items (like omens) into skills
Diffstat (limited to 'app/controllers/characters')
-rw-r--r-- | app/controllers/characters/hearth_controller.rb | 3 | ||||
-rw-r--r-- | app/controllers/characters/item_infixes_controller.rb | 27 |
2 files changed, 30 insertions, 0 deletions
diff --git a/app/controllers/characters/hearth_controller.rb b/app/controllers/characters/hearth_controller.rb index 82f72d6..c525add 100644 --- a/app/controllers/characters/hearth_controller.rb +++ b/app/controllers/characters/hearth_controller.rb @@ -7,6 +7,7 @@ class Characters::HearthController < ApplicationController forge: [], laboratory: [], spicebench: [], + binding_array: [], } Activity.where("gid like ?", "craft_%").each do |activity| @@ -20,6 +21,8 @@ class Characters::HearthController < ApplicationController @amenity_activities[:laboratory].push(activity) && next when "spicebench" @amenity_activities[:spicebench].push(activity) && next + when "binding_array" + @amenity_activities[:binding_array].push(activity) && next else raise "Invalid amenity gid (#{requirement_data[:gid]}" end diff --git a/app/controllers/characters/item_infixes_controller.rb b/app/controllers/characters/item_infixes_controller.rb new file mode 100644 index 0000000..0b5f1c5 --- /dev/null +++ b/app/controllers/characters/item_infixes_controller.rb @@ -0,0 +1,27 @@ +class Characters::ItemInfixesController < ApplicationController + def create + # TODO: Can this find-by-id happen automagically? + @item_infix = current_char.infix(Item.find(params[:item_id]), Skill.find(params[:skill_id])) + if @item_infix + flash[:notice] = "Infixed #{@item_infix.item.name}." + else + flash[:alert] = "Failed to infix item." + end + redirect_to character_skills_path(current_char) + end + + def destroy + @item_infix = ItemInfix.find(params[:id]) + if current_char.remove_infix(@item_infix) + flash[:notice] = "Removed #{@item_infix.item.name}." + else + flash[:alert] = "Failed to remove #{@item_infix.item.name}." + end + redirect_to character_skills_path(current_char) + end + + private + def item_infix_params + params.require(:item_infix).permit(:item_id, :skill_id) + end +end |