diff --git a/creator/index.html b/creator/index.html index 57c28edc..58a0edac 100644 --- a/creator/index.html +++ b/creator/index.html @@ -46,7 +46,7 @@
Select a frame version:
- @@ -55,6 +55,7 @@ + diff --git a/data/images/cardImages/manaSymbols/plane.png b/data/images/cardImages/manaSymbols/plane.png deleted file mode 100644 index d03c020b..00000000 Binary files a/data/images/cardImages/manaSymbols/plane.png and /dev/null differ diff --git a/data/images/cardImages/planechase/planechaseFrame - Copy.png b/data/images/cardImages/planechase/planechaseFrame - Copy.png new file mode 100644 index 00000000..e58eeea8 Binary files /dev/null and b/data/images/cardImages/planechase/planechaseFrame - Copy.png differ diff --git a/data/images/cardImages/planechase/planechaseFrame.png b/data/images/cardImages/planechase/planechaseFrame.png new file mode 100644 index 00000000..1d55519d Binary files /dev/null and b/data/images/cardImages/planechase/planechaseFrame.png differ diff --git a/data/scripts/main.js b/data/scripts/main.js index 5e0c2456..be2c93e3 100644 --- a/data/scripts/main.js +++ b/data/scripts/main.js @@ -28,7 +28,7 @@ function addToManaSymbolList(folderPath, newManaSymbolList) { } } -addToManaSymbolList('/data/images/cardImages/manaSymbols/', ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "w", "u", "b", "r", "g", "2w", "2u", "2b", "2r", "2g", "pw", "pu", "pb", "pr", "pg", "wu", "wb", "ub", "ur", "br", "bg", "rg", "rw", "gw", "gu", "x", "s", "c", "t","untap", "e", "y", "z", "half", "inf", "chaos", "plane", "l+", "l-", "l0", "oldtap", "artistbrush", "bar", "whiteBrush", "blackBrush"]) +addToManaSymbolList('/data/images/cardImages/manaSymbols/', ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "w", "u", "b", "r", "g", "2w", "2u", "2b", "2r", "2g", "pw", "pu", "pb", "pr", "pg", "wu", "wb", "ub", "ur", "br", "bg", "rg", "rw", "gw", "gu", "x", "s", "c", "t","untap", "e", "y", "z", "half", "inf", "chaos", "l+", "l-", "l0", "oldtap", "artistbrush", "bar", "whiteBrush", "blackBrush"]) function newCanvas(name) { window[name + 'Canvas'] = document.createElement('canvas') @@ -114,6 +114,17 @@ watermark.onload = function() { watermarkUpdated() } +function loadVersion(versionToLoad) { + if (cardWidth / cardHeight != 5/7) { + cardWidth *= 5/7 + cardHeight *= 7/5 + resizeCanvases(cardWidth, cardHeight) + previewContext.rotate(Math.PI / 2) + previewContext.translate(0, -cardHeight / 2) + } + loadScript('/data/scripts/versions/' + versionToLoad + '/version.js') +} + class cardPlaceholder { constructor(displayName, whatToDraw, x = 0, y = 0, width = 1, height = 1, zoom = 1) { this.name = displayName @@ -259,7 +270,11 @@ function drawCardObjects() { mainContext.rotate(Math.PI / 2) //preview the card mainContext.globalCompositeOperation = 'source-over' - previewContext.drawImage(mainCanvas, 0, 0, previewCanvas.width, previewCanvas.height) + if (cardWidth < cardHeight) { + previewContext.drawImage(mainCanvas, 0, 0, previewCanvas.width, previewCanvas.height) + } else { + previewContext.drawImage(mainCanvas, 0, 0, previewCanvas.height, previewCanvas.width) + } } class frameImage { @@ -518,21 +533,26 @@ function writeText(textObjectList, targetContext) { textLineContext.fillStyle = currentFontColor } else if (possibleCodeLower == 'artistbrush') { var artistBrushWidth = textSize * 1.2 - textLineContext.drawImage(manaSymbolImageList[62], textX, textCanvasBuffer + textSize - artistBrushWidth * 0.58, artistBrushWidth, artistBrushWidth * 13 / 21) + textLineContext.drawImage(manaSymbolImageList[manaSymbolCodeList.indexOf('artistbrush')], textX, textCanvasBuffer + textSize - artistBrushWidth * 0.58, artistBrushWidth, artistBrushWidth * 13 / 21) textX += artistBrushWidth * 1.1 currentLineWidth += artistBrushWidth * 1.1 } else if (possibleCodeLower == 'oldartistbrush') { var artistBrushWidth = textSize * 2.4 if (textLineContext.fillStyle == '#ffffff' || textLineContext.fillStyle == 'white') { - textLineContext.drawImage(manaSymbolImageList[64], textX, textCanvasBuffer + textSize - artistBrushWidth * 13 / 63, artistBrushWidth, artistBrushWidth * 13 / 63); + textLineContext.drawImage(manaSymbolImageList[manaSymbolCodeList.indexOf('whiteBrush')], textX, textCanvasBuffer + textSize - artistBrushWidth * 13 / 63, artistBrushWidth, artistBrushWidth * 13 / 63); } else { - textLineContext.drawImage(manaSymbolImageList[65], textX, textCanvasBuffer + textSize - artistBrushWidth * 13 / 63, artistBrushWidth, artistBrushWidth * 13 / 63); + textLineContext.drawImage(manaSymbolImageList[manaSymbolCodeList.indexOf('blackBrush')], textX, textCanvasBuffer + textSize - artistBrushWidth * 13 / 63, artistBrushWidth, artistBrushWidth * 13 / 63); } textX += artistBrushWidth * 1.1 currentLineWidth += artistBrushWidth * 1.1 } else if (possibleCodeLower.includes('font')) { textFont = possibleCodeLower.replace('font', '') textLineContext.font = fontStyle + textSize + 'px ' + textFont + } else if (possibleCodeLower == 'planechase') { + textLineContext.drawImage(manaSymbolImageList[manaSymbolCodeList.indexOf('chaos')], textX, textCanvasBuffer + textSize - scaleX(40/2100), scaleX(102/2100), scaleX(85/2100)) + textX += scaleX(125/2100) + currentLineWidth += scaleX(125/2100) + permanentLineShift += scaleX(125/2100) } else if (manaSymbolCodeList.includes(possibleCodeLower.split('/').join(''))) { //THIS HAS TO BE THE LAST ONE var manaSymbolDiameter = textSize * 0.77 @@ -636,7 +656,7 @@ function inputCardArtName(cardArtNameInput) { cardArtArtistList[i] = savedArtList[i].slice(savedArtList[i].indexOf('"artist":"') + 10, savedArtList[i].indexOf('","artist_id')) } inputCardArtNameNumber(1) - } else if (this.readyState == 4 && this.status == 404) { + } else if (this.readyState == 4 && this.status == 404 && cardArtNameInput != '') { notify("Sorry, but we can't seem to find any art for '" + cardArtNameInput + "'", '#ffffaae0') } } @@ -754,7 +774,7 @@ function inputCardNameTextImport(cardName) { inputCardNameNumberTextImport(1) document.getElementById('inputCardNameNumberTextImport').max = savedImportResponse.length - 1 document.getElementById('inputCardNameNumberTextImport').value = 1 - } else if (this.readyState == 4 && this.status == 404) { + } else if (this.readyState == 4 && this.status == 404 && cardName != '') { savedImportResponse = '' notify("Sorry, but we can't seem to find any card named '" + cardName + "'", '#ffffaae0') } diff --git a/data/scripts/versions/planechase/regular.js b/data/scripts/versions/planechase/regular.js new file mode 100644 index 00000000..b8e7938e --- /dev/null +++ b/data/scripts/versions/planechase/regular.js @@ -0,0 +1,9 @@ +if (!loadedVersions.includes('planechaseRegular')) { + loadedVersions.push('planechaseRegular') + loadFrameImages([ + ['Planechase Frame', '/data/images/cardImages/planechase/planechaseFrame.png', 0, 0, 1, 1, ['Full']], + ['Planechase Reference', '/data/images/cardImages/planechase/planechaseFrame - Copy.png', 0, 0, 1, 1, ['Full']] + ], 'frameClassPlanechaseRegular') +} + +hideFrameImages('frameClassPlanechaseRegular') \ No newline at end of file diff --git a/data/scripts/versions/planechase/version.js b/data/scripts/versions/planechase/version.js new file mode 100644 index 00000000..e26adb7f --- /dev/null +++ b/data/scripts/versions/planechase/version.js @@ -0,0 +1,66 @@ +if (!loadedVersions.includes('planechase')) { + loadedVersions.push('planechase') + // loadMaskImages([]) +} + +if (currentVersion != 'planechase') { + currentVersion = 'planechase' + + previewContext.translate(0, cardHeight / 2) + previewContext.rotate(-Math.PI / 2) + cardWidth *= 7/5 + cardHeight *= 5/7 + resizeCanvases(cardWidth, cardHeight) + + loadTextOptions([ + new cardText('Card Title', '', 150/2100, 150/1500, 1800/2100, 67/1500, 'belerenb', 67/1500, 'black', ['oneLine=true','textAlign="center"']), + new cardText('Card Type', '', 450/2100, 1056/1500, 1200/2100, 52/1500, 'belerenb', 52/1500, 'black', ['oneLine=true','textAlign="center"']), + new cardText('Rules Text', '', 242/2100, 1030/1500, 1616/2100, 500/1500, 'mplantin', 56/1500, 'black') + ]) + + artX = scaleX(65 / 2100) + artY = scaleY(65 / 1500) + artWidth = scaleX(1970 / 2100) + artHeight = scaleY(1372 / 1500) + + manaCostXPath = '0' + manaCostYPath = '0' + manaCostDiameter = '0' + manaCostShadowOffset = 'none' + manaCostDirection = 'none' + + setSymbolX = [cardWidth / 2, 'center'] + setSymbolY = [scaleY(244/2100), 'center'] + setSymbolWidth = scaleX(180/1500) + setSymbolHeight = scaleY(84/2100) + + watermarkX = cardWidth * 2 + watermarkY = cardHeight * 2 + watermarkWidth = 1 + watermarkHeight = 1 + + bottomInfoFunction = 'bottomInfoPlanechase' + + bottomInfoUpdated() +} + +loadFramePackOptions([['regular', 'Regular']]) + +function bottomInfoPlanechase() { + bottomInfoContext.clearRect(0, 0, cardWidth, cardHeight) + var ptBoxShift = 0 + for (var i = 0; i < cardTextList.length; i++) { + if (cardTextList[i].name == 'Power/Toughness' && cardTextList[i].text != '') { + ptBoxShift = 36/2100 + } + } + if (ptBoxShift == 0) { + Array.from(cardMaster.children).forEach(element => {if (element.children[2].innerHTML.includes('Power/Toughness')) {ptBoxShift = 36/2100}}) + } + writeText( + [//{artistbrush}{fontbelerenbsc}' + document.getElementById('inputInfoArtist').value + {text: '{center}' + document.getElementById('inputInfoNumber').value + ' ' + document.getElementById('inputInfoSet').value + '{right' + scaleX(0.005) + '}\u2605{right' + scaleX(0.005) + '}' + document.getElementById('inputInfoLanguage').value + '{right' + scaleX(0.005) + '}{fontmplantin}{fontsize-1}\u2122 & \u00a9 ' + date.getFullYear() + ' Wizards of the Coast', x: 670/2100, y: 2044/2100, width: 760/2100, height: 36/2100, font: 'gothammedium', fontSize: 36/2100, fontColor: 'white', otherParameters: ['oneLine=true']}, + {text: '{center}{artistbrush}{fontbelerenbsc}' + document.getElementById('inputInfoArtist').value, x: 670/2100, y: 2008/2100, width: 760/2100, height: 36/2100, font: 'belerenbsc', fontSize: 36/2100, fontColor: 'white', otherParameters: ['oneLine=true']}, + {text: '{center}NOT FOR SALE{right' + scaleX(0.005) + '}{fontmplantin}CardConjurer.com', x: 670/2100, y: 2078/2100, width: 760/2100, height: 30/2100, font: 'gothammedium', fontSize: 30/2100, fontColor: 'white', otherParameters: ['oneLine=true']}, + ], bottomInfoContext) +} \ No newline at end of file