Support importing art for Adventure cards

This commit is contained in:
Josh birnholz
2023-03-02 17:06:41 -05:00
parent 6bb398fa5c
commit d402d0ca7b

View File

@@ -3874,14 +3874,7 @@ function stretchSVGReal(data, frameObject) {
});
return returnData;
}
//SCRYFALL STUFF MAY BE CHANGED IN THE FUTURE
function fetchScryfallData(cardName, callback = console.log, searchUniqueArt = '') {
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
responseCards = [];
importedCards = JSON.parse(this.responseText).data;
importedCards.forEach(card => {
function processScryfallCard(card, responseCards) {
if ('card_faces' in card) {
card.card_faces.forEach(face => {
face.set = card.set;
@@ -3892,6 +3885,9 @@ function fetchScryfallData(cardName, callback = console.log, searchUniqueArt = '
face.type_line = face.printed_type_line;
}
responseCards.push(face);
if (!face.image_uris) {
face.image_uris = card.image_uris;
}
});
} else {
if (card.lang != 'en') {
@@ -3901,6 +3897,17 @@ function fetchScryfallData(cardName, callback = console.log, searchUniqueArt = '
}
responseCards.push(card);
}
}
//SCRYFALL STUFF MAY BE CHANGED IN THE FUTURE
function fetchScryfallData(cardName, callback = console.log, searchUniqueArt = '') {
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
responseCards = [];
importedCards = JSON.parse(this.responseText).data;
importedCards.forEach(card => {
processScryfallCard(card, responseCards);
});
callback(responseCards);
} else if (this.readyState == 4 && this.status == 404 && !searchUniqueArt && cardName != '') {