From 93b1f9fbc70f8aed4f3bda769eb5272feabb91c9 Mon Sep 17 00:00:00 2001 From: "marcins78@gmail.com" Date: Wed, 14 Mar 2012 12:12:40 +0000 Subject: [PATCH] Merchant look&feel. --- .../merchant/ParametrizedMerchantTest.java | 17 +++++++++++ .../src/main/webapp/js/merchantUi.js | 28 +++++++++++-------- .../src/main/webapp/merchant.html | 4 +++ 3 files changed, 37 insertions(+), 12 deletions(-) diff --git a/gemp-lotr/gemp-lotr-server/src/test/java/com/gempukku/lotro/merchant/ParametrizedMerchantTest.java b/gemp-lotr/gemp-lotr-server/src/test/java/com/gempukku/lotro/merchant/ParametrizedMerchantTest.java index 8e7a4b570..abae8d3ce 100644 --- a/gemp-lotr/gemp-lotr-server/src/test/java/com/gempukku/lotro/merchant/ParametrizedMerchantTest.java +++ b/gemp-lotr/gemp-lotr-server/src/test/java/com/gempukku/lotro/merchant/ParametrizedMerchantTest.java @@ -55,6 +55,23 @@ public class ParametrizedMerchantTest { } } + + // @Test + public void plotPriceEasingFromSetup() { + Date setupDate = new Date(0); + + MerchantDAO merchantDao = new MockMerchantDAO(); + + ParametrizedMerchant merchant = new ParametrizedMerchant(new LotroCardBlueprintLibrary()); + merchant.setMerchantDao(merchantDao); + merchant.setMerchantSetupDate(setupDate); + + long hour = 1000 * 60 * 60; + + for (long time = 0; time < hour * 24 * 35L; time += hour * 2) + System.out.println(time / hour + "," + ((int) merchant.getCardSellPrice("1_1", new Date(time))) + "," + ((int) merchant.getCardBuyPrice("1_1", new Date(time)))); + } + private void assertEqualsMoreOrLess(int expected, int given) { assertTrue("Expected " + expected + " more or less, but received " + given, given <= expected + 1 && given >= expected - 1); } 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 2dffc128a..1e8b5a082 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 @@ -46,20 +46,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, @@ -230,7 +230,7 @@ var GempLotrMerchantUI = Class.extend({ }); cardDiv.append(buyBut); } - if (sellPrice != null && sellPrice <= this.currencyCount) { + if (sellPrice != null) { var formattedSellPrice = this.formatPrice(sellPrice); var sellBut = $("
Buy for
" + this.formatPrice(sellPrice) + "
").button(); sellBut.click( @@ -242,6 +242,10 @@ var GempLotrMerchantUI = Class.extend({ }); }); }); + if (parseInt(sellPrice) > parseInt(this.currencyCount)) { + sellBut.button({disabled: true}); + sellBut.css({color: "#ff0000"}); + } cardDiv.append(sellBut); } if (tradeFoil == "true") { diff --git a/gemp-lotr/gemp-lotr-web/src/main/webapp/merchant.html b/gemp-lotr/gemp-lotr-web/src/main/webapp/merchant.html index 47ff95e48..bd41fe710 100644 --- a/gemp-lotr/gemp-lotr-web/src/main/webapp/merchant.html +++ b/gemp-lotr/gemp-lotr-web/src/main/webapp/merchant.html @@ -19,6 +19,10 @@ opacity: 0.2; } + .buyPrice.ui-state-disabled, .sellPrice.ui-state-disabled, .tradeFoil { + opacity: 0.6; + } + .owned { background-color: #000000; border: 1px solid #ffffff;