v1.5.49 - select emblem shape on culture level

This commit is contained in:
Azgaar 2021-02-21 15:55:52 +03:00
parent 7b1e463c92
commit bfc881bda9
6 changed files with 84 additions and 40 deletions

View file

@ -196,6 +196,18 @@
}
};
const shields = {
types: {basic: 10, regional: 2, historical: 1, specific: 1, banner: 1, simple: 2, fantasy: 1, middleEarth: 0},
basic: {heater: 12, spanish: 6, french: 1},
regional: {horsehead: 1, horsehead2: 1, polish: 1, hessen: 1, swiss: 1},
historical: {boeotian: 1, roman: 2, kite: 1, oldFrench: 5, renaissance: 2, baroque: 2},
specific: {targe: 1, targe2: 0, pavise: 5, wedged: 10},
banner: {flag: 1, pennon: 0, guidon: 0, banner: 0, dovetail: 1, gonfalon: 5, pennant: 0},
simple: {round: 12, oval: 6, vesicaPiscis: 1, square: 1, diamond: 2, no: 0},
fantasy: {fantasy1: 2, fantasy2: 2, fantasy3: 1, fantasy4: 1, fantasy5: 3},
middleEarth: {noldor: 1, gondor: 1, easterling: 1, erebor: 1, ironHills: 1, urukHai: 1, moriaOrc: 1}
}
const generate = function(parent, kinship, dominion, type) {
if (parent === "custom") parent = null;
let usedPattern = null, usedTinctures = [];
@ -471,8 +483,11 @@
}
const getShield = function(culture, state) {
const emblemShape = document.getElementById("emblemShape").value;
if (emblemShape === "state" && state && pack.states[state].coa) return pack.states[state].coa.shield;
const emblemShape = document.getElementById("emblemShape");
const shapeGroup = emblemShape.selectedOptions[0].parentNode.label;
if (shapeGroup !== "Diversiform") return emblemShape.value;
if (emblemShape.value === "state" && state && pack.states[state].coa) return pack.states[state].coa.shield;
if (pack.cultures[culture].shield) return pack.cultures[culture].shield;
console.error("Shield shape is not defined on culture level", pack.cultures[culture]);
return "heater";
@ -481,6 +496,6 @@
const toString = coa => JSON.stringify(coa).replaceAll("#", "%23");
const copy = coa => JSON.parse(JSON.stringify(coa));
return {generate, toString, copy, getShield};
return {generate, toString, copy, getShield, shields};
})));