mirror of
https://github.com/Investigamer/cardconjurer.git
synced 2025-07-27 05:14:53 -05:00
kamigawa basics
This commit is contained in:
@@ -2189,20 +2189,22 @@ function stretchSVGReal(data, frameObject) {
|
||||
const name = stretch.name;
|
||||
const oldData = returnData.split(name + '" d="')[1].split('" style=')[0];
|
||||
var newData = '';
|
||||
const listData = oldData.replace(/L/g, '|L').replace(/C/g, '|C').replace(/M/g, '|M').replace(/Z/g, '|Z').replace('|', '').split('|');
|
||||
const listData = oldData.split(/(?=[clmz])/gi);
|
||||
for (i = 0; i < listData.length; i ++) {
|
||||
const item = listData[i]
|
||||
if (targets.includes(i)) {
|
||||
if (item[0] == 'C') {
|
||||
const item = listData[i];
|
||||
if (targets.includes(i) || targets.includes(-i)) {
|
||||
let sign = 1;
|
||||
if (i != 0 && targets.includes(-i)) {sign = -1};
|
||||
if (item[0] == 'C' || item[0] == 'c') {
|
||||
newCoords = [];
|
||||
item.slice(1).split(' ').forEach(pair => {
|
||||
coords = pair.split(',');
|
||||
newCoords.push((scaleWidth(change[0]) + parseFloat(coords[0])) + ',' + (scaleHeight(change[1]) + parseFloat(coords[1])));
|
||||
newCoords.push((scaleWidth(change[0]) * sign + parseFloat(coords[0])) + ',' + (scaleHeight(change[1]) * sign + parseFloat(coords[1])));
|
||||
});
|
||||
newData += 'C' + newCoords.join(' ');
|
||||
newData += item[0] + newCoords.join(' ');
|
||||
} else {
|
||||
const coords = item.slice(1).split(',');
|
||||
newData += item[0] + (scaleWidth(change[0]) + parseFloat(coords[0])) + ',' + (scaleHeight(change[1]) + parseFloat(coords[1]))
|
||||
const coords = item.slice(1).split(/[, ]/);
|
||||
newData += item[0] + (scaleWidth(change[0]) * sign + parseFloat(coords[0])) + ',' + (scaleHeight(change[1]) * sign + parseFloat(coords[1]))
|
||||
}
|
||||
} else {
|
||||
newData += item;
|
||||
|
@@ -1,12 +1,15 @@
|
||||
loadFramePacks([
|
||||
{name:'Generic Showcase', value:'TextlessGenericShowcase'},
|
||||
{name:'Magic Fest Promos', value:'MagicFest'},
|
||||
{name:'Inventions', value:'TextlessInvention'},
|
||||
{name:'Unstable Basics', value:'Unstable'},
|
||||
{name:'Unhinged Basics', value:'Unhinged'},
|
||||
{name:'Basic Lands', value:'disabled'},
|
||||
{name:'Kamigawa Basics (NEO)', value:'NeoBasics'},
|
||||
{name:'Fullart Basics (THB)', value:'TextlessBasics'},
|
||||
{name:'Fullart Basics (ZEN)', value:'ZendikarBasic-1'},
|
||||
{name:'Fullart Snow Basics', value:'FullartBasicRoundBottom'},
|
||||
{name:'Unstable Basics (UST)', value:'Unstable'},
|
||||
{name:'Unhinged Basics (UNH)', value:'Unhinged'},
|
||||
{name:'Other', value:'disabled'},
|
||||
{name:'Generic Showcase', value:'TextlessGenericShowcase'},
|
||||
{name:'Magic Fest Promos', value:'MagicFest'},
|
||||
{name:'Inventions', value:'TextlessInvention'},
|
||||
{name:'Seventh', value:'SeventhTextless'},
|
||||
{name:'Addons', value:'disabled'},
|
||||
{name:'Legend Crowns', value:'M15LegendCrowns'},
|
||||
|
45
js/frames/packNeoBasics.js
Normal file
45
js/frames/packNeoBasics.js
Normal file
@@ -0,0 +1,45 @@
|
||||
//Create objects for common properties across available frames
|
||||
var masks = []//[{src:'/img/frames/mysticalArchive/jp/pinline.svg', name:'Pinline'}, {src:'/img/frames/mysticalArchive/jp/rightHalf.svg', name:'Right Half'}];
|
||||
var stretch = [
|
||||
{name:'outline', targets: [3, 11], change:[0, 0]},
|
||||
{name:'top', targets: [0, -2], change:[0, 0]},
|
||||
{name:'bottom', targets: [0], change:[0, 0]},
|
||||
{name:'symbol', targets: [0], change:[0, 0]}
|
||||
];
|
||||
// Notification
|
||||
notify('When you load the Kamigawa Basics frame version, a "Kamigawa Basics" tab will appear. This tab allows you to control the height of the title bar.', 15);
|
||||
//defines available frames
|
||||
availableFrames = [
|
||||
{name:'White Frame', src:'/img/frames/neo/basics/w.svg', stretch:stretch, masks:masks},
|
||||
{name:'Blue Frame', src:'/img/frames/neo/basics/u.svg', stretch:stretch, masks:masks},
|
||||
{name:'Black Frame', src:'/img/frames/neo/basics/b.svg', stretch:stretch, masks:masks},
|
||||
{name:'Red Frame', src:'/img/frames/neo/basics/r.svg', stretch:stretch, masks:masks},
|
||||
{name:'Green Frame', src:'/img/frames/neo/basics/g.svg', stretch:stretch, masks:masks},
|
||||
{name:'Colorless Frame', src:'/img/frames/neo/basics/c.svg', stretch:stretch, masks:masks}
|
||||
];
|
||||
//disables/enables the "Load Frame Version" button
|
||||
document.querySelector('#loadFrameVersion').disabled = false;
|
||||
//defines process for loading this version, if applicable
|
||||
document.querySelector('#loadFrameVersion').onclick = async function() {
|
||||
//resets things so that every frame doesn't have to
|
||||
await resetCardIrregularities();
|
||||
//sets card version
|
||||
card.version = 'neoBasics';
|
||||
card.onload = '/js/frames/versionNeoBasics.js';
|
||||
loadScript('/js/frames/versionNeoBasics.js');
|
||||
//art bounds
|
||||
card.artBounds = {x:0, y:0, width:1, height:0.9286};
|
||||
autoFitArt();
|
||||
//set symbol bounds
|
||||
card.setSymbolBounds = {x:-1, y:-1, width:0, height:0, vertical:'center', horizontal: 'center'};
|
||||
resetSetSymbol();
|
||||
//watermark bounds
|
||||
card.watermarkBounds = {x:0.5, y:0.7705, width:0.75, height:0.2362};
|
||||
resetWatermark();
|
||||
//text
|
||||
loadTextOptions({
|
||||
title: {name:'Title', text:'', x:0.12, y:0.1048, width:0.1734, height:0.2381, font:'japanese-title', size:0.1191, align:'center', vertical:true, color:'white'}
|
||||
});
|
||||
}
|
||||
//loads available frames
|
||||
loadFramePack();
|
37
js/frames/versionNeoBasics.js
Normal file
37
js/frames/versionNeoBasics.js
Normal file
@@ -0,0 +1,37 @@
|
||||
//checks to see if it needs to run
|
||||
if (!loadedVersions.includes('/js/frames/versionNeoBasics.js')) {
|
||||
loadedVersions.push('/js/frames/versionNeoBasics.js');
|
||||
document.querySelector('#creator-menu-tabs').innerHTML += '<h3 class="selectable readable-background" onclick="toggleCreatorTabs(event, `neoBasics`)">Kamigawa Basics</h3>';
|
||||
var newHTML = document.createElement('div');
|
||||
newHTML.id = 'creator-menu-neoBasics';
|
||||
newHTML.classList.add('hidden');
|
||||
newHTML.innerHTML = `
|
||||
<div class='readable-background padding'>
|
||||
<h5 class='padding margin-bottom input-description'>Adjust the title bar's height:</h5>
|
||||
<input id='nb-change' class='input' type='number' oninput='stretchNeoBasics();' min='330', max='1000', value='330', step='10'>
|
||||
</div>
|
||||
<!--<div class='readable-background padding'>
|
||||
<h5 class='padding margin-bottom input-description'>Adjust the targets:</h5>
|
||||
<input id='targets' class='input' type='text' oninput='stretchNeoBasics();' value='0'>
|
||||
</div>-->`;
|
||||
document.querySelector('#creator-menu-sections').appendChild(newHTML);
|
||||
loadScript('/js/frames/manaSymbolsMysticalArchiveJP.js');
|
||||
}
|
||||
|
||||
function stretchNeoBasics() {
|
||||
const change = [0, (parseInt(document.querySelector('#nb-change').value) - 330) / 2100];
|
||||
// var targets = []
|
||||
// document.querySelector('#targets').value.split(' ').forEach(item => targets.push(parseInt(item)));
|
||||
card.frames.forEach(frame => {
|
||||
if (frame.src.includes('neo/basics/') && 'stretch' in frame) {
|
||||
frame.stretch[0].change = change;
|
||||
// frame.stretch[0].targets = targets;
|
||||
frame.stretch[1].change = change;
|
||||
frame.stretch[2].change = change;
|
||||
frame.stretch[3].change = change;
|
||||
card.text.title.height = change[1] + 500 / 2100;
|
||||
drawTextBuffer();
|
||||
stretchSVG(frame);
|
||||
}
|
||||
});
|
||||
}
|
Reference in New Issue
Block a user