diff --git a/gemp-lotr/gemp-lotr-async/src/main/web/js/gemp-022/hallUi.js b/gemp-lotr/gemp-lotr-async/src/main/web/js/gemp-022/hallUi.js
index a10e2abd6..c02aba207 100644
--- a/gemp-lotr/gemp-lotr-async/src/main/web/js/gemp-022/hallUi.js
+++ b/gemp-lotr/gemp-lotr-async/src/main/web/js/gemp-022/hallUi.js
@@ -53,17 +53,17 @@ var GempLotrHallUI = Class.extend({
this.chat = chat;
this.chat.tournamentCallback = function(from, message) {
- var thisName = that.userInfo.name
+ var thisName = that.userInfo.name
if (from == "TournamentSystem" && that.inTournament) {
that.showDialog("Tournament Update", message, 320);
} else if (from.startsWith("TournamentSystemTo:")) {
- // Extract and split the user list
- let users = from.split(":")[1].split(";");
+ // Extract and split the user list
+ let users = from.split(":")[1].split(";");
- // Check if thisName is in the list
- if (users.includes(thisName)) {
- that.showDialog("Tournament Update", message, 320);
- }
+ // Check if thisName is in the list
+ if (users.includes(thisName)) {
+ that.showDialog("Tournament Update", message, 320);
+ }
}
};
@@ -144,6 +144,12 @@ var GempLotrHallUI = Class.extend({
that.createTableButton.addClass("ui-state-disabled")
that.createTableButton.removeClass("ui-state-focus")
var format = that.supportedFormatsSelect.val();
+
+ if(format == null || format === "") {
+ that.showErrorDialog("Table creation error", "You must select a format", false, false);
+ return;
+ }
+
var deck = that.decksSelect.val();
var tableDesc = that.tableDescInput.val();
var timer = that.timerSelect.val();
@@ -491,57 +497,57 @@ var GempLotrHallUI = Class.extend({
})(queue));
actionsField.append(but);
- if (queue.getAttribute("startable") == "true") {
- var startBut = $("");
- $(startBut).button().click((
- function(queueInfo) {
- return function() {
- var queueId = queueInfo.getAttribute("id");
- that.comm.startQueue(queueId, function (xml) {
- var result = that.processResponse(xml);
- });
- }
- })(queue));
- actionsField.append(startBut);
- }
+ if (queue.getAttribute("startable") == "true") {
+ var startBut = $("");
+ $(startBut).button().click((
+ function(queueInfo) {
+ return function() {
+ var queueId = queueInfo.getAttribute("id");
+ that.comm.startQueue(queueId, function (xml) {
+ var result = that.processResponse(xml);
+ });
+ }
+ })(queue));
+ actionsField.append(startBut);
+ }
- if (+queue.getAttribute("readyCheckSecsRemaining") > -1) {
- if ($("button:contains('READY CHECK')").length === 0 && queue.getAttribute("confirmedReadyCheck") == "false") {
- that.showDialog("Ready Check", "Ready Check started for the " + queue.getAttribute("queue")
- + " tournament.
To confirm you are present, click the Ready Check button within next "
- + queue.getAttribute("readyCheckSecsRemaining") + " seconds.", 230);
- }
- var checkBut = $("");
- $(checkBut).button().click((
- function(queueInfo) {
- return function() {
- var queueId = queueInfo.getAttribute("id");
- that.comm.confirmReadyCheckQueue(queueId, function (xml) {
- var result = that.processResponse(xml);
- });
- }
- })(queue));
- actionsField.append(checkBut);
- if (queue.getAttribute("confirmedReadyCheck") == "true") {
- $(checkBut).prop("disabled", true).text("Waiting for others - " + queue.getAttribute("readyCheckSecsRemaining") + " s");
- }
- }
+ if (+queue.getAttribute("readyCheckSecsRemaining") > -1) {
+ if ($("button:contains('READY CHECK')").length === 0 && queue.getAttribute("confirmedReadyCheck") == "false") {
+ that.showDialog("Ready Check", "Ready Check started for the " + queue.getAttribute("queue")
+ + " tournament.
To confirm you are present, click the Ready Check button within next "
+ + queue.getAttribute("readyCheckSecsRemaining") + " seconds.", 230);
+ }
+ var checkBut = $("");
+ $(checkBut).button().click((
+ function(queueInfo) {
+ return function() {
+ var queueId = queueInfo.getAttribute("id");
+ that.comm.confirmReadyCheckQueue(queueId, function (xml) {
+ var result = that.processResponse(xml);
+ });
+ }
+ })(queue));
+ actionsField.append(checkBut);
+ if (queue.getAttribute("confirmedReadyCheck") == "true") {
+ $(checkBut).prop("disabled", true).text("Waiting for others - " + queue.getAttribute("readyCheckSecsRemaining") + " s");
+ }
+ }
}
- var type = queue.getAttribute("type");
- if(type !== null)
- type = type.toLowerCase();
- if(type === "sealed") {
- type = "Sealed";
- }
- else if (type === "solodraft") {
- type = "Solo Draft";
- }
- else if (type === "table_solodraft") {
- type = "Solo Table Draft";
- }
- else if (type === "table_draft") {
- type = "Table Draft";
- }
+ var type = queue.getAttribute("type");
+ if(type !== null)
+ type = type.toLowerCase();
+ if(type === "sealed") {
+ type = "Sealed";
+ }
+ else if (type === "solodraft") {
+ type = "Solo Draft";
+ }
+ else if (type === "table_solodraft") {
+ type = "Solo Table Draft";
+ }
+ else if (type === "table_draft") {
+ type = "Table Draft";
+ }
var rowstr = "
| " + queue.getAttribute("format") + " | ";
var startTd = "" + queue.getAttribute("start") + " | ";
@@ -556,10 +562,10 @@ var GempLotrHallUI = Class.extend({
"
";
} else if (type.includes("Sealed") || type.includes("Draft")) {
// No prizes and cost displayed for limited games
- rowstr += "" + type + " | ";
+ rowstr += "" + type + " | ";
rowstr += "" + queue.getAttribute("queue") + " | " +
startTd +
@@ -581,25 +587,25 @@ var GempLotrHallUI = Class.extend({
row.append(actionsField);
// Row for tournament queue waiting table
- var tablesRow = $("
");
- tablesRow.append("" + queue.getAttribute("format") + " | ");
- let htmlTd = " ";
- if (isWC) {
- htmlTd += "WC";
- } else {
- htmlTd += "Tournament"
- }
- htmlTd += " - " + type + " - " + queue.getAttribute("queue") + " | ";
- tablesRow.append(htmlTd);
- tablesRow.append("" + queue.getAttribute("start") + " | ");
- tablesRow.append("" + queue.getAttribute("playerList") + " | ");
- var actionsFieldClone = actionsField.clone(true);
- tablesRow.append(actionsFieldClone);
- if (joined == "true")
+ var tablesRow = $("
");
+ tablesRow.append("" + queue.getAttribute("format") + " | ");
+ let htmlTd = " ";
+ if (isWC) {
+ htmlTd += "WC";
+ } else {
+ htmlTd += "Tournament"
+ }
+ htmlTd += " - " + type + " - " + queue.getAttribute("queue") + " | ";
+ tablesRow.append(htmlTd);
+ tablesRow.append("" + queue.getAttribute("start") + " | ");
+ tablesRow.append("" + queue.getAttribute("playerList") + " | ");
+ var actionsFieldClone = actionsField.clone(true);
+ tablesRow.append(actionsFieldClone);
+ if (joined == "true")
tablesRow.addClass("played");
if (action == "add") {
@@ -607,44 +613,44 @@ var GempLotrHallUI = Class.extend({
$("table.wc-queues", this.tablesDiv)
.append(row);
} else if (type.includes("Sealed")) {
- $("table.sealedQueues", this.tablesDiv)
- .append(row);
- } else if (type.includes("Draft")) {
+ $("table.sealedQueues", this.tablesDiv)
+ .append(row);
+ } else if (type.includes("Draft")) {
$("table.draftQueues", this.tablesDiv)
.append(row);
} else {
$("table.queues", this.tablesDiv)
.append(row);
}
- // Display queues with waiting players also as waiting tables
- if (queue.getAttribute("playerCount") != 0 || isWC) {
- $("table.waitingTables", this.tablesDiv)
- .append(tablesRow);
- }
+ // Display queues with waiting players also as waiting tables
+ if (queue.getAttribute("playerCount") != 0 || isWC) {
+ $("table.waitingTables", this.tablesDiv)
+ .append(tablesRow);
+ }
} else if (action == "update") {
$(".queue" + id, this.tablesDiv).replaceWith(row);
- // Display queues with waiting players also as waiting tables
- if (queue.getAttribute("playerCount") != 0) {
- var existingRow = $(".table" + id, this.tablesDiv);
- if (existingRow.length > 0) {
- // If the row exists, replace it
- existingRow.replaceWith(tablesRow);
- } else {
- // If the row does not exist, append it
- $("table.waitingTables", this.tablesDiv).append(tablesRow);
- }
- } else if (queue.getAttribute("playerCount") == 0) {
- // Remove tournaments displayed as tables
- $(".table" + id, this.tablesDiv).remove();
- }
+ // Display queues with waiting players also as waiting tables
+ if (queue.getAttribute("playerCount") != 0) {
+ var existingRow = $(".table" + id, this.tablesDiv);
+ if (existingRow.length > 0) {
+ // If the row exists, replace it
+ existingRow.replaceWith(tablesRow);
+ } else {
+ // If the row does not exist, append it
+ $("table.waitingTables", this.tablesDiv).append(tablesRow);
+ }
+ } else if (queue.getAttribute("playerCount") == 0) {
+ // Remove tournaments displayed as tables
+ $(".table" + id, this.tablesDiv).remove();
+ }
}
this.animateRowUpdate(".queue" + id);
} else if (action == "remove") {
- $(".queue" + id, this.tablesDiv).remove();
- // Remove tournaments displayed as tables
- $(".table" + id, this.tablesDiv).remove();
+ $(".queue" + id, this.tablesDiv).remove();
+ // Remove tournaments displayed as tables
+ $(".table" + id, this.tablesDiv).remove();
}
}
@@ -683,13 +689,13 @@ var GempLotrHallUI = Class.extend({
function(tourneyInfo) {
var tourneyId = tournament.getAttribute("id");
- return function() {
- var win = window.open("/gemp-lotr/soloDraft.html?eventId=" + tourneyId, '_blank');
- if (win) {
- //Browser has allowed it to be opened
- win.focus();
- }
- }
+ return function() {
+ var win = window.open("/gemp-lotr/soloDraft.html?eventId=" + tourneyId, '_blank');
+ if (win) {
+ //Browser has allowed it to be opened
+ win.focus();
+ }
+ }
}
)(tournament));
actionsField.append(but);
@@ -700,13 +706,13 @@ var GempLotrHallUI = Class.extend({
function(tourneyInfo) {
var tourneyId = tournament.getAttribute("id");
- return function() {
- var win = window.open("/gemp-lotr/tableDraft.html?eventId=" + tourneyId, '_blank');
- if (win) {
- //Browser has allowed it to be opened
- win.focus();
- }
- }
+ return function() {
+ var win = window.open("/gemp-lotr/tableDraft.html?eventId=" + tourneyId, '_blank');
+ if (win) {
+ //Browser has allowed it to be opened
+ win.focus();
+ }
+ }
}
)(tournament));
actionsField.append(but);
@@ -717,13 +723,13 @@ var GempLotrHallUI = Class.extend({
function(tourneyInfo) {
var tourneyId = tournament.getAttribute("id");
- return function() {
- var win = window.open("/gemp-lotr/tableDraft.html?eventId=" + tourneyId, '_blank');
- if (win) {
- //Browser has allowed it to be opened
- win.focus();
- }
- }
+ return function() {
+ var win = window.open("/gemp-lotr/tableDraft.html?eventId=" + tourneyId, '_blank');
+ if (win) {
+ //Browser has allowed it to be opened
+ win.focus();
+ }
+ }
}
)(tournament));
actionsField.append(but);
@@ -799,7 +805,7 @@ var GempLotrHallUI = Class.extend({
}
else if (type === "table_solodraft") {
rowstr += "Solo Table Draft | ";
- }
+ }
else if (type === "table_draft") {
rowstr += "Table Draft | ";
}
@@ -808,44 +814,44 @@ var GempLotrHallUI = Class.extend({
}
}
rowstr += "" + tournament.getAttribute("name") + " | " +
- "" + tournament.getAttribute("system") + " | ";
- if (tournament.hasAttribute("timeRemaining")) {
- rowstr += "" + tournament.getAttribute("stage") + " - " + tournament.getAttribute("timeRemaining") + " | ";
- } else {
- rowstr += "" + tournament.getAttribute("stage") + " | ";
- }
- rowstr += "" + tournament.getAttribute("round") + " | " +
- "" + tournament.getAttribute("playerCount") + " | ";
+ "" + tournament.getAttribute("system") + " | ";
+ if (tournament.hasAttribute("timeRemaining")) {
+ rowstr += "" + tournament.getAttribute("stage") + " - " + tournament.getAttribute("timeRemaining") + " | ";
+ } else {
+ rowstr += "" + tournament.getAttribute("stage") + " | ";
+ }
+ rowstr += "" + tournament.getAttribute("round") + " | " +
+ "" + tournament.getAttribute("playerCount") + " | ";
var row = $(rowstr);
row.append(actionsField);
- // Row for tournament playing table
- var displayType = type;
- if(type === "sealed") {
- displayType = "Sealed";
- }
- else if (type === "solodraft") {
- displayType = "Solo Draft";
- }
- else if (type === "table_solodraft") {
- displayType = "Solo Table Draft";
- }
- else if (type === "table_draft") {
- displayType = "Table Draft";
- }
- var tablesRow = $("
");
- tablesRow.append("" + tournament.getAttribute("format") + " | ");
- tablesRow.append(" Tournament - " + displayType + " - " + tournament.getAttribute("name") + " | ");
- if (tournament.hasAttribute("timeRemaining")) {
- tablesRow.append("" + tournament.getAttribute("stage") + " - " + tournament.getAttribute("timeRemaining") + " | ");
- } else {
- tablesRow.append("" + tournament.getAttribute("stage") + " | ");
- }
- tablesRow.append("" + tournament.getAttribute("playerList") + " | ");
- var actionsFieldClone = actionsField.clone(true);
- tablesRow.append(actionsFieldClone);
+ // Row for tournament playing table
+ var displayType = type;
+ if(type === "sealed") {
+ displayType = "Sealed";
+ }
+ else if (type === "solodraft") {
+ displayType = "Solo Draft";
+ }
+ else if (type === "table_solodraft") {
+ displayType = "Solo Table Draft";
+ }
+ else if (type === "table_draft") {
+ displayType = "Table Draft";
+ }
+ var tablesRow = $("
");
+ tablesRow.append("" + tournament.getAttribute("format") + " | ");
+ tablesRow.append(" Tournament - " + displayType + " - " + tournament.getAttribute("name") + " | ");
+ if (tournament.hasAttribute("timeRemaining")) {
+ tablesRow.append("" + tournament.getAttribute("stage") + " - " + tournament.getAttribute("timeRemaining") + " | ");
+ } else {
+ tablesRow.append("" + tournament.getAttribute("stage") + " | ");
+ }
+ tablesRow.append("" + tournament.getAttribute("playerList") + " | ");
+ var actionsFieldClone = actionsField.clone(true);
+ tablesRow.append(actionsFieldClone);
if (joined == "true")
tablesRow.addClass("played"); // red highlight
@@ -857,43 +863,43 @@ var GempLotrHallUI = Class.extend({
$("table.tournaments", this.tablesDiv)
.append(row);
}
- // Display running tournaments also as playing tables
- $("table.playingTables", this.tablesDiv)
- .append(tablesRow)
+ // Display running tournaments also as playing tables
+ $("table.playingTables", this.tablesDiv)
+ .append(tablesRow)
- if (joined == "true") {
- // Open draft window
- if ((type === "table_solodraft" && (stage === "deck-building" || stage === "registering decks" || stage === "awaiting kickoff"))
- || (type === "table_draft" && stage === "drafting")) {
- var tourneyId = tournament.getAttribute("id");
- window.open("/gemp-lotr/tableDraft.html?eventId=" + tourneyId, '_blank');
- this.PlaySound("gamestart");
- } else if (type === "solodraft" && (stage === "deck-building" || stage === "registering decks" || stage === "awaiting kickoff")) {
- var tourneyId = tournament.getAttribute("id");
- window.open("/gemp-lotr/soloDraft.html?eventId=" + tourneyId, '_blank');
- this.PlaySound("gamestart");
- }
- }
+ if (joined == "true") {
+ // Open draft window
+ if ((type === "table_solodraft" && (stage === "deck-building" || stage === "registering decks" || stage === "awaiting kickoff"))
+ || (type === "table_draft" && stage === "drafting")) {
+ var tourneyId = tournament.getAttribute("id");
+ window.open("/gemp-lotr/tableDraft.html?eventId=" + tourneyId, '_blank');
+ this.PlaySound("gamestart");
+ } else if (type === "solodraft" && (stage === "deck-building" || stage === "registering decks" || stage === "awaiting kickoff")) {
+ var tourneyId = tournament.getAttribute("id");
+ window.open("/gemp-lotr/soloDraft.html?eventId=" + tourneyId, '_blank');
+ this.PlaySound("gamestart");
+ }
+ }
} else if (action == "update") {
- $(".tournament" + id, this.tablesDiv).replaceWith(row);
+ $(".tournament" + id, this.tablesDiv).replaceWith(row);
- // Display tournaments also as playing tables
- var existingRow = $(".table" + id, this.tablesDiv);
- if (existingRow.length > 0) {
- // If the row exists, replace it
- existingRow.replaceWith(tablesRow);
- } else {
- // If the row does not exist, append it
- $("table.playingTables", this.tablesDiv).append(tablesRow);
- }
+ // Display tournaments also as playing tables
+ var existingRow = $(".table" + id, this.tablesDiv);
+ if (existingRow.length > 0) {
+ // If the row exists, replace it
+ existingRow.replaceWith(tablesRow);
+ } else {
+ // If the row does not exist, append it
+ $("table.playingTables", this.tablesDiv).append(tablesRow);
+ }
}
this.animateRowUpdate(".tournament" + id);
} else if (action == "remove") {
- $(".tournament" + id, this.tablesDiv).remove();
- // Remove tournaments displayed as tables
- $(".table" + id, this.tablesDiv).remove();
+ $(".tournament" + id, this.tablesDiv).remove();
+ // Remove tournaments displayed as tables
+ $(".table" + id, this.tablesDiv).remove();
}
}
@@ -1115,13 +1121,15 @@ var GempLotrHallUI = Class.extend({
if (!this.supportedFormatsInitialized) {
var formats = root.getElementsByTagName("format");
+
+ var defaultItem = ""
+ this.supportedFormatsSelect.append(defaultItem);
+
for (var i = 0; i < formats.length; i++) {
var format = formats[i].childNodes[0].nodeValue;
var type = formats[i].getAttribute("type");
-
- var selected = (format === "Fellowship Block") ? " selected" : "";
- var item = "";
+ var item = ""
this.supportedFormatsSelect.append(item);
}
this.supportedFormatsInitialized = true;
diff --git a/gemp-lotr/gemp-lotr-server/src/test/java/com/gempukku/lotro/cards/official/set01/Card_01_081_Tests.java b/gemp-lotr/gemp-lotr-server/src/test/java/com/gempukku/lotro/cards/official/set01/Card_01_081_Tests.java
index 357646ada..5cd0ea572 100644
--- a/gemp-lotr/gemp-lotr-server/src/test/java/com/gempukku/lotro/cards/official/set01/Card_01_081_Tests.java
+++ b/gemp-lotr/gemp-lotr-server/src/test/java/com/gempukku/lotro/cards/official/set01/Card_01_081_Tests.java
@@ -8,6 +8,7 @@ import org.junit.Test;
import java.util.HashMap;
+import static com.gempukku.lotro.framework.Assertions.assertInZone;
import static org.junit.Assert.*;
public class Card_01_081_Tests
@@ -17,8 +18,13 @@ public class Card_01_081_Tests
return new VirtualTableScenario(
new HashMap<>()
{{
- put("card", "1_81");
- // put other cards in here as needed for the test case
+ put("questions", "1_81");
+ put("gandalf", "1_364");
+
+ put("chaff1", "1_91");
+ put("chaff2", "1_92");
+ put("chaff3", "1_93");
+ put("chaff4", "1_94");
}},
VirtualTableScenario.FellowshipSites,
VirtualTableScenario.FOTRFrodo,
@@ -27,7 +33,7 @@ public class Card_01_081_Tests
}
@Test
- public void QuestionsThatbrNeedAnsweringStatsAndKeywordsAreCorrect() throws DecisionResultInvalidException, CardNotFoundException {
+ public void QuestionsThatNeedAnsweringStatsAndKeywordsAreCorrect() throws DecisionResultInvalidException, CardNotFoundException {
/**
* Set: 1
@@ -43,7 +49,7 @@ public class Card_01_081_Tests
var scn = GetScenario();
- var card = scn.GetFreepsCard("card");
+ var card = scn.GetFreepsCard("questions");
assertEquals("Questions That Need Answering", card.getBlueprint().getTitle());
assertNull(card.getBlueprint().getSubtitle());
@@ -56,18 +62,34 @@ public class Card_01_081_Tests
assertEquals(3, card.getBlueprint().getTwilightCost());
}
- // Uncomment any @Test markers below once this is ready to be used
- //@Test
- public void QuestionsThatbrNeedAnsweringTest1() throws DecisionResultInvalidException, CardNotFoundException {
+ @Test
+ public void QuestionsThatNeedAnsweringTakes2CardsIntoHandAndDiscardsTheRest() throws DecisionResultInvalidException, CardNotFoundException {
//Pre-game setup
var scn = GetScenario();
- var card = scn.GetFreepsCard("card");
- scn.MoveCardsToHand(card);
+ var questions = scn.GetFreepsCard("questions");
+ var gandalf = scn.GetFreepsCard("gandalf");
+ scn.MoveCardsToHand(questions);
+ scn.MoveCompanionToTable(gandalf);
+
+ var chaff1 = scn.GetFreepsCard("chaff1");
+ var chaff2 = scn.GetFreepsCard("chaff2");
+ var chaff3 = scn.GetFreepsCard("chaff3");
+ var chaff4 = scn.GetFreepsCard("chaff4");
+ scn.MoveCardsToTopOfDeck(chaff1, chaff2, chaff3, chaff4);
scn.StartGame();
- scn.FreepsPlayCard(card);
- assertEquals(3, scn.GetTwilight());
+ assertTrue(scn.FreepsPlayAvailable(questions));
+ scn.FreepsPlayCard(questions);
+ scn.FreepsDismissRevealedCards();
+
+ assertInZone(Zone.DECK, chaff1, chaff2, chaff3, chaff4);
+ assertTrue(scn.FreepsHasCardChoicesAvailable(chaff1, chaff2, chaff3, chaff4));
+
+ scn.FreepsChooseCards(chaff3, chaff4);
+ assertInZone(Zone.HAND, chaff3, chaff4);
+ assertInZone(Zone.DISCARD, chaff1, chaff2);
+
}
}