diff --git a/data/images/imageCSV.csv b/data/images/imageCSV.csv index 41baa3d8..08dd6ff4 100644 --- a/data/images/imageCSV.csv +++ b/data/images/imageCSV.csv @@ -1,36 +1,36 @@ -displayName,imagePath,maskOptions -White,m15WFull.png,Full-0-0-744-1039;Title-0-0-744-1039;Type-0-0-744-1039;Rules Text-0-0-744-1039;Pinline-0-0-744-1039;Frame-0-0-744-1039;BoxTopper-0-0-744-1039 -Blue,m15UFull.png,Full-0-0-744-1039;Title-0-0-744-1039;Type-0-0-744-1039;Rules Text-0-0-744-1039;Pinline-0-0-744-1039;Frame-0-0-744-1039;BoxTopper-0-0-744-1039 -Black,m15BFull.png,Full-0-0-744-1039;Title-0-0-744-1039;Type-0-0-744-1039;Rules Text-0-0-744-1039;Pinline-0-0-744-1039;Frame-0-0-744-1039;BoxTopper-0-0-744-1039 -Red,m15RFull.png,Full-0-0-744-1039;Title-0-0-744-1039;Type-0-0-744-1039;Rules Text-0-0-744-1039;Pinline-0-0-744-1039;Frame-0-0-744-1039;BoxTopper-0-0-744-1039 -Green,m15GFull.png,Full-0-0-744-1039;Title-0-0-744-1039;Type-0-0-744-1039;Rules Text-0-0-744-1039;Pinline-0-0-744-1039;Frame-0-0-744-1039;BoxTopper-0-0-744-1039 -Multicolored,m15MFull.png,Full-0-0-744-1039;Title-0-0-744-1039;Type-0-0-744-1039;Rules Text-0-0-744-1039;Pinline-0-0-744-1039;Frame-0-0-744-1039;BoxTopper-0-0-744-1039 -Artifact,m15AFull.png,Full-0-0-744-1039;Title-0-0-744-1039;Type-0-0-744-1039;Rules Text-0-0-744-1039;Pinline-0-0-744-1039;Frame-0-0-744-1039;BoxTopper-0-0-744-1039 -Land,m15LFull.png,Full-0-0-744-1039;Title-0-0-744-1039;Type-0-0-744-1039;Rules Text-0-0-744-1039;Pinline-0-0-744-1039;Frame-0-0-744-1039;BoxTopper-0-0-744-1039 -Vehicle,m15VFull.png,Full-0-0-744-1039;Title-0-0-744-1039;Type-0-0-744-1039;Rules Text-0-0-744-1039;Pinline-0-0-744-1039;Frame-0-0-744-1039;BoxTopper-0-0-744-1039 -White PT,m15WPT.png,Full-567-921-140-81 -Blue PT,m15UPT.png,Full-567-921-140-81 -Black PT,m15BPT.png,Full-567-921-140-81 -Red PT,m15RPT.png,Full-567-921-140-81 -Green PT,m15GPT.png,Full-567-921-140-81 -Multicolored PT,m15MPT.png,Full-567-921-140-81 -Artifact PT,m15APT.png,Full-567-921-140-81 -Vehicle PT,m15VPT.png,Full-567-921-140-81 -White Legendary,m15WLegendary.png,Full-0-0-744-177;Legend-0-0-744-177;LegendWithBorder-0-0-744-177 -Blue Legendary,m15ULegendary.png,Full-0-0-744-177;Legend-0-0-744-177;LegendWithBorder-0-0-744-177 -Black Legendary,m15BLegendary.png,Full-0-0-744-177;Legend-0-0-744-177;LegendWithBorder-0-0-744-177 -Red Legendary,m15RLegendary.png,Full-0-0-744-177;Legend-0-0-744-177;LegendWithBorder-0-0-744-177 -Green Legendary,m15GLegendary.png,Full-0-0-744-177;Legend-0-0-744-177;LegendWithBorder-0-0-744-177 -Multicolored Legendary,m15MLegendary.png,Full-0-0-744-177;Legend-0-0-744-177;LegendWithBorder-0-0-744-177 -Artifact Legendary,m15ALegendary.png,Full-0-0-744-177;Legend-0-0-744-177;LegendWithBorder-0-0-744-177 -Colorless Legendary,m15CLegendary.png,Full-0-0-744-177;Legend-0-0-744-177;LegendWithBorder-0-0-744-177 -White Rare Stamp,m15WRareStamp.png,Full-327-943-91-22 -Blue Rare Stamp,m15URareStamp.png,Full-327-943-91-22 -Black Rare Stamp,m15BRareStamp.png,Full-327-943-91-22 -Red Rare Stamp,m15RRareStamp.png,Full-327-943-91-22 -Green Rare Stamp,m15GRareStamp.png,Full-327-943-91-22 -Multicolored Rare Stamp,m15MRareStamp.png,Full-327-943-91-22 -Artifact Rare Stamp,m15ARareStamp.png,Full-327-943-91-22 -Colorless Rare Stamp,m15CRareStamp.png,Full-327-943-91-22 -Holo Stamp,stamp.png,Full-340-953-70-38 -Black Border,masks/Border.png,Full-0-0-744-1039;BoxTopper-0-0-744-1039 \ No newline at end of file +displayName,imagePath,maskOptions,framePickerOptions +White,m15WFull.png,Full-0-0-744-1039;Title-0-0-744-1039;Type-0-0-744-1039;Rules Text-0-0-744-1039;Pinline-0-0-744-1039;Frame-0-0-744-1039;BoxTopper-0-0-744-1039,Regular +Blue,m15UFull.png,Full-0-0-744-1039;Title-0-0-744-1039;Type-0-0-744-1039;Rules Text-0-0-744-1039;Pinline-0-0-744-1039;Frame-0-0-744-1039;BoxTopper-0-0-744-1039,Regular +Black,m15BFull.png,Full-0-0-744-1039;Title-0-0-744-1039;Type-0-0-744-1039;Rules Text-0-0-744-1039;Pinline-0-0-744-1039;Frame-0-0-744-1039;BoxTopper-0-0-744-1039,Regular +Red,m15RFull.png,Full-0-0-744-1039;Title-0-0-744-1039;Type-0-0-744-1039;Rules Text-0-0-744-1039;Pinline-0-0-744-1039;Frame-0-0-744-1039;BoxTopper-0-0-744-1039,Regular +Green,m15GFull.png,Full-0-0-744-1039;Title-0-0-744-1039;Type-0-0-744-1039;Rules Text-0-0-744-1039;Pinline-0-0-744-1039;Frame-0-0-744-1039;BoxTopper-0-0-744-1039,Regular +Multicolored,m15MFull.png,Full-0-0-744-1039;Title-0-0-744-1039;Type-0-0-744-1039;Rules Text-0-0-744-1039;Pinline-0-0-744-1039;Frame-0-0-744-1039;BoxTopper-0-0-744-1039,Regular +Artifact,m15AFull.png,Full-0-0-744-1039;Title-0-0-744-1039;Type-0-0-744-1039;Rules Text-0-0-744-1039;Pinline-0-0-744-1039;Frame-0-0-744-1039;BoxTopper-0-0-744-1039,Regular +Land,m15LFull.png,Full-0-0-744-1039;Title-0-0-744-1039;Type-0-0-744-1039;Rules Text-0-0-744-1039;Pinline-0-0-744-1039;Frame-0-0-744-1039;BoxTopper-0-0-744-1039,Regular +Vehicle,m15VFull.png,Full-0-0-744-1039;Title-0-0-744-1039;Type-0-0-744-1039;Rules Text-0-0-744-1039;Pinline-0-0-744-1039;Frame-0-0-744-1039;BoxTopper-0-0-744-1039,Regular +White PT,m15WPT.png,Full-567-921-140-81,Regular +Blue PT,m15UPT.png,Full-567-921-140-81,Regular +Black PT,m15BPT.png,Full-567-921-140-81,Regular +Red PT,m15RPT.png,Full-567-921-140-81,Regular +Green PT,m15GPT.png,Full-567-921-140-81,Regular +Multicolored PT,m15MPT.png,Full-567-921-140-81,Regular +Artifact PT,m15APT.png,Full-567-921-140-81,Regular +Vehicle PT,m15VPT.png,Full-567-921-140-81,Regular +White Legendary,m15WLegendary.png,Full-0-0-744-177;Legend-0-0-744-177;LegendWithBorder-0-0-744-177,Regular +Blue Legendary,m15ULegendary.png,Full-0-0-744-177;Legend-0-0-744-177;LegendWithBorder-0-0-744-177,Regular +Black Legendary,m15BLegendary.png,Full-0-0-744-177;Legend-0-0-744-177;LegendWithBorder-0-0-744-177,Regular +Red Legendary,m15RLegendary.png,Full-0-0-744-177;Legend-0-0-744-177;LegendWithBorder-0-0-744-177,Regular +Green Legendary,m15GLegendary.png,Full-0-0-744-177;Legend-0-0-744-177;LegendWithBorder-0-0-744-177,Regular +Multicolored Legendary,m15MLegendary.png,Full-0-0-744-177;Legend-0-0-744-177;LegendWithBorder-0-0-744-177,Regular +Artifact Legendary,m15ALegendary.png,Full-0-0-744-177;Legend-0-0-744-177;LegendWithBorder-0-0-744-177,Regular +Colorless Legendary,m15CLegendary.png,Full-0-0-744-177;Legend-0-0-744-177;LegendWithBorder-0-0-744-177,Regular +White Rare Stamp,m15WRareStamp.png,Full-327-943-91-22,Regular +Blue Rare Stamp,m15URareStamp.png,Full-327-943-91-22,Regular +Black Rare Stamp,m15BRareStamp.png,Full-327-943-91-22,Regular +Red Rare Stamp,m15RRareStamp.png,Full-327-943-91-22,Regular +Green Rare Stamp,m15GRareStamp.png,Full-327-943-91-22,Regular +Multicolored Rare Stamp,m15MRareStamp.png,Full-327-943-91-22,Regular +Artifact Rare Stamp,m15ARareStamp.png,Full-327-943-91-22,Regular +Colorless Rare Stamp,m15CRareStamp.png,Full-327-943-91-22,Regular +Holo Stamp,stamp.png,Full-340-953-70-38,Regular +Black Border,masks/Border.png,Full-0-0-744-1039;BoxTopper-0-0-744-1039,Regular \ No newline at end of file diff --git a/data/m15 - Shortcut.lnk b/data/m15 - Shortcut.lnk deleted file mode 100644 index 05c28d0c..00000000 Binary files a/data/m15 - Shortcut.lnk and /dev/null differ diff --git a/data/scripts/main.js b/data/scripts/main.js index 94665c22..901b629f 100644 --- a/data/scripts/main.js +++ b/data/scripts/main.js @@ -12,6 +12,7 @@ function testFunction() { /* Initiate! */ window.onload = initiate; function initiate() { + window.CSVList = [] window.version = {} window.cardWidth = 744; window.cardHeight = 1039; @@ -79,33 +80,36 @@ function initiate() { /* Loads all the image info from the CSV! */ -function loadImageCSV() { - var xhttp = new XMLHttpRequest(); - xhttp.onreadystatechange = function() { - if (this.readyState == 4) { - var splitImageCSV = xhttp.responseText.split("\n"); - for (var i = 1; i < splitImageCSV.length; i++) { - var splitIndividualImageCSV = splitImageCSV[i].split(","); - frameList[frameList.length] = new frameImage(splitIndividualImageCSV[0], "data/images/" + splitIndividualImageCSV[1], splitIndividualImageCSV[2]); - } - for (var i = 0; i < frameList.length; i++) { - document.getElementById("framePicker").appendChild(frameList[i].framePickerElement()); - } - //I don't like these here, because even though they run, it doesn't populate the mask options - // document.getElementsByClassName("frameOption")[0].classList.add("frameOptionSelected"); - // selectedMask = document.getElementsByClassName("frameOption")[0].id.replace("frameIndex", ""); - console.log("image csv loaded, happy card conjuring!"); - setTimeout(testFunction, 0); //deleteme - } - } - xhttp.open("GET", "data/images/imageCSV.csv", true); - xhttp.send(); +function loadImageCSV(targetCSV) { + if (!CSVList.includes(targetCSV)) { + CSVList[CSVList.length] = targetCSV; + var xhttp = new XMLHttpRequest(); + xhttp.onreadystatechange = function() { + if (this.readyState == 4) { + var splitImageCSV = xhttp.responseText.split("\n"); + for (var i = 1; i < splitImageCSV.length; i++) { + var splitIndividualImageCSV = splitImageCSV[i].split(","); + frameList[frameList.length] = new frameImage(splitIndividualImageCSV[0], "data/images/" + splitIndividualImageCSV[1], splitIndividualImageCSV[2], splitIndividualImageCSV[3].toString()); + if (i == 1) { + frameList[0].image.onload = testFunction; + } + } + for (var i = 0; i < frameList.length; i++) { + document.getElementById("framePicker").appendChild(frameList[i].framePickerElement()); + } + console.log("image csv loaded, happy card conjuring!"); + // setTimeout(testFunction, 0); //deleteme + } + } + xhttp.open("GET", targetCSV, true); + xhttp.send(); + } } /* Image Class */ class frameImage { - constructor(display, path, masks) { + constructor(display, path, masks, classes) { this.displayName = display; this.image = new Image(); this.image.src = path; @@ -123,6 +127,10 @@ class frameImage { this.widthList[i] = scale(parseInt(splitIndividualMasks[3])); this.heightList[i] = scale(parseInt(splitIndividualMasks[4])); } + this.framePickerClasses =["frameOption"] + if (classes[0] == "f") { + this.framePickerClasses = ("frameOption;" + classes.slice(0,classes.length - 1)).replace(/;/g, ";frameClass").split(";"); + } } cardMasterElement(targetMask) { var tempElement = document.createElement("div"); @@ -134,7 +142,9 @@ class frameImage { framePickerElement(targetElement) { var tempElement = document.createElement("div"); tempElement.id = "frameIndex" + frameList.indexOf(this); - tempElement.classList.add("frameOption"); + for (var i = 0; i < this.framePickerClasses.length; i++) { + tempElement.classList.add(this.framePickerClasses[i]); + } tempElement.onclick = frameOptionClicked; tempElement.innerHTML = "" return tempElement; @@ -276,7 +286,7 @@ function cardImageUpdated() { function changeVersionTo(versionToChangeTo) { loadScript("data/versions/" + versionToChangeTo + ".js") } -function finishChangingVersion() { +function finishChangingVersion(targetCSV = false) { for (var i = 0; i < version.textList.length; i ++) { document.getElementById("inputWhichTextTabs").innerHTML += "
" + version.textList[i][0] + "
" if (i == 0) { @@ -284,7 +294,9 @@ function finishChangingVersion() { } } console.log("version changed, time to load the image csv") - loadImageCSV(); + if (targetCSV != false) { + loadImageCSV(targetCSV); + } } diff --git a/data/versions/m15.js b/data/versions/m15.js index 43c2bde9..ccd7fc78 100644 --- a/data/versions/m15.js +++ b/data/versions/m15.js @@ -4,10 +4,10 @@ version.currentVersion = "m15" version.artX = scale(58) version.artY = scale(118) -version.setSymbolRight = scale(688) -version.setSymbolVertical = scale(613) +version.setSymbolRight = scale(684) +version.setSymbolVertical = scale(614) version.setSymbolWidth = scale(90) -version.setSymbolHeight = scale(38) +version.setSymbolHeight = scale(40) version.bottomInfoFunction = "m15BottomInfo" version.manaCostX = scale(653) version.manaCostY = scale(60) @@ -24,8 +24,8 @@ version.watermarkY = scale(800) //Name, text, x, y, width, height, font, size, color, other version.textList = [ ["Title", "", scale(64), scale(83), scale(630), 0, "belerenb", 37, "black", "oneLine=true"], - ["Type", "", scale(65), scale(615), scale(630), 0, "belerenb", 37, "black", "oneLine=true"], - ["Rules Text", "", scale(66), scale(662), scale(612), scale(292), "mplantin", 38, "black", "lineSpace=0.97"], + ["Type", "", scale(64), scale(615), scale(630), 0, "belerenb", 33, "black", "oneLine=true"], + ["Rules Text", "", scale(64), scale(662), scale(616), scale(292), "mplantin", 38, "black", "lineSpace=0.97"], ["Power Toughness", "", scale(587), scale(958), scale(110), 0, "belerenb", 38, "black", "oneLine=true,textAlign='center'"]/*, ["Flip PT", "", scale(588), scale(902), scale(100), 0, "belerenb", 28, "#666", "oneLine=true,textAlign='right'"]*/ ] @@ -33,8 +33,8 @@ version.textList = [ function m15BottomInfo() { //remember to ctrl+f for 'artistBrushWidth' and adjust that when fixing these values! bottomInfoContext.clearRect(0, 0, cardWidth, cardHeight) - bottomInfoContext.writeText(document.getElementById("inputInfoNumber").value + " " + document.getElementById("inputInfoRarity").value + " *Not For Sale*", scale(43), scale(980), scale(329), 0, "gothammedium", 17, "white", "oneLine=true") - bottomInfoContext.writeText(document.getElementById("inputInfoSet").value + " \u2022 " + document.getElementById("inputInfoLanguage").value + " {font:belerenbsc}{artistBrush}{fontsize1}" + document.getElementById("inputInfoArtist").value, scale(43), scale(1000), scale(375), 0, "gothammedium", 17, "white", "oneLine=true") + bottomInfoContext.writeText(document.getElementById("inputInfoNumber").value + " " + document.getElementById("inputInfoRarity").value + " *Not For Sale*", scale(46), scale(980), scale(329), 0, "gothammedium", 17, "white", "oneLine=true") + bottomInfoContext.writeText(document.getElementById("inputInfoSet").value + " \u2022 " + document.getElementById("inputInfoLanguage").value + " {font:belerenbsc}{artistBrush}{fontsize1}" + document.getElementById("inputInfoArtist").value, scale(46), scale(1000), scale(375), 0, "gothammedium", 17, "white", "oneLine=true") var copyrightShift = 0; for (var i = 0; i < cardMaster.children.length; i++) { if (parseInt(cardMaster.children[i].id.replace("frameIndex", "")) != -1 && frameList[parseInt(cardMaster.children[i].id.replace("frameIndex", ""))].image.src.includes("PT")) { @@ -46,4 +46,4 @@ function m15BottomInfo() { } // setTimeout(m15BottomInfo, 250) -finishChangingVersion() +finishChangingVersion("data/images/imageCSV.csv")