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)
|
if (packContents == null)
|
||||||
throw new HttpProcessingException(404);
|
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<>();
|
Map<String, String> headers = new HashMap<>();
|
||||||
processDeliveryServiceNotification(resourceOwner, headers);
|
processDeliveryServiceNotification(resourceOwner, headers);
|
||||||
|
|
||||||
responseWriter.writeXmlResponse(doc, headers);
|
responseWriter.writeXmlResponse(null, headers);
|
||||||
} finally {
|
} finally {
|
||||||
postDecoder.destroy();
|
postDecoder.destroy();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,6 +43,12 @@ var GempLotrCommunication = Class.extend({
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
forcePackDelivery:function() {
|
||||||
|
if (window.deckbuilderDeliveryService != null) {
|
||||||
|
this.getPackDelivery(window.deckbuilderDeliveryService);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
getPackDelivery:function (callback) {
|
getPackDelivery:function (callback) {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type:"GET",
|
type:"GET",
|
||||||
@@ -152,8 +158,8 @@ var GempLotrCommunication = Class.extend({
|
|||||||
var that = this;
|
var that = this;
|
||||||
return function (xml, status, request) {
|
return function (xml, status, request) {
|
||||||
var delivery = request.getResponseHeader("Delivery-Service-Opened-Pack");
|
var delivery = request.getResponseHeader("Delivery-Service-Opened-Pack");
|
||||||
if (delivery == "true" && window.deckbuilderDeliveryService != null) {
|
if (delivery == "true") {
|
||||||
that.getPackDelivery(window.deckbuilderDeliveryService);
|
that.forcePackDelivery();
|
||||||
}
|
}
|
||||||
callback(xml);
|
callback(xml);
|
||||||
};
|
};
|
||||||
@@ -540,7 +546,8 @@ var GempLotrCommunication = Class.extend({
|
|||||||
cache:false,
|
cache:false,
|
||||||
data:{
|
data:{
|
||||||
participantId:getUrlParam("participantId"),
|
participantId:getUrlParam("participantId"),
|
||||||
pack:pack},
|
pack:pack
|
||||||
|
},
|
||||||
success:this.deckbuilderDeliveryCheck(callback),
|
success:this.deckbuilderDeliveryCheck(callback),
|
||||||
error:this.errorCheck(errorMap),
|
error:this.errorCheck(errorMap),
|
||||||
dataType:"xml"
|
dataType:"xml"
|
||||||
@@ -554,7 +561,8 @@ var GempLotrCommunication = Class.extend({
|
|||||||
data:{
|
data:{
|
||||||
participantId:getUrlParam("participantId"),
|
participantId:getUrlParam("participantId"),
|
||||||
pack:pack,
|
pack:pack,
|
||||||
selection:selection},
|
selection:selection
|
||||||
|
},
|
||||||
success:this.deckbuilderDeliveryCheck(callback),
|
success:this.deckbuilderDeliveryCheck(callback),
|
||||||
error:this.errorCheck(errorMap),
|
error:this.errorCheck(errorMap),
|
||||||
dataType:"xml"
|
dataType:"xml"
|
||||||
|
|||||||
@@ -343,6 +343,7 @@ var GempLotrDeckBuildingUI = Class.extend({
|
|||||||
}, this.checkDirtyInterval);
|
}, this.checkDirtyInterval);
|
||||||
|
|
||||||
this.updateFormatOptions();
|
this.updateFormatOptions();
|
||||||
|
this.comm.forcePackDelivery();
|
||||||
},
|
},
|
||||||
|
|
||||||
setMapVisibility:function(value) {
|
setMapVisibility:function(value) {
|
||||||
@@ -752,6 +753,11 @@ var GempLotrDeckBuildingUI = Class.extend({
|
|||||||
} else if (selectedCardElem.hasClass("packInCollection")) {
|
} else if (selectedCardElem.hasClass("packInCollection")) {
|
||||||
// if (confirm("Would you like to open this pack?")) {
|
// if (confirm("Would you like to open this pack?")) {
|
||||||
this.comm.openPack(this.getCollectionType(), selectedCardElem.data("card").blueprintId, function () {
|
this.comm.openPack(this.getCollectionType(), selectedCardElem.data("card").blueprintId, function () {
|
||||||
|
|
||||||
|
setTimeout(function (){
|
||||||
|
console.log("forcing delivery");
|
||||||
|
that.comm.forcePackDelivery();
|
||||||
|
}, 1000);
|
||||||
that.cardFilter.getCollection();
|
that.cardFilter.getCollection();
|
||||||
}, {
|
}, {
|
||||||
"404":function () {
|
"404":function () {
|
||||||
@@ -761,6 +767,10 @@ var GempLotrDeckBuildingUI = Class.extend({
|
|||||||
//}
|
//}
|
||||||
} else if (selectedCardElem.hasClass("cardToSelect")) {
|
} else if (selectedCardElem.hasClass("cardToSelect")) {
|
||||||
this.comm.openSelectionPack(this.getCollectionType(), this.packSelectionId, selectedCardElem.data("card").blueprintId, function () {
|
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();
|
that.cardFilter.getCollection();
|
||||||
}, {
|
}, {
|
||||||
"404":function () {
|
"404":function () {
|
||||||
@@ -1166,7 +1176,7 @@ var GempLotrDeckBuildingUI = Class.extend({
|
|||||||
if (type == "pack") {
|
if (type == "pack") {
|
||||||
var card = new Card(blueprintId, null, null, "pack", "collection", "player");
|
var card = new Card(blueprintId, null, null, "pack", "collection", "player");
|
||||||
card.tokens = {"count":count};
|
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);
|
cardDiv.data("card", card);
|
||||||
|
|
||||||
if (blueprintId.substr(0, 3) == "(S)") {
|
if (blueprintId.substr(0, 3) == "(S)") {
|
||||||
|
|||||||
Reference in New Issue
Block a user