diff --git a/data/images/storybook/storybookFrameB.png b/data/images/storybook/storybookFrameB.png index b3d1961f..f6427904 100644 Binary files a/data/images/storybook/storybookFrameB.png and b/data/images/storybook/storybookFrameB.png differ diff --git a/data/images/storybook/storybookFrameC.png b/data/images/storybook/storybookFrameC.png index 1e7bd041..917bcde2 100644 Binary files a/data/images/storybook/storybookFrameC.png and b/data/images/storybook/storybookFrameC.png differ diff --git a/data/images/storybook/storybookFrameG.png b/data/images/storybook/storybookFrameG.png index ba2c5772..8aa6282d 100644 Binary files a/data/images/storybook/storybookFrameG.png and b/data/images/storybook/storybookFrameG.png differ diff --git a/data/images/storybook/storybookFrameR.png b/data/images/storybook/storybookFrameR.png index 5a895a11..af271280 100644 Binary files a/data/images/storybook/storybookFrameR.png and b/data/images/storybook/storybookFrameR.png differ diff --git a/data/images/storybook/storybookFrameU.png b/data/images/storybook/storybookFrameU.png index 6ccce4d9..fe01365f 100644 Binary files a/data/images/storybook/storybookFrameU.png and b/data/images/storybook/storybookFrameU.png differ diff --git a/data/images/storybook/storybookFrameW.png b/data/images/storybook/storybookFrameW.png index 130e2f21..b18f2de8 100644 Binary files a/data/images/storybook/storybookFrameW.png and b/data/images/storybook/storybookFrameW.png differ diff --git a/data/images/storybook/storybookPTB.png b/data/images/storybook/storybookPTB.png new file mode 100644 index 00000000..565b0b1c Binary files /dev/null and b/data/images/storybook/storybookPTB.png differ diff --git a/data/images/storybook/storybookPTC.png b/data/images/storybook/storybookPTC.png new file mode 100644 index 00000000..4604fdf9 Binary files /dev/null and b/data/images/storybook/storybookPTC.png differ diff --git a/data/images/storybook/storybookPTG.png b/data/images/storybook/storybookPTG.png new file mode 100644 index 00000000..5c6a4248 Binary files /dev/null and b/data/images/storybook/storybookPTG.png differ diff --git a/data/images/storybook/storybookPTR.png b/data/images/storybook/storybookPTR.png new file mode 100644 index 00000000..ab1ddb1a Binary files /dev/null and b/data/images/storybook/storybookPTR.png differ diff --git a/data/images/storybook/storybookPTU.png b/data/images/storybook/storybookPTU.png new file mode 100644 index 00000000..73df50ce Binary files /dev/null and b/data/images/storybook/storybookPTU.png differ diff --git a/data/images/storybook/storybookPTW.png b/data/images/storybook/storybookPTW.png new file mode 100644 index 00000000..e070ce2e Binary files /dev/null and b/data/images/storybook/storybookPTW.png differ diff --git a/data/scripts/main.js b/data/scripts/main.js index 6cc394ea..5d1b0129 100644 --- a/data/scripts/main.js +++ b/data/scripts/main.js @@ -414,7 +414,7 @@ function writeText(textObjectList, targetContext) { textParagraphCanvas.height = scaleY(textObjectList[i].height) + 2 * textCanvasBuffer textLineContext.clearRect(0, 0, textLineCanvas.width, textLineCanvas.height) textParagraphContext.clearRect(0, 0, textParagraphCanvas.width, textParagraphCanvas.height) - var outline, shadow = 0, oneLine = false, outlineThickness = 2, textAlign = 'left', finishLine = false, paragraphSpace = 0, permanentLineShift = 0, temporaryLineShift = 0, fontStyle = '' + var outline, shadow = 0, oneLine = false, outlineThickness = 2, textAlign = 'left', finishLine = false, paragraphSpace = 0, permanentLineShift = 0, temporaryLineShift = 0, fontStyle = '', manaCost = false, canWriteText = true textObjectList[i].otherParameters.forEach(item => eval(item)) textLineContext.strokeStyle = outline textLineContext.lineWidth = outlineThickness @@ -425,6 +425,10 @@ function writeText(textObjectList, targetContext) { var textY = 0 var currentLineWidth = 0 var splitText = textObjectList[i].text.replace(/\n/g, '{line}').replace(/{/g, 'fh48a3h2{').replace(/}/g, '}fh48a3h2').replace(/ /g, 'fh48a3h2 fh48a3h2').split('fh48a3h2') + if (manaCost) { + splitText = '{' + textObjectList[i].text.replace(/\n/g, '').replace(/{/g, ' ').replace(/}/g, ' ').replace(/ /g, '}fh48a3h2{right4}fh48a3h2{') + '}' + splitText = splitText.split('fh48a3h2') + } splitText.push('') innerloop: for (var n = 0; n < splitText.length; n++) { @@ -510,6 +514,12 @@ function writeText(textObjectList, targetContext) { } else if (manaSymbolCodeList.includes(possibleCodeLower.split('/').join(''))) { //THIS HAS TO BE THE LAST ONE var manaSymbolDiameter = textSize * 0.77 + if (manaCost) { + var shadowOffset = eval(manaCostShadowOffset) + textLineContext.beginPath() + textLineContext.arc(textX + manaSymbolDiameter / 2 + shadowOffset[0], textCanvasBuffer + textSize - manaSymbolDiameter * 0.45 + shadowOffset[1], manaSymbolDiameter / 2, 0, 2 * Math.PI) + textLineContext.fill() + } textLineContext.drawImage(manaSymbolImageList[manaSymbolCodeList.indexOf(possibleCodeLower.split('/').join(''))], textX, textCanvasBuffer + textSize - manaSymbolDiameter * 0.95, manaSymbolDiameter, manaSymbolDiameter) currentLineWidth += manaSymbolDiameter * 1.02 textX += manaSymbolDiameter * 1.02 @@ -519,6 +529,9 @@ function writeText(textObjectList, targetContext) { } else { wordToWrite = splitText[n] } + if (!canWriteText) { + wordToWrite = '' + } if (wordToWrite != '' || n == splitText.length - 1 || finishLine) { var currentWordWidth = textLineContext.measureText(wordToWrite).width if (currentWordWidth + currentLineWidth > scaleX(textObjectList[i].width) || n == splitText.length - 1 || finishLine) { diff --git a/data/scripts/versions/storybook/regular.js b/data/scripts/versions/storybook/regular.js index c642ef39..82f18090 100644 --- a/data/scripts/versions/storybook/regular.js +++ b/data/scripts/versions/storybook/regular.js @@ -6,7 +6,13 @@ if (!loadedVersions.includes('storybookRegular')) { ['Black Frame', 'data/images/storybook/storybookFrameB.png', 0, 0, 1, 1, ['Full']], ['Red Frame', 'data/images/storybook/storybookFrameR.png', 0, 0, 1, 1, ['Full']], ['Green Frame', 'data/images/storybook/storybookFrameG.png', 0, 0, 1, 1, ['Full']], - ['Colorless Frame', 'data/images/storybook/storybookFrameC.png', 0, 0, 1, 1, ['Full']] + ['Colorless Frame', 'data/images/storybook/storybookFrameC.png', 0, 0, 1, 1, ['Full']], + ['White Power/Toughness', 'data/images/storybook/storybookPTW.png', 1114/1500, 1860/2100, 332/1500, 138/2100, ['Full']], + ['Blue Power/Toughness', 'data/images/storybook/storybookPTU.png', 1114/1500, 1860/2100, 332/1500, 138/2100, ['Full']], + ['Black Power/Toughness', 'data/images/storybook/storybookPTB.png', 1114/1500, 1860/2100, 332/1500, 138/2100, ['Full']], + ['Red Power/Toughness', 'data/images/storybook/storybookPTR.png', 1114/1500, 1860/2100, 332/1500, 138/2100, ['Full']], + ['Green Power/Toughness', 'data/images/storybook/storybookPTG.png', 1114/1500, 1860/2100, 332/1500, 138/2100, ['Full']], + ['Colorless Power/Toughness', 'data/images/storybook/storybookPTC.png', 1114/1500, 1860/2100, 332/1500, 138/2100, ['Full']] ], 'frameClassStorybookRegular') } diff --git a/data/scripts/versions/storybook/version.js b/data/scripts/versions/storybook/version.js index d0d620b1..a44bec98 100644 --- a/data/scripts/versions/storybook/version.js +++ b/data/scripts/versions/storybook/version.js @@ -2,17 +2,21 @@ if (!loadedVersions.includes('storybook')) { loadedVersions.push('storybook') // loadMaskImages([['Storybook Right Half', 'data/images/storybook/maskStorybookRightHalf.png']]) + //special additional mana cost, title, and type } if (currentVersion != 'storybook') { currentVersion = 'storybook' loadTextOptions([ - new cardText('Card Title', '', 222/1500, 187/2100, 1248/1500, 80/2100, 'belerenb', 80/2100, 'black', ['oneLine=true']), - new cardText('Card Type', '', 345/1500, 1268/2100, 1248/1500, 68/2100, 'belerenb', 68/2100, 'black', ['oneLine=true']), - new cardText('Rules Text', '', 124/1500, 1348/2100, 600/1500, 624/2100, 'mplantin', 74/2100, 'black'), - new cardText('Rules Text (Right)', '', 780/1500, 1348/2100, 600/1500, 624/2100, 'mplantin', 74/2100, 'black'), - new cardText('Power/Toughness', '', 1190/1500, 1950/2100, 210/1500, 78/2100, 'belerenbsc', 78/2100, 'black', ['oneLine=true,textAlign="center"']) + new cardText('Card Title', '', 222/1500, 188/2100, 1248/1500, 80/2100, 'belerenb', 80/2100, 'black', ['oneLine=true']), + new cardText('Card Type', '', 345/1500, 1269/2100, 1248/1500, 68/2100, 'belerenb', 68/2100, 'black', ['oneLine=true']), + new cardText('Rules Text', '', 125/1500, 1500/2100, 597/1500, 500/2100, 'mplantin', 74/2100, 'black'), + new cardText('Rules Text (Right)', '', 796/1500, 1370/2100, 570/1500, 600/2100, 'mplantin', 74/2100, 'black'), + new cardText('Power/Toughness', '', 1190/1500, 1957/2100, 210/1500, 78/2100, 'belerenbsc', 78/2100, 'black', ['oneLine=true,textAlign="center"']), + new cardText('Adventure Title', '', 122/1500, 1386/2100, 600/1500, 62/2100, 'belerenb', 62/2100, 'white', ['oneLine=true']), + new cardText('Adventure Type', '', 122/1500, 1480/2100, 600/1500, 62/2100, 'belerenb', 62/2100, 'white', ['oneLine=true']), + new cardText('Adventure Mana Cost', '', 122/1500, 1394/2100, 600/1500, 82/2100, 'belerenb', 82/2100, 'black', ['oneLine=true','manaCost=true','canWriteText=false','textAlign="right"']) ]) artX = scaleX(50/1500) @@ -51,11 +55,14 @@ function bottomInfoStorybook() { ptBoxShift = 36/2100 } } + if (ptBoxShift == 0) { + Array.from(cardMaster.children).forEach(element => {if (element.children[2].innerHTML.includes('Power/Toughness')) {ptBoxShift = 36/2100}}) + } writeText( [ - {text: document.getElementById('inputInfoSet').value + '{right' + scaleX(0.005) + '}\u2605{right' + scaleX(0.005) + '}' + document.getElementById('inputInfoLanguage').value + ' {saveTextX}{artistbrush}{fontbelerenbsc}' + document.getElementById('inputInfoArtist').value, x: 97/1500, y: 2036/2100, width: 1306/1500, height: 36/2100, font: 'gothammedium', fontSize: 36/2100, fontColor: 'white', otherParameters: ['oneLine=true']}, - {text: document.getElementById('inputInfoNumber').value + '{loadTextX}' + document.getElementById('inputInfoRarity').value, x: 97/1500, y: 2000/2100, width: 1306/1500, height: 36/2100, font: 'gothammedium', fontSize: 36/2100, fontColor: 'white', otherParameters: ['oneLine=true']}, - {text: '{right}\u2122 & \u00a9 ' + date.getFullYear() + ' Wizards of the Coast', x: 97/1500, y: 2000/2100 + ptBoxShift, width: 1306/1500, height: 35/2100, font: 'mplantin', fontSize: 35/2100, fontColor: 'white', otherParameters: ['oneLine=true']}, + {text: document.getElementById('inputInfoSet').value + '{right' + scaleX(0.005) + '}\u2605{right' + scaleX(0.005) + '}' + document.getElementById('inputInfoLanguage').value + ' {saveTextX}{artistbrush}{fontbelerenbsc}' + document.getElementById('inputInfoArtist').value, x: 97/1500, y: 2034/2100, width: 1306/1500, height: 36/2100, font: 'gothammedium', fontSize: 36/2100, fontColor: 'white', otherParameters: ['oneLine=true']}, + {text: document.getElementById('inputInfoNumber').value + '{loadTextX}' + document.getElementById('inputInfoRarity').value, x: 97/1500, y: 1998/2100, width: 1306/1500, height: 36/2100, font: 'gothammedium', fontSize: 36/2100, fontColor: 'white', otherParameters: ['oneLine=true']}, + {text: '{right}\u2122 & \u00a9 ' + date.getFullYear() + ' Wizards of the Coast', x: 97/1500, y: 1998/2100 + ptBoxShift, width: 1306/1500, height: 35/2100, font: 'mplantin', fontSize: 35/2100, fontColor: 'white', otherParameters: ['oneLine=true']}, {text: 'NOT FOR SALE', x: 97/1500, y: 2066/2100, width: 1306/1500, height: 30/2100, font: 'gothammedium', fontSize: 30/2100, fontColor: 'white', otherParameters: ['oneLine=true']}, {text: '{right}CardConjurer.com', x: 97/1500, y: 2030/2100 + ptBoxShift, width: 1306/1500, height: 30/2100, font: 'mplantin', fontSize: 30/2100, fontColor: 'white', otherParameters: ['oneLine=true']} ], bottomInfoContext)