- Added collector's information sorting, also added checkbox for hiding merchant buttons on Merchant screen.

This commit is contained in:
marcins78@gmail.com
2012-03-15 14:32:07 +00:00
parent 7782831d92
commit 592d29d58e
5 changed files with 86 additions and 57 deletions

View File

@@ -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<String> {
private static class CardBlueprintIdComparator implements Comparator<CardItem> {
@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]);

View File

@@ -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.
<b>14 Mar. 2012</b>
- "White Hand Destroyer" no longer has "Hunter 0" when you control no sites.

View File

@@ -137,6 +137,7 @@ var CardFilter = Class.extend({
+ "<option value='siteNumber'>Site number</option>"
+ "<option value='strength'>Strength</option>"
+ "<option value='vitality'>Vitality</option>"
+ "<option value='collectorInfo'>Collector's Info</option>"
+ "</select>");
this.raritySelect = $("<select style='width: 40px; font-size: 80%;'>"
+ "<option value=''>Rarity:</option>"

View File

@@ -8,6 +8,7 @@ var GempLotrMerchantUI = Class.extend({
cardFilter: null,
pocketDiv: null,
hideMerchantDiv: null,
countDiv: null,
infoDialog: null,
@@ -15,6 +16,7 @@ var GempLotrMerchantUI = Class.extend({
currencyCount: null,
ownedMin: 0,
hideMerchant: false,
init: function(cardListElem, cardFilterElem) {
var that = this;
@@ -44,9 +46,12 @@ var GempLotrMerchantUI = Class.extend({
this.pocketDiv = $("<div class='pocket'></div>");
this.hideMerchantDiv = $("<div class='hideMerchant'><label for='hideMerchantCheck'>Hide merchant</label><input type='checkbox' id='hideMerchantCheck' value='hideMerchant'/></div>");
this.countDiv = $("<div class='countDiv'>Owned >= <select id='ownedMin'><option value='0'>0</option><option value='1'>1</option><option value='2'>2</option><option value='3'>3</option><option value='4'>4</option><option value='5'>5</option></select></div>");
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 = $("<div></div>")
.dialog({
autoOpen: false,
closeOnEscape: true,
resizable: false,
title: "Card information"
});
autoOpen: false,
closeOnEscape: true,
resizable: false,
title: "Card information"
});
this.questionDialog = $("<div></div>")
.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("<div class='owned'>" + count + "</div>");
if (buyPrice != null) {
var formattedBuyPrice = this.formatPrice(buyPrice);
var buyBut = $("<div class='buyPrice'>Sell for<br/>" + formattedBuyPrice + "</div>").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 = $("<div class='buyPrice'>Sell for<br/>" + formattedBuyPrice + "</div>").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 = $("<div class='sellPrice'>Buy for<br/>" + this.formatPrice(sellPrice) + "</div>").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 = $("<div class='tradeFoil'>Trade 4 for foil</div>").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 = $("<div class='sellPrice'>Buy for<br/>" + this.formatPrice(sellPrice) + "</div>").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 = $("<div class='tradeFoil'>Trade 4 for foil</div>").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});
},

View File

@@ -45,6 +45,11 @@
opacity: 1;
}
.hideMerchant {
color: #ffffff;
text-align: right;
}
.countDiv {
color: #ffffff;
text-align: right;