Deck building's import now respects card counts

This commit is contained in:
marcin.sciesinski
2021-02-22 09:05:08 -08:00
parent 9c82ceecde
commit 235a76f067

View File

@@ -348,26 +348,24 @@ var GempLotrDeckBuildingUI = Class.extend({
}
this.importDeckCollection(formattedText, function (xml) {
log(xml);
var cards = xml.documentElement.getElementsByTagName("card");
for (var i = 0; i < cards.length; i++) {
var cardElem = cards[i];
var blueprintId = cardElem.getAttribute("blueprintId");
var side = cardElem.getAttribute("side");
var group = cardElem.getAttribute("group");
if (group == "ringBearer") {
that.addCardToContainer(blueprintId, "special", that.ringBearerDiv, false).addClass("cardInDeck");
that.layoutSpecialGroups();
}
else if (group == "ring") {
that.addCardToContainer(blueprintId, "special", that.ringDiv, false).addClass("cardInDeck");
that.layoutSpecialGroups();
}
else {
that.addCardToDeckAndLayout(blueprintId, side);
var cardCount = parseInt(cardElem.getAttribute("count"));
for (var j = 0; j < cardCount; j++) {
if (group == "ringBearer") {
that.addCardToContainer(blueprintId, "special", that.ringBearerDiv, false).addClass("cardInDeck");
} else if (group == "ring") {
that.addCardToContainer(blueprintId, "special", that.ringDiv, false).addClass("cardInDeck");
} else {
that.addCardToDeckAndLayout(blueprintId, side);
}
}
}
that.layoutSpecialGroups();
$("#editingDeck").text("Imported Deck (unsaved)");
});
},