Fixed packs not having a count on them in the deckbuilder. Hopefully addressed card pack deliveries being out of sync.
This commit is contained in:
@@ -206,34 +206,10 @@ public class CollectionRequestHandler extends LotroServerRequestHandler implemen
|
||||
if (packContents == null)
|
||||
throw new HttpProcessingException(404);
|
||||
|
||||
DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
|
||||
DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
|
||||
|
||||
Document doc = documentBuilder.newDocument();
|
||||
|
||||
Element collectionElem = doc.createElement("pack");
|
||||
doc.appendChild(collectionElem);
|
||||
|
||||
for (CardCollection.Item item : packContents.getAll()) {
|
||||
String blueprintId = item.getBlueprintId();
|
||||
if (item.getType() == CardCollection.Item.Type.CARD) {
|
||||
Element card = doc.createElement("card");
|
||||
card.setAttribute("count", String.valueOf(item.getCount()));
|
||||
card.setAttribute("blueprintId", blueprintId);
|
||||
appendCardSide(card, _library.getLotroCardBlueprint(blueprintId));
|
||||
collectionElem.appendChild(card);
|
||||
} else {
|
||||
Element pack = doc.createElement("pack");
|
||||
pack.setAttribute("count", String.valueOf(item.getCount()));
|
||||
pack.setAttribute("blueprintId", blueprintId);
|
||||
collectionElem.appendChild(pack);
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, String> headers = new HashMap<>();
|
||||
processDeliveryServiceNotification(resourceOwner, headers);
|
||||
|
||||
responseWriter.writeXmlResponse(doc, headers);
|
||||
responseWriter.writeXmlResponse(null, headers);
|
||||
} finally {
|
||||
postDecoder.destroy();
|
||||
}
|
||||
|
||||
@@ -43,6 +43,12 @@ var GempLotrCommunication = Class.extend({
|
||||
});
|
||||
},
|
||||
|
||||
forcePackDelivery:function() {
|
||||
if (window.deckbuilderDeliveryService != null) {
|
||||
this.getPackDelivery(window.deckbuilderDeliveryService);
|
||||
}
|
||||
},
|
||||
|
||||
getPackDelivery:function (callback) {
|
||||
$.ajax({
|
||||
type:"GET",
|
||||
@@ -152,8 +158,8 @@ var GempLotrCommunication = Class.extend({
|
||||
var that = this;
|
||||
return function (xml, status, request) {
|
||||
var delivery = request.getResponseHeader("Delivery-Service-Opened-Pack");
|
||||
if (delivery == "true" && window.deckbuilderDeliveryService != null) {
|
||||
that.getPackDelivery(window.deckbuilderDeliveryService);
|
||||
if (delivery == "true") {
|
||||
that.forcePackDelivery();
|
||||
}
|
||||
callback(xml);
|
||||
};
|
||||
@@ -540,7 +546,8 @@ var GempLotrCommunication = Class.extend({
|
||||
cache:false,
|
||||
data:{
|
||||
participantId:getUrlParam("participantId"),
|
||||
pack:pack},
|
||||
pack:pack
|
||||
},
|
||||
success:this.deckbuilderDeliveryCheck(callback),
|
||||
error:this.errorCheck(errorMap),
|
||||
dataType:"xml"
|
||||
@@ -554,7 +561,8 @@ var GempLotrCommunication = Class.extend({
|
||||
data:{
|
||||
participantId:getUrlParam("participantId"),
|
||||
pack:pack,
|
||||
selection:selection},
|
||||
selection:selection
|
||||
},
|
||||
success:this.deckbuilderDeliveryCheck(callback),
|
||||
error:this.errorCheck(errorMap),
|
||||
dataType:"xml"
|
||||
|
||||
@@ -343,6 +343,7 @@ var GempLotrDeckBuildingUI = Class.extend({
|
||||
}, this.checkDirtyInterval);
|
||||
|
||||
this.updateFormatOptions();
|
||||
this.comm.forcePackDelivery();
|
||||
},
|
||||
|
||||
setMapVisibility:function(value) {
|
||||
@@ -752,6 +753,11 @@ var GempLotrDeckBuildingUI = Class.extend({
|
||||
} else if (selectedCardElem.hasClass("packInCollection")) {
|
||||
// if (confirm("Would you like to open this pack?")) {
|
||||
this.comm.openPack(this.getCollectionType(), selectedCardElem.data("card").blueprintId, function () {
|
||||
|
||||
setTimeout(function (){
|
||||
console.log("forcing delivery");
|
||||
that.comm.forcePackDelivery();
|
||||
}, 1000);
|
||||
that.cardFilter.getCollection();
|
||||
}, {
|
||||
"404":function () {
|
||||
@@ -761,6 +767,10 @@ var GempLotrDeckBuildingUI = Class.extend({
|
||||
//}
|
||||
} else if (selectedCardElem.hasClass("cardToSelect")) {
|
||||
this.comm.openSelectionPack(this.getCollectionType(), this.packSelectionId, selectedCardElem.data("card").blueprintId, function () {
|
||||
setTimeout(function (){
|
||||
console.log("forcing delivery");
|
||||
that.comm.forcePackDelivery();
|
||||
}, 1000);
|
||||
that.cardFilter.getCollection();
|
||||
}, {
|
||||
"404":function () {
|
||||
@@ -1166,7 +1176,7 @@ var GempLotrDeckBuildingUI = Class.extend({
|
||||
if (type == "pack") {
|
||||
var card = new Card(blueprintId, null, null, "pack", "collection", "player");
|
||||
card.tokens = {"count":count};
|
||||
var cardDiv = Card.CreateCardDiv(card.imageUrl, null, null, false, false, true);
|
||||
var cardDiv = Card.CreateCardDiv(card.imageUrl, null, null, false, true, true);
|
||||
cardDiv.data("card", card);
|
||||
|
||||
if (blueprintId.substr(0, 3) == "(S)") {
|
||||
|
||||
Reference in New Issue
Block a user