From 661edde8231257a6a596e97b0fd36da6d3d22873 Mon Sep 17 00:00:00 2001 From: "marcins78@gmail.com" Date: Thu, 15 Mar 2012 21:58:13 +0000 Subject: [PATCH] - Trading for foil now also requires a payment of 4G. --- .../lotro/collection/CollectionsManager.java | 4 +++- .../lotro/merchant/MerchantService.java | 4 ++-- .../src/main/webapp/includes/changeLog.html | 1 + .../src/main/webapp/js/merchantUi.js | 24 +++++++++---------- 4 files changed, 18 insertions(+), 15 deletions(-) diff --git a/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/collection/CollectionsManager.java b/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/collection/CollectionsManager.java index b61a5b4c3..86421cebe 100644 --- a/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/collection/CollectionsManager.java +++ b/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/collection/CollectionsManager.java @@ -109,7 +109,7 @@ public class CollectionsManager { addItemsToPlayerCollection(_playerDAO.getPlayer(player), collectionType, items); } - public boolean tradeCards(Player player, CollectionType collectionType, String blueprintId1, int count1, String blueprintId2, int count2) { + public boolean tradeCards(Player player, CollectionType collectionType, String blueprintId1, int count1, String blueprintId2, int count2, int currencyCost) { _readWriteLock.writeLock().lock(); try { final CardCollection playerCollection = getPlayerCollection(player, collectionType.getCode()); @@ -117,6 +117,8 @@ public class CollectionsManager { MutableCardCollection mutableCardCollection = new DefaultCardCollection(playerCollection); if (!mutableCardCollection.removeItem(blueprintId1, count1)) return false; + if (!mutableCardCollection.removeCurrency(currencyCost)) + return false; mutableCardCollection.addItem(blueprintId2, count2); _collectionDAO.setCollectionForPlayer(player.getId(), collectionType.getCode(), mutableCardCollection); diff --git a/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/merchant/MerchantService.java b/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/merchant/MerchantService.java index 0a3c9ae41..4c1b08703 100644 --- a/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/merchant/MerchantService.java +++ b/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/merchant/MerchantService.java @@ -164,9 +164,9 @@ public class MerchantService { Lock lock = _lock.writeLock(); lock.lock(); try { - boolean success = _collectionsManager.tradeCards(player, _permanentCollection, blueprintId, 4, blueprintId + "*", 1); + boolean success = _collectionsManager.tradeCards(player, _permanentCollection, blueprintId, 4, blueprintId + "*", 1, 400); if (!success) - throw new MerchantException("Unable to remove the required cards from your collection"); + throw new MerchantException("Unable to remove the required cards or currency from your collection"); } finally { lock.unlock(); } diff --git a/gemp-lotr/gemp-lotr-web/src/main/webapp/includes/changeLog.html b/gemp-lotr/gemp-lotr-web/src/main/webapp/includes/changeLog.html index e5cd5bdb9..dff348384 100644 --- a/gemp-lotr/gemp-lotr-web/src/main/webapp/includes/changeLog.html +++ b/gemp-lotr/gemp-lotr-web/src/main/webapp/includes/changeLog.html @@ -8,6 +8,7 @@ color now. - Added collector's information sorting, also added checkbox for hiding merchant buttons on Merchant screen. - Deck upon loading now will be sorted, sites by site number and shadow number, cards in deck by card type, culture and name. +- Trading for foil now also requires a payment of 4G. 14 Mar. 2012 - "White Hand Destroyer" no longer has "Hunter 0" when you control no sites. diff --git a/gemp-lotr/gemp-lotr-web/src/main/webapp/js/merchantUi.js b/gemp-lotr/gemp-lotr-web/src/main/webapp/js/merchantUi.js index 515cebe14..8d4d19bb8 100644 --- a/gemp-lotr/gemp-lotr-web/src/main/webapp/js/merchantUi.js +++ b/gemp-lotr/gemp-lotr-web/src/main/webapp/js/merchantUi.js @@ -68,20 +68,20 @@ var GempLotrMerchantUI = Class.extend({ this.infoDialog = $("
") .dialog({ - autoOpen: false, - closeOnEscape: true, - resizable: false, - title: "Card information" - }); + autoOpen: false, + closeOnEscape: true, + resizable: false, + title: "Card information" + }); this.questionDialog = $("
") .dialog({ - autoOpen: false, - closeOnEscape: true, - resizable: false, - modal: true, - title: "Merchant operation" - }); + autoOpen: false, + closeOnEscape: true, + resizable: false, + modal: true, + title: "Merchant operation" + }); var swipeOptions = { threshold: 20, @@ -275,7 +275,7 @@ var GempLotrMerchantUI = Class.extend({ var tradeFoilBut = $("
Trade 4 for foil
").button(); tradeFoilBut.click( function() { - that.displayMerchantAction(card, "Do you want to trade 4 of this card for a foil version?", + that.displayMerchantAction(card, "Do you want to trade 4 of this card and 4G in currency for a foil version of the card?", function() { that.comm.tradeInFoil(blueprintId, function() { that.cardFilter.getCollection();