From 5ac5043d138d1790890ea43af0bfc52c83083080 Mon Sep 17 00:00:00 2001 From: Steve Richter Date: Fri, 4 Oct 2019 17:43:33 -0400 Subject: [PATCH 1/2] Adjust code so prohibited-item value message is shown --- server/core/functions/shop.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/server/core/functions/shop.js b/server/core/functions/shop.js index 9c73ca28..444ac1ad 100644 --- a/server/core/functions/shop.js +++ b/server/core/functions/shop.js @@ -330,16 +330,14 @@ class Shop { */ value() { const { price, name } = Query.getItemData(this.itemId); - let value = ''; + let msg = ''; // If the item is prohibited, it has no value if (this.prohibited) { - value = 'How can you value that which has infinite value?'; - } else { - value = `${price} coins.`; + msg = 'How can you value that which has infinite value?'; } Socket.emit('game:send:message', { player: { socket_id: world.players[this.playerIndex].socket_id }, - text: this.itemId !== 'coins' ? `${name}: ${price} coins.` : `${this.item.qty} coins.`, + text: this.prohibited ? `${msg}` : `${name}: ${price} coins.`, }); } From 3f00799fa61bc2d42d08abb35faaaa19fda3473f Mon Sep 17 00:00:00 2001 From: Steve Richter Date: Fri, 4 Oct 2019 17:47:34 -0400 Subject: [PATCH 2/2] Clean up logic for prohibited item value msg --- server/core/functions/shop.js | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/server/core/functions/shop.js b/server/core/functions/shop.js index 444ac1ad..d3840519 100644 --- a/server/core/functions/shop.js +++ b/server/core/functions/shop.js @@ -330,14 +330,9 @@ class Shop { */ value() { const { price, name } = Query.getItemData(this.itemId); - let msg = ''; - // If the item is prohibited, it has no value - if (this.prohibited) { - msg = 'How can you value that which has infinite value?'; - } Socket.emit('game:send:message', { player: { socket_id: world.players[this.playerIndex].socket_id }, - text: this.prohibited ? `${msg}` : `${name}: ${price} coins.`, + text: this.prohibited ? 'How can you value that which has infinite value?' : `${name}: ${price} coins.`, }); }