diff --git a/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/game/SortAndFilterCards.java b/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/game/SortAndFilterCards.java index fb874654c..70874342a 100644 --- a/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/game/SortAndFilterCards.java +++ b/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/game/SortAndFilterCards.java @@ -40,6 +40,8 @@ public class SortAndFilterCards { Collections.sort(result, new StrengthComparator(library)); else if (sort != null && sort.equals("vitality")) Collections.sort(result, new VitalityComparator(library)); + else if (sort != null && sort.equals("collectorInfo")) + Collections.sort(result, new CardBlueprintIdComparator()); else Collections.sort(result, new NameComparator(library)); @@ -250,7 +252,7 @@ public class SortAndFilterCards { else { final int nameCompareResult = _library.getLotroCardBlueprint(o1.getBlueprintId()).getName().compareTo(_library.getLotroCardBlueprint(o2.getBlueprintId()).getName()); if (nameCompareResult == 0) - return _cardBlueprintIdComparator.compare(o1.getBlueprintId(), o2.getBlueprintId()); + return _cardBlueprintIdComparator.compare(o1, o2); return nameCompareResult; } } else { @@ -365,11 +367,17 @@ public class SortAndFilterCards { } } - private static class CardBlueprintIdComparator implements Comparator { + private static class CardBlueprintIdComparator implements Comparator { @Override - public int compare(String o1, String o2) { - String[] o1Parts = o1.split("_"); - String[] o2Parts = o2.split("_"); + public int compare(CardItem o1, CardItem o2) { + if (isPack(o1.getBlueprintId()) && isPack(o2.getBlueprintId())) + return o1.getBlueprintId().compareTo(o2.getBlueprintId()); + if (isPack(o1.getBlueprintId())) + return -1; + if (isPack(o2.getBlueprintId())) + return 1; + String[] o1Parts = o1.getBlueprintId().split("_"); + String[] o2Parts = o2.getBlueprintId().split("_"); if (o1Parts.length == 1 && o2Parts.length == 1) return o1Parts[0].compareTo(o2Parts[0]); 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 71e68f244..909869c83 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 @@ -5,6 +5,7 @@ - You are able to browse your Adventure Deck now during game. - Selection action to use and selecting card (for example for assignments or another effect) have different card frame color now. +- Added collector's information sorting, also added checkbox for hiding merchant buttons on Merchant screen. 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/cardFilter.js b/gemp-lotr/gemp-lotr-web/src/main/webapp/js/cardFilter.js index 5e1032adf..8fe536a8b 100644 --- a/gemp-lotr/gemp-lotr-web/src/main/webapp/js/cardFilter.js +++ b/gemp-lotr/gemp-lotr-web/src/main/webapp/js/cardFilter.js @@ -137,6 +137,7 @@ var CardFilter = Class.extend({ + "" + "" + "" + + "" + ""); this.raritySelect = $(""); + this.countDiv = $("
Owned >=
"); this.filterDiv.append(this.pocketDiv); + this.filterDiv.append(this.hideMerchantDiv); this.filterDiv.append(this.countDiv); $("#ownedMin").change( @@ -55,22 +60,28 @@ var GempLotrMerchantUI = Class.extend({ that.cardFilter.getCollection(); }); + $("#hideMerchantCheck").change( + function() { + that.hideMerchant = $("#hideMerchantCheck").prop("checked"); + that.cardFilter.getCollection(); + }); + 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, @@ -227,50 +238,52 @@ var GempLotrMerchantUI = Class.extend({ if (cardDiv != null) { var that = this; cardDiv.append("
" + count + "
"); - if (buyPrice != null) { - var formattedBuyPrice = this.formatPrice(buyPrice); - var buyBut = $("
Sell for
" + formattedBuyPrice + "
").button(); - buyBut.click( - function() { - that.displayMerchantAction(card, "Do you want to sell this item for " + formattedBuyPrice + "?", - function() { - that.comm.sellItem(blueprintId, buyPrice, function() { - that.cardFilter.getCollection(); + if (!this.hideMerchant) { + if (buyPrice != null) { + var formattedBuyPrice = this.formatPrice(buyPrice); + var buyBut = $("
Sell for
" + formattedBuyPrice + "
").button(); + buyBut.click( + function() { + that.displayMerchantAction(card, "Do you want to sell this item for " + formattedBuyPrice + "?", + function() { + that.comm.sellItem(blueprintId, buyPrice, function() { + that.cardFilter.getCollection(); + }); }); - }); - }); - cardDiv.append(buyBut); - } - if (sellPrice != null) { - var formattedSellPrice = this.formatPrice(sellPrice); - var sellBut = $("
Buy for
" + this.formatPrice(sellPrice) + "
").button(); - sellBut.click( - function() { - that.displayMerchantAction(card, "Do you want to buy this item for " + formattedSellPrice + "?", - function() { - that.comm.buyItem(blueprintId, sellPrice, function() { - that.cardFilter.getCollection(); - }); - }); - }); - if (parseInt(sellPrice) > parseInt(this.currencyCount)) { - sellBut.button({disabled: true}); - sellBut.css({color: "#ff0000"}); + }); + cardDiv.append(buyBut); } - cardDiv.append(sellBut); - } - if (tradeFoil == "true") { - 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?", - function() { - that.comm.tradeInFoil(blueprintId, function() { - that.cardFilter.getCollection(); + if (sellPrice != null) { + var formattedSellPrice = this.formatPrice(sellPrice); + var sellBut = $("
Buy for
" + this.formatPrice(sellPrice) + "
").button(); + sellBut.click( + function() { + that.displayMerchantAction(card, "Do you want to buy this item for " + formattedSellPrice + "?", + function() { + that.comm.buyItem(blueprintId, sellPrice, function() { + that.cardFilter.getCollection(); + }); }); - }); - }); - cardDiv.append(tradeFoilBut); + }); + if (parseInt(sellPrice) > parseInt(this.currencyCount)) { + sellBut.button({disabled: true}); + sellBut.css({color: "#ff0000"}); + } + cardDiv.append(sellBut); + } + if (tradeFoil == "true") { + 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?", + function() { + that.comm.tradeInFoil(blueprintId, function() { + that.cardFilter.getCollection(); + }); + }); + }); + cardDiv.append(tradeFoilBut); + } } } }, @@ -329,6 +342,7 @@ var GempLotrMerchantUI = Class.extend({ this.cardFilter.layoutUi(0, 0, filterWidth, filterHeight); this.pocketDiv.css({position: "absolute", left: filterWidth - 60, top: 35, width: 60, height: 18}); + this.hideMerchantDiv.css({position: "absolute", left: filterWidth - 100, top: filterHeight - 38, width: 100, height: 18}); this.countDiv.css({position: "absolute", left: filterWidth - 100, top: filterHeight - 20, width: 100, height: 20}); }, 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 e5539196a..c7d766c1c 100644 --- a/gemp-lotr/gemp-lotr-web/src/main/webapp/merchant.html +++ b/gemp-lotr/gemp-lotr-web/src/main/webapp/merchant.html @@ -45,6 +45,11 @@ opacity: 1; } + .hideMerchant { + color: #ffffff; + text-align: right; + } + .countDiv { color: #ffffff; text-align: right;