v1.5.01 - COA gen integration, first try, embed

This commit is contained in:
Azgaar 2021-01-26 13:38:37 +03:00
parent e1bc6d9eba
commit b86d985607
9 changed files with 516 additions and 60 deletions

View file

@ -38,7 +38,7 @@ function editProvinces() {
const el = ev.target, cl = el.classList, line = el.parentNode, p = +line.dataset.id;
if (cl.contains("fillRect")) changeFill(el); else
if (cl.contains("name")) editProvinceName(p); else
if (cl.contains("icon-coa")) provinceOpenCOA(ev, p); else
if (cl.contains("icon-coa")) editCOA(p); else
if (cl.contains("icon-star-empty")) capitalZoomIn(p); else
if (cl.contains("icon-flag-empty")) triggerIndependencePromps(p); else
if (cl.contains("culturePopulation")) changePopulation(p); else
@ -117,7 +117,7 @@ function editProvinces() {
lines += `<div class="states" data-id=${p.i} data-name="${p.name}" data-form="${p.formName}" data-color="${p.color}" data-capital="${capital}" data-state="${stateName}" data-area=${area} data-population=${population}>
<svg data-tip="Province fill style. Click to change" width=".9em" height=".9em" style="margin-bottom:-1px"><rect x="0" y="0" width="100%" height="100%" fill="${p.color}" class="fillRect pointer"></svg>
<input data-tip="Province name. Click to change" class="name pointer" value="${p.name}" readonly>
<span data-tip="Click to open province COA in the Iron Arachne Heraldry Generator. Ctrl + click to change the seed" class="icon-coa pointer hide"></span>
<span data-tip="Click to edit province COA" class="icon-coa pointer hide"></span>
<input data-tip="Province form name. Click to change" class="name pointer hide" value="${p.formName}" readonly>
<span data-tip="Province capital. Click to zoom into view" class="icon-star-empty pointer hide ${p.burg?'':'placeholder'}"></span>
<select data-tip="Province capital. Click to select from burgs within the state. No capital means the province is governed from the state capital" class="cultureBase hide ${p.burgs.length?'':'placeholder'}">${p.burgs.length ? getCapitalOptions(p.burgs, p.burg) : ''}</select>
@ -192,17 +192,9 @@ function editProvinces() {
openPicker(currentFill, callback);
}
function provinceOpenCOA(event, p) {
const defSeed = `${seed}-p${p}`;
const openIAHG = () => openURL("https://ironarachne.com/#/heraldry/" + (pack.provinces[p].IAHG || defSeed));
if (isCtrlClick(event)) {
prompt(`Please provide an Iron Arachne Heraldry Generator seed. <br>Default seed is a combination of FMG map seed and province id (${defSeed})`,
{default:pack.provinces[p].IAHG || defSeed}, v => {
if (v && v != defSeed) pack.provinces[p].IAHG = v;
openIAHG();
});
} else openIAHG();
function editCOA(p) {
const coa = COA.toString(pack.provinces[p].coa);
openURL("http://azgaar.github.io/Armoria/?coa=" + coa);
}
function capitalZoomIn(p) {