From 819e5e944c1482c97492673ed05b53dbe963414d Mon Sep 17 00:00:00 2001 From: Josh birnholz Date: Thu, 27 Jul 2023 21:06:37 -0400 Subject: [PATCH] Update Autoframe for Etched nyx/snow frames --- js/creator-23.js | 37 ++++++++++++++++++++++++++--- js/frameSearch.js | 3 ++- js/frames/groupShowcase-5.js | 12 ++++++++-- js/frames/packEtched.js | 10 -------- js/frames/packInnerCrownsEtched.js | 27 +++++++++++++++++++++ js/frames/packLegendCrownsEtched.js | 19 +-------------- 6 files changed, 74 insertions(+), 34 deletions(-) create mode 100644 js/frames/packInnerCrownsEtched.js diff --git a/js/creator-23.js b/js/creator-23.js index 1da86d29..5ac6cbe3 100644 --- a/js/creator-23.js +++ b/js/creator-23.js @@ -1125,10 +1125,20 @@ async function autoEtchedFrame(colors, mana_cost, type_line, power) { document.querySelector('#frame-list').innerHTML = null; var properties = cardFrameProperties(colors, mana_cost, type_line, power, 'Etched'); + var style = 'regular'; + if (type_line.toLowerCase().includes('snow')) { + style = 'snow'; + } else if (type_line.toLowerCase().includes('enchantment creature') || type_line.toLowerCase().includes('enchantment artifact')) { + style = 'Nyx'; + } // Set frames if (type_line.includes('Legendary')) { + if (style == 'Nyx') { + frames.push(makeEtchedFrameByLetter(properties.innerCrown, 'Inner Crown', false, style)); + } + if (properties.frameRight) { frames.push(makeEtchedFrameByLetter(properties.frameRight, 'Crown', true)); } @@ -1145,9 +1155,9 @@ async function autoEtchedFrame(colors, mana_cost, type_line, power) { } frames.push(makeEtchedFrameByLetter(properties.rules, 'Rules', false)); if (properties.frameRight) { - frames.push(makeEtchedFrameByLetter(properties.frameRight, 'Frame', true)); + frames.push(makeEtchedFrameByLetter(properties.frameRight, 'Frame', true, style)); } - frames.push(makeEtchedFrameByLetter(properties.frame, 'Frame', false)); + frames.push(makeEtchedFrameByLetter(properties.frame, 'Frame', false, style)); frames.push(makeEtchedFrameByLetter(properties.frame, 'Border', false)); card.frames = frames; @@ -2014,7 +2024,7 @@ function makeCircuitFrameByLetter(letter, mask = false, maskToRightHalf = false) return frame; } -function makeEtchedFrameByLetter(letter, mask = false, maskToRightHalf = false) { +function makeEtchedFrameByLetter(letter, mask = false, maskToRightHalf = false, style = 'regular') { letter = letter.toUpperCase(); var frameNames = { 'W': 'White', @@ -2073,6 +2083,22 @@ function makeEtchedFrameByLetter(letter, mask = false, maskToRightHalf = false) return frame; } + if (mask == "Inner Crown") { + var frame = { + 'name': frameName + ' Inner Crown', + 'src': '/img/frames/etched/regular/innerCrowns/' + style.toLowerCase() + '/' + letter.toLowerCase() + '.png', + 'masks': [], + 'bounds': {x:244/1500, y:51/2100, width:1012/1500, height:64/2100} + } + if (maskToRightHalf) { + frame.masks.push({ + 'src': '/img/frames/maskRightHalf.png', + 'name': 'Right Half' + }); + } + return frame; + } + if (mask == 'PT') { return { 'name': frameName + ' Power/Toughness', @@ -2092,6 +2118,11 @@ function makeEtchedFrameByLetter(letter, mask = false, maskToRightHalf = false) 'src': '/img/frames/etched/regular/' + letter.toLowerCase() + '.png', } + if (style != 'regular') { + frame.src = frame.src.replace('/regular/', '/regular/' + style.toLowerCase() + '/'); + frame.name = frame.name += ' (' + style +')'; + } + if (mask) { frame.masks = [ { diff --git a/js/frameSearch.js b/js/frameSearch.js index d74a585c..32b9411f 100644 --- a/js/frameSearch.js +++ b/js/frameSearch.js @@ -5,6 +5,7 @@ const frameNames = new Map ([ ['Legend Crowns (Etched)', 'LegendCrownsEtched'], ['Floating Legend Crowns', 'M15LegendCrownsFloating'], ['Inner Crowns', 'M15InnerCrowns'], + ['Inner Crowns (Etched)', 'InnerCrownsEtched'], ['Miracle', 'M15Miracle'], ['Holo Stamps', 'M15HoloStamps'], ['Nicknames', 'M15Nickname-2'], @@ -77,7 +78,7 @@ const frameNames = new Map ([ ['Universes Beyond (Extended art)', 'UBExtendedArt'], ['Universes Beyond legend crowns', 'UBLegendCrowns'], ['Full Text', 'FullText'], - ['Etched (Commander Precons)', 'Etched'], + ['Etched', 'Etched'], ['Etched (Nyx)', 'EtchedNyx'], ['Etched (Snow)', 'EtchedSnow'], ['ZNR Expeditions (2020)', 'ExpeditionZNR-1'], diff --git a/js/frames/groupShowcase-5.js b/js/frames/groupShowcase-5.js index 7428a7b8..06199b32 100644 --- a/js/frames/groupShowcase-5.js +++ b/js/frames/groupShowcase-5.js @@ -33,6 +33,7 @@ loadFramePacks([ {name:'M21 Signature Spellbooks (M21)', value:'M21'}, {name:'Theros Beyond Death (THB)', value:'M15NyxShowcase'}, {name:'Eldraine Storybooks: Adventures (ELD)', value:'Storybook'}, + {name:'Generic Showcase Frames', value:'disabled'}, {name:'Borderless', value:'GenericShowcase'}, {name:'Borderless (Alt)', value:'Borderless'}, @@ -42,13 +43,19 @@ loadFramePacks([ {name:'Extended Art (Shorter Textbox)', value:'M15ExtendedArtShort'}, {name:'FNM Promo (Inverted Promos)', value:'FNM'}, {name:'Full Text', value:'FullText'}, - {name:'Etched (Commander Precons)', value:'Etched'}, + + {name:'Foil-Etched', value:'disabled'}, + {name:'Etched', value:'Etched'}, {name:'Etched (Nyx)', value:'EtchedNyx'}, {name:'Etched (Snow)', value:'EtchedSnow'}, + {name:'Legend Crowns (Etched)', value:'LegendCrownsEtched'}, + {name:'Inner Crowns (Etched)', value:'InnerCrownsEtched'}, + {name:'Universes Beyond', value:'disabled'}, {name:'Universes Beyond', value:'UB'}, {name:'Universes Beyond (Full art)', value:'UBFull'}, {name:'Universes Beyond (Extended art)', value:'UBExtendedArt'}, + {name:'Masterpieces/Other', value:'disabled'}, {name:'Phyrexian', value:'Praetors'}, {name:'ZNR Expeditions (2020)', value:'ExpeditionZNR-1'}, @@ -60,10 +67,10 @@ loadFramePacks([ {name:'BFZ Expeditions (2015)', value:'ExpeditionBFZ-1'}, {name:'SDCC15 (Blackout)', value:'SDCC15'}, {name:'Future Shifted', value:'FutureRegular'}, + {name:'Addons', value:'disabled'}, {name:'Legend Crowns', value:'M15LegendCrowns'}, {name:'Legend Crowns (Universes Beyond)', value:'UBLegendCrowns'}, - {name:'Legend Crowns (Etched)', value:'LegendCrownsEtched'}, {name:'Floating Legend Crowns', value:'M15LegendCrownsFloating'}, {name:'Inner Crowns', value:'M15InnerCrowns'}, {name:'Nicknames', value:'M15Nickname-2'}, @@ -72,6 +79,7 @@ loadFramePacks([ {name:'Colored Borders', value:'M15Borders'}, {name:'Color Identity Pips', value:'M15CIPips'}, {name:'"The List" Stamp', value:'TheList'}, + {name:'Custom Addons', value:'disabled'}, {name:'Brawl Legend Crowns', value:'Brawl'} ]) \ No newline at end of file diff --git a/js/frames/packEtched.js b/js/frames/packEtched.js index 5721f944..1ec8b2fa 100644 --- a/js/frames/packEtched.js +++ b/js/frames/packEtched.js @@ -25,16 +25,6 @@ availableFrames = [ {name:'Land Power/Toughness', src:'/img/frames/etched/regular/pt/l.png', bounds:bounds}, {name:'Vehicle Power/Toughness', src:'/img/frames/etched/regular/pt/v.png', bounds:bounds}, {name:'Colorless Power/Toughness', src:'/img/frames/etched/regular/pt/c.png', bounds:bounds}, - {name:'White Legend Crown', src:'/img/frames/etched/regular/crowns/w.png', bounds:bounds3, complementary:29}, - {name:'Blue Legend Crown', src:'/img/frames/etched/regular/crowns/u.png', bounds:bounds3, complementary:29}, - {name:'Black Legend Crown', src:'/img/frames/etched/regular/crowns/b.png', bounds:bounds3, complementary:29}, - {name:'Red Legend Crown', src:'/img/frames/etched/regular/crowns/r.png', bounds:bounds3, complementary:29}, - {name:'Green Legend Crown', src:'/img/frames/etched/regular/crowns/g.png', bounds:bounds3, complementary:29}, - {name:'Multicolored Legend Crown', src:'/img/frames/etched/regular/crowns/m.png', bounds:bounds3, complementary:29}, - {name:'Artifact Legend Crown', src:'/img/frames/etched/regular/crowns/a.png', bounds:bounds3, complementary:29}, - {name:'Land Crown', src:'/img/frames/etched/regular/crowns/l.png', bounds:bounds3, complementary:29}, - {name:'Colorless Crown', src:'/img/frames/etched/regular/crowns/c.png', bounds:bounds3, complementary:29}, - {name:'Legend Crown Cover', src:'/img/frames/etched/regular/crowns/cover.svg'}, {name:'White Holo Stamp', src:'/img/frames/etched/regular/holo/w.png', bounds:bounds2}, {name:'Blue Holo Stamp', src:'/img/frames/etched/regular/holo/u.png', bounds:bounds2}, {name:'Black Holo Stamp', src:'/img/frames/etched/regular/holo/b.png', bounds:bounds2}, diff --git a/js/frames/packInnerCrownsEtched.js b/js/frames/packInnerCrownsEtched.js new file mode 100644 index 00000000..5bdfc07d --- /dev/null +++ b/js/frames/packInnerCrownsEtched.js @@ -0,0 +1,27 @@ +//Create objects for common properties across available frames +var masks = []; +var bounds = {x:244/1500, y:51/2100, width:1012/1500, height:64/2100}; +//defines available frames +availableFrames = [ + {name:'White Inner Crown (Nyx)', src:'/img/frames/etched/regular/innerCrowns/nyx/w.png', bounds:bounds}, + {name:'Blue Inner Crown (Nyx)', src:'/img/frames/etched/regular/innerCrowns/nyx/u.png', bounds:bounds}, + {name:'Black Inner Crown (Nyx)', src:'/img/frames/etched/regular/innerCrowns/nyx/b.png', bounds:bounds}, + {name:'Red Inner Crown (Nyx)', src:'/img/frames/etched/regular/innerCrowns/nyx/r.png', bounds:bounds}, + {name:'Green Inner Crown (Nyx)', src:'/img/frames/etched/regular/innerCrowns/nyx/g.png', bounds:bounds}, + {name:'Multicolored Inner Crown (Nyx)', src:'/img/frames/etched/regular/innerCrowns/nyx/m.png', bounds:bounds}, + {name:'Artifact Inner Crown (Nyx)', src:'/img/frames/etched/regular/innerCrowns/nyx/a.png', bounds:bounds}, + + {name:'White Inner Crown (Companion)', src:'/img/frames/etched/regular/innerCrowns/companion/w.png', bounds:bounds}, + {name:'Blue Inner Crow (Companion)', src:'/img/frames/etched/regular/innerCrowns/companion/u.png', bounds:bounds}, + {name:'Black Inner Crown (Companion)', src:'/img/frames/etched/regular/innerCrowns/companion/b.png', bounds:bounds}, + {name:'Red Inner Crown (Companion)', src:'/img/frames/etched/regular/innerCrowns/companion/r.png', bounds:bounds}, + {name:'Green Inner Crown (Companion)', src:'/img/frames/etched/regular/innerCrowns/companion/g.png', bounds:bounds}, + {name:'Multicolored Inner Crown (Companion)', src:'/img/frames/etched/regular/innerCrowns/companion/m.png', bounds:bounds}, + {name:'Artifact Inner Crown (Companion)', src:'/img/frames/etched/regular/innerCrowns/companion/a.png', bounds:bounds}, +]; +//disables/enables the "Load Frame Version" button +document.querySelector('#loadFrameVersion').disabled = true; +//defines process for loading this version, if applicable +document.querySelector('#loadFrameVersion').onclick = null; +//loads available frames +loadFramePack(); \ No newline at end of file diff --git a/js/frames/packLegendCrownsEtched.js b/js/frames/packLegendCrownsEtched.js index 5104ca86..57ba59da 100644 --- a/js/frames/packLegendCrownsEtched.js +++ b/js/frames/packLegendCrownsEtched.js @@ -1,7 +1,6 @@ //Create objects for common properties across available frames var masks = []; var bounds = {x:0.0307, y:0.0191, width:0.9387, height:0.092}; -var innerCrownBounds = {x:244/1500, y:51/2100, width:1012/1500, height:64/2100}; //defines available frames availableFrames = [ {name:'White Legend Crown', src:'/img/frames/etched/regular/crowns/w.png', bounds:bounds, complementary:9}, @@ -13,23 +12,7 @@ availableFrames = [ {name:'Artifact Legend Crown', src:'/img/frames/etched/regular/crowns/a.png', bounds:bounds, complementary:9}, {name:'Land Crown', src:'/img/frames/etched/regular/crowns/l.png', bounds:bounds, complementary:9}, {name:'Colorless Crown', src:'/img/frames/etched/regular/crowns/c.png', bounds:bounds, complementary:9}, - {name:'Legend Crown Cover', src:'/img/frames/etched/regular/crowns/cover.svg'}, - - {name:'White Inner Crown (Nyx)', src:'/img/frames/etched/regular/innerCrowns/nyx/w.png', bounds:innerCrownBounds}, - {name:'Blue Inner Crown (Nyx)', src:'/img/frames/etched/regular/innerCrowns/nyx/u.png', bounds:innerCrownBounds}, - {name:'Black Inner Crown (Nyx)', src:'/img/frames/etched/regular/innerCrowns/nyx/b.png', bounds:innerCrownBounds}, - {name:'Red Inner Crown (Nyx)', src:'/img/frames/etched/regular/innerCrowns/nyx/r.png', bounds:innerCrownBounds}, - {name:'Green Inner Crown (Nyx)', src:'/img/frames/etched/regular/innerCrowns/nyx/g.png', bounds:innerCrownBounds}, - {name:'Multicolored Inner Crown (Nyx)', src:'/img/frames/etched/regular/innerCrowns/nyx/m.png', bounds:innerCrownBounds}, - {name:'Artifact Inner Crown (Nyx)', src:'/img/frames/etched/regular/innerCrowns/nyx/a.png', bounds:innerCrownBounds}, - - {name:'White Inner Crown (Companion)', src:'/img/frames/etched/regular/innerCrowns/companion/w.png', bounds:innerCrownBounds}, - {name:'Blue Inner Crow (Companion)', src:'/img/frames/etched/regular/innerCrowns/companion/u.png', bounds:innerCrownBounds}, - {name:'Black Inner Crown (Companion)', src:'/img/frames/etched/regular/innerCrowns/companion/b.png', bounds:innerCrownBounds}, - {name:'Red Inner Crown (Companion)', src:'/img/frames/etched/regular/innerCrowns/companion/r.png', bounds:innerCrownBounds}, - {name:'Green Inner Crown (Companion)', src:'/img/frames/etched/regular/innerCrowns/companion/g.png', bounds:innerCrownBounds}, - {name:'Multicolored Inner Crown (Companion)', src:'/img/frames/etched/regular/innerCrowns/companion/m.png', bounds:innerCrownBounds}, - {name:'Artifact Inner Crown (Companion)', src:'/img/frames/etched/regular/innerCrowns/companion/a.png', bounds:innerCrownBounds}, + {name:'Legend Crown Cover', src:'/img/frames/etched/regular/crowns/cover.svg'} ]; //disables/enables the "Load Frame Version" button document.querySelector('#loadFrameVersion').disabled = true;