From 39ff6a5146cd81c5d6c245b2ceb2ec14d0693520 Mon Sep 17 00:00:00 2001 From: David Gay Date: Mon, 7 Jun 2021 19:43:00 -0400 Subject: Send message when bazaar order is bought or sold from --- CHANGELOG.md | 3 +++ app/controllers/bazaar_controller.rb | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 90bc394..6ef00d5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,9 @@ All notable changes to this project will be documented in this file. ## [Unreleased] +### General +- You now receive an informative message when someone buys or sells items to you via one of your bazaar orders. + ### Monsters - Stalk beast - Bash resistance 6 -> 4 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 -- cgit v1.2.3