From 3064961c59d59f306b31eca7918ebeb8fab806be Mon Sep 17 00:00:00 2001 From: Azgaar Date: Fri, 1 Jul 2022 21:00:00 +0300 Subject: [PATCH] fix(#845): emblem shield - remove incorrect data --- index.html | 4 +-- modules/coa-renderer.js | 66 ++++++++++++++++++++++------------ modules/dynamic/auto-update.js | 7 ++++ modules/io/load.js | 2 +- 4 files changed, 54 insertions(+), 25 deletions(-) diff --git a/index.html b/index.html index bcb26d40..aebb76f2 100644 --- a/index.html +++ b/index.html @@ -7856,12 +7856,12 @@ - + - + diff --git a/modules/coa-renderer.js b/modules/coa-renderer.js index 8bb6b777..269e3317 100644 --- a/modules/coa-renderer.js +++ b/modules/coa-renderer.js @@ -1454,10 +1454,12 @@ window.COArenderer = (function () { french: "m 25,25 h 150 v 139.15 c 0,41.745 -66,18.15 -75,36.3 -9,-18.15 -75,5.445 -75,-36.3 v 0 z", horsehead: "m 20,40 c 0,60 40,80 40,100 0,10 -4,15 -0.35,30 C 65,185.7 81,200 100,200 c 19.1,0 35.3,-14.6 40.5,-30.4 C 144.2,155 140,150 140,140 140,120 180,100 180,40 142.72,40 150,15 100,15 55,15 55,40 20,40 Z", - horsehead2: "M60 20c-5 20-10 35-35 55 25 35 35 65 30 100 20 0 35 10 45 26 10-16 30-26 45-26-5-35 5-65 30-100a87 87 0 01-35-55c-25 3-55 3-80 0z", + horsehead2: + "M60 20c-5 20-10 35-35 55 25 35 35 65 30 100 20 0 35 10 45 26 10-16 30-26 45-26-5-35 5-65 30-100a87 87 0 01-35-55c-25 3-55 3-80 0z", polish: "m 90.3,6.3 c -12.7,0 -20.7,10.9 -40.5,14 0,11.8 -4.9,23.5 -11.4,31.1 0,0 12.7,6 12.7,19.3 C 51.1,90.8 30,90.8 30,90.8 c 0,0 -3.6,7.4 -3.6,22.4 0,34.3 23.1,60.2 40.7,68.2 17.6,8 27.7,11.4 32.9,18.6 5.2,-7.3 15.3,-10.7 32.8,-18.6 17.6,-8 40.7,-33.9 40.7,-68.2 0,-15 -3.6,-22.4 -3.6,-22.4 0,0 -21.1,0 -21.1,-20.1 0,-13.3 12.7,-19.3 12.7,-19.3 C 155.1,43.7 150.2,32.1 150.2,20.3 130.4,17.2 122.5,6.3 109.7,6.3 102.5,6.3 100,10 100,10 c 0,0 -2.5,-3.7 -9.7,-3.7 z", - hessen: "M170 20c4 5 8 13 15 20 0 0-10 0-10 15 0 100-15 140-75 145-65-5-75-45-75-145 0-15-10-15-10-15l15-20c0 15 10-5 70-5s70 20 70 5z", + hessen: + "M170 20c4 5 8 13 15 20 0 0-10 0-10 15 0 100-15 140-75 145-65-5-75-45-75-145 0-15-10-15-10-15l15-20c0 15 10-5 70-5s70 20 70 5z", swiss: "m 25,20 c -0.1,0 25.2,8.5 37.6,8.5 C 75.1,28.5 99.1,20 100,20 c 0.6,0 24.9,8.5 37.3,8.5 C 149.8,28.5 174.4,20 175,20 l -0.3,22.6 C 173.2,160.3 100,200 100,200 100,200 26.5,160.9 25.2,42.6 Z", boeotian: @@ -1473,11 +1475,14 @@ window.COArenderer = (function () { "m 20,35 c 15,0 115,-60 155,-10 -5,10 -15,15 -10,50 5,45 10,70 -10,90 C 125,195 75,195 50,175 25,150 30,130 35,85 50,95 65,85 65,70 65,50 50,45 40,50 30,55 27,65 30,70 23,73 20,70 14,70 11,60 20,45 20,35 Z", targe2: "m 84,32.2 c 6.2,-1 19.5,-31.4 94.1,-20.2 -30.57,33.64 -21.66,67.37 -11.2,95 20.2,69.5 -41.17549,84.7 -66.88,84.7 C 74.32,191.7071 8.38,168.95 32,105.9 36.88,92.88 31,89 31,82.6 35.15,82.262199 56.79,86.17 56.5,69.8 56.20,52.74 42.2,47.9 25.9,55.2 25.9,51.4 39.8,6.7 84,32.2 Z", - pavise: "M95 7L39.9 37.3a10 10 0 00-5.1 9.5L46 180c.4 5.2 3.7 10 9 10h90c5.3 0 9.6-4.8 10-10l10.6-133.2a10 10 0 00-5-9.5L105 7c-4.2-2.3-6.2-2.3-10 0z", - wedged: "m 51.2,19 h 96.4 c 3.1,12.7 10.7,20.9 26.5,20.8 C 175.7,94.5 165.3,144.3 100,200 43.5,154.2 22.8,102.8 25.1,39.7 37,38.9 47.1,34.7 51.2,19 Z", + pavise: + "M95 7L39.9 37.3a10 10 0 00-5.1 9.5L46 180c.4 5.2 3.7 10 9 10h90c5.3 0 9.6-4.8 10-10l10.6-133.2a10 10 0 00-5-9.5L105 7c-4.2-2.3-6.2-2.3-10 0z", + wedged: + "m 51.2,19 h 96.4 c 3.1,12.7 10.7,20.9 26.5,20.8 C 175.7,94.5 165.3,144.3 100,200 43.5,154.2 22.8,102.8 25.1,39.7 37,38.9 47.1,34.7 51.2,19 Z", round: "m 185,100 a 85,85 0 0 1 -85,85 85,85 0 0 1 -85,-85 85,85 0 0 1 85,-85 85,85 0 0 1 85,85", oval: "m 32.3,99.5 a 67.7,93.7 0 1 1 0,1.3 z", - vesicaPiscis: "M 100,0 C 63.9,20.4 41,58.5 41,100 c 0,41.5 22.9,79.6 59,100 36.1,-20.4 59,-58.5 59,-100 C 159,58.5 136.1,20.4 100,0 Z", + vesicaPiscis: + "M 100,0 C 63.9,20.4 41,58.5 41,100 c 0,41.5 22.9,79.6 59,100 36.1,-20.4 59,-58.5 59,-100 C 159,58.5 136.1,20.4 100,0 Z", square: "M 25,25 H 175 V 175 H 25 Z", diamond: "M 25,100 100,200 175,100 100,0 Z", no: "m0,0 h200 v200 h-200 z", @@ -1488,13 +1493,17 @@ window.COArenderer = (function () { dovetail: "m 25,25 v 175 l 75,-40 75,40 V 25 Z", gonfalon: "m 25,25 v 125 l 75,50 75,-50 V 25 Z", pennant: "M 25,15 100,200 175,15 Z", - fantasy1: "M 100,5 C 85,30 40,35 15,40 c 40,35 20,90 40,115 15,25 40,30 45,45 5,-15 30,-20 45,-45 20,-25 0,-80 40,-115 C 160,35 115,30 100,5 Z", + fantasy1: + "M 100,5 C 85,30 40,35 15,40 c 40,35 20,90 40,115 15,25 40,30 45,45 5,-15 30,-20 45,-45 20,-25 0,-80 40,-115 C 160,35 115,30 100,5 Z", fantasy2: "m 152,21 c 0,0 -27,14 -52,-4 C 75,35 48,21 48,21 50,45 30,55 30,75 60,75 60,115 32,120 c 3,40 53,50 68,80 15,-30 65,-40 68,-80 -28,-5 -28,-45 2,-45 C 170,55 150,45 152,21 Z", - fantasy3: "M 167,67 C 165,0 35,0 33,67 c 32,-7 27,53 -3,43 -5,45 60,65 70,90 10,-25 75,-47.51058 70,-90 -30,10 -35,-50 -3,-43 z", - fantasy4: "M100 9C55 48 27 27 13 39c23 50 3 119 49 150 14 9 28 11 38 11s27-4 38-11c55-39 24-108 49-150-14-12-45 7-87-30z", + fantasy3: + "M 167,67 C 165,0 35,0 33,67 c 32,-7 27,53 -3,43 -5,45 60,65 70,90 10,-25 75,-47.51058 70,-90 -30,10 -35,-50 -3,-43 z", + fantasy4: + "M100 9C55 48 27 27 13 39c23 50 3 119 49 150 14 9 28 11 38 11s27-4 38-11c55-39 24-108 49-150-14-12-45 7-87-30z", fantasy5: "M 100,0 C 75,25 30,25 30,25 c 0,69 20,145 70,175 50,-30 71,-106 70,-175 0,0 -45,0 -70,-25 z", - noldor: "m 55,75 h 2 c 3,-25 38,-10 3,20 15,50 30,75 40,105 10,-30 25,-55 40,-105 -35,-30 0,-45 3,-20 h 2 C 150,30 110,20 100,0 90,20 50,30 55,75 Z", + noldor: + "m 55,75 h 2 c 3,-25 38,-10 3,20 15,50 30,75 40,105 10,-30 25,-55 40,-105 -35,-30 0,-45 3,-20 h 2 C 150,30 110,20 100,0 90,20 50,30 55,75 Z", gondor: "m 100,200 c 15,-15 38,-35 45,-60 h 5 V 30 h -5 C 133,10 67,10 55,30 h -5 v 110 h 5 c 7,25 30,45 45,60 z", easterling: "M 160,185 C 120,170 80,170 40,185 V 15 c 40,15 80,15 120,0 z", erebor: "M25 135 V60 l22-13 16-37 h75 l15 37 22 13 v75l-22 18-16 37 H63l-16-37z", @@ -1515,7 +1524,8 @@ window.COArenderer = (function () { wavy: "m 200,115 v -15 c -8.9,3.5 -16,3.1 -25,0 -8.9,-3.5 -16,-3.1 -25,0 -8.9,3.5 -16,3.2 -25,0 -8.9,-3.5 -16,-3.2 -25,0 -8.9,3.5 -16,3.1 -25,0 -8.9,-3.5 -16,-3.1 -25,0 -8.9,3.5 -16,3.2 -25,0 -8.9,-3.5 -16,-3.2 -25,0 v 15 z", raguly: "m 200,95 h -3 l -5,10 h -10 l 5,-10 h -10 l -5,10 h -10 l 5,-10 h -10 l -5,10 h -10 l 5,-10 h -10 l -5,10 h -10 l 5,-10 h -10 l -5,10 h -10 l 5,-10 H 97 l -5,10 H 82 L 87,95 H 77 l -5,10 H 62 L 67,95 H 57 l -5,10 H 42 L 47,95 H 37 l -5,10 H 22 L 27,95 H 17 l -5,10 H 2 L 7,95 H 0 v 20 h 200 z", - dancetty: "m 0,105 10,-15 15,20 15,-20 15,20 15,-20 15,20 15,-20 15,20 15,-20 15,20 15,-20 15,20 15,-20 10,15 v 10 H 0 Z", + dancetty: + "m 0,105 10,-15 15,20 15,-20 15,20 15,-20 15,20 15,-20 15,20 15,-20 15,20 15,-20 15,20 15,-20 10,15 v 10 H 0 Z", dentilly: "M 180,105 170,95 v 10 L 160,95 v 10 L 150,95 v 10 L 140,95 v 10 L 130,95 v 10 L 120,95 v 10 L 110,95 v 10 L 100,95 v 10 L 90,95 v 10 L 80,95 v 10 L 70,95 v 10 L 60,95 v 10 L 50,95 v 10 L 40,95 v 10 L 30,95 v 10 L 20,95 v 10 L 10,95 v 10 L 0,95 v 20 H 200 V 105 L 190,95 v 10 L 180,95 Z", angled: "m 0,95 h 100 v 10 h 100 v 10 H 0 Z", @@ -1573,8 +1583,10 @@ window.COArenderer = (function () { gyronny: ``, chevronny: ``, // lined divisions - perFessLined: line => ``, - perPaleLined: line => ``, + perFessLined: line => + ``, + perPaleLined: line => + ``, perBendLined: line => ``, perBendSinisterLined: line => @@ -1630,10 +1642,12 @@ window.COArenderer = (function () { ``, bendSinisterLined: line => ``, - chiefLined: line => ``, + chiefLined: line => + ``, barLined: line => ``, - gemelleLined: line => ``, + gemelleLined: line => + ``, fessCotissedLined: line => ``, fessDoubleCotissedLined: line => @@ -1642,7 +1656,8 @@ window.COArenderer = (function () { ``, bendletSinisterLined: line => ``, - terraceLined: line => ``, + terraceLined: line => + ``, crossLined: line => ``, crossPartedLined: line => @@ -1781,18 +1796,20 @@ window.COArenderer = (function () { }; const draw = async function (id, coa) { - const {shield, division, ordinaries = [], charges = []} = coa; + const {shield = "heater", division, ordinaries = [], charges = []} = coa; const ordinariesRegular = ordinaries.filter(o => !o.above); const ordinariesAboveCharges = ordinaries.filter(o => o.above); - const shieldPath = shieldPaths[shield]; + const shieldPath = shieldPaths[shield] || shieldPaths.heater; const tDiv = division ? (division.t.includes("-") ? division.t.split("-")[1] : division.t) : null; const positions = shieldPositions[shield]; const sizeModifier = shieldSize[shield] || 1; const viewBox = shieldBox[shield] || "0 0 200 200"; const shieldClip = ``; - const divisionClip = division ? `${getTemplate(division.division, division.line)}` : ""; + const divisionClip = division + ? `${getTemplate(division.division, division.line)}` + : ""; const loadedCharges = await getCharges(coa, id, shieldPath); const loadedPatterns = getPatterns(coa, id); const blacklight = ``; @@ -1829,7 +1846,9 @@ window.COArenderer = (function () { } // In division part - svg += ``; + svg += ``; for (const ordinary of ordinariesRegular) { if (ordinary.divided === "division") svg += templateOrdinary(ordinary, ordinary.t); @@ -1876,7 +1895,8 @@ window.COArenderer = (function () { function templateOrdinary(ordinary, tincture) { const fill = clr(tincture); let svg = ``; - if (ordinary.ordinary === "bordure") svg += ``; + if (ordinary.ordinary === "bordure") + svg += ``; else if (ordinary.ordinary === "orle") svg += ``; else svg += getTemplate(ordinary.ordinary, ordinary.line); @@ -1916,7 +1936,8 @@ window.COArenderer = (function () { const uniqueCharges = [...new Set(charges)]; const fetchedCharges = await Promise.all( uniqueCharges.map(async charge => { - if (charge === "inescutcheon") return ``; + if (charge === "inescutcheon") + return ``; const fetched = await fetchCharge(charge, id); return fetched; }) @@ -1949,7 +1970,8 @@ window.COArenderer = (function () { let patternsToAdd = []; if (coa.t1.includes("-")) patternsToAdd.push(coa.t1); // add field pattern if (coa.division && isPattern(coa.division.t)) patternsToAdd.push(coa.division.t); // add division pattern - if (coa.ordinaries) coa.ordinaries.filter(ordinary => isPattern(ordinary.t)).forEach(ordinary => patternsToAdd.push(ordinary.t)); // add ordinaries pattern + if (coa.ordinaries) + coa.ordinaries.filter(ordinary => isPattern(ordinary.t)).forEach(ordinary => patternsToAdd.push(ordinary.t)); // add ordinaries pattern if (coa.charges) coa.charges.filter(charge => isPattern(charge.t)).forEach(charge => patternsToAdd.push(charge.t)); // add charges pattern if (!patternsToAdd.length) return ""; diff --git a/modules/dynamic/auto-update.js b/modules/dynamic/auto-update.js index fdb758de..6c280826 100644 --- a/modules/dynamic/auto-update.js +++ b/modules/dynamic/auto-update.js @@ -629,4 +629,11 @@ export function resolveVersionConflicts(version) { delete religion.origin; } } + + if (version < 1.88) { + // v1.87 may have incorrect shield for some reason + pack.states.forEach(({coa}) => { + if (coa?.shield === "state") delete coa.shield; + }); + } } diff --git a/modules/io/load.js b/modules/io/load.js index 1e8c946a..ea2ff63d 100644 --- a/modules/io/load.js +++ b/modules/io/load.js @@ -431,7 +431,7 @@ async function parseLoadedData(data) { { // dynamically import and run auto-udpdate script const versionNumber = parseFloat(params[0]); - const {resolveVersionConflicts} = await import("../dynamic/auto-update.js?v=06062022"); + const {resolveVersionConflicts} = await import("../dynamic/auto-update.js?v=1.87.08"); resolveVersionConflicts(versionNumber); }