summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorDavid Gay <david@davidgay.org>2021-06-07 19:43:00 -0400
committerDavid Gay <david@davidgay.org>2021-06-07 19:43:00 -0400
commit39ff6a5146cd81c5d6c245b2ceb2ec14d0693520 (patch)
tree07ca81b2452299a9080338a2c32f54b5bf4f8528 /app
parent84ab6ed32c7bc3777b267b85f75b6487b9d92b49 (diff)
Send message when bazaar order is bought or sold from
Diffstat (limited to 'app')
-rw-r--r--app/controllers/bazaar_controller.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/app/controllers/bazaar_controller.rb b/app/controllers/bazaar_controller.rb
index 5ed8a59..d51a419 100644
--- a/app/controllers/bazaar_controller.rb
+++ b/app/controllers/bazaar_controller.rb
@@ -40,6 +40,9 @@ class BazaarController < ApplicationController
@bazaar_order.character.shift_item(@bazaar_order.item, quantity)
@bazaar_order.decrement(:quantity, quantity)
@bazaar_order.save!
+ Message.create(recipient: @bazaar_order.character, subject: "Bought #{quantity} #{@bazaar_order.item.name}",
+ body: "#{current_char.name} sold #{quantity} #{@bazaar_order.item.name} to you" \
+ " for #{profit} vg.")
flash[:notice] = "You sold #{quantity} #{@bazaar_order.item.name} and got #{profit} vg."
end
else
@@ -51,6 +54,9 @@ class BazaarController < ApplicationController
@bazaar_order.character.shift_item("vestige", cost)
@bazaar_order.decrement(:quantity, quantity)
@bazaar_order.save!
+ Message.create(recipient: @bazaar_order.character, subject: "Sold #{quantity} #{@bazaar_order.item.name}",
+ body: "#{current_char.name} bought #{quantity} #{@bazaar_order.item.name} from you" \
+ " for #{cost} vg.")
flash[:notice] = "You bought #{quantity} #{@bazaar_order.item.name} for #{cost} vg."
end
end