- In deck builder, in list of decks there is an extra icon, to show the deck-list in a text format.
This commit is contained in:
@@ -4,6 +4,7 @@ import com.gempukku.lotro.cards.packs.SetRarity;
|
||||
import com.gempukku.lotro.common.CardType;
|
||||
import com.gempukku.lotro.common.Culture;
|
||||
import com.gempukku.lotro.common.Keyword;
|
||||
import com.gempukku.lotro.common.Side;
|
||||
import com.gempukku.lotro.logic.GameUtils;
|
||||
import com.gempukku.util.MultipleComparator;
|
||||
|
||||
@@ -15,6 +16,7 @@ public class SortAndFilterCards {
|
||||
filter = "";
|
||||
String[] filterParams = filter.split(" ");
|
||||
|
||||
Side side = getSideFilter(filterParams);
|
||||
String type = getTypeFilter(filterParams);
|
||||
String rarity = getRarityFilter(filterParams);
|
||||
String[] sets = getSetFilter(filterParams);
|
||||
@@ -29,7 +31,7 @@ public class SortAndFilterCards {
|
||||
for (T item : items) {
|
||||
String blueprintId = item.getBlueprintId();
|
||||
|
||||
if (acceptsFilters(library, rarities, blueprintId, type, rarity, sets, cardTypes, cultures, keywords, words, siteNumber))
|
||||
if (acceptsFilters(library, rarities, blueprintId, side, type, rarity, sets, cardTypes, cultures, keywords, words, siteNumber))
|
||||
result.add(item);
|
||||
}
|
||||
|
||||
@@ -65,7 +67,7 @@ public class SortAndFilterCards {
|
||||
}
|
||||
|
||||
private boolean acceptsFilters(
|
||||
LotroCardBlueprintLibrary library, Map<String, SetRarity> rarities, String blueprintId, String type, String rarity, String[] sets,
|
||||
LotroCardBlueprintLibrary library, Map<String, SetRarity> rarities, String blueprintId, Side side, String type, String rarity, String[] sets,
|
||||
Set<CardType> cardTypes, Set<Culture> cultures, Set<Keyword> keywords, List<String> words, Integer siteNumber) {
|
||||
if (isPack(blueprintId)) {
|
||||
if (type == null || type.equals("pack"))
|
||||
@@ -77,19 +79,28 @@ public class SortAndFilterCards {
|
||||
|| (type.equals("nonFoil") && !blueprintId.endsWith("*"))
|
||||
|| (type.equals("tengwar") && (blueprintId.endsWith("T*") || blueprintId.endsWith("T")))) {
|
||||
final LotroCardBlueprint blueprint = library.getLotroCardBlueprint(blueprintId);
|
||||
if (rarity == null || isRarity(blueprintId, rarity, library, rarities))
|
||||
if (sets == null || isInSets(blueprintId, sets, library))
|
||||
if (cardTypes == null || cardTypes.contains(blueprint.getCardType()))
|
||||
if (cultures == null || cultures.contains(blueprint.getCulture()))
|
||||
if (containsAllKeywords(blueprint, keywords))
|
||||
if (containsAllWords(blueprint, words))
|
||||
if (siteNumber == null || blueprint.getSiteNumber() == siteNumber)
|
||||
return true;
|
||||
if (side == null || blueprint.getSide() == side)
|
||||
if (rarity == null || isRarity(blueprintId, rarity, library, rarities))
|
||||
if (sets == null || isInSets(blueprintId, sets, library))
|
||||
if (cardTypes == null || cardTypes.contains(blueprint.getCardType()))
|
||||
if (cultures == null || cultures.contains(blueprint.getCulture()))
|
||||
if (containsAllKeywords(blueprint, keywords))
|
||||
if (containsAllWords(blueprint, words))
|
||||
if (siteNumber == null || blueprint.getSiteNumber() == siteNumber)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private Side getSideFilter(String[] filterParams) {
|
||||
for (String filterParam : filterParams) {
|
||||
if (filterParam.startsWith("side:"))
|
||||
return Side.valueOf(filterParam.substring("side:".length()));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private String getTypeFilter(String[] filterParams) {
|
||||
for (String filterParam : filterParams) {
|
||||
if (filterParam.startsWith("type:"))
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.gempukku.lotro.common.Side;
|
||||
import com.gempukku.lotro.db.DeckDAO;
|
||||
import com.gempukku.lotro.game.*;
|
||||
import com.gempukku.lotro.hall.HallServer;
|
||||
import com.gempukku.lotro.logic.GameUtils;
|
||||
import com.gempukku.lotro.logic.vo.LotroDeck;
|
||||
import com.sun.jersey.spi.resource.Singleton;
|
||||
import org.w3c.dom.Document;
|
||||
@@ -82,6 +83,55 @@ public class DeckResource extends AbstractResource {
|
||||
return serializeDeck(deck);
|
||||
}
|
||||
|
||||
@Path("/html")
|
||||
@GET
|
||||
@Produces(MediaType.TEXT_HTML)
|
||||
public String getDeckList(
|
||||
@QueryParam("deckName") String deckName,
|
||||
@QueryParam("participantId") String participantId,
|
||||
@Context HttpServletRequest request) {
|
||||
Player resourceOwner = getResourceOwnerSafely(request, participantId);
|
||||
|
||||
LotroDeck deck = _deckDao.getDeckForPlayer(resourceOwner, deckName);
|
||||
|
||||
if (deck == null)
|
||||
sendError(Response.Status.NOT_FOUND);
|
||||
|
||||
StringBuilder result = new StringBuilder();
|
||||
result.append("<html><body>");
|
||||
String ringBearer = deck.getRingBearer();
|
||||
if (ringBearer != null)
|
||||
result.append("<b>Ring-bearer:</b> " + GameUtils.getFullName(_library.getLotroCardBlueprint(ringBearer)) + "<br/>");
|
||||
String ring = deck.getRing();
|
||||
if (ring != null)
|
||||
result.append("<b>Ring:</b> " + GameUtils.getFullName(_library.getLotroCardBlueprint(ring)) + "<br/>");
|
||||
|
||||
DefaultCardCollection deckCards = new DefaultCardCollection();
|
||||
for (String card : deck.getAdventureCards())
|
||||
deckCards.addItem(_library.getBaseBlueprintId(card), 1);
|
||||
for (String site : deck.getSites())
|
||||
deckCards.addItem(_library.getBaseBlueprintId(site), 1);
|
||||
|
||||
result.append("<br/>");
|
||||
result.append("<b>Adventure deck:</b><br/>");
|
||||
for (CardCollection.Item item : _sortAndFilterCards.process("cardType:SITE sort:siteNumber,twilight", deckCards.getAllItems(), _library, null))
|
||||
result.append(GameUtils.getFullName(_library.getLotroCardBlueprint(item.getBlueprintId())) + "<br/>");
|
||||
|
||||
result.append("<br/>");
|
||||
result.append("<b>Free Peoples Draw Deck:</b><br/>");
|
||||
for (CardCollection.Item item : _sortAndFilterCards.process("side:FREE_PEOPLE sort:cardType,culture,name", deckCards.getAllItems(), _library, null))
|
||||
result.append(item.getCount() + "x " + GameUtils.getFullName(_library.getLotroCardBlueprint(item.getBlueprintId())) + "<br/>");
|
||||
|
||||
result.append("<br/>");
|
||||
result.append("<b>Shadow Draw Deck:</b><br/>");
|
||||
for (CardCollection.Item item : _sortAndFilterCards.process("side:SHADOW sort:cardType,culture,name", deckCards.getAllItems(), _library, null))
|
||||
result.append(item.getCount() + "x " + GameUtils.getFullName(_library.getLotroCardBlueprint(item.getBlueprintId())) + "<br/>");
|
||||
|
||||
result.append("</body></html>");
|
||||
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
@POST
|
||||
@Produces(MediaType.APPLICATION_XML)
|
||||
public Document saveDeck(
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<pre style="font-size:80%">
|
||||
<b>31 Mar. 2012</b>
|
||||
- Added sub-titles to all cards.
|
||||
- In deck builder, in list of decks there is an extra icon, to show the deck-list in a text format.
|
||||
|
||||
<b>30 Mar. 2012</b>
|
||||
- "What Are We Waiting For?" should now skip only one Shadow phase, if player moves more than once.
|
||||
|
||||
@@ -236,11 +236,11 @@ var GempLotrDeckBuildingUI = Class.extend({
|
||||
|
||||
this.infoDialog = $("<div></div>")
|
||||
.dialog({
|
||||
autoOpen: false,
|
||||
closeOnEscape: true,
|
||||
resizable: false,
|
||||
title: "Card information"
|
||||
});
|
||||
autoOpen: false,
|
||||
closeOnEscape: true,
|
||||
resizable: false,
|
||||
title: "Card information"
|
||||
});
|
||||
|
||||
var swipeOptions = {
|
||||
threshold: 20,
|
||||
@@ -288,14 +288,14 @@ var GempLotrDeckBuildingUI = Class.extend({
|
||||
if (that.deckListDialog == null) {
|
||||
that.deckListDialog = $("<div></div>")
|
||||
.dialog({
|
||||
title: "Your stored decks",
|
||||
autoOpen: false,
|
||||
closeOnEscape: true,
|
||||
resizable: true,
|
||||
width: 400,
|
||||
height: 400,
|
||||
modal: true
|
||||
});
|
||||
title: "Your stored decks",
|
||||
autoOpen: false,
|
||||
closeOnEscape: true,
|
||||
resizable: true,
|
||||
width: 400,
|
||||
height: 400,
|
||||
modal: true
|
||||
});
|
||||
}
|
||||
that.deckListDialog.html("");
|
||||
|
||||
@@ -306,10 +306,12 @@ var GempLotrDeckBuildingUI = Class.extend({
|
||||
var deck = decks[i];
|
||||
var deckName = decks[i].childNodes[0].nodeValue;
|
||||
var openDeckBut = $("<button title='Open deck'><span class='ui-icon ui-icon-folder-open'></span></button>").button();
|
||||
var deckListBut = $("<button title='Deck list'><span class='ui-icon ui-icon-clipboard'></span></button>").button();
|
||||
var deleteDeckBut = $("<button title='Delete deck'><span class='ui-icon ui-icon-trash'></span></button>").button();
|
||||
|
||||
var deckElem = $("<div class='deckItem'></div>");
|
||||
deckElem.append(openDeckBut);
|
||||
deckElem.append(deckListBut);
|
||||
deckElem.append(deleteDeckBut);
|
||||
deckElem.append(deckName);
|
||||
|
||||
@@ -325,6 +327,13 @@ var GempLotrDeckBuildingUI = Class.extend({
|
||||
};
|
||||
})(deckName));
|
||||
|
||||
deckListBut.click(
|
||||
(function(deckName) {
|
||||
return function() {
|
||||
window.open('/gemp-lotr/server/deck/html?deckName=' + encodeURIComponent(deckName), "_blank");
|
||||
};
|
||||
})(deckName));
|
||||
|
||||
deleteDeckBut.click(
|
||||
(function(deckName) {
|
||||
return function() {
|
||||
@@ -393,14 +402,14 @@ var GempLotrDeckBuildingUI = Class.extend({
|
||||
if (this.selectionDialog == null) {
|
||||
this.selectionDialog = $("<div></div>")
|
||||
.dialog({
|
||||
title: "Choose one",
|
||||
autoOpen: false,
|
||||
closeOnEscape: true,
|
||||
resizable: true,
|
||||
width: 400,
|
||||
height: 200,
|
||||
modal: true
|
||||
});
|
||||
title: "Choose one",
|
||||
autoOpen: false,
|
||||
closeOnEscape: true,
|
||||
resizable: true,
|
||||
width: 400,
|
||||
height: 200,
|
||||
modal: true
|
||||
});
|
||||
|
||||
this.selectionGroup = new NormalCardGroup(this.selectionDialog, function(card) {
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user