planechase (wip)

This commit is contained in:
Kyle
2020-07-12 18:23:53 -07:00
parent ab465c0aff
commit f2e45c595e
7 changed files with 104 additions and 8 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 MiB

View File

@@ -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')
}

View File

@@ -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')

View File

@@ -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)
}