- 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.CardType;
|
||||||
import com.gempukku.lotro.common.Culture;
|
import com.gempukku.lotro.common.Culture;
|
||||||
import com.gempukku.lotro.common.Keyword;
|
import com.gempukku.lotro.common.Keyword;
|
||||||
|
import com.gempukku.lotro.common.Side;
|
||||||
import com.gempukku.lotro.logic.GameUtils;
|
import com.gempukku.lotro.logic.GameUtils;
|
||||||
import com.gempukku.util.MultipleComparator;
|
import com.gempukku.util.MultipleComparator;
|
||||||
|
|
||||||
@@ -15,6 +16,7 @@ public class SortAndFilterCards {
|
|||||||
filter = "";
|
filter = "";
|
||||||
String[] filterParams = filter.split(" ");
|
String[] filterParams = filter.split(" ");
|
||||||
|
|
||||||
|
Side side = getSideFilter(filterParams);
|
||||||
String type = getTypeFilter(filterParams);
|
String type = getTypeFilter(filterParams);
|
||||||
String rarity = getRarityFilter(filterParams);
|
String rarity = getRarityFilter(filterParams);
|
||||||
String[] sets = getSetFilter(filterParams);
|
String[] sets = getSetFilter(filterParams);
|
||||||
@@ -29,7 +31,7 @@ public class SortAndFilterCards {
|
|||||||
for (T item : items) {
|
for (T item : items) {
|
||||||
String blueprintId = item.getBlueprintId();
|
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);
|
result.add(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -65,7 +67,7 @@ public class SortAndFilterCards {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean acceptsFilters(
|
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) {
|
Set<CardType> cardTypes, Set<Culture> cultures, Set<Keyword> keywords, List<String> words, Integer siteNumber) {
|
||||||
if (isPack(blueprintId)) {
|
if (isPack(blueprintId)) {
|
||||||
if (type == null || type.equals("pack"))
|
if (type == null || type.equals("pack"))
|
||||||
@@ -77,19 +79,28 @@ public class SortAndFilterCards {
|
|||||||
|| (type.equals("nonFoil") && !blueprintId.endsWith("*"))
|
|| (type.equals("nonFoil") && !blueprintId.endsWith("*"))
|
||||||
|| (type.equals("tengwar") && (blueprintId.endsWith("T*") || blueprintId.endsWith("T")))) {
|
|| (type.equals("tengwar") && (blueprintId.endsWith("T*") || blueprintId.endsWith("T")))) {
|
||||||
final LotroCardBlueprint blueprint = library.getLotroCardBlueprint(blueprintId);
|
final LotroCardBlueprint blueprint = library.getLotroCardBlueprint(blueprintId);
|
||||||
if (rarity == null || isRarity(blueprintId, rarity, library, rarities))
|
if (side == null || blueprint.getSide() == side)
|
||||||
if (sets == null || isInSets(blueprintId, sets, library))
|
if (rarity == null || isRarity(blueprintId, rarity, library, rarities))
|
||||||
if (cardTypes == null || cardTypes.contains(blueprint.getCardType()))
|
if (sets == null || isInSets(blueprintId, sets, library))
|
||||||
if (cultures == null || cultures.contains(blueprint.getCulture()))
|
if (cardTypes == null || cardTypes.contains(blueprint.getCardType()))
|
||||||
if (containsAllKeywords(blueprint, keywords))
|
if (cultures == null || cultures.contains(blueprint.getCulture()))
|
||||||
if (containsAllWords(blueprint, words))
|
if (containsAllKeywords(blueprint, keywords))
|
||||||
if (siteNumber == null || blueprint.getSiteNumber() == siteNumber)
|
if (containsAllWords(blueprint, words))
|
||||||
return true;
|
if (siteNumber == null || blueprint.getSiteNumber() == siteNumber)
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
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) {
|
private String getTypeFilter(String[] filterParams) {
|
||||||
for (String filterParam : filterParams) {
|
for (String filterParam : filterParams) {
|
||||||
if (filterParam.startsWith("type:"))
|
if (filterParam.startsWith("type:"))
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import com.gempukku.lotro.common.Side;
|
|||||||
import com.gempukku.lotro.db.DeckDAO;
|
import com.gempukku.lotro.db.DeckDAO;
|
||||||
import com.gempukku.lotro.game.*;
|
import com.gempukku.lotro.game.*;
|
||||||
import com.gempukku.lotro.hall.HallServer;
|
import com.gempukku.lotro.hall.HallServer;
|
||||||
|
import com.gempukku.lotro.logic.GameUtils;
|
||||||
import com.gempukku.lotro.logic.vo.LotroDeck;
|
import com.gempukku.lotro.logic.vo.LotroDeck;
|
||||||
import com.sun.jersey.spi.resource.Singleton;
|
import com.sun.jersey.spi.resource.Singleton;
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
@@ -82,6 +83,55 @@ public class DeckResource extends AbstractResource {
|
|||||||
return serializeDeck(deck);
|
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
|
@POST
|
||||||
@Produces(MediaType.APPLICATION_XML)
|
@Produces(MediaType.APPLICATION_XML)
|
||||||
public Document saveDeck(
|
public Document saveDeck(
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
<pre style="font-size:80%">
|
<pre style="font-size:80%">
|
||||||
<b>31 Mar. 2012</b>
|
<b>31 Mar. 2012</b>
|
||||||
- Added sub-titles to all cards.
|
- 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>
|
<b>30 Mar. 2012</b>
|
||||||
- "What Are We Waiting For?" should now skip only one Shadow phase, if player moves more than once.
|
- "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>")
|
this.infoDialog = $("<div></div>")
|
||||||
.dialog({
|
.dialog({
|
||||||
autoOpen: false,
|
autoOpen: false,
|
||||||
closeOnEscape: true,
|
closeOnEscape: true,
|
||||||
resizable: false,
|
resizable: false,
|
||||||
title: "Card information"
|
title: "Card information"
|
||||||
});
|
});
|
||||||
|
|
||||||
var swipeOptions = {
|
var swipeOptions = {
|
||||||
threshold: 20,
|
threshold: 20,
|
||||||
@@ -288,14 +288,14 @@ var GempLotrDeckBuildingUI = Class.extend({
|
|||||||
if (that.deckListDialog == null) {
|
if (that.deckListDialog == null) {
|
||||||
that.deckListDialog = $("<div></div>")
|
that.deckListDialog = $("<div></div>")
|
||||||
.dialog({
|
.dialog({
|
||||||
title: "Your stored decks",
|
title: "Your stored decks",
|
||||||
autoOpen: false,
|
autoOpen: false,
|
||||||
closeOnEscape: true,
|
closeOnEscape: true,
|
||||||
resizable: true,
|
resizable: true,
|
||||||
width: 400,
|
width: 400,
|
||||||
height: 400,
|
height: 400,
|
||||||
modal: true
|
modal: true
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
that.deckListDialog.html("");
|
that.deckListDialog.html("");
|
||||||
|
|
||||||
@@ -306,10 +306,12 @@ var GempLotrDeckBuildingUI = Class.extend({
|
|||||||
var deck = decks[i];
|
var deck = decks[i];
|
||||||
var deckName = decks[i].childNodes[0].nodeValue;
|
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 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 deleteDeckBut = $("<button title='Delete deck'><span class='ui-icon ui-icon-trash'></span></button>").button();
|
||||||
|
|
||||||
var deckElem = $("<div class='deckItem'></div>");
|
var deckElem = $("<div class='deckItem'></div>");
|
||||||
deckElem.append(openDeckBut);
|
deckElem.append(openDeckBut);
|
||||||
|
deckElem.append(deckListBut);
|
||||||
deckElem.append(deleteDeckBut);
|
deckElem.append(deleteDeckBut);
|
||||||
deckElem.append(deckName);
|
deckElem.append(deckName);
|
||||||
|
|
||||||
@@ -325,6 +327,13 @@ var GempLotrDeckBuildingUI = Class.extend({
|
|||||||
};
|
};
|
||||||
})(deckName));
|
})(deckName));
|
||||||
|
|
||||||
|
deckListBut.click(
|
||||||
|
(function(deckName) {
|
||||||
|
return function() {
|
||||||
|
window.open('/gemp-lotr/server/deck/html?deckName=' + encodeURIComponent(deckName), "_blank");
|
||||||
|
};
|
||||||
|
})(deckName));
|
||||||
|
|
||||||
deleteDeckBut.click(
|
deleteDeckBut.click(
|
||||||
(function(deckName) {
|
(function(deckName) {
|
||||||
return function() {
|
return function() {
|
||||||
@@ -393,14 +402,14 @@ var GempLotrDeckBuildingUI = Class.extend({
|
|||||||
if (this.selectionDialog == null) {
|
if (this.selectionDialog == null) {
|
||||||
this.selectionDialog = $("<div></div>")
|
this.selectionDialog = $("<div></div>")
|
||||||
.dialog({
|
.dialog({
|
||||||
title: "Choose one",
|
title: "Choose one",
|
||||||
autoOpen: false,
|
autoOpen: false,
|
||||||
closeOnEscape: true,
|
closeOnEscape: true,
|
||||||
resizable: true,
|
resizable: true,
|
||||||
width: 400,
|
width: 400,
|
||||||
height: 200,
|
height: 200,
|
||||||
modal: true
|
modal: true
|
||||||
});
|
});
|
||||||
|
|
||||||
this.selectionGroup = new NormalCardGroup(this.selectionDialog, function(card) {
|
this.selectionGroup = new NormalCardGroup(this.selectionDialog, function(card) {
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
Reference in New Issue
Block a user