mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-21 19:41:23 +01:00
feat: add more details to burgs export
This commit is contained in:
parent
1619bed334
commit
0fdfe706f6
2 changed files with 57 additions and 52 deletions
|
|
@ -126,51 +126,6 @@ function editBurg(id) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// in °C, array from -1 °C; source: https://en.wikipedia.org/wiki/List_of_cities_by_average_temperature
|
|
||||||
function getTemperatureLikeness(temperature) {
|
|
||||||
if (temperature < -5) return "Yakutsk";
|
|
||||||
const cities = [
|
|
||||||
"Snag (Yukon)",
|
|
||||||
"Yellowknife (Canada)",
|
|
||||||
"Okhotsk (Russia)",
|
|
||||||
"Fairbanks (Alaska)",
|
|
||||||
"Nuuk (Greenland)",
|
|
||||||
"Murmansk", // -5 - 0
|
|
||||||
"Arkhangelsk",
|
|
||||||
"Anchorage",
|
|
||||||
"Tromsø",
|
|
||||||
"Reykjavik",
|
|
||||||
"Riga",
|
|
||||||
"Stockholm",
|
|
||||||
"Halifax",
|
|
||||||
"Prague",
|
|
||||||
"Copenhagen",
|
|
||||||
"London", // 1 - 10
|
|
||||||
"Antwerp",
|
|
||||||
"Paris",
|
|
||||||
"Milan",
|
|
||||||
"Batumi",
|
|
||||||
"Rome",
|
|
||||||
"Dubrovnik",
|
|
||||||
"Lisbon",
|
|
||||||
"Barcelona",
|
|
||||||
"Marrakesh",
|
|
||||||
"Alexandria", // 11 - 20
|
|
||||||
"Tegucigalpa",
|
|
||||||
"Guangzhou",
|
|
||||||
"Rio de Janeiro",
|
|
||||||
"Dakar",
|
|
||||||
"Miami",
|
|
||||||
"Jakarta",
|
|
||||||
"Mogadishu",
|
|
||||||
"Bangkok",
|
|
||||||
"Aden",
|
|
||||||
"Khartoum"
|
|
||||||
]; // 21 - 30
|
|
||||||
if (temperature > 30) return "Mecca";
|
|
||||||
return cities[temperature + 5] || null;
|
|
||||||
}
|
|
||||||
|
|
||||||
function dragBurgLabel() {
|
function dragBurgLabel() {
|
||||||
const tr = parseTransform(this.getAttribute("transform"));
|
const tr = parseTransform(this.getAttribute("transform"));
|
||||||
const dx = +tr[0] - d3.event.x,
|
const dx = +tr[0] - d3.event.x,
|
||||||
|
|
@ -284,7 +239,9 @@ function editBurg(id) {
|
||||||
alertMessage.innerHTML = /* html */ `Are you sure you want to remove ${
|
alertMessage.innerHTML = /* html */ `Are you sure you want to remove ${
|
||||||
basic || capital ? "all unlocked elements in the burg group" : "the entire burg group"
|
basic || capital ? "all unlocked elements in the burg group" : "the entire burg group"
|
||||||
}?
|
}?
|
||||||
<br />Please note that capital or locked burgs will not be deleted. <br /><br />Burgs to be removed: ${burgsToRemove.length}`;
|
<br />Please note that capital or locked burgs will not be deleted. <br /><br />Burgs to be removed: ${
|
||||||
|
burgsToRemove.length
|
||||||
|
}`;
|
||||||
$("#alert").dialog({
|
$("#alert").dialog({
|
||||||
resizable: false,
|
resizable: false,
|
||||||
title: "Remove burg group",
|
title: "Remove burg group",
|
||||||
|
|
@ -433,7 +390,8 @@ function editBurg(id) {
|
||||||
function addCustomMfcgLink() {
|
function addCustomMfcgLink() {
|
||||||
const id = +elSelected.attr("data-id");
|
const id = +elSelected.attr("data-id");
|
||||||
const burg = pack.burgs[id];
|
const burg = pack.burgs[id];
|
||||||
const message = "Enter custom link to the burg map. It can be a link to Medieval Fantasy City Generator or other tool. Keep empty to use MFCG seed";
|
const message =
|
||||||
|
"Enter custom link to the burg map. It can be a link to Medieval Fantasy City Generator or other tool. Keep empty to use MFCG seed";
|
||||||
prompt(message, {default: burg.link || "", required: false}, link => {
|
prompt(message, {default: burg.link || "", required: false}, link => {
|
||||||
if (link) burg.link = link;
|
if (link) burg.link = link;
|
||||||
else delete burg.link;
|
else delete burg.link;
|
||||||
|
|
@ -581,3 +539,48 @@ function editBurg(id) {
|
||||||
unselect();
|
unselect();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// in °C, array from -1 °C; source: https://en.wikipedia.org/wiki/List_of_cities_by_average_temperature
|
||||||
|
function getTemperatureLikeness(temperature) {
|
||||||
|
if (temperature < -5) return "Yakutsk";
|
||||||
|
const cities = [
|
||||||
|
"Snag (Yukon)",
|
||||||
|
"Yellowknife (Canada)",
|
||||||
|
"Okhotsk (Russia)",
|
||||||
|
"Fairbanks (Alaska)",
|
||||||
|
"Nuuk (Greenland)",
|
||||||
|
"Murmansk", // -5 - 0
|
||||||
|
"Arkhangelsk",
|
||||||
|
"Anchorage",
|
||||||
|
"Tromsø",
|
||||||
|
"Reykjavik",
|
||||||
|
"Riga",
|
||||||
|
"Stockholm",
|
||||||
|
"Halifax",
|
||||||
|
"Prague",
|
||||||
|
"Copenhagen",
|
||||||
|
"London", // 1 - 10
|
||||||
|
"Antwerp",
|
||||||
|
"Paris",
|
||||||
|
"Milan",
|
||||||
|
"Batumi",
|
||||||
|
"Rome",
|
||||||
|
"Dubrovnik",
|
||||||
|
"Lisbon",
|
||||||
|
"Barcelona",
|
||||||
|
"Marrakesh",
|
||||||
|
"Alexandria", // 11 - 20
|
||||||
|
"Tegucigalpa",
|
||||||
|
"Guangzhou",
|
||||||
|
"Rio de Janeiro",
|
||||||
|
"Dakar",
|
||||||
|
"Miami",
|
||||||
|
"Jakarta",
|
||||||
|
"Mogadishu",
|
||||||
|
"Bangkok",
|
||||||
|
"Aden",
|
||||||
|
"Khartoum"
|
||||||
|
]; // 21 - 30
|
||||||
|
if (temperature > 30) return "Mecca";
|
||||||
|
return cities[temperature + 5] || null;
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -480,10 +480,7 @@ function overviewBurgs(settings = {stateId: null, cultureId: null}) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function downloadBurgsData() {
|
function downloadBurgsData() {
|
||||||
let data = `Id,Burg,Province,Province Full Name,State,State Full Name,Culture,Religion,Population,X,Y,Latitude,Longitude,Elevation (${heightUnit.value}),Capital,Port,Citadel,Walls,Plaza,Temple,Shanty Town`; // headers
|
let data = `Id,Burg,Province,Province Full Name,State,State Full Name,Culture,Religion,Population,X,Y,Latitude,Longitude,Elevation (${heightUnit.value}),Temperature,Temperature likeness,Capital,Port,Citadel,Walls,Plaza,Temple,Shanty Town,Emblem,City Generator Link\n`; // headers
|
||||||
if (options.showMFCGMap) data += `,City Generator Link`;
|
|
||||||
data += "\n";
|
|
||||||
|
|
||||||
const valid = pack.burgs.filter(b => b.i && !b.removed); // all valid burgs
|
const valid = pack.burgs.filter(b => b.i && !b.removed); // all valid burgs
|
||||||
|
|
||||||
valid.forEach(b => {
|
valid.forEach(b => {
|
||||||
|
|
@ -504,6 +501,9 @@ function overviewBurgs(settings = {stateId: null, cultureId: null}) {
|
||||||
data += getLatitude(b.y, 2) + ",";
|
data += getLatitude(b.y, 2) + ",";
|
||||||
data += getLongitude(b.x, 2) + ",";
|
data += getLongitude(b.x, 2) + ",";
|
||||||
data += parseInt(getHeight(pack.cells.h[b.cell])) + ",";
|
data += parseInt(getHeight(pack.cells.h[b.cell])) + ",";
|
||||||
|
const temperature = grid.cells.temp[pack.cells.g[b.cell]];
|
||||||
|
data += convertTemperature(temperature) + ",";
|
||||||
|
data += getTemperatureLikeness(temperature) + ",";
|
||||||
|
|
||||||
// add status data
|
// add status data
|
||||||
data += b.capital ? "capital," : ",";
|
data += b.capital ? "capital," : ",";
|
||||||
|
|
@ -513,7 +513,9 @@ function overviewBurgs(settings = {stateId: null, cultureId: null}) {
|
||||||
data += b.plaza ? "plaza," : ",";
|
data += b.plaza ? "plaza," : ",";
|
||||||
data += b.temple ? "temple," : ",";
|
data += b.temple ? "temple," : ",";
|
||||||
data += b.shanty ? "shanty town," : ",";
|
data += b.shanty ? "shanty town," : ",";
|
||||||
if (options.showMFCGMap) data += getMFCGlink(b);
|
data += b.coa ? JSON.stringify(b.coa).replace(/"/g, "").replace(/,/g, ";") + "," : ",";
|
||||||
|
data += getMFCGlink(b);
|
||||||
|
|
||||||
data += "\n";
|
data += "\n";
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue