mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-17 17:51:24 +01:00
v1.5.01 - COA gen integration, first try, embed
This commit is contained in:
parent
e1bc6d9eba
commit
b86d985607
9 changed files with 516 additions and 60 deletions
|
|
@ -43,7 +43,7 @@ function editBurg(id) {
|
|||
document.getElementById("burgEditAnchorStyle").addEventListener("click", editGroupAnchorStyle);
|
||||
|
||||
document.getElementById("burgSeeInMFCG").addEventListener("click", openInMFCG);
|
||||
document.getElementById("burgOpenCOA").addEventListener("click", openInIAHG);
|
||||
document.getElementById("burgOpenCOA").addEventListener("click", editCOA);
|
||||
document.getElementById("burgRelocate").addEventListener("click", toggleRelocateBurg);
|
||||
document.getElementById("burglLegend").addEventListener("click", editBurgLegend);
|
||||
document.getElementById("burgRemove").addEventListener("click", removeSelectedBurg);
|
||||
|
|
@ -326,17 +326,10 @@ function editBurg(id) {
|
|||
}
|
||||
}
|
||||
|
||||
function openInIAHG(event) {
|
||||
const id = elSelected.attr("data-id"), burg = pack.burgs[id], defSeed = `${seed}-b${id}`;
|
||||
const openIAHG = () => openURL("https://ironarachne.com/#/heraldry/" + (burg.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 burg id (${defSeed})`,
|
||||
{default:burg.IAHG || defSeed}, v => {
|
||||
if (v && v != defSeed) burg.IAHG = v;
|
||||
openIAHG();
|
||||
});
|
||||
} else openIAHG();
|
||||
function editCOA() {
|
||||
const id = elSelected.attr("data-id"), burg = pack.burgs[id];
|
||||
const coa = COA.toString(burg.coa);
|
||||
openURL("http://azgaar.github.io/Armoria/?coa=" + coa);
|
||||
}
|
||||
|
||||
function toggleRelocateBurg() {
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ function editStates() {
|
|||
const el = ev.target, cl = el.classList, line = el.parentNode, state = +line.dataset.id;
|
||||
if (cl.contains("fillRect")) stateChangeFill(el); else
|
||||
if (cl.contains("name")) editStateName(state); else
|
||||
if (cl.contains("icon-coa")) stateOpenCOA(ev, state); else
|
||||
if (cl.contains("emblemIcon")) editCOA(state); else
|
||||
if (cl.contains("icon-star-empty")) stateCapitalZoomIn(state); else
|
||||
if (cl.contains("culturePopulation")) changePopulation(state); else
|
||||
if (cl.contains("icon-pin")) toggleFog(state, cl); else
|
||||
|
|
@ -83,6 +83,7 @@ function editStates() {
|
|||
totalPopulation += population;
|
||||
totalBurgs += s.burgs;
|
||||
const focused = defs.select("#fog #focusState"+s.i).size();
|
||||
const COAsize = Math.round(15 * +uiSizeInput.value);
|
||||
|
||||
if (!s.i) {
|
||||
// Neutral line
|
||||
|
|
@ -90,7 +91,7 @@ function editStates() {
|
|||
data-population=${population} data-burgs=${s.burgs} data-color="" data-form="" data-capital="" data-culture="" data-type="" data-expansionism="">
|
||||
<svg width="9" height="9" class="placeholder"></svg>
|
||||
<input data-tip="Neutral lands name. Click to change" class="stateName name pointer italic" value="${s.name}" readonly>
|
||||
<span class="icon-coa placeholder hide"></span>
|
||||
<embed class="emblemIcon placeholder hide" type="image/svg+xml" width=${COAsize} height=${COAsize} >
|
||||
<input class="stateForm placeholder" value="none">
|
||||
<span class="icon-star-empty placeholder hide"></span>
|
||||
<input class="stateCapital placeholder hide">
|
||||
|
|
@ -110,11 +111,12 @@ function editStates() {
|
|||
continue;
|
||||
}
|
||||
const capital = pack.burgs[s.capital].name;
|
||||
const coaURL = `http://azgaar.github.io/Armoria/?view=1&size=${COAsize}&noedit&coa=${COA.toString(s.coa)}`;
|
||||
lines += `<div class="states" data-id=${s.i} data-name="${s.name}" data-form="${s.formName}" data-capital="${capital}" data-color="${s.color}" data-cells=${s.cells}
|
||||
data-area=${area} data-population=${population} data-burgs=${s.burgs} data-culture=${pack.cultures[s.culture].name} data-type=${s.type} data-expansionism=${s.expansionism}>
|
||||
<svg data-tip="State fill style. Click to change" width=".9em" height=".9em" style="margin-bottom:-1px"><rect x="0" y="0" width="100%" height="100%" fill="${s.color}" class="fillRect pointer"></svg>
|
||||
<input data-tip="State name. Click to change" class="stateName name pointer" value="${s.name}" readonly>
|
||||
<span data-tip="Click to open state COA in the Iron Arachne Heraldry Generator. Ctrl + click to change the seed" class="icon-coa pointer hide"></span>
|
||||
<embed data-tip="Click to show state COA" class="emblemIcon hide" type="image/svg+xml" width=${COAsize} height=${COAsize} src='${coaURL}'>
|
||||
<input data-tip="State form name. Click to change" class="stateForm name pointer" value="${s.formName}" readonly>
|
||||
<span data-tip="State capital. Click to zoom into view" class="icon-star-empty pointer hide"></span>
|
||||
<input data-tip="Capital name. Click and type to rename" class="stateCapital hide" value="${capital}" autocorrect="off" spellcheck="false"/>
|
||||
|
|
@ -313,17 +315,17 @@ function editStates() {
|
|||
document.querySelector("#burgLabel"+capital).textContent = value;
|
||||
}
|
||||
|
||||
function stateOpenCOA(event, state) {
|
||||
const defSeed = `${seed}-s${state}`;
|
||||
const openIAHG = () => openURL("https://ironarachne.com/#/heraldry/" + (pack.states[state].IAHG || defSeed));
|
||||
function editCOA(state) {
|
||||
const coa = COA.toString(pack.states[state].coa);
|
||||
const url = "http://azgaar.github.io/Armoria/?view=1&size=200&noedit&coa=" + coa;
|
||||
|
||||
if (isCtrlClick(event)) {
|
||||
prompt(`Please provide an Iron Arachne Heraldry Generator seed. <br>Default seed is a combination of FMG map seed and state id (${defSeed})`,
|
||||
{default:pack.states[state].IAHG || defSeed}, v => {
|
||||
if (v && v != defSeed) pack.states[state].IAHG = v;
|
||||
openIAHG();
|
||||
});
|
||||
} else openIAHG();
|
||||
$("#emblemsEditor").dialog({
|
||||
title: "Emblems Editor", resizable: false, width: fitContent(), close: closeStatesEditor,
|
||||
position: {my: "left top", at: "left+10 top+10", of: "svg", collision: "fit"}
|
||||
});
|
||||
|
||||
const embed = document.getElementById("emblemsEmbed");
|
||||
embed.setAttribute("src", url);
|
||||
}
|
||||
|
||||
function changePopulation(state) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue