diff --git a/gemp-lotr/gemp-lotr-cards/src/main/resources/blueprintMapping.txt b/gemp-lotr/gemp-lotr-cards/src/main/resources/blueprintMapping.txt index 79b46e941..cf7a3e640 100644 --- a/gemp-lotr/gemp-lotr-cards/src/main/resources/blueprintMapping.txt +++ b/gemp-lotr/gemp-lotr-cards/src/main/resources/blueprintMapping.txt @@ -1,2 +1,2 @@ -4_002,1_002 -4_062,1_041 \ No newline at end of file +4_2,1_2 +4_62,1_41 \ No newline at end of file diff --git a/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/collection/CollectionSerializer.java b/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/collection/CollectionSerializer.java index 5817621e9..d34039a30 100644 --- a/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/collection/CollectionSerializer.java +++ b/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/collection/CollectionSerializer.java @@ -107,7 +107,7 @@ public class CollectionSerializer { private MutableCardCollection deserializeCollectionVer0(BufferedInputStream inputStream) throws IOException { int packBytes = inputStream.read(); - DefaultCardCollection collection = new DefaultCardCollection(); + DefaultCardCollection collection = new DefaultCardCollection(_library); byte[] packs = new byte[packBytes]; int read = inputStream.read(packs); diff --git a/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/game/DefaultCardCollection.java b/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/game/DefaultCardCollection.java index bc58bd75c..84b7dadec 100644 --- a/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/game/DefaultCardCollection.java +++ b/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/game/DefaultCardCollection.java @@ -9,6 +9,11 @@ import java.util.*; public class DefaultCardCollection implements MutableCardCollection { private Map _counts = new TreeMap(new CardBlueprintIdComparator()); private Map _cards = new TreeMap(); + private LotroCardBlueprintLibrary _library; + + public DefaultCardCollection(LotroCardBlueprintLibrary library) { + _library = library; + } @Override public void addCards(String blueprintId, LotroCardBlueprint blueprint, int count) { @@ -34,7 +39,10 @@ public class DefaultCardCollection implements MutableCardCollection { filter = ""; String[] filterParams = filter.split(" "); - String set = getSetNumber(filterParams); + String setStr = getSetNumber(filterParams); + String[] sets = null; + if (setStr != null) + sets = setStr.split(","); List cardTypes = getEnumFilter(CardType.values(), CardType.class, "cardType", null, filterParams); List cultures = getEnumFilter(Culture.values(), Culture.class, "culture", null, filterParams); List keywords = getEnumFilter(Keyword.values(), Keyword.class, "keyword", Collections.emptyList(), filterParams); @@ -50,7 +58,7 @@ public class DefaultCardCollection implements MutableCardCollection { if (blueprint == null) result.add(new Item(Item.Type.PACK, count, blueprintId)); else { - if (set == null || blueprintId.startsWith(set + "_")) + if (sets == null || isInSets(blueprintId, sets)) if (cardTypes == null || cardTypes.contains(blueprint.getCardType())) if (cultures == null || cultures.contains(blueprint.getCulture())) if (containsAllKeywords(blueprint, keywords)) @@ -77,6 +85,14 @@ public class DefaultCardCollection implements MutableCardCollection { return result; } + private boolean isInSets(String blueprintId, String[] sets) { + for (String set : sets) + if (blueprintId.startsWith(set + "_") || _library.hasAlternateInSet(blueprintId, Integer.parseInt(set))) + return true; + + return false; + } + private String getSetNumber(String[] filterParams) { for (String filterParam : filterParams) { if (filterParam.startsWith("set:")) diff --git a/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/game/LotroServer.java b/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/game/LotroServer.java index 08675130b..d36639478 100644 --- a/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/game/LotroServer.java +++ b/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/game/LotroServer.java @@ -36,7 +36,7 @@ public class LotroServer extends AbstractServer { public LotroServer(DbAccess dbAccess, LotroCardBlueprintLibrary library, ChatServer chatServer, boolean test) { _lotroCardBlueprintLibrary = library; _chatServer = chatServer; - _defaultCollection = new DefaultCardCollection(); + _defaultCollection = new DefaultCardCollection(library); for (int i = 1; i <= 4; i++) { for (int j = 1; j <= 365; j++) { String blueprintId = i + "_" + j; diff --git a/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/game/formats/DefaultLotroFormat.java b/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/game/formats/DefaultLotroFormat.java index a2e2e4f7b..345c40ccd 100644 --- a/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/game/formats/DefaultLotroFormat.java +++ b/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/game/formats/DefaultLotroFormat.java @@ -78,7 +78,7 @@ public abstract class DefaultLotroFormat implements LotroFormat { throw new DeckInvalidException("One of the sites is from a different block than the format allows"); } - if (_validSets != null) { + if (_validSets.size() > 0) { validateSet(deck.getRingBearer()); validateSet(deck.getRing()); for (String site : deck.getSites()) diff --git a/gemp-lotr/gemp-lotr-server/src/test/java/com/gempukku/lotro/collection/CollectionSerializerTest.java b/gemp-lotr/gemp-lotr-server/src/test/java/com/gempukku/lotro/collection/CollectionSerializerTest.java index 48c6aa52d..7ff1a6644 100644 --- a/gemp-lotr/gemp-lotr-server/src/test/java/com/gempukku/lotro/collection/CollectionSerializerTest.java +++ b/gemp-lotr/gemp-lotr-server/src/test/java/com/gempukku/lotro/collection/CollectionSerializerTest.java @@ -3,6 +3,7 @@ package com.gempukku.lotro.collection; import com.gempukku.lotro.game.CardCollection; import com.gempukku.lotro.game.DefaultCardCollection; import com.gempukku.lotro.game.LotroCardBlueprintLibrary; +import static junit.framework.Assert.assertEquals; import org.junit.Test; import java.io.ByteArrayInputStream; @@ -10,19 +11,19 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.Map; -import static junit.framework.Assert.assertEquals; - public class CollectionSerializerTest { @Test public void testSerializeDeserialize() throws IOException { - DefaultCardCollection collection = new DefaultCardCollection(); + LotroCardBlueprintLibrary library = new LotroCardBlueprintLibrary(); + + DefaultCardCollection collection = new DefaultCardCollection(library); collection.addCards("1_1", null, 2); collection.addCards("1_231T", null, 3); collection.addCards("1_23*", null, 3); collection.addCards("1_237T*", null, 3); collection.addPacks("Fellowship of the Ring", 2); - CollectionSerializer serializer = new CollectionSerializer(new LotroCardBlueprintLibrary()); + CollectionSerializer serializer = new CollectionSerializer(library); ByteArrayOutputStream baos = new ByteArrayOutputStream(); serializer.serializeCollection(collection, baos); 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 b6e8895dd..b2a42edb5 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 @@ -2,7 +2,9 @@ 6 Oct. 2011 - "Hollowing of Isengard" now correctly discards itself upon use. - Playing attached permanents now can have twilight cost modified (as for example per "Fell Voice on the Air"). -- Now the cards played on a site are finally correctly displayed if in Adventure Path (this time I actually tested it). +- Now the cards played on a site are finally correctly displayed if in Adventure Path (this time I actually tested it). +- Added additional format for testing that allows cards from any set and any number of them. +- Added filtering by block and new sets. 5 Oct. 2011 - Added timestamps to the chat messages in GameHall. diff --git a/gemp-lotr/gemp-lotr-web/src/main/webapp/js/deckBuildingUi.js b/gemp-lotr/gemp-lotr-web/src/main/webapp/js/deckBuildingUi.js index 6ca432036..709304d45 100644 --- a/gemp-lotr/gemp-lotr-web/src/main/webapp/js/deckBuildingUi.js +++ b/gemp-lotr/gemp-lotr-web/src/main/webapp/js/deckBuildingUi.js @@ -64,9 +64,14 @@ var GempLotrDeckBuildingUI = Class.extend({ combos.append(""); combos.append("