diff --git a/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set1/isengard/Card1_120.java b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set1/isengard/Card1_120.java index 934ca4264..af47fe196 100644 --- a/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set1/isengard/Card1_120.java +++ b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set1/isengard/Card1_120.java @@ -38,14 +38,14 @@ public class Card1_120 extends AbstractPermanent { @Override public boolean checkPlayRequirements(String playerId, LotroGame game, PhysicalCard self, int twilightModifier) { return super.checkPlayRequirements(playerId, game, self, twilightModifier) - && Filters.canSpot(game.getGameState(), game.getModifiersQuerying(), Filters.culture(Culture.URUK_HAI), Filters.canExert()); + && Filters.canSpot(game.getGameState(), game.getModifiersQuerying(), Filters.race(Race.URUK_HAI), Filters.canExert()); } @Override public PlayPermanentAction getPlayCardAction(String playerId, LotroGame game, PhysicalCard self, int twilightModifier) { final PlayPermanentAction action = super.getPlayCardAction(playerId, game, self, twilightModifier); action.addCost( - new ChooseAndExertCharacterEffect(action, playerId, "Choose an Uruk-hai", true, Filters.culture(Culture.URUK_HAI), Filters.canExert())); + new ChooseAndExertCharacterEffect(action, playerId, "Choose an Uruk-hai", true, Filters.race(Race.URUK_HAI), Filters.canExert())); return action; } diff --git a/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set1/sauron/Card1_254.java b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set1/sauron/Card1_254.java index 2fdf17795..24013cfcd 100644 --- a/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set1/sauron/Card1_254.java +++ b/gemp-lotr/gemp-lotr-cards/src/main/java/com/gempukku/lotro/cards/set1/sauron/Card1_254.java @@ -25,7 +25,7 @@ import java.util.List; */ public class Card1_254 extends AbstractAttachable { public Card1_254() { - super(Side.SHADOW, CardType.CONDITION, 0, Culture.SHIRE, null, "Mordor Enraged"); + super(Side.SHADOW, CardType.CONDITION, 0, Culture.SAURON, null, "Mordor Enraged"); } @Override diff --git a/gemp-lotr/gemp-lotr-common/src/main/java/com/gempukku/lotro/common/Culture.java b/gemp-lotr/gemp-lotr-common/src/main/java/com/gempukku/lotro/common/Culture.java index c5246cc44..60117241a 100644 --- a/gemp-lotr/gemp-lotr-common/src/main/java/com/gempukku/lotro/common/Culture.java +++ b/gemp-lotr/gemp-lotr-common/src/main/java/com/gempukku/lotro/common/Culture.java @@ -2,5 +2,5 @@ package com.gempukku.lotro.common; public enum Culture { DWARVEN, ELVEN, GANDALF, GOLLUM, GONDOR, ROHAN, SHIRE, - DUNLAND, ISENGARD, MEN, MORIA, ORC, RAIDER, SAURON, URUK_HAI, WRAITH + DUNLAND, ISENGARD, MEN, MORIA, ORC, RAIDER, SAURON, WRAITH } 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 c99915fa0..0af4791c9 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 @@ -1,6 +1,7 @@ package com.gempukku.lotro.game; import com.gempukku.lotro.common.CardType; +import com.gempukku.lotro.common.Culture; import com.gempukku.lotro.common.Keyword; import java.util.*; @@ -20,7 +21,8 @@ public class DefaultCardCollection implements CardCollection { filter = ""; String[] filterParams = filter.split(" "); - List cardTypes = getEnumFilter(CardType.values(), CardType.class, "cardType", Arrays.asList(CardType.values()), filterParams); + 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); Integer siteNumber = getSiteNumber(filterParams); @@ -28,10 +30,11 @@ public class DefaultCardCollection implements CardCollection { for (Map.Entry stringLotroCardBlueprintEntry : _cards.entrySet()) { String blueprintId = stringLotroCardBlueprintEntry.getKey(); LotroCardBlueprint blueprint = stringLotroCardBlueprintEntry.getValue(); - if (cardTypes.contains(blueprint.getCardType())) - if (containsAllKeywords(blueprint, keywords)) - if (siteNumber == null || blueprint.getSiteNumber() == siteNumber.intValue()) - result.put(blueprintId, _cardsCount.get(blueprintId)); + if (cardTypes == null || cardTypes.contains(blueprint.getCardType())) + if (cultures == null || cultures.contains(blueprint.getCulture())) + if (containsAllKeywords(blueprint, keywords)) + if (siteNumber == null || blueprint.getSiteNumber() == siteNumber.intValue()) + result.put(blueprintId, _cardsCount.get(blueprintId)); } return result; } diff --git a/gemp-lotr/gemp-lotr-web/src/main/java/com/gempukku/lotro/server/ServerResource.java b/gemp-lotr/gemp-lotr-web/src/main/java/com/gempukku/lotro/server/ServerResource.java index 0f51ce875..f7ddebe2c 100644 --- a/gemp-lotr/gemp-lotr-web/src/main/java/com/gempukku/lotro/server/ServerResource.java +++ b/gemp-lotr/gemp-lotr-web/src/main/java/com/gempukku/lotro/server/ServerResource.java @@ -35,7 +35,7 @@ import java.util.Set; @Path("/") public class ServerResource { private static final Logger _logger = Logger.getLogger(ServerResource.class); - private boolean _test = false; + private boolean _test = true; private HallServer _hallServer; private LotroServer _lotroServer; diff --git a/gemp-lotr/gemp-lotr-web/src/main/webapp/deckBuild.html b/gemp-lotr/gemp-lotr-web/src/main/webapp/deckBuild.html index 700f5c151..d822fd2e4 100644 --- a/gemp-lotr/gemp-lotr-web/src/main/webapp/deckBuild.html +++ b/gemp-lotr/gemp-lotr-web/src/main/webapp/deckBuild.html @@ -46,8 +46,6 @@ diff --git a/gemp-lotr/gemp-lotr-web/src/main/webapp/images/ajax-loader.gif b/gemp-lotr/gemp-lotr-web/src/main/webapp/images/ajax-loader.gif new file mode 100644 index 000000000..ac3a2e890 Binary files /dev/null and b/gemp-lotr/gemp-lotr-web/src/main/webapp/images/ajax-loader.gif differ diff --git a/gemp-lotr/gemp-lotr-web/src/main/webapp/images/cultures/dwarven.gif b/gemp-lotr/gemp-lotr-web/src/main/webapp/images/cultures/dwarven.gif new file mode 100644 index 000000000..40fcbb29b Binary files /dev/null and b/gemp-lotr/gemp-lotr-web/src/main/webapp/images/cultures/dwarven.gif differ diff --git a/gemp-lotr/gemp-lotr-web/src/main/webapp/images/cultures/elven.gif b/gemp-lotr/gemp-lotr-web/src/main/webapp/images/cultures/elven.gif new file mode 100644 index 000000000..99e482ef7 Binary files /dev/null and b/gemp-lotr/gemp-lotr-web/src/main/webapp/images/cultures/elven.gif differ diff --git a/gemp-lotr/gemp-lotr-web/src/main/webapp/images/cultures/gandalf.gif b/gemp-lotr/gemp-lotr-web/src/main/webapp/images/cultures/gandalf.gif new file mode 100644 index 000000000..7e53d0887 Binary files /dev/null and b/gemp-lotr/gemp-lotr-web/src/main/webapp/images/cultures/gandalf.gif differ diff --git a/gemp-lotr/gemp-lotr-web/src/main/webapp/images/cultures/gollum.gif b/gemp-lotr/gemp-lotr-web/src/main/webapp/images/cultures/gollum.gif new file mode 100644 index 000000000..a71c5c4b9 Binary files /dev/null and b/gemp-lotr/gemp-lotr-web/src/main/webapp/images/cultures/gollum.gif differ diff --git a/gemp-lotr/gemp-lotr-web/src/main/webapp/images/cultures/gondor.gif b/gemp-lotr/gemp-lotr-web/src/main/webapp/images/cultures/gondor.gif new file mode 100644 index 000000000..b37ff4084 Binary files /dev/null and b/gemp-lotr/gemp-lotr-web/src/main/webapp/images/cultures/gondor.gif differ diff --git a/gemp-lotr/gemp-lotr-web/src/main/webapp/images/cultures/men.gif b/gemp-lotr/gemp-lotr-web/src/main/webapp/images/cultures/men.gif new file mode 100644 index 000000000..a0d28a9a7 Binary files /dev/null and b/gemp-lotr/gemp-lotr-web/src/main/webapp/images/cultures/men.gif differ diff --git a/gemp-lotr/gemp-lotr-web/src/main/webapp/images/cultures/moria.gif b/gemp-lotr/gemp-lotr-web/src/main/webapp/images/cultures/moria.gif new file mode 100644 index 000000000..056fc1553 Binary files /dev/null and b/gemp-lotr/gemp-lotr-web/src/main/webapp/images/cultures/moria.gif differ diff --git a/gemp-lotr/gemp-lotr-web/src/main/webapp/images/cultures/orc.gif b/gemp-lotr/gemp-lotr-web/src/main/webapp/images/cultures/orc.gif new file mode 100644 index 000000000..0db99476b Binary files /dev/null and b/gemp-lotr/gemp-lotr-web/src/main/webapp/images/cultures/orc.gif differ diff --git a/gemp-lotr/gemp-lotr-web/src/main/webapp/images/cultures/rohan.gif b/gemp-lotr/gemp-lotr-web/src/main/webapp/images/cultures/rohan.gif new file mode 100644 index 000000000..3cea457e8 Binary files /dev/null and b/gemp-lotr/gemp-lotr-web/src/main/webapp/images/cultures/rohan.gif differ diff --git a/gemp-lotr/gemp-lotr-web/src/main/webapp/images/cultures/sauron.gif b/gemp-lotr/gemp-lotr-web/src/main/webapp/images/cultures/sauron.gif new file mode 100644 index 000000000..c9aac0091 Binary files /dev/null and b/gemp-lotr/gemp-lotr-web/src/main/webapp/images/cultures/sauron.gif differ diff --git a/gemp-lotr/gemp-lotr-web/src/main/webapp/images/cultures/shire.gif b/gemp-lotr/gemp-lotr-web/src/main/webapp/images/cultures/shire.gif new file mode 100644 index 000000000..c38fbb1c7 Binary files /dev/null and b/gemp-lotr/gemp-lotr-web/src/main/webapp/images/cultures/shire.gif differ diff --git a/gemp-lotr/gemp-lotr-web/src/main/webapp/images/cultures/uruk-hai.gif b/gemp-lotr/gemp-lotr-web/src/main/webapp/images/cultures/uruk-hai.gif new file mode 100644 index 000000000..1dd3d081f Binary files /dev/null and b/gemp-lotr/gemp-lotr-web/src/main/webapp/images/cultures/uruk-hai.gif differ diff --git a/gemp-lotr/gemp-lotr-web/src/main/webapp/images/cultures/wraith.gif b/gemp-lotr/gemp-lotr-web/src/main/webapp/images/cultures/wraith.gif new file mode 100644 index 000000000..6a279765c Binary files /dev/null and b/gemp-lotr/gemp-lotr-web/src/main/webapp/images/cultures/wraith.gif differ 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 7cffdd2a1..30cd021d6 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 @@ -1,4 +1,7 @@ var GempLotrDeckBuildingUI = Class.extend({ + comm: null, + + collectionType: "default", deckDiv: null, ringBearerDiv: null, ringBearerGroup: null, @@ -11,53 +14,103 @@ var GempLotrDeckBuildingUI = Class.extend({ normalCollectionGroup: null, specialCollectionDiv: null, specialCollectionGroup: null, - loadCollectionFunc: null, - saveDeckFunc: null, selectionFunc: null, + pageDiv: null, filterDiv: null, drawDeckDiv: null, drawDeckGroup: null, start: 0, count: 18, + filter: null, init: function() { var that = this; + this.filter = "cardType:-SITE,THE_ONE_RING"; + + this.comm = new GempLotrCommunication("/gemp-lotr/server", that.processError); + this.deckDiv = $("#deckDiv"); this.collectionDiv = $("#collectionDiv"); + this.pageDiv = $("
"); + this.pageDiv.append(""); + this.pageDiv.append(""); + this.pageDiv.append("
"); + this.collectionDiv.append(this.pageDiv); + this.filterDiv = $("
"); - this.filterDiv.append(""); - this.filterDiv.append(""); + + this.filterDiv.append("
" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "" + + "
"); + this.collectionDiv.append(this.filterDiv); + $("#culture").buttonset(); + + $("#labelDWARVEN,#labelELVEN,#labelGANDALF,#labelGONDOR,#labelSHIRE,#labelISENGARD,#labelMORIA,#labelSAURON,#labelWRAITH").click( + function() { + that.filter = that.calculateNormalFilter(); + that.start = 0; + that.getCollection(); + return true; + }); + + $("#countSlider").slider({ + value:18, + min: 4, + max: 40, + step: 1, + disabled: true, + slide: function(event, ui) { + that.start = 0; + that.count = ui.value; + that.getCollection(); + } + }); + $("#previousPage").button({ text: false, icons: { primary: "ui-icon-circle-triangle-w" - } + }, + disabled: true }).click( function() { $("#previousPage").button("option", "disabled", true); $("#nextPage").button("option", "disabled", true); + $("#countSlider").button("option", "disabled", true); $(".card", that.normalCollectionDiv).remove(); + $(".card", that.specialCollectionDiv).remove(); that.start -= that.count; - that.loadCollectionFunc("default", "cardType:-SITE,THE_ONE_RING", that.start, that.count); + that.getCollection(); }); $("#nextPage").button({ text: false, icons: { primary: "ui-icon-circle-triangle-e" - } + }, + disabled: true }).click( function() { $("#previousPage").button("option", "disabled", true); $("#nextPage").button("option", "disabled", true); + $("#countSlider").button("option", "disabled", true); $(".card", that.normalCollectionDiv).remove(); + $(".card", that.specialCollectionDiv).remove(); that.start += that.count; - that.loadCollectionFunc("default", "cardType:-SITE,THE_ONE_RING", that.start, that.count); + that.getCollection(); }); this.normalCollectionDiv = $("
"); @@ -78,8 +131,8 @@ var GempLotrDeckBuildingUI = Class.extend({ this.ringBearerDiv = $("
Ring Bearer
"); this.ringBearerDiv.click( function() { - $(".card", that.ringBearerDiv).remove(); - that.showPredefinedFilter("keyword:RING_BEARER", that.ringBearerDiv); + if ($(".card", this.ringBearerDiv).length == 0) + that.showPredefinedFilter("keyword:RING_BEARER", that.ringBearerDiv); }); this.ringBearerGroup = new NormalCardGroup(this.ringBearerDiv, function(card) { return true; @@ -89,8 +142,8 @@ var GempLotrDeckBuildingUI = Class.extend({ this.ringDiv = $("
Ring
"); this.ringDiv.click( function() { - $(".card", that.ringDiv).remove(); - that.showPredefinedFilter("cardType:THE_ONE_RING", that.ringDiv); + if ($(".card", this.ringDiv).length == 0) + that.showPredefinedFilter("cardType:THE_ONE_RING", that.ringDiv); }); this.ringGroup = new NormalCardGroup(this.ringDiv, function(card) { return true; @@ -104,8 +157,8 @@ var GempLotrDeckBuildingUI = Class.extend({ siteDiv.click( (function (siteNumber, container) { return function() { - $(".card", container).remove(); - that.showPredefinedFilter("cardType:SITE siteNumber:" + siteNumber, container); + if ($(".card", container).length == 0) + that.showPredefinedFilter("cardType:SITE siteNumber:" + siteNumber, container); }; })(i, siteDiv)); this.deckDiv.append(siteDiv); @@ -141,17 +194,52 @@ var GempLotrDeckBuildingUI = Class.extend({ var selectedCardElem = tar.parent(); if (event.which == 1) { if (event.shiftKey) { - // that.displayCardInfo(selectedCardElem.data("card")); + that.displayCardInfo(selectedCardElem.data("card")); } else if (selectedCardElem.hasClass("cardInCollection")) { that.selectionFunc(selectedCardElem.data("card").blueprintId); } else if (selectedCardElem.hasClass("cardInDeck")) { that.removeCardFromDeck(selectedCardElem); } + return false; } } } return false; }); + + this.infoDialog = $("
") + .dialog({ + autoOpen: false, + closeOnEscape: true, + resizable: true, + title: "Card information", + minHeight: 80, + minWidth: 200, + width: 600, + height: 300 + }); + + var swipeOptions = { + threshold: 20, + swipeUp: function (event) { + that.infoDialog.prop({ scrollTop: that.infoDialog.prop("scrollHeight") }); + return false; + }, + swipeDown: function (event) { + that.infoDialog.prop({ scrollTop: 0 }); + return false; + } + }; + this.infoDialog.swipe(swipeOptions); + + this.comm.getDeck("default", function(xml) { + that.setupDeck(xml); + }); + }, + + displayCardInfo: function(card) { + this.infoDialog.html("
"); + this.infoDialog.dialog("open"); }, saveDeck: function() { @@ -189,7 +277,9 @@ var GempLotrDeckBuildingUI = Class.extend({ cards.push($(this).data("card").blueprintId); }); - this.saveDeckFunc("default", "" + cards); + this.comm.saveDeck("default", "" + cards, function(xml) { + alert("Deck was saved"); + }); } }, @@ -206,16 +296,41 @@ var GempLotrDeckBuildingUI = Class.extend({ this.normalCollectionDiv.hide(); this.filterDiv.hide(); this.specialCollectionDiv.show(); - this.loadCollectionFunc("default", filter, 0, 18); + + this.filter = filter; + this.start = 0; + this.getCollection(); this.selectionFunc = function(blueprintId) { - this.addCardToContainer(blueprintId, "special", container); - this.specialCollectionDiv.hide(); - this.normalCollectionDiv.show(); - this.filterDiv.show(); - this.selectionFunc = this.addCardToDeck; + var cardDiv = this.addCardToContainer(blueprintId, "special", container); + cardDiv.addClass("cardInDeck"); + this.showNormalFilter(); }; }, + showNormalFilter: function() { + this.specialCollectionDiv.hide(); + this.normalCollectionDiv.show(); + this.filterDiv.show(); + + this.filter = this.calculateNormalFilter(); + this.start = 0; + this.getCollection(); + this.selectionFunc = this.addCardToDeck; + }, + + calculateNormalFilter: function() { + var cultures = new Array(); + $("label", $("#culture")).each( + function() { + if ($(this).hasClass("ui-state-active")) + cultures.push($(this).prop("id").substring(5)); + }); + if (cultures.length > 0) + return "cardType:-SITE,THE_ONE_RING culture:" + cultures; + else + return "cardType:-SITE,THE_ONE_RING"; + }, + addCardToDeck: function(blueprintId) { var that = this; var added = false; @@ -246,12 +361,11 @@ var GempLotrDeckBuildingUI = Class.extend({ this.layoutUI(); }, - setLoadCollectionFunc: function(func) { - this.loadCollectionFunc = func; - }, - - setSaveDeckFunc: function(func) { - this.saveDeckFunc = func; + getCollection: function() { + var that = this; + this.comm.getCollection(this.collectionType, this.filter, this.start, this.count, function(xml) { + that.displayCollection(xml); + }); }, setupDeck: function(xml) { @@ -259,11 +373,11 @@ var GempLotrDeckBuildingUI = Class.extend({ if (root.tagName == "deck") { var ringBearer = root.getElementsByTagName("ringBearer"); if (ringBearer.length == 1) { - this.addCardToContainer(ringBearer[0].getAttribute("blueprintId"), "deck", this.ringBearerDiv); - this.addCardToContainer(root.getElementsByTagName("ring")[0].getAttribute("blueprintId"), "deck", this.ringDiv); + this.addCardToContainer(ringBearer[0].getAttribute("blueprintId"), "deck", this.ringBearerDiv).addClass("cardInDeck"); + this.addCardToContainer(root.getElementsByTagName("ring")[0].getAttribute("blueprintId"), "deck", this.ringDiv).addClass("cardInDeck"); var sites = root.getElementsByTagName("site"); for (var i = 0; i < 9; i++) - this.addCardToContainer(sites[i].getAttribute("blueprintId"), "deck", this.siteDivs[i]); + this.addCardToContainer(sites[i].getAttribute("blueprintId"), "deck", this.siteDivs[i]).addClass("cardInDeck"); var cards = root.getElementsByTagName("card"); for (var i = 0; i < cards.length; i++) @@ -272,7 +386,7 @@ var GempLotrDeckBuildingUI = Class.extend({ this.layoutUI(); } - this.loadCollectionFunc("default", "cardType:-SITE,THE_ONE_RING", this.start, this.count); + this.getCollection(); } }, @@ -304,11 +418,10 @@ var GempLotrDeckBuildingUI = Class.extend({ this.normalCollectionGroup.layoutCards(); this.specialCollectionGroup.layoutCards(); - if (this.normalCollectionDiv.is(":visible")) { - $("#previousPage").button("option", "disabled", this.start == 0); - var cnt = parseInt(root.getAttribute("count")); - $("#nextPage").button("option", "disabled", (this.start + this.count) >= cnt); - } + $("#previousPage").button("option", "disabled", this.start == 0); + var cnt = parseInt(root.getAttribute("count")); + $("#nextPage").button("option", "disabled", (this.start + this.count) >= cnt); + $("#countSlider").slider("option", "disabled", false); } }, @@ -341,11 +454,12 @@ var GempLotrDeckBuildingUI = Class.extend({ this.bottomBarDiv.css({ position: "absolute", left: sitesWidth * 2, top: deckHeight - 50, width: deckWidth - sitesWidth * 2, height: 50 }); - this.normalCollectionDiv.css({ position: "absolute", left: padding, top: 50, width: collectionWidth - padding * 2, height: collectionHeight - 50 }); - this.filterDiv.css({ position: "absolute", left: padding, top: 0, width: collectionWidth - padding, height: 50 }); - this.specialCollectionDiv.css({ position: "absolute", left: padding, top: 0, width: collectionWidth - padding * 2, height: collectionHeight }); + this.filterDiv.css({ position: "absolute", left: padding, top: 50, width: collectionWidth - padding, height: 50 }); + this.normalCollectionDiv.css({ position: "absolute", left: padding, top: 100, width: collectionWidth - padding * 2, height: collectionHeight - 100 }); + this.pageDiv.css({ position: "absolute", left: padding, top: 0, width: collectionWidth - padding, height: 50 }); + this.specialCollectionDiv.css({ position: "absolute", left: padding, top: 50, width: collectionWidth - padding * 2, height: collectionHeight - 50 }); - this.normalCollectionGroup.setBounds(0, 0, collectionWidth - padding * 2, collectionHeight - 50); + this.normalCollectionGroup.setBounds(0, 0, collectionWidth - padding * 2, collectionHeight - 100); this.specialCollectionGroup.setBounds(0, 0, collectionWidth - padding * 2, collectionHeight); },